Skip to content

Add cross-session search: federated GET /api/search + history-panel search box#133

Open
aakhter wants to merge 2 commits into
Ark0N:masterfrom
aakhter:cod-113-cross-session-search
Open

Add cross-session search: federated GET /api/search + history-panel search box#133
aakhter wants to merge 2 commits into
Ark0N:masterfrom
aakhter:cod-113-cross-session-search

Conversation

@aakhter

@aakhter aakhter commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

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.ts core plus GET /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: clean
  • test/search-service.test.ts: 14/14
  • test/routes/search-routes.test.ts: 10/10 (inject real GET /api/search requests)
  • npm run build: passes

aakhter added 2 commits June 19, 2026 12:35
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).
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.

1 participant