fix(tui): narrow /resume sources to human adapters

Follow-up on #13724: showing literally every source was too noisy.\n\n now fetches a wider window (, larger limit) and then filters to a curated allowlist of human-facing sources (tui/cli plus chat adapters like telegram/discord/slack/whatsapp/etc). This keeps row #7 fixed (telegram sessions visible in /resume) without surfacing internal source kinds such as tool/acp.
This commit is contained in:
Brooklyn Nicholson 2026-04-21 18:52:26 -05:00
parent 0dfb7b8a0d
commit bd046220b3
3 changed files with 104 additions and 90 deletions

View file

@ -1231,12 +1231,34 @@ def _(rid, params: dict) -> dict:
@method("session.list")
def _(rid, params: dict) -> dict:
try:
# Show sessions from every adapter — users resume telegram/discord/etc
# sessions by pasting the id directly, so the picker should surface them
# too. Children (subagents/compression runs) stay filtered out via the
# hermes_state default.
limit = params.get("limit", 20)
rows = _get_db().list_sessions_rich(source=None, limit=limit)
# Resume picker should include human conversation surfaces beyond
# tui/cli (notably telegram from blitz row #7), but avoid internal
# sources that clutter the modal (tool/acp/etc).
allow = frozenset(
{
"cli",
"tui",
"telegram",
"discord",
"slack",
"whatsapp",
"wecom",
"weixin",
"feishu",
"signal",
"mattermost",
"matrix",
"qq",
}
)
limit = int(params.get("limit", 20) or 20)
fetch_limit = max(limit * 5, 100)
rows = [
s
for s in _get_db().list_sessions_rich(source=None, limit=fetch_limit)
if (s.get("source") or "").strip().lower() in allow
][:limit]
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,