@bubblebrain-ai/bubble 0.0.52 → 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 +73 -10
  49. package/dist/provider-transform.js +32 -4
  50. package/dist/provider.d.ts +6 -2
  51. package/dist/provider.js +95 -6
  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
@@ -1,7 +0,0 @@
1
- interface PlanConfirmProps {
2
- initialPlan: string;
3
- onApprove: (plan: string) => void;
4
- onReject: (reason?: string) => void;
5
- }
6
- export declare function PlanConfirm({ initialPlan, onApprove, onReject }: PlanConfirmProps): import("react/jsx-runtime").JSX.Element;
7
- export {};
@@ -1,115 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useState } from "react";
3
- import { Box, Text, useInput } from "ink";
4
- import { isKeyReleaseEvent } from "./key-events.js";
5
- import { useTheme } from "./theme.js";
6
- import { MarkdownContent } from "./markdown.js";
7
- import { stripTerminalMouseSequences } from "./terminal-mouse.js";
8
- export function PlanConfirm({ initialPlan, onApprove, onReject }) {
9
- const theme = useTheme();
10
- const [stage, setStage] = useState("view");
11
- const [draft, setDraft] = useState(initialPlan);
12
- const [cursor, setCursor] = useState(initialPlan.length);
13
- useInput((input, key) => {
14
- if (isKeyReleaseEvent(key))
15
- return;
16
- const strippedMouseInput = stripTerminalMouseSequences(input);
17
- if (strippedMouseInput !== input) {
18
- if (!strippedMouseInput)
19
- return;
20
- input = strippedMouseInput;
21
- }
22
- if (stage === "view") {
23
- if (key.escape || input === "n" || input === "N") {
24
- onReject();
25
- return;
26
- }
27
- if (input === "y" || input === "Y" || key.return) {
28
- onApprove(initialPlan);
29
- return;
30
- }
31
- if (input === "e" || input === "E") {
32
- setStage("edit");
33
- return;
34
- }
35
- return;
36
- }
37
- // edit stage
38
- if (key.escape) {
39
- setDraft(initialPlan);
40
- setCursor(initialPlan.length);
41
- setStage("view");
42
- return;
43
- }
44
- if (key.ctrl && (input === "s" || input === "d")) {
45
- const finalText = draft.trim();
46
- if (!finalText) {
47
- return;
48
- }
49
- onApprove(finalText);
50
- return;
51
- }
52
- if (key.return) {
53
- // Enter inserts a newline (multi-line editor).
54
- insertAtCursor("\n");
55
- return;
56
- }
57
- if (key.backspace || key.delete) {
58
- if (cursor > 0) {
59
- setDraft((prev) => prev.slice(0, cursor - 1) + prev.slice(cursor));
60
- setCursor((c) => Math.max(0, c - 1));
61
- }
62
- return;
63
- }
64
- if (key.leftArrow) {
65
- setCursor((c) => Math.max(0, c - 1));
66
- return;
67
- }
68
- if (key.rightArrow) {
69
- setCursor((c) => Math.min(draft.length, c + 1));
70
- return;
71
- }
72
- if (key.upArrow || key.downArrow) {
73
- const before = draft.slice(0, cursor);
74
- const after = draft.slice(cursor);
75
- const beforeLines = before.split("\n");
76
- const afterLines = after.split("\n");
77
- const currentCol = beforeLines[beforeLines.length - 1].length;
78
- if (key.upArrow && beforeLines.length > 1) {
79
- const prevLine = beforeLines[beforeLines.length - 2];
80
- const col = Math.min(currentCol, prevLine.length);
81
- const newCursor = before.length - beforeLines[beforeLines.length - 1].length - 1 - (prevLine.length - col);
82
- setCursor(Math.max(0, newCursor));
83
- }
84
- else if (key.downArrow && afterLines.length > 1) {
85
- const nextLine = afterLines[1];
86
- const col = Math.min(currentCol, nextLine.length);
87
- const newCursor = before.length + afterLines[0].length + 1 + col;
88
- setCursor(Math.min(draft.length, newCursor));
89
- }
90
- return;
91
- }
92
- if (input) {
93
- insertAtCursor(input);
94
- }
95
- });
96
- function insertAtCursor(text) {
97
- setDraft((prev) => prev.slice(0, cursor) + text + prev.slice(cursor));
98
- setCursor((c) => c + text.length);
99
- }
100
- if (stage === "view") {
101
- return (_jsxs(Box, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, marginY: 1, children: [_jsx(Text, { color: theme.accent, bold: true, children: "Proposed plan" }), _jsx(Box, { flexDirection: "column", marginTop: 1, children: _jsx(MarkdownContent, { content: initialPlan }) }), _jsx(Box, { marginTop: 1, children: _jsxs(Text, { color: theme.muted, children: [_jsx(Text, { color: theme.accent, bold: true, children: "y" }), " approve \u00A0\u00A0", _jsx(Text, { color: theme.accent, bold: true, children: "e" }), " edit \u00A0\u00A0", _jsx(Text, { color: theme.accent, bold: true, children: "n" }), "/", _jsx(Text, { color: theme.accent, bold: true, children: "esc" }), " reject"] }) })] }));
102
- }
103
- // edit stage
104
- const lines = draft.split("\n");
105
- const beforeCursor = draft.slice(0, cursor);
106
- const cursorLineIndex = beforeCursor.split("\n").length - 1;
107
- const cursorCol = beforeCursor.split("\n").pop()?.length || 0;
108
- return (_jsxs(Box, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, marginY: 1, children: [_jsx(Text, { color: theme.accent, bold: true, children: "Edit plan" }), _jsx(Box, { flexDirection: "column", marginTop: 1, children: lines.map((line, index) => {
109
- if (index !== cursorLineIndex) {
110
- return (_jsx(Text, { children: line || " " }, index));
111
- }
112
- const safe = line || " ";
113
- return (_jsxs(Box, { children: [_jsx(Text, { children: safe.slice(0, cursorCol) }), _jsx(Text, { inverse: true, children: safe[cursorCol] || " " }), _jsx(Text, { children: safe.slice(cursorCol + 1) })] }, index));
114
- }) }), _jsx(Box, { marginTop: 1, children: _jsxs(Text, { color: theme.muted, children: [_jsx(Text, { color: theme.accent, bold: true, children: "\u2303S" }), " save & approve \u00A0\u00A0", _jsx(Text, { color: theme.accent, bold: true, children: "esc" }), " cancel edit"] }) })] }));
115
- }
@@ -1,8 +0,0 @@
1
- import type { QuestionAnswer, QuestionRequest } from "../question/index.js";
2
- interface QuestionDialogProps {
3
- request: QuestionRequest;
4
- onSubmit: (answers: QuestionAnswer[]) => void;
5
- onCancel: () => void;
6
- }
7
- export declare function QuestionDialog({ request, onSubmit, onCancel }: QuestionDialogProps): import("react/jsx-runtime").JSX.Element;
8
- export {};
@@ -1,135 +0,0 @@
1
- import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
2
- import { useMemo, useState } from "react";
3
- import { Box, Text, useInput } from "ink";
4
- import { isKeyReleaseEvent } from "./key-events.js";
5
- import { useTheme } from "./theme.js";
6
- import { stripTerminalMouseSequences } from "./terminal-mouse.js";
7
- export function QuestionDialog({ request, onSubmit, onCancel }) {
8
- const theme = useTheme();
9
- const [index, setIndex] = useState(0);
10
- const [selected, setSelected] = useState(0);
11
- const [custom, setCustom] = useState("");
12
- const [answers, setAnswers] = useState(() => request.questions.map(() => []));
13
- const question = request.questions[index];
14
- const options = question?.options ?? [];
15
- const canUseCustom = question?.custom !== false;
16
- const isMultiple = question?.multiple === true;
17
- const totalTabs = request.questions.length;
18
- // The "Custom: type to answer" row is the last navigable item (when custom is
19
- // allowed), so Up/Down can reach and highlight it just like an option.
20
- const customIndex = canUseCustom ? options.length : -1;
21
- const navCount = options.length + (canUseCustom ? 1 : 0);
22
- const isCustomSelected = canUseCustom && selected === customIndex;
23
- const currentAnswer = useMemo(() => answers[index] ?? [], [answers, index]);
24
- const commitQuestion = () => {
25
- const customAnswer = custom.trim();
26
- // Submit what is actually selected: the Custom row submits the typed text;
27
- // an option row submits that option (a stale custom buffer no longer wins).
28
- const nextAnswer = isCustomSelected
29
- ? customAnswer
30
- ? [customAnswer]
31
- : []
32
- : isMultiple
33
- ? currentAnswer
34
- : options[selected]?.label
35
- ? [options[selected].label]
36
- : customAnswer
37
- ? [customAnswer]
38
- : [];
39
- const nextAnswers = answers.map((answer, i) => i === index ? nextAnswer : answer);
40
- if (index < request.questions.length - 1) {
41
- setAnswers(nextAnswers);
42
- setIndex((i) => i + 1);
43
- setSelected(0);
44
- setCustom("");
45
- return;
46
- }
47
- onSubmit(nextAnswers);
48
- };
49
- const toggleCurrentOption = () => {
50
- const option = options[selected]?.label;
51
- if (!option)
52
- return;
53
- if (!isMultiple) {
54
- setAnswers((prev) => prev.map((answer, i) => i === index ? [option] : answer));
55
- return;
56
- }
57
- setAnswers((prev) => prev.map((answer, i) => {
58
- if (i !== index)
59
- return answer;
60
- return answer.includes(option)
61
- ? answer.filter((item) => item !== option)
62
- : [...answer, option];
63
- }));
64
- };
65
- useInput((input, key) => {
66
- if (isKeyReleaseEvent(key))
67
- return;
68
- const strippedMouseInput = stripTerminalMouseSequences(input);
69
- if (strippedMouseInput !== input) {
70
- if (!strippedMouseInput)
71
- return;
72
- input = strippedMouseInput;
73
- }
74
- if (key.escape) {
75
- onCancel();
76
- return;
77
- }
78
- if (key.leftArrow && index > 0) {
79
- setIndex((i) => i - 1);
80
- setSelected(0);
81
- setCustom("");
82
- return;
83
- }
84
- if (key.rightArrow && index < totalTabs - 1) {
85
- setIndex((i) => i + 1);
86
- setSelected(0);
87
- setCustom("");
88
- return;
89
- }
90
- if (key.upArrow) {
91
- setSelected((i) => Math.max(0, i - 1));
92
- return;
93
- }
94
- if (key.downArrow) {
95
- setSelected((i) => Math.min(Math.max(0, navCount - 1), i + 1));
96
- return;
97
- }
98
- // Tab toggles a checkbox; only meaningful while an option row is selected.
99
- if (key.tab) {
100
- if (!isCustomSelected)
101
- toggleCurrentOption();
102
- return;
103
- }
104
- if (input === " ") {
105
- // Space toggles the highlighted option, but on the Custom row it types a
106
- // literal space into the answer instead of swallowing the keystroke.
107
- if (isCustomSelected) {
108
- setCustom((value) => value + " ");
109
- }
110
- else {
111
- toggleCurrentOption();
112
- }
113
- return;
114
- }
115
- if (key.return) {
116
- commitQuestion();
117
- return;
118
- }
119
- if (key.backspace || key.delete) {
120
- setCustom((value) => value.slice(0, -1));
121
- return;
122
- }
123
- // Any printable key starts/continues the custom answer and moves the
124
- // highlight onto the Custom row, so typing and arrow navigation agree.
125
- if (canUseCustom && input && !key.ctrl && !key.meta) {
126
- setSelected(customIndex);
127
- setCustom((value) => value + input);
128
- }
129
- });
130
- return (_jsxs(Box, { flexDirection: "column", borderStyle: "round", borderColor: theme.accent, paddingX: 1, marginY: 1, children: [_jsxs(Text, { color: theme.accent, bold: true, children: ["Question ", totalTabs > 1 ? `${index + 1}/${totalTabs}` : ""] }), _jsx(Box, { marginTop: 1, children: _jsx(Text, { children: question?.question ?? "The agent is asking for input." }) }), _jsx(Box, { flexDirection: "column", marginTop: 1, children: options.map((option, optionIndex) => {
131
- const isSelected = optionIndex === selected;
132
- const isChecked = currentAnswer.includes(option.label);
133
- return (_jsxs(Box, { flexDirection: "column", children: [_jsxs(Text, { color: isSelected ? theme.accent : undefined, children: [isSelected ? "> " : " ", isMultiple ? `[${isChecked ? "x" : " "}] ` : "", option.label] }), option.description && (_jsx(Box, { marginLeft: 4, children: _jsx(Text, { color: theme.muted, dimColor: true, children: option.description }) }))] }, `${option.label}-${optionIndex}`));
134
- }) }), canUseCustom && (_jsx(Box, { marginTop: 1, children: _jsxs(Text, { color: isCustomSelected ? theme.accent : custom ? undefined : theme.muted, children: [isCustomSelected ? "> " : " ", "Custom: ", custom || "type to answer…"] }) })), _jsx(Box, { marginTop: 1, children: _jsxs(Text, { color: theme.muted, children: ["\u2191\u2193 choose \u00B7 ", isMultiple ? "Space toggle · " : "", "type for Custom \u00B7 Enter submit \u00B7 Esc dismiss"] }) })] }));
135
- }
@@ -1,8 +0,0 @@
1
- import type { SessionManager } from "../session.js";
2
- export declare function RewindPicker({ sessionManager, terminalColumns, terminalRows, onSelect, onCancel, }: {
3
- sessionManager: SessionManager;
4
- terminalColumns: number;
5
- terminalRows: number;
6
- onSelect: (command: string) => void;
7
- onCancel: () => void;
8
- }): import("react/jsx-runtime").JSX.Element;
@@ -1,102 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- /**
3
- * /rewind checkpoint picker: lists user turns with touched-file counts and
4
- * cycles the restore scope (chat + files / chat only / files only).
5
- */
6
- import { useEffect, useMemo, useState } from "react";
7
- import { Box, Text, useInput } from "ink";
8
- import { useTheme } from "./theme.js";
9
- import { isKeyReleaseEvent } from "./key-events.js";
10
- import { clampWindowStartForIndex, truncate } from "./app-helpers.js";
11
- const REWIND_SCOPE_ORDER = ["all", "chat", "code"];
12
- const REWIND_SCOPE_LABEL = {
13
- all: "chat + files",
14
- chat: "chat only",
15
- code: "files only",
16
- };
17
- function rewindCommand(turnIndex, scope) {
18
- const base = `/rewind ${turnIndex + 1}`;
19
- if (scope === "chat")
20
- return `${base} --chat`;
21
- if (scope === "code")
22
- return `${base} --code`;
23
- return base;
24
- }
25
- function cycleRewindScope(scope, direction) {
26
- const index = REWIND_SCOPE_ORDER.indexOf(scope);
27
- return REWIND_SCOPE_ORDER[(index + direction + REWIND_SCOPE_ORDER.length) % REWIND_SCOPE_ORDER.length];
28
- }
29
- export function RewindPicker({ sessionManager, terminalColumns, terminalRows, onSelect, onCancel, }) {
30
- const theme = useTheme();
31
- const turns = useMemo(() => sessionManager.listUserTurns(), [sessionManager]);
32
- const checkpoints = useMemo(() => sessionManager.getCheckpoints(), [sessionManager]);
33
- const fileCounts = useMemo(() => {
34
- const entries = checkpoints.listEntries();
35
- const byTurn = new Map();
36
- for (const entry of entries) {
37
- const files = byTurn.get(entry.turn);
38
- if (files)
39
- files.add(entry.path);
40
- else
41
- byTurn.set(entry.turn, new Set([entry.path]));
42
- }
43
- return new Map(turns.map((turn) => [turn.id, byTurn.get(turn.id)?.size ?? 0]));
44
- }, [checkpoints, turns]);
45
- const [selectedIndex, setSelectedIndex] = useState(() => Math.max(0, turns.length - 1));
46
- const [scope, setScope] = useState("all");
47
- const maxVisible = Math.max(4, Math.min(10, terminalRows - 10));
48
- useEffect(() => {
49
- setSelectedIndex((current) => Math.min(Math.max(0, turns.length - 1), current));
50
- }, [turns.length]);
51
- useInput((input, key) => {
52
- if (isKeyReleaseEvent(key))
53
- return;
54
- if (key.escape) {
55
- onCancel();
56
- return;
57
- }
58
- if (key.return) {
59
- if (turns[selectedIndex])
60
- onSelect(rewindCommand(selectedIndex, scope));
61
- return;
62
- }
63
- if (key.upArrow) {
64
- setSelectedIndex((index) => Math.max(0, index - 1));
65
- return;
66
- }
67
- if (key.downArrow) {
68
- setSelectedIndex((index) => Math.min(Math.max(0, turns.length - 1), index + 1));
69
- return;
70
- }
71
- if (key.pageUp) {
72
- setSelectedIndex((index) => Math.max(0, index - maxVisible));
73
- return;
74
- }
75
- if (key.pageDown) {
76
- setSelectedIndex((index) => Math.min(Math.max(0, turns.length - 1), index + maxVisible));
77
- return;
78
- }
79
- if (key.tab || key.rightArrow || input === "l") {
80
- setScope((current) => cycleRewindScope(current, 1));
81
- return;
82
- }
83
- if (key.leftArrow || input === "h") {
84
- setScope((current) => cycleRewindScope(current, -1));
85
- }
86
- });
87
- const start = clampWindowStartForIndex(turns.length, selectedIndex, maxVisible);
88
- const visibleTurns = turns.slice(start, start + maxVisible);
89
- const previewWidth = Math.max(18, Math.min(76, terminalColumns - 34));
90
- return (_jsxs(Box, { flexDirection: "column", marginY: 1, paddingX: 1, borderStyle: "round", borderColor: theme.borderActive, children: [_jsx(Text, { bold: true, color: theme.accent, children: "Rewind" }), _jsxs(Text, { color: theme.muted, children: ["Restore: ", _jsx(Text, { color: theme.accent, children: REWIND_SCOPE_LABEL[scope] }), " · ", turns.length, " point", turns.length === 1 ? "" : "s"] }), _jsx(Text, { color: theme.muted, children: "Up/Down choose \u00B7 Left/Right scope \u00B7 Enter rewind \u00B7 Esc cancel" }), _jsxs(Box, { flexDirection: "column", marginTop: 1, children: [turns.length === 0 && _jsx(Text, { color: theme.muted, children: "Nothing to rewind: no user messages in this session." }), visibleTurns.map((turn, offset) => {
91
- const actualIndex = start + offset;
92
- const isSelected = actualIndex === selectedIndex;
93
- const touched = fileCounts.get(turn.id) ?? 0;
94
- return (_jsx(RewindRow, { turn: turn, turnNumber: actualIndex + 1, selected: isSelected, fileCount: touched, previewWidth: previewWidth }, turn.id));
95
- })] })] }));
96
- }
97
- function RewindRow({ turn, turnNumber, selected, fileCount, previewWidth, }) {
98
- const theme = useTheme();
99
- const time = new Date(turn.timestamp).toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" });
100
- const fileNote = fileCount > 0 ? ` · ${fileCount} file${fileCount === 1 ? "" : "s"}` : "";
101
- return (_jsxs(Box, { children: [_jsxs(Text, { color: selected ? theme.accent : undefined, children: [selected ? "> " : " ", String(turnNumber).padStart(2, " "), " ", time, " ", truncate(turn.preview, previewWidth)] }), _jsx(Text, { color: theme.muted, children: fileNote })] }));
102
- }
@@ -1,22 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { render } from "ink";
3
- import { SessionPicker } from "./session-picker.js";
4
- import { ThemeProvider, paletteFor } from "./theme.js";
5
- export async function runSessionPicker(options) {
6
- const theme = paletteFor(options.resolvedTheme, options.themeOverrides);
7
- return new Promise((resolve) => {
8
- let done = false;
9
- const finish = (value) => {
10
- if (done)
11
- return;
12
- done = true;
13
- try {
14
- instance.unmount();
15
- }
16
- catch { /* ignore */ }
17
- resolve(value);
18
- };
19
- const instance = render(_jsx(ThemeProvider, { value: theme, children: _jsx(SessionPicker, { currentCwd: options.currentCwd, currentSessions: options.currentSessions, allSessions: options.allSessions, onSelect: (file) => finish(file), onCancel: () => finish(undefined) }) }));
20
- void instance.waitUntilExit().then(() => finish(undefined));
21
- });
22
- }
@@ -1,62 +0,0 @@
1
- import React from "react";
2
- import type { Agent } from "../agent.js";
3
- import type { CliArgs } from "../cli.js";
4
- import type { SessionManager } from "../session.js";
5
- import type { Provider } from "../types.js";
6
- import type { ProviderRegistry } from "../provider-registry.js";
7
- import type { SkillRegistry } from "../skills/registry.js";
8
- import { type ApprovalHandlerRef, type ExitSummary, type PlanHandlerRef } from "./app.js";
9
- import type { BashAllowlist } from "../approval/session-cache.js";
10
- import type { SettingsManager } from "../permissions/settings.js";
11
- import type { McpManager } from "../mcp/manager.js";
12
- import type { LspService } from "../lsp/index.js";
13
- import type { QuestionController } from "../question/index.js";
14
- import type { MemoryScope } from "../memory/index.js";
15
- import type { ExternalHookController } from "../hooks/controller.js";
16
- import type { ResolvedTheme, ThemeMode } from "./theme.js";
17
- import type { ExternalRuntimeManager } from "../external-runtime/types.js";
18
- export interface RunTuiOptions {
19
- sessionManager?: SessionManager;
20
- createProvider?: (providerId: string, apiKey: string, baseURL: string) => Provider;
21
- registry?: ProviderRegistry;
22
- skillRegistry?: SkillRegistry;
23
- planHandlerRef?: PlanHandlerRef;
24
- approvalHandlerRef?: ApprovalHandlerRef;
25
- questionController?: QuestionController;
26
- bashAllowlist?: BashAllowlist;
27
- settingsManager?: SettingsManager;
28
- switchSession?: (sessionFile: string) => {
29
- manager: SessionManager;
30
- } | {
31
- error: string;
32
- };
33
- lspService?: LspService;
34
- mcpManager?: McpManager;
35
- /** Shared with the model-facing goal tools and the Ink auto-continuation loop. */
36
- goalStore?: import("../goal/store.js").GoalStore;
37
- /** Unified process manager; drives task notices, auto-resume, and the status row. */
38
- processManager?: import("../tasks/manager.js").ProcessManager;
39
- /** tasks.auto_resume from user config (design §2.3b). Default ON. */
40
- tasksAutoResume?: boolean;
41
- /** Ctrl+G send-to-background channel shared with the bash tool (design §2.5). */
42
- promotionChannel?: import("../tasks/promotion.js").PromotionChannel;
43
- themeMode?: ThemeMode;
44
- themeOverrides?: Record<string, string>;
45
- detectedTheme?: ResolvedTheme;
46
- onThemeModeChange?: (mode: ThemeMode) => void;
47
- flushMemory?: () => Promise<void>;
48
- runMemoryCompaction?: () => Promise<string>;
49
- runMemorySummary?: (scope?: MemoryScope) => Promise<string>;
50
- runMemoryRefresh?: (scope?: MemoryScope) => Promise<string>;
51
- bypassEnabled?: boolean;
52
- /** One-line "update available" notice rendered under the welcome banner version. */
53
- updateNotice?: string;
54
- /** Late update notice refresh surfaced after startup without restarting Ink. */
55
- updateNoticeRefresh?: Promise<string | null>;
56
- /** External lifecycle hooks, threaded into slash-command execution. */
57
- hookController?: ExternalHookController;
58
- /** Subscription-backed external agent runtime used by the interactive TUI. */
59
- externalRuntime?: ExternalRuntimeManager;
60
- }
61
- export declare function createInkAppElement(agent: Agent, args: CliArgs, options: RunTuiOptions, onExit: (summary: ExitSummary) => void): React.ReactElement;
62
- export declare function runTui(agent: Agent, args: CliArgs, options?: RunTuiOptions): Promise<ExitSummary | undefined>;
@@ -1,103 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { render } from "ink";
3
- import { END_SYNC, wrapSynchronizedOutput } from "./sync-output.js";
4
- import { App } from "./app.js";
5
- import { warmHighlighter } from "./code-highlight.js";
6
- export function createInkAppElement(agent, args, options, onExit) {
7
- return (_jsx(App, { agent: agent, args: args, sessionManager: options.sessionManager, switchSession: options.switchSession, createProvider: options.createProvider, registry: options.registry, skillRegistry: options.skillRegistry, planHandlerRef: options.planHandlerRef, approvalHandlerRef: options.approvalHandlerRef, questionController: options.questionController, bashAllowlist: options.bashAllowlist, settingsManager: options.settingsManager, lspService: options.lspService, mcpManager: options.mcpManager, goalStore: options.goalStore, processManager: options.processManager, tasksAutoResume: options.tasksAutoResume, promotionChannel: options.promotionChannel, themeMode: options.themeMode, themeOverrides: options.themeOverrides, detectedTheme: options.detectedTheme, onThemeModeChange: options.onThemeModeChange, flushMemory: options.flushMemory, runMemoryCompaction: options.runMemoryCompaction, runMemorySummary: options.runMemorySummary, runMemoryRefresh: options.runMemoryRefresh, bypassEnabled: options.bypassEnabled, updateNotice: options.updateNotice, updateNoticeRefresh: options.updateNoticeRefresh, hookController: options.hookController, externalRuntime: options.externalRuntime, onExit: onExit }));
8
- }
9
- /**
10
- * Best-effort terminal restore for abnormal exits. Bubble renders into the
11
- * primary screen (no alt-screen, no mouse reporting) so the transcript flows
12
- * into the terminal's native scrollback. We end synchronized output first —
13
- * a crash between a frame's ?2026h and ?2026l would otherwise leave the
14
- * terminal buffering until its own timeout — then restore the cursor,
15
- * mirroring Ink's teardown (idempotent when Ink already ran; load-bearing
16
- * when it didn't).
17
- */
18
- function restoreTerminal() {
19
- if (!process.stdout.isTTY)
20
- return;
21
- try {
22
- process.stdout.write(`${END_SYNC}\x1b[?25h`);
23
- }
24
- catch {
25
- // stdout may already be destroyed during shutdown
26
- }
27
- }
28
- export async function runTui(agent, args, options = {}) {
29
- // Kick off shiki load before the first code block is rendered. Fire and
30
- // forget — CodeBlock's lazy init falls back to raw lines if this isn't ready
31
- // yet, so callers don't need to await it.
32
- warmHighlighter();
33
- // NOTE: the CSI 6n ambiguous-width probe is intentionally NOT run here. Doing
34
- // raw-mode stdin I/O before Ink mounts left stdin in a state Bun's TTY compat
35
- // didn't hand cleanly back to Ink, swallowing all composer keystrokes. The
36
- // verdict now comes from `BUBBLE_AMBIGUOUS_WIDTH` / locale only (see width.ts);
37
- // a safe Ink-mounted probe can be reintroduced later behind a flag.
38
- let exitSummary;
39
- const onFatalError = (err) => {
40
- restoreTerminal();
41
- const detail = err instanceof Error ? err.stack ?? err.message : String(err);
42
- try {
43
- process.stderr.write(`${detail}\n`);
44
- }
45
- catch {
46
- // nothing left to report to
47
- }
48
- process.exit(1);
49
- };
50
- const onSigterm = () => {
51
- restoreTerminal();
52
- process.exit(143);
53
- };
54
- process.on("uncaughtException", onFatalError);
55
- process.on("SIGTERM", onSigterm);
56
- const instance = render(createInkAppElement(agent, args, options, (summary) => {
57
- // The app already called useApp().exit() inside requestExit, which
58
- // triggers Ink's own unmount + TTY restore. waitUntilExit() below is
59
- // the canonical signal that we're done — we deliberately do *not*
60
- // call instance.unmount() again here to avoid double-teardown
61
- // warnings on React 19. We capture the summary and render it after
62
- // teardown so it lands in the real shell scrollback (Claude-Code style).
63
- exitSummary = summary;
64
- }), {
65
- // Bubble owns Ctrl+C so it can route both raw ETX and kitty keyboard
66
- // Ctrl+C through App.requestExit(). Ink's default only exits reliably
67
- // for raw "\x03"; with kitty keyboard it can swallow the parsed
68
- // ctrl+c event before our useInput handlers see it.
69
- exitOnCtrlC: false,
70
- kittyKeyboard: {
71
- mode: "enabled",
72
- // reportEventTypes keeps release events out of text input.
73
- flags: ["disambiguateEscapeCodes", "reportEventTypes"],
74
- },
75
- // Render into the primary screen (NOT the 1049 alternate screen): settled
76
- // transcript rows are committed once via Ink's <Static> region so they
77
- // flow into the terminal's native scrollback. That gives flicker-free
78
- // native scroll + text selection + copy (and tmux copy-mode) for free,
79
- // and frees the arrow keys for composer history. Only the streaming tail
80
- // and the composer live in the repainting region at the bottom.
81
- alternateScreen: false,
82
- // Frames composite atomically via synchronized output (CSI ?2026) —
83
- // kills erase-then-repaint flicker without alt-screen.
84
- stdout: wrapSynchronizedOutput(process.stdout),
85
- });
86
- try {
87
- await instance.waitUntilExit();
88
- }
89
- finally {
90
- process.off("uncaughtException", onFatalError);
91
- process.off("SIGTERM", onSigterm);
92
- }
93
- // zsh's PROMPT_SP prints a reverse-video `%` if the previous program left
94
- // the cursor mid-line. Ink's interactive teardown (log-update.done) doesn't
95
- // emit a trailing newline, so mirror Ink's non-interactive branch and align
96
- // the cursor to column 0 before handing control back to the shell.
97
- if (process.stdout.isTTY) {
98
- process.stdout.write("\n");
99
- }
100
- // The exit summary is printed by main.ts (single print site, after the alt
101
- // screen has been left, so it lands in the real shell scrollback).
102
- return exitSummary;
103
- }
@@ -1,10 +0,0 @@
1
- import type { SessionSummary } from "../session.js";
2
- export type SessionPickerMode = "current" | "all";
3
- export interface SessionPickerProps {
4
- currentCwd: string;
5
- currentSessions: SessionSummary[];
6
- allSessions: SessionSummary[];
7
- onSelect: (file: string) => void;
8
- onCancel: () => void;
9
- }
10
- export declare function SessionPicker({ currentCwd, currentSessions, allSessions, onSelect, onCancel }: SessionPickerProps): import("react/jsx-runtime").JSX.Element;