forked from vhaudiquet/rhema-claw
feat(web/claw): open every key, read-only when it has no stream
Every row in the sidebar was disabled unless its key started with a resident prefix, so a forge thread or a finished job could only be paused or aborted, never read. Now every row opens. A resident key subscribes as before. Any other key loads the snapshot its history route serves, which carries `read_only`; the header says `snapshot` instead of claiming a live stream, and the composer becomes a line saying why there is none. The mirror is the same one the stream feeds, so paging, outcomes, and the turn renderer come for free. That view has no stream to tell it a dispatch ran, so the inventory's revision drives reloads: a poll that sees it move fetches the newest page again, and nothing else does, so the pages a reader walked back to survive polling. `phone:` joins the client's resident prefixes, which the daemon already carried: those rows were dead ends that refused the message the phone client sends every day. The user label follows the key: a chat or phone key's rows are the human's, any other key's are the prompt its dispatch started with.
This commit is contained in:
1 parent
8d7dc7c4c7
commit
1a1ace014a
5 files changed
+153
-49
No files matched your search
@@ -10,11 +10,11 @@
|
||||
//
|
||||
// The non-interactive keys fold under *others*: folded (the default),
|
||||
// the group shows only how many of them hold a lease, plus the
|
||||
// more/less toggle; unfolded it lists every row — all of them, the
|
||||
// whole inventory, not only the keys a transcript can open. A row the
|
||||
// chat cannot open (a forge thread, a coding job, a phone topic) is a
|
||||
// control row: pause/resume and abort act on its dispatch, and there
|
||||
// is no transcript to click into.
|
||||
// more/less toggle; unfolded it lists every row, the whole inventory.
|
||||
// Every row opens: a resident key streams, and any other key (a forge
|
||||
// thread, a coding job, a phone topic) opens the read-only snapshot its
|
||||
// history route serves. The controls beside it act on its dispatch from
|
||||
// either view.
|
||||
//
|
||||
// The controls sit beside the delete button, on hover, one word each:
|
||||
// hold/run pauses and resumes the key's dispatch, stop aborts — cuts a
|
||||
@@ -47,9 +47,6 @@ interface Group {
|
||||
key: string
|
||||
name: string
|
||||
session: ClawSession
|
||||
/** Whether the chat can open this key — the resident prefixes only.
|
||||
* A non-selectable row is a control row: it has no transcript. */
|
||||
selectable: boolean
|
||||
/** Whether abort has anything to act on: a live turn, or queued
|
||||
* work to drop. */
|
||||
abortable: boolean
|
||||
@@ -62,16 +59,13 @@ interface Group {
|
||||
|
||||
const groups = computed<Group[]>(() => {
|
||||
const byKey = (a: ClawSession, b: ClawSession) => a.key.localeCompare(b.key)
|
||||
// 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 — `phone:<device>:<topic>`
|
||||
// status reporting, `job:<instance>#<id>` bookkeeping, a forge thread —
|
||||
// has no transcript to open: the daemon's message, event and history
|
||||
// routes refuse those prefixes, so a row for one is a dead end. The
|
||||
// others group still lists them all: the inventory shows every key,
|
||||
// and a dead-end row is a control row, not a hidden one.
|
||||
const conversable = props.sessions.filter((session) => isResidentKey(session.key))
|
||||
const interactive = conversable
|
||||
// The resident prefixes are the chat sessions: `interactive:` is the
|
||||
// live chat surface, `task:` a scheduled task's own turn, `phone:` the
|
||||
// phone client's, `calendar:` a reminder's. The rest of the inventory —
|
||||
// `job:<instance>#<id>`, a forge thread — holds no turn record: its
|
||||
// handler never streams. Its history route serves the session stash
|
||||
// instead, so the row still opens, read-only.
|
||||
const interactive = props.sessions
|
||||
.filter((session) => session.key.startsWith('interactive:'))
|
||||
.sort(byKey)
|
||||
const others = props.sessions
|
||||
@@ -81,7 +75,6 @@ const groups = computed<Group[]>(() => {
|
||||
key: session.key,
|
||||
name: session.key.replace(/^interactive:/, ''),
|
||||
session,
|
||||
selectable: isResidentKey(session.key),
|
||||
abortable: session.state === 'leased' || session.inbox_depth > 0,
|
||||
})
|
||||
const working = (sessions: ClawSession[]) =>
|
||||
@@ -104,9 +97,19 @@ const groups = computed<Group[]>(() => {
|
||||
return groups
|
||||
})
|
||||
|
||||
/** Whether the others group is folded out; it starts folded. */
|
||||
/** Whether the others group is folded out; it starts folded, and opens
|
||||
* when the chat opens a row that lives in it — otherwise the selection
|
||||
* would be invisible. */
|
||||
const othersOpen = ref(false)
|
||||
|
||||
watch(
|
||||
() => props.activeKey,
|
||||
(key) => {
|
||||
if (key !== '' && !isResidentKey(key)) othersOpen.value = true
|
||||
},
|
||||
{ immediate: true },
|
||||
)
|
||||
|
||||
const shownCount = computed(() =>
|
||||
groups.value.reduce((total, group) => total + group.rows.length, 0),
|
||||
)
|
||||
@@ -229,11 +232,7 @@ watch(
|
||||
:class="{ active: row.key === activeKey }"
|
||||
:title="row.key"
|
||||
>
|
||||
<button
|
||||
class="entry"
|
||||
:disabled="!row.selectable"
|
||||
@click="$emit('select', row.key)"
|
||||
>
|
||||
<button class="entry" @click="$emit('select', row.key)">
|
||||
<StatusDot :tone="stateTone(row.session.state)" />
|
||||
<span class="name">{{ row.name }}</span>
|
||||
<span
|
||||
|
||||
Reference in new issue
Block a user