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: watch a bot's thinking and steps live from its working line

leepokaid79550e758a7
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 6f1f8206..79c6fbf4 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
@@ -3,7 +3,6 @@ package com.codync.android
import android.content.ClipData
import android.content.ClipboardManager
import androidx.compose.animation.animateContentSize
-import androidx.compose.animation.core.animateFloatAsState
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
@@ -13,14 +12,11 @@ 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
import androidx.compose.foundation.layout.width
-import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.text.selection.SelectionContainer
-import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
@@ -32,7 +28,6 @@ import androidx.compose.runtime.setValue
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.semantics.Role
@@ -361,26 +356,20 @@ internal val Entry.botReactions: Map<String, List<String>> get() =
/**
* The bot's live activity line: a turning orb, what it's doing and for how long. Tapping it
- * unfolds what the bot is thinking right now.
+ * opens Full conversation, where its thinking and steps come in as it works.
*/
-@Composable internal fun WorkingIndicator(bot: Bot, thinking: String?) {
- var expanded by remember { mutableStateOf(false) }
+@Composable internal fun WorkingIndicator(bot: Bot, openTrace: () -> Unit) {
val needs = bot.status == "needsInput"
- val turn by animateFloatAsState(if (expanded) 180f else 0f, Motion.layout(), label = "Thinking")
Row(Modifier.fillMaxWidth().padding(top = 6.dp, end = 40.dp)) {
- Column(Modifier.clip(RoundedRectangle(18.dp)).background(Palette.bubbleAgent)
- .clickable(enabled = thinking != null, role = Role.Button) { expanded = !expanded }
- .animateContentSize(Motion.layoutSize).padding(horizontal = 16.dp, vertical = 12.dp), verticalArrangement = Arrangement.spacedBy(8.dp)) {
- Row(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(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) }
- if (thinking != null) Symbol("chevron.down", Modifier.rotate(turn), size = 12.dp, tint = Palette.tertiary)
- }
- if (expanded && thinking != null) Box(Modifier.heightIn(max = 180.dp).verticalScroll(rememberScrollState(Int.MAX_VALUE))) {
- SelectionContainer { Text(thinking, style = Type.footnote, color = Palette.secondary) }
- }
+ Row(Modifier.clip(RoundedRectangle(18.dp)).background(Palette.bubbleAgent)
+ .clickable(role = Role.Button, onClickLabel = "Show what it's doing", onClick = openTrace)
+ .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(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) }
+ Symbol("chevron.right", size = 12.dp, tint = Palette.tertiary)
}
}
}
@@ -394,16 +383,6 @@ internal val Entry.botReactions: Map<String, List<String>> get() =
style = Type.footnote.monospacedDigit, color = Palette.tertiary)
}
-/** The latest thinking of the turn running in a chat. */
-internal fun currentThinking(entries: List<Entry>, botId: String): String? {
- for (e in entries.asReversed()) {
- if (e.botId != botId) continue
- if (e.kind == "user" || (e.kind == "agent" && e.data["final"]?.jsonPrimitive?.booleanOrNull == true)) return null
- if (e.kind == "thought" && e.text.isNotEmpty()) return e.text
- }
- return null
-}
-
/** The start of an empty chat: who the bot is and how it works. */
@Composable internal fun IntroCard(bot: Bot, state: AppState) {
val members = bot.memberBots(state.bots)
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 71299f30..52731d61 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
@@ -251,6 +251,6 @@ import com.kyant.shapes.Capsule
is ChatItem.Exchanges -> BotMessageRow(item.group, state) { openPeer(item.group.peerId) }
}
}
- if (working) item("working") { WorkingIndicator(bot, currentThinking(state.entries, bot.id)) }
+ if (working) item("working") { WorkingIndicator(bot) { store.showTrace(true) } }
}
}
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 7fc361c6..9b2919bd 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
@@ -6,6 +6,7 @@ import androidx.compose.animation.fadeOut
import androidx.compose.animation.scaleIn
import androidx.compose.animation.scaleOut
import androidx.compose.foundation.background
+import androidx.compose.foundation.gestures.animateScrollBy
import androidx.compose.foundation.interaction.DragInteraction
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.PaddingValues
@@ -58,14 +59,15 @@ import kotlinx.coroutines.launch
}
/** Stays on the newest message until the reader scrolls away; scrolling back down follows again. */
-@Composable private fun rememberFollowing(list: LazyListState, last: String?, rev: Long?, working: Boolean, bottom: Dp): MutableState<Boolean> {
+@Composable internal fun rememberFollowing(list: LazyListState, last: String?, rev: Long?, working: Boolean, bottom: Dp): MutableState<Boolean> {
val following = remember { mutableStateOf(true) }
+ // The reader's drag and its fling, until it settles: a new step never pulls it back down meanwhile.
+ val touched = remember { mutableStateOf(false) }
LaunchedEffect(list) {
// Only the reader's own scroll decides: new content arriving (even while Codync is in the background) keeps the follow.
- var touched = false
- launch { list.interactionSource.interactions.collect { if (it is DragInteraction.Start) touched = true } }
+ launch { list.interactionSource.interactions.collect { if (it is DragInteraction.Start) touched.value = true } }
snapshotFlow { list.isScrollInProgress }.collect { scrolling ->
- if (!scrolling && touched) { touched = false; following.value = !list.canScrollForward }
+ if (!scrolling && touched.value) { touched.value = false; following.value = !list.canScrollForward }
}
}
LaunchedEffect(Unit) {
@@ -74,7 +76,7 @@ import kotlinx.coroutines.launch
}
// A new message, or the box growing (keyboard, more lines): stay on the newest.
LaunchedEffect(last, rev, working, bottom) {
- if (following.value && list.layoutInfo.totalItemsCount > 0) list.scrollToEnd(animated = true)
+ if (following.value && !touched.value && list.layoutInfo.totalItemsCount > 0) list.scrollToEnd(animated = true)
}
return following
}
@@ -82,7 +84,12 @@ import kotlinx.coroutines.launch
private suspend fun LazyListState.scrollToEnd(animated: Boolean) {
val count = layoutInfo.totalItemsCount
if (count == 0) return
- if (animated) animateScrollToItem(count - 1)
+ if (animated) {
+ // Glide the rest of the way down: a last item taller than the viewport would otherwise scroll back up to its top.
+ val end = layoutInfo.visibleItemsInfo.lastOrNull()?.takeIf { it.index == count - 1 }
+ if (end == null) animateScrollToItem(count - 1)
+ else animateScrollBy((end.offset + end.size + layoutInfo.afterContentPadding - layoutInfo.viewportEndOffset).coerceAtLeast(0).toFloat())
+ }
scrollToItem(count - 1, Int.MAX_VALUE)
}
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 e36915ef..b6671af6 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
@@ -14,10 +14,9 @@ import androidx.compose.foundation.lazy.rememberLazyListState
import androidx.compose.foundation.text.selection.SelectionContainer
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
-import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
-import androidx.compose.runtime.remember
+import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
@@ -34,9 +33,13 @@ import kotlinx.serialization.json.jsonPrimitive
/** "Full conversation": everything the agent did, grouped by turn (iOS `TraceView`). */
@Composable internal fun TraceView(bot: Bot, state: AppState) {
- val turns = state.entries.filter { it.botId == bot.id }.groupBy { it.turn }.toSortedMap().toList()
+ val all = state.entries.filter { it.botId == bot.id }
+ val turns = all.groupBy { it.turn }.toSortedMap().toList()
+ // The turn running now (a queued message already holds the next one): its thoughts start unfolded.
+ val running = if (bot.isWorking(bot.id)) all.filter { it.status != "queued" }.maxOfOrNull { it.turn } else null
val list = rememberLazyListState()
- LaunchedEffect(Unit) { if (turns.isNotEmpty()) list.scrollToItem(turns.lastIndex, Int.MAX_VALUE) }
+ // Opens at the end and follows any new step there (in whichever turn) until the reader scrolls up.
+ rememberFollowing(list, turns.lastOrNull()?.first?.toString(), all.maxOfOrNull { it.rev }, working = false, bottom = 0.dp)
Column(Modifier.fillMaxSize()) {
ModalHeader("Full conversation")
LazyColumn(state = list, contentPadding = PaddingValues(20.dp), verticalArrangement = Arrangement.spacedBy(22.dp)) {
@@ -45,16 +48,17 @@ import kotlinx.serialization.json.jsonPrimitive
Column(verticalArrangement = Arrangement.spacedBy(8.dp)) {
Text(entries.firstOrNull { it.kind == "user" }?.text ?: "Turn $turn", Modifier.padding(start = 4.dp),
style = Type.subheadline.semibold, color = Palette.text, maxLines = 1, overflow = TextOverflow.Ellipsis)
- CardSection { for (entry in entries) row { TraceRow(entry) } }
+ CardSection { for (entry in entries) row { TraceRow(entry, unfolded = turn == running) } }
}
}
}
}
}
-@Composable private fun TraceRow(entry: Entry) {
+/** The running turn's thoughts start `unfolded`, so its reasoning reads as it comes in. */
+@Composable private fun TraceRow(entry: Entry, unfolded: Boolean) {
val d = entry.data
- var expanded by remember { mutableStateOf(false) }
+ var expanded by rememberSaveable { mutableStateOf(unfolded) }
when (entry.kind) {
"user" -> Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {
Symbol("person.fill", size = 16.dp, tint = Palette.secondary)
@@ -94,7 +98,7 @@ import kotlinx.serialization.json.jsonPrimitive
/** A tool call: its kind's symbol, title and outcome; output and diffs unfold. */
@Composable private fun ToolRow(d: JsonObject) {
- var expanded by remember { mutableStateOf(false) }
+ var expanded by rememberSaveable { mutableStateOf(false) }
val icon = when (d.text("toolKind")) {
"read" -> "doc.text"; "edit" -> "pencil"; "delete" -> "trash"; "move" -> "arrow.right.doc.on.clipboard"
"search" -> "magnifyingglass"; "execute" -> "terminal"; "think" -> "brain"; "fetch" -> "globe"
diff --git a/apps/desktop/src/renderer/store/bot-mirror.ts b/apps/desktop/src/renderer/store/bot-mirror.ts
index 47374bb2..18aebccb 100644
--- a/apps/desktop/src/renderer/store/bot-mirror.ts
+++ b/apps/desktop/src/renderer/store/bot-mirror.ts
@@ -137,17 +137,6 @@ export class BotMirror extends Observable {
return (id && this.bots.get(id)?.name) || 'A deleted bot'
}
- /** The latest thinking of the turn running in a chat. */
- currentThinking(botId: string) {
- const list = this.allEntries(botId)
- for (let i = list.length - 1; i >= 0; i--) {
- const e = list[i]!
- if (e.kind === 'user' || (e.kind === 'agent' && e.data.final === true)) return null
- if (e.kind === 'thought' && e.data.text) return e.data.text
- }
- return null
- }
-
get connectionLabel() {
switch (this.shownConnection.kind) {
case 'online':
diff --git a/apps/desktop/src/renderer/views/thread/ChatRows.tsx b/apps/desktop/src/renderer/views/thread/ChatRows.tsx
index cf328fb3..88947a66 100644
--- a/apps/desktop/src/renderer/views/thread/ChatRows.tsx
+++ b/apps/desktop/src/renderer/views/thread/ChatRows.tsx
@@ -221,31 +221,19 @@ export function NoticeRow({ entry, addFallback }: { entry: Entry; addFallback?:
/**
* The bot's live activity line: a turning orb, what it's doing and for how long. Clicking it
- * unfolds what the bot is thinking right now.
+ * opens Full conversation, where its thinking and steps come in as it works.
*/
-export function WorkingIndicator({ bot, thinking }: { bot: Bot; thinking: string | null }) {
- const [expanded, setExpanded] = useState(false)
+export function WorkingIndicator({ bot, openTrace }: { bot: Bot; openTrace: () => void }) {
const waiting = needsInput(bot)
return (
<HStack gap={10} className="agent-inset">
- <button className="working" disabled={!thinking} onClick={() => setExpanded((e) => !e)} aria-expanded={thinking ? expanded : undefined}>
+ <button className="working" onClick={openTrace} title="Show what it's doing">
<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>{bot.activity || 'Working…'}</Text>
{bot.startedAt ? <Timer since={bot.startedAt} /> : null}
- {thinking ? (
- <HStack as="span" align="stretch" className={expanded ? 'working-chevron expanded' : 'working-chevron'}>
- <Icon name="chevron.down" size={10} weight="semibold" color="var(--tertiary)" />
- </HStack>
- ) : null}
+ <Icon name="chevron.right" size={10} weight="semibold" color="var(--tertiary)" />
</HStack>
- {expanded && thinking ? (
- <div className="selectable thinking" ref={(el) => {
- if (el) el.scrollTop = el.scrollHeight
- }}>
- {thinking}
- </div>
- ) : null}
</button>
</HStack>
)
diff --git a/apps/desktop/src/renderer/views/thread/ThreadView.tsx b/apps/desktop/src/renderer/views/thread/ThreadView.tsx
index 172e9f4d..c4a4c034 100644
--- a/apps/desktop/src/renderer/views/thread/ThreadView.tsx
+++ b/apps/desktop/src/renderer/views/thread/ThreadView.tsx
@@ -365,7 +365,7 @@ const Transcript = memo(function Transcript({ botId, openTrace, onReply, openRou
))}
{bot && live ? (
<div className={arrivals.has('working') ? 'chat-working row-in' : 'chat-working'}>
- <WorkingIndicator bot={bot} thinking={store.currentThinking(botId)} />
+ <WorkingIndicator bot={bot} openTrace={openTrace} />
</div>
) : null}
<div className="chat-end" />
diff --git a/apps/desktop/src/renderer/views/thread/TraceView.tsx b/apps/desktop/src/renderer/views/thread/TraceView.tsx
index e71364a9..d04839c3 100644
--- a/apps/desktop/src/renderer/views/thread/TraceView.tsx
+++ b/apps/desktop/src/renderer/views/thread/TraceView.tsx
@@ -1,5 +1,5 @@
import { useLayoutEffect, useRef, useState } from 'react'
-import type { Entry, EntryData } from '@shared/models'
+import { isWorkingIn, type Entry, type EntryData } from '@shared/models'
import { CardSection, Disclosure } from '../../components/Controls'
import { Icon } from '../../components/Icon'
import { ModalHeader, SheetPage } from '../../components/Overlay'
@@ -20,20 +20,32 @@ import './trace.css'
export function TraceView({ botId }: { botId: string }) {
const store = useStore()
useScreenViewed('trace')
+ const all = store.allEntries(botId)
const turns = new Map<number, Entry[]>()
- for (const e of store.allEntries(botId)) {
+ for (const e of all) {
turns.set(e.turn, [...(turns.get(e.turn) ?? []), e])
}
const sorted = [...turns.entries()].sort((a, b) => a[0] - b[0])
+ // The turn running now (a queued message already holds the next one): its thoughts start unfolded.
+ const bot = store.bots.get(botId)
+ const running = bot && isWorkingIn(bot, botId)
+ ? all.reduce((t, e) => (e.data.status === 'queued' ? t : Math.max(t, e.turn)), -1)
+ : undefined
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) el.scrollTop = el.scrollHeight
- }, [])
+ if (el && atEnd.current) el.scrollTop = el.scrollHeight
+ })
+ const onScroll = (e: React.UIEvent<HTMLDivElement>) => {
+ const el = e.currentTarget
+ atEnd.current = el.scrollHeight - el.scrollTop - el.clientHeight < 8
+ }
return (
<SheetPage>
<ModalHeader title="Full conversation" />
- <div ref={scroller} className="thread-scroll">
+ <div ref={scroller} className="thread-scroll" onScroll={onScroll}>
<VStack gap={14} className="trace-content">
{sorted.length === 0 ? <Text tone="tertiary">Nothing yet.</Text> : null}
{sorted.map(([turn, entries]) => (
@@ -43,7 +55,7 @@ export function TraceView({ botId }: { botId: string }) {
</Text>
<CardSection>
{entries.map((e) => (
- <TraceRow key={e.id} entry={e} />
+ <TraceRow key={e.id} entry={e} unfolded={turn === running} />
))}
</CardSection>
</VStack>
@@ -64,8 +76,9 @@ function Label({ icon, weight, tone, children }: { icon: React.ReactNode; weight
)
}
-function TraceRow({ entry }: { entry: Entry }) {
- const [expanded, setExpanded] = useState(false)
+/** The running turn's thoughts start `unfolded`, so its reasoning reads as it comes in. */
+function TraceRow({ entry, unfolded }: { entry: Entry; unfolded: boolean }) {
+ const [expanded, setExpanded] = useState(unfolded)
const d = entry.data
switch (entry.kind) {
case 'user':
diff --git a/apps/desktop/src/renderer/views/thread/thread.css b/apps/desktop/src/renderer/views/thread/thread.css
index da66453a..57f3dd05 100644
--- a/apps/desktop/src/renderer/views/thread/thread.css
+++ b/apps/desktop/src/renderer/views/thread/thread.css
@@ -326,28 +326,14 @@
}
.working {
display: flex;
+ /* A column stretches the row to the pill's width, so a long activity truncates. */
flex-direction: column;
- gap: 8px;
padding: 12px;
border-radius: var(--radius-xl);
background: var(--bubble-agent);
text-align: left;
min-width: 0;
}
-.working-chevron {
- transition: transform var(--layout);
-}
-.working-chevron.expanded {
- transform: rotate(180deg);
-}
-.thinking {
- max-height: 180px;
- overflow-y: auto;
- white-space: pre-wrap;
- text-align: left;
- font-size: var(--text-caption);
- color: var(--secondary);
-}
.call-overlay {
position: absolute;
diff --git a/apps/ios/Kit/Sources/CodyncUI/Thread/ChatRows.swift b/apps/ios/Kit/Sources/CodyncUI/Thread/ChatRows.swift
index 56007ce8..669276cb 100644
--- a/apps/ios/Kit/Sources/CodyncUI/Thread/ChatRows.swift
+++ b/apps/ios/Kit/Sources/CodyncUI/Thread/ChatRows.swift
@@ -256,75 +256,40 @@ struct NoticeRow: View {
}
/// The bot's live activity line: a turning orb, what it's doing and for how long. Tapping it
-/// unfolds what the bot is thinking right now (the whole trace stays in "Full conversation").
+/// opens Full conversation, where its thinking and steps come in as it works.
struct WorkingIndicator: View {
let bot: Bot
- /// The running turn's latest thinking, if the agent shares it.
- var thinking: String?
- @State private var expanded = false
- @Environment(\.accessibilityReduceMotion) private var reduceMotion
+ let openTrace: () -> Void
var body: some View {
HStack(alignment: .center, spacing: 10) {
- Button {
- withAnimation(Motion.reduced(Motion.layout, reduceMotion)) { expanded.toggle() }
- } label: {
- VStack(alignment: .leading, spacing: 8) {
- HStack(spacing: 8) {
- ThinkingOrb(state: bot.needsInput ? .listening : .working, size: 16, color: bot.needsInput ? Palette.warning : Palette.secondary)
- Text(bot.activity.isEmpty ? "Working…" : bot.activity)
- .font(.subheadline)
- .foregroundStyle(bot.needsInput ? Palette.warning : Palette.secondary)
- .lineLimit(1)
- if let started = bot.startedAt {
- Text(Date(milliseconds: started), style: .timer)
- .font(.footnote.monospacedDigit())
- .foregroundStyle(Palette.tertiary)
- }
- if thinking != nil {
- Image(systemName: "chevron.down")
- .font(.caption2.weight(.semibold))
- .foregroundStyle(Palette.tertiary)
- .rotationEffect(.degrees(expanded ? 180 : 0))
- }
- }
- if expanded, let thinking {
- ScrollView {
- Text(thinking)
- .font(.footnote)
- .foregroundStyle(Palette.secondary)
- .textSelection(.enabled)
- .frame(maxWidth: .infinity, alignment: .leading)
- }
- .defaultScrollAnchor(.bottom)
- .frame(maxHeight: 180)
- .fixedSize(horizontal: false, vertical: true)
- .transition(.opacity)
+ Button(action: openTrace) {
+ HStack(spacing: 8) {
+ ThinkingOrb(state: bot.needsInput ? .listening : .working, size: 16, color: bot.needsInput ? Palette.warning : Palette.secondary)
+ Text(bot.activity.isEmpty ? "Working…" : bot.activity)
+ .font(.subheadline)
+ .foregroundStyle(bot.needsInput ? Palette.warning : Palette.secondary)
+ .lineLimit(1)
+ if let started = bot.startedAt {
+ Text(Date(milliseconds: started), style: .timer)
+ .font(.footnote.monospacedDigit())
+ .foregroundStyle(Palette.tertiary)
}
+ Image(systemName: "chevron.right")
+ .font(.caption2.weight(.semibold))
+ .foregroundStyle(Palette.tertiary)
}
.padding(.horizontal, 16)
.padding(.vertical, 12)
.background(Palette.bubbleAgent, in: RoundedRectangle(cornerRadius: 18, style: .continuous))
}
.buttonStyle(.plain)
- .disabled(thinking == nil)
- .accessibilityHint(thinking == nil ? "" : expanded ? "Hides its thinking" : "Shows its thinking")
+ .accessibilityHint("Shows what it's doing")
Spacer(minLength: 40)
}
}
}
-extension BotStore {
- /// The latest thinking of the turn running in a chat: the newest thought since the last message.
- func currentThinking(_ botId: String) -> String? {
- for e in chat(botId).reversed() {
- if e.kind == "user" || (e.kind == "agent" && e.data.final == true) { return nil }
- if e.kind == "thought", let text = e.data.text, !text.isEmpty { return text }
- }
- return nil
- }
-}
-
extension BotStore {
/// The quick-reaction row for a message.
func reactionPick(_ entry: Entry) -> ReactionPick {
diff --git a/apps/ios/Kit/Sources/CodyncUI/Thread/ThreadView.swift b/apps/ios/Kit/Sources/CodyncUI/Thread/ThreadView.swift
index d5a36049..452408f2 100644
--- a/apps/ios/Kit/Sources/CodyncUI/Thread/ThreadView.swift
+++ b/apps/ios/Kit/Sources/CodyncUI/Thread/ThreadView.swift
@@ -349,7 +349,7 @@ 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, thinking: model.currentThinking(botId))
+ WorkingIndicator(bot: bot) { showTrace = true }
.padding(.top, 6)
})
}
diff --git a/apps/ios/Kit/Sources/CodyncUI/Thread/TraceView.swift b/apps/ios/Kit/Sources/CodyncUI/Thread/TraceView.swift
index 0bfbf2b0..2a9327b0 100644
--- a/apps/ios/Kit/Sources/CodyncUI/Thread/TraceView.swift
+++ b/apps/ios/Kit/Sources/CodyncUI/Thread/TraceView.swift
@@ -10,8 +10,12 @@ public struct TraceView: View {
@Environment(BotStore.self) private var model
public var body: some View {
- let turns = Dictionary(grouping: model.chat(botId), by: \.turn)
+ let all = model.chat(botId)
+ let turns = Dictionary(grouping: all, by: \.turn)
.sorted { $0.key < $1.key }
+ // The turn running now (a queued message already holds the next one): its thoughts start unfolded.
+ let running = model.bots[botId]?.isWorking(in: botId) == true
+ ? all.filter { $0.data.status != "queued" }.map(\.turn).max() : nil
VStack(spacing: 0) {
ModalHeader("Full conversation")
ScrollView {
@@ -28,7 +32,7 @@ public struct TraceView: View {
.foregroundStyle(Palette.text)
.padding(.leading, 4)
CardSection {
- ForEach(entries) { TraceRow(entry: $0) }
+ ForEach(entries) { TraceRow(entry: $0, unfolded: turn == running) }
}
}
}
@@ -45,7 +49,13 @@ public struct TraceView: View {
private struct TraceRow: View {
let entry: Entry
- @State private var expanded = false
+ @State private var expanded: Bool
+
+ /// The running turn's thoughts start unfolded, so its reasoning reads as it comes in.
+ init(entry: Entry, unfolded: Bool) {
+ self.entry = entry
+ _expanded = State(initialValue: unfolded)
+ }
var body: some View {
let d = entry.data
diff --git a/apps/ios/WhatsNew.md b/apps/ios/WhatsNew.md
index 96376f0f..6d4be6e0 100644
--- a/apps/ios/WhatsNew.md
+++ b/apps/ios/WhatsNew.md
@@ -10,6 +10,8 @@ a version without one gets a generic "Bug fixes and improvements" line. Delete o
### zh-Hant
- 用麥克風聽寫時,麥克風按鈕會變成錄音膠囊:停止鍵、錄了多久,還有跟著你說話起伏的點點
+- Bot 工作中時點一下狀態列,就能即時看它的思考過程和每個步驟
### en-US
- While you dictate, the mic turns into a recording pill: a stop button, how long you've been talking, and dots that follow your voice
+- While a bot works, tap its status line to watch its thinking and each step live
diff --git a/docs/features/chat-messages.md b/docs/features/chat-messages.md
index 537a0d29..757daa69 100644
--- a/docs/features/chat-messages.md
+++ b/docs/features/chat-messages.md
@@ -64,7 +64,10 @@ it has no pointer tooltip or link-opening action.
The working line under the last message shows the bot's activity; composing a `send_message`
reads as **Typing…** (`activity()` in `agent/bot.rs`). Thoughts and tool calls stay in the
-Full conversation sheet.
+Full conversation sheet. The working line ends in a `chevron.right` and opens that sheet, which
+follows the run: it stays at the end while new steps arrive (until the reader scrolls up), and
+the running turn's thoughts start unfolded (finished turns' stay folded). The terminal UI says
+"N steps so far · t shows them live" under its working line instead.
## Motion and scrolling