@sixb/app 0.1.14 → 0.1.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/dist/{chunk-vtp6nk44.js → chunk-736c9akn.js} +1 -1
  2. package/dist/{chunk-1rhht9y0.js → chunk-n0cxwvej.js} +1 -1
  3. package/dist/{chunk-0yb22w6m.js → chunk-qh1panvd.js} +1 -1
  4. package/dist/{chunk-aes17xmx.js → chunk-twjs2sb9.js} +3928 -3717
  5. package/dist/{chunk-aes17xmx.js.map → chunk-twjs2sb9.js.map} +46 -42
  6. package/dist/index.js +15 -6
  7. package/dist/index.js.map +6 -6
  8. package/dist/pages.js +60 -44
  9. package/dist/pages.js.map +8 -8
  10. package/dist/server.js +12 -6
  11. package/dist/server.js.map +3 -3
  12. package/package.json +3 -3
  13. package/src/agent/agent-chat.tsx +4 -22
  14. package/src/agent/agent-panel.tsx +4 -0
  15. package/src/agent/agent-surface.tsx +4 -0
  16. package/src/agent/agent.css +33 -3
  17. package/src/agent/approvals.ts +4 -5
  18. package/src/agent/artifact-panel.tsx +113 -37
  19. package/src/agent/components/activity-status.tsx +1 -1
  20. package/src/agent/components/agent-threads.tsx +377 -0
  21. package/src/agent/components/approval-card.tsx +336 -327
  22. package/src/agent/components/approval-mode-chip.tsx +38 -145
  23. package/src/agent/components/auto-model-chip.tsx +103 -167
  24. package/src/agent/components/composer-menu.tsx +185 -0
  25. package/src/agent/components/composer.tsx +38 -43
  26. package/src/agent/components/context-chips.tsx +1 -1
  27. package/src/agent/components/conversation-panel.tsx +16 -36
  28. package/src/agent/components/file-attachment-card.tsx +5 -2
  29. package/src/agent/components/message-parts.tsx +27 -11
  30. package/src/agent/components/message-view.tsx +182 -68
  31. package/src/agent/components/model-controls.tsx +133 -125
  32. package/src/agent/components/model-picker-row.tsx +38 -17
  33. package/src/agent/components/participant-input.tsx +159 -31
  34. package/src/agent/components/reasoning-effort-slider.tsx +27 -27
  35. package/src/agent/components/shared-thread-notice.tsx +1 -1
  36. package/src/agent/components/thread-people.tsx +45 -15
  37. package/src/agent/components/threads-button.tsx +70 -0
  38. package/src/agent/components/transcript.tsx +30 -1
  39. package/src/agent/conversation.ts +25 -1
  40. package/src/agent/delegation/child-card.tsx +187 -247
  41. package/src/agent/delegation/child-cards.tsx +4 -7
  42. package/src/agent/delegation/child-group.tsx +179 -98
  43. package/src/agent/delegation/child-parts.tsx +71 -106
  44. package/src/agent/delegation/child-work.tsx +6 -52
  45. package/src/agent/delegation/interpret.ts +0 -28
  46. package/src/agent/delegation/model.ts +115 -39
  47. package/src/agent/hooks/use-agent-conversation.ts +7 -92
  48. package/src/agent/hooks/use-people-suggestions.ts +90 -0
  49. package/src/agent/hooks/use-thread-lists.ts +77 -0
  50. package/src/agent/i18n/en.ts +96 -83
  51. package/src/agent/i18n/fr.ts +105 -100
  52. package/src/agent/react-router.tsx +48 -5
  53. package/src/agent/run-presentation.ts +6 -2
  54. package/src/agent/thread-navigation.ts +16 -0
  55. package/src/agent/thread-pages.ts +24 -0
  56. package/src/artifacts/person-avatar.tsx +1 -1
  57. package/src/createCustomApp.ts +13 -6
  58. package/src/index.ts +7 -3
  59. package/src/pages/home.tsx +3 -1
  60. package/src/pages/observability/ai-usage/calls.tsx +2 -1
  61. package/src/pages/settings/memory-history.tsx +2 -1
  62. package/src/pages/settings/messages.ts +2 -3
  63. package/src/pages/values.tsx +23 -1
  64. package/src/pages.ts +5 -1
  65. package/src/shell/agent-dock.tsx +4 -2
  66. package/src/agent/agents-page.ts +0 -7
  67. package/src/agent/components/agent-thread-switcher.tsx +0 -519
  68. /package/dist/{chunk-vtp6nk44.js.map → chunk-736c9akn.js.map} +0 -0
  69. /package/dist/{chunk-1rhht9y0.js.map → chunk-n0cxwvej.js.map} +0 -0
  70. /package/dist/{chunk-0yb22w6m.js.map → chunk-qh1panvd.js.map} +0 -0
@@ -1,36 +1,26 @@
1
1
  import { isSixbApiError } from "@sixb/client"
2
2
  import { cancelAgentRunByIdMutation } from "@sixb/client/hooks"
3
- import {
4
- Drawer,
5
- DrawerClose,
6
- DrawerContent,
7
- DrawerDescription,
8
- DrawerTitle,
9
- } from "@sixb/ui/components"
10
- import { useIsMobile } from "@sixb/ui/hooks"
11
- import { useLocale } from "@sixb/ui/lib/i18n"
12
3
  import { cn } from "@sixb/ui/lib/utils"
13
4
  import { useMutation, useQueryClient } from "@tanstack/react-query"
14
- import { ArrowDown, ChevronDown, Square, X } from "lucide-react"
15
- import { memo, useEffect, useId, useRef, useState } from "react"
5
+ import { ArrowDown, ChevronRight } from "lucide-react"
6
+ import { useEffect, useState } from "react"
16
7
  import { childFileSource } from "../../artifacts/file-source"
8
+ import { latestWorkLabel } from "../activity-label"
17
9
  import { heldCallOf } from "../approvals"
18
10
  import { ApprovalCard } from "../components/approval-card"
19
11
  import { FileAttachmentCard } from "../components/file-attachment-card"
20
12
  import { useAgentMessages } from "../i18n"
21
13
  import {
14
+ AgentAvatar,
22
15
  Exchanges,
23
16
  ModelChip,
24
- Section,
25
- StateGlyph,
26
- stateLabel,
17
+ NEEDS_READER_TEXT,
27
18
  statusLabel,
28
- toneClass,
29
19
  WorkedFor,
30
20
  } from "./child-parts"
31
- import { ChildWork, FollowingScroll } from "./child-work"
21
+ import { ChildWork } from "./child-work"
32
22
  import { useDelegationCards } from "./context"
33
- import { type AgentChild, activeRun, childrenCost, childTitle, liveQuestion } from "./interpret"
23
+ import { type AgentChild, activeRun, childTitle, liveQuestion } from "./interpret"
34
24
  import type { ChildModel } from "./model"
35
25
  import { type ChildrenSource, refreshChildren } from "./use-children"
36
26
 
@@ -38,237 +28,161 @@ import { type ChildrenSource, refreshChildren } from "./use-children"
38
28
  const STOP_FAILED_MS = 6_000
39
29
 
40
30
  /**
41
- * One child: what it was asked, on which model, where it stands and what it does now. Its work opens
42
- * right under that, or in a sheet on a phone; below are what passed between it and the Agent, the
43
- * calls it waits on, and the files it made.
31
+ * A sub-agent in its reply's list of them: its avatar, its name, and on a second line what it does
32
+ * now or how it ended. Choosing it opens its thread.
33
+ */
34
+ export function ChildRow({
35
+ model,
36
+ tint,
37
+ observed,
38
+ onOpen,
39
+ }: {
40
+ readonly model: ChildModel
41
+ /** Its place among its reply's agents, which picks its avatar's tint. */
42
+ readonly tint: number
43
+ readonly observed: boolean
44
+ readonly onOpen: () => void
45
+ }) {
46
+ const messages = useAgentMessages()
47
+ const { child, view, state, needsReader } = model
48
+ const title = childTitle(child.key)
49
+ const task = view?.task ?? child.task
50
+ const status = statusLabel(model, { stopping: false, observed, messages })
51
+ // What it does now, once its stream says; the time on the right already says it works.
52
+ const doing =
53
+ state === "working" && model.live && model.live.parts.length > 0
54
+ ? latestWorkLabel(model.live.parts, messages)
55
+ : null
56
+
57
+ return (
58
+ <button
59
+ type="button"
60
+ onClick={onOpen}
61
+ aria-label={`${messages.delegation.open(title)}, ${status}`}
62
+ data-child-row={child.key}
63
+ data-child-state={state}
64
+ className="group/row -mx-2 flex w-[calc(100%+1rem)] min-w-0 items-center gap-3 rounded-xl px-2 py-2 text-left outline-none transition-colors hover:bg-muted/60 focus-visible:bg-muted/60 focus-visible:ring-2 focus-visible:ring-ring/40"
65
+ >
66
+ <AgentAvatar name={title} state={state} needsReader={needsReader} tint={tint} size="md" />
67
+ <span className="min-w-0 flex-1">
68
+ <span className="block truncate text-sm font-medium text-foreground">{title}</span>
69
+ {/* While it works, what it does now; otherwise what it was asked. */}
70
+ {doing || task ? (
71
+ <span
72
+ className={cn(
73
+ "block truncate text-xs text-muted-foreground",
74
+ doing && "shimmer motion-reduce:animate-none"
75
+ )}
76
+ >
77
+ {doing ?? task}
78
+ </span>
79
+ ) : null}
80
+ </span>
81
+ <span
82
+ className={cn(
83
+ "max-w-[45%] shrink-0 truncate text-right text-xs tabular-nums",
84
+ needsReader ? NEEDS_READER_TEXT : "text-muted-foreground"
85
+ )}
86
+ >
87
+ {state === "working" || state === "done" ? <WorkedFor views={[view]} /> : status}
88
+ </span>
89
+ <ChevronRight
90
+ className="size-4 shrink-0 text-muted-foreground/50 transition-colors group-hover/row:text-muted-foreground"
91
+ aria-hidden="true"
92
+ />
93
+ </button>
94
+ )
95
+ }
96
+
97
+ /**
98
+ * A sub-agent's thread, in the panel: how it stands, the model it runs on and how long it worked,
99
+ * with a way to stop it while it works; then the task it was given, its work and what it made.
44
100
  */
45
- export const ChildCard = memo(function ChildCard({
101
+ export function ChildDetail({
46
102
  model,
47
103
  source,
48
104
  unavailable,
49
- grouped = false,
50
- announce = true,
51
- onWorkOpenChange,
52
105
  }: {
53
106
  readonly model: ChildModel
54
107
  readonly source: ChildrenSource
55
108
  readonly unavailable: boolean
56
- /** A row of a group, which draws the border around it. */
57
- readonly grouped?: boolean
58
- /** Say its changes to a screen reader: not while its group is folded. */
59
- readonly announce?: boolean
60
- /** Its work opened or closed: a group stays open while any is. */
61
- readonly onWorkOpenChange?: (childId: string, open: boolean) => void
62
109
  }) {
63
- const { child, view, live, state, needsReader } = model
64
110
  const messages = useAgentMessages()
65
111
  const labels = messages.delegation
66
- const locale = useLocale()
67
- const mobile = useIsMobile()
68
112
  const cards = useDelegationCards()
69
- const workId = useId()
70
- const workButton = useRef<HTMLButtonElement>(null)
113
+ const { child, view, live, needsReader } = model
71
114
  const { runId, observed } = source
72
-
73
115
  const title = childTitle(child.key)
74
116
  const task = view?.task ?? child.task
75
117
  const run = activeRun(view)
76
118
 
77
- const [workOpen, setWorkOpen] = useState(false)
78
- const openWork = (open: boolean) => {
79
- setWorkOpen(open)
80
- onWorkOpenChange?.(child.id, open)
81
- // A sheet gives the reader back where they were.
82
- if (!open && mobile) requestAnimationFrame(() => workButton.current?.focus())
83
- }
84
-
85
119
  const stop = useStop(model, source)
86
120
  const canStop =
87
121
  run !== undefined && runId !== null && (cards?.actions?.canStop(run.parentRunId) ?? false)
88
-
89
122
  const status = statusLabel(model, { stopping: stop.stopping, observed, messages })
90
- const shownState = stop.stopping ? "stopped" : state
91
- const cost = childrenCost([view], locale)
92
- const exchanges = cards?.delegation.exchanges.get(child.id) ?? []
93
- const openQuestion =
94
- view?.awaiting?.type === "answer"
95
- ? view.awaiting.question.text
96
- : state === "asking" && live
97
- ? liveQuestion(live.parts)
98
- : null
99
123
  const files = view ? returnedFiles(view) : []
100
- const hasWork = view !== undefined || unavailable || model.waited?.text !== undefined
101
-
102
- const work = (
103
- <ChildWork
104
- view={view}
105
- live={live}
106
- source={source}
107
- unavailable={unavailable}
108
- waited={model.waited}
109
- enabled={workOpen}
110
- />
111
- )
112
- const follow = `${live?.parts.length ?? 0}:${view?.runs.length ?? 0}`
113
124
 
114
125
  return (
115
126
  <section
116
127
  aria-label={labels.card(title)}
117
- data-child-state={state}
118
- data-child-key={child.key}
119
- className={cn(
120
- "min-w-0",
121
- !grouped &&
122
- "overflow-hidden rounded-2xl border bg-card text-card-foreground shadow-[0_1px_2px_0_rgb(0_0_0/0.04)]",
123
- !grouped &&
124
- (needsReader
125
- ? "border-amber-500/35 shadow-[0_0_0_4px_rgb(245_158_11/0.06),0_1px_2px_0_rgb(0_0_0/0.04)]"
126
- : "border-border")
127
- )}
128
+ data-child-detail={child.key}
129
+ className="flex flex-col gap-5"
128
130
  >
129
- {/* Said once per change of state, never per step: the visible line moves faster. */}
130
- {announce ? (
131
- <span className="sr-only" aria-live="polite">
132
- {`${title}: ${stateLabel(state, model.waitingOn, observed, messages)}`}
133
- </span>
134
- ) : null}
135
-
136
- <div className="flex min-w-0 items-start gap-3 px-4 pt-3.5 pb-3">
137
- <StateGlyph state={shownState} calm={!needsReader} />
138
- <div className="min-w-0 flex-1">
139
- <div className="flex min-w-0 items-center gap-2">
140
- <h3 className="min-w-0 truncate text-[14px] leading-6 font-semibold tracking-[-0.01em] text-foreground">
141
- {title}
142
- </h3>
143
- <ModelChip child={child} view={view} className="ml-auto max-sm:hidden" />
144
- </div>
145
- {task ? (
146
- <p
147
- className={cn(
148
- "text-[13px] leading-5 text-muted-foreground",
149
- // The whole task once its work is open, where the reader came to read.
150
- workOpen && !mobile ? "whitespace-pre-wrap" : "truncate"
151
- )}
152
- title={task}
153
- >
154
- {task}
155
- </p>
156
- ) : null}
157
- <ModelChip child={child} view={view} className="mt-2 max-w-full sm:hidden" />
158
-
159
- <div className="mt-2 flex min-w-0 flex-wrap items-center gap-x-3 gap-y-1.5">
160
- {/* What to do never truncates; the facts after it give way first. */}
161
- <p className="flex min-w-0 flex-1 basis-48 flex-wrap items-baseline gap-x-1.5 text-xs">
162
- <span
163
- className={cn(
164
- "font-medium break-words",
165
- toneClass(shownState, needsReader),
166
- state === "working" && !stop.stopping && "shimmer motion-reduce:animate-none"
167
- )}
168
- >
169
- {status}
170
- </span>
171
- <span className="min-w-0 truncate text-muted-foreground tabular-nums">
172
- <WorkedFor views={[view]} />
173
- {cost ? ` · ${cost}` : null}
174
- </span>
175
- </p>
176
-
177
- <div className="ml-auto flex shrink-0 items-center gap-1">
178
- {model.heldLater ? (
179
- <button
180
- type="button"
181
- onClick={() => revealApproval(model.heldLater?.id)}
182
- className="flex h-7 items-center gap-1 rounded-md px-2 text-xs font-medium text-amber-700 outline-none transition-colors hover:bg-amber-500/10 focus-visible:ring-2 focus-visible:ring-ring/40 dark:text-amber-400 max-sm:h-9"
183
- >
184
- <ArrowDown className="size-3.5" aria-hidden="true" />
185
- {labels.viewRequest}
186
- </button>
187
- ) : null}
188
- {canStop ? (
189
- <button
190
- type="button"
191
- onClick={stop.stop}
192
- disabled={stop.stopping}
193
- aria-label={labels.stopLabel(title)}
194
- className="flex h-7 items-center gap-1.5 rounded-md px-2 text-xs font-medium text-muted-foreground outline-none transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring/40 disabled:opacity-60 max-sm:h-9 max-sm:px-2.5"
195
- >
196
- <Square className="size-3 fill-current" aria-hidden="true" />
197
- {labels.stop}
198
- </button>
199
- ) : null}
200
- {hasWork ? (
201
- <button
202
- ref={workButton}
203
- type="button"
204
- aria-expanded={workOpen}
205
- aria-controls={mobile ? undefined : workId}
206
- aria-haspopup={mobile ? "dialog" : undefined}
207
- aria-label={
208
- workOpen && !mobile ? labels.hideWorkOf(title) : labels.showWorkOf(title)
209
- }
210
- onClick={() => openWork(!workOpen)}
211
- className="flex h-7 items-center gap-1 rounded-md px-2 text-xs font-medium text-muted-foreground outline-none transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring/40 max-sm:h-9 max-sm:px-2.5"
212
- >
213
- {workOpen && !mobile ? labels.hideWork : labels.showWork}
214
- <ChevronDown
215
- className={cn(
216
- "size-3.5 transition-transform motion-reduce:transition-none",
217
- workOpen && !mobile && "rotate-180",
218
- mobile && "-rotate-90"
219
- )}
220
- aria-hidden="true"
221
- />
222
- </button>
223
- ) : null}
224
- </div>
225
- </div>
226
- </div>
131
+ <div className="flex min-w-0 items-center gap-3 pt-1">
132
+ <p className="flex min-w-0 flex-1 items-center gap-1.5 text-xs text-muted-foreground">
133
+ <span
134
+ className={cn(
135
+ "truncate font-medium",
136
+ needsReader ? NEEDS_READER_TEXT : "text-foreground/80"
137
+ )}
138
+ >
139
+ {status}
140
+ </span>
141
+ <span className="shrink-0 tabular-nums empty:hidden before:mr-1.5 before:content-['·']">
142
+ <WorkedFor views={[view]} />
143
+ </span>
144
+ </p>
145
+ <ModelChip child={child} view={view} className="shrink-0 text-xs opacity-80" />
146
+ {canStop ? (
147
+ <button
148
+ type="button"
149
+ onClick={stop.stop}
150
+ disabled={stop.stopping}
151
+ aria-label={labels.stopLabel(title)}
152
+ className="h-7 shrink-0 rounded-full bg-muted px-3 text-xs font-medium text-foreground outline-none transition-colors hover:bg-foreground hover:text-background focus-visible:ring-2 focus-visible:ring-ring/40 disabled:opacity-60"
153
+ >
154
+ {labels.stop}
155
+ </button>
156
+ ) : null}
227
157
  </div>
228
-
229
158
  {stop.failed ? (
230
- <p role="alert" className="px-4 pb-3 text-xs text-destructive sm:pl-14">
159
+ <p role="alert" className="-mt-3 text-xs text-destructive">
231
160
  {labels.stopFailed}
232
161
  </p>
233
162
  ) : null}
234
163
 
235
- {!mobile && workOpen ? (
236
- <div id={workId} className="border-t border-border/60 bg-muted/25">
237
- <FollowingScroll
238
- follow={follow}
239
- live={run !== undefined}
240
- className="max-h-[min(28rem,60vh)] px-4 py-3 sm:pl-14"
241
- >
242
- {work}
243
- </FollowingScroll>
164
+ {/* What the agent asked of it, which opens its thread. */}
165
+ {task ? (
166
+ <div>
167
+ <p className="mb-1.5 text-xs text-muted-foreground">{labels.task}</p>
168
+ <p className="border-l-2 border-border pl-3 text-sm leading-relaxed whitespace-pre-wrap text-foreground/85">
169
+ {task}
170
+ </p>
244
171
  </div>
245
172
  ) : null}
246
173
 
247
- {exchanges.length > 0 || openQuestion ? (
248
- <Section>
249
- <Exchanges
250
- exchanges={exchanges}
251
- openQuestion={openQuestion}
252
- urgent={needsReader || state === "asking"}
253
- />
254
- {state === "answer" && !observed ? (
255
- <p className="mt-1.5 text-xs text-muted-foreground">{labels.answerHint}</p>
256
- ) : null}
257
- </Section>
258
- ) : null}
259
-
260
- {model.approvals.length > 0 ? (
261
- <Section>
262
- <div className="flex flex-col gap-2.5">
263
- {model.approvals.map((approval) => (
264
- <ApprovalCard key={approval.id} held={heldCallOf(approval)} inCard />
265
- ))}
266
- </div>
267
- </Section>
268
- ) : null}
174
+ <ChildWork
175
+ view={view}
176
+ live={live}
177
+ source={source}
178
+ unavailable={unavailable}
179
+ waited={model.waited}
180
+ enabled
181
+ />
269
182
 
270
183
  {files.length > 0 && view ? (
271
- <Section label={labels.made}>
184
+ <div>
185
+ <p className="mb-2 text-xs text-muted-foreground">{labels.made}</p>
272
186
  <div className="flex flex-wrap gap-2">
273
187
  {files.map(({ runId: fileRunId, path, fileRef }) => (
274
188
  <FileAttachmentCard
@@ -285,47 +199,73 @@ export const ChildCard = memo(function ChildCard({
285
199
  />
286
200
  ))}
287
201
  </div>
288
- </Section>
202
+ </div>
289
203
  ) : null}
204
+ </section>
205
+ )
206
+ }
290
207
 
291
- {mobile ? (
292
- <Drawer open={workOpen} onOpenChange={openWork}>
293
- <DrawerContent className="data-[vaul-drawer-direction=bottom]:max-h-[88dvh]">
294
- <div className="flex items-start gap-3 border-b border-border/70 px-4 pt-2 pb-3">
295
- <StateGlyph state={shownState} calm={!needsReader} />
296
- <div className="min-w-0 flex-1">
297
- <DrawerTitle className="truncate text-[15px] font-semibold">{title}</DrawerTitle>
298
- <DrawerDescription
299
- className={cn("text-xs font-medium", toneClass(shownState, needsReader))}
300
- >
301
- {status}
302
- </DrawerDescription>
303
- </div>
304
- <DrawerClose
305
- aria-label={labels.close}
306
- className="-mt-0.5 -mr-1.5 flex size-9 shrink-0 items-center justify-center rounded-full text-muted-foreground outline-none transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring/40"
307
- >
308
- <X className="size-4" aria-hidden="true" />
309
- </DrawerClose>
310
- </div>
311
- <FollowingScroll
312
- follow={follow}
313
- live={run !== undefined}
314
- className="min-h-0 flex-1 px-4 pt-3 pb-[max(1rem,env(safe-area-inset-bottom))]"
315
- >
316
- {task ? (
317
- <p className="mb-3 text-[13px] leading-5 whitespace-pre-wrap text-muted-foreground">
318
- {task}
319
- </p>
320
- ) : null}
321
- {work}
322
- </FollowingScroll>
323
- </DrawerContent>
324
- </Drawer>
208
+ /**
209
+ * What waits on the reader from one sub-agent, under the reply's line: the question it asked, and
210
+ * the calls it holds for approval. Named when the reply has several, so each says whose it is.
211
+ */
212
+ export function ChildAttention({
213
+ model,
214
+ observed,
215
+ named,
216
+ }: {
217
+ readonly model: ChildModel
218
+ readonly observed: boolean
219
+ readonly named: boolean
220
+ }) {
221
+ const labels = useAgentMessages().delegation
222
+ const cards = useDelegationCards()
223
+ const { child, view, live, state, needsReader } = model
224
+ const exchanges = cards?.delegation.exchanges.get(child.id) ?? []
225
+ const openQuestion =
226
+ view?.awaiting?.type === "answer"
227
+ ? view.awaiting.question.text
228
+ : state === "asking" && live
229
+ ? liveQuestion(live.parts)
230
+ : null
231
+ const asks = exchanges.length > 0 || openQuestion !== null
232
+ if (!asks && model.approvals.length === 0 && !model.heldLater) return null
233
+
234
+ return (
235
+ <div className="flex flex-col gap-2" data-child-key={child.key}>
236
+ {asks ? (
237
+ <div className="pl-[1.875rem]">
238
+ {named ? (
239
+ <p className="mb-1 text-xs font-medium text-muted-foreground">
240
+ {childTitle(child.key)}
241
+ </p>
242
+ ) : null}
243
+ <Exchanges
244
+ exchanges={exchanges}
245
+ openQuestion={openQuestion}
246
+ urgent={needsReader || state === "asking"}
247
+ />
248
+ {state === "answer" && !observed ? (
249
+ <p className="mt-1 text-xs text-muted-foreground">{labels.answerHint}</p>
250
+ ) : null}
251
+ </div>
325
252
  ) : null}
326
- </section>
253
+ {model.heldLater ? (
254
+ <button
255
+ type="button"
256
+ onClick={() => revealApproval(model.heldLater?.id)}
257
+ className="ml-[1.625rem] flex h-7 w-fit items-center gap-1 rounded-full px-2 text-xs font-medium text-amber-700 outline-none transition-colors hover:bg-amber-500/10 focus-visible:ring-2 focus-visible:ring-ring/40 dark:text-amber-400"
258
+ >
259
+ <ArrowDown className="size-3.5" aria-hidden="true" />
260
+ {labels.viewRequest}
261
+ </button>
262
+ ) : null}
263
+ {model.approvals.map((approval) => (
264
+ <ApprovalCard key={approval.id} held={heldCallOf(approval)} underCaller={!named} />
265
+ ))}
266
+ </div>
327
267
  )
328
- })
268
+ }
329
269
 
330
270
  /**
331
271
  * Stop the child at work, at once: it says it is stopping until its run ends. A failure says so for
@@ -3,7 +3,6 @@ import { useEffect, useMemo, useRef } from "react"
3
3
  import { type TranscriptApprovals, useApprovalCards } from "../approvals"
4
4
  import type { LiveRunState } from "../live-run"
5
5
  import { useObservedThread } from "../observed-thread"
6
- import { ChildCard } from "./child-card"
7
6
  import { ChildGroup } from "./child-group"
8
7
  import { useDelegationCards } from "./context"
9
8
  import { type AgentChild, activeRun, type SpawnedChild, type ThreadDelegation } from "./interpret"
@@ -17,8 +16,8 @@ import {
17
16
  } from "./use-children"
18
17
 
19
18
  /**
20
- * The sub-agents a run of the Agent's work spawned, under that work: one card each, or, for
21
- * several, one group that says how they stand. Each child at work streams to its card.
19
+ * The sub-agents a run of the Agent's work spawned, under that work: one line that names them and
20
+ * says how they stand, opening each one's thread. Each child at work streams to it.
22
21
  */
23
22
  export function ChildCards({ spawned }: { readonly spawned: readonly SpawnedChild[] }) {
24
23
  const cards = useDelegationCards()
@@ -86,11 +85,9 @@ export function ChildCards({ spawned }: { readonly spawned: readonly SpawnedChil
86
85
  {streaming.map((id) => (
87
86
  <ChildStream key={id} runId={id} onEvent={onEvent} />
88
87
  ))}
89
- {models.length === 1 && models[0] ? (
90
- <ChildCard model={models[0]} source={source} unavailable={unavailable} />
91
- ) : (
88
+ {models.length > 0 ? (
92
89
  <ChildGroup models={models} source={source} unavailable={unavailable} />
93
- )}
90
+ ) : null}
94
91
  </>
95
92
  )
96
93
  }