fix(tui): show CLI sessions in resume picker

- session.list RPC now queries both tui and cli sources, merged by recency
- Session picker shows source label for non-tui sessions (e.g. ", cli")
- Added source field to SessionItem interface
This commit is contained in:
jonny 2026-04-09 12:17:55 +00:00
parent 294c377c0c
commit 304f1463a9
2 changed files with 10 additions and 3 deletions

View file

@ -449,10 +449,16 @@ def _(rid, params: dict) -> dict:
@method("session.list")
def _(rid, params: dict) -> dict:
try:
rows = _get_db().list_sessions_rich(source="tui", limit=params.get("limit", 20))
db = _get_db()
# Show both TUI and CLI sessions — TUI is the successor to the CLI,
# so users expect to resume their old CLI sessions here too.
tui = db.list_sessions_rich(source="tui", limit=params.get("limit", 20))
cli = db.list_sessions_rich(source="cli", limit=params.get("limit", 20))
rows = sorted(tui + cli, key=lambda s: s.get("started_at") or 0, reverse=True)[:params.get("limit", 20)]
return _ok(rid, {"sessions": [
{"id": s["id"], "title": s.get("title") or "", "preview": s.get("preview") or "",
"started_at": s.get("started_at") or 0, "message_count": s.get("message_count") or 0}
"started_at": s.get("started_at") or 0, "message_count": s.get("message_count") or 0,
"source": s.get("source") or ""}
for s in rows
]})
except Exception as e:

View file

@ -10,6 +10,7 @@ interface SessionItem {
preview: string
started_at: number
message_count: number
source?: string
}
function age(ts: number): string {
@ -109,7 +110,7 @@ export function SessionPicker({
</Text>
<Text color={t.color.dim}>
{' '}
({s.message_count} msgs, {age(s.started_at)})
({s.message_count} msgs, {age(s.started_at)}{s.source && s.source !== 'tui' ? `, ${s.source}` : ''})
</Text>
</Text>
)