feat(v0.3): O2 — resume past Claude sessions

- src/http/history.ts: listSessions() reads ~/.claude/projects/*/*.jsonl
  (mtime-sorted, top 50), parseSessionMeta() extracts cwd + first user prompt
  (pure, 4 unit tests); GET /sessions
- terminal-session: opts.initialInput (typed ~700ms after the shell is ready)
- tabs.newTabForResume(cwd,id): new tab in the project dir running
  'claude --resume <id>'
- public/history.ts: 🕘 panel listing sessions (project · time · preview) with
  Resume buttons
- Verified: /sessions returns 44 real sessions; panel lists project/time/preview.
  216 tests green.
This commit is contained in:
Yaojia Wang
2026-06-18 08:04:04 +02:00
parent 25269cad3f
commit e36ca272ed
8 changed files with 366 additions and 1 deletions

View File

@@ -17,6 +17,7 @@ import { mountSearch } from './search.js'
import { mountQrConnect } from './qr.js'
import { mountSettings, loadSettings, type Settings } from './settings.js'
import { mountDashboard } from './dashboard.js'
import { mountHistory } from './history.js'
const paneHost = document.getElementById('term')
const tabs = document.getElementById('tabs')
@@ -51,6 +52,9 @@ mountDashboard(toolbar, {
snapshot: () => app.snapshot(),
focus: (idx) => app.focusTab(idx),
})
mountHistory(toolbar, {
resume: (cwd, id) => app.newTabForResume(cwd, id),
})
mountQrConnect(toolbar)
// PWA: register the service worker (installable + offline shell, M4).