@ashx-j/lunr-dev 0.2.21-dev.12.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 (570) hide show
  1. package/CHANGELOG.md +25 -2
  2. package/dist/builtin-extensions/ashxj-tui.d.ts.map +1 -1
  3. package/dist/builtin-extensions/ashxj-tui.js +2 -2
  4. package/dist/builtin-extensions/ashxj-tui.js.map +1 -1
  5. package/dist/builtin-extensions/index.d.ts.map +1 -1
  6. package/dist/builtin-extensions/index.js +1 -0
  7. package/dist/builtin-extensions/index.js.map +1 -1
  8. package/dist/builtin-extensions/lunr-browser.d.ts +9 -0
  9. package/dist/builtin-extensions/lunr-browser.d.ts.map +1 -0
  10. package/dist/builtin-extensions/lunr-browser.js +169 -0
  11. package/dist/builtin-extensions/lunr-browser.js.map +1 -0
  12. package/dist/builtin-extensions/lunr-computer-use.d.ts.map +1 -1
  13. package/dist/builtin-extensions/lunr-computer-use.js +3 -3
  14. package/dist/builtin-extensions/lunr-computer-use.js.map +1 -1
  15. package/dist/builtin-extensions/lunr-plan-tools.d.ts +7 -7
  16. package/dist/builtin-extensions/lunr-plan-tools.d.ts.map +1 -1
  17. package/dist/builtin-extensions/lunr-plan-tools.js +12 -12
  18. package/dist/builtin-extensions/lunr-plan-tools.js.map +1 -1
  19. package/dist/builtin-extensions/lunr-todos.d.ts.map +1 -1
  20. package/dist/builtin-extensions/lunr-todos.js +15 -0
  21. package/dist/builtin-extensions/lunr-todos.js.map +1 -1
  22. package/dist/builtin-extensions/pi-intercom/index.d.ts.map +1 -1
  23. package/dist/builtin-extensions/pi-intercom/index.js +5 -0
  24. package/dist/builtin-extensions/pi-intercom/index.js.map +1 -1
  25. package/dist/builtin-extensions/pi-mcp-adapter/direct-tools.d.ts.map +1 -1
  26. package/dist/builtin-extensions/pi-mcp-adapter/direct-tools.js +1 -0
  27. package/dist/builtin-extensions/pi-mcp-adapter/direct-tools.js.map +1 -1
  28. package/dist/builtin-extensions/pi-mcp-adapter/index.d.ts.map +1 -1
  29. package/dist/builtin-extensions/pi-mcp-adapter/index.js +1 -1
  30. package/dist/builtin-extensions/pi-mcp-adapter/index.js.map +1 -1
  31. package/dist/builtin-extensions/pi-subagents/src/extension/control-notices.d.ts +1 -1
  32. package/dist/builtin-extensions/pi-subagents/src/extension/control-notices.d.ts.map +1 -1
  33. package/dist/builtin-extensions/pi-subagents/src/extension/control-notices.js +5 -1
  34. package/dist/builtin-extensions/pi-subagents/src/extension/control-notices.js.map +1 -1
  35. package/dist/builtin-extensions/pi-subagents/src/extension/index.d.ts +2 -2
  36. package/dist/builtin-extensions/pi-subagents/src/extension/index.d.ts.map +1 -1
  37. package/dist/builtin-extensions/pi-subagents/src/extension/index.js +18 -5
  38. package/dist/builtin-extensions/pi-subagents/src/extension/index.js.map +1 -1
  39. package/dist/builtin-extensions/pi-subagents/src/extension/schemas.d.ts.map +1 -1
  40. package/dist/builtin-extensions/pi-subagents/src/extension/schemas.js +1 -1
  41. package/dist/builtin-extensions/pi-subagents/src/extension/schemas.js.map +1 -1
  42. package/dist/builtin-extensions/pi-subagents/src/extension/tool-description.d.ts +4 -3
  43. package/dist/builtin-extensions/pi-subagents/src/extension/tool-description.d.ts.map +1 -1
  44. package/dist/builtin-extensions/pi-subagents/src/extension/tool-description.js +8 -3
  45. package/dist/builtin-extensions/pi-subagents/src/extension/tool-description.js.map +1 -1
  46. package/dist/builtin-extensions/pi-subagents/src/intercom/communication.d.ts +17 -0
  47. package/dist/builtin-extensions/pi-subagents/src/intercom/communication.d.ts.map +1 -0
  48. package/dist/builtin-extensions/pi-subagents/src/intercom/communication.js +45 -0
  49. package/dist/builtin-extensions/pi-subagents/src/intercom/communication.js.map +1 -0
  50. package/dist/builtin-extensions/pi-subagents/src/intercom/intercom-bridge.d.ts +2 -0
  51. package/dist/builtin-extensions/pi-subagents/src/intercom/intercom-bridge.d.ts.map +1 -1
  52. package/dist/builtin-extensions/pi-subagents/src/intercom/intercom-bridge.js +10 -14
  53. package/dist/builtin-extensions/pi-subagents/src/intercom/intercom-bridge.js.map +1 -1
  54. package/dist/builtin-extensions/pi-subagents/src/intercom/native-supervisor-channel.d.ts +4 -1
  55. package/dist/builtin-extensions/pi-subagents/src/intercom/native-supervisor-channel.d.ts.map +1 -1
  56. package/dist/builtin-extensions/pi-subagents/src/intercom/native-supervisor-channel.js +167 -53
  57. package/dist/builtin-extensions/pi-subagents/src/intercom/native-supervisor-channel.js.map +1 -1
  58. package/dist/builtin-extensions/pi-subagents/src/intercom/supervisor-ask.d.ts.map +1 -1
  59. package/dist/builtin-extensions/pi-subagents/src/intercom/supervisor-ask.js +5 -0
  60. package/dist/builtin-extensions/pi-subagents/src/intercom/supervisor-ask.js.map +1 -1
  61. package/dist/builtin-extensions/pi-subagents/src/intercom/supervisor-questions.d.ts +2 -0
  62. package/dist/builtin-extensions/pi-subagents/src/intercom/supervisor-questions.d.ts.map +1 -1
  63. package/dist/builtin-extensions/pi-subagents/src/intercom/supervisor-questions.js +3 -2
  64. package/dist/builtin-extensions/pi-subagents/src/intercom/supervisor-questions.js.map +1 -1
  65. package/dist/builtin-extensions/pi-subagents/src/runs/background/async-execution.d.ts +2 -0
  66. package/dist/builtin-extensions/pi-subagents/src/runs/background/async-execution.d.ts.map +1 -1
  67. package/dist/builtin-extensions/pi-subagents/src/runs/background/async-execution.js +4 -0
  68. package/dist/builtin-extensions/pi-subagents/src/runs/background/async-execution.js.map +1 -1
  69. package/dist/builtin-extensions/pi-subagents/src/runs/background/auto-drain.d.ts +1 -0
  70. package/dist/builtin-extensions/pi-subagents/src/runs/background/auto-drain.d.ts.map +1 -1
  71. package/dist/builtin-extensions/pi-subagents/src/runs/background/auto-drain.js +2 -1
  72. package/dist/builtin-extensions/pi-subagents/src/runs/background/auto-drain.js.map +1 -1
  73. package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-runner.d.ts.map +1 -1
  74. package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-runner.js +1 -1
  75. package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-runner.js.map +1 -1
  76. package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-wait.d.ts +3 -0
  77. package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-wait.d.ts.map +1 -1
  78. package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-wait.js +11 -0
  79. package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-wait.js.map +1 -1
  80. package/dist/builtin-extensions/pi-subagents/src/runs/background/wait-tool.d.ts.map +1 -1
  81. package/dist/builtin-extensions/pi-subagents/src/runs/background/wait-tool.js +41 -3
  82. package/dist/builtin-extensions/pi-subagents/src/runs/background/wait-tool.js.map +1 -1
  83. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/chain-execution.d.ts +1 -0
  84. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/chain-execution.d.ts.map +1 -1
  85. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/chain-execution.js +5 -1
  86. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/chain-execution.js.map +1 -1
  87. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/execution.d.ts.map +1 -1
  88. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/execution.js +3 -2
  89. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/execution.js.map +1 -1
  90. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/subagent-executor.d.ts.map +1 -1
  91. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/subagent-executor.js +23 -0
  92. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/subagent-executor.js.map +1 -1
  93. package/dist/builtin-extensions/pi-subagents/src/runs/shared/child-tools.d.ts +1 -1
  94. package/dist/builtin-extensions/pi-subagents/src/runs/shared/child-tools.d.ts.map +1 -1
  95. package/dist/builtin-extensions/pi-subagents/src/runs/shared/child-tools.js +1 -1
  96. package/dist/builtin-extensions/pi-subagents/src/runs/shared/child-tools.js.map +1 -1
  97. package/dist/builtin-extensions/pi-subagents/src/runs/shared/pi-args.d.ts +2 -0
  98. package/dist/builtin-extensions/pi-subagents/src/runs/shared/pi-args.d.ts.map +1 -1
  99. package/dist/builtin-extensions/pi-subagents/src/runs/shared/pi-args.js +20 -15
  100. package/dist/builtin-extensions/pi-subagents/src/runs/shared/pi-args.js.map +1 -1
  101. package/dist/builtin-extensions/pi-subagents/src/runs/shared/subagent-control.d.ts +1 -0
  102. package/dist/builtin-extensions/pi-subagents/src/runs/shared/subagent-control.d.ts.map +1 -1
  103. package/dist/builtin-extensions/pi-subagents/src/runs/shared/subagent-control.js +3 -0
  104. package/dist/builtin-extensions/pi-subagents/src/runs/shared/subagent-control.js.map +1 -1
  105. package/dist/builtin-extensions/pi-subagents/src/runs/shared/subagent-prompt-runtime.d.ts.map +1 -1
  106. package/dist/builtin-extensions/pi-subagents/src/runs/shared/subagent-prompt-runtime.js +4 -2
  107. package/dist/builtin-extensions/pi-subagents/src/runs/shared/subagent-prompt-runtime.js.map +1 -1
  108. package/dist/builtin-extensions/pi-subagents/src/shared/child-spec.d.ts.map +1 -1
  109. package/dist/builtin-extensions/pi-subagents/src/shared/child-spec.js +2 -2
  110. package/dist/builtin-extensions/pi-subagents/src/shared/child-spec.js.map +1 -1
  111. package/dist/builtin-extensions/pi-subagents/src/shared/types.d.ts +2 -0
  112. package/dist/builtin-extensions/pi-subagents/src/shared/types.d.ts.map +1 -1
  113. package/dist/builtin-extensions/pi-subagents/src/shared/types.js.map +1 -1
  114. package/dist/builtin-extensions/pi-subagents/src/tui/communication.d.ts +18 -0
  115. package/dist/builtin-extensions/pi-subagents/src/tui/communication.d.ts.map +1 -0
  116. package/dist/builtin-extensions/pi-subagents/src/tui/communication.js +48 -0
  117. package/dist/builtin-extensions/pi-subagents/src/tui/communication.js.map +1 -0
  118. package/dist/builtin-extensions/pi-web-access/index.d.ts.map +1 -1
  119. package/dist/builtin-extensions/pi-web-access/index.js +11 -7
  120. package/dist/builtin-extensions/pi-web-access/index.js.map +1 -1
  121. package/dist/cli/args.d.ts.map +1 -1
  122. package/dist/cli/args.js +2 -1
  123. package/dist/cli/args.js.map +1 -1
  124. package/dist/cli/install-cli.d.ts.map +1 -1
  125. package/dist/cli/install-cli.js +15 -45
  126. package/dist/cli/install-cli.js.map +1 -1
  127. package/dist/core/agent-session-runtime.d.ts +9 -0
  128. package/dist/core/agent-session-runtime.d.ts.map +1 -1
  129. package/dist/core/agent-session-runtime.js +126 -29
  130. package/dist/core/agent-session-runtime.js.map +1 -1
  131. package/dist/core/agent-session.d.ts +23 -1
  132. package/dist/core/agent-session.d.ts.map +1 -1
  133. package/dist/core/agent-session.js +255 -109
  134. package/dist/core/agent-session.js.map +1 -1
  135. package/dist/core/browser/network.d.ts +9 -0
  136. package/dist/core/browser/network.d.ts.map +1 -0
  137. package/dist/core/browser/network.js +146 -0
  138. package/dist/core/browser/network.js.map +1 -0
  139. package/dist/core/browser/runtime.d.ts +24 -0
  140. package/dist/core/browser/runtime.d.ts.map +1 -0
  141. package/dist/core/browser/runtime.js +289 -0
  142. package/dist/core/browser/runtime.js.map +1 -0
  143. package/dist/core/browser/schema.d.ts +16 -0
  144. package/dist/core/browser/schema.d.ts.map +1 -0
  145. package/dist/core/browser/schema.js +36 -0
  146. package/dist/core/browser/schema.js.map +1 -0
  147. package/dist/core/browser/settings.d.ts +8 -0
  148. package/dist/core/browser/settings.d.ts.map +1 -0
  149. package/dist/core/browser/settings.js +30 -0
  150. package/dist/core/browser/settings.js.map +1 -0
  151. package/dist/core/browser/setup.d.ts +2 -0
  152. package/dist/core/browser/setup.d.ts.map +1 -0
  153. package/dist/core/browser/setup.js +16 -0
  154. package/dist/core/browser/setup.js.map +1 -0
  155. package/dist/core/catalog-cache-scope.d.ts.map +1 -1
  156. package/dist/core/catalog-cache-scope.js +3 -1
  157. package/dist/core/catalog-cache-scope.js.map +1 -1
  158. package/dist/core/computer-use/image.d.ts +1 -0
  159. package/dist/core/computer-use/image.d.ts.map +1 -1
  160. package/dist/core/computer-use/image.js +8 -0
  161. package/dist/core/computer-use/image.js.map +1 -1
  162. package/dist/core/computer-use/schemas.d.ts +1 -0
  163. package/dist/core/computer-use/schemas.d.ts.map +1 -1
  164. package/dist/core/computer-use/schemas.js +2 -1
  165. package/dist/core/computer-use/schemas.js.map +1 -1
  166. package/dist/core/computer-use/workflow.d.ts.map +1 -1
  167. package/dist/core/computer-use/workflow.js +89 -23
  168. package/dist/core/computer-use/workflow.js.map +1 -1
  169. package/dist/core/customize.d.ts.map +1 -1
  170. package/dist/core/customize.js +15 -14
  171. package/dist/core/customize.js.map +1 -1
  172. package/dist/core/export-html/index.d.ts.map +1 -1
  173. package/dist/core/export-html/index.js +1 -1
  174. package/dist/core/export-html/index.js.map +1 -1
  175. package/dist/core/extensions/loader.d.ts.map +1 -1
  176. package/dist/core/extensions/loader.js +4 -0
  177. package/dist/core/extensions/loader.js.map +1 -1
  178. package/dist/core/extensions/runner.d.ts +1 -0
  179. package/dist/core/extensions/runner.d.ts.map +1 -1
  180. package/dist/core/extensions/runner.js +1 -1
  181. package/dist/core/extensions/runner.js.map +1 -1
  182. package/dist/core/extensions/types.d.ts +1 -1
  183. package/dist/core/extensions/types.d.ts.map +1 -1
  184. package/dist/core/extensions/types.js.map +1 -1
  185. package/dist/core/install-features.d.ts.map +1 -1
  186. package/dist/core/install-features.js +10 -8
  187. package/dist/core/install-features.js.map +1 -1
  188. package/dist/core/memory-cap.d.ts.map +1 -1
  189. package/dist/core/memory-cap.js +5 -3
  190. package/dist/core/memory-cap.js.map +1 -1
  191. package/dist/core/model-runtime.d.ts.map +1 -1
  192. package/dist/core/model-runtime.js +3 -2
  193. package/dist/core/model-runtime.js.map +1 -1
  194. package/dist/core/model-tiers.d.ts.map +1 -1
  195. package/dist/core/model-tiers.js +9 -6
  196. package/dist/core/model-tiers.js.map +1 -1
  197. package/dist/core/permissions.d.ts +16 -23
  198. package/dist/core/permissions.d.ts.map +1 -1
  199. package/dist/core/permissions.js +71 -142
  200. package/dist/core/permissions.js.map +1 -1
  201. package/dist/core/plan-mode.d.ts +10 -12
  202. package/dist/core/plan-mode.d.ts.map +1 -1
  203. package/dist/core/plan-mode.js +20 -19
  204. package/dist/core/plan-mode.js.map +1 -1
  205. package/dist/core/process-registry.d.ts.map +1 -1
  206. package/dist/core/process-registry.js +6 -4
  207. package/dist/core/process-registry.js.map +1 -1
  208. package/dist/core/runtime-bridges.d.ts.map +1 -1
  209. package/dist/core/runtime-bridges.js +2 -0
  210. package/dist/core/runtime-bridges.js.map +1 -1
  211. package/dist/core/runtime-scope.d.ts +11 -0
  212. package/dist/core/runtime-scope.d.ts.map +1 -0
  213. package/dist/core/runtime-scope.js +3 -0
  214. package/dist/core/runtime-scope.js.map +1 -0
  215. package/dist/core/sdk.d.ts.map +1 -1
  216. package/dist/core/sdk.js +26 -6
  217. package/dist/core/sdk.js.map +1 -1
  218. package/dist/core/session-handoff.d.ts +35 -0
  219. package/dist/core/session-handoff.d.ts.map +1 -0
  220. package/dist/core/session-handoff.js +214 -0
  221. package/dist/core/session-handoff.js.map +1 -0
  222. package/dist/core/session-manager.d.ts +20 -0
  223. package/dist/core/session-manager.d.ts.map +1 -1
  224. package/dist/core/session-manager.js +191 -22
  225. package/dist/core/session-manager.js.map +1 -1
  226. package/dist/core/session-ownership.d.ts +28 -0
  227. package/dist/core/session-ownership.d.ts.map +1 -0
  228. package/dist/core/session-ownership.js +138 -0
  229. package/dist/core/session-ownership.js.map +1 -0
  230. package/dist/core/session-retention.d.ts.map +1 -1
  231. package/dist/core/session-retention.js +11 -2
  232. package/dist/core/session-retention.js.map +1 -1
  233. package/dist/core/settings-manager.d.ts +20 -1
  234. package/dist/core/settings-manager.d.ts.map +1 -1
  235. package/dist/core/settings-manager.js +67 -1
  236. package/dist/core/settings-manager.js.map +1 -1
  237. package/dist/core/slash-commands.d.ts.map +1 -1
  238. package/dist/core/slash-commands.js +6 -4
  239. package/dist/core/slash-commands.js.map +1 -1
  240. package/dist/core/subagent-permission-inherit.d.ts +6 -10
  241. package/dist/core/subagent-permission-inherit.d.ts.map +1 -1
  242. package/dist/core/subagent-permission-inherit.js +14 -14
  243. package/dist/core/subagent-permission-inherit.js.map +1 -1
  244. package/dist/core/subagent-wait-interruption.d.ts +11 -0
  245. package/dist/core/subagent-wait-interruption.d.ts.map +1 -0
  246. package/dist/core/subagent-wait-interruption.js +19 -0
  247. package/dist/core/subagent-wait-interruption.js.map +1 -0
  248. package/dist/core/system-prompt.d.ts +2 -0
  249. package/dist/core/system-prompt.d.ts.map +1 -1
  250. package/dist/core/system-prompt.js +14 -4
  251. package/dist/core/system-prompt.js.map +1 -1
  252. package/dist/core/todo-settings.d.ts +5 -0
  253. package/dist/core/todo-settings.d.ts.map +1 -0
  254. package/dist/core/todo-settings.js +7 -0
  255. package/dist/core/todo-settings.js.map +1 -0
  256. package/dist/core/tools/bash.d.ts.map +1 -1
  257. package/dist/core/tools/bash.js +4 -4
  258. package/dist/core/tools/bash.js.map +1 -1
  259. package/dist/core/tools/edit.d.ts.map +1 -1
  260. package/dist/core/tools/edit.js +5 -3
  261. package/dist/core/tools/edit.js.map +1 -1
  262. package/dist/core/tools/find.d.ts.map +1 -1
  263. package/dist/core/tools/find.js +4 -4
  264. package/dist/core/tools/find.js.map +1 -1
  265. package/dist/core/tools/grep.d.ts.map +1 -1
  266. package/dist/core/tools/grep.js +4 -4
  267. package/dist/core/tools/grep.js.map +1 -1
  268. package/dist/core/tools/ls.d.ts.map +1 -1
  269. package/dist/core/tools/ls.js +4 -4
  270. package/dist/core/tools/ls.js.map +1 -1
  271. package/dist/core/tools/read.d.ts.map +1 -1
  272. package/dist/core/tools/read.js +4 -4
  273. package/dist/core/tools/read.js.map +1 -1
  274. package/dist/core/tools/render-utils.d.ts +14 -5
  275. package/dist/core/tools/render-utils.d.ts.map +1 -1
  276. package/dist/core/tools/render-utils.js +34 -7
  277. package/dist/core/tools/render-utils.js.map +1 -1
  278. package/dist/core/tools/write.d.ts.map +1 -1
  279. package/dist/core/tools/write.js +4 -4
  280. package/dist/core/tools/write.js.map +1 -1
  281. package/dist/core/usage-service.d.ts.map +1 -1
  282. package/dist/core/usage-service.js +5 -3
  283. package/dist/core/usage-service.js.map +1 -1
  284. package/dist/gateway/adapters/discord.d.ts +12 -1
  285. package/dist/gateway/adapters/discord.d.ts.map +1 -1
  286. package/dist/gateway/adapters/discord.js +114 -24
  287. package/dist/gateway/adapters/discord.js.map +1 -1
  288. package/dist/gateway/adapters/telegram.d.ts +4 -2
  289. package/dist/gateway/adapters/telegram.d.ts.map +1 -1
  290. package/dist/gateway/adapters/telegram.js +41 -11
  291. package/dist/gateway/adapters/telegram.js.map +1 -1
  292. package/dist/gateway/agent-bridge.d.ts +18 -4
  293. package/dist/gateway/agent-bridge.d.ts.map +1 -1
  294. package/dist/gateway/agent-bridge.js +305 -73
  295. package/dist/gateway/agent-bridge.js.map +1 -1
  296. package/dist/gateway/approval.d.ts +3 -6
  297. package/dist/gateway/approval.d.ts.map +1 -1
  298. package/dist/gateway/approval.js +62 -24
  299. package/dist/gateway/approval.js.map +1 -1
  300. package/dist/gateway/authz.d.ts +2 -0
  301. package/dist/gateway/authz.d.ts.map +1 -1
  302. package/dist/gateway/authz.js +13 -0
  303. package/dist/gateway/authz.js.map +1 -1
  304. package/dist/gateway/buttons.d.ts +3 -1
  305. package/dist/gateway/buttons.d.ts.map +1 -1
  306. package/dist/gateway/buttons.js +45 -20
  307. package/dist/gateway/buttons.js.map +1 -1
  308. package/dist/gateway/command.d.ts.map +1 -1
  309. package/dist/gateway/command.js +49 -4
  310. package/dist/gateway/command.js.map +1 -1
  311. package/dist/gateway/commands.d.ts +2 -0
  312. package/dist/gateway/commands.d.ts.map +1 -1
  313. package/dist/gateway/commands.js +52 -16
  314. package/dist/gateway/commands.js.map +1 -1
  315. package/dist/gateway/config.d.ts +6 -0
  316. package/dist/gateway/config.d.ts.map +1 -1
  317. package/dist/gateway/config.js +7 -0
  318. package/dist/gateway/config.js.map +1 -1
  319. package/dist/gateway/conversations.d.ts +14 -0
  320. package/dist/gateway/conversations.d.ts.map +1 -0
  321. package/dist/gateway/conversations.js +30 -0
  322. package/dist/gateway/conversations.js.map +1 -0
  323. package/dist/gateway/cron.d.ts +1 -1
  324. package/dist/gateway/cron.d.ts.map +1 -1
  325. package/dist/gateway/cron.js +2 -2
  326. package/dist/gateway/cron.js.map +1 -1
  327. package/dist/gateway/download.d.ts +2 -0
  328. package/dist/gateway/download.d.ts.map +1 -0
  329. package/dist/gateway/download.js +36 -0
  330. package/dist/gateway/download.js.map +1 -0
  331. package/dist/gateway/index.d.ts.map +1 -1
  332. package/dist/gateway/index.js +106 -47
  333. package/dist/gateway/index.js.map +1 -1
  334. package/dist/gateway/mobile-commands.d.ts +24 -0
  335. package/dist/gateway/mobile-commands.d.ts.map +1 -0
  336. package/dist/gateway/mobile-commands.js +423 -0
  337. package/dist/gateway/mobile-commands.js.map +1 -0
  338. package/dist/gateway/presenter.d.ts +27 -0
  339. package/dist/gateway/presenter.d.ts.map +1 -0
  340. package/dist/gateway/presenter.js +308 -0
  341. package/dist/gateway/presenter.js.map +1 -0
  342. package/dist/gateway/router.d.ts +6 -5
  343. package/dist/gateway/router.d.ts.map +1 -1
  344. package/dist/gateway/router.js +126 -43
  345. package/dist/gateway/router.js.map +1 -1
  346. package/dist/gateway/service.d.ts +46 -0
  347. package/dist/gateway/service.d.ts.map +1 -0
  348. package/dist/gateway/service.js +404 -0
  349. package/dist/gateway/service.js.map +1 -0
  350. package/dist/gateway/setup.d.ts +9 -0
  351. package/dist/gateway/setup.d.ts.map +1 -0
  352. package/dist/gateway/setup.js +202 -0
  353. package/dist/gateway/setup.js.map +1 -0
  354. package/dist/gateway/stream.d.ts +6 -5
  355. package/dist/gateway/stream.d.ts.map +1 -1
  356. package/dist/gateway/stream.js +24 -11
  357. package/dist/gateway/stream.js.map +1 -1
  358. package/dist/gateway/types.d.ts +4 -2
  359. package/dist/gateway/types.d.ts.map +1 -1
  360. package/dist/gateway/types.js.map +1 -1
  361. package/dist/index.d.ts +2 -0
  362. package/dist/index.d.ts.map +1 -1
  363. package/dist/index.js +2 -0
  364. package/dist/index.js.map +1 -1
  365. package/dist/main.d.ts.map +1 -1
  366. package/dist/main.js +3 -3
  367. package/dist/main.js.map +1 -1
  368. package/dist/modes/interactive/components/assistant-message.d.ts +19 -2
  369. package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
  370. package/dist/modes/interactive/components/assistant-message.js +78 -17
  371. package/dist/modes/interactive/components/assistant-message.js.map +1 -1
  372. package/dist/modes/interactive/components/copyable-text.d.ts +27 -0
  373. package/dist/modes/interactive/components/copyable-text.d.ts.map +1 -0
  374. package/dist/modes/interactive/components/copyable-text.js +156 -0
  375. package/dist/modes/interactive/components/copyable-text.js.map +1 -0
  376. package/dist/modes/interactive/components/custom-entry.d.ts +1 -0
  377. package/dist/modes/interactive/components/custom-entry.d.ts.map +1 -1
  378. package/dist/modes/interactive/components/custom-entry.js +8 -0
  379. package/dist/modes/interactive/components/custom-entry.js.map +1 -1
  380. package/dist/modes/interactive/components/custom-message.d.ts +1 -0
  381. package/dist/modes/interactive/components/custom-message.d.ts.map +1 -1
  382. package/dist/modes/interactive/components/custom-message.js +8 -0
  383. package/dist/modes/interactive/components/custom-message.js.map +1 -1
  384. package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
  385. package/dist/modes/interactive/components/session-selector.js +16 -0
  386. package/dist/modes/interactive/components/session-selector.js.map +1 -1
  387. package/dist/modes/interactive/components/settings-selector.d.ts +12 -1
  388. package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
  389. package/dist/modes/interactive/components/settings-selector.js +74 -3
  390. package/dist/modes/interactive/components/settings-selector.js.map +1 -1
  391. package/dist/modes/interactive/components/thinking-tail.d.ts +9 -2
  392. package/dist/modes/interactive/components/thinking-tail.d.ts.map +1 -1
  393. package/dist/modes/interactive/components/thinking-tail.js +43 -1
  394. package/dist/modes/interactive/components/thinking-tail.js.map +1 -1
  395. package/dist/modes/interactive/components/tool-execution.d.ts +5 -3
  396. package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  397. package/dist/modes/interactive/components/tool-execution.js +44 -45
  398. package/dist/modes/interactive/components/tool-execution.js.map +1 -1
  399. package/dist/modes/interactive/interactive-mode.d.ts +10 -2
  400. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  401. package/dist/modes/interactive/interactive-mode.js +342 -133
  402. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  403. package/dist/modes/interactive/theme/theme.d.ts +1 -0
  404. package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
  405. package/dist/modes/interactive/theme/theme.js +23 -0
  406. package/dist/modes/interactive/theme/theme.js.map +1 -1
  407. package/dist/node-runtime/agent-session-services-MQUPZSIN.js +51 -0
  408. package/dist/node-runtime/{builtin-extensions-SRCYQPZ6.js → builtin-extensions-4GNDR6U3.js} +7 -6
  409. package/dist/node-runtime/{chunk-LTXUQJI4.js → chunk-24C5IAJ4.js} +1 -6
  410. package/dist/node-runtime/chunk-2BLXLDJR.js +144 -0
  411. package/dist/node-runtime/{chunk-RQ5DNUNG.js → chunk-2CMV4L24.js} +21 -124
  412. package/dist/node-runtime/{chunk-LTYWTR3V.js → chunk-2MI5OPMN.js} +17 -2
  413. package/dist/node-runtime/{chunk-W3CVH5RX.js → chunk-2TKODGBZ.js} +11 -6
  414. package/dist/node-runtime/{chunk-GT5F3OKM.js → chunk-33SIKK3Y.js} +38 -164
  415. package/dist/node-runtime/{chunk-GZQHMEWL.js → chunk-3DKIWPKN.js} +19 -4
  416. package/dist/node-runtime/{chunk-3GHXVUAK.js → chunk-3VEY2IYY.js} +1 -1
  417. package/dist/node-runtime/chunk-4ER2ZV4Z.js +537 -0
  418. package/dist/node-runtime/chunk-4EULYYR4.js +62 -0
  419. package/dist/node-runtime/{chunk-LOYUC2ID.js → chunk-4SBQAI4T.js} +27 -27
  420. package/dist/node-runtime/{chunk-CZUBYPFP.js → chunk-53ARRUHA.js} +674 -257
  421. package/dist/node-runtime/{chunk-VTPM5V35.js → chunk-5Q4A37RB.js} +10 -4
  422. package/dist/node-runtime/{chunk-SWSN6HAB.js → chunk-5UZOPGE3.js} +1 -1
  423. package/dist/node-runtime/{chunk-XSRCAQK2.js → chunk-5Z5PCXGY.js} +263 -222
  424. package/dist/node-runtime/chunk-7JIYPIQU.js +356 -0
  425. package/dist/node-runtime/{chunk-D466UAID.js → chunk-AJ6R5VTV.js} +60 -88
  426. package/dist/node-runtime/chunk-ATIF3RX5.js +352 -0
  427. package/dist/node-runtime/{chunk-A3KMVBZV.js → chunk-BBUVIEZB.js} +1 -10
  428. package/dist/node-runtime/chunk-CCCN2UCX.js +14 -0
  429. package/dist/node-runtime/chunk-CJS4KQFI.js +3412 -0
  430. package/dist/node-runtime/chunk-DO6PALE2.js +205 -0
  431. package/dist/node-runtime/{chunk-N3PNL74S.js → chunk-DRJI7ZSC.js} +63 -163
  432. package/dist/node-runtime/{chunk-VTGEKB7R.js → chunk-E75WFZ33.js} +1 -1
  433. package/dist/node-runtime/{chunk-MJQDX3BA.js → chunk-EBB4BJW4.js} +3 -3
  434. package/dist/node-runtime/{chunk-VQ4UBWSA.js → chunk-EOEAQIJV.js} +63 -6
  435. package/dist/node-runtime/chunk-EOPL2HMM.js +117 -0
  436. package/dist/node-runtime/chunk-H4K3JDRB.js +47 -0
  437. package/dist/node-runtime/{chunk-HRS4HMDX.js → chunk-HT2XEJNP.js} +19 -3
  438. package/dist/node-runtime/chunk-IMLCWLPI.js +9 -0
  439. package/dist/node-runtime/{chunk-BJ6H7DPI.js → chunk-JJWZB7S3.js} +62 -50
  440. package/dist/node-runtime/chunk-KFFOQR4G.js +672 -0
  441. package/dist/node-runtime/chunk-L5LZUGT7.js +40 -0
  442. package/dist/node-runtime/chunk-LV6CEFW2.js +97 -0
  443. package/dist/node-runtime/{chunk-VSELYKWU.js → chunk-LWYIVUGV.js} +2 -1
  444. package/dist/node-runtime/{chunk-BYQ2MOFI.js → chunk-MFV2LOOX.js} +184 -2192
  445. package/dist/node-runtime/{chunk-5SQDLSZJ.js → chunk-MNRO3UCV.js} +2 -2
  446. package/dist/node-runtime/{chunk-JHYKXIMM.js → chunk-MPKSOJBT.js} +1 -1
  447. package/dist/node-runtime/{chunk-C4O2RSQQ.js → chunk-N4TUWAGA.js} +1 -1
  448. package/dist/node-runtime/{chunk-7NBZ5P7I.js → chunk-NAY6UUQZ.js} +1 -1
  449. package/dist/node-runtime/chunk-NKH2QBKF.js +773 -0
  450. package/dist/node-runtime/chunk-O2AT4MEU.js +124 -0
  451. package/dist/node-runtime/chunk-OAR4TYZE.js +146 -0
  452. package/dist/node-runtime/{chunk-DDGMHUOW.js → chunk-OGJN3OZV.js} +2 -1
  453. package/dist/node-runtime/{chunk-MX3GJNXJ.js → chunk-PLGA743X.js} +23 -0
  454. package/dist/node-runtime/chunk-Q3FEOEDA.js +1364 -0
  455. package/dist/node-runtime/{chunk-H2BI7G7T.js → chunk-QFADHUQV.js} +2 -1
  456. package/dist/node-runtime/{chunk-W3SILANP.js → chunk-RBZQU6TJ.js} +12 -9
  457. package/dist/node-runtime/{chunk-ZVSORYRM.js → chunk-RVOQBXTA.js} +10 -6
  458. package/dist/node-runtime/{chunk-HXJS2PJM.js → chunk-RW4PYFNE.js} +14 -94
  459. package/dist/node-runtime/chunk-TP7K7YWS.js +2830 -0
  460. package/dist/node-runtime/{chunk-ZOIIMEN6.js → chunk-TVLBDVTR.js} +32 -21
  461. package/dist/node-runtime/chunk-UAEOTO52.js +119 -0
  462. package/dist/node-runtime/{chunk-MGWCVY6Y.js → chunk-UDKX3PFN.js} +3 -3
  463. package/dist/node-runtime/{chunk-AY6CAJSL.js → chunk-UJOCPOMX.js} +6 -3
  464. package/dist/node-runtime/{chunk-WJVFOIB5.js → chunk-UQUCFAJ3.js} +1 -1
  465. package/dist/node-runtime/chunk-US544NN6.js +13 -0
  466. package/dist/node-runtime/{chunk-7AFOFSDY.js → chunk-V3HK3FE7.js} +1 -1
  467. package/dist/node-runtime/{chunk-6UB6NKA3.js → chunk-VIVYOI7C.js} +130 -27
  468. package/dist/node-runtime/{chunk-MW2XJZIK.js → chunk-XHIRAZ26.js} +1 -1
  469. package/dist/node-runtime/chunk-YPHAIRZT.js +10 -0
  470. package/dist/node-runtime/{chunk-3RCWXWAY.js → chunk-YRUY57IN.js} +1 -1
  471. package/dist/node-runtime/cli-runtime.js +2 -2
  472. package/dist/node-runtime/command-PYBNGLPP.js +45 -0
  473. package/dist/node-runtime/{commands-BZGSLIP7.js → commands-EMBQQVVT.js} +13 -13
  474. package/dist/node-runtime/commands-Y2OUC2T7.js +37 -0
  475. package/dist/node-runtime/config-7DYMNJUO.js +20 -0
  476. package/dist/node-runtime/{customize-LF5VST47.js → customize-VFJV3U6A.js} +2 -1
  477. package/dist/node-runtime/{direct-tool-executor-BSZDHIYR.js → direct-tool-executor-4D7UXYU4.js} +10 -10
  478. package/dist/node-runtime/{export-html-E4DT6ZJQ.js → export-html-ETFOKW3M.js} +4 -3
  479. package/dist/node-runtime/{extension-input-RV5N6APL.js → extension-input-7QODTFAS.js} +4 -4
  480. package/dist/node-runtime/{extension-selector-CPD5LWDD.js → extension-selector-T65JEDJ5.js} +4 -4
  481. package/dist/node-runtime/{extract-XLQSJN4V.js → extract-EQJE7FZZ.js} +2 -2
  482. package/dist/node-runtime/gateway-QENRQA5X.js +1476 -0
  483. package/dist/node-runtime/{gemini-search-U7SUMPQA.js → gemini-search-35OCRFLN.js} +1 -1
  484. package/dist/node-runtime/{gemini-url-context-PXWCBQHK.js → gemini-url-context-UQY3PHHW.js} +2 -2
  485. package/dist/node-runtime/index.js +113 -73
  486. package/dist/node-runtime/{init-DVJUAOUO.js → init-P5AUV77I.js} +5 -5
  487. package/dist/node-runtime/{install-cli-TH7IJJQQ.js → install-cli-KHAXYBOO.js} +21 -82
  488. package/dist/node-runtime/interactive-mode-IN77GQGX.js +74 -0
  489. package/dist/node-runtime/{interactive-view-N6F4KUIT.js → interactive-view-OMWDFGUQ.js} +10 -10
  490. package/dist/node-runtime/lunr-browser-VVPRWC3F.js +174 -0
  491. package/dist/node-runtime/{lunr-computer-use-TJNDAMWM.js → lunr-computer-use-IAUNXSXH.js} +11 -8
  492. package/dist/node-runtime/{lunr-cron-J64I72C6.js → lunr-cron-P6ZJGVEF.js} +21 -7
  493. package/dist/node-runtime/main.js +47 -34
  494. package/dist/node-runtime/{mcp-auth-flow-YL6RWPYG.js → mcp-auth-flow-QVLFVLEO.js} +2 -2
  495. package/dist/node-runtime/{memory-cap-3S4XRLNP.js → memory-cap-EL3KL4JJ.js} +2 -1
  496. package/dist/node-runtime/mobile-commands-WKFSFACZ.js +33 -0
  497. package/dist/node-runtime/model-runtime-YXGJS5OJ.js +16 -0
  498. package/dist/node-runtime/{model-tiers-NJLHUEGK.js → model-tiers-OU3U5CZG.js} +2 -1
  499. package/dist/node-runtime/{package-manager-cli-VMYX4Y2S.js → package-manager-cli-J337RKTI.js} +25 -17
  500. package/dist/node-runtime/{pi-intercom-NV2LW6X7.js → pi-intercom-QM53RLTS.js} +6 -1
  501. package/dist/node-runtime/{pi-mcp-adapter-JLB5YL2F.js → pi-mcp-adapter-3PHF4KZ4.js} +8 -7
  502. package/dist/node-runtime/{pi-subagents-WEHV3W7H.js → pi-subagents-RCHPB6UK.js} +255 -88
  503. package/dist/node-runtime/{pi-web-access-FN5YC5T6.js → pi-web-access-PNG35XW7.js} +15 -15
  504. package/dist/node-runtime/process-registry-PVJ44F7H.js +31 -0
  505. package/dist/node-runtime/{proxy-modes-OR7ISBXK.js → proxy-modes-5FAPSZEZ.js} +11 -11
  506. package/dist/node-runtime/rpc-entry.js +47 -34
  507. package/dist/node-runtime/{rpc-mode-SJNSOA4G.js → rpc-mode-SH7VB4RH.js} +2 -2
  508. package/dist/node-runtime/runtime-4VA6JKNF.js +373 -0
  509. package/dist/node-runtime/runtime-bridges-3CQHWVVY.js +21 -0
  510. package/dist/node-runtime/service-HGGU3STY.js +36 -0
  511. package/dist/node-runtime/session-handoff-IAFIK7QP.js +33 -0
  512. package/dist/node-runtime/{session-manager-QEMZBMTM.js → session-manager-TCEFDKBL.js} +2 -1
  513. package/dist/node-runtime/{session-selector-URVJLOTK.js → session-selector-HG5J4BDZ.js} +5 -4
  514. package/dist/node-runtime/{settings-manager-3CCU326G.js → settings-manager-HIBIUNBK.js} +12 -5
  515. package/dist/node-runtime/setup-JBKOLJ6F.js +18 -0
  516. package/dist/node-runtime/setup-YU5LKRL3.js +215 -0
  517. package/dist/node-runtime/{subagent-executor-CXKXQDHH.js → subagent-executor-2BH76MMS.js} +64 -23
  518. package/dist/node-runtime/theme-WTJWZSGD.js +68 -0
  519. package/dist/node-runtime/trust-manager-6ZQANSBX.js +17 -0
  520. package/dist/node-runtime/{update-cli-NM7B4CKL.js → update-cli-TVTPVUNM.js} +6 -3
  521. package/dist/node-runtime/usage-service-LFB2SWYV.js +37 -0
  522. package/dist/node-runtime/{video-extract-OYT5WKS5.js → video-extract-OOZHR7SU.js} +2 -2
  523. package/dist/node-runtime/{workflow-C26QCUTW.js → workflow-TVJNKKQP.js} +80 -39
  524. package/dist/node-runtime/{youtube-extract-TQYKGFGS.js → youtube-extract-FNPAUNHU.js} +6 -6
  525. package/dist/startup/interactive-view.d.ts.map +1 -1
  526. package/dist/startup/interactive-view.js +5 -1
  527. package/dist/startup/interactive-view.js.map +1 -1
  528. package/dist/utils/image-resize-core.d.ts +2 -0
  529. package/dist/utils/image-resize-core.d.ts.map +1 -1
  530. package/dist/utils/image-resize-core.js +10 -0
  531. package/dist/utils/image-resize-core.js.map +1 -1
  532. package/docs/browser.md +86 -0
  533. package/docs/computer-use.md +134 -48
  534. package/docs/extensions.md +2 -0
  535. package/docs/features.md +108 -27
  536. package/docs/index.md +1 -1
  537. package/docs/interactive-startup.md +2 -1
  538. package/docs/keybindings.md +1 -1
  539. package/docs/providers.md +6 -2
  540. package/docs/quickstart.md +2 -2
  541. package/docs/sessions.md +10 -0
  542. package/docs/settings.md +3 -1
  543. package/docs/tui.md +2 -0
  544. package/docs/usage.md +20 -4
  545. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  546. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  547. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  548. package/examples/extensions/gondolin/package-lock.json +2 -2
  549. package/examples/extensions/gondolin/package.json +1 -1
  550. package/examples/extensions/plan-mode/README.md +1 -1
  551. package/examples/extensions/sandbox/package-lock.json +2 -2
  552. package/examples/extensions/sandbox/package.json +1 -1
  553. package/examples/extensions/with-deps/package-lock.json +2 -2
  554. package/examples/extensions/with-deps/package.json +1 -1
  555. package/install-lock/package-lock.json +39 -25
  556. package/install-lock/package.json +2 -2
  557. package/npm-shrinkwrap.json +36 -22
  558. package/package.json +10 -7
  559. package/scripts/install-browser.mjs +20 -0
  560. package/dist/node-runtime/agent-session-services-QANFGM2V.js +0 -40
  561. package/dist/node-runtime/chunk-LISUTZS3.js +0 -19
  562. package/dist/node-runtime/chunk-VGYZ3APQ.js +0 -59
  563. package/dist/node-runtime/chunk-XAUQOKYK.js +0 -6011
  564. package/dist/node-runtime/command-ZURZJDXF.js +0 -13
  565. package/dist/node-runtime/gateway-FWHRIBK5.js +0 -2139
  566. package/dist/node-runtime/interactive-mode-BBASNWHN.js +0 -62
  567. package/dist/node-runtime/runtime-bridges-2VQTLPOZ.js +0 -12
  568. package/dist/node-runtime/{chunk-U6C7VTR5.js → chunk-7IQGBKBJ.js} +3 -3
  569. package/dist/node-runtime/{mcp-panel-IIGMXQGP.js → mcp-panel-KTTFXJZ4.js} +3 -3
  570. package/dist/node-runtime/{src-BPQFJR76.js → src-IVPNZ2BX.js} +9 -9
@@ -4,13 +4,11 @@ import {
4
4
  markUpdateNotified
5
5
  } from "./chunk-BR7YDUKA.js";
6
6
  import {
7
- computeContextBreakdown
8
- } from "./chunk-7AFOFSDY.js";
9
- import {
10
- SubagentEscapeSequence,
11
- getSubagentCancellation,
12
7
  getSubagentSpinnerDefinition
13
- } from "./chunk-A3KMVBZV.js";
8
+ } from "./chunk-US544NN6.js";
9
+ import {
10
+ computeContextBreakdown
11
+ } from "./chunk-V3HK3FE7.js";
14
12
  import {
15
13
  copyToClipboard,
16
14
  readClipboardText
@@ -22,17 +20,14 @@ import {
22
20
  import {
23
21
  BootScreenComponent,
24
22
  registerPermissionModeBridge
25
- } from "./chunk-SWSN6HAB.js";
23
+ } from "./chunk-5UZOPGE3.js";
26
24
  import {
27
25
  nextModeForGoal,
28
26
  registerPermissionModeControlBridge
29
27
  } from "./chunk-7N3YHTYF.js";
30
28
  import {
31
- ProjectTrustStore,
32
- areExperimentalFeaturesEnabled,
33
- getProjectTrustOptions,
34
- hasTrustRequiringProjectResources
35
- } from "./chunk-LTXUQJI4.js";
29
+ areExperimentalFeaturesEnabled
30
+ } from "./chunk-YPHAIRZT.js";
36
31
  import {
37
32
  MissingSessionCwdError,
38
33
  SessionImportFileNotFoundError,
@@ -41,45 +36,28 @@ import {
41
36
  clearRollback,
42
37
  disableRollbackForSession,
43
38
  enableRollbackForSession,
44
- formatCatalogRefreshSummary,
45
39
  formatMissingSessionCwdPrompt,
46
- hasGrokCliXaiAuth,
47
40
  initRollback,
48
41
  isRollbackEnabled,
49
42
  isRollbackSessionForceEnabled,
50
43
  migrateRollbackSession,
51
44
  parseSkillBlock,
52
45
  peekRollbackTurnsConsumed,
53
- refreshModelCandidatesForInit,
54
46
  rollbackLastTurn,
55
- setRollbackWarningHandler,
56
- stripJsonComments
57
- } from "./chunk-XAUQOKYK.js";
47
+ setRollbackWarningHandler
48
+ } from "./chunk-CJS4KQFI.js";
58
49
  import {
59
- parseGitUrl
60
- } from "./chunk-BYQ2MOFI.js";
50
+ notifyTodosEnabledChanged
51
+ } from "./chunk-CCCN2UCX.js";
61
52
  import {
62
- computeFileLists,
63
- createFileOps,
64
- defaultModelPerProvider,
65
- extractFileOpsFromMessage,
66
- findExactModelReferenceMatch,
67
- resolveModelScope
68
- } from "./chunk-5SQDLSZJ.js";
53
+ parseGitUrl
54
+ } from "./chunk-MFV2LOOX.js";
69
55
  import {
70
- clearRegistry,
71
56
  createAllToolDefinitions,
72
57
  ensureTool,
73
58
  getToolPath,
74
- isWindows,
75
- kill,
76
- killAll,
77
- list,
78
- pause,
79
- restart,
80
- resume,
81
59
  truncateToVisualLines
82
- } from "./chunk-GT5F3OKM.js";
60
+ } from "./chunk-33SIKK3Y.js";
83
61
  import {
84
62
  DEFAULT_MAX_BYTES,
85
63
  DEFAULT_MAX_LINES,
@@ -92,94 +70,132 @@ import {
92
70
  toolGroupRole,
93
71
  toolGroupTree,
94
72
  toolStatusDot
95
- } from "./chunk-GZQHMEWL.js";
73
+ } from "./chunk-3DKIWPKN.js";
96
74
  import {
97
- killTrackedDetachedChildren
98
- } from "./chunk-ZCHMJ34K.js";
75
+ convertToPng,
76
+ processImage
77
+ } from "./chunk-XHIRAZ26.js";
78
+ import {
79
+ formatCatalogRefreshSummary,
80
+ hasGrokCliXaiAuth,
81
+ refreshModelCandidatesForInit,
82
+ stripJsonComments
83
+ } from "./chunk-TP7K7YWS.js";
99
84
  import {
100
85
  HTTP_IDLE_TIMEOUT_CHOICES,
101
86
  SKILL_TAG_CHARACTERS,
87
+ SUBAGENT_SPINNER_LABELS,
88
+ SUBAGENT_SPINNER_NAMES,
102
89
  configureHttpDispatcher,
103
90
  formatHttpIdleTimeoutMs
104
- } from "./chunk-VQ4UBWSA.js";
91
+ } from "./chunk-EOEAQIJV.js";
105
92
  import {
106
- SUBAGENT_SPINNER_LABELS,
107
- SUBAGENT_SPINNER_NAMES
108
- } from "./chunk-LISUTZS3.js";
109
- import {
110
- SessionManager,
111
- sessionEntryToContextMessages
112
- } from "./chunk-6UB6NKA3.js";
113
- import {
114
- createCompactionSummaryMessage
115
- } from "./chunk-FVDOXRUD.js";
116
- import {
117
- getModelTiersBridge
118
- } from "./chunk-W3CVH5RX.js";
93
+ ProjectTrustStore,
94
+ getProjectTrustOptions,
95
+ hasTrustRequiringProjectResources
96
+ } from "./chunk-24C5IAJ4.js";
119
97
  import {
120
- getAllPlanUsageResults,
121
- getUsageServiceBridge
122
- } from "./chunk-LTYWTR3V.js";
98
+ computeFileLists,
99
+ createFileOps,
100
+ defaultModelPerProvider,
101
+ extractFileOpsFromMessage,
102
+ findExactModelReferenceMatch,
103
+ resolveModelScope
104
+ } from "./chunk-MNRO3UCV.js";
123
105
  import {
124
- convertToPng,
125
- processImage
126
- } from "./chunk-MW2XJZIK.js";
106
+ SubagentEscapeSequence,
107
+ getSubagentCancellation
108
+ } from "./chunk-BBUVIEZB.js";
127
109
  import {
128
110
  AUTO_MODE_ADDENDUM,
129
- PLAN_MODE_ADDENDUM,
111
+ READ_ONLY_MODE_ADDENDUM,
130
112
  getPermissionMode,
131
113
  nextPermissionMode,
132
114
  registerApprovalHandler,
133
115
  resetPermissions,
134
116
  restorePermissionModeAfterPlan,
135
117
  setPermissionMode
136
- } from "./chunk-D466UAID.js";
118
+ } from "./chunk-AJ6R5VTV.js";
137
119
  import {
138
120
  getGlobalInstructionsPath,
139
121
  getModelInstructionsPath
140
122
  } from "./chunk-M3LZLQW2.js";
141
123
  import {
142
- CustomEditor
143
- } from "./chunk-H2EOZYMP.js";
124
+ clearRegistry,
125
+ isWindows,
126
+ kill,
127
+ killAll,
128
+ list,
129
+ pause,
130
+ restart,
131
+ resume
132
+ } from "./chunk-2BLXLDJR.js";
144
133
  import {
145
- time
146
- } from "./chunk-PVCDKGR6.js";
134
+ killTrackedDetachedChildren
135
+ } from "./chunk-ZCHMJ34K.js";
136
+ import {
137
+ cancelSessionHandoff,
138
+ markSessionHandoff,
139
+ recordTuiActivity,
140
+ registerTransferHandler,
141
+ requestSessionTransfer
142
+ } from "./chunk-DO6PALE2.js";
143
+ import {
144
+ SessionManager,
145
+ sessionEntryToContextMessages
146
+ } from "./chunk-VIVYOI7C.js";
147
+ import {
148
+ createCompactionSummaryMessage
149
+ } from "./chunk-FVDOXRUD.js";
147
150
  import {
148
151
  getCustomizeBridge
149
- } from "./chunk-VGYZ3APQ.js";
152
+ } from "./chunk-4EULYYR4.js";
150
153
  import {
151
154
  MEMORY_CHAR_CAP_DEFAULT,
152
155
  MEMORY_CHAR_CAP_MAX,
153
156
  MEMORY_CHAR_CAP_MIN
154
- } 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";
168
+ import {
169
+ CustomEditor
170
+ } from "./chunk-H2EOZYMP.js";
171
+ import {
172
+ KeybindingsManager
173
+ } from "./chunk-CH6OL6P2.js";
174
+ import {
175
+ time
176
+ } from "./chunk-PVCDKGR6.js";
155
177
  import {
156
178
  markStartupMilestone
157
179
  } from "./chunk-CCZJ3PYY.js";
158
180
  import {
159
181
  ExtensionSelectorComponent
160
- } from "./chunk-MJQDX3BA.js";
182
+ } from "./chunk-EBB4BJW4.js";
161
183
  import {
162
184
  ExtensionInputComponent
163
- } from "./chunk-MGWCVY6Y.js";
185
+ } from "./chunk-UDKX3PFN.js";
164
186
  import {
165
187
  CountdownTimer
166
188
  } from "./chunk-I6R76AG7.js";
167
- import {
168
- SessionSelectorComponent
169
- } from "./chunk-HRS4HMDX.js";
170
- import {
171
- KeybindingsManager
172
- } from "./chunk-CH6OL6P2.js";
173
189
  import {
174
190
  DynamicBorder
175
- } from "./chunk-3GHXVUAK.js";
191
+ } from "./chunk-3VEY2IYY.js";
176
192
  import {
177
193
  formatKeyText,
178
194
  keyDisplayText,
179
195
  keyHint,
180
196
  keyText,
181
197
  rawKeyHint
182
- } from "./chunk-C4O2RSQQ.js";
198
+ } from "./chunk-N4TUWAGA.js";
183
199
  import {
184
200
  FS_WATCH_RETRY_DELAY_MS,
185
201
  Theme,
@@ -205,7 +221,7 @@ import {
205
221
  stopThemeWatcher,
206
222
  theme,
207
223
  watchWithErrorHandler
208
- } from "./chunk-MX3GJNXJ.js";
224
+ } from "./chunk-PLGA743X.js";
209
225
  import {
210
226
  APP_NAME,
211
227
  APP_TITLE,
@@ -227,7 +243,7 @@ import * as fs2 from "node:fs";
227
243
  import * as os2 from "node:os";
228
244
  import * as path2 from "node:path";
229
245
  import { getSupportedThinkingLevels } from "@ashx-j/lunr-ai/compat";
230
- 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";
231
247
  import chalk from "chalk";
232
248
  import { spawn as spawn3, spawnSync } from "child_process";
233
249
 
@@ -691,15 +707,15 @@ var BUILTIN_SLASH_COMMANDS = [
691
707
  { name: "context", description: "Show estimated context window breakdown" },
692
708
  {
693
709
  name: "plan",
694
- 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",
695
711
  argumentHint: "[on|off|status|<task>]"
696
712
  },
697
713
  {
698
714
  name: "mode",
699
- description: "Set permission mode: manual, yolo, plan, or auto",
700
- argumentHint: "[manual|yolo|plan|auto]"
715
+ description: "Set permission mode: yolo, auto, or read",
716
+ argumentHint: "[yolo|auto|read]"
701
717
  },
702
- { name: "manual", description: "Activate manual permission mode (approve every action)" },
718
+ { name: "read", description: "Activate read-only permission mode" },
703
719
  { name: "yolo", description: "Activate YOLO permission mode (auto-approve tools)" },
704
720
  { name: "auto", description: "Activate auto permission mode (fully autonomous, no questions)" },
705
721
  { name: "processes", description: "View and manage background processes started this session" },
@@ -719,6 +735,8 @@ var BUILTIN_SLASH_COMMANDS = [
719
735
  { name: "new", description: "Start a new session" },
720
736
  { name: "init", description: "Generate a starter AGENTS.md for this project" },
721
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" },
722
740
  { name: "resume", description: "Resume a different session" },
723
741
  { name: "sessions", description: "Browse and resume sessions" },
724
742
  { name: "reload", description: "Reload keybindings, extensions, skills, prompts, themes, and context files" },
@@ -1097,6 +1115,114 @@ var ArminComponent = class {
1097
1115
  // packages/coding-agent/dist/modes/interactive/components/assistant-message.js
1098
1116
  import { Container, Markdown as Markdown2, Spacer, Text } from "@ashx-j/lunr-tui";
1099
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
+
1100
1226
  // packages/coding-agent/dist/modes/interactive/components/thinking-summary.js
1101
1227
  var LEADING_MARKDOWN_RE = /^[#*`>\-\s]+/;
1102
1228
  function thinkingSnippet(joinedThinking, maxLen = 120) {
@@ -1143,7 +1269,7 @@ function isThinkingRunComplete(_hasFollowingBlock, timing, timingsAttached) {
1143
1269
  }
1144
1270
 
1145
1271
  // packages/coding-agent/dist/modes/interactive/components/thinking-tail.js
1146
- import { Markdown } from "@ashx-j/lunr-tui";
1272
+ import { Markdown, truncateToWidth as truncateToWidth2, visibleWidth as visibleWidth2 } from "@ashx-j/lunr-tui";
1147
1273
  var THINKING_TAIL_LINES = 4, ThinkingTailComponent = class {
1148
1274
  markdown;
1149
1275
  maxLines;
@@ -1157,6 +1283,28 @@ var THINKING_TAIL_LINES = 4, ThinkingTailComponent = class {
1157
1283
  let lines = this.markdown.render(width);
1158
1284
  return lines.length <= this.maxLines ? lines : lines.slice(-this.maxLines);
1159
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
+ }
1160
1308
  };
1161
1309
 
1162
1310
  // packages/coding-agent/dist/modes/interactive/components/assistant-message.js
@@ -1181,12 +1329,23 @@ var OSC133_ZONE_START = "\x1B]133;A\x07", OSC133_ZONE_END = "\x1B]133;B\x07", OS
1181
1329
  lastMessage;
1182
1330
  thinkingSource;
1183
1331
  hasToolCalls = !1;
1184
- constructor(message, hideThinkingBlock = !1, markdownTheme = getMarkdownTheme(), hiddenThinkingLabel = "Thinking...", outputPad = 1, thinkingCollapse = !1) {
1185
- 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);
1186
1342
  }
1187
1343
  invalidate() {
1188
1344
  super.invalidate(), this.lastMessage && this.updateContent(this.lastMessage, this.thinkingSourceOptions());
1189
1345
  }
1346
+ setReasoningDisplay(display) {
1347
+ this.reasoningDisplay = display, this.lastMessage && this.updateContent(this.lastMessage, this.thinkingSourceOptions());
1348
+ }
1190
1349
  setHideThinkingBlock(hide) {
1191
1350
  this.hideThinkingBlock = hide, this.lastMessage && this.updateContent(this.lastMessage, this.thinkingSourceOptions());
1192
1351
  }
@@ -1210,12 +1369,12 @@ var OSC133_ZONE_START = "\x1B]133;A\x07", OSC133_ZONE_END = "\x1B]133;B\x07", OS
1210
1369
  } else this.expandedRuns.has(runIndex) ? this.expandedRuns.delete(runIndex) : this.expandedRuns.add(runIndex);
1211
1370
  this.lastMessage && this.updateContent(this.lastMessage, this.thinkingSourceOptions());
1212
1371
  }
1213
- handleClick(localY, width) {
1372
+ handleClick(localY, width, localX) {
1214
1373
  let contentWidth = width, y = 0;
1215
1374
  for (let child of this.contentContainer.children) {
1216
1375
  let h = child.render(contentWidth).length;
1217
1376
  if (localY >= y && localY < y + h)
1218
- return typeof child.handleClick == "function" ? child.handleClick(localY - y, contentWidth) : !1;
1377
+ return typeof child.handleClick == "function" ? child.handleClick(localY - y, contentWidth, localX) : !1;
1219
1378
  y += h;
1220
1379
  }
1221
1380
  return !1;
@@ -1237,18 +1396,28 @@ var OSC133_ZONE_START = "\x1B]133;A\x07", OSC133_ZONE_END = "\x1B]133;B\x07", OS
1237
1396
  return this.thinkingSource ? { thinkingSource: this.thinkingSource } : void 0;
1238
1397
  }
1239
1398
  updateContent(message, options) {
1240
- this.lastMessage = message, this.thinkingSource = options?.thinkingSource, this.contentContainer.clear();
1399
+ this.lastMessage = message, this.thinkingSource = options?.thinkingSource, this.thinkingAnimationActive = !1, this.contentContainer.clear();
1241
1400
  let sourceMessage = this.thinkingSource ?? message, sourceThinkingRuns = collectThinkingRuns(sourceMessage.content);
1242
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));
1243
1402
  let isFirstTextBlock = !0, thinkingRunIndex = -1;
1244
1403
  for (let i = 0; i < message.content.length; i++) {
1245
1404
  let content = message.content[i];
1246
- if (content.type === "text" && content.text.trim()) {
1247
- let trimmed = content.text.trim(), text = isFirstTextBlock ? `\u25CF ${trimmed}` : trimmed;
1248
- isFirstTextBlock = !1, this.contentContainer.addChild(new Markdown2(text, this.outputPad, 0, this.markdownTheme, {
1249
- color: (body) => theme.fg("userMessageText", body)
1250
- }));
1251
- } 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") {
1252
1421
  thinkingRunIndex++;
1253
1422
  let displayBlocks = [];
1254
1423
  for (; i < message.content.length; i++) {
@@ -1276,6 +1445,18 @@ var OSC133_ZONE_START = "\x1B]133;A\x07", OSC133_ZONE_END = "\x1B]133;B\x07", OS
1276
1445
  this.contentContainer.addChild(new Spacer(1)), this.contentContainer.addChild(new Text(theme.fg("error", `Error: ${errorMsg}`), this.outputPad, 0));
1277
1446
  }
1278
1447
  }
1448
+ this.onThinkingAnimationChange?.(this.thinkingAnimationActive);
1449
+ }
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();
1279
1460
  }
1280
1461
  renderThinkingRun(thinkingRunIndex, thinkingBlocks, displayMessage, displayIndex, fullyRevealed) {
1281
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) => {
@@ -1284,13 +1465,19 @@ var OSC133_ZONE_START = "\x1B]133;A\x07", OSC133_ZONE_END = "\x1B]133;B\x07", OS
1284
1465
  if (this.thinkingCollapse && !this.isRunExpanded(thinkingRunIndex) && runComplete) {
1285
1466
  let timing = this.thinkingTimings?.[thinkingRunIndex], label = timing?.end !== void 0 ? `\u273B Thought for ${formatThoughtDuration(timing.end - timing.start)}` : "\u273B Thought", block = new Container();
1286
1467
  block.addChild(new Text(theme.fg("thinkingText", theme.italic(label)), this.outputPad, 0));
1287
- let snippet = thinkingSnippet(thinkingBlocks.join(`
1468
+ let joinedThinking = thinkingBlocks.join(`
1288
1469
 
1289
- `));
1470
+ `), snippet = thinkingSnippet(displayMessage.provider === "openai-codex" ? joinedThinking.replaceAll("**", "") : joinedThinking);
1290
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));
1291
1472
  return;
1292
1473
  }
1293
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
+ }
1294
1481
  wrap(new ThinkingTailComponent(thinkingBlocks.join(`
1295
1482
 
1296
1483
  `), this.outputPad, 0, this.markdownTheme, {
@@ -1509,7 +1696,7 @@ var CompactionSummaryMessageComponent = class extends Box2 {
1509
1696
 
1510
1697
  // packages/coding-agent/dist/modes/interactive/components/footer.js
1511
1698
  import { isAbsolute, relative, resolve as resolve2, sep } from "node:path";
1512
- import { truncateToWidth, visibleWidth } from "@ashx-j/lunr-tui";
1699
+ import { truncateToWidth as truncateToWidth3, visibleWidth as visibleWidth3 } from "@ashx-j/lunr-tui";
1513
1700
  function sanitizeStatusText(text) {
1514
1701
  return text.replace(/[\r\n\t]/g, " ").replace(/ +/g, " ").trim();
1515
1702
  }
@@ -1568,38 +1755,38 @@ var FooterComponent = class {
1568
1755
  }
1569
1756
  let contextPercentStr, autoIndicator = this.autoCompactEnabled ? " (auto)" : "", contextPercentDisplay = contextPercent === "?" ? `?/${formatTokens(contextWindow)}${autoIndicator}` : `${contextPercent}%/${formatTokens(contextWindow)}${autoIndicator}`;
1570
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"))}`);
1571
- let statsLeft = statsParts.join(" "), modelName = state.model?.id || "no-model", statsLeftWidth = visibleWidth(statsLeft);
1572
- 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));
1573
1760
  let minPadding = 2, rightSideWithoutProvider = modelName;
1574
1761
  if (state.model?.reasoning) {
1575
1762
  let thinkingLevel = state.thinkingLevel || "off";
1576
1763
  rightSideWithoutProvider = thinkingLevel === "off" ? `${modelName} \u2022 thinking off` : `${modelName} \u2022 ${thinkingLevel}`;
1577
1764
  }
1578
1765
  let rightSide = rightSideWithoutProvider;
1579
- this.footerData.getAvailableProviderCount() > 1 && state.model && (rightSide = `(${state.model.provider}) ${rightSideWithoutProvider}`, statsLeftWidth + minPadding + visibleWidth(rightSide) > width && (rightSide = rightSideWithoutProvider));
1580
- 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;
1581
1768
  if (totalNeeded <= width) {
1582
1769
  let padding = " ".repeat(width - statsLeftWidth - rightSideWidth);
1583
1770
  statsLine = statsLeft + padding + rightSide;
1584
1771
  } else {
1585
1772
  let availableForRight = width - statsLeftWidth - minPadding;
1586
1773
  if (availableForRight > 0) {
1587
- 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));
1588
1775
  statsLine = statsLeft + padding + truncatedRight;
1589
1776
  } else
1590
1777
  statsLine = statsLeft;
1591
1778
  }
1592
- 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();
1593
1780
  if (extensionStatuses.size > 0) {
1594
1781
  let statusLine = Array.from(extensionStatuses.entries()).sort(([a], [b]) => a.localeCompare(b)).map(([, text]) => sanitizeStatusText(text)).join(" ");
1595
- lines.push(truncateToWidth(statusLine, width, theme.fg("dim", "...")));
1782
+ lines.push(truncateToWidth3(statusLine, width, theme.fg("dim", "...")));
1596
1783
  }
1597
1784
  return lines;
1598
1785
  }
1599
1786
  };
1600
1787
 
1601
1788
  // packages/coding-agent/dist/modes/interactive/components/usage-view.js
1602
- 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";
1603
1790
  var BAR_CELLS = 20;
1604
1791
  function usageLevelColor(percent) {
1605
1792
  return percent > 90 ? "error" : percent > 70 ? "warning" : "success";
@@ -1637,9 +1824,9 @@ function planWindowLine(window, labelWidth) {
1637
1824
  return ` ${window.label.padEnd(labelWidth)} ${usageBar(window.usedPercent)} ${pct}${reset}`;
1638
1825
  }
1639
1826
  function renderThemedBox(headerText, content, maxWidth) {
1640
- 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];
1641
1828
  for (let rawLine of content) {
1642
- 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)));
1643
1830
  lines.push(`${border("\u2502 ")}${line}${padding}${border(" \u2502")}`);
1644
1831
  }
1645
1832
  return lines.push(bottom), lines;
@@ -1731,6 +1918,9 @@ var CustomEntryComponent = class extends Container4 {
1731
1918
  setExpanded(expanded) {
1732
1919
  this._expanded !== expanded && (this._expanded = expanded, this.rebuild());
1733
1920
  }
1921
+ handleClick(localY, width) {
1922
+ return super.handleClick(localY, width) ? !0 : !this.customComponent || localY < 1 ? !1 : (this.setExpanded(!this._expanded), !0);
1923
+ }
1734
1924
  invalidate() {
1735
1925
  super.invalidate(), this.rebuild();
1736
1926
  }
@@ -1762,6 +1952,9 @@ var CustomMessageComponent = class extends Container5 {
1762
1952
  setExpanded(expanded) {
1763
1953
  this._expanded !== expanded && (this._expanded = expanded, this.rebuild());
1764
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
+ }
1765
1958
  invalidate() {
1766
1959
  super.invalidate(), this.rebuild();
1767
1960
  }
@@ -2410,7 +2603,7 @@ var PlanMessageComponent = class extends Container10 {
2410
2603
  };
2411
2604
 
2412
2605
  // packages/coding-agent/dist/modes/interactive/components/processes-selector.js
2413
- 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";
2414
2607
  function formatElapsed(startedAt) {
2415
2608
  let ms = Date.now() - startedAt, s = Math.floor(ms / 1e3);
2416
2609
  if (s < 60)
@@ -2447,7 +2640,7 @@ var ProcessesSelectorComponent = class extends Container11 {
2447
2640
  continue;
2448
2641
  let elapsed = formatElapsed(p.startedAt), status;
2449
2642
  p.status === "exited" ? status = `exited(${p.exitCode ?? "?"})` : p.status === "paused" ? status = "paused" : status = "running";
2450
- 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);
2451
2644
  this.addChild(new Text13(colored, 0, 0));
2452
2645
  }
2453
2646
  this.addChild(new Spacer12(1));
@@ -3422,6 +3615,14 @@ var ThemeSubmenu = class extends Container13 {
3422
3615
  values: ["true", "false"],
3423
3616
  disabled: () => config.hideThinkingBlock
3424
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
+ },
3425
3626
  {
3426
3627
  id: "cache-miss-notices",
3427
3628
  label: "Cache miss notices",
@@ -3466,6 +3667,13 @@ var ThemeSubmenu = class extends Container13 {
3466
3667
  currentValue: config.computerForeground !== !1 ? "on" : "off",
3467
3668
  values: ["on", "off"]
3468
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
+ },
3469
3677
  {
3470
3678
  id: "agent-memory",
3471
3679
  label: "Agent memory",
@@ -3473,6 +3681,13 @@ var ThemeSubmenu = class extends Container13 {
3473
3681
  currentValue: config.memoryEnabled ? "on" : "off",
3474
3682
  values: ["on", "off"]
3475
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
+ },
3476
3691
  {
3477
3692
  id: "memory-char-cap",
3478
3693
  label: "Memory character cap",
@@ -3501,12 +3716,29 @@ var ThemeSubmenu = class extends Container13 {
3501
3716
  currentValue: DEFAULT_PROJECT_TRUST_LABELS[config.defaultProjectTrust],
3502
3717
  values: Object.values(DEFAULT_PROJECT_TRUST_LABELS)
3503
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
+ },
3504
3736
  {
3505
3737
  id: "default-permission-mode",
3506
3738
  label: "Default permission mode",
3507
3739
  description: "Starting permission mode for new sessions",
3508
- currentValue: config.defaultPermissionMode,
3509
- values: ["manual", "yolo", "plan", "auto"]
3740
+ currentValue: config.defaultPermissionMode === "read-only" ? "read" : config.defaultPermissionMode,
3741
+ values: ["yolo", "auto", "read"]
3510
3742
  },
3511
3743
  {
3512
3744
  id: "double-escape-action",
@@ -3556,6 +3788,20 @@ var ThemeSubmenu = class extends Container13 {
3556
3788
  currentValue: config.modelInstructions.enabled ? "on" : "off",
3557
3789
  submenu: (_currentValue, done) => new ModelInstructionsSubmenu(config, callbacks, done)
3558
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
+ },
3559
3805
  {
3560
3806
  id: "confirm-large-subagent-launches",
3561
3807
  label: "Confirm large subagent launches",
@@ -3734,6 +3980,9 @@ var ThemeSubmenu = class extends Container13 {
3734
3980
  case "thinking-collapse":
3735
3981
  callbacks.onThinkingCollapseChange(newValue === "true");
3736
3982
  break;
3983
+ case "reasoning-display":
3984
+ (newValue === "auto" || newValue === "one-line" || newValue === "four-lines") && callbacks.onReasoningDisplayChange(newValue);
3985
+ break;
3737
3986
  case "cache-miss-notices":
3738
3987
  callbacks.onShowCacheMissNoticesChange(newValue === "true");
3739
3988
  break;
@@ -3746,6 +3995,12 @@ var ThemeSubmenu = class extends Container13 {
3746
3995
  case "smooth-streaming":
3747
3996
  callbacks.onSmoothStreamingChange(newValue === "true");
3748
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;
3749
4004
  case "plan-usage-window":
3750
4005
  callbacks.onPlanUsageWindowChange(newValue === "5h" ? "5h" : "weekly");
3751
4006
  break;
@@ -3758,9 +4013,15 @@ var ThemeSubmenu = class extends Container13 {
3758
4013
  case "computer-foreground":
3759
4014
  callbacks.onComputerForegroundChange?.(newValue === "on");
3760
4015
  break;
4016
+ case "browser-enabled":
4017
+ callbacks.onBrowserEnabledChange(newValue === "on");
4018
+ break;
3761
4019
  case "agent-memory":
3762
4020
  callbacks.onMemoryEnabledChange(newValue === "on");
3763
4021
  break;
4022
+ case "todos":
4023
+ callbacks.onTodosEnabledChange(newValue === "on");
4024
+ break;
3764
4025
  case "search-curator":
3765
4026
  callbacks.onSearchCuratorChange(newValue);
3766
4027
  break;
@@ -3773,7 +4034,7 @@ var ThemeSubmenu = class extends Container13 {
3773
4034
  break;
3774
4035
  }
3775
4036
  case "default-permission-mode":
3776
- callbacks.onDefaultPermissionModeChange(newValue);
4037
+ callbacks.onDefaultPermissionModeChange(newValue === "read" ? "read-only" : newValue);
3777
4038
  break;
3778
4039
  case "double-escape-action":
3779
4040
  callbacks.onDoubleEscapeActionChange(newValue);
@@ -3925,7 +4186,6 @@ var ToolExecutionComponent = class extends Container14 {
3925
4186
  hideComponent = !1;
3926
4187
  groupContinuation = !1;
3927
4188
  groupFollowed = !1;
3928
- groupPrev;
3929
4189
  groupNext;
3930
4190
  constructor(toolName, toolCallId, args, options = {}, toolDefinition, ui, cwd) {
3931
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();
@@ -3969,13 +4229,18 @@ var ToolExecutionComponent = class extends Container14 {
3969
4229
  let state = this.isPartial ? "pending" : this.result?.isError ? "error" : "success";
3970
4230
  return toolStatusDot(state, theme);
3971
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
+ }
3972
4235
  createCallFallback() {
4236
+ let waitDuration = this.getWaitDuration();
3973
4237
  return new Text17(formatGroupedCall({
3974
4238
  role: toolGroupRole(this.groupContinuation, this.groupFollowed),
3975
4239
  compact: !this.isPartial && !this.expanded && !this.result?.isError,
3976
4240
  tree: toolGroupTree({ expanded: this.expanded, isError: this.result?.isError }),
3977
4241
  dot: this.getStatusDot(),
3978
- title: theme.fg("toolTitle", theme.bold(this.toolName))
4242
+ title: theme.fg("toolTitle", theme.bold(this.toolName)),
4243
+ detail: waitDuration && theme.fg("toolOutput", waitDuration)
3979
4244
  }), 0, 0);
3980
4245
  }
3981
4246
  createResultFallback() {
@@ -4010,16 +4275,30 @@ var ToolExecutionComponent = class extends Container14 {
4010
4275
  }
4011
4276
  }
4012
4277
  setExpanded(expanded) {
4013
- this.expanded = expanded, this.updateDisplay(), this.refreshGroupTail();
4278
+ this.toolName !== "browser" && (this.expanded = expanded, this.updateDisplay(), this.refreshGroupTail());
4014
4279
  }
4015
4280
  handleClick(_localY, _width) {
4016
- 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?.();
4017
4293
  }
4018
4294
  // lunr: consecutive same-tool grouping — exposes the tool name so the caller
4019
4295
  // can detect adjacency.
4020
4296
  getToolName() {
4021
4297
  return this.toolName;
4022
4298
  }
4299
+ matchesToolCall(toolCallId) {
4300
+ return this.toolCallId === toolCallId;
4301
+ }
4023
4302
  // lunr: consecutive same-tool grouping — continuation calls hide the top
4024
4303
  // spacer and top box pad so adjacent same-bg boxes read as one continuous
4025
4304
  // background; the last card in a run keeps its bottom pad.
@@ -4031,41 +4310,22 @@ var ToolExecutionComponent = class extends Container14 {
4031
4310
  setGroupFollowed(on) {
4032
4311
  this.groupFollowed = on, this.applyGroupPadding(), this.invalidate();
4033
4312
  }
4034
- // lunr: same-name run link so a later card can hoist earlier error bodies
4035
- // under the last leaf instead of splitting the tree.
4313
+ // lunr: same-name run link keeps the final card refreshed as earlier calls settle.
4036
4314
  linkGroupNext(next) {
4037
- this.groupNext = next, next.groupPrev = this;
4315
+ this.groupNext = next;
4038
4316
  }
4039
4317
  applyGroupPadding() {
4040
4318
  let top = this.groupContinuation ? 0 : 1, bottom = this.groupFollowed ? 0 : 1;
4041
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));
4042
4320
  }
4043
- shouldHideGroupedErrorBody() {
4044
- return !!this.result?.isError && this.groupFollowed && !this.expanded && !this.isPartial && this.getRenderShell() === "default" && this.toolName !== "subagent" && this.toolName !== "subagent_wait";
4045
- }
4046
4321
  shouldSkipCompactResult() {
4047
4322
  if (this.result === void 0 || this.isPartial || this.expanded)
4048
4323
  return !1;
4049
4324
  if (this.toolName === "subagent") {
4050
4325
  let details = this.result.details;
4051
- return !(this.result.isError || Array.isArray(details?.results) && details.results.length > 0 || details?.mode === "management");
4326
+ return !this.result.isError && this.args?.action === "steer" ? !0 : !(this.result.isError || Array.isArray(details?.results) && details.results.length > 0 || details?.mode === "management");
4052
4327
  }
4053
- return this.result.isError ? this.shouldHideGroupedErrorBody() : this.getRenderShell() === "default";
4054
- }
4055
- formatHoistedGroupErrors() {
4056
- if (this.groupFollowed || this.expanded)
4057
- return;
4058
- let texts = [], prev = this.groupPrev;
4059
- for (; prev; ) {
4060
- if (prev.shouldHideGroupedErrorBody()) {
4061
- let output = prev.getTextOutput().trim();
4062
- output && texts.unshift(output);
4063
- }
4064
- prev = prev.groupPrev;
4065
- }
4066
- return texts.length > 0 ? `
4067
- ${texts.join(`
4068
- `)}` : void 0;
4328
+ return this.toolName === "subagent_wait" || this.result.isError ? !0 : this.getRenderShell() === "default";
4069
4329
  }
4070
4330
  refreshGroupTail() {
4071
4331
  let next = this.groupNext;
@@ -4133,8 +4393,6 @@ ${texts.join(`
4133
4393
  let component = this.createResultFallback();
4134
4394
  component && (renderContainer.addChild(component), hasContent = !0);
4135
4395
  }
4136
- let hoisted = this.formatHoistedGroupErrors();
4137
- hoisted && (renderContainer.addChild(new Text17(theme.fg("toolOutput", hoisted), 0, 0)), hasContent = !0);
4138
4396
  }
4139
4397
  } else
4140
4398
  this.contentText.setCustomBgFn(bgFn), this.contentText.setText(this.formatToolExecution()), hasContent = !0;
@@ -4164,12 +4422,13 @@ ${texts.join(`
4164
4422
  return getTextOutput(this.result, this.showImages);
4165
4423
  }
4166
4424
  formatToolExecution() {
4167
- 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({
4168
4426
  role: toolGroupRole(this.groupContinuation, this.groupFollowed),
4169
4427
  compact,
4170
4428
  tree: toolGroupTree({ expanded: this.expanded, isError: this.result?.isError }),
4171
4429
  dot: this.getStatusDot(),
4172
- title: theme.fg("toolTitle", theme.bold(this.toolName))
4430
+ title: theme.fg("toolTitle", theme.bold(this.toolName)),
4431
+ detail: waitDuration && theme.fg("toolOutput", waitDuration)
4173
4432
  });
4174
4433
  if (!compact) {
4175
4434
  let content = JSON.stringify(this.args, null, 2);
@@ -4180,8 +4439,7 @@ ${content}`);
4180
4439
  output && (text += `
4181
4440
  ${output}`);
4182
4441
  }
4183
- let hoisted = this.formatHoistedGroupErrors();
4184
- return hoisted && (text += hoisted), text;
4442
+ return text;
4185
4443
  }
4186
4444
  };
4187
4445
  function applySameToolGrouping(previous, next) {
@@ -4189,7 +4447,7 @@ function applySameToolGrouping(previous, next) {
4189
4447
  }
4190
4448
 
4191
4449
  // packages/coding-agent/dist/modes/interactive/components/tree-selector.js
4192
- 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";
4193
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;
4194
4452
  function renderHorizontalViewport(rows, width) {
4195
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;
@@ -4202,7 +4460,7 @@ function renderHorizontalViewport(rows, width) {
4202
4460
  }
4203
4461
  return rows.map((row) => {
4204
4462
  let line = horizontalScroll > 0 ? `${row.gutter}${sliceByColumn(row.body, horizontalScroll, viewportWidth, !0)}\x1B[0m` : row.gutter + row.body;
4205
- return truncateToWidth4(line, width, "");
4463
+ return truncateToWidth6(line, width, "");
4206
4464
  });
4207
4465
  }
4208
4466
  var TreeList = class {
@@ -4520,7 +4778,7 @@ var TreeList = class {
4520
4778
  render(width) {
4521
4779
  let lines = [];
4522
4780
  if (this.filteredNodes.length === 0)
4523
- 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;
4524
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 = [];
4525
4783
  for (let i = startIndex; i < endIndex; i++) {
4526
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);
@@ -4539,10 +4797,10 @@ var TreeList = class {
4539
4797
  else
4540
4798
  prefixChars.push(" ");
4541
4799
  }
4542
- 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;
4543
- 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 });
4544
4802
  }
4545
- 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;
4546
4804
  }
4547
4805
  getEntryDisplayText(node, isSelected) {
4548
4806
  let entry = node.entry, result, normalize = (s) => s.replace(/[\n\t]/g, " ").trim();
@@ -4801,7 +5059,7 @@ var TreeList = class {
4801
5059
  }
4802
5060
  render(width) {
4803
5061
  let query = this.treeList.getSearchQuery();
4804
- 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)];
4805
5063
  }
4806
5064
  handleInput(_keyData) {
4807
5065
  }
@@ -4814,14 +5072,14 @@ var TreeList = class {
4814
5072
  return text ? labelFirst ? `${label} ${text}` : `${text} ${label}` : label;
4815
5073
  }), availableWidth = Math.max(1, width), indent = " ", separator = " \xB7 ", lines = [], currentLine = "";
4816
5074
  for (let item of items) {
4817
- let candidate = currentLine ? `${currentLine}${separator}${item}` : visibleWidth3(`${indent}${item}`) <= availableWidth ? `${indent}${item}` : item;
4818
- 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) {
4819
5077
  currentLine = candidate;
4820
5078
  continue;
4821
5079
  }
4822
- 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;
4823
5081
  }
4824
- 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));
4825
5083
  }
4826
5084
  }, TREE_HELP_ITEMS = [
4827
5085
  { keys: ["tui.select.up", "tui.select.down"], label: "move" },
@@ -4880,7 +5138,7 @@ var LabelInput = class {
4880
5138
  }
4881
5139
  render(width) {
4882
5140
  let lines = [], availableWidth = width - 2;
4883
- 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;
4884
5142
  }
4885
5143
  handleInput(keyData) {
4886
5144
  let kb = getKeybindings8();
@@ -4997,7 +5255,7 @@ var OSC133_ZONE_START2 = "\x1B]133;A\x07", OSC133_ZONE_END2 = "\x1B]133;B\x07",
4997
5255
  };
4998
5256
 
4999
5257
  // packages/coding-agent/dist/modes/interactive/components/user-message-selector.js
5000
- 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";
5001
5259
  var UserMessageList = class {
5002
5260
  messages = [];
5003
5261
  selectedIndex = 0;
@@ -5018,7 +5276,7 @@ var UserMessageList = class {
5018
5276
  return lines.push(theme.fg("muted", " No user messages found")), lines;
5019
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);
5020
5278
  for (let i = startIndex; i < endIndex; i++) {
5021
- 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);
5022
5280
  lines.push(messageLine);
5023
5281
  let metadata = ` Message ${i + 1} of ${this.messages.length}`, metadataLine = theme.fg("muted", metadata);
5024
5282
  lines.push(metadataLine), lines.push("");
@@ -5327,7 +5585,7 @@ function isDeadTerminalError(error) {
5327
5585
  let code = error.code;
5328
5586
  return code !== void 0 && DEAD_TERMINAL_ERROR_CODES.has(code);
5329
5587
  }
5330
- 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.
5331
5589
  Scan: package manifests, directory layout, build/test/lint scripts, CI config,
5332
5590
  existing README/docs. Include only: project purpose (one paragraph), build &
5333
5591
  test commands, code style/conventions found, directory map, and agent rules
@@ -5440,8 +5698,10 @@ var InteractiveMode = class _InteractiveMode {
5440
5698
  streamingTargetMessage = void 0;
5441
5699
  streamingDisplayedLength = 0;
5442
5700
  smoothStreamingTimer = void 0;
5701
+ thinkingAnimationTimer;
5443
5702
  // Tool execution tracking: toolCallId -> component
5444
5703
  pendingTools = /* @__PURE__ */ new Map();
5704
+ browserActivityComponent;
5445
5705
  // Tool output expansion state
5446
5706
  toolOutputExpanded = !1;
5447
5707
  // Thinking block visibility state
@@ -5460,8 +5720,7 @@ var InteractiveMode = class _InteractiveMode {
5460
5720
  signalCleanupHandlers = [];
5461
5721
  // Track if editor is in bash mode (text starts with !)
5462
5722
  isBashMode = !1;
5463
- // lunr: mode in effect before the current plan stretch. Used by approve / `/plan off`
5464
- // / `/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.
5465
5724
  previousPermissionMode;
5466
5725
  // lunr: mode in effect before `/goal` forced session auto. Dedicated so it cannot
5467
5726
  // collide with plan restore.
@@ -5526,11 +5785,13 @@ var InteractiveMode = class _InteractiveMode {
5526
5785
  this.runtimeHost = runtimeHost, this.options = options, this.autoTrustOnReloadCwd = options.autoTrustOnReloadCwd, this.runtimeHost.setBeforeSessionInvalidate((reason) => {
5527
5786
  this.resetExtensionUI(), this.previousPermissionMode = void 0, this.preGoalPermissionMode = void 0, resetPermissions(this.settingsManager.getDefaultPermissionMode()), clearRegistry(), reason !== "fork" && clearRollback(this.sessionManager.getSessionId());
5528
5787
  }), this.runtimeHost.setRebindSession(async () => {
5529
- 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);
5530
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({
5531
5792
  enterGoalAuto: () => this.enterGoalAuto(),
5532
5793
  leaveGoalAuto: () => this.leaveGoalAuto()
5533
- }), 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);
5534
5795
  let editorPaddingX = this.settingsManager.getEditorPaddingX(), autocompleteMaxVisible = this.settingsManager.getAutocompleteMaxVisible();
5535
5796
  this.defaultEditor = options.startupView?.editor ?? new CustomEditor(this.ui, getEditorTheme(), this.keybindings, {
5536
5797
  paddingX: editorPaddingX,
@@ -5646,10 +5907,14 @@ var InteractiveMode = class _InteractiveMode {
5646
5907
  return this.showLargeSubagentLaunchApprovalDialog(req);
5647
5908
  if (req.kind === "plan") {
5648
5909
  let resp = await this.showPlanApprovalDialog(req.detail);
5649
- 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;
5650
5915
  }
5651
- return this.showApprovalDialog(req);
5652
- }), 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()) {
5653
5918
  let header = theme.bold(theme.fg("accent", APP_NAME)) + theme.fg("dim", ` v${this.version}`);
5654
5919
  this.builtInHeader = new BootScreenComponent(header, this.buildBootRows()), this.headerContainer.addChild(new Spacer19(1)), this.headerContainer.addChild(this.builtInHeader);
5655
5920
  } else
@@ -6136,7 +6401,7 @@ ${warningLines}`, 0, 0)), this.loadedResourcesContainer.addChild(new Spacer19(1)
6136
6401
  replaceInstructions: options?.replaceInstructions,
6137
6402
  label: options?.label
6138
6403
  });
6139
- 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 });
6140
6405
  },
6141
6406
  switchSession: async (sessionPath, options) => this.handleResumeSession(sessionPath, options),
6142
6407
  reload: async () => {
@@ -6169,15 +6434,25 @@ ${warningLines}`, 0, 0)), this.loadedResourcesContainer.addChild(new Spacer19(1)
6169
6434
  ], skillsCount = this.session.resourceLoader.getSkills().skills.length;
6170
6435
  return skillsCount > 0 && bootRows.push({ label: "skills", value: String(skillsCount) }), bootRows;
6171
6436
  }
6437
+ unregisterSessionTransfer;
6438
+ transferInProgress = !1;
6439
+ detachedDraft = "";
6172
6440
  async rebindCurrentSession(options = {}) {
6173
- 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();
6174
6449
  }
6175
6450
  async handleFatalRuntimeError(prefix, error) {
6176
6451
  let message = error instanceof Error ? error.message : String(error);
6177
6452
  this.showError(`${prefix}: ${message}`), stopThemeWatcher(), this.stop(), process.exit(1);
6178
6453
  }
6179
6454
  renderCurrentSessionState() {
6180
- 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();
6181
6456
  }
6182
6457
  /**
6183
6458
  * Get a registered tool definition by name (for custom rendering).
@@ -6692,7 +6967,35 @@ ${message}`, ["Yes", "No"], opts) === "Yes";
6692
6967
  }
6693
6968
  setupEditorSubmitHandler() {
6694
6969
  this.defaultEditor.onSubmit = async (text) => {
6695
- 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) {
6696
6999
  this.takeSubmittedImages(text);
6697
7000
  return;
6698
7001
  }
@@ -6790,8 +7093,8 @@ ${message}`, ["Yes", "No"], opts) === "Yes";
6790
7093
  this.editor.setText(""), this.handleModeCommand(text === "/mode" ? "" : text.slice(6).trim());
6791
7094
  return;
6792
7095
  }
6793
- if (text === "/manual" || text === "/yolo" || text === "/auto") {
6794
- 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));
6795
7098
  return;
6796
7099
  }
6797
7100
  if (text === "/processes") {
@@ -6863,9 +7166,21 @@ ${message}`, ["Yes", "No"], opts) === "Yes";
6863
7166
  this.isExtensionCommand(text) ? (this.editor.addToHistory?.(text), this.editor.setText(""), await this.promptAfterDeferredBuiltins(text)) : this.queueCompactionMessage(text, "steer", images);
6864
7167
  return;
6865
7168
  }
6866
- if (this.session.isStreaming) {
6867
- this.editor.addToHistory?.(text), this.editor.setText(""), await this.promptAfterDeferredBuiltins(text, { streamingBehavior: "steer", images }), this.updatePendingMessagesDisplay(), this.ui.requestRender();
6868
- 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
+ }
6869
7184
  }
6870
7185
  this.flushPendingBashComponents(), this.onInputCallback ? this.onInputCallback({ text, images }) : this.pendingUserInputs.push({ text, images }), this.editor.addToHistory?.(text);
6871
7186
  };
@@ -6875,6 +7190,13 @@ ${message}`, ["Yes", "No"], opts) === "Yes";
6875
7190
  getSmoothStreamingOptions() {
6876
7191
  return { hideThinking: this.hideThinkingBlock };
6877
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
+ }
6878
7200
  clearSmoothStreamingTimer() {
6879
7201
  this.smoothStreamingTimer && (clearInterval(this.smoothStreamingTimer), this.smoothStreamingTimer = void 0);
6880
7202
  }
@@ -6905,11 +7227,8 @@ ${message}`, ["Yes", "No"], opts) === "Yes";
6905
7227
  let component = this.pendingTools.get(content.id);
6906
7228
  component && component.updateArgs(content.arguments);
6907
7229
  } else {
6908
- let component = new ToolExecutionComponent(content.name, content.id, content.arguments, {
6909
- showImages: this.settingsManager.getShowImages(),
6910
- imageWidthCells: this.settingsManager.getImageWidthCells()
6911
- }, this.getRegisteredToolDefinition(content.name), this.ui, this.sessionManager.getCwd());
6912
- 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);
6913
7232
  }
6914
7233
  }
6915
7234
  advanceSmoothStreaming() {
@@ -6927,7 +7246,7 @@ ${message}`, ["Yes", "No"], opts) === "Yes";
6927
7246
  this.streamingDisplayedLength += computeSmoothRevealStep(backlog), this.streamingDisplayedLength > total && (this.streamingDisplayedLength = total), this.paintSmoothStreamingFrame(), this.streamingDisplayedLength >= total && this.clearSmoothStreamingTimer();
6928
7247
  }
6929
7248
  stopSmoothStreaming() {
6930
- this.clearSmoothStreamingTimer(), this.streamingTargetMessage = void 0, this.streamingDisplayedLength = 0;
7249
+ this.setThinkingAnimation(!1), this.clearSmoothStreamingTimer(), this.streamingTargetMessage = void 0, this.streamingDisplayedLength = 0;
6931
7250
  }
6932
7251
  /** Apply a mid-stream smoothStreaming setting change without rewinding. */
6933
7252
  applySmoothStreamingSettingChange(enabled) {
@@ -6949,7 +7268,7 @@ ${message}`, ["Yes", "No"], opts) === "Yes";
6949
7268
  async handleEvent(event) {
6950
7269
  switch (this.isInitialized || await this.init(), this.footer.invalidate(), event.type) {
6951
7270
  case "agent_start":
6952
- 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();
6953
7272
  break;
6954
7273
  case "queue_update":
6955
7274
  this.updatePendingMessagesDisplay(), this.ui.requestRender();
@@ -6964,7 +7283,11 @@ ${message}`, ["Yes", "No"], opts) === "Yes";
6964
7283
  this.footer.invalidate(), this.updateEditorBorderColor();
6965
7284
  break;
6966
7285
  case "message_start":
6967
- 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());
6968
7291
  break;
6969
7292
  case "message_update":
6970
7293
  if (this.streamingComponent && event.message.role === "assistant")
@@ -7007,10 +7330,7 @@ ${message}`, ["Yes", "No"], opts) === "Yes";
7007
7330
  this.streamingDisplayedLength < needed && (this.streamingDisplayedLength = needed), this.paintSmoothStreamingFrame();
7008
7331
  }
7009
7332
  let component = this.pendingTools.get(event.toolCallId);
7010
- component || (component = new ToolExecutionComponent(event.toolName, event.toolCallId, event.args, {
7011
- showImages: this.settingsManager.getShowImages(),
7012
- imageWidthCells: this.settingsManager.getImageWidthCells()
7013
- }, 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();
7014
7334
  break;
7015
7335
  }
7016
7336
  case "tool_execution_update": {
@@ -7024,7 +7344,7 @@ ${message}`, ["Yes", "No"], opts) === "Yes";
7024
7344
  break;
7025
7345
  }
7026
7346
  case "agent_end":
7027
- 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();
7028
7348
  break;
7029
7349
  case "agent_settled":
7030
7350
  if (this.pendingCompactionRender) {
@@ -7145,7 +7465,10 @@ ${message}`, ["Yes", "No"], opts) === "Yes";
7145
7465
  break;
7146
7466
  }
7147
7467
  case "assistant": {
7148
- 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
+ });
7149
7472
  assistantComponent.setThinkingTimings(this.thinkingTimingsByMessage.get(message)), assistantComponent.setExpanded(this.toolOutputExpanded), this.chatContainer.addChild(assistantComponent);
7150
7473
  break;
7151
7474
  }
@@ -7158,7 +7481,7 @@ ${message}`, ["Yes", "No"], opts) === "Yes";
7158
7481
  }
7159
7482
  renderSessionItems(items, options = {}) {
7160
7483
  this.pendingTools.clear();
7161
- 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();
7162
7485
  options.updateFooter && (this.footer.invalidate(), this.updateEditorBorderColor());
7163
7486
  for (let item of items) {
7164
7487
  if (isCustomSessionEntry(item)) {
@@ -7170,11 +7493,11 @@ ${message}`, ["Yes", "No"], opts) === "Yes";
7170
7493
  this.addMessageToChat(message);
7171
7494
  for (let content of message.content)
7172
7495
  if (content.type === "toolCall") {
7173
- 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, {
7174
7498
  showImages: this.settingsManager.getShowImages(),
7175
7499
  imageWidthCells: this.settingsManager.getImageWidthCells()
7176
- }, this.getRegisteredToolDefinition(content.name), this.ui, this.sessionManager.getCwd());
7177
- 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") {
7178
7501
  let errorMessage;
7179
7502
  if (message.stopReason === "aborted") {
7180
7503
  let retryAttempt = this.session.retryAttempt;
@@ -7193,7 +7516,7 @@ ${message}`, ["Yes", "No"], opts) === "Yes";
7193
7516
  let component = renderedPendingTools.get(message.toolCallId);
7194
7517
  component && (component.updateResult(message), renderedPendingTools.delete(message.toolCallId));
7195
7518
  } else
7196
- this.addMessageToChat(message, options);
7519
+ message.role === "user" && (browserActivityComponent = void 0), this.addMessageToChat(message, options);
7197
7520
  }
7198
7521
  for (let [toolCallId, component] of renderedPendingTools)
7199
7522
  this.pendingTools.set(toolCallId, component);
@@ -7252,7 +7575,7 @@ ${message}`, ["Yes", "No"], opts) === "Yes";
7252
7575
  });
7253
7576
  }
7254
7577
  rebuildChatFromMessages() {
7255
- this.chatContainer.clear(), this.renderSessionEntries(this.sessionManager.buildContextEntries());
7578
+ this.clearChatContainer(), this.renderSessionEntries(this.sessionManager.buildContextEntries());
7256
7579
  }
7257
7580
  // =========================================================================
7258
7581
  // Key handlers
@@ -7273,7 +7596,7 @@ ${message}`, ["Yes", "No"], opts) === "Yes";
7273
7596
  async shutdown(options) {
7274
7597
  if (this.isShuttingDown)
7275
7598
  return;
7276
- 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) {
7277
7600
  await this.runtimeHost.dispose(), this.themeController.disableAutoSync(), await this.ui.terminal.drainInput(1e3);
7278
7601
  try {
7279
7602
  killAll();
@@ -7374,6 +7697,10 @@ Kill them before exit?`) && killAll(), this.stop(), await this.runtimeHost.dispo
7374
7697
  }
7375
7698
  }
7376
7699
  async handleFollowUp() {
7700
+ if (this.runtimeHost.isDetached || this.transferInProgress) {
7701
+ this.showError("Use /reclaim before sending more work. Draft retained.");
7702
+ return;
7703
+ }
7377
7704
  let text = (this.editor.getExpandedText?.() ?? this.editor.getText()).trim();
7378
7705
  if (text) {
7379
7706
  if (this.session.isCompacting) {
@@ -7408,21 +7735,26 @@ Kill them before exit?`) && killAll(), this.stop(), await this.runtimeHost.dispo
7408
7735
  this.ui.requestRender();
7409
7736
  }
7410
7737
  cycleThinkingLevel() {
7411
- 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());
7412
7741
  }
7413
7742
  cyclePermissionMode() {
7414
7743
  this.applyPermissionMode(nextPermissionMode(getPermissionMode()), { silent: !0 });
7415
7744
  }
7416
7745
  async cycleModel(direction) {
7417
- try {
7418
- let result = await this.session.cycleModel(direction);
7419
- if (result === void 0) {
7420
- let msg = this.session.scopedModels.length > 0 ? "Only one model in scope" : "Only one model available";
7421
- this.showStatus(msg);
7422
- } else
7423
- this.footer.invalidate(), this.updateEditorBorderColor(), this.maybeWarnAboutAnthropicSubscriptionAuth(result.model);
7424
- } catch (error) {
7425
- 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
+ }
7426
7758
  }
7427
7759
  }
7428
7760
  toggleToolOutputExpansion() {
@@ -7437,6 +7769,23 @@ Kill them before exit?`) && killAll(), this.stop(), await this.runtimeHost.dispo
7437
7769
  isExpandable(child) && child.setExpanded(expanded);
7438
7770
  globalThis[/* @__PURE__ */ Symbol.for("@lunr/tools-expanded-changed")]?.(expanded), this.ui.requestRender();
7439
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
+ }
7440
7789
  // lunr: consecutive same-tool grouping — a tool component appended right after
7441
7790
  // another component for the SAME tool becomes a group continuation (no top
7442
7791
  // spacer / top pad); the previous card drops its bottom pad. Mixed neighbors
@@ -7446,7 +7795,7 @@ Kill them before exit?`) && killAll(), this.stop(), await this.runtimeHost.dispo
7446
7795
  applySameToolGrouping(last instanceof ToolExecutionComponent ? last : void 0, component), this.chatContainer.addChild(component);
7447
7796
  }
7448
7797
  toggleThinkingBlockVisibility() {
7449
- 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) {
7450
7799
  if (this.streamingComponent.setHideThinkingBlock(this.hideThinkingBlock), this.settingsManager.getSmoothStreaming() && this.streamingTargetMessage) {
7451
7800
  let opts = this.getSmoothStreamingOptions(), total = countMessageGraphemes(this.streamingTargetMessage, opts);
7452
7801
  this.streamingDisplayedLength > total && (this.streamingDisplayedLength = total), this.paintSmoothStreamingFrame(), this.streamingDisplayedLength < total && this.startSmoothStreaming();
@@ -7563,7 +7912,7 @@ Pi will resume when the editor exits.
7563
7912
  return !!extensionRunner.getCommand(commandName);
7564
7913
  }
7565
7914
  renderCompactionResult(result) {
7566
- 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();
7567
7916
  }
7568
7917
  async flushCompactionQueue(options) {
7569
7918
  if (this.compactionQueuedMessages.length === 0)
@@ -7642,6 +7991,7 @@ Pi will resume when the editor exits.
7642
7991
  availableThemes: getAvailableThemes(),
7643
7992
  hideThinkingBlock: this.hideThinkingBlock,
7644
7993
  thinkingCollapse: this.thinkingCollapse,
7994
+ reasoningDisplay: this.settingsManager.getReasoningDisplay(),
7645
7995
  cacheRetention: this.settingsManager.getCacheRetention() ?? "short",
7646
7996
  doubleEscapeAction: this.settingsManager.getDoubleEscapeAction(),
7647
7997
  treeFilterMode: this.settingsManager.getTreeFilterMode(),
@@ -7664,8 +8014,12 @@ Pi will resume when the editor exits.
7664
8014
  confirmLargeSubagentLaunches: this.settingsManager.getConfirmLargeSubagentLaunches(),
7665
8015
  computerUse: this.settingsManager.getComputerUse(),
7666
8016
  computerForeground: this.settingsManager.getComputerForeground(),
8017
+ subagentCommunicationEnabled: this.settingsManager.getSubagentCommunicationEnabled(),
8018
+ automaticSubagentDelegation: this.settingsManager.getAutomaticSubagentDelegation(),
8019
+ browserEnabled: this.settingsManager.getBrowserEnabled(),
7667
8020
  memoryEnabled: this.settingsManager.getMemoryEnabled(),
7668
8021
  memoryCharCap: this.settingsManager.getMemoryCharCap(),
8022
+ todosEnabled: this.settingsManager.getTodosEnabled(),
7669
8023
  searchCurator: getSearchCuratorSetting(),
7670
8024
  // lunr: TUI customize settings
7671
8025
  footerMcp: this.settingsManager.getFooterMcp(),
@@ -7736,13 +8090,19 @@ Pi will resume when the editor exits.
7736
8090
  this.hideThinkingBlock = hidden, this.settingsManager.setHideThinkingBlock(hidden);
7737
8091
  for (let child of this.chatContainer.children)
7738
8092
  child instanceof AssistantMessageComponent && child.setHideThinkingBlock(hidden);
7739
- this.chatContainer.clear(), this.rebuildChatFromMessages();
8093
+ this.rebuildChatFromMessages();
7740
8094
  },
7741
8095
  onThinkingCollapseChange: (collapse) => {
7742
8096
  this.thinkingCollapse = collapse, this.settingsManager.setThinkingCollapse(collapse);
7743
8097
  for (let child of this.chatContainer.children)
7744
8098
  child instanceof AssistantMessageComponent && child.setThinkingCollapse(collapse);
7745
- 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();
7746
8106
  },
7747
8107
  onShowCacheMissNoticesChange: (shown) => {
7748
8108
  this.settingsManager.setShowCacheMissNotices(shown), this.rebuildChatFromMessages();
@@ -7813,6 +8173,12 @@ Pi will resume when the editor exits.
7813
8173
  onConfirmLargeSubagentLaunchesChange: (enabled) => {
7814
8174
  this.settingsManager.setConfirmLargeSubagentLaunches(enabled);
7815
8175
  },
8176
+ onSubagentCommunicationChange: (enabled) => {
8177
+ this.settingsManager.setSubagentCommunicationEnabled(enabled);
8178
+ },
8179
+ onAutomaticSubagentDelegationChange: (enabled) => {
8180
+ this.settingsManager.setAutomaticSubagentDelegation(enabled), this.session.refreshToolRegistry();
8181
+ },
7816
8182
  getTierThinkingLevels: (tier) => {
7817
8183
  let model = this.resolveModelReference(this.settingsManager.getTierModel(tier));
7818
8184
  return model ? getSupportedThinkingLevels(model) : this.session.getAvailableThinkingLevels();
@@ -7826,9 +8192,15 @@ Pi will resume when the editor exits.
7826
8192
  onComputerForegroundChange: (enabled) => {
7827
8193
  this.settingsManager.setComputerForeground(enabled);
7828
8194
  },
8195
+ onBrowserEnabledChange: (enabled) => {
8196
+ this.settingsManager.setBrowserEnabled(enabled), this.session.refreshToolRegistry();
8197
+ },
7829
8198
  onMemoryEnabledChange: (enabled) => {
7830
8199
  this.settingsManager.setMemoryEnabled(enabled), this.session.refreshToolRegistry(), this.showStatus(`Agent memory: ${enabled ? "on" : "off"}`);
7831
8200
  },
8201
+ onTodosEnabledChange: (enabled) => {
8202
+ this.settingsManager.setTodosEnabled(enabled), notifyTodosEnabledChanged(enabled), this.session.refreshToolRegistry();
8203
+ },
7832
8204
  onSearchCuratorChange: (setting) => {
7833
8205
  setSearchCuratorSetting(setting) || this.showError("pi-web-access is not loaded; curator setting unavailable.");
7834
8206
  },
@@ -7866,6 +8238,31 @@ Pi will resume when the editor exits.
7866
8238
  onPlanUsageWindowChange: (window) => {
7867
8239
  this.settingsManager.setPlanUsageWindow(window);
7868
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
+ },
7869
8266
  onDefaultPermissionModeChange: (mode) => {
7870
8267
  this.settingsManager.setDefaultPermissionMode(mode);
7871
8268
  },
@@ -8037,6 +8434,8 @@ Pi will resume when the editor exits.
8037
8434
  });
8038
8435
  }
8039
8436
  async showModelSelector(initialSearchInput) {
8437
+ if (this.runtimeHost.isDetached || this.transferInProgress)
8438
+ return;
8040
8439
  let subscriptionNames = await this.getActiveSubscriptionNames();
8041
8440
  this.showSelector((done) => {
8042
8441
  let selector = new ModelSelectorComponent(this.ui, this.session.model, this.settingsManager, this.session.modelRuntime, this.session.scopedModels, async (model) => {
@@ -8173,6 +8572,8 @@ Pi will resume when the editor exits.
8173
8572
  });
8174
8573
  }
8175
8574
  showUserMessageSelector() {
8575
+ if (this.runtimeHost.isDetached || this.transferInProgress)
8576
+ return;
8176
8577
  let userMessages = this.session.getUserMessagesForForking();
8177
8578
  if (userMessages.length === 0) {
8178
8579
  this.showStatus("No messages to fork from");
@@ -8215,6 +8616,8 @@ Pi will resume when the editor exits.
8215
8616
  }
8216
8617
  }
8217
8618
  showTreeSelector(initialSelectedId) {
8619
+ if (this.runtimeHost.isDetached || this.transferInProgress)
8620
+ return;
8218
8621
  let tree = this.sessionManager.getTree(), realLeafId = this.sessionManager.getLeafId(), initialFilterMode = this.settingsManager.getTreeFilterMode();
8219
8622
  if (tree.length === 0) {
8220
8623
  this.showStatus("No entries in session");
@@ -8259,7 +8662,7 @@ Pi will resume when the editor exits.
8259
8662
  this.showStatus("Navigation cancelled");
8260
8663
  return;
8261
8664
  }
8262
- 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 });
8263
8666
  } catch (error) {
8264
8667
  this.showError(error instanceof Error ? error.message : String(error));
8265
8668
  } finally {
@@ -8296,7 +8699,16 @@ Pi will resume when the editor exits.
8296
8699
  let next = (nextName ?? "").trim();
8297
8700
  if (!next)
8298
8701
  return;
8299
- 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
+ }
8300
8712
  },
8301
8713
  showRenameHint: !0,
8302
8714
  keybindings: this.keybindings
@@ -8352,8 +8764,8 @@ Pi will resume when the editor exits.
8352
8764
  }
8353
8765
  async getLogoutProviderOptions() {
8354
8766
  let options = [];
8355
- for (let { providerId, type } of await this.session.modelRuntime.listCredentials()) {
8356
- 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" };
8357
8769
  if (type === "api_key") {
8358
8770
  let subs = await this.session.modelRuntime.subscriptionManager.list(providerId);
8359
8771
  if (subs.length > 1) {
@@ -8757,7 +9169,22 @@ Pi will resume when the editor exits.
8757
9169
  return this.session.modelRuntime.login(providerId, method, {
8758
9170
  signal: dialog.signal,
8759
9171
  prompt: (prompt) => this.showAuthPrompt(dialog, prompt),
8760
- 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
+ }
8761
9188
  });
8762
9189
  }
8763
9190
  async showLoginDialog(providerId, providerName) {
@@ -8838,7 +9265,7 @@ ${INIT_EXISTING_FILE_INSTRUCTIONS.append}`;
8838
9265
  this.showStatus(command === "undo" ? "Undo cancelled" : "Edit cancelled");
8839
9266
  return;
8840
9267
  }
8841
- 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 };
8842
9269
  } catch (error) {
8843
9270
  this.showError(error instanceof Error ? error.message : String(error));
8844
9271
  return;
@@ -8870,7 +9297,7 @@ ${INIT_EXISTING_FILE_INSTRUCTIONS.append}`;
8870
9297
  this.redoStack.push(targetId), this.showStatus("Navigation cancelled");
8871
9298
  return;
8872
9299
  }
8873
- 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 });
8874
9301
  } catch (error) {
8875
9302
  this.showError(error instanceof Error ? error.message : String(error));
8876
9303
  }
@@ -9215,56 +9642,54 @@ ${theme.fg("dim", "Cache Re-billed:")} ${detail}`;
9215
9642
  this.chatContainer.addChild(new Spacer19(1)), this.chatContainer.addChild(new Text21(lines.join(`
9216
9643
  `), 1, 0)), this.ui.requestRender();
9217
9644
  }
9218
- // lunr: /plan — shortcut onto the plan permission mode (not a second state machine).
9645
+ // /plan is a shortcut into read-only mode for planning.
9219
9646
  async handlePlanCommand(args) {
9220
- let sub = args.toLowerCase(), inPlan = getPermissionMode() === "plan";
9647
+ let sub = args.toLowerCase(), inReadOnly = getPermissionMode() === "read-only";
9221
9648
  if (sub === "status") {
9222
- 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()}.`);
9223
9650
  return;
9224
9651
  }
9225
9652
  if (sub !== "" && sub !== "on" && sub !== "off") {
9226
- 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}`);
9227
9654
  return;
9228
9655
  }
9229
- let next = sub === "" ? !inPlan : sub === "on";
9230
- if (next === inPlan) {
9231
- 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.");
9232
9659
  return;
9233
9660
  }
9234
- next ? this.applyPermissionMode("plan") : this.applyPermissionMode(this.restoreTargetAfterPlan());
9661
+ this.applyPermissionMode(next ? "read-only" : this.restoreTargetAfterPlan());
9235
9662
  }
9236
- // lunr: /mode — permission mode selector (manual / yolo / plan / auto). Per-session only.
9237
9663
  handleModeCommand(args) {
9238
9664
  let sub = args.toLowerCase();
9239
9665
  if (sub === "status") {
9240
- this.showStatus(`Permission mode: ${getPermissionMode()}`);
9666
+ this.showStatus(`Permission mode: ${getPermissionMode() === "read-only" ? "read" : getPermissionMode()}`);
9241
9667
  return;
9242
9668
  }
9243
- if (sub === "manual" || sub === "yolo" || sub === "plan" || sub === "auto") {
9244
- this.applyPermissionMode(sub);
9669
+ if (sub === "yolo" || sub === "auto" || sub === "read-only" || sub === "read") {
9670
+ this.applyPermissionMode(sub === "read" ? "read-only" : sub);
9245
9671
  return;
9246
9672
  }
9247
9673
  if (sub !== "") {
9248
- 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.");
9249
9675
  return;
9250
9676
  }
9251
9677
  let options = [
9252
- "Manual \u2014 approve every action",
9253
9678
  "YOLO \u2014 auto-approve tools, agent may still ask",
9254
- "Plan \u2014 read-only; present a plan for approval",
9255
- "Auto \u2014 fully autonomous, no questions"
9679
+ "Auto \u2014 fully autonomous, no questions",
9680
+ "Read \u2014 inspect without making changes"
9256
9681
  ];
9257
9682
  this.showExtensionSelector("Permission mode", options).then((choice) => {
9258
- 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"));
9259
9684
  });
9260
9685
  }
9261
- /** Destination when leaving plan via approve / `/plan off` / `/plan <text>`. */
9686
+ /** Destination after plan approval or /plan off. */
9262
9687
  restoreTargetAfterPlan() {
9263
9688
  return restorePermissionModeAfterPlan(this.previousPermissionMode, this.settingsManager.getDefaultPermissionMode());
9264
9689
  }
9265
9690
  /** Apply addendum + auto-rollback for a mode without a status toast. */
9266
9691
  syncPermissionModeEffects(mode) {
9267
- 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));
9268
9693
  }
9269
9694
  // lunr: `/goal` forces session auto without writing settings.
9270
9695
  enterGoalAuto() {
@@ -9276,23 +9701,11 @@ ${theme.fg("dim", "Cache Re-billed:")} ${detail}`;
9276
9701
  this.preGoalPermissionMode = next.saved, next.mode !== getPermissionMode() && this.applyPermissionMode(next.mode, { silent: !0 });
9277
9702
  }
9278
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);
9279
9707
  let prev = getPermissionMode();
9280
- 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}`));
9281
- }
9282
- // lunr: approval dialog for manual permission mode.
9283
- // lunr: adds "Switch to auto" / "Switch to yolo" at the bottom so users can
9284
- // escape manual approval mid-turn without a separate /mode round-trip.
9285
- async showApprovalDialog(req) {
9286
- return new Promise((resolve4) => {
9287
- this.showSelector((done) => {
9288
- let selector = new ExtensionSelectorComponent(`Approve ${req.action}?`, ["Approve once", "Approve for session", "Reject", "Switch to auto", "Switch to yolo"], (option) => {
9289
- 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");
9290
- }, () => {
9291
- done(), resolve4("reject");
9292
- }, { message: req.detail.slice(0, 500) });
9293
- return { component: selector, focus: selector };
9294
- });
9295
- });
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}`));
9296
9709
  }
9297
9710
  // Approval dialog for one subagent call launching more than two children.
9298
9711
  // "Reject with feedback" collects a one-line
@@ -9312,7 +9725,7 @@ ${theme.fg("dim", "Cache Re-billed:")} ${detail}`;
9312
9725
  });
9313
9726
  });
9314
9727
  }
9315
- // lunr: approval dialog for present_plan (plan mode). The "with feedback"
9728
+ // Approval dialog for present_plan (read-only mode). The "with feedback"
9316
9729
  // options collect a one-line note via showExtensionInput that becomes part of
9317
9730
  // the result text the model sees. Esc/close counts as Decline.
9318
9731
  showPlanInChat(summary) {
@@ -9461,6 +9874,10 @@ ${toggleThinking ? `| \`${toggleThinking}\` | Toggle thinking block visibility |
9461
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();
9462
9875
  }
9463
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
+ }
9464
9881
  this.clearStatusIndicator(), this.ui.setChatScroll(0), await this.waitForDeferredBuiltins();
9465
9882
  let previousModel = this.session.model;
9466
9883
  try {
@@ -9479,7 +9896,7 @@ ${toggleThinking ? `| \`${toggleThinking}\` | Toggle thinking block visibility |
9479
9896
  "",
9480
9897
  "=== All rendered lines with visible widths ===",
9481
9898
  ...allLines.map((line, idx) => {
9482
- let vw = visibleWidth4(line), escaped = JSON.stringify(line);
9899
+ let vw = visibleWidth6(line), escaped = JSON.stringify(line);
9483
9900
  return `[${idx}] (w=${vw}) ${escaped}`;
9484
9901
  }),
9485
9902
  "",
@@ -9532,7 +9949,7 @@ ${theme.fg("muted", debugLogPath)}`, 1, 1)), this.ui.requestRender();
9532
9949
  }
9533
9950
  }
9534
9951
  stop() {
9535
- 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();
9536
9953
  }
9537
9954
  };
9538
9955