@bubblebrain-ai/bubble 0.0.51 → 0.0.53

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 (481) hide show
  1. package/README.md +4 -12
  2. package/dist/agent/routing-catalog.js +3 -2
  3. package/dist/agent/subagent/router.js +5 -0
  4. package/dist/agent/subagent/runtime.d.ts +1 -0
  5. package/dist/agent/subagent/runtime.js +13 -1
  6. package/dist/agent/subagent-control.d.ts +4 -0
  7. package/dist/agent/subagent-control.js +1 -0
  8. package/dist/agent/subagent-store.js +2 -0
  9. package/dist/agent/workflow/control.d.ts +2 -0
  10. package/dist/agent/workflow/runs.d.ts +1 -0
  11. package/dist/agent/workflow/runs.js +3 -0
  12. package/dist/agent.d.ts +11 -1
  13. package/dist/agent.js +158 -57
  14. package/dist/bin.js +2 -44
  15. package/dist/config.d.ts +14 -1
  16. package/dist/config.js +45 -4
  17. package/dist/context/budget.d.ts +7 -1
  18. package/dist/context/budget.js +25 -2
  19. package/dist/context/compact-llm.d.ts +1 -1
  20. package/dist/context/compact-llm.js +5 -2
  21. package/dist/context/overflow.js +2 -0
  22. package/dist/context/projector.d.ts +8 -0
  23. package/dist/context/projector.js +55 -6
  24. package/dist/context/tool-output-truncate.d.ts +17 -1
  25. package/dist/context/tool-output-truncate.js +171 -49
  26. package/dist/feishu/agent-host/run-driver.js +3 -0
  27. package/dist/feishu/serve.js +2 -0
  28. package/dist/goal/command.d.ts +1 -1
  29. package/dist/goal/command.js +7 -2
  30. package/dist/main.d.ts +1 -1
  31. package/dist/main.js +38 -8
  32. package/dist/memory/db.js +0 -7
  33. package/dist/model-catalog.js +25 -6
  34. package/dist/model-config.js +3 -2
  35. package/dist/model-pricing.d.ts +24 -5
  36. package/dist/model-pricing.js +0 -0
  37. package/dist/model-selection.js +13 -4
  38. package/dist/network/chatgpt-transport.js +0 -34
  39. package/dist/network/errors.d.ts +19 -0
  40. package/dist/network/errors.js +24 -0
  41. package/dist/network/provider-transport.d.ts +0 -4
  42. package/dist/network/provider-transport.js +3 -35
  43. package/dist/network/retry.d.ts +6 -1
  44. package/dist/network/retry.js +9 -0
  45. package/dist/provider-model-policy.d.ts +16 -0
  46. package/dist/provider-model-policy.js +33 -0
  47. package/dist/provider-registry.d.ts +1 -1
  48. package/dist/provider-registry.js +80 -11
  49. package/dist/provider-transform.js +32 -4
  50. package/dist/provider.d.ts +6 -2
  51. package/dist/provider.js +100 -11
  52. package/dist/question/controller.js +5 -4
  53. package/dist/question/normalize.d.ts +6 -0
  54. package/dist/question/normalize.js +11 -0
  55. package/dist/rewind.d.ts +20 -0
  56. package/dist/rewind.js +29 -0
  57. package/dist/sdk/index.d.ts +1 -1
  58. package/dist/sdk/index.js +11 -3
  59. package/dist/session.d.ts +7 -0
  60. package/dist/session.js +20 -0
  61. package/dist/skills/discovery.js +18 -0
  62. package/dist/skills/registry.d.ts +12 -2
  63. package/dist/skills/registry.js +40 -5
  64. package/dist/skills/types.d.ts +2 -0
  65. package/dist/slash-commands/commands.js +120 -81
  66. package/dist/slash-commands/registry.d.ts +2 -1
  67. package/dist/slash-commands/registry.js +3 -0
  68. package/dist/slash-commands/types.d.ts +22 -4
  69. package/dist/stats/usage.d.ts +3 -1
  70. package/dist/stats/usage.js +22 -13
  71. package/dist/tasks/manager.d.ts +4 -2
  72. package/dist/tasks/manager.js +34 -9
  73. package/dist/tasks/promotion.d.ts +2 -2
  74. package/dist/tasks/promotion.js +2 -2
  75. package/dist/tools/agent-lifecycle.js +4 -0
  76. package/dist/tools/bash.d.ts +3 -1
  77. package/dist/tools/bash.js +13 -2
  78. package/dist/tools/grep.d.ts +5 -1
  79. package/dist/tools/grep.js +318 -69
  80. package/dist/tools/index.d.ts +3 -1
  81. package/dist/tools/index.js +1 -0
  82. package/dist/tools/question.js +5 -4
  83. package/dist/tools/read.js +40 -21
  84. package/dist/tui/animation-clock.d.ts +14 -0
  85. package/dist/tui/animation-clock.js +34 -0
  86. package/dist/tui/app.d.ts +176 -0
  87. package/dist/tui/app.js +1647 -0
  88. package/dist/tui/components/approval-dialog.d.ts +43 -0
  89. package/dist/tui/components/approval-dialog.js +247 -0
  90. package/dist/tui/components/bottom-sheet.d.ts +9 -0
  91. package/dist/tui/components/bottom-sheet.js +32 -0
  92. package/dist/tui/components/context-info.d.ts +54 -0
  93. package/dist/tui/components/context-info.js +388 -0
  94. package/dist/tui/components/feedback-dialog.d.ts +56 -0
  95. package/dist/tui/components/feedback-dialog.js +262 -0
  96. package/dist/tui/components/feishu-setup-dialog.d.ts +65 -0
  97. package/dist/tui/components/feishu-setup-dialog.js +332 -0
  98. package/dist/tui/components/image-preview.d.ts +32 -0
  99. package/dist/tui/components/image-preview.js +130 -0
  100. package/dist/tui/components/plan-dialog.d.ts +34 -0
  101. package/dist/tui/components/plan-dialog.js +196 -0
  102. package/dist/tui/components/provider-key-input.d.ts +18 -0
  103. package/dist/tui/components/provider-key-input.js +49 -0
  104. package/dist/tui/components/question-dialog.d.ts +25 -0
  105. package/dist/tui/components/question-dialog.js +263 -0
  106. package/dist/tui/components/responsive-transcript.d.ts +31 -0
  107. package/dist/tui/components/responsive-transcript.js +77 -0
  108. package/dist/tui/components/rewind-picker.d.ts +62 -0
  109. package/dist/tui/components/rewind-picker.js +317 -0
  110. package/dist/tui/components/session-picker.d.ts +49 -0
  111. package/dist/tui/components/session-picker.js +303 -0
  112. package/dist/tui/components/skills-panel.d.ts +59 -0
  113. package/dist/tui/components/skills-panel.js +568 -0
  114. package/dist/tui/components/stats-panel.d.ts +40 -0
  115. package/dist/tui/components/stats-panel.js +301 -0
  116. package/dist/tui/components/streaming-message.d.ts +69 -0
  117. package/dist/tui/components/streaming-message.js +393 -0
  118. package/dist/tui/components/subagent-inspector.d.ts +28 -0
  119. package/dist/tui/components/subagent-inspector.js +127 -0
  120. package/dist/tui/components/task-inspector.d.ts +26 -0
  121. package/dist/tui/components/task-inspector.js +70 -0
  122. package/dist/tui/components/tasks-pane.d.ts +88 -0
  123. package/dist/tui/components/tasks-pane.js +416 -0
  124. package/dist/tui/components/transcript.d.ts +96 -0
  125. package/dist/tui/components/transcript.js +771 -0
  126. package/dist/tui/components/welcome.d.ts +20 -0
  127. package/dist/tui/components/welcome.js +133 -0
  128. package/dist/tui/components/workflow-inspector.d.ts +30 -0
  129. package/dist/tui/components/workflow-inspector.js +136 -0
  130. package/dist/tui/composer-autocomplete.d.ts +61 -0
  131. package/dist/tui/composer-autocomplete.js +383 -0
  132. package/dist/tui/composer-style.d.ts +7 -0
  133. package/dist/tui/composer-style.js +29 -0
  134. package/dist/tui/controller/agent-event-reducer.d.ts +75 -0
  135. package/dist/tui/controller/agent-event-reducer.js +238 -0
  136. package/dist/tui/controller/composer-controller.d.ts +95 -0
  137. package/dist/tui/controller/composer-controller.js +502 -0
  138. package/dist/tui/controller/controller.d.ts +194 -0
  139. package/dist/tui/controller/controller.js +1035 -0
  140. package/dist/tui/controller/effects.d.ts +71 -0
  141. package/dist/tui/controller/effects.js +1 -0
  142. package/dist/tui/controller/goal-runtime-controller.d.ts +47 -0
  143. package/dist/tui/controller/goal-runtime-controller.js +202 -0
  144. package/dist/tui/controller/input-queue-machine.d.ts +71 -0
  145. package/dist/tui/controller/input-queue-machine.js +121 -0
  146. package/dist/tui/controller/intents.d.ts +56 -0
  147. package/dist/tui/controller/intents.js +6 -0
  148. package/dist/tui/controller/overlay-controller.d.ts +64 -0
  149. package/dist/tui/controller/overlay-controller.js +129 -0
  150. package/dist/tui/controller/ports.d.ts +57 -0
  151. package/dist/tui/controller/ports.js +9 -0
  152. package/dist/tui/controller/session-transition.d.ts +54 -0
  153. package/dist/tui/controller/session-transition.js +68 -0
  154. package/dist/tui/controller/state.d.ts +14 -0
  155. package/dist/tui/controller/state.js +36 -0
  156. package/dist/tui/controller/task-runtime-controller.d.ts +66 -0
  157. package/dist/tui/controller/task-runtime-controller.js +158 -0
  158. package/dist/tui/footer.d.ts +37 -0
  159. package/dist/tui/footer.js +80 -0
  160. package/dist/{tui-ink → tui/formatting}/edit-diff.d.ts +1 -1
  161. package/dist/{tui-ink → tui/formatting}/edit-diff.js +1 -1
  162. package/dist/{tui-ink/app-helpers.d.ts → tui/formatting/summary.d.ts} +4 -4
  163. package/dist/{tui-ink/app-helpers.js → tui/formatting/summary.js} +2 -2
  164. package/dist/tui/fullscreen.d.ts +48 -0
  165. package/dist/tui/fullscreen.js +255 -0
  166. package/dist/tui/image-display.d.ts +4 -0
  167. package/dist/tui/image-display.js +30 -12
  168. package/dist/tui/markdown-style.d.ts +5 -0
  169. package/dist/tui/markdown-style.js +23 -0
  170. package/dist/{tui-ink → tui/model}/composer-buffer.js +1 -1
  171. package/dist/tui/model/composer-types.d.ts +17 -0
  172. package/dist/tui/model/composer-types.js +1 -0
  173. package/dist/{tui-ink → tui/model}/display-history.d.ts +7 -1
  174. package/dist/{tui-ink → tui/model}/display-reconstruct.d.ts +1 -1
  175. package/dist/{tui-ink → tui/model}/display-reconstruct.js +54 -6
  176. package/dist/{tui-ink → tui/model}/file-mentions.d.ts +2 -0
  177. package/dist/{tui-ink → tui/model}/file-mentions.js +4 -0
  178. package/dist/tui/model/image-attachment.d.ts +15 -0
  179. package/dist/tui/model/image-attachment.js +1 -0
  180. package/dist/{tui-ink → tui/model}/image-paste.d.ts +7 -1
  181. package/dist/{tui-ink → tui/model}/image-paste.js +46 -0
  182. package/dist/tui/model/input-history.d.ts +1 -0
  183. package/dist/tui/model/input-history.js +1 -0
  184. package/dist/{tui-ink → tui/model}/input-queue.d.ts +1 -1
  185. package/dist/{tui-ink → tui/model}/recent-activity.js +1 -1
  186. package/dist/{tui-ink → tui/model}/subagent-view.d.ts +17 -2
  187. package/dist/{tui-ink → tui/model}/subagent-view.js +125 -4
  188. package/dist/{tui-ink → tui/model}/submit-dedupe.d.ts +1 -1
  189. package/dist/tui/model/theme-style.d.ts +10 -0
  190. package/dist/tui/model/theme-style.js +79 -0
  191. package/dist/{tui-ink → tui/model}/theme.d.ts +11 -23
  192. package/dist/{tui-ink → tui/model}/theme.js +23 -38
  193. package/dist/{tui-ink → tui/model}/trace-groups.d.ts +2 -0
  194. package/dist/{tui-ink → tui/model}/trace-groups.js +91 -30
  195. package/dist/tui/model/trace-interaction.d.ts +63 -0
  196. package/dist/tui/model/trace-interaction.js +87 -0
  197. package/dist/tui/model-picker-data.d.ts +1 -2
  198. package/dist/tui/model-picker-data.js +8 -1
  199. package/dist/tui/model-switch.js +2 -0
  200. package/dist/{tui-ink → tui}/run-session-picker.d.ts +2 -3
  201. package/dist/tui/run-session-picker.js +64 -0
  202. package/dist/tui/run.d.ts +72 -0
  203. package/dist/tui/run.js +139 -0
  204. package/dist/tui/terminal/multiplexer.d.ts +5 -0
  205. package/dist/tui/terminal/multiplexer.js +14 -0
  206. package/dist/tui/testing/fake-agent.d.ts +24 -0
  207. package/dist/tui/testing/fake-agent.js +22 -0
  208. package/dist/tui/testing/spy-host.d.ts +21 -0
  209. package/dist/tui/testing/spy-host.js +55 -0
  210. package/dist/tui/trace-groups.js +27 -6
  211. package/dist/types.d.ts +7 -0
  212. package/node_modules/@bubblebrain-ai/pi-tui/LICENSE +21 -0
  213. package/node_modules/@bubblebrain-ai/pi-tui/README.md +854 -0
  214. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/alt-screen-search.d.ts +26 -0
  215. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/alt-screen-search.d.ts.map +1 -0
  216. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/alt-screen-search.js +121 -0
  217. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/alt-screen-search.js.map +1 -0
  218. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/autocomplete.d.ts +86 -0
  219. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/autocomplete.d.ts.map +1 -0
  220. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/autocomplete.js +649 -0
  221. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/autocomplete.js.map +1 -0
  222. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/alt-screen-flash.d.ts +13 -0
  223. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/alt-screen-flash.d.ts.map +1 -0
  224. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/alt-screen-flash.js +36 -0
  225. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/alt-screen-flash.js.map +1 -0
  226. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/box.d.ts +22 -0
  227. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/box.d.ts.map +1 -0
  228. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/box.js +99 -0
  229. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/box.js.map +1 -0
  230. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/cancellable-loader.d.ts +22 -0
  231. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/cancellable-loader.d.ts.map +1 -0
  232. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/cancellable-loader.js +36 -0
  233. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/cancellable-loader.js.map +1 -0
  234. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/editor.d.ts +330 -0
  235. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/editor.d.ts.map +1 -0
  236. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/editor.js +2344 -0
  237. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/editor.js.map +1 -0
  238. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/h-stack.d.ts +7 -0
  239. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/h-stack.d.ts.map +1 -0
  240. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/h-stack.js +43 -0
  241. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/h-stack.js.map +1 -0
  242. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/image.d.ts +28 -0
  243. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/image.d.ts.map +1 -0
  244. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/image.js +82 -0
  245. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/image.js.map +1 -0
  246. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/input.d.ts +48 -0
  247. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/input.d.ts.map +1 -0
  248. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/input.js +390 -0
  249. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/input.js.map +1 -0
  250. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/loader.d.ts +31 -0
  251. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/loader.d.ts.map +1 -0
  252. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/loader.js +67 -0
  253. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/loader.js.map +1 -0
  254. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/markdown.d.ts +103 -0
  255. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/markdown.d.ts.map +1 -0
  256. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/markdown.js +797 -0
  257. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/markdown.js.map +1 -0
  258. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/scroll-view.d.ts +56 -0
  259. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/scroll-view.d.ts.map +1 -0
  260. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/scroll-view.js +179 -0
  261. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/scroll-view.js.map +1 -0
  262. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/select-list.d.ts +53 -0
  263. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/select-list.d.ts.map +1 -0
  264. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/select-list.js +175 -0
  265. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/select-list.js.map +1 -0
  266. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/settings-list.d.ts +50 -0
  267. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/settings-list.d.ts.map +1 -0
  268. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/settings-list.js +174 -0
  269. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/settings-list.js.map +1 -0
  270. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/spacer.d.ts +12 -0
  271. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/spacer.d.ts.map +1 -0
  272. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/spacer.js +22 -0
  273. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/spacer.js.map +1 -0
  274. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/stack.d.ts +32 -0
  275. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/stack.d.ts.map +1 -0
  276. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/stack.js +109 -0
  277. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/stack.js.map +1 -0
  278. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/text.d.ts +19 -0
  279. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/text.d.ts.map +1 -0
  280. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/text.js +81 -0
  281. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/text.js.map +1 -0
  282. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/truncated-text.d.ts +13 -0
  283. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/truncated-text.d.ts.map +1 -0
  284. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/truncated-text.js +48 -0
  285. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/truncated-text.js.map +1 -0
  286. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/v-stack.d.ts +8 -0
  287. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/v-stack.d.ts.map +1 -0
  288. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/v-stack.js +26 -0
  289. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/components/v-stack.js.map +1 -0
  290. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/editor-component.d.ts +39 -0
  291. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/editor-component.d.ts.map +1 -0
  292. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/editor-component.js +2 -0
  293. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/editor-component.js.map +1 -0
  294. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/fuzzy.d.ts +16 -0
  295. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/fuzzy.d.ts.map +1 -0
  296. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/fuzzy.js +110 -0
  297. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/fuzzy.js.map +1 -0
  298. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/index.d.ts +31 -0
  299. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/index.d.ts.map +1 -0
  300. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/index.js +42 -0
  301. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/index.js.map +1 -0
  302. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/keybindings.d.ts +273 -0
  303. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/keybindings.d.ts.map +1 -0
  304. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/keybindings.js +231 -0
  305. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/keybindings.js.map +1 -0
  306. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/keys.d.ts +184 -0
  307. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/keys.d.ts.map +1 -0
  308. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/keys.js +1174 -0
  309. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/keys.js.map +1 -0
  310. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/kill-ring.d.ts +28 -0
  311. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/kill-ring.d.ts.map +1 -0
  312. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/kill-ring.js +46 -0
  313. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/kill-ring.js.map +1 -0
  314. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/latex.d.ts +10 -0
  315. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/latex.d.ts.map +1 -0
  316. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/latex.js +1268 -0
  317. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/latex.js.map +1 -0
  318. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/layout-node.d.ts +40 -0
  319. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/layout-node.d.ts.map +1 -0
  320. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/layout-node.js +6 -0
  321. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/layout-node.js.map +1 -0
  322. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/layout.d.ts +42 -0
  323. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/layout.d.ts.map +1 -0
  324. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/layout.js +335 -0
  325. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/layout.js.map +1 -0
  326. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/native-modifiers.d.ts +3 -0
  327. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/native-modifiers.d.ts.map +1 -0
  328. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/native-modifiers.js +60 -0
  329. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/native-modifiers.js.map +1 -0
  330. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/stdin-buffer.d.ts +56 -0
  331. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/stdin-buffer.d.ts.map +1 -0
  332. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/stdin-buffer.js +363 -0
  333. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/stdin-buffer.js.map +1 -0
  334. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/terminal-colors.d.ts +10 -0
  335. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/terminal-colors.d.ts.map +1 -0
  336. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/terminal-colors.js +59 -0
  337. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/terminal-colors.js.map +1 -0
  338. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/terminal-image.d.ts +116 -0
  339. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/terminal-image.d.ts.map +1 -0
  340. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/terminal-image.js +518 -0
  341. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/terminal-image.js.map +1 -0
  342. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/terminal.d.ts +142 -0
  343. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/terminal.d.ts.map +1 -0
  344. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/terminal.js +544 -0
  345. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/terminal.js.map +1 -0
  346. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/testing.d.ts +11 -0
  347. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/testing.d.ts.map +1 -0
  348. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/testing.js +11 -0
  349. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/testing.js.map +1 -0
  350. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/tui-alt-screen.d.ts +140 -0
  351. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/tui-alt-screen.d.ts.map +1 -0
  352. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/tui-alt-screen.js +1334 -0
  353. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/tui-alt-screen.js.map +1 -0
  354. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/tui-main-screen.d.ts +39 -0
  355. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/tui-main-screen.d.ts.map +1 -0
  356. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/tui-main-screen.js +536 -0
  357. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/tui-main-screen.js.map +1 -0
  358. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/tui.d.ts +338 -0
  359. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/tui.d.ts.map +1 -0
  360. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/tui.js +1016 -0
  361. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/tui.js.map +1 -0
  362. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/undo-stack.d.ts +17 -0
  363. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/undo-stack.d.ts.map +1 -0
  364. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/undo-stack.js +27 -0
  365. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/undo-stack.js.map +1 -0
  366. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/utils.d.ts +96 -0
  367. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/utils.d.ts.map +1 -0
  368. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/utils.js +1193 -0
  369. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/utils.js.map +1 -0
  370. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/word-navigation.d.ts +25 -0
  371. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/word-navigation.d.ts.map +1 -0
  372. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/word-navigation.js +96 -0
  373. package/node_modules/@bubblebrain-ai/pi-tui/dist/src/word-navigation.js.map +1 -0
  374. package/node_modules/@bubblebrain-ai/pi-tui/dist/test/virtual-terminal.d.ts +73 -0
  375. package/node_modules/@bubblebrain-ai/pi-tui/dist/test/virtual-terminal.d.ts.map +1 -0
  376. package/node_modules/@bubblebrain-ai/pi-tui/dist/test/virtual-terminal.js +188 -0
  377. package/node_modules/@bubblebrain-ai/pi-tui/dist/test/virtual-terminal.js.map +1 -0
  378. package/node_modules/@bubblebrain-ai/pi-tui/native/darwin/README.md +20 -0
  379. package/node_modules/@bubblebrain-ai/pi-tui/native/darwin/build.sh +62 -0
  380. package/node_modules/@bubblebrain-ai/pi-tui/native/darwin/prebuilds/darwin-arm64/darwin-modifiers.node +0 -0
  381. package/node_modules/@bubblebrain-ai/pi-tui/native/darwin/prebuilds/darwin-x64/darwin-modifiers.node +0 -0
  382. package/node_modules/@bubblebrain-ai/pi-tui/native/darwin/src/darwin-modifiers.c +70 -0
  383. package/node_modules/@bubblebrain-ai/pi-tui/native/win32/README.md +22 -0
  384. package/node_modules/@bubblebrain-ai/pi-tui/native/win32/build.mjs +229 -0
  385. package/node_modules/@bubblebrain-ai/pi-tui/native/win32/prebuilds/win32-arm64/win32-console-mode.node +0 -0
  386. package/node_modules/@bubblebrain-ai/pi-tui/native/win32/prebuilds/win32-x64/win32-console-mode.node +0 -0
  387. package/node_modules/@bubblebrain-ai/pi-tui/native/win32/src/win32-console-mode.c +119 -0
  388. package/node_modules/@bubblebrain-ai/pi-tui/package.json +66 -0
  389. package/node_modules/get-east-asian-width/index.d.ts +60 -0
  390. package/node_modules/get-east-asian-width/index.js +30 -0
  391. package/node_modules/get-east-asian-width/license +9 -0
  392. package/node_modules/get-east-asian-width/lookup-data.js +21 -0
  393. package/node_modules/get-east-asian-width/lookup.js +138 -0
  394. package/node_modules/get-east-asian-width/package.json +71 -0
  395. package/node_modules/get-east-asian-width/readme.md +65 -0
  396. package/node_modules/get-east-asian-width/utilities.js +24 -0
  397. package/package.json +23 -10
  398. package/packages/pi-tui/node_modules/marked/LICENSE +44 -0
  399. package/packages/pi-tui/node_modules/marked/README.md +115 -0
  400. package/packages/pi-tui/node_modules/marked/bin/main.js +284 -0
  401. package/packages/pi-tui/node_modules/marked/bin/marked.js +16 -0
  402. package/packages/pi-tui/node_modules/marked/lib/marked.d.ts +760 -0
  403. package/packages/pi-tui/node_modules/marked/lib/marked.esm.js +77 -0
  404. package/packages/pi-tui/node_modules/marked/lib/marked.esm.js.map +7 -0
  405. package/packages/pi-tui/node_modules/marked/lib/marked.umd.js +79 -0
  406. package/packages/pi-tui/node_modules/marked/lib/marked.umd.js.map +7 -0
  407. package/packages/pi-tui/node_modules/marked/man/marked.1 +113 -0
  408. package/packages/pi-tui/node_modules/marked/man/marked.1.md +93 -0
  409. package/packages/pi-tui/node_modules/marked/package.json +103 -0
  410. package/dist/tui-ink/app.d.ts +0 -76
  411. package/dist/tui-ink/app.js +0 -2377
  412. package/dist/tui-ink/approval/approval-dialog.d.ts +0 -13
  413. package/dist/tui-ink/approval/approval-dialog.js +0 -184
  414. package/dist/tui-ink/approval/diff-view.d.ts +0 -7
  415. package/dist/tui-ink/approval/diff-view.js +0 -44
  416. package/dist/tui-ink/approval/select.d.ts +0 -35
  417. package/dist/tui-ink/approval/select.js +0 -98
  418. package/dist/tui-ink/code-highlight.d.ts +0 -8
  419. package/dist/tui-ink/code-highlight.js +0 -121
  420. package/dist/tui-ink/command-palette.d.ts +0 -32
  421. package/dist/tui-ink/command-palette.js +0 -158
  422. package/dist/tui-ink/compaction-progress.d.ts +0 -19
  423. package/dist/tui-ink/compaction-progress.js +0 -74
  424. package/dist/tui-ink/detect-theme.d.ts +0 -1
  425. package/dist/tui-ink/detect-theme.js +0 -1
  426. package/dist/tui-ink/feedback-dialog.d.ts +0 -19
  427. package/dist/tui-ink/feedback-dialog.js +0 -133
  428. package/dist/tui-ink/feishu-setup-picker.d.ts +0 -5
  429. package/dist/tui-ink/feishu-setup-picker.js +0 -271
  430. package/dist/tui-ink/footer.d.ts +0 -26
  431. package/dist/tui-ink/footer.js +0 -51
  432. package/dist/tui-ink/input-box.d.ts +0 -189
  433. package/dist/tui-ink/input-box.js +0 -1279
  434. package/dist/tui-ink/input-history.d.ts +0 -1
  435. package/dist/tui-ink/input-history.js +0 -1
  436. package/dist/tui-ink/markdown.d.ts +0 -103
  437. package/dist/tui-ink/markdown.js +0 -747
  438. package/dist/tui-ink/message-list.d.ts +0 -49
  439. package/dist/tui-ink/message-list.js +0 -841
  440. package/dist/tui-ink/model-picker.d.ts +0 -143
  441. package/dist/tui-ink/model-picker.js +0 -966
  442. package/dist/tui-ink/plan-confirm.d.ts +0 -7
  443. package/dist/tui-ink/plan-confirm.js +0 -115
  444. package/dist/tui-ink/question-dialog.d.ts +0 -8
  445. package/dist/tui-ink/question-dialog.js +0 -135
  446. package/dist/tui-ink/rewind-picker.d.ts +0 -8
  447. package/dist/tui-ink/rewind-picker.js +0 -102
  448. package/dist/tui-ink/run-session-picker.js +0 -22
  449. package/dist/tui-ink/run.d.ts +0 -62
  450. package/dist/tui-ink/run.js +0 -103
  451. package/dist/tui-ink/session-picker.d.ts +0 -10
  452. package/dist/tui-ink/session-picker.js +0 -113
  453. package/dist/tui-ink/stats-panel.d.ts +0 -11
  454. package/dist/tui-ink/stats-panel.js +0 -65
  455. package/dist/tui-ink/subagent-inspector.d.ts +0 -21
  456. package/dist/tui-ink/subagent-inspector.js +0 -205
  457. package/dist/tui-ink/use-terminal-size.d.ts +0 -4
  458. package/dist/tui-ink/use-terminal-size.js +0 -48
  459. package/dist/tui-ink/waiting-indicator.d.ts +0 -12
  460. package/dist/tui-ink/waiting-indicator.js +0 -129
  461. package/dist/tui-ink/welcome.d.ts +0 -25
  462. package/dist/tui-ink/welcome.js +0 -88
  463. package/dist/tui-ink/wordmark.d.ts +0 -8
  464. package/dist/tui-ink/wordmark.js +0 -103
  465. /package/dist/{tui-ink → tui/model}/composer-buffer.d.ts +0 -0
  466. /package/dist/{tui-ink → tui/model}/display-history.js +0 -0
  467. /package/dist/{tui-ink → tui/model}/input-queue.js +0 -0
  468. /package/dist/{tui-ink → tui/model}/key-events.d.ts +0 -0
  469. /package/dist/{tui-ink → tui/model}/key-events.js +0 -0
  470. /package/dist/{tui-ink → tui/model}/paste-operation-tracker.d.ts +0 -0
  471. /package/dist/{tui-ink → tui/model}/paste-operation-tracker.js +0 -0
  472. /package/dist/{tui-ink → tui/model}/recent-activity.d.ts +0 -0
  473. /package/dist/{tui-ink → tui/model}/submit-dedupe.js +0 -0
  474. /package/dist/{tui-ink → tui/model}/sync-output.d.ts +0 -0
  475. /package/dist/{tui-ink → tui/model}/sync-output.js +0 -0
  476. /package/dist/{tui-ink → tui/model}/terminal-env.d.ts +0 -0
  477. /package/dist/{tui-ink → tui/model}/terminal-env.js +0 -0
  478. /package/dist/{tui-ink → tui/model}/terminal-mouse.d.ts +0 -0
  479. /package/dist/{tui-ink → tui/model}/terminal-mouse.js +0 -0
  480. /package/dist/{tui-ink → tui/model}/width.d.ts +0 -0
  481. /package/dist/{tui-ink → tui/model}/width.js +0 -0
@@ -27,3 +27,5 @@ export declare function filterFileSuggestions(files: string[], query: string, li
27
27
  export declare function listProjectFiles(cwd: string): Promise<string[]>;
28
28
  export declare function invalidateFileListCache(cwd?: string): void;
29
29
  export declare function expandAtMentions(text: string, cwd: string): Promise<ExpandResult>;
30
+ /** Composer @-mention context resolution (moved from input-box at cutover). */
31
+ export declare function resolveComposerAtContext(text: string, cursor: number, isSlashContext: boolean, allowWorkspaceMentions?: boolean): AtContext | null;
@@ -172,3 +172,7 @@ function guessLanguage(filePath) {
172
172
  };
173
173
  return map[ext] ?? "";
174
174
  }
175
+ /** Composer @-mention context resolution (moved from input-box at cutover). */
176
+ export function resolveComposerAtContext(text, cursor, isSlashContext, allowWorkspaceMentions = true) {
177
+ return !allowWorkspaceMentions || isSlashContext ? null : findAtContext(text, cursor);
178
+ }
@@ -0,0 +1,15 @@
1
+ /** Image attachment shape shared by composer, provider payload, and history. */
2
+ export interface ImageAttachment {
3
+ base64: string;
4
+ mediaType: string;
5
+ /** Raw byte size of the decoded image (not base64). */
6
+ bytes: number;
7
+ /** data:<mediaType>;base64,<...> — ready to send as image_url.url. */
8
+ dataUrl: string;
9
+ filename?: string;
10
+ sourcePath?: string;
11
+ }
12
+ /** Image state retained by a rendered user message after composer submit. */
13
+ export interface DisplayImageAttachment extends ImageAttachment {
14
+ label: string;
15
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -7,7 +7,7 @@
7
7
  * TemporaryItems path and the clipboard — the path often gets cleaned up before
8
8
  * we can read it, so we fall back to the clipboard.
9
9
  */
10
- import type { ContentPart } from "../types.js";
10
+ import type { ContentPart } from "../../types.js";
11
11
  export interface ImageAttachment {
12
12
  base64: string;
13
13
  mediaType: string;
@@ -53,6 +53,12 @@ export declare function imageLabelForPath(rawPath: string, index: number): strin
53
53
  export declare function imageAttachmentReference(att: ImageAttachment, index: number): string;
54
54
  export declare function imageAttachmentLabelPattern(): RegExp;
55
55
  export declare function buildImageContentParts(promptText: string, attachments: ImageAttachment[]): ContentPart[];
56
+ /**
57
+ * Convert the composer's inline [Image #N] chips into ordered multimodal
58
+ * content. The labels remain UI-only, while each image reaches the provider at
59
+ * the same position the user chose in the draft.
60
+ */
61
+ export declare function buildImageContentPartsFromDisplayText(displayText: string, promptText: string, attachments: ImageAttachment[], labelStart?: number): ContentPart[];
56
62
  export declare function formatImageDisplayInput(promptText: string, attachments: ImageAttachment[], labelStart?: number): string;
57
63
  export declare function buildImageContentPartsFromLabels(input: string, attachmentsByLabel: Map<string, ImageAttachment>): {
58
64
  actualInput?: ContentPart[];
@@ -109,6 +109,52 @@ export function buildImageContentParts(promptText, attachments) {
109
109
  })),
110
110
  ];
111
111
  }
112
+ /**
113
+ * Convert the composer's inline [Image #N] chips into ordered multimodal
114
+ * content. The labels remain UI-only, while each image reaches the provider at
115
+ * the same position the user chose in the draft.
116
+ */
117
+ export function buildImageContentPartsFromDisplayText(displayText, promptText, attachments, labelStart = 1) {
118
+ const byLabel = new Map(attachments.map((attachment, index) => [`[Image #${labelStart + index}]`, attachment]));
119
+ const parts = [];
120
+ const used = new Set();
121
+ let cursor = 0;
122
+ while (cursor < displayText.length) {
123
+ let nextLabel;
124
+ let nextIndex = -1;
125
+ for (const label of byLabel.keys()) {
126
+ if (used.has(label))
127
+ continue;
128
+ const index = displayText.indexOf(label, cursor);
129
+ if (index >= 0 && (nextIndex < 0 || index < nextIndex)) {
130
+ nextLabel = label;
131
+ nextIndex = index;
132
+ }
133
+ }
134
+ if (!nextLabel || nextIndex < 0)
135
+ break;
136
+ const before = displayText.slice(cursor, nextIndex).trim();
137
+ if (before)
138
+ parts.push({ type: "text", text: before });
139
+ parts.push({ type: "image_url", image_url: { url: byLabel.get(nextLabel).dataUrl } });
140
+ used.add(nextLabel);
141
+ cursor = nextIndex + nextLabel.length;
142
+ }
143
+ const after = displayText.slice(cursor).trim();
144
+ if (after)
145
+ parts.push({ type: "text", text: after });
146
+ for (const [label, attachment] of byLabel) {
147
+ if (!used.has(label)) {
148
+ parts.push({ type: "image_url", image_url: { url: attachment.dataUrl } });
149
+ }
150
+ }
151
+ if (used.size === 0)
152
+ return buildImageContentParts(promptText, attachments);
153
+ if (!parts.some((part) => part.type === "text")) {
154
+ parts.unshift({ type: "text", text: promptText.trim() || defaultImagePrompt(attachments.length) });
155
+ }
156
+ return parts;
157
+ }
112
158
  export function formatImageDisplayInput(promptText, attachments, labelStart = 1) {
113
159
  const text = promptText.trim() || defaultImagePrompt(attachments.length);
114
160
  const imageLines = attachments.map((attachment, index) => imageAttachmentReference(attachment, labelStart + index));
@@ -0,0 +1 @@
1
+ export * from "../../tui/input-history.js";
@@ -0,0 +1 @@
1
+ export * from "../../tui/input-history.js";
@@ -1,4 +1,4 @@
1
- import type { SubmitPayload } from "./input-box.js";
1
+ import type { SubmitPayload } from "./composer-types.js";
2
2
  export interface QueuedInput {
3
3
  payload: SubmitPayload;
4
4
  displayKey?: string;
@@ -1,6 +1,6 @@
1
1
  import { readFileSync, readdirSync, statSync, existsSync } from "node:fs";
2
2
  import path from "node:path";
3
- import { getSessionsDir } from "../session.js";
3
+ import { getSessionsDir } from "../../session.js";
4
4
  export function getRecentSessions(cwd, limit = 3) {
5
5
  const dir = getSessionsDir(cwd);
6
6
  if (!existsSync(dir))
@@ -3,22 +3,26 @@
3
3
  * Subagents block (message-list.tsx) and the full-screen inspector
4
4
  * (subagent-inspector.tsx). Pure functions only — no React.
5
5
  */
6
- import { type SubagentRouteLike } from "../agent/subagent-route-format.js";
6
+ import { type SubagentRouteLike } from "../../agent/subagent-route-format.js";
7
7
  import type { Theme } from "./theme.js";
8
8
  import type { DisplayMessage, DisplayToolCall } from "./display-history.js";
9
- import type { ToolResultMetadata } from "../types.js";
9
+ import type { TokenUsage, ToolResultMetadata } from "../../types.js";
10
10
  export interface SubagentDisplay {
11
11
  subAgentId?: string;
12
12
  agentName?: string;
13
13
  nickname?: string;
14
14
  status?: string;
15
15
  category?: string;
16
+ phase?: string;
16
17
  route?: SubagentRouteLike;
17
18
  profileSource?: string;
18
19
  task?: string;
19
20
  summary?: string;
20
21
  toolNotes?: string[];
21
22
  error?: string;
23
+ usage?: TokenUsage;
24
+ createdAt?: number;
25
+ updatedAt?: number;
22
26
  }
23
27
  export declare function latestSubagentNote(subagent: SubagentDisplay): string;
24
28
  export declare function subagentLabel(subagent: SubagentDisplay): string;
@@ -32,10 +36,21 @@ export declare function sortSubagents(subagents: SubagentDisplay[]): SubagentDis
32
36
  * those tools were removed (2026-07-06). */
33
37
  export interface SubagentGroup {
34
38
  id: string;
39
+ runId?: string;
35
40
  kind: "single" | "team" | "batch" | "workflow";
36
41
  label: string;
37
42
  members: SubagentDisplay[];
38
43
  }
44
+ /**
45
+ * Projects a newer lifecycle snapshot back onto every existing trace that
46
+ * already references the same child. spawn_agent settles as soon as the child
47
+ * is queued, while later tool_update/wait_agent events carry the authoritative
48
+ * running/final state. Keeping the launch row synchronized prevents it from
49
+ * remaining permanently "running" beside a completed Tasks Pane entry.
50
+ */
51
+ export declare function mergeSubagentSnapshotsIntoMessages(messages: DisplayMessage[], incoming: ToolResultMetadata | undefined): DisplayMessage[];
52
+ /** Reconciles persisted launch/wait/list echoes when rebuilding a session. */
53
+ export declare function synchronizeSubagentSnapshots(messages: DisplayMessage[]): DisplayMessage[];
39
54
  /**
40
55
  * Merges subagent tool metadata, deduping member snapshots by subAgentId so a
41
56
  * stream of per-child updates accumulates into one member list instead of each
@@ -3,7 +3,7 @@
3
3
  * Subagents block (message-list.tsx) and the full-screen inspector
4
4
  * (subagent-inspector.tsx). Pure functions only — no React.
5
5
  */
6
- import { formatSubagentRoute } from "../agent/subagent-route-format.js";
6
+ import { formatSubagentRoute } from "../../agent/subagent-route-format.js";
7
7
  export function latestSubagentNote(subagent) {
8
8
  const note = subagent.error
9
9
  || subagent.toolNotes?.filter(Boolean).at(-1)
@@ -75,6 +75,109 @@ function subagentFreshness(member) {
75
75
  function memberKey(member) {
76
76
  return member.subAgentId || `${member.nickname ?? ""}|${member.task ?? ""}`;
77
77
  }
78
+ function toolCallsFromMessage(message) {
79
+ return [
80
+ ...(message.toolCalls ?? []),
81
+ ...(message.parts ?? []).flatMap((part) => part.type === "tools" ? part.toolCalls : []),
82
+ ];
83
+ }
84
+ function freshestSubagentSnapshots(messages) {
85
+ const freshest = new Map();
86
+ for (const message of messages) {
87
+ for (const tool of toolCallsFromMessage(message)) {
88
+ if (tool.metadata?.kind !== "subagent" || !Array.isArray(tool.metadata.subagents))
89
+ continue;
90
+ for (const raw of tool.metadata.subagents) {
91
+ if (typeof raw !== "object" || raw === null)
92
+ continue;
93
+ const member = raw;
94
+ const key = memberKey(member);
95
+ if (!key)
96
+ continue;
97
+ const current = freshest.get(key);
98
+ if (!current || subagentFreshness(member) >= subagentFreshness(current)) {
99
+ freshest.set(key, current ? { ...current, ...member } : member);
100
+ }
101
+ }
102
+ }
103
+ }
104
+ return [...freshest.values()];
105
+ }
106
+ /**
107
+ * Projects a newer lifecycle snapshot back onto every existing trace that
108
+ * already references the same child. spawn_agent settles as soon as the child
109
+ * is queued, while later tool_update/wait_agent events carry the authoritative
110
+ * running/final state. Keeping the launch row synchronized prevents it from
111
+ * remaining permanently "running" beside a completed Tasks Pane entry.
112
+ */
113
+ export function mergeSubagentSnapshotsIntoMessages(messages, incoming) {
114
+ if (incoming?.kind !== "subagent" || !Array.isArray(incoming.subagents))
115
+ return messages;
116
+ const incomingByKey = new Map();
117
+ for (const raw of incoming.subagents) {
118
+ if (typeof raw !== "object" || raw === null)
119
+ continue;
120
+ const member = raw;
121
+ const key = memberKey(member);
122
+ if (key)
123
+ incomingByKey.set(key, member);
124
+ }
125
+ if (incomingByKey.size === 0)
126
+ return messages;
127
+ const updateTool = (tool) => {
128
+ if (tool.metadata?.kind !== "subagent" || !Array.isArray(tool.metadata.subagents))
129
+ return tool;
130
+ let changed = false;
131
+ const subagents = tool.metadata.subagents.map((raw) => {
132
+ if (typeof raw !== "object" || raw === null)
133
+ return raw;
134
+ const current = raw;
135
+ const next = incomingByKey.get(memberKey(current));
136
+ if (!next || subagentFreshness(next) < subagentFreshness(current))
137
+ return raw;
138
+ changed = true;
139
+ return { ...current, ...next };
140
+ });
141
+ return changed ? { ...tool, metadata: { ...tool.metadata, subagents } } : tool;
142
+ };
143
+ let anyChanged = false;
144
+ const updated = messages.map((message) => {
145
+ let messageChanged = false;
146
+ const toolCalls = message.toolCalls?.map((tool) => {
147
+ const next = updateTool(tool);
148
+ if (next !== tool)
149
+ messageChanged = true;
150
+ return next;
151
+ });
152
+ const parts = message.parts?.map((part) => {
153
+ if (part.type !== "tools")
154
+ return part;
155
+ let partChanged = false;
156
+ const nextTools = part.toolCalls.map((tool) => {
157
+ const next = updateTool(tool);
158
+ if (next !== tool)
159
+ partChanged = true;
160
+ return next;
161
+ });
162
+ if (!partChanged)
163
+ return part;
164
+ messageChanged = true;
165
+ return { ...part, toolCalls: nextTools };
166
+ });
167
+ if (!messageChanged)
168
+ return message;
169
+ anyChanged = true;
170
+ return { ...message, toolCalls, parts };
171
+ });
172
+ return anyChanged ? updated : messages;
173
+ }
174
+ /** Reconciles persisted launch/wait/list echoes when rebuilding a session. */
175
+ export function synchronizeSubagentSnapshots(messages) {
176
+ const snapshots = freshestSubagentSnapshots(messages);
177
+ return snapshots.length === 0
178
+ ? messages
179
+ : mergeSubagentSnapshotsIntoMessages(messages, { kind: "subagent", subagents: snapshots });
180
+ }
78
181
  /**
79
182
  * Merges subagent tool metadata, deduping member snapshots by subAgentId so a
80
183
  * stream of per-child updates accumulates into one member list instead of each
@@ -150,7 +253,20 @@ export function accumulateLiveSubagentUpdate(map, event) {
150
253
  // call rather than falling back to one single-agent group per member.
151
254
  if (event.name === "run_workflow" && metadata.mode === undefined)
152
255
  metadata.mode = "workflow";
153
- map.set(event.id, { id: event.id, name: event.name, args: prev?.args ?? {}, metadata });
256
+ const members = Array.isArray(metadata.subagents)
257
+ ? metadata.subagents.filter((member) => (typeof member === "object" && member !== null))
258
+ : [];
259
+ const statuses = members.map((member) => String(member.status ?? "running"));
260
+ const stillRunning = statuses.some((status) => status === "queued" || status === "running");
261
+ const failed = statuses.some((status) => status === "failed" || status === "blocked" || status === "cancelled");
262
+ map.set(event.id, {
263
+ id: event.id,
264
+ name: event.name,
265
+ args: prev?.args ?? {},
266
+ metadata,
267
+ status: stillRunning ? "running" : failed ? "failed" : "completed",
268
+ isError: failed,
269
+ });
154
270
  return true;
155
271
  }
156
272
  /**
@@ -206,7 +322,11 @@ export function collectSubagentGroups(messages, streamingTools) {
206
322
  if (!groups.has(groupKey)) {
207
323
  const description = typeof tc.args?.description === "string" ? tc.args.description.trim()
208
324
  : typeof tc.args?.title === "string" ? tc.args.title.trim() : "";
209
- groups.set(groupKey, { kind: mode, label: description || mode, memberKeys: [], order: order++ });
325
+ const metadataRunId = typeof tc.metadata?.runId === "string" ? tc.metadata.runId : undefined;
326
+ const memberRunId = typeof members[0]?.subAgentId === "string"
327
+ ? (typeof members[0].runId === "string" ? String(members[0].runId) : undefined)
328
+ : undefined;
329
+ groups.set(groupKey, { kind: mode, label: description || mode, runId: metadataRunId ?? memberRunId, memberKeys: [], order: order++ });
210
330
  }
211
331
  const group = groups.get(groupKey);
212
332
  for (const m of members) {
@@ -226,7 +346,7 @@ export function collectSubagentGroups(messages, streamingTools) {
226
346
  continue;
227
347
  const groupKey = `single:${key}`;
228
348
  memberToGroup.set(key, groupKey);
229
- groups.set(groupKey, { kind: "single", label: m.nickname ?? m.task ?? "subagent", memberKeys: [key], order: order++ });
349
+ groups.set(groupKey, { kind: "single", label: m.nickname ?? m.task ?? "subagent", runId: typeof m.runId === "string" ? String(m.runId) : undefined, memberKeys: [key], order: order++ });
230
350
  }
231
351
  }
232
352
  }
@@ -236,6 +356,7 @@ export function collectSubagentGroups(messages, streamingTools) {
236
356
  id,
237
357
  kind: g.kind,
238
358
  label: g.label,
359
+ runId: g.runId,
239
360
  members: g.memberKeys.map((k) => freshest.get(k)).filter((m) => !!m),
240
361
  }))
241
362
  // A group can end up empty when a later echo of the same run (e.g. the
@@ -1,4 +1,4 @@
1
- import type { SubmitPayload } from "./input-box.js";
1
+ import type { SubmitPayload } from "./composer-types.js";
2
2
  export type StartingSubmitDecision = "accept" | "ignore" | "queue";
3
3
  export declare function submitPayloadFingerprint(payload: SubmitPayload): string;
4
4
  export declare function decideStartingSubmit(activeFingerprint: string | null, payload: SubmitPayload): StartingSubmitDecision;
@@ -0,0 +1,10 @@
1
+ /** Apply a configured foreground without letting a malformed override crash rendering. */
2
+ export declare function themeForeground(color: string | undefined, text: string): string;
3
+ /** Apply a configured background without letting a malformed override crash rendering. */
4
+ export declare function themeBackground(color: string | undefined, text: string): string;
5
+ export declare function themeDim(color: string | undefined, text: string): string;
6
+ /** ANSI pair used by the alternate-screen renderer to paint every cell. */
7
+ export declare function themeBackgroundCodes(color: string | undefined): {
8
+ open: string;
9
+ close: string;
10
+ } | undefined;
@@ -0,0 +1,79 @@
1
+ import chalk from "chalk";
2
+ const NAMED_COLORS = new Set([
3
+ "black",
4
+ "red",
5
+ "green",
6
+ "yellow",
7
+ "blue",
8
+ "magenta",
9
+ "cyan",
10
+ "white",
11
+ "gray",
12
+ "grey",
13
+ ]);
14
+ function isHexColor(value) {
15
+ return /^#[0-9a-f]{6}$/i.test(value) || /^#[0-9a-f]{3}$/i.test(value);
16
+ }
17
+ /** Apply a configured foreground without letting a malformed override crash rendering. */
18
+ export function themeForeground(color, text) {
19
+ if (!color)
20
+ return text;
21
+ if (isHexColor(color))
22
+ return chalk.hex(color)(text);
23
+ const normalized = color.toLowerCase();
24
+ if (NAMED_COLORS.has(normalized))
25
+ return chalk[normalized](text);
26
+ return text;
27
+ }
28
+ /** Apply a configured background without letting a malformed override crash rendering. */
29
+ export function themeBackground(color, text) {
30
+ if (!color)
31
+ return text;
32
+ if (isHexColor(color))
33
+ return chalk.bgHex(color)(text);
34
+ const normalized = color.toLowerCase();
35
+ if (!NAMED_COLORS.has(normalized))
36
+ return text;
37
+ switch (normalized) {
38
+ case "black": return chalk.bgBlack(text);
39
+ case "red": return chalk.bgRed(text);
40
+ case "green": return chalk.bgGreen(text);
41
+ case "yellow": return chalk.bgYellow(text);
42
+ case "blue": return chalk.bgBlue(text);
43
+ case "magenta": return chalk.bgMagenta(text);
44
+ case "cyan": return chalk.bgCyan(text);
45
+ case "white": return chalk.bgWhite(text);
46
+ case "gray":
47
+ case "grey": return chalk.bgGray(text);
48
+ }
49
+ }
50
+ export function themeDim(color, text) {
51
+ return chalk.dim(themeForeground(color, text));
52
+ }
53
+ /** ANSI pair used by the alternate-screen renderer to paint every cell. */
54
+ export function themeBackgroundCodes(color) {
55
+ if (!color)
56
+ return undefined;
57
+ if (isHexColor(color)) {
58
+ const expanded = color.length === 4
59
+ ? color.slice(1).split("").map((part) => part + part).join("")
60
+ : color.slice(1);
61
+ const channels = expanded.match(/../g)?.map((part) => Number.parseInt(part, 16));
62
+ if (!channels || channels.length !== 3)
63
+ return undefined;
64
+ return { open: `\x1b[48;2;${channels.join(";")}m`, close: "\x1b[49m" };
65
+ }
66
+ const normalized = color.toLowerCase();
67
+ if (!NAMED_COLORS.has(normalized))
68
+ return undefined;
69
+ const code = normalized === "black" ? 40
70
+ : normalized === "red" ? 41
71
+ : normalized === "green" ? 42
72
+ : normalized === "yellow" ? 43
73
+ : normalized === "blue" ? 44
74
+ : normalized === "magenta" ? 45
75
+ : normalized === "cyan" ? 46
76
+ : normalized === "white" ? 47
77
+ : 100;
78
+ return { open: `\x1b[${code}m`, close: "\x1b[49m" };
79
+ }
@@ -1,11 +1,5 @@
1
1
  /**
2
- * Color themes for the TUI.
3
- *
4
- * Two base palettes are shipped: `darkTheme` for dark terminal backgrounds and
5
- * `lightTheme` for light ones. The shape is identical so consumers depend on
6
- * `Theme` rather than either palette directly. Active palette is provided
7
- * through `ThemeContext` so components re-render automatically when the
8
- * user switches via `/theme` at runtime.
2
+ * Renderer-neutral theme tokens shared by the terminal UI surfaces.
9
3
  */
10
4
  export type ResolvedTheme = "light" | "dark";
11
5
  export type ThemeMode = "auto" | ResolvedTheme;
@@ -53,6 +47,9 @@ export interface Theme {
53
47
  traceDetail: string;
54
48
  traceCommand: string;
55
49
  tracePending: string;
50
+ /** Neutral painted surfaces for pointer-hovered / selected tool traces. */
51
+ traceHoverBg: string;
52
+ traceSelectedBg: string;
56
53
  userMessageBorder: string;
57
54
  userMessageBg: string;
58
55
  userMessageText: string;
@@ -64,21 +61,12 @@ export interface Theme {
64
61
  diffRemoveFg: string;
65
62
  }
66
63
  export declare const darkTheme: Theme;
67
- /**
68
- * Light palette tuned for paper-neutral surfaces, blue focus/user rails, warm
69
- * command accent, and semantic tool colors with readable contrast on a light
70
- * terminal background.
71
- */
72
64
  export declare const lightTheme: Theme;
73
- /**
74
- * Decide whether the canvas needs painting. Auto mode always inherits the
75
- * terminal's own background, and so does a forced theme that matches the
76
- * detected terminal. A forced theme that mismatches (e.g. `/theme light`
77
- * inside a dark terminal) paints its canvas, because its foregrounds are
78
- * tuned for the opposite background and would otherwise be unreadable.
79
- */
80
65
  export declare function canvasBackgroundFor(mode: ThemeMode, resolved: ResolvedTheme, terminalTheme: ResolvedTheme): string | undefined;
81
- export declare const ThemeProvider: import("react").Provider<Theme>;
82
- export declare function useTheme(): Theme;
83
- /** Build the active palette given a resolved mode and optional overrides. */
84
- export declare function paletteFor(mode: ResolvedTheme, overrides?: Record<string, string>): Theme;
66
+ /** Build a palette from one of the shipped themes plus user overrides. */
67
+ export declare function paletteFor(resolved: ResolvedTheme, overrides?: Record<string, string>): Theme;
68
+ /** Resolve the complete live palette used by an interactive TUI instance. */
69
+ export declare function resolveThemePalette(mode: ThemeMode, terminalTheme: ResolvedTheme, overrides?: Record<string, string>): {
70
+ resolved: ResolvedTheme;
71
+ palette: Theme;
72
+ };
@@ -1,13 +1,3 @@
1
- /**
2
- * Color themes for the TUI.
3
- *
4
- * Two base palettes are shipped: `darkTheme` for dark terminal backgrounds and
5
- * `lightTheme` for light ones. The shape is identical so consumers depend on
6
- * `Theme` rather than either palette directly. Active palette is provided
7
- * through `ThemeContext` so components re-render automatically when the
8
- * user switches via `/theme` at runtime.
9
- */
10
- import { createContext, useContext } from "react";
11
1
  export const darkTheme = {
12
2
  user: "green",
13
3
  agent: "blue",
@@ -43,19 +33,16 @@ export const darkTheme = {
43
33
  traceDetail: "gray",
44
34
  traceCommand: "#59BCE8",
45
35
  tracePending: "yellow",
36
+ traceHoverBg: "#232323",
37
+ traceSelectedBg: "#2B2B2B",
46
38
  userMessageBorder: "#8A7FC6",
47
- userMessageBg: "#2a2a34",
39
+ userMessageBg: "#2A2A2A",
48
40
  userMessageText: "#f3f3f7",
49
41
  diffAdd: "#1a3d1a",
50
42
  diffRemove: "#3d1a1a",
51
43
  diffAddFg: "green",
52
44
  diffRemoveFg: "red",
53
45
  };
54
- /**
55
- * Light palette tuned for paper-neutral surfaces, blue focus/user rails, warm
56
- * command accent, and semantic tool colors with readable contrast on a light
57
- * terminal background.
58
- */
59
46
  export const lightTheme = {
60
47
  user: "#356FD2",
61
48
  agent: "#171717",
@@ -91,6 +78,8 @@ export const lightTheme = {
91
78
  traceDetail: "#8B9094",
92
79
  traceCommand: "#257E8A",
93
80
  tracePending: "#8B4A00",
81
+ traceHoverBg: "#E8E8E5",
82
+ traceSelectedBg: "#DDDFDB",
94
83
  userMessageBorder: "#356FD2",
95
84
  userMessageBg: "#F1F3F0",
96
85
  userMessageText: "#234B93",
@@ -99,38 +88,34 @@ export const lightTheme = {
99
88
  diffAddFg: "#2F7D4A",
100
89
  diffRemoveFg: "#B62633",
101
90
  };
102
- /** Canvas colors painted only when a forced theme mismatches the terminal. */
103
91
  const paintedCanvas = {
104
92
  dark: "#0A0A0A",
105
93
  light: "#FCFCFA",
106
94
  };
107
- /**
108
- * Decide whether the canvas needs painting. Auto mode always inherits the
109
- * terminal's own background, and so does a forced theme that matches the
110
- * detected terminal. A forced theme that mismatches (e.g. `/theme light`
111
- * inside a dark terminal) paints its canvas, because its foregrounds are
112
- * tuned for the opposite background and would otherwise be unreadable.
113
- */
114
95
  export function canvasBackgroundFor(mode, resolved, terminalTheme) {
115
96
  if (mode === "auto" || resolved === terminalTheme)
116
97
  return undefined;
117
98
  return paintedCanvas[resolved];
118
99
  }
119
- const ThemeContext = createContext(darkTheme);
120
- export const ThemeProvider = ThemeContext.Provider;
121
- export function useTheme() {
122
- return useContext(ThemeContext);
123
- }
124
- /** Build the active palette given a resolved mode and optional overrides. */
125
- export function paletteFor(mode, overrides) {
126
- const base = mode === "light" ? lightTheme : darkTheme;
100
+ /** Build a palette from one of the shipped themes plus user overrides. */
101
+ export function paletteFor(resolved, overrides) {
102
+ const base = resolved === "light" ? lightTheme : darkTheme;
127
103
  if (!overrides)
128
- return base;
129
- const filtered = {};
104
+ return { ...base };
105
+ const palette = { ...base };
130
106
  for (const [key, value] of Object.entries(overrides)) {
131
- if (typeof value === "string" && key in base) {
132
- filtered[key] = value;
133
- }
107
+ if (typeof value !== "string" || !(key in base))
108
+ continue;
109
+ palette[key] = value;
110
+ }
111
+ return palette;
112
+ }
113
+ /** Resolve the complete live palette used by an interactive TUI instance. */
114
+ export function resolveThemePalette(mode, terminalTheme, overrides) {
115
+ const resolved = mode === "auto" ? terminalTheme : mode;
116
+ const palette = paletteFor(resolved, overrides);
117
+ if (palette.background === undefined) {
118
+ palette.background = canvasBackgroundFor(mode, resolved, terminalTheme);
134
119
  }
135
- return { ...base, ...filtered };
120
+ return { resolved, palette };
136
121
  }
@@ -19,6 +19,8 @@ export interface TraceGroup {
19
19
  hasError: boolean;
20
20
  errorCount: number;
21
21
  startedAt?: number;
22
+ /** Final lifecycle label for traces whose tool call launches background work. */
23
+ statusLabel?: string;
22
24
  }
23
25
  export interface TraceGroupOptions {
24
26
  maxItems?: number;