@ashx-j/lunr 0.2.21 → 0.2.23

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 (461) hide show
  1. package/CHANGELOG.md +4 -2
  2. package/README.md +23 -5
  3. package/dist/builtin-extensions/index.d.ts.map +1 -1
  4. package/dist/builtin-extensions/index.js +1 -0
  5. package/dist/builtin-extensions/index.js.map +1 -1
  6. package/dist/builtin-extensions/lunr-browser.d.ts +9 -0
  7. package/dist/builtin-extensions/lunr-browser.d.ts.map +1 -0
  8. package/dist/builtin-extensions/lunr-browser.js +169 -0
  9. package/dist/builtin-extensions/lunr-browser.js.map +1 -0
  10. package/dist/builtin-extensions/lunr-todos.d.ts.map +1 -1
  11. package/dist/builtin-extensions/lunr-todos.js +15 -0
  12. package/dist/builtin-extensions/lunr-todos.js.map +1 -1
  13. package/dist/builtin-extensions/pi-intercom/index.d.ts.map +1 -1
  14. package/dist/builtin-extensions/pi-intercom/index.js +3 -0
  15. package/dist/builtin-extensions/pi-intercom/index.js.map +1 -1
  16. package/dist/builtin-extensions/pi-subagents/src/extension/control-notices.d.ts +1 -1
  17. package/dist/builtin-extensions/pi-subagents/src/extension/control-notices.d.ts.map +1 -1
  18. package/dist/builtin-extensions/pi-subagents/src/extension/control-notices.js +5 -1
  19. package/dist/builtin-extensions/pi-subagents/src/extension/control-notices.js.map +1 -1
  20. package/dist/builtin-extensions/pi-subagents/src/extension/index.d.ts +2 -2
  21. package/dist/builtin-extensions/pi-subagents/src/extension/index.d.ts.map +1 -1
  22. package/dist/builtin-extensions/pi-subagents/src/extension/index.js +18 -5
  23. package/dist/builtin-extensions/pi-subagents/src/extension/index.js.map +1 -1
  24. package/dist/builtin-extensions/pi-subagents/src/extension/tool-description.d.ts +4 -3
  25. package/dist/builtin-extensions/pi-subagents/src/extension/tool-description.d.ts.map +1 -1
  26. package/dist/builtin-extensions/pi-subagents/src/extension/tool-description.js +3 -0
  27. package/dist/builtin-extensions/pi-subagents/src/extension/tool-description.js.map +1 -1
  28. package/dist/builtin-extensions/pi-subagents/src/intercom/communication.d.ts +17 -0
  29. package/dist/builtin-extensions/pi-subagents/src/intercom/communication.d.ts.map +1 -0
  30. package/dist/builtin-extensions/pi-subagents/src/intercom/communication.js +45 -0
  31. package/dist/builtin-extensions/pi-subagents/src/intercom/communication.js.map +1 -0
  32. package/dist/builtin-extensions/pi-subagents/src/intercom/intercom-bridge.d.ts.map +1 -1
  33. package/dist/builtin-extensions/pi-subagents/src/intercom/intercom-bridge.js +4 -11
  34. package/dist/builtin-extensions/pi-subagents/src/intercom/intercom-bridge.js.map +1 -1
  35. package/dist/builtin-extensions/pi-subagents/src/intercom/native-supervisor-channel.d.ts +4 -1
  36. package/dist/builtin-extensions/pi-subagents/src/intercom/native-supervisor-channel.d.ts.map +1 -1
  37. package/dist/builtin-extensions/pi-subagents/src/intercom/native-supervisor-channel.js +160 -51
  38. package/dist/builtin-extensions/pi-subagents/src/intercom/native-supervisor-channel.js.map +1 -1
  39. package/dist/builtin-extensions/pi-subagents/src/intercom/supervisor-ask.d.ts.map +1 -1
  40. package/dist/builtin-extensions/pi-subagents/src/intercom/supervisor-ask.js +5 -0
  41. package/dist/builtin-extensions/pi-subagents/src/intercom/supervisor-ask.js.map +1 -1
  42. package/dist/builtin-extensions/pi-subagents/src/intercom/supervisor-questions.d.ts +2 -0
  43. package/dist/builtin-extensions/pi-subagents/src/intercom/supervisor-questions.d.ts.map +1 -1
  44. package/dist/builtin-extensions/pi-subagents/src/intercom/supervisor-questions.js +3 -2
  45. package/dist/builtin-extensions/pi-subagents/src/intercom/supervisor-questions.js.map +1 -1
  46. package/dist/builtin-extensions/pi-subagents/src/runs/background/auto-drain.d.ts +1 -0
  47. package/dist/builtin-extensions/pi-subagents/src/runs/background/auto-drain.d.ts.map +1 -1
  48. package/dist/builtin-extensions/pi-subagents/src/runs/background/auto-drain.js +2 -1
  49. package/dist/builtin-extensions/pi-subagents/src/runs/background/auto-drain.js.map +1 -1
  50. package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-wait.d.ts +3 -0
  51. package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-wait.d.ts.map +1 -1
  52. package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-wait.js +11 -0
  53. package/dist/builtin-extensions/pi-subagents/src/runs/background/subagent-wait.js.map +1 -1
  54. package/dist/builtin-extensions/pi-subagents/src/runs/background/wait-tool.d.ts.map +1 -1
  55. package/dist/builtin-extensions/pi-subagents/src/runs/background/wait-tool.js +41 -3
  56. package/dist/builtin-extensions/pi-subagents/src/runs/background/wait-tool.js.map +1 -1
  57. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/subagent-executor.d.ts.map +1 -1
  58. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/subagent-executor.js +4 -0
  59. package/dist/builtin-extensions/pi-subagents/src/runs/foreground/subagent-executor.js.map +1 -1
  60. package/dist/builtin-extensions/pi-subagents/src/runs/shared/pi-args.d.ts.map +1 -1
  61. package/dist/builtin-extensions/pi-subagents/src/runs/shared/pi-args.js +3 -0
  62. package/dist/builtin-extensions/pi-subagents/src/runs/shared/pi-args.js.map +1 -1
  63. package/dist/builtin-extensions/pi-subagents/src/runs/shared/subagent-control.d.ts +1 -0
  64. package/dist/builtin-extensions/pi-subagents/src/runs/shared/subagent-control.d.ts.map +1 -1
  65. package/dist/builtin-extensions/pi-subagents/src/runs/shared/subagent-control.js +3 -0
  66. package/dist/builtin-extensions/pi-subagents/src/runs/shared/subagent-control.js.map +1 -1
  67. package/dist/builtin-extensions/pi-subagents/src/runs/shared/subagent-prompt-runtime.d.ts.map +1 -1
  68. package/dist/builtin-extensions/pi-subagents/src/runs/shared/subagent-prompt-runtime.js +1 -1
  69. package/dist/builtin-extensions/pi-subagents/src/runs/shared/subagent-prompt-runtime.js.map +1 -1
  70. package/dist/builtin-extensions/pi-subagents/src/shared/types.d.ts +1 -0
  71. package/dist/builtin-extensions/pi-subagents/src/shared/types.d.ts.map +1 -1
  72. package/dist/builtin-extensions/pi-subagents/src/shared/types.js.map +1 -1
  73. package/dist/builtin-extensions/pi-subagents/src/tui/communication.d.ts +18 -0
  74. package/dist/builtin-extensions/pi-subagents/src/tui/communication.d.ts.map +1 -0
  75. package/dist/builtin-extensions/pi-subagents/src/tui/communication.js +48 -0
  76. package/dist/builtin-extensions/pi-subagents/src/tui/communication.js.map +1 -0
  77. package/dist/builtin-extensions/pi-web-access/index.d.ts.map +1 -1
  78. package/dist/builtin-extensions/pi-web-access/index.js +11 -7
  79. package/dist/builtin-extensions/pi-web-access/index.js.map +1 -1
  80. package/dist/cli/args.d.ts.map +1 -1
  81. package/dist/cli/args.js +2 -1
  82. package/dist/cli/args.js.map +1 -1
  83. package/dist/cli/install-cli.d.ts.map +1 -1
  84. package/dist/cli/install-cli.js +15 -45
  85. package/dist/cli/install-cli.js.map +1 -1
  86. package/dist/core/agent-session-runtime.d.ts +9 -0
  87. package/dist/core/agent-session-runtime.d.ts.map +1 -1
  88. package/dist/core/agent-session-runtime.js +126 -29
  89. package/dist/core/agent-session-runtime.js.map +1 -1
  90. package/dist/core/agent-session.d.ts +22 -0
  91. package/dist/core/agent-session.d.ts.map +1 -1
  92. package/dist/core/agent-session.js +250 -105
  93. package/dist/core/agent-session.js.map +1 -1
  94. package/dist/core/browser/network.d.ts +9 -0
  95. package/dist/core/browser/network.d.ts.map +1 -0
  96. package/dist/core/browser/network.js +146 -0
  97. package/dist/core/browser/network.js.map +1 -0
  98. package/dist/core/browser/runtime.d.ts +24 -0
  99. package/dist/core/browser/runtime.d.ts.map +1 -0
  100. package/dist/core/browser/runtime.js +289 -0
  101. package/dist/core/browser/runtime.js.map +1 -0
  102. package/dist/core/browser/schema.d.ts +16 -0
  103. package/dist/core/browser/schema.d.ts.map +1 -0
  104. package/dist/core/browser/schema.js +36 -0
  105. package/dist/core/browser/schema.js.map +1 -0
  106. package/dist/core/browser/settings.d.ts +8 -0
  107. package/dist/core/browser/settings.d.ts.map +1 -0
  108. package/dist/core/browser/settings.js +30 -0
  109. package/dist/core/browser/settings.js.map +1 -0
  110. package/dist/core/browser/setup.d.ts +2 -0
  111. package/dist/core/browser/setup.d.ts.map +1 -0
  112. package/dist/core/browser/setup.js +16 -0
  113. package/dist/core/browser/setup.js.map +1 -0
  114. package/dist/core/customize.d.ts.map +1 -1
  115. package/dist/core/customize.js +15 -14
  116. package/dist/core/customize.js.map +1 -1
  117. package/dist/core/export-html/index.d.ts.map +1 -1
  118. package/dist/core/export-html/index.js +1 -1
  119. package/dist/core/export-html/index.js.map +1 -1
  120. package/dist/core/extensions/runner.d.ts +1 -0
  121. package/dist/core/extensions/runner.d.ts.map +1 -1
  122. package/dist/core/extensions/runner.js +1 -1
  123. package/dist/core/extensions/runner.js.map +1 -1
  124. package/dist/core/extensions/types.d.ts +1 -1
  125. package/dist/core/extensions/types.d.ts.map +1 -1
  126. package/dist/core/extensions/types.js.map +1 -1
  127. package/dist/core/install-features.d.ts.map +1 -1
  128. package/dist/core/install-features.js +10 -8
  129. package/dist/core/install-features.js.map +1 -1
  130. package/dist/core/memory-cap.d.ts.map +1 -1
  131. package/dist/core/memory-cap.js +5 -3
  132. package/dist/core/memory-cap.js.map +1 -1
  133. package/dist/core/model-tiers.d.ts.map +1 -1
  134. package/dist/core/model-tiers.js +9 -6
  135. package/dist/core/model-tiers.js.map +1 -1
  136. package/dist/core/permissions.d.ts.map +1 -1
  137. package/dist/core/permissions.js +9 -0
  138. package/dist/core/permissions.js.map +1 -1
  139. package/dist/core/plan-mode.d.ts.map +1 -1
  140. package/dist/core/plan-mode.js +3 -0
  141. package/dist/core/plan-mode.js.map +1 -1
  142. package/dist/core/process-registry.d.ts.map +1 -1
  143. package/dist/core/process-registry.js +6 -4
  144. package/dist/core/process-registry.js.map +1 -1
  145. package/dist/core/runtime-scope.d.ts +11 -0
  146. package/dist/core/runtime-scope.d.ts.map +1 -0
  147. package/dist/core/runtime-scope.js +3 -0
  148. package/dist/core/runtime-scope.js.map +1 -0
  149. package/dist/core/sdk.d.ts.map +1 -1
  150. package/dist/core/sdk.js +13 -0
  151. package/dist/core/sdk.js.map +1 -1
  152. package/dist/core/session-handoff.d.ts +35 -0
  153. package/dist/core/session-handoff.d.ts.map +1 -0
  154. package/dist/core/session-handoff.js +214 -0
  155. package/dist/core/session-handoff.js.map +1 -0
  156. package/dist/core/session-manager.d.ts +20 -0
  157. package/dist/core/session-manager.d.ts.map +1 -1
  158. package/dist/core/session-manager.js +184 -22
  159. package/dist/core/session-manager.js.map +1 -1
  160. package/dist/core/session-ownership.d.ts +28 -0
  161. package/dist/core/session-ownership.d.ts.map +1 -0
  162. package/dist/core/session-ownership.js +138 -0
  163. package/dist/core/session-ownership.js.map +1 -0
  164. package/dist/core/session-retention.d.ts.map +1 -1
  165. package/dist/core/session-retention.js +11 -2
  166. package/dist/core/session-retention.js.map +1 -1
  167. package/dist/core/settings-manager.d.ts +11 -0
  168. package/dist/core/settings-manager.d.ts.map +1 -1
  169. package/dist/core/settings-manager.js +27 -0
  170. package/dist/core/settings-manager.js.map +1 -1
  171. package/dist/core/slash-commands.d.ts.map +1 -1
  172. package/dist/core/slash-commands.js +2 -0
  173. package/dist/core/slash-commands.js.map +1 -1
  174. package/dist/core/subagent-wait-interruption.d.ts +11 -0
  175. package/dist/core/subagent-wait-interruption.d.ts.map +1 -0
  176. package/dist/core/subagent-wait-interruption.js +19 -0
  177. package/dist/core/subagent-wait-interruption.js.map +1 -0
  178. package/dist/core/system-prompt.d.ts.map +1 -1
  179. package/dist/core/system-prompt.js +7 -2
  180. package/dist/core/system-prompt.js.map +1 -1
  181. package/dist/core/todo-settings.d.ts +5 -0
  182. package/dist/core/todo-settings.d.ts.map +1 -0
  183. package/dist/core/todo-settings.js +7 -0
  184. package/dist/core/todo-settings.js.map +1 -0
  185. package/dist/core/tools/bash.d.ts.map +1 -1
  186. package/dist/core/tools/bash.js +4 -4
  187. package/dist/core/tools/bash.js.map +1 -1
  188. package/dist/core/tools/edit.d.ts.map +1 -1
  189. package/dist/core/tools/edit.js +5 -3
  190. package/dist/core/tools/edit.js.map +1 -1
  191. package/dist/core/tools/find.d.ts.map +1 -1
  192. package/dist/core/tools/find.js +4 -4
  193. package/dist/core/tools/find.js.map +1 -1
  194. package/dist/core/tools/grep.d.ts.map +1 -1
  195. package/dist/core/tools/grep.js +4 -4
  196. package/dist/core/tools/grep.js.map +1 -1
  197. package/dist/core/tools/ls.d.ts.map +1 -1
  198. package/dist/core/tools/ls.js +4 -4
  199. package/dist/core/tools/ls.js.map +1 -1
  200. package/dist/core/tools/read.d.ts.map +1 -1
  201. package/dist/core/tools/read.js +4 -4
  202. package/dist/core/tools/read.js.map +1 -1
  203. package/dist/core/tools/render-utils.d.ts +14 -5
  204. package/dist/core/tools/render-utils.d.ts.map +1 -1
  205. package/dist/core/tools/render-utils.js +34 -7
  206. package/dist/core/tools/render-utils.js.map +1 -1
  207. package/dist/core/tools/write.d.ts.map +1 -1
  208. package/dist/core/tools/write.js +4 -4
  209. package/dist/core/tools/write.js.map +1 -1
  210. package/dist/core/usage-service.d.ts.map +1 -1
  211. package/dist/core/usage-service.js +5 -3
  212. package/dist/core/usage-service.js.map +1 -1
  213. package/dist/gateway/adapters/discord.d.ts +12 -1
  214. package/dist/gateway/adapters/discord.d.ts.map +1 -1
  215. package/dist/gateway/adapters/discord.js +112 -17
  216. package/dist/gateway/adapters/discord.js.map +1 -1
  217. package/dist/gateway/adapters/telegram.d.ts +4 -2
  218. package/dist/gateway/adapters/telegram.d.ts.map +1 -1
  219. package/dist/gateway/adapters/telegram.js +34 -11
  220. package/dist/gateway/adapters/telegram.js.map +1 -1
  221. package/dist/gateway/agent-bridge.d.ts +14 -3
  222. package/dist/gateway/agent-bridge.d.ts.map +1 -1
  223. package/dist/gateway/agent-bridge.js +252 -60
  224. package/dist/gateway/agent-bridge.js.map +1 -1
  225. package/dist/gateway/approval.d.ts +1 -0
  226. package/dist/gateway/approval.d.ts.map +1 -1
  227. package/dist/gateway/approval.js +60 -18
  228. package/dist/gateway/approval.js.map +1 -1
  229. package/dist/gateway/authz.d.ts +2 -0
  230. package/dist/gateway/authz.d.ts.map +1 -1
  231. package/dist/gateway/authz.js +13 -0
  232. package/dist/gateway/authz.js.map +1 -1
  233. package/dist/gateway/buttons.d.ts +3 -1
  234. package/dist/gateway/buttons.d.ts.map +1 -1
  235. package/dist/gateway/buttons.js +18 -3
  236. package/dist/gateway/buttons.js.map +1 -1
  237. package/dist/gateway/command.d.ts.map +1 -1
  238. package/dist/gateway/command.js +49 -4
  239. package/dist/gateway/command.js.map +1 -1
  240. package/dist/gateway/commands.d.ts.map +1 -1
  241. package/dist/gateway/commands.js +18 -3
  242. package/dist/gateway/commands.js.map +1 -1
  243. package/dist/gateway/config.d.ts +5 -0
  244. package/dist/gateway/config.d.ts.map +1 -1
  245. package/dist/gateway/config.js +5 -0
  246. package/dist/gateway/config.js.map +1 -1
  247. package/dist/gateway/conversations.d.ts +14 -0
  248. package/dist/gateway/conversations.d.ts.map +1 -0
  249. package/dist/gateway/conversations.js +30 -0
  250. package/dist/gateway/conversations.js.map +1 -0
  251. package/dist/gateway/download.d.ts +2 -0
  252. package/dist/gateway/download.d.ts.map +1 -0
  253. package/dist/gateway/download.js +36 -0
  254. package/dist/gateway/download.js.map +1 -0
  255. package/dist/gateway/index.d.ts.map +1 -1
  256. package/dist/gateway/index.js +85 -26
  257. package/dist/gateway/index.js.map +1 -1
  258. package/dist/gateway/mobile-commands.d.ts +24 -0
  259. package/dist/gateway/mobile-commands.d.ts.map +1 -0
  260. package/dist/gateway/mobile-commands.js +422 -0
  261. package/dist/gateway/mobile-commands.js.map +1 -0
  262. package/dist/gateway/presenter.d.ts +16 -0
  263. package/dist/gateway/presenter.d.ts.map +1 -0
  264. package/dist/gateway/presenter.js +210 -0
  265. package/dist/gateway/presenter.js.map +1 -0
  266. package/dist/gateway/router.d.ts +1 -0
  267. package/dist/gateway/router.d.ts.map +1 -1
  268. package/dist/gateway/router.js +32 -3
  269. package/dist/gateway/router.js.map +1 -1
  270. package/dist/gateway/service.d.ts +46 -0
  271. package/dist/gateway/service.d.ts.map +1 -0
  272. package/dist/gateway/service.js +395 -0
  273. package/dist/gateway/service.js.map +1 -0
  274. package/dist/gateway/setup.d.ts +4 -0
  275. package/dist/gateway/setup.d.ts.map +1 -0
  276. package/dist/gateway/setup.js +146 -0
  277. package/dist/gateway/setup.js.map +1 -0
  278. package/dist/gateway/types.d.ts +4 -2
  279. package/dist/gateway/types.d.ts.map +1 -1
  280. package/dist/gateway/types.js.map +1 -1
  281. package/dist/index.d.ts +2 -0
  282. package/dist/index.d.ts.map +1 -1
  283. package/dist/index.js +2 -0
  284. package/dist/index.js.map +1 -1
  285. package/dist/main.d.ts.map +1 -1
  286. package/dist/main.js +2 -1
  287. package/dist/main.js.map +1 -1
  288. package/dist/modes/interactive/components/assistant-message.d.ts +19 -2
  289. package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
  290. package/dist/modes/interactive/components/assistant-message.js +78 -17
  291. package/dist/modes/interactive/components/assistant-message.js.map +1 -1
  292. package/dist/modes/interactive/components/copyable-text.d.ts +27 -0
  293. package/dist/modes/interactive/components/copyable-text.d.ts.map +1 -0
  294. package/dist/modes/interactive/components/copyable-text.js +156 -0
  295. package/dist/modes/interactive/components/copyable-text.js.map +1 -0
  296. package/dist/modes/interactive/components/custom-entry.d.ts +1 -0
  297. package/dist/modes/interactive/components/custom-entry.d.ts.map +1 -1
  298. package/dist/modes/interactive/components/custom-entry.js +8 -0
  299. package/dist/modes/interactive/components/custom-entry.js.map +1 -1
  300. package/dist/modes/interactive/components/custom-message.d.ts +1 -0
  301. package/dist/modes/interactive/components/custom-message.d.ts.map +1 -1
  302. package/dist/modes/interactive/components/custom-message.js +8 -0
  303. package/dist/modes/interactive/components/custom-message.js.map +1 -1
  304. package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
  305. package/dist/modes/interactive/components/session-selector.js +16 -0
  306. package/dist/modes/interactive/components/session-selector.js.map +1 -1
  307. package/dist/modes/interactive/components/settings-selector.d.ts +8 -1
  308. package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
  309. package/dist/modes/interactive/components/settings-selector.js +51 -0
  310. package/dist/modes/interactive/components/settings-selector.js.map +1 -1
  311. package/dist/modes/interactive/components/thinking-tail.d.ts +9 -2
  312. package/dist/modes/interactive/components/thinking-tail.d.ts.map +1 -1
  313. package/dist/modes/interactive/components/thinking-tail.js +43 -1
  314. package/dist/modes/interactive/components/thinking-tail.js.map +1 -1
  315. package/dist/modes/interactive/components/tool-execution.d.ts +4 -3
  316. package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  317. package/dist/modes/interactive/components/tool-execution.js +34 -45
  318. package/dist/modes/interactive/components/tool-execution.js.map +1 -1
  319. package/dist/modes/interactive/interactive-mode.d.ts +9 -0
  320. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  321. package/dist/modes/interactive/interactive-mode.js +267 -44
  322. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  323. package/dist/modes/interactive/theme/theme.d.ts +1 -0
  324. package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
  325. package/dist/modes/interactive/theme/theme.js +23 -0
  326. package/dist/modes/interactive/theme/theme.js.map +1 -1
  327. package/dist/node-runtime/agent-session-services-GZVSOGYR.js +49 -0
  328. package/dist/node-runtime/{builtin-extensions-JCOPAAB5.js → builtin-extensions-QVCXNQT4.js} +6 -5
  329. package/dist/node-runtime/{chunk-LTYWTR3V.js → chunk-2MI5OPMN.js} +17 -2
  330. package/dist/node-runtime/{chunk-W3CVH5RX.js → chunk-2TKODGBZ.js} +11 -6
  331. package/dist/node-runtime/chunk-4EULYYR4.js +62 -0
  332. package/dist/node-runtime/{chunk-6N22HULO.js → chunk-5D7LC2ZQ.js} +7 -2
  333. package/dist/node-runtime/{chunk-KBKMCJDU.js → chunk-5ZQXRPMC.js} +19 -4
  334. package/dist/node-runtime/{chunk-BOHIDQT4.js → chunk-6VYZ5UFP.js} +1 -1
  335. package/dist/node-runtime/chunk-AZJHNQKQ.js +205 -0
  336. package/dist/node-runtime/{chunk-A3KMVBZV.js → chunk-BBUVIEZB.js} +1 -10
  337. package/dist/node-runtime/{chunk-IRPJXI6U.js → chunk-BX2RB477.js} +1 -1
  338. package/dist/node-runtime/chunk-CCCN2UCX.js +14 -0
  339. package/dist/node-runtime/{chunk-25I2BHAA.js → chunk-CSUZVNYE.js} +1 -1
  340. package/dist/node-runtime/chunk-DD5YWFSJ.js +708 -0
  341. package/dist/node-runtime/chunk-DQMGU675.js +3409 -0
  342. package/dist/node-runtime/{chunk-QZMODZQ2.js → chunk-E24EO34J.js} +2 -1
  343. package/dist/node-runtime/chunk-EKVFP6YF.js +355 -0
  344. package/dist/node-runtime/chunk-GJ2RDBRL.js +672 -0
  345. package/dist/node-runtime/{chunk-W3SILANP.js → chunk-GMHJCCEN.js} +8 -8
  346. package/dist/node-runtime/{chunk-DDWHZ633.js → chunk-GS42T6MX.js} +1 -1
  347. package/dist/node-runtime/chunk-GS66LV4M.js +2830 -0
  348. package/dist/node-runtime/chunk-H4K3JDRB.js +47 -0
  349. package/dist/node-runtime/{chunk-2SJB2AWP.js → chunk-HMBGROQK.js} +3 -3
  350. package/dist/node-runtime/{chunk-GB2MGFLI.js → chunk-HPUP7E4T.js} +216 -201
  351. package/dist/node-runtime/{chunk-YMEAYRBE.js → chunk-HTFRRDSF.js} +2 -7
  352. package/dist/node-runtime/{chunk-OPEK5RRY.js → chunk-IF24A3FH.js} +1 -1
  353. package/dist/node-runtime/chunk-IMLCWLPI.js +9 -0
  354. package/dist/node-runtime/chunk-KKUTQQV7.js +144 -0
  355. package/dist/node-runtime/chunk-LFZDVKSP.js +521 -0
  356. package/dist/node-runtime/{chunk-2BUAYZ7K.js → chunk-LLUIPGDR.js} +581 -197
  357. package/dist/node-runtime/{chunk-7NBZ5P7I.js → chunk-NAY6UUQZ.js} +1 -1
  358. package/dist/node-runtime/chunk-OAR4TYZE.js +146 -0
  359. package/dist/node-runtime/{chunk-STERBGUB.js → chunk-OFKSVRV7.js} +2 -2
  360. package/dist/node-runtime/{chunk-JZQ7F36T.js → chunk-PCEW76PM.js} +19 -3
  361. package/dist/node-runtime/{chunk-WLLDXJRT.js → chunk-QAZOULTU.js} +29 -1014
  362. package/dist/node-runtime/{chunk-6KDIOJL3.js → chunk-QH6YL7VK.js} +3 -3
  363. package/dist/node-runtime/chunk-R3K2F5GI.js +122 -0
  364. package/dist/node-runtime/{chunk-RNBHABBA.js → chunk-RDDAZOMU.js} +23 -0
  365. package/dist/node-runtime/{chunk-SY2TFMLO.js → chunk-RIR5EDDJ.js} +46 -151
  366. package/dist/node-runtime/chunk-RMQZU2YU.js +117 -0
  367. package/dist/node-runtime/{chunk-6BEIBLQ3.js → chunk-RWTKOC3B.js} +1 -1
  368. package/dist/node-runtime/{chunk-G6LRAP36.js → chunk-TQGPP4SC.js} +1 -1
  369. package/dist/node-runtime/{chunk-Y5KOEMBH.js → chunk-TVJUOJZJ.js} +9 -674
  370. package/dist/node-runtime/chunk-UAEOTO52.js +119 -0
  371. package/dist/node-runtime/{chunk-AY6CAJSL.js → chunk-UJOCPOMX.js} +6 -3
  372. package/dist/node-runtime/chunk-UP2XBVH5.js +40 -0
  373. package/dist/node-runtime/{chunk-WJVFOIB5.js → chunk-UQUCFAJ3.js} +1 -1
  374. package/dist/node-runtime/chunk-URD2SLIT.js +1019 -0
  375. package/dist/node-runtime/chunk-US544NN6.js +13 -0
  376. package/dist/node-runtime/chunk-UWPJL22I.js +341 -0
  377. package/dist/node-runtime/{chunk-4I23VTC4.js → chunk-VWCE2HSZ.js} +21 -124
  378. package/dist/node-runtime/{chunk-VZR3NCM7.js → chunk-W64JC4E7.js} +18 -14
  379. package/dist/node-runtime/{chunk-AWVD5IEY.js → chunk-X3URCYCU.js} +23 -12
  380. package/dist/node-runtime/{chunk-GKLEQ3I4.js → chunk-XLTL257W.js} +126 -27
  381. package/dist/node-runtime/{chunk-WKDK4C5P.js → chunk-YDO2F2IA.js} +38 -164
  382. package/dist/node-runtime/{chunk-PDNXVXMD.js → chunk-YHQ3NBB3.js} +58 -48
  383. package/dist/node-runtime/chunk-YPHAIRZT.js +10 -0
  384. package/dist/node-runtime/cli-runtime.js +2 -2
  385. package/dist/node-runtime/command-PDVTBRWA.js +45 -0
  386. package/dist/node-runtime/{commands-MV5KOZ64.js → commands-KAMO2T6P.js} +10 -10
  387. package/dist/node-runtime/commands-XDCFGIGW.js +36 -0
  388. package/dist/node-runtime/config-RORQUQFG.js +20 -0
  389. package/dist/node-runtime/{customize-LF5VST47.js → customize-VFJV3U6A.js} +2 -1
  390. package/dist/node-runtime/{direct-tool-executor-BK7CLEBX.js → direct-tool-executor-YAVOLDFY.js} +8 -8
  391. package/dist/node-runtime/{export-html-TEXVV5RP.js → export-html-KSOIMVPI.js} +4 -3
  392. package/dist/node-runtime/{extension-input-O4HSAEM4.js → extension-input-E7BJZ35H.js} +4 -4
  393. package/dist/node-runtime/{extension-selector-X5FCX43D.js → extension-selector-WU42XDTU.js} +4 -4
  394. package/dist/node-runtime/{extract-XLQSJN4V.js → extract-EQJE7FZZ.js} +2 -2
  395. package/dist/node-runtime/{gateway-BM6NLOH4.js → gateway-AYWM5DIO.js} +275 -994
  396. package/dist/node-runtime/{gemini-search-U7SUMPQA.js → gemini-search-35OCRFLN.js} +1 -1
  397. package/dist/node-runtime/{gemini-url-context-PXWCBQHK.js → gemini-url-context-UQY3PHHW.js} +2 -2
  398. package/dist/node-runtime/index.js +104 -65
  399. package/dist/node-runtime/{init-3C7Z24OI.js → init-X2LIUB2H.js} +3 -3
  400. package/dist/node-runtime/{install-cli-EXMJQESX.js → install-cli-3BO4MMQ6.js} +21 -82
  401. package/dist/node-runtime/interactive-mode-4MFRKAHG.js +72 -0
  402. package/dist/node-runtime/{interactive-view-ILS6TAN5.js → interactive-view-TUZHCQM3.js} +8 -8
  403. package/dist/node-runtime/lunr-browser-RYFIIVJN.js +174 -0
  404. package/dist/node-runtime/{lunr-cron-4VHP4E4B.js → lunr-cron-YWXEPZMQ.js} +19 -5
  405. package/dist/node-runtime/main.js +44 -31
  406. package/dist/node-runtime/{memory-cap-3S4XRLNP.js → memory-cap-EL3KL4JJ.js} +2 -1
  407. package/dist/node-runtime/mobile-commands-LVHDAUDP.js +32 -0
  408. package/dist/node-runtime/model-runtime-PLQKAG4B.js +16 -0
  409. package/dist/node-runtime/{model-tiers-NJLHUEGK.js → model-tiers-OU3U5CZG.js} +2 -1
  410. package/dist/node-runtime/{package-manager-cli-N37546V5.js → package-manager-cli-6GT3Z3CK.js} +22 -15
  411. package/dist/node-runtime/{pi-intercom-NV2LW6X7.js → pi-intercom-HBPK5HSJ.js} +4 -1
  412. package/dist/node-runtime/{pi-mcp-adapter-GUFZWW54.js → pi-mcp-adapter-E6WULBKF.js} +4 -4
  413. package/dist/node-runtime/{pi-subagents-6MUIFNDM.js → pi-subagents-CDWK2AKY.js} +236 -79
  414. package/dist/node-runtime/{pi-web-access-2CQGFLT2.js → pi-web-access-WTGMNZ32.js} +15 -15
  415. package/dist/node-runtime/process-registry-4FAKZQOL.js +31 -0
  416. package/dist/node-runtime/{proxy-modes-V6YVFH3C.js → proxy-modes-OSQCWRBI.js} +9 -9
  417. package/dist/node-runtime/rpc-entry.js +44 -31
  418. package/dist/node-runtime/{rpc-mode-W5ZTLTMZ.js → rpc-mode-O3XV4SID.js} +2 -2
  419. package/dist/node-runtime/runtime-4VA6JKNF.js +373 -0
  420. package/dist/node-runtime/{runtime-bridges-2VQTLPOZ.js → runtime-bridges-3XUQ46XW.js} +6 -5
  421. package/dist/node-runtime/service-ISSP6VHE.js +36 -0
  422. package/dist/node-runtime/session-handoff-HC7R5E24.js +33 -0
  423. package/dist/node-runtime/{session-manager-E7AREDTV.js → session-manager-CFN4UFM2.js} +2 -1
  424. package/dist/node-runtime/{session-selector-FJ7M2AIX.js → session-selector-GIM4DHQ2.js} +5 -4
  425. package/dist/node-runtime/{settings-manager-CUGAZWAB.js → settings-manager-6VEMXRDL.js} +7 -2
  426. package/dist/node-runtime/setup-5SR2J35A.js +155 -0
  427. package/dist/node-runtime/setup-JBKOLJ6F.js +18 -0
  428. package/dist/node-runtime/{subagent-executor-MH4A7CCF.js → subagent-executor-M5VWB3D3.js} +26 -18
  429. package/dist/node-runtime/theme-UOO5RVFN.js +68 -0
  430. package/dist/node-runtime/trust-manager-MMISNCYO.js +17 -0
  431. package/dist/node-runtime/{update-cli-XTZMZGOL.js → update-cli-UVKJWRRJ.js} +7 -2
  432. package/dist/node-runtime/usage-service-LFB2SWYV.js +37 -0
  433. package/dist/node-runtime/{video-extract-OYT5WKS5.js → video-extract-OOZHR7SU.js} +2 -2
  434. package/dist/node-runtime/{youtube-extract-TQYKGFGS.js → youtube-extract-FNPAUNHU.js} +6 -6
  435. package/docs/browser.md +86 -0
  436. package/docs/extensions.md +2 -0
  437. package/docs/features.md +96 -16
  438. package/docs/interactive-startup.md +2 -1
  439. package/docs/sessions.md +10 -0
  440. package/docs/settings.md +2 -0
  441. package/docs/tui.md +2 -0
  442. package/docs/usage.md +16 -0
  443. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  444. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  445. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  446. package/examples/extensions/gondolin/package-lock.json +2 -2
  447. package/examples/extensions/gondolin/package.json +1 -1
  448. package/examples/extensions/sandbox/package-lock.json +2 -2
  449. package/examples/extensions/sandbox/package.json +1 -1
  450. package/examples/extensions/with-deps/package-lock.json +2 -2
  451. package/examples/extensions/with-deps/package.json +1 -1
  452. package/package.json +7 -4
  453. package/scripts/install-browser.mjs +20 -0
  454. package/dist/node-runtime/agent-session-services-C743TYQE.js +0 -37
  455. package/dist/node-runtime/chunk-VGYZ3APQ.js +0 -59
  456. package/dist/node-runtime/chunk-XI77KVKA.js +0 -6009
  457. package/dist/node-runtime/command-P4NYCJ2M.js +0 -13
  458. package/dist/node-runtime/interactive-mode-EVVBA64D.js +0 -59
  459. package/dist/node-runtime/{chunk-UWQYRSYQ.js → chunk-YJMMG7C6.js} +25 -25
  460. package/dist/node-runtime/{mcp-panel-IIGMXQGP.js → mcp-panel-KTTFXJZ4.js} +3 -3
  461. package/dist/node-runtime/{src-BPQFJR76.js → src-IVPNZ2BX.js} +9 -9
@@ -1,16 +1,14 @@
1
1
  import { createRequire as __lunrRequire } from "node:module"; const require = __lunrRequire(import.meta.url);
2
- import {
3
- computeContextBreakdown
4
- } from "./chunk-G6LRAP36.js";
5
2
  import {
6
3
  checkForUpdate,
7
4
  markUpdateNotified
8
5
  } from "./chunk-KWA4OC2J.js";
9
6
  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-TQGPP4SC.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-6BEIBLQ3.js";
23
+ } from "./chunk-RWTKOC3B.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-YMEAYRBE.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-XI77KVKA.js";
47
+ setRollbackWarningHandler
48
+ } from "./chunk-DQMGU675.js";
58
49
  import {
59
- computeFileLists,
60
- createFileOps,
61
- defaultModelPerProvider,
62
- extractFileOpsFromMessage,
63
- findExactModelReferenceMatch,
64
- resolveModelScope
65
- } from "./chunk-STERBGUB.js";
50
+ notifyTodosEnabledChanged
51
+ } from "./chunk-CCCN2UCX.js";
66
52
  import {
67
53
  parseGitUrl
68
- } from "./chunk-Y5KOEMBH.js";
54
+ } from "./chunk-TVJUOJZJ.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-WKDK4C5P.js";
60
+ } from "./chunk-YDO2F2IA.js";
83
61
  import {
84
62
  DEFAULT_MAX_BYTES,
85
63
  DEFAULT_MAX_LINES,
@@ -92,38 +70,44 @@ import {
92
70
  toolGroupRole,
93
71
  toolGroupTree,
94
72
  toolStatusDot
95
- } from "./chunk-KBKMCJDU.js";
73
+ } from "./chunk-5ZQXRPMC.js";
96
74
  import {
97
- killTrackedDetachedChildren
98
- } from "./chunk-CSFI6YXL.js";
75
+ convertToPng,
76
+ processImage
77
+ } from "./chunk-AD6VXAO7.js";
78
+ import {
79
+ formatCatalogRefreshSummary,
80
+ hasGrokCliXaiAuth,
81
+ refreshModelCandidatesForInit,
82
+ stripJsonComments
83
+ } from "./chunk-GS66LV4M.js";
99
84
  import {
100
85
  HTTP_IDLE_TIMEOUT_CHOICES,
101
86
  SKILL_TAG_CHARACTERS,
102
87
  configureHttpDispatcher,
103
88
  formatHttpIdleTimeoutMs
104
- } from "./chunk-WLLDXJRT.js";
89
+ } from "./chunk-QAZOULTU.js";
105
90
  import {
106
91
  SUBAGENT_SPINNER_LABELS,
107
92
  SUBAGENT_SPINNER_NAMES
108
93
  } from "./chunk-LISUTZS3.js";
109
94
  import {
110
- SessionManager,
111
- sessionEntryToContextMessages
112
- } from "./chunk-GKLEQ3I4.js";
113
- import {
114
- createCompactionSummaryMessage
115
- } from "./chunk-FVDOXRUD.js";
116
- import {
117
- getModelTiersBridge
118
- } from "./chunk-W3CVH5RX.js";
95
+ ProjectTrustStore,
96
+ getProjectTrustOptions,
97
+ hasTrustRequiringProjectResources
98
+ } from "./chunk-HTFRRDSF.js";
119
99
  import {
120
- getAllPlanUsageResults,
121
- getUsageServiceBridge
122
- } from "./chunk-LTYWTR3V.js";
100
+ computeFileLists,
101
+ createFileOps,
102
+ defaultModelPerProvider,
103
+ extractFileOpsFromMessage,
104
+ findExactModelReferenceMatch,
105
+ resolveModelScope
106
+ } from "./chunk-OFKSVRV7.js";
123
107
  import {
124
- convertToPng,
125
- processImage
126
- } from "./chunk-AD6VXAO7.js";
108
+ SubagentEscapeSequence,
109
+ getSubagentCancellation
110
+ } from "./chunk-BBUVIEZB.js";
127
111
  import {
128
112
  AUTO_MODE_ADDENDUM,
129
113
  PLAN_MODE_ADDENDUM,
@@ -133,53 +117,87 @@ import {
133
117
  resetPermissions,
134
118
  restorePermissionModeAfterPlan,
135
119
  setPermissionMode
136
- } from "./chunk-6N22HULO.js";
120
+ } from "./chunk-5D7LC2ZQ.js";
137
121
  import {
138
122
  getGlobalInstructionsPath,
139
123
  getModelInstructionsPath
140
124
  } from "./chunk-M3LZLQW2.js";
141
125
  import {
142
- CustomEditor
143
- } from "./chunk-H2EOZYMP.js";
126
+ clearRegistry,
127
+ isWindows,
128
+ kill,
129
+ killAll,
130
+ list,
131
+ pause,
132
+ restart,
133
+ resume
134
+ } from "./chunk-KKUTQQV7.js";
144
135
  import {
145
- time
146
- } from "./chunk-PVCDKGR6.js";
136
+ killTrackedDetachedChildren
137
+ } from "./chunk-CSFI6YXL.js";
138
+ import {
139
+ cancelSessionHandoff,
140
+ markSessionHandoff,
141
+ recordTuiActivity,
142
+ registerTransferHandler,
143
+ requestSessionTransfer
144
+ } from "./chunk-AZJHNQKQ.js";
145
+ import {
146
+ SessionManager,
147
+ sessionEntryToContextMessages
148
+ } from "./chunk-XLTL257W.js";
149
+ import {
150
+ createCompactionSummaryMessage
151
+ } from "./chunk-FVDOXRUD.js";
147
152
  import {
148
153
  getCustomizeBridge
149
- } from "./chunk-VGYZ3APQ.js";
154
+ } from "./chunk-4EULYYR4.js";
150
155
  import {
151
156
  MEMORY_CHAR_CAP_DEFAULT,
152
157
  MEMORY_CHAR_CAP_MAX,
153
158
  MEMORY_CHAR_CAP_MIN
154
- } from "./chunk-AY6CAJSL.js";
159
+ } from "./chunk-UJOCPOMX.js";
160
+ import {
161
+ getModelTiersBridge
162
+ } from "./chunk-2TKODGBZ.js";
163
+ import {
164
+ getAllPlanUsageResults,
165
+ getUsageServiceBridge
166
+ } from "./chunk-2MI5OPMN.js";
167
+ import {
168
+ SessionSelectorComponent
169
+ } from "./chunk-PCEW76PM.js";
170
+ import {
171
+ CustomEditor
172
+ } from "./chunk-H2EOZYMP.js";
173
+ import {
174
+ KeybindingsManager
175
+ } from "./chunk-5EFIU3OM.js";
176
+ import {
177
+ time
178
+ } from "./chunk-PVCDKGR6.js";
155
179
  import {
156
180
  markStartupMilestone
157
181
  } from "./chunk-CCZJ3PYY.js";
158
182
  import {
159
183
  ExtensionSelectorComponent
160
- } from "./chunk-6KDIOJL3.js";
184
+ } from "./chunk-QH6YL7VK.js";
161
185
  import {
162
186
  ExtensionInputComponent
163
- } from "./chunk-2SJB2AWP.js";
187
+ } from "./chunk-HMBGROQK.js";
164
188
  import {
165
189
  CountdownTimer
166
190
  } from "./chunk-I6R76AG7.js";
167
- import {
168
- SessionSelectorComponent
169
- } from "./chunk-JZQ7F36T.js";
170
- import {
171
- KeybindingsManager
172
- } from "./chunk-5EFIU3OM.js";
173
191
  import {
174
192
  DynamicBorder
175
- } from "./chunk-BOHIDQT4.js";
193
+ } from "./chunk-6VYZ5UFP.js";
176
194
  import {
177
195
  formatKeyText,
178
196
  keyDisplayText,
179
197
  keyHint,
180
198
  keyText,
181
199
  rawKeyHint
182
- } from "./chunk-DDWHZ633.js";
200
+ } from "./chunk-GS42T6MX.js";
183
201
  import {
184
202
  FS_WATCH_RETRY_DELAY_MS,
185
203
  Theme,
@@ -205,7 +223,7 @@ import {
205
223
  stopThemeWatcher,
206
224
  theme,
207
225
  watchWithErrorHandler
208
- } from "./chunk-RNBHABBA.js";
226
+ } from "./chunk-RDDAZOMU.js";
209
227
  import {
210
228
  APP_NAME,
211
229
  APP_TITLE,
@@ -227,7 +245,7 @@ import * as fs2 from "node:fs";
227
245
  import * as os2 from "node:os";
228
246
  import * as path2 from "node:path";
229
247
  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";
248
+ 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
249
  import chalk from "chalk";
232
250
  import { spawn as spawn3, spawnSync } from "child_process";
233
251
 
@@ -719,6 +737,8 @@ var BUILTIN_SLASH_COMMANDS = [
719
737
  { name: "new", description: "Start a new session" },
720
738
  { name: "init", description: "Generate a starter AGENTS.md for this project" },
721
739
  { name: "compact", description: "Manually compact the session context" },
740
+ { name: "handoff", description: "Mark this saved session for phone continuation for 8 hours, or cancel" },
741
+ { name: "reclaim", description: "Reclaim this session after its remote owner releases it" },
722
742
  { name: "resume", description: "Resume a different session" },
723
743
  { name: "sessions", description: "Browse and resume sessions" },
724
744
  { name: "reload", description: "Reload keybindings, extensions, skills, prompts, themes, and context files" },
@@ -1097,6 +1117,114 @@ var ArminComponent = class {
1097
1117
  // packages/coding-agent/dist/modes/interactive/components/assistant-message.js
1098
1118
  import { Container, Markdown as Markdown2, Spacer, Text } from "@ashx-j/lunr-tui";
1099
1119
 
1120
+ // packages/coding-agent/dist/modes/interactive/components/copyable-text.js
1121
+ import { truncateToWidth, visibleWidth, wrapTextWithAnsi } from "@ashx-j/lunr-tui";
1122
+ function sourceLines(source) {
1123
+ let lines = [], pattern = /([^\r\n]*)(\r\n|\r|\n|$)/g;
1124
+ for (let match of source.matchAll(pattern)) {
1125
+ let start = match.index, text = match[1], newline = match[2];
1126
+ if (lines.push({ start, end: start + text.length + newline.length, text }), !newline)
1127
+ break;
1128
+ }
1129
+ return lines;
1130
+ }
1131
+ function parseFenceOpening(line) {
1132
+ let match = /^( {0,3})(`{3,}|~{3,})(.*)$/.exec(line);
1133
+ if (!match)
1134
+ return;
1135
+ let fence = match[2], info = match[3];
1136
+ if (!(fence[0] === "`" && info.includes("`")))
1137
+ return {
1138
+ marker: fence[0],
1139
+ length: fence.length,
1140
+ copyable: info.trim() === "lunr-copy"
1141
+ };
1142
+ }
1143
+ function isFenceClosing(line, opening) {
1144
+ let match = /^( {0,3})(`+|~+)[ \t]*$/.exec(line);
1145
+ if (!match)
1146
+ return !1;
1147
+ let fence = match[2];
1148
+ return fence[0] === opening.marker && fence.length >= opening.length;
1149
+ }
1150
+ function payloadEndBeforeClosing(source, closingStart) {
1151
+ return closingStart >= 2 && source.slice(closingStart - 2, closingStart) === `\r
1152
+ ` ? closingStart - 2 : closingStart >= 1 && (source[closingStart - 1] === `
1153
+ ` || source[closingStart - 1] === "\r") ? closingStart - 1 : closingStart;
1154
+ }
1155
+ function parseCopyableTextSegments(source) {
1156
+ let lines = sourceLines(source), segments = [], emittedThrough = 0, lineIndex = 0;
1157
+ for (; lineIndex < lines.length; ) {
1158
+ let openingLine = lines[lineIndex], opening = parseFenceOpening(openingLine.text);
1159
+ if (!opening) {
1160
+ lineIndex++;
1161
+ continue;
1162
+ }
1163
+ let closingIndex = -1;
1164
+ for (let i = lineIndex + 1; i < lines.length; i++)
1165
+ if (isFenceClosing(lines[i].text, opening)) {
1166
+ closingIndex = i;
1167
+ break;
1168
+ }
1169
+ if (!opening.copyable) {
1170
+ if (closingIndex < 0)
1171
+ break;
1172
+ lineIndex = closingIndex + 1;
1173
+ continue;
1174
+ }
1175
+ openingLine.start > emittedThrough && segments.push({ type: "markdown", text: source.slice(emittedThrough, openingLine.start) });
1176
+ let payloadStart = openingLine.end;
1177
+ if (closingIndex < 0)
1178
+ return segments.push({
1179
+ type: "copyable",
1180
+ payload: source.slice(payloadStart),
1181
+ complete: !1,
1182
+ start: openingLine.start
1183
+ }), segments;
1184
+ let closingLine = lines[closingIndex];
1185
+ segments.push({
1186
+ type: "copyable",
1187
+ payload: source.slice(payloadStart, payloadEndBeforeClosing(source, closingLine.start)),
1188
+ complete: !0,
1189
+ start: openingLine.start
1190
+ }), emittedThrough = closingLine.end, lineIndex = closingIndex + 1;
1191
+ }
1192
+ return emittedThrough < source.length && segments.push({ type: "markdown", text: source.slice(emittedThrough) }), segments;
1193
+ }
1194
+ var CopyableTextBlockComponent = class {
1195
+ renderedRows = 0;
1196
+ payload;
1197
+ complete;
1198
+ outputPad;
1199
+ status;
1200
+ onCopy;
1201
+ constructor(payload, complete, outputPad, status, onCopy) {
1202
+ this.payload = payload, this.complete = complete, this.outputPad = outputPad, this.status = status, this.onCopy = onCopy;
1203
+ }
1204
+ invalidate() {
1205
+ this.renderedRows = 0;
1206
+ }
1207
+ render(width) {
1208
+ if (width <= 0)
1209
+ return this.renderedRows = 0, [];
1210
+ let horizontalPad = Math.min(this.outputPad, Math.max(0, width - 1)), pad = " ".repeat(horizontalPad), contentWidth = Math.max(1, width - horizontalPad * 2), paint = (content) => {
1211
+ let line = truncateToWidth(`${pad}${content}`, width, "");
1212
+ return theme.bg("userMessageBg", `${line}${" ".repeat(Math.max(0, width - visibleWidth(line)))}`);
1213
+ }, lines = [paint("")], payloadLines = this.payload.replace(/\t/g, " ").split(`
1214
+ `);
1215
+ for (let payloadLine of payloadLines)
1216
+ for (let wrappedLine of wrapTextWithAnsi(payloadLine, contentWidth))
1217
+ lines.push(paint(theme.fg("userMessageText", wrappedLine)));
1218
+ if (typeof this.status == "object")
1219
+ for (let wrappedLine of wrapTextWithAnsi(`Copy failed: ${this.status.error}`, contentWidth))
1220
+ lines.push(paint(theme.fg("error", wrappedLine)));
1221
+ return lines.push(paint("")), this.renderedRows = lines.length, lines;
1222
+ }
1223
+ handleClick(localY, width, localX) {
1224
+ 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);
1225
+ }
1226
+ };
1227
+
1100
1228
  // packages/coding-agent/dist/modes/interactive/components/thinking-summary.js
1101
1229
  var LEADING_MARKDOWN_RE = /^[#*`>\-\s]+/;
1102
1230
  function thinkingSnippet(joinedThinking, maxLen = 120) {
@@ -1143,7 +1271,7 @@ function isThinkingRunComplete(_hasFollowingBlock, timing, timingsAttached) {
1143
1271
  }
1144
1272
 
1145
1273
  // packages/coding-agent/dist/modes/interactive/components/thinking-tail.js
1146
- import { Markdown } from "@ashx-j/lunr-tui";
1274
+ import { Markdown, truncateToWidth as truncateToWidth2, visibleWidth as visibleWidth2 } from "@ashx-j/lunr-tui";
1147
1275
  var THINKING_TAIL_LINES = 4, ThinkingTailComponent = class {
1148
1276
  markdown;
1149
1277
  maxLines;
@@ -1157,6 +1285,28 @@ var THINKING_TAIL_LINES = 4, ThinkingTailComponent = class {
1157
1285
  let lines = this.markdown.render(width);
1158
1286
  return lines.length <= this.maxLines ? lines : lines.slice(-this.maxLines);
1159
1287
  }
1288
+ }, shimmerSegmenter = new Intl.Segmenter(void 0, { granularity: "grapheme" }), SHIMMER_PERIOD_MS = 2800, ThinkingLineComponent = class extends ThinkingTailComponent {
1289
+ startedAt;
1290
+ palette = theme.getFgGradient("thinkingText", "white", 32);
1291
+ constructor(text, paddingX, markdownTheme, startedAt) {
1292
+ super(text, paddingX, 0, markdownTheme), this.startedAt = startedAt;
1293
+ }
1294
+ invalidate() {
1295
+ super.invalidate(), this.palette = theme.getFgGradient("thinkingText", "white", 32);
1296
+ }
1297
+ render(width) {
1298
+ if (width <= 0)
1299
+ return ["", "", ""];
1300
+ let lines = this.markdown.render(width), latest = "";
1301
+ for (let index = lines.length - 1; index >= 0 && (latest = stripAnsi(lines[index]).trimEnd(), !latest.trim()); index--)
1302
+ ;
1303
+ 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 = "";
1304
+ for (let { segment } of shimmerSegmenter.segment(text)) {
1305
+ let cells = visibleWidth2(segment), distance = Math.abs(column + cells / 2 - center) / band, intensity = distance >= 1 ? 0 : (1 + Math.cos(Math.PI * distance)) / 2;
1306
+ highlighted += this.palette[Math.round(intensity * (this.palette.length - 1))] + segment, column += cells;
1307
+ }
1308
+ return ["", `\x1B[3m${highlighted}\x1B[23m\x1B[39m`, ""];
1309
+ }
1160
1310
  };
1161
1311
 
1162
1312
  // packages/coding-agent/dist/modes/interactive/components/assistant-message.js
@@ -1181,12 +1331,23 @@ var OSC133_ZONE_START = "\x1B]133;A\x07", OSC133_ZONE_END = "\x1B]133;B\x07", OS
1181
1331
  lastMessage;
1182
1332
  thinkingSource;
1183
1333
  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);
1334
+ copyText;
1335
+ requestRender;
1336
+ copyStates = /* @__PURE__ */ new Map();
1337
+ reasoningDisplay;
1338
+ onThinkingAnimationChange;
1339
+ thinkingAnimationStart = performance.now();
1340
+ thinkingAnimationActive = !1;
1341
+ constructor(message, hideThinkingBlock = !1, markdownTheme = getMarkdownTheme(), hiddenThinkingLabel = "Thinking...", outputPad = 1, thinkingCollapse = !1, options = {}) {
1342
+ 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 ?? (() => {
1343
+ }), this.reasoningDisplay = options.reasoningDisplay ?? "auto", this.onThinkingAnimationChange = options.onThinkingAnimationChange, this.contentContainer = new Container(), this.addChild(this.contentContainer), message && this.updateContent(message);
1186
1344
  }
1187
1345
  invalidate() {
1188
1346
  super.invalidate(), this.lastMessage && this.updateContent(this.lastMessage, this.thinkingSourceOptions());
1189
1347
  }
1348
+ setReasoningDisplay(display) {
1349
+ this.reasoningDisplay = display, this.lastMessage && this.updateContent(this.lastMessage, this.thinkingSourceOptions());
1350
+ }
1190
1351
  setHideThinkingBlock(hide) {
1191
1352
  this.hideThinkingBlock = hide, this.lastMessage && this.updateContent(this.lastMessage, this.thinkingSourceOptions());
1192
1353
  }
@@ -1210,12 +1371,12 @@ var OSC133_ZONE_START = "\x1B]133;A\x07", OSC133_ZONE_END = "\x1B]133;B\x07", OS
1210
1371
  } else this.expandedRuns.has(runIndex) ? this.expandedRuns.delete(runIndex) : this.expandedRuns.add(runIndex);
1211
1372
  this.lastMessage && this.updateContent(this.lastMessage, this.thinkingSourceOptions());
1212
1373
  }
1213
- handleClick(localY, width) {
1374
+ handleClick(localY, width, localX) {
1214
1375
  let contentWidth = width, y = 0;
1215
1376
  for (let child of this.contentContainer.children) {
1216
1377
  let h = child.render(contentWidth).length;
1217
1378
  if (localY >= y && localY < y + h)
1218
- return typeof child.handleClick == "function" ? child.handleClick(localY - y, contentWidth) : !1;
1379
+ return typeof child.handleClick == "function" ? child.handleClick(localY - y, contentWidth, localX) : !1;
1219
1380
  y += h;
1220
1381
  }
1221
1382
  return !1;
@@ -1237,18 +1398,28 @@ var OSC133_ZONE_START = "\x1B]133;A\x07", OSC133_ZONE_END = "\x1B]133;B\x07", OS
1237
1398
  return this.thinkingSource ? { thinkingSource: this.thinkingSource } : void 0;
1238
1399
  }
1239
1400
  updateContent(message, options) {
1240
- this.lastMessage = message, this.thinkingSource = options?.thinkingSource, this.contentContainer.clear();
1401
+ this.lastMessage = message, this.thinkingSource = options?.thinkingSource, this.thinkingAnimationActive = !1, this.contentContainer.clear();
1241
1402
  let sourceMessage = this.thinkingSource ?? message, sourceThinkingRuns = collectThinkingRuns(sourceMessage.content);
1242
1403
  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
1404
  let isFirstTextBlock = !0, thinkingRunIndex = -1;
1244
1405
  for (let i = 0; i < message.content.length; i++) {
1245
1406
  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") {
1407
+ if (content.type === "text" && content.text.trim())
1408
+ for (let segment of parseCopyableTextSegments(content.text)) {
1409
+ if (segment.type === "markdown") {
1410
+ let trimmed = segment.text.trim();
1411
+ if (!trimmed)
1412
+ continue;
1413
+ let text = isFirstTextBlock ? `\u25CF ${trimmed}` : trimmed;
1414
+ isFirstTextBlock = !1, this.contentContainer.addChild(new Markdown2(text, this.outputPad, 0, this.markdownTheme, {
1415
+ color: (body) => theme.fg("userMessageText", body)
1416
+ }));
1417
+ continue;
1418
+ }
1419
+ let key = `${i}:${segment.start}`, copyState = this.copyStates.get(key), status = copyState?.payload === segment.payload ? copyState.status : "idle";
1420
+ 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)));
1421
+ }
1422
+ else if (content.type === "thinking") {
1252
1423
  thinkingRunIndex++;
1253
1424
  let displayBlocks = [];
1254
1425
  for (; i < message.content.length; i++) {
@@ -1276,6 +1447,18 @@ var OSC133_ZONE_START = "\x1B]133;A\x07", OSC133_ZONE_END = "\x1B]133;B\x07", OS
1276
1447
  this.contentContainer.addChild(new Spacer(1)), this.contentContainer.addChild(new Text(theme.fg("error", `Error: ${errorMsg}`), this.outputPad, 0));
1277
1448
  }
1278
1449
  }
1450
+ this.onThinkingAnimationChange?.(this.thinkingAnimationActive);
1451
+ }
1452
+ copyPayload(key, payload) {
1453
+ this.copyStates.get(key)?.status !== "copying" && (this.copyStates.set(key, { payload, status: "copying" }), this.refreshCopyStatus(), Promise.resolve().then(() => this.copyText(payload)).then(() => {
1454
+ this.copyStates.set(key, { payload, status: "copied" }), this.refreshCopyStatus();
1455
+ }).catch((error) => {
1456
+ let message = (error instanceof Error ? error.message : String(error)).replace(/\s+/g, " ").trim();
1457
+ this.copyStates.set(key, { payload, status: { error: message || "Unknown error" } }), this.refreshCopyStatus();
1458
+ }));
1459
+ }
1460
+ refreshCopyStatus() {
1461
+ this.lastMessage && this.updateContent(this.lastMessage, this.thinkingSourceOptions()), this.requestRender();
1279
1462
  }
1280
1463
  renderThinkingRun(thinkingRunIndex, thinkingBlocks, displayMessage, displayIndex, fullyRevealed) {
1281
1464
  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 +1467,19 @@ var OSC133_ZONE_START = "\x1B]133;A\x07", OSC133_ZONE_END = "\x1B]133;B\x07", OS
1284
1467
  if (this.thinkingCollapse && !this.isRunExpanded(thinkingRunIndex) && runComplete) {
1285
1468
  let timing = this.thinkingTimings?.[thinkingRunIndex], label = timing?.end !== void 0 ? `\u273B Thought for ${formatThoughtDuration(timing.end - timing.start)}` : "\u273B Thought", block = new Container();
1286
1469
  block.addChild(new Text(theme.fg("thinkingText", theme.italic(label)), this.outputPad, 0));
1287
- let snippet = thinkingSnippet(thinkingBlocks.join(`
1470
+ let joinedThinking = thinkingBlocks.join(`
1288
1471
 
1289
- `));
1472
+ `), snippet = thinkingSnippet(displayMessage.provider === "openai-codex" ? joinedThinking.replaceAll("**", "") : joinedThinking);
1290
1473
  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
1474
  return;
1292
1475
  }
1293
1476
  if (!runComplete && !this.isRunExpanded(thinkingRunIndex)) {
1477
+ if (this.reasoningDisplay === "one-line" || this.reasoningDisplay === "auto" && displayMessage.provider === "openai-codex") {
1478
+ this.thinkingAnimationActive = !0, this.contentContainer.children.length === 1 && this.contentContainer.children[0] instanceof Spacer && this.contentContainer.clear(), wrap(new ThinkingLineComponent(thinkingBlocks.join(`
1479
+
1480
+ `), this.outputPad, this.markdownTheme, this.thinkingAnimationStart));
1481
+ return;
1482
+ }
1294
1483
  wrap(new ThinkingTailComponent(thinkingBlocks.join(`
1295
1484
 
1296
1485
  `), this.outputPad, 0, this.markdownTheme, {
@@ -1509,7 +1698,7 @@ var CompactionSummaryMessageComponent = class extends Box2 {
1509
1698
 
1510
1699
  // packages/coding-agent/dist/modes/interactive/components/footer.js
1511
1700
  import { isAbsolute, relative, resolve as resolve2, sep } from "node:path";
1512
- import { truncateToWidth, visibleWidth } from "@ashx-j/lunr-tui";
1701
+ import { truncateToWidth as truncateToWidth3, visibleWidth as visibleWidth3 } from "@ashx-j/lunr-tui";
1513
1702
  function sanitizeStatusText(text) {
1514
1703
  return text.replace(/[\r\n\t]/g, " ").replace(/ +/g, " ").trim();
1515
1704
  }
@@ -1568,38 +1757,38 @@ var FooterComponent = class {
1568
1757
  }
1569
1758
  let contextPercentStr, autoIndicator = this.autoCompactEnabled ? " (auto)" : "", contextPercentDisplay = contextPercent === "?" ? `?/${formatTokens(contextWindow)}${autoIndicator}` : `${contextPercent}%/${formatTokens(contextWindow)}${autoIndicator}`;
1570
1759
  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));
1760
+ let statsLeft = statsParts.join(" "), modelName = state.model?.id || "no-model", statsLeftWidth = visibleWidth3(statsLeft);
1761
+ statsLeftWidth > width && (statsLeft = truncateToWidth3(statsLeft, width, "..."), statsLeftWidth = visibleWidth3(statsLeft));
1573
1762
  let minPadding = 2, rightSideWithoutProvider = modelName;
1574
1763
  if (state.model?.reasoning) {
1575
1764
  let thinkingLevel = state.thinkingLevel || "off";
1576
1765
  rightSideWithoutProvider = thinkingLevel === "off" ? `${modelName} \u2022 thinking off` : `${modelName} \u2022 ${thinkingLevel}`;
1577
1766
  }
1578
1767
  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;
1768
+ this.footerData.getAvailableProviderCount() > 1 && state.model && (rightSide = `(${state.model.provider}) ${rightSideWithoutProvider}`, statsLeftWidth + minPadding + visibleWidth3(rightSide) > width && (rightSide = rightSideWithoutProvider));
1769
+ let rightSideWidth = visibleWidth3(rightSide), totalNeeded = statsLeftWidth + minPadding + rightSideWidth, statsLine;
1581
1770
  if (totalNeeded <= width) {
1582
1771
  let padding = " ".repeat(width - statsLeftWidth - rightSideWidth);
1583
1772
  statsLine = statsLeft + padding + rightSide;
1584
1773
  } else {
1585
1774
  let availableForRight = width - statsLeftWidth - minPadding;
1586
1775
  if (availableForRight > 0) {
1587
- let truncatedRight = truncateToWidth(rightSide, availableForRight, ""), truncatedRightWidth = visibleWidth(truncatedRight), padding = " ".repeat(Math.max(0, width - statsLeftWidth - truncatedRightWidth));
1776
+ let truncatedRight = truncateToWidth3(rightSide, availableForRight, ""), truncatedRightWidth = visibleWidth3(truncatedRight), padding = " ".repeat(Math.max(0, width - statsLeftWidth - truncatedRightWidth));
1588
1777
  statsLine = statsLeft + padding + truncatedRight;
1589
1778
  } else
1590
1779
  statsLine = statsLeft;
1591
1780
  }
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();
1781
+ 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
1782
  if (extensionStatuses.size > 0) {
1594
1783
  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", "...")));
1784
+ lines.push(truncateToWidth3(statusLine, width, theme.fg("dim", "...")));
1596
1785
  }
1597
1786
  return lines;
1598
1787
  }
1599
1788
  };
1600
1789
 
1601
1790
  // packages/coding-agent/dist/modes/interactive/components/usage-view.js
1602
- import { truncateToWidth as truncateToWidth2, visibleWidth as visibleWidth2 } from "@ashx-j/lunr-tui";
1791
+ import { truncateToWidth as truncateToWidth4, visibleWidth as visibleWidth4 } from "@ashx-j/lunr-tui";
1603
1792
  var BAR_CELLS = 20;
1604
1793
  function usageLevelColor(percent) {
1605
1794
  return percent > 90 ? "error" : percent > 70 ? "warning" : "success";
@@ -1637,9 +1826,9 @@ function planWindowLine(window, labelWidth) {
1637
1826
  return ` ${window.label.padEnd(labelWidth)} ${usageBar(window.usedPercent)} ${pct}${reset}`;
1638
1827
  }
1639
1828
  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];
1829
+ 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
1830
  for (let rawLine of content) {
1642
- let line = rawLine.length > 0 ? truncateToWidth2(rawLine, innerWidth, "") : "", padding = " ".repeat(Math.max(0, innerWidth - visibleWidth2(line)));
1831
+ let line = rawLine.length > 0 ? truncateToWidth4(rawLine, innerWidth, "") : "", padding = " ".repeat(Math.max(0, innerWidth - visibleWidth4(line)));
1643
1832
  lines.push(`${border("\u2502 ")}${line}${padding}${border(" \u2502")}`);
1644
1833
  }
1645
1834
  return lines.push(bottom), lines;
@@ -1731,6 +1920,9 @@ var CustomEntryComponent = class extends Container4 {
1731
1920
  setExpanded(expanded) {
1732
1921
  this._expanded !== expanded && (this._expanded = expanded, this.rebuild());
1733
1922
  }
1923
+ handleClick(localY, width) {
1924
+ return super.handleClick(localY, width) ? !0 : !this.customComponent || localY < 1 ? !1 : (this.setExpanded(!this._expanded), !0);
1925
+ }
1734
1926
  invalidate() {
1735
1927
  super.invalidate(), this.rebuild();
1736
1928
  }
@@ -1762,6 +1954,9 @@ var CustomMessageComponent = class extends Container5 {
1762
1954
  setExpanded(expanded) {
1763
1955
  this._expanded !== expanded && (this._expanded = expanded, this.rebuild());
1764
1956
  }
1957
+ handleClick(localY, width) {
1958
+ return super.handleClick(localY, width) ? !0 : !this.customRenderer || !this.customComponent || localY < 1 ? !1 : (this.setExpanded(!this._expanded), !0);
1959
+ }
1765
1960
  invalidate() {
1766
1961
  super.invalidate(), this.rebuild();
1767
1962
  }
@@ -2410,7 +2605,7 @@ var PlanMessageComponent = class extends Container10 {
2410
2605
  };
2411
2606
 
2412
2607
  // 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";
2608
+ import { Container as Container11, getKeybindings as getKeybindings5, Spacer as Spacer12, Text as Text13, truncateToWidth as truncateToWidth5 } from "@ashx-j/lunr-tui";
2414
2609
  function formatElapsed(startedAt) {
2415
2610
  let ms = Date.now() - startedAt, s = Math.floor(ms / 1e3);
2416
2611
  if (s < 60)
@@ -2447,7 +2642,7 @@ var ProcessesSelectorComponent = class extends Container11 {
2447
2642
  continue;
2448
2643
  let elapsed = formatElapsed(p.startedAt), status;
2449
2644
  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);
2645
+ 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
2646
  this.addChild(new Text13(colored, 0, 0));
2452
2647
  }
2453
2648
  this.addChild(new Spacer12(1));
@@ -3422,6 +3617,14 @@ var ThemeSubmenu = class extends Container13 {
3422
3617
  values: ["true", "false"],
3423
3618
  disabled: () => config.hideThinkingBlock
3424
3619
  },
3620
+ {
3621
+ id: "reasoning-display",
3622
+ label: "Reasoning display",
3623
+ description: "Auto uses one line for OpenAI Codex, four lines for other models. One line has a soft moving highlight.",
3624
+ currentValue: config.reasoningDisplay ?? "auto",
3625
+ values: ["auto", "one-line", "four-lines"],
3626
+ disabled: () => config.hideThinkingBlock
3627
+ },
3425
3628
  {
3426
3629
  id: "cache-miss-notices",
3427
3630
  label: "Cache miss notices",
@@ -3452,6 +3655,13 @@ var ThemeSubmenu = class extends Container13 {
3452
3655
  currentValue: config.smoothStreaming ? "true" : "false",
3453
3656
  values: ["true", "false"]
3454
3657
  },
3658
+ {
3659
+ id: "browser-enabled",
3660
+ label: "Browser",
3661
+ description: "Browse JavaScript pages and interact with websites. Off closes the browser and hides its tool.",
3662
+ currentValue: config.browserEnabled ? "on" : "off",
3663
+ values: ["on", "off"]
3664
+ },
3455
3665
  {
3456
3666
  id: "agent-memory",
3457
3667
  label: "Agent memory",
@@ -3459,6 +3669,13 @@ var ThemeSubmenu = class extends Container13 {
3459
3669
  currentValue: config.memoryEnabled ? "on" : "off",
3460
3670
  values: ["on", "off"]
3461
3671
  },
3672
+ {
3673
+ id: "todos",
3674
+ label: "Todos",
3675
+ description: "Agent task list and todo tool",
3676
+ currentValue: config.todosEnabled ? "on" : "off",
3677
+ values: ["on", "off"]
3678
+ },
3462
3679
  {
3463
3680
  id: "memory-char-cap",
3464
3681
  label: "Memory character cap",
@@ -3487,6 +3704,23 @@ var ThemeSubmenu = class extends Container13 {
3487
3704
  currentValue: DEFAULT_PROJECT_TRUST_LABELS[config.defaultProjectTrust],
3488
3705
  values: Object.values(DEFAULT_PROJECT_TRUST_LABELS)
3489
3706
  },
3707
+ {
3708
+ id: "gateway",
3709
+ label: "Gateway",
3710
+ description: "Phone access and automatic startup",
3711
+ currentValue: "manage",
3712
+ submenu: (_value, done) => new SelectSubmenu("Gateway", "Boot startup may require administrator permission. Setup manages bot accounts and approved folders.", [
3713
+ { value: "setup", label: "Set up Telegram or Discord" },
3714
+ { value: "status", label: "Show gateway status" },
3715
+ { value: "start", label: "Start gateway" },
3716
+ { value: "stop", label: "Stop gateway" },
3717
+ { value: "autostart login", label: "Start automatically at login" },
3718
+ { value: "autostart boot", label: "Start automatically at boot" },
3719
+ { value: "autostart off", label: "Disable automatic startup" }
3720
+ ], "", (action) => {
3721
+ done(), callbacks.onGatewayAction?.(action);
3722
+ }, () => done())
3723
+ },
3490
3724
  {
3491
3725
  id: "default-permission-mode",
3492
3726
  label: "Default permission mode",
@@ -3720,6 +3954,9 @@ var ThemeSubmenu = class extends Container13 {
3720
3954
  case "thinking-collapse":
3721
3955
  callbacks.onThinkingCollapseChange(newValue === "true");
3722
3956
  break;
3957
+ case "reasoning-display":
3958
+ (newValue === "auto" || newValue === "one-line" || newValue === "four-lines") && callbacks.onReasoningDisplayChange(newValue);
3959
+ break;
3723
3960
  case "cache-miss-notices":
3724
3961
  callbacks.onShowCacheMissNoticesChange(newValue === "true");
3725
3962
  break;
@@ -3738,9 +3975,15 @@ var ThemeSubmenu = class extends Container13 {
3738
3975
  case "memory-char-cap":
3739
3976
  callbacks.onMemoryCharCapChange(parseInt(newValue, 10));
3740
3977
  break;
3978
+ case "browser-enabled":
3979
+ callbacks.onBrowserEnabledChange(newValue === "on");
3980
+ break;
3741
3981
  case "agent-memory":
3742
3982
  callbacks.onMemoryEnabledChange(newValue === "on");
3743
3983
  break;
3984
+ case "todos":
3985
+ callbacks.onTodosEnabledChange(newValue === "on");
3986
+ break;
3744
3987
  case "search-curator":
3745
3988
  callbacks.onSearchCuratorChange(newValue);
3746
3989
  break;
@@ -3905,7 +4148,6 @@ var ToolExecutionComponent = class extends Container14 {
3905
4148
  hideComponent = !1;
3906
4149
  groupContinuation = !1;
3907
4150
  groupFollowed = !1;
3908
- groupPrev;
3909
4151
  groupNext;
3910
4152
  constructor(toolName, toolCallId, args, options = {}, toolDefinition, ui, cwd) {
3911
4153
  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();
@@ -3990,16 +4232,30 @@ var ToolExecutionComponent = class extends Container14 {
3990
4232
  }
3991
4233
  }
3992
4234
  setExpanded(expanded) {
3993
- this.expanded = expanded, this.updateDisplay(), this.refreshGroupTail();
4235
+ this.toolName !== "browser" && (this.expanded = expanded, this.updateDisplay(), this.refreshGroupTail());
3994
4236
  }
3995
4237
  handleClick(_localY, _width) {
3996
- return this.isPartial || this.toolName === "subagent" || this.toolName === "subagent_wait" ? !1 : (this.setExpanded(!this.expanded), this.ui.requestRender(), !0);
4238
+ return this.isPartial || this.toolName === "browser" || this.toolName === "subagent" || this.toolName === "subagent_wait" ? !1 : (this.setExpanded(!this.expanded), this.ui.requestRender(), !0);
4239
+ }
4240
+ beginNextExecution(toolCallId, args) {
4241
+ 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();
4242
+ }
4243
+ dispose() {
4244
+ let components = /* @__PURE__ */ new Set([this.callRendererComponent, this.resultRendererComponent]);
4245
+ for (let component of components)
4246
+ this.disposeComponent(component);
4247
+ }
4248
+ disposeComponent(component) {
4249
+ component?.dispose?.();
3997
4250
  }
3998
4251
  // lunr: consecutive same-tool grouping — exposes the tool name so the caller
3999
4252
  // can detect adjacency.
4000
4253
  getToolName() {
4001
4254
  return this.toolName;
4002
4255
  }
4256
+ matchesToolCall(toolCallId) {
4257
+ return this.toolCallId === toolCallId;
4258
+ }
4003
4259
  // lunr: consecutive same-tool grouping — continuation calls hide the top
4004
4260
  // spacer and top box pad so adjacent same-bg boxes read as one continuous
4005
4261
  // background; the last card in a run keeps its bottom pad.
@@ -4011,41 +4267,22 @@ var ToolExecutionComponent = class extends Container14 {
4011
4267
  setGroupFollowed(on) {
4012
4268
  this.groupFollowed = on, this.applyGroupPadding(), this.invalidate();
4013
4269
  }
4014
- // lunr: same-name run link so a later card can hoist earlier error bodies
4015
- // under the last leaf instead of splitting the tree.
4270
+ // lunr: same-name run link keeps the final card refreshed as earlier calls settle.
4016
4271
  linkGroupNext(next) {
4017
- this.groupNext = next, next.groupPrev = this;
4272
+ this.groupNext = next;
4018
4273
  }
4019
4274
  applyGroupPadding() {
4020
4275
  let top = this.groupContinuation ? 0 : 1, bottom = this.groupFollowed ? 0 : 1;
4021
4276
  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));
4022
4277
  }
4023
- shouldHideGroupedErrorBody() {
4024
- return !!this.result?.isError && this.groupFollowed && !this.expanded && !this.isPartial && this.getRenderShell() === "default" && this.toolName !== "subagent" && this.toolName !== "subagent_wait";
4025
- }
4026
4278
  shouldSkipCompactResult() {
4027
4279
  if (this.result === void 0 || this.isPartial || this.expanded)
4028
4280
  return !1;
4029
4281
  if (this.toolName === "subagent") {
4030
4282
  let details = this.result.details;
4031
- return !(this.result.isError || Array.isArray(details?.results) && details.results.length > 0 || details?.mode === "management");
4032
- }
4033
- return this.result.isError ? this.shouldHideGroupedErrorBody() : this.getRenderShell() === "default";
4034
- }
4035
- formatHoistedGroupErrors() {
4036
- if (this.groupFollowed || this.expanded)
4037
- return;
4038
- let texts = [], prev = this.groupPrev;
4039
- for (; prev; ) {
4040
- if (prev.shouldHideGroupedErrorBody()) {
4041
- let output = prev.getTextOutput().trim();
4042
- output && texts.unshift(output);
4043
- }
4044
- prev = prev.groupPrev;
4283
+ return !this.result.isError && this.args?.action === "steer" ? !0 : !(this.result.isError || Array.isArray(details?.results) && details.results.length > 0 || details?.mode === "management");
4045
4284
  }
4046
- return texts.length > 0 ? `
4047
- ${texts.join(`
4048
- `)}` : void 0;
4285
+ return this.toolName === "subagent_wait" ? !1 : this.result.isError ? !0 : this.getRenderShell() === "default";
4049
4286
  }
4050
4287
  refreshGroupTail() {
4051
4288
  let next = this.groupNext;
@@ -4113,8 +4350,6 @@ ${texts.join(`
4113
4350
  let component = this.createResultFallback();
4114
4351
  component && (renderContainer.addChild(component), hasContent = !0);
4115
4352
  }
4116
- let hoisted = this.formatHoistedGroupErrors();
4117
- hoisted && (renderContainer.addChild(new Text17(theme.fg("toolOutput", hoisted), 0, 0)), hasContent = !0);
4118
4353
  }
4119
4354
  } else
4120
4355
  this.contentText.setCustomBgFn(bgFn), this.contentText.setText(this.formatToolExecution()), hasContent = !0;
@@ -4144,7 +4379,7 @@ ${texts.join(`
4144
4379
  return getTextOutput(this.result, this.showImages);
4145
4380
  }
4146
4381
  formatToolExecution() {
4147
- let hideGroupedErrorBody = !!(this.result?.isError && this.groupFollowed && !this.expanded), compact = !this.isPartial && !this.expanded && (!this.result?.isError || hideGroupedErrorBody), text = formatGroupedCall({
4382
+ let compact = !this.isPartial && !this.expanded, text = formatGroupedCall({
4148
4383
  role: toolGroupRole(this.groupContinuation, this.groupFollowed),
4149
4384
  compact,
4150
4385
  tree: toolGroupTree({ expanded: this.expanded, isError: this.result?.isError }),
@@ -4160,8 +4395,7 @@ ${content}`);
4160
4395
  output && (text += `
4161
4396
  ${output}`);
4162
4397
  }
4163
- let hoisted = this.formatHoistedGroupErrors();
4164
- return hoisted && (text += hoisted), text;
4398
+ return text;
4165
4399
  }
4166
4400
  };
4167
4401
  function applySameToolGrouping(previous, next) {
@@ -4169,7 +4403,7 @@ function applySameToolGrouping(previous, next) {
4169
4403
  }
4170
4404
 
4171
4405
  // packages/coding-agent/dist/modes/interactive/components/tree-selector.js
4172
- 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";
4406
+ 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";
4173
4407
  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;
4174
4408
  function renderHorizontalViewport(rows, width) {
4175
4409
  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;
@@ -4182,7 +4416,7 @@ function renderHorizontalViewport(rows, width) {
4182
4416
  }
4183
4417
  return rows.map((row) => {
4184
4418
  let line = horizontalScroll > 0 ? `${row.gutter}${sliceByColumn(row.body, horizontalScroll, viewportWidth, !0)}\x1B[0m` : row.gutter + row.body;
4185
- return truncateToWidth4(line, width, "");
4419
+ return truncateToWidth6(line, width, "");
4186
4420
  });
4187
4421
  }
4188
4422
  var TreeList = class {
@@ -4500,7 +4734,7 @@ var TreeList = class {
4500
4734
  render(width) {
4501
4735
  let lines = [];
4502
4736
  if (this.filteredNodes.length === 0)
4503
- return lines.push(truncateToWidth4(theme.fg("muted", " No entries found"), width)), lines.push(truncateToWidth4(theme.fg("muted", ` (0/0)${this.getStatusLabels()}`), width)), lines;
4737
+ return lines.push(truncateToWidth6(theme.fg("muted", " No entries found"), width)), lines.push(truncateToWidth6(theme.fg("muted", ` (0/0)${this.getStatusLabels()}`), width)), lines;
4504
4738
  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 = [];
4505
4739
  for (let i = startIndex; i < endIndex; i++) {
4506
4740
  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);
@@ -4519,10 +4753,10 @@ var TreeList = class {
4519
4753
  else
4520
4754
  prefixChars.push(" ");
4521
4755
  }
4522
- 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;
4523
- isSelected && (gutter = theme.bg("selectedBg", gutter), body = theme.bg("selectedBg", body)), renderedRows.push({ gutter, body, anchorCol, bodyWidth: visibleWidth3(body), isSelected });
4756
+ 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;
4757
+ isSelected && (gutter = theme.bg("selectedBg", gutter), body = theme.bg("selectedBg", body)), renderedRows.push({ gutter, body, anchorCol, bodyWidth: visibleWidth5(body), isSelected });
4524
4758
  }
4525
- return lines.push(...renderHorizontalViewport(renderedRows, width)), lines.push(truncateToWidth4(theme.fg("muted", ` (${this.selectedIndex + 1}/${this.filteredNodes.length})${this.getStatusLabels()}`), width)), lines;
4759
+ return lines.push(...renderHorizontalViewport(renderedRows, width)), lines.push(truncateToWidth6(theme.fg("muted", ` (${this.selectedIndex + 1}/${this.filteredNodes.length})${this.getStatusLabels()}`), width)), lines;
4526
4760
  }
4527
4761
  getEntryDisplayText(node, isSelected) {
4528
4762
  let entry = node.entry, result, normalize = (s) => s.replace(/[\n\t]/g, " ").trim();
@@ -4781,7 +5015,7 @@ var TreeList = class {
4781
5015
  }
4782
5016
  render(width) {
4783
5017
  let query = this.treeList.getSearchQuery();
4784
- return query ? [truncateToWidth4(` ${theme.fg("muted", "Type to search:")} ${theme.fg("accent", query)}`, width)] : [truncateToWidth4(` ${theme.fg("muted", "Type to search:")}`, width)];
5018
+ return query ? [truncateToWidth6(` ${theme.fg("muted", "Type to search:")} ${theme.fg("accent", query)}`, width)] : [truncateToWidth6(` ${theme.fg("muted", "Type to search:")}`, width)];
4785
5019
  }
4786
5020
  handleInput(_keyData) {
4787
5021
  }
@@ -4794,14 +5028,14 @@ var TreeList = class {
4794
5028
  return text ? labelFirst ? `${label} ${text}` : `${text} ${label}` : label;
4795
5029
  }), availableWidth = Math.max(1, width), indent = " ", separator = " \xB7 ", lines = [], currentLine = "";
4796
5030
  for (let item of items) {
4797
- let candidate = currentLine ? `${currentLine}${separator}${item}` : visibleWidth3(`${indent}${item}`) <= availableWidth ? `${indent}${item}` : item;
4798
- if (!currentLine || visibleWidth3(candidate) <= availableWidth) {
5031
+ let candidate = currentLine ? `${currentLine}${separator}${item}` : visibleWidth5(`${indent}${item}`) <= availableWidth ? `${indent}${item}` : item;
5032
+ if (!currentLine || visibleWidth5(candidate) <= availableWidth) {
4799
5033
  currentLine = candidate;
4800
5034
  continue;
4801
5035
  }
4802
- lines.push(...wrapTextWithAnsi(currentLine.trimEnd(), availableWidth)), currentLine = visibleWidth3(`${indent}${item}`) <= availableWidth ? `${indent}${item}` : item;
5036
+ lines.push(...wrapTextWithAnsi2(currentLine.trimEnd(), availableWidth)), currentLine = visibleWidth5(`${indent}${item}`) <= availableWidth ? `${indent}${item}` : item;
4803
5037
  }
4804
- return currentLine && lines.push(...wrapTextWithAnsi(currentLine.trimEnd(), availableWidth)), lines.map((line) => theme.fg("muted", line));
5038
+ return currentLine && lines.push(...wrapTextWithAnsi2(currentLine.trimEnd(), availableWidth)), lines.map((line) => theme.fg("muted", line));
4805
5039
  }
4806
5040
  }, TREE_HELP_ITEMS = [
4807
5041
  { keys: ["tui.select.up", "tui.select.down"], label: "move" },
@@ -4860,7 +5094,7 @@ var LabelInput = class {
4860
5094
  }
4861
5095
  render(width) {
4862
5096
  let lines = [], availableWidth = width - 2;
4863
- 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;
5097
+ 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;
4864
5098
  }
4865
5099
  handleInput(keyData) {
4866
5100
  let kb = getKeybindings8();
@@ -4977,7 +5211,7 @@ var OSC133_ZONE_START2 = "\x1B]133;A\x07", OSC133_ZONE_END2 = "\x1B]133;B\x07",
4977
5211
  };
4978
5212
 
4979
5213
  // packages/coding-agent/dist/modes/interactive/components/user-message-selector.js
4980
- import { Container as Container18, getKeybindings as getKeybindings10, Spacer as Spacer18, Text as Text20, truncateToWidth as truncateToWidth5 } from "@ashx-j/lunr-tui";
5214
+ import { Container as Container18, getKeybindings as getKeybindings10, Spacer as Spacer18, Text as Text20, truncateToWidth as truncateToWidth7 } from "@ashx-j/lunr-tui";
4981
5215
  var UserMessageList = class {
4982
5216
  messages = [];
4983
5217
  selectedIndex = 0;
@@ -4998,7 +5232,7 @@ var UserMessageList = class {
4998
5232
  return lines.push(theme.fg("muted", " No user messages found")), lines;
4999
5233
  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);
5000
5234
  for (let i = startIndex; i < endIndex; i++) {
5001
- 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);
5235
+ 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);
5002
5236
  lines.push(messageLine);
5003
5237
  let metadata = ` Message ${i + 1} of ${this.messages.length}`, metadataLine = theme.fg("muted", metadata);
5004
5238
  lines.push(metadataLine), lines.push("");
@@ -5420,8 +5654,10 @@ var InteractiveMode = class _InteractiveMode {
5420
5654
  streamingTargetMessage = void 0;
5421
5655
  streamingDisplayedLength = 0;
5422
5656
  smoothStreamingTimer = void 0;
5657
+ thinkingAnimationTimer;
5423
5658
  // Tool execution tracking: toolCallId -> component
5424
5659
  pendingTools = /* @__PURE__ */ new Map();
5660
+ browserActivityComponent;
5425
5661
  // Tool output expansion state
5426
5662
  toolOutputExpanded = !1;
5427
5663
  // Thinking block visibility state
@@ -5506,11 +5742,13 @@ var InteractiveMode = class _InteractiveMode {
5506
5742
  this.runtimeHost = runtimeHost, this.options = options, this.autoTrustOnReloadCwd = options.autoTrustOnReloadCwd, this.runtimeHost.setBeforeSessionInvalidate((reason) => {
5507
5743
  this.resetExtensionUI(), this.previousPermissionMode = void 0, this.preGoalPermissionMode = void 0, resetPermissions(this.settingsManager.getDefaultPermissionMode()), clearRegistry(), reason !== "fork" && clearRollback(this.sessionManager.getSessionId());
5508
5744
  }), this.runtimeHost.setRebindSession(async () => {
5509
- await this.rebindCurrentSession({ renderBeforeBind: !0 }), initRollback(this.settingsManager, this.sessionManager.getSessionId()), this.syncPermissionModeEffects(this.settingsManager.getDefaultPermissionMode());
5745
+ await this.rebindCurrentSession({ renderBeforeBind: !0 }), initRollback(this.settingsManager, this.sessionManager.getSessionId());
5746
+ let mode = this.sessionManager.getPermissionMode() ?? this.settingsManager.getDefaultPermissionMode();
5747
+ resetPermissions(mode), this.syncPermissionModeEffects(mode);
5510
5748
  }), this.version = VERSION, this.ui = options.startupView?.ui ?? new TUI(new ProcessTerminal(), this.settingsManager.getShowHardwareCursor()), this.ui.setClearOnShrink(this.settingsManager.getClearOnShrink()), registerPermissionModeBridge(() => getPermissionMode()), registerPermissionModeControlBridge({
5511
5749
  enterGoalAuto: () => this.enterGoalAuto(),
5512
5750
  leaveGoalAuto: () => this.leaveGoalAuto()
5513
- }), 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);
5751
+ }), 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);
5514
5752
  let editorPaddingX = this.settingsManager.getEditorPaddingX(), autocompleteMaxVisible = this.settingsManager.getAutocompleteMaxVisible();
5515
5753
  this.defaultEditor = options.startupView?.editor ?? new CustomEditor(this.ui, getEditorTheme(), this.keybindings, {
5516
5754
  paddingX: editorPaddingX,
@@ -5629,7 +5867,7 @@ var InteractiveMode = class _InteractiveMode {
5629
5867
  return (typeof resp == "string" ? resp : resp.decision) !== "reject" && this.applyPermissionMode(this.restoreTargetAfterPlan()), resp;
5630
5868
  }
5631
5869
  return this.showApprovalDialog(req);
5632
- }), 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()) {
5870
+ }), 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()) {
5633
5871
  let header = theme.bold(theme.fg("accent", APP_NAME)) + theme.fg("dim", ` v${this.version}`);
5634
5872
  this.builtInHeader = new BootScreenComponent(header, this.buildBootRows()), this.headerContainer.addChild(new Spacer19(1)), this.headerContainer.addChild(this.builtInHeader);
5635
5873
  } else
@@ -6116,7 +6354,7 @@ ${warningLines}`, 0, 0)), this.loadedResourcesContainer.addChild(new Spacer19(1)
6116
6354
  replaceInstructions: options?.replaceInstructions,
6117
6355
  label: options?.label
6118
6356
  });
6119
- 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 });
6357
+ 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 });
6120
6358
  },
6121
6359
  switchSession: async (sessionPath, options) => this.handleResumeSession(sessionPath, options),
6122
6360
  reload: async () => {
@@ -6149,15 +6387,25 @@ ${warningLines}`, 0, 0)), this.loadedResourcesContainer.addChild(new Spacer19(1)
6149
6387
  ], skillsCount = this.session.resourceLoader.getSkills().skills.length;
6150
6388
  return skillsCount > 0 && bootRows.push({ label: "skills", value: String(skillsCount) }), bootRows;
6151
6389
  }
6390
+ unregisterSessionTransfer;
6391
+ transferInProgress = !1;
6392
+ detachedDraft = "";
6152
6393
  async rebindCurrentSession(options = {}) {
6153
- 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();
6394
+ await this.waitForDeferredBuiltins(), this.unregisterSessionTransfer?.(), recordTuiActivity(this.sessionManager, this.runtimeHost.services.agentDir), this.unregisterSessionTransfer = registerTransferHandler(this.sessionManager, async ({ stop, signal }) => {
6395
+ this.transferInProgress = !0;
6396
+ try {
6397
+ 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.");
6398
+ } finally {
6399
+ this.transferInProgress = !1;
6400
+ }
6401
+ }), 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();
6154
6402
  }
6155
6403
  async handleFatalRuntimeError(prefix, error) {
6156
6404
  let message = error instanceof Error ? error.message : String(error);
6157
6405
  this.showError(`${prefix}: ${message}`), stopThemeWatcher(), this.stop(), process.exit(1);
6158
6406
  }
6159
6407
  renderCurrentSessionState() {
6160
- 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();
6408
+ 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();
6161
6409
  }
6162
6410
  /**
6163
6411
  * Get a registered tool definition by name (for custom rendering).
@@ -6672,7 +6920,35 @@ ${message}`, ["Yes", "No"], opts) === "Yes";
6672
6920
  }
6673
6921
  setupEditorSubmitHandler() {
6674
6922
  this.defaultEditor.onSubmit = async (text) => {
6675
- if (text = text.trim(), !text) {
6923
+ if (text = text.trim(), text === "/reclaim" || text === "/reclaim stop") {
6924
+ let file = this.sessionManager.getSessionFile();
6925
+ try {
6926
+ if (!file)
6927
+ throw new Error("This session is not saved.");
6928
+ if (!this.runtimeHost.isDetached) {
6929
+ this.showStatus("This terminal already owns the session.");
6930
+ return;
6931
+ }
6932
+ let draft = this.editor.getText();
6933
+ await requestSessionTransfer(file, { stop: text === "/reclaim stop" }), await this.runtimeHost.switchSession(file), this.editor.setText(draft === text ? this.detachedDraft : draft), this.showStatus("Session reclaimed.");
6934
+ } catch (error) {
6935
+ this.showError(error instanceof Error ? error.message : String(error));
6936
+ }
6937
+ return;
6938
+ }
6939
+ if ((this.runtimeHost.isDetached || this.transferInProgress) && !["/quit", "/exit"].includes(text)) {
6940
+ this.showError("Session is detached or transferring. Draft retained. Use /reclaim, /reclaim stop, or /quit.");
6941
+ return;
6942
+ }
6943
+ if (text === "/handoff" || text === "/handoff cancel") {
6944
+ try {
6945
+ 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.");
6946
+ } catch (error) {
6947
+ this.showError(error instanceof Error ? error.message : String(error));
6948
+ }
6949
+ return;
6950
+ }
6951
+ if (text && !this.runtimeHost.isDetached && (!text.startsWith("/") || /^\/(?:model|thinking|effort|reasoning|off|minimal|low|medium|high|xhigh|max|mode|plan|manual|yolo|auto|name|title|undo|edit|redo|tree|compact)(?:\s|$)/.test(text)) && recordTuiActivity(this.sessionManager, this.runtimeHost.services.agentDir), !text) {
6676
6952
  this.takeSubmittedImages(text);
6677
6953
  return;
6678
6954
  }
@@ -6843,9 +7119,21 @@ ${message}`, ["Yes", "No"], opts) === "Yes";
6843
7119
  this.isExtensionCommand(text) ? (this.editor.addToHistory?.(text), this.editor.setText(""), await this.promptAfterDeferredBuiltins(text)) : this.queueCompactionMessage(text, "steer", images);
6844
7120
  return;
6845
7121
  }
6846
- if (this.session.isStreaming) {
6847
- this.editor.addToHistory?.(text), this.editor.setText(""), await this.promptAfterDeferredBuiltins(text, { streamingBehavior: "steer", images }), this.updatePendingMessagesDisplay(), this.ui.requestRender();
6848
- return;
7122
+ if (this.session.isStreaming || this.session.isWaitPromptHandoffActive) {
7123
+ if (!this.isExtensionCommand(text)) {
7124
+ await this.awaitDeferredBuiltinsForPrompt();
7125
+ let handoff = await this.session.interruptSubagentWaitWithPrompt(text, { images });
7126
+ if (handoff) {
7127
+ this.editor.addToHistory?.(text), this.editor.setText(""), handoff.completion.catch((error) => {
7128
+ this.showError(error instanceof Error ? error.message : String(error));
7129
+ }), this.ui.requestRender();
7130
+ return;
7131
+ }
7132
+ }
7133
+ if (this.session.isStreaming) {
7134
+ this.editor.addToHistory?.(text), this.editor.setText(""), await this.promptAfterDeferredBuiltins(text, { streamingBehavior: "steer", images }), this.updatePendingMessagesDisplay(), this.ui.requestRender();
7135
+ return;
7136
+ }
6849
7137
  }
6850
7138
  this.flushPendingBashComponents(), this.onInputCallback ? this.onInputCallback({ text, images }) : this.pendingUserInputs.push({ text, images }), this.editor.addToHistory?.(text);
6851
7139
  };
@@ -6855,6 +7143,13 @@ ${message}`, ["Yes", "No"], opts) === "Yes";
6855
7143
  getSmoothStreamingOptions() {
6856
7144
  return { hideThinking: this.hideThinkingBlock };
6857
7145
  }
7146
+ setThinkingAnimation(active) {
7147
+ if (!active) {
7148
+ this.thinkingAnimationTimer && clearInterval(this.thinkingAnimationTimer), this.thinkingAnimationTimer = void 0;
7149
+ return;
7150
+ }
7151
+ this.thinkingAnimationTimer || (this.thinkingAnimationTimer = setInterval(() => this.ui.requestRender(), 33), this.thinkingAnimationTimer.unref?.());
7152
+ }
6858
7153
  clearSmoothStreamingTimer() {
6859
7154
  this.smoothStreamingTimer && (clearInterval(this.smoothStreamingTimer), this.smoothStreamingTimer = void 0);
6860
7155
  }
@@ -6885,11 +7180,8 @@ ${message}`, ["Yes", "No"], opts) === "Yes";
6885
7180
  let component = this.pendingTools.get(content.id);
6886
7181
  component && component.updateArgs(content.arguments);
6887
7182
  } else {
6888
- let component = new ToolExecutionComponent(content.name, content.id, content.arguments, {
6889
- showImages: this.settingsManager.getShowImages(),
6890
- imageWidthCells: this.settingsManager.getImageWidthCells()
6891
- }, this.getRegisteredToolDefinition(content.name), this.ui, this.sessionManager.getCwd());
6892
- component.setExpanded(this.toolOutputExpanded), this.addToolComponentToChat(component), this.pendingTools.set(content.id, component);
7183
+ let component = content.name === "browser" && this.browserActivityComponent ? this.browserActivityComponent : this.createToolExecutionComponent(content.name, content.id, content.arguments);
7184
+ this.pendingTools.set(content.id, component);
6893
7185
  }
6894
7186
  }
6895
7187
  advanceSmoothStreaming() {
@@ -6907,7 +7199,7 @@ ${message}`, ["Yes", "No"], opts) === "Yes";
6907
7199
  this.streamingDisplayedLength += computeSmoothRevealStep(backlog), this.streamingDisplayedLength > total && (this.streamingDisplayedLength = total), this.paintSmoothStreamingFrame(), this.streamingDisplayedLength >= total && this.clearSmoothStreamingTimer();
6908
7200
  }
6909
7201
  stopSmoothStreaming() {
6910
- this.clearSmoothStreamingTimer(), this.streamingTargetMessage = void 0, this.streamingDisplayedLength = 0;
7202
+ this.setThinkingAnimation(!1), this.clearSmoothStreamingTimer(), this.streamingTargetMessage = void 0, this.streamingDisplayedLength = 0;
6911
7203
  }
6912
7204
  /** Apply a mid-stream smoothStreaming setting change without rewinding. */
6913
7205
  applySmoothStreamingSettingChange(enabled) {
@@ -6929,7 +7221,7 @@ ${message}`, ["Yes", "No"], opts) === "Yes";
6929
7221
  async handleEvent(event) {
6930
7222
  switch (this.isInitialized || await this.init(), this.footer.invalidate(), event.type) {
6931
7223
  case "agent_start":
6932
- 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();
7224
+ 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();
6933
7225
  break;
6934
7226
  case "queue_update":
6935
7227
  this.updatePendingMessagesDisplay(), this.ui.requestRender();
@@ -6944,7 +7236,11 @@ ${message}`, ["Yes", "No"], opts) === "Yes";
6944
7236
  this.footer.invalidate(), this.updateEditorBorderColor();
6945
7237
  break;
6946
7238
  case "message_start":
6947
- 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());
7239
+ 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, {
7240
+ requestRender: () => this.ui.requestRender(),
7241
+ reasoningDisplay: this.settingsManager.getReasoningDisplay(),
7242
+ onThinkingAnimationChange: (active) => this.setThinkingAnimation(active)
7243
+ }), 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());
6948
7244
  break;
6949
7245
  case "message_update":
6950
7246
  if (this.streamingComponent && event.message.role === "assistant")
@@ -6987,10 +7283,7 @@ ${message}`, ["Yes", "No"], opts) === "Yes";
6987
7283
  this.streamingDisplayedLength < needed && (this.streamingDisplayedLength = needed), this.paintSmoothStreamingFrame();
6988
7284
  }
6989
7285
  let component = this.pendingTools.get(event.toolCallId);
6990
- component || (component = new ToolExecutionComponent(event.toolName, event.toolCallId, event.args, {
6991
- showImages: this.settingsManager.getShowImages(),
6992
- imageWidthCells: this.settingsManager.getImageWidthCells()
6993
- }, 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();
7286
+ 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();
6994
7287
  break;
6995
7288
  }
6996
7289
  case "tool_execution_update": {
@@ -7004,7 +7297,7 @@ ${message}`, ["Yes", "No"], opts) === "Yes";
7004
7297
  break;
7005
7298
  }
7006
7299
  case "agent_end":
7007
- 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();
7300
+ 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();
7008
7301
  break;
7009
7302
  case "agent_settled":
7010
7303
  if (this.pendingCompactionRender) {
@@ -7125,7 +7418,10 @@ ${message}`, ["Yes", "No"], opts) === "Yes";
7125
7418
  break;
7126
7419
  }
7127
7420
  case "assistant": {
7128
- let assistantComponent = new AssistantMessageComponent(message, this.hideThinkingBlock, this.getMarkdownThemeWithSettings(), this.hiddenThinkingLabel, this.outputPad, this.thinkingCollapse);
7421
+ let assistantComponent = new AssistantMessageComponent(message, this.hideThinkingBlock, this.getMarkdownThemeWithSettings(), this.hiddenThinkingLabel, this.outputPad, this.thinkingCollapse, {
7422
+ requestRender: () => this.ui.requestRender(),
7423
+ reasoningDisplay: this.settingsManager.getReasoningDisplay()
7424
+ });
7129
7425
  assistantComponent.setThinkingTimings(this.thinkingTimingsByMessage.get(message)), assistantComponent.setExpanded(this.toolOutputExpanded), this.chatContainer.addChild(assistantComponent);
7130
7426
  break;
7131
7427
  }
@@ -7138,7 +7434,7 @@ ${message}`, ["Yes", "No"], opts) === "Yes";
7138
7434
  }
7139
7435
  renderSessionItems(items, options = {}) {
7140
7436
  this.pendingTools.clear();
7141
- let renderedPendingTools = /* @__PURE__ */ new Map(), cacheMisses = this.settingsManager.getShowCacheMissNotices() ? collectCacheMisses(this.sessionManager.getEntries(), this.session.modelRuntime) : /* @__PURE__ */ new Map();
7437
+ let browserActivityComponent, renderedPendingTools = /* @__PURE__ */ new Map(), cacheMisses = this.settingsManager.getShowCacheMissNotices() ? collectCacheMisses(this.sessionManager.getEntries(), this.session.modelRuntime) : /* @__PURE__ */ new Map();
7142
7438
  options.updateFooter && (this.footer.invalidate(), this.updateEditorBorderColor());
7143
7439
  for (let item of items) {
7144
7440
  if (isCustomSessionEntry(item)) {
@@ -7150,11 +7446,11 @@ ${message}`, ["Yes", "No"], opts) === "Yes";
7150
7446
  this.addMessageToChat(message);
7151
7447
  for (let content of message.content)
7152
7448
  if (content.type === "toolCall") {
7153
- let component = new ToolExecutionComponent(content.name, content.id, content.arguments, {
7449
+ let component = content.name === "browser" ? browserActivityComponent : void 0;
7450
+ if (component ? component.beginNextExecution(content.id, content.arguments) : (component = new ToolExecutionComponent(content.name, content.id, content.arguments, {
7154
7451
  showImages: this.settingsManager.getShowImages(),
7155
7452
  imageWidthCells: this.settingsManager.getImageWidthCells()
7156
- }, this.getRegisteredToolDefinition(content.name), this.ui, this.sessionManager.getCwd());
7157
- if (component.setExpanded(this.toolOutputExpanded), this.addToolComponentToChat(component), message.stopReason === "aborted" || message.stopReason === "error") {
7453
+ }, 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") {
7158
7454
  let errorMessage;
7159
7455
  if (message.stopReason === "aborted") {
7160
7456
  let retryAttempt = this.session.retryAttempt;
@@ -7173,7 +7469,7 @@ ${message}`, ["Yes", "No"], opts) === "Yes";
7173
7469
  let component = renderedPendingTools.get(message.toolCallId);
7174
7470
  component && (component.updateResult(message), renderedPendingTools.delete(message.toolCallId));
7175
7471
  } else
7176
- this.addMessageToChat(message, options);
7472
+ message.role === "user" && (browserActivityComponent = void 0), this.addMessageToChat(message, options);
7177
7473
  }
7178
7474
  for (let [toolCallId, component] of renderedPendingTools)
7179
7475
  this.pendingTools.set(toolCallId, component);
@@ -7232,7 +7528,7 @@ ${message}`, ["Yes", "No"], opts) === "Yes";
7232
7528
  });
7233
7529
  }
7234
7530
  rebuildChatFromMessages() {
7235
- this.chatContainer.clear(), this.renderSessionEntries(this.sessionManager.buildContextEntries());
7531
+ this.clearChatContainer(), this.renderSessionEntries(this.sessionManager.buildContextEntries());
7236
7532
  }
7237
7533
  // =========================================================================
7238
7534
  // Key handlers
@@ -7253,7 +7549,7 @@ ${message}`, ["Yes", "No"], opts) === "Yes";
7253
7549
  async shutdown(options) {
7254
7550
  if (this.isShuttingDown)
7255
7551
  return;
7256
- if (this.isShuttingDown = !0, this.stopSmoothStreaming(), this.planUsageTimer && (clearInterval(this.planUsageTimer), this.planUsageTimer = void 0), getUsageServiceBridge()?.setOnUpdate(void 0), options?.fromSignal) {
7552
+ if (this.isShuttingDown = !0, this.unregisterSessionTransfer?.(), this.stopSmoothStreaming(), this.planUsageTimer && (clearInterval(this.planUsageTimer), this.planUsageTimer = void 0), getUsageServiceBridge()?.setOnUpdate(void 0), options?.fromSignal) {
7257
7553
  await this.runtimeHost.dispose(), this.themeController.disableAutoSync(), await this.ui.terminal.drainInput(1e3);
7258
7554
  try {
7259
7555
  killAll();
@@ -7354,6 +7650,10 @@ Kill them before exit?`) && killAll(), this.stop(), await this.runtimeHost.dispo
7354
7650
  }
7355
7651
  }
7356
7652
  async handleFollowUp() {
7653
+ if (this.runtimeHost.isDetached || this.transferInProgress) {
7654
+ this.showError("Use /reclaim before sending more work. Draft retained.");
7655
+ return;
7656
+ }
7357
7657
  let text = (this.editor.getExpandedText?.() ?? this.editor.getText()).trim();
7358
7658
  if (text) {
7359
7659
  if (this.session.isCompacting) {
@@ -7388,21 +7688,26 @@ Kill them before exit?`) && killAll(), this.stop(), await this.runtimeHost.dispo
7388
7688
  this.ui.requestRender();
7389
7689
  }
7390
7690
  cycleThinkingLevel() {
7391
- this.session.cycleThinkingLevel() === void 0 ? this.showStatus("Current model does not support thinking") : (this.footer.invalidate(), this.updateEditorBorderColor());
7691
+ if (this.runtimeHost.isDetached || this.transferInProgress)
7692
+ return;
7693
+ 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());
7392
7694
  }
7393
7695
  cyclePermissionMode() {
7394
7696
  this.applyPermissionMode(nextPermissionMode(getPermissionMode()), { silent: !0 });
7395
7697
  }
7396
7698
  async cycleModel(direction) {
7397
- try {
7398
- let result = await this.session.cycleModel(direction);
7399
- if (result === void 0) {
7400
- let msg = this.session.scopedModels.length > 0 ? "Only one model in scope" : "Only one model available";
7401
- this.showStatus(msg);
7402
- } else
7403
- this.footer.invalidate(), this.updateEditorBorderColor(), this.maybeWarnAboutAnthropicSubscriptionAuth(result.model);
7404
- } catch (error) {
7405
- this.showError(error instanceof Error ? error.message : String(error));
7699
+ if (!(this.runtimeHost.isDetached || this.transferInProgress)) {
7700
+ recordTuiActivity(this.sessionManager, this.runtimeHost.services.agentDir);
7701
+ try {
7702
+ let result = await this.session.cycleModel(direction);
7703
+ if (result === void 0) {
7704
+ let msg = this.session.scopedModels.length > 0 ? "Only one model in scope" : "Only one model available";
7705
+ this.showStatus(msg);
7706
+ } else
7707
+ this.footer.invalidate(), this.updateEditorBorderColor(), this.maybeWarnAboutAnthropicSubscriptionAuth(result.model);
7708
+ } catch (error) {
7709
+ this.showError(error instanceof Error ? error.message : String(error));
7710
+ }
7406
7711
  }
7407
7712
  }
7408
7713
  toggleToolOutputExpansion() {
@@ -7417,6 +7722,23 @@ Kill them before exit?`) && killAll(), this.stop(), await this.runtimeHost.dispo
7417
7722
  isExpandable(child) && child.setExpanded(expanded);
7418
7723
  globalThis[/* @__PURE__ */ Symbol.for("@lunr/tools-expanded-changed")]?.(expanded), this.ui.requestRender();
7419
7724
  }
7725
+ createToolExecutionComponent(toolName, toolCallId, args) {
7726
+ if (toolName === "browser" && this.browserActivityComponent)
7727
+ return this.browserActivityComponent.beginNextExecution(toolCallId, args), this.browserActivityComponent;
7728
+ let component = new ToolExecutionComponent(toolName, toolCallId, args, {
7729
+ showImages: this.settingsManager.getShowImages(),
7730
+ imageWidthCells: this.settingsManager.getImageWidthCells()
7731
+ }, this.getRegisteredToolDefinition(toolName), this.ui, this.sessionManager.getCwd());
7732
+ return component.setExpanded(this.toolOutputExpanded), this.addToolComponentToChat(component), toolName === "browser" && (this.browserActivityComponent = component), component;
7733
+ }
7734
+ disposeChatToolComponents() {
7735
+ for (let child of this.chatContainer.children)
7736
+ child instanceof ToolExecutionComponent && child.dispose();
7737
+ this.browserActivityComponent = void 0;
7738
+ }
7739
+ clearChatContainer() {
7740
+ this.disposeChatToolComponents(), this.chatContainer.clear();
7741
+ }
7420
7742
  // lunr: consecutive same-tool grouping — a tool component appended right after
7421
7743
  // another component for the SAME tool becomes a group continuation (no top
7422
7744
  // spacer / top pad); the previous card drops its bottom pad. Mixed neighbors
@@ -7426,7 +7748,7 @@ Kill them before exit?`) && killAll(), this.stop(), await this.runtimeHost.dispo
7426
7748
  applySameToolGrouping(last instanceof ToolExecutionComponent ? last : void 0, component), this.chatContainer.addChild(component);
7427
7749
  }
7428
7750
  toggleThinkingBlockVisibility() {
7429
- if (this.hideThinkingBlock = !this.hideThinkingBlock, this.settingsManager.setHideThinkingBlock(this.hideThinkingBlock), this.chatContainer.clear(), this.rebuildChatFromMessages(), this.streamingComponent && this.streamingMessage) {
7751
+ if (this.hideThinkingBlock = !this.hideThinkingBlock, this.settingsManager.setHideThinkingBlock(this.hideThinkingBlock), this.rebuildChatFromMessages(), this.streamingComponent && this.streamingMessage) {
7430
7752
  if (this.streamingComponent.setHideThinkingBlock(this.hideThinkingBlock), this.settingsManager.getSmoothStreaming() && this.streamingTargetMessage) {
7431
7753
  let opts = this.getSmoothStreamingOptions(), total = countMessageGraphemes(this.streamingTargetMessage, opts);
7432
7754
  this.streamingDisplayedLength > total && (this.streamingDisplayedLength = total), this.paintSmoothStreamingFrame(), this.streamingDisplayedLength < total && this.startSmoothStreaming();
@@ -7543,7 +7865,7 @@ Pi will resume when the editor exits.
7543
7865
  return !!extensionRunner.getCommand(commandName);
7544
7866
  }
7545
7867
  renderCompactionResult(result) {
7546
- this.chatContainer.clear(), this.rebuildChatFromMessages(), this.addMessageToChat(createCompactionSummaryMessage(result.summary, result.tokensBefore, (/* @__PURE__ */ new Date()).toISOString())), this.footer.invalidate();
7868
+ this.rebuildChatFromMessages(), this.addMessageToChat(createCompactionSummaryMessage(result.summary, result.tokensBefore, (/* @__PURE__ */ new Date()).toISOString())), this.footer.invalidate();
7547
7869
  }
7548
7870
  async flushCompactionQueue(options) {
7549
7871
  if (this.compactionQueuedMessages.length === 0)
@@ -7622,6 +7944,7 @@ Pi will resume when the editor exits.
7622
7944
  availableThemes: getAvailableThemes(),
7623
7945
  hideThinkingBlock: this.hideThinkingBlock,
7624
7946
  thinkingCollapse: this.thinkingCollapse,
7947
+ reasoningDisplay: this.settingsManager.getReasoningDisplay(),
7625
7948
  cacheRetention: this.settingsManager.getCacheRetention() ?? "short",
7626
7949
  doubleEscapeAction: this.settingsManager.getDoubleEscapeAction(),
7627
7950
  treeFilterMode: this.settingsManager.getTreeFilterMode(),
@@ -7642,8 +7965,10 @@ Pi will resume when the editor exits.
7642
7965
  globalInstructionsPath: getGlobalInstructionsPath(getAgentDir()),
7643
7966
  modelInstructionsPath: getModelInstructionsPath(getAgentDir(), this.session.model?.id ?? "no-model-selected"),
7644
7967
  confirmLargeSubagentLaunches: this.settingsManager.getConfirmLargeSubagentLaunches(),
7968
+ browserEnabled: this.settingsManager.getBrowserEnabled(),
7645
7969
  memoryEnabled: this.settingsManager.getMemoryEnabled(),
7646
7970
  memoryCharCap: this.settingsManager.getMemoryCharCap(),
7971
+ todosEnabled: this.settingsManager.getTodosEnabled(),
7647
7972
  searchCurator: getSearchCuratorSetting(),
7648
7973
  // lunr: TUI customize settings
7649
7974
  footerMcp: this.settingsManager.getFooterMcp(),
@@ -7714,13 +8039,19 @@ Pi will resume when the editor exits.
7714
8039
  this.hideThinkingBlock = hidden, this.settingsManager.setHideThinkingBlock(hidden);
7715
8040
  for (let child of this.chatContainer.children)
7716
8041
  child instanceof AssistantMessageComponent && child.setHideThinkingBlock(hidden);
7717
- this.chatContainer.clear(), this.rebuildChatFromMessages();
8042
+ this.rebuildChatFromMessages();
7718
8043
  },
7719
8044
  onThinkingCollapseChange: (collapse) => {
7720
8045
  this.thinkingCollapse = collapse, this.settingsManager.setThinkingCollapse(collapse);
7721
8046
  for (let child of this.chatContainer.children)
7722
8047
  child instanceof AssistantMessageComponent && child.setThinkingCollapse(collapse);
7723
- this.chatContainer.clear(), this.rebuildChatFromMessages();
8048
+ this.rebuildChatFromMessages();
8049
+ },
8050
+ onReasoningDisplayChange: (display) => {
8051
+ this.settingsManager.setReasoningDisplay(display);
8052
+ for (let child of this.chatContainer.children)
8053
+ child instanceof AssistantMessageComponent && child.setReasoningDisplay(this.settingsManager.getReasoningDisplay());
8054
+ this.ui.requestRender();
7724
8055
  },
7725
8056
  onShowCacheMissNoticesChange: (shown) => {
7726
8057
  this.settingsManager.setShowCacheMissNotices(shown), this.rebuildChatFromMessages();
@@ -7798,9 +8129,15 @@ Pi will resume when the editor exits.
7798
8129
  onMemoryCharCapChange: (cap) => {
7799
8130
  this.settingsManager.setMemoryCharCap(cap);
7800
8131
  },
8132
+ onBrowserEnabledChange: (enabled) => {
8133
+ this.settingsManager.setBrowserEnabled(enabled), this.session.refreshToolRegistry();
8134
+ },
7801
8135
  onMemoryEnabledChange: (enabled) => {
7802
8136
  this.settingsManager.setMemoryEnabled(enabled), this.session.refreshToolRegistry(), this.showStatus(`Agent memory: ${enabled ? "on" : "off"}`);
7803
8137
  },
8138
+ onTodosEnabledChange: (enabled) => {
8139
+ this.settingsManager.setTodosEnabled(enabled), notifyTodosEnabledChanged(enabled), this.session.refreshToolRegistry();
8140
+ },
7804
8141
  onSearchCuratorChange: (setting) => {
7805
8142
  setSearchCuratorSetting(setting) || this.showError("pi-web-access is not loaded; curator setting unavailable.");
7806
8143
  },
@@ -7838,6 +8175,31 @@ Pi will resume when the editor exits.
7838
8175
  onPlanUsageWindowChange: (window) => {
7839
8176
  this.settingsManager.setPlanUsageWindow(window);
7840
8177
  },
8178
+ onGatewayAction: (action) => {
8179
+ (async () => {
8180
+ if (this.session.isStreaming) {
8181
+ this.showStatus("Wait for the current turn before managing the gateway.");
8182
+ return;
8183
+ }
8184
+ if (action === "status") {
8185
+ this.showStatus((await import("./service-ISSP6VHE.js")).serviceStatusText());
8186
+ return;
8187
+ }
8188
+ this.ui.stop();
8189
+ try {
8190
+ await new Promise((resolve4, reject) => {
8191
+ let child = spawn3(process.execPath, [process.argv[1], "gateway", ...action.split(" ")], {
8192
+ stdio: "inherit",
8193
+ env: process.env
8194
+ });
8195
+ child.once("error", reject), child.once("exit", (code) => code === 0 ? resolve4() : reject(new Error(`Gateway command exited with code ${code}. Run lunr gateway doctor.`)));
8196
+ });
8197
+ } finally {
8198
+ this.ui.start(), this.ui.requestRender(!0);
8199
+ }
8200
+ this.showStatus((await import("./service-ISSP6VHE.js")).serviceStatusText());
8201
+ })().catch((error) => this.showStatus(error instanceof Error ? error.message : String(error)));
8202
+ },
7841
8203
  onDefaultPermissionModeChange: (mode) => {
7842
8204
  this.settingsManager.setDefaultPermissionMode(mode);
7843
8205
  },
@@ -8009,6 +8371,8 @@ Pi will resume when the editor exits.
8009
8371
  });
8010
8372
  }
8011
8373
  async showModelSelector(initialSearchInput) {
8374
+ if (this.runtimeHost.isDetached || this.transferInProgress)
8375
+ return;
8012
8376
  let subscriptionNames = await this.getActiveSubscriptionNames();
8013
8377
  this.showSelector((done) => {
8014
8378
  let selector = new ModelSelectorComponent(this.ui, this.session.model, this.settingsManager, this.session.modelRuntime, this.session.scopedModels, async (model) => {
@@ -8145,6 +8509,8 @@ Pi will resume when the editor exits.
8145
8509
  });
8146
8510
  }
8147
8511
  showUserMessageSelector() {
8512
+ if (this.runtimeHost.isDetached || this.transferInProgress)
8513
+ return;
8148
8514
  let userMessages = this.session.getUserMessagesForForking();
8149
8515
  if (userMessages.length === 0) {
8150
8516
  this.showStatus("No messages to fork from");
@@ -8187,6 +8553,8 @@ Pi will resume when the editor exits.
8187
8553
  }
8188
8554
  }
8189
8555
  showTreeSelector(initialSelectedId) {
8556
+ if (this.runtimeHost.isDetached || this.transferInProgress)
8557
+ return;
8190
8558
  let tree = this.sessionManager.getTree(), realLeafId = this.sessionManager.getLeafId(), initialFilterMode = this.settingsManager.getTreeFilterMode();
8191
8559
  if (tree.length === 0) {
8192
8560
  this.showStatus("No entries in session");
@@ -8231,7 +8599,7 @@ Pi will resume when the editor exits.
8231
8599
  this.showStatus("Navigation cancelled");
8232
8600
  return;
8233
8601
  }
8234
- this.chatContainer.clear(), this.renderInitialMessages(), result.editorText && !this.editor.getText().trim() && this.restoreEditorFromTreeResult(result), this.showStatus("Navigated to selected point"), this.flushCompactionQueue({ willRetry: !1 });
8602
+ this.clearChatContainer(), this.renderInitialMessages(), result.editorText && !this.editor.getText().trim() && this.restoreEditorFromTreeResult(result), this.showStatus("Navigated to selected point"), this.flushCompactionQueue({ willRetry: !1 });
8235
8603
  } catch (error) {
8236
8604
  this.showError(error instanceof Error ? error.message : String(error));
8237
8605
  } finally {
@@ -8268,7 +8636,16 @@ Pi will resume when the editor exits.
8268
8636
  let next = (nextName ?? "").trim();
8269
8637
  if (!next)
8270
8638
  return;
8271
- SessionManager.open(sessionFilePath).appendSessionInfo(next);
8639
+ if (sessionFilePath === this.sessionManager.getSessionFile() && !this.runtimeHost.isDetached) {
8640
+ this.sessionManager.appendSessionInfo(next);
8641
+ return;
8642
+ }
8643
+ let mgr = SessionManager.open(sessionFilePath);
8644
+ try {
8645
+ mgr.appendSessionInfo(next);
8646
+ } finally {
8647
+ mgr.dispose();
8648
+ }
8272
8649
  },
8273
8650
  showRenameHint: !0,
8274
8651
  keybindings: this.keybindings
@@ -8810,7 +9187,7 @@ ${INIT_EXISTING_FILE_INSTRUCTIONS.append}`;
8810
9187
  this.showStatus(command === "undo" ? "Undo cancelled" : "Edit cancelled");
8811
9188
  return;
8812
9189
  }
8813
- return leafId && this.redoStack.push(leafId), this.chatContainer.clear(), this.renderInitialMessages(), this.flushCompactionQueue({ willRetry: !1 }), { editorText: result.editorText, editorImages: result.editorImages };
9190
+ return leafId && this.redoStack.push(leafId), this.clearChatContainer(), this.renderInitialMessages(), this.flushCompactionQueue({ willRetry: !1 }), { editorText: result.editorText, editorImages: result.editorImages };
8814
9191
  } catch (error) {
8815
9192
  this.showError(error instanceof Error ? error.message : String(error));
8816
9193
  return;
@@ -8842,7 +9219,7 @@ ${INIT_EXISTING_FILE_INSTRUCTIONS.append}`;
8842
9219
  this.redoStack.push(targetId), this.showStatus("Navigation cancelled");
8843
9220
  return;
8844
9221
  }
8845
- this.chatContainer.clear(), this.renderInitialMessages(), result.editorText && !this.editor.getText().trim() && this.restoreEditorFromTreeResult(result), this.showStatus("Redone"), this.flushCompactionQueue({ willRetry: !1 });
9222
+ this.clearChatContainer(), this.renderInitialMessages(), result.editorText && !this.editor.getText().trim() && this.restoreEditorFromTreeResult(result), this.showStatus("Redone"), this.flushCompactionQueue({ willRetry: !1 });
8846
9223
  } catch (error) {
8847
9224
  this.showError(error instanceof Error ? error.message : String(error));
8848
9225
  }
@@ -9236,7 +9613,7 @@ ${theme.fg("dim", "Cache Re-billed:")} ${detail}`;
9236
9613
  }
9237
9614
  /** Apply addendum + auto-rollback for a mode without a status toast. */
9238
9615
  syncPermissionModeEffects(mode) {
9239
- 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);
9616
+ this.runtimeHost.isDetached || this.transferInProgress || (this.sessionManager.setPermissionMode(mode), 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));
9240
9617
  }
9241
9618
  // lunr: `/goal` forces session auto without writing settings.
9242
9619
  enterGoalAuto() {
@@ -9248,6 +9625,9 @@ ${theme.fg("dim", "Cache Re-billed:")} ${detail}`;
9248
9625
  this.preGoalPermissionMode = next.saved, next.mode !== getPermissionMode() && this.applyPermissionMode(next.mode, { silent: !0 });
9249
9626
  }
9250
9627
  applyPermissionMode(mode, opts) {
9628
+ if (this.runtimeHost.isDetached || this.transferInProgress)
9629
+ return;
9630
+ this.sessionManager.setPermissionMode(mode), recordTuiActivity(this.sessionManager, this.runtimeHost.services.agentDir);
9251
9631
  let prev = getPermissionMode();
9252
9632
  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}`));
9253
9633
  }
@@ -9433,6 +9813,10 @@ ${toggleThinking ? `| \`${toggleThinking}\` | Toggle thinking block visibility |
9433
9813
  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();
9434
9814
  }
9435
9815
  async handleClearCommand() {
9816
+ if (this.runtimeHost.isDetached || this.transferInProgress) {
9817
+ this.showError("Use /reclaim first, or /quit to leave this terminal.");
9818
+ return;
9819
+ }
9436
9820
  this.clearStatusIndicator(), this.ui.setChatScroll(0), await this.waitForDeferredBuiltins();
9437
9821
  let previousModel = this.session.model;
9438
9822
  try {
@@ -9451,7 +9835,7 @@ ${toggleThinking ? `| \`${toggleThinking}\` | Toggle thinking block visibility |
9451
9835
  "",
9452
9836
  "=== All rendered lines with visible widths ===",
9453
9837
  ...allLines.map((line, idx) => {
9454
- let vw = visibleWidth4(line), escaped = JSON.stringify(line);
9838
+ let vw = visibleWidth6(line), escaped = JSON.stringify(line);
9455
9839
  return `[${idx}] (w=${vw}) ${escaped}`;
9456
9840
  }),
9457
9841
  "",
@@ -9504,7 +9888,7 @@ ${theme.fg("muted", debugLogPath)}`, 1, 1)), this.ui.requestRender();
9504
9888
  }
9505
9889
  }
9506
9890
  stop() {
9507
- 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();
9891
+ 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();
9508
9892
  }
9509
9893
  };
9510
9894