Skip to content

feat: View all in folder modal for Resume Conversation#94

Merged
Ark0N merged 1 commit into
Ark0N:masterfrom
TeigenZhang:feat/folder-history-modal
May 19, 2026
Merged

feat: View all in folder modal for Resume Conversation#94
Ark0N merged 1 commit into
Ark0N:masterfrom
TeigenZhang:feat/folder-history-modal

Conversation

@TeigenZhang
Copy link
Copy Markdown
Contributor

Summary

The homepage Resume Conversation list dedups history at 3 sessions per project so the top of the page doesn't get dominated by a single hot folder. But once you want to dig into a specific project's older conversations, there is no drill-down — they're hidden.

This adds a "View all in this folder" action that opens a modal listing the complete history for a single project, paginated.

Changes

Backend (src/web/routes/session-routes.ts)

GET /api/history/sessions now accepts:

  • projectKey — restrict to a single project
  • offset / limit — pagination

Single-folder mode bypasses the 50-cap and returns { sessions, total }.

projectKey is validated against ^[A-Za-z0-9_-]+$ before any filesystem lookup, so the parameter cannot be used for path traversal.

Frontend (src/web/public/terminal-ui.js, styles.css)

  • The history-item detail panel gains a "View all in this folder" button when projectKey is present.
  • Clicking it opens a modal listing 20 sessions per page with a "Show more" button for pagination.
  • Modal items reuse _buildHistoryItem with showViewAll: false to avoid recursive entry points.

Test plan

  • tsc --noEmit passes
  • npm run lint passes
  • npm run format:check passes
  • Manual: open Resume Conversation, expand a project with >3 sessions, click "View all in this folder", verify modal lists more than 3 sessions and pagination works.
  • Manual: confirm modal items do NOT render their own "View all" button (no recursion).
  • Security: requests with projectKey=../../etc are rejected by the regex before reaching the filesystem.

Drill into a single project's complete history when the homepage's
3-per-project dedup hides older conversations.

- Backend: /api/history/sessions accepts projectKey/offset/limit;
  single-folder mode bypasses the 50-cap and returns { sessions, total }.
  projectKey is validated against ^[A-Za-z0-9_-]+$ to prevent traversal.
- Frontend: detail panel adds "View all in this folder" button that
  opens a modal listing 20 sessions per page with Show more pagination.
- Modal items reuse _buildHistoryItem with showViewAll:false to avoid
  recursive entry points.
@Ark0N
Copy link
Copy Markdown
Owner

Ark0N commented May 19, 2026

Great input — thank you! Nice refactor: extracting scanProjectDir keeps the global and drill-down code paths in sync, and the projectKey regex closes path traversal before the filesystem call. The recursion guard via showViewAll: false is a clean way to reuse _buildHistoryItem inside the modal. Merging.

@Ark0N Ark0N merged commit d27f8e7 into Ark0N:master May 19, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants