@sixb/app 0.2.3 → 0.2.5

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 (329) hide show
  1. package/assets/connector-icons/README.md +1 -0
  2. package/assets/connector-icons/ctm.png +0 -0
  3. package/dist/agent/activity-label.d.ts.map +1 -1
  4. package/dist/agent/agent-chat.d.ts +3 -1
  5. package/dist/agent/agent-chat.d.ts.map +1 -1
  6. package/dist/agent/agent-panel.d.ts.map +1 -1
  7. package/dist/agent/artifact-panel.d.ts +3 -1
  8. package/dist/agent/artifact-panel.d.ts.map +1 -1
  9. package/dist/agent/background/background-tool-row.d.ts.map +1 -1
  10. package/dist/agent/background/interpret.d.ts +1 -1
  11. package/dist/agent/background/interpret.d.ts.map +1 -1
  12. package/dist/agent/components/composer-settings.d.ts +1 -1
  13. package/dist/agent/components/composer-settings.d.ts.map +1 -1
  14. package/dist/agent/components/composer.d.ts +22 -5
  15. package/dist/agent/components/composer.d.ts.map +1 -1
  16. package/dist/agent/components/context-meter.d.ts +1 -1
  17. package/dist/agent/components/context-meter.d.ts.map +1 -1
  18. package/dist/agent/components/conversation-panel.d.ts +8 -2
  19. package/dist/agent/components/conversation-panel.d.ts.map +1 -1
  20. package/dist/agent/components/message-parts.d.ts +2 -1
  21. package/dist/agent/components/message-parts.d.ts.map +1 -1
  22. package/dist/agent/components/message-view.d.ts.map +1 -1
  23. package/dist/agent/components/pending-messages.d.ts +20 -0
  24. package/dist/agent/components/pending-messages.d.ts.map +1 -0
  25. package/dist/agent/components/sandbox-recovery.d.ts +11 -2
  26. package/dist/agent/components/sandbox-recovery.d.ts.map +1 -1
  27. package/dist/agent/components/threads-button.d.ts +1 -1
  28. package/dist/agent/components/threads-button.d.ts.map +1 -1
  29. package/dist/agent/components/transcript.d.ts +5 -0
  30. package/dist/agent/components/transcript.d.ts.map +1 -1
  31. package/dist/agent/conversation.d.ts +3 -6
  32. package/dist/agent/conversation.d.ts.map +1 -1
  33. package/dist/agent/delegation/agent-exchange.d.ts +16 -0
  34. package/dist/agent/delegation/agent-exchange.d.ts.map +1 -0
  35. package/dist/agent/delegation/child-card.d.ts +3 -3
  36. package/dist/agent/delegation/child-card.d.ts.map +1 -1
  37. package/dist/agent/delegation/child-parts.d.ts +1 -10
  38. package/dist/agent/delegation/child-parts.d.ts.map +1 -1
  39. package/dist/agent/delegation/child-work.d.ts.map +1 -1
  40. package/dist/agent/delegation/interpret.d.ts +9 -10
  41. package/dist/agent/delegation/interpret.d.ts.map +1 -1
  42. package/dist/agent/delegation/use-children.d.ts.map +1 -1
  43. package/dist/agent/file-edits/file-edit-tool-view.d.ts +10 -0
  44. package/dist/agent/file-edits/file-edit-tool-view.d.ts.map +1 -0
  45. package/dist/agent/file-edits/interpret.d.ts +25 -0
  46. package/dist/agent/file-edits/interpret.d.ts.map +1 -0
  47. package/dist/agent/hooks/use-agent-conversation.d.ts +16 -4
  48. package/dist/agent/hooks/use-agent-conversation.d.ts.map +1 -1
  49. package/dist/agent/hooks/use-thread-lists.d.ts.map +1 -1
  50. package/dist/agent/hooks/use-thread-stream.d.ts.map +1 -1
  51. package/dist/agent/i18n/en.d.ts +114 -5
  52. package/dist/agent/i18n/en.d.ts.map +1 -1
  53. package/dist/agent/i18n/fr.d.ts.map +1 -1
  54. package/dist/agent/i18n/index.d.ts +190 -8
  55. package/dist/agent/i18n/index.d.ts.map +1 -1
  56. package/dist/agent/inbox-handoff.d.ts +10 -0
  57. package/dist/agent/inbox-handoff.d.ts.map +1 -0
  58. package/dist/agent/live-run.d.ts +8 -1
  59. package/dist/agent/live-run.d.ts.map +1 -1
  60. package/dist/agent/message-agent/interpret.d.ts +2 -2
  61. package/dist/agent/message-agent/interpret.d.ts.map +1 -1
  62. package/dist/agent/publish-artifact/interpret.d.ts +1 -1
  63. package/dist/agent/publish-artifact/interpret.d.ts.map +1 -1
  64. package/dist/agent/questions/interpret.d.ts +31 -0
  65. package/dist/agent/questions/interpret.d.ts.map +1 -0
  66. package/dist/agent/questions/question-card.d.ts +16 -0
  67. package/dist/agent/questions/question-card.d.ts.map +1 -0
  68. package/dist/agent/questions/question-composer.d.ts +15 -0
  69. package/dist/agent/questions/question-composer.d.ts.map +1 -0
  70. package/dist/agent/read/interpret.d.ts +8 -1
  71. package/dist/agent/read/interpret.d.ts.map +1 -1
  72. package/dist/agent/read/read-tool-view.d.ts.map +1 -1
  73. package/dist/agent/search/interpret.d.ts +101 -0
  74. package/dist/agent/search/interpret.d.ts.map +1 -0
  75. package/dist/agent/search/search-tool-view.d.ts +10 -0
  76. package/dist/agent/search/search-tool-view.d.ts.map +1 -0
  77. package/dist/agent/thread-state.d.ts +26 -0
  78. package/dist/agent/thread-state.d.ts.map +1 -0
  79. package/dist/agent/tool-views/built-in.d.ts.map +1 -1
  80. package/dist/agent/tool-views/registry.d.ts +5 -6
  81. package/dist/agent/tool-views/registry.d.ts.map +1 -1
  82. package/dist/agent/types.d.ts +5 -1
  83. package/dist/agent/types.d.ts.map +1 -1
  84. package/dist/agent/view-file/view-file-tool-view.d.ts +2 -1
  85. package/dist/agent/view-file/view-file-tool-view.d.ts.map +1 -1
  86. package/dist/agent/waits.d.ts +14 -0
  87. package/dist/agent/waits.d.ts.map +1 -0
  88. package/dist/artifacts/card-preview.d.ts.map +1 -1
  89. package/dist/artifacts/edit-session.d.ts +11 -1
  90. package/dist/artifacts/edit-session.d.ts.map +1 -1
  91. package/dist/artifacts/editor/block-handle.d.ts +20 -0
  92. package/dist/artifacts/editor/block-handle.d.ts.map +1 -0
  93. package/dist/artifacts/editor/blocks.d.ts +34 -0
  94. package/dist/artifacts/editor/blocks.d.ts.map +1 -0
  95. package/dist/artifacts/editor/callout-view.d.ts +7 -0
  96. package/dist/artifacts/editor/callout-view.d.ts.map +1 -0
  97. package/dist/artifacts/editor/document-editor.d.ts +30 -0
  98. package/dist/artifacts/editor/document-editor.d.ts.map +1 -0
  99. package/dist/artifacts/editor/figure-view.d.ts +12 -0
  100. package/dist/artifacts/editor/figure-view.d.ts.map +1 -0
  101. package/dist/artifacts/editor/find-blocks.d.ts +6 -0
  102. package/dist/artifacts/editor/find-blocks.d.ts.map +1 -0
  103. package/dist/artifacts/editor/markdown-document.d.ts +12 -0
  104. package/dist/artifacts/editor/markdown-document.d.ts.map +1 -0
  105. package/dist/artifacts/editor/messages.d.ts +4 -0
  106. package/dist/artifacts/editor/messages.d.ts.map +1 -0
  107. package/dist/artifacts/editor/schema.d.ts +21 -0
  108. package/dist/artifacts/editor/schema.d.ts.map +1 -0
  109. package/dist/artifacts/editor/selection-toolbar.d.ts +35 -0
  110. package/dist/artifacts/editor/selection-toolbar.d.ts.map +1 -0
  111. package/dist/artifacts/editor/slash-menu.d.ts +43 -0
  112. package/dist/artifacts/editor/slash-menu.d.ts.map +1 -0
  113. package/dist/artifacts/editor/upload.d.ts +12 -0
  114. package/dist/artifacts/editor/upload.d.ts.map +1 -0
  115. package/dist/artifacts/file-source.d.ts +5 -0
  116. package/dist/artifacts/file-source.d.ts.map +1 -1
  117. package/dist/artifacts/frame-editor/bundle.d.ts +7 -0
  118. package/dist/artifacts/frame-editor/bundle.d.ts.map +1 -0
  119. package/dist/artifacts/frame-editor/commands.d.ts +93 -0
  120. package/dist/artifacts/frame-editor/commands.d.ts.map +1 -0
  121. package/dist/artifacts/frame-editor/entry.d.ts +2 -0
  122. package/dist/artifacts/frame-editor/entry.d.ts.map +1 -0
  123. package/dist/artifacts/frame-editor/frame.d.ts +5 -0
  124. package/dist/artifacts/frame-editor/frame.d.ts.map +1 -0
  125. package/dist/artifacts/frame-editor/keys.d.ts +8 -0
  126. package/dist/artifacts/frame-editor/keys.d.ts.map +1 -0
  127. package/dist/artifacts/frame-editor/protocol.d.ts +186 -0
  128. package/dist/artifacts/frame-editor/protocol.d.ts.map +1 -0
  129. package/dist/artifacts/frame-editor/schema.d.ts +34 -0
  130. package/dist/artifacts/frame-editor/schema.d.ts.map +1 -0
  131. package/dist/artifacts/frame-editor/style.d.ts +2 -0
  132. package/dist/artifacts/frame-editor/style.d.ts.map +1 -0
  133. package/dist/artifacts/frame.d.ts +2 -2
  134. package/dist/artifacts/frame.d.ts.map +1 -1
  135. package/dist/artifacts/live/boards.d.ts +2 -0
  136. package/dist/artifacts/live/boards.d.ts.map +1 -1
  137. package/dist/artifacts/live/document.d.ts +32 -0
  138. package/dist/artifacts/live/document.d.ts.map +1 -0
  139. package/dist/artifacts/live/header.d.ts +4 -4
  140. package/dist/artifacts/live/header.d.ts.map +1 -1
  141. package/dist/artifacts/live/presence.d.ts.map +1 -1
  142. package/dist/artifacts/live/session.d.ts +2 -0
  143. package/dist/artifacts/live/session.d.ts.map +1 -1
  144. package/dist/artifacts/live/view.d.ts +4 -3
  145. package/dist/artifacts/live/view.d.ts.map +1 -1
  146. package/dist/artifacts/messages.d.ts +278 -2
  147. package/dist/artifacts/messages.d.ts.map +1 -1
  148. package/dist/artifacts/pdf.d.ts +8 -0
  149. package/dist/artifacts/pdf.d.ts.map +1 -0
  150. package/dist/artifacts/queries.d.ts +80 -0
  151. package/dist/artifacts/queries.d.ts.map +1 -1
  152. package/dist/artifacts/references/references.d.ts +3 -3
  153. package/dist/artifacts/references/references.d.ts.map +1 -1
  154. package/dist/artifacts/renderers/canvas/board-editor.d.ts +11 -4
  155. package/dist/artifacts/renderers/canvas/board-editor.d.ts.map +1 -1
  156. package/dist/artifacts/renderers/canvas/board.d.ts +14 -2
  157. package/dist/artifacts/renderers/canvas/board.d.ts.map +1 -1
  158. package/dist/artifacts/renderers/canvas/canvas.d.ts +4 -3
  159. package/dist/artifacts/renderers/canvas/canvas.d.ts.map +1 -1
  160. package/dist/artifacts/renderers/canvas/comment-pins.d.ts +4 -2
  161. package/dist/artifacts/renderers/canvas/comment-pins.d.ts.map +1 -1
  162. package/dist/artifacts/renderers/canvas/comments-panel.d.ts.map +1 -1
  163. package/dist/artifacts/renderers/canvas/comments.d.ts +2 -1
  164. package/dist/artifacts/renderers/canvas/comments.d.ts.map +1 -1
  165. package/dist/artifacts/renderers/canvas/controls.d.ts +15 -4
  166. package/dist/artifacts/renderers/canvas/controls.d.ts.map +1 -1
  167. package/dist/artifacts/renderers/canvas/focus.d.ts +19 -5
  168. package/dist/artifacts/renderers/canvas/focus.d.ts.map +1 -1
  169. package/dist/artifacts/renderers/canvas/gestures.d.ts +46 -0
  170. package/dist/artifacts/renderers/canvas/gestures.d.ts.map +1 -0
  171. package/dist/artifacts/renderers/canvas/page-resize.d.ts +21 -0
  172. package/dist/artifacts/renderers/canvas/page-resize.d.ts.map +1 -0
  173. package/dist/artifacts/renderers/canvas/page-size-controls.d.ts +21 -0
  174. package/dist/artifacts/renderers/canvas/page-size-controls.d.ts.map +1 -0
  175. package/dist/artifacts/renderers/canvas/page-size.d.ts +93 -0
  176. package/dist/artifacts/renderers/canvas/page-size.d.ts.map +1 -0
  177. package/dist/artifacts/renderers/canvas/page-zoom.d.ts +64 -0
  178. package/dist/artifacts/renderers/canvas/page-zoom.d.ts.map +1 -0
  179. package/dist/artifacts/renderers/canvas/shown-size.d.ts +26 -0
  180. package/dist/artifacts/renderers/canvas/shown-size.d.ts.map +1 -0
  181. package/dist/artifacts/renderers/designed-document.d.ts +28 -0
  182. package/dist/artifacts/renderers/designed-document.d.ts.map +1 -0
  183. package/dist/artifacts/renderers/document-tree.d.ts +2 -0
  184. package/dist/artifacts/renderers/document-tree.d.ts.map +1 -1
  185. package/dist/artifacts/renderers/document.d.ts +9 -1
  186. package/dist/artifacts/renderers/document.d.ts.map +1 -1
  187. package/dist/artifacts/renderers/live-frame.d.ts +145 -0
  188. package/dist/artifacts/renderers/live-frame.d.ts.map +1 -0
  189. package/dist/artifacts/renderers/page-editor.d.ts +16 -0
  190. package/dist/artifacts/renderers/page-editor.d.ts.map +1 -0
  191. package/dist/artifacts/renderers/page.d.ts +10 -1
  192. package/dist/artifacts/renderers/page.d.ts.map +1 -1
  193. package/dist/artifacts/viewer.d.ts.map +1 -1
  194. package/dist/{chunk-001c4gnk.js → chunk-4fex83k2.js} +19965 -13027
  195. package/dist/chunk-4fex83k2.js.map +239 -0
  196. package/dist/{chunk-5crvhjp2.js → chunk-4wm09prf.js} +1633 -1999
  197. package/dist/chunk-4wm09prf.js.map +27 -0
  198. package/dist/{chunk-fwb9mxwm.js → chunk-5sgac68y.js} +1 -1
  199. package/dist/{chunk-kes4ygmz.js → chunk-69qgh20f.js} +1 -1
  200. package/dist/chunk-y51c4tsz.js +11 -0
  201. package/dist/chunk-y51c4tsz.js.map +10 -0
  202. package/dist/index.d.ts +4 -1
  203. package/dist/index.d.ts.map +1 -1
  204. package/dist/index.js +13 -6
  205. package/dist/index.js.map +5 -5
  206. package/dist/pages/console/data/messages.d.ts +6 -0
  207. package/dist/pages/console/data/messages.d.ts.map +1 -1
  208. package/dist/pages/console/data/shared.d.ts.map +1 -1
  209. package/dist/pages.js +12 -5
  210. package/dist/pages.js.map +6 -6
  211. package/dist/shell/search-command.d.ts.map +1 -1
  212. package/package.json +22 -5
  213. package/src/agent/activity-label.ts +9 -1
  214. package/src/agent/agent-chat.tsx +57 -37
  215. package/src/agent/agent-execution-trace.tsx +2 -2
  216. package/src/agent/agent-panel.tsx +6 -4
  217. package/src/agent/agent.css +254 -0
  218. package/src/agent/artifact-panel.tsx +77 -22
  219. package/src/agent/background/background-tool-row.tsx +24 -10
  220. package/src/agent/background/interpret.ts +60 -51
  221. package/src/agent/components/composer-settings.tsx +20 -10
  222. package/src/agent/components/composer.tsx +342 -104
  223. package/src/agent/components/context-meter.tsx +7 -3
  224. package/src/agent/components/conversation-panel.tsx +96 -37
  225. package/src/agent/components/message-parts.tsx +390 -64
  226. package/src/agent/components/message-view.tsx +12 -2
  227. package/src/agent/components/pending-messages.tsx +338 -0
  228. package/src/agent/components/sandbox-recovery.tsx +36 -17
  229. package/src/agent/components/threads-button.tsx +3 -2
  230. package/src/agent/components/transcript.tsx +92 -45
  231. package/src/agent/conversation.ts +203 -54
  232. package/src/agent/delegation/agent-exchange.tsx +53 -0
  233. package/src/agent/delegation/child-card.tsx +6 -40
  234. package/src/agent/delegation/child-parts.tsx +1 -84
  235. package/src/agent/delegation/child-work.tsx +19 -5
  236. package/src/agent/delegation/interpret.ts +64 -61
  237. package/src/agent/delegation/model.ts +1 -1
  238. package/src/agent/file-edits/file-edit-tool-view.tsx +126 -0
  239. package/src/agent/file-edits/interpret.ts +120 -0
  240. package/src/agent/hooks/use-agent-conversation.ts +360 -92
  241. package/src/agent/hooks/use-thread-stream.ts +10 -0
  242. package/src/agent/i18n/en.ts +134 -16
  243. package/src/agent/i18n/fr.ts +122 -16
  244. package/src/agent/inbox-handoff.ts +47 -0
  245. package/src/agent/live-run.ts +23 -2
  246. package/src/agent/message-agent/interpret.ts +4 -3
  247. package/src/agent/publish-artifact/interpret.ts +14 -5
  248. package/src/agent/publish-artifact/publish-artifact-tool-view.tsx +2 -2
  249. package/src/agent/questions/interpret.ts +90 -0
  250. package/src/agent/questions/question-card.tsx +57 -0
  251. package/src/agent/questions/question-composer.tsx +257 -0
  252. package/src/agent/react-router.tsx +2 -2
  253. package/src/agent/read/interpret.ts +34 -1
  254. package/src/agent/read/read-tool-view.tsx +20 -4
  255. package/src/agent/search/interpret.ts +367 -0
  256. package/src/agent/search/search-tool-view.tsx +235 -0
  257. package/src/agent/thread-state.ts +114 -0
  258. package/src/agent/tool-views/built-in.tsx +33 -6
  259. package/src/agent/tool-views/registry.tsx +28 -2
  260. package/src/agent/types.ts +7 -0
  261. package/src/agent/view-file/view-file-tool-view.tsx +33 -19
  262. package/src/agent/waits.ts +50 -0
  263. package/src/artifacts/artifacts.css +434 -0
  264. package/src/artifacts/card-preview.tsx +6 -1
  265. package/src/artifacts/edit-session.tsx +15 -1
  266. package/src/artifacts/editor/block-handle.tsx +278 -0
  267. package/src/artifacts/editor/blocks.ts +216 -0
  268. package/src/artifacts/editor/callout-view.tsx +31 -0
  269. package/src/artifacts/editor/document-editor.tsx +484 -0
  270. package/src/artifacts/editor/figure-view.tsx +66 -0
  271. package/src/artifacts/editor/find-blocks.ts +19 -0
  272. package/src/artifacts/editor/markdown-document.tsx +72 -0
  273. package/src/artifacts/editor/messages.ts +4 -0
  274. package/src/artifacts/editor/schema.ts +159 -0
  275. package/src/artifacts/editor/selection-toolbar.tsx +364 -0
  276. package/src/artifacts/editor/slash-menu.tsx +251 -0
  277. package/src/artifacts/editor/upload.ts +40 -0
  278. package/src/artifacts/file-source.ts +11 -0
  279. package/src/artifacts/frame-editor/bundle.ts +8 -0
  280. package/src/artifacts/frame-editor/commands.ts +565 -0
  281. package/src/artifacts/frame-editor/entry.ts +6 -0
  282. package/src/artifacts/frame-editor/frame.ts +847 -0
  283. package/src/artifacts/frame-editor/generated/editor.txt +149 -0
  284. package/src/artifacts/frame-editor/generated.d.ts +5 -0
  285. package/src/artifacts/frame-editor/keys.ts +323 -0
  286. package/src/artifacts/frame-editor/protocol.ts +151 -0
  287. package/src/artifacts/frame-editor/schema.ts +293 -0
  288. package/src/artifacts/frame-editor/style.ts +58 -0
  289. package/src/artifacts/frame.tsx +14 -5
  290. package/src/artifacts/live/boards.ts +46 -3
  291. package/src/artifacts/live/document.ts +89 -0
  292. package/src/artifacts/live/header.tsx +9 -14
  293. package/src/artifacts/live/presence.ts +5 -1
  294. package/src/artifacts/live/session.ts +4 -2
  295. package/src/artifacts/live/view.ts +14 -8
  296. package/src/artifacts/messages.ts +192 -2
  297. package/src/artifacts/pdf.ts +50 -0
  298. package/src/artifacts/references/references.tsx +46 -11
  299. package/src/artifacts/renderers/canvas/board-editor.tsx +44 -155
  300. package/src/artifacts/renderers/canvas/board.tsx +70 -8
  301. package/src/artifacts/renderers/canvas/canvas.tsx +66 -15
  302. package/src/artifacts/renderers/canvas/comment-pins.tsx +5 -0
  303. package/src/artifacts/renderers/canvas/comments-panel.tsx +58 -1
  304. package/src/artifacts/renderers/canvas/comments.ts +8 -4
  305. package/src/artifacts/renderers/canvas/controls.tsx +64 -30
  306. package/src/artifacts/renderers/canvas/focus.tsx +200 -56
  307. package/src/artifacts/renderers/canvas/gestures.ts +265 -0
  308. package/src/artifacts/renderers/canvas/page-resize.tsx +542 -0
  309. package/src/artifacts/renderers/canvas/page-size-controls.tsx +193 -0
  310. package/src/artifacts/renderers/canvas/page-size.ts +218 -0
  311. package/src/artifacts/renderers/canvas/page-zoom.ts +280 -0
  312. package/src/artifacts/renderers/canvas/shown-size.ts +105 -0
  313. package/src/artifacts/renderers/designed-document.tsx +277 -0
  314. package/src/artifacts/renderers/document-tree.ts +9 -0
  315. package/src/artifacts/renderers/document.tsx +13 -102
  316. package/src/artifacts/renderers/live-frame.ts +163 -0
  317. package/src/artifacts/renderers/page-editor.tsx +613 -0
  318. package/src/artifacts/renderers/page.tsx +21 -4
  319. package/src/artifacts/viewer.tsx +101 -41
  320. package/src/index.ts +8 -0
  321. package/src/pages/console/data/messages.ts +6 -0
  322. package/src/pages/console/data/projections.tsx +4 -0
  323. package/src/pages/console/data/shared.tsx +1 -0
  324. package/src/pages/console/ontology/lineage/trail.tsx +3 -0
  325. package/src/shell/search-command.tsx +2 -0
  326. package/dist/chunk-001c4gnk.js.map +0 -204
  327. package/dist/chunk-5crvhjp2.js.map +0 -28
  328. /package/dist/{chunk-fwb9mxwm.js.map → chunk-5sgac68y.js.map} +0 -0
  329. /package/dist/{chunk-kes4ygmz.js.map → chunk-69qgh20f.js.map} +0 -0
@@ -7,6 +7,7 @@ import { useAgentMessages } from "../i18n"
7
7
  import type { LiveRunState } from "../live-run"
8
8
  import { normalizeDurableParts } from "../parts"
9
9
  import type { AgentMessage } from "../types"
10
+ import { AgentNote } from "./agent-exchange"
10
11
  import type { AgentChild, WaitedChild } from "./interpret"
11
12
  import { type ChildrenSource, useChildMessages } from "./use-children"
12
13
 
@@ -107,7 +108,11 @@ export function ChildWork({
107
108
  {view.runs.map((run, index) => {
108
109
  const atWork = run.status === "queued" || run.status === "running"
109
110
  const own = byRun.get(run.id) ?? []
110
- const work = own.filter((message) => message.role === "assistant")
111
+ // Its work, and what the Agent sent it along the way; its task heads the panel already.
112
+ const work = own.filter(
113
+ (message) =>
114
+ message.role === "assistant" || message.parts.some((part) => part.type === "mail")
115
+ )
111
116
 
112
117
  let body: ReactNode
113
118
  if (work.length > 0) {
@@ -166,7 +171,7 @@ function continuedAfterAnswer(
166
171
  return previous?.finishReason === "awaiting_answer"
167
172
  }
168
173
 
169
- /** One run's work, as its thread keeps it: its assistant messages, read once each. */
174
+ /** One run's work, as its thread keeps it: its steps, and what the Agent sent it between them. */
170
175
  const RunWork = memo(function RunWork({
171
176
  messages,
172
177
  threadId,
@@ -190,9 +195,18 @@ const RunWork = memo(function RunWork({
190
195
 
191
196
  return (
192
197
  <>
193
- {bodies.map((parts, position) => (
194
- <AssistantBody key={messages[position]?.id ?? position} parts={parts} nested />
195
- ))}
198
+ {bodies.map((parts, position) => {
199
+ const message = messages[position]
200
+ // What the Agent sent it, an answer or a message, reads on the Agent's side.
201
+ if (message?.role === "user") {
202
+ return message.parts.flatMap((part, index) =>
203
+ part.type === "mail"
204
+ ? [<AgentNote key={`${message.id}:${index}`} text={part.text} />]
205
+ : []
206
+ )
207
+ }
208
+ return <AssistantBody key={message?.id ?? position} parts={parts} nested />
209
+ })}
196
210
  </>
197
211
  )
198
212
  })
@@ -2,6 +2,8 @@ import type { AgentChild } from "@sixb/client"
2
2
  import { type AgentConversationMessage, normalizedTool } from "../conversation"
3
3
  import type { AgentMessages } from "../i18n/en"
4
4
  import { type NormalizedPart, type NormalizedTool, toolResultValue } from "../parts"
5
+ import { askedText, isAskTool } from "../questions/interpret"
6
+ import { isCommandId, isStop, namedIds, waitsForChildren } from "../waits"
5
7
 
6
8
  // What the parent's own parts say about the sub-agents it delegated to: which it spawned, what it
7
9
  // told or answered each, and what each asked. A reader of the thread always has them, even without
@@ -24,13 +26,7 @@ export interface SpawnedChild {
24
26
  readonly pending: boolean
25
27
  }
26
28
 
27
- /** One line of what passed between the Agent and a child, oldest first. */
28
- export interface ChildExchange {
29
- readonly kind: "told" | "asked" | "answered"
30
- readonly text: string
31
- }
32
-
33
- /** What `wait_agent` last said about one of a child's runs. */
29
+ /** What `wait`, or a `stop`, last said about one of a child's runs. */
34
30
  export interface WaitedChild {
35
31
  readonly status: string
36
32
  readonly text?: string
@@ -41,7 +37,6 @@ export interface WaitedChild {
41
37
  export interface ThreadDelegation {
42
38
  /** The turn that spawned each child. */
43
39
  readonly spawnedBy: ReadonlyMap<string, string | null>
44
- readonly exchanges: ReadonlyMap<string, readonly ChildExchange[]>
45
40
  /** By the id of the run waited on: a child's first run, or one that continued it. */
46
41
  readonly waited: ReadonlyMap<string, WaitedChild>
47
42
  /**
@@ -93,44 +88,56 @@ export interface DelegationTurn {
93
88
  readonly tools: readonly NormalizedTool[]
94
89
  }
95
90
 
96
- const DELEGATION_TOOLS = new Set(["spawn_agent", "wait_agent", "message_agent"])
91
+ /** Earlier threads hold `wait_agent`; a `wait` or a `stop` for commands alone is left out. */
92
+ const DELEGATION_TOOLS = new Set(["spawn_agent", "message_agent", "wait", "stop", "wait_agent"])
93
+
94
+ export interface DelegationTurnEntry {
95
+ readonly turn: DelegationTurn
96
+ readonly signature: string
97
+ }
98
+
99
+ const delegationTurnEntries = new WeakMap<AgentConversationMessage, DelegationTurnEntry>()
100
+
101
+ export function delegationTurnEntry(msg: AgentConversationMessage): DelegationTurnEntry | null {
102
+ if (msg.role !== "assistant") return null
103
+ const cached = delegationTurnEntries.get(msg)
104
+ if (cached) return cached
105
+
106
+ const tools: NormalizedTool[] = []
107
+ let sig = `${msg.runId ?? ""}:`
108
+ for (const part of msg.parts) {
109
+ if (part.type === "tool" && DELEGATION_TOOLS.has(part.toolName)) {
110
+ tools.push(normalizedTool(part))
111
+ sig += `${part.toolName}@${part.state};`
112
+ }
113
+ }
114
+ const entry = { turn: { runId: msg.runId, tools }, signature: sig }
115
+ delegationTurnEntries.set(msg, entry)
116
+ return entry
117
+ }
97
118
 
98
119
  /** The delegation calls of each reply, oldest first, the one streaming last. */
99
120
  export function delegationTurns(
100
121
  messages: readonly AgentConversationMessage[]
101
122
  ): readonly DelegationTurn[] {
102
- return messages.flatMap((message) => {
103
- if (message.role !== "assistant") return []
104
- const tools = message.parts.flatMap((part) =>
105
- part.type === "tool" && DELEGATION_TOOLS.has(part.toolName) ? [normalizedTool(part)] : []
106
- )
107
- return [{ runId: message.runId, tools }]
108
- })
123
+ const result: DelegationTurn[] = []
124
+ for (const message of messages) {
125
+ const entry = delegationTurnEntry(message)
126
+ if (entry) result.push(entry.turn)
127
+ }
128
+ return result
109
129
  }
110
130
 
111
131
  /**
112
- * Read the thread's sub-agents from its turns, oldest first, the one streaming now last. Each
113
- * `message_agent` and question goes to the child its key named at that point.
132
+ * Read the thread's sub-agents from its turns, oldest first, the one streaming now last. What
133
+ * passed between the Agent and a child reads in the child's panel, from its own thread.
114
134
  */
115
135
  export function readThreadDelegation(turns: readonly DelegationTurn[]): ThreadDelegation {
116
136
  const spawnedBy = new Map<string, string | null>()
117
- const exchanges = new Map<string, ChildExchange[]>()
118
137
  const waited = new Map<string, WaitedChild>()
119
138
  const owners = new Map<string, string>()
120
139
  const ownersByTurn = new Map<string, ReadonlyMap<string, string>>()
121
140
 
122
- const add = (key: string, exchange: ChildExchange) => {
123
- const owner = owners.get(key)
124
- if (!owner) return
125
- const list = exchanges.get(owner) ?? []
126
- // A question is listed by every wait until it is answered: it reads once.
127
- const repeated = list.some(
128
- (earlier) => earlier.kind === exchange.kind && earlier.text === exchange.text
129
- )
130
- if (exchange.kind === "asked" && repeated) return
131
- exchanges.set(owner, [...list, exchange])
132
- }
133
-
134
141
  const read = (runId: string | null, tool: NormalizedTool) => {
135
142
  const child = spawnedChild(tool)
136
143
  if (child && !child.pending) {
@@ -139,28 +146,15 @@ export function readThreadDelegation(turns: readonly DelegationTurn[]): ThreadDe
139
146
  return
140
147
  }
141
148
 
142
- if (tool.toolName === "message_agent" && tool.state === "output-available") {
143
- const input = isRecord(tool.input) ? tool.input : {}
144
- const output = toolResultValue(tool.output)
145
- if (typeof input.key !== "string" || typeof input.text !== "string") return
146
- const kind = isRecord(output) && output.delivery === "answer" ? "answered" : "told"
147
- add(input.key.trim(), { kind, text: input.text.trim() })
148
- return
149
- }
150
-
151
- if (tool.toolName !== "wait_agent" || tool.state !== "output-available") return
149
+ if (!waitsForChildren(tool) || tool.state !== "output-available") return
152
150
  const output = toolResultValue(tool.output)
153
151
  if (!isRecord(output)) return
154
152
 
155
- for (const question of Array.isArray(output.questions) ? output.questions : []) {
156
- if (!isRecord(question)) continue
157
- if (typeof question.key !== "string" || typeof question.text !== "string") continue
158
- add(question.key, { kind: "asked", text: question.text.trim() })
159
- }
160
153
  for (const result of Array.isArray(output.results) ? output.results : []) {
161
154
  if (!isRecord(result) || typeof result.runId !== "string") continue
162
155
  if (typeof result.status !== "string") continue
163
- waited.set(result.runId, {
156
+ // Named by its key, as `wait` takes it, or by its run id, as `wait_agent` did.
157
+ waited.set(owners.get(result.runId) ?? result.runId, {
164
158
  status: result.status,
165
159
  ...(typeof result.text === "string" ? { text: result.text } : {}),
166
160
  ...(isRecord(result.error) && typeof result.error.message === "string"
@@ -177,7 +171,6 @@ export function readThreadDelegation(turns: readonly DelegationTurn[]): ThreadDe
177
171
 
178
172
  return {
179
173
  spawnedBy,
180
- exchanges,
181
174
  waited,
182
175
  ownerOf: (key, runId) =>
183
176
  (runId ? ownersByTurn.get(runId) : undefined)?.get(key) ?? owners.get(key),
@@ -273,14 +266,13 @@ export function childTitle(key: string): string {
273
266
  return words ? `${words.charAt(0).toUpperCase()}${words.slice(1)}` : key
274
267
  }
275
268
 
276
- /** The question a child at work waits on, from its live parts: its `ask_parent` call in flight. */
269
+ /** The question a child at work waits on, from its live parts: its `ask` call in flight. */
277
270
  export function liveQuestion(parts: readonly NormalizedPart[]): string | null {
278
271
  for (let index = parts.length - 1; index >= 0; index -= 1) {
279
272
  const part = parts[index]
280
- if (part?.kind !== "tool" || part.tool.toolName !== "ask_parent") continue
273
+ if (part?.kind !== "tool" || !isAskTool(part.tool.toolName)) continue
281
274
  if (part.tool.state !== "input-available") return null
282
- const input = isRecord(part.tool.input) ? part.tool.input : {}
283
- return typeof input.question === "string" ? input.question.trim() : null
275
+ return askedText(part.tool.input) || null
284
276
  }
285
277
  return null
286
278
  }
@@ -294,11 +286,14 @@ export function formatWorked(ms: number, messages: AgentMessages["delegation"]):
294
286
  return messages.hours(Math.floor(minutes / 60), minutes % 60)
295
287
  }
296
288
 
297
- /** The children a `wait_agent` call waits for, by key when the parts named them. */
289
+ /**
290
+ * The children a `wait` or a `stop` names, by title: `wait` takes their keys, `wait_agent` took
291
+ * run ids, titled when the parts spawned them. Its background commands are not children.
292
+ */
298
293
  function waitedKeys(tool: NormalizedTool, keys: ReadonlyMap<string, string>): readonly string[] {
299
- const input = isRecord(tool.input) ? tool.input : {}
300
- const ids = Array.isArray(input.runIds) ? input.runIds : []
301
- return ids.flatMap((id) => (typeof id === "string" ? [keys.get(id) ?? ""] : []))
294
+ return namedIds(tool)
295
+ .filter((id) => !isCommandId(id))
296
+ .map((id) => keys.get(id) ?? (tool.toolName === "wait_agent" ? "" : childTitle(id)))
302
297
  }
303
298
 
304
299
  /**
@@ -330,13 +325,11 @@ export function describeDelegationTool(
330
325
  }
331
326
  }
332
327
 
333
- if (tool.toolName === "ask_parent") {
334
- const input = isRecord(tool.input) ? tool.input : {}
335
- const question = typeof input.question === "string" ? input.question.trim() : ""
336
- return { title: labels.askedAgent(question), running: labels.states.asking }
328
+ if (isAskTool(tool.toolName)) {
329
+ return { title: labels.askedAgent(askedText(tool.input)), running: labels.states.asking }
337
330
  }
338
331
 
339
- if (tool.toolName === "wait_agent") {
332
+ if (waitsForChildren(tool)) {
340
333
  const keys = new Map<string, string>()
341
334
  for (const part of parts) {
342
335
  if (part.kind !== "tool") continue
@@ -345,6 +338,16 @@ export function describeDelegationTool(
345
338
  }
346
339
  const waitedFor = waitedKeys(tool, keys)
347
340
  const named = waitedFor.every(Boolean) ? waitedFor : []
341
+ if (isStop(tool)) {
342
+ const name = named[0] ?? ""
343
+ if (tool.state === "output-error") {
344
+ const failed = labels.stopAgentFailed(name)
345
+ return { title: failed, running: failed }
346
+ }
347
+ return tool.state === "output-available"
348
+ ? { title: labels.stoppedAgent(name), running: labels.stoppedAgent(name) }
349
+ : { title: labels.stoppingAgent(name), running: labels.stoppingAgent(name) }
350
+ }
348
351
  const waiting =
349
352
  named.length === 1
350
353
  ? labels.waitingFor(named[0] ?? "")
@@ -224,7 +224,7 @@ function shortName(name: string): string {
224
224
  return `${(word > LINE_NAME_LENGTH / 2 ? cut.slice(0, word) : cut).replace(/[\s,.:;-]+$/, "")}…`
225
225
  }
226
226
 
227
- /** What `wait_agent` last said of any of the child's runs. */
227
+ /** What `wait`, or a `stop`, last said of any of the child's runs. */
228
228
  function waitedFor(
229
229
  waited: ReadonlyMap<string, WaitedChild>,
230
230
  child: SpawnedChild,
@@ -0,0 +1,126 @@
1
+ import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "@sixb/ui/components"
2
+ import { cn } from "@sixb/ui/lib/utils"
3
+ import { ChevronRight, FilePen, FilePlus } from "lucide-react"
4
+ import { ActivityStatusText } from "../components/activity-status"
5
+ import { useAgentMessages } from "../i18n"
6
+ import type { NormalizedTool } from "../parts"
7
+ import { type DiffLine, describeEdit, describeWrite, type FileEditDescription } from "./interpret"
8
+
9
+ /** A change the agent made to part of a file: its name and `+3 −1`, opening to the diff. */
10
+ export function EditToolView({ tool }: { tool: NormalizedTool }) {
11
+ const messages = useAgentMessages()
12
+ return (
13
+ <FileEditRow tool={tool} description={describeEdit(tool, messages)} icon={FilePen} counts />
14
+ )
15
+ }
16
+
17
+ /** A file the agent created or replaced whole: its name and lines, opening to what it wrote. */
18
+ export function WriteToolView({ tool }: { tool: NormalizedTool }) {
19
+ const messages = useAgentMessages()
20
+ return <FileEditRow tool={tool} description={describeWrite(tool, messages)} icon={FilePlus} />
21
+ }
22
+
23
+ function FileEditRow({
24
+ tool,
25
+ description,
26
+ icon: Icon,
27
+ counts = false,
28
+ }: {
29
+ tool: NormalizedTool
30
+ description: FileEditDescription
31
+ icon: typeof FilePen
32
+ /** Show the lines added and removed, in the diff's colors, rather than the detail text. */
33
+ counts?: boolean
34
+ }) {
35
+ const running = tool.state === "input-streaming" || tool.state === "input-available"
36
+ const error = tool.state === "output-error"
37
+ const label = error
38
+ ? description.failedTitle
39
+ : running
40
+ ? description.runningTitle
41
+ : description.title
42
+
43
+ if (running) {
44
+ return (
45
+ <div className="flex w-fit max-w-full items-center gap-1.5 text-[13px] leading-normal text-muted-foreground">
46
+ <Icon className="size-3.5 shrink-0" />
47
+ <ActivityStatusText label={label} className="font-medium shimmer" />
48
+ </div>
49
+ )
50
+ }
51
+
52
+ return (
53
+ <Collapsible>
54
+ <CollapsibleTrigger className="group flex w-fit max-w-full items-center gap-1.5 text-[13px] leading-normal text-muted-foreground transition-colors hover:text-foreground">
55
+ <Icon className="size-3.5 shrink-0" />
56
+ <span className="min-w-0 truncate font-medium">{label}</span>
57
+ {error || !description.detail ? null : counts ? (
58
+ <span className="shrink-0 font-mono text-[11px] tabular-nums">
59
+ <span className="text-emerald-600 dark:text-emerald-400">+{description.added}</span>{" "}
60
+ <span className="text-red-600 dark:text-red-400">−{description.removed}</span>
61
+ </span>
62
+ ) : (
63
+ <span className="min-w-0 shrink truncate text-muted-foreground/60">
64
+ {description.detail}
65
+ </span>
66
+ )}
67
+ <ChevronRight className="size-3.5 shrink-0 opacity-0 transition-all group-hover:opacity-100 group-focus-visible:opacity-100 group-data-[state=open]:rotate-90 group-data-[state=open]:opacity-100" />
68
+ </CollapsibleTrigger>
69
+ <CollapsibleContent>
70
+ <div className="mt-3 min-w-0 space-y-2 text-xs">
71
+ {description.path ? (
72
+ <p className="truncate font-mono text-[10px] text-muted-foreground/60">
73
+ {description.path}
74
+ </p>
75
+ ) : null}
76
+ {error ? (
77
+ <pre className="scrollbar-thin max-h-60 overflow-auto rounded bg-muted/50 p-2 text-[11px] leading-relaxed text-foreground">
78
+ {tool.errorText?.trim()}
79
+ </pre>
80
+ ) : (
81
+ <DiffBlock lines={description.lines} />
82
+ )}
83
+ </div>
84
+ </CollapsibleContent>
85
+ </Collapsible>
86
+ )
87
+ }
88
+
89
+ const LINE_CLASS: Record<DiffLine["kind"], string> = {
90
+ hunk: "text-muted-foreground/60",
91
+ added: "bg-emerald-500/10 text-emerald-700 dark:text-emerald-300",
92
+ removed: "bg-red-500/10 text-red-700 dark:text-red-300",
93
+ context: "text-foreground/80",
94
+ note: "text-muted-foreground/60 italic",
95
+ }
96
+
97
+ const LINE_MARK: Record<DiffLine["kind"], string> = {
98
+ hunk: "",
99
+ added: "+",
100
+ removed: "−",
101
+ context: " ",
102
+ note: "",
103
+ }
104
+
105
+ function DiffBlock({ lines }: { lines: readonly DiffLine[] }) {
106
+ return (
107
+ <pre className="scrollbar-thin max-h-72 overflow-auto rounded bg-muted/50 py-1.5 text-[11px] leading-relaxed">
108
+ {lines.map((line, index) => (
109
+ <div
110
+ // Lines of one diff never reorder: the index is their identity.
111
+ key={index}
112
+ className={cn("flex min-w-max gap-2 px-2", LINE_CLASS[line.kind])}
113
+ >
114
+ {line.kind === "hunk" || line.kind === "note" ? (
115
+ <span>{line.text}</span>
116
+ ) : (
117
+ <>
118
+ <span className="w-2 shrink-0 select-none opacity-70">{LINE_MARK[line.kind]}</span>
119
+ <span>{line.text || " "}</span>
120
+ </>
121
+ )}
122
+ </div>
123
+ ))}
124
+ </pre>
125
+ )
126
+ }
@@ -0,0 +1,120 @@
1
+ import { type AgentMessages, en } from "../i18n/en"
2
+ import type { NormalizedTool } from "../parts"
3
+
4
+ /** One line of the unified diff `edit` returns. */
5
+ export interface DiffLine {
6
+ readonly kind: "hunk" | "added" | "removed" | "context" | "note"
7
+ readonly text: string
8
+ }
9
+
10
+ export interface FileEditDescription {
11
+ /** The path the call named, or empty until it streams in. */
12
+ readonly path: string
13
+ readonly title: string
14
+ readonly runningTitle: string
15
+ readonly failedTitle: string
16
+ /** `+3 −1` for an edit, the line count for a write, once it has a result. */
17
+ readonly detail?: string
18
+ readonly added: number
19
+ readonly removed: number
20
+ /** The edit's diff, or the written file's contents as added lines. */
21
+ readonly lines: readonly DiffLine[]
22
+ }
23
+
24
+ export function describeEdit(
25
+ tool: Pick<NormalizedTool, "input" | "output">,
26
+ messages: AgentMessages = en
27
+ ): FileEditDescription {
28
+ const m = messages.edit
29
+ const path = stringField(tool.input, "path") ?? stringField(tool.output, "path") ?? ""
30
+ const name = fileName(path)
31
+ const diff = stringField(tool.output, "diff")
32
+ const lines = diff === undefined ? [] : parseDiff(diff)
33
+
34
+ // The diff is cut on a large edit, so the edit counts its lines; an output stored before it
35
+ // did carries only the diff.
36
+ const added =
37
+ numberField(tool.output, "added") ?? lines.filter((line) => line.kind === "added").length
38
+ const removed =
39
+ numberField(tool.output, "removed") ?? lines.filter((line) => line.kind === "removed").length
40
+
41
+ return {
42
+ path,
43
+ title: m.title(name),
44
+ runningTitle: m.running(name),
45
+ failedTitle: m.failed(name),
46
+ ...(diff === undefined ? {} : { detail: `+${added} −${removed}` }),
47
+ added,
48
+ removed,
49
+ lines,
50
+ }
51
+ }
52
+
53
+ export function describeWrite(
54
+ tool: Pick<NormalizedTool, "input" | "output">,
55
+ messages: AgentMessages = en
56
+ ): FileEditDescription {
57
+ const m = messages.write
58
+ const path = stringField(tool.input, "path") ?? stringField(tool.output, "path") ?? ""
59
+ const name = fileName(path)
60
+ const content = stringField(tool.input, "content")
61
+ const created = booleanField(tool.output, "created")
62
+ const lineCount = numberField(tool.output, "lines")
63
+ const lines: DiffLine[] =
64
+ content === undefined
65
+ ? []
66
+ : contentLines(content).map((text) => ({ kind: "added" as const, text }))
67
+ return {
68
+ path,
69
+ title: created === false ? m.replaced(name) : m.created(name),
70
+ runningTitle: m.running(name),
71
+ failedTitle: m.failed(name),
72
+ ...(lineCount === undefined ? {} : { detail: m.lines(lineCount) }),
73
+ added: lines.length,
74
+ removed: 0,
75
+ lines,
76
+ }
77
+ }
78
+
79
+ /** A unified diff's lines by kind; `… 3 more hunks` and anything unexpected are notes. */
80
+ export function parseDiff(diff: string): DiffLine[] {
81
+ const lines = diff.endsWith("\n") ? diff.slice(0, -1).split("\n") : diff.split("\n")
82
+ return lines.map((line): DiffLine => {
83
+ if (line.startsWith("@@")) return { kind: "hunk", text: line }
84
+ if (line.startsWith("+")) return { kind: "added", text: line.slice(1) }
85
+ if (line.startsWith("-")) return { kind: "removed", text: line.slice(1) }
86
+ if (line.startsWith(" ")) return { kind: "context", text: line.slice(1) }
87
+ return { kind: "note", text: line }
88
+ })
89
+ }
90
+
91
+ const MAX_CONTENT_LINES = 400
92
+
93
+ function contentLines(content: string): string[] {
94
+ if (content === "") return []
95
+ const lines = (content.endsWith("\n") ? content.slice(0, -1) : content).split("\n")
96
+ return lines.length > MAX_CONTENT_LINES ? lines.slice(0, MAX_CONTENT_LINES) : lines
97
+ }
98
+
99
+ function fileName(path: string): string {
100
+ return path.split("/").filter(Boolean).at(-1) ?? ""
101
+ }
102
+
103
+ function stringField(value: unknown, key: string): string | undefined {
104
+ const field = isRecord(value) ? value[key] : undefined
105
+ return typeof field === "string" ? field : undefined
106
+ }
107
+
108
+ function numberField(value: unknown, key: string): number | undefined {
109
+ const field = isRecord(value) ? value[key] : undefined
110
+ return typeof field === "number" && Number.isInteger(field) ? field : undefined
111
+ }
112
+
113
+ function booleanField(value: unknown, key: string): boolean | undefined {
114
+ const field = isRecord(value) ? value[key] : undefined
115
+ return typeof field === "boolean" ? field : undefined
116
+ }
117
+
118
+ function isRecord(value: unknown): value is Record<string, unknown> {
119
+ return typeof value === "object" && value !== null && !Array.isArray(value)
120
+ }