forked from vhaudiquet/rhema-claw
feat(web/claw): list every key and control its dispatch
The sidebar listed only the resident prefixes. The phone's status keys, the coding jobs' `job:<instance>#<id>` keys and the forge threads were on the wire and invisible in the client: an operator watching a job fill a queue had no row to look at, let alone act on. *Others* now carries the whole inventory, folded to the working count as before and every row listed unfolded. A row the chat cannot open is a control row — the resident prefixes are the only ones with a transcript — so it renders as a disabled entry rather than a dead click-through, and it keeps the status dot, the held badge and the depth that every row has. Beside the delete button, on hover: `hold` posts the pause and the row badges `held` in the warn tone, `run` posts the resume, `stop` posts the abort. `stop` is disabled when there is neither a live turn nor queued work, so an idle row sends nothing instead of collecting a no-op answer. What the abort did reads in the notice — the turn stopped, N queued items dropped, or nothing running — straight from the answer's `cut` and `dropped`. An aborted turn renders in the warn tone too: cut by the operator, not failed, and unlike a steered turn nothing replaces it. The About page's route list gains the three, and the README's inventory and delete paragraphs follow the fold and the controls. nuxt typecheck and build pass; checked against a mock daemon on a seeded store, folded and unfolded, with a held row, a queued job and an aborted turn.
This commit is contained in:
1 parent
38292b6344
commit
dc269472eb
6 files changed
+224
-16
No files matched your search
@@ -490,7 +490,11 @@ function streamTone(status: StreamStatus): 'ok' | 'warn' | 'error' {
|
||||
<div
|
||||
v-if="item.turn.outcome"
|
||||
class="outcome mono"
|
||||
:class="{ failed: item.turn.outcome === 'failed', steered: item.turn.outcome === 'steered' }"
|
||||
:class="{
|
||||
failed: item.turn.outcome === 'failed',
|
||||
steered: item.turn.outcome === 'steered',
|
||||
aborted: item.turn.outcome === 'aborted',
|
||||
}"
|
||||
>
|
||||
{{ item.turn.outcome }}
|
||||
</div>
|
||||
@@ -759,6 +763,13 @@ function streamTone(status: StreamStatus): 'ok' | 'warn' | 'error' {
|
||||
color: var(--accent-text);
|
||||
}
|
||||
|
||||
/* An aborted turn: stopped from the controls, and nothing replaced
|
||||
it. Not a failure either — the same warn tone the held badge
|
||||
carries, which is what an operator's stop is. */
|
||||
.outcome.aborted {
|
||||
color: var(--warn);
|
||||
}
|
||||
|
||||
/* While the turn runs but no reply text has landed yet. Tool rows and
|
||||
the thinking trace never render on this surface, so this line is the
|
||||
turn's only pulse between its first event and its first delta — the
|
||||
|
||||
@@ -10,7 +10,16 @@
|
||||
//
|
||||
// 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.
|
||||
// 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.
|
||||
//
|
||||
// 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
|
||||
// live turn, or drops the key's queued work when none runs. Nothing
|
||||
// here is destructive beyond the delete, which keeps its own dialog.
|
||||
import { SESSION_NAME_PATTERN, isResidentKey } from '~/composables/useClaw'
|
||||
import type { ClawSession } from '~/composables/useClaw'
|
||||
|
||||
@@ -27,11 +36,24 @@ const emit = defineEmits<{
|
||||
refresh: []
|
||||
create: [name: string]
|
||||
delete: [key: string]
|
||||
pause: [key: string]
|
||||
resume: [key: string]
|
||||
abort: [key: string]
|
||||
}>()
|
||||
|
||||
interface Group {
|
||||
label: string
|
||||
rows: { key: string; name: string; session: ClawSession }[]
|
||||
rows: {
|
||||
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
|
||||
}[]
|
||||
/** How many rows hold a lease; the others' header shows the count. */
|
||||
working: number
|
||||
/** Whether the rows fold away until the toggle says otherwise. */
|
||||
@@ -42,23 +64,25 @@ 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 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.
|
||||
// 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
|
||||
.filter((session) => session.key.startsWith('interactive:'))
|
||||
.sort(byKey)
|
||||
const others = conversable
|
||||
const others = props.sessions
|
||||
.filter((session) => !session.key.startsWith('interactive:'))
|
||||
.sort(byKey)
|
||||
const row = (session: ClawSession) => ({
|
||||
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[]) =>
|
||||
sessions.filter((session) => session.state === 'leased').length
|
||||
@@ -205,13 +229,48 @@ watch(
|
||||
:class="{ active: row.key === activeKey }"
|
||||
:title="row.key"
|
||||
>
|
||||
<button class="entry" @click="$emit('select', row.key)">
|
||||
<button
|
||||
class="entry"
|
||||
:disabled="!row.selectable"
|
||||
@click="$emit('select', row.key)"
|
||||
>
|
||||
<StatusDot :tone="stateTone(row.session.state)" />
|
||||
<span class="name">{{ row.name }}</span>
|
||||
<span
|
||||
v-if="row.session.paused"
|
||||
class="held"
|
||||
title="dispatch held: nothing runs until resume"
|
||||
>
|
||||
held
|
||||
</span>
|
||||
<span v-if="row.session.inbox_depth > 0" class="depth" title="inbox depth">
|
||||
{{ row.session.inbox_depth }}
|
||||
</span>
|
||||
</button>
|
||||
<button
|
||||
v-if="row.session.paused"
|
||||
class="ghost act"
|
||||
:title="`resume ${row.key}`"
|
||||
@click.stop="$emit('resume', row.key)"
|
||||
>
|
||||
run
|
||||
</button>
|
||||
<button
|
||||
v-else
|
||||
class="ghost act"
|
||||
:title="`pause ${row.key}`"
|
||||
@click.stop="$emit('pause', row.key)"
|
||||
>
|
||||
hold
|
||||
</button>
|
||||
<button
|
||||
class="ghost act stop"
|
||||
:disabled="!row.abortable"
|
||||
:title="`abort ${row.key}`"
|
||||
@click.stop="$emit('abort', row.key)"
|
||||
>
|
||||
stop
|
||||
</button>
|
||||
<button
|
||||
class="ghost remove"
|
||||
aria-label="delete session"
|
||||
@@ -390,6 +449,27 @@ watch(
|
||||
font-weight: inherit;
|
||||
}
|
||||
|
||||
.row .act {
|
||||
flex: none;
|
||||
padding: 0 4px;
|
||||
font-size: 11px;
|
||||
font-family: var(--mono);
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.row .act.stop {
|
||||
color: var(--error);
|
||||
}
|
||||
|
||||
.row .act:disabled {
|
||||
color: var(--text3);
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.entry:disabled {
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.row .remove {
|
||||
flex: none;
|
||||
padding: 0 5px;
|
||||
@@ -397,12 +477,25 @@ watch(
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.row:hover .act,
|
||||
.row:hover .remove,
|
||||
.row:focus-within .act,
|
||||
.row:focus-within .remove,
|
||||
.row.active .act,
|
||||
.row.active .remove {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.held {
|
||||
flex: none;
|
||||
font-size: 10px;
|
||||
font-family: var(--mono);
|
||||
color: var(--warn);
|
||||
border: 1px solid var(--border-strong);
|
||||
border-radius: 999px;
|
||||
padding: 0 5px;
|
||||
}
|
||||
|
||||
.name {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
|
||||
@@ -14,6 +14,9 @@ const routes = [
|
||||
{ method: 'GET', path: '/v1/sessions', note: 'the dispatch-key inventory' },
|
||||
{ method: 'POST', path: '/v1/sessions', note: 'create an interactive session from a name' },
|
||||
{ method: 'DELETE', path: '/v1/sessions/{key}', note: 'delete a session and its turn history' },
|
||||
{ method: 'POST', path: '/v1/sessions/{key}/pause', note: "hold a key's dispatch" },
|
||||
{ method: 'POST', path: '/v1/sessions/{key}/resume', note: 'lift the hold' },
|
||||
{ method: 'POST', path: '/v1/sessions/{key}/abort', note: 'cut the live turn, or drop the queue' },
|
||||
{ method: 'POST', path: '/v1/sessions/{key}/messages', note: 'message ingest, 202 + stream' },
|
||||
{ method: 'GET', path: '/v1/sessions/{key}/events', note: 'the turn-event stream (SSE)' },
|
||||
{ method: 'POST', path: '/v1/consents/{id}', note: 'answer a consent (a secret or a grant)' },
|
||||
|
||||
Reference in new issue
Block a user