fix(web): the session inventory lists only the keys the chat can open
The sidebar grouped everything that was not `interactive:` under "other keys", minus the phone's status keys. That included the coding jobs' `job:<instance>#<id>` keys and forge keys — and those are dead ends: the message, event and history routes answer only for the resident prefixes (`is_resident_key`), so opening one 400s and the row sits there looking busy with nothing inside. A finished job's key was worse than useless while its dispatch spun: `reacquire`, forever. `isResidentKey` names the rule once, beside `isInteractive` — `interactive:`, `task:`, `calendar:` — and the inventory filters on it. That leaves the phone's keys out as before, keeps scheduled tasks (their turns have real transcripts), and stops offering keys the chat surface cannot address. The shell's `nextActiveKey` follows the same rule: after a delete the chat moves to the next key it can open, or to none. The full list stays on the wire — the API's inventory is the dispatcher's, not the client's, and the delete route still answers for any key with a record. Consequence worth naming: a `job:` or forge key has no row now, so it cannot be deleted from the sidebar either.
This commit is contained in:
1 parent
bb475856a0
commit
b3bb026fab
4 files changed
+28
-9
No files matched your search
@@ -7,7 +7,7 @@
|
||||
// new key lands in the inventory. The delete button asks nothing itself
|
||||
// — the confirmation, which names the transcript that goes with the
|
||||
// session, is the shell's.
|
||||
import { SESSION_NAME_PATTERN } from '~/composables/useClaw'
|
||||
import { SESSION_NAME_PATTERN, isResidentKey } from '~/composables/useClaw'
|
||||
import type { ClawSession } from '~/composables/useClaw'
|
||||
|
||||
const props = defineProps<{
|
||||
@@ -32,10 +32,15 @@ interface Group {
|
||||
|
||||
const groups = computed<Group[]>(() => {
|
||||
const byKey = (a: ClawSession, b: ClawSession) => a.key.localeCompare(b.key)
|
||||
// `phone:<device>:<topic>` keys carry the phone client's status
|
||||
// reporting (battery, network, dnd), not conversation; the inventory
|
||||
// Only the resident prefixes are chat sessions: `interactive:` is the
|
||||
// live chat surface, `task:` a scheduled task's own turn, `calendar:` a
|
||||
// reminder's. The rest of the inventory has no transcript to open —
|
||||
// `phone:<device>:<topic>` is status reporting, `job:<instance>#<id>`
|
||||
// is the coding jobs' bookkeeping, a forge key is a thread the handler
|
||||
// reports on — and the daemon's message, event and history routes
|
||||
// refuse those prefixes, so a row for one is a dead end. The inventory
|
||||
// hides them rather than the API narrowing.
|
||||
const conversable = props.sessions.filter((session) => !session.key.startsWith('phone:'))
|
||||
const conversable = props.sessions.filter((session) => isResidentKey(session.key))
|
||||
const interactive = conversable
|
||||
.filter((session) => session.key.startsWith('interactive:'))
|
||||
.sort(byKey)
|
||||
|
||||
Reference in new issue
Block a user