@ashx-j/lunr-dev 0.2.19-dev.10.1 → 0.2.25-dev.13.1

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 (690) hide show
  1. package/CHANGELOG.md +60 -2
  2. package/README.md +2 -2
  3. package/dist/builtin-extensions/ashxj-tui.d.ts.map +1 -1
  4. package/dist/builtin-extensions/ashxj-tui.js +2 -2
  5. package/dist/builtin-extensions/ashxj-tui.js.map +1 -1
  6. package/dist/builtin-extensions/index.d.ts.map +1 -1
  7. package/dist/builtin-extensions/index.js +1 -2
  8. package/dist/builtin-extensions/index.js.map +1 -1
  9. package/dist/builtin-extensions/lunr-browser.d.ts +9 -0
  10. package/dist/builtin-extensions/lunr-browser.d.ts.map +1 -0
  11. package/dist/builtin-extensions/lunr-browser.js +169 -0
  12. package/dist/builtin-extensions/lunr-browser.js.map +1 -0
  13. package/dist/builtin-extensions/lunr-computer-use.d.ts.map +1 -1
  14. package/dist/builtin-extensions/lunr-computer-use.js +15 -14
  15. package/dist/builtin-extensions/lunr-computer-use.js.map +1 -1
  16. package/dist/builtin-extensions/lunr-plan-tools.d.ts +7 -7
  17. package/dist/builtin-extensions/lunr-plan-tools.d.ts.map +1 -1
  18. package/dist/builtin-extensions/lunr-plan-tools.js +12 -12
  19. package/dist/builtin-extensions/lunr-plan-tools.js.map +1 -1
  20. package/dist/builtin-extensions/lunr-todos.d.ts +6 -5
  21. package/dist/builtin-extensions/lunr-todos.d.ts.map +1 -1
  22. package/dist/builtin-extensions/lunr-todos.js +24 -7
  23. package/dist/builtin-extensions/lunr-todos.js.map +1 -1
  24. package/dist/builtin-extensions/pi-intercom/broker/spawn.d.ts +6 -4
  25. package/dist/builtin-extensions/pi-intercom/broker/spawn.d.ts.map +1 -1
  26. package/dist/builtin-extensions/pi-intercom/broker/spawn.js +114 -61
  27. package/dist/builtin-extensions/pi-intercom/broker/spawn.js.map +1 -1
  28. package/dist/builtin-extensions/pi-intercom/index.d.ts.map +1 -1
  29. package/dist/builtin-extensions/pi-intercom/index.js +365 -351
  30. package/dist/builtin-extensions/pi-intercom/index.js.map +1 -1
  31. package/dist/builtin-extensions/pi-mcp-adapter/direct-tools.d.ts.map +1 -1
  32. package/dist/builtin-extensions/pi-mcp-adapter/direct-tools.js +1 -0
  33. package/dist/builtin-extensions/pi-mcp-adapter/direct-tools.js.map +1 -1
  34. package/dist/builtin-extensions/pi-mcp-adapter/index.d.ts.map +1 -1
  35. package/dist/builtin-extensions/pi-mcp-adapter/index.js +1 -1
  36. package/dist/builtin-extensions/pi-mcp-adapter/index.js.map +1 -1
  37. package/dist/builtin-extensions/pi-subagents/src/extension/control-notices.d.ts +1 -1
  38. package/dist/builtin-extensions/pi-subagents/src/extension/control-notices.d.ts.map +1 -1
  39. package/dist/builtin-extensions/pi-subagents/src/extension/control-notices.js +5 -1
  40. package/dist/builtin-extensions/pi-subagents/src/extension/control-notices.js.map +1 -1
  41. package/dist/builtin-extensions/pi-subagents/src/extension/fanout-child.d.ts.map +1 -1
  42. package/dist/builtin-extensions/pi-subagents/src/extension/fanout-child.js +2 -2
  43. package/dist/builtin-extensions/pi-subagents/src/extension/fanout-child.js.map +1 -1
  44. package/dist/builtin-extensions/pi-subagents/src/extension/index.d.ts +9 -7
  45. package/dist/builtin-extensions/pi-subagents/src/extension/index.d.ts.map +1 -1
  46. package/dist/builtin-extensions/pi-subagents/src/extension/index.js +143 -59
  47. package/dist/builtin-extensions/pi-subagents/src/extension/index.js.map +1 -1
  48. package/dist/builtin-extensions/pi-subagents/src/extension/schemas.d.ts +18 -8
  49. package/dist/builtin-extensions/pi-subagents/src/extension/schemas.d.ts.map +1 -1
  50. package/dist/builtin-extensions/pi-subagents/src/extension/schemas.js +39 -14
  51. package/dist/builtin-extensions/pi-subagents/src/extension/schemas.js.map +1 -1
  52. package/dist/builtin-extensions/pi-subagents/src/extension/tool-description.d.ts +5 -3
  53. package/dist/builtin-extensions/pi-subagents/src/extension/tool-description.d.ts.map +1 -1
  54. package/dist/builtin-extensions/pi-subagents/src/extension/tool-description.js +32 -17
  55. package/dist/builtin-extensions/pi-subagents/src/extension/tool-description.js.map +1 -1
  56. package/dist/builtin-extensions/pi-subagents/src/intercom/communication.d.ts +17 -0
  57. package/dist/builtin-extensions/pi-subagents/src/intercom/communication.d.ts.map +1 -0
  58. package/dist/builtin-extensions/pi-subagents/src/intercom/communication.js +45 -0
  59. package/dist/builtin-extensions/pi-subagents/src/intercom/communication.js.map +1 -0
  60. package/dist/builtin-extensions/pi-subagents/src/intercom/intercom-bridge.d.ts +2 -0
  61. package/dist/builtin-extensions/pi-subagents/src/intercom/intercom-bridge.d.ts.map +1 -1
  62. package/dist/builtin-extensions/pi-subagents/src/intercom/intercom-bridge.js +10 -14
  63. package/dist/builtin-extensions/pi-subagents/src/intercom/intercom-bridge.js.map +1 -1
  64. package/dist/builtin-extensions/pi-subagents/src/intercom/native-supervisor-channel.d.ts +12 -2
  65. package/dist/builtin-extensions/pi-subagents/src/intercom/native-supervisor-channel.d.ts.map +1 -1
  66. package/dist/builtin-extensions/pi-subagents/src/intercom/native-supervisor-channel.js +401 -58
  67. package/dist/builtin-extensions/pi-subagents/src/intercom/native-supervisor-channel.js.map +1 -1
  68. package/dist/builtin-extensions/pi-subagents/src/intercom/result-intercom.d.ts +1 -0
  69. package/dist/builtin-extensions/pi-subagents/src/intercom/result-intercom.d.ts.map +1 -1
  70. package/dist/builtin-extensions/pi-subagents/src/intercom/result-intercom.js +1 -1
  71. package/dist/builtin-extensions/pi-subagents/src/intercom/result-intercom.js.map +1 -1
  72. package/dist/builtin-extensions/pi-subagents/src/intercom/supervisor-ask.d.ts +29 -0
  73. package/dist/builtin-extensions/pi-subagents/src/intercom/supervisor-ask.d.ts.map +1 -0
  74. package/dist/builtin-extensions/pi-subagents/src/intercom/supervisor-ask.js +184 -0
  75. package/dist/builtin-extensions/pi-subagents/src/intercom/supervisor-ask.js.map +1 -0
  76. package/dist/builtin-extensions/pi-subagents/src/intercom/supervisor-questions.d.ts +91 -0
  77. package/dist/builtin-extensions/pi-subagents/src/intercom/supervisor-questions.d.ts.map +1 -0
  78. package/dist/builtin-extensions/pi-subagents/src/intercom/supervisor-questions.js +542 -0
  79. package/dist/builtin-extensions/pi-subagents/src/intercom/supervisor-questions.js.map +1 -0
  80. package/dist/builtin-extensions/pi-subagents/src/runs/background/async-execution.d.ts +13 -1
  81. package/dist/builtin-extensions/pi-subagents/src/runs/background/async-execution.d.ts.map +1 -1
  82. package/dist/builtin-extensions/pi-subagents/src/runs/background/async-execution.js +42 -12
  83. package/dist/builtin-extensions/pi-subagents/src/runs/background/async-execution.js.map +1 -1
  84. package/dist/builtin-extensions/pi-subagents/src/runs/background/async-job-tracker.d.ts.map +1 -1
  85. package/dist/builtin-extensions/pi-subagents/src/runs/background/async-job-tracker.js +3 -2
  86. package/dist/builtin-extensions/pi-subagents/src/runs/background/async-job-tracker.js.map +1 -1
  87. package/dist/builtin-extensions/pi-subagents/src/runs/background/async-resume.d.ts +2 -1
  88. package/dist/builtin-extensions/pi-subagents/src/runs/background/async-resume.d.ts.map +1 -1
  89. package/dist/builtin-extensions/pi-subagents/src/runs/background/async-resume.js +35 -8
  90. package/dist/builtin-extensions/pi-subagents/src/runs/background/async-resume.js.map +1 -1
  91. package/dist/builtin-extensions/pi-subagents/src/runs/background/auto-drain.d.ts +1 -0
  92. package/dist/builtin-extensions/pi-subagents/src/runs/background/auto-drain.d.ts.map +1 -1
  93. package/dist/builtin-extensions/pi-subagents/src/runs/background/auto-drain.js +2 -1
  94. package/dist/builtin-extensions/pi-subagents/src/runs/background/auto-drain.js.map +1 -1
  95. package/dist/builtin-extensions/pi-subagents/src/runs/background/notify.d.ts +7 -3
  96. package/dist/builtin-extensions/pi-subagents/src/runs/background/notify.d.ts.map +1 -1
  97. package/dist/builtin-extensions/pi-subagents/src/runs/background/notify.js +26 -4
  98. package/dist/builtin-extensions/pi-subagents/src/runs/background/notify.js.map +1 -1
  99. package/dist/builtin-extensions/pi-subagents/src/runs/background/result-watcher.d.ts +1 -0
  100. package/dist/builtin-extensions/pi-subagents/src/runs/background/result-watcher.d.ts.map +1 -1
  101. package/dist/builtin-extensions/pi-subagents/src/runs/background/result-watcher.js +55 -38
  102. package/dist/builtin-extensions/pi-subagents/src/runs/background/result-watcher.js.map +1 -1
  103. package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-runner.d.ts +100 -0
  104. package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-runner.d.ts.map +1 -1
  105. package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-runner.js +47 -32
  106. package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-runner.js.map +1 -1
  107. package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-wait.d.ts +6 -6
  108. package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-wait.d.ts.map +1 -1
  109. package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-wait.js +75 -5
  110. package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-wait.js.map +1 -1
  111. package/dist/builtin-extensions/pi-subagents/src/runs/background/top-level-async.d.ts +15 -2
  112. package/dist/builtin-extensions/pi-subagents/src/runs/background/top-level-async.d.ts.map +1 -1
  113. package/dist/builtin-extensions/pi-subagents/src/runs/background/top-level-async.js +14 -4
  114. package/dist/builtin-extensions/pi-subagents/src/runs/background/top-level-async.js.map +1 -1
  115. package/dist/builtin-extensions/pi-subagents/src/runs/background/wait-tool.d.ts.map +1 -1
  116. package/dist/builtin-extensions/pi-subagents/src/runs/background/wait-tool.js +43 -4
  117. package/dist/builtin-extensions/pi-subagents/src/runs/background/wait-tool.js.map +1 -1
  118. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/chain-execution.d.ts +1 -0
  119. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/chain-execution.d.ts.map +1 -1
  120. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/chain-execution.js +26 -9
  121. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/chain-execution.js.map +1 -1
  122. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/execution.d.ts.map +1 -1
  123. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/execution.js +4 -3
  124. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/execution.js.map +1 -1
  125. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/subagent-executor.d.ts +0 -1
  126. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/subagent-executor.d.ts.map +1 -1
  127. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/subagent-executor.js +94 -25
  128. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/subagent-executor.js.map +1 -1
  129. package/dist/builtin-extensions/pi-subagents/src/runs/shared/acceptance.d.ts +2 -0
  130. package/dist/builtin-extensions/pi-subagents/src/runs/shared/acceptance.d.ts.map +1 -1
  131. package/dist/builtin-extensions/pi-subagents/src/runs/shared/acceptance.js +75 -18
  132. package/dist/builtin-extensions/pi-subagents/src/runs/shared/acceptance.js.map +1 -1
  133. package/dist/builtin-extensions/pi-subagents/src/runs/shared/child-tools.d.ts +1 -1
  134. package/dist/builtin-extensions/pi-subagents/src/runs/shared/child-tools.d.ts.map +1 -1
  135. package/dist/builtin-extensions/pi-subagents/src/runs/shared/child-tools.js +1 -1
  136. package/dist/builtin-extensions/pi-subagents/src/runs/shared/child-tools.js.map +1 -1
  137. package/dist/builtin-extensions/pi-subagents/src/runs/shared/completion-guard.d.ts +1 -1
  138. package/dist/builtin-extensions/pi-subagents/src/runs/shared/completion-guard.d.ts.map +1 -1
  139. package/dist/builtin-extensions/pi-subagents/src/runs/shared/completion-guard.js +1 -1
  140. package/dist/builtin-extensions/pi-subagents/src/runs/shared/completion-guard.js.map +1 -1
  141. package/dist/builtin-extensions/pi-subagents/src/runs/shared/model-fallback.d.ts +13 -1
  142. package/dist/builtin-extensions/pi-subagents/src/runs/shared/model-fallback.d.ts.map +1 -1
  143. package/dist/builtin-extensions/pi-subagents/src/runs/shared/model-fallback.js +67 -11
  144. package/dist/builtin-extensions/pi-subagents/src/runs/shared/model-fallback.js.map +1 -1
  145. package/dist/builtin-extensions/pi-subagents/src/runs/shared/parallel-utils.d.ts +1 -0
  146. package/dist/builtin-extensions/pi-subagents/src/runs/shared/parallel-utils.d.ts.map +1 -1
  147. package/dist/builtin-extensions/pi-subagents/src/runs/shared/parallel-utils.js.map +1 -1
  148. package/dist/builtin-extensions/pi-subagents/src/runs/shared/pi-args.d.ts +5 -0
  149. package/dist/builtin-extensions/pi-subagents/src/runs/shared/pi-args.d.ts.map +1 -1
  150. package/dist/builtin-extensions/pi-subagents/src/runs/shared/pi-args.js +25 -15
  151. package/dist/builtin-extensions/pi-subagents/src/runs/shared/pi-args.js.map +1 -1
  152. package/dist/builtin-extensions/pi-subagents/src/runs/shared/subagent-control.d.ts +1 -0
  153. package/dist/builtin-extensions/pi-subagents/src/runs/shared/subagent-control.d.ts.map +1 -1
  154. package/dist/builtin-extensions/pi-subagents/src/runs/shared/subagent-control.js +3 -0
  155. package/dist/builtin-extensions/pi-subagents/src/runs/shared/subagent-control.js.map +1 -1
  156. package/dist/builtin-extensions/pi-subagents/src/runs/shared/subagent-prompt-runtime.d.ts.map +1 -1
  157. package/dist/builtin-extensions/pi-subagents/src/runs/shared/subagent-prompt-runtime.js +17 -5
  158. package/dist/builtin-extensions/pi-subagents/src/runs/shared/subagent-prompt-runtime.js.map +1 -1
  159. package/dist/builtin-extensions/pi-subagents/src/runs/shared/task-intent.d.ts +2 -2
  160. package/dist/builtin-extensions/pi-subagents/src/runs/shared/task-intent.d.ts.map +1 -1
  161. package/dist/builtin-extensions/pi-subagents/src/runs/shared/task-intent.js +5 -10
  162. package/dist/builtin-extensions/pi-subagents/src/runs/shared/task-intent.js.map +1 -1
  163. package/dist/builtin-extensions/pi-subagents/src/shared/async-guidance.d.ts +2 -0
  164. package/dist/builtin-extensions/pi-subagents/src/shared/async-guidance.d.ts.map +1 -0
  165. package/dist/builtin-extensions/pi-subagents/src/shared/async-guidance.js +3 -0
  166. package/dist/builtin-extensions/pi-subagents/src/shared/async-guidance.js.map +1 -0
  167. package/dist/builtin-extensions/pi-subagents/src/shared/child-spec.d.ts +3 -0
  168. package/dist/builtin-extensions/pi-subagents/src/shared/child-spec.d.ts.map +1 -1
  169. package/dist/builtin-extensions/pi-subagents/src/shared/child-spec.js +70 -13
  170. package/dist/builtin-extensions/pi-subagents/src/shared/child-spec.js.map +1 -1
  171. package/dist/builtin-extensions/pi-subagents/src/shared/formatters.d.ts +12 -1
  172. package/dist/builtin-extensions/pi-subagents/src/shared/formatters.d.ts.map +1 -1
  173. package/dist/builtin-extensions/pi-subagents/src/shared/formatters.js +21 -2
  174. package/dist/builtin-extensions/pi-subagents/src/shared/formatters.js.map +1 -1
  175. package/dist/builtin-extensions/pi-subagents/src/shared/types.d.ts +23 -4
  176. package/dist/builtin-extensions/pi-subagents/src/shared/types.d.ts.map +1 -1
  177. package/dist/builtin-extensions/pi-subagents/src/shared/types.js +1 -1
  178. package/dist/builtin-extensions/pi-subagents/src/shared/types.js.map +1 -1
  179. package/dist/builtin-extensions/pi-subagents/src/slash/delegation-adapters.d.ts.map +1 -1
  180. package/dist/builtin-extensions/pi-subagents/src/slash/delegation-adapters.js.map +1 -1
  181. package/dist/builtin-extensions/pi-subagents/src/slash/prompt-workflows.d.ts +7 -0
  182. package/dist/builtin-extensions/pi-subagents/src/slash/prompt-workflows.d.ts.map +1 -1
  183. package/dist/builtin-extensions/pi-subagents/src/slash/prompt-workflows.js +11 -7
  184. package/dist/builtin-extensions/pi-subagents/src/slash/prompt-workflows.js.map +1 -1
  185. package/dist/builtin-extensions/pi-subagents/src/slash/slash-commands.d.ts +6 -0
  186. package/dist/builtin-extensions/pi-subagents/src/slash/slash-commands.d.ts.map +1 -1
  187. package/dist/builtin-extensions/pi-subagents/src/slash/slash-commands.js +46 -29
  188. package/dist/builtin-extensions/pi-subagents/src/slash/slash-commands.js.map +1 -1
  189. package/dist/builtin-extensions/pi-subagents/src/tui/communication.d.ts +18 -0
  190. package/dist/builtin-extensions/pi-subagents/src/tui/communication.d.ts.map +1 -0
  191. package/dist/builtin-extensions/pi-subagents/src/tui/communication.js +48 -0
  192. package/dist/builtin-extensions/pi-subagents/src/tui/communication.js.map +1 -0
  193. package/dist/builtin-extensions/pi-subagents/src/tui/render.d.ts +46 -4
  194. package/dist/builtin-extensions/pi-subagents/src/tui/render.d.ts.map +1 -1
  195. package/dist/builtin-extensions/pi-subagents/src/tui/render.js +407 -450
  196. package/dist/builtin-extensions/pi-subagents/src/tui/render.js.map +1 -1
  197. package/dist/builtin-extensions/pi-subagents/src/watchdog/register-main.d.ts.map +1 -1
  198. package/dist/builtin-extensions/pi-subagents/src/watchdog/register-main.js +1 -1
  199. package/dist/builtin-extensions/pi-subagents/src/watchdog/register-main.js.map +1 -1
  200. package/dist/builtin-extensions/pi-subagents/src/watchdog/tool-actions.d.ts +2 -13
  201. package/dist/builtin-extensions/pi-subagents/src/watchdog/tool-actions.d.ts.map +1 -1
  202. package/dist/builtin-extensions/pi-subagents/src/watchdog/tool-actions.js +5 -91
  203. package/dist/builtin-extensions/pi-subagents/src/watchdog/tool-actions.js.map +1 -1
  204. package/dist/builtin-extensions/pi-web-access/index.d.ts.map +1 -1
  205. package/dist/builtin-extensions/pi-web-access/index.js +11 -7
  206. package/dist/builtin-extensions/pi-web-access/index.js.map +1 -1
  207. package/dist/cli/args.d.ts.map +1 -1
  208. package/dist/cli/args.js +2 -1
  209. package/dist/cli/args.js.map +1 -1
  210. package/dist/cli/install-cli.d.ts.map +1 -1
  211. package/dist/cli/install-cli.js +15 -45
  212. package/dist/cli/install-cli.js.map +1 -1
  213. package/dist/core/agent-session-runtime.d.ts +9 -0
  214. package/dist/core/agent-session-runtime.d.ts.map +1 -1
  215. package/dist/core/agent-session-runtime.js +126 -29
  216. package/dist/core/agent-session-runtime.js.map +1 -1
  217. package/dist/core/agent-session.d.ts +23 -1
  218. package/dist/core/agent-session.d.ts.map +1 -1
  219. package/dist/core/agent-session.js +255 -109
  220. package/dist/core/agent-session.js.map +1 -1
  221. package/dist/core/browser/network.d.ts +9 -0
  222. package/dist/core/browser/network.d.ts.map +1 -0
  223. package/dist/core/browser/network.js +146 -0
  224. package/dist/core/browser/network.js.map +1 -0
  225. package/dist/core/browser/runtime.d.ts +24 -0
  226. package/dist/core/browser/runtime.d.ts.map +1 -0
  227. package/dist/core/browser/runtime.js +289 -0
  228. package/dist/core/browser/runtime.js.map +1 -0
  229. package/dist/core/browser/schema.d.ts +16 -0
  230. package/dist/core/browser/schema.d.ts.map +1 -0
  231. package/dist/core/browser/schema.js +36 -0
  232. package/dist/core/browser/schema.js.map +1 -0
  233. package/dist/core/browser/settings.d.ts +8 -0
  234. package/dist/core/browser/settings.d.ts.map +1 -0
  235. package/dist/core/browser/settings.js +30 -0
  236. package/dist/core/browser/settings.js.map +1 -0
  237. package/dist/core/browser/setup.d.ts +2 -0
  238. package/dist/core/browser/setup.d.ts.map +1 -0
  239. package/dist/core/browser/setup.js +16 -0
  240. package/dist/core/browser/setup.js.map +1 -0
  241. package/dist/core/catalog-cache-scope.d.ts.map +1 -1
  242. package/dist/core/catalog-cache-scope.js +3 -1
  243. package/dist/core/catalog-cache-scope.js.map +1 -1
  244. package/dist/core/computer-use/image.d.ts +27 -0
  245. package/dist/core/computer-use/image.d.ts.map +1 -0
  246. package/dist/core/computer-use/image.js +72 -0
  247. package/dist/core/computer-use/image.js.map +1 -0
  248. package/dist/core/computer-use/policy.d.ts.map +1 -1
  249. package/dist/core/computer-use/policy.js +2 -6
  250. package/dist/core/computer-use/policy.js.map +1 -1
  251. package/dist/core/computer-use/schemas.d.ts +14 -10
  252. package/dist/core/computer-use/schemas.d.ts.map +1 -1
  253. package/dist/core/computer-use/schemas.js +27 -35
  254. package/dist/core/computer-use/schemas.js.map +1 -1
  255. package/dist/core/computer-use/workflow.d.ts +16 -8
  256. package/dist/core/computer-use/workflow.d.ts.map +1 -1
  257. package/dist/core/computer-use/workflow.js +337 -260
  258. package/dist/core/computer-use/workflow.js.map +1 -1
  259. package/dist/core/customize.d.ts +2 -0
  260. package/dist/core/customize.d.ts.map +1 -1
  261. package/dist/core/customize.js +17 -13
  262. package/dist/core/customize.js.map +1 -1
  263. package/dist/core/export-html/index.d.ts.map +1 -1
  264. package/dist/core/export-html/index.js +1 -1
  265. package/dist/core/export-html/index.js.map +1 -1
  266. package/dist/core/extensions/loader.d.ts.map +1 -1
  267. package/dist/core/extensions/loader.js +4 -0
  268. package/dist/core/extensions/loader.js.map +1 -1
  269. package/dist/core/extensions/runner.d.ts +1 -0
  270. package/dist/core/extensions/runner.d.ts.map +1 -1
  271. package/dist/core/extensions/runner.js +1 -1
  272. package/dist/core/extensions/runner.js.map +1 -1
  273. package/dist/core/extensions/types.d.ts +1 -1
  274. package/dist/core/extensions/types.d.ts.map +1 -1
  275. package/dist/core/extensions/types.js.map +1 -1
  276. package/dist/core/install-features.d.ts.map +1 -1
  277. package/dist/core/install-features.js +10 -8
  278. package/dist/core/install-features.js.map +1 -1
  279. package/dist/core/memory-cap.d.ts.map +1 -1
  280. package/dist/core/memory-cap.js +5 -3
  281. package/dist/core/memory-cap.js.map +1 -1
  282. package/dist/core/model-runtime.d.ts.map +1 -1
  283. package/dist/core/model-runtime.js +3 -2
  284. package/dist/core/model-runtime.js.map +1 -1
  285. package/dist/core/model-tiers.d.ts.map +1 -1
  286. package/dist/core/model-tiers.js +9 -6
  287. package/dist/core/model-tiers.js.map +1 -1
  288. package/dist/core/permissions.d.ts +17 -23
  289. package/dist/core/permissions.d.ts.map +1 -1
  290. package/dist/core/permissions.js +79 -146
  291. package/dist/core/permissions.js.map +1 -1
  292. package/dist/core/plan-mode.d.ts +10 -12
  293. package/dist/core/plan-mode.d.ts.map +1 -1
  294. package/dist/core/plan-mode.js +20 -24
  295. package/dist/core/plan-mode.js.map +1 -1
  296. package/dist/core/process-registry.d.ts.map +1 -1
  297. package/dist/core/process-registry.js +6 -4
  298. package/dist/core/process-registry.js.map +1 -1
  299. package/dist/core/runtime-bridges.d.ts.map +1 -1
  300. package/dist/core/runtime-bridges.js +2 -2
  301. package/dist/core/runtime-bridges.js.map +1 -1
  302. package/dist/core/runtime-scope.d.ts +11 -0
  303. package/dist/core/runtime-scope.d.ts.map +1 -0
  304. package/dist/core/runtime-scope.js +3 -0
  305. package/dist/core/runtime-scope.js.map +1 -0
  306. package/dist/core/sdk.d.ts.map +1 -1
  307. package/dist/core/sdk.js +26 -6
  308. package/dist/core/sdk.js.map +1 -1
  309. package/dist/core/session-handoff.d.ts +35 -0
  310. package/dist/core/session-handoff.d.ts.map +1 -0
  311. package/dist/core/session-handoff.js +214 -0
  312. package/dist/core/session-handoff.js.map +1 -0
  313. package/dist/core/session-manager.d.ts +20 -0
  314. package/dist/core/session-manager.d.ts.map +1 -1
  315. package/dist/core/session-manager.js +191 -22
  316. package/dist/core/session-manager.js.map +1 -1
  317. package/dist/core/session-ownership.d.ts +28 -0
  318. package/dist/core/session-ownership.d.ts.map +1 -0
  319. package/dist/core/session-ownership.js +138 -0
  320. package/dist/core/session-ownership.js.map +1 -0
  321. package/dist/core/session-retention.d.ts.map +1 -1
  322. package/dist/core/session-retention.js +11 -2
  323. package/dist/core/session-retention.js.map +1 -1
  324. package/dist/core/settings-manager.d.ts +24 -1
  325. package/dist/core/settings-manager.d.ts.map +1 -1
  326. package/dist/core/settings-manager.js +78 -1
  327. package/dist/core/settings-manager.js.map +1 -1
  328. package/dist/core/slash-commands.d.ts.map +1 -1
  329. package/dist/core/slash-commands.js +6 -4
  330. package/dist/core/slash-commands.js.map +1 -1
  331. package/dist/core/subagent-cancellation.d.ts +21 -0
  332. package/dist/core/subagent-cancellation.d.ts.map +1 -0
  333. package/dist/core/subagent-cancellation.js +53 -0
  334. package/dist/core/subagent-cancellation.js.map +1 -0
  335. package/dist/core/subagent-permission-inherit.d.ts +6 -10
  336. package/dist/core/subagent-permission-inherit.d.ts.map +1 -1
  337. package/dist/core/subagent-permission-inherit.js +14 -14
  338. package/dist/core/subagent-permission-inherit.js.map +1 -1
  339. package/dist/core/subagent-spinner-setting.d.ts +6 -0
  340. package/dist/core/subagent-spinner-setting.d.ts.map +1 -0
  341. package/dist/core/subagent-spinner-setting.js +12 -0
  342. package/dist/core/subagent-spinner-setting.js.map +1 -0
  343. package/dist/core/subagent-spinner.d.ts +4 -0
  344. package/dist/core/subagent-spinner.d.ts.map +1 -0
  345. package/dist/core/subagent-spinner.js +6 -0
  346. package/dist/core/subagent-spinner.js.map +1 -0
  347. package/dist/core/subagent-wait-interruption.d.ts +11 -0
  348. package/dist/core/subagent-wait-interruption.d.ts.map +1 -0
  349. package/dist/core/subagent-wait-interruption.js +19 -0
  350. package/dist/core/subagent-wait-interruption.js.map +1 -0
  351. package/dist/core/system-prompt.d.ts +2 -0
  352. package/dist/core/system-prompt.d.ts.map +1 -1
  353. package/dist/core/system-prompt.js +14 -4
  354. package/dist/core/system-prompt.js.map +1 -1
  355. package/dist/core/todo-settings.d.ts +5 -0
  356. package/dist/core/todo-settings.d.ts.map +1 -0
  357. package/dist/core/todo-settings.js +7 -0
  358. package/dist/core/todo-settings.js.map +1 -0
  359. package/dist/core/tools/bash.d.ts.map +1 -1
  360. package/dist/core/tools/bash.js +4 -4
  361. package/dist/core/tools/bash.js.map +1 -1
  362. package/dist/core/tools/edit.d.ts.map +1 -1
  363. package/dist/core/tools/edit.js +5 -3
  364. package/dist/core/tools/edit.js.map +1 -1
  365. package/dist/core/tools/find.d.ts.map +1 -1
  366. package/dist/core/tools/find.js +4 -4
  367. package/dist/core/tools/find.js.map +1 -1
  368. package/dist/core/tools/grep.d.ts.map +1 -1
  369. package/dist/core/tools/grep.js +4 -4
  370. package/dist/core/tools/grep.js.map +1 -1
  371. package/dist/core/tools/ls.d.ts.map +1 -1
  372. package/dist/core/tools/ls.js +4 -4
  373. package/dist/core/tools/ls.js.map +1 -1
  374. package/dist/core/tools/read.d.ts.map +1 -1
  375. package/dist/core/tools/read.js +4 -4
  376. package/dist/core/tools/read.js.map +1 -1
  377. package/dist/core/tools/render-utils.d.ts +14 -5
  378. package/dist/core/tools/render-utils.d.ts.map +1 -1
  379. package/dist/core/tools/render-utils.js +34 -7
  380. package/dist/core/tools/render-utils.js.map +1 -1
  381. package/dist/core/tools/write.d.ts.map +1 -1
  382. package/dist/core/tools/write.js +4 -4
  383. package/dist/core/tools/write.js.map +1 -1
  384. package/dist/core/usage-service.d.ts.map +1 -1
  385. package/dist/core/usage-service.js +5 -3
  386. package/dist/core/usage-service.js.map +1 -1
  387. package/dist/gateway/adapters/discord.d.ts +12 -1
  388. package/dist/gateway/adapters/discord.d.ts.map +1 -1
  389. package/dist/gateway/adapters/discord.js +114 -24
  390. package/dist/gateway/adapters/discord.js.map +1 -1
  391. package/dist/gateway/adapters/telegram.d.ts +4 -2
  392. package/dist/gateway/adapters/telegram.d.ts.map +1 -1
  393. package/dist/gateway/adapters/telegram.js +41 -11
  394. package/dist/gateway/adapters/telegram.js.map +1 -1
  395. package/dist/gateway/agent-bridge.d.ts +18 -4
  396. package/dist/gateway/agent-bridge.d.ts.map +1 -1
  397. package/dist/gateway/agent-bridge.js +305 -73
  398. package/dist/gateway/agent-bridge.js.map +1 -1
  399. package/dist/gateway/approval.d.ts +3 -6
  400. package/dist/gateway/approval.d.ts.map +1 -1
  401. package/dist/gateway/approval.js +62 -24
  402. package/dist/gateway/approval.js.map +1 -1
  403. package/dist/gateway/authz.d.ts +2 -0
  404. package/dist/gateway/authz.d.ts.map +1 -1
  405. package/dist/gateway/authz.js +13 -0
  406. package/dist/gateway/authz.js.map +1 -1
  407. package/dist/gateway/buttons.d.ts +3 -1
  408. package/dist/gateway/buttons.d.ts.map +1 -1
  409. package/dist/gateway/buttons.js +45 -20
  410. package/dist/gateway/buttons.js.map +1 -1
  411. package/dist/gateway/command.d.ts.map +1 -1
  412. package/dist/gateway/command.js +49 -4
  413. package/dist/gateway/command.js.map +1 -1
  414. package/dist/gateway/commands.d.ts +2 -0
  415. package/dist/gateway/commands.d.ts.map +1 -1
  416. package/dist/gateway/commands.js +52 -16
  417. package/dist/gateway/commands.js.map +1 -1
  418. package/dist/gateway/config.d.ts +6 -0
  419. package/dist/gateway/config.d.ts.map +1 -1
  420. package/dist/gateway/config.js +7 -0
  421. package/dist/gateway/config.js.map +1 -1
  422. package/dist/gateway/conversations.d.ts +14 -0
  423. package/dist/gateway/conversations.d.ts.map +1 -0
  424. package/dist/gateway/conversations.js +30 -0
  425. package/dist/gateway/conversations.js.map +1 -0
  426. package/dist/gateway/cron.d.ts +1 -1
  427. package/dist/gateway/cron.d.ts.map +1 -1
  428. package/dist/gateway/cron.js +2 -2
  429. package/dist/gateway/cron.js.map +1 -1
  430. package/dist/gateway/download.d.ts +2 -0
  431. package/dist/gateway/download.d.ts.map +1 -0
  432. package/dist/gateway/download.js +36 -0
  433. package/dist/gateway/download.js.map +1 -0
  434. package/dist/gateway/index.d.ts.map +1 -1
  435. package/dist/gateway/index.js +106 -47
  436. package/dist/gateway/index.js.map +1 -1
  437. package/dist/gateway/mobile-commands.d.ts +24 -0
  438. package/dist/gateway/mobile-commands.d.ts.map +1 -0
  439. package/dist/gateway/mobile-commands.js +423 -0
  440. package/dist/gateway/mobile-commands.js.map +1 -0
  441. package/dist/gateway/presenter.d.ts +27 -0
  442. package/dist/gateway/presenter.d.ts.map +1 -0
  443. package/dist/gateway/presenter.js +308 -0
  444. package/dist/gateway/presenter.js.map +1 -0
  445. package/dist/gateway/router.d.ts +6 -5
  446. package/dist/gateway/router.d.ts.map +1 -1
  447. package/dist/gateway/router.js +126 -43
  448. package/dist/gateway/router.js.map +1 -1
  449. package/dist/gateway/service.d.ts +46 -0
  450. package/dist/gateway/service.d.ts.map +1 -0
  451. package/dist/gateway/service.js +404 -0
  452. package/dist/gateway/service.js.map +1 -0
  453. package/dist/gateway/setup.d.ts +9 -0
  454. package/dist/gateway/setup.d.ts.map +1 -0
  455. package/dist/gateway/setup.js +202 -0
  456. package/dist/gateway/setup.js.map +1 -0
  457. package/dist/gateway/stream.d.ts +6 -5
  458. package/dist/gateway/stream.d.ts.map +1 -1
  459. package/dist/gateway/stream.js +24 -11
  460. package/dist/gateway/stream.js.map +1 -1
  461. package/dist/gateway/types.d.ts +4 -2
  462. package/dist/gateway/types.d.ts.map +1 -1
  463. package/dist/gateway/types.js.map +1 -1
  464. package/dist/index.d.ts +2 -0
  465. package/dist/index.d.ts.map +1 -1
  466. package/dist/index.js +2 -0
  467. package/dist/index.js.map +1 -1
  468. package/dist/main.d.ts.map +1 -1
  469. package/dist/main.js +3 -3
  470. package/dist/main.js.map +1 -1
  471. package/dist/modes/interactive/components/assistant-message.d.ts +19 -2
  472. package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
  473. package/dist/modes/interactive/components/assistant-message.js +90 -35
  474. package/dist/modes/interactive/components/assistant-message.js.map +1 -1
  475. package/dist/modes/interactive/components/copyable-text.d.ts +27 -0
  476. package/dist/modes/interactive/components/copyable-text.d.ts.map +1 -0
  477. package/dist/modes/interactive/components/copyable-text.js +156 -0
  478. package/dist/modes/interactive/components/copyable-text.js.map +1 -0
  479. package/dist/modes/interactive/components/custom-entry.d.ts +1 -0
  480. package/dist/modes/interactive/components/custom-entry.d.ts.map +1 -1
  481. package/dist/modes/interactive/components/custom-entry.js +8 -0
  482. package/dist/modes/interactive/components/custom-entry.js.map +1 -1
  483. package/dist/modes/interactive/components/custom-message.d.ts +1 -0
  484. package/dist/modes/interactive/components/custom-message.d.ts.map +1 -1
  485. package/dist/modes/interactive/components/custom-message.js +8 -0
  486. package/dist/modes/interactive/components/custom-message.js.map +1 -1
  487. package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
  488. package/dist/modes/interactive/components/session-selector.js +16 -0
  489. package/dist/modes/interactive/components/session-selector.js.map +1 -1
  490. package/dist/modes/interactive/components/settings-selector.d.ts +16 -1
  491. package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
  492. package/dist/modes/interactive/components/settings-selector.js +147 -4
  493. package/dist/modes/interactive/components/settings-selector.js.map +1 -1
  494. package/dist/modes/interactive/components/thinking-tail.d.ts +9 -2
  495. package/dist/modes/interactive/components/thinking-tail.d.ts.map +1 -1
  496. package/dist/modes/interactive/components/thinking-tail.js +43 -1
  497. package/dist/modes/interactive/components/thinking-tail.js.map +1 -1
  498. package/dist/modes/interactive/components/tool-execution.d.ts +5 -3
  499. package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  500. package/dist/modes/interactive/components/tool-execution.js +55 -44
  501. package/dist/modes/interactive/components/tool-execution.js.map +1 -1
  502. package/dist/modes/interactive/extension-widget-order.d.ts +8 -0
  503. package/dist/modes/interactive/extension-widget-order.d.ts.map +1 -0
  504. package/dist/modes/interactive/extension-widget-order.js +37 -0
  505. package/dist/modes/interactive/extension-widget-order.js.map +1 -0
  506. package/dist/modes/interactive/interactive-mode.d.ts +11 -2
  507. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  508. package/dist/modes/interactive/interactive-mode.js +386 -155
  509. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  510. package/dist/modes/interactive/theme/theme.d.ts +1 -0
  511. package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
  512. package/dist/modes/interactive/theme/theme.js +23 -0
  513. package/dist/modes/interactive/theme/theme.js.map +1 -1
  514. package/dist/node-runtime/agent-session-services-MQUPZSIN.js +51 -0
  515. package/dist/node-runtime/{builtin-extensions-7STLFW3A.js → builtin-extensions-4GNDR6U3.js} +8 -6
  516. package/dist/node-runtime/{chunk-LTXUQJI4.js → chunk-24C5IAJ4.js} +1 -6
  517. package/dist/node-runtime/chunk-2BLXLDJR.js +144 -0
  518. package/dist/node-runtime/{chunk-RQ5DNUNG.js → chunk-2CMV4L24.js} +21 -124
  519. package/dist/node-runtime/{chunk-OTT6JMPU.js → chunk-2MI5OPMN.js} +17 -370
  520. package/dist/node-runtime/{chunk-W3CVH5RX.js → chunk-2TKODGBZ.js} +11 -6
  521. package/dist/node-runtime/{chunk-K72NVGUB.js → chunk-33SIKK3Y.js} +38 -164
  522. package/dist/node-runtime/{chunk-GZQHMEWL.js → chunk-3DKIWPKN.js} +19 -4
  523. package/dist/node-runtime/{chunk-5OLJGVCB.js → chunk-3ONQTOMR.js} +2 -2
  524. package/dist/node-runtime/{chunk-3GHXVUAK.js → chunk-3VEY2IYY.js} +1 -1
  525. package/dist/node-runtime/chunk-4ER2ZV4Z.js +537 -0
  526. package/dist/node-runtime/chunk-4EULYYR4.js +62 -0
  527. package/dist/node-runtime/{chunk-BKAZ6BKX.js → chunk-4SBQAI4T.js} +31 -31
  528. package/dist/node-runtime/{chunk-W7S2REEG.js → chunk-53ARRUHA.js} +785 -285
  529. package/dist/node-runtime/{chunk-ZSEZY3II.js → chunk-5Q4A37RB.js} +10 -4
  530. package/dist/node-runtime/{chunk-SWSN6HAB.js → chunk-5UZOPGE3.js} +1 -1
  531. package/dist/node-runtime/{chunk-LCACDWHJ.js → chunk-5Z5PCXGY.js} +263 -222
  532. package/dist/node-runtime/chunk-5ZH3ZFIZ.js +308 -0
  533. package/dist/node-runtime/chunk-7JIYPIQU.js +356 -0
  534. package/dist/node-runtime/{chunk-ZRDIMBEQ.js → chunk-AJ6R5VTV.js} +66 -91
  535. package/dist/node-runtime/chunk-ATIF3RX5.js +352 -0
  536. package/dist/node-runtime/chunk-BBUVIEZB.js +51 -0
  537. package/dist/node-runtime/chunk-CCCN2UCX.js +14 -0
  538. package/dist/node-runtime/chunk-CJS4KQFI.js +3412 -0
  539. package/dist/node-runtime/chunk-DO6PALE2.js +205 -0
  540. package/dist/node-runtime/{chunk-MUMMMTW4.js → chunk-DRJI7ZSC.js} +572 -401
  541. package/dist/node-runtime/{chunk-6SPPH4FY.js → chunk-E75WFZ33.js} +4 -4
  542. package/dist/node-runtime/{chunk-MJQDX3BA.js → chunk-EBB4BJW4.js} +3 -3
  543. package/dist/node-runtime/{chunk-5NWQCSKR.js → chunk-EOEAQIJV.js} +70 -3
  544. package/dist/node-runtime/chunk-EOPL2HMM.js +117 -0
  545. package/dist/node-runtime/chunk-H4K3JDRB.js +47 -0
  546. package/dist/node-runtime/{chunk-HRS4HMDX.js → chunk-HT2XEJNP.js} +19 -3
  547. package/dist/node-runtime/chunk-IMLCWLPI.js +9 -0
  548. package/dist/node-runtime/{chunk-FLYMHKCS.js → chunk-JJWZB7S3.js} +60 -48
  549. package/dist/node-runtime/chunk-KFFOQR4G.js +672 -0
  550. package/dist/node-runtime/chunk-L5LZUGT7.js +40 -0
  551. package/dist/node-runtime/chunk-LV6CEFW2.js +97 -0
  552. package/dist/node-runtime/{chunk-EHMBW7FA.js → chunk-LWYIVUGV.js} +5 -4
  553. package/dist/node-runtime/{chunk-T5GM5BFH.js → chunk-MFV2LOOX.js} +186 -2194
  554. package/dist/node-runtime/{chunk-5SQDLSZJ.js → chunk-MNRO3UCV.js} +2 -2
  555. package/dist/node-runtime/{chunk-JHYKXIMM.js → chunk-MPKSOJBT.js} +1 -1
  556. package/dist/node-runtime/{chunk-C4O2RSQQ.js → chunk-N4TUWAGA.js} +1 -1
  557. package/dist/node-runtime/{chunk-4SJWFTUP.js → chunk-NAY6UUQZ.js} +1 -1
  558. package/dist/node-runtime/chunk-NKH2QBKF.js +773 -0
  559. package/dist/node-runtime/chunk-O2AT4MEU.js +124 -0
  560. package/dist/node-runtime/chunk-OAR4TYZE.js +146 -0
  561. package/dist/node-runtime/{chunk-DDGMHUOW.js → chunk-OGJN3OZV.js} +2 -1
  562. package/dist/node-runtime/{chunk-MX3GJNXJ.js → chunk-PLGA743X.js} +23 -0
  563. package/dist/node-runtime/chunk-Q3FEOEDA.js +1364 -0
  564. package/dist/node-runtime/chunk-QFADHUQV.js +74 -0
  565. package/dist/node-runtime/chunk-RBZQU6TJ.js +27 -0
  566. package/dist/node-runtime/{chunk-MGSB2C3M.js → chunk-RVOQBXTA.js} +10 -6
  567. package/dist/node-runtime/{chunk-ISQDQIZN.js → chunk-RW4PYFNE.js} +14 -94
  568. package/dist/node-runtime/chunk-TP7K7YWS.js +2830 -0
  569. package/dist/node-runtime/{chunk-TAP7QTUT.js → chunk-TVLBDVTR.js} +46 -436
  570. package/dist/node-runtime/chunk-UAEOTO52.js +119 -0
  571. package/dist/node-runtime/{chunk-MGWCVY6Y.js → chunk-UDKX3PFN.js} +3 -3
  572. package/dist/node-runtime/{chunk-AY6CAJSL.js → chunk-UJOCPOMX.js} +6 -3
  573. package/dist/node-runtime/{chunk-J7QGQD45.js → chunk-UQUCFAJ3.js} +1 -1
  574. package/dist/node-runtime/chunk-US544NN6.js +13 -0
  575. package/dist/node-runtime/{chunk-7AFOFSDY.js → chunk-V3HK3FE7.js} +1 -1
  576. package/dist/node-runtime/{chunk-6UB6NKA3.js → chunk-VIVYOI7C.js} +130 -27
  577. package/dist/node-runtime/{chunk-5Q45AVQG.js → chunk-XHIRAZ26.js} +1 -1
  578. package/dist/node-runtime/chunk-YPHAIRZT.js +10 -0
  579. package/dist/node-runtime/{chunk-3RCWXWAY.js → chunk-YRUY57IN.js} +1 -1
  580. package/dist/node-runtime/cli-runtime.js +2 -2
  581. package/dist/node-runtime/command-PYBNGLPP.js +45 -0
  582. package/dist/node-runtime/{commands-LGR5VT5X.js → commands-EMBQQVVT.js} +13 -13
  583. package/dist/node-runtime/commands-Y2OUC2T7.js +37 -0
  584. package/dist/node-runtime/config-7DYMNJUO.js +20 -0
  585. package/dist/node-runtime/{customize-XEXL2DGQ.js → customize-VFJV3U6A.js} +2 -1
  586. package/dist/node-runtime/{direct-tool-executor-TDJS7TBD.js → direct-tool-executor-4D7UXYU4.js} +10 -10
  587. package/dist/node-runtime/{export-html-E4DT6ZJQ.js → export-html-ETFOKW3M.js} +4 -3
  588. package/dist/node-runtime/{extension-input-RV5N6APL.js → extension-input-7QODTFAS.js} +4 -4
  589. package/dist/node-runtime/{extension-selector-CPD5LWDD.js → extension-selector-T65JEDJ5.js} +4 -4
  590. package/dist/node-runtime/{extract-IUCVZCWC.js → extract-EQJE7FZZ.js} +2 -2
  591. package/dist/node-runtime/gateway-QENRQA5X.js +1476 -0
  592. package/dist/node-runtime/{gemini-search-NCIDF7NE.js → gemini-search-35OCRFLN.js} +1 -1
  593. package/dist/node-runtime/{gemini-url-context-OKIN7AIP.js → gemini-url-context-UQY3PHHW.js} +2 -2
  594. package/dist/node-runtime/index.js +120 -77
  595. package/dist/node-runtime/{init-EKE277AG.js → init-P5AUV77I.js} +5 -5
  596. package/dist/node-runtime/{install-cli-TH7IJJQQ.js → install-cli-KHAXYBOO.js} +21 -82
  597. package/dist/node-runtime/interactive-mode-IN77GQGX.js +74 -0
  598. package/dist/node-runtime/{interactive-view-N6F4KUIT.js → interactive-view-OMWDFGUQ.js} +10 -10
  599. package/dist/node-runtime/lunr-browser-VVPRWC3F.js +174 -0
  600. package/dist/node-runtime/lunr-computer-use-IAUNXSXH.js +138 -0
  601. package/dist/node-runtime/{lunr-cron-KKBOGAEF.js → lunr-cron-P6ZJGVEF.js} +22 -8
  602. package/dist/node-runtime/main.js +50 -35
  603. package/dist/node-runtime/{mcp-auth-flow-YL6RWPYG.js → mcp-auth-flow-QVLFVLEO.js} +2 -2
  604. package/dist/node-runtime/{memory-cap-3S4XRLNP.js → memory-cap-EL3KL4JJ.js} +2 -1
  605. package/dist/node-runtime/mobile-commands-WKFSFACZ.js +33 -0
  606. package/dist/node-runtime/model-runtime-YXGJS5OJ.js +16 -0
  607. package/dist/node-runtime/{model-tiers-NJLHUEGK.js → model-tiers-OU3U5CZG.js} +2 -1
  608. package/dist/node-runtime/{package-manager-cli-C4EJOO5Q.js → package-manager-cli-J337RKTI.js} +28 -19
  609. package/dist/node-runtime/{pi-intercom-EEMBGQID.js → pi-intercom-QM53RLTS.js} +114 -88
  610. package/dist/node-runtime/{pi-mcp-adapter-DPTJGAAL.js → pi-mcp-adapter-3PHF4KZ4.js} +9 -8
  611. package/dist/node-runtime/{pi-subagents-VKCLYIBY.js → pi-subagents-RCHPB6UK.js} +1476 -646
  612. package/dist/node-runtime/{pi-web-access-BV6DSZOP.js → pi-web-access-PNG35XW7.js} +11 -11
  613. package/dist/node-runtime/process-registry-PVJ44F7H.js +31 -0
  614. package/dist/node-runtime/{proxy-modes-R64LU6WZ.js → proxy-modes-5FAPSZEZ.js} +14 -14
  615. package/dist/node-runtime/rpc-entry.js +50 -35
  616. package/dist/node-runtime/{rpc-mode-SJNSOA4G.js → rpc-mode-SH7VB4RH.js} +2 -2
  617. package/dist/node-runtime/runtime-4VA6JKNF.js +373 -0
  618. package/dist/node-runtime/runtime-bridges-3CQHWVVY.js +21 -0
  619. package/dist/node-runtime/service-HGGU3STY.js +36 -0
  620. package/dist/node-runtime/session-handoff-IAFIK7QP.js +33 -0
  621. package/dist/node-runtime/{session-manager-QEMZBMTM.js → session-manager-TCEFDKBL.js} +2 -1
  622. package/dist/node-runtime/{session-selector-URVJLOTK.js → session-selector-HG5J4BDZ.js} +5 -4
  623. package/dist/node-runtime/{settings-manager-K6IPIQTI.js → settings-manager-HIBIUNBK.js} +13 -5
  624. package/dist/node-runtime/setup-JBKOLJ6F.js +18 -0
  625. package/dist/node-runtime/setup-YU5LKRL3.js +215 -0
  626. package/dist/node-runtime/{subagent-executor-EFLTO32A.js → subagent-executor-2BH76MMS.js} +242 -314
  627. package/dist/node-runtime/theme-WTJWZSGD.js +68 -0
  628. package/dist/node-runtime/trust-manager-6ZQANSBX.js +17 -0
  629. package/dist/node-runtime/{update-cli-I6OVDRPL.js → update-cli-TVTPVUNM.js} +7 -3
  630. package/dist/node-runtime/usage-service-LFB2SWYV.js +37 -0
  631. package/dist/node-runtime/{video-extract-ETA5RA7U.js → video-extract-OOZHR7SU.js} +2 -2
  632. package/dist/node-runtime/workflow-TVJNKKQP.js +509 -0
  633. package/dist/node-runtime/{youtube-extract-SRVGNN26.js → youtube-extract-FNPAUNHU.js} +6 -6
  634. package/dist/startup/interactive-view.d.ts.map +1 -1
  635. package/dist/startup/interactive-view.js +5 -1
  636. package/dist/startup/interactive-view.js.map +1 -1
  637. package/dist/utils/image-resize-core.d.ts +2 -0
  638. package/dist/utils/image-resize-core.d.ts.map +1 -1
  639. package/dist/utils/image-resize-core.js +10 -0
  640. package/dist/utils/image-resize-core.js.map +1 -1
  641. package/docs/browser.md +86 -0
  642. package/docs/computer-use.md +319 -268
  643. package/docs/extensions.md +2 -0
  644. package/docs/features.md +129 -30
  645. package/docs/index.md +1 -1
  646. package/docs/interactive-startup.md +2 -1
  647. package/docs/keybindings.md +4 -2
  648. package/docs/providers.md +6 -2
  649. package/docs/quickstart.md +2 -2
  650. package/docs/sessions.md +10 -0
  651. package/docs/settings.md +6 -3
  652. package/docs/tui.md +2 -0
  653. package/docs/usage.md +20 -4
  654. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  655. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  656. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  657. package/examples/extensions/gondolin/package-lock.json +2 -2
  658. package/examples/extensions/gondolin/package.json +1 -1
  659. package/examples/extensions/plan-mode/README.md +1 -1
  660. package/examples/extensions/sandbox/package-lock.json +2 -2
  661. package/examples/extensions/sandbox/package.json +1 -1
  662. package/examples/extensions/with-deps/package-lock.json +2 -2
  663. package/examples/extensions/with-deps/package.json +1 -1
  664. package/install-lock/package-lock.json +39 -25
  665. package/install-lock/package.json +2 -2
  666. package/npm-shrinkwrap.json +36 -22
  667. package/package.json +10 -7
  668. package/scripts/install-browser.mjs +20 -0
  669. package/dist/builtin-extensions/lunr-settings-tools.d.ts +0 -4
  670. package/dist/builtin-extensions/lunr-settings-tools.d.ts.map +0 -1
  671. package/dist/builtin-extensions/lunr-settings-tools.js +0 -120
  672. package/dist/builtin-extensions/lunr-settings-tools.js.map +0 -1
  673. package/dist/core/settings-tools-bridge.d.ts +0 -35
  674. package/dist/core/settings-tools-bridge.d.ts.map +0 -1
  675. package/dist/core/settings-tools-bridge.js +0 -56
  676. package/dist/core/settings-tools-bridge.js.map +0 -1
  677. package/dist/node-runtime/agent-session-services-RSGP5GDN.js +0 -39
  678. package/dist/node-runtime/chunk-EH2LJQPM.js +0 -64
  679. package/dist/node-runtime/chunk-HQCKFM2O.js +0 -56
  680. package/dist/node-runtime/chunk-JT6YCS5B.js +0 -5648
  681. package/dist/node-runtime/command-6UXQ6XZN.js +0 -13
  682. package/dist/node-runtime/gateway-3OLC4GQN.js +0 -2139
  683. package/dist/node-runtime/image-resize-6ZPBFMWW.js +0 -11
  684. package/dist/node-runtime/interactive-mode-S5M26CQ7.js +0 -59
  685. package/dist/node-runtime/lunr-computer-use-4X3KUNF4.js +0 -206
  686. package/dist/node-runtime/runtime-bridges-UJ5WJJLN.js +0 -14
  687. package/dist/node-runtime/workflow-SA34S4VX.js +0 -325
  688. package/dist/node-runtime/{chunk-U6C7VTR5.js → chunk-7IQGBKBJ.js} +3 -3
  689. package/dist/node-runtime/{mcp-panel-IIGMXQGP.js → mcp-panel-KTTFXJZ4.js} +3 -3
  690. package/dist/node-runtime/{src-GPFAU3N6.js → src-IVPNZ2BX.js} +6 -6
@@ -3,9 +3,12 @@ import {
3
3
  checkForUpdate,
4
4
  markUpdateNotified
5
5
  } from "./chunk-BR7YDUKA.js";
6
+ import {
7
+ getSubagentSpinnerDefinition
8
+ } from "./chunk-US544NN6.js";
6
9
  import {
7
10
  computeContextBreakdown
8
- } from "./chunk-7AFOFSDY.js";
11
+ } from "./chunk-V3HK3FE7.js";
9
12
  import {
10
13
  copyToClipboard,
11
14
  readClipboardText
@@ -17,52 +20,44 @@ import {
17
20
  import {
18
21
  BootScreenComponent,
19
22
  registerPermissionModeBridge
20
- } from "./chunk-SWSN6HAB.js";
23
+ } from "./chunk-5UZOPGE3.js";
21
24
  import {
22
25
  nextModeForGoal,
23
26
  registerPermissionModeControlBridge
24
27
  } from "./chunk-7N3YHTYF.js";
25
28
  import {
26
- ProjectTrustStore,
27
- areExperimentalFeaturesEnabled,
28
- getProjectTrustOptions,
29
- hasTrustRequiringProjectResources
30
- } from "./chunk-LTXUQJI4.js";
29
+ areExperimentalFeaturesEnabled
30
+ } from "./chunk-YPHAIRZT.js";
31
31
  import {
32
32
  MissingSessionCwdError,
33
33
  SessionImportFileNotFoundError,
34
- formatCatalogRefreshSummary,
34
+ beginTurn,
35
+ captureTreeChanges,
36
+ clearRollback,
37
+ disableRollbackForSession,
38
+ enableRollbackForSession,
35
39
  formatMissingSessionCwdPrompt,
36
- hasGrokCliXaiAuth,
40
+ initRollback,
41
+ isRollbackEnabled,
42
+ isRollbackSessionForceEnabled,
43
+ migrateRollbackSession,
37
44
  parseSkillBlock,
38
- refreshModelCandidatesForInit,
39
- stripJsonComments
40
- } from "./chunk-JT6YCS5B.js";
45
+ peekRollbackTurnsConsumed,
46
+ rollbackLastTurn,
47
+ setRollbackWarningHandler
48
+ } from "./chunk-CJS4KQFI.js";
41
49
  import {
42
- parseGitUrl
43
- } from "./chunk-T5GM5BFH.js";
50
+ notifyTodosEnabledChanged
51
+ } from "./chunk-CCCN2UCX.js";
44
52
  import {
45
- computeFileLists,
46
- createFileOps,
47
- defaultModelPerProvider,
48
- extractFileOpsFromMessage,
49
- findExactModelReferenceMatch,
50
- resolveModelScope
51
- } from "./chunk-5SQDLSZJ.js";
53
+ parseGitUrl
54
+ } from "./chunk-MFV2LOOX.js";
52
55
  import {
53
- clearRegistry,
54
56
  createAllToolDefinitions,
55
57
  ensureTool,
56
58
  getToolPath,
57
- isWindows,
58
- kill,
59
- killAll,
60
- list,
61
- pause,
62
- restart,
63
- resume,
64
59
  truncateToVisualLines
65
- } from "./chunk-K72NVGUB.js";
60
+ } from "./chunk-33SIKK3Y.js";
66
61
  import {
67
62
  DEFAULT_MAX_BYTES,
68
63
  DEFAULT_MAX_LINES,
@@ -75,102 +70,132 @@ import {
75
70
  toolGroupRole,
76
71
  toolGroupTree,
77
72
  toolStatusDot
78
- } from "./chunk-GZQHMEWL.js";
79
- import {
80
- killTrackedDetachedChildren
81
- } from "./chunk-ZCHMJ34K.js";
73
+ } from "./chunk-3DKIWPKN.js";
82
74
  import {
83
75
  convertToPng,
84
76
  processImage
85
- } from "./chunk-5Q45AVQG.js";
77
+ } from "./chunk-XHIRAZ26.js";
78
+ import {
79
+ formatCatalogRefreshSummary,
80
+ hasGrokCliXaiAuth,
81
+ refreshModelCandidatesForInit,
82
+ stripJsonComments
83
+ } from "./chunk-TP7K7YWS.js";
84
+ import {
85
+ HTTP_IDLE_TIMEOUT_CHOICES,
86
+ SKILL_TAG_CHARACTERS,
87
+ SUBAGENT_SPINNER_LABELS,
88
+ SUBAGENT_SPINNER_NAMES,
89
+ configureHttpDispatcher,
90
+ formatHttpIdleTimeoutMs
91
+ } from "./chunk-EOEAQIJV.js";
92
+ import {
93
+ ProjectTrustStore,
94
+ getProjectTrustOptions,
95
+ hasTrustRequiringProjectResources
96
+ } from "./chunk-24C5IAJ4.js";
97
+ import {
98
+ computeFileLists,
99
+ createFileOps,
100
+ defaultModelPerProvider,
101
+ extractFileOpsFromMessage,
102
+ findExactModelReferenceMatch,
103
+ resolveModelScope
104
+ } from "./chunk-MNRO3UCV.js";
105
+ import {
106
+ SubagentEscapeSequence,
107
+ getSubagentCancellation
108
+ } from "./chunk-BBUVIEZB.js";
86
109
  import {
87
110
  AUTO_MODE_ADDENDUM,
88
- PLAN_MODE_ADDENDUM,
111
+ READ_ONLY_MODE_ADDENDUM,
89
112
  getPermissionMode,
90
113
  nextPermissionMode,
91
114
  registerApprovalHandler,
92
115
  resetPermissions,
93
116
  restorePermissionModeAfterPlan,
94
117
  setPermissionMode
95
- } from "./chunk-ZRDIMBEQ.js";
118
+ } from "./chunk-AJ6R5VTV.js";
96
119
  import {
97
120
  getGlobalInstructionsPath,
98
121
  getModelInstructionsPath
99
122
  } from "./chunk-M3LZLQW2.js";
100
123
  import {
101
- HTTP_IDLE_TIMEOUT_CHOICES,
102
- SKILL_TAG_CHARACTERS,
103
- configureHttpDispatcher,
104
- formatHttpIdleTimeoutMs
105
- } from "./chunk-5NWQCSKR.js";
124
+ clearRegistry,
125
+ isWindows,
126
+ kill,
127
+ killAll,
128
+ list,
129
+ pause,
130
+ restart,
131
+ resume
132
+ } from "./chunk-2BLXLDJR.js";
133
+ import {
134
+ killTrackedDetachedChildren
135
+ } from "./chunk-ZCHMJ34K.js";
136
+ import {
137
+ cancelSessionHandoff,
138
+ markSessionHandoff,
139
+ recordTuiActivity,
140
+ registerTransferHandler,
141
+ requestSessionTransfer
142
+ } from "./chunk-DO6PALE2.js";
106
143
  import {
107
144
  SessionManager,
108
145
  sessionEntryToContextMessages
109
- } from "./chunk-6UB6NKA3.js";
146
+ } from "./chunk-VIVYOI7C.js";
110
147
  import {
111
148
  createCompactionSummaryMessage
112
149
  } from "./chunk-FVDOXRUD.js";
113
150
  import {
114
- getModelTiersBridge
115
- } from "./chunk-W3CVH5RX.js";
116
- import {
117
- beginTurn,
118
- captureTreeChanges,
119
- clearRollback,
120
- disableRollbackForSession,
121
- enableRollbackForSession,
122
- getAllPlanUsageResults,
123
- getUsageServiceBridge,
124
- initRollback,
125
- isRollbackEnabled,
126
- isRollbackSessionForceEnabled,
127
- migrateRollbackSession,
128
- peekRollbackTurnsConsumed,
129
- rollbackLastTurn,
130
- setRollbackWarningHandler
131
- } from "./chunk-OTT6JMPU.js";
151
+ getCustomizeBridge
152
+ } from "./chunk-4EULYYR4.js";
132
153
  import {
133
154
  MEMORY_CHAR_CAP_DEFAULT,
134
155
  MEMORY_CHAR_CAP_MAX,
135
156
  MEMORY_CHAR_CAP_MIN
136
- } from "./chunk-AY6CAJSL.js";
157
+ } from "./chunk-UJOCPOMX.js";
158
+ import {
159
+ getModelTiersBridge
160
+ } from "./chunk-2TKODGBZ.js";
161
+ import {
162
+ getAllPlanUsageResults,
163
+ getUsageServiceBridge
164
+ } from "./chunk-2MI5OPMN.js";
165
+ import {
166
+ SessionSelectorComponent
167
+ } from "./chunk-HT2XEJNP.js";
137
168
  import {
138
169
  CustomEditor
139
170
  } from "./chunk-H2EOZYMP.js";
171
+ import {
172
+ KeybindingsManager
173
+ } from "./chunk-CH6OL6P2.js";
140
174
  import {
141
175
  time
142
176
  } from "./chunk-PVCDKGR6.js";
143
- import {
144
- getCustomizeBridge
145
- } from "./chunk-HQCKFM2O.js";
146
177
  import {
147
178
  markStartupMilestone
148
179
  } from "./chunk-CCZJ3PYY.js";
149
180
  import {
150
181
  ExtensionSelectorComponent
151
- } from "./chunk-MJQDX3BA.js";
182
+ } from "./chunk-EBB4BJW4.js";
152
183
  import {
153
184
  ExtensionInputComponent
154
- } from "./chunk-MGWCVY6Y.js";
185
+ } from "./chunk-UDKX3PFN.js";
155
186
  import {
156
187
  CountdownTimer
157
188
  } from "./chunk-I6R76AG7.js";
158
- import {
159
- SessionSelectorComponent
160
- } from "./chunk-HRS4HMDX.js";
161
- import {
162
- KeybindingsManager
163
- } from "./chunk-CH6OL6P2.js";
164
189
  import {
165
190
  DynamicBorder
166
- } from "./chunk-3GHXVUAK.js";
191
+ } from "./chunk-3VEY2IYY.js";
167
192
  import {
168
193
  formatKeyText,
169
194
  keyDisplayText,
170
195
  keyHint,
171
196
  keyText,
172
197
  rawKeyHint
173
- } from "./chunk-C4O2RSQQ.js";
198
+ } from "./chunk-N4TUWAGA.js";
174
199
  import {
175
200
  FS_WATCH_RETRY_DELAY_MS,
176
201
  Theme,
@@ -196,7 +221,7 @@ import {
196
221
  stopThemeWatcher,
197
222
  theme,
198
223
  watchWithErrorHandler
199
- } from "./chunk-MX3GJNXJ.js";
224
+ } from "./chunk-PLGA743X.js";
200
225
  import {
201
226
  APP_NAME,
202
227
  APP_TITLE,
@@ -218,7 +243,7 @@ import * as fs2 from "node:fs";
218
243
  import * as os2 from "node:os";
219
244
  import * as path2 from "node:path";
220
245
  import { getSupportedThinkingLevels } from "@ashx-j/lunr-ai/compat";
221
- import { CombinedAutocompleteProvider, Container as Container19, collectImageMarkerIds, formatImageMarker, fuzzyFilter as fuzzyFilter5, isFocusable, Markdown as Markdown10, matchesKey as matchesKey2, ProcessTerminal, Spacer as Spacer19, setKeybindings, Text as Text21, TruncatedText as TruncatedText2, TUI, visibleWidth as visibleWidth4 } from "@ashx-j/lunr-tui";
246
+ import { CombinedAutocompleteProvider, Container as Container19, collectImageMarkerIds, formatImageMarker, fuzzyFilter as fuzzyFilter5, isFocusable, Markdown as Markdown10, matchesKey as matchesKey2, ProcessTerminal, Spacer as Spacer19, setKeybindings, Text as Text21, TruncatedText as TruncatedText2, TUI, visibleWidth as visibleWidth6 } from "@ashx-j/lunr-tui";
222
247
  import chalk from "chalk";
223
248
  import { spawn as spawn3, spawnSync } from "child_process";
224
249
 
@@ -682,15 +707,15 @@ var BUILTIN_SLASH_COMMANDS = [
682
707
  { name: "context", description: "Show estimated context window breakdown" },
683
708
  {
684
709
  name: "plan",
685
- description: "Switch to plan permission mode, or /plan <task> to plan a task",
710
+ description: "Use read-only mode to plan a task, or /plan <task> to start planning",
686
711
  argumentHint: "[on|off|status|<task>]"
687
712
  },
688
713
  {
689
714
  name: "mode",
690
- description: "Set permission mode: manual, yolo, plan, or auto",
691
- argumentHint: "[manual|yolo|plan|auto]"
715
+ description: "Set permission mode: yolo, auto, or read",
716
+ argumentHint: "[yolo|auto|read]"
692
717
  },
693
- { name: "manual", description: "Activate manual permission mode (approve every action)" },
718
+ { name: "read", description: "Activate read-only permission mode" },
694
719
  { name: "yolo", description: "Activate YOLO permission mode (auto-approve tools)" },
695
720
  { name: "auto", description: "Activate auto permission mode (fully autonomous, no questions)" },
696
721
  { name: "processes", description: "View and manage background processes started this session" },
@@ -710,6 +735,8 @@ var BUILTIN_SLASH_COMMANDS = [
710
735
  { name: "new", description: "Start a new session" },
711
736
  { name: "init", description: "Generate a starter AGENTS.md for this project" },
712
737
  { name: "compact", description: "Manually compact the session context" },
738
+ { name: "handoff", description: "Mark this saved session for phone continuation for 8 hours, or cancel" },
739
+ { name: "reclaim", description: "Reclaim this session after its remote owner releases it" },
713
740
  { name: "resume", description: "Resume a different session" },
714
741
  { name: "sessions", description: "Browse and resume sessions" },
715
742
  { name: "reload", description: "Reload keybindings, extensions, skills, prompts, themes, and context files" },
@@ -1088,6 +1115,114 @@ var ArminComponent = class {
1088
1115
  // packages/coding-agent/dist/modes/interactive/components/assistant-message.js
1089
1116
  import { Container, Markdown as Markdown2, Spacer, Text } from "@ashx-j/lunr-tui";
1090
1117
 
1118
+ // packages/coding-agent/dist/modes/interactive/components/copyable-text.js
1119
+ import { truncateToWidth, visibleWidth, wrapTextWithAnsi } from "@ashx-j/lunr-tui";
1120
+ function sourceLines(source) {
1121
+ let lines = [], pattern = /([^\r\n]*)(\r\n|\r|\n|$)/g;
1122
+ for (let match of source.matchAll(pattern)) {
1123
+ let start = match.index, text = match[1], newline = match[2];
1124
+ if (lines.push({ start, end: start + text.length + newline.length, text }), !newline)
1125
+ break;
1126
+ }
1127
+ return lines;
1128
+ }
1129
+ function parseFenceOpening(line) {
1130
+ let match = /^( {0,3})(`{3,}|~{3,})(.*)$/.exec(line);
1131
+ if (!match)
1132
+ return;
1133
+ let fence = match[2], info = match[3];
1134
+ if (!(fence[0] === "`" && info.includes("`")))
1135
+ return {
1136
+ marker: fence[0],
1137
+ length: fence.length,
1138
+ copyable: info.trim() === "lunr-copy"
1139
+ };
1140
+ }
1141
+ function isFenceClosing(line, opening) {
1142
+ let match = /^( {0,3})(`+|~+)[ \t]*$/.exec(line);
1143
+ if (!match)
1144
+ return !1;
1145
+ let fence = match[2];
1146
+ return fence[0] === opening.marker && fence.length >= opening.length;
1147
+ }
1148
+ function payloadEndBeforeClosing(source, closingStart) {
1149
+ return closingStart >= 2 && source.slice(closingStart - 2, closingStart) === `\r
1150
+ ` ? closingStart - 2 : closingStart >= 1 && (source[closingStart - 1] === `
1151
+ ` || source[closingStart - 1] === "\r") ? closingStart - 1 : closingStart;
1152
+ }
1153
+ function parseCopyableTextSegments(source) {
1154
+ let lines = sourceLines(source), segments = [], emittedThrough = 0, lineIndex = 0;
1155
+ for (; lineIndex < lines.length; ) {
1156
+ let openingLine = lines[lineIndex], opening = parseFenceOpening(openingLine.text);
1157
+ if (!opening) {
1158
+ lineIndex++;
1159
+ continue;
1160
+ }
1161
+ let closingIndex = -1;
1162
+ for (let i = lineIndex + 1; i < lines.length; i++)
1163
+ if (isFenceClosing(lines[i].text, opening)) {
1164
+ closingIndex = i;
1165
+ break;
1166
+ }
1167
+ if (!opening.copyable) {
1168
+ if (closingIndex < 0)
1169
+ break;
1170
+ lineIndex = closingIndex + 1;
1171
+ continue;
1172
+ }
1173
+ openingLine.start > emittedThrough && segments.push({ type: "markdown", text: source.slice(emittedThrough, openingLine.start) });
1174
+ let payloadStart = openingLine.end;
1175
+ if (closingIndex < 0)
1176
+ return segments.push({
1177
+ type: "copyable",
1178
+ payload: source.slice(payloadStart),
1179
+ complete: !1,
1180
+ start: openingLine.start
1181
+ }), segments;
1182
+ let closingLine = lines[closingIndex];
1183
+ segments.push({
1184
+ type: "copyable",
1185
+ payload: source.slice(payloadStart, payloadEndBeforeClosing(source, closingLine.start)),
1186
+ complete: !0,
1187
+ start: openingLine.start
1188
+ }), emittedThrough = closingLine.end, lineIndex = closingIndex + 1;
1189
+ }
1190
+ return emittedThrough < source.length && segments.push({ type: "markdown", text: source.slice(emittedThrough) }), segments;
1191
+ }
1192
+ var CopyableTextBlockComponent = class {
1193
+ renderedRows = 0;
1194
+ payload;
1195
+ complete;
1196
+ outputPad;
1197
+ status;
1198
+ onCopy;
1199
+ constructor(payload, complete, outputPad, status, onCopy) {
1200
+ this.payload = payload, this.complete = complete, this.outputPad = outputPad, this.status = status, this.onCopy = onCopy;
1201
+ }
1202
+ invalidate() {
1203
+ this.renderedRows = 0;
1204
+ }
1205
+ render(width) {
1206
+ if (width <= 0)
1207
+ return this.renderedRows = 0, [];
1208
+ let horizontalPad = Math.min(this.outputPad, Math.max(0, width - 1)), pad = " ".repeat(horizontalPad), contentWidth = Math.max(1, width - horizontalPad * 2), paint = (content) => {
1209
+ let line = truncateToWidth(`${pad}${content}`, width, "");
1210
+ return theme.bg("userMessageBg", `${line}${" ".repeat(Math.max(0, width - visibleWidth(line)))}`);
1211
+ }, lines = [paint("")], payloadLines = this.payload.replace(/\t/g, " ").split(`
1212
+ `);
1213
+ for (let payloadLine of payloadLines)
1214
+ for (let wrappedLine of wrapTextWithAnsi(payloadLine, contentWidth))
1215
+ lines.push(paint(theme.fg("userMessageText", wrappedLine)));
1216
+ if (typeof this.status == "object")
1217
+ for (let wrappedLine of wrapTextWithAnsi(`Copy failed: ${this.status.error}`, contentWidth))
1218
+ lines.push(paint(theme.fg("error", wrappedLine)));
1219
+ return lines.push(paint("")), this.renderedRows = lines.length, lines;
1220
+ }
1221
+ handleClick(localY, width, localX) {
1222
+ return this.render(width), !this.complete || this.status === "copying" || localY < 0 || localY >= this.renderedRows || localX !== void 0 && (localX < 0 || localX >= width) ? !1 : (this.onCopy(), !0);
1223
+ }
1224
+ };
1225
+
1091
1226
  // packages/coding-agent/dist/modes/interactive/components/thinking-summary.js
1092
1227
  var LEADING_MARKDOWN_RE = /^[#*`>\-\s]+/;
1093
1228
  function thinkingSnippet(joinedThinking, maxLen = 120) {
@@ -1134,7 +1269,7 @@ function isThinkingRunComplete(_hasFollowingBlock, timing, timingsAttached) {
1134
1269
  }
1135
1270
 
1136
1271
  // packages/coding-agent/dist/modes/interactive/components/thinking-tail.js
1137
- import { Markdown } from "@ashx-j/lunr-tui";
1272
+ import { Markdown, truncateToWidth as truncateToWidth2, visibleWidth as visibleWidth2 } from "@ashx-j/lunr-tui";
1138
1273
  var THINKING_TAIL_LINES = 4, ThinkingTailComponent = class {
1139
1274
  markdown;
1140
1275
  maxLines;
@@ -1148,6 +1283,28 @@ var THINKING_TAIL_LINES = 4, ThinkingTailComponent = class {
1148
1283
  let lines = this.markdown.render(width);
1149
1284
  return lines.length <= this.maxLines ? lines : lines.slice(-this.maxLines);
1150
1285
  }
1286
+ }, shimmerSegmenter = new Intl.Segmenter(void 0, { granularity: "grapheme" }), SHIMMER_PERIOD_MS = 2800, ThinkingLineComponent = class extends ThinkingTailComponent {
1287
+ startedAt;
1288
+ palette = theme.getFgGradient("thinkingText", "white", 32);
1289
+ constructor(text, paddingX, markdownTheme, startedAt) {
1290
+ super(text, paddingX, 0, markdownTheme), this.startedAt = startedAt;
1291
+ }
1292
+ invalidate() {
1293
+ super.invalidate(), this.palette = theme.getFgGradient("thinkingText", "white", 32);
1294
+ }
1295
+ render(width) {
1296
+ if (width <= 0)
1297
+ return ["", ""];
1298
+ let lines = this.markdown.render(width), latest = "";
1299
+ for (let index = lines.length - 1; index >= 0 && (latest = stripAnsi(lines[index]).trimEnd(), !latest.trim()); index--)
1300
+ ;
1301
+ let text = stripAnsi(truncateToWidth2(latest, width, "")), length = visibleWidth2(text), band = Math.max(6, Math.min(18, length * 0.3)), progress = (performance.now() - this.startedAt) % SHIMMER_PERIOD_MS / SHIMMER_PERIOD_MS, center = -band + progress * (length + band * 2), column = 0, highlighted = "";
1302
+ for (let { segment } of shimmerSegmenter.segment(text)) {
1303
+ let cells = visibleWidth2(segment), distance = Math.abs(column + cells / 2 - center) / band, intensity = distance >= 1 ? 0 : (1 + Math.cos(Math.PI * distance)) / 2;
1304
+ highlighted += this.palette[Math.round(intensity * (this.palette.length - 1))] + segment, column += cells;
1305
+ }
1306
+ return ["", `\x1B[3m${highlighted}\x1B[23m\x1B[39m`];
1307
+ }
1151
1308
  };
1152
1309
 
1153
1310
  // packages/coding-agent/dist/modes/interactive/components/assistant-message.js
@@ -1172,12 +1329,23 @@ var OSC133_ZONE_START = "\x1B]133;A\x07", OSC133_ZONE_END = "\x1B]133;B\x07", OS
1172
1329
  lastMessage;
1173
1330
  thinkingSource;
1174
1331
  hasToolCalls = !1;
1175
- constructor(message, hideThinkingBlock = !1, markdownTheme = getMarkdownTheme(), hiddenThinkingLabel = "Thinking...", outputPad = 1, thinkingCollapse = !1) {
1176
- super(), this.hideThinkingBlock = hideThinkingBlock, this.thinkingCollapse = thinkingCollapse, this.markdownTheme = markdownTheme, this.hiddenThinkingLabel = hiddenThinkingLabel, this.outputPad = outputPad, this.contentContainer = new Container(), this.addChild(this.contentContainer), message && this.updateContent(message);
1332
+ copyText;
1333
+ requestRender;
1334
+ copyStates = /* @__PURE__ */ new Map();
1335
+ reasoningDisplay;
1336
+ onThinkingAnimationChange;
1337
+ thinkingAnimationStart = performance.now();
1338
+ thinkingAnimationActive = !1;
1339
+ constructor(message, hideThinkingBlock = !1, markdownTheme = getMarkdownTheme(), hiddenThinkingLabel = "Thinking...", outputPad = 1, thinkingCollapse = !1, options = {}) {
1340
+ super(), this.hideThinkingBlock = hideThinkingBlock, this.thinkingCollapse = thinkingCollapse, this.markdownTheme = markdownTheme, this.hiddenThinkingLabel = hiddenThinkingLabel, this.outputPad = outputPad, this.copyText = options.copyText ?? copyToClipboard, this.requestRender = options.requestRender ?? (() => {
1341
+ }), this.reasoningDisplay = options.reasoningDisplay ?? "auto", this.onThinkingAnimationChange = options.onThinkingAnimationChange, this.contentContainer = new Container(), this.addChild(this.contentContainer), message && this.updateContent(message);
1177
1342
  }
1178
1343
  invalidate() {
1179
1344
  super.invalidate(), this.lastMessage && this.updateContent(this.lastMessage, this.thinkingSourceOptions());
1180
1345
  }
1346
+ setReasoningDisplay(display) {
1347
+ this.reasoningDisplay = display, this.lastMessage && this.updateContent(this.lastMessage, this.thinkingSourceOptions());
1348
+ }
1181
1349
  setHideThinkingBlock(hide) {
1182
1350
  this.hideThinkingBlock = hide, this.lastMessage && this.updateContent(this.lastMessage, this.thinkingSourceOptions());
1183
1351
  }
@@ -1201,12 +1369,12 @@ var OSC133_ZONE_START = "\x1B]133;A\x07", OSC133_ZONE_END = "\x1B]133;B\x07", OS
1201
1369
  } else this.expandedRuns.has(runIndex) ? this.expandedRuns.delete(runIndex) : this.expandedRuns.add(runIndex);
1202
1370
  this.lastMessage && this.updateContent(this.lastMessage, this.thinkingSourceOptions());
1203
1371
  }
1204
- handleClick(localY, width) {
1372
+ handleClick(localY, width, localX) {
1205
1373
  let contentWidth = width, y = 0;
1206
1374
  for (let child of this.contentContainer.children) {
1207
1375
  let h = child.render(contentWidth).length;
1208
1376
  if (localY >= y && localY < y + h)
1209
- return typeof child.handleClick == "function" ? child.handleClick(localY - y, contentWidth) : !1;
1377
+ return typeof child.handleClick == "function" ? child.handleClick(localY - y, contentWidth, localX) : !1;
1210
1378
  y += h;
1211
1379
  }
1212
1380
  return !1;
@@ -1228,18 +1396,28 @@ var OSC133_ZONE_START = "\x1B]133;A\x07", OSC133_ZONE_END = "\x1B]133;B\x07", OS
1228
1396
  return this.thinkingSource ? { thinkingSource: this.thinkingSource } : void 0;
1229
1397
  }
1230
1398
  updateContent(message, options) {
1231
- this.lastMessage = message, this.thinkingSource = options?.thinkingSource, this.contentContainer.clear();
1399
+ this.lastMessage = message, this.thinkingSource = options?.thinkingSource, this.thinkingAnimationActive = !1, this.contentContainer.clear();
1232
1400
  let sourceMessage = this.thinkingSource ?? message, sourceThinkingRuns = collectThinkingRuns(sourceMessage.content);
1233
- (message.content.some((c) => c.type === "text" && c.text.trim() || c.type === "thinking" && c.thinking.trim()) || !this.hideThinkingBlock && sourceThinkingRuns.some((run) => run.length > 0)) && this.contentContainer.addChild(new Spacer(1));
1234
- let isFirstTextBlock = !0, thinkingRunIndex = -1, renderedThinking = !1;
1401
+ message.content.some((c) => c.type === "text" && c.text.trim() || !this.hideThinkingBlock && c.type === "thinking" && c.thinking.trim()) && this.contentContainer.addChild(new Spacer(1));
1402
+ let isFirstTextBlock = !0, thinkingRunIndex = -1;
1235
1403
  for (let i = 0; i < message.content.length; i++) {
1236
1404
  let content = message.content[i];
1237
- if (content.type === "text" && content.text.trim()) {
1238
- let trimmed = content.text.trim(), text = isFirstTextBlock ? `\u25CF ${trimmed}` : trimmed;
1239
- isFirstTextBlock = !1, this.contentContainer.addChild(new Markdown2(text, this.outputPad, 0, this.markdownTheme, {
1240
- color: (body) => theme.fg("userMessageText", body)
1241
- }));
1242
- } else if (content.type === "thinking") {
1405
+ if (content.type === "text" && content.text.trim())
1406
+ for (let segment of parseCopyableTextSegments(content.text)) {
1407
+ if (segment.type === "markdown") {
1408
+ let trimmed = segment.text.trim();
1409
+ if (!trimmed)
1410
+ continue;
1411
+ let text = isFirstTextBlock ? `\u25CF ${trimmed}` : trimmed;
1412
+ isFirstTextBlock = !1, this.contentContainer.addChild(new Markdown2(text, this.outputPad, 0, this.markdownTheme, {
1413
+ color: (body) => theme.fg("userMessageText", body)
1414
+ }));
1415
+ continue;
1416
+ }
1417
+ let key = `${i}:${segment.start}`, copyState = this.copyStates.get(key), status = copyState?.payload === segment.payload ? copyState.status : "idle";
1418
+ copyState && copyState.payload !== segment.payload && this.copyStates.delete(key), this.contentContainer.addChild(new CopyableTextBlockComponent(segment.payload, segment.complete, this.outputPad, status, () => this.copyPayload(key, segment.payload)));
1419
+ }
1420
+ else if (content.type === "thinking") {
1243
1421
  thinkingRunIndex++;
1244
1422
  let displayBlocks = [];
1245
1423
  for (; i < message.content.length; i++) {
@@ -1249,18 +1427,12 @@ var OSC133_ZONE_START = "\x1B]133;A\x07", OSC133_ZONE_END = "\x1B]133;B\x07", OS
1249
1427
  let thinking = thinkingContent.thinking.trim();
1250
1428
  thinking && displayBlocks.push(thinking);
1251
1429
  }
1252
- i--;
1253
- let thinkingBlocks = sourceThinkingRuns[thinkingRunIndex] ?? displayBlocks;
1254
- if (thinkingBlocks.length === 0 || this.hideThinkingBlock)
1430
+ if (i--, displayBlocks.length === 0 || this.hideThinkingBlock)
1255
1431
  continue;
1256
- renderedThinking = !0, this.renderThinkingRun(thinkingRunIndex, thinkingBlocks, message, i);
1432
+ let sourceBlocks = sourceThinkingRuns[thinkingRunIndex] ?? [], fullyRevealed = displayBlocks.length === sourceBlocks.length && displayBlocks.every((block, index) => block === sourceBlocks[index]);
1433
+ this.renderThinkingRun(thinkingRunIndex, displayBlocks, message, i, fullyRevealed);
1257
1434
  }
1258
1435
  }
1259
- if (!this.hideThinkingBlock && !renderedThinking && sourceThinkingRuns.length > 0) {
1260
- thinkingRunIndex = 0;
1261
- let thinkingBlocks = sourceThinkingRuns[0] ?? [];
1262
- thinkingBlocks.length > 0 && this.renderThinkingRun(thinkingRunIndex, thinkingBlocks, message, -1);
1263
- }
1264
1436
  let hasToolCalls = message.content.some((c) => c.type === "toolCall");
1265
1437
  if (this.hasToolCalls = hasToolCalls, message.stopReason === "length")
1266
1438
  this.contentContainer.addChild(new Spacer(1)), this.contentContainer.addChild(new Text(theme.fg("error", "Error: Model stopped because it reached the maximum output token limit. The response may be incomplete."), this.outputPad, 0));
@@ -1273,21 +1445,39 @@ var OSC133_ZONE_START = "\x1B]133;A\x07", OSC133_ZONE_END = "\x1B]133;B\x07", OS
1273
1445
  this.contentContainer.addChild(new Spacer(1)), this.contentContainer.addChild(new Text(theme.fg("error", `Error: ${errorMsg}`), this.outputPad, 0));
1274
1446
  }
1275
1447
  }
1448
+ this.onThinkingAnimationChange?.(this.thinkingAnimationActive);
1276
1449
  }
1277
- renderThinkingRun(thinkingRunIndex, thinkingBlocks, displayMessage, displayIndex) {
1278
- let hasVisibleContentAfter = displayIndex >= 0 ? displayMessage.content.slice(displayIndex + 1).some((c) => c.type === "text" && c.text.trim() || c.type === "thinking" && c.thinking.trim()) : displayMessage.content.some((c) => c.type === "text" && c.text.trim()), runComplete = isThinkingRunComplete(!1, this.thinkingTimings?.[thinkingRunIndex], this.thinkingTimings !== void 0), wrap = (inner) => {
1450
+ copyPayload(key, payload) {
1451
+ this.copyStates.get(key)?.status !== "copying" && (this.copyStates.set(key, { payload, status: "copying" }), this.refreshCopyStatus(), Promise.resolve().then(() => this.copyText(payload)).then(() => {
1452
+ this.copyStates.set(key, { payload, status: "copied" }), this.refreshCopyStatus();
1453
+ }).catch((error) => {
1454
+ let message = (error instanceof Error ? error.message : String(error)).replace(/\s+/g, " ").trim();
1455
+ this.copyStates.set(key, { payload, status: { error: message || "Unknown error" } }), this.refreshCopyStatus();
1456
+ }));
1457
+ }
1458
+ refreshCopyStatus() {
1459
+ this.lastMessage && this.updateContent(this.lastMessage, this.thinkingSourceOptions()), this.requestRender();
1460
+ }
1461
+ renderThinkingRun(thinkingRunIndex, thinkingBlocks, displayMessage, displayIndex, fullyRevealed) {
1462
+ let hasVisibleContentAfter = displayIndex >= 0 ? displayMessage.content.slice(displayIndex + 1).some((c) => c.type === "text" && c.text.trim() || c.type === "thinking" && c.thinking.trim()) : displayMessage.content.some((c) => c.type === "text" && c.text.trim()), runComplete = fullyRevealed && isThinkingRunComplete(!1, this.thinkingTimings?.[thinkingRunIndex], this.thinkingTimings !== void 0), wrap = (inner) => {
1279
1463
  this.contentContainer.addChild(new ThinkingRunBlock(this, thinkingRunIndex, inner));
1280
1464
  };
1281
1465
  if (this.thinkingCollapse && !this.isRunExpanded(thinkingRunIndex) && runComplete) {
1282
1466
  let timing = this.thinkingTimings?.[thinkingRunIndex], label = timing?.end !== void 0 ? `\u273B Thought for ${formatThoughtDuration(timing.end - timing.start)}` : "\u273B Thought", block = new Container();
1283
1467
  block.addChild(new Text(theme.fg("thinkingText", theme.italic(label)), this.outputPad, 0));
1284
- let snippet = thinkingSnippet(thinkingBlocks.join(`
1468
+ let joinedThinking = thinkingBlocks.join(`
1285
1469
 
1286
- `));
1470
+ `), snippet = thinkingSnippet(displayMessage.provider === "openai-codex" ? joinedThinking.replaceAll("**", "") : joinedThinking);
1287
1471
  snippet && block.addChild(new Text(theme.fg("thinkingText", theme.italic(snippet)), this.outputPad + 2, 0)), wrap(block), hasVisibleContentAfter && this.contentContainer.addChild(new Spacer(1));
1288
1472
  return;
1289
1473
  }
1290
1474
  if (!runComplete && !this.isRunExpanded(thinkingRunIndex)) {
1475
+ if (this.reasoningDisplay === "one-line" || this.reasoningDisplay === "auto" && displayMessage.provider === "openai-codex") {
1476
+ this.thinkingAnimationActive = !0, this.contentContainer.children.length === 1 && this.contentContainer.children[0] instanceof Spacer && this.contentContainer.clear(), wrap(new ThinkingLineComponent(thinkingBlocks.join(`
1477
+
1478
+ `), this.outputPad, this.markdownTheme, this.thinkingAnimationStart));
1479
+ return;
1480
+ }
1291
1481
  wrap(new ThinkingTailComponent(thinkingBlocks.join(`
1292
1482
 
1293
1483
  `), this.outputPad, 0, this.markdownTheme, {
@@ -1328,7 +1518,7 @@ function collectThinkingRuns(content) {
1328
1518
  let thinking = thinkingContent.thinking.trim();
1329
1519
  thinking && blocks.push(thinking);
1330
1520
  }
1331
- blocks.length > 0 && runs.push(blocks);
1521
+ runs.push(blocks);
1332
1522
  }
1333
1523
  return runs;
1334
1524
  }
@@ -1506,7 +1696,7 @@ var CompactionSummaryMessageComponent = class extends Box2 {
1506
1696
 
1507
1697
  // packages/coding-agent/dist/modes/interactive/components/footer.js
1508
1698
  import { isAbsolute, relative, resolve as resolve2, sep } from "node:path";
1509
- import { truncateToWidth, visibleWidth } from "@ashx-j/lunr-tui";
1699
+ import { truncateToWidth as truncateToWidth3, visibleWidth as visibleWidth3 } from "@ashx-j/lunr-tui";
1510
1700
  function sanitizeStatusText(text) {
1511
1701
  return text.replace(/[\r\n\t]/g, " ").replace(/ +/g, " ").trim();
1512
1702
  }
@@ -1565,38 +1755,38 @@ var FooterComponent = class {
1565
1755
  }
1566
1756
  let contextPercentStr, autoIndicator = this.autoCompactEnabled ? " (auto)" : "", contextPercentDisplay = contextPercent === "?" ? `?/${formatTokens(contextWindow)}${autoIndicator}` : `${contextPercent}%/${formatTokens(contextWindow)}${autoIndicator}`;
1567
1757
  contextPercentValue > 90 ? contextPercentStr = theme.fg("error", contextPercentDisplay) : contextPercentValue > 70 ? contextPercentStr = theme.fg("warning", contextPercentDisplay) : contextPercentStr = contextPercentDisplay, statsParts.push(contextPercentStr), areExperimentalFeaturesEnabled() && statsParts.push(`${theme.fg("dim", "\u2022")} ${theme.bold(theme.fg("warning", "xp"))}`);
1568
- let statsLeft = statsParts.join(" "), modelName = state.model?.id || "no-model", statsLeftWidth = visibleWidth(statsLeft);
1569
- statsLeftWidth > width && (statsLeft = truncateToWidth(statsLeft, width, "..."), statsLeftWidth = visibleWidth(statsLeft));
1758
+ let statsLeft = statsParts.join(" "), modelName = state.model?.id || "no-model", statsLeftWidth = visibleWidth3(statsLeft);
1759
+ statsLeftWidth > width && (statsLeft = truncateToWidth3(statsLeft, width, "..."), statsLeftWidth = visibleWidth3(statsLeft));
1570
1760
  let minPadding = 2, rightSideWithoutProvider = modelName;
1571
1761
  if (state.model?.reasoning) {
1572
1762
  let thinkingLevel = state.thinkingLevel || "off";
1573
1763
  rightSideWithoutProvider = thinkingLevel === "off" ? `${modelName} \u2022 thinking off` : `${modelName} \u2022 ${thinkingLevel}`;
1574
1764
  }
1575
1765
  let rightSide = rightSideWithoutProvider;
1576
- this.footerData.getAvailableProviderCount() > 1 && state.model && (rightSide = `(${state.model.provider}) ${rightSideWithoutProvider}`, statsLeftWidth + minPadding + visibleWidth(rightSide) > width && (rightSide = rightSideWithoutProvider));
1577
- let rightSideWidth = visibleWidth(rightSide), totalNeeded = statsLeftWidth + minPadding + rightSideWidth, statsLine;
1766
+ this.footerData.getAvailableProviderCount() > 1 && state.model && (rightSide = `(${state.model.provider}) ${rightSideWithoutProvider}`, statsLeftWidth + minPadding + visibleWidth3(rightSide) > width && (rightSide = rightSideWithoutProvider));
1767
+ let rightSideWidth = visibleWidth3(rightSide), totalNeeded = statsLeftWidth + minPadding + rightSideWidth, statsLine;
1578
1768
  if (totalNeeded <= width) {
1579
1769
  let padding = " ".repeat(width - statsLeftWidth - rightSideWidth);
1580
1770
  statsLine = statsLeft + padding + rightSide;
1581
1771
  } else {
1582
1772
  let availableForRight = width - statsLeftWidth - minPadding;
1583
1773
  if (availableForRight > 0) {
1584
- let truncatedRight = truncateToWidth(rightSide, availableForRight, ""), truncatedRightWidth = visibleWidth(truncatedRight), padding = " ".repeat(Math.max(0, width - statsLeftWidth - truncatedRightWidth));
1774
+ let truncatedRight = truncateToWidth3(rightSide, availableForRight, ""), truncatedRightWidth = visibleWidth3(truncatedRight), padding = " ".repeat(Math.max(0, width - statsLeftWidth - truncatedRightWidth));
1585
1775
  statsLine = statsLeft + padding + truncatedRight;
1586
1776
  } else
1587
1777
  statsLine = statsLeft;
1588
1778
  }
1589
- let dimStatsLeft = theme.fg("dim", statsLeft), remainder = statsLine.slice(statsLeft.length), dimRemainder = theme.fg("dim", remainder), lines = [truncateToWidth(theme.fg("dim", pwd), width, theme.fg("dim", "...")), dimStatsLeft + dimRemainder], extensionStatuses = this.footerData.getExtensionStatuses();
1779
+ let dimStatsLeft = theme.fg("dim", statsLeft), remainder = statsLine.slice(statsLeft.length), dimRemainder = theme.fg("dim", remainder), lines = [truncateToWidth3(theme.fg("dim", pwd), width, theme.fg("dim", "...")), dimStatsLeft + dimRemainder], extensionStatuses = this.footerData.getExtensionStatuses();
1590
1780
  if (extensionStatuses.size > 0) {
1591
1781
  let statusLine = Array.from(extensionStatuses.entries()).sort(([a], [b]) => a.localeCompare(b)).map(([, text]) => sanitizeStatusText(text)).join(" ");
1592
- lines.push(truncateToWidth(statusLine, width, theme.fg("dim", "...")));
1782
+ lines.push(truncateToWidth3(statusLine, width, theme.fg("dim", "...")));
1593
1783
  }
1594
1784
  return lines;
1595
1785
  }
1596
1786
  };
1597
1787
 
1598
1788
  // packages/coding-agent/dist/modes/interactive/components/usage-view.js
1599
- import { truncateToWidth as truncateToWidth2, visibleWidth as visibleWidth2 } from "@ashx-j/lunr-tui";
1789
+ import { truncateToWidth as truncateToWidth4, visibleWidth as visibleWidth4 } from "@ashx-j/lunr-tui";
1600
1790
  var BAR_CELLS = 20;
1601
1791
  function usageLevelColor(percent) {
1602
1792
  return percent > 90 ? "error" : percent > 70 ? "warning" : "success";
@@ -1634,9 +1824,9 @@ function planWindowLine(window, labelWidth) {
1634
1824
  return ` ${window.label.padEnd(labelWidth)} ${usageBar(window.usedPercent)} ${pct}${reset}`;
1635
1825
  }
1636
1826
  function renderThemedBox(headerText, content, maxWidth) {
1637
- let contentWidth = Math.max(...content.map((line) => visibleWidth2(line))), totalWidth = Math.max(24, Math.min(contentWidth + 4, Math.max(24, maxWidth))), innerWidth = totalWidth - 4, border = (text) => theme.fg("border", text), top = border(`\u256D${headerText}${"\u2500".repeat(Math.max(0, totalWidth - 2 - headerText.length))}\u256E`), bottom = border(`\u2570${"\u2500".repeat(totalWidth - 2)}\u256F`), lines = [top];
1827
+ let contentWidth = Math.max(...content.map((line) => visibleWidth4(line))), totalWidth = Math.max(24, Math.min(contentWidth + 4, Math.max(24, maxWidth))), innerWidth = totalWidth - 4, border = (text) => theme.fg("border", text), top = border(`\u256D${headerText}${"\u2500".repeat(Math.max(0, totalWidth - 2 - headerText.length))}\u256E`), bottom = border(`\u2570${"\u2500".repeat(totalWidth - 2)}\u256F`), lines = [top];
1638
1828
  for (let rawLine of content) {
1639
- let line = rawLine.length > 0 ? truncateToWidth2(rawLine, innerWidth, "") : "", padding = " ".repeat(Math.max(0, innerWidth - visibleWidth2(line)));
1829
+ let line = rawLine.length > 0 ? truncateToWidth4(rawLine, innerWidth, "") : "", padding = " ".repeat(Math.max(0, innerWidth - visibleWidth4(line)));
1640
1830
  lines.push(`${border("\u2502 ")}${line}${padding}${border(" \u2502")}`);
1641
1831
  }
1642
1832
  return lines.push(bottom), lines;
@@ -1728,6 +1918,9 @@ var CustomEntryComponent = class extends Container4 {
1728
1918
  setExpanded(expanded) {
1729
1919
  this._expanded !== expanded && (this._expanded = expanded, this.rebuild());
1730
1920
  }
1921
+ handleClick(localY, width) {
1922
+ return super.handleClick(localY, width) ? !0 : !this.customComponent || localY < 1 ? !1 : (this.setExpanded(!this._expanded), !0);
1923
+ }
1731
1924
  invalidate() {
1732
1925
  super.invalidate(), this.rebuild();
1733
1926
  }
@@ -1759,6 +1952,9 @@ var CustomMessageComponent = class extends Container5 {
1759
1952
  setExpanded(expanded) {
1760
1953
  this._expanded !== expanded && (this._expanded = expanded, this.rebuild());
1761
1954
  }
1955
+ handleClick(localY, width) {
1956
+ return super.handleClick(localY, width) ? !0 : !this.customRenderer || !this.customComponent || localY < 1 ? !1 : (this.setExpanded(!this._expanded), !0);
1957
+ }
1762
1958
  invalidate() {
1763
1959
  super.invalidate(), this.rebuild();
1764
1960
  }
@@ -2407,7 +2603,7 @@ var PlanMessageComponent = class extends Container10 {
2407
2603
  };
2408
2604
 
2409
2605
  // packages/coding-agent/dist/modes/interactive/components/processes-selector.js
2410
- import { Container as Container11, getKeybindings as getKeybindings5, Spacer as Spacer12, Text as Text13, truncateToWidth as truncateToWidth3 } from "@ashx-j/lunr-tui";
2606
+ import { Container as Container11, getKeybindings as getKeybindings5, Spacer as Spacer12, Text as Text13, truncateToWidth as truncateToWidth5 } from "@ashx-j/lunr-tui";
2411
2607
  function formatElapsed(startedAt) {
2412
2608
  let ms = Date.now() - startedAt, s = Math.floor(ms / 1e3);
2413
2609
  if (s < 60)
@@ -2444,7 +2640,7 @@ var ProcessesSelectorComponent = class extends Container11 {
2444
2640
  continue;
2445
2641
  let elapsed = formatElapsed(p.startedAt), status;
2446
2642
  p.status === "exited" ? status = `exited(${p.exitCode ?? "?"})` : p.status === "paused" ? status = "paused" : status = "running";
2447
- let line = `${i === this.selected ? "\u25B8 " : " "}${p.pid} \xB7 ${status} \xB7 ${elapsed} \xB7 ${truncateToWidth3(p.command, 60)}`, colored = i === this.selected ? theme.fg("accent", line) : theme.fg("dim", line);
2643
+ let line = `${i === this.selected ? "\u25B8 " : " "}${p.pid} \xB7 ${status} \xB7 ${elapsed} \xB7 ${truncateToWidth5(p.command, 60)}`, colored = i === this.selected ? theme.fg("accent", line) : theme.fg("dim", line);
2448
2644
  this.addChild(new Text13(colored, 0, 0));
2449
2645
  }
2450
2646
  this.addChild(new Spacer12(1));
@@ -2836,11 +3032,56 @@ var SETTINGS_SUBMENU_SELECT_LIST_LAYOUT = {
2836
3032
  handleInput(data) {
2837
3033
  this.input.handleInput(data);
2838
3034
  }
2839
- }, SEARCH_CURATOR_VALUES = ["off", "on", "auto-summary"], CustomizeSubmenu = class extends Container13 {
3035
+ }, SEARCH_CURATOR_VALUES = ["off", "on", "auto-summary"];
3036
+ function subagentSpinnerItems() {
3037
+ return SUBAGENT_SPINNER_NAMES.map((name) => ({
3038
+ value: name,
3039
+ label: SUBAGENT_SPINNER_LABELS[name],
3040
+ description: getSubagentSpinnerDefinition(name).frames.slice(0, 4).join(" ")
3041
+ }));
3042
+ }
3043
+ var SubagentSpinnerSubmenu = class extends Container13 {
3044
+ preview;
3045
+ selectList;
3046
+ selected;
3047
+ timer;
3048
+ constructor(current, callbacks, done) {
3049
+ super(), this.selected = current, this.addChild(new Text15(theme.bold(theme.fg("accent", "Subagent spinner")), 0, 0)), this.addChild(new Spacer14(1)), this.preview = new Text15("", 0, 0), this.addChild(this.preview), this.addChild(new Spacer14(1));
3050
+ let options = subagentSpinnerItems();
3051
+ this.selectList = new SelectList(options, options.length, getSelectListTheme(), SETTINGS_SUBMENU_SELECT_LIST_LAYOUT), this.selectList.setSelectedIndex(Math.max(0, SUBAGENT_SPINNER_NAMES.indexOf(current))), this.selectList.onSelectionChange = (item) => {
3052
+ this.selected = item.value, this.updatePreview(), callbacks.requestRender();
3053
+ }, this.selectList.onSelect = (item) => {
3054
+ this.dispose();
3055
+ let selected = item.value;
3056
+ callbacks.onSubagentSpinnerChange(selected), done(SUBAGENT_SPINNER_LABELS[selected]);
3057
+ }, this.selectList.onCancel = () => {
3058
+ this.dispose(), done();
3059
+ }, this.addChild(this.selectList), this.addChild(new Spacer14(1)), this.addChild(new Text15(theme.fg("dim", " Enter to select \xB7 Esc to go back"), 0, 0)), this.updatePreview(), this.timer = setInterval(() => {
3060
+ this.updatePreview(), callbacks.requestRender();
3061
+ }, 80), this.timer.unref?.();
3062
+ }
3063
+ updatePreview() {
3064
+ let definition = getSubagentSpinnerDefinition(this.selected), frame = definition.frames[Math.floor(Date.now() / definition.interval) % definition.frames.length];
3065
+ this.preview.setText(`${theme.fg("muted", "Preview")} ${theme.fg("accent", frame)}`);
3066
+ }
3067
+ dispose() {
3068
+ this.timer && (clearInterval(this.timer), this.timer = void 0);
3069
+ }
3070
+ handleInput(data) {
3071
+ this.selectList.handleInput(data);
3072
+ }
3073
+ }, CustomizeSubmenu = class extends Container13 {
2840
3074
  settingsList;
2841
- constructor(_config, callbacks, done) {
3075
+ constructor(config, callbacks, done) {
2842
3076
  super();
2843
- let bridge = getCustomizeBridge(), items = [
3077
+ let bridge = getCustomizeBridge(), currentSpinner = bridge?.getSubagentSpinner() ?? config.subagentSpinner, items = [
3078
+ {
3079
+ id: "subagent-spinner",
3080
+ label: "Subagent spinner",
3081
+ description: "Running child indicator",
3082
+ currentValue: SUBAGENT_SPINNER_LABELS[currentSpinner],
3083
+ submenu: (_currentValue, submenuDone) => new SubagentSpinnerSubmenu(bridge?.getSubagentSpinner() ?? currentSpinner, callbacks, submenuDone)
3084
+ },
2844
3085
  {
2845
3086
  id: "footer-mcp",
2846
3087
  label: "MCP status",
@@ -3374,6 +3615,14 @@ var ThemeSubmenu = class extends Container13 {
3374
3615
  values: ["true", "false"],
3375
3616
  disabled: () => config.hideThinkingBlock
3376
3617
  },
3618
+ {
3619
+ id: "reasoning-display",
3620
+ label: "Reasoning display",
3621
+ description: "Auto uses one line for OpenAI Codex, four lines for other models. One line has a soft moving highlight.",
3622
+ currentValue: config.reasoningDisplay ?? "auto",
3623
+ values: ["auto", "one-line", "four-lines"],
3624
+ disabled: () => config.hideThinkingBlock
3625
+ },
3377
3626
  {
3378
3627
  id: "cache-miss-notices",
3379
3628
  label: "Cache miss notices",
@@ -3418,6 +3667,13 @@ var ThemeSubmenu = class extends Container13 {
3418
3667
  currentValue: config.computerForeground !== !1 ? "on" : "off",
3419
3668
  values: ["on", "off"]
3420
3669
  },
3670
+ {
3671
+ id: "browser-enabled",
3672
+ label: "Browser",
3673
+ description: "Browse JavaScript pages and interact with websites. Off closes the browser and hides its tool.",
3674
+ currentValue: config.browserEnabled ? "on" : "off",
3675
+ values: ["on", "off"]
3676
+ },
3421
3677
  {
3422
3678
  id: "agent-memory",
3423
3679
  label: "Agent memory",
@@ -3425,6 +3681,13 @@ var ThemeSubmenu = class extends Container13 {
3425
3681
  currentValue: config.memoryEnabled ? "on" : "off",
3426
3682
  values: ["on", "off"]
3427
3683
  },
3684
+ {
3685
+ id: "todos",
3686
+ label: "Todos",
3687
+ description: "Agent task list and todo tool",
3688
+ currentValue: config.todosEnabled ? "on" : "off",
3689
+ values: ["on", "off"]
3690
+ },
3428
3691
  {
3429
3692
  id: "memory-char-cap",
3430
3693
  label: "Memory character cap",
@@ -3453,12 +3716,29 @@ var ThemeSubmenu = class extends Container13 {
3453
3716
  currentValue: DEFAULT_PROJECT_TRUST_LABELS[config.defaultProjectTrust],
3454
3717
  values: Object.values(DEFAULT_PROJECT_TRUST_LABELS)
3455
3718
  },
3719
+ {
3720
+ id: "gateway",
3721
+ label: "Gateway",
3722
+ description: "Phone access and automatic startup",
3723
+ currentValue: "manage",
3724
+ submenu: (_value, done) => new SelectSubmenu("Gateway", "Boot startup may require administrator permission. Setup manages bot accounts and approved folders.", [
3725
+ { value: "setup", label: "Set up Telegram or Discord" },
3726
+ { value: "status", label: "Show gateway status" },
3727
+ { value: "start", label: "Start gateway" },
3728
+ { value: "stop", label: "Stop gateway" },
3729
+ { value: "autostart login", label: "Start automatically at login" },
3730
+ { value: "autostart boot", label: "Start automatically at boot" },
3731
+ { value: "autostart off", label: "Disable automatic startup" }
3732
+ ], "", (action) => {
3733
+ done(), callbacks.onGatewayAction?.(action);
3734
+ }, () => done())
3735
+ },
3456
3736
  {
3457
3737
  id: "default-permission-mode",
3458
3738
  label: "Default permission mode",
3459
3739
  description: "Starting permission mode for new sessions",
3460
- currentValue: config.defaultPermissionMode,
3461
- values: ["manual", "yolo", "plan", "auto"]
3740
+ currentValue: config.defaultPermissionMode === "read-only" ? "read" : config.defaultPermissionMode,
3741
+ values: ["yolo", "auto", "read"]
3462
3742
  },
3463
3743
  {
3464
3744
  id: "double-escape-action",
@@ -3508,6 +3788,20 @@ var ThemeSubmenu = class extends Container13 {
3508
3788
  currentValue: config.modelInstructions.enabled ? "on" : "off",
3509
3789
  submenu: (_currentValue, done) => new ModelInstructionsSubmenu(config, callbacks, done)
3510
3790
  },
3791
+ {
3792
+ id: "subagent-communication",
3793
+ label: "Subagent communication",
3794
+ description: "Allow parent and child to exchange messages during a task",
3795
+ currentValue: config.subagentCommunicationEnabled ? "on" : "off",
3796
+ values: ["on", "off"]
3797
+ },
3798
+ {
3799
+ id: "automatic-subagent-delegation",
3800
+ label: "Automatic subagent delegation",
3801
+ description: "Let the agent decide when to delegate work",
3802
+ currentValue: config.automaticSubagentDelegation ? "on" : "off",
3803
+ values: ["on", "off"]
3804
+ },
3511
3805
  {
3512
3806
  id: "confirm-large-subagent-launches",
3513
3807
  label: "Confirm large subagent launches",
@@ -3686,6 +3980,9 @@ var ThemeSubmenu = class extends Container13 {
3686
3980
  case "thinking-collapse":
3687
3981
  callbacks.onThinkingCollapseChange(newValue === "true");
3688
3982
  break;
3983
+ case "reasoning-display":
3984
+ (newValue === "auto" || newValue === "one-line" || newValue === "four-lines") && callbacks.onReasoningDisplayChange(newValue);
3985
+ break;
3689
3986
  case "cache-miss-notices":
3690
3987
  callbacks.onShowCacheMissNoticesChange(newValue === "true");
3691
3988
  break;
@@ -3698,6 +3995,12 @@ var ThemeSubmenu = class extends Container13 {
3698
3995
  case "smooth-streaming":
3699
3996
  callbacks.onSmoothStreamingChange(newValue === "true");
3700
3997
  break;
3998
+ case "subagent-communication":
3999
+ callbacks.onSubagentCommunicationChange(newValue === "on");
4000
+ break;
4001
+ case "automatic-subagent-delegation":
4002
+ callbacks.onAutomaticSubagentDelegationChange(newValue === "on");
4003
+ break;
3701
4004
  case "plan-usage-window":
3702
4005
  callbacks.onPlanUsageWindowChange(newValue === "5h" ? "5h" : "weekly");
3703
4006
  break;
@@ -3710,9 +4013,15 @@ var ThemeSubmenu = class extends Container13 {
3710
4013
  case "computer-foreground":
3711
4014
  callbacks.onComputerForegroundChange?.(newValue === "on");
3712
4015
  break;
4016
+ case "browser-enabled":
4017
+ callbacks.onBrowserEnabledChange(newValue === "on");
4018
+ break;
3713
4019
  case "agent-memory":
3714
4020
  callbacks.onMemoryEnabledChange(newValue === "on");
3715
4021
  break;
4022
+ case "todos":
4023
+ callbacks.onTodosEnabledChange(newValue === "on");
4024
+ break;
3716
4025
  case "search-curator":
3717
4026
  callbacks.onSearchCuratorChange(newValue);
3718
4027
  break;
@@ -3725,7 +4034,7 @@ var ThemeSubmenu = class extends Container13 {
3725
4034
  break;
3726
4035
  }
3727
4036
  case "default-permission-mode":
3728
- callbacks.onDefaultPermissionModeChange(newValue);
4037
+ callbacks.onDefaultPermissionModeChange(newValue === "read" ? "read-only" : newValue);
3729
4038
  break;
3730
4039
  case "double-escape-action":
3731
4040
  callbacks.onDoubleEscapeActionChange(newValue);
@@ -3877,7 +4186,6 @@ var ToolExecutionComponent = class extends Container14 {
3877
4186
  hideComponent = !1;
3878
4187
  groupContinuation = !1;
3879
4188
  groupFollowed = !1;
3880
- groupPrev;
3881
4189
  groupNext;
3882
4190
  constructor(toolName, toolCallId, args, options = {}, toolDefinition, ui, cwd) {
3883
4191
  super(), this.toolName = toolName, this.toolCallId = toolCallId, this.args = args, this.toolDefinition = toolDefinition, this.builtInToolDefinition = createAllToolDefinitions(cwd)[toolName], this.showImages = options.showImages ?? !0, this.imageWidthCells = options.imageWidthCells ?? 60, this.ui = ui, this.cwd = cwd, this.topSpacer = new Spacer15(1), this.addChild(this.topSpacer), this.contentBox = new Box7(1, 1, (text) => theme.bg("toolPendingBg", text)), this.contentText = new Text17("", 1, 1, (text) => theme.bg("toolPendingBg", text)), this.selfRenderContainer = new Container14(), this.hasRendererDefinition() ? this.addChild(this.getRenderShell() === "self" ? this.selfRenderContainer : this.contentBox) : this.addChild(this.contentText), this.updateDisplay();
@@ -3921,13 +4229,18 @@ var ToolExecutionComponent = class extends Container14 {
3921
4229
  let state = this.isPartial ? "pending" : this.result?.isError ? "error" : "success";
3922
4230
  return toolStatusDot(state, theme);
3923
4231
  }
4232
+ getWaitDuration() {
4233
+ return this.toolName !== "subagent_wait" || this.isPartial || this.expanded ? void 0 : /^(?:Waited |Wait (?:timed out|aborted) after )(\d+(?:ms|[smhd])(?:\d+[smhd])*)\b/.exec(this.getTextOutput())?.[1];
4234
+ }
3924
4235
  createCallFallback() {
4236
+ let waitDuration = this.getWaitDuration();
3925
4237
  return new Text17(formatGroupedCall({
3926
4238
  role: toolGroupRole(this.groupContinuation, this.groupFollowed),
3927
4239
  compact: !this.isPartial && !this.expanded && !this.result?.isError,
3928
4240
  tree: toolGroupTree({ expanded: this.expanded, isError: this.result?.isError }),
3929
4241
  dot: this.getStatusDot(),
3930
- title: theme.fg("toolTitle", theme.bold(this.toolName))
4242
+ title: theme.fg("toolTitle", theme.bold(this.toolName)),
4243
+ detail: waitDuration && theme.fg("toolOutput", waitDuration)
3931
4244
  }), 0, 0);
3932
4245
  }
3933
4246
  createResultFallback() {
@@ -3962,16 +4275,30 @@ var ToolExecutionComponent = class extends Container14 {
3962
4275
  }
3963
4276
  }
3964
4277
  setExpanded(expanded) {
3965
- this.expanded = expanded, this.updateDisplay(), this.refreshGroupTail();
4278
+ this.toolName !== "browser" && (this.expanded = expanded, this.updateDisplay(), this.refreshGroupTail());
3966
4279
  }
3967
4280
  handleClick(_localY, _width) {
3968
- return this.isPartial || this.toolName === "subagent" || this.toolName === "subagent_wait" ? !1 : (this.setExpanded(!this.expanded), this.ui.requestRender(), !0);
4281
+ return this.isPartial || this.toolName === "browser" || this.toolName === "subagent" ? !1 : (this.setExpanded(!this.expanded), this.ui.requestRender(), !0);
4282
+ }
4283
+ beginNextExecution(toolCallId, args) {
4284
+ this.toolCallId = toolCallId, this.args = args, this.result = void 0, this.isPartial = !0, this.executionStarted = !1, this.argsComplete = !1, this.expanded = !1, this.disposeComponent(this.resultRendererComponent), this.resultRendererComponent = void 0, this.updateDisplay();
4285
+ }
4286
+ dispose() {
4287
+ let components = /* @__PURE__ */ new Set([this.callRendererComponent, this.resultRendererComponent]);
4288
+ for (let component of components)
4289
+ this.disposeComponent(component);
4290
+ }
4291
+ disposeComponent(component) {
4292
+ component?.dispose?.();
3969
4293
  }
3970
4294
  // lunr: consecutive same-tool grouping — exposes the tool name so the caller
3971
4295
  // can detect adjacency.
3972
4296
  getToolName() {
3973
4297
  return this.toolName;
3974
4298
  }
4299
+ matchesToolCall(toolCallId) {
4300
+ return this.toolCallId === toolCallId;
4301
+ }
3975
4302
  // lunr: consecutive same-tool grouping — continuation calls hide the top
3976
4303
  // spacer and top box pad so adjacent same-bg boxes read as one continuous
3977
4304
  // background; the last card in a run keeps its bottom pad.
@@ -3983,35 +4310,22 @@ var ToolExecutionComponent = class extends Container14 {
3983
4310
  setGroupFollowed(on) {
3984
4311
  this.groupFollowed = on, this.applyGroupPadding(), this.invalidate();
3985
4312
  }
3986
- // lunr: same-name run link so a later card can hoist earlier error bodies
3987
- // under the last leaf instead of splitting the tree.
4313
+ // lunr: same-name run link keeps the final card refreshed as earlier calls settle.
3988
4314
  linkGroupNext(next) {
3989
- this.groupNext = next, next.groupPrev = this;
4315
+ this.groupNext = next;
3990
4316
  }
3991
4317
  applyGroupPadding() {
3992
4318
  let top = this.groupContinuation ? 0 : 1, bottom = this.groupFollowed ? 0 : 1;
3993
4319
  this.contentBox.setPaddingTop(top), this.contentBox.setPaddingBottom(bottom), this.contentText.setPaddingTop(top), this.contentText.setPaddingBottom(bottom), this.getRenderShell() === "self" && this.callRendererComponent instanceof Box7 && (this.callRendererComponent.setPaddingTop(top), this.callRendererComponent.setPaddingBottom(bottom));
3994
4320
  }
3995
- shouldHideGroupedErrorBody() {
3996
- return !!this.result?.isError && this.groupFollowed && !this.expanded && !this.isPartial && this.getRenderShell() === "default" && this.toolName !== "subagent" && this.toolName !== "subagent_wait";
3997
- }
3998
4321
  shouldSkipCompactResult() {
3999
- return this.result === void 0 || this.isPartial || this.expanded ? !1 : this.result.isError ? this.shouldHideGroupedErrorBody() : this.getRenderShell() === "default";
4000
- }
4001
- formatHoistedGroupErrors() {
4002
- if (this.groupFollowed || this.expanded)
4003
- return;
4004
- let texts = [], prev = this.groupPrev;
4005
- for (; prev; ) {
4006
- if (prev.shouldHideGroupedErrorBody()) {
4007
- let output = prev.getTextOutput().trim();
4008
- output && texts.unshift(output);
4009
- }
4010
- prev = prev.groupPrev;
4322
+ if (this.result === void 0 || this.isPartial || this.expanded)
4323
+ return !1;
4324
+ if (this.toolName === "subagent") {
4325
+ let details = this.result.details;
4326
+ return !this.result.isError && this.args?.action === "steer" ? !0 : !(this.result.isError || Array.isArray(details?.results) && details.results.length > 0 || details?.mode === "management");
4011
4327
  }
4012
- return texts.length > 0 ? `
4013
- ${texts.join(`
4014
- `)}` : void 0;
4328
+ return this.toolName === "subagent_wait" || this.result.isError ? !0 : this.getRenderShell() === "default";
4015
4329
  }
4016
4330
  refreshGroupTail() {
4017
4331
  let next = this.groupNext;
@@ -4079,8 +4393,6 @@ ${texts.join(`
4079
4393
  let component = this.createResultFallback();
4080
4394
  component && (renderContainer.addChild(component), hasContent = !0);
4081
4395
  }
4082
- let hoisted = this.formatHoistedGroupErrors();
4083
- hoisted && (renderContainer.addChild(new Text17(theme.fg("toolOutput", hoisted), 0, 0)), hasContent = !0);
4084
4396
  }
4085
4397
  } else
4086
4398
  this.contentText.setCustomBgFn(bgFn), this.contentText.setText(this.formatToolExecution()), hasContent = !0;
@@ -4110,12 +4422,13 @@ ${texts.join(`
4110
4422
  return getTextOutput(this.result, this.showImages);
4111
4423
  }
4112
4424
  formatToolExecution() {
4113
- let hideGroupedErrorBody = !!(this.result?.isError && this.groupFollowed && !this.expanded), compact = !this.isPartial && !this.expanded && (!this.result?.isError || hideGroupedErrorBody), text = formatGroupedCall({
4425
+ let compact = !this.isPartial && !this.expanded, waitDuration = this.getWaitDuration(), text = formatGroupedCall({
4114
4426
  role: toolGroupRole(this.groupContinuation, this.groupFollowed),
4115
4427
  compact,
4116
4428
  tree: toolGroupTree({ expanded: this.expanded, isError: this.result?.isError }),
4117
4429
  dot: this.getStatusDot(),
4118
- title: theme.fg("toolTitle", theme.bold(this.toolName))
4430
+ title: theme.fg("toolTitle", theme.bold(this.toolName)),
4431
+ detail: waitDuration && theme.fg("toolOutput", waitDuration)
4119
4432
  });
4120
4433
  if (!compact) {
4121
4434
  let content = JSON.stringify(this.args, null, 2);
@@ -4126,8 +4439,7 @@ ${content}`);
4126
4439
  output && (text += `
4127
4440
  ${output}`);
4128
4441
  }
4129
- let hoisted = this.formatHoistedGroupErrors();
4130
- return hoisted && (text += hoisted), text;
4442
+ return text;
4131
4443
  }
4132
4444
  };
4133
4445
  function applySameToolGrouping(previous, next) {
@@ -4135,7 +4447,7 @@ function applySameToolGrouping(previous, next) {
4135
4447
  }
4136
4448
 
4137
4449
  // packages/coding-agent/dist/modes/interactive/components/tree-selector.js
4138
- import { Container as Container15, getKeybindings as getKeybindings8, Input as Input6, Spacer as Spacer16, sliceByColumn, Text as Text18, truncateToWidth as truncateToWidth4, visibleWidth as visibleWidth3, wrapTextWithAnsi } from "@ashx-j/lunr-tui";
4450
+ import { Container as Container15, getKeybindings as getKeybindings8, Input as Input6, Spacer as Spacer16, sliceByColumn, Text as Text18, truncateToWidth as truncateToWidth6, visibleWidth as visibleWidth5, wrapTextWithAnsi as wrapTextWithAnsi2 } from "@ashx-j/lunr-tui";
4139
4451
  var TREE_GUTTER_WIDTH = 2, MIN_VISIBLE_ANCHOR_CONTENT_WIDTH = 4, MAX_VISIBLE_ANCHOR_CONTENT_WIDTH = 20, MIN_ANCHOR_CONTEXT_WIDTH = 2, MAX_ANCHOR_CONTEXT_WIDTH = 12;
4140
4452
  function renderHorizontalViewport(rows, width) {
4141
4453
  let viewportWidth = Math.max(0, width - TREE_GUTTER_WIDTH), maxBodyWidth = rows.reduce((max, row) => Math.max(max, row.bodyWidth), 0), maxHorizontalScroll = Math.max(0, maxBodyWidth - viewportWidth), selectedRow = rows.find((row) => row.isSelected), horizontalScroll = 0;
@@ -4148,7 +4460,7 @@ function renderHorizontalViewport(rows, width) {
4148
4460
  }
4149
4461
  return rows.map((row) => {
4150
4462
  let line = horizontalScroll > 0 ? `${row.gutter}${sliceByColumn(row.body, horizontalScroll, viewportWidth, !0)}\x1B[0m` : row.gutter + row.body;
4151
- return truncateToWidth4(line, width, "");
4463
+ return truncateToWidth6(line, width, "");
4152
4464
  });
4153
4465
  }
4154
4466
  var TreeList = class {
@@ -4466,7 +4778,7 @@ var TreeList = class {
4466
4778
  render(width) {
4467
4779
  let lines = [];
4468
4780
  if (this.filteredNodes.length === 0)
4469
- return lines.push(truncateToWidth4(theme.fg("muted", " No entries found"), width)), lines.push(truncateToWidth4(theme.fg("muted", ` (0/0)${this.getStatusLabels()}`), width)), lines;
4781
+ return lines.push(truncateToWidth6(theme.fg("muted", " No entries found"), width)), lines.push(truncateToWidth6(theme.fg("muted", ` (0/0)${this.getStatusLabels()}`), width)), lines;
4470
4782
  let startIndex = Math.max(0, Math.min(this.selectedIndex - Math.floor(this.maxVisibleLines / 2), this.filteredNodes.length - this.maxVisibleLines)), endIndex = Math.min(startIndex + this.maxVisibleLines, this.filteredNodes.length), renderedRows = [];
4471
4783
  for (let i = startIndex; i < endIndex; i++) {
4472
4784
  let flatNode = this.filteredNodes[i], entry = flatNode.node.entry, isSelected = i === this.selectedIndex, cursor = isSelected ? theme.fg("accent", "\u203A ") : " ", displayIndent = this.multipleRoots ? Math.max(0, flatNode.indent - 1) : flatNode.indent, connector = flatNode.showConnector && !flatNode.isVirtualRootChild ? flatNode.isLast ? "\u2514\u2500 " : "\u251C\u2500 " : "", connectorPosition = connector ? displayIndent - 1 : -1, totalChars = displayIndent * 3, prefixChars = [], isFolded = this.foldedNodes.has(entry.id);
@@ -4485,10 +4797,10 @@ var TreeList = class {
4485
4797
  else
4486
4798
  prefixChars.push(" ");
4487
4799
  }
4488
- let prefix = prefixChars.join(""), showsFoldInConnector = flatNode.showConnector && !flatNode.isVirtualRootChild, foldMarker = isFolded && !showsFoldInConnector ? theme.fg("accent", "\u229E ") : "", pathMarker = this.activePathIds.has(entry.id) ? theme.fg("accent", "\u2022 ") : "", label = flatNode.node.label ? theme.fg("warning", `[${flatNode.node.label}] `) : "", labelTimestamp = this.showLabelTimestamps && flatNode.node.label && flatNode.node.labelTimestamp ? theme.fg("muted", `${this.formatLabelTimestamp(flatNode.node.labelTimestamp)} `) : "", content = this.getEntryDisplayText(flatNode.node, isSelected), prefixPart = theme.fg("dim", prefix) + foldMarker + pathMarker, anchorCol = visibleWidth3(prefixPart), gutter = cursor, body = prefixPart + label + labelTimestamp + content;
4489
- isSelected && (gutter = theme.bg("selectedBg", gutter), body = theme.bg("selectedBg", body)), renderedRows.push({ gutter, body, anchorCol, bodyWidth: visibleWidth3(body), isSelected });
4800
+ let prefix = prefixChars.join(""), showsFoldInConnector = flatNode.showConnector && !flatNode.isVirtualRootChild, foldMarker = isFolded && !showsFoldInConnector ? theme.fg("accent", "\u229E ") : "", pathMarker = this.activePathIds.has(entry.id) ? theme.fg("accent", "\u2022 ") : "", label = flatNode.node.label ? theme.fg("warning", `[${flatNode.node.label}] `) : "", labelTimestamp = this.showLabelTimestamps && flatNode.node.label && flatNode.node.labelTimestamp ? theme.fg("muted", `${this.formatLabelTimestamp(flatNode.node.labelTimestamp)} `) : "", content = this.getEntryDisplayText(flatNode.node, isSelected), prefixPart = theme.fg("dim", prefix) + foldMarker + pathMarker, anchorCol = visibleWidth5(prefixPart), gutter = cursor, body = prefixPart + label + labelTimestamp + content;
4801
+ isSelected && (gutter = theme.bg("selectedBg", gutter), body = theme.bg("selectedBg", body)), renderedRows.push({ gutter, body, anchorCol, bodyWidth: visibleWidth5(body), isSelected });
4490
4802
  }
4491
- return lines.push(...renderHorizontalViewport(renderedRows, width)), lines.push(truncateToWidth4(theme.fg("muted", ` (${this.selectedIndex + 1}/${this.filteredNodes.length})${this.getStatusLabels()}`), width)), lines;
4803
+ return lines.push(...renderHorizontalViewport(renderedRows, width)), lines.push(truncateToWidth6(theme.fg("muted", ` (${this.selectedIndex + 1}/${this.filteredNodes.length})${this.getStatusLabels()}`), width)), lines;
4492
4804
  }
4493
4805
  getEntryDisplayText(node, isSelected) {
4494
4806
  let entry = node.entry, result, normalize = (s) => s.replace(/[\n\t]/g, " ").trim();
@@ -4747,7 +5059,7 @@ var TreeList = class {
4747
5059
  }
4748
5060
  render(width) {
4749
5061
  let query = this.treeList.getSearchQuery();
4750
- return query ? [truncateToWidth4(` ${theme.fg("muted", "Type to search:")} ${theme.fg("accent", query)}`, width)] : [truncateToWidth4(` ${theme.fg("muted", "Type to search:")}`, width)];
5062
+ return query ? [truncateToWidth6(` ${theme.fg("muted", "Type to search:")} ${theme.fg("accent", query)}`, width)] : [truncateToWidth6(` ${theme.fg("muted", "Type to search:")}`, width)];
4751
5063
  }
4752
5064
  handleInput(_keyData) {
4753
5065
  }
@@ -4760,14 +5072,14 @@ var TreeList = class {
4760
5072
  return text ? labelFirst ? `${label} ${text}` : `${text} ${label}` : label;
4761
5073
  }), availableWidth = Math.max(1, width), indent = " ", separator = " \xB7 ", lines = [], currentLine = "";
4762
5074
  for (let item of items) {
4763
- let candidate = currentLine ? `${currentLine}${separator}${item}` : visibleWidth3(`${indent}${item}`) <= availableWidth ? `${indent}${item}` : item;
4764
- if (!currentLine || visibleWidth3(candidate) <= availableWidth) {
5075
+ let candidate = currentLine ? `${currentLine}${separator}${item}` : visibleWidth5(`${indent}${item}`) <= availableWidth ? `${indent}${item}` : item;
5076
+ if (!currentLine || visibleWidth5(candidate) <= availableWidth) {
4765
5077
  currentLine = candidate;
4766
5078
  continue;
4767
5079
  }
4768
- lines.push(...wrapTextWithAnsi(currentLine.trimEnd(), availableWidth)), currentLine = visibleWidth3(`${indent}${item}`) <= availableWidth ? `${indent}${item}` : item;
5080
+ lines.push(...wrapTextWithAnsi2(currentLine.trimEnd(), availableWidth)), currentLine = visibleWidth5(`${indent}${item}`) <= availableWidth ? `${indent}${item}` : item;
4769
5081
  }
4770
- return currentLine && lines.push(...wrapTextWithAnsi(currentLine.trimEnd(), availableWidth)), lines.map((line) => theme.fg("muted", line));
5082
+ return currentLine && lines.push(...wrapTextWithAnsi2(currentLine.trimEnd(), availableWidth)), lines.map((line) => theme.fg("muted", line));
4771
5083
  }
4772
5084
  }, TREE_HELP_ITEMS = [
4773
5085
  { keys: ["tui.select.up", "tui.select.down"], label: "move" },
@@ -4826,7 +5138,7 @@ var LabelInput = class {
4826
5138
  }
4827
5139
  render(width) {
4828
5140
  let lines = [], availableWidth = width - 2;
4829
- return lines.push(truncateToWidth4(` ${theme.fg("muted", "Label (empty to remove):")}`, width)), lines.push(...this.input.render(availableWidth).map((line) => truncateToWidth4(` ${line}`, width))), lines.push(truncateToWidth4(` ${keyHint("tui.select.confirm", "save")} ${keyHint("tui.select.cancel", "cancel")}`, width)), lines;
5141
+ return lines.push(truncateToWidth6(` ${theme.fg("muted", "Label (empty to remove):")}`, width)), lines.push(...this.input.render(availableWidth).map((line) => truncateToWidth6(` ${line}`, width))), lines.push(truncateToWidth6(` ${keyHint("tui.select.confirm", "save")} ${keyHint("tui.select.cancel", "cancel")}`, width)), lines;
4830
5142
  }
4831
5143
  handleInput(keyData) {
4832
5144
  let kb = getKeybindings8();
@@ -4943,7 +5255,7 @@ var OSC133_ZONE_START2 = "\x1B]133;A\x07", OSC133_ZONE_END2 = "\x1B]133;B\x07",
4943
5255
  };
4944
5256
 
4945
5257
  // packages/coding-agent/dist/modes/interactive/components/user-message-selector.js
4946
- import { Container as Container18, getKeybindings as getKeybindings10, Spacer as Spacer18, Text as Text20, truncateToWidth as truncateToWidth5 } from "@ashx-j/lunr-tui";
5258
+ import { Container as Container18, getKeybindings as getKeybindings10, Spacer as Spacer18, Text as Text20, truncateToWidth as truncateToWidth7 } from "@ashx-j/lunr-tui";
4947
5259
  var UserMessageList = class {
4948
5260
  messages = [];
4949
5261
  selectedIndex = 0;
@@ -4964,7 +5276,7 @@ var UserMessageList = class {
4964
5276
  return lines.push(theme.fg("muted", " No user messages found")), lines;
4965
5277
  let startIndex = Math.max(0, Math.min(this.selectedIndex - Math.floor(this.maxVisible / 2), this.messages.length - this.maxVisible)), endIndex = Math.min(startIndex + this.maxVisible, this.messages.length);
4966
5278
  for (let i = startIndex; i < endIndex; i++) {
4967
- let message = this.messages[i], isSelected = i === this.selectedIndex, normalizedMessage = message.text.replace(/\n/g, " ").trim(), cursor = isSelected ? theme.fg("accent", "\u203A ") : " ", maxMsgWidth = width - 2, truncatedMsg = truncateToWidth5(normalizedMessage, maxMsgWidth), messageLine = cursor + (isSelected ? theme.bold(truncatedMsg) : truncatedMsg);
5279
+ let message = this.messages[i], isSelected = i === this.selectedIndex, normalizedMessage = message.text.replace(/\n/g, " ").trim(), cursor = isSelected ? theme.fg("accent", "\u203A ") : " ", maxMsgWidth = width - 2, truncatedMsg = truncateToWidth7(normalizedMessage, maxMsgWidth), messageLine = cursor + (isSelected ? theme.bold(truncatedMsg) : truncatedMsg);
4968
5280
  lines.push(messageLine);
4969
5281
  let metadata = ` Message ${i + 1} of ${this.messages.length}`, metadataLine = theme.fg("muted", metadata);
4970
5282
  lines.push(metadataLine), lines.push("");
@@ -4996,6 +5308,29 @@ var UserMessageList = class {
4996
5308
  }
4997
5309
  };
4998
5310
 
5311
+ // packages/coding-agent/dist/modes/interactive/extension-widget-order.js
5312
+ var BUILTIN_WIDGET_ORDER = /* @__PURE__ */ new Map([
5313
+ ["todos", 0],
5314
+ ["subagent-async", 1]
5315
+ ]);
5316
+ function replaceExtensionWidget(above, below, key, component, placement) {
5317
+ let target = placement === "belowEditor" ? below : above, other = placement === "belowEditor" ? above : below, existingTarget = target.get(key), existingOther = other.get(key);
5318
+ if (existingTarget && existingTarget !== component && existingTarget.dispose?.(), existingOther && existingOther !== component && existingOther.dispose?.(), other.delete(key), component === void 0) {
5319
+ target.delete(key);
5320
+ return;
5321
+ }
5322
+ target.set(key, component);
5323
+ }
5324
+ function orderedExtensionWidgets(widgets) {
5325
+ return [...widgets.entries()].map(([key, component], insertionIndex) => ({ key, component, insertionIndex })).sort((left, right) => {
5326
+ let leftOrder = BUILTIN_WIDGET_ORDER.get(left.key), rightOrder = BUILTIN_WIDGET_ORDER.get(right.key);
5327
+ return leftOrder !== void 0 || rightOrder !== void 0 ? (leftOrder ?? Number.MAX_SAFE_INTEGER) - (rightOrder ?? Number.MAX_SAFE_INTEGER) : left.insertionIndex - right.insertionIndex;
5328
+ }).map(({ key, component }) => [key, component]);
5329
+ }
5330
+ function widgetSeparatorNeedsSpacer(previousKey, key) {
5331
+ return !(previousKey === "todos" && key === "subagent-async");
5332
+ }
5333
+
4999
5334
  // packages/coding-agent/dist/modes/interactive/skill-tag-autocomplete.js
5000
5335
  import { fuzzyFilter as fuzzyFilter4 } from "@ashx-j/lunr-tui";
5001
5336
  function extractSkillTagPrefix(textBeforeCursor, character) {
@@ -5250,7 +5585,7 @@ function isDeadTerminalError(error) {
5250
5585
  let code = error.code;
5251
5586
  return code !== void 0 && DEAD_TERMINAL_ERROR_CODES.has(code);
5252
5587
  }
5253
- var ANTHROPIC_SUBSCRIPTION_AUTH_WARNING = "Anthropic subscription auth is active. Third-party harness usage draws from extra usage and is billed per token, not your Claude plan limits. Manage extra usage at https://claude.ai/settings/usage.", ANTHROPIC_TOS_DISCLAIMER = "Connecting an Anthropic subscription (Claude Pro/Max) account to lunR may violate Anthropic's Terms of Service (https://www.anthropic.com/legal/consumer-terms). Third-party harness usage also draws from paid extra usage, not your plan limits. Continue?", INIT_PROMPT = `Analyze this codebase and write a starter AGENTS.md in the project root.
5588
+ var ANTHROPIC_SUBSCRIPTION_AUTH_WARNING = "Claude Code handles Anthropic subscription authentication. lunR retains tool execution and conversation state. Check your Claude account for usage and any extra charges.", ANTHROPIC_TOS_DISCLAIMER = "Connecting an Anthropic subscription through Claude Code may be subject to Anthropic's Terms of Service (https://www.anthropic.com/legal/consumer-terms). Claude Code authenticates each lunR generation; lunR keeps its own tools and history. Continue?", INIT_PROMPT = `Analyze this codebase and write a starter AGENTS.md in the project root.
5254
5589
  Scan: package manifests, directory layout, build/test/lint scripts, CI config,
5255
5590
  existing README/docs. Include only: project purpose (one paragraph), build &
5256
5591
  test commands, code style/conventions found, directory map, and agent rules
@@ -5349,6 +5684,7 @@ var InteractiveMode = class _InteractiveMode {
5349
5684
  hiddenThinkingLabel = this.defaultHiddenThinkingLabel;
5350
5685
  lastSigintTime = 0;
5351
5686
  lastEscapeTime = 0;
5687
+ subagentEscape = new SubagentEscapeSequence();
5352
5688
  anthropicSubscriptionWarningShown = !1;
5353
5689
  // Status line tracking (for mutating immediately-sequential status updates)
5354
5690
  lastStatusSpacer = void 0;
@@ -5362,8 +5698,10 @@ var InteractiveMode = class _InteractiveMode {
5362
5698
  streamingTargetMessage = void 0;
5363
5699
  streamingDisplayedLength = 0;
5364
5700
  smoothStreamingTimer = void 0;
5701
+ thinkingAnimationTimer;
5365
5702
  // Tool execution tracking: toolCallId -> component
5366
5703
  pendingTools = /* @__PURE__ */ new Map();
5704
+ browserActivityComponent;
5367
5705
  // Tool output expansion state
5368
5706
  toolOutputExpanded = !1;
5369
5707
  // Thinking block visibility state
@@ -5382,8 +5720,7 @@ var InteractiveMode = class _InteractiveMode {
5382
5720
  signalCleanupHandlers = [];
5383
5721
  // Track if editor is in bash mode (text starts with !)
5384
5722
  isBashMode = !1;
5385
- // lunr: mode in effect before the current plan stretch. Used by approve / `/plan off`
5386
- // / `/plan <text>` to leave plan. Shift+Tab and `/mode` pick the destination themselves.
5723
+ // Restore the previous mode after approving a plan or leaving read-only via /plan.
5387
5724
  previousPermissionMode;
5388
5725
  // lunr: mode in effect before `/goal` forced session auto. Dedicated so it cannot
5389
5726
  // collide with plan restore.
@@ -5448,11 +5785,13 @@ var InteractiveMode = class _InteractiveMode {
5448
5785
  this.runtimeHost = runtimeHost, this.options = options, this.autoTrustOnReloadCwd = options.autoTrustOnReloadCwd, this.runtimeHost.setBeforeSessionInvalidate((reason) => {
5449
5786
  this.resetExtensionUI(), this.previousPermissionMode = void 0, this.preGoalPermissionMode = void 0, resetPermissions(this.settingsManager.getDefaultPermissionMode()), clearRegistry(), reason !== "fork" && clearRollback(this.sessionManager.getSessionId());
5450
5787
  }), this.runtimeHost.setRebindSession(async () => {
5451
- await this.rebindCurrentSession({ renderBeforeBind: !0 }), initRollback(this.settingsManager, this.sessionManager.getSessionId()), this.syncPermissionModeEffects(this.settingsManager.getDefaultPermissionMode());
5788
+ await this.rebindCurrentSession({ renderBeforeBind: !0 }), initRollback(this.settingsManager, this.sessionManager.getSessionId());
5789
+ let mode = this.sessionManager.getPermissionMode() ?? this.settingsManager.getDefaultPermissionMode();
5790
+ resetPermissions(mode), this.syncPermissionModeEffects(mode);
5452
5791
  }), this.version = VERSION, this.ui = options.startupView?.ui ?? new TUI(new ProcessTerminal(), this.settingsManager.getShowHardwareCursor()), this.ui.setClearOnShrink(this.settingsManager.getClearOnShrink()), registerPermissionModeBridge(() => getPermissionMode()), registerPermissionModeControlBridge({
5453
5792
  enterGoalAuto: () => this.enterGoalAuto(),
5454
5793
  leaveGoalAuto: () => this.leaveGoalAuto()
5455
- }), resetPermissions(this.settingsManager.getDefaultPermissionMode()), this.headerContainer = new Container19(), options.startupView && (this.headerContainer.addChild(new Spacer19(1)), this.headerContainer.addChild(options.startupView.header), this.customFooter = options.startupView.footer), this.loadedResourcesContainer = new Container19(), this.chatContainer = new Container19(), this.pendingMessagesContainer = new Container19(), this.statusContainer = options.startupView?.statusContainer ?? new Container19(), this.widgetContainerAbove = new Container19(), this.widgetContainerBelow = new Container19(), this.keybindings = options.startupView?.keybindings ?? KeybindingsManager.create(), setKeybindings(this.keybindings);
5794
+ }), resetPermissions(this.sessionManager.getPermissionMode() ?? this.settingsManager.getDefaultPermissionMode()), this.headerContainer = new Container19(), options.startupView && (this.headerContainer.addChild(new Spacer19(1)), this.headerContainer.addChild(options.startupView.header), this.customFooter = options.startupView.footer), this.loadedResourcesContainer = new Container19(), this.chatContainer = new Container19(), this.pendingMessagesContainer = new Container19(), this.statusContainer = options.startupView?.statusContainer ?? new Container19(), this.widgetContainerAbove = new Container19(), this.widgetContainerBelow = new Container19(), this.keybindings = options.startupView?.keybindings ?? KeybindingsManager.create(), setKeybindings(this.keybindings);
5456
5795
  let editorPaddingX = this.settingsManager.getEditorPaddingX(), autocompleteMaxVisible = this.settingsManager.getAutocompleteMaxVisible();
5457
5796
  this.defaultEditor = options.startupView?.editor ?? new CustomEditor(this.ui, getEditorTheme(), this.keybindings, {
5458
5797
  paddingX: editorPaddingX,
@@ -5568,10 +5907,14 @@ var InteractiveMode = class _InteractiveMode {
5568
5907
  return this.showLargeSubagentLaunchApprovalDialog(req);
5569
5908
  if (req.kind === "plan") {
5570
5909
  let resp = await this.showPlanApprovalDialog(req.detail);
5571
- return (typeof resp == "string" ? resp : resp.decision) !== "reject" && this.applyPermissionMode(this.restoreTargetAfterPlan()), resp;
5910
+ if ((typeof resp == "string" ? resp : resp.decision) !== "reject") {
5911
+ let target = this.restoreTargetAfterPlan();
5912
+ this.applyPermissionMode(target === "read-only" ? "yolo" : target);
5913
+ }
5914
+ return resp;
5572
5915
  }
5573
- return this.showApprovalDialog(req);
5574
- }), initRollback(this.settingsManager, this.sessionManager.getSessionId()), setRollbackWarningHandler((msg) => this.showStatus(msg)), this.syncPermissionModeEffects(this.settingsManager.getDefaultPermissionMode()), await this.themeController.applyFromSettings(), this.headerContainer.clear(), this.options.verbose || !this.settingsManager.getQuietStartup()) {
5916
+ return "reject";
5917
+ }), initRollback(this.settingsManager, this.sessionManager.getSessionId()), setRollbackWarningHandler((msg) => this.showStatus(msg)), this.syncPermissionModeEffects(this.sessionManager.getPermissionMode() ?? this.settingsManager.getDefaultPermissionMode()), await this.themeController.applyFromSettings(), this.headerContainer.clear(), this.options.verbose || !this.settingsManager.getQuietStartup()) {
5575
5918
  let header = theme.bold(theme.fg("accent", APP_NAME)) + theme.fg("dim", ` v${this.version}`);
5576
5919
  this.builtInHeader = new BootScreenComponent(header, this.buildBootRows()), this.headerContainer.addChild(new Spacer19(1)), this.headerContainer.addChild(this.builtInHeader);
5577
5920
  } else
@@ -6058,7 +6401,7 @@ ${warningLines}`, 0, 0)), this.loadedResourcesContainer.addChild(new Spacer19(1)
6058
6401
  replaceInstructions: options?.replaceInstructions,
6059
6402
  label: options?.label
6060
6403
  });
6061
- return result.cancelled ? { cancelled: !0 } : (this.chatContainer.clear(), this.renderInitialMessages(), result.editorText && !this.editor.getText().trim() && this.restoreEditorFromTreeResult(result), this.showStatus("Navigated to selected point"), this.flushCompactionQueue({ willRetry: !1 }), { cancelled: !1 });
6404
+ return result.cancelled ? { cancelled: !0 } : (this.clearChatContainer(), this.renderInitialMessages(), result.editorText && !this.editor.getText().trim() && this.restoreEditorFromTreeResult(result), this.showStatus("Navigated to selected point"), this.flushCompactionQueue({ willRetry: !1 }), { cancelled: !1 });
6062
6405
  },
6063
6406
  switchSession: async (sessionPath, options) => this.handleResumeSession(sessionPath, options),
6064
6407
  reload: async () => {
@@ -6091,15 +6434,25 @@ ${warningLines}`, 0, 0)), this.loadedResourcesContainer.addChild(new Spacer19(1)
6091
6434
  ], skillsCount = this.session.resourceLoader.getSkills().skills.length;
6092
6435
  return skillsCount > 0 && bootRows.push({ label: "skills", value: String(skillsCount) }), bootRows;
6093
6436
  }
6437
+ unregisterSessionTransfer;
6438
+ transferInProgress = !1;
6439
+ detachedDraft = "";
6094
6440
  async rebindCurrentSession(options = {}) {
6095
- await this.waitForDeferredBuiltins(), this.unsubscribe?.(), this.unsubscribe = void 0, this.applyRuntimeSettings(), this.builtInHeader instanceof BootScreenComponent && this.builtInHeader.updateRows(this.buildBootRows()), options.renderBeforeBind ? (this.renderCurrentSessionState(), this.subscribeToAgent(), await this.bindCurrentSessionExtensions()) : (await this.bindCurrentSessionExtensions(), this.subscribeToAgent()), this.updateAvailableProviderCount(), this.updateEditorBorderColor(), this.updateTerminalTitle();
6441
+ await this.waitForDeferredBuiltins(), this.unregisterSessionTransfer?.(), recordTuiActivity(this.sessionManager, this.runtimeHost.services.agentDir), this.unregisterSessionTransfer = registerTransferHandler(this.sessionManager, async ({ stop, signal }) => {
6442
+ this.transferInProgress = !0;
6443
+ try {
6444
+ this.detachedDraft = this.editor.getText(), await this.runtimeHost.releaseForTransfer({ stop, signal }), this.editor.setText(this.detachedDraft), this.unregisterSessionTransfer?.(), this.showStatus("Session released for remote continuation. Draft retained. Use /reclaim to continue here.");
6445
+ } finally {
6446
+ this.transferInProgress = !1;
6447
+ }
6448
+ }), this.unsubscribe?.(), this.unsubscribe = void 0, this.applyRuntimeSettings(), this.builtInHeader instanceof BootScreenComponent && this.builtInHeader.updateRows(this.buildBootRows()), options.renderBeforeBind ? (this.renderCurrentSessionState(), this.subscribeToAgent(), await this.bindCurrentSessionExtensions()) : (await this.bindCurrentSessionExtensions(), this.subscribeToAgent()), this.updateAvailableProviderCount(), this.updateEditorBorderColor(), this.updateTerminalTitle();
6096
6449
  }
6097
6450
  async handleFatalRuntimeError(prefix, error) {
6098
6451
  let message = error instanceof Error ? error.message : String(error);
6099
6452
  this.showError(`${prefix}: ${message}`), stopThemeWatcher(), this.stop(), process.exit(1);
6100
6453
  }
6101
6454
  renderCurrentSessionState() {
6102
- this.ui.setChatScroll(0), this.loadedResourcesContainer.clear(), this.chatContainer.clear(), this.pendingMessagesContainer.clear(), this.compactionQueuedMessages = [], this.pendingCompactionRender = void 0, this.stopSmoothStreaming(), this.streamingComponent = void 0, this.streamingMessage = void 0, this.pendingTools.clear(), this.renderInitialMessages();
6455
+ this.ui.setChatScroll(0), this.loadedResourcesContainer.clear(), this.clearChatContainer(), this.pendingMessagesContainer.clear(), this.compactionQueuedMessages = [], this.pendingCompactionRender = void 0, this.stopSmoothStreaming(), this.streamingComponent = void 0, this.streamingMessage = void 0, this.pendingTools.clear(), this.renderInitialMessages();
6103
6456
  }
6104
6457
  /**
6105
6458
  * Get a registered tool definition by name (for custom rendering).
@@ -6190,23 +6543,14 @@ ${warningLines}`, 0, 0)), this.loadedResourcesContainer.addChild(new Spacer19(1)
6190
6543
  * Set an extension widget (string array or custom component).
6191
6544
  */
6192
6545
  setExtensionWidget(key, content, options) {
6193
- let placement = options?.placement ?? "aboveEditor", removeExisting = (map) => {
6194
- let existing = map.get(key);
6195
- existing?.dispose && existing.dispose(), map.delete(key);
6196
- };
6197
- if (removeExisting(this.extensionWidgetsAbove), removeExisting(this.extensionWidgetsBelow), content === void 0) {
6198
- this.renderWidgets();
6199
- return;
6200
- }
6201
- let component;
6546
+ let placement = options?.placement ?? "aboveEditor", component;
6202
6547
  if (Array.isArray(content)) {
6203
6548
  let container = new Container19();
6204
6549
  for (let line of content.slice(0, _InteractiveMode.MAX_WIDGET_LINES))
6205
6550
  container.addChild(new Text21(line, 1, 0));
6206
6551
  content.length > _InteractiveMode.MAX_WIDGET_LINES && container.addChild(new Text21(theme.fg("muted", "... (widget truncated)"), 1, 0)), component = container;
6207
- } else
6208
- component = content(this.ui, theme);
6209
- (placement === "belowEditor" ? this.extensionWidgetsBelow : this.extensionWidgetsAbove).set(key, component), this.renderWidgets();
6552
+ } else content && (component = content(this.ui, theme));
6553
+ replaceExtensionWidget(this.extensionWidgetsAbove, this.extensionWidgetsBelow, key, component, placement), this.renderWidgets();
6210
6554
  }
6211
6555
  clearExtensionWidgets() {
6212
6556
  for (let widget of this.extensionWidgetsAbove.values())
@@ -6232,9 +6576,9 @@ ${warningLines}`, 0, 0)), this.loadedResourcesContainer.addChild(new Spacer19(1)
6232
6576
  return;
6233
6577
  }
6234
6578
  leadingSpacer && container.addChild(new Spacer19(1));
6235
- let first = !0;
6236
- for (let component of widgets.values())
6237
- first || (container.addChild(new Spacer19(1)), container.addChild(new DynamicBorder((s) => theme.fg("dim", s)))), first = !1, container.addChild(component);
6579
+ let previousKey;
6580
+ for (let [key, component] of orderedExtensionWidgets(widgets))
6581
+ previousKey !== void 0 && (widgetSeparatorNeedsSpacer(previousKey, key) && container.addChild(new Spacer19(1)), container.addChild(new DynamicBorder((s) => theme.fg("dim", s)))), previousKey = key, container.addChild(component);
6238
6582
  }
6239
6583
  /**
6240
6584
  * Set a custom footer component, or restore the built-in footer.
@@ -6484,6 +6828,15 @@ ${message}`, ["Yes", "No"], opts) === "Yes";
6484
6828
  // =========================================================================
6485
6829
  setupKeyHandlers() {
6486
6830
  this.defaultEditor.onEscape = () => {
6831
+ let sessionId = this.session.sessionId, cancellation = getSubagentCancellation(sessionId), escapeAction = this.subagentEscape.press(sessionId, cancellation?.hasActiveRuns() ?? !1);
6832
+ if (escapeAction) {
6833
+ this.lastEscapeTime = 0, this.session.isStreaming ? this.restoreQueuedMessagesToEditor({ abort: !0 }) : this.session.isBashRunning && this.session.abortBash(), escapeAction === "children" && cancellation && cancellation.stop().then(({ requested, failed }) => {
6834
+ this.session.sessionId === sessionId && (failed ? this.showError(`Could not request stop for ${failed} async runs. Inspect subagent status.`) : requested && this.showStatus(`Stopping ${requested} async ${requested === 1 ? "run" : "runs"}`));
6835
+ }).catch((error) => {
6836
+ this.session.sessionId === sessionId && this.showError(error instanceof Error ? error.message : String(error));
6837
+ });
6838
+ return;
6839
+ }
6487
6840
  if (this.session.isStreaming)
6488
6841
  this.restoreQueuedMessagesToEditor({ abort: !0 });
6489
6842
  else if (this.session.isBashRunning)
@@ -6614,7 +6967,35 @@ ${message}`, ["Yes", "No"], opts) === "Yes";
6614
6967
  }
6615
6968
  setupEditorSubmitHandler() {
6616
6969
  this.defaultEditor.onSubmit = async (text) => {
6617
- if (text = text.trim(), !text) {
6970
+ if (text = text.trim(), text === "/reclaim" || text === "/reclaim stop") {
6971
+ let file = this.sessionManager.getSessionFile();
6972
+ try {
6973
+ if (!file)
6974
+ throw new Error("This session is not saved.");
6975
+ if (!this.runtimeHost.isDetached) {
6976
+ this.showStatus("This terminal already owns the session.");
6977
+ return;
6978
+ }
6979
+ let draft = this.editor.getText();
6980
+ await requestSessionTransfer(file, { stop: text === "/reclaim stop" }), await this.runtimeHost.switchSession(file), this.editor.setText(draft === text ? this.detachedDraft : draft), this.showStatus("Session reclaimed.");
6981
+ } catch (error) {
6982
+ this.showError(error instanceof Error ? error.message : String(error));
6983
+ }
6984
+ return;
6985
+ }
6986
+ if ((this.runtimeHost.isDetached || this.transferInProgress) && !["/quit", "/exit"].includes(text)) {
6987
+ this.showError("Session is detached or transferring. Draft retained. Use /reclaim, /reclaim stop, or /quit.");
6988
+ return;
6989
+ }
6990
+ if (text === "/handoff" || text === "/handoff cancel") {
6991
+ try {
6992
+ text === "/handoff cancel" ? cancelSessionHandoff(this.sessionManager, this.runtimeHost.services.agentDir) : markSessionHandoff(this.sessionManager, this.runtimeHost.services.agentDir), this.showStatus(text === "/handoff cancel" ? "Handoff mark cancelled." : "Marked for phone continuation for 8 hours. Busy work must finish or be explicitly stopped before transfer.");
6993
+ } catch (error) {
6994
+ this.showError(error instanceof Error ? error.message : String(error));
6995
+ }
6996
+ return;
6997
+ }
6998
+ if (text && !this.runtimeHost.isDetached && (!text.startsWith("/") || /^\/(?:model|thinking|effort|reasoning|off|minimal|low|medium|high|xhigh|max|mode|plan|read|yolo|auto|name|title|undo|edit|redo|tree|compact)(?:\s|$)/.test(text)) && recordTuiActivity(this.sessionManager, this.runtimeHost.services.agentDir), !text) {
6618
6999
  this.takeSubmittedImages(text);
6619
7000
  return;
6620
7001
  }
@@ -6712,8 +7093,8 @@ ${message}`, ["Yes", "No"], opts) === "Yes";
6712
7093
  this.editor.setText(""), this.handleModeCommand(text === "/mode" ? "" : text.slice(6).trim());
6713
7094
  return;
6714
7095
  }
6715
- if (text === "/manual" || text === "/yolo" || text === "/auto") {
6716
- this.editor.setText(""), this.applyPermissionMode(text.slice(1));
7096
+ if (text === "/read" || text === "/yolo" || text === "/auto") {
7097
+ this.editor.setText(""), this.applyPermissionMode(text === "/read" ? "read-only" : text.slice(1));
6717
7098
  return;
6718
7099
  }
6719
7100
  if (text === "/processes") {
@@ -6785,9 +7166,21 @@ ${message}`, ["Yes", "No"], opts) === "Yes";
6785
7166
  this.isExtensionCommand(text) ? (this.editor.addToHistory?.(text), this.editor.setText(""), await this.promptAfterDeferredBuiltins(text)) : this.queueCompactionMessage(text, "steer", images);
6786
7167
  return;
6787
7168
  }
6788
- if (this.session.isStreaming) {
6789
- this.editor.addToHistory?.(text), this.editor.setText(""), await this.promptAfterDeferredBuiltins(text, { streamingBehavior: "steer", images }), this.updatePendingMessagesDisplay(), this.ui.requestRender();
6790
- return;
7169
+ if (this.session.isStreaming || this.session.isWaitPromptHandoffActive) {
7170
+ if (!this.isExtensionCommand(text)) {
7171
+ await this.awaitDeferredBuiltinsForPrompt();
7172
+ let handoff = await this.session.interruptSubagentWaitWithPrompt(text, { images });
7173
+ if (handoff) {
7174
+ this.editor.addToHistory?.(text), this.editor.setText(""), handoff.completion.catch((error) => {
7175
+ this.showError(error instanceof Error ? error.message : String(error));
7176
+ }), this.ui.requestRender();
7177
+ return;
7178
+ }
7179
+ }
7180
+ if (this.session.isStreaming) {
7181
+ this.editor.addToHistory?.(text), this.editor.setText(""), await this.promptAfterDeferredBuiltins(text, { streamingBehavior: "steer", images }), this.updatePendingMessagesDisplay(), this.ui.requestRender();
7182
+ return;
7183
+ }
6791
7184
  }
6792
7185
  this.flushPendingBashComponents(), this.onInputCallback ? this.onInputCallback({ text, images }) : this.pendingUserInputs.push({ text, images }), this.editor.addToHistory?.(text);
6793
7186
  };
@@ -6797,6 +7190,13 @@ ${message}`, ["Yes", "No"], opts) === "Yes";
6797
7190
  getSmoothStreamingOptions() {
6798
7191
  return { hideThinking: this.hideThinkingBlock };
6799
7192
  }
7193
+ setThinkingAnimation(active) {
7194
+ if (!active) {
7195
+ this.thinkingAnimationTimer && clearInterval(this.thinkingAnimationTimer), this.thinkingAnimationTimer = void 0;
7196
+ return;
7197
+ }
7198
+ this.thinkingAnimationTimer || (this.thinkingAnimationTimer = setInterval(() => this.ui.requestRender(), 33), this.thinkingAnimationTimer.unref?.());
7199
+ }
6800
7200
  clearSmoothStreamingTimer() {
6801
7201
  this.smoothStreamingTimer && (clearInterval(this.smoothStreamingTimer), this.smoothStreamingTimer = void 0);
6802
7202
  }
@@ -6827,11 +7227,8 @@ ${message}`, ["Yes", "No"], opts) === "Yes";
6827
7227
  let component = this.pendingTools.get(content.id);
6828
7228
  component && component.updateArgs(content.arguments);
6829
7229
  } else {
6830
- let component = new ToolExecutionComponent(content.name, content.id, content.arguments, {
6831
- showImages: this.settingsManager.getShowImages(),
6832
- imageWidthCells: this.settingsManager.getImageWidthCells()
6833
- }, this.getRegisteredToolDefinition(content.name), this.ui, this.sessionManager.getCwd());
6834
- component.setExpanded(this.toolOutputExpanded), this.addToolComponentToChat(component), this.pendingTools.set(content.id, component);
7230
+ let component = content.name === "browser" && this.browserActivityComponent ? this.browserActivityComponent : this.createToolExecutionComponent(content.name, content.id, content.arguments);
7231
+ this.pendingTools.set(content.id, component);
6835
7232
  }
6836
7233
  }
6837
7234
  advanceSmoothStreaming() {
@@ -6849,7 +7246,7 @@ ${message}`, ["Yes", "No"], opts) === "Yes";
6849
7246
  this.streamingDisplayedLength += computeSmoothRevealStep(backlog), this.streamingDisplayedLength > total && (this.streamingDisplayedLength = total), this.paintSmoothStreamingFrame(), this.streamingDisplayedLength >= total && this.clearSmoothStreamingTimer();
6850
7247
  }
6851
7248
  stopSmoothStreaming() {
6852
- this.clearSmoothStreamingTimer(), this.streamingTargetMessage = void 0, this.streamingDisplayedLength = 0;
7249
+ this.setThinkingAnimation(!1), this.clearSmoothStreamingTimer(), this.streamingTargetMessage = void 0, this.streamingDisplayedLength = 0;
6853
7250
  }
6854
7251
  /** Apply a mid-stream smoothStreaming setting change without rewinding. */
6855
7252
  applySmoothStreamingSettingChange(enabled) {
@@ -6871,7 +7268,7 @@ ${message}`, ["Yes", "No"], opts) === "Yes";
6871
7268
  async handleEvent(event) {
6872
7269
  switch (this.isInitialized || await this.init(), this.footer.invalidate(), event.type) {
6873
7270
  case "agent_start":
6874
- this.pendingTools.clear(), this.settingsManager.getShowTerminalProgress() && this.ui.terminal.setProgress(!0), this.retryEscapeHandler && (this.defaultEditor.onEscape = this.retryEscapeHandler, this.retryEscapeHandler = void 0), this.workingVisible ? this.showStatusIndicator(new WorkingStatusIndicator(this.ui, this.workingMessage ?? this.defaultWorkingMessage, this.workingIndicatorOptions)) : this.clearStatusIndicator(), this.ui.requestRender();
7271
+ this.pendingTools.clear(), this.browserActivityComponent = void 0, this.settingsManager.getShowTerminalProgress() && this.ui.terminal.setProgress(!0), this.retryEscapeHandler && (this.defaultEditor.onEscape = this.retryEscapeHandler, this.retryEscapeHandler = void 0), this.workingVisible ? this.showStatusIndicator(new WorkingStatusIndicator(this.ui, this.workingMessage ?? this.defaultWorkingMessage, this.workingIndicatorOptions)) : this.clearStatusIndicator(), this.ui.requestRender();
6875
7272
  break;
6876
7273
  case "queue_update":
6877
7274
  this.updatePendingMessagesDisplay(), this.ui.requestRender();
@@ -6886,7 +7283,11 @@ ${message}`, ["Yes", "No"], opts) === "Yes";
6886
7283
  this.footer.invalidate(), this.updateEditorBorderColor();
6887
7284
  break;
6888
7285
  case "message_start":
6889
- event.message.role === "custom" ? (this.addMessageToChat(event.message), this.ui.requestRender()) : event.message.role === "user" ? (this.redoStack.length = 0, beginTurn(this.sessionManager.getCwd(), this.sessionManager.getSessionId()), this.stopSmoothStreaming(), this.addMessageToChat(event.message), this.updatePendingMessagesDisplay(), this.ui.requestRender()) : event.message.role === "assistant" && (this.streamingComponent = new AssistantMessageComponent(void 0, this.hideThinkingBlock, this.getMarkdownThemeWithSettings(), this.hiddenThinkingLabel, this.outputPad, this.thinkingCollapse), this.thinkingRunTimings = [], this.streamingComponent.setThinkingTimings(this.thinkingRunTimings), this.streamingComponent.setExpanded(this.toolOutputExpanded), this.streamingMessage = event.message, this.streamingTargetMessage = event.message, this.streamingDisplayedLength = 0, this.chatContainer.addChild(this.streamingComponent), this.settingsManager.getSmoothStreaming() ? this.streamingComponent.updateContent(sliceMessageContent(this.streamingMessage, 0, this.getSmoothStreamingOptions()), { thinkingSource: this.streamingMessage }) : this.streamingComponent.updateContent(this.streamingMessage), this.ui.requestRender());
7286
+ event.message.role === "custom" ? (this.addMessageToChat(event.message), this.ui.requestRender()) : event.message.role === "user" ? (this.redoStack.length = 0, beginTurn(this.sessionManager.getCwd(), this.sessionManager.getSessionId()), this.stopSmoothStreaming(), this.addMessageToChat(event.message), this.updatePendingMessagesDisplay(), this.ui.requestRender()) : event.message.role === "assistant" && (this.streamingComponent = new AssistantMessageComponent(void 0, this.hideThinkingBlock, this.getMarkdownThemeWithSettings(), this.hiddenThinkingLabel, this.outputPad, this.thinkingCollapse, {
7287
+ requestRender: () => this.ui.requestRender(),
7288
+ reasoningDisplay: this.settingsManager.getReasoningDisplay(),
7289
+ onThinkingAnimationChange: (active) => this.setThinkingAnimation(active)
7290
+ }), this.thinkingRunTimings = [], this.streamingComponent.setThinkingTimings(this.thinkingRunTimings), this.streamingComponent.setExpanded(this.toolOutputExpanded), this.streamingMessage = event.message, this.streamingTargetMessage = event.message, this.streamingDisplayedLength = 0, this.chatContainer.addChild(this.streamingComponent), this.settingsManager.getSmoothStreaming() ? this.streamingComponent.updateContent(sliceMessageContent(this.streamingMessage, 0, this.getSmoothStreamingOptions()), { thinkingSource: this.streamingMessage }) : this.streamingComponent.updateContent(this.streamingMessage), this.ui.requestRender());
6890
7291
  break;
6891
7292
  case "message_update":
6892
7293
  if (this.streamingComponent && event.message.role === "assistant")
@@ -6929,10 +7330,7 @@ ${message}`, ["Yes", "No"], opts) === "Yes";
6929
7330
  this.streamingDisplayedLength < needed && (this.streamingDisplayedLength = needed), this.paintSmoothStreamingFrame();
6930
7331
  }
6931
7332
  let component = this.pendingTools.get(event.toolCallId);
6932
- component || (component = new ToolExecutionComponent(event.toolName, event.toolCallId, event.args, {
6933
- showImages: this.settingsManager.getShowImages(),
6934
- imageWidthCells: this.settingsManager.getImageWidthCells()
6935
- }, this.getRegisteredToolDefinition(event.toolName), this.ui, this.sessionManager.getCwd()), component.setExpanded(this.toolOutputExpanded), this.addToolComponentToChat(component), this.pendingTools.set(event.toolCallId, component)), component.markExecutionStarted(), this.ui.requestRender();
7333
+ component ? event.toolName === "browser" && !component.matchesToolCall(event.toolCallId) && component.beginNextExecution(event.toolCallId, event.args) : (component = this.createToolExecutionComponent(event.toolName, event.toolCallId, event.args), this.pendingTools.set(event.toolCallId, component)), component.markExecutionStarted(), this.ui.requestRender();
6936
7334
  break;
6937
7335
  }
6938
7336
  case "tool_execution_update": {
@@ -6946,7 +7344,7 @@ ${message}`, ["Yes", "No"], opts) === "Yes";
6946
7344
  break;
6947
7345
  }
6948
7346
  case "agent_end":
6949
- this.session.refreshModelFromRegistry(), this.settingsManager.getShowTerminalProgress() && this.ui.terminal.setProgress(!1), this.clearStatusIndicator("working"), this.stopSmoothStreaming(), this.streamingComponent && (this.chatContainer.removeChild(this.streamingComponent), this.streamingComponent = void 0, this.streamingMessage = void 0), this.pendingTools.clear(), this.maybeAutoNameSession(), captureTreeChanges(this.sessionManager.getCwd(), this.sessionManager.getSessionId()), this.ui.requestRender();
7347
+ this.session.refreshModelFromRegistry(), this.settingsManager.getShowTerminalProgress() && this.ui.terminal.setProgress(!1), this.clearStatusIndicator("working"), this.stopSmoothStreaming(), this.streamingComponent && (this.chatContainer.removeChild(this.streamingComponent), this.streamingComponent = void 0, this.streamingMessage = void 0), this.pendingTools.clear(), this.browserActivityComponent = void 0, this.maybeAutoNameSession(), captureTreeChanges(this.sessionManager.getCwd(), this.sessionManager.getSessionId()), this.ui.requestRender();
6950
7348
  break;
6951
7349
  case "agent_settled":
6952
7350
  if (this.pendingCompactionRender) {
@@ -7067,7 +7465,10 @@ ${message}`, ["Yes", "No"], opts) === "Yes";
7067
7465
  break;
7068
7466
  }
7069
7467
  case "assistant": {
7070
- let assistantComponent = new AssistantMessageComponent(message, this.hideThinkingBlock, this.getMarkdownThemeWithSettings(), this.hiddenThinkingLabel, this.outputPad, this.thinkingCollapse);
7468
+ let assistantComponent = new AssistantMessageComponent(message, this.hideThinkingBlock, this.getMarkdownThemeWithSettings(), this.hiddenThinkingLabel, this.outputPad, this.thinkingCollapse, {
7469
+ requestRender: () => this.ui.requestRender(),
7470
+ reasoningDisplay: this.settingsManager.getReasoningDisplay()
7471
+ });
7071
7472
  assistantComponent.setThinkingTimings(this.thinkingTimingsByMessage.get(message)), assistantComponent.setExpanded(this.toolOutputExpanded), this.chatContainer.addChild(assistantComponent);
7072
7473
  break;
7073
7474
  }
@@ -7080,7 +7481,7 @@ ${message}`, ["Yes", "No"], opts) === "Yes";
7080
7481
  }
7081
7482
  renderSessionItems(items, options = {}) {
7082
7483
  this.pendingTools.clear();
7083
- let renderedPendingTools = /* @__PURE__ */ new Map(), cacheMisses = this.settingsManager.getShowCacheMissNotices() ? collectCacheMisses(this.sessionManager.getEntries(), this.session.modelRuntime) : /* @__PURE__ */ new Map();
7484
+ let browserActivityComponent, renderedPendingTools = /* @__PURE__ */ new Map(), cacheMisses = this.settingsManager.getShowCacheMissNotices() ? collectCacheMisses(this.sessionManager.getEntries(), this.session.modelRuntime) : /* @__PURE__ */ new Map();
7084
7485
  options.updateFooter && (this.footer.invalidate(), this.updateEditorBorderColor());
7085
7486
  for (let item of items) {
7086
7487
  if (isCustomSessionEntry(item)) {
@@ -7092,11 +7493,11 @@ ${message}`, ["Yes", "No"], opts) === "Yes";
7092
7493
  this.addMessageToChat(message);
7093
7494
  for (let content of message.content)
7094
7495
  if (content.type === "toolCall") {
7095
- let component = new ToolExecutionComponent(content.name, content.id, content.arguments, {
7496
+ let component = content.name === "browser" ? browserActivityComponent : void 0;
7497
+ if (component ? component.beginNextExecution(content.id, content.arguments) : (component = new ToolExecutionComponent(content.name, content.id, content.arguments, {
7096
7498
  showImages: this.settingsManager.getShowImages(),
7097
7499
  imageWidthCells: this.settingsManager.getImageWidthCells()
7098
- }, this.getRegisteredToolDefinition(content.name), this.ui, this.sessionManager.getCwd());
7099
- if (component.setExpanded(this.toolOutputExpanded), this.addToolComponentToChat(component), message.stopReason === "aborted" || message.stopReason === "error") {
7500
+ }, this.getRegisteredToolDefinition(content.name), this.ui, this.sessionManager.getCwd()), component.setExpanded(this.toolOutputExpanded), this.addToolComponentToChat(component), content.name === "browser" && (browserActivityComponent = component)), message.stopReason === "aborted" || message.stopReason === "error") {
7100
7501
  let errorMessage;
7101
7502
  if (message.stopReason === "aborted") {
7102
7503
  let retryAttempt = this.session.retryAttempt;
@@ -7115,7 +7516,7 @@ ${message}`, ["Yes", "No"], opts) === "Yes";
7115
7516
  let component = renderedPendingTools.get(message.toolCallId);
7116
7517
  component && (component.updateResult(message), renderedPendingTools.delete(message.toolCallId));
7117
7518
  } else
7118
- this.addMessageToChat(message, options);
7519
+ message.role === "user" && (browserActivityComponent = void 0), this.addMessageToChat(message, options);
7119
7520
  }
7120
7521
  for (let [toolCallId, component] of renderedPendingTools)
7121
7522
  this.pendingTools.set(toolCallId, component);
@@ -7174,7 +7575,7 @@ ${message}`, ["Yes", "No"], opts) === "Yes";
7174
7575
  });
7175
7576
  }
7176
7577
  rebuildChatFromMessages() {
7177
- this.chatContainer.clear(), this.renderSessionEntries(this.sessionManager.buildContextEntries());
7578
+ this.clearChatContainer(), this.renderSessionEntries(this.sessionManager.buildContextEntries());
7178
7579
  }
7179
7580
  // =========================================================================
7180
7581
  // Key handlers
@@ -7195,7 +7596,7 @@ ${message}`, ["Yes", "No"], opts) === "Yes";
7195
7596
  async shutdown(options) {
7196
7597
  if (this.isShuttingDown)
7197
7598
  return;
7198
- if (this.isShuttingDown = !0, this.stopSmoothStreaming(), this.planUsageTimer && (clearInterval(this.planUsageTimer), this.planUsageTimer = void 0), getUsageServiceBridge()?.setOnUpdate(void 0), options?.fromSignal) {
7599
+ if (this.isShuttingDown = !0, this.unregisterSessionTransfer?.(), this.stopSmoothStreaming(), this.planUsageTimer && (clearInterval(this.planUsageTimer), this.planUsageTimer = void 0), getUsageServiceBridge()?.setOnUpdate(void 0), options?.fromSignal) {
7199
7600
  await this.runtimeHost.dispose(), this.themeController.disableAutoSync(), await this.ui.terminal.drainInput(1e3);
7200
7601
  try {
7201
7602
  killAll();
@@ -7296,6 +7697,10 @@ Kill them before exit?`) && killAll(), this.stop(), await this.runtimeHost.dispo
7296
7697
  }
7297
7698
  }
7298
7699
  async handleFollowUp() {
7700
+ if (this.runtimeHost.isDetached || this.transferInProgress) {
7701
+ this.showError("Use /reclaim before sending more work. Draft retained.");
7702
+ return;
7703
+ }
7299
7704
  let text = (this.editor.getExpandedText?.() ?? this.editor.getText()).trim();
7300
7705
  if (text) {
7301
7706
  if (this.session.isCompacting) {
@@ -7330,21 +7735,26 @@ Kill them before exit?`) && killAll(), this.stop(), await this.runtimeHost.dispo
7330
7735
  this.ui.requestRender();
7331
7736
  }
7332
7737
  cycleThinkingLevel() {
7333
- this.session.cycleThinkingLevel() === void 0 ? this.showStatus("Current model does not support thinking") : (this.footer.invalidate(), this.updateEditorBorderColor());
7738
+ if (this.runtimeHost.isDetached || this.transferInProgress)
7739
+ return;
7740
+ recordTuiActivity(this.sessionManager, this.runtimeHost.services.agentDir), this.session.cycleThinkingLevel() === void 0 ? this.showStatus("Current model does not support thinking") : (this.footer.invalidate(), this.updateEditorBorderColor());
7334
7741
  }
7335
7742
  cyclePermissionMode() {
7336
7743
  this.applyPermissionMode(nextPermissionMode(getPermissionMode()), { silent: !0 });
7337
7744
  }
7338
7745
  async cycleModel(direction) {
7339
- try {
7340
- let result = await this.session.cycleModel(direction);
7341
- if (result === void 0) {
7342
- let msg = this.session.scopedModels.length > 0 ? "Only one model in scope" : "Only one model available";
7343
- this.showStatus(msg);
7344
- } else
7345
- this.footer.invalidate(), this.updateEditorBorderColor(), this.maybeWarnAboutAnthropicSubscriptionAuth(result.model);
7346
- } catch (error) {
7347
- this.showError(error instanceof Error ? error.message : String(error));
7746
+ if (!(this.runtimeHost.isDetached || this.transferInProgress)) {
7747
+ recordTuiActivity(this.sessionManager, this.runtimeHost.services.agentDir);
7748
+ try {
7749
+ let result = await this.session.cycleModel(direction);
7750
+ if (result === void 0) {
7751
+ let msg = this.session.scopedModels.length > 0 ? "Only one model in scope" : "Only one model available";
7752
+ this.showStatus(msg);
7753
+ } else
7754
+ this.footer.invalidate(), this.updateEditorBorderColor(), this.maybeWarnAboutAnthropicSubscriptionAuth(result.model);
7755
+ } catch (error) {
7756
+ this.showError(error instanceof Error ? error.message : String(error));
7757
+ }
7348
7758
  }
7349
7759
  }
7350
7760
  toggleToolOutputExpansion() {
@@ -7359,6 +7769,23 @@ Kill them before exit?`) && killAll(), this.stop(), await this.runtimeHost.dispo
7359
7769
  isExpandable(child) && child.setExpanded(expanded);
7360
7770
  globalThis[/* @__PURE__ */ Symbol.for("@lunr/tools-expanded-changed")]?.(expanded), this.ui.requestRender();
7361
7771
  }
7772
+ createToolExecutionComponent(toolName, toolCallId, args) {
7773
+ if (toolName === "browser" && this.browserActivityComponent)
7774
+ return this.browserActivityComponent.beginNextExecution(toolCallId, args), this.browserActivityComponent;
7775
+ let component = new ToolExecutionComponent(toolName, toolCallId, args, {
7776
+ showImages: this.settingsManager.getShowImages(),
7777
+ imageWidthCells: this.settingsManager.getImageWidthCells()
7778
+ }, this.getRegisteredToolDefinition(toolName), this.ui, this.sessionManager.getCwd());
7779
+ return component.setExpanded(this.toolOutputExpanded), this.addToolComponentToChat(component), toolName === "browser" && (this.browserActivityComponent = component), component;
7780
+ }
7781
+ disposeChatToolComponents() {
7782
+ for (let child of this.chatContainer.children)
7783
+ child instanceof ToolExecutionComponent && child.dispose();
7784
+ this.browserActivityComponent = void 0;
7785
+ }
7786
+ clearChatContainer() {
7787
+ this.disposeChatToolComponents(), this.chatContainer.clear();
7788
+ }
7362
7789
  // lunr: consecutive same-tool grouping — a tool component appended right after
7363
7790
  // another component for the SAME tool becomes a group continuation (no top
7364
7791
  // spacer / top pad); the previous card drops its bottom pad. Mixed neighbors
@@ -7368,7 +7795,7 @@ Kill them before exit?`) && killAll(), this.stop(), await this.runtimeHost.dispo
7368
7795
  applySameToolGrouping(last instanceof ToolExecutionComponent ? last : void 0, component), this.chatContainer.addChild(component);
7369
7796
  }
7370
7797
  toggleThinkingBlockVisibility() {
7371
- if (this.hideThinkingBlock = !this.hideThinkingBlock, this.settingsManager.setHideThinkingBlock(this.hideThinkingBlock), this.chatContainer.clear(), this.rebuildChatFromMessages(), this.streamingComponent && this.streamingMessage) {
7798
+ if (this.hideThinkingBlock = !this.hideThinkingBlock, this.settingsManager.setHideThinkingBlock(this.hideThinkingBlock), this.rebuildChatFromMessages(), this.streamingComponent && this.streamingMessage) {
7372
7799
  if (this.streamingComponent.setHideThinkingBlock(this.hideThinkingBlock), this.settingsManager.getSmoothStreaming() && this.streamingTargetMessage) {
7373
7800
  let opts = this.getSmoothStreamingOptions(), total = countMessageGraphemes(this.streamingTargetMessage, opts);
7374
7801
  this.streamingDisplayedLength > total && (this.streamingDisplayedLength = total), this.paintSmoothStreamingFrame(), this.streamingDisplayedLength < total && this.startSmoothStreaming();
@@ -7485,7 +7912,7 @@ Pi will resume when the editor exits.
7485
7912
  return !!extensionRunner.getCommand(commandName);
7486
7913
  }
7487
7914
  renderCompactionResult(result) {
7488
- this.chatContainer.clear(), this.rebuildChatFromMessages(), this.addMessageToChat(createCompactionSummaryMessage(result.summary, result.tokensBefore, (/* @__PURE__ */ new Date()).toISOString())), this.footer.invalidate();
7915
+ this.rebuildChatFromMessages(), this.addMessageToChat(createCompactionSummaryMessage(result.summary, result.tokensBefore, (/* @__PURE__ */ new Date()).toISOString())), this.footer.invalidate();
7489
7916
  }
7490
7917
  async flushCompactionQueue(options) {
7491
7918
  if (this.compactionQueuedMessages.length === 0)
@@ -7564,6 +7991,7 @@ Pi will resume when the editor exits.
7564
7991
  availableThemes: getAvailableThemes(),
7565
7992
  hideThinkingBlock: this.hideThinkingBlock,
7566
7993
  thinkingCollapse: this.thinkingCollapse,
7994
+ reasoningDisplay: this.settingsManager.getReasoningDisplay(),
7567
7995
  cacheRetention: this.settingsManager.getCacheRetention() ?? "short",
7568
7996
  doubleEscapeAction: this.settingsManager.getDoubleEscapeAction(),
7569
7997
  treeFilterMode: this.settingsManager.getTreeFilterMode(),
@@ -7575,6 +8003,7 @@ Pi will resume when the editor exits.
7575
8003
  autocompleteMaxVisible: this.settingsManager.getAutocompleteMaxVisible(),
7576
8004
  quietStartup: this.settingsManager.getQuietStartup(),
7577
8005
  smoothStreaming: this.settingsManager.getSmoothStreaming(),
8006
+ subagentSpinner: this.settingsManager.getSubagentSpinner(),
7578
8007
  sessionRetentionDays: this.settingsManager.getSessionRetentionDays(),
7579
8008
  clearOnShrink: this.settingsManager.getClearOnShrink(),
7580
8009
  showTerminalProgress: this.settingsManager.getShowTerminalProgress(),
@@ -7585,8 +8014,12 @@ Pi will resume when the editor exits.
7585
8014
  confirmLargeSubagentLaunches: this.settingsManager.getConfirmLargeSubagentLaunches(),
7586
8015
  computerUse: this.settingsManager.getComputerUse(),
7587
8016
  computerForeground: this.settingsManager.getComputerForeground(),
8017
+ subagentCommunicationEnabled: this.settingsManager.getSubagentCommunicationEnabled(),
8018
+ automaticSubagentDelegation: this.settingsManager.getAutomaticSubagentDelegation(),
8019
+ browserEnabled: this.settingsManager.getBrowserEnabled(),
7588
8020
  memoryEnabled: this.settingsManager.getMemoryEnabled(),
7589
8021
  memoryCharCap: this.settingsManager.getMemoryCharCap(),
8022
+ todosEnabled: this.settingsManager.getTodosEnabled(),
7590
8023
  searchCurator: getSearchCuratorSetting(),
7591
8024
  // lunr: TUI customize settings
7592
8025
  footerMcp: this.settingsManager.getFooterMcp(),
@@ -7657,13 +8090,19 @@ Pi will resume when the editor exits.
7657
8090
  this.hideThinkingBlock = hidden, this.settingsManager.setHideThinkingBlock(hidden);
7658
8091
  for (let child of this.chatContainer.children)
7659
8092
  child instanceof AssistantMessageComponent && child.setHideThinkingBlock(hidden);
7660
- this.chatContainer.clear(), this.rebuildChatFromMessages();
8093
+ this.rebuildChatFromMessages();
7661
8094
  },
7662
8095
  onThinkingCollapseChange: (collapse) => {
7663
8096
  this.thinkingCollapse = collapse, this.settingsManager.setThinkingCollapse(collapse);
7664
8097
  for (let child of this.chatContainer.children)
7665
8098
  child instanceof AssistantMessageComponent && child.setThinkingCollapse(collapse);
7666
- this.chatContainer.clear(), this.rebuildChatFromMessages();
8099
+ this.rebuildChatFromMessages();
8100
+ },
8101
+ onReasoningDisplayChange: (display) => {
8102
+ this.settingsManager.setReasoningDisplay(display);
8103
+ for (let child of this.chatContainer.children)
8104
+ child instanceof AssistantMessageComponent && child.setReasoningDisplay(this.settingsManager.getReasoningDisplay());
8105
+ this.ui.requestRender();
7667
8106
  },
7668
8107
  onShowCacheMissNoticesChange: (shown) => {
7669
8108
  this.settingsManager.setShowCacheMissNotices(shown), this.rebuildChatFromMessages();
@@ -7677,6 +8116,9 @@ Pi will resume when the editor exits.
7677
8116
  onSmoothStreamingChange: (enabled) => {
7678
8117
  this.applySmoothStreamingSettingChange(enabled);
7679
8118
  },
8119
+ onSubagentSpinnerChange: (spinner) => {
8120
+ this.settingsManager.setSubagentSpinner(spinner), this.ui.requestRender();
8121
+ },
7680
8122
  onSessionRetentionDaysChange: (days) => {
7681
8123
  this.settingsManager.setSessionRetentionDays(days);
7682
8124
  },
@@ -7731,6 +8173,12 @@ Pi will resume when the editor exits.
7731
8173
  onConfirmLargeSubagentLaunchesChange: (enabled) => {
7732
8174
  this.settingsManager.setConfirmLargeSubagentLaunches(enabled);
7733
8175
  },
8176
+ onSubagentCommunicationChange: (enabled) => {
8177
+ this.settingsManager.setSubagentCommunicationEnabled(enabled);
8178
+ },
8179
+ onAutomaticSubagentDelegationChange: (enabled) => {
8180
+ this.settingsManager.setAutomaticSubagentDelegation(enabled), this.session.refreshToolRegistry();
8181
+ },
7734
8182
  getTierThinkingLevels: (tier) => {
7735
8183
  let model = this.resolveModelReference(this.settingsManager.getTierModel(tier));
7736
8184
  return model ? getSupportedThinkingLevels(model) : this.session.getAvailableThinkingLevels();
@@ -7744,9 +8192,15 @@ Pi will resume when the editor exits.
7744
8192
  onComputerForegroundChange: (enabled) => {
7745
8193
  this.settingsManager.setComputerForeground(enabled);
7746
8194
  },
8195
+ onBrowserEnabledChange: (enabled) => {
8196
+ this.settingsManager.setBrowserEnabled(enabled), this.session.refreshToolRegistry();
8197
+ },
7747
8198
  onMemoryEnabledChange: (enabled) => {
7748
8199
  this.settingsManager.setMemoryEnabled(enabled), this.session.refreshToolRegistry(), this.showStatus(`Agent memory: ${enabled ? "on" : "off"}`);
7749
8200
  },
8201
+ onTodosEnabledChange: (enabled) => {
8202
+ this.settingsManager.setTodosEnabled(enabled), notifyTodosEnabledChanged(enabled), this.session.refreshToolRegistry();
8203
+ },
7750
8204
  onSearchCuratorChange: (setting) => {
7751
8205
  setSearchCuratorSetting(setting) || this.showError("pi-web-access is not loaded; curator setting unavailable.");
7752
8206
  },
@@ -7784,6 +8238,31 @@ Pi will resume when the editor exits.
7784
8238
  onPlanUsageWindowChange: (window) => {
7785
8239
  this.settingsManager.setPlanUsageWindow(window);
7786
8240
  },
8241
+ onGatewayAction: (action) => {
8242
+ (async () => {
8243
+ if (this.session.isStreaming) {
8244
+ this.showStatus("Wait for the current turn before managing the gateway.");
8245
+ return;
8246
+ }
8247
+ if (action === "status") {
8248
+ this.showStatus((await import("./service-HGGU3STY.js")).serviceStatusText());
8249
+ return;
8250
+ }
8251
+ this.ui.stop();
8252
+ try {
8253
+ await new Promise((resolve4, reject) => {
8254
+ let child = spawn3(process.execPath, [process.argv[1], "gateway", ...action.split(" ")], {
8255
+ stdio: "inherit",
8256
+ env: process.env
8257
+ });
8258
+ child.once("error", reject), child.once("exit", (code) => code === 0 ? resolve4() : reject(new Error(`Gateway command exited with code ${code}. Run lunr gateway doctor.`)));
8259
+ });
8260
+ } finally {
8261
+ this.ui.start(), this.ui.requestRender(!0);
8262
+ }
8263
+ this.showStatus((await import("./service-HGGU3STY.js")).serviceStatusText());
8264
+ })().catch((error) => this.showStatus(error instanceof Error ? error.message : String(error)));
8265
+ },
7787
8266
  onDefaultPermissionModeChange: (mode) => {
7788
8267
  this.settingsManager.setDefaultPermissionMode(mode);
7789
8268
  },
@@ -7813,6 +8292,7 @@ Pi will resume when the editor exits.
7813
8292
  autoManage: () => this.settingsManager.getAutoManageSubscriptions(),
7814
8293
  requestRender: () => this.ui.requestRender()
7815
8294
  },
8295
+ requestRender: () => this.ui.requestRender(),
7816
8296
  createModelTierPicker: (_tier, currentModelRef, done2) => new ModelSelectorComponent(this.ui, this.resolveModelReference(currentModelRef), this.settingsManager, this.session.modelRuntime, this.session.scopedModels, (model) => {
7817
8297
  done2(`${model.provider}/${model.id}`), this.ui.requestRender();
7818
8298
  }, () => {
@@ -7954,6 +8434,8 @@ Pi will resume when the editor exits.
7954
8434
  });
7955
8435
  }
7956
8436
  async showModelSelector(initialSearchInput) {
8437
+ if (this.runtimeHost.isDetached || this.transferInProgress)
8438
+ return;
7957
8439
  let subscriptionNames = await this.getActiveSubscriptionNames();
7958
8440
  this.showSelector((done) => {
7959
8441
  let selector = new ModelSelectorComponent(this.ui, this.session.model, this.settingsManager, this.session.modelRuntime, this.session.scopedModels, async (model) => {
@@ -8090,6 +8572,8 @@ Pi will resume when the editor exits.
8090
8572
  });
8091
8573
  }
8092
8574
  showUserMessageSelector() {
8575
+ if (this.runtimeHost.isDetached || this.transferInProgress)
8576
+ return;
8093
8577
  let userMessages = this.session.getUserMessagesForForking();
8094
8578
  if (userMessages.length === 0) {
8095
8579
  this.showStatus("No messages to fork from");
@@ -8132,6 +8616,8 @@ Pi will resume when the editor exits.
8132
8616
  }
8133
8617
  }
8134
8618
  showTreeSelector(initialSelectedId) {
8619
+ if (this.runtimeHost.isDetached || this.transferInProgress)
8620
+ return;
8135
8621
  let tree = this.sessionManager.getTree(), realLeafId = this.sessionManager.getLeafId(), initialFilterMode = this.settingsManager.getTreeFilterMode();
8136
8622
  if (tree.length === 0) {
8137
8623
  this.showStatus("No entries in session");
@@ -8176,7 +8662,7 @@ Pi will resume when the editor exits.
8176
8662
  this.showStatus("Navigation cancelled");
8177
8663
  return;
8178
8664
  }
8179
- this.chatContainer.clear(), this.renderInitialMessages(), result.editorText && !this.editor.getText().trim() && this.restoreEditorFromTreeResult(result), this.showStatus("Navigated to selected point"), this.flushCompactionQueue({ willRetry: !1 });
8665
+ this.clearChatContainer(), this.renderInitialMessages(), result.editorText && !this.editor.getText().trim() && this.restoreEditorFromTreeResult(result), this.showStatus("Navigated to selected point"), this.flushCompactionQueue({ willRetry: !1 });
8180
8666
  } catch (error) {
8181
8667
  this.showError(error instanceof Error ? error.message : String(error));
8182
8668
  } finally {
@@ -8213,7 +8699,16 @@ Pi will resume when the editor exits.
8213
8699
  let next = (nextName ?? "").trim();
8214
8700
  if (!next)
8215
8701
  return;
8216
- SessionManager.open(sessionFilePath).appendSessionInfo(next);
8702
+ if (sessionFilePath === this.sessionManager.getSessionFile() && !this.runtimeHost.isDetached) {
8703
+ this.sessionManager.appendSessionInfo(next);
8704
+ return;
8705
+ }
8706
+ let mgr = SessionManager.open(sessionFilePath);
8707
+ try {
8708
+ mgr.appendSessionInfo(next);
8709
+ } finally {
8710
+ mgr.dispose();
8711
+ }
8217
8712
  },
8218
8713
  showRenameHint: !0,
8219
8714
  keybindings: this.keybindings
@@ -8269,8 +8764,8 @@ Pi will resume when the editor exits.
8269
8764
  }
8270
8765
  async getLogoutProviderOptions() {
8271
8766
  let options = [];
8272
- for (let { providerId, type } of await this.session.modelRuntime.listCredentials()) {
8273
- let name = this.session.modelRuntime.getProvider(providerId)?.name ?? providerId, status = { type, source: "stored credential" };
8767
+ for (let { providerId, type: credentialType } of await this.session.modelRuntime.listCredentials()) {
8768
+ let type = credentialType === "external_claude_code" ? "oauth" : credentialType, name = this.session.modelRuntime.getProvider(providerId)?.name ?? providerId, status = { type, source: "stored credential" };
8274
8769
  if (type === "api_key") {
8275
8770
  let subs = await this.session.modelRuntime.subscriptionManager.list(providerId);
8276
8771
  if (subs.length > 1) {
@@ -8674,7 +9169,22 @@ Pi will resume when the editor exits.
8674
9169
  return this.session.modelRuntime.login(providerId, method, {
8675
9170
  signal: dialog.signal,
8676
9171
  prompt: (prompt) => this.showAuthPrompt(dialog, prompt),
8677
- notify: (event) => this.notifyAuthDialog(dialog, event)
9172
+ notify: (event) => this.notifyAuthDialog(dialog, event),
9173
+ handoff: async (command, args, env) => {
9174
+ this.ui.stop();
9175
+ try {
9176
+ await new Promise((resolve4, reject) => {
9177
+ let child = spawn3(command, [...args], { stdio: "inherit", env, windowsHide: !1 }), abort = () => child.kill();
9178
+ dialog.signal.addEventListener("abort", abort, { once: !0 }), dialog.signal.aborted && abort(), child.once("error", (error) => {
9179
+ dialog.signal.removeEventListener("abort", abort), reject(error);
9180
+ }), child.once("close", (code) => {
9181
+ dialog.signal.removeEventListener("abort", abort), code === 0 ? resolve4() : reject(new Error("Claude Code login did not complete"));
9182
+ });
9183
+ });
9184
+ } finally {
9185
+ this.ui.start();
9186
+ }
9187
+ }
8678
9188
  });
8679
9189
  }
8680
9190
  async showLoginDialog(providerId, providerName) {
@@ -8755,7 +9265,7 @@ ${INIT_EXISTING_FILE_INSTRUCTIONS.append}`;
8755
9265
  this.showStatus(command === "undo" ? "Undo cancelled" : "Edit cancelled");
8756
9266
  return;
8757
9267
  }
8758
- return leafId && this.redoStack.push(leafId), this.chatContainer.clear(), this.renderInitialMessages(), this.flushCompactionQueue({ willRetry: !1 }), { editorText: result.editorText, editorImages: result.editorImages };
9268
+ return leafId && this.redoStack.push(leafId), this.clearChatContainer(), this.renderInitialMessages(), this.flushCompactionQueue({ willRetry: !1 }), { editorText: result.editorText, editorImages: result.editorImages };
8759
9269
  } catch (error) {
8760
9270
  this.showError(error instanceof Error ? error.message : String(error));
8761
9271
  return;
@@ -8787,7 +9297,7 @@ ${INIT_EXISTING_FILE_INSTRUCTIONS.append}`;
8787
9297
  this.redoStack.push(targetId), this.showStatus("Navigation cancelled");
8788
9298
  return;
8789
9299
  }
8790
- this.chatContainer.clear(), this.renderInitialMessages(), result.editorText && !this.editor.getText().trim() && this.restoreEditorFromTreeResult(result), this.showStatus("Redone"), this.flushCompactionQueue({ willRetry: !1 });
9300
+ this.clearChatContainer(), this.renderInitialMessages(), result.editorText && !this.editor.getText().trim() && this.restoreEditorFromTreeResult(result), this.showStatus("Redone"), this.flushCompactionQueue({ willRetry: !1 });
8791
9301
  } catch (error) {
8792
9302
  this.showError(error instanceof Error ? error.message : String(error));
8793
9303
  }
@@ -9132,56 +9642,54 @@ ${theme.fg("dim", "Cache Re-billed:")} ${detail}`;
9132
9642
  this.chatContainer.addChild(new Spacer19(1)), this.chatContainer.addChild(new Text21(lines.join(`
9133
9643
  `), 1, 0)), this.ui.requestRender();
9134
9644
  }
9135
- // lunr: /plan — shortcut onto the plan permission mode (not a second state machine).
9645
+ // /plan is a shortcut into read-only mode for planning.
9136
9646
  async handlePlanCommand(args) {
9137
- let sub = args.toLowerCase(), inPlan = getPermissionMode() === "plan";
9647
+ let sub = args.toLowerCase(), inReadOnly = getPermissionMode() === "read-only";
9138
9648
  if (sub === "status") {
9139
- this.showStatus(inPlan ? "Plan mode is active \u2014 edit/write and mutating bash are blocked. /plan off to implement." : `Permission mode: ${getPermissionMode()}.`);
9649
+ this.showStatus(inReadOnly ? "Read mode is active. /plan off to leave it." : `Permission mode: ${getPermissionMode()}.`);
9140
9650
  return;
9141
9651
  }
9142
9652
  if (sub !== "" && sub !== "on" && sub !== "off") {
9143
- inPlan ? this.applyPermissionMode(this.restoreTargetAfterPlan()) : this.applyPermissionMode("plan"), await this.sendUserMessageAfterDeferredBuiltins(args);
9653
+ inReadOnly || this.applyPermissionMode("read-only"), await this.sendUserMessageAfterDeferredBuiltins(`Create a plan for: ${args}`);
9144
9654
  return;
9145
9655
  }
9146
- let next = sub === "" ? !inPlan : sub === "on";
9147
- if (next === inPlan) {
9148
- this.showStatus(next ? "Plan mode is already active." : "Plan mode is already off.");
9656
+ let next = sub !== "off";
9657
+ if (next === inReadOnly) {
9658
+ this.showStatus(next ? "Read mode is already active." : "Read mode is already off.");
9149
9659
  return;
9150
9660
  }
9151
- next ? this.applyPermissionMode("plan") : this.applyPermissionMode(this.restoreTargetAfterPlan());
9661
+ this.applyPermissionMode(next ? "read-only" : this.restoreTargetAfterPlan());
9152
9662
  }
9153
- // lunr: /mode — permission mode selector (manual / yolo / plan / auto). Per-session only.
9154
9663
  handleModeCommand(args) {
9155
9664
  let sub = args.toLowerCase();
9156
9665
  if (sub === "status") {
9157
- this.showStatus(`Permission mode: ${getPermissionMode()}`);
9666
+ this.showStatus(`Permission mode: ${getPermissionMode() === "read-only" ? "read" : getPermissionMode()}`);
9158
9667
  return;
9159
9668
  }
9160
- if (sub === "manual" || sub === "yolo" || sub === "plan" || sub === "auto") {
9161
- this.applyPermissionMode(sub);
9669
+ if (sub === "yolo" || sub === "auto" || sub === "read-only" || sub === "read") {
9670
+ this.applyPermissionMode(sub === "read" ? "read-only" : sub);
9162
9671
  return;
9163
9672
  }
9164
9673
  if (sub !== "") {
9165
- this.showStatus("Usage: /mode [manual|yolo|plan|auto] \u2014 bare /mode opens the selector.");
9674
+ this.showStatus("Usage: /mode [yolo|auto|read] \u2014 bare /mode opens the selector.");
9166
9675
  return;
9167
9676
  }
9168
9677
  let options = [
9169
- "Manual \u2014 approve every action",
9170
9678
  "YOLO \u2014 auto-approve tools, agent may still ask",
9171
- "Plan \u2014 read-only; present a plan for approval",
9172
- "Auto \u2014 fully autonomous, no questions"
9679
+ "Auto \u2014 fully autonomous, no questions",
9680
+ "Read \u2014 inspect without making changes"
9173
9681
  ];
9174
9682
  this.showExtensionSelector("Permission mode", options).then((choice) => {
9175
- choice && (choice.startsWith("Manual") ? this.applyPermissionMode("manual") : choice.startsWith("YOLO") ? this.applyPermissionMode("yolo") : choice.startsWith("Plan") ? this.applyPermissionMode("plan") : choice.startsWith("Auto") && this.applyPermissionMode("auto"));
9683
+ choice && (choice.startsWith("YOLO") ? this.applyPermissionMode("yolo") : choice.startsWith("Auto") ? this.applyPermissionMode("auto") : choice.startsWith("Read") && this.applyPermissionMode("read-only"));
9176
9684
  });
9177
9685
  }
9178
- /** Destination when leaving plan via approve / `/plan off` / `/plan <text>`. */
9686
+ /** Destination after plan approval or /plan off. */
9179
9687
  restoreTargetAfterPlan() {
9180
9688
  return restorePermissionModeAfterPlan(this.previousPermissionMode, this.settingsManager.getDefaultPermissionMode());
9181
9689
  }
9182
9690
  /** Apply addendum + auto-rollback for a mode without a status toast. */
9183
9691
  syncPermissionModeEffects(mode) {
9184
- mode === "plan" ? this.session.setSystemPromptAppend(PLAN_MODE_ADDENDUM) : mode === "auto" ? (this.session.setSystemPromptAppend(AUTO_MODE_ADDENDUM), enableRollbackForSession(this.sessionManager.getSessionId())) : this.session.setSystemPromptAppend(void 0);
9692
+ this.runtimeHost.isDetached || this.transferInProgress || (this.sessionManager.setPermissionMode(mode), mode === "read-only" ? this.session.setSystemPromptAppend(READ_ONLY_MODE_ADDENDUM) : mode === "auto" ? (this.session.setSystemPromptAppend(AUTO_MODE_ADDENDUM), enableRollbackForSession(this.sessionManager.getSessionId())) : this.session.setSystemPromptAppend(void 0));
9185
9693
  }
9186
9694
  // lunr: `/goal` forces session auto without writing settings.
9187
9695
  enterGoalAuto() {
@@ -9193,23 +9701,11 @@ ${theme.fg("dim", "Cache Re-billed:")} ${detail}`;
9193
9701
  this.preGoalPermissionMode = next.saved, next.mode !== getPermissionMode() && this.applyPermissionMode(next.mode, { silent: !0 });
9194
9702
  }
9195
9703
  applyPermissionMode(mode, opts) {
9704
+ if (this.runtimeHost.isDetached || this.transferInProgress)
9705
+ return;
9706
+ this.sessionManager.setPermissionMode(mode), recordTuiActivity(this.sessionManager, this.runtimeHost.services.agentDir);
9196
9707
  let prev = getPermissionMode();
9197
- mode === "plan" && prev !== "plan" && (this.previousPermissionMode = prev), setPermissionMode(mode), this.ui.requestRender(), mode === "plan" ? this.session.setSystemPromptAppend(PLAN_MODE_ADDENDUM) : mode === "auto" ? this.session.setSystemPromptAppend(AUTO_MODE_ADDENDUM) : this.session.setSystemPromptAppend(void 0), mode === "auto" && prev !== "auto" ? enableRollbackForSession(this.sessionManager.getSessionId()) : mode !== "auto" && prev === "auto" && disableRollbackForSession(this.sessionManager.getSessionId()), !opts?.silent && (mode === "auto" && prev !== "auto" ? this.showStatus("Auto mode active \u2014 fully autonomous. Rollback enabled for this session.") : mode === "plan" ? this.showStatus("Plan mode active \u2014 edit/write and mutating bash are blocked. /plan off to implement.") : this.showStatus(`Permission mode: ${mode}`));
9198
- }
9199
- // lunr: approval dialog for manual permission mode.
9200
- // lunr: adds "Switch to auto" / "Switch to yolo" at the bottom so users can
9201
- // escape manual approval mid-turn without a separate /mode round-trip.
9202
- async showApprovalDialog(req) {
9203
- return new Promise((resolve4) => {
9204
- this.showSelector((done) => {
9205
- let selector = new ExtensionSelectorComponent(`Approve ${req.action}?`, ["Approve once", "Approve for session", "Reject", "Switch to auto", "Switch to yolo"], (option) => {
9206
- done(), option === "Approve once" ? resolve4("once") : option === "Approve for session" ? resolve4("session") : option === "Switch to auto" ? (this.applyPermissionMode("auto"), resolve4("once")) : option === "Switch to yolo" ? (this.applyPermissionMode("yolo"), resolve4("once")) : resolve4("reject");
9207
- }, () => {
9208
- done(), resolve4("reject");
9209
- }, { message: req.detail.slice(0, 500) });
9210
- return { component: selector, focus: selector };
9211
- });
9212
- });
9708
+ mode === "read-only" && prev !== "read-only" && (this.previousPermissionMode = prev), setPermissionMode(mode), this.ui.requestRender(), mode === "read-only" ? this.session.setSystemPromptAppend(READ_ONLY_MODE_ADDENDUM) : mode === "auto" ? this.session.setSystemPromptAppend(AUTO_MODE_ADDENDUM) : this.session.setSystemPromptAppend(void 0), mode === "auto" && prev !== "auto" ? enableRollbackForSession(this.sessionManager.getSessionId()) : mode !== "auto" && prev === "auto" && disableRollbackForSession(this.sessionManager.getSessionId()), !opts?.silent && (mode === "auto" && prev !== "auto" ? this.showStatus("Auto mode active \u2014 fully autonomous. Rollback enabled for this session.") : mode === "read-only" ? this.showStatus("Read mode active. Changes are blocked.") : this.showStatus(`Permission mode: ${mode}`));
9213
9709
  }
9214
9710
  // Approval dialog for one subagent call launching more than two children.
9215
9711
  // "Reject with feedback" collects a one-line
@@ -9229,7 +9725,7 @@ ${theme.fg("dim", "Cache Re-billed:")} ${detail}`;
9229
9725
  });
9230
9726
  });
9231
9727
  }
9232
- // lunr: approval dialog for present_plan (plan mode). The "with feedback"
9728
+ // Approval dialog for present_plan (read-only mode). The "with feedback"
9233
9729
  // options collect a one-line note via showExtensionInput that becomes part of
9234
9730
  // the result text the model sees. Esc/close counts as Decline.
9235
9731
  showPlanInChat(summary) {
@@ -9378,6 +9874,10 @@ ${toggleThinking ? `| \`${toggleThinking}\` | Toggle thinking block visibility |
9378
9874
  this.chatContainer.addChild(new Spacer19(1)), this.chatContainer.addChild(new DynamicBorder()), this.chatContainer.addChild(new Text21(theme.bold(theme.fg("accent", "Keyboard Shortcuts")), 1, 0)), this.chatContainer.addChild(new Spacer19(1)), this.chatContainer.addChild(new Markdown10(hotkeys.trim(), 1, 1, this.getMarkdownThemeWithSettings())), this.chatContainer.addChild(new DynamicBorder()), this.ui.requestRender();
9379
9875
  }
9380
9876
  async handleClearCommand() {
9877
+ if (this.runtimeHost.isDetached || this.transferInProgress) {
9878
+ this.showError("Use /reclaim first, or /quit to leave this terminal.");
9879
+ return;
9880
+ }
9381
9881
  this.clearStatusIndicator(), this.ui.setChatScroll(0), await this.waitForDeferredBuiltins();
9382
9882
  let previousModel = this.session.model;
9383
9883
  try {
@@ -9396,7 +9896,7 @@ ${toggleThinking ? `| \`${toggleThinking}\` | Toggle thinking block visibility |
9396
9896
  "",
9397
9897
  "=== All rendered lines with visible widths ===",
9398
9898
  ...allLines.map((line, idx) => {
9399
- let vw = visibleWidth4(line), escaped = JSON.stringify(line);
9899
+ let vw = visibleWidth6(line), escaped = JSON.stringify(line);
9400
9900
  return `[${idx}] (w=${vw}) ${escaped}`;
9401
9901
  }),
9402
9902
  "",
@@ -9449,7 +9949,7 @@ ${theme.fg("muted", debugLogPath)}`, 1, 1)), this.ui.requestRender();
9449
9949
  }
9450
9950
  }
9451
9951
  stop() {
9452
- this.stopCatalogRefresh?.(), this.stopCatalogRefresh = void 0, this.settingsManager.getShowTerminalProgress() && this.ui.terminal.setProgress(!1), this.clearStatusIndicator(), this.themeController.disableAutoSync(), this.clearExtensionTerminalInputListeners(), this.footer.dispose(), this.footerDataProvider.dispose(), this.unsubscribe && this.unsubscribe(), this.isInitialized && (this.ui.stop(), this.isInitialized = !1), this.unregisterSignalHandlers();
9952
+ this.setThinkingAnimation(!1), this.stopCatalogRefresh?.(), this.stopCatalogRefresh = void 0, this.settingsManager.getShowTerminalProgress() && this.ui.terminal.setProgress(!1), this.clearStatusIndicator(), this.themeController.disableAutoSync(), this.clearExtensionTerminalInputListeners(), this.footer.dispose(), this.footerDataProvider.dispose(), this.disposeChatToolComponents(), this.unsubscribe && this.unsubscribe(), this.isInitialized && (this.ui.stop(), this.isInitialized = !1), this.unregisterSignalHandlers();
9453
9953
  }
9454
9954
  };
9455
9955