@bastani/atomic 0.10.2-alpha.1 → 0.10.3-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (499) hide show
  1. package/CHANGELOG.md +112 -0
  2. package/dist/builtin/intercom/CHANGELOG.md +17 -0
  3. package/dist/builtin/intercom/broker/broker-instance.ts +2 -13
  4. package/dist/builtin/intercom/broker/broker.ts +158 -73
  5. package/dist/builtin/intercom/broker/durable-ended-queue.ts +14 -2
  6. package/dist/builtin/intercom/broker/host-command-environment.ts +13 -0
  7. package/dist/builtin/intercom/broker/hosted-session-errors.ts +1 -0
  8. package/dist/builtin/intercom/broker/multinode-router.ts +111 -16
  9. package/dist/builtin/intercom/broker/multinode-state-store.ts +50 -4
  10. package/dist/builtin/intercom/broker/open-broker-state.ts +5 -4
  11. package/dist/builtin/intercom/broker/spawn.ts +144 -25
  12. package/dist/builtin/intercom/broker/sql-add-column.ts +33 -0
  13. package/dist/builtin/intercom/broker/sql-known-session-store.ts +120 -36
  14. package/dist/builtin/intercom/broker/sql-outbox-store.ts +75 -13
  15. package/dist/builtin/intercom/broker/start-announcement.ts +55 -10
  16. package/dist/builtin/intercom/broker/watchdog.ts +10 -7
  17. package/dist/builtin/intercom/index.bundle.mjs +111 -27
  18. package/dist/builtin/intercom/package.json +1 -1
  19. package/dist/builtin/mcp/package.json +1 -1
  20. package/dist/builtin/subagents/CHANGELOG.md +29 -0
  21. package/dist/builtin/subagents/package.json +1 -1
  22. package/dist/builtin/subagents/skills/skill-creator/SKILL.md +30 -52
  23. package/dist/builtin/subagents/skills/skill-creator/eval-viewer/generate_review.py +34 -40
  24. package/dist/builtin/subagents/skills/skill-creator/eval-viewer/viewer.html +2 -2
  25. package/dist/builtin/subagents/skills/skill-creator/scripts/atomic_cli.py +668 -0
  26. package/dist/builtin/subagents/skills/skill-creator/scripts/generate_report.py +3 -3
  27. package/dist/builtin/subagents/skills/skill-creator/scripts/improve_description.py +42 -38
  28. package/dist/builtin/subagents/skills/skill-creator/scripts/run_eval.py +268 -176
  29. package/dist/builtin/subagents/skills/skill-creator/scripts/run_loop.py +20 -11
  30. package/dist/builtin/subagents/skills/skill-creator/scripts/utils.py +1 -1
  31. package/dist/builtin/subagents/src/extension/index.bundle.mjs +163 -97
  32. package/dist/builtin/web-access/CHANGELOG.md +14 -0
  33. package/dist/builtin/web-access/index.bundle.mjs +5 -4
  34. package/dist/builtin/web-access/package.json +1 -1
  35. package/dist/core/agent-session-auto-compaction.d.ts +10 -1
  36. package/dist/core/agent-session-auto-compaction.d.ts.map +1 -1
  37. package/dist/core/agent-session-auto-compaction.js +54 -2
  38. package/dist/core/agent-session-auto-compaction.js.map +1 -1
  39. package/dist/core/agent-session-compaction.d.ts +4 -0
  40. package/dist/core/agent-session-compaction.d.ts.map +1 -1
  41. package/dist/core/agent-session-compaction.js +17 -2
  42. package/dist/core/agent-session-compaction.js.map +1 -1
  43. package/dist/core/agent-session-custom-message-commit.d.ts.map +1 -1
  44. package/dist/core/agent-session-custom-message-commit.js +3 -1
  45. package/dist/core/agent-session-custom-message-commit.js.map +1 -1
  46. package/dist/core/agent-session-events.d.ts +2 -0
  47. package/dist/core/agent-session-events.d.ts.map +1 -1
  48. package/dist/core/agent-session-events.js +34 -13
  49. package/dist/core/agent-session-events.js.map +1 -1
  50. package/dist/core/agent-session-export.d.ts.map +1 -1
  51. package/dist/core/agent-session-export.js +3 -0
  52. package/dist/core/agent-session-export.js.map +1 -1
  53. package/dist/core/agent-session-message-queue.d.ts +27 -0
  54. package/dist/core/agent-session-message-queue.d.ts.map +1 -1
  55. package/dist/core/agent-session-message-queue.js +213 -30
  56. package/dist/core/agent-session-message-queue.js.map +1 -1
  57. package/dist/core/agent-session-methods.d.ts +6 -1
  58. package/dist/core/agent-session-methods.d.ts.map +1 -1
  59. package/dist/core/agent-session-methods.js.map +1 -1
  60. package/dist/core/agent-session-prompt.d.ts.map +1 -1
  61. package/dist/core/agent-session-prompt.js +35 -3
  62. package/dist/core/agent-session-prompt.js.map +1 -1
  63. package/dist/core/agent-session-runtime.d.ts.map +1 -1
  64. package/dist/core/agent-session-runtime.js +2 -2
  65. package/dist/core/agent-session-runtime.js.map +1 -1
  66. package/dist/core/agent-session-state.d.ts.map +1 -1
  67. package/dist/core/agent-session-state.js +6 -1
  68. package/dist/core/agent-session-state.js.map +1 -1
  69. package/dist/core/agent-session-tool-hooks.d.ts.map +1 -1
  70. package/dist/core/agent-session-tool-hooks.js +15 -2
  71. package/dist/core/agent-session-tool-hooks.js.map +1 -1
  72. package/dist/core/agent-session-typed-queue.d.ts +14 -1
  73. package/dist/core/agent-session-typed-queue.d.ts.map +1 -1
  74. package/dist/core/agent-session-typed-queue.js +26 -1
  75. package/dist/core/agent-session-typed-queue.js.map +1 -1
  76. package/dist/core/agent-session-types.d.ts +5 -0
  77. package/dist/core/agent-session-types.d.ts.map +1 -1
  78. package/dist/core/agent-session-types.js.map +1 -1
  79. package/dist/core/agent-session.d.ts.map +1 -1
  80. package/dist/core/agent-session.js +2 -1
  81. package/dist/core/agent-session.js.map +1 -1
  82. package/dist/core/async-scope.d.ts +9 -4
  83. package/dist/core/async-scope.d.ts.map +1 -1
  84. package/dist/core/async-scope.js +13 -5
  85. package/dist/core/async-scope.js.map +1 -1
  86. package/dist/core/builtin-diagnostics.js +2 -2
  87. package/dist/core/builtin-diagnostics.js.map +1 -1
  88. package/dist/core/chat-admission-order.d.ts.map +1 -1
  89. package/dist/core/chat-admission-order.js +2 -1
  90. package/dist/core/chat-admission-order.js.map +1 -1
  91. package/dist/core/chat-record-saves.d.ts +4 -0
  92. package/dist/core/chat-record-saves.d.ts.map +1 -0
  93. package/dist/core/chat-record-saves.js +25 -0
  94. package/dist/core/chat-record-saves.js.map +1 -0
  95. package/dist/core/command-deliveries.d.ts +62 -0
  96. package/dist/core/command-deliveries.d.ts.map +1 -0
  97. package/dist/core/command-deliveries.js +139 -0
  98. package/dist/core/command-deliveries.js.map +1 -0
  99. package/dist/core/diagnostic-writer.d.ts.map +1 -1
  100. package/dist/core/diagnostic-writer.js +5 -4
  101. package/dist/core/diagnostic-writer.js.map +1 -1
  102. package/dist/core/extension-startup-close.d.ts +1 -2
  103. package/dist/core/extension-startup-close.d.ts.map +1 -1
  104. package/dist/core/extension-startup-close.js +2 -2
  105. package/dist/core/extension-startup-close.js.map +1 -1
  106. package/dist/core/extensions/jiti-aliases.d.ts +11 -0
  107. package/dist/core/extensions/jiti-aliases.d.ts.map +1 -0
  108. package/dist/core/extensions/jiti-aliases.js +28 -0
  109. package/dist/core/extensions/jiti-aliases.js.map +1 -0
  110. package/dist/core/extensions/loader-api.js +3 -3
  111. package/dist/core/extensions/loader-api.js.map +1 -1
  112. package/dist/core/extensions/loader-bindings.js +2 -2
  113. package/dist/core/extensions/loader-bindings.js.map +1 -1
  114. package/dist/core/extensions/loader-rollback.d.ts +1 -2
  115. package/dist/core/extensions/loader-rollback.d.ts.map +1 -1
  116. package/dist/core/extensions/loader-rollback.js +2 -2
  117. package/dist/core/extensions/loader-rollback.js.map +1 -1
  118. package/dist/core/extensions/loader-virtual-modules.d.ts.map +1 -1
  119. package/dist/core/extensions/loader-virtual-modules.js +53 -9
  120. package/dist/core/extensions/loader-virtual-modules.js.map +1 -1
  121. package/dist/core/extensions/native-builtin-entries.d.ts +5 -0
  122. package/dist/core/extensions/native-builtin-entries.d.ts.map +1 -1
  123. package/dist/core/extensions/native-builtin-entries.js +8 -1
  124. package/dist/core/extensions/native-builtin-entries.js.map +1 -1
  125. package/dist/core/extensions/reloadable-scripts.d.ts +21 -2
  126. package/dist/core/extensions/reloadable-scripts.d.ts.map +1 -1
  127. package/dist/core/extensions/reloadable-scripts.js +11 -3
  128. package/dist/core/extensions/reloadable-scripts.js.map +1 -1
  129. package/dist/core/extensions/source-builtin-imports.d.ts +40 -0
  130. package/dist/core/extensions/source-builtin-imports.d.ts.map +1 -0
  131. package/dist/core/extensions/source-builtin-imports.js +142 -0
  132. package/dist/core/extensions/source-builtin-imports.js.map +1 -0
  133. package/dist/core/extensions/transform-graph.d.ts +15 -0
  134. package/dist/core/extensions/transform-graph.d.ts.map +1 -0
  135. package/dist/core/extensions/transform-graph.js +85 -0
  136. package/dist/core/extensions/transform-graph.js.map +1 -0
  137. package/dist/core/extensions/ts-source-specifiers.d.ts +2 -0
  138. package/dist/core/extensions/ts-source-specifiers.d.ts.map +1 -1
  139. package/dist/core/extensions/ts-source-specifiers.js +7 -0
  140. package/dist/core/extensions/ts-source-specifiers.js.map +1 -1
  141. package/dist/core/extensions/ts-transform-worker.d.ts +2 -0
  142. package/dist/core/extensions/ts-transform-worker.d.ts.map +1 -0
  143. package/dist/core/extensions/ts-transform-worker.js +43 -0
  144. package/dist/core/extensions/ts-transform-worker.js.map +1 -0
  145. package/dist/core/message-admission.d.ts.map +1 -1
  146. package/dist/core/message-admission.js +4 -4
  147. package/dist/core/message-admission.js.map +1 -1
  148. package/dist/core/messages.d.ts +5 -0
  149. package/dist/core/messages.d.ts.map +1 -1
  150. package/dist/core/messages.js +35 -0
  151. package/dist/core/messages.js.map +1 -1
  152. package/dist/core/model-fallback-failures.d.ts +1 -1
  153. package/dist/core/model-fallback-failures.d.ts.map +1 -1
  154. package/dist/core/model-fallback-failures.js +18 -1
  155. package/dist/core/model-fallback-failures.js.map +1 -1
  156. package/dist/core/process-start-token.d.ts +7 -0
  157. package/dist/core/process-start-token.d.ts.map +1 -1
  158. package/dist/core/process-start-token.js +14 -0
  159. package/dist/core/process-start-token.js.map +1 -1
  160. package/dist/core/project-trust-electorate.d.ts +24 -0
  161. package/dist/core/project-trust-electorate.d.ts.map +1 -0
  162. package/dist/core/project-trust-electorate.js +52 -0
  163. package/dist/core/project-trust-electorate.js.map +1 -0
  164. package/dist/core/project-trust-state.d.ts +15 -0
  165. package/dist/core/project-trust-state.d.ts.map +1 -1
  166. package/dist/core/project-trust-state.js +15 -0
  167. package/dist/core/project-trust-state.js.map +1 -1
  168. package/dist/core/provider-request-admission.d.ts.map +1 -1
  169. package/dist/core/provider-request-admission.js +2 -2
  170. package/dist/core/provider-request-admission.js.map +1 -1
  171. package/dist/core/queued-input-admission.js +2 -2
  172. package/dist/core/queued-input-admission.js.map +1 -1
  173. package/dist/core/queued-message-delivery.d.ts +2 -2
  174. package/dist/core/queued-message-delivery.d.ts.map +1 -1
  175. package/dist/core/queued-message-delivery.js +6 -3
  176. package/dist/core/queued-message-delivery.js.map +1 -1
  177. package/dist/core/resource-admission-scope.js +2 -2
  178. package/dist/core/resource-admission-scope.js.map +1 -1
  179. package/dist/core/resume/blueprint/process.d.ts +3 -4
  180. package/dist/core/resume/blueprint/process.d.ts.map +1 -1
  181. package/dist/core/resume/blueprint/process.js +33 -17
  182. package/dist/core/resume/blueprint/process.js.map +1 -1
  183. package/dist/core/resume/path-mapping.js +4 -4
  184. package/dist/core/resume/path-mapping.js.map +1 -1
  185. package/dist/core/resume/session-resume.d.ts +9 -0
  186. package/dist/core/resume/session-resume.d.ts.map +1 -1
  187. package/dist/core/resume/session-resume.js +27 -2
  188. package/dist/core/resume/session-resume.js.map +1 -1
  189. package/dist/core/resume-cache-checkpoint.d.ts +27 -1
  190. package/dist/core/resume-cache-checkpoint.d.ts.map +1 -1
  191. package/dist/core/resume-cache-checkpoint.js +45 -0
  192. package/dist/core/resume-cache-checkpoint.js.map +1 -1
  193. package/dist/core/sdk.d.ts.map +1 -1
  194. package/dist/core/sdk.js +7 -31
  195. package/dist/core/sdk.js.map +1 -1
  196. package/dist/core/session-lifecycle-scope.d.ts +1 -2
  197. package/dist/core/session-lifecycle-scope.d.ts.map +1 -1
  198. package/dist/core/session-lifecycle-scope.js +2 -2
  199. package/dist/core/session-lifecycle-scope.js.map +1 -1
  200. package/dist/core/session-lifecycle-work.js +2 -2
  201. package/dist/core/session-lifecycle-work.js.map +1 -1
  202. package/dist/core/session-manager-core.d.ts.map +1 -1
  203. package/dist/core/session-manager-core.js +3 -0
  204. package/dist/core/session-manager-core.js.map +1 -1
  205. package/dist/core/session-storage.d.ts +12 -0
  206. package/dist/core/session-storage.d.ts.map +1 -1
  207. package/dist/core/session-storage.js +68 -1
  208. package/dist/core/session-storage.js.map +1 -1
  209. package/dist/core/settings-lock-directory.d.ts.map +1 -1
  210. package/dist/core/settings-lock-directory.js +4 -3
  211. package/dist/core/settings-lock-directory.js.map +1 -1
  212. package/dist/core/settings-write-ownership.d.ts +1 -2
  213. package/dist/core/settings-write-ownership.d.ts.map +1 -1
  214. package/dist/core/settings-write-ownership.js +2 -2
  215. package/dist/core/settings-write-ownership.js.map +1 -1
  216. package/dist/core/storage/node-sqlite-thread.d.ts.map +1 -1
  217. package/dist/core/storage/node-sqlite-thread.js +6 -4
  218. package/dist/core/storage/node-sqlite-thread.js.map +1 -1
  219. package/dist/core/storage/node-sqlite.d.ts.map +1 -1
  220. package/dist/core/storage/node-sqlite.js +22 -8
  221. package/dist/core/storage/node-sqlite.js.map +1 -1
  222. package/dist/core/system-prompt.d.ts +16 -2
  223. package/dist/core/system-prompt.d.ts.map +1 -1
  224. package/dist/core/system-prompt.js +33 -6
  225. package/dist/core/system-prompt.js.map +1 -1
  226. package/dist/core/tasks/agent-adapter.d.ts.map +1 -1
  227. package/dist/core/tasks/agent-adapter.js +2 -1
  228. package/dist/core/tasks/agent-adapter.js.map +1 -1
  229. package/dist/core/tasks/completion.d.ts +3 -2
  230. package/dist/core/tasks/completion.d.ts.map +1 -1
  231. package/dist/core/tasks/completion.js.map +1 -1
  232. package/dist/core/tasks/execution-scope.js +2 -2
  233. package/dist/core/tasks/execution-scope.js.map +1 -1
  234. package/dist/core/tools/bash.d.ts.map +1 -1
  235. package/dist/core/tools/bash.js +2 -1
  236. package/dist/core/tools/bash.js.map +1 -1
  237. package/dist/core/tools/history-regex-worker.d.ts.map +1 -1
  238. package/dist/core/tools/history-regex-worker.js +3 -2
  239. package/dist/core/tools/history-regex-worker.js.map +1 -1
  240. package/dist/core/tools/shell-task-render.d.ts +3 -2
  241. package/dist/core/tools/shell-task-render.d.ts.map +1 -1
  242. package/dist/core/tools/shell-task-render.js +7 -5
  243. package/dist/core/tools/shell-task-render.js.map +1 -1
  244. package/dist/core/tools/shell-task-status.d.ts +6 -2
  245. package/dist/core/tools/shell-task-status.d.ts.map +1 -1
  246. package/dist/core/tools/shell-task-status.js +13 -8
  247. package/dist/core/tools/shell-task-status.js.map +1 -1
  248. package/dist/core/tools/sqlite-selector-connection.d.ts.map +1 -1
  249. package/dist/core/tools/sqlite-selector-connection.js +4 -3
  250. package/dist/core/tools/sqlite-selector-connection.js.map +1 -1
  251. package/dist/core/tools/windows-directory-security.d.ts.map +1 -1
  252. package/dist/core/tools/windows-directory-security.js +2 -1
  253. package/dist/core/tools/windows-directory-security.js.map +1 -1
  254. package/dist/core/worktree-snapshot/git.js +2 -2
  255. package/dist/core/worktree-snapshot/git.js.map +1 -1
  256. package/dist/extensions/mcp/index.d.ts +6 -1
  257. package/dist/extensions/mcp/index.d.ts.map +1 -1
  258. package/dist/extensions/mcp/index.js +150 -18
  259. package/dist/extensions/mcp/index.js.map +1 -1
  260. package/dist/extensions/mcp/tool-records.d.ts +44 -9
  261. package/dist/extensions/mcp/tool-records.d.ts.map +1 -1
  262. package/dist/extensions/mcp/tool-records.js +58 -16
  263. package/dist/extensions/mcp/tool-records.js.map +1 -1
  264. package/dist/index.d.ts +2 -0
  265. package/dist/index.d.ts.map +1 -1
  266. package/dist/index.js +4 -0
  267. package/dist/index.js.map +1 -1
  268. package/dist/main-session.d.ts +3 -1
  269. package/dist/main-session.d.ts.map +1 -1
  270. package/dist/main-session.js +1 -0
  271. package/dist/main-session.js.map +1 -1
  272. package/dist/main.d.ts.map +1 -1
  273. package/dist/main.js +230 -96
  274. package/dist/main.js.map +1 -1
  275. package/dist/modes/interactive/agent-view/agent-view-bridge.d.ts +5 -0
  276. package/dist/modes/interactive/agent-view/agent-view-bridge.d.ts.map +1 -1
  277. package/dist/modes/interactive/agent-view/agent-view-bridge.js.map +1 -1
  278. package/dist/modes/interactive/agent-view/agent-view-switcher.d.ts +5 -2
  279. package/dist/modes/interactive/agent-view/agent-view-switcher.d.ts.map +1 -1
  280. package/dist/modes/interactive/agent-view/agent-view-switcher.js +3 -3
  281. package/dist/modes/interactive/agent-view/agent-view-switcher.js.map +1 -1
  282. package/dist/modes/interactive/agent-view/contracts.d.ts +6 -0
  283. package/dist/modes/interactive/agent-view/contracts.d.ts.map +1 -1
  284. package/dist/modes/interactive/agent-view/contracts.js.map +1 -1
  285. package/dist/modes/interactive/agent-view/install.d.ts.map +1 -1
  286. package/dist/modes/interactive/agent-view/install.js +2 -1
  287. package/dist/modes/interactive/agent-view/install.js.map +1 -1
  288. package/dist/modes/interactive/agent-view/open-port.d.ts +4 -2
  289. package/dist/modes/interactive/agent-view/open-port.d.ts.map +1 -1
  290. package/dist/modes/interactive/agent-view/open-port.js +4 -3
  291. package/dist/modes/interactive/agent-view/open-port.js.map +1 -1
  292. package/dist/modes/interactive/agent-view/prompt-retarget.d.ts.map +1 -1
  293. package/dist/modes/interactive/agent-view/prompt-retarget.js +18 -5
  294. package/dist/modes/interactive/agent-view/prompt-retarget.js.map +1 -1
  295. package/dist/modes/interactive/agent-view/remote-port.d.ts +10 -1
  296. package/dist/modes/interactive/agent-view/remote-port.d.ts.map +1 -1
  297. package/dist/modes/interactive/agent-view/remote-port.js +36 -4
  298. package/dist/modes/interactive/agent-view/remote-port.js.map +1 -1
  299. package/dist/modes/interactive/agent-view/viewed-keys.d.ts +56 -0
  300. package/dist/modes/interactive/agent-view/viewed-keys.d.ts.map +1 -0
  301. package/dist/modes/interactive/agent-view/viewed-keys.js +63 -0
  302. package/dist/modes/interactive/agent-view/viewed-keys.js.map +1 -0
  303. package/dist/modes/interactive/agent-view/viewed-submit.d.ts +14 -4
  304. package/dist/modes/interactive/agent-view/viewed-submit.d.ts.map +1 -1
  305. package/dist/modes/interactive/agent-view/viewed-submit.js +51 -17
  306. package/dist/modes/interactive/agent-view/viewed-submit.js.map +1 -1
  307. package/dist/modes/interactive/components/agent-panel.d.ts.map +1 -1
  308. package/dist/modes/interactive/components/agent-panel.js +8 -21
  309. package/dist/modes/interactive/components/agent-panel.js.map +1 -1
  310. package/dist/modes/interactive/components/chat-session-host-actions.d.ts.map +1 -1
  311. package/dist/modes/interactive/components/chat-session-host-actions.js +18 -5
  312. package/dist/modes/interactive/components/chat-session-host-actions.js.map +1 -1
  313. package/dist/modes/interactive/components/chat-session-host-rendering.d.ts.map +1 -1
  314. package/dist/modes/interactive/components/chat-session-host-rendering.js +6 -0
  315. package/dist/modes/interactive/components/chat-session-host-rendering.js.map +1 -1
  316. package/dist/modes/interactive/components/chat-session-host-state.d.ts +1 -0
  317. package/dist/modes/interactive/components/chat-session-host-state.d.ts.map +1 -1
  318. package/dist/modes/interactive/components/chat-session-host-state.js +2 -0
  319. package/dist/modes/interactive/components/chat-session-host-state.js.map +1 -1
  320. package/dist/modes/interactive/components/chat-session-host-types.d.ts +5 -0
  321. package/dist/modes/interactive/components/chat-session-host-types.d.ts.map +1 -1
  322. package/dist/modes/interactive/components/chat-session-host-types.js.map +1 -1
  323. package/dist/modes/interactive/components/custom-editor.d.ts +33 -2
  324. package/dist/modes/interactive/components/custom-editor.d.ts.map +1 -1
  325. package/dist/modes/interactive/components/custom-editor.js +58 -2
  326. package/dist/modes/interactive/components/custom-editor.js.map +1 -1
  327. package/dist/modes/interactive/components/host-session-picker.js +2 -2
  328. package/dist/modes/interactive/components/host-session-picker.js.map +1 -1
  329. package/dist/modes/interactive/components/main-composer-keys.d.ts +16 -5
  330. package/dist/modes/interactive/components/main-composer-keys.d.ts.map +1 -1
  331. package/dist/modes/interactive/components/main-composer-keys.js +27 -8
  332. package/dist/modes/interactive/components/main-composer-keys.js.map +1 -1
  333. package/dist/modes/interactive/components/notice-line.d.ts +8 -25
  334. package/dist/modes/interactive/components/notice-line.d.ts.map +1 -1
  335. package/dist/modes/interactive/components/notice-line.js +18 -17
  336. package/dist/modes/interactive/components/notice-line.js.map +1 -1
  337. package/dist/modes/interactive/components/prompt-slot.d.ts +20 -3
  338. package/dist/modes/interactive/components/prompt-slot.d.ts.map +1 -1
  339. package/dist/modes/interactive/components/prompt-slot.js +82 -32
  340. package/dist/modes/interactive/components/prompt-slot.js.map +1 -1
  341. package/dist/modes/interactive/components/queued-messages-view.d.ts +5 -2
  342. package/dist/modes/interactive/components/queued-messages-view.d.ts.map +1 -1
  343. package/dist/modes/interactive/components/queued-messages-view.js +12 -5
  344. package/dist/modes/interactive/components/queued-messages-view.js.map +1 -1
  345. package/dist/modes/interactive/components/task-board.d.ts +5 -8
  346. package/dist/modes/interactive/components/task-board.d.ts.map +1 -1
  347. package/dist/modes/interactive/components/task-board.js +5 -49
  348. package/dist/modes/interactive/components/task-board.js.map +1 -1
  349. package/dist/modes/interactive/components/task-completion-message.d.ts.map +1 -1
  350. package/dist/modes/interactive/components/task-completion-message.js +9 -2
  351. package/dist/modes/interactive/components/task-completion-message.js.map +1 -1
  352. package/dist/modes/interactive/components/task-marks.d.ts +19 -0
  353. package/dist/modes/interactive/components/task-marks.d.ts.map +1 -0
  354. package/dist/modes/interactive/components/task-marks.js +25 -0
  355. package/dist/modes/interactive/components/task-marks.js.map +1 -0
  356. package/dist/modes/interactive/components/task-row.d.ts +10 -2
  357. package/dist/modes/interactive/components/task-row.d.ts.map +1 -1
  358. package/dist/modes/interactive/components/task-row.js +39 -32
  359. package/dist/modes/interactive/components/task-row.js.map +1 -1
  360. package/dist/modes/interactive/components/task-transcript-page.d.ts +7 -0
  361. package/dist/modes/interactive/components/task-transcript-page.d.ts.map +1 -1
  362. package/dist/modes/interactive/components/task-transcript-page.js +106 -10
  363. package/dist/modes/interactive/components/task-transcript-page.js.map +1 -1
  364. package/dist/modes/interactive/components/tool-block-families.d.ts.map +1 -1
  365. package/dist/modes/interactive/components/tool-block-families.js +8 -9
  366. package/dist/modes/interactive/components/tool-block-families.js.map +1 -1
  367. package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  368. package/dist/modes/interactive/components/tool-execution.js +5 -1
  369. package/dist/modes/interactive/components/tool-execution.js.map +1 -1
  370. package/dist/modes/interactive/extension-command-hold.d.ts.map +1 -1
  371. package/dist/modes/interactive/extension-command-hold.js +5 -7
  372. package/dist/modes/interactive/extension-command-hold.js.map +1 -1
  373. package/dist/modes/interactive/interactive-extension-dialogs.js +6 -1
  374. package/dist/modes/interactive/interactive-extension-dialogs.js.map +1 -1
  375. package/dist/modes/interactive/interactive-extension-runtime.d.ts.map +1 -1
  376. package/dist/modes/interactive/interactive-extension-runtime.js +21 -7
  377. package/dist/modes/interactive/interactive-extension-runtime.js.map +1 -1
  378. package/dist/modes/interactive/interactive-initial-session-binding.d.ts +1 -2
  379. package/dist/modes/interactive/interactive-initial-session-binding.d.ts.map +1 -1
  380. package/dist/modes/interactive/interactive-initial-session-binding.js +2 -2
  381. package/dist/modes/interactive/interactive-initial-session-binding.js.map +1 -1
  382. package/dist/modes/interactive/interactive-input-handling.d.ts.map +1 -1
  383. package/dist/modes/interactive/interactive-input-handling.js +13 -4
  384. package/dist/modes/interactive/interactive-input-handling.js.map +1 -1
  385. package/dist/modes/interactive/interactive-mode-base.d.ts +2 -1
  386. package/dist/modes/interactive/interactive-mode-base.d.ts.map +1 -1
  387. package/dist/modes/interactive/interactive-mode-base.js +6 -1
  388. package/dist/modes/interactive/interactive-mode-base.js.map +1 -1
  389. package/dist/modes/interactive/interactive-mode-helpers.d.ts +4 -2
  390. package/dist/modes/interactive/interactive-mode-helpers.d.ts.map +1 -1
  391. package/dist/modes/interactive/interactive-mode-helpers.js +6 -0
  392. package/dist/modes/interactive/interactive-mode-helpers.js.map +1 -1
  393. package/dist/modes/interactive/interactive-mode-surface.d.ts +5 -0
  394. package/dist/modes/interactive/interactive-mode-surface.d.ts.map +1 -1
  395. package/dist/modes/interactive/interactive-mode-surface.js.map +1 -1
  396. package/dist/modes/interactive/interactive-process-lifecycle.js +96 -17
  397. package/dist/modes/interactive/interactive-process-lifecycle.js.map +1 -1
  398. package/dist/modes/interactive/interactive-queueing.d.ts +5 -0
  399. package/dist/modes/interactive/interactive-queueing.d.ts.map +1 -1
  400. package/dist/modes/interactive/interactive-queueing.js +37 -5
  401. package/dist/modes/interactive/interactive-queueing.js.map +1 -1
  402. package/dist/modes/interactive/interactive-render-chat.d.ts.map +1 -1
  403. package/dist/modes/interactive/interactive-render-chat.js +45 -4
  404. package/dist/modes/interactive/interactive-render-chat.js.map +1 -1
  405. package/dist/modes/interactive/interactive-resource-disclosure.d.ts +4 -1
  406. package/dist/modes/interactive/interactive-resource-disclosure.d.ts.map +1 -1
  407. package/dist/modes/interactive/interactive-resource-disclosure.js +20 -1
  408. package/dist/modes/interactive/interactive-resource-disclosure.js.map +1 -1
  409. package/dist/modes/interactive/interactive-resource-rendering.js +3 -0
  410. package/dist/modes/interactive/interactive-resource-rendering.js.map +1 -1
  411. package/dist/modes/interactive/interactive-startup.d.ts.map +1 -1
  412. package/dist/modes/interactive/interactive-startup.js +43 -5
  413. package/dist/modes/interactive/interactive-startup.js.map +1 -1
  414. package/dist/modes/interactive-engine/activity-watchdog.d.ts +6 -3
  415. package/dist/modes/interactive-engine/activity-watchdog.d.ts.map +1 -1
  416. package/dist/modes/interactive-engine/activity-watchdog.js +3 -2
  417. package/dist/modes/interactive-engine/activity-watchdog.js.map +1 -1
  418. package/dist/modes/interactive-engine/engine-health.d.ts +2 -0
  419. package/dist/modes/interactive-engine/engine-health.d.ts.map +1 -1
  420. package/dist/modes/interactive-engine/engine-health.js.map +1 -1
  421. package/dist/modes/interactive-engine/engine-quit-intent.d.ts +10 -0
  422. package/dist/modes/interactive-engine/engine-quit-intent.d.ts.map +1 -1
  423. package/dist/modes/interactive-engine/engine-quit-intent.js +33 -0
  424. package/dist/modes/interactive-engine/engine-quit-intent.js.map +1 -1
  425. package/dist/modes/interactive-engine/extension-ui-bridge.d.ts +7 -1
  426. package/dist/modes/interactive-engine/extension-ui-bridge.d.ts.map +1 -1
  427. package/dist/modes/interactive-engine/extension-ui-bridge.js +15 -2
  428. package/dist/modes/interactive-engine/extension-ui-bridge.js.map +1 -1
  429. package/dist/modes/interactive-engine/host-listener-failures.d.ts +24 -0
  430. package/dist/modes/interactive-engine/host-listener-failures.d.ts.map +1 -0
  431. package/dist/modes/interactive-engine/host-listener-failures.js +98 -0
  432. package/dist/modes/interactive-engine/host-listener-failures.js.map +1 -0
  433. package/dist/modes/interactive-engine/isolated-runtime.d.ts +16 -0
  434. package/dist/modes/interactive-engine/isolated-runtime.d.ts.map +1 -1
  435. package/dist/modes/interactive-engine/isolated-runtime.js +74 -7
  436. package/dist/modes/interactive-engine/isolated-runtime.js.map +1 -1
  437. package/dist/modes/interactive-engine/protocol.d.ts +5 -0
  438. package/dist/modes/interactive-engine/protocol.d.ts.map +1 -1
  439. package/dist/modes/interactive-engine/protocol.js +8 -2
  440. package/dist/modes/interactive-engine/protocol.js.map +1 -1
  441. package/dist/modes/interactive-engine/remote-component.d.ts +13 -0
  442. package/dist/modes/interactive-engine/remote-component.d.ts.map +1 -1
  443. package/dist/modes/interactive-engine/remote-component.js +69 -4
  444. package/dist/modes/interactive-engine/remote-component.js.map +1 -1
  445. package/dist/modes/print-mode.d.ts.map +1 -1
  446. package/dist/modes/print-mode.js +34 -6
  447. package/dist/modes/print-mode.js.map +1 -1
  448. package/dist/modes/rpc/agent-panel-bridge.d.ts +7 -0
  449. package/dist/modes/rpc/agent-panel-bridge.d.ts.map +1 -1
  450. package/dist/modes/rpc/agent-panel-bridge.js +11 -1
  451. package/dist/modes/rpc/agent-panel-bridge.js.map +1 -1
  452. package/dist/modes/rpc/agent-view-rpc-panel.d.ts.map +1 -1
  453. package/dist/modes/rpc/agent-view-rpc-panel.js +11 -5
  454. package/dist/modes/rpc/agent-view-rpc-panel.js.map +1 -1
  455. package/dist/modes/rpc/rpc-client-process.d.ts +8 -1
  456. package/dist/modes/rpc/rpc-client-process.d.ts.map +1 -1
  457. package/dist/modes/rpc/rpc-client-process.js +89 -65
  458. package/dist/modes/rpc/rpc-client-process.js.map +1 -1
  459. package/dist/modes/rpc/rpc-client.d.ts +21 -0
  460. package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
  461. package/dist/modes/rpc/rpc-client.js +77 -33
  462. package/dist/modes/rpc/rpc-client.js.map +1 -1
  463. package/dist/modes/rpc/rpc-event-buffer.d.ts +5 -0
  464. package/dist/modes/rpc/rpc-event-buffer.d.ts.map +1 -1
  465. package/dist/modes/rpc/rpc-event-buffer.js +8 -2
  466. package/dist/modes/rpc/rpc-event-buffer.js.map +1 -1
  467. package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
  468. package/dist/modes/rpc/rpc-mode.js +9 -2
  469. package/dist/modes/rpc/rpc-mode.js.map +1 -1
  470. package/dist/utils/shell.d.ts +5 -1
  471. package/dist/utils/shell.d.ts.map +1 -1
  472. package/dist/utils/shell.js +14 -7
  473. package/dist/utils/shell.js.map +1 -1
  474. package/dist/utils/worker-threads.d.ts +10 -4
  475. package/dist/utils/worker-threads.d.ts.map +1 -1
  476. package/dist/utils/worker-threads.js +10 -4
  477. package/dist/utils/worker-threads.js.map +1 -1
  478. package/docs/background-tasks.md +10 -10
  479. package/docs/compaction.md +1 -0
  480. package/docs/development.md +1 -1
  481. package/docs/environment-variables.md +4 -0
  482. package/docs/extensions/api-reference.md +2 -0
  483. package/docs/extensions/events.md +1 -1
  484. package/docs/getting-started/installation.md +1 -0
  485. package/docs/guides/non-interactive.md +2 -0
  486. package/docs/guides/resume-on-any-machine.md +3 -1
  487. package/docs/intercom/reference.md +1 -1
  488. package/docs/keybindings.md +6 -5
  489. package/docs/libraries/ai.md +2 -1
  490. package/docs/mcp-servers.md +1 -1
  491. package/docs/sdk/reference.md +1 -1
  492. package/docs/sdk.md +6 -0
  493. package/docs/security.md +4 -2
  494. package/docs/settings.md +2 -1
  495. package/docs/storage.md +2 -0
  496. package/docs/subagents.md +2 -2
  497. package/docs/tui/reference.md +3 -1
  498. package/npm-shrinkwrap.json +49 -49
  499. package/package.json +6 -6
@@ -17,6 +17,11 @@ export interface AgentViewRequestOptions {
17
17
  * is shown or cannot be, so the main chat's prompt is never painted in between.
18
18
  */
19
19
  readonly keepScreen?: boolean;
20
+ /**
21
+ * With `keepScreen`: what asked for it hid the agent panel and shows it again as it closes, in another process. The
22
+ * subagent is shown once that panel can draw too, so the screen never shows it without the panel's rows.
23
+ */
24
+ readonly panel?: boolean;
20
25
  }
21
26
  /** Attach `bridge` to `session` and its owner task store, or detach it with undefined. */
22
27
  export declare function setAgentViewBridge(session: object, bridge: AgentViewBridge | undefined): void;
@@ -1 +1 @@
1
- {"version":3,"file":"agent-view-bridge.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/agent-view/agent-view-bridge.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAC;AAG/D;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC/B,mFAAmF;IACnF,YAAY,IAAI,MAAM,GAAG,SAAS,CAAC;IACnC,iHAAiH;IACjH,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,EAAE,OAAO,CAAC,EAAE,uBAAuB,GAAG,IAAI,CAAC;IACjF,SAAS,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC;CAC5C;AAED,MAAM,WAAW,uBAAuB;IACvC;;;OAGG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC;CAC9B;AAID,0FAA0F;AAC1F,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,eAAe,GAAG,SAAS,GAAG,IAAI,CAM7F;AAED,yFAAyF;AACzF,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS,CAK5E"}
1
+ {"version":3,"file":"agent-view-bridge.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/agent-view/agent-view-bridge.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kCAA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O,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;IAC/B,CAAC;AACF,CAAC;AAED,yFAAyF;AACzF,MAAM,UAAU,eAAe,CAAC,OAAe;IAC9C,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACpC,IAAI,MAAM,KAAK,SAAS;QAAE,OAAO,MAAM,CAAC;IACxC,MAAM,KAAK,GAAG,iBAAiB,CAAC,OAAO,CAAC,CAAC;IACzC,OAAO,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AAC7D,CAAC","sourcesContent":["import type { TaskId } from \"../../../core/tasks/contracts.js\";\nimport { getOwnerTaskStore } from \"../../../core/tasks/owner-store.js\";\n\n/**\n * How the agent panel and `/tasks` read and change what the screen shows, wherever they are drawn: in this process,\n * or in the isolated engine for the host. A session without a bridge keeps opening a subagent's chat page, as SDK\n * hosts do.\n */\nexport interface AgentViewBridge {\n\t/** The task id of the subagent the screen shows; undefined while it shows main. */\n\tviewedTaskId(): TaskId | undefined;\n\t/** Show the subagent `taskId` is an attempt of, or main when undefined. The host decides; nothing is awaited. */\n\trequestView(taskId: TaskId | undefined, options?: AgentViewRequestOptions): void;\n\tsubscribe(listener: () => void): () => void;\n}\n\nexport interface AgentViewRequestOptions {\n\t/**\n\t * The request closes what asked for it (`/tasks`): the prompt, footer and panel stay as painted until the subagent\n\t * is shown or cannot be, so the main chat's prompt is never painted in between.\n\t */\n\treadonly keepScreen?: boolean;\n}\n\nconst bridges = new WeakMap<object, AgentViewBridge>();\n\n/** Attach `bridge` to `session` and its owner task store, or detach it with undefined. */\nexport function setAgentViewBridge(session: object, bridge: AgentViewBridge | undefined): void {\n\tconst store = getOwnerTaskStore(session);\n\tfor (const key of store === undefined ? [session] : [session, store]) {\n\t\tif (bridge === undefined) bridges.delete(key);\n\t\telse bridges.set(key, bridge);\n\t}\n}\n\n/** The bridge of `session`, found through the session itself or its owner task store. */\nexport function agentViewBridge(session: object): AgentViewBridge | undefined {\n\tconst direct = bridges.get(session);\n\tif (direct !== undefined) return direct;\n\tconst store = getOwnerTaskStore(session);\n\treturn store === undefined ? undefined : bridges.get(store);\n}\n"]}
1
+ {"version":3,"file":"agent-view-bridge.js","sourceRoot":"","sources":["../../../../src/modes/interactive/agent-view/agent-view-bridge.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AA4BvE,MAAM,OAAO,GAAG,IAAI,OAAO,EAA2B,CAAC;AAEvD,0FAA0F;AAC1F,MAAM,UAAU,kBAAkB,CAAC,OAAe,EAAE,MAAmC;IACtF,MAAM,KAAK,GAAG,iBAAiB,CAAC,OAAO,CAAC,CAAC;IACzC,KAAK,MAAM,GAAG,IAAI,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC;QACtE,IAAI,MAAM,KAAK,SAAS;YAAE,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;;YACzC,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;IAC/B,CAAC;AACF,CAAC;AAED,yFAAyF;AACzF,MAAM,UAAU,eAAe,CAAC,OAAe;IAC9C,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACpC,IAAI,MAAM,KAAK,SAAS;QAAE,OAAO,MAAM,CAAC;IACxC,MAAM,KAAK,GAAG,iBAAiB,CAAC,OAAO,CAAC,CAAC;IACzC,OAAO,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AAC7D,CAAC","sourcesContent":["import type { TaskId } from \"../../../core/tasks/contracts.js\";\nimport { getOwnerTaskStore } from \"../../../core/tasks/owner-store.js\";\n\n/**\n * How the agent panel and `/tasks` read and change what the screen shows, wherever they are drawn: in this process,\n * or in the isolated engine for the host. A session without a bridge keeps opening a subagent's chat page, as SDK\n * hosts do.\n */\nexport interface AgentViewBridge {\n\t/** The task id of the subagent the screen shows; undefined while it shows main. */\n\tviewedTaskId(): TaskId | undefined;\n\t/** Show the subagent `taskId` is an attempt of, or main when undefined. The host decides; nothing is awaited. */\n\trequestView(taskId: TaskId | undefined, options?: AgentViewRequestOptions): void;\n\tsubscribe(listener: () => void): () => void;\n}\n\nexport interface AgentViewRequestOptions {\n\t/**\n\t * The request closes what asked for it (`/tasks`): the prompt, footer and panel stay as painted until the subagent\n\t * is shown or cannot be, so the main chat's prompt is never painted in between.\n\t */\n\treadonly keepScreen?: boolean;\n\t/**\n\t * With `keepScreen`: what asked for it hid the agent panel and shows it again as it closes, in another process. The\n\t * subagent is shown once that panel can draw too, so the screen never shows it without the panel's rows.\n\t */\n\treadonly panel?: boolean;\n}\n\nconst bridges = new WeakMap<object, AgentViewBridge>();\n\n/** Attach `bridge` to `session` and its owner task store, or detach it with undefined. */\nexport function setAgentViewBridge(session: object, bridge: AgentViewBridge | undefined): void {\n\tconst store = getOwnerTaskStore(session);\n\tfor (const key of store === undefined ? [session] : [session, store]) {\n\t\tif (bridge === undefined) bridges.delete(key);\n\t\telse bridges.set(key, bridge);\n\t}\n}\n\n/** The bridge of `session`, found through the session itself or its owner task store. */\nexport function agentViewBridge(session: object): AgentViewBridge | undefined {\n\tconst direct = bridges.get(session);\n\tif (direct !== undefined) return direct;\n\tconst store = getOwnerTaskStore(session);\n\treturn store === undefined ? undefined : bridges.get(store);\n}\n"]}
@@ -9,8 +9,11 @@ export type PendingListener = (pending: TaskId | undefined, settled?: {
9
9
  }) => void;
10
10
  /** Why the screen still shows what it showed after a request for a subagent. */
11
11
  export declare const NOT_SHOWN = "That subagent can no longer be shown.";
12
- /** Opens the port of the subagent `taskId` is an attempt of; undefined when there is no such subagent to show. */
13
- export type OpenAgentViewPort = (taskId: TaskId) => Promise<AgentViewPort | undefined>;
12
+ /**
13
+ * Opens the port of the subagent `taskId` is an attempt of; undefined when there is no such subagent to show. `options`
14
+ * are the request's.
15
+ */
16
+ export type OpenAgentViewPort = (taskId: TaskId, options?: AgentViewRequestOptions) => Promise<AgentViewPort | undefined>;
14
17
  /** Keeps what the screen shows below its transcript as painted until the answer runs; answers that release. */
15
18
  export type HoldAgentViewScreen = () => () => void;
16
19
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"agent-view-switcher.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/agent-view/agent-view-switcher.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAC;AAC/D,OAAO,KAAK,EAAE,eAAe,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACvF,OAAO,EAAE,KAAK,eAAe,EAAE,KAAK,aAAa,EAAgB,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE3G,yGAAyG;AACzG,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,QAAQ,GAAG,YAAY,CAAC;AAE/D,MAAM,MAAM,eAAe,GAAG,CAC7B,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,OAAO,CAAC,EAAE;IAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAA;CAAE,KACnE,IAAI,CAAC;AAEV,gFAAgF;AAChF,eAAO,MAAM,SAAS,0CAA0C,CAAC;AAEjE,kHAAkH;AAClH,MAAM,MAAM,iBAAiB,GAAG,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC,CAAC;AAEvF,+GAA+G;AAC/G,MAAM,MAAM,mBAAmB,GAAG,MAAM,MAAM,IAAI,CAAC;AAEnD;;;GAGG;AACH,qBAAa,iBAAkB,YAAW,eAAe;IACxD,OAAO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AED,SAAS,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI,CAG1C;IAED,oHAAoH;IACpH,KAAK,CAAC,OAAO,EAAE,iBAAiB,GAAG,kBAAkB,GAAG,UAAU,GAAG,IAAI,CAIxE;IAED,0EAA0E;IAC1E,OAAO,CAAC,UAAU;IAmBlB,OAAO,IAAI,IAAI,CAOd;IAED,OAAO,CAAC,IAAI;CAkCZ"}
@@ -70,7 +70,7 @@ export class AgentViewSwitcher {
70
70
  this.releaseScreen = this.holdScreen?.();
71
71
  let landed = false;
72
72
  try {
73
- landed = await this.open(request, taskId);
73
+ landed = await this.open(request, taskId, options);
74
74
  return landed;
75
75
  }
76
76
  finally {
@@ -85,10 +85,10 @@ export class AgentViewSwitcher {
85
85
  this.request++;
86
86
  this.setPending(undefined, "superseded");
87
87
  }
88
- async open(request, taskId) {
88
+ async open(request, taskId, options) {
89
89
  let port;
90
90
  try {
91
- port = await this.openPort(taskId);
91
+ port = await this.openPort(taskId, options);
92
92
  }
93
93
  catch (error) {
94
94
  if (request === this.request && !this.disposed)
@@ -1 +1 @@
1
- {"version":3,"file":"agent-view-switcher.js","sourceRoot":"","sources":["../../../../src/modes/interactive/agent-view/agent-view-switcher.ts"],"names":[],"mappings":"AAEA,OAAO,EAA4C,YAAY,EAAqB,MAAM,gBAAgB,CAAC;AAU3G,gFAAgF;AAChF,MAAM,CAAC,MAAM,SAAS,GAAG,uCAAuC,CAAC;AAQjE;;;GAGG;AACH,MAAM,OAAO,iBAAiB;IACrB,OAAO,GAAiB,YAAY,CAAC;IACrC,cAAc,CAA2B;IACzC,cAAc,CAA2B;IACzC,OAAO,GAAG,CAAC,CAAC;IACZ,QAAQ,GAAG,KAAK,CAAC;IACR,eAAe,GAAG,IAAI,GAAG,EAAqC,CAAC;IAC/D,SAAS,GAAG,IAAI,GAAG,EAAc,CAAC;IAClC,gBAAgB,GAAG,IAAI,GAAG,EAAmB,CAAC;IACvD,OAAO,CAAqB;IACnB,QAAQ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AE,CAAC,IAAI;oBAAE,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;YAC3E,CAAC,CAAC,CAAC;QACJ,CAAC;QACD,MAAM,MAAM,GAAoB,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC;QAC7C,KAAK,MAAM,QAAQ,IAAI,CAAC,GAAG,IAAI,CAAC,eAAe,CAAC,EAAE,CAAC;YAClD,IAAI,CAAC;gBACJ,QAAQ,CAAC,MAAM,CAAC,CAAC;YAClB,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBAChB,IAAI,CAAC,MAAM,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;YACrE,CAAC;QACF,CAAC;QACD,KAAK,MAAM,QAAQ,IAAI,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC;YAC5C,IAAI,CAAC;gBACJ,QAAQ,EAAE,CAAC;YACZ,CAAC;YAAC,MAAM,CAAC;gBACR,iDAAiD;YAClD,CAAC;QACF,CAAC;QACD,+FAA+F;QAC/F,WAAW,EAAE,EAAE,CAAC;IACjB,CAAC;CACD","sourcesContent":["import type { TaskId } from \"../../../core/tasks/contracts.js\";\nimport type { AgentViewBridge, AgentViewRequestOptions } from \"./agent-view-bridge.ts\";\nimport { type AgentViewChange, type AgentViewPort, VIEWING_MAIN, type ViewedTarget } from \"./contracts.ts\";\n\n/** How a pending request ended: its subagent was shown, could not be, or another request replaced it. */\nexport type PendingOutcome = \"shown\" | \"failed\" | \"superseded\";\n\nexport type PendingListener = (\n\tpending: TaskId | undefined,\n\tsettled?: { readonly taskId: TaskId; readonly outcome: PendingOutcome },\n) => void;\n\n/** Why the screen still shows what it showed after a request for a subagent. */\nexport const NOT_SHOWN = \"That subagent can no longer be shown.\";\n\n/** Opens the port of the subagent `taskId` is an attempt of; undefined when there is no such subagent to show. */\nexport type OpenAgentViewPort = (taskId: TaskId) => Promise<AgentViewPort | undefined>;\n\n/** Keeps what the screen shows below its transcript as painted until the answer runs; answers that release. */\nexport type HoldAgentViewScreen = () => () => void;\n\n/**\n * What the single chat screen shows. Every part that differs while a subagent is shown reads `viewed` at the moment it\n * acts, and listens to `onChange`. While main is shown nothing here runs, so the main chat is exactly as before.\n */\nexport class AgentViewSwitcher implements AgentViewBridge {\n\tprivate current: ViewedTarget = VIEWING_MAIN;\n\tprivate releaseCurrent: (() => void) | undefined;\n\tprivate unwatchCurrent: (() => void) | undefined;\n\tprivate request = 0;\n\tprivate disposed = false;\n\tprivate readonly changeListeners = new Set<(change: AgentViewChange) => void>();\n\tprivate readonly listeners = new Set<() => void>();\n\tprivate readonly pendingListeners = new Set<PendingListener>();\n\tprivate pending: TaskId | undefined;\n\tprivate readonly openPort: OpenAgentViewPort;\n\tprivate readonly notify: (message: string) => void;\n\tprivate readonly holdScreen: HoldAgentViewScreen | undefined;\n\t/** Releases the screen held for the pending request, when that request asked to keep it. */\n\tprivate releaseScreen: (() => void) | undefined;\n\n\tconstructor(openPort: OpenAgentViewPort, notify: (message: string) => void, holdScreen?: HoldAgentViewScreen) {\n\t\tthis.openPort = openPort;\n\t\tthis.notify = notify;\n\t\tthis.holdScreen = holdScreen;\n\t}\n\n\tget viewed(): ViewedTarget {\n\t\treturn this.current;\n\t}\n\n\t/**\n\t * The subagent a request is opening, from the request until it is shown or fails. What the reader types meanwhile\n\t * is meant for it, so the prompt holds it back until then.\n\t */\n\tget pendingTaskId(): TaskId | undefined {\n\t\treturn this.pending;\n\t}\n\n\t/**\n\t * Called whenever the pending request changes: `pending` is the one opening now, and `settled` the one that just\n\t * stopped pending, with how it ended.\n\t */\n\tonPending(listener: PendingListener): () => void {\n\t\tthis.pendingListeners.add(listener);\n\t\treturn () => this.pendingListeners.delete(listener);\n\t}\n\n\tviewedTaskId(): TaskId | undefined {\n\t\treturn this.current.kind === \"agent\" ? this.current.port.status().taskId : undefined;\n\t}\n\n\t/**\n\t * Show the subagent `taskId` is an attempt of, or main when undefined. The latest request wins: a port opened for\n\t * a request a later one superseded is released unused. Answers whether the screen shows what was asked. With\n\t * `keepScreen`, what the screen shows below its transcript stays as painted while the request is pending.\n\t */\n\tasync view(taskId: TaskId | undefined, options?: AgentViewRequestOptions): Promise<boolean> {\n\t\tif (this.disposed) return false;\n\t\tconst request = ++this.request;\n\t\tif (taskId === undefined) {\n\t\t\tthis.setPending(undefined, \"superseded\");\n\t\t\tthis.show(VIEWING_MAIN);\n\t\t\treturn true;\n\t\t}\n\t\tconst shown = this.current;\n\t\tif (shown.kind === \"agent\" && shown.port.status().taskId === taskId) {\n\t\t\tthis.setPending(undefined, \"superseded\");\n\t\t\treturn true;\n\t\t}\n\t\tthis.setPending(taskId, \"superseded\");\n\t\tif (options?.keepScreen === true && this.releaseScreen === undefined) this.releaseScreen = this.holdScreen?.();\n\t\tlet landed = false;\n\t\ttry {\n\t\t\tlanded = await this.open(request, taskId);\n\t\t\treturn landed;\n\t\t} finally {\n\t\t\tif (request === this.request) this.setPending(undefined, landed ? \"shown\" : \"failed\");\n\t\t}\n\t}\n\n\t/** Esc while a subagent is opening: it is not shown, and the screen keeps what it shows. */\n\tcancelPending(): void {\n\t\tif (this.pending === undefined) return;\n\t\tthis.request++;\n\t\tthis.setPending(undefined, \"superseded\");\n\t}\n\n\tprivate async open(request: number, taskId: TaskId): Promise<boolean> {\n\t\tlet port: AgentViewPort | undefined;\n\t\ttry {\n\t\t\tport = await this.openPort(taskId);\n\t\t} catch (error) {\n\t\t\tif (request === this.request && !this.disposed)\n\t\t\t\tthis.notify(error instanceof Error ? error.message : String(error));\n\t\t\treturn false;\n\t\t}\n\t\tif (port === undefined) {\n\t\t\tif (request === this.request && !this.disposed) this.notify(NOT_SHOWN);\n\t\t\treturn false;\n\t\t}\n\t\tif (request !== this.request || this.disposed) {\n\t\t\t// Superseded: the port was never shown. Retaining and releasing it once disposes it.\n\t\t\tport.retain()();\n\t\t\treturn false;\n\t\t}\n\t\tconst now = this.current;\n\t\tif (now.kind === \"agent\" && now.port.agentKey === port.agentKey) {\n\t\t\tport.retain()();\n\t\t\treturn true;\n\t\t}\n\t\tif (port.status().gone) {\n\t\t\tport.retain()();\n\t\t\tthis.notify(NOT_SHOWN);\n\t\t\treturn false;\n\t\t}\n\t\tthis.show({ kind: \"agent\", port });\n\t\treturn true;\n\t}\n\n\trequestView(taskId: TaskId | undefined, options?: AgentViewRequestOptions): void {\n\t\tvoid this.view(taskId, options).catch((error: unknown) =>\n\t\t\tthis.notify(error instanceof Error ? error.message : String(error)),\n\t\t);\n\t}\n\n\t/** Listeners run in registration order, synchronously, once `viewed` changed. */\n\tonChange(listener: (change: AgentViewChange) => void): () => void {\n\t\tthis.changeListeners.add(listener);\n\t\treturn () => this.changeListeners.delete(listener);\n\t}\n\n\tsubscribe(listener: () => void): () => void {\n\t\tthis.listeners.add(listener);\n\t\treturn () => this.listeners.delete(listener);\n\t}\n\n\t/** The engine generation ended, the main session was replaced, or the host shuts down: show main, release ports. */\n\treset(_reason: \"generation-lost\" | \"session-replaced\" | \"shutdown\"): void {\n\t\tthis.request++;\n\t\tthis.setPending(undefined, \"superseded\");\n\t\tthis.show(VIEWING_MAIN);\n\t}\n\n\t/** `outcome` is how the request pending until now ended, when one was. */\n\tprivate setPending(taskId: TaskId | undefined, outcome: PendingOutcome): void {\n\t\tconst previous = this.pending;\n\t\tif (previous === taskId) return;\n\t\tthis.pending = taskId;\n\t\t// The screen held for the request that stops pending is shown live again once the listeners ran: a request\n\t\t// that landed has its subagent laid out by then, so the next paint shows it with its prompt and panel.\n\t\tconst releaseScreen = this.releaseScreen;\n\t\tthis.releaseScreen = undefined;\n\t\tconst settled = previous === undefined ? undefined : { taskId: previous, outcome };\n\t\tfor (const listener of [...this.pendingListeners]) {\n\t\t\ttry {\n\t\t\t\tlistener(taskId, settled);\n\t\t\t} catch {\n\t\t\t\t// A listener's failure must not stop the others.\n\t\t\t}\n\t\t}\n\t\treleaseScreen?.();\n\t}\n\n\tdispose(): void {\n\t\tif (this.disposed) return;\n\t\tthis.reset(\"shutdown\");\n\t\tthis.disposed = true;\n\t\tthis.changeListeners.clear();\n\t\tthis.listeners.clear();\n\t\tthis.pendingListeners.clear();\n\t}\n\n\tprivate show(to: ViewedTarget): void {\n\t\tconst from = this.current;\n\t\tif (from === to || (from.kind === \"main\" && to.kind === \"main\")) return;\n\t\tconst releaseFrom = this.releaseCurrent;\n\t\tthis.unwatchCurrent?.();\n\t\tthis.unwatchCurrent = undefined;\n\t\tthis.releaseCurrent = undefined;\n\t\tthis.current = to;\n\t\tif (to.kind === \"agent\") {\n\t\t\tthis.releaseCurrent = to.port.retain();\n\t\t\tthis.unwatchCurrent = to.port.subscribe(() => {\n\t\t\t\t// A shown subagent that is gone gives the screen back to main in the same tick. A newer request, still\n\t\t\t\t// opening, is the reader's and still lands.\n\t\t\t\tif (this.current === to && to.port.status().gone) this.show(VIEWING_MAIN);\n\t\t\t});\n\t\t}\n\t\tconst change: AgentViewChange = { from, to };\n\t\tfor (const listener of [...this.changeListeners]) {\n\t\t\ttry {\n\t\t\t\tlistener(change);\n\t\t\t} catch (error) {\n\t\t\t\tthis.notify(error instanceof Error ? error.message : String(error));\n\t\t\t}\n\t\t}\n\t\tfor (const listener of [...this.listeners]) {\n\t\t\ttry {\n\t\t\t\tlistener();\n\t\t\t} catch {\n\t\t\t\t// A listener's failure must not stop the others.\n\t\t\t}\n\t\t}\n\t\t// Released after the listeners, so one that still has messages on their way to it can keep it.\n\t\treleaseFrom?.();\n\t}\n}\n"]}
1
+ {"version":3,"file":"agent-view-switcher.js","sourceRoot":"","sources":["../../../../src/modes/interactive/agent-view/agent-view-switcher.ts"],"names":[],"mappings":"AAEA,OAAO,EAA4C,YAAY,EAAqB,MAAM,gBAAgB,CAAC;AAU3G,gFAAgF;AAChF,MAAM,CAAC,MAAM,SAAS,GAAG,uCAAuC,CAAC;AAcjE;;;GAGG;AACH,MAAM,OAAO,iBAAiB;IACrB,OAA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;QAClB,IAAI,EAAE,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;YACzB,IAAI,CAAC,cAAc,GAAG,EAAE,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;YACvC,IAAI,CAAC,cAAc,GAAG,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE;gBAC5C,uGAAuG;gBACvG,4CAA4C;gBAC5C,IAAI,IAAI,CAAC,OAAO,KAAK,EAAE,IAAI,EAAE,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,IAAI;oBAAE,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;YAC3E,CAAC,CAAC,CAAC;QACJ,CAAC;QACD,MAAM,MAAM,GAAoB,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC;QAC7C,KAAK,MAAM,QAAQ,IAAI,CAAC,GAAG,IAAI,CAAC,eAAe,CAAC,EAAE,CAAC;YAClD,IAAI,CAAC;gBACJ,QAAQ,CAAC,MAAM,CAAC,CAAC;YAClB,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBAChB,IAAI,CAAC,MAAM,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;YACrE,CAAC;QACF,CAAC;QACD,KAAK,MAAM,QAAQ,IAAI,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC;YAC5C,IAAI,CAAC;gBACJ,QAAQ,EAAE,CAAC;YACZ,CAAC;YAAC,MAAM,CAAC;gBACR,iDAAiD;YAClD,CAAC;QACF,CAAC;QACD,+FAA+F;QAC/F,WAAW,EAAE,EAAE,CAAC;IACjB,CAAC;CACD","sourcesContent":["import type { TaskId } from \"../../../core/tasks/contracts.js\";\nimport type { AgentViewBridge, AgentViewRequestOptions } from \"./agent-view-bridge.ts\";\nimport { type AgentViewChange, type AgentViewPort, VIEWING_MAIN, type ViewedTarget } from \"./contracts.ts\";\n\n/** How a pending request ended: its subagent was shown, could not be, or another request replaced it. */\nexport type PendingOutcome = \"shown\" | \"failed\" | \"superseded\";\n\nexport type PendingListener = (\n\tpending: TaskId | undefined,\n\tsettled?: { readonly taskId: TaskId; readonly outcome: PendingOutcome },\n) => void;\n\n/** Why the screen still shows what it showed after a request for a subagent. */\nexport const NOT_SHOWN = \"That subagent can no longer be shown.\";\n\n/**\n * Opens the port of the subagent `taskId` is an attempt of; undefined when there is no such subagent to show. `options`\n * are the request's.\n */\nexport type OpenAgentViewPort = (\n\ttaskId: TaskId,\n\toptions?: AgentViewRequestOptions,\n) => Promise<AgentViewPort | undefined>;\n\n/** Keeps what the screen shows below its transcript as painted until the answer runs; answers that release. */\nexport type HoldAgentViewScreen = () => () => void;\n\n/**\n * What the single chat screen shows. Every part that differs while a subagent is shown reads `viewed` at the moment it\n * acts, and listens to `onChange`. While main is shown nothing here runs, so the main chat is exactly as before.\n */\nexport class AgentViewSwitcher implements AgentViewBridge {\n\tprivate current: ViewedTarget = VIEWING_MAIN;\n\tprivate releaseCurrent: (() => void) | undefined;\n\tprivate unwatchCurrent: (() => void) | undefined;\n\tprivate request = 0;\n\tprivate disposed = false;\n\tprivate readonly changeListeners = new Set<(change: AgentViewChange) => void>();\n\tprivate readonly listeners = new Set<() => void>();\n\tprivate readonly pendingListeners = new Set<PendingListener>();\n\tprivate pending: TaskId | undefined;\n\tprivate readonly openPort: OpenAgentViewPort;\n\tprivate readonly notify: (message: string) => void;\n\tprivate readonly holdScreen: HoldAgentViewScreen | undefined;\n\t/** Releases the screen held for the pending request, when that request asked to keep it. */\n\tprivate releaseScreen: (() => void) | undefined;\n\n\tconstructor(openPort: OpenAgentViewPort, notify: (message: string) => void, holdScreen?: HoldAgentViewScreen) {\n\t\tthis.openPort = openPort;\n\t\tthis.notify = notify;\n\t\tthis.holdScreen = holdScreen;\n\t}\n\n\tget viewed(): ViewedTarget {\n\t\treturn this.current;\n\t}\n\n\t/**\n\t * The subagent a request is opening, from the request until it is shown or fails. What the reader types meanwhile\n\t * is meant for it, so the prompt holds it back until then.\n\t */\n\tget pendingTaskId(): TaskId | undefined {\n\t\treturn this.pending;\n\t}\n\n\t/**\n\t * Called whenever the pending request changes: `pending` is the one opening now, and `settled` the one that just\n\t * stopped pending, with how it ended.\n\t */\n\tonPending(listener: PendingListener): () => void {\n\t\tthis.pendingListeners.add(listener);\n\t\treturn () => this.pendingListeners.delete(listener);\n\t}\n\n\tviewedTaskId(): TaskId | undefined {\n\t\treturn this.current.kind === \"agent\" ? this.current.port.status().taskId : undefined;\n\t}\n\n\t/**\n\t * Show the subagent `taskId` is an attempt of, or main when undefined. The latest request wins: a port opened for\n\t * a request a later one superseded is released unused. Answers whether the screen shows what was asked. With\n\t * `keepScreen`, what the screen shows below its transcript stays as painted while the request is pending.\n\t */\n\tasync view(taskId: TaskId | undefined, options?: AgentViewRequestOptions): Promise<boolean> {\n\t\tif (this.disposed) return false;\n\t\tconst request = ++this.request;\n\t\tif (taskId === undefined) {\n\t\t\tthis.setPending(undefined, \"superseded\");\n\t\t\tthis.show(VIEWING_MAIN);\n\t\t\treturn true;\n\t\t}\n\t\tconst shown = this.current;\n\t\tif (shown.kind === \"agent\" && shown.port.status().taskId === taskId) {\n\t\t\tthis.setPending(undefined, \"superseded\");\n\t\t\treturn true;\n\t\t}\n\t\tthis.setPending(taskId, \"superseded\");\n\t\tif (options?.keepScreen === true && this.releaseScreen === undefined) this.releaseScreen = this.holdScreen?.();\n\t\tlet landed = false;\n\t\ttry {\n\t\t\tlanded = await this.open(request, taskId, options);\n\t\t\treturn landed;\n\t\t} finally {\n\t\t\tif (request === this.request) this.setPending(undefined, landed ? \"shown\" : \"failed\");\n\t\t}\n\t}\n\n\t/** Esc while a subagent is opening: it is not shown, and the screen keeps what it shows. */\n\tcancelPending(): void {\n\t\tif (this.pending === undefined) return;\n\t\tthis.request++;\n\t\tthis.setPending(undefined, \"superseded\");\n\t}\n\n\tprivate async open(request: number, taskId: TaskId, options: AgentViewRequestOptions | undefined): Promise<boolean> {\n\t\tlet port: AgentViewPort | undefined;\n\t\ttry {\n\t\t\tport = await this.openPort(taskId, options);\n\t\t} catch (error) {\n\t\t\tif (request === this.request && !this.disposed)\n\t\t\t\tthis.notify(error instanceof Error ? error.message : String(error));\n\t\t\treturn false;\n\t\t}\n\t\tif (port === undefined) {\n\t\t\tif (request === this.request && !this.disposed) this.notify(NOT_SHOWN);\n\t\t\treturn false;\n\t\t}\n\t\tif (request !== this.request || this.disposed) {\n\t\t\t// Superseded: the port was never shown. Retaining and releasing it once disposes it.\n\t\t\tport.retain()();\n\t\t\treturn false;\n\t\t}\n\t\tconst now = this.current;\n\t\tif (now.kind === \"agent\" && now.port.agentKey === port.agentKey) {\n\t\t\tport.retain()();\n\t\t\treturn true;\n\t\t}\n\t\tif (port.status().gone) {\n\t\t\tport.retain()();\n\t\t\tthis.notify(NOT_SHOWN);\n\t\t\treturn false;\n\t\t}\n\t\tthis.show({ kind: \"agent\", port });\n\t\treturn true;\n\t}\n\n\trequestView(taskId: TaskId | undefined, options?: AgentViewRequestOptions): void {\n\t\tvoid this.view(taskId, options).catch((error: unknown) =>\n\t\t\tthis.notify(error instanceof Error ? error.message : String(error)),\n\t\t);\n\t}\n\n\t/** Listeners run in registration order, synchronously, once `viewed` changed. */\n\tonChange(listener: (change: AgentViewChange) => void): () => void {\n\t\tthis.changeListeners.add(listener);\n\t\treturn () => this.changeListeners.delete(listener);\n\t}\n\n\tsubscribe(listener: () => void): () => void {\n\t\tthis.listeners.add(listener);\n\t\treturn () => this.listeners.delete(listener);\n\t}\n\n\t/** The engine generation ended, the main session was replaced, or the host shuts down: show main, release ports. */\n\treset(_reason: \"generation-lost\" | \"session-replaced\" | \"shutdown\"): void {\n\t\tthis.request++;\n\t\tthis.setPending(undefined, \"superseded\");\n\t\tthis.show(VIEWING_MAIN);\n\t}\n\n\t/** `outcome` is how the request pending until now ended, when one was. */\n\tprivate setPending(taskId: TaskId | undefined, outcome: PendingOutcome): void {\n\t\tconst previous = this.pending;\n\t\tif (previous === taskId) return;\n\t\tthis.pending = taskId;\n\t\t// The screen held for the request that stops pending is shown live again once the listeners ran: a request\n\t\t// that landed has its subagent laid out by then, so the next paint shows it with its prompt and panel.\n\t\tconst releaseScreen = this.releaseScreen;\n\t\tthis.releaseScreen = undefined;\n\t\tconst settled = previous === undefined ? undefined : { taskId: previous, outcome };\n\t\tfor (const listener of [...this.pendingListeners]) {\n\t\t\ttry {\n\t\t\t\tlistener(taskId, settled);\n\t\t\t} catch {\n\t\t\t\t// A listener's failure must not stop the others.\n\t\t\t}\n\t\t}\n\t\treleaseScreen?.();\n\t}\n\n\tdispose(): void {\n\t\tif (this.disposed) return;\n\t\tthis.reset(\"shutdown\");\n\t\tthis.disposed = true;\n\t\tthis.changeListeners.clear();\n\t\tthis.listeners.clear();\n\t\tthis.pendingListeners.clear();\n\t}\n\n\tprivate show(to: ViewedTarget): void {\n\t\tconst from = this.current;\n\t\tif (from === to || (from.kind === \"main\" && to.kind === \"main\")) return;\n\t\tconst releaseFrom = this.releaseCurrent;\n\t\tthis.unwatchCurrent?.();\n\t\tthis.unwatchCurrent = undefined;\n\t\tthis.releaseCurrent = undefined;\n\t\tthis.current = to;\n\t\tif (to.kind === \"agent\") {\n\t\t\tthis.releaseCurrent = to.port.retain();\n\t\t\tthis.unwatchCurrent = to.port.subscribe(() => {\n\t\t\t\t// A shown subagent that is gone gives the screen back to main in the same tick. A newer request, still\n\t\t\t\t// opening, is the reader's and still lands.\n\t\t\t\tif (this.current === to && to.port.status().gone) this.show(VIEWING_MAIN);\n\t\t\t});\n\t\t}\n\t\tconst change: AgentViewChange = { from, to };\n\t\tfor (const listener of [...this.changeListeners]) {\n\t\t\ttry {\n\t\t\t\tlistener(change);\n\t\t\t} catch (error) {\n\t\t\t\tthis.notify(error instanceof Error ? error.message : String(error));\n\t\t\t}\n\t\t}\n\t\tfor (const listener of [...this.listeners]) {\n\t\t\ttry {\n\t\t\t\tlistener();\n\t\t\t} catch {\n\t\t\t\t// A listener's failure must not stop the others.\n\t\t\t}\n\t\t}\n\t\t// Released after the listeners, so one that still has messages on their way to it can keep it.\n\t\treleaseFrom?.();\n\t}\n}\n"]}
@@ -41,6 +41,12 @@ export interface AgentViewStatus {
41
41
  * `queued` until it does, so a message is never off screen. Drawing only; left out when there are none.
42
42
  */
43
43
  readonly delivering?: SteeringQueueLists;
44
+ /**
45
+ * Queued messages it took whose own row its transcript shows and whose save has not been seen yet, oldest first.
46
+ * Drawn as nothing more than their row; if the engine running it is lost meanwhile, they are listed as unconfirmed.
47
+ * Left out when there are none.
48
+ */
49
+ readonly unsaved?: readonly string[];
44
50
  /** Why messages cannot reach it any more; undefined while they can. */
45
51
  readonly readOnlyReason?: string;
46
52
  /** It waits on a question form, drawn in the transcript area, which takes the keys meanwhile. */
@@ -1 +1 @@
1
- {"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/agent-view/contracts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAC;AAC/D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AAC5E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AAC9E,OAAO,KAAK,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAE1F;;;GAGG;AAEH,8EAA8E;AAC9E,MAAM,MAAM,YAAY,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAA;CAAE,CAAC;AAEhH,eAAO,MAAM,YAAY,EAAE,YAA8C,CAAC;AAE1E,MAAM,MAAM,cAAc,GACvB,SAAS,GACT,QAAQ,G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,cAAc,CAAC,kBAAkB,CAAC,CAAC,CAAC;CACrD;AAED,uGAAuG;AACvG,MAAM,WAAW,aAAc,SAAQ,iBAAiB;IACvD,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,MAAM,IAAI,eAAe,CAAC;IAC1B,SAAS,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC;IAC5C,QAAQ,CAAC,UAAU,EAAE,wBAAwB,CAAC;IAC9C,qDAAqD;IACrD,OAAO,IAAI,OAAO,CAAC,SAAS,MAAM,EAAE,CAAC,CAAC;IACtC,QAAQ,IAAI,OAAO,CAAC,iBAAiB,GAAG,SAAS,CAAC,CAAC;IACnD,6EAA6E;IAC7E,oBAAoB,IAAI,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IACpD,wGAAwG;IACxG,MAAM,IAAI,MAAM,IAAI,CAAC;CACrB;AAED,MAAM,WAAW,eAAe;IAC/B,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAC5B,QAAQ,CAAC,EAAE,EAAE,YAAY,CAAC;CAC1B"}
@@ -1 +1 @@
1
- {"version":3,"file":"contracts.js","sourceRoot":"","sources":["../../../../src/modes/interactive/agent-view/contracts.ts"],"names":[],"mappings":"AAcA,MAAM,CAAC,MAAM,YAAY,GAAiB,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC","sourcesContent":["import type { Component } from \"@bastani/atomic-tui\";\nimport type { TaskId } from \"../../../core/tasks/contracts.js\";\nimport type { QueuedTaskMessages } from \"../../../core/tasks/supervisor.js\";\nimport type { TaskViewResult } from \"../../../core/tasks/task-view-source.js\";\nimport type { SteeringQueueLists, SteeringTarget } from \"../steering-queue-controller.ts\";\n\n/**\n * The single chat screen shows the main chat or one subagent. While it shows a subagent, its transcript takes the\n * transcript area and the main prompt is retargeted to it; the agent panel and `/tasks` stay as they are.\n */\n\n/** What the screen shows: the main chat, or one subagent through its port. */\nexport type ViewedTarget = { readonly kind: \"main\" } | { readonly kind: \"agent\"; readonly port: AgentViewPort };\n\nexport const VIEWING_MAIN: ViewedTarget = Object.freeze({ kind: \"main\" });\n\nexport type AgentViewState =\n\t| \"running\"\n\t| \"queued\"\n\t| \"input\"\n\t| \"paused\"\n\t| \"stopping\"\n\t| \"waiting\"\n\t| \"done\"\n\t| \"failed\"\n\t| \"stopped\";\n\n/** A viewed subagent as the prompt, its rule, the footer and the panel show it. Plain data: it crosses the engine. */\nexport interface AgentViewStatus {\n\t/** The attempt messages go to now: the latest one, which a resume moves. */\n\treadonly taskId: TaskId;\n\t/** The subagent across resumes: its first attempt's task id. Per-agent prompt state is keyed by it. */\n\treadonly agentKey: string;\n\t/** Display name without \"@\", such as \"worker\". */\n\treadonly name: string;\n\t/** The prompt's top-rule label, such as \"worker · Fix the parser · running\". */\n\treadonly ruleLabel: string;\n\t/** The empty prompt's placeholder, such as \"Message @worker…\", or the paused, stopped, answer or wake text. */\n\treadonly placeholder: string;\n\treadonly state: AgentViewState;\n\t/** Streaming, retrying or running a tool: Enter queues the message. */\n\treadonly busy: boolean;\n\t/** Esc paused it: the next message sent continues it. */\n\treadonly paused: boolean;\n\treadonly retrying: boolean;\n\t/** The subagent's own queue as it last listed it. */\n\treadonly queued: SteeringQueueLists;\n\t/**\n\t * Messages it took from its queue whose own row its transcript does not show yet: drawn as queued rows ahead of\n\t * `queued` until it does, so a message is never off screen. Drawing only; left out when there are none.\n\t */\n\treadonly delivering?: SteeringQueueLists;\n\t/** Why messages cannot reach it any more; undefined while they can. */\n\treadonly readOnlyReason?: string;\n\t/** It waits on a question form, drawn in the transcript area, which takes the keys meanwhile. */\n\treadonly heldPrompt: boolean;\n\t/** The working line under its transcript, as its chat would draw it; undefined when it shows none. */\n\treadonly working?: AgentWorkingLine;\n\t/** The subagent is gone (dismissed, removed, or its engine was lost): the screen shows main again. */\n\treadonly gone: boolean;\n}\n\n/**\n * A subagent's working line as plain data: what it is doing (`working` streams, `busy` waits or retries,\n * `compacting`), or the `worked` row its last turn left. The host draws and animates it as the main chat's.\n */\nexport interface AgentWorkingLine {\n\treadonly kind: \"working\" | \"busy\" | \"compacting\" | \"worked\";\n\treadonly message: string;\n\treadonly elapsedMs?: number;\n\treadonly tokens?: number;\n\treadonly worked?: { readonly elapsedMs: number; readonly tokens?: number };\n}\n\n/** The viewed subagent's transcript, drawn where the main transcript is. */\nexport interface AgentTranscriptComponent extends Component {\n\t/** Scroll and paging keys while it is shown (page keys, wheel, top/bottom, half page, prompt jumps, jump to latest). */\n\thandleViewKey(data: string): boolean;\n\t/** Whether its question form is open and takes the keys; focus moves to the transcript area meanwhile. */\n\tcapturesInput(): boolean;\n\thandleInput(data: string): void;\n\tinvalidate(): void;\n}\n\n/** A slash command the viewed agent's own session runs. */\nexport interface AgentViewCommand {\n\treadonly name: string;\n\treadonly description?: string;\n}\n\n/** The slash commands the viewed agent's own session runs: completion and routing of skills and templates. */\nexport interface AgentViewCommands {\n\treadonly cwd: string;\n\treadonly skillCommands: readonly AgentViewCommand[];\n\treadonly promptTemplates: readonly AgentViewCommand[];\n\treadonly extensionCommands: readonly AgentViewCommand[];\n}\n\n/** What a pause took back from the subagent's queue, and why a restart would not keep the pause, when it would not. */\nexport type PausedTaskMessages = QueuedTaskMessages & { readonly warning?: string };\n\n/** The steering half of a port. */\nexport interface AgentSteeringPort {\n\t/** Where the prompt's messages go: busy, paused and queued follow `status()`; the calls reach the subagent. */\n\treadonly steering: SteeringTarget;\n\t/** Esc: pause the subagent, answering the messages taken back from its queue, steering first. */\n\tpause(): Promise<TaskViewResult<PausedTaskMessages>>;\n}\n\n/** One subagent, reachable from the host whether it runs in this process or in the isolated engine. */\nexport interface AgentViewPort extends AgentSteeringPort {\n\treadonly agentKey: string;\n\tstatus(): AgentViewStatus;\n\tsubscribe(listener: () => void): () => void;\n\treadonly transcript: AgentTranscriptComponent;\n\t/** Its own delivered user messages, oldest first. */\n\tprompts(): Promise<readonly string[]>;\n\tcommands(): Promise<AgentViewCommands | undefined>;\n\t/** The text of its last assistant message, for `/copy` while it is shown. */\n\tlastAgentMessageText(): Promise<string | undefined>;\n\t/** Keep the port alive while it is shown or has messages on their way. The last release disposes it. */\n\tretain(): () => void;\n}\n\nexport interface AgentViewChange {\n\treadonly from: ViewedTarget;\n\treadonly to: ViewedTarget;\n}\n"]}
1
+ {"version":3,"file":"contracts.js","sourceRoot":"","sources":["../../../../src/modes/interactive/agent-view/contracts.ts"],"names":[],"mappings":"AAcA,MAAM,CAAC,MAAM,YAAY,GAAiB,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC","sourcesContent":["import type { Component } from \"@bastani/atomic-tui\";\nimport type { TaskId } from \"../../../core/tasks/contracts.js\";\nimport type { QueuedTaskMessages } from \"../../../core/tasks/supervisor.js\";\nimport type { TaskViewResult } from \"../../../core/tasks/task-view-source.js\";\nimport type { SteeringQueueLists, SteeringTarget } from \"../steering-queue-controller.ts\";\n\n/**\n * The single chat screen shows the main chat or one subagent. While it shows a subagent, its transcript takes the\n * transcript area and the main prompt is retargeted to it; the agent panel and `/tasks` stay as they are.\n */\n\n/** What the screen shows: the main chat, or one subagent through its port. */\nexport type ViewedTarget = { readonly kind: \"main\" } | { readonly kind: \"agent\"; readonly port: AgentViewPort };\n\nexport const VIEWING_MAIN: ViewedTarget = Object.freeze({ kind: \"main\" });\n\nexport type AgentViewState =\n\t| \"running\"\n\t| \"queued\"\n\t| \"input\"\n\t| \"paused\"\n\t| \"stopping\"\n\t| \"waiting\"\n\t| \"done\"\n\t| \"failed\"\n\t| \"stopped\";\n\n/** A viewed subagent as the prompt, its rule, the footer and the panel show it. Plain data: it crosses the engine. */\nexport interface AgentViewStatus {\n\t/** The attempt messages go to now: the latest one, which a resume moves. */\n\treadonly taskId: TaskId;\n\t/** The subagent across resumes: its first attempt's task id. Per-agent prompt state is keyed by it. */\n\treadonly agentKey: string;\n\t/** Display name without \"@\", such as \"worker\". */\n\treadonly name: string;\n\t/** The prompt's top-rule label, such as \"worker · Fix the parser · running\". */\n\treadonly ruleLabel: string;\n\t/** The empty prompt's placeholder, such as \"Message @worker…\", or the paused, stopped, answer or wake text. */\n\treadonly placeholder: string;\n\treadonly state: AgentViewState;\n\t/** Streaming, retrying or running a tool: Enter queues the message. */\n\treadonly busy: boolean;\n\t/** Esc paused it: the next message sent continues it. */\n\treadonly paused: boolean;\n\treadonly retrying: boolean;\n\t/** The subagent's own queue as it last listed it. */\n\treadonly queued: SteeringQueueLists;\n\t/**\n\t * Messages it took from its queue whose own row its transcript does not show yet: drawn as queued rows ahead of\n\t * `queued` until it does, so a message is never off screen. Drawing only; left out when there are none.\n\t */\n\treadonly delivering?: SteeringQueueLists;\n\t/**\n\t * Queued messages it took whose own row its transcript shows and whose save has not been seen yet, oldest first.\n\t * Drawn as nothing more than their row; if the engine running it is lost meanwhile, they are listed as unconfirmed.\n\t * Left out when there are none.\n\t */\n\treadonly unsaved?: readonly string[];\n\t/** Why messages cannot reach it any more; undefined while they can. */\n\treadonly readOnlyReason?: string;\n\t/** It waits on a question form, drawn in the transcript area, which takes the keys meanwhile. */\n\treadonly heldPrompt: boolean;\n\t/** The working line under its transcript, as its chat would draw it; undefined when it shows none. */\n\treadonly working?: AgentWorkingLine;\n\t/** The subagent is gone (dismissed, removed, or its engine was lost): the screen shows main again. */\n\treadonly gone: boolean;\n}\n\n/**\n * A subagent's working line as plain data: what it is doing (`working` streams, `busy` waits or retries,\n * `compacting`), or the `worked` row its last turn left. The host draws and animates it as the main chat's.\n */\nexport interface AgentWorkingLine {\n\treadonly kind: \"working\" | \"busy\" | \"compacting\" | \"worked\";\n\treadonly message: string;\n\treadonly elapsedMs?: number;\n\treadonly tokens?: number;\n\treadonly worked?: { readonly elapsedMs: number; readonly tokens?: number };\n}\n\n/** The viewed subagent's transcript, drawn where the main transcript is. */\nexport interface AgentTranscriptComponent extends Component {\n\t/** Scroll and paging keys while it is shown (page keys, wheel, top/bottom, half page, prompt jumps, jump to latest). */\n\thandleViewKey(data: string): boolean;\n\t/** Whether its question form is open and takes the keys; focus moves to the transcript area meanwhile. */\n\tcapturesInput(): boolean;\n\thandleInput(data: string): void;\n\tinvalidate(): void;\n}\n\n/** A slash command the viewed agent's own session runs. */\nexport interface AgentViewCommand {\n\treadonly name: string;\n\treadonly description?: string;\n}\n\n/** The slash commands the viewed agent's own session runs: completion and routing of skills and templates. */\nexport interface AgentViewCommands {\n\treadonly cwd: string;\n\treadonly skillCommands: readonly AgentViewCommand[];\n\treadonly promptTemplates: readonly AgentViewCommand[];\n\treadonly extensionCommands: readonly AgentViewCommand[];\n}\n\n/** What a pause took back from the subagent's queue, and why a restart would not keep the pause, when it would not. */\nexport type PausedTaskMessages = QueuedTaskMessages & { readonly warning?: string };\n\n/** The steering half of a port. */\nexport interface AgentSteeringPort {\n\t/** Where the prompt's messages go: busy, paused and queued follow `status()`; the calls reach the subagent. */\n\treadonly steering: SteeringTarget;\n\t/** Esc: pause the subagent, answering the messages taken back from its queue, steering first. */\n\tpause(): Promise<TaskViewResult<PausedTaskMessages>>;\n}\n\n/** One subagent, reachable from the host whether it runs in this process or in the isolated engine. */\nexport interface AgentViewPort extends AgentSteeringPort {\n\treadonly agentKey: string;\n\tstatus(): AgentViewStatus;\n\tsubscribe(listener: () => void): () => void;\n\treadonly transcript: AgentTranscriptComponent;\n\t/** Its own delivered user messages, oldest first. */\n\tprompts(): Promise<readonly string[]>;\n\tcommands(): Promise<AgentViewCommands | undefined>;\n\t/** The text of its last assistant message, for `/copy` while it is shown. */\n\tlastAgentMessageText(): Promise<string | undefined>;\n\t/** Keep the port alive while it is shown or has messages on their way. The last release disposes it. */\n\tretain(): () => void;\n}\n\nexport interface AgentViewChange {\n\treadonly from: ViewedTarget;\n\treadonly to: ViewedTarget;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/agent-view/install.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAEvE,OAAO,EAAE,iBAAiB,EAAE,KAAK,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AASrF;;;GAGG;AACH,wBAAgB,iBAAiB,CAChC,IAAI,EAAE,mBAAmB,EACzB,QAAQ,GAAE,iBAA+D,GACvE,iBAAiB,CAYnB;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,mBAAmB,GAAG,iBAAiB,CAwC7E;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,mBAAmB,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,IAAI,CAQ3F"}
1
+ {"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/agent-view/install.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAEvE,OAAO,EAAE,iBAAiB,EAAE,KAAK,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AASrF;;;GAGG;AACH,wBAAgB,iBAAiB,CAChC,IAAI,EAAE,mBAAmB,EACzB,QAAQ,GAAE,iBAAiF,GACzF,iBAAiB,CAYnB;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,mBAAmB,GAAG,iBAAiB,CAyC7E;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,mBAAmB,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,IAAI,CAQ3F"}
@@ -11,7 +11,7 @@ const switchers = new WeakMap();
11
11
  * The mode's switcher, made on first use: a session can be bound before the screen is set up. `openPort` opens the
12
12
  * subagents it shows; the first call decides it.
13
13
  */
14
- export function agentViewSwitcher(mode, openPort = (taskId) => openAgentViewPort(mode, taskId)) {
14
+ export function agentViewSwitcher(mode, openPort = (taskId, options) => openAgentViewPort(mode, taskId, options)) {
15
15
  let switcher = switchers.get(mode);
16
16
  if (switcher === undefined) {
17
17
  switcher = new AgentViewSwitcher(openPort, (message) => mode.showWarning(message), () => holdTranscriptDock(mode, FIRST_FRAME_TIMEOUT_MS));
@@ -39,6 +39,7 @@ export function installAgentView(mode) {
39
39
  return;
40
40
  switcher.requestView(message.taskId === null ? undefined : message.taskId, {
41
41
  keepScreen: message.keepScreen === true,
42
+ panel: message.panel === true,
42
43
  });
43
44
  }), runtime.onGenerationEnded(() => switcher.reset("generation-lost")), switcher.onChange(({ to }) => {
44
45
  const taskId = to.kind === "agent" ? to.port.status().taskId : undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"install.js","sourceRoot":"","sources":["../../../../src/modes/interactive/agent-view/install.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,0BAA0B,EAAE,MAAM,8CAA8C,CAAC;AAE1F,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAA0B,MAAM,0BAA0B,CAAC;AACrF,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AACjF,OAAO,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAEjE,MAAM,SAAS,GAAG,IAAI,OAAO,EAA0C,CAAC;AAExE;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAChC,IAAyB,EACzB,QAAQ,GAAsB,CAAC,MAAM,EAAE,EAAE,CAAC,iBAAiB,CAAC,IAAI,EAAE,MAAM,CAAC;IAEzE,IAAI,QAAQ,GAAG,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACnC,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;QAC5B,QAAQ,GAAG,IAAI,iBAAiB,CAC/B,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.js\";\nimport { IsolatedInteractiveRuntime } from \"../../interactive-engine/isolated-runtime.js\";\nimport type { InteractiveModeBase } from \"../interactive-mode-base.ts\";\nimport { setAgentViewBridge } from \"./agent-view-bridge.ts\";\nimport { AgentViewSwitcher, type OpenAgentViewPort } from \"./agent-view-switcher.ts\";\nimport { openAgentViewPort } from \"./open-port.ts\";\nimport { installPromptRetarget } from \"./prompt-retarget.ts\";\nimport { FIRST_FRAME_TIMEOUT_MS } from \"./remote-port.ts\";\nimport { holdTranscriptDock, installTranscriptSlot } from \"./transcript-slot.ts\";\nimport { installViewedCommandGates } from \"./viewed-commands.ts\";\n\nconst switchers = new WeakMap<InteractiveModeBase, AgentViewSwitcher>();\n\n/**\n * The mode's switcher, made on first use: a session can be bound before the screen is set up. `openPort` opens the\n * subagents it shows; the first call decides it.\n */\nexport function agentViewSwitcher(\n\tmode: InteractiveModeBase,\n\topenPort: OpenAgentViewPort = (taskId) => openAgentViewPort(mode, taskId),\n): AgentViewSwitcher {\n\tlet switcher = switchers.get(mode);\n\tif (switcher === undefined) {\n\t\tswitcher = new AgentViewSwitcher(\n\t\t\topenPort,\n\t\t\t(message) => mode.showWarning(message),\n\t\t\t() => holdTranscriptDock(mode, FIRST_FRAME_TIMEOUT_MS),\n\t\t);\n\t\tswitchers.set(mode, switcher);\n\t\tmode.agentView = switcher;\n\t}\n\treturn switcher;\n}\n\n/**\n * Set up the single chat screen once the main screen is: the transcript area, the prompt's retargeting and the\n * hotkey gates follow what the switcher shows, in that order. On the isolated host the engine's panel and `/tasks`\n * reach the switcher through `engine_view_agent`, and learn what it shows through `set_viewed_agent`.\n */\nexport function installAgentView(mode: InteractiveModeBase): AgentViewSwitcher {\n\tconst switcher = agentViewSwitcher(mode);\n\tconst undo: (() => void)[] = [\n\t\tinstallTranscriptSlot(mode, switcher),\n\t\tinstallPromptRetarget(mode, switcher),\n\t\tinstallViewedCommandGates(mode, switcher),\n\t];\n\tconst runtime = mode.runtimeHost;\n\tif (runtime instanceof IsolatedInteractiveRuntime) {\n\t\tundo.push(\n\t\t\truntime.onEngineMessage((message) => {\n\t\t\t\tif (message.type !== \"engine_view_agent\") return;\n\t\t\t\tswitcher.requestView(message.taskId === null ? undefined : (message.taskId as TaskId), {\n\t\t\t\t\tkeepScreen: message.keepScreen === true,\n\t\t\t\t});\n\t\t\t}),\n\t\t\truntime.onGenerationEnded(() => switcher.reset(\"generation-lost\")),\n\t\t\tswitcher.onChange(({ to }) => {\n\t\t\t\tconst taskId = to.kind === \"agent\" ? to.port.status().taskId : undefined;\n\t\t\t\tvoid runtime\n\t\t\t\t\t.requestAgentView({ type: \"set_viewed_agent\", ...(taskId === undefined ? {} : { taskId }) })\n\t\t\t\t\t.catch(() => {\n\t\t\t\t\t\t// A lost engine forgets what was shown; its replacement starts on main.\n\t\t\t\t\t});\n\t\t\t}),\n\t\t);\n\t}\n\tmode.disposeAgentView = () => {\n\t\tmode.disposeAgentView = undefined;\n\t\t// Main is shown again first, while every part still follows the switcher, then each part is taken down.\n\t\tswitcher.dispose();\n\t\tfor (const release of undo.reverse()) {\n\t\t\ttry {\n\t\t\t\trelease();\n\t\t\t} catch {\n\t\t\t\t// One part's failure must not keep the others installed.\n\t\t\t}\n\t\t}\n\t};\n\treturn switcher;\n}\n\n/**\n * Let the panel and `/tasks` of a session bound in this process change what the screen shows. Answers the unbind,\n * which shows main again: the subagents shown belonged to the session left.\n */\nexport function bindAgentViewSession(mode: InteractiveModeBase, session: object): () => void {\n\tif (mode.runtimeHost instanceof IsolatedInteractiveRuntime) return () => {};\n\tconst switcher = agentViewSwitcher(mode);\n\tsetAgentViewBridge(session, switcher);\n\treturn () => {\n\t\tsetAgentViewBridge(session, undefined);\n\t\tswitcher.reset(\"session-replaced\");\n\t};\n}\n"]}
1
+ {"version":3,"file":"install.js","sourceRoot":"","sources":["../../../../src/modes/interactive/agent-view/install.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,0BAA0B,EAAE,MAAM,8CAA8C,CAAC;AAE1F,OA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gB,GAAG,GAAG,EAAE;QAC5B,IAAI,CAAC,gBAAgB,GAAG,SAAS,CAAC;QAClC,wGAAwG;QACxG,QAAQ,CAAC,OAAO,EAAE,CAAC;QACnB,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC;YACtC,IAAI,CAAC;gBACJ,OAAO,EAAE,CAAC;YACX,CAAC;YAAC,MAAM,CAAC;gBACR,yDAAyD;YAC1D,CAAC;QACF,CAAC;IACF,CAAC,CAAC;IACF,OAAO,QAAQ,CAAC;AACjB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,oBAAoB,CAAC,IAAyB,EAAE,OAAe;IAC9E,IAAI,IAAI,CAAC,WAAW,YAAY,0BAA0B;QAAE,OAAO,GAAG,EAAE,GAAE,CAAC,CAAC;IAC5E,MAAM,QAAQ,GAAG,iBAAiB,CAAC,IAAI,CAAC,CAAC;IACzC,kBAAkB,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IACtC,OAAO,GAAG,EAAE;QACX,kBAAkB,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;QACvC,QAAQ,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC;IACpC,CAAC,CAAC;AACH,CAAC","sourcesContent":["import type { TaskId } from \"../../../core/tasks/contracts.js\";\nimport { IsolatedInteractiveRuntime } from \"../../interactive-engine/isolated-runtime.js\";\nimport type { InteractiveModeBase } from \"../interactive-mode-base.ts\";\nimport { setAgentViewBridge } from \"./agent-view-bridge.ts\";\nimport { AgentViewSwitcher, type OpenAgentViewPort } from \"./agent-view-switcher.ts\";\nimport { openAgentViewPort } from \"./open-port.ts\";\nimport { installPromptRetarget } from \"./prompt-retarget.ts\";\nimport { FIRST_FRAME_TIMEOUT_MS } from \"./remote-port.ts\";\nimport { holdTranscriptDock, installTranscriptSlot } from \"./transcript-slot.ts\";\nimport { installViewedCommandGates } from \"./viewed-commands.ts\";\n\nconst switchers = new WeakMap<InteractiveModeBase, AgentViewSwitcher>();\n\n/**\n * The mode's switcher, made on first use: a session can be bound before the screen is set up. `openPort` opens the\n * subagents it shows; the first call decides it.\n */\nexport function agentViewSwitcher(\n\tmode: InteractiveModeBase,\n\topenPort: OpenAgentViewPort = (taskId, options) => openAgentViewPort(mode, taskId, options),\n): AgentViewSwitcher {\n\tlet switcher = switchers.get(mode);\n\tif (switcher === undefined) {\n\t\tswitcher = new AgentViewSwitcher(\n\t\t\topenPort,\n\t\t\t(message) => mode.showWarning(message),\n\t\t\t() => holdTranscriptDock(mode, FIRST_FRAME_TIMEOUT_MS),\n\t\t);\n\t\tswitchers.set(mode, switcher);\n\t\tmode.agentView = switcher;\n\t}\n\treturn switcher;\n}\n\n/**\n * Set up the single chat screen once the main screen is: the transcript area, the prompt's retargeting and the\n * hotkey gates follow what the switcher shows, in that order. On the isolated host the engine's panel and `/tasks`\n * reach the switcher through `engine_view_agent`, and learn what it shows through `set_viewed_agent`.\n */\nexport function installAgentView(mode: InteractiveModeBase): AgentViewSwitcher {\n\tconst switcher = agentViewSwitcher(mode);\n\tconst undo: (() => void)[] = [\n\t\tinstallTranscriptSlot(mode, switcher),\n\t\tinstallPromptRetarget(mode, switcher),\n\t\tinstallViewedCommandGates(mode, switcher),\n\t];\n\tconst runtime = mode.runtimeHost;\n\tif (runtime instanceof IsolatedInteractiveRuntime) {\n\t\tundo.push(\n\t\t\truntime.onEngineMessage((message) => {\n\t\t\t\tif (message.type !== \"engine_view_agent\") return;\n\t\t\t\tswitcher.requestView(message.taskId === null ? undefined : (message.taskId as TaskId), {\n\t\t\t\t\tkeepScreen: message.keepScreen === true,\n\t\t\t\t\tpanel: message.panel === true,\n\t\t\t\t});\n\t\t\t}),\n\t\t\truntime.onGenerationEnded(() => switcher.reset(\"generation-lost\")),\n\t\t\tswitcher.onChange(({ to }) => {\n\t\t\t\tconst taskId = to.kind === \"agent\" ? to.port.status().taskId : undefined;\n\t\t\t\tvoid runtime\n\t\t\t\t\t.requestAgentView({ type: \"set_viewed_agent\", ...(taskId === undefined ? {} : { taskId }) })\n\t\t\t\t\t.catch(() => {\n\t\t\t\t\t\t// A lost engine forgets what was shown; its replacement starts on main.\n\t\t\t\t\t});\n\t\t\t}),\n\t\t);\n\t}\n\tmode.disposeAgentView = () => {\n\t\tmode.disposeAgentView = undefined;\n\t\t// Main is shown again first, while every part still follows the switcher, then each part is taken down.\n\t\tswitcher.dispose();\n\t\tfor (const release of undo.reverse()) {\n\t\t\ttry {\n\t\t\t\trelease();\n\t\t\t} catch {\n\t\t\t\t// One part's failure must not keep the others installed.\n\t\t\t}\n\t\t}\n\t};\n\treturn switcher;\n}\n\n/**\n * Let the panel and `/tasks` of a session bound in this process change what the screen shows. Answers the unbind,\n * which shows main again: the subagents shown belonged to the session left.\n */\nexport function bindAgentViewSession(mode: InteractiveModeBase, session: object): () => void {\n\tif (mode.runtimeHost instanceof IsolatedInteractiveRuntime) return () => {};\n\tconst switcher = agentViewSwitcher(mode);\n\tsetAgentViewBridge(session, switcher);\n\treturn () => {\n\t\tsetAgentViewBridge(session, undefined);\n\t\tswitcher.reset(\"session-replaced\");\n\t};\n}\n"]}
@@ -1,12 +1,14 @@
1
1
  import type { TaskId } from "../../../core/tasks/contracts.js";
2
2
  import { type TaskTranscriptEnvironment } from "../components/task-transcript-page.ts";
3
3
  import type { InteractiveModeBase } from "../interactive-mode-base.ts";
4
+ import type { AgentViewRequestOptions } from "./agent-view-bridge.ts";
4
5
  import type { AgentViewPort } from "./contracts.ts";
5
6
  /** Where a subagent's transcript is drawn in this process: the main chat's own render settings and repaint. */
6
7
  export declare function mainTranscriptEnvironment(mode: InteractiveModeBase): TaskTranscriptEnvironment;
7
8
  /**
8
9
  * Open the port of the subagent `taskId` is an attempt of: over the owner's task view in this process, or through the
9
- * isolated engine. Undefined when there is no such subagent.
10
+ * isolated engine. Undefined when there is no such subagent. In this process the panel draws as it opens; the engine's
11
+ * is awaited when the request says it opens again (`options.panel`).
10
12
  */
11
- export declare function openAgentViewPort(mode: InteractiveModeBase, taskId: TaskId): Promise<AgentViewPort | undefined>;
13
+ export declare function openAgentViewPort(mode: InteractiveModeBase, taskId: TaskId, options?: AgentViewRequestOptions): Promise<AgentViewPort | undefined>;
12
14
  //# sourceMappingURL=open-port.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"open-port.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/agent-view/open-port.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAC;AAK/D,OAAO,EAAE,KAAK,yBAAyB,EAAuB,MAAM,uCAAuC,CAAC;AAC5G,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAEvE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAKpD,+GAA+G;AAC/G,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,mBAAmB,GAAG,yBAAyB,CAc9F;AAED;;;GAGG;AACH,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,mBAAmB,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC,CAsBrH"}
1
+ {"version":3,"file":"open-port.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/agent-view/open-port.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAC;AAK/D,OAAO,EAAE,KAAK,yBAAyB,EAAuB,MAAM,uCAAuC,CAAC;AAC5G,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAEvE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACtE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAKpD,+GAA+G;AAC/G,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,mBAAmB,GAAG,yBAAyB,CAc9F;AAED;;;;GAIG;AACH,wBAAsB,iBAAiB,CACtC,IAAI,EAAE,mBAAmB,EACzB,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,uBAAuB,GAC/B,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC,CA2BpC"}
@@ -26,9 +26,10 @@ export function mainTranscriptEnvironment(mode) {
26
26
  }
27
27
  /**
28
28
  * Open the port of the subagent `taskId` is an attempt of: over the owner's task view in this process, or through the
29
- * isolated engine. Undefined when there is no such subagent.
29
+ * isolated engine. Undefined when there is no such subagent. In this process the panel draws as it opens; the engine's
30
+ * is awaited when the request says it opens again (`options.panel`).
30
31
  */
31
- export async function openAgentViewPort(mode, taskId) {
32
+ export async function openAgentViewPort(mode, taskId, options) {
32
33
  const runtime = mode.runtimeHost;
33
34
  if (runtime instanceof IsolatedInteractiveRuntime) {
34
35
  const terminal = mode.ui.terminal;
@@ -36,7 +37,7 @@ export async function openAgentViewPort(mode, taskId) {
36
37
  width: Math.max(1, terminal.columns),
37
38
  rows: transcriptSlotRows(mode),
38
39
  ...(terminal.colorDepth === undefined ? {} : { colorDepth: terminal.colorDepth }),
39
- });
40
+ }, { panel: options?.keepScreen === true && options.panel === true });
40
41
  }
41
42
  const session = mode.session;
42
43
  const store = getOwnerTaskStore(session);
@@ -1 +1 @@
1
- {"version":3,"file":"open-port.js","sourceRoot":"","sources":["../../../../src/modes/interactive/agent-view/open-port.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAE1G,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAC;AAC9E,OAAO,EAAE,0BAA0B,EAAE,MAAM,8CAA8C,CAAC;AAC1F,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AACrE,OAAO,EAAkC,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AAE5G,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CA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C;YACpC,IAAI,EAAE,kBAAkB,CAAC,IAAI,CAAC;YAC9B,GAAG,CAAC,QAAQ,CAAC,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,QAAQ,CAAC,UAAU,EAAE,CAAC;SACjF,CAAC,CAAC;IACJ,CAAC;IACD,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;IAC7B,MAAM,KAAK,GAAG,iBAAiB,CAAC,OAAO,CAAC,CAAC;IACzC,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IAC1C,OAAO,sBAAsB,CAAC;QAC7B,MAAM,EAAE,mBAAmB,CAAC,KAAK,CAAC;QAClC,MAAM;QACN,GAAG,EAAE,yBAAyB,CAAC,IAAI,CAAC;QACpC,aAAa,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,aAAa,EAAE;QAC5C,IAAI,EAAE,GAAG,EAAE,CAAC,kBAAkB,CAAC,IAAI,CAAC;QACpC,WAAW,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,wBAAwB,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE,CAAC;QACxE,KAAK,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,mBAAmB,CAAC,OAAO,EAAE,QAAQ,CAAC;KAC3D,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import { dismissedAgentPanelItems, subscribeAgentPanel } from \"../../../core/tasks/agent-panel-source.ts\";\nimport type { TaskId } from \"../../../core/tasks/contracts.js\";\nimport { getOwnerTaskStore } from \"../../../core/tasks/owner-store.js\";\nimport { ownerTaskViewSource } from \"../../../core/tasks/task-view-source.js\";\nimport { IsolatedInteractiveRuntime } from \"../../interactive-engine/isolated-runtime.js\";\nimport { ChatSessionHost } from \"../components/chat-session-host.ts\";\nimport { type TaskTranscriptEnvironment, themedChatHostStyle } from \"../components/task-transcript-page.ts\";\nimport type { InteractiveModeBase } from \"../interactive-mode-base.ts\";\nimport { getEditorTheme } from \"../theme/theme.js\";\nimport type { AgentViewPort } from \"./contracts.ts\";\nimport { openLocalAgentViewPort } from \"./local-port.ts\";\nimport { openRemoteAgentViewPort } from \"./remote-port.ts\";\nimport { transcriptSlotRows } from \"./transcript-slot.ts\";\n\n/** Where a subagent's transcript is drawn in this process: the main chat's own render settings and repaint. */\nexport function mainTranscriptEnvironment(mode: InteractiveModeBase): TaskTranscriptEnvironment {\n\tconst ui = mode.createExtensionUIContext();\n\treturn {\n\t\tcreateChat: (opts) => new ChatSessionHost(opts),\n\t\ttui: mode.ui,\n\t\tkeybindings: mode.keybindings,\n\t\teditorTheme: getEditorTheme(),\n\t\tstyle: themedChatHostStyle(),\n\t\tgetChatRenderSettings: () => ui.getChatRenderSettings(),\n\t\tgetToolsExpanded: () => mode.toolOutputExpanded,\n\t\tsetToolsExpanded: (expanded) => ui.setToolsExpanded(expanded),\n\t\tfooterData: mode.footerDataProvider,\n\t\tnotify: (message) => mode.showWarning(message),\n\t};\n}\n\n/**\n * Open the port of the subagent `taskId` is an attempt of: over the owner's task view in this process, or through the\n * isolated engine. Undefined when there is no such subagent.\n */\nexport async function openAgentViewPort(mode: InteractiveModeBase, taskId: TaskId): Promise<AgentViewPort | undefined> {\n\tconst runtime = mode.runtimeHost;\n\tif (runtime instanceof IsolatedInteractiveRuntime) {\n\t\tconst terminal = mode.ui.terminal;\n\t\treturn openRemoteAgentViewPort(runtime, taskId, {\n\t\t\twidth: Math.max(1, terminal.columns),\n\t\t\trows: transcriptSlotRows(mode),\n\t\t\t...(terminal.colorDepth === undefined ? {} : { colorDepth: terminal.colorDepth }),\n\t\t});\n\t}\n\tconst session = mode.session;\n\tconst store = getOwnerTaskStore(session);\n\tif (store === undefined) return undefined;\n\treturn openLocalAgentViewPort({\n\t\tsource: ownerTaskViewSource(store),\n\t\ttaskId,\n\t\tenv: mainTranscriptEnvironment(mode),\n\t\trequestRender: () => mode.ui.requestRender(),\n\t\trows: () => transcriptSlotRows(mode),\n\t\tisDismissed: (id) => dismissedAgentPanelItems(session).has(`task:${id}`),\n\t\twatch: (listener) => subscribeAgentPanel(session, listener),\n\t});\n}\n"]}
1
+ {"version":3,"file":"open-port.js","sourceRoot":"","sources":["../../../../src/modes/interactive/agent-view/open-port.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAE1G,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAC;AAC9E,OAAO,EAAE,0BAA0B,EAAE,MAAM,8CAA8C,CAAC;AAC1F,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AACrE,OAAO,EAAkC,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AAE5G,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAGnD,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,+GAA+G;AAC/G,MAAM,UAAU,yBAAyB,CAAC,IAAyB;IAClE,MAAM,EAAE,GAAG,IAAI,CAAC,wBAAwB,EAAE,CAAC;IAC3C,OAAO;QACN,UAAU,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,eAAe,CAAC,IAAI,CAAC;QAC/C,GAAG,EAAE,IAAI,CAAC,EAAE;QACZ,WAAW,EAAE,IAAI,CAAC,WAAW;QAC7B,WAAW,EAAE,cAAc,EAAE;QAC7B,KAAK,EAAE,mBAAmB,EAAE;QAC5B,qBAAqB,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,qBAAqB,EAAE;QACvD,gBAAgB,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,kBAAkB;QAC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EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,aAAa,EAAE;QAC5C,IAAI,EAAE,GAAG,EAAE,CAAC,kBAAkB,CAAC,IAAI,CAAC;QACpC,WAAW,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,wBAAwB,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE,CAAC;QACxE,KAAK,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,mBAAmB,CAAC,OAAO,EAAE,QAAQ,CAAC;KAC3D,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import { dismissedAgentPanelItems, subscribeAgentPanel } from \"../../../core/tasks/agent-panel-source.ts\";\nimport type { TaskId } from \"../../../core/tasks/contracts.js\";\nimport { getOwnerTaskStore } from \"../../../core/tasks/owner-store.js\";\nimport { ownerTaskViewSource } from \"../../../core/tasks/task-view-source.js\";\nimport { IsolatedInteractiveRuntime } from \"../../interactive-engine/isolated-runtime.js\";\nimport { ChatSessionHost } from \"../components/chat-session-host.ts\";\nimport { type TaskTranscriptEnvironment, themedChatHostStyle } from \"../components/task-transcript-page.ts\";\nimport type { InteractiveModeBase } from \"../interactive-mode-base.ts\";\nimport { getEditorTheme } from \"../theme/theme.js\";\nimport type { AgentViewRequestOptions } from \"./agent-view-bridge.ts\";\nimport type { AgentViewPort } from \"./contracts.ts\";\nimport { openLocalAgentViewPort } from \"./local-port.ts\";\nimport { openRemoteAgentViewPort } from \"./remote-port.ts\";\nimport { transcriptSlotRows } from \"./transcript-slot.ts\";\n\n/** Where a subagent's transcript is drawn in this process: the main chat's own render settings and repaint. */\nexport function mainTranscriptEnvironment(mode: InteractiveModeBase): TaskTranscriptEnvironment {\n\tconst ui = mode.createExtensionUIContext();\n\treturn {\n\t\tcreateChat: (opts) => new ChatSessionHost(opts),\n\t\ttui: mode.ui,\n\t\tkeybindings: mode.keybindings,\n\t\teditorTheme: getEditorTheme(),\n\t\tstyle: themedChatHostStyle(),\n\t\tgetChatRenderSettings: () => ui.getChatRenderSettings(),\n\t\tgetToolsExpanded: () => mode.toolOutputExpanded,\n\t\tsetToolsExpanded: (expanded) => ui.setToolsExpanded(expanded),\n\t\tfooterData: mode.footerDataProvider,\n\t\tnotify: (message) => mode.showWarning(message),\n\t};\n}\n\n/**\n * Open the port of the subagent `taskId` is an attempt of: over the owner's task view in this process, or through the\n * isolated engine. Undefined when there is no such subagent. In this process the panel draws as it opens; the engine's\n * is awaited when the request says it opens again (`options.panel`).\n */\nexport async function openAgentViewPort(\n\tmode: InteractiveModeBase,\n\ttaskId: TaskId,\n\toptions?: AgentViewRequestOptions,\n): Promise<AgentViewPort | undefined> {\n\tconst runtime = mode.runtimeHost;\n\tif (runtime instanceof IsolatedInteractiveRuntime) {\n\t\tconst terminal = mode.ui.terminal;\n\t\treturn openRemoteAgentViewPort(\n\t\t\truntime,\n\t\t\ttaskId,\n\t\t\t{\n\t\t\t\twidth: Math.max(1, terminal.columns),\n\t\t\t\trows: transcriptSlotRows(mode),\n\t\t\t\t...(terminal.colorDepth === undefined ? {} : { colorDepth: terminal.colorDepth }),\n\t\t\t},\n\t\t\t{ panel: options?.keepScreen === true && options.panel === true },\n\t\t);\n\t}\n\tconst session = mode.session;\n\tconst store = getOwnerTaskStore(session);\n\tif (store === undefined) return undefined;\n\treturn openLocalAgentViewPort({\n\t\tsource: ownerTaskViewSource(store),\n\t\ttaskId,\n\t\tenv: mainTranscriptEnvironment(mode),\n\t\trequestRender: () => mode.ui.requestRender(),\n\t\trows: () => transcriptSlotRows(mode),\n\t\tisDismissed: (id) => dismissedAgentPanelItems(session).has(`task:${id}`),\n\t\twatch: (listener) => subscribeAgentPanel(session, listener),\n\t});\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"prompt-retarget.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/agent-view/prompt-retarget.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,0BAA0B,EAAE,MAAM,8CAA8C,CAAC;AAO1F,OAAO,KAAK,EAAE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mFD,mHAAmH;AACnH,wBAAgB,SAAS,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAczD;AAsGD,mGAAmG;AACnG,wBAAgB,2BAA2B,CAC1C,IAAI,EAAE,mBAAmB,EACzB,OAAO,EAAE,IAAI,CAAC,0BAA0B,EAAE,mBAAmB,CAAC,GAC5D,MAAM,IAAI,CAqBZ"}
@@ -9,11 +9,11 @@ import { clickableKeyTextHint } from "../components/nav-keys.js";
9
9
  import { WorkingStatusComponent } from "../components/working-status.js";
10
10
  import { isPhysicalCtrlC, isPhysicalEscape } from "../interactive-key-identity.js";
11
11
  import { mergeRestoredDraft } from "../interactive-prompt-restore.js";
12
- import { engineLossSubagentNotice } from "../interactive-queueing.js";
12
+ import { engineLossSubagentNotice, engineLossUnconfirmedNotice } from "../interactive-queueing.js";
13
13
  import { theme } from "../theme/theme.js";
14
14
  import { appendPromptText, markMovedDraft, rewritePromptOwnText, switchPrompt, takePromptText, } from "./agent-drafts.js";
15
15
  import { notifyViewed } from "./viewed-notices.js";
16
- import { forgetIfIdle, goneAgentNotice, liveAgentSteering } from "./viewed-submit.js";
16
+ import { backFromViewedAgent, forgetIfIdle, goneAgentNotice, liveAgentSteering, replayToViewedAgent, } from "./viewed-submit.js";
17
17
  /**
18
18
  * Retarget the main prompt to the agent the screen shows. While main is shown nothing here changes what the
19
19
  * main chat does or draws. While a subagent is shown, the same prompt writes to it: its own prompt (draft, cursor,
@@ -76,6 +76,8 @@ function retargetOnSwitch(mode, switcher, activate) {
76
76
  });
77
77
  editor.setTopRuleLabel(() => port.status().ruleLabel);
78
78
  mode.footer.setViewedWork(() => ({ working: port.status().busy, stopVerb: "pause" }));
79
+ // ← on its empty prompt shows main; the main chat's ← stays the editor's.
80
+ editor.onNavBack = (input) => backFromViewedAgent(mode, input);
79
81
  unwatch = port.subscribe(() => {
80
82
  mode.updatePendingMessagesDisplay();
81
83
  mode.ui.requestRender();
@@ -85,6 +87,7 @@ function retargetOnSwitch(mode, switcher, activate) {
85
87
  editor.setPlaceholder(undefined);
86
88
  editor.setTopRuleLabel(() => mode.sessionManager.getSessionName());
87
89
  mode.footer.setViewedWork(undefined);
90
+ editor.onNavBack = undefined;
88
91
  }
89
92
  if (from.kind === "agent") {
90
93
  if (from.port.status().gone)
@@ -98,6 +101,7 @@ function retargetOnSwitch(mode, switcher, activate) {
98
101
  return () => {
99
102
  stop();
100
103
  unwatch?.();
104
+ editor.onNavBack = undefined;
101
105
  };
102
106
  }
103
107
  /** What was typed for a subagent that is gone goes in front of main's prompt, with the notice. */
@@ -261,7 +265,8 @@ const heldForTask = new WeakMap();
261
265
  * While a subagent is being opened, what the reader types is meant for it. The keys wait, and once it is shown they
262
266
  * reach its prompt in order, Enter included. When the request does not land, their text is kept for that subagent
263
267
  * (or, when it cannot be opened, shown in a notice) and the keys that send, pause or take back are dropped: nothing
264
- * typed for one agent reaches another. Esc cancels the request; Ctrl+C and Ctrl+D are never held.
268
+ * typed for one agent reaches another. A ← among them moves its cursor and never shows main. Esc cancels the request;
269
+ * Ctrl+C and Ctrl+D are never held.
265
270
  */
266
271
  function holdWhileOpening(mode, switcher) {
267
272
  let held;
@@ -281,8 +286,7 @@ function holdWhileOpening(mode, switcher) {
281
286
  if (keys.keys.length === 0)
282
287
  return;
283
288
  if (outcome === "shown") {
284
- for (const key of keys.keys)
285
- mode.editor.handleInput(key);
289
+ replayToViewedAgent(mode, keys.keys);
286
290
  mode.ui.requestRender();
287
291
  return;
288
292
  }
@@ -365,6 +369,15 @@ export function attachLostAgentQueueNotices(mode, runtime) {
365
369
  if (event.expected)
366
370
  return;
367
371
  for (const { port, controller } of liveAgentSteering(mode)) {
372
+ // What it had taken and not been seen to save, being delivered or shown, may or may not have been saved with its
373
+ // session: listed in full.
374
+ const { delivering, unsaved } = port.status();
375
+ const taken = [
376
+ ...(unsaved ?? []),
377
+ ...(delivering === undefined ? [] : [...delivering.steering, ...delivering.followUp]),
378
+ ];
379
+ if (taken.length > 0)
380
+ mode.showWarning(engineLossUnconfirmedNotice(taken, port.status().name));
368
381
  // Its listed queue, what it took before listing, and what was on its way: steering first, each lane in order.
369
382
  controller.loseTarget();
370
383
  const messages = controller.recoverTarget() ?? [];