From 304f1463a9aae82ec4fce47d4da9dabfd0598d70 Mon Sep 17 00:00:00 2001 From: jonny Date: Thu, 9 Apr 2026 12:17:55 +0000 Subject: [PATCH] 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 --- tui_gateway/server.py | 10 ++++++++-- ui-tui/src/components/sessionPicker.tsx | 3 ++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/tui_gateway/server.py b/tui_gateway/server.py index c204e1904..e53694d1d 100644 --- a/tui_gateway/server.py +++ b/tui_gateway/server.py @@ -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: diff --git a/ui-tui/src/components/sessionPicker.tsx b/ui-tui/src/components/sessionPicker.tsx index 9b5750b09..a793e52a5 100644 --- a/ui-tui/src/components/sessionPicker.tsx +++ b/ui-tui/src/components/sessionPicker.tsx @@ -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({ {' '} - ({s.message_count} msgs, {age(s.started_at)}) + ({s.message_count} msgs, {age(s.started_at)}{s.source && s.source !== 'tui' ? `, ${s.source}` : ''}) )