Repository navigation
feat(terminal): find bar over the scrollback, and opt-in saved history search - #842
opticon454 wants to merge 1 commit into
Conversation
…y search Find bar (Ctrl/Cmd+Shift+F, on by default, Settings > terminalFindEnabled) searches the live xterm scrollback with @xterm/addon-search. Saved history search (transcriptSearchEnabled, off by default) saves each live session as plain text under ~/.codeman/transcripts, searches it from the same box, shows a hit with 20 lines of context and a Copy button, and deletes it with the session, on a startup sweep, from Settings (Clear saved) and when the setting is switched off. A local Claude session is saved from its conversation file, because Claude's fullscreen UI keeps its older text in its own scrollback and the terminal holds only the screen; other CLIs are saved from the pane scrollback. Files are 0600 in a 0700 folder, never read by /api/v1/search, and the file routes refuse the folder as sensitive.
|
Thank you for this PR. It adds a Open question (for the maintainer, not for you to resolve)Should saved history be a second copy on disk that a timer refreshes, or a search that reads the live sources when the user searches (the tail of the Claude conversation file, or one async SplittingThe find bar does not depend on the store, so if you move it into its own PR it does not have to wait for that question. It needs two changes.
Saved history, if it keeps its current shapeThese apply only if the copy on disk stays.
Smaller items, which can also be done at merge time:
NextThe saved-history half waits on the open question above. The find bar items apply either way, so a separate find bar PR with the two changes under Splitting can be reviewed without waiting for it. Thanks again for the careful work on the store's lifecycle and the docs. |
|
Thanks for the careful review. I have split the find bar out as #843, with both requested changes (the rebindable I am holding the saved history work here until you have answered the open question about a copy on disk versus reading the live sources on search. The other saved-history items (the delete buttons not sticking, only the current Claude conversation being kept, the multi-user tests, reusing the edit-history locator, the docs and the smaller items) will be done once that is settled. When #843 merges I will rebase this PR onto it so it carries only the saved history. |
What
Two ways to find text from earlier in a session, without asking the AI to recall it.
Ctrl/Cmd+Shift+F, on by default (terminalFindEnabled, Settings; an absent key means on). Uses@xterm/addon-search, bundled like the other xterm addons.transcriptSearchEnabled, default off, Settings > Cross-session features). While on, each live session is saved as plain text and searched from the same box: the find bar searches the terminal as you type and the saved copy a moment later, and the count says where a match is ("Not in terminal, 1 in history"). A hit opens in place with 20 lines of context and a Copy button.Why a saved copy
Claude Code's fullscreen UI keeps its older text in its own scrollback, so the xterm buffer holds only the screen and the find bar cannot see it. A local Claude session is therefore saved from its conversation file (your prompts, Claude's text, one line per tool call; no tool results or thinking). Other CLIs are saved from the tmux pane scrollback, which is as deep as that CLI leaves it.
Storage and clearing
Off means no files. Files are
~/.codeman/transcripts/<sessionId>.txt(folder 0700, file 0600, newest 16 MiB, written through tmp and rename), the same pattern as the agent inbox snapshot. They are deleted with the session (the edit-history deletion call sites), by a startup sweep, by Settings > Clear saved history, and by switching the setting off. They are never fed to/api/v1/search, andsensitive-path.tskeeps the file viewer off the folder.Known limit
Because a fullscreen CLI keeps its older text itself, Find in terminal can only reach text that is on screen. When it cannot, the toast says why, and the expanded hit and Copy are the way to read it. Scrolling the CLI's own view from the find bar is not done.
API
GET /api/sessions/:id/transcript/search,GET /api/sessions/:id/transcript/lines,DELETE /api/sessions/:id/transcript,DELETE /api/transcripts(admin only in multi-user mode). Documented indocs/api-reference.mdanddocs/wiki/Settings-Reference.md.Testing
New tests:
transcript-store,transcript-recorder,transcript-routes,claude-transcript-text,terminal-find.npm run typecheck, eslint andformat:checkare clean. Fullnpm teston a rebased tree: 17348 passed, 1 failed,test/remote-pane-command-shell.test.ts"starts /bin/sh when SHELL is unset", which fails identically on a cleanupstream/masterand is unrelated. Also driven in headless Chromium against a running server (open, type, hit, expand, copy, clear, Esc).No changeset added (generated at release).