@ai-agent-forge/agent-forge 0.88.1 → 0.88.3

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 (518) hide show
  1. package/CHANGELOG.md +71 -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 +283 -263
  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-Z72JWUZ4.js → chunk-32YDZI4J.js} +1 -1
  24. package/dist/bundle/chunks/{chunk-AQLNTW2B.js → chunk-755VNWIF.js} +17 -16
  25. package/dist/bundle/chunks/{chunk-LZOEQITZ.js → chunk-B42Y2VME.js} +120 -104
  26. package/dist/bundle/chunks/{chunk-DRQDKNXA.js → chunk-BVVSHK6W.js} +1 -1
  27. package/dist/bundle/chunks/{chunk-6R7UI4IY.js → chunk-QDLOMKF6.js} +1 -1
  28. package/dist/bundle/chunks/{chunk-D3ARGZFR.js → chunk-V3ACW7VD.js} +3 -3
  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 +3 -3
  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/plugin-command.d.ts.map +1 -1
  61. package/dist/cli/plugin-command.js +8 -2
  62. package/dist/cli/plugin-command.js.map +1 -1
  63. package/dist/cli/startup-ui.d.ts.map +1 -1
  64. package/dist/cli/startup-ui.js +1 -1
  65. package/dist/cli/startup-ui.js.map +1 -1
  66. package/dist/config.d.ts +4 -4
  67. package/dist/config.d.ts.map +1 -1
  68. package/dist/config.js +7 -7
  69. package/dist/config.js.map +1 -1
  70. package/dist/core/agent-forge-manifest.d.ts +7 -0
  71. package/dist/core/agent-forge-manifest.d.ts.map +1 -0
  72. package/dist/core/{pi-manifest.js → agent-forge-manifest.js} +4 -4
  73. package/dist/core/agent-forge-manifest.js.map +1 -0
  74. package/dist/core/agent-session-compaction.d.ts +1 -1
  75. package/dist/core/agent-session-compaction.d.ts.map +1 -1
  76. package/dist/core/agent-session-compaction.js +3 -3
  77. package/dist/core/agent-session-compaction.js.map +1 -1
  78. package/dist/core/agent-session-internal.d.ts +2 -0
  79. package/dist/core/agent-session-internal.d.ts.map +1 -1
  80. package/dist/core/agent-session-internal.js.map +1 -1
  81. package/dist/core/agent-session-lifecycle.d.ts.map +1 -1
  82. package/dist/core/agent-session-lifecycle.js +12 -1
  83. package/dist/core/agent-session-lifecycle.js.map +1 -1
  84. package/dist/core/agent-session-projection.d.ts.map +1 -1
  85. package/dist/core/agent-session-projection.js +3 -3
  86. package/dist/core/agent-session-projection.js.map +1 -1
  87. package/dist/core/agent-session-services.d.ts +3 -1
  88. package/dist/core/agent-session-services.d.ts.map +1 -1
  89. package/dist/core/agent-session-services.js +2 -1
  90. package/dist/core/agent-session-services.js.map +1 -1
  91. package/dist/core/agent-session-store.d.ts.map +1 -1
  92. package/dist/core/agent-session-store.js +6 -1
  93. package/dist/core/agent-session-store.js.map +1 -1
  94. package/dist/core/agent-session-tools.d.ts.map +1 -1
  95. package/dist/core/agent-session-tools.js +13 -0
  96. package/dist/core/agent-session-tools.js.map +1 -1
  97. package/dist/core/agent-session.d.ts +24 -0
  98. package/dist/core/agent-session.d.ts.map +1 -1
  99. package/dist/core/agent-session.js +58 -4
  100. package/dist/core/agent-session.js.map +1 -1
  101. package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
  102. package/dist/core/compaction/branch-summarization.js +1 -1
  103. package/dist/core/compaction/branch-summarization.js.map +1 -1
  104. package/dist/core/experimental.d.ts.map +1 -1
  105. package/dist/core/experimental.js +1 -3
  106. package/dist/core/experimental.js.map +1 -1
  107. package/dist/core/extensions/capability-runtime-store.d.ts +20 -1
  108. package/dist/core/extensions/capability-runtime-store.d.ts.map +1 -1
  109. package/dist/core/extensions/capability-runtime-store.js +67 -0
  110. package/dist/core/extensions/capability-runtime-store.js.map +1 -1
  111. package/dist/core/extensions/capability-runtime-types.d.ts +14 -0
  112. package/dist/core/extensions/capability-runtime-types.d.ts.map +1 -1
  113. package/dist/core/extensions/capability-runtime-types.js +7 -1
  114. package/dist/core/extensions/capability-runtime-types.js.map +1 -1
  115. package/dist/core/extensions/capability-runtime.d.ts.map +1 -1
  116. package/dist/core/extensions/capability-runtime.js +144 -42
  117. package/dist/core/extensions/capability-runtime.js.map +1 -1
  118. package/dist/core/extensions/virtual-modules.d.ts.map +1 -1
  119. package/dist/core/extensions/virtual-modules.js +6 -1
  120. package/dist/core/extensions/virtual-modules.js.map +1 -1
  121. package/dist/core/facade/coding-agent-facade.d.ts +1 -1
  122. package/dist/core/facade/coding-agent-facade.d.ts.map +1 -1
  123. package/dist/core/facade/coding-agent-facade.js +1 -1
  124. package/dist/core/facade/coding-agent-facade.js.map +1 -1
  125. package/dist/core/i18n/locales/zh-cn/cli.d.ts.map +1 -1
  126. package/dist/core/i18n/locales/zh-cn/cli.js +2 -0
  127. package/dist/core/i18n/locales/zh-cn/cli.js.map +1 -1
  128. package/dist/core/i18n/locales/zh-cn/core-contract-final.d.ts +1 -1
  129. package/dist/core/i18n/locales/zh-cn/core-contract-final.d.ts.map +1 -1
  130. package/dist/core/i18n/locales/zh-cn/core-contract-final.js +3 -3
  131. package/dist/core/i18n/locales/zh-cn/core-contract-final.js.map +1 -1
  132. package/dist/core/i18n/locales/zh-cn/core-contract-plugins.d.ts.map +1 -1
  133. package/dist/core/i18n/locales/zh-cn/core-contract-plugins.js +1 -1
  134. package/dist/core/i18n/locales/zh-cn/core-contract-plugins.js.map +1 -1
  135. package/dist/core/i18n/locales/zh-cn/core-errors.d.ts.map +1 -1
  136. package/dist/core/i18n/locales/zh-cn/core-errors.js +1 -1
  137. package/dist/core/i18n/locales/zh-cn/core-errors.js.map +1 -1
  138. package/dist/core/i18n/locales/zh-cn/index.d.ts.map +1 -1
  139. package/dist/core/i18n/locales/zh-cn/index.js +2 -0
  140. package/dist/core/i18n/locales/zh-cn/index.js.map +1 -1
  141. package/dist/core/i18n/locales/zh-cn/interactive-mode.d.ts.map +1 -1
  142. package/dist/core/i18n/locales/zh-cn/interactive-mode.js +5 -0
  143. package/dist/core/i18n/locales/zh-cn/interactive-mode.js.map +1 -1
  144. package/dist/core/i18n/locales/zh-cn/session-cleanup.d.ts +7 -0
  145. package/dist/core/i18n/locales/zh-cn/session-cleanup.d.ts.map +1 -0
  146. package/dist/core/i18n/locales/zh-cn/session-cleanup.js +15 -0
  147. package/dist/core/i18n/locales/zh-cn/session-cleanup.js.map +1 -0
  148. package/dist/core/i18n/locales/zh-cn/slash-commands.d.ts.map +1 -1
  149. package/dist/core/i18n/locales/zh-cn/slash-commands.js +1 -0
  150. package/dist/core/i18n/locales/zh-cn/slash-commands.js.map +1 -1
  151. package/dist/core/i18n/locales/zh-cn/tui-components-misc.d.ts.map +1 -1
  152. package/dist/core/i18n/locales/zh-cn/tui-components-misc.js +2 -0
  153. package/dist/core/i18n/locales/zh-cn/tui-components-misc.js.map +1 -1
  154. package/dist/core/model-resolver.d.ts +2 -0
  155. package/dist/core/model-resolver.d.ts.map +1 -1
  156. package/dist/core/model-resolver.js +4 -1
  157. package/dist/core/model-resolver.js.map +1 -1
  158. package/dist/core/package-resource-collection.d.ts.map +1 -1
  159. package/dist/core/package-resource-collection.js +5 -5
  160. package/dist/core/package-resource-collection.js.map +1 -1
  161. package/dist/core/provider-composer.d.ts.map +1 -1
  162. package/dist/core/provider-composer.js +3 -3
  163. package/dist/core/provider-composer.js.map +1 -1
  164. package/dist/core/resource-loader.d.ts.map +1 -1
  165. package/dist/core/resource-loader.js +1 -1
  166. package/dist/core/resource-loader.js.map +1 -1
  167. package/dist/core/sdk.d.ts +1 -1
  168. package/dist/core/sdk.d.ts.map +1 -1
  169. package/dist/core/sdk.js +30 -8
  170. package/dist/core/sdk.js.map +1 -1
  171. package/dist/core/session-cleanup.d.ts +49 -0
  172. package/dist/core/session-cleanup.d.ts.map +1 -0
  173. package/dist/core/session-cleanup.js +159 -0
  174. package/dist/core/session-cleanup.js.map +1 -0
  175. package/dist/core/session-index.d.ts +75 -0
  176. package/dist/core/session-index.d.ts.map +1 -0
  177. package/dist/core/session-index.js +455 -0
  178. package/dist/core/session-index.js.map +1 -0
  179. package/dist/core/session-manager.d.ts +9 -0
  180. package/dist/core/session-manager.d.ts.map +1 -1
  181. package/dist/core/session-manager.js +206 -51
  182. package/dist/core/session-manager.js.map +1 -1
  183. package/dist/core/settings-manager.d.ts.map +1 -1
  184. package/dist/core/settings-manager.js +5 -10
  185. package/dist/core/settings-manager.js.map +1 -1
  186. package/dist/core/slash-commands.d.ts.map +1 -1
  187. package/dist/core/slash-commands.js +5 -0
  188. package/dist/core/slash-commands.js.map +1 -1
  189. package/dist/core/system-prompt.d.ts.map +1 -1
  190. package/dist/core/system-prompt.js +12 -1
  191. package/dist/core/system-prompt.js.map +1 -1
  192. package/dist/core/timings.d.ts.map +1 -1
  193. package/dist/core/timings.js +1 -3
  194. package/dist/core/timings.js.map +1 -1
  195. package/dist/core/tools/capability-mount.d.ts +40 -0
  196. package/dist/core/tools/capability-mount.d.ts.map +1 -0
  197. package/dist/core/tools/capability-mount.js +112 -0
  198. package/dist/core/tools/capability-mount.js.map +1 -0
  199. package/dist/core/tools/render-utils.d.ts +1 -1
  200. package/dist/core/tools/render-utils.d.ts.map +1 -1
  201. package/dist/core/tools/render-utils.js.map +1 -1
  202. package/dist/core/tools/tool-definition.d.ts +1 -1
  203. package/dist/core/tools/tool-definition.d.ts.map +1 -1
  204. package/dist/core/tools/tool-definition.js.map +1 -1
  205. package/dist/core/trace-retention.d.ts +16 -1
  206. package/dist/core/trace-retention.d.ts.map +1 -1
  207. package/dist/core/trace-retention.js +43 -20
  208. package/dist/core/trace-retention.js.map +1 -1
  209. package/dist/export-html/ansi-to-html.d.ts.map +1 -0
  210. package/dist/export-html/ansi-to-html.js.map +1 -0
  211. package/dist/{core/export-html → export-html}/index.d.ts +1 -1
  212. package/dist/export-html/index.d.ts.map +1 -0
  213. package/dist/{core/export-html → export-html}/index.js +5 -5
  214. package/dist/export-html/index.js.map +1 -0
  215. package/dist/{core/export-html → export-html}/tool-renderer.d.ts +2 -2
  216. package/dist/export-html/tool-renderer.d.ts.map +1 -0
  217. package/dist/export-html/tool-renderer.js.map +1 -0
  218. package/dist/{modes/interactive → host}/model-catalog-refresh.d.ts +1 -1
  219. package/dist/host/model-catalog-refresh.d.ts.map +1 -0
  220. package/dist/{modes/interactive → host}/model-catalog-refresh.js +1 -1
  221. package/dist/host/model-catalog-refresh.js.map +1 -0
  222. package/dist/index.d.ts +5 -5
  223. package/dist/index.d.ts.map +1 -1
  224. package/dist/index.js +12 -12
  225. package/dist/index.js.map +1 -1
  226. package/dist/main.d.ts.map +1 -1
  227. package/dist/main.js +26 -14
  228. package/dist/main.js.map +1 -1
  229. package/dist/modes/interactive/components/agents-view.d.ts.map +1 -1
  230. package/dist/modes/interactive/components/agents-view.js +1 -1
  231. package/dist/modes/interactive/components/agents-view.js.map +1 -1
  232. package/dist/modes/interactive/components/armin.d.ts.map +1 -1
  233. package/dist/modes/interactive/components/armin.js +1 -1
  234. package/dist/modes/interactive/components/armin.js.map +1 -1
  235. package/dist/modes/interactive/components/assistant-message.d.ts +6 -0
  236. package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
  237. package/dist/modes/interactive/components/assistant-message.js +108 -27
  238. package/dist/modes/interactive/components/assistant-message.js.map +1 -1
  239. package/dist/modes/interactive/components/bash-execution.d.ts.map +1 -1
  240. package/dist/modes/interactive/components/bash-execution.js +1 -1
  241. package/dist/modes/interactive/components/bash-execution.js.map +1 -1
  242. package/dist/modes/interactive/components/bordered-loader.d.ts +1 -1
  243. package/dist/modes/interactive/components/bordered-loader.d.ts.map +1 -1
  244. package/dist/modes/interactive/components/bordered-loader.js.map +1 -1
  245. package/dist/modes/interactive/components/branch-summary-message.d.ts.map +1 -1
  246. package/dist/modes/interactive/components/branch-summary-message.js +1 -1
  247. package/dist/modes/interactive/components/branch-summary-message.js.map +1 -1
  248. package/dist/modes/interactive/components/compaction-summary-message.d.ts.map +1 -1
  249. package/dist/modes/interactive/components/compaction-summary-message.js +1 -1
  250. package/dist/modes/interactive/components/compaction-summary-message.js.map +1 -1
  251. package/dist/modes/interactive/components/config-selector.d.ts.map +1 -1
  252. package/dist/modes/interactive/components/config-selector.js +1 -1
  253. package/dist/modes/interactive/components/config-selector.js.map +1 -1
  254. package/dist/modes/interactive/components/custom-entry.d.ts.map +1 -1
  255. package/dist/modes/interactive/components/custom-entry.js +1 -1
  256. package/dist/modes/interactive/components/custom-entry.js.map +1 -1
  257. package/dist/modes/interactive/components/custom-message.d.ts.map +1 -1
  258. package/dist/modes/interactive/components/custom-message.js +1 -1
  259. package/dist/modes/interactive/components/custom-message.js.map +1 -1
  260. package/dist/modes/interactive/components/daxnuts.d.ts.map +1 -1
  261. package/dist/modes/interactive/components/daxnuts.js +1 -1
  262. package/dist/modes/interactive/components/daxnuts.js.map +1 -1
  263. package/dist/modes/interactive/components/dialog-editor.d.ts.map +1 -1
  264. package/dist/modes/interactive/components/dialog-editor.js +1 -1
  265. package/dist/modes/interactive/components/dialog-editor.js.map +1 -1
  266. package/dist/modes/interactive/components/dialog-input.d.ts.map +1 -1
  267. package/dist/modes/interactive/components/dialog-input.js +1 -1
  268. package/dist/modes/interactive/components/dialog-input.js.map +1 -1
  269. package/dist/modes/interactive/components/dialog-selector.d.ts.map +1 -1
  270. package/dist/modes/interactive/components/dialog-selector.js +1 -1
  271. package/dist/modes/interactive/components/dialog-selector.js.map +1 -1
  272. package/dist/modes/interactive/components/diff.d.ts.map +1 -1
  273. package/dist/modes/interactive/components/diff.js +1 -1
  274. package/dist/modes/interactive/components/diff.js.map +1 -1
  275. package/dist/modes/interactive/components/dynamic-border.d.ts.map +1 -1
  276. package/dist/modes/interactive/components/dynamic-border.js +1 -1
  277. package/dist/modes/interactive/components/dynamic-border.js.map +1 -1
  278. package/dist/modes/interactive/components/first-time-setup.d.ts +1 -1
  279. package/dist/modes/interactive/components/first-time-setup.d.ts.map +1 -1
  280. package/dist/modes/interactive/components/first-time-setup.js +1 -1
  281. package/dist/modes/interactive/components/first-time-setup.js.map +1 -1
  282. package/dist/modes/interactive/components/footer.d.ts.map +1 -1
  283. package/dist/modes/interactive/components/footer.js +1 -1
  284. package/dist/modes/interactive/components/footer.js.map +1 -1
  285. package/dist/modes/interactive/components/keybinding-hints.d.ts.map +1 -1
  286. package/dist/modes/interactive/components/keybinding-hints.js +1 -1
  287. package/dist/modes/interactive/components/keybinding-hints.js.map +1 -1
  288. package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -1
  289. package/dist/modes/interactive/components/login-dialog.js +1 -1
  290. package/dist/modes/interactive/components/login-dialog.js.map +1 -1
  291. package/dist/modes/interactive/components/mermaid.d.ts +1 -1
  292. package/dist/modes/interactive/components/mermaid.d.ts.map +1 -1
  293. package/dist/modes/interactive/components/mermaid.js.map +1 -1
  294. package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
  295. package/dist/modes/interactive/components/model-selector.js +2 -2
  296. package/dist/modes/interactive/components/model-selector.js.map +1 -1
  297. package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -1
  298. package/dist/modes/interactive/components/oauth-selector.js +1 -1
  299. package/dist/modes/interactive/components/oauth-selector.js.map +1 -1
  300. package/dist/modes/interactive/components/plugin-manager-entry.d.ts.map +1 -1
  301. package/dist/modes/interactive/components/plugin-manager-entry.js +1 -1
  302. package/dist/modes/interactive/components/plugin-manager-entry.js.map +1 -1
  303. package/dist/modes/interactive/components/plugin-selection-entry.d.ts.map +1 -1
  304. package/dist/modes/interactive/components/plugin-selection-entry.js +1 -1
  305. package/dist/modes/interactive/components/plugin-selection-entry.js.map +1 -1
  306. package/dist/modes/interactive/components/queue-manager-selector.d.ts.map +1 -1
  307. package/dist/modes/interactive/components/queue-manager-selector.js +1 -1
  308. package/dist/modes/interactive/components/queue-manager-selector.js.map +1 -1
  309. package/dist/modes/interactive/components/render-types.d.ts +1 -1
  310. package/dist/modes/interactive/components/render-types.d.ts.map +1 -1
  311. package/dist/modes/interactive/components/render-types.js.map +1 -1
  312. package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -1
  313. package/dist/modes/interactive/components/scoped-models-selector.js +1 -1
  314. package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -1
  315. package/dist/modes/interactive/components/session-selector-search.d.ts.map +1 -1
  316. package/dist/modes/interactive/components/session-selector-search.js +5 -1
  317. package/dist/modes/interactive/components/session-selector-search.js.map +1 -1
  318. package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
  319. package/dist/modes/interactive/components/session-selector.js +11 -2
  320. package/dist/modes/interactive/components/session-selector.js.map +1 -1
  321. package/dist/modes/interactive/components/settings-selector.d.ts +1 -1
  322. package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
  323. package/dist/modes/interactive/components/settings-selector.js +1 -1
  324. package/dist/modes/interactive/components/settings-selector.js.map +1 -1
  325. package/dist/modes/interactive/components/settings-submenu.d.ts.map +1 -1
  326. package/dist/modes/interactive/components/settings-submenu.js +1 -1
  327. package/dist/modes/interactive/components/settings-submenu.js.map +1 -1
  328. package/dist/modes/interactive/components/show-images-selector.d.ts.map +1 -1
  329. package/dist/modes/interactive/components/show-images-selector.js +1 -1
  330. package/dist/modes/interactive/components/show-images-selector.js.map +1 -1
  331. package/dist/modes/interactive/components/skill-invocation-message.d.ts.map +1 -1
  332. package/dist/modes/interactive/components/skill-invocation-message.js +1 -1
  333. package/dist/modes/interactive/components/skill-invocation-message.js.map +1 -1
  334. package/dist/modes/interactive/components/status-indicator.d.ts.map +1 -1
  335. package/dist/modes/interactive/components/status-indicator.js +1 -1
  336. package/dist/modes/interactive/components/status-indicator.js.map +1 -1
  337. package/dist/modes/interactive/components/theme-selector.d.ts.map +1 -1
  338. package/dist/modes/interactive/components/theme-selector.js +1 -1
  339. package/dist/modes/interactive/components/theme-selector.js.map +1 -1
  340. package/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -1
  341. package/dist/modes/interactive/components/thinking-selector.js +1 -1
  342. package/dist/modes/interactive/components/thinking-selector.js.map +1 -1
  343. package/dist/modes/interactive/components/tool-execution.d.ts +19 -0
  344. package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  345. package/dist/modes/interactive/components/tool-execution.js +139 -4
  346. package/dist/modes/interactive/components/tool-execution.js.map +1 -1
  347. package/dist/modes/interactive/components/tool-run-group.d.ts +44 -0
  348. package/dist/modes/interactive/components/tool-run-group.d.ts.map +1 -0
  349. package/dist/modes/interactive/components/tool-run-group.js +121 -0
  350. package/dist/modes/interactive/components/tool-run-group.js.map +1 -0
  351. package/dist/modes/interactive/components/tree-list.d.ts.map +1 -1
  352. package/dist/modes/interactive/components/tree-list.js +1 -1
  353. package/dist/modes/interactive/components/tree-list.js.map +1 -1
  354. package/dist/modes/interactive/components/tree-render.d.ts.map +1 -1
  355. package/dist/modes/interactive/components/tree-render.js +1 -1
  356. package/dist/modes/interactive/components/tree-render.js.map +1 -1
  357. package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -1
  358. package/dist/modes/interactive/components/tree-selector.js +1 -1
  359. package/dist/modes/interactive/components/tree-selector.js.map +1 -1
  360. package/dist/modes/interactive/components/user-message-selector.d.ts.map +1 -1
  361. package/dist/modes/interactive/components/user-message-selector.js +1 -1
  362. package/dist/modes/interactive/components/user-message-selector.js.map +1 -1
  363. package/dist/modes/interactive/components/user-message.d.ts.map +1 -1
  364. package/dist/modes/interactive/components/user-message.js +1 -1
  365. package/dist/modes/interactive/components/user-message.js.map +1 -1
  366. package/dist/modes/interactive/components/workflow-view.d.ts.map +1 -1
  367. package/dist/modes/interactive/components/workflow-view.js +1 -1
  368. package/dist/modes/interactive/components/workflow-view.js.map +1 -1
  369. package/dist/modes/interactive/interactive-auth.d.ts +1 -1
  370. package/dist/modes/interactive/interactive-auth.d.ts.map +1 -1
  371. package/dist/modes/interactive/interactive-auth.js +1 -1
  372. package/dist/modes/interactive/interactive-auth.js.map +1 -1
  373. package/dist/modes/interactive/interactive-commands.d.ts +125 -6
  374. package/dist/modes/interactive/interactive-commands.d.ts.map +1 -1
  375. package/dist/modes/interactive/interactive-commands.js +698 -4
  376. package/dist/modes/interactive/interactive-commands.js.map +1 -1
  377. package/dist/modes/interactive/interactive-events.d.ts +174 -0
  378. package/dist/modes/interactive/interactive-events.d.ts.map +1 -0
  379. package/dist/modes/interactive/interactive-events.js +704 -0
  380. package/dist/modes/interactive/interactive-events.js.map +1 -0
  381. package/dist/modes/interactive/interactive-format.d.ts.map +1 -1
  382. package/dist/modes/interactive/interactive-format.js +1 -1
  383. package/dist/modes/interactive/interactive-format.js.map +1 -1
  384. package/dist/modes/interactive/interactive-lifecycle.d.ts +94 -0
  385. package/dist/modes/interactive/interactive-lifecycle.d.ts.map +1 -0
  386. package/dist/modes/interactive/interactive-lifecycle.js +177 -0
  387. package/dist/modes/interactive/interactive-lifecycle.js.map +1 -0
  388. package/dist/modes/interactive/interactive-mode.d.ts +254 -129
  389. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  390. package/dist/modes/interactive/interactive-mode.js +275 -2101
  391. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  392. package/dist/modes/interactive/interactive-queues.d.ts +96 -0
  393. package/dist/modes/interactive/interactive-queues.d.ts.map +1 -0
  394. package/dist/modes/interactive/interactive-queues.js +183 -0
  395. package/dist/modes/interactive/interactive-queues.js.map +1 -0
  396. package/dist/modes/interactive/interactive-selectors.d.ts +95 -5
  397. package/dist/modes/interactive/interactive-selectors.d.ts.map +1 -1
  398. package/dist/modes/interactive/interactive-selectors.js +517 -6
  399. package/dist/modes/interactive/interactive-selectors.js.map +1 -1
  400. package/dist/modes/interactive/startup-services.d.ts +31 -0
  401. package/dist/modes/interactive/startup-services.d.ts.map +1 -0
  402. package/dist/modes/interactive/startup-services.js +123 -0
  403. package/dist/modes/interactive/startup-services.js.map +1 -0
  404. package/dist/modes/memory-preheat.d.ts +11 -0
  405. package/dist/modes/memory-preheat.d.ts.map +1 -0
  406. package/dist/modes/memory-preheat.js +20 -0
  407. package/dist/modes/memory-preheat.js.map +1 -0
  408. package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
  409. package/dist/modes/rpc/rpc-mode.js +3 -1
  410. package/dist/modes/rpc/rpc-mode.js.map +1 -1
  411. package/dist/plugins/ecosystem/cli.d.ts.map +1 -1
  412. package/dist/plugins/ecosystem/cli.js +6 -3
  413. package/dist/plugins/ecosystem/cli.js.map +1 -1
  414. package/dist/plugins/ecosystem/node-plugin-bootstrap.d.ts +7 -1
  415. package/dist/plugins/ecosystem/node-plugin-bootstrap.d.ts.map +1 -1
  416. package/dist/plugins/ecosystem/node-plugin-bootstrap.js +50 -3
  417. package/dist/plugins/ecosystem/node-plugin-bootstrap.js.map +1 -1
  418. package/dist/plugins/ecosystem/plugin-bootstrap.d.ts +28 -16
  419. package/dist/plugins/ecosystem/plugin-bootstrap.d.ts.map +1 -1
  420. package/dist/plugins/ecosystem/plugin-bootstrap.js +35 -33
  421. package/dist/plugins/ecosystem/plugin-bootstrap.js.map +1 -1
  422. package/dist/profile/plugin-profiles.d.ts +1 -1
  423. package/dist/profile/plugin-profiles.d.ts.map +1 -1
  424. package/dist/profile/plugin-profiles.js +18 -0
  425. package/dist/profile/plugin-profiles.js.map +1 -1
  426. package/dist/remote/server-assembly.d.ts.map +1 -1
  427. package/dist/remote/server-assembly.js +7 -2
  428. package/dist/remote/server-assembly.js.map +1 -1
  429. package/dist/{profiles → suites}/builtin-suites.d.ts +14 -4
  430. package/dist/suites/builtin-suites.d.ts.map +1 -0
  431. package/dist/{profiles → suites}/builtin-suites.js +20 -5
  432. package/dist/suites/builtin-suites.js.map +1 -0
  433. package/dist/suites/resolved-agent-profile.d.ts.map +1 -0
  434. package/dist/suites/resolved-agent-profile.js.map +1 -0
  435. package/dist/suites/suite-lifecycle.d.ts.map +1 -0
  436. package/dist/suites/suite-lifecycle.js.map +1 -0
  437. package/dist/suites/suite-loader.d.ts.map +1 -0
  438. package/dist/suites/suite-loader.js.map +1 -0
  439. package/dist/{modes/interactive/theme → theme}/dark.json +1 -1
  440. package/dist/{modes/interactive/theme → theme}/light.json +1 -1
  441. package/dist/{modes/interactive/theme → theme}/theme-controller.d.ts +1 -1
  442. package/dist/theme/theme-controller.d.ts.map +1 -0
  443. package/dist/{modes/interactive/theme → theme}/theme-controller.js +1 -1
  444. package/dist/theme/theme-controller.js.map +1 -0
  445. package/dist/{modes/interactive/theme → theme}/theme.d.ts +1 -1
  446. package/dist/theme/theme.d.ts.map +1 -0
  447. package/dist/{modes/interactive/theme → theme}/theme.js +5 -5
  448. package/dist/theme/theme.js.map +1 -0
  449. package/docs/compaction.md +7 -7
  450. package/docs/environment-variables.md +10 -4
  451. package/docs/keybindings.md +3 -3
  452. package/docs/models.md +17 -17
  453. package/docs/packages.md +1 -1
  454. package/docs/prompt-templates.md +1 -1
  455. package/docs/rpc.md +2 -2
  456. package/docs/sdk.md +5 -5
  457. package/docs/session-format.md +3 -3
  458. package/docs/settings.md +368 -354
  459. package/docs/shell-aliases.md +1 -1
  460. package/docs/skills.md +1 -1
  461. package/docs/terminal-setup.md +17 -17
  462. package/docs/themes.md +5 -5
  463. package/docs/tmux.md +4 -4
  464. package/docs/tui.md +1 -1
  465. package/docs/windows.md +1 -1
  466. package/examples/extensions/bash-spawn-hook/index.ts +1 -1
  467. package/examples/extensions/dynamic-resources/dynamic.json +1 -1
  468. package/examples/extensions/with-deps/package-lock.json +2 -2
  469. package/examples/extensions/with-deps/package.json +1 -6
  470. package/examples/extensions/with-deps/plugin.json +1 -1
  471. package/package.json +2 -2
  472. package/dist/bundle/chunks/openai-responses-AUJQ3NWT.js +0 -2
  473. package/dist/bundle/chunks/virtual-modules-WF6WRHP7.js +0 -5
  474. package/dist/cli/experimental/commands/pi.d.ts +0 -15
  475. package/dist/cli/experimental/commands/pi.d.ts.map +0 -1
  476. package/dist/cli/experimental/commands/pi.js.map +0 -1
  477. package/dist/core/export-html/ansi-to-html.d.ts.map +0 -1
  478. package/dist/core/export-html/ansi-to-html.js.map +0 -1
  479. package/dist/core/export-html/index.d.ts.map +0 -1
  480. package/dist/core/export-html/index.js.map +0 -1
  481. package/dist/core/export-html/tool-renderer.d.ts.map +0 -1
  482. package/dist/core/export-html/tool-renderer.js.map +0 -1
  483. package/dist/core/pi-manifest.d.ts +0 -7
  484. package/dist/core/pi-manifest.d.ts.map +0 -1
  485. package/dist/core/pi-manifest.js.map +0 -1
  486. package/dist/modes/interactive/model-catalog-refresh.d.ts.map +0 -1
  487. package/dist/modes/interactive/model-catalog-refresh.js.map +0 -1
  488. package/dist/modes/interactive/theme/theme-controller.d.ts.map +0 -1
  489. package/dist/modes/interactive/theme/theme-controller.js.map +0 -1
  490. package/dist/modes/interactive/theme/theme.d.ts.map +0 -1
  491. package/dist/modes/interactive/theme/theme.js.map +0 -1
  492. package/dist/profiles/builtin-suites.d.ts.map +0 -1
  493. package/dist/profiles/builtin-suites.js.map +0 -1
  494. package/dist/profiles/resolved-agent-profile.d.ts.map +0 -1
  495. package/dist/profiles/resolved-agent-profile.js.map +0 -1
  496. package/dist/profiles/suite-lifecycle.d.ts.map +0 -1
  497. package/dist/profiles/suite-lifecycle.js.map +0 -1
  498. package/dist/profiles/suite-loader.d.ts.map +0 -1
  499. package/dist/profiles/suite-loader.js.map +0 -1
  500. package/dist/utils/deprecation.d.ts +0 -4
  501. package/dist/utils/deprecation.d.ts.map +0 -1
  502. package/dist/utils/deprecation.js +0 -13
  503. package/dist/utils/deprecation.js.map +0 -1
  504. /package/dist/{core/export-html → export-html}/ansi-to-html.d.ts +0 -0
  505. /package/dist/{core/export-html → export-html}/ansi-to-html.js +0 -0
  506. /package/dist/{core/export-html → export-html}/template.css +0 -0
  507. /package/dist/{core/export-html → export-html}/template.html +0 -0
  508. /package/dist/{core/export-html → export-html}/template.js +0 -0
  509. /package/dist/{core/export-html → export-html}/tool-renderer.js +0 -0
  510. /package/dist/{core/export-html → export-html}/vendor/highlight.min.js +0 -0
  511. /package/dist/{core/export-html → export-html}/vendor/marked.min.js +0 -0
  512. /package/dist/{profiles → suites}/resolved-agent-profile.d.ts +0 -0
  513. /package/dist/{profiles → suites}/resolved-agent-profile.js +0 -0
  514. /package/dist/{profiles → suites}/suite-lifecycle.d.ts +0 -0
  515. /package/dist/{profiles → suites}/suite-lifecycle.js +0 -0
  516. /package/dist/{profiles → suites}/suite-loader.d.ts +0 -0
  517. /package/dist/{profiles → suites}/suite-loader.js +0 -0
  518. /package/dist/{modes/interactive/theme → theme}/theme-schema.json +0 -0
@@ -7,8 +7,9 @@ import { createRuntimeInspector } from "./capability-runtime-inspect.js";
7
7
  import { assertManifest, assertPluginCapabilityDeclarations, assertPluginCapabilityId, assertPluginCapabilityVersion, capabilityKey, createPluginConfig, isPluginConfigValue, resolvePluginCapabilityOrder, } from "./capability-runtime-manifest.js";
8
8
  import { OutputArtifactError, RuntimeOperation } from "./capability-runtime-operation.js";
9
9
  import { definitionSnapshot, detachedSnapshot } from "./capability-runtime-snapshot.js";
10
- import { assertRegisteredCapabilityActive as assertRegisteredCapabilityState, cancelOwnedOperations as cancelOwnedOperationsState, createCapabilityRuntimeState, createRevokedCapabilityError, invokePluginCapability as invokePluginCapabilityState, invokeRegisteredCapability as invokeRegisteredCapabilityState, invokeRegisteredCapabilityWithSignal as invokeRegisteredCapabilityWithSignalState, isRevokedCapabilityError, observeUnexpectedAsyncCleanup, trackOperation as trackOperationState, } from "./capability-runtime-store.js";
10
+ import { assertRegisteredCapabilityActive as assertRegisteredCapabilityState, cancelOwnedOperations as cancelOwnedOperationsState, createCapabilityRuntimeState, createRevokedCapabilityError, invokePluginCapability as invokePluginCapabilityState, invokeRegisteredCapability as invokeRegisteredCapabilityState, invokeRegisteredCapabilityWithSignal as invokeRegisteredCapabilityWithSignalState, isRevokedCapabilityError, observeUnexpectedAsyncCleanup, pushPluginRejection, pushRuntimeLog, setDiagnosticsSpan, setOperationStatus, trackOperation as trackOperationState, } from "./capability-runtime-store.js";
11
11
  import { invokeCapabilityTool } from "./capability-runtime-tool.js";
12
+ import { OUTPUT_ARTIFACT_MAX_BUFFER_BYTES } from "./capability-runtime-types.js";
12
13
  import { asHandler, assertAgentTaskRequest, assertHost, capabilityName, contributionPointKey, lifecycleEventKey, lifecycleRegistrationKinds, stableTextCompare, toolReadonlySafe, validateCommandDefinition, validateCommandResult, validateContributionPointDefinition, validateExecutionFactsV1, validateLifecycleEventDefinition, validateProviderHeaders, validateRetryScheduleV1, } from "./capability-runtime-validation.js";
13
14
  import { PLUGIN_REJECTED_EVENT_ID, PLUGIN_REJECTED_EVENT_VERSION } from "./lifecycle-catalog.js";
14
15
  import { createLifecycleDeliveryQueue } from "./lifecycle-delivery-queue.js";
@@ -23,6 +24,122 @@ export { validateExecutionFactsV1, validateRetryScheduleV1 } from "./capability-
23
24
  * clock 缺省恒 0(生产不注入),不能作为耗时来源。
24
25
  */
25
26
  const SLOW_EVENT_SUBSCRIBER_WARN_MS = 100;
27
+ /**
28
+ * 超限驻留视图的尾部窗口字节数:超限后驻留视图保留完整流真实末尾这么多字节。
29
+ */
30
+ const OUTPUT_ARTIFACT_TAIL_BYTES = 64 * 1024;
31
+ const truncationMarkerEncoder = new TextEncoder();
32
+ /**
33
+ * 超限标记文本(ASCII):N 是驻留视图未表示的原始流字节数(十进制)。
34
+ */
35
+ const encodeTruncationMarker = (omittedBytes) => truncationMarkerEncoder.encode(`\n[agent-forge artifact truncated: ${omittedBytes} bytes omitted]\n`);
36
+ const concatChunks = (chunks, totalBytes) => {
37
+ const bytes = new Uint8Array(totalBytes);
38
+ let offset = 0;
39
+ for (const chunk of chunks) {
40
+ bytes.set(chunk, offset);
41
+ offset += chunk.byteLength;
42
+ }
43
+ return bytes;
44
+ };
45
+ /** 取 chunks 拼接后的前 length 字节(跨 chunk 切片),作为截断视图的 head。 */
46
+ const takeLeadingBytes = (chunks, length) => {
47
+ const taken = [];
48
+ let remaining = length;
49
+ for (const chunk of chunks) {
50
+ if (remaining <= 0)
51
+ break;
52
+ if (chunk.byteLength <= remaining) {
53
+ taken.push(chunk);
54
+ remaining -= chunk.byteLength;
55
+ }
56
+ else {
57
+ taken.push(chunk.subarray(0, remaining));
58
+ remaining = 0;
59
+ }
60
+ }
61
+ return taken;
62
+ };
63
+ /**
64
+ * 组装 head + 截断标记 + tail 的驻留视图,总长恰为 OUTPUT_ARTIFACT_MAX_BUFFER_BYTES。
65
+ * 标记展示的省略字节数依赖标记自身的字节长度(head = 上限 − tail − marker),
66
+ * 不动点按字节数收敛(标记长度只在十进制进位处变化),两三轮内稳定。
67
+ */
68
+ const buildTruncatedView = (headChunks, tailChunks, totalBytes) => {
69
+ const tailBytes = Math.min(OUTPUT_ARTIFACT_TAIL_BYTES, totalBytes);
70
+ let omitted = totalBytes - OUTPUT_ARTIFACT_MAX_BUFFER_BYTES;
71
+ let marker = encodeTruncationMarker(omitted);
72
+ let headLength = OUTPUT_ARTIFACT_MAX_BUFFER_BYTES - tailBytes - marker.byteLength;
73
+ while (totalBytes - headLength - tailBytes !== omitted) {
74
+ omitted = totalBytes - headLength - tailBytes;
75
+ marker = encodeTruncationMarker(omitted);
76
+ headLength = OUTPUT_ARTIFACT_MAX_BUFFER_BYTES - tailBytes - marker.byteLength;
77
+ }
78
+ return concatChunks([...takeLeadingBytes(headChunks, headLength), marker, ...tailChunks], OUTPUT_ARTIFACT_MAX_BUFFER_BYTES);
79
+ };
80
+ /**
81
+ * output.put 驻留缓冲(M4 双层限额的缓冲半层):逐字节缓冲直至
82
+ * OUTPUT_ARTIFACT_MAX_BUFFER_BYTES,超限后停止缓冲但仍把 AsyncIterable 完整
83
+ * 消费完——消费端提前返回会把背压和写管道破裂转嫁给上游,语义变化,禁止;
84
+ * 只丢弃数据。尾部窗口始终滑动维持在完整流末尾 OUTPUT_ARTIFACT_TAIL_BYTES。
85
+ * 超限驻留视图 = head + 截断标记 + tail(总长恰为上限);未超限驻留与提交
86
+ * 数据逐字节一致。
87
+ */
88
+ const bufferOutputArtifactData = async (data, throwIfAborted) => {
89
+ if (data instanceof Uint8Array) {
90
+ if (data.byteLength <= OUTPUT_ARTIFACT_MAX_BUFFER_BYTES) {
91
+ return { bytes: new Uint8Array(data), totalBytes: data.byteLength, truncated: false };
92
+ }
93
+ const tailStart = data.byteLength - OUTPUT_ARTIFACT_TAIL_BYTES;
94
+ return {
95
+ bytes: buildTruncatedView([data], [data.subarray(tailStart)], data.byteLength),
96
+ totalBytes: data.byteLength,
97
+ truncated: true,
98
+ };
99
+ }
100
+ const headChunks = [];
101
+ const tailChunks = [];
102
+ let tailBytes = 0;
103
+ let headBytes = 0;
104
+ let totalBytes = 0;
105
+ let truncated = false;
106
+ const appendTail = (chunk) => {
107
+ tailChunks.push(chunk);
108
+ tailBytes += chunk.byteLength;
109
+ while (tailBytes > OUTPUT_ARTIFACT_TAIL_BYTES) {
110
+ const oldest = tailChunks[0];
111
+ const overflow = tailBytes - OUTPUT_ARTIFACT_TAIL_BYTES;
112
+ if (oldest.byteLength <= overflow) {
113
+ tailChunks.shift();
114
+ tailBytes -= oldest.byteLength;
115
+ }
116
+ else {
117
+ tailChunks[0] = oldest.subarray(overflow);
118
+ tailBytes -= overflow;
119
+ }
120
+ }
121
+ };
122
+ for await (const chunk of data) {
123
+ throwIfAborted();
124
+ if (!(chunk instanceof Uint8Array)) {
125
+ throw new OutputArtifactError("invalid_ref", "Artifact stream yielded a non-Uint8Array chunk");
126
+ }
127
+ const copy = new Uint8Array(chunk);
128
+ totalBytes += copy.byteLength;
129
+ appendTail(copy);
130
+ if (truncated)
131
+ continue;
132
+ headChunks.push(copy);
133
+ headBytes += copy.byteLength;
134
+ if (headBytes > OUTPUT_ARTIFACT_MAX_BUFFER_BYTES)
135
+ truncated = true;
136
+ }
137
+ throwIfAborted();
138
+ if (!truncated) {
139
+ return { bytes: concatChunks(headChunks, totalBytes), totalBytes, truncated };
140
+ }
141
+ return { bytes: buildTruncatedView(headChunks, tailChunks, totalBytes), totalBytes, truncated: true };
142
+ };
26
143
  export function createCapabilityRuntime(inputHost, options = {}) {
27
144
  // D-075 S4 third batch: the communication/turnContext host services carry
28
145
  // host-owned callbacks. They must ride by reference (like the trace
@@ -114,7 +231,7 @@ export function createCapabilityRuntime(inputHost, options = {}) {
114
231
  const onOutputArtifactCommit = options.onOutputArtifactCommit;
115
232
  const toolExecutionContext = options.toolExecutionContext;
116
233
  const state = createCapabilityRuntimeState();
117
- const { tools, skills, retryPolicies, compactionPolicies, overflowPolicies, branchSummaryPolicies, runLoopStrategies, loopHooks, commands, operations, rpcMethods, contextStrategies, pluginCapabilities, providerHeaderTransforms, streamFnWrappers, contributionPoints, lifecycleDefinitions, lifecycleRegistrations, subscribers, statuses, pluginRegistrations, apiStates, activeOwnerTokens, outputArtifacts, stateByOwner, stateRevisionsByOwner, stateWatchers, stateByInstance, stateRevisionsByInstance, stateWatchersByInstance, logs, spans, lifecycleDeliveryQueues, pluginRejections, } = state;
234
+ const { tools, skills, retryPolicies, compactionPolicies, overflowPolicies, branchSummaryPolicies, runLoopStrategies, loopHooks, commands, operations, rpcMethods, contextStrategies, pluginCapabilities, providerHeaderTransforms, streamFnWrappers, contributionPoints, lifecycleDefinitions, lifecycleRegistrations, subscribers, statuses, pluginRegistrations, apiStates, activeOwnerTokens, outputArtifacts, stateByOwner, stateRevisionsByOwner, stateWatchers, stateByInstance, stateRevisionsByInstance, stateWatchersByInstance, spans, lifecycleDeliveryQueues, } = state;
118
235
  const runtimeState = state;
119
236
  // 契约 A(D-082 批 3b):store 字段保持基础注册结构类型(store 不感知链序),
120
237
  // 本运行时经此类型视图写入/读取链序元数据;唯一写入方是 registerStreamFnWrapper
@@ -338,7 +455,7 @@ export function createCapabilityRuntime(inputHost, options = {}) {
338
455
  ...(fields === undefined ? {} : { fields: detachedSnapshot(fields) }),
339
456
  ...(cause === undefined ? {} : { cause: detachedSnapshot(cause) }),
340
457
  };
341
- logs.push(record);
458
+ pushRuntimeLog(state, record);
342
459
  // 插件日志宿主转发(设计 §7.2):入环后同步转发一次。回调抛错直接吞掉——
343
460
  // 与 notifyToolRegistryChange 同守"观察者故障不打断调用方"的边界,但错误
344
461
  // 通道不同:不引入无读者的计数,也绝不经 recordLog 再记录(回调契约禁止
@@ -895,7 +1012,7 @@ export function createCapabilityRuntime(inputHost, options = {}) {
895
1012
  if (!state.active || !activeOwnerTokens.has(ownerToken) || event.owner !== owner)
896
1013
  return;
897
1014
  if (event.event === "start") {
898
- statuses.set(event.operationId, "running");
1015
+ setOperationStatus(runtimeState, event.operationId, "running");
899
1016
  reportOperationStart(event.operationId, event.operationKind, [ownerToken]);
900
1017
  }
901
1018
  else if (event.event === "step") {
@@ -904,12 +1021,12 @@ export function createCapabilityRuntime(inputHost, options = {}) {
904
1021
  reportOperationStep(event.operationId, event.operationKind, [ownerToken], event.progress, event.step);
905
1022
  }
906
1023
  else if (event.event === "cancel") {
907
- statuses.set(event.operationId, "cancelled");
1024
+ setOperationStatus(runtimeState, event.operationId, "cancelled");
908
1025
  reportOperationCancel(event.operationId, event.operationKind, [ownerToken]);
909
1026
  }
910
1027
  else {
911
1028
  const status = event.status ?? "failed";
912
- statuses.set(event.operationId, status);
1029
+ setOperationStatus(runtimeState, event.operationId, status);
913
1030
  reportOperationEnd(event.operationId, event.operationKind, status, [ownerToken]);
914
1031
  }
915
1032
  };
@@ -984,7 +1101,7 @@ export function createCapabilityRuntime(inputHost, options = {}) {
984
1101
  status: "running",
985
1102
  attributes: detachedSnapshot(attributes ?? {}),
986
1103
  };
987
- spans.set(spanId, snapshot);
1104
+ setDiagnosticsSpan(runtimeState, spanId, snapshot);
988
1105
  let ended = false;
989
1106
  const span = {
990
1107
  traceId,
@@ -1091,7 +1208,7 @@ export function createCapabilityRuntime(inputHost, options = {}) {
1091
1208
  const sequence = ++operationSequence;
1092
1209
  const operationId = createRuntimeId("capability-operation", sequence, `capability:${owner}:${id}@${version}:${sequence}`);
1093
1210
  const handle = trackOperation([ownerToken, registered.ownerToken], new RuntimeOperation(operationId, (value, context) => invokePluginCapability(registered, value, context.signal), detachedSnapshot(input), (status) => {
1094
- statuses.set(operationId, status);
1211
+ setOperationStatus(runtimeState, operationId, status);
1095
1212
  if (status === "running") {
1096
1213
  reportCapabilityCall("start", operationId, owner, registered, [
1097
1214
  ownerToken,
@@ -1105,7 +1222,7 @@ export function createCapabilityRuntime(inputHost, options = {}) {
1105
1222
  ]);
1106
1223
  }
1107
1224
  }, (status) => reportCapabilityCall("end", operationId, owner, registered, [ownerToken, registered.ownerToken], status), () => false));
1108
- statuses.set(operationId, handle.status());
1225
+ setOperationStatus(runtimeState, operationId, handle.status());
1109
1226
  const signal = callOptions?.signal;
1110
1227
  if (signal) {
1111
1228
  if (signal.aborted)
@@ -1258,30 +1375,10 @@ export function createCapabilityRuntime(inputHost, options = {}) {
1258
1375
  }
1259
1376
  };
1260
1377
  throwIfAborted();
1261
- const chunks = [];
1262
- let sizeBytes = 0;
1263
- if (input.data instanceof Uint8Array) {
1264
- chunks.push(new Uint8Array(input.data));
1265
- sizeBytes = input.data.byteLength;
1266
- }
1267
- else {
1268
- for await (const chunk of input.data) {
1269
- throwIfAborted();
1270
- if (!(chunk instanceof Uint8Array)) {
1271
- throw new OutputArtifactError("invalid_ref", "Artifact stream yielded a non-Uint8Array chunk");
1272
- }
1273
- const copy = new Uint8Array(chunk);
1274
- chunks.push(copy);
1275
- sizeBytes += copy.byteLength;
1276
- }
1277
- }
1278
- throwIfAborted();
1279
- const bytes = new Uint8Array(sizeBytes);
1280
- let offset = 0;
1281
- for (const chunk of chunks) {
1282
- bytes.set(chunk, offset);
1283
- offset += chunk.byteLength;
1284
- }
1378
+ // M4 双层限额:驻留缓冲封顶(形态见 bufferOutputArtifactData)。
1379
+ // sizeBytes/truncated 是运行时计算值——调用方传入的 truncated 只过
1380
+ // 类型校验,其值在组 ref 处被计算值覆盖,不再生效。
1381
+ const { bytes, totalBytes, truncated } = await bufferOutputArtifactData(input.data, throwIfAborted);
1285
1382
  // A stream may yield after the plugin has been revoked. Never commit
1286
1383
  // bytes after the lifecycle boundary has closed.
1287
1384
  assertUsable();
@@ -1293,16 +1390,20 @@ export function createCapabilityRuntime(inputHost, options = {}) {
1293
1390
  artifactId,
1294
1391
  kind: input.kind,
1295
1392
  mediaType: input.mediaType,
1296
- sizeBytes,
1297
- truncated: input.truncated,
1393
+ sizeBytes: totalBytes,
1394
+ truncated,
1298
1395
  createdAt: clock(),
1299
1396
  };
1300
1397
  outputArtifacts.set(artifactId, { ref, bytes, ownerToken });
1301
1398
  // Durable mirroring is a host concern, not a runtime one: the commit
1302
- // observer receives the same bytes reachable through stat/read. An
1303
- // observer failure is recorded but never fails the committed artifact,
1304
- // and cleanup/revoke intentionally do not re-emit (durable records are
1305
- // meant to outlive the in-memory lifecycle boundary).
1399
+ // observer receives the resident buffer reachable through stat/read.
1400
+ // That buffer is capped at OUTPUT_ARTIFACT_MAX_BUFFER_BYTES, so for an
1401
+ // oversized artifact the observer intentionally receives the truncated
1402
+ // head+marker+tail view (durable mirrors persist the truncated view)
1403
+ // while ref.sizeBytes keeps the original total. An observer failure is
1404
+ // recorded but never fails the committed artifact, and cleanup/revoke
1405
+ // intentionally do not re-emit (durable records are meant to outlive
1406
+ // the in-memory lifecycle boundary).
1306
1407
  if (onOutputArtifactCommit) {
1307
1408
  try {
1308
1409
  onOutputArtifactCommit({ ref: { ...ref }, bytes });
@@ -1867,7 +1968,7 @@ export function createCapabilityRuntime(inputHost, options = {}) {
1867
1968
  const sequence = ++operationSequence;
1868
1969
  const id = createRuntimeId("operation", sequence, `operation:${owner}:${operation}:${sequence}`);
1869
1970
  const handle = trackOperation([ownerToken, registered.ownerToken], new RuntimeOperation(id, (value, context) => invokeRegisteredCapability(registered, (handler) => handler(value, context)), input, (status) => {
1870
- statuses.set(id, status);
1971
+ setOperationStatus(runtimeState, id, status);
1871
1972
  if (status === "running") {
1872
1973
  reportOperationStart(id, operation, [ownerToken, registered.ownerToken]);
1873
1974
  }
@@ -1878,7 +1979,7 @@ export function createCapabilityRuntime(inputHost, options = {}) {
1878
1979
  let step = 0;
1879
1980
  return (progress) => reportOperationStep(id, operation, [ownerToken, registered.ownerToken], progress, ++step);
1880
1981
  })()));
1881
- statuses.set(id, handle.status());
1982
+ setOperationStatus(runtimeState, id, handle.status());
1882
1983
  const signal = options?.signal;
1883
1984
  if (signal) {
1884
1985
  if (signal.aborted)
@@ -2010,6 +2111,7 @@ export function createCapabilityRuntime(inputHost, options = {}) {
2010
2111
  const definition = lifecycleDefinitions.get(lifecycleEventKey(id, version));
2011
2112
  return definition !== undefined && activeOwnerTokens.has(definition.ownerToken);
2012
2113
  },
2114
+ hasLifecycleSubscribers: (type, version) => (state.lifecycleRegistrations.get(lifecycleEventKey(type, version))?.size ?? 0) > 0,
2013
2115
  dispatchLifecycle,
2014
2116
  async recordPluginRejection(rejection) {
2015
2117
  const detached = Object.freeze({
@@ -2018,7 +2120,7 @@ export function createCapabilityRuntime(inputHost, options = {}) {
2018
2120
  ...(rejection.pluginId === undefined ? {} : { pluginId: rejection.pluginId }),
2019
2121
  message: rejection.message,
2020
2122
  });
2021
- pluginRejections.push(detached);
2123
+ pushPluginRejection(state, detached);
2022
2124
  const rejectedEventDefinition = lifecycleDefinitions.get(lifecycleEventKey(PLUGIN_REJECTED_EVENT_ID, PLUGIN_REJECTED_EVENT_VERSION));
2023
2125
  if (!rejectedEventDefinition || !activeOwnerTokens.has(rejectedEventDefinition.ownerToken)) {
2024
2126
  return;