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

@@ -253,6 +253,73 @@ html, body {
font-weight: 600;
}
/* History / resume modal (O2) */
#historymodal {
position: fixed;
inset: 0;
z-index: 1200;
display: flex;
align-items: flex-start;
justify-content: center;
padding-top: 56px;
background: rgba(0, 0, 0, 0.6);
}
.hist-card {
background: #222;
border: 1px solid #3a3a3a;
border-radius: 10px;
min-width: 360px;
max-width: 92vw;
max-height: 72vh;
overflow-y: auto;
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}
.hist-title {
padding: 12px 16px;
font-weight: 600;
color: #fff;
border-bottom: 1px solid #3a3a3a;
}
.hist-empty {
padding: 16px;
color: #aaa;
}
.hist-row {
display: flex;
align-items: center;
gap: 10px;
padding: 10px 16px;
border-bottom: 1px solid #2a2a2a;
}
.hist-main {
flex: 1 1 auto;
min-width: 0;
}
.hist-proj {
color: #fff;
font-size: 13px;
}
.hist-prev {
color: #aaa;
font-size: 12px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.hist-resume {
flex: none;
background: #2ea043;
color: #fff;
border: none;
border-radius: 5px;
padding: 6px 14px;
cursor: pointer;
font: inherit;
}
.hist-resume:hover {
background: #3fb950;
}
.tab {
display: flex;
align-items: center;