@bastani/atomic 0.9.38-alpha.2 → 0.9.38-alpha.4

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 (249) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/dist/builtin/intercom/package.json +1 -1
  3. package/dist/builtin/mcp/package.json +1 -1
  4. package/dist/builtin/subagents/package.json +1 -1
  5. package/dist/builtin/web-access/package.json +1 -1
  6. package/dist/builtin/workflows/CHANGELOG.md +24 -0
  7. package/dist/builtin/workflows/README.md +5 -10
  8. package/dist/builtin/workflows/builtin/adversarial-verification.js +2 -2
  9. package/dist/builtin/workflows/builtin/{chunk-94f8zfz1.js → chunk-454hz1qt.js} +1 -1
  10. package/dist/builtin/workflows/builtin/{chunk-wf876n16.js → chunk-4bwtzyjq.js} +1 -1
  11. package/dist/builtin/workflows/builtin/{chunk-kb7s3gx2.js → chunk-5eh0brtd.js} +1 -1
  12. package/dist/builtin/workflows/builtin/{chunk-r97ndfvt.js → chunk-bjva9j5k.js} +1 -1
  13. package/dist/builtin/workflows/builtin/{chunk-x6az1sxp.js → chunk-h5fn47y5.js} +1 -1
  14. package/dist/builtin/workflows/builtin/chunk-na3wpwzh.js +3115 -0
  15. package/dist/builtin/workflows/builtin/{chunk-nkj4qhj6.js → chunk-q7dx7kh7.js} +1 -1
  16. package/dist/builtin/workflows/builtin/{chunk-a1ar035d.js → chunk-qdd897wm.js} +1 -1
  17. package/dist/builtin/workflows/builtin/{chunk-gyjck9z8.js → chunk-qjqn389g.js} +1 -1
  18. package/dist/builtin/workflows/builtin/{chunk-ad83gc5p.js → chunk-qrrkfg9v.js} +5 -12
  19. package/dist/builtin/workflows/builtin/{chunk-632fxeb8.js → chunk-x0vvjyzg.js} +1 -1
  20. package/dist/builtin/workflows/builtin/{chunk-3n2bnz64.js → chunk-xg7kkgf8.js} +2 -2
  21. package/dist/builtin/workflows/builtin/classify-and-act.js +2 -2
  22. package/dist/builtin/workflows/builtin/fan-out-and-synthesize.js +2 -2
  23. package/dist/builtin/workflows/builtin/generate-and-filter.js +2 -2
  24. package/dist/builtin/workflows/builtin/goal.js +3 -3
  25. package/dist/builtin/workflows/builtin/index.js +11 -11
  26. package/dist/builtin/workflows/builtin/loop-until-done.js +2 -2
  27. package/dist/builtin/workflows/builtin/open-claude-design.js +2 -2
  28. package/dist/builtin/workflows/builtin/ralph.js +3 -3
  29. package/dist/builtin/workflows/builtin/tournament.js +2 -2
  30. package/dist/builtin/workflows/package.json +1 -1
  31. package/dist/builtin/workflows/src/authoring.d.ts +8 -6
  32. package/dist/builtin/workflows/src/durable/journal/conformance.d.ts +4 -0
  33. package/dist/builtin/workflows/src/durable/journal/memory-run-journal.d.ts +27 -0
  34. package/dist/builtin/workflows/src/durable/journal/node-sqlite.d.ts +20 -0
  35. package/dist/builtin/workflows/src/durable/journal/resolution.d.ts +21 -0
  36. package/dist/builtin/workflows/src/durable/journal/sqlite-run-journal.d.ts +49 -0
  37. package/dist/builtin/workflows/src/durable/journal/types.d.ts +200 -0
  38. package/dist/builtin/workflows/src/durable/journal/values.d.ts +3 -0
  39. package/dist/builtin/workflows/src/extension/index.bundle.mjs +51916 -88191
  40. package/dist/builtin/workflows/src/index.js +9393 -45371
  41. package/dist/builtin/workflows/src/shared/authoring-contract-stage.d.ts +0 -6
  42. package/dist/builtin/workflows/src/shared/authoring-contract-ui.d.ts +4 -6
  43. package/dist/bun/split-loader.js +0 -13
  44. package/dist/bun/split-loader.js.map +1 -1
  45. package/dist/core/agent-session-compaction.d.ts.map +1 -1
  46. package/dist/core/agent-session-compaction.js +1 -0
  47. package/dist/core/agent-session-compaction.js.map +1 -1
  48. package/dist/core/agent-session-extension-bindings.d.ts.map +1 -1
  49. package/dist/core/agent-session-extension-bindings.js +4 -0
  50. package/dist/core/agent-session-extension-bindings.js.map +1 -1
  51. package/dist/core/agent-session-tree.d.ts.map +1 -1
  52. package/dist/core/agent-session-tree.js +1 -0
  53. package/dist/core/agent-session-tree.js.map +1 -1
  54. package/dist/core/agent-session-types.d.ts +2 -0
  55. package/dist/core/agent-session-types.d.ts.map +1 -1
  56. package/dist/core/agent-session-types.js.map +1 -1
  57. package/dist/core/compaction/branch-summarization.d.ts +2 -1
  58. package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
  59. package/dist/core/compaction/branch-summarization.js +6 -6
  60. package/dist/core/compaction/branch-summarization.js.map +1 -1
  61. package/dist/core/compaction/compaction-runner.d.ts +1 -0
  62. package/dist/core/compaction/compaction-runner.d.ts.map +1 -1
  63. package/dist/core/compaction/compaction-runner.js +4 -1
  64. package/dist/core/compaction/compaction-runner.js.map +1 -1
  65. package/dist/core/compaction/pi-summary-fallback.d.ts +2 -1
  66. package/dist/core/compaction/pi-summary-fallback.d.ts.map +1 -1
  67. package/dist/core/compaction/pi-summary-fallback.js +5 -5
  68. package/dist/core/compaction/pi-summary-fallback.js.map +1 -1
  69. package/dist/core/compaction/utils.d.ts +2 -1
  70. package/dist/core/compaction/utils.d.ts.map +1 -1
  71. package/dist/core/compaction/utils.js +32 -7
  72. package/dist/core/compaction/utils.js.map +1 -1
  73. package/dist/core/extensions/index.d.ts +1 -1
  74. package/dist/core/extensions/index.d.ts.map +1 -1
  75. package/dist/core/extensions/index.js +1 -1
  76. package/dist/core/extensions/index.js.map +1 -1
  77. package/dist/core/extensions/runner.d.ts +2 -0
  78. package/dist/core/extensions/runner.d.ts.map +1 -1
  79. package/dist/core/extensions/runner.js +8 -0
  80. package/dist/core/extensions/runner.js.map +1 -1
  81. package/dist/core/extensions/workflow-events.d.ts +2 -0
  82. package/dist/core/extensions/workflow-events.d.ts.map +1 -1
  83. package/dist/core/extensions/workflow-events.js.map +1 -1
  84. package/dist/core/extensions/workflow-run-control.d.ts +3 -3
  85. package/dist/core/extensions/workflow-run-control.d.ts.map +1 -1
  86. package/dist/core/extensions/workflow-run-control.js +4 -4
  87. package/dist/core/extensions/workflow-run-control.js.map +1 -1
  88. package/dist/core/model-resolver-defaults.js +4 -4
  89. package/dist/core/model-resolver-defaults.js.map +1 -1
  90. package/dist/core/session-manager-archive.d.ts.map +1 -1
  91. package/dist/core/session-manager-archive.js +3 -8
  92. package/dist/core/session-manager-archive.js.map +1 -1
  93. package/dist/core/session-manager-core.d.ts.map +1 -1
  94. package/dist/core/session-manager-core.js +14 -20
  95. package/dist/core/session-manager-core.js.map +1 -1
  96. package/dist/core/session-manager-list.d.ts.map +1 -1
  97. package/dist/core/session-manager-list.js +4 -13
  98. package/dist/core/session-manager-list.js.map +1 -1
  99. package/dist/core/session-manager-storage.d.ts +1 -0
  100. package/dist/core/session-manager-storage.d.ts.map +1 -1
  101. package/dist/core/session-manager-storage.js +49 -24
  102. package/dist/core/session-manager-storage.js.map +1 -1
  103. package/dist/core/session-manager-types.d.ts +2 -2
  104. package/dist/core/session-manager-types.d.ts.map +1 -1
  105. package/dist/core/session-manager-types.js +2 -1
  106. package/dist/core/session-manager-types.js.map +1 -1
  107. package/dist/core/session-manager-validation.d.ts +3 -0
  108. package/dist/core/session-manager-validation.d.ts.map +1 -1
  109. package/dist/core/session-manager-validation.js +16 -0
  110. package/dist/core/session-manager-validation.js.map +1 -1
  111. package/dist/core/session-manager.d.ts +1 -2
  112. package/dist/core/session-manager.d.ts.map +1 -1
  113. package/dist/core/session-manager.js +1 -2
  114. package/dist/core/session-manager.js.map +1 -1
  115. package/dist/core/settings-schema.d.ts +4 -0
  116. package/dist/core/settings-schema.d.ts.map +1 -1
  117. package/dist/core/settings-schema.js +9 -0
  118. package/dist/core/settings-schema.js.map +1 -1
  119. package/dist/core/storage/database.d.ts +21 -0
  120. package/dist/core/storage/database.d.ts.map +1 -0
  121. package/dist/core/storage/database.js +2 -0
  122. package/dist/core/storage/database.js.map +1 -0
  123. package/dist/core/storage/errors.d.ts +63 -0
  124. package/dist/core/storage/errors.d.ts.map +1 -0
  125. package/dist/core/storage/errors.js +103 -0
  126. package/dist/core/storage/errors.js.map +1 -0
  127. package/dist/core/storage/index.d.ts +6 -0
  128. package/dist/core/storage/index.d.ts.map +1 -0
  129. package/dist/core/storage/index.js +5 -0
  130. package/dist/core/storage/index.js.map +1 -0
  131. package/dist/core/storage/node-sqlite.d.ts +5 -0
  132. package/dist/core/storage/node-sqlite.d.ts.map +1 -0
  133. package/dist/core/storage/node-sqlite.js +161 -0
  134. package/dist/core/storage/node-sqlite.js.map +1 -0
  135. package/dist/core/storage/prefix.d.ts +5 -0
  136. package/dist/core/storage/prefix.d.ts.map +1 -0
  137. package/dist/core/storage/prefix.js +15 -0
  138. package/dist/core/storage/prefix.js.map +1 -0
  139. package/dist/core/storage/schema.d.ts +3 -0
  140. package/dist/core/storage/schema.d.ts.map +1 -0
  141. package/dist/core/storage/schema.js +6 -0
  142. package/dist/core/storage/schema.js.map +1 -0
  143. package/dist/core/storage/session/conformance.d.ts +12 -0
  144. package/dist/core/storage/session/conformance.d.ts.map +1 -0
  145. package/dist/core/storage/session/conformance.js +674 -0
  146. package/dist/core/storage/session/conformance.js.map +1 -0
  147. package/dist/core/storage/session/entry-structure.d.ts +4 -0
  148. package/dist/core/storage/session/entry-structure.d.ts.map +1 -0
  149. package/dist/core/storage/session/entry-structure.js +83 -0
  150. package/dist/core/storage/session/entry-structure.js.map +1 -0
  151. package/dist/core/storage/session/errors.d.ts +54 -0
  152. package/dist/core/storage/session/errors.d.ts.map +1 -0
  153. package/dist/core/storage/session/errors.js +95 -0
  154. package/dist/core/storage/session/errors.js.map +1 -0
  155. package/dist/core/storage/session/jsonl-session-store.d.ts +57 -0
  156. package/dist/core/storage/session/jsonl-session-store.d.ts.map +1 -0
  157. package/dist/core/storage/session/jsonl-session-store.js +482 -0
  158. package/dist/core/storage/session/jsonl-session-store.js.map +1 -0
  159. package/dist/core/storage/session/memory-session-store.d.ts +31 -0
  160. package/dist/core/storage/session/memory-session-store.d.ts.map +1 -0
  161. package/dist/core/storage/session/memory-session-store.js +113 -0
  162. package/dist/core/storage/session/memory-session-store.js.map +1 -0
  163. package/dist/core/storage/session/scratch-directory.d.ts +2 -0
  164. package/dist/core/storage/session/scratch-directory.d.ts.map +1 -0
  165. package/dist/core/storage/session/scratch-directory.js +5 -0
  166. package/dist/core/storage/session/scratch-directory.js.map +1 -0
  167. package/dist/core/storage/session/session-summary.d.ts +24 -0
  168. package/dist/core/storage/session/session-summary.d.ts.map +1 -0
  169. package/dist/core/storage/session/session-summary.js +79 -0
  170. package/dist/core/storage/session/session-summary.js.map +1 -0
  171. package/dist/core/storage/session/sql-session-store.d.ts +46 -0
  172. package/dist/core/storage/session/sql-session-store.d.ts.map +1 -0
  173. package/dist/core/storage/session/sql-session-store.js +227 -0
  174. package/dist/core/storage/session/sql-session-store.js.map +1 -0
  175. package/dist/core/storage/session/types.d.ts +68 -0
  176. package/dist/core/storage/session/types.d.ts.map +1 -0
  177. package/dist/core/storage/session/types.js +2 -0
  178. package/dist/core/storage/session/types.js.map +1 -0
  179. package/dist/core/storage/session/validation.d.ts +7 -0
  180. package/dist/core/storage/session/validation.d.ts.map +1 -0
  181. package/dist/core/storage/session/validation.js +47 -0
  182. package/dist/core/storage/session/validation.js.map +1 -0
  183. package/dist/core/storage/testing.d.ts +13 -0
  184. package/dist/core/storage/testing.d.ts.map +1 -0
  185. package/dist/core/storage/testing.js +264 -0
  186. package/dist/core/storage/testing.js.map +1 -0
  187. package/dist/index-extensions.d.ts +1 -1
  188. package/dist/index-extensions.d.ts.map +1 -1
  189. package/dist/index-extensions.js +1 -1
  190. package/dist/index-extensions.js.map +1 -1
  191. package/dist/index.d.ts +2 -1
  192. package/dist/index.d.ts.map +1 -1
  193. package/dist/index.js +2 -1
  194. package/dist/index.js.map +1 -1
  195. package/dist/modes/interactive/components/chat-session-host.d.ts +1 -1
  196. package/dist/modes/interactive/components/chat-session-host.d.ts.map +1 -1
  197. package/dist/modes/interactive/components/chat-session-host.js +8 -4
  198. package/dist/modes/interactive/components/chat-session-host.js.map +1 -1
  199. package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -1
  200. package/dist/modes/interactive/components/scoped-models-selector.js +5 -4
  201. package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -1
  202. package/dist/modes/interactive/interactive-mode-base.d.ts.map +1 -1
  203. package/dist/modes/interactive/interactive-mode-base.js +2 -1
  204. package/dist/modes/interactive/interactive-mode-base.js.map +1 -1
  205. package/dist/modes/interactive/interactive-queueing.js +8 -5
  206. package/dist/modes/interactive/interactive-queueing.js.map +1 -1
  207. package/dist/modes/interactive/interactive-session-runtime.js +6 -0
  208. package/dist/modes/interactive/interactive-session-runtime.js.map +1 -1
  209. package/dist/modes/interactive/interactive-tui.d.ts +1 -0
  210. package/dist/modes/interactive/interactive-tui.d.ts.map +1 -1
  211. package/dist/modes/interactive/interactive-tui.js +9 -2
  212. package/dist/modes/interactive/interactive-tui.js.map +1 -1
  213. package/dist/modes/interactive/program-status-reporter.d.ts +4 -0
  214. package/dist/modes/interactive/program-status-reporter.d.ts.map +1 -1
  215. package/dist/modes/interactive/program-status-reporter.js +45 -6
  216. package/dist/modes/interactive/program-status-reporter.js.map +1 -1
  217. package/dist/modes/interactive-engine/extension-ui-bridge.d.ts +2 -1
  218. package/dist/modes/interactive-engine/extension-ui-bridge.d.ts.map +1 -1
  219. package/dist/modes/interactive-engine/extension-ui-bridge.js +9 -1
  220. package/dist/modes/interactive-engine/extension-ui-bridge.js.map +1 -1
  221. package/dist/modes/interactive-engine/protocol.d.ts +4 -0
  222. package/dist/modes/interactive-engine/protocol.d.ts.map +1 -1
  223. package/dist/modes/interactive-engine/protocol.js +39 -1
  224. package/dist/modes/interactive-engine/protocol.js.map +1 -1
  225. package/dist/modes/rpc/rpc-session-binding.d.ts.map +1 -1
  226. package/dist/modes/rpc/rpc-session-binding.js +10 -0
  227. package/dist/modes/rpc/rpc-session-binding.js.map +1 -1
  228. package/docs/docs.json +1 -0
  229. package/docs/getting-started/installation.md +1 -2
  230. package/docs/json.md +1 -1
  231. package/docs/packages/authoring.md +1 -1
  232. package/docs/sdk/reference.md +1 -1
  233. package/docs/sdk/web-server.md +5 -5
  234. package/docs/sdk.md +11 -25
  235. package/docs/session-format.md +4 -10
  236. package/docs/settings.md +5 -29
  237. package/docs/storage.md +43 -0
  238. package/docs/workflows/api-reference.md +17 -55
  239. package/docs/workflows/authoring.md +2 -1
  240. package/docs/workflows/operations.md +31 -175
  241. package/docs/workflows/reliable-design.md +1 -1
  242. package/npm-shrinkwrap.json +32 -448
  243. package/package.json +13 -6
  244. package/schemas/settings.schema.json +27 -0
  245. package/dist/builtin/workflows/builtin/chunk-ymwq372z.js +0 -11609
  246. package/dist/core/session-manager-migrations.d.ts +0 -11
  247. package/dist/core/session-manager-migrations.d.ts.map +0 -1
  248. package/dist/core/session-manager-migrations.js +0 -80
  249. package/dist/core/session-manager-migrations.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"runner.js","sourceRoot":"","sources":["../../../src/core/extensions/runner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAO3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAa3D,OAAO,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAG/F,OAAO,EAAE,iCAAiC,EAAE,MAAM,qBAAqB,CAAC;AACxE,OAAO,EAAE,oBAAoB,EAAE,MAAM,iDAAiD,CAAC;AACvF,OAAO,EACN,qBAAqB,EACrB,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,mBAAmB,EACnB,wBAAwB,EACxB,mBAAmB,EACnB,iBAAiB,GACjB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACN,qBAAqB,EAGrB,eAAe,EACf,cAAc,GACd,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAE,sBAAsB,EAAE,4BAA4B,EAAE,MA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,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,EAChC,aAAa,CACb,CACD,CAAC;IACH,CAAC;IAED,qBAAqB,CACpB,GAAW,EACX,MAAwC;QAExC,OAAO,4BAA4B,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,EAAE,CACtD,4BAA4B,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,aAAa,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE,CAC1F,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CACrB,CACD,CAAC;IACH,CAAC;IAED,oEAAoE;IACpE,SAAS,CACR,IAAY,EACZ,MAAkC,EAClC,MAAmB,EACnB,iBAAwC;QAExC,OAAO,4BAA4B,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,EAAE,CACtD,gBAAgB,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,aAAa,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,iBAAiB,EAAE,CAAC,KAAK,EAAE,EAAE,CAC1G,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CACrB,CACD,CAAC;IACH,CAAC;CACD","sourcesContent":["import { AsyncLocalStorage } from \"node:async_hooks\";\nimport { raceWithAbortSignal } from \"../../utils/abort.js\";\nimport type {\n\tCacheWarmingAction,\n\tCacheWarmingDecisionEvent,\n\tCacheWarmingDecisionEventResult,\n} from \"../cache-warmer.ts\";\nimport type { ExecuteToolOptions, ExtensionToolContext } from \"./context-types.ts\";\nimport { snapshotEventHandlers } from \"./runner-events.ts\";\n/**\n * Extension runner - executes extensions and manages their lifecycle.\n */\n\nimport type { Provider, ProviderHeaders } from \"@bastani/pi-ai\";\nimport type { Api, ImageContent, Model } from \"@bastani/pi-ai/compat\";\nimport type { AgentMessage } from \"@earendil-works/pi-agent-core\";\nimport type { KeyId } from \"@earendil-works/pi-tui\";\nimport type { ResourceDiagnostic } from \"../diagnostics.ts\";\nimport type { KeybindingsConfig } from \"../keybindings.ts\";\nimport type { ModelRegistry } from \"../model-registry.ts\";\nimport type { ScopedModel } from \"../model-resolver.ts\";\nimport { lifecycleScopeForOwner, sessionLifecycleScopes } from \"../session-lifecycle-scope.ts\";\nimport type { SessionManager } from \"../session-manager.ts\";\nimport type { BuildSystemPromptOptions } from \"../system-prompt.ts\";\nimport { normalizeBuildSystemPromptOptions } from \"../system-prompt.ts\";\nimport { presentQuestionnaire } from \"../tools/ask-user-question/ask-user-question.js\";\nimport {\n\tassertExtensionAction,\n\tbindExtensionWork,\n\tdrainExtensionWork,\n\textensionWorkOpen,\n\tresumeExtensionWork,\n\trevokeExtensionAuthority,\n\trunExtensionCleanup,\n\tsealExtensionWork,\n} from \"./extension-work.ts\";\nimport {\n\tcopyHostQuestionnaire,\n\ttype HostDiagnostic,\n\ttype HostInput,\n\tHostInputBridge,\n\thostInputError,\n} from \"./host-input.js\";\nimport { originalRegistrationCallback } from \"./loader-bindings.ts\";\nimport { boundExtensionRuntimes, runResourceRegistrationBatch } from \"./loader-runtime.ts\";\nimport {\n\tcreateExtensionCommandContext,\n\tcreateExtensionContext,\n\ttype ExtensionCommandContextSource,\n\tretireExtensionContextEffects,\n} from \"./runner-context.ts\";\nimport {\n\ttype BeforeAgentStartCombinedResult,\n\ttype BoundaryBaseEvent,\n\ttype BoundaryDispatchResult,\n\ttype ResourcesDiscoverCombinedResult,\n\ttype RunnerEmitEvent,\n\ttype RunnerEmitResult,\n\trunBeforeAgentStartHandlers,\n\trunBeforeProviderRequestHandlers,\n\trunBoundaryHandlers,\n\trunContextHandlers,\n\trunGenericHandlers,\n\trunInputHandlers,\n\trunMessageEndHandlers,\n\trunResourcesDiscoverHandlers,\n\trunToolCallHandlers,\n\trunToolResultHandlers,\n\trunUserBashHandlers,\n} from \"./runner-events.ts\";\nimport type {\n\tExtensionErrorListener,\n\tForkHandler,\n\tNavigateTreeHandler,\n\tNewSessionHandler,\n\tReloadHandler,\n\tShutdownHandler,\n\tSwitchSessionHandler,\n} from \"./runner-handlers.ts\";\nimport {\n\tcollectFlags,\n\tcollectMarkdownTransformers,\n\tcollectRegisteredTools,\n\tfindEntryRenderer,\n\tfindMessageRenderer,\n\tfindToolDefinition,\n\thasExtensionHandlers,\n\tresolveRegisteredCommands,\n} from \"./runner-registries.ts\";\nimport { resolveExtensionShortcuts } from \"./runner-shortcuts.ts\";\nimport { noOpUIContext } from \"./runner-ui.ts\";\nimport { STALE_EXTENSION_CONTEXT_MESSAGE } from \"./stale-context.ts\";\nimport type {\n\tBoundaryContextPreview,\n\tCompactOptions,\n\tContextUsage,\n\tEntryRenderer,\n\tExtension,\n\tExtensionActions,\n\tExtensionCommandContext,\n\tExtensionCommandContextActions,\n\tExtensionContext,\n\tExtensionContextActions,\n\tExtensionError,\n\tExtensionFlag,\n\tExtensionMode,\n\tExtensionRuntime,\n\tExtensionShortcut,\n\tExtensionUIContext,\n\tInputEventResult,\n\tInputSource,\n\tMarkdownTransformer,\n\tMessageEndEvent,\n\tMessageRenderer,\n\tOrchestrationContext,\n\tProviderConfig,\n\tRegisteredTool,\n\tResolvedCommand,\n\tResourcesDiscoverEvent,\n\tSessionBoundaryDraft,\n\tSessionShutdownEvent,\n\tSubagentChildPolicy,\n\tToolCallEvent,\n\tToolCallEventResult,\n\tToolRenderers,\n\tToolResultEvent,\n\tToolResultEventResult,\n\tUIPromptKind,\n\tUserBashEvent,\n\tUserBashEventResult,\n} from \"./types.ts\";\nimport type {\n\tWorkflowActivityObserver,\n\tWorkflowActivitySnapshotFrame,\n\tWorkflowActivitySubscription,\n} from \"./workflow-events.js\";\nimport type { WorkflowRunControl } from \"./workflow-run-control.js\";\n\nexport type {\n\tExtensionErrorListener,\n\tForkHandler,\n\tNavigateTreeHandler,\n\tNewSessionHandler,\n\tReloadHandler,\n\tShutdownHandler,\n\tSwitchSessionHandler,\n} from \"./runner-handlers.ts\";\nexport { emitProjectTrustEvent } from \"./runner-project-trust.ts\";\n\n/**\n * Helper function to emit session_shutdown event to extensions.\n * Returns true if the event was emitted, false if there were no handlers.\n */\nexport async function emitSessionShutdownEvent(\n\textensionRunner: ExtensionRunner,\n\tevent: SessionShutdownEvent,\n): Promise<boolean> {\n\tif (extensionRunner.hasHandlers(\"session_shutdown\")) {\n\t\tconst failures: Error[] = [];\n\t\tconst unsubscribe = extensionRunner.onError((failure) => {\n\t\t\tif (failure.event === \"session_shutdown\")\n\t\t\t\tfailures.push(new Error(`${failure.extensionPath}: ${failure.error}`));\n\t\t});\n\t\ttry {\n\t\t\tawait extensionRunner.emit(event);\n\t\t} catch (error) {\n\t\t\tconst causes = error instanceof AggregateError ? error.errors : [error];\n\t\t\tfailures.push(...causes.map((cause) => (cause instanceof Error ? cause : new Error(String(cause)))));\n\t\t} finally {\n\t\t\tunsubscribe();\n\t\t}\n\t\t// Shutdown may start tracked cleanup without returning its promise. Join it\n\t\t// after dispatch leaves its own work frame, including when a handler failed.\n\t\ttry {\n\t\t\tawait extensionRunner.drainWork();\n\t\t} catch (error) {\n\t\t\tfailures.push(error instanceof Error ? error : new Error(String(error)));\n\t\t}\n\t\tif (failures.length)\n\t\t\tthrow Object.assign(new AggregateError(failures, \"Extension shutdown failed\"), { code: \"ShutdownFailed\" });\n\t\treturn true;\n\t}\n\treturn false;\n}\n\nexport class ExtensionRunner {\n\tprivate extensions: Extension[];\n\tprivate runtime: ExtensionRuntime;\n\tprivate readonly reportedMcpServers = new Set<string>();\n\tprivate mcpDiagnosticUnsubscriber?: () => void;\n\tprivate uiContext: ExtensionUIContext;\n\tprivate presentationUI?: ExtensionUIContext;\n\tprivate presentationInput?: HostInput;\n\tprivate humanInput?: HostInput | null;\n\tprivate humanInputBindingRevision = 0;\n\tprivate inputBridge = new HostInputBridge(\n\t\t() => this.sessionManager.getSessionId(),\n\t\t() => this.getSignalFn(),\n\t);\n\tprivate onDiagnostic?: (diagnostic: HostDiagnostic) => void;\n\tprivate mode: ExtensionMode = \"print\";\n\tprivate presentationOnly = false;\n\tprivate cwd: string;\n\tprivate sessionManager: SessionManager;\n\tprivate modelRegistry: ModelRegistry;\n\tprivate orchestrationContext: OrchestrationContext | undefined;\n\tprivate subagentPolicy: SubagentChildPolicy | undefined;\n\tprivate taskHostBinding: (() => import(\"../tasks/agent-adapter.js\").AgentTaskHost) | undefined;\n\t/** @internal Attach dispatch receipts to the owning session before startup. */\n\tbindWorkOwner(owner: object): void {\n\t\tbindExtensionWork(this.runtime, owner);\n\t}\n\tbindTaskHost(binding: () => import(\"../tasks/agent-adapter.js\").AgentTaskHost): void {\n\t\tthis.taskHostBinding = binding;\n\t}\n\tbindChildSessionOptions(\n\t\tresolver: import(\"../child-session-options.ts\").ChildSessionOptionsResolver | undefined,\n\t): void {\n\t\tthis.runtime.getChildSessionOptions = resolver;\n\t}\n\t/** The run-control implementation registered by the current extension generation, if any. */\n\tgetWorkflowRunControl(): WorkflowRunControl | undefined {\n\t\treturn this.runtime.workflowRunControlHub.current();\n\t}\n\t/** Observe this generation's workflow activity: snapshot first, then FIFO changes. */\n\tobserveWorkflowActivity(observer: WorkflowActivityObserver): WorkflowActivitySubscription {\n\t\treturn this.runtime.workflowActivityHub.observeWorkflowActivity(observer);\n\t}\n\t/** This generation's current workflow activity snapshot. */\n\tgetWorkflowActivitySnapshot(): WorkflowActivitySnapshotFrame {\n\t\treturn this.runtime.workflowActivityHub.getSnapshotFrame();\n\t}\n\tgetChildHostBindings(): import(\"../agent-session-types.js\").ExtensionBindings {\n\t\treturn {\n\t\t\thumanInput: this.humanInput === undefined ? this.presentationInput : this.humanInput,\n\t\t\tonDiagnostic: this.onDiagnostic,\n\t\t};\n\t}\n\tprivate errorListeners: Set<ExtensionErrorListener> = new Set();\n\tprivate getModel: () => Model<Api> | undefined = () => undefined;\n\tprivate getScopedModels: () => readonly ScopedModel[] = () => [];\n\tprivate isIdleFn: () => boolean = () => true;\n\tprivate isProjectTrustedFn: () => boolean = () => true;\n\tprivate getSignalFn: () => AbortSignal | undefined = () => undefined;\n\tprivate waitForIdleFn: () => Promise<void> = async () => {};\n\tprivate abortFn: () => void = () => {};\n\tprivate hasPendingMessagesFn: () => boolean = () => false;\n\tprivate isSessionSummaryEnabledFn: ExtensionContextActions[\"isSessionSummaryEnabled\"];\n\tprivate generateWorkflowSummaryFn: ExtensionContextActions[\"generateWorkflowSummary\"];\n\tprivate getContextUsageFn: () => ContextUsage | undefined = () => undefined;\n\tprivate compactFn: (options?: CompactOptions) => void = () => {};\n\tprivate getSystemPromptFn: () => string = () => \"\";\n\tprivate getSystemPromptOptionsFn: () => BuildSystemPromptOptions = () =>\n\t\tnormalizeBuildSystemPromptOptions({ cwd: this.cwd });\n\tprivate getSkillCatalogFn: ExtensionContextActions[\"getSkillCatalog\"] = undefined;\n\tprivate getRouterModelFn: ExtensionContextActions[\"getRouterModel\"] = undefined;\n\tprivate getModelRoutingFn: ExtensionContextActions[\"getModelRouting\"] = undefined;\n\tprivate executeToolFn: ExtensionContextActions[\"executeTool\"];\n\tprivate getCallableToolsFn: NonNullable<ExtensionContextActions[\"getCallableTools\"]> = () => [];\n\tprivate newSessionHandler: NewSessionHandler = async () => ({ cancelled: false });\n\tprivate forkHandler: ForkHandler = async () => ({ cancelled: false });\n\tprivate navigateTreeHandler: NavigateTreeHandler = async () => ({ cancelled: false });\n\tprivate switchSessionHandler: SwitchSessionHandler = async () => ({ cancelled: false });\n\tprivate reloadHandler: ReloadHandler = async () => {};\n\tprivate shutdownHandler: ShutdownHandler = () => {};\n\tprivate shortcutDiagnostics: ResourceDiagnostic[] = [];\n\tprivate commandDiagnostics: ResourceDiagnostic[] = [];\n\tprivate staleMessage: string | undefined;\n\tprivate authorityRevoked = false;\n\tprivate readonly contextOwner = {};\n\tprivate uiPromptBinding = 0;\n\tprivate activeUIPrompt:\n\t\t| { depth: number; reason: \"ui_prompt\" | \"project_trust\"; kind: UIPromptKind; title: string | undefined }\n\t\t| undefined;\n\n\tconstructor(\n\t\textensions: Extension[],\n\t\truntime: ExtensionRuntime,\n\t\tcwd: string,\n\t\tsessionManager: SessionManager,\n\t\tmodelRegistry: ModelRegistry,\n\t\torchestrationContext?: OrchestrationContext,\n\t\tsubagentPolicy?: SubagentChildPolicy,\n\t) {\n\t\tthis.extensions = extensions;\n\t\tthis.runtime = runtime;\n\t\tsessionLifecycleScopes.set(this, lifecycleScopeForOwner(runtime));\n\t\tthis.runtime.workflowActivityHub.bindDispatcher((event, isCurrent) => this.emit(event, isCurrent));\n\t\tthis.uiContext = noOpUIContext;\n\t\tthis.cwd = cwd;\n\t\tthis.sessionManager = sessionManager;\n\t\tthis.modelRegistry = modelRegistry;\n\t\tthis.orchestrationContext = orchestrationContext;\n\t\tthis.subagentPolicy = subagentPolicy;\n\t}\n\n\tbindCore(\n\t\tactions: ExtensionActions,\n\t\tcontextActions: ExtensionContextActions,\n\t\tproviderActions?: {\n\t\t\tregisterProvider?: (providerOrName: Provider | string, config?: ProviderConfig) => void;\n\t\t\tunregisterProvider?: (name: string) => void;\n\t\t},\n\t): void {\n\t\t// Copy actions into the shared runtime (all extension APIs reference this)\n\t\tthis.runtime.sendMessage = actions.sendMessage;\n\t\tthis.runtime.sendMessages = actions.sendMessages;\n\t\tthis.runtime.sendUserMessage = actions.sendUserMessage;\n\t\tboundExtensionRuntimes.add(this.runtime);\n\t\tthis.runtime.appendEntry = actions.appendEntry;\n\t\tthis.runtime.setSessionName = actions.setSessionName;\n\t\tthis.runtime.getSessionName = actions.getSessionName;\n\t\tthis.runtime.setLabel = actions.setLabel;\n\t\tthis.runtime.getActiveTools = actions.getActiveTools;\n\t\tthis.runtime.getAllTools = actions.getAllTools;\n\t\tthis.runtime.setActiveTools = actions.setActiveTools;\n\t\tthis.runtime.refreshTools = actions.refreshTools;\n\t\tthis.runtime.getCommands = actions.getCommands;\n\t\tthis.runtime.setModel = actions.setModel;\n\t\tthis.runtime.getThinkingLevel = actions.getThinkingLevel;\n\t\tthis.runtime.setThinkingLevel = actions.setThinkingLevel;\n\n\t\t// Context actions (required)\n\t\tthis.getModel = contextActions.getModel;\n\t\tthis.getScopedModels = contextActions.getScopedModels;\n\t\tthis.isIdleFn = contextActions.isIdle;\n\t\tthis.isProjectTrustedFn = contextActions.isProjectTrusted;\n\t\tthis.getSignalFn = contextActions.getSignal;\n\t\tthis.abortFn = contextActions.abort;\n\t\tthis.hasPendingMessagesFn = contextActions.hasPendingMessages;\n\t\tthis.isSessionSummaryEnabledFn = contextActions.isSessionSummaryEnabled;\n\t\tthis.generateWorkflowSummaryFn = contextActions.generateWorkflowSummary;\n\t\tthis.shutdownHandler = contextActions.shutdown;\n\t\tthis.getContextUsageFn = contextActions.getContextUsage;\n\t\tthis.compactFn = contextActions.compact;\n\t\tthis.getSystemPromptFn = contextActions.getSystemPrompt;\n\t\tthis.getSystemPromptOptionsFn =\n\t\t\tcontextActions.getSystemPromptOptions ?? (() => normalizeBuildSystemPromptOptions({ cwd: this.cwd }));\n\t\tthis.getSkillCatalogFn = contextActions.getSkillCatalog;\n\t\tthis.getRouterModelFn = contextActions.getRouterModel;\n\t\tthis.getModelRoutingFn = contextActions.getModelRouting;\n\t\tthis.executeToolFn = contextActions.executeTool;\n\t\tthis.getCallableToolsFn = contextActions.getCallableTools ?? (() => []);\n\t\tthis.runtime.getSettings = contextActions.getSettings;\n\n\t\t// Flush provider registrations queued during extension loading.\n\t\tfor (const registration of this.runtime.pendingProviderRegistrations) {\n\t\t\ttry {\n\t\t\t\tif (\"provider\" in registration) {\n\t\t\t\t\t(\n\t\t\t\t\t\tproviderActions?.registerProvider ??\n\t\t\t\t\t\t((provider: Provider) => this.modelRegistry.registerProvider(provider))\n\t\t\t\t\t)(registration.provider);\n\t\t\t\t} else {\n\t\t\t\t\t(\n\t\t\t\t\t\tproviderActions?.registerProvider ??\n\t\t\t\t\t\t((name: string, config?: ProviderConfig) => this.modelRegistry.registerProvider(name, config!))\n\t\t\t\t\t)(registration.name, registration.config);\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\tthis.emitError({\n\t\t\t\t\textensionPath: registration.extensionPath,\n\t\t\t\t\tevent: \"register_provider\",\n\t\t\t\t\terror: error instanceof Error ? error.message : String(error),\n\t\t\t\t\tstack: error instanceof Error ? error.stack : undefined,\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t\tthis.runtime.pendingProviderRegistrations = [];\n\n\t\t// From this point on, provider registration/unregistration takes effect immediately\n\t\t// without requiring a /reload.\n\t\tthis.runtime.registerProvider = ((providerOrName: Provider | string, configOrPath?: ProviderConfig | string) => {\n\t\t\tif (typeof providerOrName === \"string\") {\n\t\t\t\tconst config = configOrPath as ProviderConfig;\n\t\t\t\tif (providerActions?.registerProvider) providerActions.registerProvider(providerOrName, config);\n\t\t\t\telse this.modelRegistry.registerProvider(providerOrName, config);\n\t\t\t} else if (providerActions?.registerProvider) providerActions.registerProvider(providerOrName);\n\t\t\telse this.modelRegistry.registerProvider(providerOrName);\n\t\t}) as ExtensionRuntime[\"registerProvider\"];\n\t\tthis.runtime.unregisterProvider = (name) => {\n\t\t\tif (providerActions?.unregisterProvider) {\n\t\t\t\tproviderActions.unregisterProvider(name);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tthis.modelRegistry.unregisterProvider(name);\n\t\t};\n\t}\n\n\tbindCommandContext(actions?: ExtensionCommandContextActions): void {\n\t\tif (actions) {\n\t\t\tthis.waitForIdleFn = actions.waitForIdle;\n\t\t\tthis.newSessionHandler = actions.newSession;\n\t\t\tthis.forkHandler = actions.fork;\n\t\t\tthis.navigateTreeHandler = actions.navigateTree;\n\t\t\tthis.switchSessionHandler = actions.switchSession;\n\t\t\tthis.reloadHandler = actions.reload;\n\t\t\treturn;\n\t\t}\n\n\t\tthis.waitForIdleFn = async () => {};\n\t\tthis.newSessionHandler = async () => ({ cancelled: false });\n\t\tthis.forkHandler = async () => ({ cancelled: false });\n\t\tthis.navigateTreeHandler = async () => ({ cancelled: false });\n\t\tthis.switchSessionHandler = async () => ({ cancelled: false });\n\t\tthis.reloadHandler = async () => {};\n\t}\n\n\tsetHostBindings(\n\t\thumanInput: HostInput | null | undefined,\n\t\tonDiagnostic?: (diagnostic: HostDiagnostic) => void,\n\t\tbindingRevision = 0,\n\t): void {\n\t\tthis.humanInput = humanInput;\n\t\tthis.humanInputBindingRevision = bindingRevision;\n\t\tthis.onDiagnostic = onDiagnostic;\n\t\t// Internal builtin bridge: no new extension API and no interception of console.\n\t\tconst scope = lifecycleScopeForOwner(this.runtime);\n\t\tconst report = (diagnostic: Omit<HostDiagnostic, \"sessionId\">) => {\n\t\t\ttry {\n\t\t\t\tthis.onDiagnostic?.({ ...diagnostic, sessionId: this.sessionManager.getSessionId() });\n\t\t\t} catch {\n\t\t\t\t// Observers cannot replace the primary service failure.\n\t\t\t}\n\t\t};\n\t\t// Rebinding replaces the reporter, not the builtin service owner.\n\t\tObject.defineProperty(report, Symbol.for(\"atomic.builtin-owner.v1\"), { value: scope });\n\t\tReflect.set(scope, Symbol.for(\"atomic.builtin-diagnostic.v1\"), report);\n\t\tthis.refreshHostInput();\n\t}\n\n\tcancelHostInput(): void {\n\t\tthis.inputBridge.cancel();\n\t}\n\t/** @internal Join this generation's callbacks without draining its reload caller. */\n\tdrainWork(): Promise<void> {\n\t\treturn drainExtensionWork(this.runtime);\n\t}\n\n\t/** @internal Seal input admission without invalidating shutdown handlers. */\n\tsealHostInput(): void {\n\t\tthis.inputBridge.close();\n\t\tsealExtensionWork(this.runtime);\n\t}\n\n\t/** @internal A rejected transaction retains the live runner, but never revives captured dialogs. */\n\tresumeAfterRejectedReload(): void {\n\t\tif (this.staleMessage) return;\n\t\tresumeExtensionWork(this.runtime);\n\t\tthis.inputBridge = new HostInputBridge(\n\t\t\t() => this.sessionManager.getSessionId(),\n\t\t\t() => this.getSignalFn(),\n\t\t);\n\t\tthis.refreshHostInput();\n\t}\n\n\tprivate refreshHostInput(): void {\n\t\tconst ui = this.presentationUI;\n\t\tthis.inputBridge.bind(\n\t\t\tthis.humanInput === undefined ? this.presentationInput : (this.humanInput ?? undefined),\n\t\t\tthis.humanInput,\n\t\t\tthis.humanInputBindingRevision,\n\t\t);\n\t\tconst bridged = this.inputBridge.wrap(\n\t\t\tui ?? {\n\t\t\t\t...noOpUIContext,\n\t\t\t\tcustom: async () => {\n\t\t\t\t\tthrow hostInputError(\"HumanInputUnavailable\");\n\t\t\t\t},\n\t\t\t},\n\t\t\tthis.presentationInput,\n\t\t\tthis.orchestrationContext?.kind === \"workflow-stage\"\n\t\t\t\t? {\n\t\t\t\t\t\tworkflowRunId: this.orchestrationContext.workflowRunId,\n\t\t\t\t\t\tworkflowStageId: this.orchestrationContext.workflowStageId,\n\t\t\t\t\t}\n\t\t\t\t: {},\n\t\t);\n\t\tthis.uiContext = this.wrapUIPromptContext(bridged, this.uiPromptBinding);\n\t\tcopyHostQuestionnaire(bridged, this.uiContext);\n\t}\n\n\tsetUIContext(uiContext?: ExtensionUIContext, mode: ExtensionMode = \"print\", isPresentationOnly = false): void {\n\t\tthis.presentationOnly = isPresentationOnly;\n\t\tif (uiContext !== this.presentationUI) {\n\t\t\tthis.endActiveUIPrompt();\n\t\t\t++this.uiPromptBinding;\n\t\t\tthis.presentationUI = uiContext;\n\t\t\tconst ui = uiContext;\n\t\t\tthis.presentationInput = ui\n\t\t\t\t? {\n\t\t\t\t\t\tconfirm: (title, message, options) => ui.confirm(title, message, options),\n\t\t\t\t\t\tselect: (title, choices, options) => ui.select(title, choices, options),\n\t\t\t\t\t\tinput: (title, placeholder, options) => ui.input(title, placeholder, options),\n\t\t\t\t\t\teditor: (title, initial, options) => ui.editor(title, initial, options),\n\t\t\t\t\t\tquestionnaire: (params, options) => presentQuestionnaire(ui, params, options.signal),\n\t\t\t\t\t}\n\t\t\t\t: undefined;\n\t\t\tthis.refreshHostInput();\n\t\t}\n\t\tthis.mode = mode;\n\t}\n\n\tprivate wrapUIPromptContext(ui: ExtensionUIContext, binding: number): ExtensionUIContext {\n\t\treturn {\n\t\t\t...ui,\n\t\t\tselect: (title, options, opts) =>\n\t\t\t\tthis.withUIPrompt(binding, \"select\", title, () => ui.select(title, options, opts)),\n\t\t\tconfirm: (title, message, opts) =>\n\t\t\t\tthis.withUIPrompt(binding, \"confirm\", title, () => ui.confirm(title, message, opts)),\n\t\t\tinput: (title, placeholder, opts) =>\n\t\t\t\tthis.withUIPrompt(binding, \"input\", title, () => ui.input(title, placeholder, opts)),\n\t\t\teditor: (title, prefill, opts) =>\n\t\t\t\tthis.withUIPrompt(binding, \"editor\", title, () => ui.editor(title, prefill, opts)),\n\t\t\tcustom: (factory, options) =>\n\t\t\t\toptions?.purpose === \"navigation\"\n\t\t\t\t\t? ui.custom(factory, options)\n\t\t\t\t\t: this.withUIPrompt(binding, \"custom\", undefined, () => ui.custom(factory, options)),\n\t\t};\n\t}\n\n\t/** Track a host-owned trust dialog using the current session's prompt lifecycle. */\n\twithProjectTrustPrompt<T>(kind: UIPromptKind, title: string, run: () => Promise<T>): Promise<T> {\n\t\treturn this.withUIPrompt(this.uiPromptBinding, kind, title, run, \"project_trust\");\n\t}\n\n\t/** Begin a host-owned trust span whose end arrives as a separate control frame. */\n\tbeginProjectTrustPrompt(kind: UIPromptKind, title: string): () => void {\n\t\treturn this.beginUIPrompt(kind, title, \"project_trust\");\n\t}\n\n\tprivate withUIPrompt<T>(\n\t\tbinding: number,\n\t\tkind: UIPromptKind,\n\t\ttitle: string | undefined,\n\t\trun: () => Promise<T>,\n\t\treason: \"ui_prompt\" | \"project_trust\" = \"ui_prompt\",\n\t): Promise<T> {\n\t\tif (binding !== this.uiPromptBinding) return run();\n\t\tconst finish = this.beginUIPrompt(kind, title, reason);\n\t\ttry {\n\t\t\treturn run().finally(finish);\n\t\t} catch (error) {\n\t\t\tfinish();\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\tprivate beginUIPrompt(\n\t\tkind: UIPromptKind,\n\t\ttitle: string | undefined,\n\t\treason: \"ui_prompt\" | \"project_trust\",\n\t): () => void {\n\t\tlet prompt = this.activeUIPrompt;\n\t\tif (!prompt) {\n\t\t\tprompt = { depth: 0, reason, kind, title };\n\t\t\tthis.activeUIPrompt = prompt;\n\t\t\tthis.emitUIPromptEvent({\n\t\t\t\ttype: \"ui_prompt_start\",\n\t\t\t\treason,\n\t\t\t\tkind,\n\t\t\t\t...(title === undefined ? {} : { title }),\n\t\t\t});\n\t\t}\n\t\tprompt.depth += 1;\n\n\t\tlet finished = false;\n\t\treturn () => {\n\t\t\tif (finished) return;\n\t\t\tfinished = true;\n\t\t\tif (this.activeUIPrompt !== prompt) return;\n\n\t\t\tprompt.depth -= 1;\n\t\t\tif (prompt.depth === 0) this.endActiveUIPrompt(prompt);\n\t\t};\n\t}\n\n\tprivate endActiveUIPrompt(prompt = this.activeUIPrompt): void {\n\t\tif (!prompt || this.activeUIPrompt !== prompt) return;\n\t\tthis.activeUIPrompt = undefined;\n\t\tprompt.depth = 0;\n\t\tthis.emitUIPromptEvent({\n\t\t\ttype: \"ui_prompt_end\",\n\t\t\treason: prompt.reason,\n\t\t\tkind: prompt.kind,\n\t\t\t...(prompt.title === undefined ? {} : { title: prompt.title }),\n\t\t});\n\t}\n\n\tprivate readonly pendingUIPromptNotifications = new Set<Promise<void>>();\n\n\tprivate emitUIPromptEvent(event: Extract<RunnerEmitEvent, { type: \"ui_prompt_start\" | \"ui_prompt_end\" }>): void {\n\t\tconst delivery = Promise.resolve().then(async () => {\n\t\t\tawait this.emit(event);\n\t\t});\n\t\tthis.pendingUIPromptNotifications.add(delivery);\n\t\tvoid delivery.finally(() => this.pendingUIPromptNotifications.delete(delivery)).catch(() => {});\n\t}\n\n\t/** Settle only the deliveries pending at this boundary, without delaying prompt UI. */\n\tasync flushUIPromptNotifications(timeoutMs: number): Promise<{ timedOut: boolean }> {\n\t\tconst pending = [...this.pendingUIPromptNotifications];\n\t\tif (pending.length === 0) return { timedOut: false };\n\t\tlet timer: ReturnType<typeof setTimeout> | undefined;\n\t\ttry {\n\t\t\treturn await Promise.race([\n\t\t\t\tPromise.allSettled(pending).then(() => ({ timedOut: false })),\n\t\t\t\tnew Promise<{ timedOut: boolean }>((resolve) => {\n\t\t\t\t\ttimer = setTimeout(() => resolve({ timedOut: true }), timeoutMs);\n\t\t\t\t}),\n\t\t\t]);\n\t\t} finally {\n\t\t\tclearTimeout(timer);\n\t\t}\n\t}\n\n\tgetUIContext(): ExtensionUIContext {\n\t\treturn this.uiContext;\n\t}\n\n\thasUI(): boolean {\n\t\treturn this.presentationUI !== undefined;\n\t}\n\n\tgetExtensionPaths(): string[] {\n\t\treturn this.extensions.map((extension) => extension.path);\n\t}\n\n\t/** Get all registered tools from all extensions (first registration per name wins). */\n\tgetAllRegisteredTools(): RegisteredTool[] {\n\t\treturn collectRegisteredTools(this.extensions);\n\t}\n\n\t/** Get a tool definition by name. Returns undefined if not found. */\n\tgetToolDefinition(toolName: string): RegisteredTool[\"definition\"] | undefined {\n\t\treturn findToolDefinition(this.extensions, toolName);\n\t}\n\n\tgetFlags(): Map<string, ExtensionFlag> {\n\t\treturn collectFlags(this.extensions);\n\t}\n\n\tsetFlagValue(name: string, value: boolean | string): void {\n\t\tthis.runtime.flagValues.set(name, value);\n\t\tthis.runtime.explicitFlagNames ??= new Set();\n\t\tthis.runtime.explicitFlagNames.add(name);\n\t}\n\n\tgetFlagValues(): Map<string, boolean | string> {\n\t\treturn new Map(this.runtime.flagValues);\n\t}\n\n\tgetExplicitFlagValues(): Map<string, boolean | string> {\n\t\tconst explicitFlagNames = this.runtime.explicitFlagNames ?? new Set<string>();\n\t\treturn new Map([...this.runtime.flagValues].filter(([name]) => explicitFlagNames.has(name)));\n\t}\n\n\tgetShortcuts(resolvedKeybindings: KeybindingsConfig): Map<KeyId, ExtensionShortcut> {\n\t\tconst resolution = resolveExtensionShortcuts(this.extensions, resolvedKeybindings, this.hasUI());\n\t\tthis.shortcutDiagnostics = resolution.diagnostics;\n\t\tfor (const [key, shortcut] of resolution.shortcuts) {\n\t\t\tresolution.shortcuts.set(key, {\n\t\t\t\t...shortcut,\n\t\t\t\thandler: (context) => {\n\t\t\t\t\tif (!extensionWorkOpen(this.runtime)) return Promise.reject(hostInputError(\"SessionClosed\"));\n\t\t\t\t\treturn runResourceRegistrationBatch(this.runtime, async () => shortcut.handler(context));\n\t\t\t\t},\n\t\t\t});\n\t\t}\n\t\treturn resolution.shortcuts;\n\t}\n\n\tgetShortcutDiagnostics(): ResourceDiagnostic[] {\n\t\treturn this.shortcutDiagnostics;\n\t}\n\n\tretireObservation(): void {\n\t\tretireExtensionContextEffects(this.contextOwner);\n\t\tthis.mcpDiagnosticUnsubscriber?.();\n\t\tthis.mcpDiagnosticUnsubscriber = undefined;\n\t}\n\n\t/** A retired session's late cleanup must not write into presentation its successor now owns. */\n\tdetachPresentation(): void {\n\t\tthis.setUIContext(undefined, this.mode, this.presentationOnly);\n\t}\n\n\trevokeAuthority(): void {\n\t\ttry {\n\t\t\tthis.retireObservation();\n\t\t} finally {\n\t\t\tthis.authorityRevoked = true;\n\t\t\trevokeExtensionAuthority(this.runtime);\n\t\t}\n\t}\n\n\tinvalidate(message = STALE_EXTENSION_CONTEXT_MESSAGE): void {\n\t\tthis.sealHostInput();\n\t\ttry {\n\t\t\tthis.retireObservation();\n\t\t} finally {\n\t\t\tif (!this.staleMessage) {\n\t\t\t\tthis.staleMessage = message;\n\t\t\t\tthis.runtime.invalidate(message);\n\t\t\t}\n\t\t}\n\t}\n\n\treportUnhandledMcpServers(): void {\n\t\tthis.mcpDiagnosticUnsubscriber ??= this.runtime.mcpServerRegistry.subscribe(\n\t\t\t() => this.reportUnhandledMcpServers(),\n\t\t\t{ consumer: false },\n\t\t);\n\t\tif (this.runtime.mcpServerRegistry.hasConsumers()) return;\n\t\tfor (const server of this.runtime.mcpServerRegistry.list()) {\n\t\t\tif (this.reportedMcpServers.has(server.name)) continue;\n\t\t\tthis.reportedMcpServers.add(server.name);\n\t\t\tthis.emitError({\n\t\t\t\textensionPath: server.sourceInfo.path,\n\t\t\t\tevent: \"register_mcp_server\",\n\t\t\t\terror: `MCP server \"${server.name}\" is registered, but no loaded extension connects MCP servers; another extension may have replaced the built-in MCP support`,\n\t\t\t});\n\t\t}\n\t}\n\n\tprivate assertActive(): void {\n\t\tif (this.authorityRevoked) this.runtime.assertActive();\n\t\tif (this.staleMessage) {\n\t\t\tthrow new Error(this.staleMessage);\n\t\t}\n\t}\n\n\tonError(listener: ExtensionErrorListener): () => void {\n\t\tthis.errorListeners.add(listener);\n\t\treturn () => this.errorListeners.delete(listener);\n\t}\n\n\temitError(error: ExtensionError): void {\n\t\tthis.onDiagnostic?.({\n\t\t\tlevel: \"error\",\n\t\t\tsource: error.extensionPath,\n\t\t\tmessage: `Extension ${error.event} failed`,\n\t\t\tsessionId: this.sessionManager.getSessionId(),\n\t\t});\n\t\tfor (const listener of this.errorListeners) {\n\t\t\tlistener(error);\n\t\t}\n\t}\n\n\thasHandlers(eventType: string): boolean {\n\t\treturn hasExtensionHandlers(this.extensions, eventType);\n\t}\n\n\tgetMessageRenderer(customType: string): MessageRenderer | undefined {\n\t\treturn findMessageRenderer(this.extensions, customType);\n\t}\n\n\tgetMarkdownTransformers(): MarkdownTransformer[] {\n\t\treturn collectMarkdownTransformers(this.extensions);\n\t}\n\n\t/** Renderers of calls to `toolName`: extension resolvers in load order, then `base`. */\n\tresolveToolRenderers(toolName: string, base: () => ToolRenderers | undefined): ToolRenderers | undefined {\n\t\tconst resolvers = this.extensions.flatMap((ext) => ext.toolRenderers ?? []);\n\t\tconst resolve = (index: number): ToolRenderers | undefined =>\n\t\t\tindex < resolvers.length ? resolvers[index](toolName, () => resolve(index + 1)) : base();\n\t\treturn resolve(0);\n\t}\n\n\tgetEntryRenderer(customType: string): EntryRenderer | undefined {\n\t\tconst renderer = findEntryRenderer(this.extensions, customType);\n\t\treturn renderer ? originalRegistrationCallback(renderer) : undefined;\n\t}\n\n\t/** Invoke the session-owned registration without changing discovery identity. */\n\trenderEntry(customType: string, ...args: Parameters<EntryRenderer>): ReturnType<EntryRenderer> {\n\t\tthis.assertActive();\n\t\treturn findEntryRenderer(this.extensions, customType)?.(...args);\n\t}\n\n\tgetRegisteredCommands(): ResolvedCommand[] {\n\t\tthis.commandDiagnostics = [];\n\t\treturn resolveRegisteredCommands(this.extensions);\n\t}\n\n\tgetCommandDiagnostics(): ResourceDiagnostic[] {\n\t\treturn this.commandDiagnostics;\n\t}\n\n\tgetCommand(name: string, quitSignal?: AbortSignal): ResolvedCommand | undefined {\n\t\tconst command = resolveRegisteredCommands(this.extensions).find((entry) => entry.invocationName === name);\n\t\tif (!command) return undefined;\n\t\treturn {\n\t\t\t...command,\n\t\t\thandler: (args, context) =>\n\t\t\t\trunResourceRegistrationBatch(this.runtime, async () => {\n\t\t\t\t\tquitSignal?.throwIfAborted();\n\t\t\t\t\tconst execution = command.handler(args, context);\n\t\t\t\t\treturn quitSignal ? raceWithAbortSignal(execution, quitSignal) : execution;\n\t\t\t\t}),\n\t\t};\n\t}\n\n\t/**\n\t * Request a graceful shutdown. Called by extension tools and event handlers.\n\t * The actual shutdown behavior is provided by the mode via bindExtensions().\n\t */\n\tshutdown(): void {\n\t\tthis.shutdownHandler();\n\t}\n\n\tcreateContext(): ExtensionContext {\n\t\treturn createExtensionContext(this.createContextSource(), this.contextOwner);\n\t}\n\n\t/** Bound to the actual executing parent, not an extension-supplied caller identity. */\n\tcreateToolContext(toolCallId: string, signal: AbortSignal | undefined): ExtensionToolContext {\n\t\tconst invoke = AsyncLocalStorage.bind(async (name: string, args: unknown, options: ExecuteToolOptions = {}) => {\n\t\t\tthis.assertActive();\n\t\t\tif (signal?.aborted) throw new Error(\"Calling tool execution has ended\");\n\t\t\tif (!this.executeToolFn)\n\t\t\t\treturn {\n\t\t\t\t\ttoolCall: { type: \"toolCall\" as const, id: `${toolCallId}/0`, name, arguments: {} },\n\t\t\t\t\tresult: {\n\t\t\t\t\t\tcontent: [{ type: \"text\" as const, text: \"Nested tool calls are not available in this context\" }],\n\t\t\t\t\t\tdetails: {},\n\t\t\t\t\t},\n\t\t\t\t\tisError: true,\n\t\t\t\t};\n\t\t\tconst callSignal =\n\t\t\t\tsignal && options.signal ? AbortSignal.any([signal, options.signal]) : (options.signal ?? signal);\n\t\t\treturn this.executeToolFn(toolCallId, name, args, { ...options, signal: callSignal });\n\t\t});\n\t\treturn Object.defineProperties(this.createContext() as ExtensionToolContext, {\n\t\t\ttools: {\n\t\t\t\tget: () => {\n\t\t\t\t\tthis.assertActive();\n\t\t\t\t\treturn this.getCallableToolsFn();\n\t\t\t\t},\n\t\t\t},\n\t\t\texecuteTool: { value: invoke },\n\t\t});\n\t}\n\n\tcreateCommandContext(): ExtensionCommandContext {\n\t\treturn createExtensionCommandContext(this.createContextSource(), this.contextOwner);\n\t}\n\n\tprivate createContextSource(): ExtensionCommandContextSource {\n\t\treturn {\n\t\t\tassertActive: () => this.assertActive(),\n\t\t\tassertAction: () => assertExtensionAction(this.runtime),\n\t\t\tgetChildSessionOptions: (options) => this.runtime.getChildSessionOptions?.(options) ?? options,\n\t\t\tgetExtensionPaths: () => this.getExtensionPaths(),\n\t\t\tobserveWorkflowActivity: (observer) => this.runtime.workflowActivityHub.observeWorkflowActivity(observer),\n\t\t\t...(this.taskHostBinding ? { getAgentTaskHost: this.taskHostBinding } : {}),\n\t\t\tgetUIContext: () => this.uiContext,\n\t\t\tgetMode: () => this.mode,\n\t\t\thasUI: () => this.hasUI(),\n\t\t\thasHumanInput: () => this.inputBridge.available,\n\t\t\tisPresentationOnly: () => this.presentationOnly,\n\t\t\tgetCwd: () => this.cwd,\n\t\t\tgetSessionManager: () => this.sessionManager,\n\t\t\tgetModelRegistry: () => this.modelRegistry,\n\t\t\tgetModel: () => this.getModel(),\n\t\t\tgetSubagentPolicy: () => this.subagentPolicy,\n\t\t\tgetScopedModels: () => this.getScopedModels(),\n\t\t\tgetThinkingLevel: () => this.runtime.getThinkingLevel(),\n\t\t\tgetOrchestrationContext: () => this.orchestrationContext,\n\t\t\tisIdle: () => this.isIdleFn(),\n\t\t\tisProjectTrusted: () => this.isProjectTrustedFn(),\n\t\t\tgetSignal: () => this.getSignalFn(),\n\t\t\tabort: () => this.abortFn(),\n\t\t\thasPendingMessages: () => this.hasPendingMessagesFn(),\n\t\t\tisSessionSummaryEnabled: () => this.isSessionSummaryEnabledFn?.() ?? false,\n\t\t\tgenerateWorkflowSummary: (text, signal, options) =>\n\t\t\t\tthis.generateWorkflowSummaryFn?.(text, signal, options) ?? Promise.resolve(undefined),\n\t\t\tshutdown: () => this.shutdownHandler(),\n\t\t\tgetContextUsage: () => this.getContextUsageFn(),\n\t\t\tcompact: (options) => this.compactFn(options),\n\t\t\tgetSystemPrompt: () => this.getSystemPromptFn(),\n\t\t\t...(this.getSkillCatalogFn ? { getSkillCatalog: () => this.getSkillCatalogFn!() } : {}),\n\t\t\t...(this.getRouterModelFn ? { getRouterModel: () => this.getRouterModelFn!() } : {}),\n\t\t\t...(this.getModelRoutingFn ? { getModelRouting: () => this.getModelRoutingFn!() } : {}),\n\t\t\tgetSystemPromptOptions: () => this.getSystemPromptOptionsFn(),\n\t\t\twaitForIdle: () => this.waitForIdleFn(),\n\t\t\tnewSession: (options) => this.newSessionHandler(options),\n\t\t\tfork: (entryId, options) => this.forkHandler(entryId, options),\n\t\t\tnavigateTree: (targetId, options) => this.navigateTreeHandler(targetId, options),\n\t\t\tswitchSession: (sessionPath, options) => this.switchSessionHandler(sessionPath, options),\n\t\t\treload: () => this.reloadHandler(),\n\t\t};\n\t}\n\n\t/** Keep startup reporters bound while adding the now-authorized extension set. */\n\tattachStartupExtensions(extensions: Extension[]): () => Promise<void> {\n\t\tconst newcomers = extensions.filter((extension) => !this.extensions.includes(extension));\n\t\tthis.extensions = [...this.extensions, ...newcomers];\n\t\treturn async () => {\n\t\t\tawait runResourceRegistrationBatch(this.runtime, () =>\n\t\t\t\trunGenericHandlers(\n\t\t\t\t\tthis.extensions.filter((extension) => newcomers.includes(extension)),\n\t\t\t\t\tthis.createContext(),\n\t\t\t\t\t{ type: \"session_start\", reason: \"startup\" },\n\t\t\t\t\t(error) => this.emitError(error),\n\t\t\t\t),\n\t\t\t);\n\t\t};\n\t}\n\n\tasync emit<TEvent extends RunnerEmitEvent>(\n\t\tevent: TEvent,\n\t\tisCurrent?: () => boolean,\n\t\tadmitted = false,\n\t): Promise<RunnerEmitResult<TEvent>> {\n\t\tif (!admitted && event.type !== \"session_shutdown\" && !extensionWorkOpen(this.runtime))\n\t\t\treturn undefined as RunnerEmitResult<TEvent>;\n\t\tconst observerFailures: Error[] = [];\n\t\tconst dispatch = () =>\n\t\t\trunGenericHandlers(\n\t\t\t\tthis.extensions,\n\t\t\t\tthis.createContext(),\n\t\t\t\tevent,\n\t\t\t\t(error) => {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tthis.emitError(error);\n\t\t\t\t\t} catch (cause) {\n\t\t\t\t\t\tif (event.type !== \"session_shutdown\") throw cause;\n\t\t\t\t\t\tobserverFailures.push(\n\t\t\t\t\t\t\tnew Error(`${error.extensionPath}: ${error.error}`),\n\t\t\t\t\t\t\tnew Error(\"Shutdown observer failed\", { cause }),\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tisCurrent,\n\t\t\t);\n\t\tconst result = await runResourceRegistrationBatch(\n\t\t\tthis.runtime,\n\t\t\t() => (event.type === \"session_shutdown\" ? runExtensionCleanup(this.runtime, dispatch) : dispatch()),\n\t\t\tadmitted || event.type === \"session_shutdown\",\n\t\t);\n\t\tif (observerFailures.length)\n\t\t\tthrow Object.assign(new AggregateError(observerFailures, \"Shutdown observers failed\"), {\n\t\t\t\tcode: \"ShutdownFailed\",\n\t\t\t});\n\t\treturn result;\n\t}\n\n\tasync emitMessageEnd(event: MessageEndEvent, admitted = false): Promise<AgentMessage | undefined> {\n\t\treturn runResourceRegistrationBatch(\n\t\t\tthis.runtime,\n\t\t\t() => runMessageEndHandlers(this.extensions, this.createContext(), event, (error) => this.emitError(error)),\n\t\t\tadmitted,\n\t\t);\n\t}\n\n\tasync emitToolResult(event: ToolResultEvent, admitted = false): Promise<ToolResultEventResult | undefined> {\n\t\treturn runResourceRegistrationBatch(\n\t\t\tthis.runtime,\n\t\t\t() => runToolResultHandlers(this.extensions, this.createContext(), event, (error) => this.emitError(error)),\n\t\t\tadmitted,\n\t\t);\n\t}\n\n\tasync emitToolCall(event: ToolCallEvent): Promise<ToolCallEventResult | undefined> {\n\t\treturn runResourceRegistrationBatch(this.runtime, () =>\n\t\t\trunToolCallHandlers(this.extensions, this.createContext(), event),\n\t\t);\n\t}\n\n\tasync emitUserBash(event: UserBashEvent): Promise<UserBashEventResult | undefined> {\n\t\treturn runResourceRegistrationBatch(this.runtime, () =>\n\t\t\trunUserBashHandlers(this.extensions, this.createContext(), event, (error) => this.emitError(error)),\n\t\t);\n\t}\n\n\tasync emitBoundary(\n\t\tbaseEvent: BoundaryBaseEvent,\n\t\tbuildContext: (entries: SessionBoundaryDraft[]) => BoundaryContextPreview | Promise<BoundaryContextPreview>,\n\t): Promise<BoundaryDispatchResult> {\n\t\treturn runResourceRegistrationBatch(\n\t\t\tthis.runtime,\n\t\t\t() =>\n\t\t\t\trunBoundaryHandlers(this.extensions, this.createContext(), baseEvent, buildContext, (error) =>\n\t\t\t\t\tthis.emitError(error),\n\t\t\t\t),\n\t\t\ttrue,\n\t\t);\n\t}\n\n\tasync emitContext(messages: AgentMessage[]): Promise<AgentMessage[]> {\n\t\treturn runResourceRegistrationBatch(this.runtime, () =>\n\t\t\trunContextHandlers(this.extensions, this.createContext(), messages, (error) => this.emitError(error)),\n\t\t);\n\t}\n\n\temitBeforeProviderRequest(payload: unknown): Promise<unknown> {\n\t\treturn runResourceRegistrationBatch(this.runtime, () =>\n\t\t\trunBeforeProviderRequestHandlers(this.extensions, this.createContext(), payload, (error) =>\n\t\t\t\tthis.emitError(error),\n\t\t\t),\n\t\t);\n\t}\n\n\tasync emitCacheWarmingDecision(event: CacheWarmingDecisionEvent): Promise<CacheWarmingAction> {\n\t\tlet action = event.action;\n\t\tconst ctx = this.createContext();\n\t\tfor (const { ext, handlers } of snapshotEventHandlers(this.extensions, event.type)) {\n\t\t\tfor (const handler of handlers) {\n\t\t\t\ttry {\n\t\t\t\t\tconst result = (await handler({ ...event, action }, ctx)) as CacheWarmingDecisionEventResult | undefined;\n\t\t\t\t\tif (result?.action === \"warm\" || result?.action === \"stop\") action = result.action;\n\t\t\t\t} catch (error) {\n\t\t\t\t\tthis.emitError({\n\t\t\t\t\t\textensionPath: ext.path,\n\t\t\t\t\t\tevent: event.type,\n\t\t\t\t\t\terror: error instanceof Error ? error.message : String(error),\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn action;\n\t}\n\n\tasync emitBeforeProviderHeaders(headers: ProviderHeaders): Promise<ProviderHeaders> {\n\t\treturn runResourceRegistrationBatch(this.runtime, async () => {\n\t\t\tfor (const { ext: extension, handlers } of snapshotEventHandlers(this.extensions, \"before_provider_headers\")) {\n\t\t\t\tfor (const handler of handlers) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait handler({ type: \"before_provider_headers\", headers }, this.createContext());\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tthis.emitError({\n\t\t\t\t\t\t\textensionPath: extension.path,\n\t\t\t\t\t\t\tevent: \"before_provider_headers\",\n\t\t\t\t\t\t\terror: error instanceof Error ? error.message : String(error),\n\t\t\t\t\t\t\tstack: error instanceof Error ? error.stack : undefined,\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn headers;\n\t\t});\n\t}\n\n\temitBeforeAgentStart(\n\t\tprompt: string,\n\t\timages: ImageContent[] | undefined,\n\t\tsystemPromptOptions: BuildSystemPromptOptions,\n\t\tcustomMessage?: import(\"../messages.ts\").CustomMessage,\n\t): Promise<BeforeAgentStartCombinedResult> {\n\t\treturn runResourceRegistrationBatch(this.runtime, () =>\n\t\t\trunBeforeAgentStartHandlers(\n\t\t\t\tthis.extensions,\n\t\t\t\tthis.createContext(),\n\t\t\t\t() => this.assertActive(),\n\t\t\t\tprompt,\n\t\t\t\timages,\n\t\t\t\tsystemPromptOptions,\n\t\t\t\t(error) => this.emitError(error),\n\t\t\t\tcustomMessage,\n\t\t\t),\n\t\t);\n\t}\n\n\temitResourcesDiscover(\n\t\tcwd: string,\n\t\treason: ResourcesDiscoverEvent[\"reason\"],\n\t): Promise<ResourcesDiscoverCombinedResult> {\n\t\treturn runResourceRegistrationBatch(this.runtime, () =>\n\t\t\trunResourcesDiscoverHandlers(this.extensions, this.createContext(), cwd, reason, (error) =>\n\t\t\t\tthis.emitError(error),\n\t\t\t),\n\t\t);\n\t}\n\n\t/** Emit input event. Transforms chain, \"handled\" short-circuits. */\n\temitInput(\n\t\ttext: string,\n\t\timages: ImageContent[] | undefined,\n\t\tsource: InputSource,\n\t\tstreamingBehavior?: \"steer\" | \"followUp\",\n\t): Promise<InputEventResult> {\n\t\treturn runResourceRegistrationBatch(this.runtime, () =>\n\t\t\trunInputHandlers(this.extensions, this.createContext(), text, images, source, streamingBehavior, (error) =>\n\t\t\t\tthis.emitError(error),\n\t\t\t),\n\t\t);\n\t}\n}\n"]}
1
+ {"version":3,"file":"runner.js","sourceRoot":"","sources":["../../../src/core/extensions/runner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAO3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAa3D,OAAO,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAG/F,OAAO,EAAE,iCAAiC,EAAE,MAAM,qBAAqB,CAAC;AACxE,OAAO,EAAE,oBAAoB,EAAE,MAAM,iDAAiD,CAAC;AACvF,OAAO,EACN,qBAAqB,EACrB,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,mBAAmB,EACnB,wBAAwB,EACxB,mBAAmB,EACnB,iBAAiB,GACjB,MAAM,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\"../../utils/abort.js\";\nimport type {\n\tCacheWarmingAction,\n\tCacheWarmingDecisionEvent,\n\tCacheWarmingDecisionEventResult,\n} from \"../cache-warmer.ts\";\nimport type { ExecuteToolOptions, ExtensionToolContext } from \"./context-types.ts\";\nimport { snapshotEventHandlers } from \"./runner-events.ts\";\n/**\n * Extension runner - executes extensions and manages their lifecycle.\n */\n\nimport type { Provider, ProviderHeaders } from \"@bastani/pi-ai\";\nimport type { Api, ImageContent, Model } from \"@bastani/pi-ai/compat\";\nimport type { AgentMessage } from \"@earendil-works/pi-agent-core\";\nimport type { KeyId } from \"@earendil-works/pi-tui\";\nimport type { ResourceDiagnostic } from \"../diagnostics.ts\";\nimport type { KeybindingsConfig } from \"../keybindings.ts\";\nimport type { ModelRegistry } from \"../model-registry.ts\";\nimport type { ScopedModel } from \"../model-resolver.ts\";\nimport { lifecycleScopeForOwner, sessionLifecycleScopes } from \"../session-lifecycle-scope.ts\";\nimport type { SessionManager } from \"../session-manager.ts\";\nimport type { BuildSystemPromptOptions } from \"../system-prompt.ts\";\nimport { normalizeBuildSystemPromptOptions } from \"../system-prompt.ts\";\nimport { presentQuestionnaire } from \"../tools/ask-user-question/ask-user-question.js\";\nimport {\n\tassertExtensionAction,\n\tbindExtensionWork,\n\tdrainExtensionWork,\n\textensionWorkOpen,\n\tresumeExtensionWork,\n\trevokeExtensionAuthority,\n\trunExtensionCleanup,\n\tsealExtensionWork,\n} from \"./extension-work.ts\";\nimport {\n\tcopyHostQuestionnaire,\n\ttype HostDiagnostic,\n\ttype HostInput,\n\tHostInputBridge,\n\thostInputError,\n} from \"./host-input.js\";\nimport { originalRegistrationCallback } from \"./loader-bindings.ts\";\nimport { boundExtensionRuntimes, runResourceRegistrationBatch } from \"./loader-runtime.ts\";\nimport {\n\tcreateExtensionCommandContext,\n\tcreateExtensionContext,\n\ttype ExtensionCommandContextSource,\n\tretireExtensionContextEffects,\n} from \"./runner-context.ts\";\nimport {\n\ttype BeforeAgentStartCombinedResult,\n\ttype BoundaryBaseEvent,\n\ttype BoundaryDispatchResult,\n\ttype ResourcesDiscoverCombinedResult,\n\ttype RunnerEmitEvent,\n\ttype RunnerEmitResult,\n\trunBeforeAgentStartHandlers,\n\trunBeforeProviderRequestHandlers,\n\trunBoundaryHandlers,\n\trunContextHandlers,\n\trunGenericHandlers,\n\trunInputHandlers,\n\trunMessageEndHandlers,\n\trunResourcesDiscoverHandlers,\n\trunToolCallHandlers,\n\trunToolResultHandlers,\n\trunUserBashHandlers,\n} from \"./runner-events.ts\";\nimport type {\n\tExtensionErrorListener,\n\tForkHandler,\n\tNavigateTreeHandler,\n\tNewSessionHandler,\n\tReloadHandler,\n\tShutdownHandler,\n\tSwitchSessionHandler,\n} from \"./runner-handlers.ts\";\nimport {\n\tcollectFlags,\n\tcollectMarkdownTransformers,\n\tcollectRegisteredTools,\n\tfindEntryRenderer,\n\tfindMessageRenderer,\n\tfindToolDefinition,\n\thasExtensionHandlers,\n\tresolveRegisteredCommands,\n} from \"./runner-registries.ts\";\nimport { resolveExtensionShortcuts } from \"./runner-shortcuts.ts\";\nimport { noOpUIContext } from \"./runner-ui.ts\";\nimport { STALE_EXTENSION_CONTEXT_MESSAGE } from \"./stale-context.ts\";\nimport type {\n\tBoundaryContextPreview,\n\tCompactOptions,\n\tContextUsage,\n\tEntryRenderer,\n\tExtension,\n\tExtensionActions,\n\tExtensionCommandContext,\n\tExtensionCommandContextActions,\n\tExtensionContext,\n\tExtensionContextActions,\n\tExtensionError,\n\tExtensionFlag,\n\tExtensionMode,\n\tExtensionRuntime,\n\tExtensionShortcut,\n\tExtensionUIContext,\n\tInputEventResult,\n\tInputSource,\n\tMarkdownTransformer,\n\tMessageEndEvent,\n\tMessageRenderer,\n\tOrchestrationContext,\n\tProviderConfig,\n\tRegisteredTool,\n\tResolvedCommand,\n\tResourcesDiscoverEvent,\n\tSessionBoundaryDraft,\n\tSessionShutdownEvent,\n\tSubagentChildPolicy,\n\tToolCallEvent,\n\tToolCallEventResult,\n\tToolRenderers,\n\tToolResultEvent,\n\tToolResultEventResult,\n\tUIPromptKind,\n\tUserBashEvent,\n\tUserBashEventResult,\n} from \"./types.ts\";\nimport type {\n\tWorkflowActivityObserver,\n\tWorkflowActivitySnapshotFrame,\n\tWorkflowActivitySubscription,\n} from \"./workflow-events.js\";\nimport type { WorkflowRunControl } from \"./workflow-run-control.js\";\n\nexport type {\n\tExtensionErrorListener,\n\tForkHandler,\n\tNavigateTreeHandler,\n\tNewSessionHandler,\n\tReloadHandler,\n\tShutdownHandler,\n\tSwitchSessionHandler,\n} from \"./runner-handlers.ts\";\nexport { emitProjectTrustEvent } from \"./runner-project-trust.ts\";\n\n/**\n * Helper function to emit session_shutdown event to extensions.\n * Returns true if the event was emitted, false if there were no handlers.\n */\nexport async function emitSessionShutdownEvent(\n\textensionRunner: ExtensionRunner,\n\tevent: SessionShutdownEvent,\n): Promise<boolean> {\n\tif (extensionRunner.hasHandlers(\"session_shutdown\")) {\n\t\tconst failures: Error[] = [];\n\t\tconst unsubscribe = extensionRunner.onError((failure) => {\n\t\t\tif (failure.event === \"session_shutdown\")\n\t\t\t\tfailures.push(new Error(`${failure.extensionPath}: ${failure.error}`));\n\t\t});\n\t\ttry {\n\t\t\tawait extensionRunner.emit(event);\n\t\t} catch (error) {\n\t\t\tconst causes = error instanceof AggregateError ? error.errors : [error];\n\t\t\tfailures.push(...causes.map((cause) => (cause instanceof Error ? cause : new Error(String(cause)))));\n\t\t} finally {\n\t\t\tunsubscribe();\n\t\t}\n\t\t// Shutdown may start tracked cleanup without returning its promise. Join it\n\t\t// after dispatch leaves its own work frame, including when a handler failed.\n\t\ttry {\n\t\t\tawait extensionRunner.drainWork();\n\t\t} catch (error) {\n\t\t\tfailures.push(error instanceof Error ? error : new Error(String(error)));\n\t\t}\n\t\tif (failures.length)\n\t\t\tthrow Object.assign(new AggregateError(failures, \"Extension shutdown failed\"), { code: \"ShutdownFailed\" });\n\t\treturn true;\n\t}\n\treturn false;\n}\n\nexport class ExtensionRunner {\n\tprivate extensions: Extension[];\n\tprivate runtime: ExtensionRuntime;\n\tprivate readonly reportedMcpServers = new Set<string>();\n\tprivate mcpDiagnosticUnsubscriber?: () => void;\n\tprivate uiContext: ExtensionUIContext;\n\tprivate presentationUI?: ExtensionUIContext;\n\tprivate presentationInput?: HostInput;\n\tprivate humanInput?: HostInput | null;\n\tprivate humanInputBindingRevision = 0;\n\tprivate inputBridge = new HostInputBridge(\n\t\t() => this.sessionManager.getSessionId(),\n\t\t() => this.getSignalFn(),\n\t);\n\tprivate onDiagnostic?: (diagnostic: HostDiagnostic) => void;\n\tprivate mode: ExtensionMode = \"print\";\n\tprivate presentationOnly = false;\n\tprivate cwd: string;\n\tprivate sessionManager: SessionManager;\n\tprivate modelRegistry: ModelRegistry;\n\tprivate orchestrationContext: OrchestrationContext | undefined;\n\tprivate subagentPolicy: SubagentChildPolicy | undefined;\n\tprivate taskHostBinding: (() => import(\"../tasks/agent-adapter.js\").AgentTaskHost) | undefined;\n\t/** @internal Attach dispatch receipts to the owning session before startup. */\n\tbindWorkOwner(owner: object): void {\n\t\tbindExtensionWork(this.runtime, owner);\n\t}\n\tbindTaskHost(binding: () => import(\"../tasks/agent-adapter.js\").AgentTaskHost): void {\n\t\tthis.taskHostBinding = binding;\n\t}\n\tbindChildSessionOptions(\n\t\tresolver: import(\"../child-session-options.ts\").ChildSessionOptionsResolver | undefined,\n\t): void {\n\t\tthis.runtime.getChildSessionOptions = resolver;\n\t}\n\t/** The run-control implementation registered by the current extension generation, if any. */\n\tgetWorkflowRunControl(): WorkflowRunControl | undefined {\n\t\treturn this.runtime.workflowRunControlHub.current();\n\t}\n\t/** Observe this generation's workflow activity: snapshot first, then FIFO changes. */\n\tobserveWorkflowActivity(observer: WorkflowActivityObserver): WorkflowActivitySubscription {\n\t\treturn this.runtime.workflowActivityHub.observeWorkflowActivity(observer);\n\t}\n\t/** This generation's current workflow activity snapshot. */\n\tgetWorkflowActivitySnapshot(): WorkflowActivitySnapshotFrame {\n\t\treturn this.runtime.workflowActivityHub.getSnapshotFrame();\n\t}\n\tgetChildHostBindings(): import(\"../agent-session-types.js\").ExtensionBindings {\n\t\treturn {\n\t\t\thumanInput: this.humanInput === undefined ? this.presentationInput : this.humanInput,\n\t\t\tonDiagnostic: this.onDiagnostic,\n\t\t};\n\t}\n\tprivate errorListeners: Set<ExtensionErrorListener> = new Set();\n\tprivate getModel: () => Model<Api> | undefined = () => undefined;\n\tprivate getScopedModels: () => readonly ScopedModel[] = () => [];\n\tprivate isIdleFn: () => boolean = () => true;\n\tprivate isProjectTrustedFn: () => boolean = () => true;\n\tprivate getSignalFn: () => AbortSignal | undefined = () => undefined;\n\tprivate waitForIdleFn: () => Promise<void> = async () => {};\n\tprivate abortFn: () => void = () => {};\n\tprivate hasPendingMessagesFn: () => boolean = () => false;\n\tprivate isSessionSummaryEnabledFn: ExtensionContextActions[\"isSessionSummaryEnabled\"];\n\tprivate generateWorkflowSummaryFn: ExtensionContextActions[\"generateWorkflowSummary\"];\n\tprivate getContextUsageFn: () => ContextUsage | undefined = () => undefined;\n\tprivate compactFn: (options?: CompactOptions) => void = () => {};\n\tprivate getSystemPromptFn: () => string = () => \"\";\n\tprivate getSystemPromptOptionsFn: () => BuildSystemPromptOptions = () =>\n\t\tnormalizeBuildSystemPromptOptions({ cwd: this.cwd });\n\tprivate getSkillCatalogFn: ExtensionContextActions[\"getSkillCatalog\"] = undefined;\n\tprivate getRouterModelFn: ExtensionContextActions[\"getRouterModel\"] = undefined;\n\tprivate getModelRoutingFn: ExtensionContextActions[\"getModelRouting\"] = undefined;\n\tprivate executeToolFn: ExtensionContextActions[\"executeTool\"];\n\tprivate getCallableToolsFn: NonNullable<ExtensionContextActions[\"getCallableTools\"]> = () => [];\n\tprivate newSessionHandler: NewSessionHandler = async () => ({ cancelled: false });\n\tprivate forkHandler: ForkHandler = async () => ({ cancelled: false });\n\tprivate navigateTreeHandler: NavigateTreeHandler = async () => ({ cancelled: false });\n\tprivate switchSessionHandler: SwitchSessionHandler = async () => ({ cancelled: false });\n\tprivate reloadHandler: ReloadHandler = async () => {};\n\tprivate shutdownHandler: ShutdownHandler = () => {};\n\tprivate shortcutDiagnostics: ResourceDiagnostic[] = [];\n\tprivate commandDiagnostics: ResourceDiagnostic[] = [];\n\tprivate staleMessage: string | undefined;\n\tprivate authorityRevoked = false;\n\tprivate readonly contextOwner = {};\n\tprivate uiPromptBinding = 0;\n\tprivate activeUIPrompt:\n\t\t| { depth: number; reason: \"ui_prompt\" | \"project_trust\"; kind: UIPromptKind; title: string | undefined }\n\t\t| undefined;\n\n\tconstructor(\n\t\textensions: Extension[],\n\t\truntime: ExtensionRuntime,\n\t\tcwd: string,\n\t\tsessionManager: SessionManager,\n\t\tmodelRegistry: ModelRegistry,\n\t\torchestrationContext?: OrchestrationContext,\n\t\tsubagentPolicy?: SubagentChildPolicy,\n\t) {\n\t\tthis.extensions = extensions;\n\t\tthis.runtime = runtime;\n\t\tsessionLifecycleScopes.set(this, lifecycleScopeForOwner(runtime));\n\t\tthis.runtime.workflowActivityHub.bindDispatcher((event, isCurrent) => this.emit(event, isCurrent));\n\t\tthis.uiContext = noOpUIContext;\n\t\tthis.cwd = cwd;\n\t\tthis.sessionManager = sessionManager;\n\t\tthis.modelRegistry = modelRegistry;\n\t\tthis.orchestrationContext = orchestrationContext;\n\t\tthis.subagentPolicy = subagentPolicy;\n\t}\n\n\tbindCore(\n\t\tactions: ExtensionActions,\n\t\tcontextActions: ExtensionContextActions,\n\t\tproviderActions?: {\n\t\t\tregisterProvider?: (providerOrName: Provider | string, config?: ProviderConfig) => void;\n\t\t\tunregisterProvider?: (name: string) => void;\n\t\t},\n\t): void {\n\t\t// Copy actions into the shared runtime (all extension APIs reference this)\n\t\tthis.runtime.sendMessage = actions.sendMessage;\n\t\tthis.runtime.sendMessages = actions.sendMessages;\n\t\tthis.runtime.sendUserMessage = actions.sendUserMessage;\n\t\tboundExtensionRuntimes.add(this.runtime);\n\t\tthis.runtime.appendEntry = actions.appendEntry;\n\t\tthis.runtime.setSessionName = actions.setSessionName;\n\t\tthis.runtime.getSessionName = actions.getSessionName;\n\t\tthis.runtime.setLabel = actions.setLabel;\n\t\tthis.runtime.getActiveTools = actions.getActiveTools;\n\t\tthis.runtime.getAllTools = actions.getAllTools;\n\t\tthis.runtime.setActiveTools = actions.setActiveTools;\n\t\tthis.runtime.refreshTools = actions.refreshTools;\n\t\tthis.runtime.getCommands = actions.getCommands;\n\t\tthis.runtime.setModel = actions.setModel;\n\t\tthis.runtime.getThinkingLevel = actions.getThinkingLevel;\n\t\tthis.runtime.setThinkingLevel = actions.setThinkingLevel;\n\n\t\t// Context actions (required)\n\t\tthis.getModel = contextActions.getModel;\n\t\tthis.getScopedModels = contextActions.getScopedModels;\n\t\tthis.isIdleFn = contextActions.isIdle;\n\t\tthis.isProjectTrustedFn = contextActions.isProjectTrusted;\n\t\tthis.getSignalFn = contextActions.getSignal;\n\t\tthis.abortFn = contextActions.abort;\n\t\tthis.hasPendingMessagesFn = contextActions.hasPendingMessages;\n\t\tthis.isSessionSummaryEnabledFn = contextActions.isSessionSummaryEnabled;\n\t\tthis.generateWorkflowSummaryFn = contextActions.generateWorkflowSummary;\n\t\tthis.shutdownHandler = contextActions.shutdown;\n\t\tthis.getContextUsageFn = contextActions.getContextUsage;\n\t\tthis.compactFn = contextActions.compact;\n\t\tthis.getSystemPromptFn = contextActions.getSystemPrompt;\n\t\tthis.getSystemPromptOptionsFn =\n\t\t\tcontextActions.getSystemPromptOptions ?? (() => normalizeBuildSystemPromptOptions({ cwd: this.cwd }));\n\t\tthis.getSkillCatalogFn = contextActions.getSkillCatalog;\n\t\tthis.getRouterModelFn = contextActions.getRouterModel;\n\t\tthis.getModelRoutingFn = contextActions.getModelRouting;\n\t\tthis.executeToolFn = contextActions.executeTool;\n\t\tthis.getCallableToolsFn = contextActions.getCallableTools ?? (() => []);\n\t\tthis.runtime.getSettings = contextActions.getSettings;\n\n\t\t// Flush provider registrations queued during extension loading.\n\t\tfor (const registration of this.runtime.pendingProviderRegistrations) {\n\t\t\ttry {\n\t\t\t\tif (\"provider\" in registration) {\n\t\t\t\t\t(\n\t\t\t\t\t\tproviderActions?.registerProvider ??\n\t\t\t\t\t\t((provider: Provider) => this.modelRegistry.registerProvider(provider))\n\t\t\t\t\t)(registration.provider);\n\t\t\t\t} else {\n\t\t\t\t\t(\n\t\t\t\t\t\tproviderActions?.registerProvider ??\n\t\t\t\t\t\t((name: string, config?: ProviderConfig) => this.modelRegistry.registerProvider(name, config!))\n\t\t\t\t\t)(registration.name, registration.config);\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\tthis.emitError({\n\t\t\t\t\textensionPath: registration.extensionPath,\n\t\t\t\t\tevent: \"register_provider\",\n\t\t\t\t\terror: error instanceof Error ? error.message : String(error),\n\t\t\t\t\tstack: error instanceof Error ? error.stack : undefined,\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t\tthis.runtime.pendingProviderRegistrations = [];\n\n\t\t// From this point on, provider registration/unregistration takes effect immediately\n\t\t// without requiring a /reload.\n\t\tthis.runtime.registerProvider = ((providerOrName: Provider | string, configOrPath?: ProviderConfig | string) => {\n\t\t\tif (typeof providerOrName === \"string\") {\n\t\t\t\tconst config = configOrPath as ProviderConfig;\n\t\t\t\tif (providerActions?.registerProvider) providerActions.registerProvider(providerOrName, config);\n\t\t\t\telse this.modelRegistry.registerProvider(providerOrName, config);\n\t\t\t} else if (providerActions?.registerProvider) providerActions.registerProvider(providerOrName);\n\t\t\telse this.modelRegistry.registerProvider(providerOrName);\n\t\t}) as ExtensionRuntime[\"registerProvider\"];\n\t\tthis.runtime.unregisterProvider = (name) => {\n\t\t\tif (providerActions?.unregisterProvider) {\n\t\t\t\tproviderActions.unregisterProvider(name);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tthis.modelRegistry.unregisterProvider(name);\n\t\t};\n\t}\n\n\tbindCommandContext(actions?: ExtensionCommandContextActions): void {\n\t\tif (actions) {\n\t\t\tthis.waitForIdleFn = actions.waitForIdle;\n\t\t\tthis.newSessionHandler = actions.newSession;\n\t\t\tthis.forkHandler = actions.fork;\n\t\t\tthis.navigateTreeHandler = actions.navigateTree;\n\t\t\tthis.switchSessionHandler = actions.switchSession;\n\t\t\tthis.reloadHandler = actions.reload;\n\t\t\treturn;\n\t\t}\n\n\t\tthis.waitForIdleFn = async () => {};\n\t\tthis.newSessionHandler = async () => ({ cancelled: false });\n\t\tthis.forkHandler = async () => ({ cancelled: false });\n\t\tthis.navigateTreeHandler = async () => ({ cancelled: false });\n\t\tthis.switchSessionHandler = async () => ({ cancelled: false });\n\t\tthis.reloadHandler = async () => {};\n\t}\n\n\tsetHostBindings(\n\t\thumanInput: HostInput | null | undefined,\n\t\tonDiagnostic?: (diagnostic: HostDiagnostic) => void,\n\t\tbindingRevision = 0,\n\t): void {\n\t\tthis.humanInput = humanInput;\n\t\tthis.humanInputBindingRevision = bindingRevision;\n\t\tthis.onDiagnostic = onDiagnostic;\n\t\t// Internal builtin bridge: no new extension API and no interception of console.\n\t\tconst scope = lifecycleScopeForOwner(this.runtime);\n\t\tconst report = (diagnostic: Omit<HostDiagnostic, \"sessionId\">) => {\n\t\t\ttry {\n\t\t\t\tthis.onDiagnostic?.({ ...diagnostic, sessionId: this.sessionManager.getSessionId() });\n\t\t\t} catch {\n\t\t\t\t// Observers cannot replace the primary service failure.\n\t\t\t}\n\t\t};\n\t\t// Rebinding replaces the reporter, not the builtin service owner.\n\t\tObject.defineProperty(report, Symbol.for(\"atomic.builtin-owner.v1\"), { value: scope });\n\t\tReflect.set(scope, Symbol.for(\"atomic.builtin-diagnostic.v1\"), report);\n\t\tthis.refreshHostInput();\n\t}\n\n\tcancelHostInput(): void {\n\t\tthis.inputBridge.cancel();\n\t}\n\t/** @internal Join this generation's callbacks without draining its reload caller. */\n\tdrainWork(): Promise<void> {\n\t\treturn drainExtensionWork(this.runtime);\n\t}\n\n\t/** @internal Seal input admission without invalidating shutdown handlers. */\n\tsealHostInput(): void {\n\t\tthis.inputBridge.close();\n\t\tsealExtensionWork(this.runtime);\n\t}\n\n\t/** @internal A rejected transaction retains the live runner, but never revives captured dialogs. */\n\tresumeAfterRejectedReload(): void {\n\t\tif (this.staleMessage) return;\n\t\tresumeExtensionWork(this.runtime);\n\t\tthis.inputBridge = new HostInputBridge(\n\t\t\t() => this.sessionManager.getSessionId(),\n\t\t\t() => this.getSignalFn(),\n\t\t);\n\t\tthis.refreshHostInput();\n\t}\n\n\tprivate refreshHostInput(): void {\n\t\tconst ui = this.presentationUI;\n\t\tthis.inputBridge.bind(\n\t\t\tthis.humanInput === undefined ? this.presentationInput : (this.humanInput ?? undefined),\n\t\t\tthis.humanInput,\n\t\t\tthis.humanInputBindingRevision,\n\t\t);\n\t\tconst bridged = this.inputBridge.wrap(\n\t\t\tui ?? {\n\t\t\t\t...noOpUIContext,\n\t\t\t\tcustom: async () => {\n\t\t\t\t\tthrow hostInputError(\"HumanInputUnavailable\");\n\t\t\t\t},\n\t\t\t},\n\t\t\tthis.presentationInput,\n\t\t\tthis.orchestrationContext?.kind === \"workflow-stage\"\n\t\t\t\t? {\n\t\t\t\t\t\tworkflowRunId: this.orchestrationContext.workflowRunId,\n\t\t\t\t\t\tworkflowStageId: this.orchestrationContext.workflowStageId,\n\t\t\t\t\t}\n\t\t\t\t: {},\n\t\t);\n\t\tthis.uiContext = this.wrapUIPromptContext(bridged, this.uiPromptBinding);\n\t\tcopyHostQuestionnaire(bridged, this.uiContext);\n\t}\n\n\tsetUIContext(uiContext?: ExtensionUIContext, mode: ExtensionMode = \"print\", isPresentationOnly = false): void {\n\t\tthis.presentationOnly = isPresentationOnly;\n\t\tif (uiContext !== this.presentationUI) {\n\t\t\tthis.endActiveUIPrompt();\n\t\t\t++this.uiPromptBinding;\n\t\t\tthis.presentationUI = uiContext;\n\t\t\tconst ui = uiContext;\n\t\t\tthis.presentationInput = ui\n\t\t\t\t? {\n\t\t\t\t\t\tconfirm: (title, message, options) => ui.confirm(title, message, options),\n\t\t\t\t\t\tselect: (title, choices, options) => ui.select(title, choices, options),\n\t\t\t\t\t\tinput: (title, placeholder, options) => ui.input(title, placeholder, options),\n\t\t\t\t\t\teditor: (title, initial, options) => ui.editor(title, initial, options),\n\t\t\t\t\t\tquestionnaire: (params, options) => presentQuestionnaire(ui, params, options.signal),\n\t\t\t\t\t}\n\t\t\t\t: undefined;\n\t\t\tthis.refreshHostInput();\n\t\t}\n\t\tthis.mode = mode;\n\t}\n\n\tprivate wrapUIPromptContext(ui: ExtensionUIContext, binding: number): ExtensionUIContext {\n\t\treturn {\n\t\t\t...ui,\n\t\t\tselect: (title, options, opts) =>\n\t\t\t\tthis.withUIPrompt(binding, \"select\", title, () => ui.select(title, options, opts)),\n\t\t\tconfirm: (title, message, opts) =>\n\t\t\t\tthis.withUIPrompt(binding, \"confirm\", title, () => ui.confirm(title, message, opts)),\n\t\t\tinput: (title, placeholder, opts) =>\n\t\t\t\tthis.withUIPrompt(binding, \"input\", title, () => ui.input(title, placeholder, opts)),\n\t\t\teditor: (title, prefill, opts) =>\n\t\t\t\tthis.withUIPrompt(binding, \"editor\", title, () => ui.editor(title, prefill, opts)),\n\t\t\tcustom: (factory, options) =>\n\t\t\t\toptions?.purpose === \"navigation\"\n\t\t\t\t\t? ui.custom(factory, options)\n\t\t\t\t\t: this.withUIPrompt(binding, \"custom\", undefined, () => ui.custom(factory, options)),\n\t\t};\n\t}\n\n\t/** Track a host-owned trust dialog using the current session's prompt lifecycle. */\n\twithProjectTrustPrompt<T>(kind: UIPromptKind, title: string, run: () => Promise<T>): Promise<T> {\n\t\treturn this.withUIPrompt(this.uiPromptBinding, kind, title, run, \"project_trust\");\n\t}\n\n\t/** Begin a host-owned trust span whose end arrives as a separate control frame. */\n\tbeginProjectTrustPrompt(kind: UIPromptKind, title: string): () => void {\n\t\treturn this.beginUIPrompt(kind, title, \"project_trust\");\n\t}\n\n\tprivate withUIPrompt<T>(\n\t\tbinding: number,\n\t\tkind: UIPromptKind,\n\t\ttitle: string | undefined,\n\t\trun: () => Promise<T>,\n\t\treason: \"ui_prompt\" | \"project_trust\" = \"ui_prompt\",\n\t): Promise<T> {\n\t\tif (binding !== this.uiPromptBinding) return run();\n\t\tconst finish = this.beginUIPrompt(kind, title, reason);\n\t\ttry {\n\t\t\treturn run().finally(finish);\n\t\t} catch (error) {\n\t\t\tfinish();\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\tprivate beginUIPrompt(\n\t\tkind: UIPromptKind,\n\t\ttitle: string | undefined,\n\t\treason: \"ui_prompt\" | \"project_trust\",\n\t): () => void {\n\t\tlet prompt = this.activeUIPrompt;\n\t\tif (!prompt) {\n\t\t\tprompt = { depth: 0, reason, kind, title };\n\t\t\tthis.activeUIPrompt = prompt;\n\t\t\tthis.emitUIPromptEvent({\n\t\t\t\ttype: \"ui_prompt_start\",\n\t\t\t\treason,\n\t\t\t\tkind,\n\t\t\t\t...(title === undefined ? {} : { title }),\n\t\t\t});\n\t\t}\n\t\tprompt.depth += 1;\n\n\t\tlet finished = false;\n\t\treturn () => {\n\t\t\tif (finished) return;\n\t\t\tfinished = true;\n\t\t\tif (this.activeUIPrompt !== prompt) return;\n\n\t\t\tprompt.depth -= 1;\n\t\t\tif (prompt.depth === 0) this.endActiveUIPrompt(prompt);\n\t\t};\n\t}\n\n\tprivate endActiveUIPrompt(prompt = this.activeUIPrompt): void {\n\t\tif (!prompt || this.activeUIPrompt !== prompt) return;\n\t\tthis.activeUIPrompt = undefined;\n\t\tprompt.depth = 0;\n\t\tthis.emitUIPromptEvent({\n\t\t\ttype: \"ui_prompt_end\",\n\t\t\treason: prompt.reason,\n\t\t\tkind: prompt.kind,\n\t\t\t...(prompt.title === undefined ? {} : { title: prompt.title }),\n\t\t});\n\t}\n\n\tprivate uiPromptObserver:\n\t\t| ((event: Extract<RunnerEmitEvent, { type: \"ui_prompt_start\" | \"ui_prompt_end\" }>) => void)\n\t\t| undefined;\n\n\tsetUIPromptObserver(observer: typeof this.uiPromptObserver): void {\n\t\tthis.uiPromptObserver = observer;\n\t}\n\n\tprivate readonly pendingUIPromptNotifications = new Set<Promise<void>>();\n\n\tprivate emitUIPromptEvent(event: Extract<RunnerEmitEvent, { type: \"ui_prompt_start\" | \"ui_prompt_end\" }>): void {\n\t\ttry {\n\t\t\tthis.uiPromptObserver?.(event);\n\t\t} catch {}\n\t\tconst delivery = Promise.resolve().then(async () => {\n\t\t\tawait this.emit(event);\n\t\t});\n\t\tthis.pendingUIPromptNotifications.add(delivery);\n\t\tvoid delivery.finally(() => this.pendingUIPromptNotifications.delete(delivery)).catch(() => {});\n\t}\n\n\t/** Settle only the deliveries pending at this boundary, without delaying prompt UI. */\n\tasync flushUIPromptNotifications(timeoutMs: number): Promise<{ timedOut: boolean }> {\n\t\tconst pending = [...this.pendingUIPromptNotifications];\n\t\tif (pending.length === 0) return { timedOut: false };\n\t\tlet timer: ReturnType<typeof setTimeout> | undefined;\n\t\ttry {\n\t\t\treturn await Promise.race([\n\t\t\t\tPromise.allSettled(pending).then(() => ({ timedOut: false })),\n\t\t\t\tnew Promise<{ timedOut: boolean }>((resolve) => {\n\t\t\t\t\ttimer = setTimeout(() => resolve({ timedOut: true }), timeoutMs);\n\t\t\t\t}),\n\t\t\t]);\n\t\t} finally {\n\t\t\tclearTimeout(timer);\n\t\t}\n\t}\n\n\tgetUIContext(): ExtensionUIContext {\n\t\treturn this.uiContext;\n\t}\n\n\thasUI(): boolean {\n\t\treturn this.presentationUI !== undefined;\n\t}\n\n\tgetExtensionPaths(): string[] {\n\t\treturn this.extensions.map((extension) => extension.path);\n\t}\n\n\t/** Get all registered tools from all extensions (first registration per name wins). */\n\tgetAllRegisteredTools(): RegisteredTool[] {\n\t\treturn collectRegisteredTools(this.extensions);\n\t}\n\n\t/** Get a tool definition by name. Returns undefined if not found. */\n\tgetToolDefinition(toolName: string): RegisteredTool[\"definition\"] | undefined {\n\t\treturn findToolDefinition(this.extensions, toolName);\n\t}\n\n\tgetFlags(): Map<string, ExtensionFlag> {\n\t\treturn collectFlags(this.extensions);\n\t}\n\n\tsetFlagValue(name: string, value: boolean | string): void {\n\t\tthis.runtime.flagValues.set(name, value);\n\t\tthis.runtime.explicitFlagNames ??= new Set();\n\t\tthis.runtime.explicitFlagNames.add(name);\n\t}\n\n\tgetFlagValues(): Map<string, boolean | string> {\n\t\treturn new Map(this.runtime.flagValues);\n\t}\n\n\tgetExplicitFlagValues(): Map<string, boolean | string> {\n\t\tconst explicitFlagNames = this.runtime.explicitFlagNames ?? new Set<string>();\n\t\treturn new Map([...this.runtime.flagValues].filter(([name]) => explicitFlagNames.has(name)));\n\t}\n\n\tgetShortcuts(resolvedKeybindings: KeybindingsConfig): Map<KeyId, ExtensionShortcut> {\n\t\tconst resolution = resolveExtensionShortcuts(this.extensions, resolvedKeybindings, this.hasUI());\n\t\tthis.shortcutDiagnostics = resolution.diagnostics;\n\t\tfor (const [key, shortcut] of resolution.shortcuts) {\n\t\t\tresolution.shortcuts.set(key, {\n\t\t\t\t...shortcut,\n\t\t\t\thandler: (context) => {\n\t\t\t\t\tif (!extensionWorkOpen(this.runtime)) return Promise.reject(hostInputError(\"SessionClosed\"));\n\t\t\t\t\treturn runResourceRegistrationBatch(this.runtime, async () => shortcut.handler(context));\n\t\t\t\t},\n\t\t\t});\n\t\t}\n\t\treturn resolution.shortcuts;\n\t}\n\n\tgetShortcutDiagnostics(): ResourceDiagnostic[] {\n\t\treturn this.shortcutDiagnostics;\n\t}\n\n\tretireObservation(): void {\n\t\tretireExtensionContextEffects(this.contextOwner);\n\t\tthis.mcpDiagnosticUnsubscriber?.();\n\t\tthis.mcpDiagnosticUnsubscriber = undefined;\n\t}\n\n\t/** A retired session's late cleanup must not write into presentation its successor now owns. */\n\tdetachPresentation(): void {\n\t\tthis.setUIContext(undefined, this.mode, this.presentationOnly);\n\t}\n\n\trevokeAuthority(): void {\n\t\ttry {\n\t\t\tthis.retireObservation();\n\t\t} finally {\n\t\t\tthis.authorityRevoked = true;\n\t\t\trevokeExtensionAuthority(this.runtime);\n\t\t}\n\t}\n\n\tinvalidate(message = STALE_EXTENSION_CONTEXT_MESSAGE): void {\n\t\tthis.sealHostInput();\n\t\ttry {\n\t\t\tthis.retireObservation();\n\t\t} finally {\n\t\t\tif (!this.staleMessage) {\n\t\t\t\tthis.staleMessage = message;\n\t\t\t\tthis.runtime.invalidate(message);\n\t\t\t}\n\t\t}\n\t}\n\n\treportUnhandledMcpServers(): void {\n\t\tthis.mcpDiagnosticUnsubscriber ??= this.runtime.mcpServerRegistry.subscribe(\n\t\t\t() => this.reportUnhandledMcpServers(),\n\t\t\t{ consumer: false },\n\t\t);\n\t\tif (this.runtime.mcpServerRegistry.hasConsumers()) return;\n\t\tfor (const server of this.runtime.mcpServerRegistry.list()) {\n\t\t\tif (this.reportedMcpServers.has(server.name)) continue;\n\t\t\tthis.reportedMcpServers.add(server.name);\n\t\t\tthis.emitError({\n\t\t\t\textensionPath: server.sourceInfo.path,\n\t\t\t\tevent: \"register_mcp_server\",\n\t\t\t\terror: `MCP server \"${server.name}\" is registered, but no loaded extension connects MCP servers; another extension may have replaced the built-in MCP support`,\n\t\t\t});\n\t\t}\n\t}\n\n\tprivate assertActive(): void {\n\t\tif (this.authorityRevoked) this.runtime.assertActive();\n\t\tif (this.staleMessage) {\n\t\t\tthrow new Error(this.staleMessage);\n\t\t}\n\t}\n\n\tonError(listener: ExtensionErrorListener): () => void {\n\t\tthis.errorListeners.add(listener);\n\t\treturn () => this.errorListeners.delete(listener);\n\t}\n\n\temitError(error: ExtensionError): void {\n\t\tthis.onDiagnostic?.({\n\t\t\tlevel: \"error\",\n\t\t\tsource: error.extensionPath,\n\t\t\tmessage: `Extension ${error.event} failed`,\n\t\t\tsessionId: this.sessionManager.getSessionId(),\n\t\t});\n\t\tfor (const listener of this.errorListeners) {\n\t\t\tlistener(error);\n\t\t}\n\t}\n\n\thasHandlers(eventType: string): boolean {\n\t\treturn hasExtensionHandlers(this.extensions, eventType);\n\t}\n\n\tgetMessageRenderer(customType: string): MessageRenderer | undefined {\n\t\treturn findMessageRenderer(this.extensions, customType);\n\t}\n\n\tgetMarkdownTransformers(): MarkdownTransformer[] {\n\t\treturn collectMarkdownTransformers(this.extensions);\n\t}\n\n\t/** Renderers of calls to `toolName`: extension resolvers in load order, then `base`. */\n\tresolveToolRenderers(toolName: string, base: () => ToolRenderers | undefined): ToolRenderers | undefined {\n\t\tconst resolvers = this.extensions.flatMap((ext) => ext.toolRenderers ?? []);\n\t\tconst resolve = (index: number): ToolRenderers | undefined =>\n\t\t\tindex < resolvers.length ? resolvers[index](toolName, () => resolve(index + 1)) : base();\n\t\treturn resolve(0);\n\t}\n\n\tgetEntryRenderer(customType: string): EntryRenderer | undefined {\n\t\tconst renderer = findEntryRenderer(this.extensions, customType);\n\t\treturn renderer ? originalRegistrationCallback(renderer) : undefined;\n\t}\n\n\t/** Invoke the session-owned registration without changing discovery identity. */\n\trenderEntry(customType: string, ...args: Parameters<EntryRenderer>): ReturnType<EntryRenderer> {\n\t\tthis.assertActive();\n\t\treturn findEntryRenderer(this.extensions, customType)?.(...args);\n\t}\n\n\tgetRegisteredCommands(): ResolvedCommand[] {\n\t\tthis.commandDiagnostics = [];\n\t\treturn resolveRegisteredCommands(this.extensions);\n\t}\n\n\tgetCommandDiagnostics(): ResourceDiagnostic[] {\n\t\treturn this.commandDiagnostics;\n\t}\n\n\tgetCommand(name: string, quitSignal?: AbortSignal): ResolvedCommand | undefined {\n\t\tconst command = resolveRegisteredCommands(this.extensions).find((entry) => entry.invocationName === name);\n\t\tif (!command) return undefined;\n\t\treturn {\n\t\t\t...command,\n\t\t\thandler: (args, context) =>\n\t\t\t\trunResourceRegistrationBatch(this.runtime, async () => {\n\t\t\t\t\tquitSignal?.throwIfAborted();\n\t\t\t\t\tconst execution = command.handler(args, context);\n\t\t\t\t\treturn quitSignal ? raceWithAbortSignal(execution, quitSignal) : execution;\n\t\t\t\t}),\n\t\t};\n\t}\n\n\t/**\n\t * Request a graceful shutdown. Called by extension tools and event handlers.\n\t * The actual shutdown behavior is provided by the mode via bindExtensions().\n\t */\n\tshutdown(): void {\n\t\tthis.shutdownHandler();\n\t}\n\n\tcreateContext(): ExtensionContext {\n\t\treturn createExtensionContext(this.createContextSource(), this.contextOwner);\n\t}\n\n\t/** Bound to the actual executing parent, not an extension-supplied caller identity. */\n\tcreateToolContext(toolCallId: string, signal: AbortSignal | undefined): ExtensionToolContext {\n\t\tconst invoke = AsyncLocalStorage.bind(async (name: string, args: unknown, options: ExecuteToolOptions = {}) => {\n\t\t\tthis.assertActive();\n\t\t\tif (signal?.aborted) throw new Error(\"Calling tool execution has ended\");\n\t\t\tif (!this.executeToolFn)\n\t\t\t\treturn {\n\t\t\t\t\ttoolCall: { type: \"toolCall\" as const, id: `${toolCallId}/0`, name, arguments: {} },\n\t\t\t\t\tresult: {\n\t\t\t\t\t\tcontent: [{ type: \"text\" as const, text: \"Nested tool calls are not available in this context\" }],\n\t\t\t\t\t\tdetails: {},\n\t\t\t\t\t},\n\t\t\t\t\tisError: true,\n\t\t\t\t};\n\t\t\tconst callSignal =\n\t\t\t\tsignal && options.signal ? AbortSignal.any([signal, options.signal]) : (options.signal ?? signal);\n\t\t\treturn this.executeToolFn(toolCallId, name, args, { ...options, signal: callSignal });\n\t\t});\n\t\treturn Object.defineProperties(this.createContext() as ExtensionToolContext, {\n\t\t\ttools: {\n\t\t\t\tget: () => {\n\t\t\t\t\tthis.assertActive();\n\t\t\t\t\treturn this.getCallableToolsFn();\n\t\t\t\t},\n\t\t\t},\n\t\t\texecuteTool: { value: invoke },\n\t\t});\n\t}\n\n\tcreateCommandContext(): ExtensionCommandContext {\n\t\treturn createExtensionCommandContext(this.createContextSource(), this.contextOwner);\n\t}\n\n\tprivate createContextSource(): ExtensionCommandContextSource {\n\t\treturn {\n\t\t\tassertActive: () => this.assertActive(),\n\t\t\tassertAction: () => assertExtensionAction(this.runtime),\n\t\t\tgetChildSessionOptions: (options) => this.runtime.getChildSessionOptions?.(options) ?? options,\n\t\t\tgetExtensionPaths: () => this.getExtensionPaths(),\n\t\t\tobserveWorkflowActivity: (observer) => this.runtime.workflowActivityHub.observeWorkflowActivity(observer),\n\t\t\t...(this.taskHostBinding ? { getAgentTaskHost: this.taskHostBinding } : {}),\n\t\t\tgetUIContext: () => this.uiContext,\n\t\t\tgetMode: () => this.mode,\n\t\t\thasUI: () => this.hasUI(),\n\t\t\thasHumanInput: () => this.inputBridge.available,\n\t\t\tisPresentationOnly: () => this.presentationOnly,\n\t\t\tgetCwd: () => this.cwd,\n\t\t\tgetSessionManager: () => this.sessionManager,\n\t\t\tgetModelRegistry: () => this.modelRegistry,\n\t\t\tgetModel: () => this.getModel(),\n\t\t\tgetSubagentPolicy: () => this.subagentPolicy,\n\t\t\tgetScopedModels: () => this.getScopedModels(),\n\t\t\tgetThinkingLevel: () => this.runtime.getThinkingLevel(),\n\t\t\tgetOrchestrationContext: () => this.orchestrationContext,\n\t\t\tisIdle: () => this.isIdleFn(),\n\t\t\tisProjectTrusted: () => this.isProjectTrustedFn(),\n\t\t\tgetSignal: () => this.getSignalFn(),\n\t\t\tabort: () => this.abortFn(),\n\t\t\thasPendingMessages: () => this.hasPendingMessagesFn(),\n\t\t\tisSessionSummaryEnabled: () => this.isSessionSummaryEnabledFn?.() ?? false,\n\t\t\tgenerateWorkflowSummary: (text, signal, options) =>\n\t\t\t\tthis.generateWorkflowSummaryFn?.(text, signal, options) ?? Promise.resolve(undefined),\n\t\t\tshutdown: () => this.shutdownHandler(),\n\t\t\tgetContextUsage: () => this.getContextUsageFn(),\n\t\t\tcompact: (options) => this.compactFn(options),\n\t\t\tgetSystemPrompt: () => this.getSystemPromptFn(),\n\t\t\t...(this.getSkillCatalogFn ? { getSkillCatalog: () => this.getSkillCatalogFn!() } : {}),\n\t\t\t...(this.getRouterModelFn ? { getRouterModel: () => this.getRouterModelFn!() } : {}),\n\t\t\t...(this.getModelRoutingFn ? { getModelRouting: () => this.getModelRoutingFn!() } : {}),\n\t\t\tgetSystemPromptOptions: () => this.getSystemPromptOptionsFn(),\n\t\t\twaitForIdle: () => this.waitForIdleFn(),\n\t\t\tnewSession: (options) => this.newSessionHandler(options),\n\t\t\tfork: (entryId, options) => this.forkHandler(entryId, options),\n\t\t\tnavigateTree: (targetId, options) => this.navigateTreeHandler(targetId, options),\n\t\t\tswitchSession: (sessionPath, options) => this.switchSessionHandler(sessionPath, options),\n\t\t\treload: () => this.reloadHandler(),\n\t\t};\n\t}\n\n\t/** Keep startup reporters bound while adding the now-authorized extension set. */\n\tattachStartupExtensions(extensions: Extension[]): () => Promise<void> {\n\t\tconst newcomers = extensions.filter((extension) => !this.extensions.includes(extension));\n\t\tthis.extensions = [...this.extensions, ...newcomers];\n\t\treturn async () => {\n\t\t\tawait runResourceRegistrationBatch(this.runtime, () =>\n\t\t\t\trunGenericHandlers(\n\t\t\t\t\tthis.extensions.filter((extension) => newcomers.includes(extension)),\n\t\t\t\t\tthis.createContext(),\n\t\t\t\t\t{ type: \"session_start\", reason: \"startup\" },\n\t\t\t\t\t(error) => this.emitError(error),\n\t\t\t\t),\n\t\t\t);\n\t\t};\n\t}\n\n\tasync emit<TEvent extends RunnerEmitEvent>(\n\t\tevent: TEvent,\n\t\tisCurrent?: () => boolean,\n\t\tadmitted = false,\n\t): Promise<RunnerEmitResult<TEvent>> {\n\t\tif (!admitted && event.type !== \"session_shutdown\" && !extensionWorkOpen(this.runtime))\n\t\t\treturn undefined as RunnerEmitResult<TEvent>;\n\t\tconst observerFailures: Error[] = [];\n\t\tconst dispatch = () =>\n\t\t\trunGenericHandlers(\n\t\t\t\tthis.extensions,\n\t\t\t\tthis.createContext(),\n\t\t\t\tevent,\n\t\t\t\t(error) => {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tthis.emitError(error);\n\t\t\t\t\t} catch (cause) {\n\t\t\t\t\t\tif (event.type !== \"session_shutdown\") throw cause;\n\t\t\t\t\t\tobserverFailures.push(\n\t\t\t\t\t\t\tnew Error(`${error.extensionPath}: ${error.error}`),\n\t\t\t\t\t\t\tnew Error(\"Shutdown observer failed\", { cause }),\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tisCurrent,\n\t\t\t);\n\t\tconst result = await runResourceRegistrationBatch(\n\t\t\tthis.runtime,\n\t\t\t() => (event.type === \"session_shutdown\" ? runExtensionCleanup(this.runtime, dispatch) : dispatch()),\n\t\t\tadmitted || event.type === \"session_shutdown\",\n\t\t);\n\t\tif (observerFailures.length)\n\t\t\tthrow Object.assign(new AggregateError(observerFailures, \"Shutdown observers failed\"), {\n\t\t\t\tcode: \"ShutdownFailed\",\n\t\t\t});\n\t\treturn result;\n\t}\n\n\tasync emitMessageEnd(event: MessageEndEvent, admitted = false): Promise<AgentMessage | undefined> {\n\t\treturn runResourceRegistrationBatch(\n\t\t\tthis.runtime,\n\t\t\t() => runMessageEndHandlers(this.extensions, this.createContext(), event, (error) => this.emitError(error)),\n\t\t\tadmitted,\n\t\t);\n\t}\n\n\tasync emitToolResult(event: ToolResultEvent, admitted = false): Promise<ToolResultEventResult | undefined> {\n\t\treturn runResourceRegistrationBatch(\n\t\t\tthis.runtime,\n\t\t\t() => runToolResultHandlers(this.extensions, this.createContext(), event, (error) => this.emitError(error)),\n\t\t\tadmitted,\n\t\t);\n\t}\n\n\tasync emitToolCall(event: ToolCallEvent): Promise<ToolCallEventResult | undefined> {\n\t\treturn runResourceRegistrationBatch(this.runtime, () =>\n\t\t\trunToolCallHandlers(this.extensions, this.createContext(), event),\n\t\t);\n\t}\n\n\tasync emitUserBash(event: UserBashEvent): Promise<UserBashEventResult | undefined> {\n\t\treturn runResourceRegistrationBatch(this.runtime, () =>\n\t\t\trunUserBashHandlers(this.extensions, this.createContext(), event, (error) => this.emitError(error)),\n\t\t);\n\t}\n\n\tasync emitBoundary(\n\t\tbaseEvent: BoundaryBaseEvent,\n\t\tbuildContext: (entries: SessionBoundaryDraft[]) => BoundaryContextPreview | Promise<BoundaryContextPreview>,\n\t): Promise<BoundaryDispatchResult> {\n\t\treturn runResourceRegistrationBatch(\n\t\t\tthis.runtime,\n\t\t\t() =>\n\t\t\t\trunBoundaryHandlers(this.extensions, this.createContext(), baseEvent, buildContext, (error) =>\n\t\t\t\t\tthis.emitError(error),\n\t\t\t\t),\n\t\t\ttrue,\n\t\t);\n\t}\n\n\tasync emitContext(messages: AgentMessage[]): Promise<AgentMessage[]> {\n\t\treturn runResourceRegistrationBatch(this.runtime, () =>\n\t\t\trunContextHandlers(this.extensions, this.createContext(), messages, (error) => this.emitError(error)),\n\t\t);\n\t}\n\n\temitBeforeProviderRequest(payload: unknown): Promise<unknown> {\n\t\treturn runResourceRegistrationBatch(this.runtime, () =>\n\t\t\trunBeforeProviderRequestHandlers(this.extensions, this.createContext(), payload, (error) =>\n\t\t\t\tthis.emitError(error),\n\t\t\t),\n\t\t);\n\t}\n\n\tasync emitCacheWarmingDecision(event: CacheWarmingDecisionEvent): Promise<CacheWarmingAction> {\n\t\tlet action = event.action;\n\t\tconst ctx = this.createContext();\n\t\tfor (const { ext, handlers } of snapshotEventHandlers(this.extensions, event.type)) {\n\t\t\tfor (const handler of handlers) {\n\t\t\t\ttry {\n\t\t\t\t\tconst result = (await handler({ ...event, action }, ctx)) as CacheWarmingDecisionEventResult | undefined;\n\t\t\t\t\tif (result?.action === \"warm\" || result?.action === \"stop\") action = result.action;\n\t\t\t\t} catch (error) {\n\t\t\t\t\tthis.emitError({\n\t\t\t\t\t\textensionPath: ext.path,\n\t\t\t\t\t\tevent: event.type,\n\t\t\t\t\t\terror: error instanceof Error ? error.message : String(error),\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn action;\n\t}\n\n\tasync emitBeforeProviderHeaders(headers: ProviderHeaders): Promise<ProviderHeaders> {\n\t\treturn runResourceRegistrationBatch(this.runtime, async () => {\n\t\t\tfor (const { ext: extension, handlers } of snapshotEventHandlers(this.extensions, \"before_provider_headers\")) {\n\t\t\t\tfor (const handler of handlers) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait handler({ type: \"before_provider_headers\", headers }, this.createContext());\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tthis.emitError({\n\t\t\t\t\t\t\textensionPath: extension.path,\n\t\t\t\t\t\t\tevent: \"before_provider_headers\",\n\t\t\t\t\t\t\terror: error instanceof Error ? error.message : String(error),\n\t\t\t\t\t\t\tstack: error instanceof Error ? error.stack : undefined,\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn headers;\n\t\t});\n\t}\n\n\temitBeforeAgentStart(\n\t\tprompt: string,\n\t\timages: ImageContent[] | undefined,\n\t\tsystemPromptOptions: BuildSystemPromptOptions,\n\t\tcustomMessage?: import(\"../messages.ts\").CustomMessage,\n\t): Promise<BeforeAgentStartCombinedResult> {\n\t\treturn runResourceRegistrationBatch(this.runtime, () =>\n\t\t\trunBeforeAgentStartHandlers(\n\t\t\t\tthis.extensions,\n\t\t\t\tthis.createContext(),\n\t\t\t\t() => this.assertActive(),\n\t\t\t\tprompt,\n\t\t\t\timages,\n\t\t\t\tsystemPromptOptions,\n\t\t\t\t(error) => this.emitError(error),\n\t\t\t\tcustomMessage,\n\t\t\t),\n\t\t);\n\t}\n\n\temitResourcesDiscover(\n\t\tcwd: string,\n\t\treason: ResourcesDiscoverEvent[\"reason\"],\n\t): Promise<ResourcesDiscoverCombinedResult> {\n\t\treturn runResourceRegistrationBatch(this.runtime, () =>\n\t\t\trunResourcesDiscoverHandlers(this.extensions, this.createContext(), cwd, reason, (error) =>\n\t\t\t\tthis.emitError(error),\n\t\t\t),\n\t\t);\n\t}\n\n\t/** Emit input event. Transforms chain, \"handled\" short-circuits. */\n\temitInput(\n\t\ttext: string,\n\t\timages: ImageContent[] | undefined,\n\t\tsource: InputSource,\n\t\tstreamingBehavior?: \"steer\" | \"followUp\",\n\t): Promise<InputEventResult> {\n\t\treturn runResourceRegistrationBatch(this.runtime, () =>\n\t\t\trunInputHandlers(this.extensions, this.createContext(), text, images, source, streamingBehavior, (error) =>\n\t\t\t\tthis.emitError(error),\n\t\t\t),\n\t\t);\n\t}\n}\n"]}
@@ -57,6 +57,8 @@ export interface WorkflowRootActivity {
57
57
  reason: WorkflowActivityReason;
58
58
  activeExecutionCount: number;
59
59
  actionableBlockCount: number;
60
+ blockedPromptKind?: WorkflowGraphNodePrompt["kind"];
61
+ endedStatus?: Extract<WorkflowRunStatus, "completed" | "cancelled" | "killed" | "failed">;
60
62
  needsAttention: boolean;
61
63
  /** Graph topology and node statuses; absent when the publisher reports no graph. */
62
64
  graph?: WorkflowRootGraph;
@@ -1 +1 @@
1
- {"version":3,"file":"workflow-events.d.ts","sourceRoot":"","sources":["../../../src/core/extensions/workflow-events.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,qBAAqB,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAAC;AACnE,MAAM,MAAM,sBAAsB,GAC/B,WAAW,GACX,wBAAwB,GACxB,UAAU,GACV,UAAU,GACV,gBAAgB,GAChB,qBAAqB,GACrB,QAAQ,GACR,WAAW,CAAC;AAGf,MAAM,MAAM,iBAAiB,GAC1B,SAAS,GACT,SAAS,GACT,QAAQ,GACR,WAAW,GACX,SAAS,GACT,WAAW,GACX,SAAS,GACT,QAAQ,GACR,QAAQ,CAAC;AACZ,MAAM,MAAM,mBAAmB,GAC5B,SAAS,GACT,SAAS,GACT,gBAAgB,GAChB,QAAQ,GACR,SAAS,GACT,WAAW,GACX,QAAQ,GACR,SAAS,CAAC;AACb,MAAM,MAAM,sBAAsB,GAAG,SAAS,GAAG,SAAS,GAAG,WAAW,GAAG,QAAQ,GAAG,QAAQ,GAAG,WAAW,CAAC;AAC7G,MAAM,MAAM,qBAAqB,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC;AAEzE,yFAAyF;AACzF,MAAM,WAAW,uBAAuB;IACvC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,OAA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M,EAAE,OAAO,CAAC,uBAAuB,EAAE;QAAE,IAAI,EAAE,OAAO,CAAA;KAAE,CAAC,GAAG;QAAE,MAAM,EAAE,WAAW,CAAA;KAAE,CAAC;CACtF;AACD,MAAM,WAAW,4BAA4B;IAC5C,IAAI,EAAE,2BAA2B,CAAC;IAClC,MAAM,EAAE,yBAAyB,CAAC;IAClC,IAAI,EAAE,oBAAoB,CAAC;CAC3B;AACD,MAAM,WAAW,sBAAsB;IACtC,IAAI,EAAE,oBAAoB,CAAC;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;CACxB;AACD,MAAM,MAAM,aAAa,GACtB,sBAAsB,GACtB,2BAA2B,GAC3B,4BAA4B,GAC5B,sBAAsB,CAAC;AAC1B,MAAM,WAAW,yBAAyB;IACzC,eAAe,CAAC,KAAK,EAAE,6BAA6B,GAAG,IAAI,CAAC;IAC5D,cAAc,CAAC,IAAI,EAAE,oBAAoB,GAAG,IAAI,CAAC;IACjD,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACxC,gBAAgB,CAAC,KAAK,EAAE,IAAI,CAAC,sBAAsB,EAAE,QAAQ,CAAC,GAAG,IAAI,CAAC;IACtE,gBAAgB,CAAC,KAAK,EAAE,sBAAsB,GAAG,IAAI,CAAC;IACtD,OAAO,IAAI,IAAI,CAAC;CAChB;AACD,MAAM,WAAW,6BAA6B;IAC7C,IAAI,EACD,kBAAkB,GAClB,kBAAkB,GAClB,mBAAmB,GACnB,wBAAwB,GACxB,kBAAkB,GAClB,iBAAiB,CAAC;IACrB,MAAM,EAAE,yBAAyB,CAAC;CAClC"}
1
+ {"version":3,"file":"workflow-events.d.ts","sourceRoot":"","sources":["../../../src/core/extensions/workflow-events.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,qBAAqB,GAA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AC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;CACxB;AACD,MAAM,MAAM,aAAa,GACtB,sBAAsB,GACtB,2BAA2B,GAC3B,4BAA4B,GAC5B,sBAAsB,CAAC;AAC1B,MAAM,WAAW,yBAAyB;IACzC,eAAe,CAAC,KAAK,EAAE,6BAA6B,GAAG,IAAI,CAAC;IAC5D,cAAc,CAAC,IAAI,EAAE,oBAAoB,GAAG,IAAI,CAAC;IACjD,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACxC,gBAAgB,CAAC,KAAK,EAAE,IAAI,CAAC,sBAAsB,EAAE,QAAQ,CAAC,GAAG,IAAI,CAAC;IACtE,gBAAgB,CAAC,KAAK,EAAE,sBAAsB,GAAG,IAAI,CAAC;IACtD,OAAO,IAAI,IAAI,CAAC;CAChB;AACD,MAAM,WAAW,6BAA6B;IAC7C,IAAI,EACD,kBAAkB,GAClB,kBAAkB,GAClB,mBAAmB,GACnB,wBAAwB,GACxB,kBAAkB,GAClB,iBAAiB,CAAC;IACrB,MAAM,EAAE,yBAAyB,CAAC;CAClC"}
@@ -1 +1 @@
1
- {"version":3,"file":"workflow-events.js","sourceRoot":"","sources":["../../../src/core/extensions/workflow-events.ts"],"names":[],"mappings":"","sourcesContent":["export type WorkflowActivityState = \"working\" | \"idle\" | \"blocked\";\nexport type WorkflowActivityReason =\n\t| \"executing\"\n\t| \"automatic_continuation\"\n\t| \"retrying\"\n\t| \"stopping\"\n\t| \"awaiting_input\"\n\t| \"manual_intervention\"\n\t| \"paused\"\n\t| \"quiescent\";\n\n// Kept in sync with workflows/shared/store-types without a host runtime dependency.\nexport type WorkflowRunStatus =\n\t| \"pending\"\n\t| \"running\"\n\t| \"paused\"\n\t| \"completed\"\n\t| \"skipped\"\n\t| \"cancelled\"\n\t| \"blocked\"\n\t| \"failed\"\n\t| \"killed\";\nexport type WorkflowStageStatus =\n\t| \"pending\"\n\t| \"running\"\n\t| \"awaiting_input\"\n\t| \"paused\"\n\t| \"blocked\"\n\t| \"completed\"\n\t| \"failed\"\n\t| \"skipped\";\nexport type WorkflowToolNodeStatus = \"pending\" | \"running\" | \"completed\" | \"failed\" | \"cached\" | \"cancelled\";\nexport type WorkflowControlAction = \"quit\" | \"kill\" | \"pause\" | \"resume\";\n\n/** Snapshot-safe descriptor of a human-input prompt waiting on a workflow graph node. */\nexport interface WorkflowGraphNodePrompt {\n\tid: string;\n\tkind: \"input\" | \"confirm\" | \"select\" | \"editor\" | \"custom\";\n\tmessage: string;\n\tchoices?: readonly string[];\n\tcreatedAt: number;\n}\ninterface WorkflowGraphNodeBase {\n\t/** Graph-unique node id: run-local in the root run, `${runId}:${nodeId}` inside nested child runs. */\n\tid: string;\n\t/** Run that owns the node. */\n\trunId: string;\n\t/** Run-local stage id or tool node id. */\n\tnodeId: string;\n\tname: string;\n\t/** Graph-unique ids of the node's parents. */\n\tparentIds: readonly string[];\n\t/** Admission order shared by stages and tool nodes within one run. */\n\texecutionOrder?: number;\n\t/** Nested workflow depth; 0 for the root run. */\n\tdepth: number;\n}\nexport interface WorkflowGraphStageNode extends WorkflowGraphNodeBase {\n\tkind: \"stage\";\n\tstatus: WorkflowStageStatus;\n\tpendingPrompt?: WorkflowGraphNodePrompt;\n}\nexport interface WorkflowGraphToolNode extends WorkflowGraphNodeBase {\n\tkind: \"tool\";\n\tstatus: WorkflowToolNodeStatus;\n\t/** Invocation ordinal of this `ctx.tool` call within its run. */\n\tordinal: number;\n}\nexport type WorkflowGraphNode = WorkflowGraphStageNode | WorkflowGraphToolNode;\n/** A human-input prompt raised by a run itself rather than by one of its stages. */\nexport interface WorkflowGraphRunPrompt extends WorkflowGraphNodePrompt {\n\t/** Run that owns the prompt. */\n\trunId: string;\n}\n/** Expanded graph of one root run, including nested child workflow runs. */\nexport interface WorkflowRootGraph {\n\tnodes: readonly WorkflowGraphNode[];\n\t/** Run-level prompts awaiting an answer; absent when there are none. */\n\trunPrompts?: readonly WorkflowGraphRunPrompt[];\n}\n\nexport interface WorkflowRootActivity {\n\trootRunId: string;\n\townerSessionId: string;\n\tstate: WorkflowActivityState;\n\treason: WorkflowActivityReason;\n\tactiveExecutionCount: number;\n\tactionableBlockCount: number;\n\tneedsAttention: boolean;\n\t/** Graph topology and node statuses; absent when the publisher reports no graph. */\n\tgraph?: WorkflowRootGraph;\n}\nexport interface WorkflowObservationCursor {\n\tepoch: string;\n\trevision: number;\n}\nexport type WorkflowActivitySnapshotInput =\n\t| { availability: \"ready\"; roots: readonly WorkflowRootActivity[] }\n\t| { availability: \"recovering\" | \"unavailable\" };\nexport type WorkflowActivitySnapshotFrame = WorkflowActivitySnapshotInput & {\n\tkind: \"snapshot\";\n\tcursor: WorkflowObservationCursor;\n};\nexport type WorkflowActivityFrame =\n\t| WorkflowActivitySnapshotFrame\n\t| { kind: \"changed\"; cursor: WorkflowObservationCursor; root: WorkflowRootActivity }\n\t| { kind: \"removed\"; cursor: WorkflowObservationCursor; rootRunId: string };\nexport type WorkflowActivityObserver = (frame: WorkflowActivityFrame) => void | Promise<void>;\nexport interface WorkflowActivitySubscription {\n\tdispose(): void;\n}\nexport type WorkflowLifecycleDelivery = \"live\" | \"replay\";\nexport type WorkflowLifecycleTarget =\n\t| {\n\t\t\tkind: \"run\";\n\t\t\trunId: string;\n\t\t\tpreviousStatus?: WorkflowRunStatus;\n\t\t\tstatus: WorkflowRunStatus;\n\t\t\taction?: WorkflowControlAction;\n\t }\n\t| {\n\t\t\tkind: \"stage\";\n\t\t\trunId: string;\n\t\t\tstageId: string;\n\t\t\tstageName: string;\n\t\t\tpreviousStatus?: WorkflowStageStatus;\n\t\t\tstatus: WorkflowStageStatus;\n\t }\n\t| {\n\t\t\tkind: \"tool\";\n\t\t\trunId: string;\n\t\t\ttoolNodeId: string;\n\t\t\ttoolName: string;\n\t\t\tpreviousStatus?: WorkflowToolNodeStatus;\n\t\t\tstatus: WorkflowToolNodeStatus;\n\t }\n\t| { kind: \"prompt\"; runId: string; stageId?: string; promptId: string; status: \"opened\" | \"answered\" | \"cancelled\" };\nexport interface WorkflowLifecycleEvent {\n\ttype: \"workflow_lifecycle\";\n\teventId: string;\n\tcursor: WorkflowObservationCursor;\n\trunId: string;\n\trootRunId: string;\n\townerSessionId: string;\n\toccurredAt: number;\n\tobservedAt: number;\n\tdelivery: WorkflowLifecycleDelivery;\n\ttarget: WorkflowLifecycleTarget;\n\tattribution?: \"user\" | \"agent\" | \"scheduler\" | \"recovery\" | \"unknown\";\n}\nexport interface WorkflowStageCompletedEvent extends Omit<WorkflowLifecycleEvent, \"type\" | \"target\"> {\n\ttype: \"workflow_stage_completed\";\n\ttarget: Extract<WorkflowLifecycleTarget, { kind: \"stage\" }> & { status: \"completed\" };\n}\nexport interface WorkflowActivityChangedEvent {\n\ttype: \"workflow_activity_changed\";\n\tcursor: WorkflowObservationCursor;\n\troot: WorkflowRootActivity;\n}\nexport interface WorkflowHeartbeatEvent {\n\ttype: \"workflow_heartbeat\";\n\trunId: string;\n\trootRunId: string;\n\townerSessionId: string;\n\tscheduledAt: number;\n\tintervalMinutes: number;\n}\nexport type WorkflowEvent =\n\t| WorkflowLifecycleEvent\n\t| WorkflowStageCompletedEvent\n\t| WorkflowActivityChangedEvent\n\t| WorkflowHeartbeatEvent;\nexport interface WorkflowActivityPublisher {\n\tpublishSnapshot(input: WorkflowActivitySnapshotInput): void;\n\tpublishChanged(root: WorkflowRootActivity): void;\n\tpublishRemoved(rootRunId: string): void;\n\tpublishLifecycle(event: Omit<WorkflowLifecycleEvent, \"cursor\">): void;\n\tpublishHeartbeat(event: WorkflowHeartbeatEvent): void;\n\tdispose(): void;\n}\nexport interface WorkflowObservationDiagnostic {\n\tkind:\n\t\t| \"ObserverDisposed\"\n\t\t| \"SourceRecovering\"\n\t\t| \"SourceUnavailable\"\n\t\t| \"ObserverDeliveryFailed\"\n\t\t| \"ObserverOverflow\"\n\t\t| \"PublisherFenced\";\n\tcursor: WorkflowObservationCursor;\n}\n"]}
1
+ {"version":3,"file":"workflow-events.js","sourceRoot":"","sources":["../../../src/core/extensions/workflow-events.ts"],"names":[],"mappings":"","sourcesContent":["export type WorkflowActivityState = \"working\" | \"idle\" | \"blocked\";\nexport type WorkflowActivityReason =\n\t| \"executing\"\n\t| \"automatic_continuation\"\n\t| \"retrying\"\n\t| \"stopping\"\n\t| \"awaiting_input\"\n\t| \"manual_intervention\"\n\t| \"paused\"\n\t| \"quiescent\";\n\n// Kept in sync with workflows/shared/store-types without a host runtime dependency.\nexport type WorkflowRunStatus =\n\t| \"pending\"\n\t| \"running\"\n\t| \"paused\"\n\t| \"completed\"\n\t| \"skipped\"\n\t| \"cancelled\"\n\t| \"blocked\"\n\t| \"failed\"\n\t| \"killed\";\nexport type WorkflowStageStatus =\n\t| \"pending\"\n\t| \"running\"\n\t| \"awaiting_input\"\n\t| \"paused\"\n\t| \"blocked\"\n\t| \"completed\"\n\t| \"failed\"\n\t| \"skipped\";\nexport type WorkflowToolNodeStatus = \"pending\" | \"running\" | \"completed\" | \"failed\" | \"cached\" | \"cancelled\";\nexport type WorkflowControlAction = \"quit\" | \"kill\" | \"pause\" | \"resume\";\n\n/** Snapshot-safe descriptor of a human-input prompt waiting on a workflow graph node. */\nexport interface WorkflowGraphNodePrompt {\n\tid: string;\n\tkind: \"input\" | \"confirm\" | \"select\" | \"editor\" | \"custom\";\n\tmessage: string;\n\tchoices?: readonly string[];\n\tcreatedAt: number;\n}\ninterface WorkflowGraphNodeBase {\n\t/** Graph-unique node id: run-local in the root run, `${runId}:${nodeId}` inside nested child runs. */\n\tid: string;\n\t/** Run that owns the node. */\n\trunId: string;\n\t/** Run-local stage id or tool node id. */\n\tnodeId: string;\n\tname: string;\n\t/** Graph-unique ids of the node's parents. */\n\tparentIds: readonly string[];\n\t/** Admission order shared by stages and tool nodes within one run. */\n\texecutionOrder?: number;\n\t/** Nested workflow depth; 0 for the root run. */\n\tdepth: number;\n}\nexport interface WorkflowGraphStageNode extends WorkflowGraphNodeBase {\n\tkind: \"stage\";\n\tstatus: WorkflowStageStatus;\n\tpendingPrompt?: WorkflowGraphNodePrompt;\n}\nexport interface WorkflowGraphToolNode extends WorkflowGraphNodeBase {\n\tkind: \"tool\";\n\tstatus: WorkflowToolNodeStatus;\n\t/** Invocation ordinal of this `ctx.tool` call within its run. */\n\tordinal: number;\n}\nexport type WorkflowGraphNode = WorkflowGraphStageNode | WorkflowGraphToolNode;\n/** A human-input prompt raised by a run itself rather than by one of its stages. */\nexport interface WorkflowGraphRunPrompt extends WorkflowGraphNodePrompt {\n\t/** Run that owns the prompt. */\n\trunId: string;\n}\n/** Expanded graph of one root run, including nested child workflow runs. */\nexport interface WorkflowRootGraph {\n\tnodes: readonly WorkflowGraphNode[];\n\t/** Run-level prompts awaiting an answer; absent when there are none. */\n\trunPrompts?: readonly WorkflowGraphRunPrompt[];\n}\n\nexport interface WorkflowRootActivity {\n\trootRunId: string;\n\townerSessionId: string;\n\tstate: WorkflowActivityState;\n\treason: WorkflowActivityReason;\n\tactiveExecutionCount: number;\n\tactionableBlockCount: number;\n\tblockedPromptKind?: WorkflowGraphNodePrompt[\"kind\"];\n\tendedStatus?: Extract<WorkflowRunStatus, \"completed\" | \"cancelled\" | \"killed\" | \"failed\">;\n\tneedsAttention: boolean;\n\t/** Graph topology and node statuses; absent when the publisher reports no graph. */\n\tgraph?: WorkflowRootGraph;\n}\nexport interface WorkflowObservationCursor {\n\tepoch: string;\n\trevision: number;\n}\nexport type WorkflowActivitySnapshotInput =\n\t| { availability: \"ready\"; roots: readonly WorkflowRootActivity[] }\n\t| { availability: \"recovering\" | \"unavailable\" };\nexport type WorkflowActivitySnapshotFrame = WorkflowActivitySnapshotInput & {\n\tkind: \"snapshot\";\n\tcursor: WorkflowObservationCursor;\n};\nexport type WorkflowActivityFrame =\n\t| WorkflowActivitySnapshotFrame\n\t| { kind: \"changed\"; cursor: WorkflowObservationCursor; root: WorkflowRootActivity }\n\t| { kind: \"removed\"; cursor: WorkflowObservationCursor; rootRunId: string };\nexport type WorkflowActivityObserver = (frame: WorkflowActivityFrame) => void | Promise<void>;\nexport interface WorkflowActivitySubscription {\n\tdispose(): void;\n}\nexport type WorkflowLifecycleDelivery = \"live\" | \"replay\";\nexport type WorkflowLifecycleTarget =\n\t| {\n\t\t\tkind: \"run\";\n\t\t\trunId: string;\n\t\t\tpreviousStatus?: WorkflowRunStatus;\n\t\t\tstatus: WorkflowRunStatus;\n\t\t\taction?: WorkflowControlAction;\n\t }\n\t| {\n\t\t\tkind: \"stage\";\n\t\t\trunId: string;\n\t\t\tstageId: string;\n\t\t\tstageName: string;\n\t\t\tpreviousStatus?: WorkflowStageStatus;\n\t\t\tstatus: WorkflowStageStatus;\n\t }\n\t| {\n\t\t\tkind: \"tool\";\n\t\t\trunId: string;\n\t\t\ttoolNodeId: string;\n\t\t\ttoolName: string;\n\t\t\tpreviousStatus?: WorkflowToolNodeStatus;\n\t\t\tstatus: WorkflowToolNodeStatus;\n\t }\n\t| { kind: \"prompt\"; runId: string; stageId?: string; promptId: string; status: \"opened\" | \"answered\" | \"cancelled\" };\nexport interface WorkflowLifecycleEvent {\n\ttype: \"workflow_lifecycle\";\n\teventId: string;\n\tcursor: WorkflowObservationCursor;\n\trunId: string;\n\trootRunId: string;\n\townerSessionId: string;\n\toccurredAt: number;\n\tobservedAt: number;\n\tdelivery: WorkflowLifecycleDelivery;\n\ttarget: WorkflowLifecycleTarget;\n\tattribution?: \"user\" | \"agent\" | \"scheduler\" | \"recovery\" | \"unknown\";\n}\nexport interface WorkflowStageCompletedEvent extends Omit<WorkflowLifecycleEvent, \"type\" | \"target\"> {\n\ttype: \"workflow_stage_completed\";\n\ttarget: Extract<WorkflowLifecycleTarget, { kind: \"stage\" }> & { status: \"completed\" };\n}\nexport interface WorkflowActivityChangedEvent {\n\ttype: \"workflow_activity_changed\";\n\tcursor: WorkflowObservationCursor;\n\troot: WorkflowRootActivity;\n}\nexport interface WorkflowHeartbeatEvent {\n\ttype: \"workflow_heartbeat\";\n\trunId: string;\n\trootRunId: string;\n\townerSessionId: string;\n\tscheduledAt: number;\n\tintervalMinutes: number;\n}\nexport type WorkflowEvent =\n\t| WorkflowLifecycleEvent\n\t| WorkflowStageCompletedEvent\n\t| WorkflowActivityChangedEvent\n\t| WorkflowHeartbeatEvent;\nexport interface WorkflowActivityPublisher {\n\tpublishSnapshot(input: WorkflowActivitySnapshotInput): void;\n\tpublishChanged(root: WorkflowRootActivity): void;\n\tpublishRemoved(rootRunId: string): void;\n\tpublishLifecycle(event: Omit<WorkflowLifecycleEvent, \"cursor\">): void;\n\tpublishHeartbeat(event: WorkflowHeartbeatEvent): void;\n\tdispose(): void;\n}\nexport interface WorkflowObservationDiagnostic {\n\tkind:\n\t\t| \"ObserverDisposed\"\n\t\t| \"SourceRecovering\"\n\t\t| \"SourceUnavailable\"\n\t\t| \"ObserverDeliveryFailed\"\n\t\t| \"ObserverOverflow\"\n\t\t| \"PublisherFenced\";\n\tcursor: WorkflowObservationCursor;\n}\n"]}
@@ -136,7 +136,7 @@ export interface SessionWorkflows extends WorkflowRunControl {
136
136
  export interface WorkflowRunControlRegistration {
137
137
  dispose(): void;
138
138
  }
139
- export type WorkflowRunControlErrorCode = "WORKFLOW_RUN_NOT_FOUND" | "WORKFLOW_RUN_OWNED_ELSEWHERE" | "WORKFLOW_RUN_NOT_RESUMABLE" | "WORKFLOW_STAGE_NOT_FOUND" | "WORKFLOW_STAGE_AMBIGUOUS" | "WORKFLOW_STAGE_RESUME_UNSUPPORTED" | "WORKFLOW_RUN_DATABASE" | "WORKFLOW_RUN_CONTROL_FAILED" | "WORKFLOW_RUN_CONTROL_UNAVAILABLE";
139
+ export type WorkflowRunControlErrorCode = "WORKFLOW_RUN_NOT_FOUND" | "WORKFLOW_RUN_OWNED_ELSEWHERE" | "WORKFLOW_RUN_NOT_RESUMABLE" | "WORKFLOW_STAGE_NOT_FOUND" | "WORKFLOW_STAGE_AMBIGUOUS" | "WORKFLOW_STAGE_RESUME_UNSUPPORTED" | "WORKFLOW_RUN_STORAGE" | "WORKFLOW_RUN_CONTROL_FAILED" | "WORKFLOW_RUN_CONTROL_UNAVAILABLE";
140
140
  export interface WorkflowRunControlErrorOptions extends ErrorOptions {
141
141
  readonly runId?: string;
142
142
  readonly failedRuns?: readonly WorkflowRunControlFailedRun[];
@@ -173,8 +173,8 @@ export declare class WorkflowStageAmbiguousError extends WorkflowRunControlError
173
173
  export declare class WorkflowStageResumeUnsupportedError extends WorkflowRunControlError {
174
174
  constructor(message: string, options?: WorkflowRunControlErrorOptions);
175
175
  }
176
- /** Workflow durability (the run database) is unavailable, shut down, or failed. */
177
- export declare class WorkflowRunDatabaseError extends WorkflowRunControlError {
176
+ /** Workflow storage is unavailable, closed, or failed. */
177
+ export declare class WorkflowRunStorageError extends WorkflowRunControlError {
178
178
  constructor(message: string, options?: WorkflowRunControlErrorOptions);
179
179
  }
180
180
  /** The workflows extension is not loaded for this session, or the session was disposed. */
@@ -1 +1 @@
1
- {"version":3,"file":"workflow-run-control.d.ts","sourceRoot":"","sources":["../../../src/core/extensions/workflow-run-control.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,wBAAwB,EACxB,4BAA4B,EAC5B,iBAAiB,EACjB,mBAAmB,EACnB,MAAM,sBAAsB,CAAC;AAE9B,MAAM,MAAM,oBAAoB,GAC7B,MAAM,GACN,MAAM,GACN,OAAO,GACP,IAAI,GACJ,SAAS,oBAAoB,EAAE,GAC/B,qBAAqB,CAAC;AAEzB,MAAM,WAAW,qBAAqB;IACrC,QAAQ,EAAE,GAAG,EAAE,MAAM,GAAG,oBAAoB,GAAG,SAAS,CAAC;CACzD;AAED,MAAM,MAAM,uBAAuB,GAAG,iBAAiB,GAAG,mBAAmB,GAAG,gBAAgB,CAAC;AAEjG,MAAM,WAAW,qBAAqB;IACrC,4FAA4F;IAC5F,QAAQ,CAAC,MAAM,CAAC,EAAE,uBAAuB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AGpE;CACD;AAED,mFAAmF;AACnF,qBAAa,wBAAyB,SAAQ,uBAAuB;IACpE,YAAY,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,8BAA8B,EAGpE;CACD;AAED,2FAA2F;AAC3F,qBAAa,kCAAmC,SAAQ,uBAAuB;IAC9E,YACC,OAAO,SAA0D,EACjE,OAAO,CAAC,EAAE,8BAA8B,EAIxC;CACD"}
1
+ {"version":3,"file":"workflow-run-control.d.ts","sourceRoot":"","sources":["../../../src/core/extensions/workflow-run-control.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,wBAAwB,EACxB,4BAA4B,EAC5B,iBAAiB,EACjB,mBAAmB,EACnB,MAAM,sBAAsB,CAAC;AAE9B,MAAM,MAAM,oBAAoB,GAC7B,MAAM,GACN,MAAM,GACN,OAAO,GACP,IAAI,GACJ,SAAS,oBAAoB,EAAE,GAC/B,qBAAqB,CAAC;AAEzB,MAAM,WAAW,qBAAqB;IACrC,QAAQ,EAAE,GAAG,EAAE,MAAM,GAAG,oBAAoB,GAAG,SAAS,CAAC;CACzD;AAED,MAAM,MAAM,uBAAuB,GAAG,iBAAiB,GAAG,mBAAmB,GAAG,gBAAgB,CAAC;AAEjG,MAAM,WAAW,qBAAqB;IACrC,4FAA4F;IAC5F,QAAQ,CAAC,MAAM,CAAC,EAAE,uBAAuB,CAAC;IAC1C,oFAAoF;IACpF,QAAQ,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC;CAClC;AAED,MAAM,WAAW,uBAAuB;IACvC,QAAQ,CAAC,MAAM,CAAC,EAAE,mBAAmB,CAAC;CACtC;AAED,MAAM,WAAW,sBAAsB;IACtC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,mBAAmB,CAAC;CACrC;AAED,MAAM,WAAW,wBAAwB;IACxC,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,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;IAE7D,YAAY,IAAI,EAAE,2BAA2B,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,8BAAmC,EAM3G;CACD;AAED,gEAAgE;AAChE,qBAAa,wBAAyB,SAAQ,uBAAuB;IACpE,YAAY,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,8BAA8B,EAGpE;CACD;AAED,yFAAyF;AACzF,qBAAa,yBAA0B,SAAQ,uBAAuB;IACrE,YAAY,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,8BAA8B,EAGpE;CACD;AAED,mGAAmG;AACnG,qBAAa,4BAA6B,SAAQ,uBAAuB;IACxE,YAAY,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,8BAA8B,EAGpE;CACD;AAED,qEAAqE;AACrE,qBAAa,0BAA2B,SAAQ,uBAAuB;IACtE,YAAY,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,8BAA8B,EAGpE;CACD;AAED,sGAAsG;AACtG,qBAAa,2BAA4B,SAAQ,uBAAuB;IACvE,YAAY,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,8BAA8B,EAGpE;CACD;AAED,qFAAqF;AACrF,qBAAa,mCAAoC,SAAQ,uBAAuB;IAC/E,YAAY,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,8BAA8B,EAGpE;CACD;AAED,0DAA0D;AAC1D,qBAAa,uBAAwB,SAAQ,uBAAuB;IACnE,YAAY,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,8BAA8B,EAGpE;CACD;AAED,2FAA2F;AAC3F,qBAAa,kCAAmC,SAAQ,uBAAuB;IAC9E,YACC,OAAO,SAA0D,EACjE,OAAO,CAAC,EAAE,8BAA8B,EAIxC;CACD"}
@@ -56,11 +56,11 @@ export class WorkflowStageResumeUnsupportedError extends WorkflowRunControlError
56
56
  this.name = "WorkflowStageResumeUnsupportedError";
57
57
  }
58
58
  }
59
- /** Workflow durability (the run database) is unavailable, shut down, or failed. */
60
- export class WorkflowRunDatabaseError extends WorkflowRunControlError {
59
+ /** Workflow storage is unavailable, closed, or failed. */
60
+ export class WorkflowRunStorageError extends WorkflowRunControlError {
61
61
  constructor(message, options) {
62
- super("WORKFLOW_RUN_DATABASE", message, options);
63
- this.name = "WorkflowRunDatabaseError";
62
+ super("WORKFLOW_RUN_STORAGE", message, options);
63
+ this.name = "WorkflowRunStorageError";
64
64
  }
65
65
  }
66
66
  /** The workflows extension is not loaded for this session, or the session was disposed. */
@@ -1 +1 @@
1
- {"version":3,"file":"workflow-run-control.js","sourceRoot":"","sources":["../../../src/core/extensions/workflow-run-control.ts"],"names":[],"mappings":"AAwLA,2FAA2F;AAC3F,MAAM,OAAO,uBAAwB,SAAQ,KAAK;IACxC,IAAI,CAA8B;IAClC,KAAK,CAAU;IACxB,mFAAmF;IAC1E,UAAU,CAA0C;IAE7D,YAAY,IAAiC,EAAE,OAAe,EAAE,OAAO,GAAmC,EAAE;QAC3G,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG,yBAAyB,CAAC;QACtC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,OAAO,CAAC,KAAK,KAAK,SAAS;YAAE,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;QAC5D,IAAI,OAAO,CAAC,UAAU,KAAK,SAAS;YAAE,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;IAC5E,CAAC;CACD;AAED,gEAAgE;AAChE,MAAM,OAAO,wBAAyB,SAAQ,uBAAuB;IACpE,YAAY,OAAe,EAAE,OAAwC;QACpE,KAAK,CAAC,wBAAwB,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;QAClD,IAAI,CAAC,IAAI,GAAG,0BAA0B,CAAC;IACxC,CAAC;CACD;AAED,yFAAyF;AACzF,MAAM,OAAO,yBAA0B,SAAQ,uBAAuB;IACrE,YAAY,O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,kCAAmC,SAAQ,uBAAuB;IAC9E,YACC,OAAO,GAAG,uDAAuD,EACjE,OAAwC;QAExC,KAAK,CAAC,kCAAkC,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;QAC5D,IAAI,CAAC,IAAI,GAAG,oCAAoC,CAAC;IAClD,CAAC;CACD","sourcesContent":["import type {\n\tWorkflowActivityObserver,\n\tWorkflowActivitySubscription,\n\tWorkflowRunStatus,\n\tWorkflowStageStatus,\n} from \"./workflow-events.js\";\n\nexport type WorkflowRunJsonValue =\n\t| string\n\t| number\n\t| boolean\n\t| null\n\t| readonly WorkflowRunJsonValue[]\n\t| WorkflowRunJsonObject;\n\nexport interface WorkflowRunJsonObject {\n\treadonly [key: string]: WorkflowRunJsonValue | undefined;\n}\n\nexport type WorkflowRunFilterStatus = WorkflowRunStatus | WorkflowStageStatus | \"awaiting_input\";\n\nexport interface WorkflowRunListFilter {\n\t/** Run statuses match directly; `awaiting_input` selects runs with an unanswered prompt. */\n\treadonly status?: WorkflowRunFilterStatus;\n\t/** Include project durable/completed history in addition to this session's runs. */\n\treadonly includeDurable?: boolean;\n}\n\nexport interface WorkflowStageListFilter {\n\treadonly status?: WorkflowStageStatus;\n}\n\nexport interface WorkflowRunActiveStage {\n\treadonly stageId: string;\n\treadonly name: string;\n\treadonly status: WorkflowStageStatus;\n}\n\nexport interface WorkflowRunAwaitingInput {\n\treadonly stageId?: string;\n\treadonly stageName?: string;\n\treadonly promptId?: string;\n\treadonly promptKind?: string;\n\treadonly message?: string;\n}\n\n/** Stored generated description and the run identity used by resume clients. */\nexport interface WorkflowRunSummaryMetadata {\n\treadonly label?: string;\n\treadonly identity?: string;\n\treadonly summary?: string;\n\t/** Unix milliseconds through which the summary describes the run. */\n\treadonly summarizedThrough?: number;\n}\n\n/** The concise per-run data that the `workflow` tool's `status` action lists. */\nexport interface WorkflowRunSummary extends WorkflowRunSummaryMetadata {\n\treadonly runId: string;\n\treadonly name: string;\n\treadonly status: WorkflowRunStatus;\n\treadonly startedAt: number;\n\treadonly endedAt?: number;\n\treadonly elapsedMs: number;\n\treadonly activeStages: readonly WorkflowRunActiveStage[];\n\treadonly awaitingInputCount: number;\n\treadonly awaitingInput: readonly WorkflowRunAwaitingInput[];\n\treadonly exitReason?: string;\n\treadonly error?: string;\n}\n\nexport interface WorkflowRunStageSummary {\n\treadonly id: string;\n\treadonly name: string;\n\treadonly status: WorkflowStageStatus;\n\treadonly sessionId?: string;\n\treadonly error?: string;\n\treadonly skippedReason?: string;\n\treadonly awaitingInputSince?: number;\n}\n\n/** The per-run detail that the `workflow` tool's `status` action returns for one run id. */\nexport interface WorkflowRunDetail extends WorkflowRunSummaryMetadata {\n\treadonly runId: string;\n\treadonly rootRunId?: string;\n\treadonly name: string;\n\treadonly status: WorkflowRunStatus | \"crashed\";\n\treadonly startedAt: number;\n\treadonly endedAt?: number;\n\treadonly durationMs?: number;\n\treadonly inputs: WorkflowRunJsonObject;\n\treadonly stages: readonly WorkflowRunStageSummary[];\n\treadonly result?: WorkflowRunJsonObject;\n\treadonly error?: string;\n\treadonly exitReason?: string;\n\treadonly resumable?: boolean;\n\treadonly resumeGuidance?: string;\n\treadonly ownerActiveElsewhere?: boolean;\n}\n\nexport interface WorkflowRunAllTarget {\n\treadonly all: true;\n}\n\nexport interface WorkflowRunPauseOptions {\n\t/** Pause one stage instead of the whole run. */\n\treadonly stageId?: string;\n}\n\nexport interface WorkflowRunResumeOptions {\n\t/** Resume one paused stage instead of the whole run. */\n\treadonly stageId?: string;\n\t/** Message delivered to each resumed stage. */\n\treadonly message?: string;\n\treadonly legacyRecovery?: { readonly olderWorkersStopped: true };\n}\n\nexport type WorkflowRunControlStatus = \"ok\" | \"running\" | \"paused\" | \"partial\" | \"noop\" | \"cancelled\";\n\n/** A run that a batch pause or quit could not stop; it may still be active. */\nexport interface WorkflowRunControlFailedRun {\n\treadonly runId: string;\n\t/** Machine-readable refusal, such as `not_found`, `no_active_stages` or `pause_failed`. */\n\treadonly reason: string;\n\treadonly message?: string;\n}\n\n/**\n * The acknowledged result of a pause, quit or resume request, as the `workflow`\n * tool reports it. `runId` is `--all` for a batch request. `noop` means the request was\n * understood and found nothing to change; `partial` means only part of the\n * request took effect. For a batch pause or quit, `failedRuns` names every run that\n * could not be stopped, so a `partial` outcome is never a complete stop.\n */\nexport interface WorkflowRunControlOutcome {\n\treadonly action: \"pause\" | \"quit\" | \"resume\";\n\treadonly runId: string;\n\treadonly status: WorkflowRunControlStatus;\n\treadonly message: string;\n\treadonly stageId?: string;\n\treadonly workflowStatus?: WorkflowRunStatus;\n\treadonly abandoned?: boolean;\n\treadonly failedRuns?: readonly WorkflowRunControlFailedRun[];\n}\n\n/** Typed run management for the workflow runs owned by one session, as registered by the workflows extension. */\nexport interface WorkflowRunControl {\n\tlistRuns(filter?: WorkflowRunListFilter): Promise<readonly WorkflowRunSummary[]>;\n\tgetRun(runId: string): Promise<WorkflowRunDetail>;\n\tgetStages(runId: string, filter?: WorkflowStageListFilter): Promise<readonly WorkflowRunStageSummary[]>;\n\tpause(runId: string, options?: WorkflowRunPauseOptions): Promise<WorkflowRunControlOutcome>;\n\tpause(target: WorkflowRunAllTarget): Promise<WorkflowRunControlOutcome>;\n\tquit(target: string | WorkflowRunAllTarget): Promise<WorkflowRunControlOutcome>;\n\tresume(runId: string, options?: WorkflowRunResumeOptions): Promise<WorkflowRunControlOutcome>;\n}\n\n/** `session.workflows`: run management plus observation of the workflow runs owned by one session. */\nexport interface SessionWorkflows extends WorkflowRunControl {\n\t/**\n\t * Follow root activity and graph changes. Delivers a snapshot frame first, then FIFO\n\t * `changed` and `removed` frames; the subscription follows extension reloads.\n\t */\n\tobserve(observer: WorkflowActivityObserver): WorkflowActivitySubscription;\n}\n\nexport interface WorkflowRunControlRegistration {\n\tdispose(): void;\n}\n\nexport type WorkflowRunControlErrorCode =\n\t| \"WORKFLOW_RUN_NOT_FOUND\"\n\t| \"WORKFLOW_RUN_OWNED_ELSEWHERE\"\n\t| \"WORKFLOW_RUN_NOT_RESUMABLE\"\n\t| \"WORKFLOW_STAGE_NOT_FOUND\"\n\t| \"WORKFLOW_STAGE_AMBIGUOUS\"\n\t| \"WORKFLOW_STAGE_RESUME_UNSUPPORTED\"\n\t| \"WORKFLOW_RUN_DATABASE\"\n\t| \"WORKFLOW_RUN_CONTROL_FAILED\"\n\t| \"WORKFLOW_RUN_CONTROL_UNAVAILABLE\";\n\nexport interface WorkflowRunControlErrorOptions extends ErrorOptions {\n\treadonly runId?: string;\n\treadonly failedRuns?: readonly WorkflowRunControlFailedRun[];\n}\n\n/** Base class for every failure reported by {@link SessionWorkflows}; branch on `code`. */\nexport class WorkflowRunControlError extends Error {\n\treadonly code: WorkflowRunControlErrorCode;\n\treadonly runId?: string;\n\t/** Runs a batch pause or quit could not stop, when the whole batch was refused. */\n\treadonly failedRuns?: readonly WorkflowRunControlFailedRun[];\n\n\tconstructor(code: WorkflowRunControlErrorCode, message: string, options: WorkflowRunControlErrorOptions = {}) {\n\t\tsuper(message, options);\n\t\tthis.name = \"WorkflowRunControlError\";\n\t\tthis.code = code;\n\t\tif (options.runId !== undefined) this.runId = options.runId;\n\t\tif (options.failedRuns !== undefined) this.failedRuns = options.failedRuns;\n\t}\n}\n\n/** The run id is unknown, malformed, or an ambiguous prefix. */\nexport class WorkflowRunNotFoundError extends WorkflowRunControlError {\n\tconstructor(message: string, options?: WorkflowRunControlErrorOptions) {\n\t\tsuper(\"WORKFLOW_RUN_NOT_FOUND\", message, options);\n\t\tthis.name = \"WorkflowRunNotFoundError\";\n\t}\n}\n\n/** The run belongs to another session or is executing in another live Atomic process. */\nexport class WorkflowRunOwnershipError extends WorkflowRunControlError {\n\tconstructor(message: string, options?: WorkflowRunControlErrorOptions) {\n\t\tsuper(\"WORKFLOW_RUN_OWNED_ELSEWHERE\", message, options);\n\t\tthis.name = \"WorkflowRunOwnershipError\";\n\t}\n}\n\n/** The run has no continuation to resume: it completed, was killed, or has no durable progress. */\nexport class WorkflowRunNotResumableError extends WorkflowRunControlError {\n\tconstructor(message: string, options?: WorkflowRunControlErrorOptions) {\n\t\tsuper(\"WORKFLOW_RUN_NOT_RESUMABLE\", message, options);\n\t\tthis.name = \"WorkflowRunNotResumableError\";\n\t}\n}\n\n/** The stage identifier matches no stage or tool node of the run. */\nexport class WorkflowStageNotFoundError extends WorkflowRunControlError {\n\tconstructor(message: string, options?: WorkflowRunControlErrorOptions) {\n\t\tsuper(\"WORKFLOW_STAGE_NOT_FOUND\", message, options);\n\t\tthis.name = \"WorkflowStageNotFoundError\";\n\t}\n}\n\n/** The stage identifier matches more than one stage or tool node; pass a more specific identifier. */\nexport class WorkflowStageAmbiguousError extends WorkflowRunControlError {\n\tconstructor(message: string, options?: WorkflowRunControlErrorOptions) {\n\t\tsuper(\"WORKFLOW_STAGE_AMBIGUOUS\", message, options);\n\t\tthis.name = \"WorkflowStageAmbiguousError\";\n\t}\n}\n\n/** A durable run can only be resumed whole; resume it without a stage identifier. */\nexport class WorkflowStageResumeUnsupportedError extends WorkflowRunControlError {\n\tconstructor(message: string, options?: WorkflowRunControlErrorOptions) {\n\t\tsuper(\"WORKFLOW_STAGE_RESUME_UNSUPPORTED\", message, options);\n\t\tthis.name = \"WorkflowStageResumeUnsupportedError\";\n\t}\n}\n\n/** Workflow durability (the run database) is unavailable, shut down, or failed. */\nexport class WorkflowRunDatabaseError extends WorkflowRunControlError {\n\tconstructor(message: string, options?: WorkflowRunControlErrorOptions) {\n\t\tsuper(\"WORKFLOW_RUN_DATABASE\", message, options);\n\t\tthis.name = \"WorkflowRunDatabaseError\";\n\t}\n}\n\n/** The workflows extension is not loaded for this session, or the session was disposed. */\nexport class WorkflowRunControlUnavailableError extends WorkflowRunControlError {\n\tconstructor(\n\t\tmessage = \"Workflow run control is unavailable for this session.\",\n\t\toptions?: WorkflowRunControlErrorOptions,\n\t) {\n\t\tsuper(\"WORKFLOW_RUN_CONTROL_UNAVAILABLE\", message, options);\n\t\tthis.name = \"WorkflowRunControlUnavailableError\";\n\t}\n}\n"]}
1
+ {"version":3,"file":"workflow-run-control.js","sourceRoot":"","sources":["../../../src/core/extensions/workflow-run-control.ts"],"names":[],"mappings":"AAwLA,2FAA2F;AAC3F,MAAM,OAAO,uBAAwB,SAAQ,KAAK;IACxC,IAAI,CAA8B;IAClC,KAAK,CAAU;IACxB,mFAAmF;IAC1E,UAAU,CAA0C;IAE7D,YAAY,IAAiC,EAAE,OAAe,EAAE,OAAO,GAAmC,EAAE;QAC3G,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG,yBAAyB,CAAC;QACtC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,OAAO,CAAC,KAAK,KAAK,SAAS;YAAE,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;QAC5D,IAAI,OAAO,CAAC,UAAU,KAAK,SAAS;YAAE,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;IAC5E,CAAC;CACD;AAED,gEAAgE;AAChE,MAAM,OAAO,wBAAyB,SAAQ,uBAAuB;IACpE,YAAY,OAAe,EAAE,OAAwC;QACpE,KAAK,CAAC,wBAAwB,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;QAClD,IAAI,CAAC,IAAI,GAAG,0BAA0B,CAAC;IACxC,CAAC;CACD;AAED,yFAAyF;AACzF,MAAM,OAAO,yBAA0B,SAAQ,uBAAuB;IACrE,YAAY,OAAe,EAAE,OAAwC;QACpE,KAAK,CAAC,8BAA8B,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;QACxD,IAAI,CAAC,IAAI,GAAG,2BAA2B,CAAC;IACzC,CAAC;CACD;AAED,mGAAmG;AACnG,MAAM,OAAO,4BAA6B,SAAQ,uBAAuB;IACxE,YAAY,OAAe,EAAE,OAAwC;QACpE,KAAK,CAAC,4BAA4B,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;QACtD,IAAI,CAAC,IAAI,GAAG,8BAA8B,CAAC;IAC5C,CAAC;CACD;AAED,qEAAqE;AACrE,MAAM,OAAO,0BAA2B,SAAQ,uBAAuB;IACtE,YAAY,OAAe,EAAE,OAAwC;QACpE,KAAK,CAAC,0BAA0B,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;QACpD,IAAI,CAAC,IAAI,GAAG,4BAA4B,CAAC;IAC1C,CAAC;CACD;AAED,sGAAsG;AACtG,MAAM,OAAO,2BAA4B,SAAQ,uBAAuB;IACvE,YAAY,OAAe,EAAE,OAAwC;QACpE,KAAK,CAAC,0BAA0B,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;QACpD,IAAI,CAAC,IAAI,GAAG,6BAA6B,CAAC;IAC3C,CAAC;CACD;AAED,qFAAqF;AACrF,MAAM,OAAO,mCAAoC,SAAQ,uBAAuB;IAC/E,YAAY,OAAe,EAAE,OAAwC;QACpE,KAAK,CAAC,mCAAmC,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;QAC7D,IAAI,CAAC,IAAI,GAAG,qCAAqC,CAAC;IACnD,CAAC;CACD;AAED,0DAA0D;AAC1D,MAAM,OAAO,uBAAwB,SAAQ,uBAAuB;IACnE,YAAY,OAAe,EAAE,OAAwC;QACpE,KAAK,CAAC,sBAAsB,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;QAChD,IAAI,CAAC,IAAI,GAAG,yBAAyB,CAAC;IACvC,CAAC;CACD;AAED,2FAA2F;AAC3F,MAAM,OAAO,kCAAmC,SAAQ,uBAAuB;IAC9E,YACC,OAAO,GAAG,uDAAuD,EACjE,OAAwC;QAExC,KAAK,CAAC,kCAAkC,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;QAC5D,IAAI,CAAC,IAAI,GAAG,oCAAoC,CAAC;IAClD,CAAC;CACD","sourcesContent":["import type {\n\tWorkflowActivityObserver,\n\tWorkflowActivitySubscription,\n\tWorkflowRunStatus,\n\tWorkflowStageStatus,\n} from \"./workflow-events.js\";\n\nexport type WorkflowRunJsonValue =\n\t| string\n\t| number\n\t| boolean\n\t| null\n\t| readonly WorkflowRunJsonValue[]\n\t| WorkflowRunJsonObject;\n\nexport interface WorkflowRunJsonObject {\n\treadonly [key: string]: WorkflowRunJsonValue | undefined;\n}\n\nexport type WorkflowRunFilterStatus = WorkflowRunStatus | WorkflowStageStatus | \"awaiting_input\";\n\nexport interface WorkflowRunListFilter {\n\t/** Run statuses match directly; `awaiting_input` selects runs with an unanswered prompt. */\n\treadonly status?: WorkflowRunFilterStatus;\n\t/** Include project durable/completed history in addition to this session's runs. */\n\treadonly includeDurable?: boolean;\n}\n\nexport interface WorkflowStageListFilter {\n\treadonly status?: WorkflowStageStatus;\n}\n\nexport interface WorkflowRunActiveStage {\n\treadonly stageId: string;\n\treadonly name: string;\n\treadonly status: WorkflowStageStatus;\n}\n\nexport interface WorkflowRunAwaitingInput {\n\treadonly stageId?: string;\n\treadonly stageName?: string;\n\treadonly promptId?: string;\n\treadonly promptKind?: string;\n\treadonly message?: string;\n}\n\n/** Stored generated description and the run identity used by resume clients. */\nexport interface WorkflowRunSummaryMetadata {\n\treadonly label?: string;\n\treadonly identity?: string;\n\treadonly summary?: string;\n\t/** Unix milliseconds through which the summary describes the run. */\n\treadonly summarizedThrough?: number;\n}\n\n/** The concise per-run data that the `workflow` tool's `status` action lists. */\nexport interface WorkflowRunSummary extends WorkflowRunSummaryMetadata {\n\treadonly runId: string;\n\treadonly name: string;\n\treadonly status: WorkflowRunStatus;\n\treadonly startedAt: number;\n\treadonly endedAt?: number;\n\treadonly elapsedMs: number;\n\treadonly activeStages: readonly WorkflowRunActiveStage[];\n\treadonly awaitingInputCount: number;\n\treadonly awaitingInput: readonly WorkflowRunAwaitingInput[];\n\treadonly exitReason?: string;\n\treadonly error?: string;\n}\n\nexport interface WorkflowRunStageSummary {\n\treadonly id: string;\n\treadonly name: string;\n\treadonly status: WorkflowStageStatus;\n\treadonly sessionId?: string;\n\treadonly error?: string;\n\treadonly skippedReason?: string;\n\treadonly awaitingInputSince?: number;\n}\n\n/** The per-run detail that the `workflow` tool's `status` action returns for one run id. */\nexport interface WorkflowRunDetail extends WorkflowRunSummaryMetadata {\n\treadonly runId: string;\n\treadonly rootRunId?: string;\n\treadonly name: string;\n\treadonly status: WorkflowRunStatus | \"crashed\";\n\treadonly startedAt: number;\n\treadonly endedAt?: number;\n\treadonly durationMs?: number;\n\treadonly inputs: WorkflowRunJsonObject;\n\treadonly stages: readonly WorkflowRunStageSummary[];\n\treadonly result?: WorkflowRunJsonObject;\n\treadonly error?: string;\n\treadonly exitReason?: string;\n\treadonly resumable?: boolean;\n\treadonly resumeGuidance?: string;\n\treadonly ownerActiveElsewhere?: boolean;\n}\n\nexport interface WorkflowRunAllTarget {\n\treadonly all: true;\n}\n\nexport interface WorkflowRunPauseOptions {\n\t/** Pause one stage instead of the whole run. */\n\treadonly stageId?: string;\n}\n\nexport interface WorkflowRunResumeOptions {\n\t/** Resume one paused stage instead of the whole run. */\n\treadonly stageId?: string;\n\t/** Message delivered to each resumed stage. */\n\treadonly message?: string;\n\treadonly legacyRecovery?: { readonly olderWorkersStopped: true };\n}\n\nexport type WorkflowRunControlStatus = \"ok\" | \"running\" | \"paused\" | \"partial\" | \"noop\" | \"cancelled\";\n\n/** A run that a batch pause or quit could not stop; it may still be active. */\nexport interface WorkflowRunControlFailedRun {\n\treadonly runId: string;\n\t/** Machine-readable refusal, such as `not_found`, `no_active_stages` or `pause_failed`. */\n\treadonly reason: string;\n\treadonly message?: string;\n}\n\n/**\n * The acknowledged result of a pause, quit or resume request, as the `workflow`\n * tool reports it. `runId` is `--all` for a batch request. `noop` means the request was\n * understood and found nothing to change; `partial` means only part of the\n * request took effect. For a batch pause or quit, `failedRuns` names every run that\n * could not be stopped, so a `partial` outcome is never a complete stop.\n */\nexport interface WorkflowRunControlOutcome {\n\treadonly action: \"pause\" | \"quit\" | \"resume\";\n\treadonly runId: string;\n\treadonly status: WorkflowRunControlStatus;\n\treadonly message: string;\n\treadonly stageId?: string;\n\treadonly workflowStatus?: WorkflowRunStatus;\n\treadonly abandoned?: boolean;\n\treadonly failedRuns?: readonly WorkflowRunControlFailedRun[];\n}\n\n/** Typed run management for the workflow runs owned by one session, as registered by the workflows extension. */\nexport interface WorkflowRunControl {\n\tlistRuns(filter?: WorkflowRunListFilter): Promise<readonly WorkflowRunSummary[]>;\n\tgetRun(runId: string): Promise<WorkflowRunDetail>;\n\tgetStages(runId: string, filter?: WorkflowStageListFilter): Promise<readonly WorkflowRunStageSummary[]>;\n\tpause(runId: string, options?: WorkflowRunPauseOptions): Promise<WorkflowRunControlOutcome>;\n\tpause(target: WorkflowRunAllTarget): Promise<WorkflowRunControlOutcome>;\n\tquit(target: string | WorkflowRunAllTarget): Promise<WorkflowRunControlOutcome>;\n\tresume(runId: string, options?: WorkflowRunResumeOptions): Promise<WorkflowRunControlOutcome>;\n}\n\n/** `session.workflows`: run management plus observation of the workflow runs owned by one session. */\nexport interface SessionWorkflows extends WorkflowRunControl {\n\t/**\n\t * Follow root activity and graph changes. Delivers a snapshot frame first, then FIFO\n\t * `changed` and `removed` frames; the subscription follows extension reloads.\n\t */\n\tobserve(observer: WorkflowActivityObserver): WorkflowActivitySubscription;\n}\n\nexport interface WorkflowRunControlRegistration {\n\tdispose(): void;\n}\n\nexport type WorkflowRunControlErrorCode =\n\t| \"WORKFLOW_RUN_NOT_FOUND\"\n\t| \"WORKFLOW_RUN_OWNED_ELSEWHERE\"\n\t| \"WORKFLOW_RUN_NOT_RESUMABLE\"\n\t| \"WORKFLOW_STAGE_NOT_FOUND\"\n\t| \"WORKFLOW_STAGE_AMBIGUOUS\"\n\t| \"WORKFLOW_STAGE_RESUME_UNSUPPORTED\"\n\t| \"WORKFLOW_RUN_STORAGE\"\n\t| \"WORKFLOW_RUN_CONTROL_FAILED\"\n\t| \"WORKFLOW_RUN_CONTROL_UNAVAILABLE\";\n\nexport interface WorkflowRunControlErrorOptions extends ErrorOptions {\n\treadonly runId?: string;\n\treadonly failedRuns?: readonly WorkflowRunControlFailedRun[];\n}\n\n/** Base class for every failure reported by {@link SessionWorkflows}; branch on `code`. */\nexport class WorkflowRunControlError extends Error {\n\treadonly code: WorkflowRunControlErrorCode;\n\treadonly runId?: string;\n\t/** Runs a batch pause or quit could not stop, when the whole batch was refused. */\n\treadonly failedRuns?: readonly WorkflowRunControlFailedRun[];\n\n\tconstructor(code: WorkflowRunControlErrorCode, message: string, options: WorkflowRunControlErrorOptions = {}) {\n\t\tsuper(message, options);\n\t\tthis.name = \"WorkflowRunControlError\";\n\t\tthis.code = code;\n\t\tif (options.runId !== undefined) this.runId = options.runId;\n\t\tif (options.failedRuns !== undefined) this.failedRuns = options.failedRuns;\n\t}\n}\n\n/** The run id is unknown, malformed, or an ambiguous prefix. */\nexport class WorkflowRunNotFoundError extends WorkflowRunControlError {\n\tconstructor(message: string, options?: WorkflowRunControlErrorOptions) {\n\t\tsuper(\"WORKFLOW_RUN_NOT_FOUND\", message, options);\n\t\tthis.name = \"WorkflowRunNotFoundError\";\n\t}\n}\n\n/** The run belongs to another session or is executing in another live Atomic process. */\nexport class WorkflowRunOwnershipError extends WorkflowRunControlError {\n\tconstructor(message: string, options?: WorkflowRunControlErrorOptions) {\n\t\tsuper(\"WORKFLOW_RUN_OWNED_ELSEWHERE\", message, options);\n\t\tthis.name = \"WorkflowRunOwnershipError\";\n\t}\n}\n\n/** The run has no continuation to resume: it completed, was killed, or has no durable progress. */\nexport class WorkflowRunNotResumableError extends WorkflowRunControlError {\n\tconstructor(message: string, options?: WorkflowRunControlErrorOptions) {\n\t\tsuper(\"WORKFLOW_RUN_NOT_RESUMABLE\", message, options);\n\t\tthis.name = \"WorkflowRunNotResumableError\";\n\t}\n}\n\n/** The stage identifier matches no stage or tool node of the run. */\nexport class WorkflowStageNotFoundError extends WorkflowRunControlError {\n\tconstructor(message: string, options?: WorkflowRunControlErrorOptions) {\n\t\tsuper(\"WORKFLOW_STAGE_NOT_FOUND\", message, options);\n\t\tthis.name = \"WorkflowStageNotFoundError\";\n\t}\n}\n\n/** The stage identifier matches more than one stage or tool node; pass a more specific identifier. */\nexport class WorkflowStageAmbiguousError extends WorkflowRunControlError {\n\tconstructor(message: string, options?: WorkflowRunControlErrorOptions) {\n\t\tsuper(\"WORKFLOW_STAGE_AMBIGUOUS\", message, options);\n\t\tthis.name = \"WorkflowStageAmbiguousError\";\n\t}\n}\n\n/** A durable run can only be resumed whole; resume it without a stage identifier. */\nexport class WorkflowStageResumeUnsupportedError extends WorkflowRunControlError {\n\tconstructor(message: string, options?: WorkflowRunControlErrorOptions) {\n\t\tsuper(\"WORKFLOW_STAGE_RESUME_UNSUPPORTED\", message, options);\n\t\tthis.name = \"WorkflowStageResumeUnsupportedError\";\n\t}\n}\n\n/** Workflow storage is unavailable, closed, or failed. */\nexport class WorkflowRunStorageError extends WorkflowRunControlError {\n\tconstructor(message: string, options?: WorkflowRunControlErrorOptions) {\n\t\tsuper(\"WORKFLOW_RUN_STORAGE\", message, options);\n\t\tthis.name = \"WorkflowRunStorageError\";\n\t}\n}\n\n/** The workflows extension is not loaded for this session, or the session was disposed. */\nexport class WorkflowRunControlUnavailableError extends WorkflowRunControlError {\n\tconstructor(\n\t\tmessage = \"Workflow run control is unavailable for this session.\",\n\t\toptions?: WorkflowRunControlErrorOptions,\n\t) {\n\t\tsuper(\"WORKFLOW_RUN_CONTROL_UNAVAILABLE\", message, options);\n\t\tthis.name = \"WorkflowRunControlUnavailableError\";\n\t}\n}\n"]}
@@ -39,10 +39,10 @@ export const defaultModelPerProvider = {
39
39
  "qwen-token-plan": "qwen3.7-max",
40
40
  "qwen-token-plan-cn": "qwen3.7-max",
41
41
  "qwen-token-plan-individual": "qwen3.8-max",
42
- xiaomi: "mimo-v2.5-pro",
43
- "xiaomi-token-plan-cn": "mimo-v2.5-pro",
44
- "xiaomi-token-plan-ams": "mimo-v2.5-pro",
45
- "xiaomi-token-plan-sgp": "mimo-v2.5-pro",
42
+ xiaomi: "mimo-v2.6-pro",
43
+ "xiaomi-token-plan-cn": "mimo-v2.6-pro",
44
+ "xiaomi-token-plan-ams": "mimo-v2.6-pro",
45
+ "xiaomi-token-plan-sgp": "mimo-v2.6-pro",
46
46
  };
47
47
  export function findPreferredAvailableModel(availableModels) {
48
48
  for (const [provider, defaultId] of Object.entries(defaultModelPerProvider)) {