forked from vhaudiquet/rhema-together
feat(web): add live activity status and collapse turn details
The composer now has one status line for `Rhema is working...` and typing peers. It replaces the separate typing paragraph. A running turn no longer adds a transcript card. When it ends, the log shows a collapsed `rhema finished · N steps` line. Thinking, draft text, tool calls, and usage live inside it. The event replay starts at the oldest loaded message so completed turns rebuild after a reload.
This commit is contained in:
1 parent
36de0aace7
commit
7f494b28de
4 files changed
+122
-82
No files matched your search
@@ -318,13 +318,11 @@ for agent messages, the turn. Images and pastes ride the message row;
|
|||||||
the bytes are served from a room route, and vision models get inline
|
the bytes are served from a room route, and vision models get inline
|
||||||
image blocks the way the claw already sends them.
|
image blocks the way the claw already sends them.
|
||||||
|
|
||||||
Tool calls render as collapsed cards inside the turn: the command, the
|
A running turn has no transcript card. The status line above the composer
|
||||||
exit code, and the output tail. The agent's draft text renders as a
|
shows `Rhema is working...` until `turn_end`. When the turn ends, the log
|
||||||
collapsed "working" strip and is marked interrupted when a step dies.
|
gets one collapsed line: `rhema finished · 3 steps`. Expanding it shows the
|
||||||
|
draft text, thinking, tool calls, and usage. Nothing from the model stream
|
||||||
A turn is a visual block: started by `<name>`, a spinner while running,
|
is visible by default. The summary line is per turn, not per message.
|
||||||
the agent's messages inside it, and a footer with steps, tokens, and
|
|
||||||
cost. The footer is per turn, not per message.
|
|
||||||
|
|
||||||
### Preview
|
### Preview
|
||||||
|
|
||||||
@@ -422,6 +420,10 @@ WebSocket frames: join, leave, typing, open file and selection, active
|
|||||||
terminal tab, preview port. TTL plus heartbeat. Presence is never written
|
terminal tab, preview port. TTL plus heartbeat. Presence is never written
|
||||||
to the room log, and join and leave do not enter the model's history.
|
to the room log, and join and leave do not enter the model's history.
|
||||||
|
|
||||||
|
The line above the composer shows `Sam is typing...`, or the names of two
|
||||||
|
people, or `Several people are typing...`. A running turn adds
|
||||||
|
`Rhema is working...` in the same status area. Both states are ephemeral.
|
||||||
|
|
||||||
Cursors are the end goal. With a read-only editor they start as
|
Cursors are the end goal. With a read-only editor they start as
|
||||||
selection highlights, which needs no editing protocol.
|
selection highlights, which needs no editing protocol.
|
||||||
|
|
||||||
|
|||||||
+57
-34
@@ -930,6 +930,48 @@ button {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.activity {
|
.activity {
|
||||||
|
min-width: 0;
|
||||||
|
color: var(--muted);
|
||||||
|
font-size: var(--fs-small);
|
||||||
|
}
|
||||||
|
|
||||||
|
.activity-summary {
|
||||||
|
cursor: pointer;
|
||||||
|
padding: var(--sp-1) 0;
|
||||||
|
color: var(--faint);
|
||||||
|
line-height: var(--lh-body);
|
||||||
|
}
|
||||||
|
|
||||||
|
.activity-summary:hover {
|
||||||
|
color: var(--text);
|
||||||
|
}
|
||||||
|
|
||||||
|
.activity-label {
|
||||||
|
margin-right: var(--sp-1);
|
||||||
|
color: var(--accent);
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.activity-result {
|
||||||
|
color: var(--muted);
|
||||||
|
}
|
||||||
|
|
||||||
|
.activity-state {
|
||||||
|
color: var(--faint);
|
||||||
|
}
|
||||||
|
|
||||||
|
.activity-state::before,
|
||||||
|
.activity-error::before {
|
||||||
|
content: "·";
|
||||||
|
margin: 0 var(--sp-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.activity-error {
|
||||||
|
color: var(--danger);
|
||||||
|
}
|
||||||
|
|
||||||
|
.activity-details {
|
||||||
|
margin-top: var(--sp-2);
|
||||||
border: 1px solid var(--border);
|
border: 1px solid var(--border);
|
||||||
border-radius: var(--r-card);
|
border-radius: var(--r-card);
|
||||||
background: var(--surface);
|
background: var(--surface);
|
||||||
@@ -939,29 +981,6 @@ button {
|
|||||||
gap: var(--sp-2);
|
gap: var(--sp-2);
|
||||||
}
|
}
|
||||||
|
|
||||||
.activity-head {
|
|
||||||
display: flex;
|
|
||||||
align-items: baseline;
|
|
||||||
justify-content: space-between;
|
|
||||||
gap: var(--sp-2);
|
|
||||||
}
|
|
||||||
|
|
||||||
.activity-label {
|
|
||||||
color: var(--accent);
|
|
||||||
font-size: var(--fs-small);
|
|
||||||
font-weight: 600;
|
|
||||||
}
|
|
||||||
|
|
||||||
.activity-state {
|
|
||||||
color: var(--faint);
|
|
||||||
font-size: var(--fs-small);
|
|
||||||
}
|
|
||||||
|
|
||||||
.activity-steps {
|
|
||||||
color: var(--muted);
|
|
||||||
font-size: var(--fs-small);
|
|
||||||
}
|
|
||||||
|
|
||||||
.activity-draft {
|
.activity-draft {
|
||||||
color: var(--muted);
|
color: var(--muted);
|
||||||
font-size: var(--fs-meta);
|
font-size: var(--fs-meta);
|
||||||
@@ -975,11 +994,6 @@ button {
|
|||||||
font-size: var(--fs-small);
|
font-size: var(--fs-small);
|
||||||
}
|
}
|
||||||
|
|
||||||
.activity-error {
|
|
||||||
color: var(--danger);
|
|
||||||
font-size: var(--fs-meta);
|
|
||||||
}
|
|
||||||
|
|
||||||
.activity-foot {
|
.activity-foot {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
@@ -1102,12 +1116,25 @@ button {
|
|||||||
gap: var(--sp-1);
|
gap: var(--sp-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
.typing {
|
.room-status {
|
||||||
|
width: calc(100% - var(--sp-8));
|
||||||
max-width: 760px;
|
max-width: 760px;
|
||||||
|
min-height: 18px;
|
||||||
margin: 0 auto var(--sp-1);
|
margin: 0 auto var(--sp-1);
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 2px;
|
||||||
color: var(--muted);
|
color: var(--muted);
|
||||||
font-size: var(--fs-small);
|
font-size: var(--fs-small);
|
||||||
min-height: 18px;
|
}
|
||||||
|
|
||||||
|
.room-status-line {
|
||||||
|
margin: 0;
|
||||||
|
line-height: 18px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.room-status-error {
|
||||||
|
color: var(--danger);
|
||||||
}
|
}
|
||||||
|
|
||||||
.new-messages {
|
.new-messages {
|
||||||
@@ -1889,10 +1916,6 @@ body.pane-resizing * {
|
|||||||
min-height: 0;
|
min-height: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.typing {
|
|
||||||
padding: 0 var(--sp-4);
|
|
||||||
}
|
|
||||||
|
|
||||||
details:not([open]) > *:not(summary) {
|
details:not([open]) > *:not(summary) {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -76,46 +76,47 @@ function toolLabel(tool: ToolActivity): string {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="activity">
|
<details class="activity">
|
||||||
<div class="activity-head">
|
<summary class="activity-summary">
|
||||||
<div class="row">
|
<span class="activity-label">rhema</span>
|
||||||
<span class="activity-label">rhema</span>
|
<span class="activity-result">{{ stateLabel }}</span>
|
||||||
<span class="activity-steps">{{ stateLabel }}</span>
|
|
||||||
</div>
|
|
||||||
<span v-if="activity.steps > 0" class="activity-state">
|
<span v-if="activity.steps > 0" class="activity-state">
|
||||||
{{ activity.steps }} {{ activity.steps === 1 ? 'step' : 'steps' }}
|
{{ activity.steps }} {{ activity.steps === 1 ? 'step' : 'steps' }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
<span v-if="activity.status === 'error' && activity.error" class="activity-error">
|
||||||
|
{{ activity.error }}
|
||||||
|
</span>
|
||||||
|
</summary>
|
||||||
|
|
||||||
<details v-if="activity.thinking" class="activity-draft">
|
<div class="activity-details">
|
||||||
<summary>thinking</summary>
|
<details v-if="activity.thinking" class="activity-draft">
|
||||||
<div>{{ activity.thinking }}</div>
|
<summary>thinking</summary>
|
||||||
</details>
|
<div>{{ activity.thinking }}</div>
|
||||||
|
|
||||||
<details v-if="activity.text" class="activity-draft">
|
|
||||||
<summary>draft</summary>
|
|
||||||
<div>{{ activity.text }}</div>
|
|
||||||
</details>
|
|
||||||
|
|
||||||
<div v-for="tool in activity.tools" :key="tool.call_id" class="tool">
|
|
||||||
<div class="tool-head">
|
|
||||||
<span class="tool-name">{{ toolLabel(tool) }}</span>
|
|
||||||
<span v-if="tool.isError" class="tool-state tool-error">failed</span>
|
|
||||||
<span v-else-if="tool.done && tool.code !== null" class="tool-state">exit {{ tool.code }}</span>
|
|
||||||
<span v-else-if="!tool.done" class="tool-state">running</span>
|
|
||||||
<span v-else class="tool-state">done</span>
|
|
||||||
</div>
|
|
||||||
<div v-if="toolSummary(tool)" class="tool-args">{{ toolSummary(tool) }}</div>
|
|
||||||
<details v-if="tool.done && outputText(tool)">
|
|
||||||
<summary>output</summary>
|
|
||||||
<pre class="code-block tool-output">{{ outputText(tool) }}</pre>
|
|
||||||
</details>
|
</details>
|
||||||
</div>
|
|
||||||
|
|
||||||
<div v-if="activity.status === 'error' && activity.error" class="activity-error">{{ activity.error }}</div>
|
<details v-if="activity.text" class="activity-draft">
|
||||||
|
<summary>draft</summary>
|
||||||
|
<div>{{ activity.text }}</div>
|
||||||
|
</details>
|
||||||
|
|
||||||
<div v-if="usageText" class="activity-foot">
|
<div v-for="tool in activity.tools" :key="tool.call_id" class="tool">
|
||||||
<span>{{ usageText }}</span>
|
<div class="tool-head">
|
||||||
|
<span class="tool-name">{{ toolLabel(tool) }}</span>
|
||||||
|
<span v-if="tool.isError" class="tool-state tool-error">failed</span>
|
||||||
|
<span v-else-if="tool.done && tool.code !== null" class="tool-state">exit {{ tool.code }}</span>
|
||||||
|
<span v-else-if="!tool.done" class="tool-state">running</span>
|
||||||
|
<span v-else class="tool-state">done</span>
|
||||||
|
</div>
|
||||||
|
<div v-if="toolSummary(tool)" class="tool-args">{{ toolSummary(tool) }}</div>
|
||||||
|
<details v-if="tool.done && outputText(tool)">
|
||||||
|
<summary>output</summary>
|
||||||
|
<pre class="code-block tool-output">{{ outputText(tool) }}</pre>
|
||||||
|
</details>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div v-if="usageText" class="activity-foot">
|
||||||
|
<span>{{ usageText }}</span>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</details>
|
||||||
</template>
|
</template>
|
||||||
@@ -162,20 +162,25 @@ const timeline = computed<TimelineEntry[]>(() => {
|
|||||||
entries.push({ kind: 'notice', seq: notice.seq, level: notice.level, text: notice.text })
|
entries.push({ kind: 'notice', seq: notice.seq, level: notice.level, text: notice.text })
|
||||||
}
|
}
|
||||||
for (const activity of activities.value) {
|
for (const activity of activities.value) {
|
||||||
|
if (activity.status === 'running') continue
|
||||||
entries.push({ kind: 'turn', seq: activity.seq, activity })
|
entries.push({ kind: 'turn', seq: activity.seq, activity })
|
||||||
}
|
}
|
||||||
return entries.sort((a, b) => a.seq - b.seq)
|
return entries.sort((a, b) => a.seq - b.seq)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const agentWorking = computed(
|
||||||
|
() => streamState.value === 'live' && activities.value.some((activity) => activity.status === 'running'),
|
||||||
|
)
|
||||||
|
|
||||||
const typingText = computed(() => {
|
const typingText = computed(() => {
|
||||||
const me = detail.value?.me.id
|
const me = detail.value?.me.id
|
||||||
const names = peers.value
|
const names = peers.value
|
||||||
.filter((peer) => peer.member_id !== me && peer.state?.typing === true)
|
.filter((peer) => peer.member_id !== me && peer.state?.typing === true)
|
||||||
.map((peer) => peer.display_name)
|
.map((peer) => peer.display_name)
|
||||||
if (names.length === 0) return ''
|
if (names.length === 0) return ''
|
||||||
if (names.length === 1) return `${names[0]} is typing`
|
if (names.length === 1) return `${names[0]} is typing...`
|
||||||
if (names.length === 2) return `${names[0]} and ${names[1]} are typing`
|
if (names.length === 2) return `${names[0]} and ${names[1]} are typing...`
|
||||||
return 'Several people are typing'
|
return 'Several people are typing...'
|
||||||
})
|
})
|
||||||
|
|
||||||
function eventData<T>(envelope: Envelope): T {
|
function eventData<T>(envelope: Envelope): T {
|
||||||
@@ -350,6 +355,7 @@ function handleEnvelope(envelope: Envelope) {
|
|||||||
const activity = findActivity(data.turn_id)
|
const activity = findActivity(data.turn_id)
|
||||||
if (!activity) break
|
if (!activity) break
|
||||||
activity.status = data.status
|
activity.status = data.status
|
||||||
|
activity.seq = envelope.seq
|
||||||
activity.steps = data.steps
|
activity.steps = data.steps
|
||||||
activity.usage = data.usage
|
activity.usage = data.usage
|
||||||
if (data.status === 'error') activity.error = data.error ?? 'The turn failed.'
|
if (data.status === 'error') activity.error = data.error ?? 'The turn failed.'
|
||||||
@@ -663,7 +669,10 @@ async function loadMessages() {
|
|||||||
const page = await api.get<MessagePage>(`/rooms/${roomId.value}/messages`, { limit: 60 })
|
const page = await api.get<MessagePage>(`/rooms/${roomId.value}/messages`, { limit: 60 })
|
||||||
for (const message of page.messages) addMessage(message, true)
|
for (const message of page.messages) addMessage(message, true)
|
||||||
hasMore.value = page.has_more
|
hasMore.value = page.has_more
|
||||||
lastDurable = messages.value.reduce((max, message) => Math.max(max, message.seq), 0)
|
// Replay from the oldest loaded message, not the newest: the feed
|
||||||
|
// must also bring the turn_start and tool events that rebuild a
|
||||||
|
// completed turn's summary.
|
||||||
|
lastDurable = messages.value[0]?.seq ?? 0
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
messagesError.value = apiErrorMessage(err)
|
messagesError.value = apiErrorMessage(err)
|
||||||
} finally {
|
} finally {
|
||||||
@@ -840,9 +849,14 @@ onBeforeUnmount(() => {
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p v-if="streamError" class="typing">{{ streamError }}</p>
|
<div class="room-status" aria-live="polite">
|
||||||
<p v-else-if="streamState === 'disconnected'" class="typing">Reconnecting to live updates.</p>
|
<p v-if="streamError" class="room-status-line room-status-error">{{ streamError }}</p>
|
||||||
<p v-if="typingText" class="typing">{{ typingText }}</p>
|
<p v-else-if="streamState === 'disconnected'" class="room-status-line">
|
||||||
|
Reconnecting to live updates.
|
||||||
|
</p>
|
||||||
|
<p v-if="agentWorking" class="room-status-line">Rhema is working...</p>
|
||||||
|
<p v-if="typingText" class="room-status-line">{{ typingText }}</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
<ChatComposer :room-id="roomId" @sent="onSent" @typing="onTyping" />
|
<ChatComposer :room-id="roomId" @sent="onSent" @typing="onTyping" />
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in new issue
Block a user