Skip to content

Open source Grok Bot alternative, Bring your own agent and subscription: message Claude Code, Codex, Gemini CLI, Cursor, Copilot and 40+ AI agents as bots on your own computer, from iPhone, Mac, Windows, Linux or terminal. Agent-agnostic and free. Also a Muse and Dots alternative. Built in Rust.

feat: unfold the running turn's steps from the working pill

leepokai0d4d578fe5e1
diff --git a/apps/android/WhatsNew.md b/apps/android/WhatsNew.md
index 3270426e..1cd64734 100644
--- a/apps/android/WhatsNew.md
+++ b/apps/android/WhatsNew.md
@@ -16,6 +16,7 @@ else a generic "Bug fixes and improvements" line. Delete old sections.
- Bot 之間交辦工作不必等待,對方的回覆會回到發問的 Bot,再由它回覆你。
- 帳號選單裡的「電腦與設定」和它打開的頁面同名。
- 新增聯結器失敗後再試一次,會使用你改好的金鑰。
+- Bot 工作中點一下狀態膠囊,就能在對話裡展開這一輪的思考、工具與 MCP 呼叫,太長時在膠囊內捲動。
### en-US
- Bots can make artifacts: reports, trackers and dashboards you come back to show as a card in the chat. Open one full screen and message the bot below it to change it; it updates in place.
@@ -24,3 +25,4 @@ else a generic "Bug fixes and improvements" line. Delete old sections.
- Bots hand work to each other without waiting; the answer comes back to the bot that asked, which then replies to you.
- The account sheet's Computers & settings row now has the same name as the page it opens.
- Trying again after adding a connector failed uses the key you corrected.
+- While a bot works, tap its status pill to unfold this turn's thinking, tool and MCP calls right in the chat; a long turn scrolls inside the pill.
diff --git a/apps/android/app/src/androidTest/kotlin/com/codync/android/WorkingIndicatorTest.kt b/apps/android/app/src/androidTest/kotlin/com/codync/android/WorkingIndicatorTest.kt
index bac7991c..b111e353 100644
--- a/apps/android/app/src/androidTest/kotlin/com/codync/android/WorkingIndicatorTest.kt
+++ b/apps/android/app/src/androidTest/kotlin/com/codync/android/WorkingIndicatorTest.kt
@@ -15,6 +15,9 @@ import androidx.compose.ui.test.*
import androidx.compose.ui.test.junit4.createComposeRule
import androidx.compose.ui.unit.dp
import com.codync.android.core.Bot
+import com.codync.android.core.Entry
+import kotlinx.serialization.json.buildJsonObject
+import kotlinx.serialization.json.put
import org.junit.Assert.assertEquals
import org.junit.Assert.assertFalse
import org.junit.Rule
@@ -23,7 +26,21 @@ import org.junit.Test
class WorkingIndicatorTest {
@get:Rule val compose = createComposeRule()
- @Test fun activityIsNotClickableAndUpdatesWithoutMovingHistory() {
+ @Test fun stepsUnfoldFromTheActivity() {
+ compose.mainClock.autoAdvance = false
+ val step = Entry("tool", 0, "bot", 1, "tool", 1, buildJsonObject { put("title", "npm test"); put("status", "in_progress") })
+ compose.setContent { Hosted { WorkingIndicator(Bot("bot", "Bot", status = "working", activity = "Terminal"), listOf(step)) } }
+ compose.mainClock.advanceTimeBy(1000)
+ compose.onNodeWithText("npm test").assertDoesNotExist()
+ compose.onNodeWithText("Terminal").performClick()
+ compose.mainClock.advanceTimeBy(1000)
+ compose.onNodeWithText("npm test").assertIsDisplayed()
+ compose.onNodeWithText("Terminal").performClick()
+ compose.mainClock.advanceTimeBy(1000)
+ compose.onNodeWithText("npm test").assertDoesNotExist()
+ }
+
+ @Test fun activityWithoutStepsIsNotClickableAndUpdatesWithoutMovingHistory() {
// The live orb runs a frame loop; advance motion explicitly instead of waiting for it to stop.
compose.mainClock.autoAdvance = false
val activity = mutableStateOf("Working…")
@@ -34,15 +51,13 @@ class WorkingIndicatorTest {
rememberFollowing(list, "message", 1, working = true, bottom = 0.dp)
LazyColumn(Modifier.size(320.dp).testTag("conversation"), state = list, contentPadding = PaddingValues(0.dp)) {
items(30) { Box(Modifier.height(48.dp)) { Text("Message $it") } }
- item("working") { WorkingIndicator(Bot("bot", "Bot", status = "working", activity = activity.value)) }
+ item("working") { WorkingIndicator(Bot("bot", "Bot", status = "working", activity = activity.value), emptyList()) }
}
}
}
compose.mainClock.advanceTimeBy(1000)
compose.waitForIdle()
compose.onNodeWithText("Working…").assertIsDisplayed().assertHasNoClickAction()
- compose.onNodeWithContentDescription("Show thinking").assertDoesNotExist()
- compose.onNodeWithText("No thinking text yet.").assertDoesNotExist()
compose.runOnIdle {
assertFalse(list.canScrollForward)
activity.value = "Searching files…"
diff --git a/apps/android/app/src/main/kotlin/com/codync/android/ChatRows.kt b/apps/android/app/src/main/kotlin/com/codync/android/ChatRows.kt
index a1150649..ea3cc99b 100644
--- a/apps/android/app/src/main/kotlin/com/codync/android/ChatRows.kt
+++ b/apps/android/app/src/main/kotlin/com/codync/android/ChatRows.kt
@@ -2,9 +2,17 @@ package com.codync.android
import android.content.ClipData
import android.content.ClipboardManager
+import androidx.compose.animation.AnimatedVisibility
import androidx.compose.animation.animateContentSize
+import androidx.compose.animation.core.animateFloatAsState
+import androidx.compose.animation.expandVertically
+import androidx.compose.animation.fadeIn
+import androidx.compose.animation.fadeOut
+import androidx.compose.animation.shrinkVertically
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
+import androidx.compose.foundation.rememberScrollState
+import androidx.compose.foundation.verticalScroll
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
@@ -12,6 +20,7 @@ import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.RowScope
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
+import androidx.compose.foundation.layout.heightIn
import androidx.compose.foundation.layout.offset
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
@@ -21,13 +30,16 @@ import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
+import androidx.compose.runtime.key
import androidx.compose.runtime.mutableLongStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
+import androidx.compose.runtime.withFrameNanos
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
+import androidx.compose.ui.draw.rotate
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalFocusManager
@@ -35,6 +47,7 @@ import androidx.compose.ui.semantics.Role
import androidx.compose.ui.semantics.clearAndSetSemantics
import androidx.compose.ui.semantics.contentDescription
import androidx.compose.ui.semantics.semantics
+import androidx.compose.ui.semantics.stateDescription
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
@@ -361,21 +374,51 @@ internal val Entry.botReactions: Map<String, List<String>> get() =
}
}
-/** The bot's current activity and elapsed time. */
-@Composable internal fun WorkingIndicator(bot: Bot) {
+/** The bot's current activity and elapsed time; once the turn has steps, a tap unfolds them. */
+@Composable internal fun WorkingIndicator(bot: Bot, steps: List<Entry>) {
val needs = bot.status == "needsInput"
+ // Each turn starts folded.
+ var expanded by remember(bot.startedAt) { mutableStateOf(false) }
+ val open = expanded && steps.isNotEmpty()
+ val turn by animateFloatAsState(if (open) 90f else 0f, Motion.layout(), label = "Chevron")
+ val action = tr(if (open) "Hide steps" else "Show steps")
+ val state = tr(if (open) "Expanded" else "Collapsed")
+ val toggle = if (steps.isEmpty()) Modifier else Modifier.clickable(role = Role.Button, onClickLabel = action) { expanded = !expanded }
+ .semantics { stateDescription = state }
Column(Modifier.fillMaxWidth().padding(top = 6.dp, end = 40.dp)) {
- Row(Modifier.clip(RoundedRectangle(18.dp)).background(Palette.bubbleAgent)
- .padding(horizontal = 16.dp, vertical = 12.dp),
- verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(8.dp)) {
- ThinkingOrb(if (needs) ThinkingOrbState.Listening else ThinkingOrbState.Working, 16.dp, if (needs) Palette.warning else Palette.secondary)
- Text(tr(bot.activity.ifEmpty { "Working…" }), Modifier.weight(1f, fill = false), style = Type.subheadline,
- color = if (needs) Palette.warning else Palette.secondary, maxLines = 1, overflow = TextOverflow.Ellipsis)
- bot.startedAt?.let { Elapsed(it) }
+ Column(Modifier.then(if (open) Modifier.fillMaxWidth() else Modifier).animateContentSize(Motion.layoutSize)
+ .clip(RoundedRectangle(18.dp)).background(Palette.bubbleAgent).padding(horizontal = 16.dp, vertical = 12.dp)) {
+ Row(Modifier.then(if (open) Modifier.fillMaxWidth() else Modifier).then(toggle),
+ verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(8.dp)) {
+ ThinkingOrb(if (needs) ThinkingOrbState.Listening else ThinkingOrbState.Working, 16.dp, if (needs) Palette.warning else Palette.secondary)
+ Text(tr(bot.activity.ifEmpty { "Working…" }), Modifier.weight(1f, fill = open), style = Type.subheadline,
+ color = if (needs) Palette.warning else Palette.secondary, maxLines = 1, overflow = TextOverflow.Ellipsis)
+ bot.startedAt?.let { Elapsed(it) }
+ if (steps.isNotEmpty()) Symbol("chevron.right", Modifier.rotate(turn), size = 13.dp, tint = Palette.tertiary)
+ }
+ AnimatedVisibility(open, enter = fadeIn(Motion.fade()) + expandVertically(Motion.layoutSize),
+ exit = fadeOut(Motion.fade()) + shrinkVertically(Motion.layoutSize)) { WorkingSteps(steps) }
}
}
}
+/** The turn's thinking, narration, tool calls and plan: hugs them, scrolls past 280 dp, and follows new steps until
+ * the reader scrolls up. */
+@Composable private fun WorkingSteps(steps: List<Entry>) {
+ val scroll = rememberScrollState()
+ var follow by remember { mutableStateOf(true) }
+ LaunchedEffect(scroll.isScrollInProgress) { if (!scroll.isScrollInProgress) follow = !scroll.canScrollForward }
+ // Follows new steps once they're laid out, not a row the reader unfolds (that grows the box too).
+ LaunchedEffect(steps) {
+ if (!follow) return@LaunchedEffect
+ withFrameNanos {}
+ scroll.scrollTo(scroll.maxValue)
+ }
+ Column(Modifier.padding(top = 12.dp).heightIn(max = 280.dp).verticalScroll(scroll), verticalArrangement = Arrangement.spacedBy(10.dp)) {
+ for (entry in steps) key(entry.id) { TraceRow(entry, unfolded = true) }
+ }
+}
+
/** `Text(date, style: .timer)`: the time since `startedAt`, every second. */
@Composable private fun Elapsed(startedAt: Long) {
var now by remember { mutableLongStateOf(System.currentTimeMillis()) }
diff --git a/apps/android/app/src/main/kotlin/com/codync/android/ChatScreen.kt b/apps/android/app/src/main/kotlin/com/codync/android/ChatScreen.kt
index 719e2949..db481cce 100644
--- a/apps/android/app/src/main/kotlin/com/codync/android/ChatScreen.kt
+++ b/apps/android/app/src/main/kotlin/com/codync/android/ChatScreen.kt
@@ -261,6 +261,6 @@ import com.kyant.shapes.Capsule
is ChatItem.Exchanges -> BotMessageRow(item.group, state) { openPeer(item.group.peerId) }
}
}
- if (working) item("working") { WorkingIndicator(bot) }
+ if (working) item("working") { WorkingIndicator(bot, workingSteps(state.entries.filter { it.botId == bot.id })) }
}
}
diff --git a/apps/android/app/src/main/kotlin/com/codync/android/ConversationList.kt b/apps/android/app/src/main/kotlin/com/codync/android/ConversationList.kt
index 027408fe..b9b49a48 100644
--- a/apps/android/app/src/main/kotlin/com/codync/android/ConversationList.kt
+++ b/apps/android/app/src/main/kotlin/com/codync/android/ConversationList.kt
@@ -81,7 +81,7 @@ import kotlinx.coroutines.launch
snapshotFlow { list.layoutInfo.totalItemsCount }.first { it > 0 }
list.scrollToEnd(animated = false)
}
- // The thinking disclosure can grow without a new chat entry. Follow its measured size,
+ // The working steps can grow without a new chat entry. Follow their measured size,
// not its offset (scrolling itself changes offsets), and always yield to the reader.
LaunchedEffect(list) {
snapshotFlow {
diff --git a/apps/android/app/src/main/kotlin/com/codync/android/TraceView.kt b/apps/android/app/src/main/kotlin/com/codync/android/TraceView.kt
index 9f61481e..ace36d8d 100644
--- a/apps/android/app/src/main/kotlin/com/codync/android/TraceView.kt
+++ b/apps/android/app/src/main/kotlin/com/codync/android/TraceView.kt
@@ -59,8 +59,14 @@ import kotlinx.serialization.json.jsonPrimitive
internal fun runningTurn(entries: List<Entry>, working: Boolean): Long? =
if (working) entries.filter { it.status != "queued" }.maxOfOrNull { it.turn } else null
+/** What the running turn has done so far, in order: the steps the working indicator unfolds. */
+internal fun workingSteps(entries: List<Entry>): List<Entry> {
+ val turn = runningTurn(entries, working = true)
+ return entries.filter { it.turn == turn && it.isWorkingStep }
+}
+
/** The running turn's thoughts start `unfolded`, so its reasoning reads as it comes in. */
-@Composable private fun TraceRow(entry: Entry, unfolded: Boolean) {
+@Composable internal fun TraceRow(entry: Entry, unfolded: Boolean) {
val d = entry.data
var expanded by rememberSaveable { mutableStateOf(unfolded) }
when (entry.kind) {
diff --git a/apps/android/app/src/test/kotlin/com/codync/android/TraceTest.kt b/apps/android/app/src/test/kotlin/com/codync/android/TraceTest.kt
index d879e75f..903f4734 100644
--- a/apps/android/app/src/test/kotlin/com/codync/android/TraceTest.kt
+++ b/apps/android/app/src/test/kotlin/com/codync/android/TraceTest.kt
@@ -8,12 +8,30 @@ import org.junit.Assert.assertNull
import org.junit.Test
class TraceTest {
- private fun entry(id: String, turn: Long, status: String? = null, kind: String = "user") =
- Entry(id, 0, "bot", 0, kind, turn, buildJsonObject { put("text", id); if (status != null) put("status", status) })
+ private fun entry(id: String, turn: Long, status: String? = null, kind: String = "user", text: String = id,
+ final: Boolean? = null, bookkeeping: Boolean? = null) =
+ Entry(id, 0, "bot", 0, kind, turn, buildJsonObject {
+ put("text", text)
+ if (status != null) put("status", status)
+ if (final != null) put("final", final)
+ if (bookkeeping != null) put("bookkeeping", bookkeeping)
+ })
@Test fun `the trace unfolds the running turn, not a queued message holding the next`() {
val entries = listOf(entry("u1", 1), entry("t1", 1), entry("q", 2, status = "queued"))
assertEquals(1L, runningTurn(entries, working = true))
assertNull(runningTurn(entries, working = false))
}
+
+ @Test fun `the working steps are the running turn's work, without what the chat or memory already show`() {
+ val entries = listOf(
+ entry("old", 1, kind = "tool"), entry("u2", 2), entry("thinking", 2, kind = "thought"),
+ entry("blank", 2, kind = "thought", text = " "), entry("says", 2, kind = "agent"),
+ entry("terminal", 2, status = "in_progress", kind = "tool", bookkeeping = false),
+ entry("memory", 2, kind = "tool", bookkeeping = true), entry("unflagged", 2, kind = "tool"),
+ entry("plan", 2, kind = "plan"), entry("reply", 2, kind = "agent", final = true), entry("card", 2, kind = "permission"),
+ entry("pass", 2, kind = "agent", text = "(pass)"), entry("q", 3, status = "queued"),
+ )
+ assertEquals(listOf("thinking", "says", "terminal", "plan"), workingSteps(entries).map { it.id })
+ }
}
diff --git a/apps/android/core/src/main/kotlin/com/codync/android/core/Conversation.kt b/apps/android/core/src/main/kotlin/com/codync/android/core/Conversation.kt
index d37bb568..b548f24b 100644
--- a/apps/android/core/src/main/kotlin/com/codync/android/core/Conversation.kt
+++ b/apps/android/core/src/main/kotlin/com/codync/android/core/Conversation.kt
@@ -41,6 +41,15 @@ data class Entry(
kind == "notice" && "memory" !in data && "memoryFile" !in data && "compaction" !in data &&
(data["handoff"] as? JsonObject)?.text("status") != "kept" ||
kind == "agent" && data["final"]?.jsonPrimitive?.booleanOrNull == true
+ /** A step the working indicator unfolds: thinking, narration, a tool call or a plan; never the bot's bookkeeping,
+ * nor a call the host didn't flag (one older than 2.25.0 flags none). */
+ val isWorkingStep: Boolean get() = when (kind) {
+ "thought" -> text.isNotBlank()
+ "agent" -> data["final"]?.jsonPrimitive?.booleanOrNull != true && !isPass(text)
+ "tool" -> data["bookkeeping"]?.jsonPrimitive?.booleanOrNull == false
+ "plan" -> true
+ else -> false
+ }
/** A message the user can quote in a reply: theirs, or a final reply (a group member's too). */
val isReplyable: Boolean get() = kind == "user" || kind == "agent" && data["final"]?.jsonPrimitive?.booleanOrNull == true
/** The message this one replies to, as the computer quoted it. */
@@ -53,6 +62,10 @@ data class Entry(
val replyQuote: ReplyQuote get() = ReplyQuote(id, if (kind == "user") "user" else data.text("author") ?: botId, quotePreview.take(500))
companion object {
+ /** No text, or a pass the host keeps out of the chat (`is_pass` in host/src/chat/group.rs). */
+ private fun isPass(text: String) =
+ text.trim().trim('"', '.', '*').lowercase().let { it.isEmpty() || it == "(pass)" || it == "pass" }
+
fun decode(value: JsonObject): Entry {
val entry = WireJson.decodeFromJsonElement<Entry>(value)
require(entry.id.isNotBlank() && entry.botId.isNotBlank() && entry.kind.isNotBlank() && entry.seq >= 0 && entry.rev >= 0) {
diff --git a/apps/desktop/src/renderer/components/Controls.tsx b/apps/desktop/src/renderer/components/Controls.tsx
index 9364dfd3..471804f4 100644
--- a/apps/desktop/src/renderer/components/Controls.tsx
+++ b/apps/desktop/src/renderer/components/Controls.tsx
@@ -1,6 +1,6 @@
import { Children, Fragment, useEffect, useRef, useState, type CSSProperties, type KeyboardEvent, type PointerEvent, type ReactNode } from 'react'
import { Icon } from './Icon'
-import { AnchoredMenu, IconButtonBase, type MenuItem } from './Overlay'
+import { AnchoredMenu, IconButtonBase, usePresence, type MenuItem } from './Overlay'
import { HStack, Spacer, VStack } from './Stack'
import { useTr } from '../lib/use-language'
import { Text } from './Text'
@@ -289,6 +289,17 @@ export function Disclosure({ expanded, onToggle, label, children }: { expanded:
)
}
+/** Keeps `children` mounted while it fades and folds away. */
+export function Reveal({ show, children }: { show: boolean; children: ReactNode }) {
+ const { mounted, shown } = usePresence(show)
+ if (!mounted) return null
+ return (
+ <div className={`reveal ${shown ? 'shown' : ''}`}>
+ <div>{children}</div>
+ </div>
+ )
+}
+
/** A filled rounded value box, or outlined (outline or fill, never both). */
export function Pill({ children, fill = 'var(--background)', outlined = false, className }: { children: ReactNode; fill?: string; outlined?: boolean; className?: string }) {
return (
diff --git a/apps/desktop/src/renderer/components/controls.css b/apps/desktop/src/renderer/components/controls.css
index 5eb906bb..75aa9777 100644
--- a/apps/desktop/src/renderer/components/controls.css
+++ b/apps/desktop/src/renderer/components/controls.css
@@ -372,6 +372,24 @@
transform: rotate(90deg);
}
+/* Show/hide: fade with a short drop from the top (`.opacity.combined(with: .move(edge: .top))`). */
+.reveal {
+ display: grid;
+ grid-template-rows: 0fr;
+ opacity: 0;
+ transform: translateY(-4px);
+ transition: grid-template-rows var(--layout), opacity var(--layout), transform var(--layout);
+}
+.reveal.shown {
+ grid-template-rows: 1fr;
+ opacity: 1;
+ transform: none;
+}
+.reveal > div {
+ min-height: 0;
+ overflow: hidden;
+}
+
.pill {
display: inline-flex;
align-items: center;
diff --git a/apps/desktop/src/renderer/views/settings/ApprovalSheet.tsx b/apps/desktop/src/renderer/views/settings/ApprovalSheet.tsx
index 6694f485..0f574d0f 100644
--- a/apps/desktop/src/renderer/views/settings/ApprovalSheet.tsx
+++ b/apps/desktop/src/renderer/views/settings/ApprovalSheet.tsx
@@ -1,12 +1,12 @@
import { useState } from 'react'
-import { Button, Spinner } from '../../components/Controls'
+import { Button, Reveal, Spinner } from '../../components/Controls'
import { Icon } from '../../components/Icon'
import { ModalHeader } from '../../components/Overlay'
import { HStack, VStack } from '../../components/Stack'
import { Text } from '../../components/Text'
import type { Approval } from '../../store/app-model'
import { useApp } from '../../store/context'
-import { deviceIcon, errorText, Reveal, spacedCode } from './parts'
+import { deviceIcon, errorText, spacedCode } from './parts'
import { useTr } from '../../lib/use-language'
diff --git a/apps/desktop/src/renderer/views/settings/ComputersView.tsx b/apps/desktop/src/renderer/views/settings/ComputersView.tsx
index 9afa0db6..ee76f01b 100644
--- a/apps/desktop/src/renderer/views/settings/ComputersView.tsx
+++ b/apps/desktop/src/renderer/views/settings/ComputersView.tsx
@@ -1,7 +1,7 @@
import { useCallback, useState } from 'react'
import type { AccountApproval, PairingInfo } from '@shared/models'
import { newSSHProfile, type SSHProfile } from '@shared/ssh'
-import { Button, CardSection, IconButton, Switch } from '../../components/Controls'
+import { Button, CardSection, IconButton, Reveal, Switch } from '../../components/Controls'
import { Icon } from '../../components/Icon'
import { Dialog, ModalHeader, Sheet, useDismiss } from '../../components/Overlay'
import { HStack, Spacer, VStack } from '../../components/Stack'
@@ -15,7 +15,7 @@ import { ComputerBadge } from '../ComputerBadge'
import { PairingCode } from '../PairingCode'
import { AuthorizedDevicesSection } from './AuthorizedDevicesSection'
import { useTr } from '../../lib/use-language'
-import { errorText, liveClient, relativeDay, Reveal, SectionHeader, statusText, thisMac } from './parts'
+import { errorText, liveClient, relativeDay, SectionHeader, statusText, thisMac } from './parts'
import { useSSH } from './ssh-model'
import { SSHRow } from './SSHRow'
import { VoiceChatSettingsView } from './VoiceChatSettingsView'
diff --git a/apps/desktop/src/renderer/views/settings/HiddenBotsSection.tsx b/apps/desktop/src/renderer/views/settings/HiddenBotsSection.tsx
index 1a83df00..44a09995 100644
--- a/apps/desktop/src/renderer/views/settings/HiddenBotsSection.tsx
+++ b/apps/desktop/src/renderer/views/settings/HiddenBotsSection.tsx
@@ -1,11 +1,10 @@
import { BotAvatar } from '../../components/Avatar'
-import { CardSection, IconButton } from '../../components/Controls'
+import { CardSection, IconButton, Reveal } from '../../components/Controls'
import { VStack } from '../../components/Stack'
import { Text } from '../../components/Text'
import { useModels } from '../../lib/observable'
import { refKey } from '../../store/app-model'
import { useApp } from '../../store/context'
-import { Reveal } from './parts'
/** Bots hidden from the sidebar on every computer, each with Unhide (the iPhone's Hidden bots). */
export function HiddenBotsSection() {
diff --git a/apps/desktop/src/renderer/views/settings/SSHRow.tsx b/apps/desktop/src/renderer/views/settings/SSHRow.tsx
index 69825b28..81cf3a9b 100644
--- a/apps/desktop/src/renderer/views/settings/SSHRow.tsx
+++ b/apps/desktop/src/renderer/views/settings/SSHRow.tsx
@@ -1,10 +1,9 @@
import { SSH_INSTALL_COMMAND, type SSHProfile, type SSHStatus } from '@shared/ssh'
-import { Button, IconButton } from '../../components/Controls'
+import { Button, IconButton, Reveal } from '../../components/Controls'
import { Icon } from '../../components/Icon'
import { HStack, IconSlot, VStack } from '../../components/Stack'
import { Text } from '../../components/Text'
import { analytics } from '../../store/analytics'
-import { Reveal } from './parts'
import { sshStatusDetail } from '@shared/ssh-startup'
export function SSHRow({ profile, status, edit, attached = true }: { profile: SSHProfile; status: SSHStatus; attached?: boolean; edit: () => void }) {
diff --git a/apps/desktop/src/renderer/views/settings/VoiceChatSettingsView.tsx b/apps/desktop/src/renderer/views/settings/VoiceChatSettingsView.tsx
index d0b58c83..2b891a4a 100644
--- a/apps/desktop/src/renderer/views/settings/VoiceChatSettingsView.tsx
+++ b/apps/desktop/src/renderer/views/settings/VoiceChatSettingsView.tsx
@@ -1,7 +1,7 @@
import { onDeviceUnavailableReason } from '../call/voice'
import { useEffect, useMemo, useRef, useState } from 'react'
import type { HostClient } from '../../client/host-client'
-import { Button, CardForm, CardSection, ChoicePicker, IconButton, Spinner, ValueRow } from '../../components/Controls'
+import { Button, CardForm, CardSection, ChoicePicker, IconButton, Reveal, Spinner, ValueRow } from '../../components/Controls'
import { Icon } from '../../components/Icon'
import { ModalHeader, SheetPage } from '../../components/Overlay'
import { HStack, Spacer, VStack } from '../../components/Stack'
@@ -9,7 +9,7 @@ import { Text } from '../../components/Text'
import { usePref } from '../../lib/prefs'
import { useStore } from '../../store/context'
import { useScreenViewed } from '../../store/analytics'
-import { errorText, liveClient, Reveal } from './parts'
+import { errorText, liveClient } from './parts'
import * as voice from './voice-settings'
import type { VoiceModels, VoiceProvider } from './voice-settings'
import { useTr } from '../../lib/use-language'
diff --git a/apps/desktop/src/renderer/views/settings/parts.tsx b/apps/desktop/src/renderer/views/settings/parts.tsx
index dafaadc8..e8e4842e 100644
--- a/apps/desktop/src/renderer/views/settings/parts.tsx
+++ b/apps/desktop/src/renderer/views/settings/parts.tsx
@@ -1,5 +1,4 @@
import type { ReactNode } from 'react'
-import { usePresence } from '../../components/Overlay'
import { useTr } from '../../lib/use-language'
import { Spacer } from '../../components/Stack'
import { Text } from '../../components/Text'
@@ -15,17 +14,6 @@ export function deviceIcon(platform: string | null | undefined) {
return platform === 'ios' ? 'iphone' : platform === 'macos' ? 'laptopcomputer' : 'desktopcomputer'
}
-/** Keeps `children` mounted while it fades and folds away. */
-export function Reveal({ show, children }: { show: boolean; children: ReactNode }) {
- const { mounted, shown } = usePresence(show)
- if (!mounted) return null
- return (
- <div className={`settings-reveal ${shown ? 'shown' : ''}`}>
- <div>{children}</div>
- </div>
- )
-}
-
/** A section's title row (the CardSection heading). */
export function SectionHeader({ title, children }: { title: string; children?: ReactNode }) {
const tr = useTr()
diff --git a/apps/desktop/src/renderer/views/settings/settings.css b/apps/desktop/src/renderer/views/settings/settings.css
index 1b819557..24b637e1 100644
--- a/apps/desktop/src/renderer/views/settings/settings.css
+++ b/apps/desktop/src/renderer/views/settings/settings.css
@@ -212,21 +212,3 @@
.settings-appear {
animation: fade-in var(--layout) both;
}
-
-/* Show/hide: fade with a short drop from the top (`.opacity.combined(with: .move(edge: .top))`). */
-.settings-reveal {
- display: grid;
- grid-template-rows: 0fr;
- opacity: 0;
- transform: translateY(-4px);
- transition: grid-template-rows var(--layout), opacity var(--layout), transform var(--layout);
-}
-.settings-reveal.shown {
- grid-template-rows: 1fr;
- opacity: 1;
- transform: none;
-}
-.settings-reveal > div {
- min-height: 0;
- overflow: hidden;
-}
diff --git a/apps/desktop/src/renderer/views/thread/ChatRows.tsx b/apps/desktop/src/renderer/views/thread/ChatRows.tsx
index 5f4f2908..e8c55712 100644
--- a/apps/desktop/src/renderer/views/thread/ChatRows.tsx
+++ b/apps/desktop/src/renderer/views/thread/ChatRows.tsx
@@ -1,14 +1,13 @@
import { FileDownloadCard } from './FileDownloadCard'
import { ArtifactCard } from '../library/ArtifactCard'
-import { memo, useEffect, useRef, useState } from 'react'
-import { groupBotReactions, isGroup, isReplyable, isWorking, needsInput, type Bot, type Entry, type ReplyQuote } from '@shared/models'
+import { memo, useRef, useState } from 'react'
+import { groupBotReactions, isGroup, isReplyable, isWorking, type Bot, type Entry, type ReplyQuote } from '@shared/models'
import { BotAvatar } from '../../components/Avatar'
import { Button, IconButton } from '../../components/Controls'
import { Icon } from '../../components/Icon'
import { AnchoredMenu, useContextMenu, type MenuItem, type ReactionPick } from '../../components/Overlay'
import { HStack, VStack } from '../../components/Stack'
import { Text } from '../../components/Text'
-import { ThinkingOrb } from '../../components/ThinkingOrb'
import { messagePreview } from '../../lib/message-preview'
import { useTr } from '../../lib/use-language'
import { avatarColor } from '../../lib/theme'
@@ -231,37 +230,6 @@ export function NoticeRow({ entry, addFallback }: { entry: Entry; addFallback?:
}
}
-/** The bot's current activity and elapsed time. */
-export function WorkingIndicator({ bot }: { bot: Bot }) {
- const tr = useTr()
- const waiting = needsInput(bot)
- return (
- <VStack align="flex-start" className="agent-inset">
- <div className="working">
- <HStack as="span" gap={8}>
- <ThinkingOrb state={waiting ? 'listening' : 'working'} size={16} color={waiting ? 'var(--warning)' : 'var(--secondary)'} />
- <Text size="subheadline" tone={waiting ? 'attention' : 'secondary'} truncate>{tr(bot.activity || 'Working…')}</Text>
- {bot.startedAt ? <Timer since={bot.startedAt} /> : null}
- </HStack>
- </div>
- </VStack>
- )
-}
-
-/** `Text(date, style: .timer)`: 0:42, 12:05, 1:02:33. */
-function Timer({ since }: { since: number }) {
- const [now, setNow] = useState(Date.now())
- useEffect(() => {
- const timer = setInterval(() => setNow(Date.now()), 1000)
- return () => clearInterval(timer)
- }, [])
- const s = Math.max(0, Math.floor((now - since) / 1000))
- const h = Math.floor(s / 3600)
- const m = Math.floor((s % 3600) / 60)
- const sec = String(s % 60).padStart(2, '0')
- return <Text size="footnote" tone="tertiary" tabular>{h ? `${h}:${String(m).padStart(2, '0')}:${sec}` : `${m}:${sec}`}</Text>
-}
-
/** A message's reactions: the user's (clicking one takes it back), then the bots', each emoji with the avatars of the
* bots that chose it. */
export function ReactionsRow({ entry }: { entry: Entry }) {
diff --git a/apps/desktop/src/renderer/views/thread/ThreadView.tsx b/apps/desktop/src/renderer/views/thread/ThreadView.tsx
index 6b0cecb7..fe1538fd 100644
--- a/apps/desktop/src/renderer/views/thread/ThreadView.tsx
+++ b/apps/desktop/src/renderer/views/thread/ThreadView.tsx
@@ -20,6 +20,7 @@ import { Composer } from './Composer'
import { ChatSidePanel } from './ChatSidePanel'
import { DetailsPanel, type DetailsTab } from './DetailsPanel'
import { TraceView } from './TraceView'
+import { workingSteps } from './trace-turns'
import { useReading } from './reading'
import { GroupEditorView } from '../bots/GroupEditorView'
import { BotTemplateView } from '../bots/BotTemplateView'
@@ -275,6 +276,7 @@ const Transcript = memo(function Transcript({ botId, openTrace, onReply, openRou
// Rebuilt only when this chat changes: the store replaces a chat's list on every change.
const entries = store.allEntries(botId)
const all = useMemo(() => buildChat(entries), [entries])
+ const steps = useMemo(() => workingSteps(entries), [entries])
// The newest 40 items first; older pages come in near the top.
const [firstShown, setFirstShown] = useState<string | null>(null)
const [loadingEarlier, setLoadingEarlier] = useState(false)
@@ -376,7 +378,7 @@ const Transcript = memo(function Transcript({ botId, openTrace, onReply, openRou
<Row item={item} chat={bot} openTrace={openTrace} onReply={onReply} openRoutine={openRoutine} openAgent={openAgent} openBotChat={openBotChat} openArtifact={openArtifact} />
</div>
))}
- {bot ? <WorkingTransition bot={bot} visible={live} /> : null}
+ {bot ? <WorkingTransition bot={bot} visible={live} steps={steps} /> : null}
<div className="chat-end" />
</div>
</div>
diff --git a/apps/desktop/src/renderer/views/thread/TraceView.tsx b/apps/desktop/src/renderer/views/thread/TraceView.tsx
index 64a3a522..bc1386f3 100644
--- a/apps/desktop/src/renderer/views/thread/TraceView.tsx
+++ b/apps/desktop/src/renderer/views/thread/TraceView.tsx
@@ -1,4 +1,4 @@
-import { useLayoutEffect, useRef, useState } from 'react'
+import { useState } from 'react'
import { isWorkingIn, type Entry, type EntryData } from '@shared/models'
import { CardSection, Disclosure } from '../../components/Controls'
import { Icon } from '../../components/Icon'
@@ -11,7 +11,8 @@ import { useStore } from '../../store/context'
import { useScreenViewed } from '../../store/analytics'
import { MarkdownText } from './Markdown'
import { CodeBox, DiffView } from './PermissionCard'
-import { runningTurn, scrolledToEnd, traceTurns } from './trace-turns'
+import { useFollowEnd } from './follow-end'
+import { runningTurn, traceTurns } from './trace-turns'
import './trace.css'
import { useTr } from '../../lib/use-language'
@@ -29,20 +30,11 @@ export function TraceView({ botId }: { botId: string }) {
// The running turn's thoughts start unfolded.
const bot = store.bots.get(botId)
const running = runningTurn(all, !!bot && isWorkingIn(bot, botId))
- const scroller = useRef<HTMLDivElement>(null)
- // Opens at the end and follows new steps there until the reader scrolls up.
- const atEnd = useRef(true)
- useLayoutEffect(() => {
- const el = scroller.current
- if (el && atEnd.current) el.scrollTop = el.scrollHeight
- })
- const onScroll = (e: React.UIEvent<HTMLDivElement>) => {
- atEnd.current = scrolledToEnd(e.currentTarget)
- }
+ const follow = useFollowEnd()
return (
<SheetPage>
<ModalHeader title={tr(`Full conversation`)} />
- <div ref={scroller} className="thread-scroll" onScroll={onScroll}>
+ <div ref={follow.ref} className="thread-scroll" onScroll={follow.onScroll}>
<VStack gap={14} className="trace-content">
{sorted.length === 0 ? <Text tone="tertiary">{tr(`Nothing yet.`)}</Text> : null}
{sorted.map(([turn, entries]) => (
@@ -74,7 +66,7 @@ function Label({ icon, weight, tone, children }: { icon: React.ReactNode; weight
}
/** The running turn's thoughts start `unfolded`, so its reasoning reads as it comes in. */
-function TraceRow({ entry, unfolded }: { entry: Entry; unfolded: boolean }) {
+export function TraceRow({ entry, unfolded }: { entry: Entry; unfolded: boolean }) {
const tr = useTr()
const [expanded, setExpanded] = useState(unfolded)
const d = entry.data
diff --git a/apps/desktop/src/renderer/views/thread/WorkingIndicator.tsx b/apps/desktop/src/renderer/views/thread/WorkingIndicator.tsx
new file mode 100644
index 00000000..521504e2
--- /dev/null
+++ b/apps/desktop/src/renderer/views/thread/WorkingIndicator.tsx
@@ -0,0 +1,73 @@
+import { useEffect, useState } from 'react'
+import { needsInput, type Bot, type Entry } from '@shared/models'
+import { Reveal } from '../../components/Controls'
+import { Icon } from '../../components/Icon'
+import { HStack, VStack } from '../../components/Stack'
+import { Text } from '../../components/Text'
+import { ThinkingOrb } from '../../components/ThinkingOrb'
+import { useTr } from '../../lib/use-language'
+import { useFollowEnd } from './follow-end'
+import { TraceRow } from './TraceView'
+
+/** The bot's current activity and elapsed time; once the turn has steps, a click unfolds them. */
+export function WorkingIndicator({ bot, steps }: { bot: Bot; steps: Entry[] }) {
+ const tr = useTr()
+ const waiting = needsInput(bot)
+ const [expanded, setExpanded] = useState(false)
+ const unfoldable = steps.length > 0
+ const open = expanded && unfoldable
+ const status = (
+ <HStack as="span" gap={8}>
+ <ThinkingOrb state={waiting ? 'listening' : 'working'} size={16} color={waiting ? 'var(--warning)' : 'var(--secondary)'} />
+ <Text size="subheadline" tone={waiting ? 'attention' : 'secondary'} truncate grow>{tr(bot.activity || 'Working…')}</Text>
+ {bot.startedAt ? <Timer since={bot.startedAt} /> : null}
+ {unfoldable ? (
+ <span className={`disclosure-chevron${open ? ' open' : ''}`}>
+ <Icon name="chevron.right" size={10} weight="semibold" />
+ </span>
+ ) : null}
+ </HStack>
+ )
+ return (
+ <VStack align="flex-start" className="agent-inset">
+ <div className={open ? 'working expanded' : 'working'}>
+ {unfoldable ? (
+ <button className="working-toggle" onClick={() => setExpanded((x) => !x)} aria-expanded={open} title={tr(open ? 'Hide steps' : 'Show steps')}>
+ {status}
+ </button>
+ ) : (
+ status
+ )}
+ <Reveal show={open}>
+ <WorkingSteps steps={steps} />
+ </Reveal>
+ </div>
+ </VStack>
+ )
+}
+
+/** The turn's thinking, narration, tool calls and plan in a bounded box that follows new steps until the reader scrolls up. */
+function WorkingSteps({ steps }: { steps: Entry[] }) {
+ const follow = useFollowEnd()
+ return (
+ <div ref={follow.ref} className="working-steps" onScroll={follow.onScroll}>
+ <VStack gap={10}>
+ {steps.map((e) => <TraceRow key={e.id} entry={e} unfolded />)}
+ </VStack>
+ </div>
+ )
+}
+
+/** `Text(date, style: .timer)`: 0:42, 12:05, 1:02:33. */
+function Timer({ since }: { since: number }) {
+ const [now, setNow] = useState(Date.now())
+ useEffect(() => {
+ const timer = setInterval(() => setNow(Date.now()), 1000)
+ return () => clearInterval(timer)
+ }, [])
+ const s = Math.max(0, Math.floor((now - since) / 1000))
+ const h = Math.floor(s / 3600)
+ const m = Math.floor((s % 3600) / 60)
+ const sec = String(s % 60).padStart(2, '0')
+ return <Text size="footnote" tone="tertiary" tabular>{h ? `${h}:${String(m).padStart(2, '0')}:${sec}` : `${m}:${sec}`}</Text>
+}
diff --git a/apps/desktop/src/renderer/views/thread/WorkingTransition.tsx b/apps/desktop/src/renderer/views/thread/WorkingTransition.tsx
index 1c732751..9593a0bd 100644
--- a/apps/desktop/src/renderer/views/thread/WorkingTransition.tsx
+++ b/apps/desktop/src/renderer/views/thread/WorkingTransition.tsx
@@ -1,11 +1,11 @@
import { useLayoutEffect, useRef } from 'react'
-import type { Bot } from '@shared/models'
+import type { Bot, Entry } from '@shared/models'
import { usePresence } from '../../components/Overlay'
-import { WorkingIndicator } from './ChatRows'
+import { WorkingIndicator } from './WorkingIndicator'
import { workingExitMs, workingTransition } from './working-transition'
/** Keep the activity and its space alive until the exit finishes, including a quick restart. */
-export function WorkingTransition({ bot, visible }: { bot: Bot; visible: boolean }) {
+export function WorkingTransition({ bot, visible, steps }: { bot: Bot; visible: boolean; steps: Entry[] }) {
// Matches --working-duration; initial history appears without an entrance animation.
const presence = usePresence(visible, workingExitMs, false)
const lastActive = useRef(bot)
@@ -15,7 +15,8 @@ export function WorkingTransition({ bot, visible }: { bot: Bot; visible: boolean
<div className={`chat-working ${presence.shown ? 'shown' : ''}`} inert={!visible} aria-hidden={!visible}>
<div className="chat-working-clip">
<div className="chat-working-content">
- {indicator ? <WorkingIndicator bot={indicator} /> : null}
+ {/* Each turn starts folded. */}
+ {indicator ? <WorkingIndicator key={indicator.startedAt ?? 0} bot={indicator} steps={steps} /> : null}
</div>
</div>
</div>
diff --git a/apps/desktop/src/renderer/views/thread/follow-end.ts b/apps/desktop/src/renderer/views/thread/follow-end.ts
new file mode 100644
index 00000000..a1009d4b
--- /dev/null
+++ b/apps/desktop/src/renderer/views/thread/follow-end.ts
@@ -0,0 +1,16 @@
+import { useLayoutEffect, useRef, type UIEvent } from 'react'
+import { scrolledToEnd } from './trace-turns'
+
+/** A scroll box that opens at the end and follows new content there until the reader scrolls up. */
+export function useFollowEnd() {
+ const ref = useRef<HTMLDivElement>(null)
+ const atEnd = useRef(true)
+ useLayoutEffect(() => {
+ const el = ref.current
+ if (el && atEnd.current) el.scrollTop = el.scrollHeight
+ })
+ const onScroll = (e: UIEvent<HTMLDivElement>) => {
+ atEnd.current = scrolledToEnd(e.currentTarget)
+ }
+ return { ref, onScroll }
+}
diff --git a/apps/desktop/src/renderer/views/thread/thread.css b/apps/desktop/src/renderer/views/thread/thread.css
index 59c863d8..b8d01a06 100644
--- a/apps/desktop/src/renderer/views/thread/thread.css
+++ b/apps/desktop/src/renderer/views/thread/thread.css
@@ -237,9 +237,14 @@
margin-left: 88px;
max-width: calc(100% - 88px);
}
+/* The widest an agent bubble or card gets: most of the column, with room for a bubble's actions
+ (resolved against the conversation's container where it's used). */
+:root {
+ --agent-bubble-max: max(80px, min((100cqw + 32px) * 0.8 - 32px, 100cqw - 88px));
+}
.message.agent .message-body {
align-items: flex-start;
- max-width: max(80px, min((100cqw + 32px) * 0.8 - 32px, 100cqw - 88px));
+ max-width: var(--agent-bubble-max);
margin-right: 88px;
}
.bubble {
@@ -349,11 +354,35 @@
display: flex;
/* A column stretches the row to the pill's width, so a long activity truncates. */
flex-direction: column;
+ width: fit-content;
+ max-width: var(--agent-bubble-max);
padding: 12px;
border-radius: var(--radius-xl);
background: var(--bubble-agent);
text-align: left;
min-width: 0;
+ /* Unfolding widens the pill to a bubble's width in the same motion that grows it. */
+ interpolate-size: allow-keywords;
+ transition: width var(--layout);
+}
+.working.expanded {
+ width: 100%;
+}
+/* The steps never widen the pill themselves, so folding narrows it while they fold away. */
+.working .reveal {
+ contain: inline-size;
+}
+.working-toggle {
+ display: flex;
+ min-width: 0;
+ text-align: left;
+}
+/* The unfolded steps scroll inside the pill, so a long turn never runs down the chat. */
+.working-steps {
+ max-height: 280px;
+ overflow-y: auto;
+ padding-top: 12px;
+ font-size: var(--text-callout);
}
.call-overlay {
diff --git a/apps/desktop/src/renderer/views/thread/trace-turns.test.ts b/apps/desktop/src/renderer/views/thread/trace-turns.test.ts
index 6b3f4d1c..b3c4b113 100644
--- a/apps/desktop/src/renderer/views/thread/trace-turns.test.ts
+++ b/apps/desktop/src/renderer/views/thread/trace-turns.test.ts
@@ -1,10 +1,29 @@
import assert from 'node:assert/strict'
import { test } from 'node:test'
-import { runningTurn, scrolledToEnd, traceTurns } from './trace-turns.ts'
-import type { Entry } from '../../../shared/models.ts'
+import { runningTurn, scrolledToEnd, traceTurns, workingSteps } from './trace-turns.ts'
+import type { Entry, EntryData } from '../../../shared/models.ts'
-const entry = (id: string, turn: number, kind = 'agent', status?: string): Entry => ({
- id, seq: 0, botId: 'b', rev: 1, kind, turn, data: { text: id, status }, createdAt: 0, updatedAt: 0,
+const entry = (id: string, turn: number, kind = 'agent', status?: string, data: EntryData = {}): Entry => ({
+ id, seq: 0, botId: 'b', rev: 1, kind, turn, data: { text: id, status, ...data }, createdAt: 0, updatedAt: 0,
+})
+
+test('the working steps are the running turn’s work, without what the chat or memory already show', () => {
+ const entries = [
+ entry('old', 1, 'tool'),
+ entry('u2', 2, 'user'),
+ entry('thinking', 2, 'thought'),
+ entry('blank', 2, 'thought', undefined, { text: ' ' }),
+ entry('says', 2, 'agent'),
+ entry('terminal', 2, 'tool', 'in_progress', { bookkeeping: false }),
+ entry('memory', 2, 'tool', 'completed', { bookkeeping: true }),
+ entry('unflagged', 2, 'tool', 'completed'),
+ entry('plan', 2, 'plan'),
+ entry('reply', 2, 'agent', undefined, { final: true }),
+ entry('card', 2, 'permission'),
+ entry('pass', 2, 'agent', undefined, { text: '(pass)' }),
+ entry('q', 3, 'user', 'queued'),
+ ]
+ assert.deepEqual(workingSteps(entries).map((e) => e.id), ['thinking', 'says', 'terminal', 'plan'])
})
test('turns group in turn order and keep their entries in order', () => {
diff --git a/apps/desktop/src/renderer/views/thread/trace-turns.ts b/apps/desktop/src/renderer/views/thread/trace-turns.ts
index b575de8f..9565e5cc 100644
--- a/apps/desktop/src/renderer/views/thread/trace-turns.ts
+++ b/apps/desktop/src/renderer/views/thread/trace-turns.ts
@@ -13,6 +13,34 @@ export function runningTurn(entries: Entry[], working: boolean): number | undefi
return entries.reduce((t, e) => (e.data.status === 'queued' ? t : Math.max(t, e.turn)), -1)
}
+/** What the running turn has done so far, in order: the steps the working indicator unfolds. */
+export function workingSteps(entries: Entry[]): Entry[] {
+ const turn = runningTurn(entries, true)
+ return entries.filter((e) => e.turn === turn && isWorkingStep(e))
+}
+
+/** Thinking, narration, a tool call or a plan; never the bot's bookkeeping, nor a call the host didn't flag. */
+function isWorkingStep(e: Entry): boolean {
+ switch (e.kind) {
+ case 'thought':
+ return !!e.data.text?.trim()
+ case 'agent':
+ return !e.data.final && !isPass(e.data.text)
+ case 'tool':
+ return e.data.bookkeeping === false
+ case 'plan':
+ return true
+ default:
+ return false
+ }
+}
+
+/** No text, or a pass the host keeps out of the chat (`is_pass` in host/src/chat/group.rs). */
+function isPass(text = ''): boolean {
+ const t = text.trim().replace(/^[".*]+|[".*]+$/g, '').toLowerCase()
+ return t === '' || t === '(pass)' || t === 'pass'
+}
+
/** Scrolled to (within a few pixels of) the end: new steps keep it there. */
export function scrolledToEnd(el: { scrollHeight: number; scrollTop: number; clientHeight: number }) {
return el.scrollHeight - el.scrollTop - el.clientHeight < 8
diff --git a/apps/desktop/src/shared/models.ts b/apps/desktop/src/shared/models.ts
index 424bd2b1..423582c4 100644
--- a/apps/desktop/src/shared/models.ts
+++ b/apps/desktop/src/shared/models.ts
@@ -287,6 +287,9 @@ export interface EntryData {
clientNonce?: string
title?: string
toolKind?: string
+ /** tool: whether it's the bot's own bookkeeping (composing its message, keeping its memory), left out of the
+ * working steps; a host older than 2.25.0 leaves it out, and the steps then leave out the call too. */
+ bookkeeping?: boolean
output?: string
diffs?: FileDiff[]
locations?: { path: string; line?: number }[]
diff --git a/apps/ios/Kit/Sources/CodyncKit/Models/Entry+WorkingSteps.swift b/apps/ios/Kit/Sources/CodyncKit/Models/Entry+WorkingSteps.swift
new file mode 100644
index 00000000..bf1afd4b
--- /dev/null
+++ b/apps/ios/Kit/Sources/CodyncKit/Models/Entry+WorkingSteps.swift
@@ -0,0 +1,34 @@
+import Foundation
+
+/// The running turn's steps, which the working indicator unfolds and Full conversation opens on:
+/// docs/features/chat-messages.md, "While it works".
+public extension Entry {
+ /// Thinking, narration, a tool call or a plan; never the bot's bookkeeping, nor a call the host didn't flag
+ /// (one older than 2.25.0 flags none).
+ var isWorkingStep: Bool {
+ switch kind {
+ case "thought": !(data.text ?? "").trimmingCharacters(in: .whitespacesAndNewlines).isEmpty
+ case "agent": data.final != true && !Self.isPass(data.text ?? "")
+ case "tool": data.bookkeeping == false
+ case "plan": true
+ default: false
+ }
+ }
+
+ /// No text, or a pass the host keeps out of the chat (`is_pass` in host/src/chat/group.rs).
+ private static func isPass(_ text: String) -> Bool {
+ let t = text.trimmingCharacters(in: .whitespacesAndNewlines).trimmingCharacters(in: CharacterSet(charactersIn: "\".*")).lowercased()
+ return t.isEmpty || t == "(pass)" || t == "pass"
+ }
+
+ /// The turn running now while the bot works in this chat; a queued message already holds the next turn.
+ static func runningTurn(_ entries: [Entry], working: Bool) -> Int64? {
+ working ? entries.filter { $0.data.status != "queued" }.map(\.turn).max() : nil
+ }
+
+ /// What the running turn has done so far, in order.
+ static func workingSteps(_ entries: [Entry]) -> [Entry] {
+ let turn = runningTurn(entries, working: true)
+ return entries.filter { $0.turn == turn && $0.isWorkingStep }
+ }
+}
diff --git a/apps/ios/Kit/Sources/CodyncKit/Models/EntryData.swift b/apps/ios/Kit/Sources/CodyncKit/Models/EntryData.swift
index 0be53733..2fa90276 100644
--- a/apps/ios/Kit/Sources/CodyncKit/Models/EntryData.swift
+++ b/apps/ios/Kit/Sources/CodyncKit/Models/EntryData.swift
@@ -24,6 +24,9 @@ public struct EntryData: Codable, Hashable, Sendable {
public var clientNonce: String?
public var title: String?
public var toolKind: String?
+ /// tool: whether it's the bot's own bookkeeping (composing its message, keeping its memory), left out of the
+ /// working steps; `nil` from a host older than 2.25.0.
+ public var bookkeeping: Bool?
public var output: String?
public var diffs: [FileDiff]?
public var locations: [Location]?
diff --git a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/de.json b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/de.json
index 80fc3d74..b3b01508 100644
--- a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/de.json
+++ b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/de.json
@@ -965,6 +965,8 @@
"Session timeline": "Sitzungszeitleiste",
"Set by bot": "Vom Bot festgelegt",
"Show what it did": "Seine Aktionen anzeigen",
+ "Show steps": "Schritte anzeigen",
+ "Hide steps": "Schritte ausblenden",
"Sign in on the page that opened. This updates by itself when you're done.": "Melde dich auf der geöffneten Seite an. Danach wird diese Ansicht automatisch aktualisiert.",
"Sign in to see the other computers in your account.": "Melde dich an, um die anderen Computer in deinem Konto zu sehen.",
"Sign-in link copied: open it on this computer, then ^r refreshes": "Anmeldelink kopiert: auf diesem Computer öffnen, dann mit ^r aktualisieren",
diff --git a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/es.json b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/es.json
index 235f7baf..9477335b 100644
--- a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/es.json
+++ b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/es.json
@@ -965,6 +965,8 @@
"Session timeline": "Cronología de la sesión",
"Set by bot": "Definido por el bot",
"Show what it did": "Mostrar lo que hizo",
+ "Show steps": "Mostrar pasos",
+ "Hide steps": "Ocultar pasos",
"Sign in on the page that opened. This updates by itself when you're done.": "Inicia sesión en la página abierta. Esto se actualiza automáticamente al terminar.",
"Sign in to see the other computers in your account.": "Inicia sesión para ver las demás computadoras de tu cuenta.",
"Sign-in link copied: open it on this computer, then ^r refreshes": "Enlace de inicio de sesión copiado: ábrelo en esta computadora y luego ^r actualiza",
diff --git a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/fr.json b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/fr.json
index ef5dcb27..c1aa813b 100644
--- a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/fr.json
+++ b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/fr.json
@@ -965,6 +965,8 @@
"Session timeline": "Chronologie de la session",
"Set by bot": "Défini par le bot",
"Show what it did": "Voir ce qu’il a fait",
+ "Show steps": "Afficher les étapes",
+ "Hide steps": "Masquer les étapes",
"Sign in on the page that opened. This updates by itself when you're done.": "Connectez-vous sur la page ouverte. L’affichage s’actualise automatiquement une fois terminé.",
"Sign in to see the other computers in your account.": "Connectez-vous pour voir les autres ordinateurs de votre compte.",
"Sign-in link copied: open it on this computer, then ^r refreshes": "Lien de connexion copié : ouvrez-le sur cet ordinateur, puis ^r pour actualiser",
diff --git a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/ja.json b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/ja.json
index c33c6589..88c3944c 100644
--- a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/ja.json
+++ b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/ja.json
@@ -965,6 +965,8 @@
"Session timeline": "セッションのタイムライン",
"Set by bot": "ボットで設定",
"Show what it did": "それが何をしたかを見せてください",
+ "Show steps": "ステップを表示",
+ "Hide steps": "ステップを隠す",
"Sign in on the page that opened. This updates by itself when you're done.": "開いたページでサインインします。完了すると、これは自動的に更新されます。",
"Sign in to see the other computers in your account.": "サインインして、アカウント内の他のコンピューターを表示します。",
"Sign-in link copied: open it on this computer, then ^r refreshes": "サインイン リンクがコピーされました: このコンピュータで開くと、^r が更新されます",
diff --git a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/ko.json b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/ko.json
index 9d69ff04..14876e13 100644
--- a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/ko.json
+++ b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/ko.json
@@ -965,6 +965,8 @@
"Session timeline": "세션 타임라인",
"Set by bot": "봇이 설정함",
"Show what it did": "수행한 내용 보기",
+ "Show steps": "단계 보기",
+ "Hide steps": "단계 숨기기",
"Sign in on the page that opened. This updates by itself when you're done.": "열린 페이지에서 로그인하세요. 완료하면 자동으로 갱신됩니다.",
"Sign in to see the other computers in your account.": "계정의 다른 컴퓨터를 보려면 로그인하세요.",
"Sign-in link copied: open it on this computer, then ^r refreshes": "로그인 링크 복사됨: 이 컴퓨터에서 연 뒤 ^r로 새로고침",
diff --git a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/zh-Hans.json b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/zh-Hans.json
index df403ef9..28dfe7b4 100644
--- a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/zh-Hans.json
+++ b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/zh-Hans.json
@@ -965,6 +965,8 @@
"Session timeline": "会话时间线",
"Set by bot": "由 Bot 设置",
"Show what it did": "显示它做了什么",
+ "Show steps": "显示步骤",
+ "Hide steps": "隐藏步骤",
"Sign in on the page that opened. This updates by itself when you're done.": "在打开的页面上登录。完成后这里会自己更新。",
"Sign in to see the other computers in your account.": "登录后才能看到账户里的其他电脑。",
"Sign-in link copied: open it on this computer, then ^r refreshes": "登录链接已复制:在这台电脑上打开,然后按 ^r 刷新",
diff --git a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/zh-Hant.json b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/zh-Hant.json
index 5f56f03f..2ed29e4f 100644
--- a/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/zh-Hant.json
+++ b/apps/ios/Kit/Sources/CodyncKit/Resources/Languages/zh-Hant.json
@@ -965,6 +965,8 @@
"Session timeline": "會話時間線",
"Set by bot": "由 Bot 設定",
"Show what it did": "顯示它做了什麼",
+ "Show steps": "顯示步驟",
+ "Hide steps": "隱藏步驟",
"Sign in on the page that opened. This updates by itself when you're done.": "在開啟的頁面上登入。完成後這裡會自己更新。",
"Sign in to see the other computers in your account.": "登入後才能看到賬戶裡的其他電腦。",
"Sign-in link copied: open it on this computer, then ^r refreshes": "登入連結已複製:在這臺電腦上開啟,然後按 ^r 重新整理",
diff --git a/apps/ios/Kit/Sources/CodyncUI/CappedHeight.swift b/apps/ios/Kit/Sources/CodyncUI/CappedHeight.swift
new file mode 100644
index 00000000..41d0b9eb
--- /dev/null
+++ b/apps/ios/Kit/Sources/CodyncUI/CappedHeight.swift
@@ -0,0 +1,18 @@
+import SwiftUI
+
+/// Takes its content's own height, at most `max` points (and what it's offered): a `frame(maxHeight:)` grows to
+/// the cap whenever there's room, leaving the card half empty. A `ScrollView` inside hugs what it holds and
+/// scrolls once that's taller than the cap.
+struct CappedHeight: Layout {
+ let max: CGFloat
+
+ func sizeThatFits(proposal: ProposedViewSize, subviews: Subviews, cache: inout ()) -> CGSize {
+ guard let content = subviews.first else { return .zero }
+ let ideal = content.sizeThatFits(ProposedViewSize(width: proposal.width, height: nil))
+ return CGSize(width: ideal.width, height: min(ideal.height, max, proposal.height ?? .infinity))
+ }
+
+ func placeSubviews(in bounds: CGRect, proposal: ProposedViewSize, subviews: Subviews, cache: inout ()) {
+ subviews.first?.place(at: bounds.origin, proposal: ProposedViewSize(bounds.size))
+ }
+}
diff --git a/apps/ios/Kit/Sources/CodyncUI/Thread/ChatRows.swift b/apps/ios/Kit/Sources/CodyncUI/Thread/ChatRows.swift
index bb8175fa..d111781d 100644
--- a/apps/ios/Kit/Sources/CodyncUI/Thread/ChatRows.swift
+++ b/apps/ios/Kit/Sources/CodyncUI/Thread/ChatRows.swift
@@ -260,28 +260,85 @@ struct NoticeRow: View {
}
}
-/// The bot's current activity and elapsed time.
+/// The bot's current activity and elapsed time; once the turn has steps, a tap unfolds them.
struct WorkingIndicator: View {
let bot: Bot
+ let steps: [Entry]
+ @State private var expanded = false
+ @Environment(\.accessibilityReduceMotion) private var reduceMotion
var body: some View {
+ let open = expanded && !steps.isEmpty
+ let shape = RoundedRectangle(cornerRadius: 18, style: .continuous)
+ VStack(alignment: .leading, spacing: 0) {
+ if steps.isEmpty {
+ status(open: false)
+ } else {
+ Button {
+ withAnimation(Motion.reduced(Motion.layout, reduceMotion)) { expanded.toggle() }
+ } label: {
+ status(open: open).contentShape(Rectangle())
+ }
+ .buttonStyle(.plain)
+ .accessibilityHint(L10n.tr(open ? "Hide steps" : "Show steps"))
+ .accessibilityValue(open ? "Expanded" : "Collapsed")
+ }
+ if open {
+ WorkingSteps(steps: steps)
+ .padding(.top, 12)
+ .transition(.opacity)
+ }
+ }
+ .padding(.horizontal, 16)
+ .padding(.vertical, 12)
+ .frame(maxWidth: open ? .infinity : nil, alignment: .leading)
+ .background(Palette.bubbleAgent, in: shape)
+ // Folding steps never cross the pill's edge.
+ .clipShape(shape)
+ .frame(maxWidth: .infinity, alignment: .leading)
+ .padding(.trailing, 40)
+ }
+
+ private func status(open: Bool) -> some View {
HStack(spacing: 8) {
ThinkingOrb(state: bot.needsInput ? .listening : .working, size: 16, color: bot.needsInput ? Palette.warning : Palette.secondary)
Text(L10n.tr(bot.activity.isEmpty ? "Working…" : bot.activity))
.font(.subheadline)
.foregroundStyle(bot.needsInput ? Palette.warning : Palette.secondary)
.lineLimit(1)
+ .frame(maxWidth: open ? .infinity : nil, alignment: .leading)
if let started = bot.startedAt {
Text(Date(milliseconds: started), style: .timer)
.font(.footnote.monospacedDigit())
.foregroundStyle(Palette.tertiary)
}
+ if !steps.isEmpty {
+ Image(systemName: "chevron.right")
+ .font(.caption2.weight(.semibold))
+ .foregroundStyle(Palette.tertiary)
+ .rotationEffect(.degrees(open ? 90 : 0))
+ }
+ }
+ }
+}
+
+/// The turn's thinking, narration, tool calls and plan: hugs them, scrolls once they're taller than
+/// 280 points, and keeps the newest in view. One scroll view, so what the reader unfolds stays unfolded.
+private struct WorkingSteps: View {
+ let steps: [Entry]
+
+ var body: some View {
+ CappedHeight(max: 280) {
+ ScrollView {
+ VStack(alignment: .leading, spacing: 10) {
+ ForEach(steps) { TraceRow(entry: $0, unfolded: true) }
+ }
+ .frame(maxWidth: .infinity, alignment: .leading)
+ }
+ .scrollIndicators(.hidden)
+ .scrollBounceBehavior(.basedOnSize)
+ .defaultScrollAnchor(.bottom)
}
- .padding(.horizontal, 16)
- .padding(.vertical, 12)
- .background(Palette.bubbleAgent, in: RoundedRectangle(cornerRadius: 18, style: .continuous))
- .frame(maxWidth: .infinity, alignment: .leading)
- .padding(.trailing, 40)
}
}
diff --git a/apps/ios/Kit/Sources/CodyncUI/Thread/CommandList.swift b/apps/ios/Kit/Sources/CodyncUI/Thread/CommandList.swift
index 7b602a8e..f31f2a84 100644
--- a/apps/ios/Kit/Sources/CodyncUI/Thread/CommandList.swift
+++ b/apps/ios/Kit/Sources/CodyncUI/Thread/CommandList.swift
@@ -45,18 +45,3 @@ struct CommandList: View {
.padding(.vertical, 6)
}
}
-
-/// Offers its content at most `max` points of height and takes the content's own height: a
-/// `frame(maxHeight:)` grows to the cap whenever there's room, leaving the card half empty.
-private struct CappedHeight: Layout {
- let max: CGFloat
-
- func sizeThatFits(proposal: ProposedViewSize, subviews: Subviews, cache: inout ()) -> CGSize {
- let offer = ProposedViewSize(width: proposal.width, height: min(proposal.height ?? max, max))
- return subviews.first?.sizeThatFits(offer) ?? .zero
- }
-
- func placeSubviews(in bounds: CGRect, proposal: ProposedViewSize, subviews: Subviews, cache: inout ()) {
- subviews.first?.place(at: bounds.origin, proposal: ProposedViewSize(bounds.size))
- }
-}
diff --git a/apps/ios/Kit/Sources/CodyncUI/Thread/ThreadView.swift b/apps/ios/Kit/Sources/CodyncUI/Thread/ThreadView.swift
index ccf5f31d..9f498e54 100644
--- a/apps/ios/Kit/Sources/CodyncUI/Thread/ThreadView.swift
+++ b/apps/ios/Kit/Sources/CodyncUI/Thread/ThreadView.swift
@@ -360,7 +360,8 @@ extension ThreadView {
// Offline, "working" is only what the computer last said; don't show it as live.
if let bot, working {
rows.append(ConversationRow("working") {
- WorkingIndicator(bot: bot)
+ // Each turn starts folded.
+ WorkingIndicator(bot: bot, steps: Entry.workingSteps(model.chat(botId)))
.id(bot.startedAt)
.padding(.top, 6)
})
diff --git a/apps/ios/Kit/Sources/CodyncUI/Thread/TraceView.swift b/apps/ios/Kit/Sources/CodyncUI/Thread/TraceView.swift
index b391c017..e1bcf1bf 100644
--- a/apps/ios/Kit/Sources/CodyncUI/Thread/TraceView.swift
+++ b/apps/ios/Kit/Sources/CodyncUI/Thread/TraceView.swift
@@ -14,7 +14,7 @@ public struct TraceView: View {
let turns = Dictionary(grouping: all, by: \.turn)
.sorted { $0.key < $1.key }
// The running turn's thoughts start unfolded.
- let running = Self.runningTurn(all, working: model.bots[botId]?.isWorking(in: botId) == true)
+ let running = Entry.runningTurn(all, working: model.bots[botId]?.isWorking(in: botId) == true)
VStack(spacing: 0) {
ModalHeader("Full conversation")
ScrollView {
@@ -44,14 +44,9 @@ public struct TraceView: View {
.background(Palette.background)
.tracked(.screenViewed(.trace))
}
-
- /// The turn running now while the bot works in this chat; a queued message already holds the next turn.
- nonisolated static func runningTurn(_ entries: [Entry], working: Bool) -> Int64? {
- working ? entries.filter { $0.data.status != "queued" }.map(\.turn).max() : nil
- }
}
-private struct TraceRow: View {
+struct TraceRow: View {
let entry: Entry
@State private var expanded: Bool
diff --git a/apps/ios/Kit/Tests/CodyncUITests/ChatItemTests.swift b/apps/ios/Kit/Tests/CodyncUITests/ChatItemTests.swift
index 253aca19..2e94abde 100644
--- a/apps/ios/Kit/Tests/CodyncUITests/ChatItemTests.swift
+++ b/apps/ios/Kit/Tests/CodyncUITests/ChatItemTests.swift
@@ -1,4 +1,5 @@
import Foundation
+import SwiftUI
import Testing
@testable import CodyncKit
@testable import CodyncUI
@@ -73,6 +74,36 @@ import Testing
data: EntryData(text: id, status: status), createdAt: 0, updatedAt: 0)
}
let entries = [entry("u1", turn: 1), entry("t1", turn: 1), entry("q", turn: 2, status: "queued")]
- #expect(TraceView.runningTurn(entries, working: true) == 1)
- #expect(TraceView.runningTurn(entries, working: false) == nil)
+ #expect(Entry.runningTurn(entries, working: true) == 1)
+ #expect(Entry.runningTurn(entries, working: false) == nil)
+}
+
+/// The working indicator unfolds the running turn's work, without what the chat or memory already show.
+@Test func workingStepsAreTheRunningTurnsWork() {
+ func entry(_ id: String, _ kind: String, turn: Int64 = 2, text: String? = nil, status: String? = nil,
+ final: Bool? = nil, bookkeeping: Bool? = nil) -> Entry {
+ var data = EntryData(text: text ?? id, status: status)
+ data.final = final
+ data.bookkeeping = bookkeeping
+ return Entry(id: id, seq: 0, botId: "b", rev: 0, kind: kind, turn: turn, data: data, createdAt: 0, updatedAt: 0)
+ }
+ let entries = [
+ entry("old", "tool", turn: 1), entry("u2", "user"), entry("thinking", "thought"), entry("blank", "thought", text: " "),
+ entry("says", "agent"), entry("terminal", "tool", status: "in_progress", bookkeeping: false),
+ entry("memory", "tool", bookkeeping: true), entry("unflagged", "tool"),
+ entry("plan", "plan"), entry("reply", "agent", final: true), entry("card", "permission"),
+ entry("pass", "agent", text: "(pass)"),
+ entry("q", "user", turn: 3, status: "queued"),
+ ]
+ #expect(Entry.workingSteps(entries).map(\.id) == ["thinking", "says", "terminal", "plan"])
+}
+
+/// The unfolded steps are one scroll view that hugs them and scrolls past its cap.
+@MainActor @Test func aCappedScrollViewHugsItsContentAndScrollsPastTheCap() {
+ func height(_ content: CGFloat) -> CGFloat {
+ UIHostingController(rootView: CappedHeight(max: 280) { ScrollView { Color.clear.frame(height: content) } })
+ .sizeThatFits(in: CGSize(width: 390, height: 2000)).height
+ }
+ #expect(height(100) == 100)
+ #expect(height(1000) == 280)
}
diff --git a/apps/ios/WhatsNew.md b/apps/ios/WhatsNew.md
index 3ebb9dec..a2562e06 100644
--- a/apps/ios/WhatsNew.md
+++ b/apps/ios/WhatsNew.md
@@ -17,6 +17,7 @@ a version without one gets a generic "Bug fixes and improvements" line. Delete o
- 帳號選單裡的「電腦與設定」和它打開的頁面同名。
- 新增聯結器失敗後再試一次,會使用你改好的金鑰。
- 使用 Hermes Agent 或 Gemini CLI 的 Bot,記憶頁會說明它們自己的記憶由所有用同一個 agent 的 Bot 共用,Codync 沒辦法關掉。
+- Bot 工作中點一下狀態膠囊,就能在對話裡展開這一輪的思考、工具與 MCP 呼叫,太長時在膠囊內捲動。
### en-US
- Bots can make artifacts: reports, trackers and dashboards you come back to show as a card in the chat. Open one full screen and message the bot below it to change it; it updates in place.
@@ -27,6 +28,7 @@ a version without one gets a generic "Bug fixes and improvements" line. Delete o
- The account sheet's Computers & settings row now has the same name as the page it opens.
- Trying again after adding a connector failed uses the key you corrected.
- For bots that run Hermes Agent or Gemini CLI, Memory explains that the agent's own memory is shared by every bot that runs it and Codync can't turn it off.
+- While a bot works, tap its status pill to unfold this turn's thinking, tool and MCP calls right in the chat; a long turn scrolls inside the pill.
## 2.24.0
diff --git a/docs/architecture/conversation-runtime.md b/docs/architecture/conversation-runtime.md
index d450587b..6304084b 100644
--- a/docs/architecture/conversation-runtime.md
+++ b/docs/architecture/conversation-runtime.md
@@ -7,4 +7,4 @@
- **A session that fails** with an internal error its agent gives no category (JSON-RPC `-32603` without `data.errorKind`) is closed right after the turn, when the agent can close and load sessions: Claude's adapter otherwise answers every later prompt on it with "The Claude Agent session has ended". The next message loads it again and the conversation carries on (`acp::may_end_session`).
- Bot collaboration: built-in `team` MCP (`chat/team.rs`) lists visible bots and sends one a request through its actor queue (`message_bot`); nothing waits, and the reply comes back to the sender as a turn of its own in its main chat. Requests and replies are separate turns, bounded by the chain's hop count; native subagents stay with the harness. See [docs/features/bot-collaboration.md](../features/bot-collaboration.md).
- **Context & memory**: frozen instruction snapshot per session + compaction epoch (Claude gets it as a system prompt), profile edits as update blocks, memory in the host (a layer shared by all bots and one per bot, written by the user, the bots' tools and dreaming), busy-time messages folded into one turn, interrupted turns resumed: [docs/features/context-and-memory.md](../features/context-and-memory.md).
-- **Chat shows only**: user messages, the bot's messages (`data.final`: each `send_message` call from the built-in `chat` MCP, Grok Bot's way; a turn that sent none falls back to its last text, unless it reacted to the user's message instead or passed), permission cards, notices. Nothing streams into a bubble; narration, thoughts, tool calls, plans are trace entries (Full conversation sheet): [docs/features/chat-messages.md](../features/chat-messages.md).
+- **Chat shows only**: user messages, the bot's messages (`data.final`: each `send_message` call from the built-in `chat` MCP, Grok Bot's way; a turn that sent none falls back to its last text, unless it reacted to the user's message instead or passed), permission cards, notices. Nothing streams into a bubble; narration, thoughts, tool calls, plans are trace entries (Full conversation sheet; the live activity also unfolds the running turn's steps, without the bot's `bookkeeping` tool calls): [docs/features/chat-messages.md](../features/chat-messages.md).
diff --git a/docs/design/ui-conventions.md b/docs/design/ui-conventions.md
index 81831e62..b5dd4360 100644
--- a/docs/design/ui-conventions.md
+++ b/docs/design/ui-conventions.md
@@ -123,7 +123,10 @@ and states.
- A chat shows the latest non-final agent segment only while its turn is
working and connected. Earlier narration, tools, empty text and `(pass)` stay out
- of chat. Completed replies remain visible.
+ of the message list: the running turn's thinking, narration, tool calls (not the
+ bot's bookkeeping) and plan appear only in the working pill's unfolded steps
+ ([while it works](../features/chat-messages.md#while-it-works)), and every turn's in
+ Full conversation. Completed replies remain visible.
- TUI keeps text and attachments in the composer until sending succeeds. A failed
send can be retried with Enter; it reuses the nonce. A late response must not erase
a draft edited while the request was running.
diff --git a/docs/features/chat-messages.md b/docs/features/chat-messages.md
index 9a76d0e5..e48c3c6f 100644
--- a/docs/features/chat-messages.md
+++ b/docs/features/chat-messages.md
@@ -63,13 +63,25 @@ it has no pointer tooltip or link-opening action.
## While it works
The working line under the last message shows the bot's activity; composing a `send_message`
-reads as **Typing…** (`activity()` in `agent/bot.rs`). The activity indicator shows an animated orb,
-a short status and elapsed time. It is not interactive and does not expand thinking text.
-Replies arrive as complete messages.
+reads as **Typing…** (`activity()` in `agent/bot/tool_entry.rs`). The activity indicator shows an
+animated orb, a short status and elapsed time, in a pill no wider than an agent bubble whose status
+truncates to one line. Replies arrive as complete messages.
+
+Once the running turn has steps, the pill ends in a chevron and a tap (click) unfolds them inside it:
+the turn's thinking text, narration (never a `(pass)`), tool calls (MCP tools included) and plan, in order, with each
+tool's output and diffs one more tap away. The pill widens to an agent bubble's width, the steps
+scroll inside it past 280 pt and follow new ones until the reader scrolls up, and each turn starts
+folded; the pill leaves with the turn. The host sets `bookkeeping` on every tool entry: `true` for
+the bot's own bookkeeping (a `send_message` call, a `memory` MCP call, or a call naming a file in a
+memory folder the bot sees), which the steps leave out, as the working line does. A host older than
+2.25.0 sets none, so its tool calls stay out of the steps too. A turn with no steps yet (some agents
+send no thinking text) shows no chevron.
Full conversation remains available from the conversation menu. It contains narration, all
thoughts, tools and previous turns, and follows new steps until the reader scrolls up.
-On the terminal, `t` opens Full conversation, and the working line retains the count of steps so far.
+On the terminal, `>` or a click on the working line unfolds the steps under it (their last
+14 lines), `t` opens Full conversation, and the working line keeps the count of steps so far;
+once the turn ends, its last message's `↳ N steps` line counts them the same way.
## Motion and scrolling
diff --git a/host/src/agent/bot/mod.rs b/host/src/agent/bot/mod.rs
index 6a186ed4..81482c21 100644
--- a/host/src/agent/bot/mod.rs
+++ b/host/src/agent/bot/mod.rs
@@ -4,7 +4,8 @@
//! Chat model (from Grok Bot): the chat only shows user messages, the *final*
//! agent message of each turn, permission cards and notices. Narration between
//! tool calls, thoughts, tool calls and plans are trace entries shown in the
-//! "full conversation" sheet, and surface live as the roster activity line.
+//! "full conversation" sheet, and surface live as the activity line and the
+//! working steps a chat unfolds.
//!
//! Context (from Grok Bot too): the bot's instructions and memory are a frozen
//! snapshot per session and compaction epoch (`context`), finished turns feed
@@ -23,6 +24,7 @@ mod launch;
mod lifecycle;
mod queue;
mod session;
+mod tool_entry;
mod turn;
mod updates;
diff --git a/host/src/agent/bot/tool_entry.rs b/host/src/agent/bot/tool_entry.rs
new file mode 100644
index 00000000..e3cb249c
--- /dev/null
+++ b/host/src/agent/bot/tool_entry.rs
@@ -0,0 +1,188 @@
+//! Tool-call entries: ACP content folded into output and diffs, the working line a call shows,
+//! and which calls are the bot's own bookkeeping.
+
+use crate::agent::acp;
+use crate::chat::memory::files;
+use crate::store::BotConfig;
+use serde_json::{Value, json};
+use std::path::{Path, PathBuf};
+
+/// Folds ACP tool-call `content` into `{output, diffs}` on an entry's data.
+pub(super) fn merge_tool_content(data: &mut Value, content: &Value) {
+ let Some(items) = content.as_array() else { return };
+ let mut out = String::new();
+ let mut diffs = vec![];
+ for item in items {
+ match item["type"].as_str() {
+ Some("diff") => {
+ let path = item["path"].as_str().unwrap_or_default();
+ let old = item["oldText"].as_str().unwrap_or_default();
+ let new = item["newText"].as_str().unwrap_or_default();
+ diffs.push(diff_summary(path, old, new));
+ }
+ Some("terminal") => {}
+ _ => {
+ let t = acp::content_text(item);
+ if !t.is_empty() {
+ if !out.is_empty() {
+ out.push('\n');
+ }
+ out.push_str(&t);
+ }
+ }
+ }
+ }
+ if !out.is_empty() {
+ data["output"] = acp::truncate(&out, 6000).into();
+ }
+ if !diffs.is_empty() {
+ data["diffs"] = diffs.into();
+ }
+}
+
+/// Changed-region summary: trims the common prefix/suffix and reports the middle.
+fn diff_summary(path: &str, old: &str, new: &str) -> Value {
+ let a: Vec<&str> = old.lines().collect();
+ let b: Vec<&str> = new.lines().collect();
+ let prefix = a.iter().zip(&b).take_while(|(x, y)| x == y).count();
+ let suffix = a[prefix..].iter().rev().zip(b[prefix..].iter().rev()).take_while(|(x, y)| x == y).count();
+ let removed = &a[prefix..a.len() - suffix];
+ let added = &b[prefix..b.len() - suffix];
+ let mut unified = String::new();
+ for (sign, lines) in [('-', removed), ('+', added)] {
+ for l in lines {
+ unified.push(sign);
+ unified.push_str(l);
+ unified.push('\n');
+ }
+ }
+ json!({
+ "path": path,
+ "added": added.len(),
+ "removed": removed.len(),
+ "isNew": old.is_empty(),
+ "startLine": prefix + 1,
+ "patch": acp::truncate(&unified, 6000),
+ })
+}
+
+/// Composing the bot's message: the `chat` MCP server's `send_message`, by the name the agent titles the call with.
+fn sends_message(title: &str) -> bool {
+ ["mcp__chat__send_message", "chat.send_message"].iter().any(|name| title.starts_with(name))
+}
+
+/// Keeping the bot's memory: a call of the `memory` MCP server, or one that names a file in a memory folder the
+/// bot sees (in its `locations` or diffs, as `chat::memory::turns::touched` reads them).
+fn keeps_memory(cfg: &BotConfig, data: &Value) -> bool {
+ let title = data["title"].as_str().unwrap_or_default();
+ if ["mcp__memory__", "memory."].iter().any(|server| title.starts_with(server)) {
+ return true;
+ }
+ let folders: Vec<PathBuf> = files::layers(cfg).iter().map(|layer| files::folder(layer.as_deref())).collect();
+ data["locations"]
+ .as_array()
+ .into_iter()
+ .chain(data["diffs"].as_array())
+ .flatten()
+ .filter_map(|item| item["path"].as_str())
+ .any(|path| folders.iter().any(|dir| Path::new(path).starts_with(dir)))
+}
+
+/// Flags whether a call is the bot's own bookkeeping (composing its message, keeping its memory), which the
+/// working steps a chat unfolds leave out. An update can change the title or paths, so the flag follows them.
+/// Always written, so clients tell an older host's unflagged call from one that isn't bookkeeping.
+pub(super) fn mark_bookkeeping(cfg: &BotConfig, data: &mut Value) {
+ let flag = sends_message(data["title"].as_str().unwrap_or_default()) || keeps_memory(cfg, data);
+ data["bookkeeping"] = flag.into();
+}
+
+/// The working line for a flagged tool call: composing a message reads as typing, and memory stays out of the
+/// chat, its working line included (the memory settings show it).
+pub(super) fn activity(data: &Value) -> &str {
+ let title = data["title"].as_str().unwrap_or("Tool");
+ if sends_message(title) {
+ "Typing…"
+ } else if data["bookkeeping"] == true {
+ "Thinking…"
+ } else {
+ title
+ }
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ fn marked(mut data: Value) -> Value {
+ let cfg = serde_json::from_value(json!({"id": "b", "name": "Bot", "backend": "claude", "cwd": "/tmp"}))
+ .expect("a bot config");
+ mark_bookkeeping(&cfg, &mut data);
+ data
+ }
+
+ #[test]
+ fn the_bots_own_calls_are_bookkeeping() {
+ let note = files::folder(Some("b")).join("trip.md").display().to_string();
+ for data in [
+ json!({"title": "mcp__chat__send_message"}),
+ json!({"title": "chat.send_message"}),
+ json!({"title": "mcp__memory__edit_memory"}),
+ json!({"title": "memory.search_memory"}),
+ json!({"title": "Write", "locations": [{"path": note}]}),
+ json!({"title": "Edit", "diffs": [{"path": note}]}),
+ ] {
+ assert_eq!(marked(data.clone())["bookkeeping"], true, "{data}");
+ }
+ }
+
+ #[test]
+ fn work_that_only_names_memory_or_messages_is_not_bookkeeping() {
+ for data in [
+ json!({"title": "Read /Users/me/app/src/memory.rs", "locations": [{"path": "/Users/me/app/src/memory.rs"}]}),
+ json!({"title": "rg -n send_message src/"}),
+ json!({"title": "Edit docs/design/bot-memory.md", "diffs": [{"path": "/repo/docs/design/bot-memory.md"}]}),
+ json!({"title": "Terminal"}),
+ ] {
+ assert_eq!(marked(data.clone())["bookkeeping"], false, "{data}");
+ }
+ }
+
+ #[test]
+ fn bookkeeping_follows_the_title() {
+ let mut data = marked(json!({"title": "Tool"}));
+ assert_eq!(data["bookkeeping"], false);
+ data["title"] = "mcp__memory__edit_memory".into();
+ assert_eq!(marked(data)["bookkeeping"], true);
+ }
+
+ #[test]
+ fn memory_work_reads_as_thinking() {
+ assert_eq!(activity(&marked(json!({"title": "mcp__chat__send_message"}))), "Typing…");
+ assert_eq!(activity(&marked(json!({"title": "mcp__memory__edit_memory"}))), "Thinking…");
+ assert_eq!(activity(&marked(json!({"title": "Read src/memory.rs"}))), "Read src/memory.rs");
+ assert_eq!(activity(&marked(json!({"title": "Terminal"}))), "Terminal");
+ }
+
+ #[test]
+ fn diff_counts_changed_middle() {
+ let d = diff_summary("f", "a\nb\nc\n", "a\nB\nB2\nc\n");
+ assert_eq!(d["added"], 2);
+ assert_eq!(d["removed"], 1);
+ assert_eq!(d["startLine"], 2);
+ assert_eq!(d["patch"], "-b\n+B\n+B2\n");
+ }
+
+ #[test]
+ fn tool_content_merges_text_and_diffs() {
+ let mut data = json!({"output": "", "diffs": []});
+ merge_tool_content(
+ &mut data,
+ &json!([
+ {"type": "content", "content": {"type": "text", "text": "ok"}},
+ {"type": "diff", "path": "/a.rs", "oldText": "", "newText": "x\n"}
+ ]),
+ );
+ assert_eq!(data["output"], "ok");
+ assert_eq!(data["diffs"][0]["isNew"], true);
+ }
+}
diff --git a/host/src/agent/bot/updates.rs b/host/src/agent/bot/updates.rs
index 1774d1a7..14d046de 100644
--- a/host/src/agent/bot/updates.rs
+++ b/host/src/agent/bot/updates.rs
@@ -1,6 +1,7 @@
//! Agent → client: `session/update`s, permission requests and streamed text mapped onto entries.
use super::fast_mode::Listing;
+use super::tool_entry::{activity, mark_bookkeeping, merge_tool_content};
use super::{Actor, Reacted, Seg, SegKind};
use crate::agent::acp::{self, Incoming};
use crate::hub::BotStatus;
@@ -82,12 +83,13 @@ impl Actor {
"locations": u["locations"].clone(),
});
merge_tool_content(&mut data, &u["content"]);
+ mark_bookkeeping(&self.cfg, &mut data);
crate::chat::memory::turns::touched(&self.hub, &self.cfg, &data);
- let title = data["title"].as_str().unwrap_or("Tool").to_owned();
+ let working = activity(&data).to_owned();
if let Some(e) = self.add(EntryKind::Tool, turn, data) {
self.tools.insert(tool_id, e.id);
}
- self.set_activity(activity(&title));
+ self.set_activity(&working);
}
"tool_call_update" => {
let tool_id = u["toolCallId"].as_str().unwrap_or_default();
@@ -102,12 +104,12 @@ impl Actor {
e.data["locations"] = u["locations"].clone();
}
merge_tool_content(&mut e.data, &u["content"]);
+ mark_bookkeeping(&self.cfg, &mut e.data);
crate::chat::memory::turns::touched(&self.hub, &self.cfg, &e.data);
- let status = e.data["status"].as_str().unwrap_or_default().to_owned();
- let title = e.data["title"].as_str().unwrap_or_default().to_owned();
+ let working = (e.data["status"] == "in_progress").then(|| activity(&e.data).to_owned());
self.hub.set_entry(&entry_id, &e.data);
- if status == "in_progress" {
- self.set_activity(activity(&title));
+ if let Some(working) = working {
+ self.set_activity(&working);
}
}
"compaction_update" => {
@@ -373,110 +375,3 @@ impl Actor {
self.seg = Seg::None;
}
}
-
-/// Folds ACP tool-call `content` into `{output, diffs}` on an entry's data.
-pub fn merge_tool_content(data: &mut Value, content: &Value) {
- let Some(items) = content.as_array() else { return };
- let mut out = String::new();
- let mut diffs = vec![];
- for item in items {
- match item["type"].as_str() {
- Some("diff") => {
- let path = item["path"].as_str().unwrap_or_default();
- let old = item["oldText"].as_str().unwrap_or_default();
- let new = item["newText"].as_str().unwrap_or_default();
- diffs.push(diff_summary(path, old, new));
- }
- Some("terminal") => {}
- _ => {
- let t = acp::content_text(item);
- if !t.is_empty() {
- if !out.is_empty() {
- out.push('\n');
- }
- out.push_str(&t);
- }
- }
- }
- }
- if !out.is_empty() {
- data["output"] = acp::truncate(&out, 6000).into();
- }
- if !diffs.is_empty() {
- data["diffs"] = diffs.into();
- }
-}
-
-/// Changed-region summary: trims the common prefix/suffix and reports the middle.
-pub fn diff_summary(path: &str, old: &str, new: &str) -> Value {
- let a: Vec<&str> = old.lines().collect();
- let b: Vec<&str> = new.lines().collect();
- let prefix = a.iter().zip(&b).take_while(|(x, y)| x == y).count();
- let suffix = a[prefix..].iter().rev().zip(b[prefix..].iter().rev()).take_while(|(x, y)| x == y).count();
- let removed = &a[prefix..a.len() - suffix];
- let added = &b[prefix..b.len() - suffix];
- let mut unified = String::new();
- for (sign, lines) in [('-', removed), ('+', added)] {
- for l in lines {
- unified.push(sign);
- unified.push_str(l);
- unified.push('\n');
- }
- }
- json!({
- "path": path,
- "added": added.len(),
- "removed": removed.len(),
- "isNew": old.is_empty(),
- "startLine": prefix + 1,
- "patch": acp::truncate(&unified, 6000),
- })
-}
-
-/// The working line for a tool call: composing a message reads as typing.
-fn activity(title: &str) -> &str {
- if title.contains("send_message") {
- "Typing…"
- } else if ["memory__", "memory.", "bot-memory", "shared-memory"].iter().any(|m| title.contains(m)) {
- // Memory stays out of the chat, its working line included: the memory settings show it.
- "Thinking…"
- } else {
- title
- }
-}
-
-#[cfg(test)]
-mod tests {
- use super::*;
-
- #[test]
- fn memory_work_reads_as_thinking() {
- assert_eq!(activity("mcp__chat__send_message"), "Typing…");
- assert_eq!(activity("mcp__memory__edit_memory"), "Thinking…");
- assert_eq!(activity("Write /Users/me/.codync/bots/b/bot-memory/trip.md"), "Thinking…");
- assert_eq!(activity("Terminal"), "Terminal");
- }
-
- #[test]
- fn diff_counts_changed_middle() {
- let d = diff_summary("f", "a\nb\nc\n", "a\nB\nB2\nc\n");
- assert_eq!(d["added"], 2);
- assert_eq!(d["removed"], 1);
- assert_eq!(d["startLine"], 2);
- assert_eq!(d["patch"], "-b\n+B\n+B2\n");
- }
-
- #[test]
- fn tool_content_merges_text_and_diffs() {
- let mut data = json!({"output": "", "diffs": []});
- merge_tool_content(
- &mut data,
- &json!([
- {"type": "content", "content": {"type": "text", "text": "ok"}},
- {"type": "diff", "path": "/a.rs", "oldText": "", "newText": "x\n"}
- ]),
- );
- assert_eq!(data["output"], "ok");
- assert_eq!(data["diffs"][0]["isNew"], true);
- }
-}
diff --git a/host/src/tui/app/input.rs b/host/src/tui/app/input.rs
index 050e997e..08d22429 100644
--- a/host/src/tui/app/input.rs
+++ b/host/src/tui/app/input.rs
@@ -270,6 +270,7 @@ impl App {
}
KeyCode::Char('{') => self.step_turn(-1),
KeyCode::Char('}') => self.step_turn(1),
+ KeyCode::Char('>') => self.toggle_steps(),
KeyCode::Char('t') => {
self.trace = if self.trace == TraceMode::Pane { TraceMode::Off } else { TraceMode::Pane };
if self.trace == TraceMode::Off && self.focus == Focus::Trace {
@@ -408,6 +409,7 @@ impl App {
}
}
Some(Click::Composer) => self.start_typing(),
+ Some(Click::Steps) => self.toggle_steps(),
Some(Click::BotChat(entry)) => self.open_bot_chat(&entry),
None => {
if self.overlays.is_empty() {
diff --git a/host/src/tui/app/mod.rs b/host/src/tui/app/mod.rs
index b4e801a2..f25f99f2 100644
--- a/host/src/tui/app/mod.rs
+++ b/host/src/tui/app/mod.rs
@@ -12,12 +12,14 @@ mod navigate;
mod new_bot;
mod overlay_keys;
mod slash;
+mod steps;
mod ui;
pub use editor::Editor;
pub use exchange::{ConversationRow, Exchange, Item, Outcome, conversation, group, rows};
pub use model::{After, AgentModel, Bot, Entry, Kind, Mark, ModelOption, Msg, OwnMemory, Status};
pub use slash::SlashAction;
+pub(super) use steps::{running_turn, working_steps};
pub use ui::{
ACTIONS, Action, COLORS, Click, Confirm, ConfirmAct, Dir, FIELDS, FILTERS, Field, Focus, FolderPicker, Form, Goto,
GotoItem, GroupField, GroupForm, Hits, NewBot, NewBotField, Overlay, PairCode, SHAPES, Toast, Toggle, TraceMode,
@@ -81,6 +83,8 @@ pub struct App {
pub trace: TraceMode,
/// Turn shown in the trace; `None` follows the latest.
pub trace_turn: Option<i64>,
+ /// The bot and turn whose working steps are unfolded.
+ pub steps_open: Option<(String, i64)>,
pub compact: bool,
pub overlays: Vec<Overlay>,
pub toasts: Vec<Toast>,
@@ -156,6 +160,7 @@ impl App {
trace_scroll: 0,
trace: TraceMode::Off,
trace_turn: None,
+ steps_open: None,
compact: false,
overlays: vec![],
toasts: vec![],
diff --git a/host/src/tui/app/model.rs b/host/src/tui/app/model.rs
index d65a51ed..83106ee2 100644
--- a/host/src/tui/app/model.rs
+++ b/host/src/tui/app/model.rs
@@ -283,6 +283,11 @@ impl Bot {
self.resting.iter().find(|r| r.agent == agent && r.until > now)
}
+ /// A turn is running: working, or waiting on the user.
+ pub fn busy(&self) -> bool {
+ matches!(self.status, Status::Working | Status::NeedsInput)
+ }
+
/// Whether the running turn talks in this chat.
pub fn works_here(&self) -> bool {
self.away().is_none()
@@ -377,6 +382,18 @@ impl Entry {
self.kind == Kind::Agent && self.data["final"].as_bool().unwrap_or(false)
}
+ /// A step the working line unfolds: thinking, narration, a tool call or a plan, never the bot's bookkeeping
+ /// (nor a call an older host didn't flag either way).
+ pub fn is_working_step(&self) -> bool {
+ match self.kind {
+ Kind::Thought => !self.text().trim().is_empty(),
+ Kind::Agent => !self.is_final() && !crate::chat::group::is_pass(self.text()),
+ Kind::Tool => self.data["bookkeeping"] == false,
+ Kind::Plan => true,
+ _ => false,
+ }
+ }
+
/// A message the user can answer with a reply: theirs, or a final reply (the host checks too).
pub fn takes_reply(&self) -> bool {
self.kind == Kind::User || self.is_final()
diff --git a/host/src/tui/app/steps.rs b/host/src/tui/app/steps.rs
new file mode 100644
index 00000000..b602c1b2
--- /dev/null
+++ b/host/src/tui/app/steps.rs
@@ -0,0 +1,65 @@
+//! The working line's steps: what the running turn has done so far, unfolded for one bot and turn.
+
+use super::{App, Bot, Entry};
+
+/// The turn running now; a queued message already holds the next turn.
+pub(in crate::tui) fn running_turn(entries: &[&Entry]) -> Option<i64> {
+ entries.iter().filter(|e| e.data["status"] != "queued").map(|e| e.turn).max()
+}
+
+/// The running turn's thinking, narration, tool calls and plan, in order.
+pub(in crate::tui) fn working_steps<'a>(entries: &[&'a Entry]) -> Vec<&'a Entry> {
+ let turn = running_turn(entries);
+ entries.iter().copied().filter(|e| Some(e.turn) == turn && e.is_working_step()).collect()
+}
+
+impl App {
+ /// Whether `bot`'s chat shows the working line: a turn in flight in this chat, while connected.
+ pub(in crate::tui) fn shows_activity(&self, bot: &Bot) -> bool {
+ self.online && bot.busy() && bot.works_here()
+ }
+
+ /// `>` or a click on the working line: unfolds or folds the selected bot's steps for this turn.
+ pub(super) fn toggle_steps(&mut self) {
+ let Some(bot) = self.bot().filter(|b| self.shows_activity(b)) else { return };
+ let lane = self.lane(&bot.id);
+ if working_steps(&lane).is_empty() {
+ return;
+ }
+ let Some(turn) = running_turn(&lane) else { return };
+ let key = (bot.id.clone(), turn);
+ self.steps_open = if self.steps_open.as_ref() == Some(&key) { None } else { Some(key) };
+ }
+}
+
+#[cfg(test)]
+mod tests {
+ use super::super::Kind;
+ use super::*;
+ use serde_json::json;
+
+ fn entry(id: &str, turn: i64, kind: Kind, data: serde_json::Value) -> Entry {
+ Entry { id: id.into(), seq: 0, turn, kind, data, created_at: 0 }
+ }
+
+ #[test]
+ fn steps_are_the_running_turns_work_without_what_the_chat_or_memory_show() {
+ let entries = [
+ entry("old", 1, Kind::Tool, json!({})),
+ entry("u2", 2, Kind::User, json!({"text": "go"})),
+ entry("thinking", 2, Kind::Thought, json!({"text": "Checking the build"})),
+ entry("blank", 2, Kind::Thought, json!({"text": " "})),
+ entry("says", 2, Kind::Agent, json!({"text": "Running the tests"})),
+ entry("terminal", 2, Kind::Tool, json!({"title": "npm test", "bookkeeping": false})),
+ entry("memory", 2, Kind::Tool, json!({"title": "mcp__memory__edit_memory", "bookkeeping": true})),
+ entry("unflagged", 2, Kind::Tool, json!({"title": "an older host's call"})),
+ entry("plan", 2, Kind::Plan, json!({"entries": []})),
+ entry("reply", 2, Kind::Agent, json!({"text": "Done", "final": true})),
+ entry("card", 2, Kind::Permission, json!({})),
+ entry("pass", 2, Kind::Agent, json!({"text": "(pass)"})),
+ entry("q", 3, Kind::User, json!({"status": "queued"})),
+ ];
+ let ids: Vec<_> = working_steps(&entries.iter().collect::<Vec<_>>()).iter().map(|e| e.id.as_str()).collect();
+ assert_eq!(ids, ["thinking", "says", "terminal", "plan"]);
+ }
+}
diff --git a/host/src/tui/app/ui.rs b/host/src/tui/app/ui.rs
index 7ec7e125..34d749c5 100644
--- a/host/src/tui/app/ui.rs
+++ b/host/src/tui/app/ui.rs
@@ -329,6 +329,8 @@ pub enum Click {
},
Filter(usize),
Composer,
+ /// The working line: unfolds or folds the turn's steps.
+ Steps,
/// A bot-message row (entry id): opens the conversation.
BotChat(String),
}
diff --git a/host/src/tui/view/activity.rs b/host/src/tui/view/activity.rs
index 44e1a2cf..033ede4b 100644
--- a/host/src/tui/view/activity.rs
+++ b/host/src/tui/view/activity.rs
@@ -1,40 +1,72 @@
-//! The current activity and tool count, with a shortcut to Full conversation.
+//! The current activity and how many steps the turn has taken: `>` (or a click) unfolds them under
+//! it, `t` opens Full conversation.
use ratatui::text::{Line, Span};
-use super::super::app::{App, Bot, Entry, Kind};
+use super::super::app::{App, Bot, Click, Entry, running_turn, working_steps};
use super::super::l10n::tr;
use super::super::md::truncate;
+use super::buffer::u;
use super::style::{spin, theme};
+use super::trace::push_step;
use super::transcript::{Built, gap, name_style};
+/// The most lines the unfolded steps take; earlier ones stay in Full conversation.
+const STEP_LINES: usize = 14;
+
pub(super) fn activity(out: &mut Built, app: &App, bot: &Bot, entries: &[&Entry], width: usize) {
let t = theme();
gap(out);
out.lines.push(Line::from(Span::styled(format!(" {}", bot.name), name_style(&bot.color))));
+ let steps = working_steps(entries);
+ let open = !steps.is_empty()
+ && app.steps_open.as_ref().is_some_and(|(id, turn)| id == &bot.id && Some(*turn) == running_turn(entries));
let text = if bot.activity.is_empty() { tr("Working…") } else { tr(&bot.activity) };
- out.lines.push(Line::from(vec![
+ let mut row = vec![
Span::styled(format!(" {} ", spin(app)), t.secondary),
- Span::styled(truncate(text.as_ref(), width.saturating_sub(4)), t.secondary),
- ]));
- let turn = entries.iter().filter(|e| e.data["status"] != "queued").map(|e| e.turn).max();
- let steps = entries.iter().filter(|entry| Some(entry.turn) == turn && entry.kind == Kind::Tool).count();
- let hint = if steps == 0 {
+ Span::styled(truncate(text.as_ref(), width.saturating_sub(8)), t.secondary),
+ ];
+ if !steps.is_empty() {
+ row.push(Span::styled(if open { " v" } else { " >" }, t.dim));
+ out.buttons.push((out.lines.len(), 0, u(width), Click::Steps));
+ }
+ out.lines.push(Line::from(row));
+ let hint = if steps.is_empty() {
" t full conversation".to_owned()
} else {
- format!(" {steps} steps so far · t full conversation")
+ format!(" {} steps so far · > {} · t full conversation", steps.len(), if open { "hide" } else { "show" })
};
out.lines.push(Line::from(Span::styled(hint, t.dim)));
+ if open {
+ let mut lines = vec![];
+ for e in steps {
+ push_step(&mut lines, app, e, width, false);
+ }
+ let earlier = lines.len().saturating_sub(STEP_LINES);
+ if earlier > 0 {
+ out.lines.push(Line::from(Span::styled(format!(" … {earlier} earlier lines · t shows them"), t.dim)));
+ }
+ out.lines.extend(lines.into_iter().skip(earlier));
+ }
}
#[cfg(test)]
mod tests {
use super::*;
- use crate::tui::{app::Msg, net::Client};
+ use crate::tui::{
+ app::{Kind, Msg},
+ net::Client,
+ };
use serde_json::json;
+ fn render(app: &App, entries: &[Entry]) -> (String, usize) {
+ let mut out = Built { lines: vec![], buttons: vec![], messages: vec![] };
+ activity(&mut out, app, &app.bots["bot"], &entries.iter().collect::<Vec<_>>(), 80);
+ (out.lines.iter().map(ToString::to_string).collect::<Vec<_>>().join("\n"), out.buttons.len())
+ }
+
#[test]
- fn activity_shows_current_steps_without_a_disclosure() {
+ fn steps_unfold_under_the_activity_for_the_running_turn() {
let (tx, _) = tokio::sync::mpsc::unbounded_channel();
let mut app = App::new(Client::new("http://127.0.0.1:1", None), tx, String::new());
app.on_msg(Msg::Event(json!({"type": "bot", "bot": {
@@ -42,13 +74,20 @@ mod tests {
}})));
let entries = [
Entry { id: "old".into(), seq: 1, turn: 1, kind: Kind::Tool, data: json!({}), created_at: 0 },
- Entry { id: "tool".into(), seq: 2, turn: 2, kind: Kind::Tool, data: json!({}), created_at: 0 },
+ Entry {
+ id: "tool".into(),
+ seq: 2,
+ turn: 2,
+ kind: Kind::Tool,
+ data: json!({"title": "rg TODO", "bookkeeping": false}),
+ created_at: 0,
+ },
Entry {
id: "thought".into(),
seq: 3,
turn: 2,
kind: Kind::Thought,
- data: json!({"text": "Private preview text"}),
+ data: json!({"text": "Looking for the parser"}),
created_at: 0,
},
Entry {
@@ -60,12 +99,31 @@ mod tests {
created_at: 0,
},
];
- let mut out = Built { lines: vec![], buttons: vec![], messages: vec![] };
- activity(&mut out, &app, &app.bots["bot"], &entries.iter().collect::<Vec<_>>(), 80);
- let text = out.lines.iter().map(ToString::to_string).collect::<Vec<_>>().join("\n");
- assert!(text.contains("Searching files…"));
- assert!(text.contains("1 steps so far · t full conversation"));
- assert!(!text.contains("Private preview text") && !text.contains("> thinking"));
- assert!(out.buttons.is_empty());
+ let (folded, buttons) = render(&app, &entries);
+ assert!(folded.contains("Searching files…"));
+ assert!(folded.contains("2 steps so far · > show · t full conversation"));
+ assert!(!folded.contains("Looking for the parser") && !folded.contains("rg TODO"));
+ assert_eq!(buttons, 1);
+
+ app.steps_open = Some(("bot".into(), 2));
+ let (open, _) = render(&app, &entries);
+ assert!(open.contains("> hide"));
+ assert!(open.contains("rg TODO") && open.contains("Looking for the parser"));
+
+ // A new turn starts folded.
+ app.steps_open = Some(("bot".into(), 1));
+ assert!(!render(&app, &entries).0.contains("rg TODO"));
+ }
+
+ #[test]
+ fn a_turn_without_steps_offers_only_full_conversation() {
+ let (tx, _) = tokio::sync::mpsc::unbounded_channel();
+ let mut app = App::new(Client::new("http://127.0.0.1:1", None), tx, String::new());
+ app.on_msg(Msg::Event(json!({"type": "bot", "bot": {"id": "bot", "name": "Bot", "activity": ""}})));
+ let entries =
+ [Entry { id: "u".into(), seq: 1, turn: 1, kind: Kind::User, data: json!({"text": "hi"}), created_at: 0 }];
+ let (text, buttons) = render(&app, &entries);
+ assert!(text.contains("Working…") && text.contains("t full conversation") && !text.contains("> show"));
+ assert_eq!(buttons, 0);
}
}
diff --git a/host/src/tui/view/help.rs b/host/src/tui/view/help.rs
index 6d65a694..7242df2d 100644
--- a/host/src/tui/view/help.rs
+++ b/host/src/tui/view/help.rs
@@ -10,7 +10,7 @@ use super::buffer::{centered, frame_box, put, u};
use super::overlay::field_line;
use super::style::theme;
-const HELP: [(&str, &str, &str); 66] = [
+const HELP: [(&str, &str, &str); 67] = [
("MOVE", "j k ↑ ↓", "next / previous bot"),
("MOVE", "[ ]", "previous / next bot"),
("MOVE", "1…9", "jump to bot 1–9"),
@@ -27,6 +27,7 @@ const HELP: [(&str, &str, &str); 66] = [
("CHAT", "N", "reject and say why"),
("CHAT", "1…9", "pick an approval option"),
("CHAT", "s", "stop the bot"),
+ ("CHAT", ">", "show / hide the working turn's steps"),
("CHAT", "o", "last turn's steps"),
("CHAT", "c", "copy the last reply"),
("CHAT", "C", "open connection / login request"),
diff --git a/host/src/tui/view/trace.rs b/host/src/tui/view/trace.rs
index e3bebc8e..813ffd3a 100644
--- a/host/src/tui/view/trace.rs
+++ b/host/src/tui/view/trace.rs
@@ -5,7 +5,7 @@ use ratatui::layout::Rect;
use ratatui::style::Modifier;
use ratatui::text::{Line, Span};
-use super::super::app::{App, Bot, Focus, Kind, Status, TraceMode, tilde};
+use super::super::app::{App, Bot, Entry, Focus, Kind, Status, TraceMode, tilde};
use super::super::md::{self, truncate, width as w};
use super::buffer::{hline, put, put_line, rput, u};
use super::style::{spin, theme};
@@ -66,12 +66,8 @@ fn tool_label(kind: &str) -> &str {
}
fn build_trace(app: &App, b: &Bot, turn: i64, width: usize, full: bool) -> Vec<Line<'static>> {
- let t = theme();
let mut out: Vec<Line<'static>> = vec![];
let Some(map) = app.entries.get(&b.id) else { return out };
- let label = |s: &str| Span::styled(format!("{s:<8} "), t.secondary);
- let text_rest = |width: usize| width.saturating_sub(13);
- let (diff_max, out_max) = if full { (400, 400) } else { (14, 6) };
let mut speaker: Option<&str> = None;
for e in map.values().filter(|e| e.turn == turn) {
// In a group, each member's steps under its name.
@@ -86,137 +82,167 @@ fn build_trace(app: &App, b: &Bot, turn: i64, width: usize, full: bool) -> Vec<L
out.push(Line::from(Span::styled(format!(" {name}"), name_style(&color))));
}
}
- match e.kind {
- Kind::User => out.push(Line::from(vec![
- Span::styled(" › ", t.dim),
- label("you"),
- Span::styled(truncate(&user_line(e), text_rest(width)), t.text),
- ])),
- Kind::Thought | Kind::Agent => {
- let (g, lab) = if e.kind == Kind::Thought {
- ("✱", "thought")
- } else if e.is_final() {
- ("●", "reply")
- } else {
- ("✱", "says")
- };
- let s = if e.kind == Kind::Thought { t.dim } else { t.text };
- if full {
- let first = [Span::styled(format!(" {g} "), t.dim), label(lab)];
- let rest = [Span::raw(" ".repeat(12))];
- out.extend(md::wrap(&[Span::styled(e.text().trim().to_owned(), s)], width, &first, &rest));
- } else {
- out.push(Line::from(vec![
- Span::styled(format!(" {g} "), t.dim),
- label(lab),
- Span::styled(truncate(e.text().trim(), text_rest(width)), s),
- ]));
- }
- }
- Kind::Tool => {
- let (g, gs) = match e.data["status"].as_str() {
- Some("completed") => ("✓".to_owned(), t.green),
- Some("failed") => ("×".to_owned(), t.red),
- _ => (spin(app).to_owned(), t.secondary),
- };
- let kind = tool_label(e.data["toolKind"].as_str().unwrap_or("tool")).to_owned();
- let title = e.data["title"].as_str().unwrap_or("Tool");
- out.push(Line::from(vec![
- Span::styled(format!(" {g} "), gs),
- label(&kind),
- Span::styled(truncate(title, text_rest(width)), t.text),
- ]));
- for d in e.data["diffs"].as_array().into_iter().flatten() {
- let stat = format!("+{} −{}", d["added"].as_u64().unwrap_or(0), d["removed"].as_u64().unwrap_or(0));
- let path = tilde(d["path"].as_str().unwrap_or_default(), &app.home);
- out.push(Line::from(vec![
- Span::raw(" "),
- Span::styled(truncate(&path, width.saturating_sub(12)), t.bold),
- Span::styled(format!(" {stat}"), t.secondary),
- ]));
- let start = d["startLine"].as_u64().unwrap_or(1);
- out.push(Line::from(Span::styled(format!(" @@ line {start} @@"), t.dim)));
- let patch = d["patch"].as_str().unwrap_or_default();
- let n = patch.lines().count();
- for l in patch.lines().take(diff_max) {
- let s = if l.starts_with('+') {
- t.added
- } else if l.starts_with('-') {
- t.removed
- } else {
- t.secondary
- };
- let body = truncate(l, width.saturating_sub(4));
- let pad = width.saturating_sub(4 + w(&body));
- out.push(Line::from(vec![
- Span::raw(" "),
- Span::styled(format!("{body}{}", " ".repeat(pad)), s),
- ]));
- }
- if n > diff_max {
- out.push(Line::from(Span::styled(
- format!(" … {} more lines · T shows everything", n - diff_max),
- t.dim,
- )));
- }
- }
- let output = e.data["output"].as_str().unwrap_or_default().trim_end();
- if !output.is_empty() {
- let lines: Vec<&str> = output.lines().collect();
- let skip = lines.len().saturating_sub(out_max);
- if skip > 0 {
- out.push(Line::from(Span::styled(format!(" … {skip} earlier lines"), t.dim)));
- }
- for l in &lines[skip..] {
- out.push(Line::from(vec![
- Span::raw(" "),
- Span::styled(truncate(l, width.saturating_sub(12)), t.dim),
- ]));
- }
- }
- }
- Kind::Plan => {
- let items = e.data["entries"].as_array().cloned().unwrap_or_default();
- let done = items.iter().filter(|i| i["status"] == "completed").count();
- out.push(Line::from(vec![
- Span::styled(" ☐ ", t.secondary),
- label("plan"),
- Span::styled(format!("{done}/{}", items.len()), t.text),
- ]));
- for i in &items {
- let (g, s) = match i["status"].as_str() {
- Some("completed") => ("✓", t.green),
- Some("in_progress") => ("▸", t.bold),
- _ => ("☐", t.dim),
- };
- out.push(Line::from(vec![
- Span::raw(" "),
- Span::styled(format!("{g} "), s),
- Span::styled(
- truncate(i["content"].as_str().unwrap_or_default(), width.saturating_sub(6)),
- t.secondary,
- ),
- ]));
- }
- }
- Kind::Permission => {
- let st = e.data["status"].as_str().unwrap_or_default();
- out.push(Line::from(vec![
- Span::styled(" ◆ ", t.amber),
- label("asked"),
- Span::styled(
- truncate(e.data["title"].as_str().unwrap_or_default(), text_rest(width).saturating_sub(12)),
- t.text,
- ),
- Span::styled(format!(" {st}"), t.dim),
- ]));
- }
- Kind::Notice => out.push(Line::from(vec![
- Span::styled(" · ", t.dim),
- Span::styled(truncate(&e.notice_text(), width.saturating_sub(4)), t.dim),
- ])),
- Kind::Other => {}
- }
+ push_step(&mut out, app, e, width, full);
}
out
}
+
+/// One entry's lines: a glyph, its kind and text. `full` shows a tool's whole diff and output,
+/// otherwise their ends.
+pub(super) fn push_step(out: &mut Vec<Line<'static>>, app: &App, e: &Entry, width: usize, full: bool) {
+ let t = theme();
+ match e.kind {
+ Kind::User => out.push(Line::from(vec![
+ Span::styled(" › ", t.dim),
+ label("you"),
+ Span::styled(truncate(&user_line(e), text_rest(width)), t.text),
+ ])),
+ Kind::Thought | Kind::Agent => push_text(out, e, width, full),
+ Kind::Tool => push_tool(out, app, e, width, full),
+ Kind::Plan => push_plan(out, e, width),
+ Kind::Permission => {
+ let st = e.data["status"].as_str().unwrap_or_default();
+ out.push(Line::from(vec![
+ Span::styled(" ◆ ", t.amber),
+ label("asked"),
+ Span::styled(
+ truncate(e.data["title"].as_str().unwrap_or_default(), text_rest(width).saturating_sub(12)),
+ t.text,
+ ),
+ Span::styled(format!(" {st}"), t.dim),
+ ]));
+ }
+ Kind::Notice => out.push(Line::from(vec![
+ Span::styled(" · ", t.dim),
+ Span::styled(truncate(&e.notice_text(), width.saturating_sub(4)), t.dim),
+ ])),
+ Kind::Other => {}
+ }
+}
+
+/// A step's kind, padded to the text column.
+fn label(s: &str) -> Span<'static> {
+ Span::styled(format!("{s:<8} "), theme().secondary)
+}
+
+/// The room a step's text has after its glyph and label.
+fn text_rest(width: usize) -> usize {
+ width.saturating_sub(13)
+}
+
+/// A thought or the bot's text: wrapped in full, else its first line.
+fn push_text(out: &mut Vec<Line<'static>>, e: &Entry, width: usize, full: bool) {
+ let t = theme();
+ let (g, lab) = if e.kind == Kind::Thought {
+ ("✱", "thought")
+ } else if e.is_final() {
+ ("●", "reply")
+ } else {
+ ("✱", "says")
+ };
+ let s = if e.kind == Kind::Thought { t.dim } else { t.text };
+ if full {
+ let first = [Span::styled(format!(" {g} "), t.dim), label(lab)];
+ let rest = [Span::raw(" ".repeat(12))];
+ out.extend(md::wrap(&[Span::styled(e.text().trim().to_owned(), s)], width, &first, &rest));
+ } else {
+ out.push(Line::from(vec![
+ Span::styled(format!(" {g} "), t.dim),
+ label(lab),
+ Span::styled(truncate(e.text().trim(), text_rest(width)), s),
+ ]));
+ }
+}
+
+/// A tool call: its status, kind and title, then its diffs and output.
+fn push_tool(out: &mut Vec<Line<'static>>, app: &App, e: &Entry, width: usize, full: bool) {
+ let t = theme();
+ let (g, gs) = match e.data["status"].as_str() {
+ Some("completed") => ("✓".to_owned(), t.green),
+ Some("failed") => ("×".to_owned(), t.red),
+ _ => (spin(app).to_owned(), t.secondary),
+ };
+ let kind = tool_label(e.data["toolKind"].as_str().unwrap_or("tool")).to_owned();
+ let title = e.data["title"].as_str().unwrap_or("Tool");
+ out.push(Line::from(vec![
+ Span::styled(format!(" {g} "), gs),
+ label(&kind),
+ Span::styled(truncate(title, text_rest(width)), t.text),
+ ]));
+ let (diff_max, out_max) = if full { (400, 400) } else { (14, 6) };
+ for d in e.data["diffs"].as_array().into_iter().flatten() {
+ push_diff(out, app, d, width, diff_max);
+ }
+ push_output(out, e.data["output"].as_str().unwrap_or_default(), width, out_max);
+}
+
+/// A file's diff: its path and counts, then its first `max` patch lines.
+fn push_diff(out: &mut Vec<Line<'static>>, app: &App, d: &serde_json::Value, width: usize, max: usize) {
+ let t = theme();
+ let stat = format!("+{} −{}", d["added"].as_u64().unwrap_or(0), d["removed"].as_u64().unwrap_or(0));
+ let path = tilde(d["path"].as_str().unwrap_or_default(), &app.home);
+ out.push(Line::from(vec![
+ Span::raw(" "),
+ Span::styled(truncate(&path, width.saturating_sub(12)), t.bold),
+ Span::styled(format!(" {stat}"), t.secondary),
+ ]));
+ let start = d["startLine"].as_u64().unwrap_or(1);
+ out.push(Line::from(Span::styled(format!(" @@ line {start} @@"), t.dim)));
+ let patch = d["patch"].as_str().unwrap_or_default();
+ let n = patch.lines().count();
+ for l in patch.lines().take(max) {
+ let s = if l.starts_with('+') {
+ t.added
+ } else if l.starts_with('-') {
+ t.removed
+ } else {
+ t.secondary
+ };
+ let body = truncate(l, width.saturating_sub(4));
+ let pad = width.saturating_sub(4 + w(&body));
+ out.push(Line::from(vec![Span::raw(" "), Span::styled(format!("{body}{}", " ".repeat(pad)), s)]));
+ }
+ if n > max {
+ out.push(Line::from(Span::styled(format!(" … {} more lines · T shows everything", n - max), t.dim)));
+ }
+}
+
+/// A tool's output: its last `max` lines.
+fn push_output(out: &mut Vec<Line<'static>>, output: &str, width: usize, max: usize) {
+ let t = theme();
+ let lines: Vec<&str> = output.trim_end().lines().collect();
+ let skip = lines.len().saturating_sub(max);
+ if skip > 0 {
+ out.push(Line::from(Span::styled(format!(" … {skip} earlier lines"), t.dim)));
+ }
+ for l in &lines[skip..] {
+ out.push(Line::from(vec![
+ Span::raw(" "),
+ Span::styled(truncate(l, width.saturating_sub(12)), t.dim),
+ ]));
+ }
+}
+
+/// A plan: how many of its items are done, then each item.
+fn push_plan(out: &mut Vec<Line<'static>>, e: &Entry, width: usize) {
+ let t = theme();
+ let items = e.data["entries"].as_array().cloned().unwrap_or_default();
+ let done = items.iter().filter(|i| i["status"] == "completed").count();
+ out.push(Line::from(vec![
+ Span::styled(" ☐ ", t.secondary),
+ label("plan"),
+ Span::styled(format!("{done}/{}", items.len()), t.text),
+ ]));
+ for i in &items {
+ let (g, s) = match i["status"].as_str() {
+ Some("completed") => ("✓", t.green),
+ Some("in_progress") => ("▸", t.bold),
+ _ => ("☐", t.dim),
+ };
+ out.push(Line::from(vec![
+ Span::raw(" "),
+ Span::styled(format!("{g} "), s),
+ Span::styled(truncate(i["content"].as_str().unwrap_or_default(), width.saturating_sub(6)), t.secondary),
+ ]));
+ }
+}
diff --git a/host/src/tui/view/transcript.rs b/host/src/tui/view/transcript.rs
index 55c3ddcb..0c8853ff 100644
--- a/host/src/tui/view/transcript.rs
+++ b/host/src/tui/view/transcript.rs
@@ -32,9 +32,10 @@ fn turn_info(entries: &[&Entry]) -> HashMap<i64, TurnInfo> {
let mut m: HashMap<i64, TurnInfo> = HashMap::new();
for e in entries {
let ti = m.entry(e.turn).or_insert_with(|| TurnInfo { steps: 0, files: BTreeSet::new(), last_message: None });
+ // Counted as the working line counts them while the turn runs.
+ ti.steps += usize::from(e.is_working_step());
match e.kind {
Kind::Tool => {
- ti.steps += 1;
for d in e.data["diffs"].as_array().into_iter().flatten() {
if let Some(p) = d["path"].as_str() {
ti.files.insert(p.to_owned());
@@ -84,9 +85,9 @@ pub(super) fn build_chat(app: &App, b: &Bot, width: usize) -> Built {
}
// A turn in flight: who's on it and what they're doing.
// A message doesn't end the turn: the bot may send several.
- if app.online && matches!(b.status, Status::Working | Status::NeedsInput) && b.works_here() {
+ if app.shows_activity(b) {
super::activity::activity(&mut out, app, b, &entries, width);
- } else if let Some(group) = b.away().filter(|_| matches!(b.status, Status::Working | Status::NeedsInput)) {
+ } else if let Some(group) = b.away().filter(|_| b.busy()) {
// Busy in a group it's in.
let place = app.author_name(Some(group));
gap(&mut out);
diff --git a/host/tests/fixtures/wire-shape.json b/host/tests/fixtures/wire-shape.json
index 8ea778e9..fdca6221 100644
--- a/host/tests/fixtures/wire-shape.json
+++ b/host/tests/fixtures/wire-shape.json
@@ -132,6 +132,7 @@
"event:entry(tool).entry.createdAt": "number",
"event:entry(tool).entry.data": "object",
"event:entry(tool).entry.data.author": "string",
+ "event:entry(tool).entry.data.bookkeeping": "bool",
"event:entry(tool).entry.data.diffs": "array",
"event:entry(tool).entry.data.diffs[]": "object",
"event:entry(tool).entry.data.diffs[].added": "number",
diff --git a/web/content/docs/conversations.mdx b/web/content/docs/conversations.mdx
index 7386ed2a..0bcac1d5 100644
--- a/web/content/docs/conversations.mdx
+++ b/web/content/docs/conversations.mdx
@@ -6,6 +6,8 @@ The chat shows your messages, the bot's messages, approval cards and short notic
While the bot works, a line under the last message shows what it's doing and for how long. It reads **Typing…** while the bot writes you a message.
+Once the bot has done something this turn, the line ends in an arrow. Tap or click it to unfold this turn's steps right in the chat: its thinking, what it said along the way, the tools and MCP tools it called and its plan. Tap a tool to see its output or diff. A long turn scrolls inside the line, which keeps showing the newest step. On the terminal UI, press `>` or click the line. Each new turn starts folded, and the steps leave with the line when the bot finishes.
+
Everything else the agent did (its narration, thinking, tool calls, diffs and plans) is in **Full conversation**:
- **iPhone:** tap the bot's name at the top of the chat, then **Full conversation**. Or touch and hold a bot message, then **Show what it did**.