Add cross-session search: federated GET /api/search + history-panel search box#133
Open
aakhter wants to merge 2 commits into
Open
Add cross-session search: federated GET /api/search + history-panel search box#133aakhter wants to merge 2 commits into
aakhter wants to merge 2 commits into
Conversation
Bounded federated search over in-memory stores (sessions/cases, run-summary events, file paths). Zod-validated query (q 1-200 chars, types csv, limit 1-60), grouped session->event->file with exact-match-first + recency tiebreak, total cap 60 + per-group cap 25, snippet cap 200, path-safety (relativePath only). Frontend search box (history panel) deferred to next cycle; resume/history-prompt text matching deferred to v1.1 (lives in large on-disk files, out of v1 bounded scope). New: src/search-service.ts (pure core), src/types/search.ts, src/web/routes/search-routes.ts. Tests: test/search-service.test.ts (14), test/routes/search-routes.test.ts (10).
Search box + grouped result cards + filters folded into the welcome/history panel, wired to GET /api/search. Debounced query (250ms), type-filter chips (session/event/file), client-side case/status/date filters, grouped cards (badge, name, timestamp, snippet) with jump-to (session->selectSession, run-summary->openRunSummary, file-preview->openFilePreview), empty-state + truncated notice. All result text via textContent (no XSS surface). Files: index.html (panel markup), terminal-ui.js (search mixin + initSearchPanel), styles.css (.search-* styles).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a bounded, federated cross-session search across the in-memory stores, so you can find a session, a run-summary event, or a file path from one search box without opening each session.
Backend: a new pure
search-service.tscore plusGET /api/search?q=&types=&limit=(Zod-validated). It searches sessions/cases, run-summary events, and file paths; groups results session > event > file with exact-match-first and a recency tiebreak; caps total at 60, per-group at 25, and snippet length at 200 chars; and is path-safe (returns relativePath only, never absolute paths).Frontend: a search box folded into the welcome/history panel, with a debounced query (250ms), type-filter chips (session/event/file), client-side case/status/date filters, and grouped result cards (badge, name, timestamp, snippet) with jump-to (session, run-summary, file preview). All result text is rendered via textContent, so there is no HTML injection surface.
Resume/history-prompt full-text matching (over large on-disk transcript files) is intentionally out of scope here and left as a follow-up.
Files
New:
src/search-service.ts,src/types/search.ts,src/web/routes/search-routes.ts,test/search-service.test.ts,test/routes/search-routes.test.ts.Wiring: type and route barrels,
schemas.ts(query schema),server.ts(route registration).Frontend:
index.html,styles.css,terminal-ui.js.Testing
tsc --noEmit: cleantest/search-service.test.ts: 14/14test/routes/search-routes.test.ts: 10/10 (inject real GET /api/search requests)npm run build: passes