@bastani/atomic 0.10.0-alpha.1 → 0.10.1-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 (234) hide show
  1. package/CHANGELOG.md +211 -0
  2. package/dist/builtin/intercom/CHANGELOG.md +22 -0
  3. package/dist/builtin/intercom/package.json +1 -1
  4. package/dist/builtin/mcp/package.json +1 -1
  5. package/dist/builtin/subagents/CHANGELOG.md +35 -0
  6. package/dist/builtin/subagents/package.json +1 -1
  7. package/dist/builtin/subagents/skills/tmux/scripts/wait-for-text.sh +33 -3
  8. package/dist/builtin/web-access/package.json +1 -1
  9. package/dist/core/agent-session-events.d.ts.map +1 -1
  10. package/dist/core/agent-session-events.js +21 -6
  11. package/dist/core/agent-session-events.js.map +1 -1
  12. package/dist/core/lifecycle-timings.d.ts +6 -0
  13. package/dist/core/lifecycle-timings.d.ts.map +1 -1
  14. package/dist/core/lifecycle-timings.js +12 -0
  15. package/dist/core/lifecycle-timings.js.map +1 -1
  16. package/dist/core/queued-message-delivery.d.ts +41 -0
  17. package/dist/core/queued-message-delivery.d.ts.map +1 -0
  18. package/dist/core/queued-message-delivery.js +48 -0
  19. package/dist/core/queued-message-delivery.js.map +1 -0
  20. package/dist/core/storage/node-sqlite-thread.d.ts +64 -0
  21. package/dist/core/storage/node-sqlite-thread.d.ts.map +1 -0
  22. package/dist/core/storage/node-sqlite-thread.js +326 -0
  23. package/dist/core/storage/node-sqlite-thread.js.map +1 -0
  24. package/dist/core/storage/node-sqlite.d.ts.map +1 -1
  25. package/dist/core/storage/node-sqlite.js +230 -104
  26. package/dist/core/storage/node-sqlite.js.map +1 -1
  27. package/dist/core/tasks/agent-panel-source.d.ts +5 -0
  28. package/dist/core/tasks/agent-panel-source.d.ts.map +1 -1
  29. package/dist/core/tasks/agent-panel-source.js +1 -1
  30. package/dist/core/tasks/agent-panel-source.js.map +1 -1
  31. package/dist/modes/interactive/agent-view/agent-view-bridge.d.ts +8 -1
  32. package/dist/modes/interactive/agent-view/agent-view-bridge.d.ts.map +1 -1
  33. package/dist/modes/interactive/agent-view/agent-view-bridge.js.map +1 -1
  34. package/dist/modes/interactive/agent-view/agent-view-switcher.d.ts +11 -5
  35. package/dist/modes/interactive/agent-view/agent-view-switcher.d.ts.map +1 -1
  36. package/dist/modes/interactive/agent-view/agent-view-switcher.js +17 -5
  37. package/dist/modes/interactive/agent-view/agent-view-switcher.js.map +1 -1
  38. package/dist/modes/interactive/agent-view/contracts.d.ts +5 -0
  39. package/dist/modes/interactive/agent-view/contracts.d.ts.map +1 -1
  40. package/dist/modes/interactive/agent-view/contracts.js.map +1 -1
  41. package/dist/modes/interactive/agent-view/install.d.ts.map +1 -1
  42. package/dist/modes/interactive/agent-view/install.js +6 -3
  43. package/dist/modes/interactive/agent-view/install.js.map +1 -1
  44. package/dist/modes/interactive/agent-view/local-port.d.ts +5 -0
  45. package/dist/modes/interactive/agent-view/local-port.d.ts.map +1 -1
  46. package/dist/modes/interactive/agent-view/local-port.js +8 -0
  47. package/dist/modes/interactive/agent-view/local-port.js.map +1 -1
  48. package/dist/modes/interactive/agent-view/remote-port.d.ts +4 -1
  49. package/dist/modes/interactive/agent-view/remote-port.d.ts.map +1 -1
  50. package/dist/modes/interactive/agent-view/remote-port.js +22 -8
  51. package/dist/modes/interactive/agent-view/remote-port.js.map +1 -1
  52. package/dist/modes/interactive/agent-view/transcript-slot.d.ts +9 -0
  53. package/dist/modes/interactive/agent-view/transcript-slot.d.ts.map +1 -1
  54. package/dist/modes/interactive/agent-view/transcript-slot.js +141 -1
  55. package/dist/modes/interactive/agent-view/transcript-slot.js.map +1 -1
  56. package/dist/modes/interactive/components/agent-panel.d.ts +6 -0
  57. package/dist/modes/interactive/components/agent-panel.d.ts.map +1 -1
  58. package/dist/modes/interactive/components/agent-panel.js +40 -10
  59. package/dist/modes/interactive/components/agent-panel.js.map +1 -1
  60. package/dist/modes/interactive/components/atomic-working-status.d.ts +15 -0
  61. package/dist/modes/interactive/components/atomic-working-status.d.ts.map +1 -1
  62. package/dist/modes/interactive/components/atomic-working-status.js +51 -3
  63. package/dist/modes/interactive/components/atomic-working-status.js.map +1 -1
  64. package/dist/modes/interactive/components/bash-execution.d.ts +2 -0
  65. package/dist/modes/interactive/components/bash-execution.d.ts.map +1 -1
  66. package/dist/modes/interactive/components/bash-execution.js +5 -1
  67. package/dist/modes/interactive/components/bash-execution.js.map +1 -1
  68. package/dist/modes/interactive/components/branch-summary-message.d.ts +2 -0
  69. package/dist/modes/interactive/components/branch-summary-message.d.ts.map +1 -1
  70. package/dist/modes/interactive/components/branch-summary-message.js +5 -1
  71. package/dist/modes/interactive/components/branch-summary-message.js.map +1 -1
  72. package/dist/modes/interactive/components/chat-message-renderer.d.ts +2 -0
  73. package/dist/modes/interactive/components/chat-message-renderer.d.ts.map +1 -1
  74. package/dist/modes/interactive/components/chat-message-renderer.js +17 -6
  75. package/dist/modes/interactive/components/chat-message-renderer.js.map +1 -1
  76. package/dist/modes/interactive/components/chat-session-host-events.d.ts.map +1 -1
  77. package/dist/modes/interactive/components/chat-session-host-events.js +35 -4
  78. package/dist/modes/interactive/components/chat-session-host-events.js.map +1 -1
  79. package/dist/modes/interactive/components/chat-session-host-rendering.d.ts.map +1 -1
  80. package/dist/modes/interactive/components/chat-session-host-rendering.js +70 -13
  81. package/dist/modes/interactive/components/chat-session-host-rendering.js.map +1 -1
  82. package/dist/modes/interactive/components/chat-session-host-runtime.d.ts +7 -0
  83. package/dist/modes/interactive/components/chat-session-host-runtime.d.ts.map +1 -1
  84. package/dist/modes/interactive/components/chat-session-host-runtime.js +25 -4
  85. package/dist/modes/interactive/components/chat-session-host-runtime.js.map +1 -1
  86. package/dist/modes/interactive/components/chat-session-host-state.d.ts +41 -1
  87. package/dist/modes/interactive/components/chat-session-host-state.d.ts.map +1 -1
  88. package/dist/modes/interactive/components/chat-session-host-state.js +24 -3
  89. package/dist/modes/interactive/components/chat-session-host-state.js.map +1 -1
  90. package/dist/modes/interactive/components/chat-session-host-steering.d.ts.map +1 -1
  91. package/dist/modes/interactive/components/chat-session-host-steering.js +2 -1
  92. package/dist/modes/interactive/components/chat-session-host-steering.js.map +1 -1
  93. package/dist/modes/interactive/components/chat-session-host.d.ts +13 -1
  94. package/dist/modes/interactive/components/chat-session-host.d.ts.map +1 -1
  95. package/dist/modes/interactive/components/chat-session-host.js +20 -2
  96. package/dist/modes/interactive/components/chat-session-host.js.map +1 -1
  97. package/dist/modes/interactive/components/chat-transcript.d.ts +15 -0
  98. package/dist/modes/interactive/components/chat-transcript.d.ts.map +1 -1
  99. package/dist/modes/interactive/components/chat-transcript.js +14 -1
  100. package/dist/modes/interactive/components/chat-transcript.js.map +1 -1
  101. package/dist/modes/interactive/components/compaction-boundary-message.d.ts +2 -0
  102. package/dist/modes/interactive/components/compaction-boundary-message.d.ts.map +1 -1
  103. package/dist/modes/interactive/components/compaction-boundary-message.js +5 -1
  104. package/dist/modes/interactive/components/compaction-boundary-message.js.map +1 -1
  105. package/dist/modes/interactive/components/custom-entry.d.ts +2 -0
  106. package/dist/modes/interactive/components/custom-entry.d.ts.map +1 -1
  107. package/dist/modes/interactive/components/custom-entry.js +5 -1
  108. package/dist/modes/interactive/components/custom-entry.js.map +1 -1
  109. package/dist/modes/interactive/components/custom-message.d.ts +2 -0
  110. package/dist/modes/interactive/components/custom-message.d.ts.map +1 -1
  111. package/dist/modes/interactive/components/custom-message.js +5 -1
  112. package/dist/modes/interactive/components/custom-message.js.map +1 -1
  113. package/dist/modes/interactive/components/model-column.d.ts +96 -0
  114. package/dist/modes/interactive/components/model-column.d.ts.map +1 -0
  115. package/dist/modes/interactive/components/model-column.js +207 -0
  116. package/dist/modes/interactive/components/model-column.js.map +1 -0
  117. package/dist/modes/interactive/components/prompt-slot.d.ts +73 -0
  118. package/dist/modes/interactive/components/prompt-slot.d.ts.map +1 -0
  119. package/dist/modes/interactive/components/prompt-slot.js +201 -0
  120. package/dist/modes/interactive/components/prompt-slot.js.map +1 -0
  121. package/dist/modes/interactive/components/queued-messages-view.d.ts +6 -3
  122. package/dist/modes/interactive/components/queued-messages-view.d.ts.map +1 -1
  123. package/dist/modes/interactive/components/queued-messages-view.js +7 -4
  124. package/dist/modes/interactive/components/queued-messages-view.js.map +1 -1
  125. package/dist/modes/interactive/components/session-selector.d.ts +2 -0
  126. package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
  127. package/dist/modes/interactive/components/session-selector.js +4 -0
  128. package/dist/modes/interactive/components/session-selector.js.map +1 -1
  129. package/dist/modes/interactive/components/skill-invocation-message.d.ts +2 -0
  130. package/dist/modes/interactive/components/skill-invocation-message.d.ts.map +1 -1
  131. package/dist/modes/interactive/components/skill-invocation-message.js +5 -1
  132. package/dist/modes/interactive/components/skill-invocation-message.js.map +1 -1
  133. package/dist/modes/interactive/components/task-board.d.ts +12 -3
  134. package/dist/modes/interactive/components/task-board.d.ts.map +1 -1
  135. package/dist/modes/interactive/components/task-board.js +33 -17
  136. package/dist/modes/interactive/components/task-board.js.map +1 -1
  137. package/dist/modes/interactive/components/task-inspector.d.ts +6 -1
  138. package/dist/modes/interactive/components/task-inspector.d.ts.map +1 -1
  139. package/dist/modes/interactive/components/task-inspector.js +27 -7
  140. package/dist/modes/interactive/components/task-inspector.js.map +1 -1
  141. package/dist/modes/interactive/components/task-row.d.ts +4 -0
  142. package/dist/modes/interactive/components/task-row.d.ts.map +1 -1
  143. package/dist/modes/interactive/components/task-row.js +7 -1
  144. package/dist/modes/interactive/components/task-row.js.map +1 -1
  145. package/dist/modes/interactive/components/task-transcript-page.d.ts +5 -0
  146. package/dist/modes/interactive/components/task-transcript-page.d.ts.map +1 -1
  147. package/dist/modes/interactive/components/task-transcript-page.js +25 -0
  148. package/dist/modes/interactive/components/task-transcript-page.js.map +1 -1
  149. package/dist/modes/interactive/components/tool-execution.d.ts +7 -0
  150. package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  151. package/dist/modes/interactive/components/tool-execution.js +19 -2
  152. package/dist/modes/interactive/components/tool-execution.js.map +1 -1
  153. package/dist/modes/interactive/components/tool-group-tracker.d.ts +20 -3
  154. package/dist/modes/interactive/components/tool-group-tracker.d.ts.map +1 -1
  155. package/dist/modes/interactive/components/tool-group-tracker.js +34 -7
  156. package/dist/modes/interactive/components/tool-group-tracker.js.map +1 -1
  157. package/dist/modes/interactive/components/transcript-block-clicks.d.ts +14 -2
  158. package/dist/modes/interactive/components/transcript-block-clicks.d.ts.map +1 -1
  159. package/dist/modes/interactive/components/transcript-block-clicks.js +23 -2
  160. package/dist/modes/interactive/components/transcript-block-clicks.js.map +1 -1
  161. package/dist/modes/interactive/interactive-agent-events.js +10 -2
  162. package/dist/modes/interactive/interactive-agent-events.js.map +1 -1
  163. package/dist/modes/interactive/interactive-extension-runtime.d.ts +12 -1
  164. package/dist/modes/interactive/interactive-extension-runtime.d.ts.map +1 -1
  165. package/dist/modes/interactive/interactive-extension-runtime.js +37 -5
  166. package/dist/modes/interactive/interactive-extension-runtime.js.map +1 -1
  167. package/dist/modes/interactive/interactive-input-handling.d.ts.map +1 -1
  168. package/dist/modes/interactive/interactive-input-handling.js +70 -46
  169. package/dist/modes/interactive/interactive-input-handling.js.map +1 -1
  170. package/dist/modes/interactive/interactive-mode-base.d.ts.map +1 -1
  171. package/dist/modes/interactive/interactive-mode-base.js +7 -1
  172. package/dist/modes/interactive/interactive-mode-base.js.map +1 -1
  173. package/dist/modes/interactive/interactive-prompt-turn.js +17 -9
  174. package/dist/modes/interactive/interactive-prompt-turn.js.map +1 -1
  175. package/dist/modes/interactive/interactive-queueing.d.ts.map +1 -1
  176. package/dist/modes/interactive/interactive-queueing.js +2 -1
  177. package/dist/modes/interactive/interactive-queueing.js.map +1 -1
  178. package/dist/modes/interactive/interactive-render-chat.d.ts +18 -1
  179. package/dist/modes/interactive/interactive-render-chat.d.ts.map +1 -1
  180. package/dist/modes/interactive/interactive-render-chat.js +90 -10
  181. package/dist/modes/interactive/interactive-render-chat.js.map +1 -1
  182. package/dist/modes/interactive/interactive-session-routing.js +2 -0
  183. package/dist/modes/interactive/interactive-session-routing.js.map +1 -1
  184. package/dist/modes/interactive/interactive-task-projection.js +2 -2
  185. package/dist/modes/interactive/interactive-task-projection.js.map +1 -1
  186. package/dist/modes/interactive/screen-hold.d.ts +41 -0
  187. package/dist/modes/interactive/screen-hold.d.ts.map +1 -0
  188. package/dist/modes/interactive/screen-hold.js +80 -0
  189. package/dist/modes/interactive/screen-hold.js.map +1 -0
  190. package/dist/modes/interactive/started-run-echo.d.ts +66 -0
  191. package/dist/modes/interactive/started-run-echo.d.ts.map +1 -0
  192. package/dist/modes/interactive/started-run-echo.js +75 -0
  193. package/dist/modes/interactive/started-run-echo.js.map +1 -0
  194. package/dist/modes/interactive-engine/engine-custom-ui.d.ts +1 -0
  195. package/dist/modes/interactive-engine/engine-custom-ui.d.ts.map +1 -1
  196. package/dist/modes/interactive-engine/engine-custom-ui.js +25 -1
  197. package/dist/modes/interactive-engine/engine-custom-ui.js.map +1 -1
  198. package/dist/modes/interactive-engine/engine-quit-intent.d.ts.map +1 -1
  199. package/dist/modes/interactive-engine/engine-quit-intent.js +3 -0
  200. package/dist/modes/interactive-engine/engine-quit-intent.js.map +1 -1
  201. package/dist/modes/interactive-engine/protocol.d.ts +5 -0
  202. package/dist/modes/interactive-engine/protocol.d.ts.map +1 -1
  203. package/dist/modes/interactive-engine/protocol.js +7 -1
  204. package/dist/modes/interactive-engine/protocol.js.map +1 -1
  205. package/dist/modes/interactive-engine/remote-component.d.ts +10 -2
  206. package/dist/modes/interactive-engine/remote-component.d.ts.map +1 -1
  207. package/dist/modes/interactive-engine/remote-component.js +19 -2
  208. package/dist/modes/interactive-engine/remote-component.js.map +1 -1
  209. package/dist/modes/interactive-engine/remote-renderer.d.ts +10 -0
  210. package/dist/modes/interactive-engine/remote-renderer.d.ts.map +1 -1
  211. package/dist/modes/interactive-engine/remote-renderer.js +24 -4
  212. package/dist/modes/interactive-engine/remote-renderer.js.map +1 -1
  213. package/dist/modes/interactive-engine/transcript-frame-layout.d.ts +50 -0
  214. package/dist/modes/interactive-engine/transcript-frame-layout.d.ts.map +1 -0
  215. package/dist/modes/interactive-engine/transcript-frame-layout.js +95 -0
  216. package/dist/modes/interactive-engine/transcript-frame-layout.js.map +1 -0
  217. package/dist/modes/rpc/agent-panel-bridge.d.ts.map +1 -1
  218. package/dist/modes/rpc/agent-panel-bridge.js +16 -0
  219. package/dist/modes/rpc/agent-panel-bridge.js.map +1 -1
  220. package/dist/modes/rpc/agent-view-engine-registry.d.ts.map +1 -1
  221. package/dist/modes/rpc/agent-view-engine-registry.js +36 -1
  222. package/dist/modes/rpc/agent-view-engine-registry.js.map +1 -1
  223. package/dist/modes/rpc/agent-view-rpc-panel.d.ts.map +1 -1
  224. package/dist/modes/rpc/agent-view-rpc-panel.js +5 -1
  225. package/dist/modes/rpc/agent-view-rpc-panel.js.map +1 -1
  226. package/dist/modes/rpc/task-ui-bridge.js +1 -1
  227. package/dist/modes/rpc/task-ui-bridge.js.map +1 -1
  228. package/docs/background-tasks.md +1 -1
  229. package/docs/development.md +2 -0
  230. package/docs/extensions/authoring.md +1 -1
  231. package/docs/keybindings.md +2 -2
  232. package/docs/storage.md +1 -0
  233. package/npm-shrinkwrap.json +49 -49
  234. package/package.json +6 -6
@@ -5,6 +5,7 @@ import { canonicalizePathAsync } from "../../utils/paths.js";
5
5
  import { withHostProjectTrustPrompt } from "../interactive-engine/extension-ui-bridge.js";
6
6
  import { promptHandle } from "./agent-view/agent-drafts.js";
7
7
  import { mountIdleStatus } from "./components/idle-status.js";
8
+ import { awaitFirstContent } from "./components/prompt-slot.js";
8
9
  import { InteractiveModeBase } from "./interactive-mode-base.js";
9
10
  import { APP_NAME, getProjectTrustPathAsync, hasTrustRequiringProjectResourcesAsync, keyTextHint, Loader, MissingSessionCwdError, ProjectTrustStore, SessionManager, SessionSelectorComponent, Spacer, TreeSelectorComponent, TrustSelectorComponent, theme, } from "./interactive-mode-deps.js";
10
11
  import { showQueueRestoreFailure } from "./interactive-queueing.js";
@@ -318,6 +319,7 @@ InteractiveModeBase.prototype.showSessionSelector = function () {
318
319
  showRenameHint: true,
319
320
  keybindings: this.keybindings,
320
321
  }, { id: this.sessionManager.getSessionId(), directory: this.sessionManager.getSessionDir() });
322
+ awaitFirstContent(selector, () => selector.awaitingFirstContent());
321
323
  return {
322
324
  component: selector,
323
325
  focus: selector,
@@ -1 +1 @@
1
- {"version":3,"file":"interactive-session-routing.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-session-routing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAE/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,0CAA0C,CAAC;AAClF,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,0BAA0B,EAAE,MAAM,8CAA8C,CAAC;AAC1F,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EACN,QAAQ,EAGR,wBAAwB,EACxB,sCAAsC,EACtC,WAAW,EACX,MAAM,EACN,sBAAsB,EACtB,iBAAiB,EACjB,cAAc,EACd,wBAAwB,EACxB,MAAM,EACN,qBAAqB,EACrB,sBAAsB,EACtB,KAAK,GACL,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,6BAA6B,EAAE,MAAM,gCAAgC,CAAC;AAC/E,OAAO,EAAE,qBAAqB,EAAE,MAAM,6CAA6C,CAAC;AACpF,OAAO,EAAE,mBAAmB,EAAE,MAAM,q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AG,EAAE,KAAK,CAAC,CAAC;IACxC,CAAC;YAAS,CAAC;QACV,IAAI,MAAM,CAAC,eAAe,EAAE,KAAK,KAAK;YAAE,MAAM,MAAM,CAAC,eAAe,EAAE,CAAC,KAAK,EAAE,CAAC;IAChF,CAAC;AACF,CAAC;AAED;;;GAGG;AACH,mBAAmB,CAAC,SAAS,CAAC,qBAAqB,GAAG,KAAK,WAE1D,MAA4B,EAC5B,GAAW,EACX,OAAiE;IAEjE,MAAM,MAAM,GAAG,CAAC,MAAM,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC,YAAY,EAAE,CAAC;IAC7E,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,MAAM,EAAE;QAC3D,WAAW,EAAE,OAAO,EAAE,WAAW;QACjC,0BAA0B,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,IAAI,CAAC,yBAAyB,CAAC,OAAO,CAAC;QAChF,OAAO,EAAE,MAAM;KACf,CAAC,CAAC;IACH,IAAI,MAAM,CAAC,SAAS,EAAE,CAAC;QACtB,MAAM,IAAI,CAAC,cAAc,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;QAChD,OAAO,MAAM,CAAC;IACf,CAAC;IACD,sBAAsB,CAAC,IAAI,EAAE,2BAA2B,MAAM,OAAO,GAAG,EAAE,CAAC,CAAC;IAC5E,OAAO,MAAM,CAAC;AACf,CAAC,CAAC","sourcesContent":["import { dirname } from \"node:path\";\nimport type { Focusable } from \"@bastani/atomic-tui\";\nimport { isResumeFailure } from \"../../core/resume/failure.ts\";\nimport type { SessionInfo } from \"../../core/session-manager.ts\";\nimport { worktreeRestoreNotices } from \"../../core/session-worktree-snapshots.ts\";\nimport { canonicalizePathAsync } from \"../../utils/paths.ts\";\nimport { withHostProjectTrustPrompt } from \"../interactive-engine/extension-ui-bridge.ts\";\nimport { promptHandle } from \"./agent-view/agent-drafts.ts\";\nimport { mountIdleStatus } from \"./components/idle-status.ts\";\nimport { InteractiveModeBase } from \"./interactive-mode-base.ts\";\nimport {\n\tAPP_NAME,\n\ttype Component,\n\ttype ExtensionCommandContext,\n\tgetProjectTrustPathAsync,\n\thasTrustRequiringProjectResourcesAsync,\n\tkeyTextHint,\n\tLoader,\n\tMissingSessionCwdError,\n\tProjectTrustStore,\n\tSessionManager,\n\tSessionSelectorComponent,\n\tSpacer,\n\tTreeSelectorComponent,\n\tTrustSelectorComponent,\n\ttheme,\n} from \"./interactive-mode-deps.ts\";\nimport type { MissingCwdForkSource } from \"./interactive-mode-surface.ts\";\nimport { showQueueRestoreFailure } from \"./interactive-queueing.ts\";\nimport { clearChatForRerender } from \"./interactive-render-chat.ts\";\nimport { onPreliminaryCatalogWithdrawn } from \"./interactive-startup-trust.ts\";\nimport { setSummaryCancellable } from \"./interactive-summarization-retry-events.ts\";\nimport { resolveResumeTarget } from \"./resume-catalog.ts\";\nimport { showSessionNotices } from \"./session-notices.ts\";\n\nInteractiveModeBase.prototype.handleCloneCommand = async function (this: InteractiveModeBase): Promise<void> {\n\t// The prompt the command was typed in: a subagent's, when the clone was asked for from its view.\n\tconst prompt = promptHandle(this, \"viewed\");\n\tawait this.ensureDeferredStartupComplete();\n\tconst leafId = this.sessionManager.getLeafId();\n\tif (!leafId) {\n\t\tthis.showStatus(\"Nothing to clone yet\");\n\t\treturn;\n\t}\n\n\ttry {\n\t\tconst result = await this.runtimeHost.fork(leafId, { position: \"at\" });\n\t\tif (result.cancelled) {\n\t\t\tthis.ui.requestRender();\n\t\t\treturn;\n\t\t}\n\n\t\tthis.renderCurrentSessionState();\n\t\tprompt.setText(\"\");\n\t\tthis.showStatus(\"Cloned to new session\");\n\t} catch (error: unknown) {\n\t\tthis.showError(error instanceof Error ? error.message : String(error));\n\t}\n};\n\nInteractiveModeBase.prototype.maybeSaveImplicitProjectTrustAfterReload = async function (\n\tthis: InteractiveModeBase,\n): Promise<boolean> {\n\tconst cwd = this.sessionManager.getCwd();\n\tif (this.autoTrustOnReloadCwd !== cwd) {\n\t\treturn false;\n\t}\n\tif (!this.settingsManager.isProjectTrusted() || !(await hasTrustRequiringProjectResourcesAsync(cwd))) {\n\t\treturn false;\n\t}\n\n\tconst trustStore = new ProjectTrustStore(this.runtimeHost.services.agentDir);\n\ttry {\n\t\tif ((await trustStore.getAsync(cwd)) !== null) {\n\t\t\tthis.autoTrustOnReloadCwd = undefined;\n\t\t\treturn false;\n\t\t}\n\t\tawait trustStore.setAsync(cwd, true);\n\t\tthis.autoTrustOnReloadCwd = undefined;\n\t\treturn true;\n\t} catch (error) {\n\t\tthis.showWarning(\n\t\t\t`Could not save project trust after reload: ${error instanceof Error ? error.message : String(error)}`,\n\t\t);\n\t\treturn false;\n\t}\n};\n\nInteractiveModeBase.prototype.showTrustSelector = async function (this: InteractiveModeBase): Promise<void> {\n\tconst cwd = this.sessionManager.getCwd();\n\tconst trustStore = new ProjectTrustStore(this.runtimeHost.services.agentDir);\n\tconst trustData = Promise.all([trustStore.getEntryAsync(cwd), getProjectTrustPathAsync(cwd)]);\n\tawait withHostProjectTrustPrompt(\n\t\tthis.runtimeHost,\n\t\t\"select\",\n\t\t\"Project trust\",\n\t\t() =>\n\t\t\tnew Promise<void>((resolve, reject) => {\n\t\t\t\tthis.showSelector((done) => {\n\t\t\t\t\tconst heldInput: string[] = [];\n\t\t\t\t\tlet selector: TrustSelectorComponent | undefined;\n\t\t\t\t\tlet focused = false;\n\t\t\t\t\tlet closed = false;\n\t\t\t\t\tconst view: Component & Focusable = {\n\t\t\t\t\t\tcapturesViewportInput: true,\n\t\t\t\t\t\tget focused() {\n\t\t\t\t\t\t\treturn focused;\n\t\t\t\t\t\t},\n\t\t\t\t\t\tset focused(value: boolean) {\n\t\t\t\t\t\t\tfocused = value;\n\t\t\t\t\t\t\tif (selector) selector.focused = value;\n\t\t\t\t\t\t},\n\t\t\t\t\t\trender: (width) => selector?.render(width) ?? [],\n\t\t\t\t\t\tinvalidate: () => selector?.invalidate(),\n\t\t\t\t\t\thandleInput: (data) => {\n\t\t\t\t\t\t\tif (selector) selector.handleInput(data);\n\t\t\t\t\t\t\telse heldInput.push(data);\n\t\t\t\t\t\t},\n\t\t\t\t\t\thandleMouse: (event) => selector?.handleMouse(event),\n\t\t\t\t\t};\n\t\t\t\t\ttrustData.then(\n\t\t\t\t\t\t([savedDecision, trustPath]) => {\n\t\t\t\t\t\t\tif (closed) return;\n\t\t\t\t\t\t\tconst shown = new TrustSelectorComponent({\n\t\t\t\t\t\t\t\tcwd,\n\t\t\t\t\t\t\t\ttrustPath,\n\t\t\t\t\t\t\t\tsavedDecision,\n\t\t\t\t\t\t\t\tprojectTrusted: this.settingsManager.isProjectTrusted(),\n\t\t\t\t\t\t\t\tonSelect: (selection) => {\n\t\t\t\t\t\t\t\t\ttrustStore.setManyAsync(selection.updates).then(\n\t\t\t\t\t\t\t\t\t\t() => {\n\t\t\t\t\t\t\t\t\t\t\tdone();\n\t\t\t\t\t\t\t\t\t\t\tthis.showStatus(\n\t\t\t\t\t\t\t\t\t\t\t\t`Saved trust decision: ${selection.trusted ? \"trusted\" : \"untrusted\"}. Restart ${APP_NAME} for this to take effect.`,\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t(error: unknown) => {\n\t\t\t\t\t\t\t\t\t\t\tshown.selector.retrySelection();\n\t\t\t\t\t\t\t\t\t\t\tthis.showError(error instanceof Error ? error.message : String(error));\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tonCancel: () => {\n\t\t\t\t\t\t\t\t\tdone();\n\t\t\t\t\t\t\t\t\tthis.ui.requestRender();\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tshown.focused = focused;\n\t\t\t\t\t\t\tselector = shown;\n\t\t\t\t\t\t\tfor (const data of heldInput.splice(0)) {\n\t\t\t\t\t\t\t\tif (closed) break;\n\t\t\t\t\t\t\t\tshown.handleInput(data);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tthis.ui.requestRender();\n\t\t\t\t\t\t},\n\t\t\t\t\t\t(error: unknown) => {\n\t\t\t\t\t\t\treject(error);\n\t\t\t\t\t\t\tdone();\n\t\t\t\t\t\t},\n\t\t\t\t\t);\n\t\t\t\t\treturn {\n\t\t\t\t\t\tcomponent: view,\n\t\t\t\t\t\tfocus: view,\n\t\t\t\t\t\tdispose: () => {\n\t\t\t\t\t\t\tclosed = true;\n\t\t\t\t\t\t\tresolve();\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\t});\n\t\t\t}),\n\t).catch((error: Error) => this.showError(error.message));\n};\n\nInteractiveModeBase.prototype.showTreeSelector = async function (\n\tthis: InteractiveModeBase,\n\tinitialSelectedId?: string,\n): Promise<void> {\n\tawait this.ensureDeferredStartupComplete();\n\t// The navigation's text is for main's prompt, also when the tree was opened from a subagent's view.\n\tconst mainPrompt = promptHandle(this, \"main\");\n\tconst archived =\n\t\tthis.sessionManager.hasFullHistory?.() === false\n\t\t\t? await (await import(\"./components/stored-tree-view.js\")).StoredTreeView.open(this.sessionManager)\n\t\t\t: undefined;\n\tconst tree = archived?.tree ?? this.sessionManager.getTree();\n\tconst realLeafId = archived ? archived.leaf : this.sessionManager.getLeafId();\n\tif (archived) {\n\t\tarchived.view.onUpdate = () => this.ui.requestRender();\n\t\tarchived.view.onError = (error) => this.showError(error.message);\n\t}\n\tconst initialFilterMode = this.settingsManager.getTreeFilterMode();\n\n\tif (tree.length === 0) {\n\t\tthis.showStatus(\"No entries in session\");\n\t\treturn;\n\t}\n\n\tthis.showSelector((done) => {\n\t\tconst selector = new TreeSelectorComponent(\n\t\t\ttree,\n\t\t\trealLeafId,\n\t\t\tthis.ui.terminal.rows,\n\t\t\tasync (entryId) => {\n\t\t\t\t// Compare against the live leaf: a response that was streaming while the\n\t\t\t\t// selector was open may have advanced it past the captured value.\n\t\t\t\tif (entryId === this.sessionManager.getLeafId()) {\n\t\t\t\t\tdone();\n\t\t\t\t\tthis.showStatus(\"Already at this point\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Ask about summarization\n\t\t\t\tdone(); // Close selector first\n\n\t\t\t\t// Loop until user makes a complete choice or cancels to tree\n\t\t\t\tlet wantsSummary = false;\n\t\t\t\tlet customInstructions: string | undefined;\n\n\t\t\t\t// Check if we should skip the prompt (user preference to always default to no summary)\n\t\t\t\tif (!this.settingsManager.getBranchSummarySkipPrompt()) {\n\t\t\t\t\twhile (true) {\n\t\t\t\t\t\tconst summaryChoice = await this.showExtensionSelector(\"Summarize branch?\", [\n\t\t\t\t\t\t\t\"No summary\",\n\t\t\t\t\t\t\t\"Summarize\",\n\t\t\t\t\t\t\t\"Summarize with custom prompt\",\n\t\t\t\t\t\t]);\n\n\t\t\t\t\t\tif (summaryChoice === undefined) {\n\t\t\t\t\t\t\t// User pressed escape - re-show tree selector with same selection\n\t\t\t\t\t\t\tthis.showTreeSelector(entryId);\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\twantsSummary = summaryChoice !== \"No summary\";\n\n\t\t\t\t\t\tif (summaryChoice === \"Summarize with custom prompt\") {\n\t\t\t\t\t\t\tcustomInstructions = await this.showExtensionEditor(\"Custom summarization instructions\");\n\t\t\t\t\t\t\tif (customInstructions === undefined) {\n\t\t\t\t\t\t\t\t// User cancelled - loop back to summary selector\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// User made a complete choice\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (this.session.isStreaming) {\n\t\t\t\t\t// The clear goes out before the abort. The editor fills when the session answers, so a clear that\n\t\t\t\t\t// stalls or fails cannot hold up the abort.\n\t\t\t\t\tvoid this.restoreQueuedMessagesToEditor().catch((error: unknown) =>\n\t\t\t\t\t\tshowQueueRestoreFailure(this, error),\n\t\t\t\t\t);\n\t\t\t\t\tawait this.session.abort();\n\t\t\t\t}\n\t\t\t\tif (this.session.isCompacting) {\n\t\t\t\t\tthis.showError(\n\t\t\t\t\t\t\"Wait for the current compaction or tree navigation to finish before navigating the session tree.\",\n\t\t\t\t\t);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Set up escape handler and loader if summarizing\n\t\t\t\tlet summaryLoader: Loader | undefined;\n\t\t\t\tconst originalOnEscape = this.defaultEditor.onEscape;\n\n\t\t\t\tif (wantsSummary) {\n\t\t\t\t\tthis.defaultEditor.onEscape = () => {\n\t\t\t\t\t\tthis.session.abortBranchSummary();\n\t\t\t\t\t};\n\t\t\t\t\tsetSummaryCancellable(this, true);\n\t\t\t\t\tthis.chatContainer.addChild(new Spacer(1));\n\t\t\t\t\tsummaryLoader = new Loader(\n\t\t\t\t\t\tthis.ui,\n\t\t\t\t\t\t(spinner) => theme.fg(\"accent\", spinner),\n\t\t\t\t\t\t(text) => theme.fg(\"muted\", text),\n\t\t\t\t\t\t`Summarizing branch... (${keyTextHint(\"app.interrupt\", \"Cancel\")})`,\n\t\t\t\t\t);\n\t\t\t\t\tthis.statusContainer.addChild(summaryLoader);\n\t\t\t\t\tthis.ui.requestRender();\n\t\t\t\t}\n\n\t\t\t\ttry {\n\t\t\t\t\tawait this.ensureDeferredStartupComplete();\n\t\t\t\t\tconst result = await this.session.navigateTree(entryId, {\n\t\t\t\t\t\tsummarize: wantsSummary,\n\t\t\t\t\t\tcustomInstructions,\n\t\t\t\t\t});\n\n\t\t\t\t\tif (result.aborted) {\n\t\t\t\t\t\t// Summarization aborted - re-show tree selector with same selection\n\t\t\t\t\t\tthis.showStatus(\"Branch summarization cancelled\");\n\t\t\t\t\t\tthis.showTreeSelector(entryId);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tif (result.cancelled) {\n\t\t\t\t\t\tthis.showStatus(\"Navigation cancelled\");\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Update UI\n\t\t\t\t\tclearChatForRerender(this);\n\t\t\t\t\tthis.renderInitialMessages();\n\t\t\t\t\tif (result.editorText && !mainPrompt.getText().trim()) {\n\t\t\t\t\t\tmainPrompt.setText(result.editorText);\n\t\t\t\t\t}\n\t\t\t\t\tthis.showStatus(\"Navigated to selected point\");\n\t\t\t\t\tvoid this.flushCompactionQueue({ willRetry: false });\n\t\t\t\t} catch (error) {\n\t\t\t\t\tthis.showError(error instanceof Error ? error.message : String(error));\n\t\t\t\t} finally {\n\t\t\t\t\tif (summaryLoader) {\n\t\t\t\t\t\tsummaryLoader.stop();\n\t\t\t\t\t\tthis.statusContainer.clear();\n\t\t\t\t\t\tmountIdleStatus(this.statusContainer, this.settingsManager.getClearOnShrink());\n\t\t\t\t\t}\n\t\t\t\t\tsetSummaryCancellable(this, false);\n\t\t\t\t\tthis.defaultEditor.onEscape = originalOnEscape;\n\t\t\t\t}\n\t\t\t},\n\t\t\t() => {\n\t\t\t\tdone();\n\t\t\t\tthis.ui.requestRender();\n\t\t\t},\n\t\t\tasync (entryId, label) => {\n\t\t\t\tawait this.sessionManager.appendLabelChange(entryId, label);\n\t\t\t},\n\t\t\tinitialSelectedId,\n\t\t\tinitialFilterMode,\n\t\t\tarchived?.view,\n\t\t);\n\t\tselector.onLabelError = (error) => this.showError(error.message);\n\t\tselector.onLabelUpdate = () => this.ui.requestRender();\n\t\tconst dispose = onPreliminaryCatalogWithdrawn(this, () => {\n\t\t\tselector.getTreeList().updateInitialFilter(this.settingsManager.getTreeFilterMode());\n\t\t\tthis.ui.requestRender();\n\t\t});\n\t\treturn {\n\t\t\tcomponent: selector,\n\t\t\tfocus: selector,\n\t\t\tdispose: () => {\n\t\t\t\tarchived?.view.dispose();\n\t\t\t\tdispose?.();\n\t\t\t},\n\t\t};\n\t});\n};\n\nInteractiveModeBase.prototype.showSessionSelector = function (this: InteractiveModeBase): void {\n\tthis.showSelector((done) => {\n\t\tconst selector = new SessionSelectorComponent(\n\t\t\t(onProgress) =>\n\t\t\t\tSessionManager.list(this.sessionManager.getCwd(), this.sessionManager.getSessionStore(), onProgress),\n\t\t\t(onProgress) => SessionManager.listAll(this.sessionManager.getSessionStore(), onProgress),\n\t\t\tasync (selected) => {\n\t\t\t\tdone();\n\t\t\t\tawait resumeCatalogSelection(this, selected);\n\t\t\t},\n\t\t\t() => {\n\t\t\t\tdone();\n\t\t\t\tthis.ui.requestRender();\n\t\t\t},\n\t\t\t() => {\n\t\t\t\tdone();\n\t\t\t\tvoid this.shutdown();\n\t\t\t},\n\t\t\t() => this.ui.requestRender(),\n\t\t\t{\n\t\t\t\tvariant: \"mixed\",\n\t\t\t\ttitle: \"Resume\",\n\t\t\t\tdeleteSession:\n\t\t\t\t\tthis.sessionManager.getSessionStore().descriptor.adapter === \"jsonl\"\n\t\t\t\t\t\t? undefined\n\t\t\t\t\t\t: (id) => this.sessionManager.deleteSession(id),\n\t\t\t\trenameSession: async (selected, nextName) => {\n\t\t\t\t\tconst next = (nextName ?? \"\").trim();\n\t\t\t\t\tif (!next) return;\n\t\t\t\t\tconst store = this.sessionManager.getSessionStore();\n\t\t\t\t\tconst directory = store.descriptor.adapter === \"jsonl\" ? dirname(selected.path) : undefined;\n\t\t\t\t\tif (\n\t\t\t\t\t\tselected.id === this.sessionManager.getSessionId() &&\n\t\t\t\t\t\t(directory === undefined ||\n\t\t\t\t\t\t\t(await canonicalizePathAsync(directory)) ===\n\t\t\t\t\t\t\t\t(await canonicalizePathAsync(this.sessionManager.getSessionDir())))\n\t\t\t\t\t) {\n\t\t\t\t\t\tawait this.session.setSessionName(next);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst mgr = await this.sessionManager.openSessionById(selected.id, undefined, directory, {\n\t\t\t\t\t\t\thistory: \"tail\",\n\t\t\t\t\t\t});\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tawait mgr.appendSessionInfo(next);\n\t\t\t\t\t\t} finally {\n\t\t\t\t\t\t\tif (mgr.getSessionStore() !== store) await mgr.getSessionStore().close();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tshowRenameHint: true,\n\t\t\t\tkeybindings: this.keybindings,\n\t\t\t},\n\n\t\t\t{ id: this.sessionManager.getSessionId(), directory: this.sessionManager.getSessionDir() },\n\t\t);\n\t\treturn {\n\t\t\tcomponent: selector,\n\t\t\tfocus: selector,\n\t\t\tdispose: () => selector.dispose(),\n\t\t};\n\t});\n};\n\nasync function resumeCatalogSelection(mode: InteractiveModeBase, selected: SessionInfo): Promise<void> {\n\tconst directory =\n\t\tmode.sessionManager.getSessionStore().descriptor.adapter === \"jsonl\" ? dirname(selected.path) : undefined;\n\tawait mode.handleResumeSession(selected.id, undefined, directory);\n}\n\nInteractiveModeBase.prototype.handleResumeTarget = async function (\n\tthis: InteractiveModeBase,\n\ttarget: string,\n): Promise<void> {\n\tif (/\\s/.test(target) || target.startsWith(\"-\")) {\n\t\tthis.showError(\"Usage: /resume [session-id].\");\n\t\treturn;\n\t}\n\ttry {\n\t\tconst sessions = await SessionManager.listAll(this.sessionManager.getSessionStore());\n\t\tconst resolution = resolveResumeTarget(target, sessions);\n\t\tif (resolution.kind === \"session\") {\n\t\t\tawait resumeCatalogSelection(this, resolution.session);\n\t\t} else if (resolution.kind === \"ambiguous\") {\n\t\t\tthis.showError(\n\t\t\t\t`Resume id \"${target}\" is ambiguous: ${resolution.matches.map((entry) => `session ${entry.id}`).join(\", \")}. Use /resume to choose an entry, or provide a unique full id.`,\n\t\t\t);\n\t\t} else {\n\t\t\tthis.showError(\n\t\t\t\t`No session matches \"${target}\". Use /resume to choose an entry, or provide a full id or unique 8-character hexadecimal prefix.`,\n\t\t\t);\n\t\t}\n\t} catch (error) {\n\t\tthis.showError(error instanceof Error ? error.message : String(error));\n\t}\n};\n\nInteractiveModeBase.prototype.handleResumeSession = async function (\n\tthis: InteractiveModeBase,\n\tsessionId: string,\n\toptions?: Parameters<ExtensionCommandContext[\"switchSession\"]>[1],\n\tsessionDirectory?: string,\n): Promise<{ cancelled: boolean }> {\n\tawait this.ensureDeferredStartupComplete();\n\tInteractiveModeBase.prototype.clearWorkingLoader.call(this);\n\tmountIdleStatus(this.statusContainer, this.settingsManager.getClearOnShrink());\n\tconst resumeStartedAt = new Date().toISOString();\n\ttry {\n\t\tconst result = await this.runtimeHost.switchSession(sessionId, {\n\t\t\twithSession: options?.withSession,\n\t\t\tsessionDirectory,\n\t\t\tprojectTrustContextFactory: (cwd) => this.createProjectTrustContext(cwd),\n\t\t\thistory: \"tail\",\n\t\t});\n\t\tif (result.cancelled) {\n\t\t\treturn result;\n\t\t}\n\t\tthis.renderCurrentSessionState();\n\t\tif (this.firstRunNoticeVisible) {\n\t\t\tthis.clearFirstRunOnboardingUi();\n\t\t}\n\t\tthis.showStatus(\"Resumed session\");\n\t\tshowSessionNotices(this, [\n\t\t\t...worktreeRestoreNotices(this.sessionManager, resumeStartedAt),\n\t\t\t...this.runtimeHost.takeResumeNotices(),\n\t\t]);\n\t\tthis.startSessionRecovery(\"resume\");\n\t\treturn result;\n\t} catch (error: unknown) {\n\t\tif (isResumeFailure(error)) {\n\t\t\tthis.showError(error.message);\n\t\t\treturn { cancelled: true };\n\t\t}\n\t\tif (error instanceof MissingSessionCwdError) {\n\t\t\tswitch (await this.promptForMissingSessionCwd(error)) {\n\t\t\t\tcase \"continue\": {\n\t\t\t\t\tconst result = await this.runtimeHost.switchSession(sessionId, {\n\t\t\t\t\t\tcwdOverride: error.issue.fallbackCwd,\n\t\t\t\t\t\tsessionDirectory,\n\t\t\t\t\t\twithSession: options?.withSession,\n\t\t\t\t\t\tprojectTrustContextFactory: (cwd) => this.createProjectTrustContext(cwd),\n\t\t\t\t\t\thistory: \"tail\",\n\t\t\t\t\t});\n\t\t\t\t\tif (!result.cancelled) finishMissingCwdResume(this, `Resumed session in ${error.issue.fallbackCwd}`);\n\t\t\t\t\treturn result;\n\t\t\t\t}\n\t\t\t\tcase \"fork\":\n\t\t\t\t\treturn this.switchToForkedSession({ sessionId, sessionDirectory }, error.issue.fallbackCwd, options);\n\t\t\t\tcase undefined:\n\t\t\t\t\tthis.showStatus(\"Resume cancelled\");\n\t\t\t\t\treturn { cancelled: true };\n\t\t\t}\n\t\t}\n\t\treturn this.handleFatalRuntimeError(\"Failed to resume session\", error);\n\t}\n};\n\nfunction finishMissingCwdResume(mode: InteractiveModeBase, status: string): void {\n\tmode.renderCurrentSessionState();\n\tif (mode.firstRunNoticeVisible) {\n\t\tmode.clearFirstRunOnboardingUi();\n\t}\n\tmode.showStatus(status);\n\tshowSessionNotices(mode, mode.runtimeHost.takeResumeNotices());\n\tmode.startSessionRecovery(\"resume\");\n}\n\nasync function forkIntoActiveStore(\n\tmode: InteractiveModeBase,\n\tsource: MissingCwdForkSource,\n\tcwd: string,\n): Promise<SessionManager> {\n\tconst store = mode.sessionManager.getSessionStore();\n\tif (\"exportPath\" in source) return SessionManager.forkFrom(source.exportPath, cwd, store);\n\tconst stored = await mode.sessionManager.openSessionById(source.sessionId, undefined, source.sessionDirectory);\n\ttry {\n\t\treturn await stored.forkTo(cwd, store);\n\t} finally {\n\t\tif (stored.getSessionStore() !== store) await stored.getSessionStore().close();\n\t}\n}\n\n/**\n * Fork a session whose stored cwd is gone into `cwd`, in the store the current session lives in, and switch to the\n * fork. An extension that cancels the switch leaves no copy behind.\n */\nInteractiveModeBase.prototype.switchToForkedSession = async function (\n\tthis: InteractiveModeBase,\n\tsource: MissingCwdForkSource,\n\tcwd: string,\n\toptions?: Parameters<ExtensionCommandContext[\"switchSession\"]>[1],\n): Promise<{ cancelled: boolean }> {\n\tconst forkId = (await forkIntoActiveStore(this, source, cwd)).getSessionId();\n\tconst result = await this.runtimeHost.switchSession(forkId, {\n\t\twithSession: options?.withSession,\n\t\tprojectTrustContextFactory: (forkCwd) => this.createProjectTrustContext(forkCwd),\n\t\thistory: \"tail\",\n\t});\n\tif (result.cancelled) {\n\t\tawait this.sessionManager.deleteSession(forkId);\n\t\treturn result;\n\t}\n\tfinishMissingCwdResume(this, `Forked into new session ${forkId} in ${cwd}`);\n\treturn result;\n};\n"]}
1
+ {"version":3,"file":"interactive-session-routing.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-session-routing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAE/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,0CAA0C,CAAC;AAClF,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,0BAA0B,EAAE,MAAM,8CAA8C,CAAC;AAC1F,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EACN,QAAQ,EAGR,wBAAwB,EACxB,sCAAsC,EACtC,WAAW,EACX,MAAM,EACN,sBAAsB,EACtB,iBAAiB,EACjB,cAAc,EACd,wBAAwB,EACxB,MAAM,EACN,qBAAqB,EACrB,sBAAsB,EACtB,KAAK,GACL,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,6BAA6B,EAAE,MAAM,gCAAgC,CAAC;AAC/E,OAAO,EAAE,qBAAqB,EAAE,MAAM,6CAA6C,CAAC;AACpF,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;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AM,CAAC,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IACxC,CAAC;YAAS,CAAC;QACV,IAAI,MAAM,CAAC,eAAe,EAAE,KAAK,KAAK;YAAE,MAAM,MAAM,CAAC,eAAe,EAAE,CAAC,KAAK,EAAE,CAAC;IAChF,CAAC;AACF,CAAC;AAED;;;GAGG;AACH,mBAAmB,CAAC,SAAS,CAAC,qBAAqB,GAAG,KAAK,WAE1D,MAA4B,EAC5B,GAAW,EACX,OAAiE;IAEjE,MAAM,MAAM,GAAG,CAAC,MAAM,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC,YAAY,EAAE,CAAC;IAC7E,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,MAAM,EAAE;QAC3D,WAAW,EAAE,OAAO,EAAE,WAAW;QACjC,0BAA0B,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,IAAI,CAAC,yBAAyB,CAAC,OAAO,CAAC;QAChF,OAAO,EAAE,MAAM;KACf,CAAC,CAAC;IACH,IAAI,MAAM,CAAC,SAAS,EAAE,CAAC;QACtB,MAAM,IAAI,CAAC,cAAc,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;QAChD,OAAO,MAAM,CAAC;IACf,CAAC;IACD,sBAAsB,CAAC,IAAI,EAAE,2BAA2B,MAAM,OAAO,GAAG,EAAE,CAAC,CAAC;IAC5E,OAAO,MAAM,CAAC;AACf,CAAC,CAAC","sourcesContent":["import { dirname } from \"node:path\";\nimport type { Focusable } from \"@bastani/atomic-tui\";\nimport { isResumeFailure } from \"../../core/resume/failure.ts\";\nimport type { SessionInfo } from \"../../core/session-manager.ts\";\nimport { worktreeRestoreNotices } from \"../../core/session-worktree-snapshots.ts\";\nimport { canonicalizePathAsync } from \"../../utils/paths.ts\";\nimport { withHostProjectTrustPrompt } from \"../interactive-engine/extension-ui-bridge.ts\";\nimport { promptHandle } from \"./agent-view/agent-drafts.ts\";\nimport { mountIdleStatus } from \"./components/idle-status.ts\";\nimport { awaitFirstContent } from \"./components/prompt-slot.ts\";\nimport { InteractiveModeBase } from \"./interactive-mode-base.ts\";\nimport {\n\tAPP_NAME,\n\ttype Component,\n\ttype ExtensionCommandContext,\n\tgetProjectTrustPathAsync,\n\thasTrustRequiringProjectResourcesAsync,\n\tkeyTextHint,\n\tLoader,\n\tMissingSessionCwdError,\n\tProjectTrustStore,\n\tSessionManager,\n\tSessionSelectorComponent,\n\tSpacer,\n\tTreeSelectorComponent,\n\tTrustSelectorComponent,\n\ttheme,\n} from \"./interactive-mode-deps.ts\";\nimport type { MissingCwdForkSource } from \"./interactive-mode-surface.ts\";\nimport { showQueueRestoreFailure } from \"./interactive-queueing.ts\";\nimport { clearChatForRerender } from \"./interactive-render-chat.ts\";\nimport { onPreliminaryCatalogWithdrawn } from \"./interactive-startup-trust.ts\";\nimport { setSummaryCancellable } from \"./interactive-summarization-retry-events.ts\";\nimport { resolveResumeTarget } from \"./resume-catalog.ts\";\nimport { showSessionNotices } from \"./session-notices.ts\";\n\nInteractiveModeBase.prototype.handleCloneCommand = async function (this: InteractiveModeBase): Promise<void> {\n\t// The prompt the command was typed in: a subagent's, when the clone was asked for from its view.\n\tconst prompt = promptHandle(this, \"viewed\");\n\tawait this.ensureDeferredStartupComplete();\n\tconst leafId = this.sessionManager.getLeafId();\n\tif (!leafId) {\n\t\tthis.showStatus(\"Nothing to clone yet\");\n\t\treturn;\n\t}\n\n\ttry {\n\t\tconst result = await this.runtimeHost.fork(leafId, { position: \"at\" });\n\t\tif (result.cancelled) {\n\t\t\tthis.ui.requestRender();\n\t\t\treturn;\n\t\t}\n\n\t\tthis.renderCurrentSessionState();\n\t\tprompt.setText(\"\");\n\t\tthis.showStatus(\"Cloned to new session\");\n\t} catch (error: unknown) {\n\t\tthis.showError(error instanceof Error ? error.message : String(error));\n\t}\n};\n\nInteractiveModeBase.prototype.maybeSaveImplicitProjectTrustAfterReload = async function (\n\tthis: InteractiveModeBase,\n): Promise<boolean> {\n\tconst cwd = this.sessionManager.getCwd();\n\tif (this.autoTrustOnReloadCwd !== cwd) {\n\t\treturn false;\n\t}\n\tif (!this.settingsManager.isProjectTrusted() || !(await hasTrustRequiringProjectResourcesAsync(cwd))) {\n\t\treturn false;\n\t}\n\n\tconst trustStore = new ProjectTrustStore(this.runtimeHost.services.agentDir);\n\ttry {\n\t\tif ((await trustStore.getAsync(cwd)) !== null) {\n\t\t\tthis.autoTrustOnReloadCwd = undefined;\n\t\t\treturn false;\n\t\t}\n\t\tawait trustStore.setAsync(cwd, true);\n\t\tthis.autoTrustOnReloadCwd = undefined;\n\t\treturn true;\n\t} catch (error) {\n\t\tthis.showWarning(\n\t\t\t`Could not save project trust after reload: ${error instanceof Error ? error.message : String(error)}`,\n\t\t);\n\t\treturn false;\n\t}\n};\n\nInteractiveModeBase.prototype.showTrustSelector = async function (this: InteractiveModeBase): Promise<void> {\n\tconst cwd = this.sessionManager.getCwd();\n\tconst trustStore = new ProjectTrustStore(this.runtimeHost.services.agentDir);\n\tconst trustData = Promise.all([trustStore.getEntryAsync(cwd), getProjectTrustPathAsync(cwd)]);\n\tawait withHostProjectTrustPrompt(\n\t\tthis.runtimeHost,\n\t\t\"select\",\n\t\t\"Project trust\",\n\t\t() =>\n\t\t\tnew Promise<void>((resolve, reject) => {\n\t\t\t\tthis.showSelector((done) => {\n\t\t\t\t\tconst heldInput: string[] = [];\n\t\t\t\t\tlet selector: TrustSelectorComponent | undefined;\n\t\t\t\t\tlet focused = false;\n\t\t\t\t\tlet closed = false;\n\t\t\t\t\tconst view: Component & Focusable = {\n\t\t\t\t\t\tcapturesViewportInput: true,\n\t\t\t\t\t\tget focused() {\n\t\t\t\t\t\t\treturn focused;\n\t\t\t\t\t\t},\n\t\t\t\t\t\tset focused(value: boolean) {\n\t\t\t\t\t\t\tfocused = value;\n\t\t\t\t\t\t\tif (selector) selector.focused = value;\n\t\t\t\t\t\t},\n\t\t\t\t\t\trender: (width) => selector?.render(width) ?? [],\n\t\t\t\t\t\tinvalidate: () => selector?.invalidate(),\n\t\t\t\t\t\thandleInput: (data) => {\n\t\t\t\t\t\t\tif (selector) selector.handleInput(data);\n\t\t\t\t\t\t\telse heldInput.push(data);\n\t\t\t\t\t\t},\n\t\t\t\t\t\thandleMouse: (event) => selector?.handleMouse(event),\n\t\t\t\t\t};\n\t\t\t\t\ttrustData.then(\n\t\t\t\t\t\t([savedDecision, trustPath]) => {\n\t\t\t\t\t\t\tif (closed) return;\n\t\t\t\t\t\t\tconst shown = new TrustSelectorComponent({\n\t\t\t\t\t\t\t\tcwd,\n\t\t\t\t\t\t\t\ttrustPath,\n\t\t\t\t\t\t\t\tsavedDecision,\n\t\t\t\t\t\t\t\tprojectTrusted: this.settingsManager.isProjectTrusted(),\n\t\t\t\t\t\t\t\tonSelect: (selection) => {\n\t\t\t\t\t\t\t\t\ttrustStore.setManyAsync(selection.updates).then(\n\t\t\t\t\t\t\t\t\t\t() => {\n\t\t\t\t\t\t\t\t\t\t\tdone();\n\t\t\t\t\t\t\t\t\t\t\tthis.showStatus(\n\t\t\t\t\t\t\t\t\t\t\t\t`Saved trust decision: ${selection.trusted ? \"trusted\" : \"untrusted\"}. Restart ${APP_NAME} for this to take effect.`,\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t(error: unknown) => {\n\t\t\t\t\t\t\t\t\t\t\tshown.selector.retrySelection();\n\t\t\t\t\t\t\t\t\t\t\tthis.showError(error instanceof Error ? error.message : String(error));\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tonCancel: () => {\n\t\t\t\t\t\t\t\t\tdone();\n\t\t\t\t\t\t\t\t\tthis.ui.requestRender();\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tshown.focused = focused;\n\t\t\t\t\t\t\tselector = shown;\n\t\t\t\t\t\t\tfor (const data of heldInput.splice(0)) {\n\t\t\t\t\t\t\t\tif (closed) break;\n\t\t\t\t\t\t\t\tshown.handleInput(data);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tthis.ui.requestRender();\n\t\t\t\t\t\t},\n\t\t\t\t\t\t(error: unknown) => {\n\t\t\t\t\t\t\treject(error);\n\t\t\t\t\t\t\tdone();\n\t\t\t\t\t\t},\n\t\t\t\t\t);\n\t\t\t\t\treturn {\n\t\t\t\t\t\tcomponent: view,\n\t\t\t\t\t\tfocus: view,\n\t\t\t\t\t\tdispose: () => {\n\t\t\t\t\t\t\tclosed = true;\n\t\t\t\t\t\t\tresolve();\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\t});\n\t\t\t}),\n\t).catch((error: Error) => this.showError(error.message));\n};\n\nInteractiveModeBase.prototype.showTreeSelector = async function (\n\tthis: InteractiveModeBase,\n\tinitialSelectedId?: string,\n): Promise<void> {\n\tawait this.ensureDeferredStartupComplete();\n\t// The navigation's text is for main's prompt, also when the tree was opened from a subagent's view.\n\tconst mainPrompt = promptHandle(this, \"main\");\n\tconst archived =\n\t\tthis.sessionManager.hasFullHistory?.() === false\n\t\t\t? await (await import(\"./components/stored-tree-view.js\")).StoredTreeView.open(this.sessionManager)\n\t\t\t: undefined;\n\tconst tree = archived?.tree ?? this.sessionManager.getTree();\n\tconst realLeafId = archived ? archived.leaf : this.sessionManager.getLeafId();\n\tif (archived) {\n\t\tarchived.view.onUpdate = () => this.ui.requestRender();\n\t\tarchived.view.onError = (error) => this.showError(error.message);\n\t}\n\tconst initialFilterMode = this.settingsManager.getTreeFilterMode();\n\n\tif (tree.length === 0) {\n\t\tthis.showStatus(\"No entries in session\");\n\t\treturn;\n\t}\n\n\tthis.showSelector((done) => {\n\t\tconst selector = new TreeSelectorComponent(\n\t\t\ttree,\n\t\t\trealLeafId,\n\t\t\tthis.ui.terminal.rows,\n\t\t\tasync (entryId) => {\n\t\t\t\t// Compare against the live leaf: a response that was streaming while the\n\t\t\t\t// selector was open may have advanced it past the captured value.\n\t\t\t\tif (entryId === this.sessionManager.getLeafId()) {\n\t\t\t\t\tdone();\n\t\t\t\t\tthis.showStatus(\"Already at this point\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Ask about summarization\n\t\t\t\tdone(); // Close selector first\n\n\t\t\t\t// Loop until user makes a complete choice or cancels to tree\n\t\t\t\tlet wantsSummary = false;\n\t\t\t\tlet customInstructions: string | undefined;\n\n\t\t\t\t// Check if we should skip the prompt (user preference to always default to no summary)\n\t\t\t\tif (!this.settingsManager.getBranchSummarySkipPrompt()) {\n\t\t\t\t\twhile (true) {\n\t\t\t\t\t\tconst summaryChoice = await this.showExtensionSelector(\"Summarize branch?\", [\n\t\t\t\t\t\t\t\"No summary\",\n\t\t\t\t\t\t\t\"Summarize\",\n\t\t\t\t\t\t\t\"Summarize with custom prompt\",\n\t\t\t\t\t\t]);\n\n\t\t\t\t\t\tif (summaryChoice === undefined) {\n\t\t\t\t\t\t\t// User pressed escape - re-show tree selector with same selection\n\t\t\t\t\t\t\tthis.showTreeSelector(entryId);\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\twantsSummary = summaryChoice !== \"No summary\";\n\n\t\t\t\t\t\tif (summaryChoice === \"Summarize with custom prompt\") {\n\t\t\t\t\t\t\tcustomInstructions = await this.showExtensionEditor(\"Custom summarization instructions\");\n\t\t\t\t\t\t\tif (customInstructions === undefined) {\n\t\t\t\t\t\t\t\t// User cancelled - loop back to summary selector\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// User made a complete choice\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (this.session.isStreaming) {\n\t\t\t\t\t// The clear goes out before the abort. The editor fills when the session answers, so a clear that\n\t\t\t\t\t// stalls or fails cannot hold up the abort.\n\t\t\t\t\tvoid this.restoreQueuedMessagesToEditor().catch((error: unknown) =>\n\t\t\t\t\t\tshowQueueRestoreFailure(this, error),\n\t\t\t\t\t);\n\t\t\t\t\tawait this.session.abort();\n\t\t\t\t}\n\t\t\t\tif (this.session.isCompacting) {\n\t\t\t\t\tthis.showError(\n\t\t\t\t\t\t\"Wait for the current compaction or tree navigation to finish before navigating the session tree.\",\n\t\t\t\t\t);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Set up escape handler and loader if summarizing\n\t\t\t\tlet summaryLoader: Loader | undefined;\n\t\t\t\tconst originalOnEscape = this.defaultEditor.onEscape;\n\n\t\t\t\tif (wantsSummary) {\n\t\t\t\t\tthis.defaultEditor.onEscape = () => {\n\t\t\t\t\t\tthis.session.abortBranchSummary();\n\t\t\t\t\t};\n\t\t\t\t\tsetSummaryCancellable(this, true);\n\t\t\t\t\tthis.chatContainer.addChild(new Spacer(1));\n\t\t\t\t\tsummaryLoader = new Loader(\n\t\t\t\t\t\tthis.ui,\n\t\t\t\t\t\t(spinner) => theme.fg(\"accent\", spinner),\n\t\t\t\t\t\t(text) => theme.fg(\"muted\", text),\n\t\t\t\t\t\t`Summarizing branch... (${keyTextHint(\"app.interrupt\", \"Cancel\")})`,\n\t\t\t\t\t);\n\t\t\t\t\tthis.statusContainer.addChild(summaryLoader);\n\t\t\t\t\tthis.ui.requestRender();\n\t\t\t\t}\n\n\t\t\t\ttry {\n\t\t\t\t\tawait this.ensureDeferredStartupComplete();\n\t\t\t\t\tconst result = await this.session.navigateTree(entryId, {\n\t\t\t\t\t\tsummarize: wantsSummary,\n\t\t\t\t\t\tcustomInstructions,\n\t\t\t\t\t});\n\n\t\t\t\t\tif (result.aborted) {\n\t\t\t\t\t\t// Summarization aborted - re-show tree selector with same selection\n\t\t\t\t\t\tthis.showStatus(\"Branch summarization cancelled\");\n\t\t\t\t\t\tthis.showTreeSelector(entryId);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tif (result.cancelled) {\n\t\t\t\t\t\tthis.showStatus(\"Navigation cancelled\");\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Update UI\n\t\t\t\t\tclearChatForRerender(this);\n\t\t\t\t\tthis.renderInitialMessages();\n\t\t\t\t\tif (result.editorText && !mainPrompt.getText().trim()) {\n\t\t\t\t\t\tmainPrompt.setText(result.editorText);\n\t\t\t\t\t}\n\t\t\t\t\tthis.showStatus(\"Navigated to selected point\");\n\t\t\t\t\tvoid this.flushCompactionQueue({ willRetry: false });\n\t\t\t\t} catch (error) {\n\t\t\t\t\tthis.showError(error instanceof Error ? error.message : String(error));\n\t\t\t\t} finally {\n\t\t\t\t\tif (summaryLoader) {\n\t\t\t\t\t\tsummaryLoader.stop();\n\t\t\t\t\t\tthis.statusContainer.clear();\n\t\t\t\t\t\tmountIdleStatus(this.statusContainer, this.settingsManager.getClearOnShrink());\n\t\t\t\t\t}\n\t\t\t\t\tsetSummaryCancellable(this, false);\n\t\t\t\t\tthis.defaultEditor.onEscape = originalOnEscape;\n\t\t\t\t}\n\t\t\t},\n\t\t\t() => {\n\t\t\t\tdone();\n\t\t\t\tthis.ui.requestRender();\n\t\t\t},\n\t\t\tasync (entryId, label) => {\n\t\t\t\tawait this.sessionManager.appendLabelChange(entryId, label);\n\t\t\t},\n\t\t\tinitialSelectedId,\n\t\t\tinitialFilterMode,\n\t\t\tarchived?.view,\n\t\t);\n\t\tselector.onLabelError = (error) => this.showError(error.message);\n\t\tselector.onLabelUpdate = () => this.ui.requestRender();\n\t\tconst dispose = onPreliminaryCatalogWithdrawn(this, () => {\n\t\t\tselector.getTreeList().updateInitialFilter(this.settingsManager.getTreeFilterMode());\n\t\t\tthis.ui.requestRender();\n\t\t});\n\t\treturn {\n\t\t\tcomponent: selector,\n\t\t\tfocus: selector,\n\t\t\tdispose: () => {\n\t\t\t\tarchived?.view.dispose();\n\t\t\t\tdispose?.();\n\t\t\t},\n\t\t};\n\t});\n};\n\nInteractiveModeBase.prototype.showSessionSelector = function (this: InteractiveModeBase): void {\n\tthis.showSelector((done) => {\n\t\tconst selector = new SessionSelectorComponent(\n\t\t\t(onProgress) =>\n\t\t\t\tSessionManager.list(this.sessionManager.getCwd(), this.sessionManager.getSessionStore(), onProgress),\n\t\t\t(onProgress) => SessionManager.listAll(this.sessionManager.getSessionStore(), onProgress),\n\t\t\tasync (selected) => {\n\t\t\t\tdone();\n\t\t\t\tawait resumeCatalogSelection(this, selected);\n\t\t\t},\n\t\t\t() => {\n\t\t\t\tdone();\n\t\t\t\tthis.ui.requestRender();\n\t\t\t},\n\t\t\t() => {\n\t\t\t\tdone();\n\t\t\t\tvoid this.shutdown();\n\t\t\t},\n\t\t\t() => this.ui.requestRender(),\n\t\t\t{\n\t\t\t\tvariant: \"mixed\",\n\t\t\t\ttitle: \"Resume\",\n\t\t\t\tdeleteSession:\n\t\t\t\t\tthis.sessionManager.getSessionStore().descriptor.adapter === \"jsonl\"\n\t\t\t\t\t\t? undefined\n\t\t\t\t\t\t: (id) => this.sessionManager.deleteSession(id),\n\t\t\t\trenameSession: async (selected, nextName) => {\n\t\t\t\t\tconst next = (nextName ?? \"\").trim();\n\t\t\t\t\tif (!next) return;\n\t\t\t\t\tconst store = this.sessionManager.getSessionStore();\n\t\t\t\t\tconst directory = store.descriptor.adapter === \"jsonl\" ? dirname(selected.path) : undefined;\n\t\t\t\t\tif (\n\t\t\t\t\t\tselected.id === this.sessionManager.getSessionId() &&\n\t\t\t\t\t\t(directory === undefined ||\n\t\t\t\t\t\t\t(await canonicalizePathAsync(directory)) ===\n\t\t\t\t\t\t\t\t(await canonicalizePathAsync(this.sessionManager.getSessionDir())))\n\t\t\t\t\t) {\n\t\t\t\t\t\tawait this.session.setSessionName(next);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst mgr = await this.sessionManager.openSessionById(selected.id, undefined, directory, {\n\t\t\t\t\t\t\thistory: \"tail\",\n\t\t\t\t\t\t});\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tawait mgr.appendSessionInfo(next);\n\t\t\t\t\t\t} finally {\n\t\t\t\t\t\t\tif (mgr.getSessionStore() !== store) await mgr.getSessionStore().close();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tshowRenameHint: true,\n\t\t\t\tkeybindings: this.keybindings,\n\t\t\t},\n\n\t\t\t{ id: this.sessionManager.getSessionId(), directory: this.sessionManager.getSessionDir() },\n\t\t);\n\t\tawaitFirstContent(selector, () => selector.awaitingFirstContent());\n\t\treturn {\n\t\t\tcomponent: selector,\n\t\t\tfocus: selector,\n\t\t\tdispose: () => selector.dispose(),\n\t\t};\n\t});\n};\n\nasync function resumeCatalogSelection(mode: InteractiveModeBase, selected: SessionInfo): Promise<void> {\n\tconst directory =\n\t\tmode.sessionManager.getSessionStore().descriptor.adapter === \"jsonl\" ? dirname(selected.path) : undefined;\n\tawait mode.handleResumeSession(selected.id, undefined, directory);\n}\n\nInteractiveModeBase.prototype.handleResumeTarget = async function (\n\tthis: InteractiveModeBase,\n\ttarget: string,\n): Promise<void> {\n\tif (/\\s/.test(target) || target.startsWith(\"-\")) {\n\t\tthis.showError(\"Usage: /resume [session-id].\");\n\t\treturn;\n\t}\n\ttry {\n\t\tconst sessions = await SessionManager.listAll(this.sessionManager.getSessionStore());\n\t\tconst resolution = resolveResumeTarget(target, sessions);\n\t\tif (resolution.kind === \"session\") {\n\t\t\tawait resumeCatalogSelection(this, resolution.session);\n\t\t} else if (resolution.kind === \"ambiguous\") {\n\t\t\tthis.showError(\n\t\t\t\t`Resume id \"${target}\" is ambiguous: ${resolution.matches.map((entry) => `session ${entry.id}`).join(\", \")}. Use /resume to choose an entry, or provide a unique full id.`,\n\t\t\t);\n\t\t} else {\n\t\t\tthis.showError(\n\t\t\t\t`No session matches \"${target}\". Use /resume to choose an entry, or provide a full id or unique 8-character hexadecimal prefix.`,\n\t\t\t);\n\t\t}\n\t} catch (error) {\n\t\tthis.showError(error instanceof Error ? error.message : String(error));\n\t}\n};\n\nInteractiveModeBase.prototype.handleResumeSession = async function (\n\tthis: InteractiveModeBase,\n\tsessionId: string,\n\toptions?: Parameters<ExtensionCommandContext[\"switchSession\"]>[1],\n\tsessionDirectory?: string,\n): Promise<{ cancelled: boolean }> {\n\tawait this.ensureDeferredStartupComplete();\n\tInteractiveModeBase.prototype.clearWorkingLoader.call(this);\n\tmountIdleStatus(this.statusContainer, this.settingsManager.getClearOnShrink());\n\tconst resumeStartedAt = new Date().toISOString();\n\ttry {\n\t\tconst result = await this.runtimeHost.switchSession(sessionId, {\n\t\t\twithSession: options?.withSession,\n\t\t\tsessionDirectory,\n\t\t\tprojectTrustContextFactory: (cwd) => this.createProjectTrustContext(cwd),\n\t\t\thistory: \"tail\",\n\t\t});\n\t\tif (result.cancelled) {\n\t\t\treturn result;\n\t\t}\n\t\tthis.renderCurrentSessionState();\n\t\tif (this.firstRunNoticeVisible) {\n\t\t\tthis.clearFirstRunOnboardingUi();\n\t\t}\n\t\tthis.showStatus(\"Resumed session\");\n\t\tshowSessionNotices(this, [\n\t\t\t...worktreeRestoreNotices(this.sessionManager, resumeStartedAt),\n\t\t\t...this.runtimeHost.takeResumeNotices(),\n\t\t]);\n\t\tthis.startSessionRecovery(\"resume\");\n\t\treturn result;\n\t} catch (error: unknown) {\n\t\tif (isResumeFailure(error)) {\n\t\t\tthis.showError(error.message);\n\t\t\treturn { cancelled: true };\n\t\t}\n\t\tif (error instanceof MissingSessionCwdError) {\n\t\t\tswitch (await this.promptForMissingSessionCwd(error)) {\n\t\t\t\tcase \"continue\": {\n\t\t\t\t\tconst result = await this.runtimeHost.switchSession(sessionId, {\n\t\t\t\t\t\tcwdOverride: error.issue.fallbackCwd,\n\t\t\t\t\t\tsessionDirectory,\n\t\t\t\t\t\twithSession: options?.withSession,\n\t\t\t\t\t\tprojectTrustContextFactory: (cwd) => this.createProjectTrustContext(cwd),\n\t\t\t\t\t\thistory: \"tail\",\n\t\t\t\t\t});\n\t\t\t\t\tif (!result.cancelled) finishMissingCwdResume(this, `Resumed session in ${error.issue.fallbackCwd}`);\n\t\t\t\t\treturn result;\n\t\t\t\t}\n\t\t\t\tcase \"fork\":\n\t\t\t\t\treturn this.switchToForkedSession({ sessionId, sessionDirectory }, error.issue.fallbackCwd, options);\n\t\t\t\tcase undefined:\n\t\t\t\t\tthis.showStatus(\"Resume cancelled\");\n\t\t\t\t\treturn { cancelled: true };\n\t\t\t}\n\t\t}\n\t\treturn this.handleFatalRuntimeError(\"Failed to resume session\", error);\n\t}\n};\n\nfunction finishMissingCwdResume(mode: InteractiveModeBase, status: string): void {\n\tmode.renderCurrentSessionState();\n\tif (mode.firstRunNoticeVisible) {\n\t\tmode.clearFirstRunOnboardingUi();\n\t}\n\tmode.showStatus(status);\n\tshowSessionNotices(mode, mode.runtimeHost.takeResumeNotices());\n\tmode.startSessionRecovery(\"resume\");\n}\n\nasync function forkIntoActiveStore(\n\tmode: InteractiveModeBase,\n\tsource: MissingCwdForkSource,\n\tcwd: string,\n): Promise<SessionManager> {\n\tconst store = mode.sessionManager.getSessionStore();\n\tif (\"exportPath\" in source) return SessionManager.forkFrom(source.exportPath, cwd, store);\n\tconst stored = await mode.sessionManager.openSessionById(source.sessionId, undefined, source.sessionDirectory);\n\ttry {\n\t\treturn await stored.forkTo(cwd, store);\n\t} finally {\n\t\tif (stored.getSessionStore() !== store) await stored.getSessionStore().close();\n\t}\n}\n\n/**\n * Fork a session whose stored cwd is gone into `cwd`, in the store the current session lives in, and switch to the\n * fork. An extension that cancels the switch leaves no copy behind.\n */\nInteractiveModeBase.prototype.switchToForkedSession = async function (\n\tthis: InteractiveModeBase,\n\tsource: MissingCwdForkSource,\n\tcwd: string,\n\toptions?: Parameters<ExtensionCommandContext[\"switchSession\"]>[1],\n): Promise<{ cancelled: boolean }> {\n\tconst forkId = (await forkIntoActiveStore(this, source, cwd)).getSessionId();\n\tconst result = await this.runtimeHost.switchSession(forkId, {\n\t\twithSession: options?.withSession,\n\t\tprojectTrustContextFactory: (forkCwd) => this.createProjectTrustContext(forkCwd),\n\t\thistory: \"tail\",\n\t});\n\tif (result.cancelled) {\n\t\tawait this.sessionManager.deleteSession(forkId);\n\t\treturn result;\n\t}\n\tfinishMissingCwdResume(this, `Forked into new session ${forkId} in ${cwd}`);\n\treturn result;\n};\n"]}
@@ -1,6 +1,6 @@
1
1
  import { getOwnerTaskStore, watchOwnerTaskStoreBinding } from "../../core/tasks/owner-store.js";
2
2
  import { messageComponents } from "./chat-message-count.js";
3
- import { countTasksBy, TaskRow, taskNameAndTitle, taskSiblings } from "./components/task-row.js";
3
+ import { countTasksBy, TranscriptTaskRow, taskNameAndTitle, taskSiblings } from "./components/task-row.js";
4
4
  import { rowsFrom } from "./components/transcript-block-clicks.js";
5
5
  function taskSnapshot(tasks) {
6
6
  const siblings = taskSiblings(tasks);
@@ -58,7 +58,7 @@ export function refreshInteractiveTasks(mode) {
58
58
  render(width) {
59
59
  const current = snapshot.byId.get(task.ref.taskId) ?? task;
60
60
  const duplicate = (snapshot.copies.get(taskNameAndTitle(current)) ?? 0) > 1;
61
- return new TaskRow(current, {
61
+ return new TranscriptTaskRow(current, {
62
62
  expanded: isExpanded(),
63
63
  duplicate,
64
64
  siblings: snapshot.siblings,
@@ -1 +1 @@
1
- {"version":3,"file":"interactive-task-projection.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-task-projection.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAuB,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AACrH,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACjG,OAAO,EAA6B,QAAQ,EAAE,MAAM,yCAAyC,CAAC;AAE9F,SAAS,YAAY,CAAC,KAA4B;IACjD,MAAM,QA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E,OAAO,EAAE,CAAC;IACrC,eAAe,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC7B,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,CAAC;IAC9B,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AACvB,CAAC","sourcesContent":["import type { Component, Container, TUI } from \"@bastani/atomic-tui\";\nimport type { TaskId, TaskRecord } from \"../../core/tasks/contracts.js\";\nimport { getOwnerTaskStore, type OwnerTaskStore, watchOwnerTaskStoreBinding } from \"../../core/tasks/owner-store.js\";\nimport { messageComponents } from \"./chat-message-count.ts\";\nimport { countTasksBy, TaskRow, taskNameAndTitle, taskSiblings } from \"./components/task-row.js\";\nimport { type ClickExpandableBlock, rowsFrom } from \"./components/transcript-block-clicks.ts\";\n\nfunction taskSnapshot(tasks: readonly TaskRecord[]) {\n\tconst siblings = taskSiblings(tasks);\n\treturn {\n\t\tsiblings,\n\t\tbyId: new Map(siblings.map((task) => [task.ref.taskId, task])),\n\t\tcopies: countTasksBy(siblings, taskNameAndTitle),\n\t};\n}\n\ntype InteractiveTaskHost = {\n\tsession: object;\n\tchatContainer: Container;\n\ttoolOutputExpanded: boolean;\n\ttaskRowsInChat?: boolean;\n\tui: Pick<TUI, \"requestRender\">;\n};\n\nconst bindings = new WeakMap<InteractiveTaskHost, { store: OwnerTaskStore; dispose: () => void; update: () => void }>();\nconst sessionBindings = new WeakMap<InteractiveTaskHost, { session: object; dispose: () => void }>();\n/** The launch tool's pending component is not the lifetime of a task anchor. */\nexport function refreshInteractiveTasks(mode: InteractiveTaskHost): void {\n\tif (sessionBindings.get(mode)?.session !== mode.session) {\n\t\tsessionBindings.get(mode)?.dispose();\n\t\tsessionBindings.set(mode, {\n\t\t\tsession: mode.session,\n\t\t\tdispose: watchOwnerTaskStoreBinding(mode.session, () => refreshInteractiveTasks(mode)),\n\t\t});\n\t}\n\tconst store = getOwnerTaskStore(mode.session);\n\tconst binding = bindings.get(mode);\n\tif (store && binding?.store === store) {\n\t\tbinding.update();\n\t\treturn;\n\t}\n\tbinding?.dispose();\n\tbindings.delete(mode);\n\tif (!store) return;\n\tconst mounted = new Map<TaskId, Component>();\n\tlet snapshot = taskSnapshot(store.tasks);\n\tconst update = () => {\n\t\tsnapshot = taskSnapshot(store.tasks);\n\t\tif (mode.taskRowsInChat === false) {\n\t\t\tmode.ui.requestRender();\n\t\t\treturn;\n\t\t}\n\t\tconst attached = mounted.size > 0 ? new Set(mode.chatContainer.children) : undefined;\n\t\tfor (const task of snapshot.siblings) {\n\t\t\tconst anchor = mounted.get(task.ref.taskId);\n\t\t\tif (anchor && attached?.has(anchor)) continue;\n\t\t\t// The row follows the chat's tool-output setting until a click, or Ctrl+O, sets its own expansion.\n\t\t\tlet clicked: boolean | undefined;\n\t\t\tconst isExpanded = () => clicked ?? mode.toolOutputExpanded;\n\t\t\tconst component: ClickExpandableBlock = {\n\t\t\t\texpandsOnClick: true,\n\t\t\t\tisExpanded,\n\t\t\t\tsetExpanded(next: boolean) {\n\t\t\t\t\tclicked = next;\n\t\t\t\t},\n\t\t\t\tclickArea: (width: number) => rowsFrom(0, component.render(width).length),\n\t\t\t\tinvalidate() {},\n\t\t\t\trender(width: number) {\n\t\t\t\t\tconst current = snapshot.byId.get(task.ref.taskId) ?? task;\n\t\t\t\t\tconst duplicate = (snapshot.copies.get(taskNameAndTitle(current)) ?? 0) > 1;\n\t\t\t\t\treturn new TaskRow(current, {\n\t\t\t\t\t\texpanded: isExpanded(),\n\t\t\t\t\t\tduplicate,\n\t\t\t\t\t\tsiblings: snapshot.siblings,\n\t\t\t\t\t\tactivity: store.recentActivity(current.ref.taskId),\n\t\t\t\t\t\tactivityOmitted: store.activityOmitted(current.ref.taskId),\n\t\t\t\t\t}).render(width);\n\t\t\t\t},\n\t\t\t};\n\t\t\tmounted.set(task.ref.taskId, component);\n\t\t\tmessageComponents.add(component);\n\t\t\tmode.chatContainer.addChild(component);\n\t\t}\n\t\tmode.ui.requestRender();\n\t};\n\tconst unsubscribe = store.subscribe(update);\n\tbindings.set(mode, {\n\t\tstore,\n\t\tupdate,\n\t\tdispose() {\n\t\t\tunsubscribe();\n\t\t\tfor (const component of mounted.values()) mode.chatContainer.removeChild(component);\n\t\t},\n\t});\n\tupdate();\n}\nexport function disposeInteractiveTasks(mode: InteractiveTaskHost): void {\n\tsessionBindings.get(mode)?.dispose();\n\tsessionBindings.delete(mode);\n\tbindings.get(mode)?.dispose();\n\tbindings.delete(mode);\n}\n"]}
1
+ {"version":3,"file":"interactive-task-projection.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-task-projection.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAuB,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AACrH,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAC3G,OAAO,EAA6B,QAAQ,EAAE,MAAM,yCAAyC,CAAC;AAE9F,SAAS,YAAY,CAAC,KAA4B;IACjD,MAAM,QAAQ,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;IACrC,OAAO;QACN,QAAQ;QACR,IAAI,EAAE,IAAI,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC;QAC9D,MAAM,EAAE,YAAY,CAAC,QAAQ,EAAE,gBAAgB,CAAC;KAChD,CAAC;AACH,CAAC;AAUD,MAAM,QAAQ,GAAG,IAAI,OAAO,EAA2F,CAAC;AACxH,MAAM,eAAe,GAAG,IAAI,OAAO,EAAiE,CAAC;AACrG,gFAAgF;AAChF,MAAM,UAAU,uBAAuB,CAAC,IAAyB;IAChE,IAAI,eAAe,CAAC,GAAG,CAAC,IAAI,CAAC,EAA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;gBAClB,CAAC;aACD,CAAC;YACF,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;YACxC,iBAAiB,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;YACjC,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;QACxC,CAAC;QACD,IAAI,CAAC,EAAE,CAAC,aAAa,EAAE,CAAC;IACzB,CAAC,CAAC;IACF,MAAM,WAAW,GAAG,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IAC5C,QAAQ,CAAC,GAAG,CAAC,IAAI,EAAE;QAClB,KAAK;QACL,MAAM;QACN,OAAO;YACN,WAAW,EAAE,CAAC;YACd,KAAK,MAAM,SAAS,IAAI,OAAO,CAAC,MAAM,EAAE;gBAAE,IAAI,CAAC,aAAa,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;QACrF,CAAC;KACD,CAAC,CAAC;IACH,MAAM,EAAE,CAAC;AACV,CAAC;AACD,MAAM,UAAU,uBAAuB,CAAC,IAAyB;IAChE,eAAe,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,CAAC;IACrC,eAAe,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC7B,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,CAAC;IAC9B,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AACvB,CAAC","sourcesContent":["import type { Component, Container, TUI } from \"@bastani/atomic-tui\";\nimport type { TaskId, TaskRecord } from \"../../core/tasks/contracts.js\";\nimport { getOwnerTaskStore, type OwnerTaskStore, watchOwnerTaskStoreBinding } from \"../../core/tasks/owner-store.js\";\nimport { messageComponents } from \"./chat-message-count.ts\";\nimport { countTasksBy, TranscriptTaskRow, taskNameAndTitle, taskSiblings } from \"./components/task-row.js\";\nimport { type ClickExpandableBlock, rowsFrom } from \"./components/transcript-block-clicks.ts\";\n\nfunction taskSnapshot(tasks: readonly TaskRecord[]) {\n\tconst siblings = taskSiblings(tasks);\n\treturn {\n\t\tsiblings,\n\t\tbyId: new Map(siblings.map((task) => [task.ref.taskId, task])),\n\t\tcopies: countTasksBy(siblings, taskNameAndTitle),\n\t};\n}\n\ntype InteractiveTaskHost = {\n\tsession: object;\n\tchatContainer: Container;\n\ttoolOutputExpanded: boolean;\n\ttaskRowsInChat?: boolean;\n\tui: Pick<TUI, \"requestRender\">;\n};\n\nconst bindings = new WeakMap<InteractiveTaskHost, { store: OwnerTaskStore; dispose: () => void; update: () => void }>();\nconst sessionBindings = new WeakMap<InteractiveTaskHost, { session: object; dispose: () => void }>();\n/** The launch tool's pending component is not the lifetime of a task anchor. */\nexport function refreshInteractiveTasks(mode: InteractiveTaskHost): void {\n\tif (sessionBindings.get(mode)?.session !== mode.session) {\n\t\tsessionBindings.get(mode)?.dispose();\n\t\tsessionBindings.set(mode, {\n\t\t\tsession: mode.session,\n\t\t\tdispose: watchOwnerTaskStoreBinding(mode.session, () => refreshInteractiveTasks(mode)),\n\t\t});\n\t}\n\tconst store = getOwnerTaskStore(mode.session);\n\tconst binding = bindings.get(mode);\n\tif (store && binding?.store === store) {\n\t\tbinding.update();\n\t\treturn;\n\t}\n\tbinding?.dispose();\n\tbindings.delete(mode);\n\tif (!store) return;\n\tconst mounted = new Map<TaskId, Component>();\n\tlet snapshot = taskSnapshot(store.tasks);\n\tconst update = () => {\n\t\tsnapshot = taskSnapshot(store.tasks);\n\t\tif (mode.taskRowsInChat === false) {\n\t\t\tmode.ui.requestRender();\n\t\t\treturn;\n\t\t}\n\t\tconst attached = mounted.size > 0 ? new Set(mode.chatContainer.children) : undefined;\n\t\tfor (const task of snapshot.siblings) {\n\t\t\tconst anchor = mounted.get(task.ref.taskId);\n\t\t\tif (anchor && attached?.has(anchor)) continue;\n\t\t\t// The row follows the chat's tool-output setting until a click, or Ctrl+O, sets its own expansion.\n\t\t\tlet clicked: boolean | undefined;\n\t\t\tconst isExpanded = () => clicked ?? mode.toolOutputExpanded;\n\t\t\tconst component: ClickExpandableBlock = {\n\t\t\t\texpandsOnClick: true,\n\t\t\t\tisExpanded,\n\t\t\t\tsetExpanded(next: boolean) {\n\t\t\t\t\tclicked = next;\n\t\t\t\t},\n\t\t\t\tclickArea: (width: number) => rowsFrom(0, component.render(width).length),\n\t\t\t\tinvalidate() {},\n\t\t\t\trender(width: number) {\n\t\t\t\t\tconst current = snapshot.byId.get(task.ref.taskId) ?? task;\n\t\t\t\t\tconst duplicate = (snapshot.copies.get(taskNameAndTitle(current)) ?? 0) > 1;\n\t\t\t\t\treturn new TranscriptTaskRow(current, {\n\t\t\t\t\t\texpanded: isExpanded(),\n\t\t\t\t\t\tduplicate,\n\t\t\t\t\t\tsiblings: snapshot.siblings,\n\t\t\t\t\t\tactivity: store.recentActivity(current.ref.taskId),\n\t\t\t\t\t\tactivityOmitted: store.activityOmitted(current.ref.taskId),\n\t\t\t\t\t}).render(width);\n\t\t\t\t},\n\t\t\t};\n\t\t\tmounted.set(task.ref.taskId, component);\n\t\t\tmessageComponents.add(component);\n\t\t\tmode.chatContainer.addChild(component);\n\t\t}\n\t\tmode.ui.requestRender();\n\t};\n\tconst unsubscribe = store.subscribe(update);\n\tbindings.set(mode, {\n\t\tstore,\n\t\tupdate,\n\t\tdispose() {\n\t\t\tunsubscribe();\n\t\t\tfor (const component of mounted.values()) mode.chatContainer.removeChild(component);\n\t\t},\n\t});\n\tupdate();\n}\nexport function disposeInteractiveTasks(mode: InteractiveTaskHost): void {\n\tsessionBindings.get(mode)?.dispose();\n\tsessionBindings.delete(mode);\n\tbindings.get(mode)?.dispose();\n\tbindings.delete(mode);\n}\n"]}
@@ -0,0 +1,41 @@
1
+ /**
2
+ * The part of the screen a hold keeps as painted: the prompt's slot while a slash command's view opens, or everything
3
+ * below the transcript while a subagent opened from `/tasks` is on its way.
4
+ */
5
+ export type ScreenHoldRegion = "prompt" | "dock";
6
+ /** Ends a hold, or nothing for a request that held nothing. */
7
+ export type ScreenHoldRelease = () => void;
8
+ /** A key the user pressed: not the release of one, nor a mouse or focus report. */
9
+ export declare function isKeyPress(data: string): boolean;
10
+ /** Shows a held part live again; `key` is the user's key that ends it, which the screen handles right after. */
11
+ export type EndScreenHold = (key?: string) => void;
12
+ /**
13
+ * Which part of the screen, if any, is kept as painted while what replaces it is on its way. At most one part is held:
14
+ * a request made while another hold is held joins it, keeps nothing more and does not move its bound. A hold keeps
15
+ * only rows painted from live content, never rows another hold kept. The user's next key press shows the screen live.
16
+ */
17
+ export declare class ScreenHold {
18
+ private state;
19
+ private statusChanges;
20
+ /** Counts the changes of a run's working status: a dock painted before the latest change shows one that is gone. */
21
+ get statusEpoch(): number;
22
+ /** The part held now, if any. */
23
+ get region(): ScreenHoldRegion | undefined;
24
+ /**
25
+ * Hold `region`. `start` keeps it as painted and answers how to show it live again, or undefined when it cannot (what
26
+ * it painted is not live content); it calls `ended` once its hold ends on its own. Answers what ends this hold.
27
+ */
28
+ begin(region: ScreenHoldRegion, start: (ended: () => void) => EndScreenHold | undefined): ScreenHoldRelease;
29
+ /** Show the screen live again, whatever part is held. */
30
+ end(): void;
31
+ /**
32
+ * A run's working status started or ended: a held dock, which has the status area in it, shows it live again. A held
33
+ * prompt never has a working status in it (`PromptSlot` does not hold one that draws it), so it stays held.
34
+ */
35
+ statusChanged(): void;
36
+ /** Input on its way to the screen, before any handler sees it: a key press shows the screen live. */
37
+ noteInput(data: string): void;
38
+ }
39
+ /** The screen hold of the interactive mode `mode`. */
40
+ export declare function screenHoldOf(mode: object): ScreenHold;
41
+ //# sourceMappingURL=screen-hold.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"screen-hold.d.ts","sourceRoot":"","sources":["../../../src/modes/interactive/screen-hold.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG,QAAQ,GAAG,MAAM,CAAC;AAEjD,+DAA+D;AAC/D,MAAM,MAAM,iBAAiB,GAAG,MAAM,IAAI,CAAC;AAI3C,mFAAmF;AACnF,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAQhD;AAED,gHAAgH;AAChH,MAAM,MAAM,aAAa,GAAG,CAAC,GAAG,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;AAMnD;;;;GAIG;AACH,qBAAa,UAAU;IACtB,OAAO,CAAC,KAAK,CAAqC;IAClD,OAAO,CAAC,aAAa,CAAK;IAE1B,oHAAoH;IACpH,IAAI,WAAW,IAAI,MAAM,CAExB;IAED,iCAAiC;IACjC,IAAI,MAAM,IAAI,gBAAgB,GAAG,SAAS,CAEzC;IAED;;;OAGG;IACH,KAAK,CAAC,MAAM,EAAE,gBAAgB,EAAE,KAAK,EAAE,CAAC,KAAK,EAAE,MAAM,IAAI,KAAK,aAAa,GAAG,SAAS,GAAG,iBAAiB,CAc1G;IAED,yDAAyD;IACzD,GAAG,IAAI,IAAI,CAEV;IAED;;;OAGG;IACH,aAAa,IAAI,IAAI,CAGpB;IAED,qGAAqG;IACrG,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAE5B;CACD;AAID,sDAAsD;AACtD,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,CAOrD"}
@@ -0,0 +1,80 @@
1
+ import { isKeyRelease } from "@bastani/atomic-tui";
2
+ const NOTHING_HELD = () => { };
3
+ /** A key the user pressed: not the release of one, nor a mouse or focus report. */
4
+ export function isKeyPress(data) {
5
+ return (!isKeyRelease(data) &&
6
+ data !== "\x1b[I" &&
7
+ data !== "\x1b[O" &&
8
+ !data.startsWith("\x1b[<") &&
9
+ !data.startsWith("\x1b[M"));
10
+ }
11
+ /**
12
+ * Which part of the screen, if any, is kept as painted while what replaces it is on its way. At most one part is held:
13
+ * a request made while another hold is held joins it, keeps nothing more and does not move its bound. A hold keeps
14
+ * only rows painted from live content, never rows another hold kept. The user's next key press shows the screen live.
15
+ */
16
+ export class ScreenHold {
17
+ state = { kind: "live" };
18
+ statusChanges = 0;
19
+ /** Counts the changes of a run's working status: a dock painted before the latest change shows one that is gone. */
20
+ get statusEpoch() {
21
+ return this.statusChanges;
22
+ }
23
+ /** The part held now, if any. */
24
+ get region() {
25
+ return this.state.kind === "held" ? this.state.region : undefined;
26
+ }
27
+ /**
28
+ * Hold `region`. `start` keeps it as painted and answers how to show it live again, or undefined when it cannot (what
29
+ * it painted is not live content); it calls `ended` once its hold ends on its own. Answers what ends this hold.
30
+ */
31
+ begin(region, start) {
32
+ if (this.state.kind === "held")
33
+ return NOTHING_HELD;
34
+ let held;
35
+ const ended = () => {
36
+ if (held !== undefined && this.state === held)
37
+ this.state = { kind: "live" };
38
+ };
39
+ const end = start(ended);
40
+ if (end === undefined)
41
+ return NOTHING_HELD;
42
+ held = { kind: "held", region, end };
43
+ this.state = held;
44
+ const self = held;
45
+ return () => {
46
+ if (this.state === self)
47
+ end();
48
+ };
49
+ }
50
+ /** Show the screen live again, whatever part is held. */
51
+ end() {
52
+ if (this.state.kind === "held")
53
+ this.state.end();
54
+ }
55
+ /**
56
+ * A run's working status started or ended: a held dock, which has the status area in it, shows it live again. A held
57
+ * prompt never has a working status in it (`PromptSlot` does not hold one that draws it), so it stays held.
58
+ */
59
+ statusChanged() {
60
+ this.statusChanges++;
61
+ if (this.state.kind === "held" && this.state.region === "dock")
62
+ this.state.end();
63
+ }
64
+ /** Input on its way to the screen, before any handler sees it: a key press shows the screen live. */
65
+ noteInput(data) {
66
+ if (this.state.kind === "held" && isKeyPress(data))
67
+ this.state.end(data);
68
+ }
69
+ }
70
+ const holds = new WeakMap();
71
+ /** The screen hold of the interactive mode `mode`. */
72
+ export function screenHoldOf(mode) {
73
+ let hold = holds.get(mode);
74
+ if (hold === undefined) {
75
+ hold = new ScreenHold();
76
+ holds.set(mode, hold);
77
+ }
78
+ return hold;
79
+ }
80
+ //# sourceMappingURL=screen-hold.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"screen-hold.js","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Content":["import { isKeyRelease } from \"@bastani/atomic-tui\";\n\n/**\n * The part of the screen a hold keeps as painted: the prompt's slot while a slash command's view opens, or everything\n * below the transcript while a subagent opened from `/tasks` is on its way.\n */\nexport type ScreenHoldRegion = \"prompt\" | \"dock\";\n\n/** Ends a hold, or nothing for a request that held nothing. */\nexport type ScreenHoldRelease = () => void;\n\nconst NOTHING_HELD: ScreenHoldRelease = () => {};\n\n/** A key the user pressed: not the release of one, nor a mouse or focus report. */\nexport function isKeyPress(data: string): boolean {\n\treturn (\n\t\t!isKeyRelease(data) &&\n\t\tdata !== \"\\x1b[I\" &&\n\t\tdata !== \"\\x1b[O\" &&\n\t\t!data.startsWith(\"\\x1b[<\") &&\n\t\t!data.startsWith(\"\\x1b[M\")\n\t);\n}\n\n/** Shows a held part live again; `key` is the user's key that ends it, which the screen handles right after. */\nexport type EndScreenHold = (key?: string) => void;\n\ntype ScreenHoldState =\n\t| { readonly kind: \"live\" }\n\t| { readonly kind: \"held\"; readonly region: ScreenHoldRegion; readonly end: EndScreenHold };\n\n/**\n * Which part of the screen, if any, is kept as painted while what replaces it is on its way. At most one part is held:\n * a request made while another hold is held joins it, keeps nothing more and does not move its bound. A hold keeps\n * only rows painted from live content, never rows another hold kept. The user's next key press shows the screen live.\n */\nexport class ScreenHold {\n\tprivate state: ScreenHoldState = { kind: \"live\" };\n\tprivate statusChanges = 0;\n\n\t/** Counts the changes of a run's working status: a dock painted before the latest change shows one that is gone. */\n\tget statusEpoch(): number {\n\t\treturn this.statusChanges;\n\t}\n\n\t/** The part held now, if any. */\n\tget region(): ScreenHoldRegion | undefined {\n\t\treturn this.state.kind === \"held\" ? this.state.region : undefined;\n\t}\n\n\t/**\n\t * Hold `region`. `start` keeps it as painted and answers how to show it live again, or undefined when it cannot (what\n\t * it painted is not live content); it calls `ended` once its hold ends on its own. Answers what ends this hold.\n\t */\n\tbegin(region: ScreenHoldRegion, start: (ended: () => void) => EndScreenHold | undefined): ScreenHoldRelease {\n\t\tif (this.state.kind === \"held\") return NOTHING_HELD;\n\t\tlet held: ScreenHoldState | undefined;\n\t\tconst ended = () => {\n\t\t\tif (held !== undefined && this.state === held) this.state = { kind: \"live\" };\n\t\t};\n\t\tconst end = start(ended);\n\t\tif (end === undefined) return NOTHING_HELD;\n\t\theld = { kind: \"held\", region, end };\n\t\tthis.state = held;\n\t\tconst self = held;\n\t\treturn () => {\n\t\t\tif (this.state === self) end();\n\t\t};\n\t}\n\n\t/** Show the screen live again, whatever part is held. */\n\tend(): void {\n\t\tif (this.state.kind === \"held\") this.state.end();\n\t}\n\n\t/**\n\t * A run's working status started or ended: a held dock, which has the status area in it, shows it live again. A held\n\t * prompt never has a working status in it (`PromptSlot` does not hold one that draws it), so it stays held.\n\t */\n\tstatusChanged(): void {\n\t\tthis.statusChanges++;\n\t\tif (this.state.kind === \"held\" && this.state.region === \"dock\") this.state.end();\n\t}\n\n\t/** Input on its way to the screen, before any handler sees it: a key press shows the screen live. */\n\tnoteInput(data: string): void {\n\t\tif (this.state.kind === \"held\" && isKeyPress(data)) this.state.end(data);\n\t}\n}\n\nconst holds = new WeakMap<object, ScreenHold>();\n\n/** The screen hold of the interactive mode `mode`. */\nexport function screenHoldOf(mode: object): ScreenHold {\n\tlet hold = holds.get(mode);\n\tif (hold === undefined) {\n\t\thold = new ScreenHold();\n\t\tholds.set(mode, hold);\n\t}\n\treturn hold;\n}\n"]}
@@ -0,0 +1,66 @@
1
+ import type { AgentSessionEvent } from "../../core/agent-session.js";
2
+ /**
3
+ * The echo of a sent message (the copy the chat shows as soon as it is sent) once the session answers that it started
4
+ * a run for it. The run shows the message itself, and its user `message_start` takes the echo's place; a run that
5
+ * repeats input the chat already shows as unsaved shows no message of its own, and its echo goes (#5135).
6
+ *
7
+ * The answer and the run's first events arrive in either order: an engine answers as the run starts, and can send the
8
+ * run's events after it, or the host can handle the answer after events that followed it. So only the run's own events
9
+ * decide: its user message keeps the echo, and the run getting past where that message would be (its first assistant
10
+ * message, its turn's end or its end) without one drops it. Events of a run that was still going when the message was
11
+ * sent all come before its answer, and are not this run's.
12
+ *
13
+ * - `awaiting-answer`: sent, not answered yet. Events seen meanwhile are remembered.
14
+ * - `awaiting-run-message`: answered "started" before the run showed or skipped its message.
15
+ * - `settled`: decided. `left` leaves the echo to the rest of the chat (shown by the run, or answered other than
16
+ * started); `dropped` removes it; `never-ran` removes it too, for a run that settled or lost its engine before it
17
+ * started, which also leaves the working row the send showed with nothing to replace it.
18
+ */
19
+ export type StartedRunEcho = {
20
+ readonly kind: "awaiting-answer";
21
+ /** A run started after the message was sent. */
22
+ readonly runStarted: boolean;
23
+ /** The session showed a user message after the message was sent. */
24
+ readonly userMessageShown: boolean;
25
+ /** A run that started after the message was sent got past its prompt messages. */
26
+ readonly runPastPrompt: boolean;
27
+ /** This message's run settled without starting: its answer reached the host after the run's end. */
28
+ readonly runSettled: boolean;
29
+ } | {
30
+ readonly kind: "awaiting-run-message";
31
+ readonly runStarted: boolean;
32
+ } | {
33
+ readonly kind: "settled";
34
+ readonly echo: "left" | "dropped" | "never-ran";
35
+ };
36
+ export type StartedRunEchoEvent =
37
+ /** The session answered the prompt; `started` when it started a run for it. */
38
+ {
39
+ readonly type: "answer";
40
+ readonly started: boolean;
41
+ }
42
+ /** `agent_start`. */
43
+ | {
44
+ readonly type: "run-start";
45
+ }
46
+ /** `message_start` of a user message. */
47
+ | {
48
+ readonly type: "user-message";
49
+ }
50
+ /** `message_start` of an assistant message, `turn_end` or `agent_end`: a run is past its prompt messages. */
51
+ | {
52
+ readonly type: "past-prompt";
53
+ }
54
+ /** `agent_settled`: a prompt's run is over, whether or not it started. */
55
+ | {
56
+ readonly type: "run-settled";
57
+ }
58
+ /** The engine that would run it went away. */
59
+ | {
60
+ readonly type: "lost";
61
+ };
62
+ export declare const STARTED_RUN_ECHO_SENT: StartedRunEcho;
63
+ export declare function nextStartedRunEcho(state: StartedRunEcho, event: StartedRunEchoEvent): StartedRunEcho;
64
+ /** What a session event tells a `StartedRunEcho`, if anything. */
65
+ export declare function startedRunEchoEvent(event: AgentSessionEvent): StartedRunEchoEvent | undefined;
66
+ //# sourceMappingURL=started-run-echo.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"started-run-echo.d.ts","sourceRoot":"","sources":["../../../src/modes/interactive/started-run-echo.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAErE;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,MAAM,cAAc,GACvB;IACA,QAAQ,CAAC,IAAI,EAAE,iBAAiB,CAAC;IACjC,gDAAgD;IAChD,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAC7B,oEAAoE;IACpE,QAAQ,CAAC,gBAAgB,EAAE,OAAO,CAAC;IACnC,kFAAkF;IAClF,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;IAChC,oGAAoG;IACpG,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;CAC5B,GACD;IAAE,QAAQ,CAAC,IAAI,EAAE,sBAAsB,CAAC;IAAC,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAA;CAAE,GACvE;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,WAAW,CAAA;CAAE,CAAC;AAEjF,MAAM,MAAM,mBAAmB;AAC9B,+EAA+E;AAC7E;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;CAAE;AACxD,qBAAqB;GACnB;IAAE,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAA;CAAE;AAChC,yCAAyC;GACvC;IAAE,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAA;CAAE;AACnC,6GAA6G;GAC3G;IAAE,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAA;CAAE;AAClC,0EAA0E;GACxE;IAAE,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAA;CAAE;AAClC,8CAA8C;GAC5C;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAE7B,eAAO,MAAM,qBAAqB,EAAE,cAMnC,CAAC;AAMF,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,mBAAmB,GAAG,cAAc,CA0CpG;AAED,kEAAkE;AAClE,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,iBAAiB,GAAG,mBAAmB,GAAG,SAAS,CAe7F"}
@@ -0,0 +1,75 @@
1
+ export const STARTED_RUN_ECHO_SENT = {
2
+ kind: "awaiting-answer",
3
+ runStarted: false,
4
+ userMessageShown: false,
5
+ runPastPrompt: false,
6
+ runSettled: false,
7
+ };
8
+ const LEFT = { kind: "settled", echo: "left" };
9
+ const DROPPED = { kind: "settled", echo: "dropped" };
10
+ const NEVER_RAN = { kind: "settled", echo: "never-ran" };
11
+ export function nextStartedRunEcho(state, event) {
12
+ switch (state.kind) {
13
+ case "settled":
14
+ return state;
15
+ case "awaiting-answer":
16
+ switch (event.type) {
17
+ case "run-start":
18
+ return { ...state, runStarted: true };
19
+ case "user-message":
20
+ return { ...state, userMessageShown: true };
21
+ case "past-prompt":
22
+ return state.runStarted ? { ...state, runPastPrompt: true } : state;
23
+ case "run-settled":
24
+ // The follower passes on only this message's run's events: one that settles unstarted before its
25
+ // answer is handled was answered in the same read as its end.
26
+ return state.runStarted ? state : { ...state, runSettled: true };
27
+ case "lost":
28
+ // The prompt fails with the engine, and its failure handles the echo.
29
+ return LEFT;
30
+ case "answer":
31
+ if (!event.started || state.userMessageShown)
32
+ return LEFT;
33
+ if (state.runPastPrompt)
34
+ return DROPPED;
35
+ if (state.runSettled)
36
+ return NEVER_RAN;
37
+ return { kind: "awaiting-run-message", runStarted: state.runStarted };
38
+ }
39
+ break;
40
+ case "awaiting-run-message":
41
+ switch (event.type) {
42
+ case "run-start":
43
+ return { kind: "awaiting-run-message", runStarted: true };
44
+ case "user-message":
45
+ return LEFT;
46
+ case "past-prompt":
47
+ return state.runStarted ? DROPPED : state;
48
+ case "run-settled":
49
+ case "lost":
50
+ return state.runStarted ? DROPPED : NEVER_RAN;
51
+ case "answer":
52
+ return state;
53
+ }
54
+ }
55
+ return state;
56
+ }
57
+ /** What a session event tells a `StartedRunEcho`, if anything. */
58
+ export function startedRunEchoEvent(event) {
59
+ switch (event.type) {
60
+ case "agent_start":
61
+ return { type: "run-start" };
62
+ case "message_start":
63
+ if (event.message.role === "user")
64
+ return { type: "user-message" };
65
+ return event.message.role === "assistant" ? { type: "past-prompt" } : undefined;
66
+ case "turn_end":
67
+ case "agent_end":
68
+ return { type: "past-prompt" };
69
+ case "agent_settled":
70
+ return { type: "run-settled" };
71
+ default:
72
+ return undefined;
73
+ }
74
+ }
75
+ //# sourceMappingURL=started-run-echo.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"started-run-echo.js","sourceRoot":"","sources":["../../../src/modes/interactive/started-run-echo.ts"],"names":[],"mappings":"AAgDA,MAAM,CAAC,MAAM,qBAAqB,GAAmB;IACpD,IAAI,EAAE,iBAAiB;IACvB,UAAU,EAAE,KAAK;IACjB,gBAAgB,EAAE,KAAK;IACvB,aAAa,EAAE,KAAK;IACpB,UAAU,EAAE,KAAK;CACjB,CAAC;AAEF,MAAM,IAAI,GAAmB,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;AAC/D,MAAM,OAAO,GAAmB,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;AACrE,MAAM,SAAS,GAAmB,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC;AAEzE,MAAM,UAAU,kBAAkB,CAAC,KAAqB,EAAE,KAA0B;IACnF,QAAQ,KAAK,CAAC,IAAI,EAAE,CAAC;QACpB,KAAK,SAAS;YACb,OAAO,KAAK,CAAC;QACd,KAAK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AC,CAAC,KAAK,CAAC;gBAC3C,KAAK,aAAa,CAAC;gBACnB,KAAK,MAAM;oBACV,OAAO,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC;gBAC/C,KAAK,QAAQ;oBACZ,OAAO,KAAK,CAAC;YACf,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACd,CAAC;AAED,kEAAkE;AAClE,MAAM,UAAU,mBAAmB,CAAC,KAAwB;IAC3D,QAAQ,KAAK,CAAC,IAAI,EAAE,CAAC;QACpB,KAAK,aAAa;YACjB,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC;QAC9B,KAAK,eAAe;YACnB,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,KAAK,MAAM;gBAAE,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC;YACnE,OAAO,KAAK,CAAC,OAAO,CAAC,IAAI,KAAK,WAAW,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;QACjF,KAAK,UAAU,CAAC;QAChB,KAAK,WAAW;YACf,OAAO,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC;QAChC,KAAK,eAAe;YACnB,OAAO,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC;QAChC;YACC,OAAO,SAAS,CAAC;IACnB,CAAC;AACF,CAAC","sourcesContent":["import type { AgentSessionEvent } from \"../../core/agent-session.js\";\n\n/**\n * The echo of a sent message (the copy the chat shows as soon as it is sent) once the session answers that it started\n * a run for it. The run shows the message itself, and its user `message_start` takes the echo's place; a run that\n * repeats input the chat already shows as unsaved shows no message of its own, and its echo goes (#5135).\n *\n * The answer and the run's first events arrive in either order: an engine answers as the run starts, and can send the\n * run's events after it, or the host can handle the answer after events that followed it. So only the run's own events\n * decide: its user message keeps the echo, and the run getting past where that message would be (its first assistant\n * message, its turn's end or its end) without one drops it. Events of a run that was still going when the message was\n * sent all come before its answer, and are not this run's.\n *\n * - `awaiting-answer`: sent, not answered yet. Events seen meanwhile are remembered.\n * - `awaiting-run-message`: answered \"started\" before the run showed or skipped its message.\n * - `settled`: decided. `left` leaves the echo to the rest of the chat (shown by the run, or answered other than\n * started); `dropped` removes it; `never-ran` removes it too, for a run that settled or lost its engine before it\n * started, which also leaves the working row the send showed with nothing to replace it.\n */\nexport type StartedRunEcho =\n\t| {\n\t\t\treadonly kind: \"awaiting-answer\";\n\t\t\t/** A run started after the message was sent. */\n\t\t\treadonly runStarted: boolean;\n\t\t\t/** The session showed a user message after the message was sent. */\n\t\t\treadonly userMessageShown: boolean;\n\t\t\t/** A run that started after the message was sent got past its prompt messages. */\n\t\t\treadonly runPastPrompt: boolean;\n\t\t\t/** This message's run settled without starting: its answer reached the host after the run's end. */\n\t\t\treadonly runSettled: boolean;\n\t }\n\t| { readonly kind: \"awaiting-run-message\"; readonly runStarted: boolean }\n\t| { readonly kind: \"settled\"; readonly echo: \"left\" | \"dropped\" | \"never-ran\" };\n\nexport type StartedRunEchoEvent =\n\t/** The session answered the prompt; `started` when it started a run for it. */\n\t| { readonly type: \"answer\"; readonly started: boolean }\n\t/** `agent_start`. */\n\t| { readonly type: \"run-start\" }\n\t/** `message_start` of a user message. */\n\t| { readonly type: \"user-message\" }\n\t/** `message_start` of an assistant message, `turn_end` or `agent_end`: a run is past its prompt messages. */\n\t| { readonly type: \"past-prompt\" }\n\t/** `agent_settled`: a prompt's run is over, whether or not it started. */\n\t| { readonly type: \"run-settled\" }\n\t/** The engine that would run it went away. */\n\t| { readonly type: \"lost\" };\n\nexport const STARTED_RUN_ECHO_SENT: StartedRunEcho = {\n\tkind: \"awaiting-answer\",\n\trunStarted: false,\n\tuserMessageShown: false,\n\trunPastPrompt: false,\n\trunSettled: false,\n};\n\nconst LEFT: StartedRunEcho = { kind: \"settled\", echo: \"left\" };\nconst DROPPED: StartedRunEcho = { kind: \"settled\", echo: \"dropped\" };\nconst NEVER_RAN: StartedRunEcho = { kind: \"settled\", echo: \"never-ran\" };\n\nexport function nextStartedRunEcho(state: StartedRunEcho, event: StartedRunEchoEvent): StartedRunEcho {\n\tswitch (state.kind) {\n\t\tcase \"settled\":\n\t\t\treturn state;\n\t\tcase \"awaiting-answer\":\n\t\t\tswitch (event.type) {\n\t\t\t\tcase \"run-start\":\n\t\t\t\t\treturn { ...state, runStarted: true };\n\t\t\t\tcase \"user-message\":\n\t\t\t\t\treturn { ...state, userMessageShown: true };\n\t\t\t\tcase \"past-prompt\":\n\t\t\t\t\treturn state.runStarted ? { ...state, runPastPrompt: true } : state;\n\t\t\t\tcase \"run-settled\":\n\t\t\t\t\t// The follower passes on only this message's run's events: one that settles unstarted before its\n\t\t\t\t\t// answer is handled was answered in the same read as its end.\n\t\t\t\t\treturn state.runStarted ? state : { ...state, runSettled: true };\n\t\t\t\tcase \"lost\":\n\t\t\t\t\t// The prompt fails with the engine, and its failure handles the echo.\n\t\t\t\t\treturn LEFT;\n\t\t\t\tcase \"answer\":\n\t\t\t\t\tif (!event.started || state.userMessageShown) return LEFT;\n\t\t\t\t\tif (state.runPastPrompt) return DROPPED;\n\t\t\t\t\tif (state.runSettled) return NEVER_RAN;\n\t\t\t\t\treturn { kind: \"awaiting-run-message\", runStarted: state.runStarted };\n\t\t\t}\n\t\t\tbreak;\n\t\tcase \"awaiting-run-message\":\n\t\t\tswitch (event.type) {\n\t\t\t\tcase \"run-start\":\n\t\t\t\t\treturn { kind: \"awaiting-run-message\", runStarted: true };\n\t\t\t\tcase \"user-message\":\n\t\t\t\t\treturn LEFT;\n\t\t\t\tcase \"past-prompt\":\n\t\t\t\t\treturn state.runStarted ? DROPPED : state;\n\t\t\t\tcase \"run-settled\":\n\t\t\t\tcase \"lost\":\n\t\t\t\t\treturn state.runStarted ? DROPPED : NEVER_RAN;\n\t\t\t\tcase \"answer\":\n\t\t\t\t\treturn state;\n\t\t\t}\n\t}\n\treturn state;\n}\n\n/** What a session event tells a `StartedRunEcho`, if anything. */\nexport function startedRunEchoEvent(event: AgentSessionEvent): StartedRunEchoEvent | undefined {\n\tswitch (event.type) {\n\t\tcase \"agent_start\":\n\t\t\treturn { type: \"run-start\" };\n\t\tcase \"message_start\":\n\t\t\tif (event.message.role === \"user\") return { type: \"user-message\" };\n\t\t\treturn event.message.role === \"assistant\" ? { type: \"past-prompt\" } : undefined;\n\t\tcase \"turn_end\":\n\t\tcase \"agent_end\":\n\t\t\treturn { type: \"past-prompt\" };\n\t\tcase \"agent_settled\":\n\t\t\treturn { type: \"run-settled\" };\n\t\tdefault:\n\t\t\treturn undefined;\n\t}\n}\n"]}
@@ -57,6 +57,7 @@ export declare class EngineCustomUiService {
57
57
  readonly componentId: string;
58
58
  readonly tui: TUI;
59
59
  close(): void;
60
+ paintPendingFrame(): void;
60
61
  };
61
62
  getHostCustomUiState(): HostCustomUiState;
62
63
  onHostCustomUiStateChange(listener: HostCustomUiStateListener): () => void;
@@ -1 +1 @@
1
- {"version":3,"file":"engine-custom-ui.d.ts","sourceRoot":"","sources":["../../../src/modes/interactive-engine/engine-custom-ui.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,SAAS,EAEd,KAAK,aAAa,EAClB,KAAK,cAAc,EAGnB,KAAK,GAAG,EAKR,MAAM,qBAAqB,CAAC;AAG7B,OAAO,KAAK,EAAE,iBAAiB,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAEnG,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAIpE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,+BAA+B,CAAC;AAG3D,OAAO,EACN,KAAK,mBAAmB,EACxB,KAAK,wBAAwB,EAQ7B,MAAM,eAAe,CAAC;AAEvB,UAAU,eAAe;IACxB,OAAO,CAAC,EAAE,QAAQ,GAAG,YAAY,CAAC;IAClC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC,gFAAgF;IAChF,YAAY,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