@ai-agent-forge/agent-forge 0.88.2 → 0.88.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 (460) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/README.md +1 -1
  3. package/bundled-plugins/agent-loop-policy/agent-forge.json +1 -1
  4. package/bundled-plugins/agent-loop-policy/plugin.json +1 -1
  5. package/bundled-plugins/coding-tools/agent-forge.json +1 -1
  6. package/bundled-plugins/coding-tools/plugin.json +1 -1
  7. package/bundled-plugins/compaction-policy/agent-forge.json +1 -1
  8. package/bundled-plugins/compaction-policy/plugin.json +1 -1
  9. package/bundled-plugins/overflow-policy/agent-forge.json +1 -1
  10. package/bundled-plugins/overflow-policy/plugin.json +1 -1
  11. package/bundled-plugins/provider-failover/agent-forge.json +1 -1
  12. package/bundled-plugins/provider-failover/plugin.json +1 -1
  13. package/bundled-plugins/retry-policy/agent-forge.json +1 -1
  14. package/bundled-plugins/retry-policy/plugin.json +1 -1
  15. package/dist/artifacts/paged-read.d.ts +6 -1
  16. package/dist/artifacts/paged-read.d.ts.map +1 -1
  17. package/dist/artifacts/paged-read.js.map +1 -1
  18. package/dist/bundle/.build-manifest.json +244 -234
  19. package/dist/bundle/chunks/{anthropic-messages-PLAKXR73.js → anthropic-messages-3FJHRAJL.js} +2 -2
  20. package/dist/bundle/chunks/anthropic.js +1 -1
  21. package/dist/bundle/chunks/{azure-openai-responses-OUWQ2AZD.js → azure-openai-responses-GCL47IDS.js} +1 -1
  22. package/dist/bundle/chunks/bedrock-converse-stream.js +1 -1
  23. package/dist/bundle/chunks/{chunk-6F5JWGKE.js → chunk-32YDZI4J.js} +1 -1
  24. package/dist/bundle/chunks/{chunk-LSP24WNH.js → chunk-755VNWIF.js} +12 -12
  25. package/dist/bundle/chunks/{chunk-DRQDKNXA.js → chunk-BVVSHK6W.js} +1 -1
  26. package/dist/bundle/chunks/{chunk-HTC5K5SM.js → chunk-HEL6TAWE.js} +95 -90
  27. package/dist/bundle/chunks/{chunk-6R7UI4IY.js → chunk-QDLOMKF6.js} +1 -1
  28. package/dist/bundle/chunks/{chunk-44I47ACN.js → chunk-V3ACW7VD.js} +1 -1
  29. package/dist/bundle/chunks/{google-generative-ai-DLII6DAT.js → google-generative-ai-6BMXWA44.js} +1 -1
  30. package/dist/bundle/chunks/{google-vertex-G7BZL7GM.js → google-vertex-6H7NLRTK.js} +1 -1
  31. package/dist/bundle/chunks/image-resize-worker.js +1 -1
  32. package/dist/bundle/chunks/{mistral-conversations-JXUK24ID.js → mistral-conversations-IXUHSFSJ.js} +1 -1
  33. package/dist/bundle/chunks/{openai-codex-responses-5GSGFIPG.js → openai-codex-responses-YHUAEVCM.js} +1 -1
  34. package/dist/bundle/chunks/openai-codex.js +1 -1
  35. package/dist/bundle/chunks/{openai-completions-EI2I6DTG.js → openai-completions-ULQCFC72.js} +1 -1
  36. package/dist/bundle/chunks/openai-responses-NLLAJDPS.js +2 -0
  37. package/dist/bundle/chunks/{openrouter-images-G4GQRUSG.js → openrouter-images-GZZQZXMS.js} +1 -1
  38. package/dist/bundle/chunks/openrouter.js +1 -1
  39. package/dist/bundle/chunks/{pi-messages-PWU2VJMR.js → pi-messages-EJTI2EJ3.js} +1 -1
  40. package/dist/bundle/chunks/virtual-modules-TQWEGNNZ.js +5 -0
  41. package/dist/bundle/cli.js +1 -1
  42. package/dist/bundle/client.js +1 -1
  43. package/dist/bundle/index.js +1 -1
  44. package/dist/bundle/rpc-entry.js +1 -1
  45. package/dist/cli/args.d.ts +0 -1
  46. package/dist/cli/args.d.ts.map +1 -1
  47. package/dist/cli/args.js +1 -4
  48. package/dist/cli/args.js.map +1 -1
  49. package/dist/cli/config-selector.d.ts.map +1 -1
  50. package/dist/cli/config-selector.js +1 -1
  51. package/dist/cli/config-selector.js.map +1 -1
  52. package/dist/cli/experimental/cli.d.ts +3 -3
  53. package/dist/cli/experimental/cli.d.ts.map +1 -1
  54. package/dist/cli/experimental/cli.js +2 -2
  55. package/dist/cli/experimental/cli.js.map +1 -1
  56. package/dist/cli/experimental/commands/agent-forge.d.ts +15 -0
  57. package/dist/cli/experimental/commands/agent-forge.d.ts.map +1 -0
  58. package/dist/cli/experimental/commands/{pi.js → agent-forge.js} +4 -4
  59. package/dist/cli/experimental/commands/agent-forge.js.map +1 -0
  60. package/dist/cli/startup-ui.d.ts.map +1 -1
  61. package/dist/cli/startup-ui.js +1 -1
  62. package/dist/cli/startup-ui.js.map +1 -1
  63. package/dist/config.d.ts +4 -4
  64. package/dist/config.d.ts.map +1 -1
  65. package/dist/config.js +7 -7
  66. package/dist/config.js.map +1 -1
  67. package/dist/core/agent-forge-manifest.d.ts +7 -0
  68. package/dist/core/agent-forge-manifest.d.ts.map +1 -0
  69. package/dist/core/{pi-manifest.js → agent-forge-manifest.js} +4 -4
  70. package/dist/core/agent-forge-manifest.js.map +1 -0
  71. package/dist/core/agent-session-compaction.d.ts +1 -1
  72. package/dist/core/agent-session-compaction.d.ts.map +1 -1
  73. package/dist/core/agent-session-compaction.js +3 -3
  74. package/dist/core/agent-session-compaction.js.map +1 -1
  75. package/dist/core/agent-session-lifecycle.d.ts.map +1 -1
  76. package/dist/core/agent-session-lifecycle.js +12 -1
  77. package/dist/core/agent-session-lifecycle.js.map +1 -1
  78. package/dist/core/agent-session-projection.d.ts.map +1 -1
  79. package/dist/core/agent-session-projection.js +3 -3
  80. package/dist/core/agent-session-projection.js.map +1 -1
  81. package/dist/core/agent-session-services.d.ts +1 -1
  82. package/dist/core/agent-session-services.d.ts.map +1 -1
  83. package/dist/core/agent-session-services.js +1 -1
  84. package/dist/core/agent-session-services.js.map +1 -1
  85. package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
  86. package/dist/core/compaction/branch-summarization.js +1 -1
  87. package/dist/core/compaction/branch-summarization.js.map +1 -1
  88. package/dist/core/experimental.d.ts.map +1 -1
  89. package/dist/core/experimental.js +1 -3
  90. package/dist/core/experimental.js.map +1 -1
  91. package/dist/core/extensions/capability-plugin.d.ts.map +1 -1
  92. package/dist/core/extensions/capability-plugin.js +15 -8
  93. package/dist/core/extensions/capability-plugin.js.map +1 -1
  94. package/dist/core/extensions/capability-runtime-store.d.ts +20 -1
  95. package/dist/core/extensions/capability-runtime-store.d.ts.map +1 -1
  96. package/dist/core/extensions/capability-runtime-store.js +67 -0
  97. package/dist/core/extensions/capability-runtime-store.js.map +1 -1
  98. package/dist/core/extensions/capability-runtime-types.d.ts +14 -0
  99. package/dist/core/extensions/capability-runtime-types.d.ts.map +1 -1
  100. package/dist/core/extensions/capability-runtime-types.js +7 -1
  101. package/dist/core/extensions/capability-runtime-types.js.map +1 -1
  102. package/dist/core/extensions/capability-runtime.d.ts.map +1 -1
  103. package/dist/core/extensions/capability-runtime.js +144 -42
  104. package/dist/core/extensions/capability-runtime.js.map +1 -1
  105. package/dist/core/extensions/virtual-modules.d.ts.map +1 -1
  106. package/dist/core/extensions/virtual-modules.js +12 -4
  107. package/dist/core/extensions/virtual-modules.js.map +1 -1
  108. package/dist/core/facade/coding-agent-facade.d.ts +1 -1
  109. package/dist/core/facade/coding-agent-facade.d.ts.map +1 -1
  110. package/dist/core/facade/coding-agent-facade.js +1 -1
  111. package/dist/core/facade/coding-agent-facade.js.map +1 -1
  112. package/dist/core/i18n/locales/zh-cn/core-contract-final.d.ts +1 -1
  113. package/dist/core/i18n/locales/zh-cn/core-contract-final.d.ts.map +1 -1
  114. package/dist/core/i18n/locales/zh-cn/core-contract-final.js +3 -3
  115. package/dist/core/i18n/locales/zh-cn/core-contract-final.js.map +1 -1
  116. package/dist/core/i18n/locales/zh-cn/core-contract-plugins.d.ts.map +1 -1
  117. package/dist/core/i18n/locales/zh-cn/core-contract-plugins.js +1 -1
  118. package/dist/core/i18n/locales/zh-cn/core-contract-plugins.js.map +1 -1
  119. package/dist/core/i18n/locales/zh-cn/core-errors.d.ts.map +1 -1
  120. package/dist/core/i18n/locales/zh-cn/core-errors.js +1 -1
  121. package/dist/core/i18n/locales/zh-cn/core-errors.js.map +1 -1
  122. package/dist/core/i18n/locales/zh-cn/tui-components-misc.d.ts.map +1 -1
  123. package/dist/core/i18n/locales/zh-cn/tui-components-misc.js +2 -0
  124. package/dist/core/i18n/locales/zh-cn/tui-components-misc.js.map +1 -1
  125. package/dist/core/model-resolver.d.ts +2 -0
  126. package/dist/core/model-resolver.d.ts.map +1 -1
  127. package/dist/core/model-resolver.js +4 -1
  128. package/dist/core/model-resolver.js.map +1 -1
  129. package/dist/core/package-resource-collection.d.ts.map +1 -1
  130. package/dist/core/package-resource-collection.js +5 -5
  131. package/dist/core/package-resource-collection.js.map +1 -1
  132. package/dist/core/provider-composer.d.ts.map +1 -1
  133. package/dist/core/provider-composer.js +3 -3
  134. package/dist/core/provider-composer.js.map +1 -1
  135. package/dist/core/resource-loader.d.ts.map +1 -1
  136. package/dist/core/resource-loader.js +1 -1
  137. package/dist/core/resource-loader.js.map +1 -1
  138. package/dist/core/sdk.d.ts +1 -1
  139. package/dist/core/sdk.d.ts.map +1 -1
  140. package/dist/core/sdk.js +6 -7
  141. package/dist/core/sdk.js.map +1 -1
  142. package/dist/core/session-manager.d.ts.map +1 -1
  143. package/dist/core/session-manager.js +4 -4
  144. package/dist/core/session-manager.js.map +1 -1
  145. package/dist/core/settings-manager.d.ts.map +1 -1
  146. package/dist/core/settings-manager.js +5 -10
  147. package/dist/core/settings-manager.js.map +1 -1
  148. package/dist/core/timings.d.ts.map +1 -1
  149. package/dist/core/timings.js +1 -3
  150. package/dist/core/timings.js.map +1 -1
  151. package/dist/core/tools/render-utils.d.ts +1 -1
  152. package/dist/core/tools/render-utils.d.ts.map +1 -1
  153. package/dist/core/tools/render-utils.js.map +1 -1
  154. package/dist/core/tools/tool-definition.d.ts +1 -1
  155. package/dist/core/tools/tool-definition.d.ts.map +1 -1
  156. package/dist/core/tools/tool-definition.js.map +1 -1
  157. package/dist/core/trace-retention.d.ts +16 -1
  158. package/dist/core/trace-retention.d.ts.map +1 -1
  159. package/dist/core/trace-retention.js +43 -20
  160. package/dist/core/trace-retention.js.map +1 -1
  161. package/dist/export-html/ansi-to-html.d.ts.map +1 -0
  162. package/dist/export-html/ansi-to-html.js.map +1 -0
  163. package/dist/{core/export-html → export-html}/index.d.ts +1 -1
  164. package/dist/export-html/index.d.ts.map +1 -0
  165. package/dist/{core/export-html → export-html}/index.js +5 -5
  166. package/dist/export-html/index.js.map +1 -0
  167. package/dist/{core/export-html → export-html}/tool-renderer.d.ts +2 -2
  168. package/dist/export-html/tool-renderer.d.ts.map +1 -0
  169. package/dist/export-html/tool-renderer.js.map +1 -0
  170. package/dist/{modes/interactive → host}/model-catalog-refresh.d.ts +1 -1
  171. package/dist/host/model-catalog-refresh.d.ts.map +1 -0
  172. package/dist/{modes/interactive → host}/model-catalog-refresh.js +1 -1
  173. package/dist/host/model-catalog-refresh.js.map +1 -0
  174. package/dist/index.d.ts +5 -5
  175. package/dist/index.d.ts.map +1 -1
  176. package/dist/index.js +12 -12
  177. package/dist/index.js.map +1 -1
  178. package/dist/main.d.ts.map +1 -1
  179. package/dist/main.js +25 -14
  180. package/dist/main.js.map +1 -1
  181. package/dist/modes/interactive/components/agents-view.d.ts.map +1 -1
  182. package/dist/modes/interactive/components/agents-view.js +1 -1
  183. package/dist/modes/interactive/components/agents-view.js.map +1 -1
  184. package/dist/modes/interactive/components/armin.d.ts.map +1 -1
  185. package/dist/modes/interactive/components/armin.js +1 -1
  186. package/dist/modes/interactive/components/armin.js.map +1 -1
  187. package/dist/modes/interactive/components/assistant-message.d.ts +3 -0
  188. package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
  189. package/dist/modes/interactive/components/assistant-message.js +83 -24
  190. package/dist/modes/interactive/components/assistant-message.js.map +1 -1
  191. package/dist/modes/interactive/components/bash-execution.d.ts.map +1 -1
  192. package/dist/modes/interactive/components/bash-execution.js +1 -1
  193. package/dist/modes/interactive/components/bash-execution.js.map +1 -1
  194. package/dist/modes/interactive/components/bordered-loader.d.ts +1 -1
  195. package/dist/modes/interactive/components/bordered-loader.d.ts.map +1 -1
  196. package/dist/modes/interactive/components/bordered-loader.js.map +1 -1
  197. package/dist/modes/interactive/components/branch-summary-message.d.ts.map +1 -1
  198. package/dist/modes/interactive/components/branch-summary-message.js +1 -1
  199. package/dist/modes/interactive/components/branch-summary-message.js.map +1 -1
  200. package/dist/modes/interactive/components/compaction-summary-message.d.ts.map +1 -1
  201. package/dist/modes/interactive/components/compaction-summary-message.js +1 -1
  202. package/dist/modes/interactive/components/compaction-summary-message.js.map +1 -1
  203. package/dist/modes/interactive/components/config-selector.d.ts.map +1 -1
  204. package/dist/modes/interactive/components/config-selector.js +1 -1
  205. package/dist/modes/interactive/components/config-selector.js.map +1 -1
  206. package/dist/modes/interactive/components/custom-entry.d.ts.map +1 -1
  207. package/dist/modes/interactive/components/custom-entry.js +1 -1
  208. package/dist/modes/interactive/components/custom-entry.js.map +1 -1
  209. package/dist/modes/interactive/components/custom-message.d.ts.map +1 -1
  210. package/dist/modes/interactive/components/custom-message.js +1 -1
  211. package/dist/modes/interactive/components/custom-message.js.map +1 -1
  212. package/dist/modes/interactive/components/daxnuts.d.ts.map +1 -1
  213. package/dist/modes/interactive/components/daxnuts.js +1 -1
  214. package/dist/modes/interactive/components/daxnuts.js.map +1 -1
  215. package/dist/modes/interactive/components/dialog-editor.d.ts.map +1 -1
  216. package/dist/modes/interactive/components/dialog-editor.js +1 -1
  217. package/dist/modes/interactive/components/dialog-editor.js.map +1 -1
  218. package/dist/modes/interactive/components/dialog-input.d.ts.map +1 -1
  219. package/dist/modes/interactive/components/dialog-input.js +1 -1
  220. package/dist/modes/interactive/components/dialog-input.js.map +1 -1
  221. package/dist/modes/interactive/components/dialog-selector.d.ts.map +1 -1
  222. package/dist/modes/interactive/components/dialog-selector.js +1 -1
  223. package/dist/modes/interactive/components/dialog-selector.js.map +1 -1
  224. package/dist/modes/interactive/components/diff.d.ts.map +1 -1
  225. package/dist/modes/interactive/components/diff.js +1 -1
  226. package/dist/modes/interactive/components/diff.js.map +1 -1
  227. package/dist/modes/interactive/components/dynamic-border.d.ts.map +1 -1
  228. package/dist/modes/interactive/components/dynamic-border.js +1 -1
  229. package/dist/modes/interactive/components/dynamic-border.js.map +1 -1
  230. package/dist/modes/interactive/components/first-time-setup.d.ts +1 -1
  231. package/dist/modes/interactive/components/first-time-setup.d.ts.map +1 -1
  232. package/dist/modes/interactive/components/first-time-setup.js +1 -1
  233. package/dist/modes/interactive/components/first-time-setup.js.map +1 -1
  234. package/dist/modes/interactive/components/footer.d.ts.map +1 -1
  235. package/dist/modes/interactive/components/footer.js +1 -1
  236. package/dist/modes/interactive/components/footer.js.map +1 -1
  237. package/dist/modes/interactive/components/keybinding-hints.d.ts.map +1 -1
  238. package/dist/modes/interactive/components/keybinding-hints.js +1 -1
  239. package/dist/modes/interactive/components/keybinding-hints.js.map +1 -1
  240. package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -1
  241. package/dist/modes/interactive/components/login-dialog.js +1 -1
  242. package/dist/modes/interactive/components/login-dialog.js.map +1 -1
  243. package/dist/modes/interactive/components/mermaid.d.ts +1 -1
  244. package/dist/modes/interactive/components/mermaid.d.ts.map +1 -1
  245. package/dist/modes/interactive/components/mermaid.js.map +1 -1
  246. package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
  247. package/dist/modes/interactive/components/model-selector.js +2 -2
  248. package/dist/modes/interactive/components/model-selector.js.map +1 -1
  249. package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -1
  250. package/dist/modes/interactive/components/oauth-selector.js +1 -1
  251. package/dist/modes/interactive/components/oauth-selector.js.map +1 -1
  252. package/dist/modes/interactive/components/plugin-manager-entry.d.ts.map +1 -1
  253. package/dist/modes/interactive/components/plugin-manager-entry.js +1 -1
  254. package/dist/modes/interactive/components/plugin-manager-entry.js.map +1 -1
  255. package/dist/modes/interactive/components/plugin-selection-entry.d.ts.map +1 -1
  256. package/dist/modes/interactive/components/plugin-selection-entry.js +1 -1
  257. package/dist/modes/interactive/components/plugin-selection-entry.js.map +1 -1
  258. package/dist/modes/interactive/components/queue-manager-selector.d.ts.map +1 -1
  259. package/dist/modes/interactive/components/queue-manager-selector.js +1 -1
  260. package/dist/modes/interactive/components/queue-manager-selector.js.map +1 -1
  261. package/dist/modes/interactive/components/render-types.d.ts +1 -1
  262. package/dist/modes/interactive/components/render-types.d.ts.map +1 -1
  263. package/dist/modes/interactive/components/render-types.js.map +1 -1
  264. package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -1
  265. package/dist/modes/interactive/components/scoped-models-selector.js +1 -1
  266. package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -1
  267. package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
  268. package/dist/modes/interactive/components/session-selector.js +2 -2
  269. package/dist/modes/interactive/components/session-selector.js.map +1 -1
  270. package/dist/modes/interactive/components/settings-selector.d.ts +1 -1
  271. package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
  272. package/dist/modes/interactive/components/settings-selector.js +1 -1
  273. package/dist/modes/interactive/components/settings-selector.js.map +1 -1
  274. package/dist/modes/interactive/components/settings-submenu.d.ts.map +1 -1
  275. package/dist/modes/interactive/components/settings-submenu.js +1 -1
  276. package/dist/modes/interactive/components/settings-submenu.js.map +1 -1
  277. package/dist/modes/interactive/components/show-images-selector.d.ts.map +1 -1
  278. package/dist/modes/interactive/components/show-images-selector.js +1 -1
  279. package/dist/modes/interactive/components/show-images-selector.js.map +1 -1
  280. package/dist/modes/interactive/components/skill-invocation-message.d.ts.map +1 -1
  281. package/dist/modes/interactive/components/skill-invocation-message.js +1 -1
  282. package/dist/modes/interactive/components/skill-invocation-message.js.map +1 -1
  283. package/dist/modes/interactive/components/status-indicator.d.ts.map +1 -1
  284. package/dist/modes/interactive/components/status-indicator.js +1 -1
  285. package/dist/modes/interactive/components/status-indicator.js.map +1 -1
  286. package/dist/modes/interactive/components/theme-selector.d.ts.map +1 -1
  287. package/dist/modes/interactive/components/theme-selector.js +1 -1
  288. package/dist/modes/interactive/components/theme-selector.js.map +1 -1
  289. package/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -1
  290. package/dist/modes/interactive/components/thinking-selector.js +1 -1
  291. package/dist/modes/interactive/components/thinking-selector.js.map +1 -1
  292. package/dist/modes/interactive/components/tool-execution.d.ts +2 -0
  293. package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  294. package/dist/modes/interactive/components/tool-execution.js +96 -4
  295. package/dist/modes/interactive/components/tool-execution.js.map +1 -1
  296. package/dist/modes/interactive/components/tool-run-group.d.ts.map +1 -1
  297. package/dist/modes/interactive/components/tool-run-group.js +1 -1
  298. package/dist/modes/interactive/components/tool-run-group.js.map +1 -1
  299. package/dist/modes/interactive/components/tree-list.d.ts.map +1 -1
  300. package/dist/modes/interactive/components/tree-list.js +1 -1
  301. package/dist/modes/interactive/components/tree-list.js.map +1 -1
  302. package/dist/modes/interactive/components/tree-render.d.ts.map +1 -1
  303. package/dist/modes/interactive/components/tree-render.js +1 -1
  304. package/dist/modes/interactive/components/tree-render.js.map +1 -1
  305. package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -1
  306. package/dist/modes/interactive/components/tree-selector.js +1 -1
  307. package/dist/modes/interactive/components/tree-selector.js.map +1 -1
  308. package/dist/modes/interactive/components/user-message-selector.d.ts.map +1 -1
  309. package/dist/modes/interactive/components/user-message-selector.js +1 -1
  310. package/dist/modes/interactive/components/user-message-selector.js.map +1 -1
  311. package/dist/modes/interactive/components/user-message.d.ts.map +1 -1
  312. package/dist/modes/interactive/components/user-message.js +1 -1
  313. package/dist/modes/interactive/components/user-message.js.map +1 -1
  314. package/dist/modes/interactive/components/workflow-view.d.ts.map +1 -1
  315. package/dist/modes/interactive/components/workflow-view.js +1 -1
  316. package/dist/modes/interactive/components/workflow-view.js.map +1 -1
  317. package/dist/modes/interactive/interactive-auth.d.ts +1 -1
  318. package/dist/modes/interactive/interactive-auth.d.ts.map +1 -1
  319. package/dist/modes/interactive/interactive-auth.js +1 -1
  320. package/dist/modes/interactive/interactive-auth.js.map +1 -1
  321. package/dist/modes/interactive/interactive-commands.d.ts +123 -6
  322. package/dist/modes/interactive/interactive-commands.d.ts.map +1 -1
  323. package/dist/modes/interactive/interactive-commands.js +691 -4
  324. package/dist/modes/interactive/interactive-commands.js.map +1 -1
  325. package/dist/modes/interactive/interactive-events.d.ts +174 -0
  326. package/dist/modes/interactive/interactive-events.d.ts.map +1 -0
  327. package/dist/modes/interactive/interactive-events.js +704 -0
  328. package/dist/modes/interactive/interactive-events.js.map +1 -0
  329. package/dist/modes/interactive/interactive-format.d.ts.map +1 -1
  330. package/dist/modes/interactive/interactive-format.js +1 -1
  331. package/dist/modes/interactive/interactive-format.js.map +1 -1
  332. package/dist/modes/interactive/interactive-lifecycle.d.ts +94 -0
  333. package/dist/modes/interactive/interactive-lifecycle.d.ts.map +1 -0
  334. package/dist/modes/interactive/interactive-lifecycle.js +177 -0
  335. package/dist/modes/interactive/interactive-lifecycle.js.map +1 -0
  336. package/dist/modes/interactive/interactive-mode.d.ts +240 -133
  337. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  338. package/dist/modes/interactive/interactive-mode.js +251 -2159
  339. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  340. package/dist/modes/interactive/interactive-queues.d.ts +96 -0
  341. package/dist/modes/interactive/interactive-queues.d.ts.map +1 -0
  342. package/dist/modes/interactive/interactive-queues.js +183 -0
  343. package/dist/modes/interactive/interactive-queues.js.map +1 -0
  344. package/dist/modes/interactive/interactive-selectors.d.ts +95 -5
  345. package/dist/modes/interactive/interactive-selectors.d.ts.map +1 -1
  346. package/dist/modes/interactive/interactive-selectors.js +517 -6
  347. package/dist/modes/interactive/interactive-selectors.js.map +1 -1
  348. package/dist/modes/interactive/startup-services.d.ts +31 -0
  349. package/dist/modes/interactive/startup-services.d.ts.map +1 -0
  350. package/dist/modes/interactive/startup-services.js +123 -0
  351. package/dist/modes/interactive/startup-services.js.map +1 -0
  352. package/dist/modes/memory-preheat.d.ts +11 -0
  353. package/dist/modes/memory-preheat.d.ts.map +1 -0
  354. package/dist/modes/memory-preheat.js +20 -0
  355. package/dist/modes/memory-preheat.js.map +1 -0
  356. package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
  357. package/dist/modes/rpc/rpc-mode.js +3 -1
  358. package/dist/modes/rpc/rpc-mode.js.map +1 -1
  359. package/dist/plugins/ecosystem/node-package-install-host.d.ts +9 -1
  360. package/dist/plugins/ecosystem/node-package-install-host.d.ts.map +1 -1
  361. package/dist/plugins/ecosystem/node-package-install-host.js +79 -0
  362. package/dist/plugins/ecosystem/node-package-install-host.js.map +1 -1
  363. package/dist/remote/server-assembly.d.ts.map +1 -1
  364. package/dist/remote/server-assembly.js +7 -2
  365. package/dist/remote/server-assembly.js.map +1 -1
  366. package/dist/suites/builtin-suites.d.ts.map +1 -0
  367. package/dist/suites/builtin-suites.js.map +1 -0
  368. package/dist/suites/resolved-agent-profile.d.ts.map +1 -0
  369. package/dist/suites/resolved-agent-profile.js.map +1 -0
  370. package/dist/suites/suite-lifecycle.d.ts.map +1 -0
  371. package/dist/suites/suite-lifecycle.js.map +1 -0
  372. package/dist/suites/suite-loader.d.ts.map +1 -0
  373. package/dist/suites/suite-loader.js.map +1 -0
  374. package/dist/{modes/interactive/theme → theme}/dark.json +1 -1
  375. package/dist/{modes/interactive/theme → theme}/light.json +1 -1
  376. package/dist/{modes/interactive/theme → theme}/theme-controller.d.ts +1 -1
  377. package/dist/theme/theme-controller.d.ts.map +1 -0
  378. package/dist/{modes/interactive/theme → theme}/theme-controller.js +1 -1
  379. package/dist/theme/theme-controller.js.map +1 -0
  380. package/dist/{modes/interactive/theme → theme}/theme.d.ts +1 -1
  381. package/dist/theme/theme.d.ts.map +1 -0
  382. package/dist/{modes/interactive/theme → theme}/theme.js +5 -5
  383. package/dist/theme/theme.js.map +1 -0
  384. package/docs/compaction.md +7 -7
  385. package/docs/environment-variables.md +10 -4
  386. package/docs/keybindings.md +3 -3
  387. package/docs/models.md +17 -17
  388. package/docs/packages.md +1 -1
  389. package/docs/prompt-templates.md +1 -1
  390. package/docs/rpc.md +2 -2
  391. package/docs/sdk.md +5 -5
  392. package/docs/session-format.md +3 -3
  393. package/docs/settings.md +15 -1
  394. package/docs/shell-aliases.md +1 -1
  395. package/docs/skills.md +1 -1
  396. package/docs/terminal-setup.md +17 -17
  397. package/docs/themes.md +5 -5
  398. package/docs/tmux.md +4 -4
  399. package/docs/tui.md +1 -1
  400. package/docs/usage.md +292 -292
  401. package/docs/windows.md +1 -1
  402. package/examples/extensions/bash-spawn-hook/index.ts +1 -1
  403. package/examples/extensions/dynamic-resources/dynamic.json +1 -1
  404. package/examples/extensions/mcp-stdio/index.d.ts +64 -0
  405. package/examples/extensions/mcp-stdio/index.d.ts.map +1 -0
  406. package/examples/extensions/mcp-stdio/index.js +292 -0
  407. package/examples/extensions/mcp-stdio/index.js.map +1 -0
  408. package/examples/extensions/with-deps/package-lock.json +2 -2
  409. package/examples/extensions/with-deps/package.json +1 -6
  410. package/examples/extensions/with-deps/plugin.json +1 -1
  411. package/package.json +2 -2
  412. package/dist/bundle/chunks/openai-responses-AUJQ3NWT.js +0 -2
  413. package/dist/bundle/chunks/virtual-modules-MRXD3RWG.js +0 -5
  414. package/dist/cli/experimental/commands/pi.d.ts +0 -15
  415. package/dist/cli/experimental/commands/pi.d.ts.map +0 -1
  416. package/dist/cli/experimental/commands/pi.js.map +0 -1
  417. package/dist/core/export-html/ansi-to-html.d.ts.map +0 -1
  418. package/dist/core/export-html/ansi-to-html.js.map +0 -1
  419. package/dist/core/export-html/index.d.ts.map +0 -1
  420. package/dist/core/export-html/index.js.map +0 -1
  421. package/dist/core/export-html/tool-renderer.d.ts.map +0 -1
  422. package/dist/core/export-html/tool-renderer.js.map +0 -1
  423. package/dist/core/pi-manifest.d.ts +0 -7
  424. package/dist/core/pi-manifest.d.ts.map +0 -1
  425. package/dist/core/pi-manifest.js.map +0 -1
  426. package/dist/modes/interactive/model-catalog-refresh.d.ts.map +0 -1
  427. package/dist/modes/interactive/model-catalog-refresh.js.map +0 -1
  428. package/dist/modes/interactive/theme/theme-controller.d.ts.map +0 -1
  429. package/dist/modes/interactive/theme/theme-controller.js.map +0 -1
  430. package/dist/modes/interactive/theme/theme.d.ts.map +0 -1
  431. package/dist/modes/interactive/theme/theme.js.map +0 -1
  432. package/dist/profiles/builtin-suites.d.ts.map +0 -1
  433. package/dist/profiles/builtin-suites.js.map +0 -1
  434. package/dist/profiles/resolved-agent-profile.d.ts.map +0 -1
  435. package/dist/profiles/resolved-agent-profile.js.map +0 -1
  436. package/dist/profiles/suite-lifecycle.d.ts.map +0 -1
  437. package/dist/profiles/suite-lifecycle.js.map +0 -1
  438. package/dist/profiles/suite-loader.d.ts.map +0 -1
  439. package/dist/profiles/suite-loader.js.map +0 -1
  440. package/dist/utils/deprecation.d.ts +0 -4
  441. package/dist/utils/deprecation.d.ts.map +0 -1
  442. package/dist/utils/deprecation.js +0 -13
  443. package/dist/utils/deprecation.js.map +0 -1
  444. /package/dist/{core/export-html → export-html}/ansi-to-html.d.ts +0 -0
  445. /package/dist/{core/export-html → export-html}/ansi-to-html.js +0 -0
  446. /package/dist/{core/export-html → export-html}/template.css +0 -0
  447. /package/dist/{core/export-html → export-html}/template.html +0 -0
  448. /package/dist/{core/export-html → export-html}/template.js +0 -0
  449. /package/dist/{core/export-html → export-html}/tool-renderer.js +0 -0
  450. /package/dist/{core/export-html → export-html}/vendor/highlight.min.js +0 -0
  451. /package/dist/{core/export-html → export-html}/vendor/marked.min.js +0 -0
  452. /package/dist/{profiles → suites}/builtin-suites.d.ts +0 -0
  453. /package/dist/{profiles → suites}/builtin-suites.js +0 -0
  454. /package/dist/{profiles → suites}/resolved-agent-profile.d.ts +0 -0
  455. /package/dist/{profiles → suites}/resolved-agent-profile.js +0 -0
  456. /package/dist/{profiles → suites}/suite-lifecycle.d.ts +0 -0
  457. /package/dist/{profiles → suites}/suite-lifecycle.js +0 -0
  458. /package/dist/{profiles → suites}/suite-loader.d.ts +0 -0
  459. /package/dist/{profiles → suites}/suite-loader.js +0 -0
  460. /package/dist/{modes/interactive/theme → theme}/theme-schema.json +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"capability-runtime-store.js","sourceRoot":"","sources":["../../../src/core/extensions/capability-runtime-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAwCpE;;;;GAIG;AACH,MAAM,UAAU,4BAA4B,GAA2B;IACtE,OAAO;QACN,KAAK,EAAE,IAAI,GAAG,EAAyC;QACvD,MAAM,EAAE,IAAI,GAAG,EAAiD;QAChE,aAAa,EAAE,IAAI,GAAG,EAA6C;QACnE,kBAAkB,EAAE,IAAI,GAAG,EAAkD;QAC7E,gBAAgB,EAAE,IAAI,GAAG,EAAgD;QACzE,qBAAqB,EAAE,IAAI,GAAG,EAAqD;QACnF,iBAAiB,EAAE,IAAI,GAAG,EAAwD;QAClF,SAAS,EAAE,IAAI,GAAG,EAA2E;QAC7F,QAAQ,EAAE,IAAI,GAAG,EAA6D;QAC9E,UAAU,EAAE,IAAI,GAAG,EAAkD;QACrE,UAAU,EAAE,IAAI,GAAG,EAAgF;QACnG,iBAAiB,EAAE,IAAI,GAAG,EAAiD;QAC3E,kBAAkB,EAAE,IAAI,GAAG,EAAsC;QACjE,wBAAwB,EAAE,IAAI,GAAG,EAAyD;QAC1F,gBAAgB,EAAE,IAAI,GAAG,EAAiD;QAC1E,kBAAkB,EAAE,IAAI,GAAG,EAA4C;QACvE,oBAAoB,EAAE,IAAI,GAAG,EAAqC;QAClE,sBAAsB,EAAE,IAAI,GAAG,EAAoD;QACnF,WAAW,EAAE,IAAI,GAAG,EAA6F;QACjH,QAAQ,EAAE,IAAI,GAAG,EAA2B;QAC5C,4BAA4B,EAAE,IAAI,GAAG,EAAyC;QAC9E,mBAAmB,EAAE,IAAI,GA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AU,IAAI,WAAW,EAAE,CAAC;YACtC,MAAM,OAAO,GAAG,KAAK,CAAC,4BAA4B,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;YACnE,IAAI,CAAC,OAAO;gBAAE,SAAS;YACvB,OAAO,CAAC,MAAM,CAAC,MAAkC,CAAC,CAAC;YACnD,IAAI,OAAO,CAAC,IAAI,KAAK,CAAC;gBAAE,KAAK,CAAC,4BAA4B,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QAC/E,CAAC;IAAA,CACD,CAAC;IACF,KAAK,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACxC,OAAO,MAAM,CAAC;AAAA,CACd;AAED,MAAM,UAAU,qBAAqB,CAAC,KAA6B,EAAE,UAAkB,EAAE,KAAa,EAAQ;IAC7G,MAAM,OAAO,GAAG,KAAK,CAAC,4BAA4B,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IACnE,IAAI,CAAC,OAAO;QAAE,OAAO;IACrB,KAAK,CAAC,4BAA4B,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;IACtD,MAAM,MAAM,GAAG,4BAA4B,CAAC,KAAK,CAAC,CAAC;IACnD,KAAK,MAAM,MAAM,IAAI,OAAO;QAAE,KAAK,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;AAAA,CACjE","sourcesContent":["import { cancellationError } from \"./capability-runtime-operation.ts\";\nimport { detachedSnapshot } from \"./capability-runtime-snapshot.ts\";\nimport type {\n\tAPIState,\n\tCapabilityRuntimeState,\n\tOperationHandler,\n\tQueuedLifecycleDelivery,\n\tRegisteredCapability,\n\tRegisteredPluginCapability,\n\tStateWatcher,\n\tStoredContributionPoint,\n\tStoredLifecycleDefinition,\n\tStoredLifecycleRegistration,\n\tStoredOutputArtifact,\n\tStoredState,\n} from \"./capability-runtime-types.ts\";\nimport type { LifecycleDeliveryQueue } from \"./lifecycle-delivery-queue.ts\";\nimport type {\n\tAgentLoopHookHandlerV1,\n\tAgentLoopHookPositionV1,\n\tAgentRunLoopStrategyV1,\n\tBranchSummaryPolicy,\n\tCapabilityAPI,\n\tCapabilityCommandDefinition,\n\tCompactionPolicy,\n\tContextStrategy,\n\tDiagnosticsSpanSnapshot,\n\tDisposableRegistration,\n\tEventEnvelope,\n\tLoggerRecord,\n\tOperationHandle,\n\tOperationStatus,\n\tOverflowPolicy,\n\tPluginRejection,\n\tProviderHeaderTransform,\n\tRetryPolicy,\n\tRuntimeInspectorLifecycleDeliveryReportSnapshot,\n\tSkillDefinition,\n\tStreamFnWrapper,\n} from \"./public-api.ts\";\n\n/**\n * Create the mutable state container for one capability runtime. Every map,\n * set, and array is created once and mutated in place; `eventSequence` is the\n * single mutable primitive shared with the lifecycle dispatch module.\n */\nexport function createCapabilityRuntimeState(): CapabilityRuntimeState {\n\treturn {\n\t\ttools: new Map<string, RegisteredCapability<unknown>>(),\n\t\tskills: new Map<string, RegisteredCapability<SkillDefinition>>(),\n\t\tretryPolicies: new Map<string, RegisteredCapability<RetryPolicy>>(),\n\t\tcompactionPolicies: new Map<string, RegisteredCapability<CompactionPolicy>>(),\n\t\toverflowPolicies: new Map<string, RegisteredCapability<OverflowPolicy>>(),\n\t\tbranchSummaryPolicies: new Map<string, RegisteredCapability<BranchSummaryPolicy>>(),\n\t\trunLoopStrategies: new Map<string, RegisteredCapability<AgentRunLoopStrategyV1>>(),\n\t\tloopHooks: new Map<AgentLoopHookPositionV1, RegisteredCapability<AgentLoopHookHandlerV1>[]>(),\n\t\tcommands: new Map<string, RegisteredCapability<CapabilityCommandDefinition>>(),\n\t\toperations: new Map<string, RegisteredCapability<OperationHandler>>(),\n\t\trpcMethods: new Map<string, RegisteredCapability<(input: unknown) => unknown | Promise<unknown>>>(),\n\t\tcontextStrategies: new Map<string, RegisteredCapability<ContextStrategy>>(),\n\t\tpluginCapabilities: new Map<string, RegisteredPluginCapability>(),\n\t\tproviderHeaderTransforms: new Map<string, RegisteredCapability<ProviderHeaderTransform>>(),\n\t\tstreamFnWrappers: new Map<string, RegisteredCapability<StreamFnWrapper>>(),\n\t\tcontributionPoints: new Map<string, StoredContributionPoint<unknown>>(),\n\t\tlifecycleDefinitions: new Map<string, StoredLifecycleDefinition>(),\n\t\tlifecycleRegistrations: new Map<string, Map<string, StoredLifecycleRegistration>>(),\n\t\tsubscribers: new Map<string, Map<string, RegisteredCapability<(event: EventEnvelope) => void | Promise<void>>>>(),\n\t\tstatuses: new Map<string, OperationStatus>(),\n\t\tactiveOperationsByOwnerToken: new Map<symbol, Set<OperationHandle<unknown>>>(),\n\t\tpluginRegistrations: new Map<string, Set<DisposableRegistration>>(),\n\t\tapiStates: new Map<CapabilityAPI, APIState>(),\n\t\tactiveOwnerTokens: new Set<symbol>(),\n\t\toutputArtifacts: new Map<string, StoredOutputArtifact>(),\n\t\tstateByOwner: new Map<string, Map<string, StoredState>>(),\n\t\tstateRevisionsByOwner: new Map<string, Map<string, number>>(),\n\t\tstateWatchers: new Map<string, Map<string, StateWatcher>>(),\n\t\tstateByInstance: new Map<string, Map<string, Map<string, StoredState>>>(),\n\t\tstateRevisionsByInstance: new Map<string, Map<string, Map<string, number>>>(),\n\t\tstateWatchersByInstance: new Map<string, Map<string, Map<string, StateWatcher>>>(),\n\t\tlogs: [] as LoggerRecord[],\n\t\tspans: new Map<string, DiagnosticsSpanSnapshot>(),\n\t\tlifecycleReports: [] as RuntimeInspectorLifecycleDeliveryReportSnapshot[],\n\t\tlifecycleDeliveryQueues: new Set<LifecycleDeliveryQueue<QueuedLifecycleDelivery<unknown>>>(),\n\t\tpluginRejections: [] as PluginRejection[],\n\t\teventSequence: 0,\n\t};\n}\n\n/**\n * A synchronous bootstrap plugin violated its lifecycle contract after its\n * disposer had already run. The synchronous caller receives a contract error;\n * observe a later rejection too so it cannot become an unhandled promise.\n */\nexport function observeUnexpectedAsyncCleanup(result: PromiseLike<void>, pluginId: string): void {\n\tvoid Promise.resolve(result).catch((error) => {\n\t\tconsole.error(`Asynchronous cleanup rejected after synchronous plugin disposal was rejected: ${pluginId}`, error);\n\t});\n}\n\nexport function createRevokedCapabilityError(owner: string): Error {\n\treturn new Error(`Capability API is revoked: ${owner}`);\n}\n\nexport function isRevokedCapabilityError(error: unknown): boolean {\n\treturn error instanceof Error && error.message.startsWith(\"Capability API is revoked: \");\n}\n\nexport function assertRegisteredCapabilityActive<T>(\n\tstate: CapabilityRuntimeState,\n\tregistered: RegisteredCapability<T>,\n): void {\n\tif (!state.activeOwnerTokens.has(registered.ownerToken)) {\n\t\tthrow createRevokedCapabilityError(registered.owner);\n\t}\n}\n\n/**\n * Invoke an extension-owned callback with a lifecycle check before and after\n * awaiting it. A callback that resolves after its owner is revoked must not\n * publish a late result, and its rejection is normalized to the lifecycle\n * error so callers can distinguish revocation from plugin failures.\n */\nexport async function invokeRegisteredCapability<T, TResult>(\n\tstate: CapabilityRuntimeState,\n\tregistered: RegisteredCapability<T>,\n\tinvoke: (value: T) => TResult | PromiseLike<TResult>,\n): Promise<TResult> {\n\tassertRegisteredCapabilityActive(state, registered);\n\ttry {\n\t\tconst result = await invoke(registered.value);\n\t\tassertRegisteredCapabilityActive(state, registered);\n\t\treturn result;\n\t} catch (error) {\n\t\tif (!state.activeOwnerTokens.has(registered.ownerToken)) {\n\t\t\tthrow createRevokedCapabilityError(registered.owner);\n\t\t}\n\t\tthrow error;\n\t}\n}\n\n/**\n * Invoke a policy with its optional host cancellation signal. The signal is\n * checked before dispatch and after the policy settles; revocation remains\n * the stronger lifecycle error when both happen during one invocation.\n */\nexport async function invokeRegisteredCapabilityWithSignal<T, TResult>(\n\tstate: CapabilityRuntimeState,\n\tregistered: RegisteredCapability<T>,\n\tsignal: AbortSignal | undefined,\n\tinvoke: (value: T) => TResult | PromiseLike<TResult>,\n): Promise<TResult> {\n\tif (signal?.aborted) throw cancellationError(signal.reason);\n\ttry {\n\t\tconst result = await invokeRegisteredCapability(state, registered, invoke);\n\t\tif (signal?.aborted) throw cancellationError(signal.reason);\n\t\treturn result;\n\t} catch (error) {\n\t\tif (!state.activeOwnerTokens.has(registered.ownerToken)) {\n\t\t\tthrow createRevokedCapabilityError(registered.owner);\n\t\t}\n\t\tif (signal?.aborted) throw cancellationError(signal.reason);\n\t\tthrow error;\n\t}\n}\n\nexport async function invokePluginCapability<TResult>(\n\tstate: CapabilityRuntimeState,\n\tregistered: RegisteredPluginCapability,\n\tinput: unknown,\n\tsignal: AbortSignal,\n): Promise<TResult> {\n\tassertRegisteredCapabilityActive(state, registered as unknown as RegisteredCapability<unknown>);\n\ttry {\n\t\tconst result = await registered.handler(detachedSnapshot(input), { signal });\n\t\tassertRegisteredCapabilityActive(state, registered as unknown as RegisteredCapability<unknown>);\n\t\treturn detachedSnapshot(result) as TResult;\n\t} catch (error) {\n\t\tif (!state.activeOwnerTokens.has(registered.ownerToken)) throw createRevokedCapabilityError(registered.owner);\n\t\tthrow error;\n\t}\n}\n\nexport function trackOperation<TResult>(\n\tstate: CapabilityRuntimeState,\n\townerTokens: readonly symbol[],\n\thandle: OperationHandle<TResult>,\n): OperationHandle<TResult> {\n\tfor (const ownerToken of ownerTokens) {\n\t\tconst handles = state.activeOperationsByOwnerToken.get(ownerToken) ?? new Set<OperationHandle<unknown>>();\n\t\thandles.add(handle as OperationHandle<unknown>);\n\t\tstate.activeOperationsByOwnerToken.set(ownerToken, handles);\n\t}\n\tconst remove = () => {\n\t\tfor (const ownerToken of ownerTokens) {\n\t\t\tconst handles = state.activeOperationsByOwnerToken.get(ownerToken);\n\t\t\tif (!handles) continue;\n\t\t\thandles.delete(handle as OperationHandle<unknown>);\n\t\t\tif (handles.size === 0) state.activeOperationsByOwnerToken.delete(ownerToken);\n\t\t}\n\t};\n\tvoid handle.result.then(remove, remove);\n\treturn handle;\n}\n\nexport function cancelOwnedOperations(state: CapabilityRuntimeState, ownerToken: symbol, owner: string): void {\n\tconst handles = state.activeOperationsByOwnerToken.get(ownerToken);\n\tif (!handles) return;\n\tstate.activeOperationsByOwnerToken.delete(ownerToken);\n\tconst reason = createRevokedCapabilityError(owner);\n\tfor (const handle of handles) void handle.cancel(reason.message);\n}\n"]}
1
+ {"version":3,"file":"capability-runtime-store.js","sourceRoot":"","sources":["../../../src/core/extensions/capability-runtime-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAwCpE;;;;GAIG;AACH,6XAAiM;AACjM,MAAM,sBAAsB,GAAG,IAAI,CAAC;AACpC,qIAAyE;AACzE,MAAM,qBAAqB,GAAG,IAAI,CAAC;AACnC,qHAA2D;AAC3D,MAAM,uBAAuB,GAAG,IAAI,CAAC;AACrC,uEAA+B;AAC/B,MAAM,qBAAqB,GAAG,GAAG,CAAC;AAElC;;;;GAIG;AACH,MAAM,UAAU,4BAA4B,GAA2B;IACtE,OAAO;QACN,KAAK,EAAE,IAAI,GAAG,EAAyC;QACvD,MAAM,EAAE,IAAI,GAAG,EAAiD;QAChE,aAAa,EAAE,IAAI,GAAG,EAA6C;QACnE,kBAAkB,EAAE,IAAI,GAAG,EAAkD;QAC7E,gBAAgB,EAAE,IAAI,GAAG,EAAgD;QACzE,qBAAqB,EAAE,IAAI,GAAG,EAAqD;QACnF,iBAAiB,EAAE,IAAI,GAAG,EAAwD;QAClF,SAAS,EAAE,IAAI,GAAG,EAA2E;QAC7F,QAAQ,EAAE,IAAI,GAAG,EAA6D;QAC9E,UAAU,EAAE,IAAI,GAAG,EAAkD;QACrE,UAAU,EAAE,IAAI,GAAG,EAAgF;QACnG,iBAAiB,EAAE,IAAI,GAAG,EAAiD;QAC3E,kBAAkB,EAAE,IAAI,GAAG,EAAsC;QACjE,wBAAwB,EAAE,IAAI,GAAG,EAAyD;QAC1F,gBAAgB,EAAE,IAAI,GAAG,EAAiD;QAC1E,kBAAkB,EAAE,IAAI,GAAG,EAA4C;QACvE,oBAAoB,EAAE,IAAI,GAAG,E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+F;AAC/F,MAAM,UAAU,cAAc,CAAC,KAA6B,EAAE,MAAoB,EAAQ;IACzF,IAAI,KAAK,CAAC,IAAI,CAAC,MAAM,IAAI,uBAAuB;QAAE,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;IACrE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAAA,CACxB;AAED,yGAAyG;AACzG,MAAM,UAAU,mBAAmB,CAAC,KAA6B,EAAE,SAA0B,EAAQ;IACpG,IAAI,KAAK,CAAC,gBAAgB,CAAC,MAAM,IAAI,qBAAqB;QAAE,KAAK,CAAC,gBAAgB,CAAC,KAAK,EAAE,CAAC;IAC3F,KAAK,CAAC,gBAAgB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;AAAA,CACvC","sourcesContent":["import { cancellationError } from \"./capability-runtime-operation.ts\";\nimport { detachedSnapshot } from \"./capability-runtime-snapshot.ts\";\nimport type {\n\tAPIState,\n\tCapabilityRuntimeState,\n\tOperationHandler,\n\tQueuedLifecycleDelivery,\n\tRegisteredCapability,\n\tRegisteredPluginCapability,\n\tStateWatcher,\n\tStoredContributionPoint,\n\tStoredLifecycleDefinition,\n\tStoredLifecycleRegistration,\n\tStoredOutputArtifact,\n\tStoredState,\n} from \"./capability-runtime-types.ts\";\nimport type { LifecycleDeliveryQueue } from \"./lifecycle-delivery-queue.ts\";\nimport type {\n\tAgentLoopHookHandlerV1,\n\tAgentLoopHookPositionV1,\n\tAgentRunLoopStrategyV1,\n\tBranchSummaryPolicy,\n\tCapabilityAPI,\n\tCapabilityCommandDefinition,\n\tCompactionPolicy,\n\tContextStrategy,\n\tDiagnosticsSpanSnapshot,\n\tDisposableRegistration,\n\tEventEnvelope,\n\tLoggerRecord,\n\tOperationHandle,\n\tOperationStatus,\n\tOverflowPolicy,\n\tPluginRejection,\n\tProviderHeaderTransform,\n\tRetryPolicy,\n\tRuntimeInspectorLifecycleDeliveryReportSnapshot,\n\tSkillDefinition,\n\tStreamFnWrapper,\n} from \"./public-api.ts\";\n\n/**\n * 有界诊断容器上限(上限与逐出规则的权威来源:docs/design/插件基础能力设计.md §8.3):statuses/spans/logs/pluginRejections 只服务\n * 诊断与查询面(getOperationStatus、inspect),进程生命周期内只增不减,这里为\n * 各容器钉住\"保留最近 N 条,超限逐出最旧\"的进程级上限。\n */\n/** Operation 状态快照上限 1024:超限按插入序逐出最旧的已终态条目;在途 running 条目绝不逐出(getOperationStatus 返回非 running 会让 reportOperationStep 拒绝后续 step)。全部在途时跳过逐出、插入超过上限——statuses 没有终态删除路径,size 自此恒驻峰值水位、不再回落(并发在途天然小)。 */\nconst MAX_OPERATION_STATUSES = 1024;\n/** Diagnostics span 快照上限 1024:超限优先逐出最旧的已终态 span,全部 running 时按插入序逐出最旧。 */\nconst MAX_DIAGNOSTICS_SPANS = 1024;\n/** 运行时日志记录上限 1000(与 lifecycleReports 有界先例同风格):超限逐出最旧记录。 */\nconst MAX_RUNTIME_LOG_RECORDS = 1000;\n/** 插件启动拒绝记录上限 128:超限逐出最旧记录。 */\nconst MAX_PLUGIN_REJECTIONS = 128;\n\n/**\n * Create the mutable state container for one capability runtime. Every map,\n * set, and array is created once and mutated in place; `eventSequence` is the\n * single mutable primitive shared with the lifecycle dispatch module.\n */\nexport function createCapabilityRuntimeState(): CapabilityRuntimeState {\n\treturn {\n\t\ttools: new Map<string, RegisteredCapability<unknown>>(),\n\t\tskills: new Map<string, RegisteredCapability<SkillDefinition>>(),\n\t\tretryPolicies: new Map<string, RegisteredCapability<RetryPolicy>>(),\n\t\tcompactionPolicies: new Map<string, RegisteredCapability<CompactionPolicy>>(),\n\t\toverflowPolicies: new Map<string, RegisteredCapability<OverflowPolicy>>(),\n\t\tbranchSummaryPolicies: new Map<string, RegisteredCapability<BranchSummaryPolicy>>(),\n\t\trunLoopStrategies: new Map<string, RegisteredCapability<AgentRunLoopStrategyV1>>(),\n\t\tloopHooks: new Map<AgentLoopHookPositionV1, RegisteredCapability<AgentLoopHookHandlerV1>[]>(),\n\t\tcommands: new Map<string, RegisteredCapability<CapabilityCommandDefinition>>(),\n\t\toperations: new Map<string, RegisteredCapability<OperationHandler>>(),\n\t\trpcMethods: new Map<string, RegisteredCapability<(input: unknown) => unknown | Promise<unknown>>>(),\n\t\tcontextStrategies: new Map<string, RegisteredCapability<ContextStrategy>>(),\n\t\tpluginCapabilities: new Map<string, RegisteredPluginCapability>(),\n\t\tproviderHeaderTransforms: new Map<string, RegisteredCapability<ProviderHeaderTransform>>(),\n\t\tstreamFnWrappers: new Map<string, RegisteredCapability<StreamFnWrapper>>(),\n\t\tcontributionPoints: new Map<string, StoredContributionPoint<unknown>>(),\n\t\tlifecycleDefinitions: new Map<string, StoredLifecycleDefinition>(),\n\t\tlifecycleRegistrations: new Map<string, Map<string, StoredLifecycleRegistration>>(),\n\t\tsubscribers: new Map<string, Map<string, RegisteredCapability<(event: EventEnvelope) => void | Promise<void>>>>(),\n\t\tstatuses: new Map<string, OperationStatus>(),\n\t\tactiveOperationsByOwnerToken: new Map<symbol, Set<OperationHandle<unknown>>>(),\n\t\tpluginRegistrations: new Map<string, Set<DisposableRegistration>>(),\n\t\tapiStates: new Map<CapabilityAPI, APIState>(),\n\t\tactiveOwnerTokens: new Set<symbol>(),\n\t\toutputArtifacts: new Map<string, StoredOutputArtifact>(),\n\t\tstateByOwner: new Map<string, Map<string, StoredState>>(),\n\t\tstateRevisionsByOwner: new Map<string, Map<string, number>>(),\n\t\tstateWatchers: new Map<string, Map<string, StateWatcher>>(),\n\t\tstateByInstance: new Map<string, Map<string, Map<string, StoredState>>>(),\n\t\tstateRevisionsByInstance: new Map<string, Map<string, Map<string, number>>>(),\n\t\tstateWatchersByInstance: new Map<string, Map<string, Map<string, StateWatcher>>>(),\n\t\tlogs: [] as LoggerRecord[],\n\t\tspans: new Map<string, DiagnosticsSpanSnapshot>(),\n\t\tlifecycleReports: [] as RuntimeInspectorLifecycleDeliveryReportSnapshot[],\n\t\tlifecycleDeliveryQueues: new Set<LifecycleDeliveryQueue<QueuedLifecycleDelivery<unknown>>>(),\n\t\tpluginRejections: [] as PluginRejection[],\n\t\teventSequence: 0,\n\t};\n}\n\n/**\n * A synchronous bootstrap plugin violated its lifecycle contract after its\n * disposer had already run. The synchronous caller receives a contract error;\n * observe a later rejection too so it cannot become an unhandled promise.\n */\nexport function observeUnexpectedAsyncCleanup(result: PromiseLike<void>, pluginId: string): void {\n\tvoid Promise.resolve(result).catch((error) => {\n\t\tconsole.error(`Asynchronous cleanup rejected after synchronous plugin disposal was rejected: ${pluginId}`, error);\n\t});\n}\n\nexport function createRevokedCapabilityError(owner: string): Error {\n\treturn new Error(`Capability API is revoked: ${owner}`);\n}\n\nexport function isRevokedCapabilityError(error: unknown): boolean {\n\treturn error instanceof Error && error.message.startsWith(\"Capability API is revoked: \");\n}\n\nexport function assertRegisteredCapabilityActive<T>(\n\tstate: CapabilityRuntimeState,\n\tregistered: RegisteredCapability<T>,\n): void {\n\tif (!state.activeOwnerTokens.has(registered.ownerToken)) {\n\t\tthrow createRevokedCapabilityError(registered.owner);\n\t}\n}\n\n/**\n * Invoke an extension-owned callback with a lifecycle check before and after\n * awaiting it. A callback that resolves after its owner is revoked must not\n * publish a late result, and its rejection is normalized to the lifecycle\n * error so callers can distinguish revocation from plugin failures.\n */\nexport async function invokeRegisteredCapability<T, TResult>(\n\tstate: CapabilityRuntimeState,\n\tregistered: RegisteredCapability<T>,\n\tinvoke: (value: T) => TResult | PromiseLike<TResult>,\n): Promise<TResult> {\n\tassertRegisteredCapabilityActive(state, registered);\n\ttry {\n\t\tconst result = await invoke(registered.value);\n\t\tassertRegisteredCapabilityActive(state, registered);\n\t\treturn result;\n\t} catch (error) {\n\t\tif (!state.activeOwnerTokens.has(registered.ownerToken)) {\n\t\t\tthrow createRevokedCapabilityError(registered.owner);\n\t\t}\n\t\tthrow error;\n\t}\n}\n\n/**\n * Invoke a policy with its optional host cancellation signal. The signal is\n * checked before dispatch and after the policy settles; revocation remains\n * the stronger lifecycle error when both happen during one invocation.\n */\nexport async function invokeRegisteredCapabilityWithSignal<T, TResult>(\n\tstate: CapabilityRuntimeState,\n\tregistered: RegisteredCapability<T>,\n\tsignal: AbortSignal | undefined,\n\tinvoke: (value: T) => TResult | PromiseLike<TResult>,\n): Promise<TResult> {\n\tif (signal?.aborted) throw cancellationError(signal.reason);\n\ttry {\n\t\tconst result = await invokeRegisteredCapability(state, registered, invoke);\n\t\tif (signal?.aborted) throw cancellationError(signal.reason);\n\t\treturn result;\n\t} catch (error) {\n\t\tif (!state.activeOwnerTokens.has(registered.ownerToken)) {\n\t\t\tthrow createRevokedCapabilityError(registered.owner);\n\t\t}\n\t\tif (signal?.aborted) throw cancellationError(signal.reason);\n\t\tthrow error;\n\t}\n}\n\nexport async function invokePluginCapability<TResult>(\n\tstate: CapabilityRuntimeState,\n\tregistered: RegisteredPluginCapability,\n\tinput: unknown,\n\tsignal: AbortSignal,\n): Promise<TResult> {\n\tassertRegisteredCapabilityActive(state, registered as unknown as RegisteredCapability<unknown>);\n\ttry {\n\t\tconst result = await registered.handler(detachedSnapshot(input), { signal });\n\t\tassertRegisteredCapabilityActive(state, registered as unknown as RegisteredCapability<unknown>);\n\t\treturn detachedSnapshot(result) as TResult;\n\t} catch (error) {\n\t\tif (!state.activeOwnerTokens.has(registered.ownerToken)) throw createRevokedCapabilityError(registered.owner);\n\t\tthrow error;\n\t}\n}\n\nexport function trackOperation<TResult>(\n\tstate: CapabilityRuntimeState,\n\townerTokens: readonly symbol[],\n\thandle: OperationHandle<TResult>,\n): OperationHandle<TResult> {\n\tfor (const ownerToken of ownerTokens) {\n\t\tconst handles = state.activeOperationsByOwnerToken.get(ownerToken) ?? new Set<OperationHandle<unknown>>();\n\t\thandles.add(handle as OperationHandle<unknown>);\n\t\tstate.activeOperationsByOwnerToken.set(ownerToken, handles);\n\t}\n\tconst remove = () => {\n\t\tfor (const ownerToken of ownerTokens) {\n\t\t\tconst handles = state.activeOperationsByOwnerToken.get(ownerToken);\n\t\t\tif (!handles) continue;\n\t\t\thandles.delete(handle as OperationHandle<unknown>);\n\t\t\tif (handles.size === 0) state.activeOperationsByOwnerToken.delete(ownerToken);\n\t\t}\n\t};\n\tvoid handle.result.then(remove, remove);\n\treturn handle;\n}\n\nexport function cancelOwnedOperations(state: CapabilityRuntimeState, ownerToken: symbol, owner: string): void {\n\tconst handles = state.activeOperationsByOwnerToken.get(ownerToken);\n\tif (!handles) return;\n\tstate.activeOperationsByOwnerToken.delete(ownerToken);\n\tconst reason = createRevokedCapabilityError(owner);\n\tfor (const handle of handles) void handle.cancel(reason.message);\n}\n\n/**\n * Bounded write for `statuses`. Setting an existing id keeps its insertion\n * slot and never evicts. A new id at capacity evicts the oldest terminal\n * (non-running) entry in insertion order; when every entry is running the\n * insert proceeds above the limit because evicting a running status would\n * make reportOperationStep reject the operation's remaining steps.\n */\nexport function setOperationStatus(state: CapabilityRuntimeState, id: string, status: OperationStatus): void {\n\tif (state.statuses.size >= MAX_OPERATION_STATUSES && !state.statuses.has(id)) {\n\t\tfor (const [key, value] of state.statuses) {\n\t\t\tif (value !== \"running\") {\n\t\t\t\tstate.statuses.delete(key);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\tstate.statuses.set(id, status);\n}\n\n/**\n * Bounded insert for `spans`. A new span at capacity evicts the oldest\n * terminal (non-running) span first; when every span is still running it\n * falls back to the oldest span in insertion order. Updates to an existing\n * span (annotate/end/cancel) go through the map in place and never evict.\n */\nexport function setDiagnosticsSpan(\n\tstate: CapabilityRuntimeState,\n\tspanId: string,\n\tsnapshot: DiagnosticsSpanSnapshot,\n): void {\n\tif (state.spans.size >= MAX_DIAGNOSTICS_SPANS && !state.spans.has(spanId)) {\n\t\tlet evicted = false;\n\t\tfor (const [key, span] of state.spans) {\n\t\t\tif (span.status !== \"running\") {\n\t\t\t\tstate.spans.delete(key);\n\t\t\t\tevicted = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (!evicted) {\n\t\t\tconst oldest = state.spans.keys().next();\n\t\t\tif (!oldest.done) state.spans.delete(oldest.value);\n\t\t}\n\t}\n\tstate.spans.set(spanId, snapshot);\n}\n\n/** Bounded append for `logs`: keep the most recent {@link MAX_RUNTIME_LOG_RECORDS} records. */\nexport function pushRuntimeLog(state: CapabilityRuntimeState, record: LoggerRecord): void {\n\tif (state.logs.length >= MAX_RUNTIME_LOG_RECORDS) state.logs.shift();\n\tstate.logs.push(record);\n}\n\n/** Bounded append for `pluginRejections`: keep the most recent {@link MAX_PLUGIN_REJECTIONS} records. */\nexport function pushPluginRejection(state: CapabilityRuntimeState, rejection: PluginRejection): void {\n\tif (state.pluginRejections.length >= MAX_PLUGIN_REJECTIONS) state.pluginRejections.shift();\n\tstate.pluginRejections.push(rejection);\n}\n"]}
@@ -119,6 +119,13 @@ export interface APIState {
119
119
  compositionInstances?: Set<AgentInstance>;
120
120
  compositionDefinitions?: Set<AgentDefinition>;
121
121
  }
122
+ /**
123
+ * output.put 驻留缓冲上限(M4 双层限额的缓冲半层):单个输出工件的内存驻留
124
+ * 封顶。超限后停止继续缓冲(AsyncIterable 仍完整消费,只丢弃数据),驻留视图
125
+ * 变为 head + 截断标记 + 完整流末尾 64 KiB tail;ref.sizeBytes/truncated 由
126
+ * 运行时计算(sizeBytes 恒为原始总字节数),commit 观察者只收截断视图。
127
+ */
128
+ export declare const OUTPUT_ARTIFACT_MAX_BUFFER_BYTES: number;
122
129
  export interface StoredOutputArtifact {
123
130
  ref: OutputArtifactRef;
124
131
  bytes: Uint8Array;
@@ -208,6 +215,13 @@ export interface CapabilityRuntime {
208
215
  }[];
209
216
  listContributions(pointId: string, version: number): readonly ContributionEntry[];
210
217
  hasLifecycleEvent(id: string, version: number): boolean;
218
+ /**
219
+ * Whether at least one lifecycle registration currently exists for the event
220
+ * key (registration-map presence; owner activity is rechecked at delivery).
221
+ * Hot-path gate for per-delta producers (model.stream): lets the host skip
222
+ * envelope snapshot and clone work when nothing observes the event.
223
+ */
224
+ hasLifecycleSubscribers(type: string, version: number): boolean;
211
225
  dispatchLifecycle<TData>(request: LifecycleDispatchRequest<TData>): Promise<LifecycleDispatchResult<TData>>;
212
226
  /**
213
227
  * Record one startup plugin rejection (D-028): the rejection stays visible in
@@ -1 +1 @@
1
- {"version":3,"file":"capability-runtime-types.d.ts","sourceRoot":"","sources":["../../../src/core/extensions/capability-runtime-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,KAAK,EAAE,0BAA0B,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAC3G,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAC5E,OAAO,KAAK,EACX,mBAAmB,EACnB,eAAe,EACf,aAAa,EACb,kBAAkB,EAClB,sBAAsB,EACtB,uBAAuB,EACvB,4BAA4B,EAC5B,8BAA8B,EAC9B,6BAA6B,EAC7B,sBAAsB,EACtB,gBAAgB,EAChB,yBAAyB,EACzB,sBAAsB,EACtB,mBAAmB,EACnB,mBAAmB,EACnB,aAAa,EACb,wBAAwB,EACxB,2BAA2B,EAC3B,uBAAuB,EACvB,yBAAyB,EACzB,qBAAqB,EACrB,gBAAgB,EAChB,wBAAwB,EACxB,uBAAuB,EACvB,4BAA4B,EAC5B,wBAAwB,EACxB,uBAAuB,EACvB,uBAAuB,EACvB,eAAe,EACf,uBAAuB,EACvB,iBAAiB,EACjB,qBAAqB,EACrB,2BAA2B,EAC3B,aAAa,EACb,uBAAuB,EACvB,sBAAsB,EACtB,aAAa,EACb,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EACjB,2BAA2B,EAC3B,yBAAyB,EACzB,wBAAwB,EACxB,uBAAuB,EACvB,cAAc,EACd,wBAAwB,EACxB,uBAAuB,EACvB,uBAAuB,EACvB,yBAAyB,EACzB,yBAAyB,EACzB,YAAY,EACZ,yBAAyB,EACzB,eAAe,EACf,eAAe,EACf,iBAA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Q,CAAC,eAAe,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC;IAC7E,QAAQ,CAAC,wBAAwB,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;IACjF,QAAQ,CAAC,uBAAuB,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC;IACtF,QAAQ,CAAC,IAAI,EAAE,YAAY,EAAE,CAAC;IAC9B,QAAQ,CAAC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,uBAAuB,CAAC,CAAC;IACrD,QAAQ,CAAC,gBAAgB,EAAE,+CAA+C,EAAE,CAAC;IAC7E,QAAQ,CAAC,uBAAuB,EAAE,GAAG,CAAC,sBAAsB,CAAC,uBAAuB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAChG,QAAQ,CAAC,gBAAgB,EAAE,eAAe,EAAE,CAAC;IAC7C,+FAA+F;IAC/F,aAAa,EAAE,MAAM,CAAC;CACtB","sourcesContent":["import type { DurableServiceV1 } from \"../../durable/durable-service.ts\";\nimport type { ObservabilityHostAdapterV1, TraceSinkOptionsV1 } from \"../../plugins/observability-types.ts\";\nimport type { LifecycleDeliveryQueue } from \"./lifecycle-delivery-queue.ts\";\nimport type {\n\tAgentCompositionAPI,\n\tAgentDefinition,\n\tAgentInstance,\n\tAgentLoopHookForV1,\n\tAgentLoopHookHandlerV1,\n\tAgentLoopHookPositionV1,\n\tAgentModelInvocationResultV1,\n\tAgentRunLoopStrategyDecisionV1,\n\tAgentRunLoopStrategyRequestV1,\n\tAgentRunLoopStrategyV1,\n\tAgentTaskAdapter,\n\tAgentTaskSessionSummaryV1,\n\tAgentTaskSessionViewV1,\n\tBranchSummaryPolicy,\n\tBranchSummaryResult,\n\tCapabilityAPI,\n\tCapabilityCommandContext,\n\tCapabilityCommandDefinition,\n\tCapabilityCommandResult,\n\tCapabilityProviderHandler,\n\tCapabilityToolContext,\n\tCompactionPolicy,\n\tCompactionPolicyDecision,\n\tCompactionPolicyRequest,\n\tCompactionPreparationRequest,\n\tCompactionSummaryRequest,\n\tCompactionSummaryResult,\n\tContextOperationOptions,\n\tContextStrategy,\n\tContributionChangeEvent,\n\tContributionEntry,\n\tContributionLifecycle,\n\tContributionPointDefinition,\n\tCredentialAPI,\n\tDiagnosticsSpanSnapshot,\n\tDisposableRegistration,\n\tEventEnvelope,\n\tExecutionFactsV1,\n\tHostCapabilities,\n\tInteractionHostV1,\n\tLifecycleAfterCommitHandler,\n\tLifecycleDeliverySnapshot,\n\tLifecycleDispatchRequest,\n\tLifecycleDispatchResult,\n\tLifecycleEvent,\n\tLifecycleEventDefinition,\n\tLifecycleExecuteHandler,\n\tLifecycleObserveHandler,\n\tLifecycleRegistrationKind,\n\tLifecycleTransformHandler,\n\tLoggerRecord,\n\tOperationExecutionContext,\n\tOperationHandle,\n\tOperationStatus,\n\tOutputArtifactRef,\n\tOverflowPolicy,\n\tOverflowPolicyDecision,\n\tOverflowPolicyRequest,\n\tPluginCapabilityDeclaration,\n\tPluginConfigValue,\n\tPluginManifest,\n\tPluginRejection,\n\tProviderHeaderTransform,\n\tProviderHeaderTransformRequest,\n\tRetryClassificationRequest,\n\tRetryPolicy,\n\tRetryPolicyDecision,\n\tRetryPolicyRequest,\n\tRetryScheduleV1,\n\tRuntimeInspectorLifecycleDeliveryReportSnapshot,\n\tRuntimeInspectorSnapshot,\n\tSessionAPI,\n\tSkillDefinition,\n\tStateChange,\n\tStreamFnWrapper,\n} from \"./public-api.ts\";\n\n/** Host trace service injection (D-075 S4 second batch observability host contract). */\nexport interface TraceServiceV1 {\n\treadonly adapter: ObservabilityHostAdapterV1;\n\treadonly options?: TraceSinkOptionsV1;\n}\n\nexport type OperationHandler = (input: unknown, context: OperationExecutionContext) => unknown | Promise<unknown>;\n\nexport interface CapabilityRuntimeOptions {\n\tclock?: () => number;\n\t/** Test-only override for generated runtime identifiers; omitted in production. */\n\tidFactory?: (kind: string, sequence: number) => string;\n\t/** Test-only observer for every lifecycle dispatch, including detached runtime facts. */\n\tonLifecycleDispatch?: (\n\t\trequest: LifecycleDispatchRequest<unknown>,\n\t\tsettled: Promise<LifecycleDispatchResult<unknown>>,\n\t) => void;\n\t/** Observes each committed output artifact; host adapters may mirror it into durable storage. The runtime stays storage-agnostic. */\n\tonOutputArtifactCommit?: (artifact: { readonly ref: OutputArtifactRef; readonly bytes: Uint8Array }) => void;\n\t/**\n\t * 运行时工具表变更钩子:工具表发生任何变更(注册、同名替换、卸载、替换链恢复,\n\t * 以及插件装卸引发的表变更)后同步调用一次。缺省不传 = 行为不变;回调异常经\n\t * 运行时既有错误通道记录,不打断注册本身。\n\t */\n\tonToolRegistryChange?: () => void;\n\t/**\n\t * 运行时 invoke 面传给工具 execute 的第二参上下文(additive;现有单参工具不受\n\t * 影响)。宿主注入后,经 runtime.invokeTool 调用的工具收到 `{ cwd }`(与会话\n\t * cwd 同源,对应命令面 CapabilityCommandContext.cwd);未注入时第二参保持 undefined。\n\t */\n\ttoolExecutionContext?: CapabilityToolContext;\n\t/**\n\t * 插件日志记录宿主转发通道(会话轨迹 plugin.log 镜像,设计 §5.3/§7.2):每条\n\t * 经 LoggerAPI 写入并通过校验的记录在入运行时内存环后同步转发一次。回调契约:\n\t * 回调内不得调用 LoggerAPI(防自递归);回调抛错由运行时直接吞掉,不打断\n\t * 调用方,也绝不经 recordLog 再记录。缺省不传 = 行为不变。\n\t */\n\tonLogRecord?: (record: LoggerRecord) => void;\n\tsession?: SessionAPI;\n\tagents?: AgentTaskAdapter;\n\t/**\n\t * 会话回读器(D-060 S2/S3):宿主注入后 `api.agents.session(sessionId)` 才存在。\n\t * 作用域(只放行本会话的子会话)由宿主在读取器内部强制;内核不做假设。\n\t */\n\tagentSessionReader?: (sessionId: string) => Promise<AgentTaskSessionViewV1 | undefined>;\n\t/**\n\t * 列出宿主会话**自己的**子代理会话摘要(按最近活动倒序,D-060 模型面盘点通道)。\n\t * 注入后 `agents.list()` 才存在;作用域由宿主强制(宿主只回自己会话的子会话)。\n\t */\n\tagentSessionLister?: () => Promise<AgentTaskSessionSummaryV1[]>;\n\t/**\n\t * Durable replay channel for agent task terminal outcomes. When present,\n\t * every settle persists a frozen record under the deterministic artifact id\n\t * `agent-task:<taskId>`; `api.agents.result(taskId)` reads it back across\n\t * runtime rebuilds. The host owns the writer claim lifecycle: the writer\n\t * must have claimed on the store before the first settle, or persist fails\n\t * loudly with the store's `not_writer` error.\n\t */\n\tagentResults?: {\n\t\treadonly store: DurableServiceV1;\n\t\treadonly writerId: string;\n\t};\n\tcredentials?: CredentialAPI;\n\tinteraction?: InteractionHostV1;\n\tcomposition?: AgentCompositionAPI;\n\t/** Host-provided model runtime for agent-composition model/tool facades. */\n\tmodelRuntime?: {\n\t\t/** Provider-agnostic facts about the current session model. */\n\t\tgetModelFacts():\n\t\t\t| { provider: string; id: string; contextWindow: number; maxTokens: number; reasoning: boolean }\n\t\t\t| undefined;\n\t\t/** Single-shot model invocation. The host resolves model, auth, transport and cache routing. */\n\t\tinvoke: (\n\t\t\tinput: { systemPrompt?: string; prompt: string; maxTokens?: number; thinkingLevel?: string },\n\t\t\toptions?: { signal?: AbortSignal },\n\t\t) => Promise<AgentModelInvocationResultV1>;\n\t};\n\t/**\n\t * Parent-session cancel fence (D-044 §4.2). Consulted once per agent-task\n\t * creation: the returned signal (when present) cancels that task if it fires,\n\t * or immediately cancels tasks created after it already fired. The host\n\t * refreshes the fence epoch so tasks submitted after an aborted turn bind to\n\t * the next signal instead of an already-spent one. Absent = no cascade.\n\t */\n\tparentSignal?: () => AbortSignal | undefined;\n\t/**\n\t * Host trace service (D-075 S4 second batch): injected on hosts running\n\t * session trace collection. Exposed to plugins as `api.trace` (the\n\t * adapter) plus `api.traceSinkOptions`; absent = plugins see neither and\n\t * stay trace-free.\n\t */\n\ttrace?: TraceServiceV1;\n}\n\nexport interface RegisteredCapability<T> {\n\towner: string;\n\townerToken: symbol;\n\tvalue: T;\n}\n\nexport interface RegisteredPluginCapability {\n\tdeclaration: PluginCapabilityDeclaration;\n\towner: string;\n\townerToken: symbol;\n\thandler: CapabilityProviderHandler;\n}\n\nexport interface APIState {\n\tactive: boolean;\n\towner: string;\n\townerToken: symbol;\n\tcompositionInstances?: Set<AgentInstance>;\n\tcompositionDefinitions?: Set<AgentDefinition>;\n}\n\nexport interface StoredOutputArtifact {\n\tref: OutputArtifactRef;\n\tbytes: Uint8Array;\n\townerToken: symbol;\n}\n\nexport interface StoredContributionPoint<TValue = unknown> {\n\towner: string;\n\townerToken: symbol;\n\tdefinition: ContributionPointDefinition<TValue>;\n\tentries: Map<string, StoredContributionEntry<TValue>>;\n\tsubscribers: Map<\n\t\tstring,\n\t\t{ ownerToken: symbol; handler: (event: ContributionChangeEvent<TValue>) => void | Promise<void> }\n\t>;\n}\n\nexport interface StoredContributionEntry<TValue = unknown> extends ContributionEntry<TValue> {\n\townerToken: symbol;\n}\n\nexport interface StoredLifecycleDefinition<TData = unknown> {\n\towner: string;\n\townerToken: symbol;\n\tdefinition: LifecycleEventDefinition<TData>;\n}\n\nexport interface StoredLifecycleRegistration<TData = unknown> {\n\tid: string;\n\towner: string;\n\townerToken: symbol;\n\tkind: LifecycleRegistrationKind;\n\tsequence: number;\n\thandler:\n\t\t| LifecycleObserveHandler<TData>\n\t\t| LifecycleTransformHandler<TData>\n\t\t| LifecycleExecuteHandler<TData>\n\t\t| LifecycleAfterCommitHandler<TData>;\n\tdelivery: LifecycleDeliverySnapshot;\n\tqueue?: LifecycleDeliveryQueue<QueuedLifecycleDelivery<TData>>;\n}\n\nexport interface QueuedLifecycleDelivery<TData> {\n\treadonly event: LifecycleEvent<TData>;\n\treadonly signal?: AbortSignal;\n}\n\nexport interface StoredState {\n\tvalue: PluginConfigValue;\n\trevision: number;\n}\n\nexport interface StateWatcher {\n\towner: string;\n\townerToken: symbol;\n\tprefix?: string;\n\thandler: (change: StateChange) => void;\n}\n\n/**\n * Terminal statuses the runtime executor itself can produce. `timed_out` is\n * excluded: the executor has no watchdog — a caller-imposed deadline aborts\n * through cancel() and settles cancelled, while a host-declared timed_out\n * enters only through the public contract's complete() path (D-043).\n */\nexport type OperationTerminalStatus = Exclude<OperationStatus, \"queued\" | \"running\" | \"timed_out\">;\n\nexport interface CapabilityRuntime {\n\treadonly host: HostCapabilities;\n\tresolvePluginCapabilityOrder(manifests: readonly PluginManifest[]): readonly PluginManifest[];\n\tcreateAPI(manifest: PluginManifest): CapabilityAPI;\n\trevokeAPI(api: CapabilityAPI): void;\n\t/** Revoke every API produced by this runtime, including direct host-created APIs. */\n\trevokeAllAPIs(): void;\n\t/** Revoke APIs and await disposal of every registration owned by this runtime. */\n\tdisposeAll(): Promise<void>;\n\tdisposePlugin(id: string): Promise<void>;\n\t/** Synchronous cleanup for synchronous bootstrap factories only. */\n\tdisposePluginSync(id: string): void;\n\tlistTools(): readonly { name: string; definition: unknown; source: string; readonlySafe: boolean }[];\n\tlistCommands(): readonly { definition: CapabilityCommandDefinition; source: string }[];\n\tlistSkills(): readonly { definition: SkillDefinition; source: string }[];\n\tlistContributionPoints(): readonly {\n\t\tid: string;\n\t\tversion: number;\n\t\tschema: string;\n\t\tlifecycle: ContributionLifecycle;\n\t\towner: string;\n\t}[];\n\tlistContributions(pointId: string, version: number): readonly ContributionEntry[];\n\thasLifecycleEvent(id: string, version: number): boolean;\n\tdispatchLifecycle<TData>(request: LifecycleDispatchRequest<TData>): Promise<LifecycleDispatchResult<TData>>;\n\t/**\n\t * Record one startup plugin rejection (D-028): the rejection stays visible in\n\t * the inspector snapshot and, when defined, as a plugin.rejected@1 lifecycle\n\t * fact. Recording must never fail the remaining startup path.\n\t */\n\trecordPluginRejection(rejection: PluginRejection): Promise<void>;\n\tlistPluginCapabilities(options?: { kind?: PluginCapabilityDeclaration[\"kind\"] }): readonly {\n\t\tdeclaration: PluginCapabilityDeclaration;\n\t\towner: string;\n\t}[];\n\tvalidateExecutionFacts(facts: unknown): ExecutionFactsV1;\n\tvalidateRetrySchedule(schedule: unknown): RetryScheduleV1;\n\thasRetryPolicy(name: string): boolean;\n\tclassifyRetry(name: string, request: RetryClassificationRequest): Promise<boolean>;\n\tdecideRetry(name: string, request: RetryPolicyRequest): Promise<RetryPolicyDecision>;\n\thasCompactionPolicy(name: string): boolean;\n\tdecideCompaction(name: string, request: CompactionPolicyRequest): Promise<CompactionPolicyDecision>;\n\tprepareCompaction(name: string, request: CompactionPreparationRequest): Promise<unknown | undefined>;\n\tsummarizeCompaction(name: string, request: CompactionSummaryRequest): Promise<CompactionSummaryResult>;\n\thasOverflowPolicy(name: string): boolean;\n\tdecideOverflow(name: string, request: OverflowPolicyRequest): Promise<OverflowPolicyDecision>;\n\thasBranchSummaryPolicy(name: string): boolean;\n\tsummarizeBranch(\n\t\tname: string,\n\t\trequest: Parameters<BranchSummaryPolicy[\"summarize\"]>[0],\n\t): Promise<BranchSummaryResult>;\n\t/** Ordered loop-hook links for one position, filtered by active owners, in registration order. */\n\tgetLoopHookChain<P extends AgentLoopHookPositionV1>(position: P): readonly AgentLoopHookForV1<P>[];\n\thasRunLoopStrategy(name: string): boolean;\n\tdecideRunLoop(name: string, request: AgentRunLoopStrategyRequestV1): Promise<AgentRunLoopStrategyDecisionV1>;\n\t/**\n\t * 活跃后台委派数(设计 子代理运行时 §4.2 中断分级,2026-10-02):活任务\n\t * 集合(创建即入;终态经投影按状态过滤,成员随 dispose 释放)的有界投影,供宿主做 Esc 分级提示与\n\t * /stop-agents 反馈;无 agents feature 的 runtime 恒为 0。\n\t */\n\tgetActiveAgentTaskCount(): number;\n\tinvokeTool(name: string, input: unknown, options?: { readonly signal?: AbortSignal }): Promise<unknown>;\n\thasCommand(name: string): boolean;\n\tinvokeCommand(\n\t\tname: string,\n\t\targs: string,\n\t\toptions?: CapabilityCommandContext,\n\t): Promise<CapabilityCommandResult | undefined>;\n\thasRpcMethod(name: string): boolean;\n\tdispatchRpc(name: string, input: unknown): Promise<unknown>;\n\thasContextStrategy(name: string): boolean;\n\ttransformContext(name: string, context: unknown, options?: ContextOperationOptions): Promise<unknown>;\n\tsnapshotContext(name: string, context: unknown, options?: ContextOperationOptions): Promise<unknown>;\n\trestoreContext(name: string, snapshot: unknown, options?: ContextOperationOptions): Promise<unknown>;\n\treplaceContext(name: string, context: unknown, options?: ContextOperationOptions): Promise<unknown>;\n\ttransformProviderHeaders(request: ProviderHeaderTransformRequest): Promise<Record<string, string | null>>;\n\t/**\n\t * Ordered stream-function wrappers registered through the public\n\t * `registerStreamFnWrapper` face (provider-failover family), filtered by\n\t * active owners, sorted by (priority ascending, registration order\n\t * ascending) — lower priority wraps outermost; equal priorities keep\n\t * registration order (first registered = outermost), the pre-priority\n\t * semantics (contract A, D-082 批 3b). The host's default stream assembly\n\t * composes them around its own stream call at request time.\n\t */\n\tgetStreamFnWrappers(): readonly StreamFnWrapper[];\n\tgetOperationStatus(id: string): OperationStatus | undefined;\n\tdrainLifecycleDeliveries(): Promise<void>;\n\tinspect(): RuntimeInspectorSnapshot;\n}\n\n/**\n * Mutable state container shared by the capability runtime entry, the lifecycle\n * dispatch module, and the runtime inspector. Field order is irrelevant; every\n * map, set, and array is created once per runtime and mutated in place.\n */\nexport interface CapabilityRuntimeState {\n\treadonly tools: Map<string, RegisteredCapability<unknown>>;\n\treadonly skills: Map<string, RegisteredCapability<SkillDefinition>>;\n\treadonly retryPolicies: Map<string, RegisteredCapability<RetryPolicy>>;\n\treadonly compactionPolicies: Map<string, RegisteredCapability<CompactionPolicy>>;\n\treadonly overflowPolicies: Map<string, RegisteredCapability<OverflowPolicy>>;\n\treadonly branchSummaryPolicies: Map<string, RegisteredCapability<BranchSummaryPolicy>>;\n\treadonly runLoopStrategies: Map<string, RegisteredCapability<AgentRunLoopStrategyV1>>;\n\treadonly loopHooks: Map<AgentLoopHookPositionV1, RegisteredCapability<AgentLoopHookHandlerV1>[]>;\n\treadonly commands: Map<string, RegisteredCapability<CapabilityCommandDefinition>>;\n\treadonly operations: Map<string, RegisteredCapability<OperationHandler>>;\n\treadonly rpcMethods: Map<string, RegisteredCapability<(input: unknown) => unknown | Promise<unknown>>>;\n\treadonly contextStrategies: Map<string, RegisteredCapability<ContextStrategy>>;\n\treadonly pluginCapabilities: Map<string, RegisteredPluginCapability>;\n\treadonly providerHeaderTransforms: Map<string, RegisteredCapability<ProviderHeaderTransform>>;\n\treadonly streamFnWrappers: Map<string, RegisteredCapability<StreamFnWrapper>>;\n\treadonly contributionPoints: Map<string, StoredContributionPoint<unknown>>;\n\treadonly lifecycleDefinitions: Map<string, StoredLifecycleDefinition>;\n\treadonly lifecycleRegistrations: Map<string, Map<string, StoredLifecycleRegistration>>;\n\treadonly subscribers: Map<string, Map<string, RegisteredCapability<(event: EventEnvelope) => void | Promise<void>>>>;\n\treadonly statuses: Map<string, OperationStatus>;\n\treadonly activeOperationsByOwnerToken: Map<symbol, Set<OperationHandle<unknown>>>;\n\treadonly pluginRegistrations: Map<string, Set<DisposableRegistration>>;\n\treadonly apiStates: Map<CapabilityAPI, APIState>;\n\treadonly activeOwnerTokens: Set<symbol>;\n\treadonly outputArtifacts: Map<string, StoredOutputArtifact>;\n\treadonly stateByOwner: Map<string, Map<string, StoredState>>;\n\treadonly stateRevisionsByOwner: Map<string, Map<string, number>>;\n\treadonly stateWatchers: Map<string, Map<string, StateWatcher>>;\n\t/** Instance-private state namespaces keyed by owner, then instance id; cleared on instance disposal. */\n\treadonly stateByInstance: Map<string, Map<string, Map<string, StoredState>>>;\n\treadonly stateRevisionsByInstance: Map<string, Map<string, Map<string, number>>>;\n\treadonly stateWatchersByInstance: Map<string, Map<string, Map<string, StateWatcher>>>;\n\treadonly logs: LoggerRecord[];\n\treadonly spans: Map<string, DiagnosticsSpanSnapshot>;\n\treadonly lifecycleReports: RuntimeInspectorLifecycleDeliveryReportSnapshot[];\n\treadonly lifecycleDeliveryQueues: Set<LifecycleDeliveryQueue<QueuedLifecycleDelivery<unknown>>>;\n\treadonly pluginRejections: PluginRejection[];\n\t/** Lifecycle event sequence; incremented by both the runtime entry and the dispatch module. */\n\teventSequence: number;\n}\n"]}
1
+ {"version":3,"file":"capability-runtime-types.d.ts","sourceRoot":"","sources":["../../../src/core/extensions/capability-runtime-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,KAAK,EAAE,0BAA0B,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAC3G,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAC5E,OAAO,KAAK,EACX,mBAAmB,EACnB,eAAe,EACf,aAAa,EACb,kBAAkB,EAClB,sBAAsB,EACtB,uBAAuB,EACvB,4BAA4B,EAC5B,8BAA8B,EAC9B,6BAA6B,EAC7B,sBAAsB,EACtB,gBAAgB,EAChB,yBAAyB,EACzB,sBAAsB,EACtB,mBAAmB,EACnB,mBAAmB,EACnB,aAAa,EACb,wBAAwB,EACxB,2BAA2B,EAC3B,uBAAuB,EACvB,yBAAyB,EACzB,qBAAqB,EACrB,gBAAgB,EAChB,wBAAwB,EACxB,uBAAuB,EACvB,4BAA4B,EAC5B,wBAAwB,EACxB,uBAAuB,EACvB,uBAAuB,EACvB,eAAe,EACf,uBAAuB,EACvB,iBAAiB,EACjB,qBAAqB,EACrB,2BAA2B,EAC3B,aAAa,EACb,uBAAuB,EACvB,sBAAsB,EACtB,aAAa,EACb,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EACjB,2BAA2B,EAC3B,yBAAyB,EACzB,wBAAwB,EACxB,uBAAuB,EACvB,cAAc,EACd,wBAAwB,EACxB,uBAAuB,EACvB,uBAAuB,EACvB,yBAAyB,EACzB,yBAAyB,EACzB,YAAY,EACZ,yBAAyB,EACzB,eAA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AG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACjE,QAAQ,CAAC,aAAa,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC;IAC/D,wGAAwG;IACxG,QAAQ,CAAC,eAAe,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC;IAC7E,QAAQ,CAAC,wBAAwB,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;IACjF,QAAQ,CAAC,uBAAuB,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC;IACtF,QAAQ,CAAC,IAAI,EAAE,YAAY,EAAE,CAAC;IAC9B,QAAQ,CAAC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,uBAAuB,CAAC,CAAC;IACrD,QAAQ,CAAC,gBAAgB,EAAE,+CAA+C,EAAE,CAAC;IAC7E,QAAQ,CAAC,uBAAuB,EAAE,GAAG,CAAC,sBAAsB,CAAC,uBAAuB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAChG,QAAQ,CAAC,gBAAgB,EAAE,eAAe,EAAE,CAAC;IAC7C,+FAA+F;IAC/F,aAAa,EAAE,MAAM,CAAC;CACtB","sourcesContent":["import type { DurableServiceV1 } from \"../../durable/durable-service.ts\";\nimport type { ObservabilityHostAdapterV1, TraceSinkOptionsV1 } from \"../../plugins/observability-types.ts\";\nimport type { LifecycleDeliveryQueue } from \"./lifecycle-delivery-queue.ts\";\nimport type {\n\tAgentCompositionAPI,\n\tAgentDefinition,\n\tAgentInstance,\n\tAgentLoopHookForV1,\n\tAgentLoopHookHandlerV1,\n\tAgentLoopHookPositionV1,\n\tAgentModelInvocationResultV1,\n\tAgentRunLoopStrategyDecisionV1,\n\tAgentRunLoopStrategyRequestV1,\n\tAgentRunLoopStrategyV1,\n\tAgentTaskAdapter,\n\tAgentTaskSessionSummaryV1,\n\tAgentTaskSessionViewV1,\n\tBranchSummaryPolicy,\n\tBranchSummaryResult,\n\tCapabilityAPI,\n\tCapabilityCommandContext,\n\tCapabilityCommandDefinition,\n\tCapabilityCommandResult,\n\tCapabilityProviderHandler,\n\tCapabilityToolContext,\n\tCompactionPolicy,\n\tCompactionPolicyDecision,\n\tCompactionPolicyRequest,\n\tCompactionPreparationRequest,\n\tCompactionSummaryRequest,\n\tCompactionSummaryResult,\n\tContextOperationOptions,\n\tContextStrategy,\n\tContributionChangeEvent,\n\tContributionEntry,\n\tContributionLifecycle,\n\tContributionPointDefinition,\n\tCredentialAPI,\n\tDiagnosticsSpanSnapshot,\n\tDisposableRegistration,\n\tEventEnvelope,\n\tExecutionFactsV1,\n\tHostCapabilities,\n\tInteractionHostV1,\n\tLifecycleAfterCommitHandler,\n\tLifecycleDeliverySnapshot,\n\tLifecycleDispatchRequest,\n\tLifecycleDispatchResult,\n\tLifecycleEvent,\n\tLifecycleEventDefinition,\n\tLifecycleExecuteHandler,\n\tLifecycleObserveHandler,\n\tLifecycleRegistrationKind,\n\tLifecycleTransformHandler,\n\tLoggerRecord,\n\tOperationExecutionContext,\n\tOperationHandle,\n\tOperationStatus,\n\tOutputArtifactRef,\n\tOverflowPolicy,\n\tOverflowPolicyDecision,\n\tOverflowPolicyRequest,\n\tPluginCapabilityDeclaration,\n\tPluginConfigValue,\n\tPluginManifest,\n\tPluginRejection,\n\tProviderHeaderTransform,\n\tProviderHeaderTransformRequest,\n\tRetryClassificationRequest,\n\tRetryPolicy,\n\tRetryPolicyDecision,\n\tRetryPolicyRequest,\n\tRetryScheduleV1,\n\tRuntimeInspectorLifecycleDeliveryReportSnapshot,\n\tRuntimeInspectorSnapshot,\n\tSessionAPI,\n\tSkillDefinition,\n\tStateChange,\n\tStreamFnWrapper,\n} from \"./public-api.ts\";\n\n/** Host trace service injection (D-075 S4 second batch observability host contract). */\nexport interface TraceServiceV1 {\n\treadonly adapter: ObservabilityHostAdapterV1;\n\treadonly options?: TraceSinkOptionsV1;\n}\n\nexport type OperationHandler = (input: unknown, context: OperationExecutionContext) => unknown | Promise<unknown>;\n\nexport interface CapabilityRuntimeOptions {\n\tclock?: () => number;\n\t/** Test-only override for generated runtime identifiers; omitted in production. */\n\tidFactory?: (kind: string, sequence: number) => string;\n\t/** Test-only observer for every lifecycle dispatch, including detached runtime facts. */\n\tonLifecycleDispatch?: (\n\t\trequest: LifecycleDispatchRequest<unknown>,\n\t\tsettled: Promise<LifecycleDispatchResult<unknown>>,\n\t) => void;\n\t/** Observes each committed output artifact; host adapters may mirror it into durable storage. The runtime stays storage-agnostic. */\n\tonOutputArtifactCommit?: (artifact: { readonly ref: OutputArtifactRef; readonly bytes: Uint8Array }) => void;\n\t/**\n\t * 运行时工具表变更钩子:工具表发生任何变更(注册、同名替换、卸载、替换链恢复,\n\t * 以及插件装卸引发的表变更)后同步调用一次。缺省不传 = 行为不变;回调异常经\n\t * 运行时既有错误通道记录,不打断注册本身。\n\t */\n\tonToolRegistryChange?: () => void;\n\t/**\n\t * 运行时 invoke 面传给工具 execute 的第二参上下文(additive;现有单参工具不受\n\t * 影响)。宿主注入后,经 runtime.invokeTool 调用的工具收到 `{ cwd }`(与会话\n\t * cwd 同源,对应命令面 CapabilityCommandContext.cwd);未注入时第二参保持 undefined。\n\t */\n\ttoolExecutionContext?: CapabilityToolContext;\n\t/**\n\t * 插件日志记录宿主转发通道(会话轨迹 plugin.log 镜像,设计 §5.3/§7.2):每条\n\t * 经 LoggerAPI 写入并通过校验的记录在入运行时内存环后同步转发一次。回调契约:\n\t * 回调内不得调用 LoggerAPI(防自递归);回调抛错由运行时直接吞掉,不打断\n\t * 调用方,也绝不经 recordLog 再记录。缺省不传 = 行为不变。\n\t */\n\tonLogRecord?: (record: LoggerRecord) => void;\n\tsession?: SessionAPI;\n\tagents?: AgentTaskAdapter;\n\t/**\n\t * 会话回读器(D-060 S2/S3):宿主注入后 `api.agents.session(sessionId)` 才存在。\n\t * 作用域(只放行本会话的子会话)由宿主在读取器内部强制;内核不做假设。\n\t */\n\tagentSessionReader?: (sessionId: string) => Promise<AgentTaskSessionViewV1 | undefined>;\n\t/**\n\t * 列出宿主会话**自己的**子代理会话摘要(按最近活动倒序,D-060 模型面盘点通道)。\n\t * 注入后 `agents.list()` 才存在;作用域由宿主强制(宿主只回自己会话的子会话)。\n\t */\n\tagentSessionLister?: () => Promise<AgentTaskSessionSummaryV1[]>;\n\t/**\n\t * Durable replay channel for agent task terminal outcomes. When present,\n\t * every settle persists a frozen record under the deterministic artifact id\n\t * `agent-task:<taskId>`; `api.agents.result(taskId)` reads it back across\n\t * runtime rebuilds. The host owns the writer claim lifecycle: the writer\n\t * must have claimed on the store before the first settle, or persist fails\n\t * loudly with the store's `not_writer` error.\n\t */\n\tagentResults?: {\n\t\treadonly store: DurableServiceV1;\n\t\treadonly writerId: string;\n\t};\n\tcredentials?: CredentialAPI;\n\tinteraction?: InteractionHostV1;\n\tcomposition?: AgentCompositionAPI;\n\t/** Host-provided model runtime for agent-composition model/tool facades. */\n\tmodelRuntime?: {\n\t\t/** Provider-agnostic facts about the current session model. */\n\t\tgetModelFacts():\n\t\t\t| { provider: string; id: string; contextWindow: number; maxTokens: number; reasoning: boolean }\n\t\t\t| undefined;\n\t\t/** Single-shot model invocation. The host resolves model, auth, transport and cache routing. */\n\t\tinvoke: (\n\t\t\tinput: { systemPrompt?: string; prompt: string; maxTokens?: number; thinkingLevel?: string },\n\t\t\toptions?: { signal?: AbortSignal },\n\t\t) => Promise<AgentModelInvocationResultV1>;\n\t};\n\t/**\n\t * Parent-session cancel fence (D-044 §4.2). Consulted once per agent-task\n\t * creation: the returned signal (when present) cancels that task if it fires,\n\t * or immediately cancels tasks created after it already fired. The host\n\t * refreshes the fence epoch so tasks submitted after an aborted turn bind to\n\t * the next signal instead of an already-spent one. Absent = no cascade.\n\t */\n\tparentSignal?: () => AbortSignal | undefined;\n\t/**\n\t * Host trace service (D-075 S4 second batch): injected on hosts running\n\t * session trace collection. Exposed to plugins as `api.trace` (the\n\t * adapter) plus `api.traceSinkOptions`; absent = plugins see neither and\n\t * stay trace-free.\n\t */\n\ttrace?: TraceServiceV1;\n}\n\nexport interface RegisteredCapability<T> {\n\towner: string;\n\townerToken: symbol;\n\tvalue: T;\n}\n\nexport interface RegisteredPluginCapability {\n\tdeclaration: PluginCapabilityDeclaration;\n\towner: string;\n\townerToken: symbol;\n\thandler: CapabilityProviderHandler;\n}\n\nexport interface APIState {\n\tactive: boolean;\n\towner: string;\n\townerToken: symbol;\n\tcompositionInstances?: Set<AgentInstance>;\n\tcompositionDefinitions?: Set<AgentDefinition>;\n}\n\n/**\n * output.put 驻留缓冲上限(M4 双层限额的缓冲半层):单个输出工件的内存驻留\n * 封顶。超限后停止继续缓冲(AsyncIterable 仍完整消费,只丢弃数据),驻留视图\n * 变为 head + 截断标记 + 完整流末尾 64 KiB tail;ref.sizeBytes/truncated 由\n * 运行时计算(sizeBytes 恒为原始总字节数),commit 观察者只收截断视图。\n */\nexport const OUTPUT_ARTIFACT_MAX_BUFFER_BYTES = 1024 * 1024;\n\nexport interface StoredOutputArtifact {\n\tref: OutputArtifactRef;\n\tbytes: Uint8Array;\n\townerToken: symbol;\n}\n\nexport interface StoredContributionPoint<TValue = unknown> {\n\towner: string;\n\townerToken: symbol;\n\tdefinition: ContributionPointDefinition<TValue>;\n\tentries: Map<string, StoredContributionEntry<TValue>>;\n\tsubscribers: Map<\n\t\tstring,\n\t\t{ ownerToken: symbol; handler: (event: ContributionChangeEvent<TValue>) => void | Promise<void> }\n\t>;\n}\n\nexport interface StoredContributionEntry<TValue = unknown> extends ContributionEntry<TValue> {\n\townerToken: symbol;\n}\n\nexport interface StoredLifecycleDefinition<TData = unknown> {\n\towner: string;\n\townerToken: symbol;\n\tdefinition: LifecycleEventDefinition<TData>;\n}\n\nexport interface StoredLifecycleRegistration<TData = unknown> {\n\tid: string;\n\towner: string;\n\townerToken: symbol;\n\tkind: LifecycleRegistrationKind;\n\tsequence: number;\n\thandler:\n\t\t| LifecycleObserveHandler<TData>\n\t\t| LifecycleTransformHandler<TData>\n\t\t| LifecycleExecuteHandler<TData>\n\t\t| LifecycleAfterCommitHandler<TData>;\n\tdelivery: LifecycleDeliverySnapshot;\n\tqueue?: LifecycleDeliveryQueue<QueuedLifecycleDelivery<TData>>;\n}\n\nexport interface QueuedLifecycleDelivery<TData> {\n\treadonly event: LifecycleEvent<TData>;\n\treadonly signal?: AbortSignal;\n}\n\nexport interface StoredState {\n\tvalue: PluginConfigValue;\n\trevision: number;\n}\n\nexport interface StateWatcher {\n\towner: string;\n\townerToken: symbol;\n\tprefix?: string;\n\thandler: (change: StateChange) => void;\n}\n\n/**\n * Terminal statuses the runtime executor itself can produce. `timed_out` is\n * excluded: the executor has no watchdog — a caller-imposed deadline aborts\n * through cancel() and settles cancelled, while a host-declared timed_out\n * enters only through the public contract's complete() path (D-043).\n */\nexport type OperationTerminalStatus = Exclude<OperationStatus, \"queued\" | \"running\" | \"timed_out\">;\n\nexport interface CapabilityRuntime {\n\treadonly host: HostCapabilities;\n\tresolvePluginCapabilityOrder(manifests: readonly PluginManifest[]): readonly PluginManifest[];\n\tcreateAPI(manifest: PluginManifest): CapabilityAPI;\n\trevokeAPI(api: CapabilityAPI): void;\n\t/** Revoke every API produced by this runtime, including direct host-created APIs. */\n\trevokeAllAPIs(): void;\n\t/** Revoke APIs and await disposal of every registration owned by this runtime. */\n\tdisposeAll(): Promise<void>;\n\tdisposePlugin(id: string): Promise<void>;\n\t/** Synchronous cleanup for synchronous bootstrap factories only. */\n\tdisposePluginSync(id: string): void;\n\tlistTools(): readonly { name: string; definition: unknown; source: string; readonlySafe: boolean }[];\n\tlistCommands(): readonly { definition: CapabilityCommandDefinition; source: string }[];\n\tlistSkills(): readonly { definition: SkillDefinition; source: string }[];\n\tlistContributionPoints(): readonly {\n\t\tid: string;\n\t\tversion: number;\n\t\tschema: string;\n\t\tlifecycle: ContributionLifecycle;\n\t\towner: string;\n\t}[];\n\tlistContributions(pointId: string, version: number): readonly ContributionEntry[];\n\thasLifecycleEvent(id: string, version: number): boolean;\n\t/**\n\t * Whether at least one lifecycle registration currently exists for the event\n\t * key (registration-map presence; owner activity is rechecked at delivery).\n\t * Hot-path gate for per-delta producers (model.stream): lets the host skip\n\t * envelope snapshot and clone work when nothing observes the event.\n\t */\n\thasLifecycleSubscribers(type: string, version: number): boolean;\n\tdispatchLifecycle<TData>(request: LifecycleDispatchRequest<TData>): Promise<LifecycleDispatchResult<TData>>;\n\t/**\n\t * Record one startup plugin rejection (D-028): the rejection stays visible in\n\t * the inspector snapshot and, when defined, as a plugin.rejected@1 lifecycle\n\t * fact. Recording must never fail the remaining startup path.\n\t */\n\trecordPluginRejection(rejection: PluginRejection): Promise<void>;\n\tlistPluginCapabilities(options?: { kind?: PluginCapabilityDeclaration[\"kind\"] }): readonly {\n\t\tdeclaration: PluginCapabilityDeclaration;\n\t\towner: string;\n\t}[];\n\tvalidateExecutionFacts(facts: unknown): ExecutionFactsV1;\n\tvalidateRetrySchedule(schedule: unknown): RetryScheduleV1;\n\thasRetryPolicy(name: string): boolean;\n\tclassifyRetry(name: string, request: RetryClassificationRequest): Promise<boolean>;\n\tdecideRetry(name: string, request: RetryPolicyRequest): Promise<RetryPolicyDecision>;\n\thasCompactionPolicy(name: string): boolean;\n\tdecideCompaction(name: string, request: CompactionPolicyRequest): Promise<CompactionPolicyDecision>;\n\tprepareCompaction(name: string, request: CompactionPreparationRequest): Promise<unknown | undefined>;\n\tsummarizeCompaction(name: string, request: CompactionSummaryRequest): Promise<CompactionSummaryResult>;\n\thasOverflowPolicy(name: string): boolean;\n\tdecideOverflow(name: string, request: OverflowPolicyRequest): Promise<OverflowPolicyDecision>;\n\thasBranchSummaryPolicy(name: string): boolean;\n\tsummarizeBranch(\n\t\tname: string,\n\t\trequest: Parameters<BranchSummaryPolicy[\"summarize\"]>[0],\n\t): Promise<BranchSummaryResult>;\n\t/** Ordered loop-hook links for one position, filtered by active owners, in registration order. */\n\tgetLoopHookChain<P extends AgentLoopHookPositionV1>(position: P): readonly AgentLoopHookForV1<P>[];\n\thasRunLoopStrategy(name: string): boolean;\n\tdecideRunLoop(name: string, request: AgentRunLoopStrategyRequestV1): Promise<AgentRunLoopStrategyDecisionV1>;\n\t/**\n\t * 活跃后台委派数(设计 子代理运行时 §4.2 中断分级,2026-10-02):活任务\n\t * 集合(创建即入;终态经投影按状态过滤,成员随 dispose 释放)的有界投影,供宿主做 Esc 分级提示与\n\t * /stop-agents 反馈;无 agents feature 的 runtime 恒为 0。\n\t */\n\tgetActiveAgentTaskCount(): number;\n\tinvokeTool(name: string, input: unknown, options?: { readonly signal?: AbortSignal }): Promise<unknown>;\n\thasCommand(name: string): boolean;\n\tinvokeCommand(\n\t\tname: string,\n\t\targs: string,\n\t\toptions?: CapabilityCommandContext,\n\t): Promise<CapabilityCommandResult | undefined>;\n\thasRpcMethod(name: string): boolean;\n\tdispatchRpc(name: string, input: unknown): Promise<unknown>;\n\thasContextStrategy(name: string): boolean;\n\ttransformContext(name: string, context: unknown, options?: ContextOperationOptions): Promise<unknown>;\n\tsnapshotContext(name: string, context: unknown, options?: ContextOperationOptions): Promise<unknown>;\n\trestoreContext(name: string, snapshot: unknown, options?: ContextOperationOptions): Promise<unknown>;\n\treplaceContext(name: string, context: unknown, options?: ContextOperationOptions): Promise<unknown>;\n\ttransformProviderHeaders(request: ProviderHeaderTransformRequest): Promise<Record<string, string | null>>;\n\t/**\n\t * Ordered stream-function wrappers registered through the public\n\t * `registerStreamFnWrapper` face (provider-failover family), filtered by\n\t * active owners, sorted by (priority ascending, registration order\n\t * ascending) — lower priority wraps outermost; equal priorities keep\n\t * registration order (first registered = outermost), the pre-priority\n\t * semantics (contract A, D-082 批 3b). The host's default stream assembly\n\t * composes them around its own stream call at request time.\n\t */\n\tgetStreamFnWrappers(): readonly StreamFnWrapper[];\n\tgetOperationStatus(id: string): OperationStatus | undefined;\n\tdrainLifecycleDeliveries(): Promise<void>;\n\tinspect(): RuntimeInspectorSnapshot;\n}\n\n/**\n * Mutable state container shared by the capability runtime entry, the lifecycle\n * dispatch module, and the runtime inspector. Field order is irrelevant; every\n * map, set, and array is created once per runtime and mutated in place.\n */\nexport interface CapabilityRuntimeState {\n\treadonly tools: Map<string, RegisteredCapability<unknown>>;\n\treadonly skills: Map<string, RegisteredCapability<SkillDefinition>>;\n\treadonly retryPolicies: Map<string, RegisteredCapability<RetryPolicy>>;\n\treadonly compactionPolicies: Map<string, RegisteredCapability<CompactionPolicy>>;\n\treadonly overflowPolicies: Map<string, RegisteredCapability<OverflowPolicy>>;\n\treadonly branchSummaryPolicies: Map<string, RegisteredCapability<BranchSummaryPolicy>>;\n\treadonly runLoopStrategies: Map<string, RegisteredCapability<AgentRunLoopStrategyV1>>;\n\treadonly loopHooks: Map<AgentLoopHookPositionV1, RegisteredCapability<AgentLoopHookHandlerV1>[]>;\n\treadonly commands: Map<string, RegisteredCapability<CapabilityCommandDefinition>>;\n\treadonly operations: Map<string, RegisteredCapability<OperationHandler>>;\n\treadonly rpcMethods: Map<string, RegisteredCapability<(input: unknown) => unknown | Promise<unknown>>>;\n\treadonly contextStrategies: Map<string, RegisteredCapability<ContextStrategy>>;\n\treadonly pluginCapabilities: Map<string, RegisteredPluginCapability>;\n\treadonly providerHeaderTransforms: Map<string, RegisteredCapability<ProviderHeaderTransform>>;\n\treadonly streamFnWrappers: Map<string, RegisteredCapability<StreamFnWrapper>>;\n\treadonly contributionPoints: Map<string, StoredContributionPoint<unknown>>;\n\treadonly lifecycleDefinitions: Map<string, StoredLifecycleDefinition>;\n\treadonly lifecycleRegistrations: Map<string, Map<string, StoredLifecycleRegistration>>;\n\treadonly subscribers: Map<string, Map<string, RegisteredCapability<(event: EventEnvelope) => void | Promise<void>>>>;\n\treadonly statuses: Map<string, OperationStatus>;\n\treadonly activeOperationsByOwnerToken: Map<symbol, Set<OperationHandle<unknown>>>;\n\treadonly pluginRegistrations: Map<string, Set<DisposableRegistration>>;\n\treadonly apiStates: Map<CapabilityAPI, APIState>;\n\treadonly activeOwnerTokens: Set<symbol>;\n\treadonly outputArtifacts: Map<string, StoredOutputArtifact>;\n\treadonly stateByOwner: Map<string, Map<string, StoredState>>;\n\treadonly stateRevisionsByOwner: Map<string, Map<string, number>>;\n\treadonly stateWatchers: Map<string, Map<string, StateWatcher>>;\n\t/** Instance-private state namespaces keyed by owner, then instance id; cleared on instance disposal. */\n\treadonly stateByInstance: Map<string, Map<string, Map<string, StoredState>>>;\n\treadonly stateRevisionsByInstance: Map<string, Map<string, Map<string, number>>>;\n\treadonly stateWatchersByInstance: Map<string, Map<string, Map<string, StateWatcher>>>;\n\treadonly logs: LoggerRecord[];\n\treadonly spans: Map<string, DiagnosticsSpanSnapshot>;\n\treadonly lifecycleReports: RuntimeInspectorLifecycleDeliveryReportSnapshot[];\n\treadonly lifecycleDeliveryQueues: Set<LifecycleDeliveryQueue<QueuedLifecycleDelivery<unknown>>>;\n\treadonly pluginRejections: PluginRejection[];\n\t/** Lifecycle event sequence; incremented by both the runtime entry and the dispatch module. */\n\teventSequence: number;\n}\n"]}
@@ -1,2 +1,8 @@
1
- export {};
1
+ /**
2
+ * output.put 驻留缓冲上限(M4 双层限额的缓冲半层):单个输出工件的内存驻留
3
+ * 封顶。超限后停止继续缓冲(AsyncIterable 仍完整消费,只丢弃数据),驻留视图
4
+ * 变为 head + 截断标记 + 完整流末尾 64 KiB tail;ref.sizeBytes/truncated 由
5
+ * 运行时计算(sizeBytes 恒为原始总字节数),commit 观察者只收截断视图。
6
+ */
7
+ export const OUTPUT_ARTIFACT_MAX_BUFFER_BYTES = 1024 * 1024;
2
8
  //# sourceMappingURL=capability-runtime-types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"capability-runtime-types.js","sourceRoot":"","sources":["../../../src/core/extensions/capability-runtime-types.ts"],"names":[],"mappings":"","sourcesContent":["import type { DurableServiceV1 } from \"../../durable/durable-service.ts\";\nimport type { ObservabilityHostAdapterV1, TraceSinkOptionsV1 } from \"../../plugins/observability-types.ts\";\nimport type { LifecycleDeliveryQueue } from \"./lifecycle-delivery-queue.ts\";\nimport type {\n\tAgentCompositionAPI,\n\tAgentDefinition,\n\tAgentInstance,\n\tAgentLoopHookForV1,\n\tAgentLoopHookHandlerV1,\n\tAgentLoopHookPositionV1,\n\tAgentModelInvocationResultV1,\n\tAgentRunLoopStrategyDecisionV1,\n\tAgentRunLoopStrategyRequestV1,\n\tAgentRunLoopStrategyV1,\n\tAgentTaskAdapter,\n\tAgentTaskSessionSummaryV1,\n\tAgentTaskSessionViewV1,\n\tBranchSummaryPolicy,\n\tBranchSummaryResult,\n\tCapabilityAPI,\n\tCapabilityCommandContext,\n\tCapabilityCommandDefinition,\n\tCapabilityCommandResult,\n\tCapabilityProviderHandler,\n\tCapabilityToolContext,\n\tCompactionPolicy,\n\tCompactionPolicyDecision,\n\tCompactionPolicyRequest,\n\tCompactionPreparationRequest,\n\tCompactionSummaryRequest,\n\tCompactionSummaryResult,\n\tContextOperationOptions,\n\tContextStrategy,\n\tContributionChangeEvent,\n\tContributionEntry,\n\tContributionLifecycle,\n\tContributionPointDefinition,\n\tCredentialAPI,\n\tDiagnosticsSpanSnapshot,\n\tDisposableRegistration,\n\tEventEnvelope,\n\tExecutionFactsV1,\n\tHostCapabilities,\n\tInteractionHostV1,\n\tLifecycleAfterCommitHandler,\n\tLifecycleDeliverySnapshot,\n\tLifecycleDispatchRequest,\n\tLifecycleDispatchResult,\n\tLifecycleEvent,\n\tLifecycleEventDefinition,\n\tLifecycleExecuteHandler,\n\tLifecycleObserveHandler,\n\tLifecycleRegistrationKind,\n\tLifecycleTransformHandler,\n\tLoggerRecord,\n\tOperationExecutionContext,\n\tOperationHandle,\n\tOperationStatus,\n\tOutputArtifactRef,\n\tOverflowPolicy,\n\tOverflowPolicyDecision,\n\tOverflowPolicyRequest,\n\tPluginCapabilityDeclaration,\n\tPluginConfigValue,\n\tPluginManifest,\n\tPluginRejection,\n\tProviderHeaderTransform,\n\tProviderHeaderTransformRequest,\n\tRetryClassificationRequest,\n\tRetryPolicy,\n\tRetryPolicyDecision,\n\tRetryPolicyRequest,\n\tRetryScheduleV1,\n\tRuntimeInspectorLifecycleDeliveryReportSnapshot,\n\tRuntimeInspectorSnapshot,\n\tSessionAPI,\n\tSkillDefinition,\n\tStateChange,\n\tStreamFnWrapper,\n} from \"./public-api.ts\";\n\n/** Host trace service injection (D-075 S4 second batch observability host contract). */\nexport interface TraceServiceV1 {\n\treadonly adapter: ObservabilityHostAdapterV1;\n\treadonly options?: TraceSinkOptionsV1;\n}\n\nexport type OperationHandler = (input: unknown, context: OperationExecutionContext) => unknown | Promise<unknown>;\n\nexport interface CapabilityRuntimeOptions {\n\tclock?: () => number;\n\t/** Test-only override for generated runtime identifiers; omitted in production. */\n\tidFactory?: (kind: string, sequence: number) => string;\n\t/** Test-only observer for every lifecycle dispatch, including detached runtime facts. */\n\tonLifecycleDispatch?: (\n\t\trequest: LifecycleDispatchRequest<unknown>,\n\t\tsettled: Promise<LifecycleDispatchResult<unknown>>,\n\t) => void;\n\t/** Observes each committed output artifact; host adapters may mirror it into durable storage. The runtime stays storage-agnostic. */\n\tonOutputArtifactCommit?: (artifact: { readonly ref: OutputArtifactRef; readonly bytes: Uint8Array }) => void;\n\t/**\n\t * 运行时工具表变更钩子:工具表发生任何变更(注册、同名替换、卸载、替换链恢复,\n\t * 以及插件装卸引发的表变更)后同步调用一次。缺省不传 = 行为不变;回调异常经\n\t * 运行时既有错误通道记录,不打断注册本身。\n\t */\n\tonToolRegistryChange?: () => void;\n\t/**\n\t * 运行时 invoke 面传给工具 execute 的第二参上下文(additive;现有单参工具不受\n\t * 影响)。宿主注入后,经 runtime.invokeTool 调用的工具收到 `{ cwd }`(与会话\n\t * cwd 同源,对应命令面 CapabilityCommandContext.cwd);未注入时第二参保持 undefined。\n\t */\n\ttoolExecutionContext?: CapabilityToolContext;\n\t/**\n\t * 插件日志记录宿主转发通道(会话轨迹 plugin.log 镜像,设计 §5.3/§7.2):每条\n\t * 经 LoggerAPI 写入并通过校验的记录在入运行时内存环后同步转发一次。回调契约:\n\t * 回调内不得调用 LoggerAPI(防自递归);回调抛错由运行时直接吞掉,不打断\n\t * 调用方,也绝不经 recordLog 再记录。缺省不传 = 行为不变。\n\t */\n\tonLogRecord?: (record: LoggerRecord) => void;\n\tsession?: SessionAPI;\n\tagents?: AgentTaskAdapter;\n\t/**\n\t * 会话回读器(D-060 S2/S3):宿主注入后 `api.agents.session(sessionId)` 才存在。\n\t * 作用域(只放行本会话的子会话)由宿主在读取器内部强制;内核不做假设。\n\t */\n\tagentSessionReader?: (sessionId: string) => Promise<AgentTaskSessionViewV1 | undefined>;\n\t/**\n\t * 列出宿主会话**自己的**子代理会话摘要(按最近活动倒序,D-060 模型面盘点通道)。\n\t * 注入后 `agents.list()` 才存在;作用域由宿主强制(宿主只回自己会话的子会话)。\n\t */\n\tagentSessionLister?: () => Promise<AgentTaskSessionSummaryV1[]>;\n\t/**\n\t * Durable replay channel for agent task terminal outcomes. When present,\n\t * every settle persists a frozen record under the deterministic artifact id\n\t * `agent-task:<taskId>`; `api.agents.result(taskId)` reads it back across\n\t * runtime rebuilds. The host owns the writer claim lifecycle: the writer\n\t * must have claimed on the store before the first settle, or persist fails\n\t * loudly with the store's `not_writer` error.\n\t */\n\tagentResults?: {\n\t\treadonly store: DurableServiceV1;\n\t\treadonly writerId: string;\n\t};\n\tcredentials?: CredentialAPI;\n\tinteraction?: InteractionHostV1;\n\tcomposition?: AgentCompositionAPI;\n\t/** Host-provided model runtime for agent-composition model/tool facades. */\n\tmodelRuntime?: {\n\t\t/** Provider-agnostic facts about the current session model. */\n\t\tgetModelFacts():\n\t\t\t| { provider: string; id: string; contextWindow: number; maxTokens: number; reasoning: boolean }\n\t\t\t| undefined;\n\t\t/** Single-shot model invocation. The host resolves model, auth, transport and cache routing. */\n\t\tinvoke: (\n\t\t\tinput: { systemPrompt?: string; prompt: string; maxTokens?: number; thinkingLevel?: string },\n\t\t\toptions?: { signal?: AbortSignal },\n\t\t) => Promise<AgentModelInvocationResultV1>;\n\t};\n\t/**\n\t * Parent-session cancel fence (D-044 §4.2). Consulted once per agent-task\n\t * creation: the returned signal (when present) cancels that task if it fires,\n\t * or immediately cancels tasks created after it already fired. The host\n\t * refreshes the fence epoch so tasks submitted after an aborted turn bind to\n\t * the next signal instead of an already-spent one. Absent = no cascade.\n\t */\n\tparentSignal?: () => AbortSignal | undefined;\n\t/**\n\t * Host trace service (D-075 S4 second batch): injected on hosts running\n\t * session trace collection. Exposed to plugins as `api.trace` (the\n\t * adapter) plus `api.traceSinkOptions`; absent = plugins see neither and\n\t * stay trace-free.\n\t */\n\ttrace?: TraceServiceV1;\n}\n\nexport interface RegisteredCapability<T> {\n\towner: string;\n\townerToken: symbol;\n\tvalue: T;\n}\n\nexport interface RegisteredPluginCapability {\n\tdeclaration: PluginCapabilityDeclaration;\n\towner: string;\n\townerToken: symbol;\n\thandler: CapabilityProviderHandler;\n}\n\nexport interface APIState {\n\tactive: boolean;\n\towner: string;\n\townerToken: symbol;\n\tcompositionInstances?: Set<AgentInstance>;\n\tcompositionDefinitions?: Set<AgentDefinition>;\n}\n\nexport interface StoredOutputArtifact {\n\tref: OutputArtifactRef;\n\tbytes: Uint8Array;\n\townerToken: symbol;\n}\n\nexport interface StoredContributionPoint<TValue = unknown> {\n\towner: string;\n\townerToken: symbol;\n\tdefinition: ContributionPointDefinition<TValue>;\n\tentries: Map<string, StoredContributionEntry<TValue>>;\n\tsubscribers: Map<\n\t\tstring,\n\t\t{ ownerToken: symbol; handler: (event: ContributionChangeEvent<TValue>) => void | Promise<void> }\n\t>;\n}\n\nexport interface StoredContributionEntry<TValue = unknown> extends ContributionEntry<TValue> {\n\townerToken: symbol;\n}\n\nexport interface StoredLifecycleDefinition<TData = unknown> {\n\towner: string;\n\townerToken: symbol;\n\tdefinition: LifecycleEventDefinition<TData>;\n}\n\nexport interface StoredLifecycleRegistration<TData = unknown> {\n\tid: string;\n\towner: string;\n\townerToken: symbol;\n\tkind: LifecycleRegistrationKind;\n\tsequence: number;\n\thandler:\n\t\t| LifecycleObserveHandler<TData>\n\t\t| LifecycleTransformHandler<TData>\n\t\t| LifecycleExecuteHandler<TData>\n\t\t| LifecycleAfterCommitHandler<TData>;\n\tdelivery: LifecycleDeliverySnapshot;\n\tqueue?: LifecycleDeliveryQueue<QueuedLifecycleDelivery<TData>>;\n}\n\nexport interface QueuedLifecycleDelivery<TData> {\n\treadonly event: LifecycleEvent<TData>;\n\treadonly signal?: AbortSignal;\n}\n\nexport interface StoredState {\n\tvalue: PluginConfigValue;\n\trevision: number;\n}\n\nexport interface StateWatcher {\n\towner: string;\n\townerToken: symbol;\n\tprefix?: string;\n\thandler: (change: StateChange) => void;\n}\n\n/**\n * Terminal statuses the runtime executor itself can produce. `timed_out` is\n * excluded: the executor has no watchdog — a caller-imposed deadline aborts\n * through cancel() and settles cancelled, while a host-declared timed_out\n * enters only through the public contract's complete() path (D-043).\n */\nexport type OperationTerminalStatus = Exclude<OperationStatus, \"queued\" | \"running\" | \"timed_out\">;\n\nexport interface CapabilityRuntime {\n\treadonly host: HostCapabilities;\n\tresolvePluginCapabilityOrder(manifests: readonly PluginManifest[]): readonly PluginManifest[];\n\tcreateAPI(manifest: PluginManifest): CapabilityAPI;\n\trevokeAPI(api: CapabilityAPI): void;\n\t/** Revoke every API produced by this runtime, including direct host-created APIs. */\n\trevokeAllAPIs(): void;\n\t/** Revoke APIs and await disposal of every registration owned by this runtime. */\n\tdisposeAll(): Promise<void>;\n\tdisposePlugin(id: string): Promise<void>;\n\t/** Synchronous cleanup for synchronous bootstrap factories only. */\n\tdisposePluginSync(id: string): void;\n\tlistTools(): readonly { name: string; definition: unknown; source: string; readonlySafe: boolean }[];\n\tlistCommands(): readonly { definition: CapabilityCommandDefinition; source: string }[];\n\tlistSkills(): readonly { definition: SkillDefinition; source: string }[];\n\tlistContributionPoints(): readonly {\n\t\tid: string;\n\t\tversion: number;\n\t\tschema: string;\n\t\tlifecycle: ContributionLifecycle;\n\t\towner: string;\n\t}[];\n\tlistContributions(pointId: string, version: number): readonly ContributionEntry[];\n\thasLifecycleEvent(id: string, version: number): boolean;\n\tdispatchLifecycle<TData>(request: LifecycleDispatchRequest<TData>): Promise<LifecycleDispatchResult<TData>>;\n\t/**\n\t * Record one startup plugin rejection (D-028): the rejection stays visible in\n\t * the inspector snapshot and, when defined, as a plugin.rejected@1 lifecycle\n\t * fact. Recording must never fail the remaining startup path.\n\t */\n\trecordPluginRejection(rejection: PluginRejection): Promise<void>;\n\tlistPluginCapabilities(options?: { kind?: PluginCapabilityDeclaration[\"kind\"] }): readonly {\n\t\tdeclaration: PluginCapabilityDeclaration;\n\t\towner: string;\n\t}[];\n\tvalidateExecutionFacts(facts: unknown): ExecutionFactsV1;\n\tvalidateRetrySchedule(schedule: unknown): RetryScheduleV1;\n\thasRetryPolicy(name: string): boolean;\n\tclassifyRetry(name: string, request: RetryClassificationRequest): Promise<boolean>;\n\tdecideRetry(name: string, request: RetryPolicyRequest): Promise<RetryPolicyDecision>;\n\thasCompactionPolicy(name: string): boolean;\n\tdecideCompaction(name: string, request: CompactionPolicyRequest): Promise<CompactionPolicyDecision>;\n\tprepareCompaction(name: string, request: CompactionPreparationRequest): Promise<unknown | undefined>;\n\tsummarizeCompaction(name: string, request: CompactionSummaryRequest): Promise<CompactionSummaryResult>;\n\thasOverflowPolicy(name: string): boolean;\n\tdecideOverflow(name: string, request: OverflowPolicyRequest): Promise<OverflowPolicyDecision>;\n\thasBranchSummaryPolicy(name: string): boolean;\n\tsummarizeBranch(\n\t\tname: string,\n\t\trequest: Parameters<BranchSummaryPolicy[\"summarize\"]>[0],\n\t): Promise<BranchSummaryResult>;\n\t/** Ordered loop-hook links for one position, filtered by active owners, in registration order. */\n\tgetLoopHookChain<P extends AgentLoopHookPositionV1>(position: P): readonly AgentLoopHookForV1<P>[];\n\thasRunLoopStrategy(name: string): boolean;\n\tdecideRunLoop(name: string, request: AgentRunLoopStrategyRequestV1): Promise<AgentRunLoopStrategyDecisionV1>;\n\t/**\n\t * 活跃后台委派数(设计 子代理运行时 §4.2 中断分级,2026-10-02):活任务\n\t * 集合(创建即入;终态经投影按状态过滤,成员随 dispose 释放)的有界投影,供宿主做 Esc 分级提示与\n\t * /stop-agents 反馈;无 agents feature 的 runtime 恒为 0。\n\t */\n\tgetActiveAgentTaskCount(): number;\n\tinvokeTool(name: string, input: unknown, options?: { readonly signal?: AbortSignal }): Promise<unknown>;\n\thasCommand(name: string): boolean;\n\tinvokeCommand(\n\t\tname: string,\n\t\targs: string,\n\t\toptions?: CapabilityCommandContext,\n\t): Promise<CapabilityCommandResult | undefined>;\n\thasRpcMethod(name: string): boolean;\n\tdispatchRpc(name: string, input: unknown): Promise<unknown>;\n\thasContextStrategy(name: string): boolean;\n\ttransformContext(name: string, context: unknown, options?: ContextOperationOptions): Promise<unknown>;\n\tsnapshotContext(name: string, context: unknown, options?: ContextOperationOptions): Promise<unknown>;\n\trestoreContext(name: string, snapshot: unknown, options?: ContextOperationOptions): Promise<unknown>;\n\treplaceContext(name: string, context: unknown, options?: ContextOperationOptions): Promise<unknown>;\n\ttransformProviderHeaders(request: ProviderHeaderTransformRequest): Promise<Record<string, string | null>>;\n\t/**\n\t * Ordered stream-function wrappers registered through the public\n\t * `registerStreamFnWrapper` face (provider-failover family), filtered by\n\t * active owners, sorted by (priority ascending, registration order\n\t * ascending) — lower priority wraps outermost; equal priorities keep\n\t * registration order (first registered = outermost), the pre-priority\n\t * semantics (contract A, D-082 批 3b). The host's default stream assembly\n\t * composes them around its own stream call at request time.\n\t */\n\tgetStreamFnWrappers(): readonly StreamFnWrapper[];\n\tgetOperationStatus(id: string): OperationStatus | undefined;\n\tdrainLifecycleDeliveries(): Promise<void>;\n\tinspect(): RuntimeInspectorSnapshot;\n}\n\n/**\n * Mutable state container shared by the capability runtime entry, the lifecycle\n * dispatch module, and the runtime inspector. Field order is irrelevant; every\n * map, set, and array is created once per runtime and mutated in place.\n */\nexport interface CapabilityRuntimeState {\n\treadonly tools: Map<string, RegisteredCapability<unknown>>;\n\treadonly skills: Map<string, RegisteredCapability<SkillDefinition>>;\n\treadonly retryPolicies: Map<string, RegisteredCapability<RetryPolicy>>;\n\treadonly compactionPolicies: Map<string, RegisteredCapability<CompactionPolicy>>;\n\treadonly overflowPolicies: Map<string, RegisteredCapability<OverflowPolicy>>;\n\treadonly branchSummaryPolicies: Map<string, RegisteredCapability<BranchSummaryPolicy>>;\n\treadonly runLoopStrategies: Map<string, RegisteredCapability<AgentRunLoopStrategyV1>>;\n\treadonly loopHooks: Map<AgentLoopHookPositionV1, RegisteredCapability<AgentLoopHookHandlerV1>[]>;\n\treadonly commands: Map<string, RegisteredCapability<CapabilityCommandDefinition>>;\n\treadonly operations: Map<string, RegisteredCapability<OperationHandler>>;\n\treadonly rpcMethods: Map<string, RegisteredCapability<(input: unknown) => unknown | Promise<unknown>>>;\n\treadonly contextStrategies: Map<string, RegisteredCapability<ContextStrategy>>;\n\treadonly pluginCapabilities: Map<string, RegisteredPluginCapability>;\n\treadonly providerHeaderTransforms: Map<string, RegisteredCapability<ProviderHeaderTransform>>;\n\treadonly streamFnWrappers: Map<string, RegisteredCapability<StreamFnWrapper>>;\n\treadonly contributionPoints: Map<string, StoredContributionPoint<unknown>>;\n\treadonly lifecycleDefinitions: Map<string, StoredLifecycleDefinition>;\n\treadonly lifecycleRegistrations: Map<string, Map<string, StoredLifecycleRegistration>>;\n\treadonly subscribers: Map<string, Map<string, RegisteredCapability<(event: EventEnvelope) => void | Promise<void>>>>;\n\treadonly statuses: Map<string, OperationStatus>;\n\treadonly activeOperationsByOwnerToken: Map<symbol, Set<OperationHandle<unknown>>>;\n\treadonly pluginRegistrations: Map<string, Set<DisposableRegistration>>;\n\treadonly apiStates: Map<CapabilityAPI, APIState>;\n\treadonly activeOwnerTokens: Set<symbol>;\n\treadonly outputArtifacts: Map<string, StoredOutputArtifact>;\n\treadonly stateByOwner: Map<string, Map<string, StoredState>>;\n\treadonly stateRevisionsByOwner: Map<string, Map<string, number>>;\n\treadonly stateWatchers: Map<string, Map<string, StateWatcher>>;\n\t/** Instance-private state namespaces keyed by owner, then instance id; cleared on instance disposal. */\n\treadonly stateByInstance: Map<string, Map<string, Map<string, StoredState>>>;\n\treadonly stateRevisionsByInstance: Map<string, Map<string, Map<string, number>>>;\n\treadonly stateWatchersByInstance: Map<string, Map<string, Map<string, StateWatcher>>>;\n\treadonly logs: LoggerRecord[];\n\treadonly spans: Map<string, DiagnosticsSpanSnapshot>;\n\treadonly lifecycleReports: RuntimeInspectorLifecycleDeliveryReportSnapshot[];\n\treadonly lifecycleDeliveryQueues: Set<LifecycleDeliveryQueue<QueuedLifecycleDelivery<unknown>>>;\n\treadonly pluginRejections: PluginRejection[];\n\t/** Lifecycle event sequence; incremented by both the runtime entry and the dispatch module. */\n\teventSequence: number;\n}\n"]}
1
+ {"version":3,"file":"capability-runtime-types.js","sourceRoot":"","sources":["../../../src/core/extensions/capability-runtime-types.ts"],"names":[],"mappings":"AAoMA;;;;;GAKG;AACH,MAAM,CAAC,MAAM,gCAAgC,GAAG,IAAI,GAAG,IAAI,CAAC","sourcesContent":["import type { DurableServiceV1 } from \"../../durable/durable-service.ts\";\nimport type { ObservabilityHostAdapterV1, TraceSinkOptionsV1 } from \"../../plugins/observability-types.ts\";\nimport type { LifecycleDeliveryQueue } from \"./lifecycle-delivery-queue.ts\";\nimport type {\n\tAgentCompositionAPI,\n\tAgentDefinition,\n\tAgentInstance,\n\tAgentLoopHookForV1,\n\tAgentLoopHookHandlerV1,\n\tAgentLoopHookPositionV1,\n\tAgentModelInvocationResultV1,\n\tAgentRunLoopStrategyDecisionV1,\n\tAgentRunLoopStrategyRequestV1,\n\tAgentRunLoopStrategyV1,\n\tAgentTaskAdapter,\n\tAgentTaskSessionSummaryV1,\n\tAgentTaskSessionViewV1,\n\tBranchSummaryPolicy,\n\tBranchSummaryResult,\n\tCapabilityAPI,\n\tCapabilityCommandContext,\n\tCapabilityCommandDefinition,\n\tCapabilityCommandResult,\n\tCapabilityProviderHandler,\n\tCapabilityToolContext,\n\tCompactionPolicy,\n\tCompactionPolicyDecision,\n\tCompactionPolicyRequest,\n\tCompactionPreparationRequest,\n\tCompactionSummaryRequest,\n\tCompactionSummaryResult,\n\tContextOperationOptions,\n\tContextStrategy,\n\tContributionChangeEvent,\n\tContributionEntry,\n\tContributionLifecycle,\n\tContributionPointDefinition,\n\tCredentialAPI,\n\tDiagnosticsSpanSnapshot,\n\tDisposableRegistration,\n\tEventEnvelope,\n\tExecutionFactsV1,\n\tHostCapabilities,\n\tInteractionHostV1,\n\tLifecycleAfterCommitHandler,\n\tLifecycleDeliverySnapshot,\n\tLifecycleDispatchRequest,\n\tLifecycleDispatchResult,\n\tLifecycleEvent,\n\tLifecycleEventDefinition,\n\tLifecycleExecuteHandler,\n\tLifecycleObserveHandler,\n\tLifecycleRegistrationKind,\n\tLifecycleTransformHandler,\n\tLoggerRecord,\n\tOperationExecutionContext,\n\tOperationHandle,\n\tOperationStatus,\n\tOutputArtifactRef,\n\tOverflowPolicy,\n\tOverflowPolicyDecision,\n\tOverflowPolicyRequest,\n\tPluginCapabilityDeclaration,\n\tPluginConfigValue,\n\tPluginManifest,\n\tPluginRejection,\n\tProviderHeaderTransform,\n\tProviderHeaderTransformRequest,\n\tRetryClassificationRequest,\n\tRetryPolicy,\n\tRetryPolicyDecision,\n\tRetryPolicyRequest,\n\tRetryScheduleV1,\n\tRuntimeInspectorLifecycleDeliveryReportSnapshot,\n\tRuntimeInspectorSnapshot,\n\tSessionAPI,\n\tSkillDefinition,\n\tStateChange,\n\tStreamFnWrapper,\n} from \"./public-api.ts\";\n\n/** Host trace service injection (D-075 S4 second batch observability host contract). */\nexport interface TraceServiceV1 {\n\treadonly adapter: ObservabilityHostAdapterV1;\n\treadonly options?: TraceSinkOptionsV1;\n}\n\nexport type OperationHandler = (input: unknown, context: OperationExecutionContext) => unknown | Promise<unknown>;\n\nexport interface CapabilityRuntimeOptions {\n\tclock?: () => number;\n\t/** Test-only override for generated runtime identifiers; omitted in production. */\n\tidFactory?: (kind: string, sequence: number) => string;\n\t/** Test-only observer for every lifecycle dispatch, including detached runtime facts. */\n\tonLifecycleDispatch?: (\n\t\trequest: LifecycleDispatchRequest<unknown>,\n\t\tsettled: Promise<LifecycleDispatchResult<unknown>>,\n\t) => void;\n\t/** Observes each committed output artifact; host adapters may mirror it into durable storage. The runtime stays storage-agnostic. */\n\tonOutputArtifactCommit?: (artifact: { readonly ref: OutputArtifactRef; readonly bytes: Uint8Array }) => void;\n\t/**\n\t * 运行时工具表变更钩子:工具表发生任何变更(注册、同名替换、卸载、替换链恢复,\n\t * 以及插件装卸引发的表变更)后同步调用一次。缺省不传 = 行为不变;回调异常经\n\t * 运行时既有错误通道记录,不打断注册本身。\n\t */\n\tonToolRegistryChange?: () => void;\n\t/**\n\t * 运行时 invoke 面传给工具 execute 的第二参上下文(additive;现有单参工具不受\n\t * 影响)。宿主注入后,经 runtime.invokeTool 调用的工具收到 `{ cwd }`(与会话\n\t * cwd 同源,对应命令面 CapabilityCommandContext.cwd);未注入时第二参保持 undefined。\n\t */\n\ttoolExecutionContext?: CapabilityToolContext;\n\t/**\n\t * 插件日志记录宿主转发通道(会话轨迹 plugin.log 镜像,设计 §5.3/§7.2):每条\n\t * 经 LoggerAPI 写入并通过校验的记录在入运行时内存环后同步转发一次。回调契约:\n\t * 回调内不得调用 LoggerAPI(防自递归);回调抛错由运行时直接吞掉,不打断\n\t * 调用方,也绝不经 recordLog 再记录。缺省不传 = 行为不变。\n\t */\n\tonLogRecord?: (record: LoggerRecord) => void;\n\tsession?: SessionAPI;\n\tagents?: AgentTaskAdapter;\n\t/**\n\t * 会话回读器(D-060 S2/S3):宿主注入后 `api.agents.session(sessionId)` 才存在。\n\t * 作用域(只放行本会话的子会话)由宿主在读取器内部强制;内核不做假设。\n\t */\n\tagentSessionReader?: (sessionId: string) => Promise<AgentTaskSessionViewV1 | undefined>;\n\t/**\n\t * 列出宿主会话**自己的**子代理会话摘要(按最近活动倒序,D-060 模型面盘点通道)。\n\t * 注入后 `agents.list()` 才存在;作用域由宿主强制(宿主只回自己会话的子会话)。\n\t */\n\tagentSessionLister?: () => Promise<AgentTaskSessionSummaryV1[]>;\n\t/**\n\t * Durable replay channel for agent task terminal outcomes. When present,\n\t * every settle persists a frozen record under the deterministic artifact id\n\t * `agent-task:<taskId>`; `api.agents.result(taskId)` reads it back across\n\t * runtime rebuilds. The host owns the writer claim lifecycle: the writer\n\t * must have claimed on the store before the first settle, or persist fails\n\t * loudly with the store's `not_writer` error.\n\t */\n\tagentResults?: {\n\t\treadonly store: DurableServiceV1;\n\t\treadonly writerId: string;\n\t};\n\tcredentials?: CredentialAPI;\n\tinteraction?: InteractionHostV1;\n\tcomposition?: AgentCompositionAPI;\n\t/** Host-provided model runtime for agent-composition model/tool facades. */\n\tmodelRuntime?: {\n\t\t/** Provider-agnostic facts about the current session model. */\n\t\tgetModelFacts():\n\t\t\t| { provider: string; id: string; contextWindow: number; maxTokens: number; reasoning: boolean }\n\t\t\t| undefined;\n\t\t/** Single-shot model invocation. The host resolves model, auth, transport and cache routing. */\n\t\tinvoke: (\n\t\t\tinput: { systemPrompt?: string; prompt: string; maxTokens?: number; thinkingLevel?: string },\n\t\t\toptions?: { signal?: AbortSignal },\n\t\t) => Promise<AgentModelInvocationResultV1>;\n\t};\n\t/**\n\t * Parent-session cancel fence (D-044 §4.2). Consulted once per agent-task\n\t * creation: the returned signal (when present) cancels that task if it fires,\n\t * or immediately cancels tasks created after it already fired. The host\n\t * refreshes the fence epoch so tasks submitted after an aborted turn bind to\n\t * the next signal instead of an already-spent one. Absent = no cascade.\n\t */\n\tparentSignal?: () => AbortSignal | undefined;\n\t/**\n\t * Host trace service (D-075 S4 second batch): injected on hosts running\n\t * session trace collection. Exposed to plugins as `api.trace` (the\n\t * adapter) plus `api.traceSinkOptions`; absent = plugins see neither and\n\t * stay trace-free.\n\t */\n\ttrace?: TraceServiceV1;\n}\n\nexport interface RegisteredCapability<T> {\n\towner: string;\n\townerToken: symbol;\n\tvalue: T;\n}\n\nexport interface RegisteredPluginCapability {\n\tdeclaration: PluginCapabilityDeclaration;\n\towner: string;\n\townerToken: symbol;\n\thandler: CapabilityProviderHandler;\n}\n\nexport interface APIState {\n\tactive: boolean;\n\towner: string;\n\townerToken: symbol;\n\tcompositionInstances?: Set<AgentInstance>;\n\tcompositionDefinitions?: Set<AgentDefinition>;\n}\n\n/**\n * output.put 驻留缓冲上限(M4 双层限额的缓冲半层):单个输出工件的内存驻留\n * 封顶。超限后停止继续缓冲(AsyncIterable 仍完整消费,只丢弃数据),驻留视图\n * 变为 head + 截断标记 + 完整流末尾 64 KiB tail;ref.sizeBytes/truncated 由\n * 运行时计算(sizeBytes 恒为原始总字节数),commit 观察者只收截断视图。\n */\nexport const OUTPUT_ARTIFACT_MAX_BUFFER_BYTES = 1024 * 1024;\n\nexport interface StoredOutputArtifact {\n\tref: OutputArtifactRef;\n\tbytes: Uint8Array;\n\townerToken: symbol;\n}\n\nexport interface StoredContributionPoint<TValue = unknown> {\n\towner: string;\n\townerToken: symbol;\n\tdefinition: ContributionPointDefinition<TValue>;\n\tentries: Map<string, StoredContributionEntry<TValue>>;\n\tsubscribers: Map<\n\t\tstring,\n\t\t{ ownerToken: symbol; handler: (event: ContributionChangeEvent<TValue>) => void | Promise<void> }\n\t>;\n}\n\nexport interface StoredContributionEntry<TValue = unknown> extends ContributionEntry<TValue> {\n\townerToken: symbol;\n}\n\nexport interface StoredLifecycleDefinition<TData = unknown> {\n\towner: string;\n\townerToken: symbol;\n\tdefinition: LifecycleEventDefinition<TData>;\n}\n\nexport interface StoredLifecycleRegistration<TData = unknown> {\n\tid: string;\n\towner: string;\n\townerToken: symbol;\n\tkind: LifecycleRegistrationKind;\n\tsequence: number;\n\thandler:\n\t\t| LifecycleObserveHandler<TData>\n\t\t| LifecycleTransformHandler<TData>\n\t\t| LifecycleExecuteHandler<TData>\n\t\t| LifecycleAfterCommitHandler<TData>;\n\tdelivery: LifecycleDeliverySnapshot;\n\tqueue?: LifecycleDeliveryQueue<QueuedLifecycleDelivery<TData>>;\n}\n\nexport interface QueuedLifecycleDelivery<TData> {\n\treadonly event: LifecycleEvent<TData>;\n\treadonly signal?: AbortSignal;\n}\n\nexport interface StoredState {\n\tvalue: PluginConfigValue;\n\trevision: number;\n}\n\nexport interface StateWatcher {\n\towner: string;\n\townerToken: symbol;\n\tprefix?: string;\n\thandler: (change: StateChange) => void;\n}\n\n/**\n * Terminal statuses the runtime executor itself can produce. `timed_out` is\n * excluded: the executor has no watchdog — a caller-imposed deadline aborts\n * through cancel() and settles cancelled, while a host-declared timed_out\n * enters only through the public contract's complete() path (D-043).\n */\nexport type OperationTerminalStatus = Exclude<OperationStatus, \"queued\" | \"running\" | \"timed_out\">;\n\nexport interface CapabilityRuntime {\n\treadonly host: HostCapabilities;\n\tresolvePluginCapabilityOrder(manifests: readonly PluginManifest[]): readonly PluginManifest[];\n\tcreateAPI(manifest: PluginManifest): CapabilityAPI;\n\trevokeAPI(api: CapabilityAPI): void;\n\t/** Revoke every API produced by this runtime, including direct host-created APIs. */\n\trevokeAllAPIs(): void;\n\t/** Revoke APIs and await disposal of every registration owned by this runtime. */\n\tdisposeAll(): Promise<void>;\n\tdisposePlugin(id: string): Promise<void>;\n\t/** Synchronous cleanup for synchronous bootstrap factories only. */\n\tdisposePluginSync(id: string): void;\n\tlistTools(): readonly { name: string; definition: unknown; source: string; readonlySafe: boolean }[];\n\tlistCommands(): readonly { definition: CapabilityCommandDefinition; source: string }[];\n\tlistSkills(): readonly { definition: SkillDefinition; source: string }[];\n\tlistContributionPoints(): readonly {\n\t\tid: string;\n\t\tversion: number;\n\t\tschema: string;\n\t\tlifecycle: ContributionLifecycle;\n\t\towner: string;\n\t}[];\n\tlistContributions(pointId: string, version: number): readonly ContributionEntry[];\n\thasLifecycleEvent(id: string, version: number): boolean;\n\t/**\n\t * Whether at least one lifecycle registration currently exists for the event\n\t * key (registration-map presence; owner activity is rechecked at delivery).\n\t * Hot-path gate for per-delta producers (model.stream): lets the host skip\n\t * envelope snapshot and clone work when nothing observes the event.\n\t */\n\thasLifecycleSubscribers(type: string, version: number): boolean;\n\tdispatchLifecycle<TData>(request: LifecycleDispatchRequest<TData>): Promise<LifecycleDispatchResult<TData>>;\n\t/**\n\t * Record one startup plugin rejection (D-028): the rejection stays visible in\n\t * the inspector snapshot and, when defined, as a plugin.rejected@1 lifecycle\n\t * fact. Recording must never fail the remaining startup path.\n\t */\n\trecordPluginRejection(rejection: PluginRejection): Promise<void>;\n\tlistPluginCapabilities(options?: { kind?: PluginCapabilityDeclaration[\"kind\"] }): readonly {\n\t\tdeclaration: PluginCapabilityDeclaration;\n\t\towner: string;\n\t}[];\n\tvalidateExecutionFacts(facts: unknown): ExecutionFactsV1;\n\tvalidateRetrySchedule(schedule: unknown): RetryScheduleV1;\n\thasRetryPolicy(name: string): boolean;\n\tclassifyRetry(name: string, request: RetryClassificationRequest): Promise<boolean>;\n\tdecideRetry(name: string, request: RetryPolicyRequest): Promise<RetryPolicyDecision>;\n\thasCompactionPolicy(name: string): boolean;\n\tdecideCompaction(name: string, request: CompactionPolicyRequest): Promise<CompactionPolicyDecision>;\n\tprepareCompaction(name: string, request: CompactionPreparationRequest): Promise<unknown | undefined>;\n\tsummarizeCompaction(name: string, request: CompactionSummaryRequest): Promise<CompactionSummaryResult>;\n\thasOverflowPolicy(name: string): boolean;\n\tdecideOverflow(name: string, request: OverflowPolicyRequest): Promise<OverflowPolicyDecision>;\n\thasBranchSummaryPolicy(name: string): boolean;\n\tsummarizeBranch(\n\t\tname: string,\n\t\trequest: Parameters<BranchSummaryPolicy[\"summarize\"]>[0],\n\t): Promise<BranchSummaryResult>;\n\t/** Ordered loop-hook links for one position, filtered by active owners, in registration order. */\n\tgetLoopHookChain<P extends AgentLoopHookPositionV1>(position: P): readonly AgentLoopHookForV1<P>[];\n\thasRunLoopStrategy(name: string): boolean;\n\tdecideRunLoop(name: string, request: AgentRunLoopStrategyRequestV1): Promise<AgentRunLoopStrategyDecisionV1>;\n\t/**\n\t * 活跃后台委派数(设计 子代理运行时 §4.2 中断分级,2026-10-02):活任务\n\t * 集合(创建即入;终态经投影按状态过滤,成员随 dispose 释放)的有界投影,供宿主做 Esc 分级提示与\n\t * /stop-agents 反馈;无 agents feature 的 runtime 恒为 0。\n\t */\n\tgetActiveAgentTaskCount(): number;\n\tinvokeTool(name: string, input: unknown, options?: { readonly signal?: AbortSignal }): Promise<unknown>;\n\thasCommand(name: string): boolean;\n\tinvokeCommand(\n\t\tname: string,\n\t\targs: string,\n\t\toptions?: CapabilityCommandContext,\n\t): Promise<CapabilityCommandResult | undefined>;\n\thasRpcMethod(name: string): boolean;\n\tdispatchRpc(name: string, input: unknown): Promise<unknown>;\n\thasContextStrategy(name: string): boolean;\n\ttransformContext(name: string, context: unknown, options?: ContextOperationOptions): Promise<unknown>;\n\tsnapshotContext(name: string, context: unknown, options?: ContextOperationOptions): Promise<unknown>;\n\trestoreContext(name: string, snapshot: unknown, options?: ContextOperationOptions): Promise<unknown>;\n\treplaceContext(name: string, context: unknown, options?: ContextOperationOptions): Promise<unknown>;\n\ttransformProviderHeaders(request: ProviderHeaderTransformRequest): Promise<Record<string, string | null>>;\n\t/**\n\t * Ordered stream-function wrappers registered through the public\n\t * `registerStreamFnWrapper` face (provider-failover family), filtered by\n\t * active owners, sorted by (priority ascending, registration order\n\t * ascending) — lower priority wraps outermost; equal priorities keep\n\t * registration order (first registered = outermost), the pre-priority\n\t * semantics (contract A, D-082 批 3b). The host's default stream assembly\n\t * composes them around its own stream call at request time.\n\t */\n\tgetStreamFnWrappers(): readonly StreamFnWrapper[];\n\tgetOperationStatus(id: string): OperationStatus | undefined;\n\tdrainLifecycleDeliveries(): Promise<void>;\n\tinspect(): RuntimeInspectorSnapshot;\n}\n\n/**\n * Mutable state container shared by the capability runtime entry, the lifecycle\n * dispatch module, and the runtime inspector. Field order is irrelevant; every\n * map, set, and array is created once per runtime and mutated in place.\n */\nexport interface CapabilityRuntimeState {\n\treadonly tools: Map<string, RegisteredCapability<unknown>>;\n\treadonly skills: Map<string, RegisteredCapability<SkillDefinition>>;\n\treadonly retryPolicies: Map<string, RegisteredCapability<RetryPolicy>>;\n\treadonly compactionPolicies: Map<string, RegisteredCapability<CompactionPolicy>>;\n\treadonly overflowPolicies: Map<string, RegisteredCapability<OverflowPolicy>>;\n\treadonly branchSummaryPolicies: Map<string, RegisteredCapability<BranchSummaryPolicy>>;\n\treadonly runLoopStrategies: Map<string, RegisteredCapability<AgentRunLoopStrategyV1>>;\n\treadonly loopHooks: Map<AgentLoopHookPositionV1, RegisteredCapability<AgentLoopHookHandlerV1>[]>;\n\treadonly commands: Map<string, RegisteredCapability<CapabilityCommandDefinition>>;\n\treadonly operations: Map<string, RegisteredCapability<OperationHandler>>;\n\treadonly rpcMethods: Map<string, RegisteredCapability<(input: unknown) => unknown | Promise<unknown>>>;\n\treadonly contextStrategies: Map<string, RegisteredCapability<ContextStrategy>>;\n\treadonly pluginCapabilities: Map<string, RegisteredPluginCapability>;\n\treadonly providerHeaderTransforms: Map<string, RegisteredCapability<ProviderHeaderTransform>>;\n\treadonly streamFnWrappers: Map<string, RegisteredCapability<StreamFnWrapper>>;\n\treadonly contributionPoints: Map<string, StoredContributionPoint<unknown>>;\n\treadonly lifecycleDefinitions: Map<string, StoredLifecycleDefinition>;\n\treadonly lifecycleRegistrations: Map<string, Map<string, StoredLifecycleRegistration>>;\n\treadonly subscribers: Map<string, Map<string, RegisteredCapability<(event: EventEnvelope) => void | Promise<void>>>>;\n\treadonly statuses: Map<string, OperationStatus>;\n\treadonly activeOperationsByOwnerToken: Map<symbol, Set<OperationHandle<unknown>>>;\n\treadonly pluginRegistrations: Map<string, Set<DisposableRegistration>>;\n\treadonly apiStates: Map<CapabilityAPI, APIState>;\n\treadonly activeOwnerTokens: Set<symbol>;\n\treadonly outputArtifacts: Map<string, StoredOutputArtifact>;\n\treadonly stateByOwner: Map<string, Map<string, StoredState>>;\n\treadonly stateRevisionsByOwner: Map<string, Map<string, number>>;\n\treadonly stateWatchers: Map<string, Map<string, StateWatcher>>;\n\t/** Instance-private state namespaces keyed by owner, then instance id; cleared on instance disposal. */\n\treadonly stateByInstance: Map<string, Map<string, Map<string, StoredState>>>;\n\treadonly stateRevisionsByInstance: Map<string, Map<string, Map<string, number>>>;\n\treadonly stateWatchersByInstance: Map<string, Map<string, Map<string, StateWatcher>>>;\n\treadonly logs: LoggerRecord[];\n\treadonly spans: Map<string, DiagnosticsSpanSnapshot>;\n\treadonly lifecycleReports: RuntimeInspectorLifecycleDeliveryReportSnapshot[];\n\treadonly lifecycleDeliveryQueues: Set<LifecycleDeliveryQueue<QueuedLifecycleDelivery<unknown>>>;\n\treadonly pluginRejections: PluginRejection[];\n\t/** Lifecycle event sequence; incremented by both the runtime entry and the dispatch module. */\n\teventSequence: number;\n}\n"]}