feat: load sessions from all Copilot CLI storage locations#82
Conversation
|
Thanks for pushing this — loading sessions from the additional Copilot CLI storage locations closes a real gap in AGENTVIZ, and the added functionality here is valuable. I pulled the branch locally and it is green ( 1. Shared sessions are discoverable but still not openable from the app (blocker)The backend now exposes shared sessions via What is broken
Please fix this end-to-end
2.
|
60b07de to
aff587f
Compare
|
Fixed in 4373648 -- all three points addressed. 1. Blocker (shared sessions openable): fetchSessionContent now branches on source: shared-file goes to /api/session/shared?path= and extracts .raw; shared-gist goes to /api/session/shared?gist= and extracts .raw; everything else uses existing /api/session?path=. App.jsx passes the full entry (not bare path) to fetchSessionContent, widens condition to include entry.gistId so gist entries (no path) are openable, and copies gistId into discoveredOnly. 2. Warning (path restriction): Exported isAllowedSharedPath() using isPathInsideRoot. Applied after realpathSync in the handler: files outside process.cwd() return 403. Four new tests: inside-cwd allows, outside-cwd rejects, sibling-prefix-of-cwd rejects, null-cwd returns false. 3. Warning (gist cache): Module-level _gistCache with 5-minute TTL in sharedSessions.js. findSharedSessionGists() returns cached results immediately on repeated /api/sessions polls; execFileSync only runs when cache is cold or stale. 786/786 tests pass. |
4373648 to
34530d2
Compare
34530d2 to
7b0c181
Compare
Enriches session discovery with metadata from session-store.db and data.db (model, reasoning effort, full summary, custom names). Discovers shared sessions from /share file (local markdown) and /share gist (GitHub gists). Adds shared-md format parser that converts Copilot CLI shared session markdown into normalized events. New files: - routes/sessionStoreReader.js -- reads session-store.db + data.db - routes/sharedSessions.js -- discovers shared markdown + gists - src/lib/sharedSessionParser.js -- client-side markdown parser - 3 test files with 27 new tests Closes jayparikh#81 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…tion, gist cache - useDiscoveredSessions: fetchSessionContent now branches on source for shared-file (GET /api/session/shared?path=) and shared-gist (GET /api/session/shared?gist=), extracting .raw from JSON response - App.jsx: pass full entry (not bare path) to fetchSessionContent for discovered sessions; widen condition to include entry.gistId so shared-gist entries (no path) are openable; copy gistId into discoveredOnly - routes/sessions.js: add isAllowedSharedPath() export and apply it to /api/session/shared?path= (rejects files outside process.cwd(), 403) - routes/sharedSessions.js: cache findSharedSessionGists() results with 5-minute TTL to avoid blocking the event loop on every /api/sessions poll - tests: 4 new isAllowedSharedPath cases (inside cwd, outside cwd, sibling-prefix rejection, null cwd) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
7b0c181 to
cbbd1fa
Compare
Summary
Enables AGENTVIZ to load sessions from all three Copilot CLI storage locations, not just local JSONL files.
New session sources:
Session store enrichment -- reads
~/.copilot/session-store.dband~/.copilot/data.dbto enrich discovered sessions with: full summary, model name, reasoning effort, custom title (from/rename), repo, branch, turn count. Surfaces store-only sessions that haveevents.jsonlbut weren't found by the file scanner.Shared session discovery -- finds
copilot-session-*.mdfiles in cwd (from/share file) and secret GitHub gists (from/share gistviagh gist list).Shared markdown parser -- new format parser that converts Copilot CLI
/sharemarkdown into normalized events. Supports drag-and-drop of.mdfiles. Auto-detected byparseSession.ts.Files changed (9)
/api/sessions, adds/api/session/sharedendpointshared-mdformat, routes to new parsershared-mdto SessionFormat typeTests
All 590 tests pass (567 existing + 23 new).
References
Closes #81