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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (360) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/bundled-plugins/agent-loop-policy/agent-forge.json +19 -0
  3. package/bundled-plugins/agent-loop-policy/dist/entry.d.ts +28 -0
  4. package/bundled-plugins/agent-loop-policy/dist/entry.d.ts.map +1 -0
  5. package/bundled-plugins/agent-loop-policy/dist/entry.js +69 -0
  6. package/bundled-plugins/agent-loop-policy/dist/entry.js.map +1 -0
  7. package/bundled-plugins/agent-loop-policy/dist/loop-guard.d.ts +199 -0
  8. package/bundled-plugins/agent-loop-policy/dist/loop-guard.d.ts.map +1 -0
  9. package/bundled-plugins/agent-loop-policy/dist/loop-guard.js +208 -0
  10. package/bundled-plugins/agent-loop-policy/dist/loop-guard.js.map +1 -0
  11. package/bundled-plugins/agent-loop-policy/dist/run-loop-strategy.d.ts +17 -0
  12. package/bundled-plugins/agent-loop-policy/dist/run-loop-strategy.d.ts.map +1 -0
  13. package/bundled-plugins/agent-loop-policy/dist/run-loop-strategy.js +18 -0
  14. package/bundled-plugins/agent-loop-policy/dist/run-loop-strategy.js.map +1 -0
  15. package/bundled-plugins/agent-loop-policy/plugin.json +7 -0
  16. package/bundled-plugins/coding-tools/agent-forge.json +19 -0
  17. package/{dist/core/tools → bundled-plugins/coding-tools/dist}/bash.d.ts +5 -44
  18. package/bundled-plugins/coding-tools/dist/bash.d.ts.map +1 -0
  19. package/{dist/core/tools → bundled-plugins/coding-tools/dist}/bash.js +15 -119
  20. package/bundled-plugins/coding-tools/dist/bash.js.map +1 -0
  21. package/bundled-plugins/coding-tools/dist/capability.d.ts +25 -0
  22. package/bundled-plugins/coding-tools/dist/capability.d.ts.map +1 -0
  23. package/bundled-plugins/coding-tools/dist/capability.js +98 -0
  24. package/bundled-plugins/coding-tools/dist/capability.js.map +1 -0
  25. package/bundled-plugins/coding-tools/dist/config.d.ts +8 -0
  26. package/bundled-plugins/coding-tools/dist/config.d.ts.map +1 -0
  27. package/bundled-plugins/coding-tools/dist/config.js +8 -0
  28. package/bundled-plugins/coding-tools/dist/config.js.map +1 -0
  29. package/{dist/core/tools → bundled-plugins/coding-tools/dist}/edit.d.ts +3 -3
  30. package/bundled-plugins/coding-tools/dist/edit.d.ts.map +1 -0
  31. package/{dist/core/tools → bundled-plugins/coding-tools/dist}/edit.js +12 -10
  32. package/bundled-plugins/coding-tools/dist/edit.js.map +1 -0
  33. package/bundled-plugins/coding-tools/dist/entry.d.ts +14 -0
  34. package/bundled-plugins/coding-tools/dist/entry.d.ts.map +1 -0
  35. package/bundled-plugins/coding-tools/dist/entry.js +23 -0
  36. package/bundled-plugins/coding-tools/dist/entry.js.map +1 -0
  37. package/{dist/core/tools → bundled-plugins/coding-tools/dist}/find.d.ts +4 -4
  38. package/bundled-plugins/coding-tools/dist/find.d.ts.map +1 -0
  39. package/{dist/core/tools → bundled-plugins/coding-tools/dist}/find.js +10 -8
  40. package/bundled-plugins/coding-tools/dist/find.js.map +1 -0
  41. package/{dist/core/tools → bundled-plugins/coding-tools/dist}/grep.d.ts +3 -3
  42. package/bundled-plugins/coding-tools/dist/grep.d.ts.map +1 -0
  43. package/{dist/core/tools → bundled-plugins/coding-tools/dist}/grep.js +10 -8
  44. package/bundled-plugins/coding-tools/dist/grep.js.map +1 -0
  45. package/bundled-plugins/coding-tools/dist/index.d.ts +17 -0
  46. package/bundled-plugins/coding-tools/dist/index.d.ts.map +1 -0
  47. package/bundled-plugins/coding-tools/dist/index.js +17 -0
  48. package/bundled-plugins/coding-tools/dist/index.js.map +1 -0
  49. package/{dist/core/tools → bundled-plugins/coding-tools/dist}/ls.d.ts +3 -3
  50. package/bundled-plugins/coding-tools/dist/ls.d.ts.map +1 -0
  51. package/{dist/core/tools → bundled-plugins/coding-tools/dist}/ls.js +8 -6
  52. package/{dist/core/tools → bundled-plugins/coding-tools/dist}/ls.js.map +1 -1
  53. package/{dist/core/tools → bundled-plugins/coding-tools/dist}/powershell.d.ts +2 -1
  54. package/bundled-plugins/coding-tools/dist/powershell.d.ts.map +1 -0
  55. package/{dist/core/tools → bundled-plugins/coding-tools/dist}/powershell.js +6 -3
  56. package/bundled-plugins/coding-tools/dist/powershell.js.map +1 -0
  57. package/{dist/core/tools → bundled-plugins/coding-tools/dist}/read.d.ts +3 -3
  58. package/bundled-plugins/coding-tools/dist/read.d.ts.map +1 -0
  59. package/{dist/core/tools → bundled-plugins/coding-tools/dist}/read.js +15 -13
  60. package/bundled-plugins/coding-tools/dist/read.js.map +1 -0
  61. package/bundled-plugins/coding-tools/dist/types.d.ts +74 -0
  62. package/bundled-plugins/coding-tools/dist/types.d.ts.map +1 -0
  63. package/bundled-plugins/coding-tools/dist/types.js +28 -0
  64. package/bundled-plugins/coding-tools/dist/types.js.map +1 -0
  65. package/{dist/core/tools → bundled-plugins/coding-tools/dist}/write.d.ts +2 -2
  66. package/bundled-plugins/coding-tools/dist/write.d.ts.map +1 -0
  67. package/{dist/core/tools → bundled-plugins/coding-tools/dist}/write.js +11 -9
  68. package/bundled-plugins/coding-tools/dist/write.js.map +1 -0
  69. package/bundled-plugins/coding-tools/plugin.json +10 -0
  70. package/bundled-plugins/compaction-policy/agent-forge.json +19 -0
  71. package/bundled-plugins/compaction-policy/dist/branch-summary-policy.d.ts +6 -0
  72. package/bundled-plugins/compaction-policy/dist/branch-summary-policy.d.ts.map +1 -0
  73. package/bundled-plugins/compaction-policy/dist/branch-summary-policy.js +19 -0
  74. package/bundled-plugins/compaction-policy/dist/branch-summary-policy.js.map +1 -0
  75. package/bundled-plugins/compaction-policy/dist/compaction-policy.d.ts +6 -0
  76. package/bundled-plugins/compaction-policy/dist/compaction-policy.d.ts.map +1 -0
  77. package/bundled-plugins/compaction-policy/dist/compaction-policy.js +38 -0
  78. package/bundled-plugins/compaction-policy/dist/compaction-policy.js.map +1 -0
  79. package/bundled-plugins/compaction-policy/dist/entry.d.ts +13 -0
  80. package/bundled-plugins/compaction-policy/dist/entry.d.ts.map +1 -0
  81. package/bundled-plugins/compaction-policy/dist/entry.js +23 -0
  82. package/bundled-plugins/compaction-policy/dist/entry.js.map +1 -0
  83. package/bundled-plugins/compaction-policy/plugin.json +10 -0
  84. package/bundled-plugins/mcp-http/dist/index.d.ts +8 -0
  85. package/bundled-plugins/mcp-http/dist/index.d.ts.map +1 -0
  86. package/bundled-plugins/mcp-http/dist/index.js +8 -0
  87. package/bundled-plugins/mcp-http/dist/index.js.map +1 -0
  88. package/bundled-plugins/mcp-http/dist/mcp-http.d.ts.map +1 -0
  89. package/{dist/plugins → bundled-plugins/mcp-http/dist}/mcp-http.js +1 -1
  90. package/bundled-plugins/mcp-http/dist/mcp-http.js.map +1 -0
  91. package/bundled-plugins/overflow-policy/agent-forge.json +19 -0
  92. package/bundled-plugins/overflow-policy/dist/entry.d.ts +16 -0
  93. package/bundled-plugins/overflow-policy/dist/entry.d.ts.map +1 -0
  94. package/bundled-plugins/overflow-policy/dist/entry.js +35 -0
  95. package/bundled-plugins/overflow-policy/dist/entry.js.map +1 -0
  96. package/bundled-plugins/overflow-policy/plugin.json +10 -0
  97. package/bundled-plugins/provider-failover/agent-forge.json +19 -0
  98. package/bundled-plugins/provider-failover/dist/entry.d.ts +8 -0
  99. package/bundled-plugins/provider-failover/dist/entry.d.ts.map +1 -0
  100. package/bundled-plugins/provider-failover/dist/entry.js +8 -0
  101. package/bundled-plugins/provider-failover/dist/entry.js.map +1 -0
  102. package/bundled-plugins/provider-failover/dist/provider-failover.d.ts +122 -0
  103. package/bundled-plugins/provider-failover/dist/provider-failover.d.ts.map +1 -0
  104. package/{dist/core/extensions → bundled-plugins/provider-failover/dist}/provider-failover.js +143 -56
  105. package/bundled-plugins/provider-failover/dist/provider-failover.js.map +1 -0
  106. package/bundled-plugins/provider-failover/plugin.json +7 -0
  107. package/bundled-plugins/retry-policy/agent-forge.json +19 -0
  108. package/bundled-plugins/retry-policy/dist/entry.d.ts +16 -0
  109. package/bundled-plugins/retry-policy/dist/entry.d.ts.map +1 -0
  110. package/bundled-plugins/retry-policy/dist/entry.js +34 -0
  111. package/bundled-plugins/retry-policy/dist/entry.js.map +1 -0
  112. package/bundled-plugins/retry-policy/plugin.json +10 -0
  113. package/dist/bundle/.build-manifest.json +61 -117
  114. package/dist/bundle/chunks/{anthropic-messages-ALDZBUKI.js → anthropic-messages-PLAKXR73.js} +1 -1
  115. package/dist/bundle/chunks/{azure-openai-responses-A2WJWZFB.js → azure-openai-responses-OUWQ2AZD.js} +1 -1
  116. package/dist/bundle/chunks/{chunk-CIX3FSBK.js → chunk-A3JYRWB6.js} +1 -1
  117. package/dist/bundle/chunks/{chunk-SQFG22WN.js → chunk-AC2FIS4G.js} +1 -1
  118. package/dist/bundle/chunks/chunk-AQLNTW2B.js +664 -0
  119. package/dist/bundle/chunks/chunk-D3ARGZFR.js +13 -0
  120. package/dist/bundle/chunks/{chunk-YJCQVXW5.js → chunk-HTEVUY7F.js} +1 -1
  121. package/dist/bundle/chunks/{chunk-Y7HXTASS.js → chunk-HV64ASMT.js} +1 -1
  122. package/dist/bundle/chunks/chunk-LZOEQITZ.js +855 -0
  123. package/dist/bundle/chunks/{chunk-7ZY7IXZD.js → chunk-TRDNDS6A.js} +1 -1
  124. package/dist/bundle/chunks/chunk-Z72JWUZ4.js +4 -0
  125. package/dist/bundle/chunks/{google-generative-ai-NIB4WONV.js → google-generative-ai-DLII6DAT.js} +1 -1
  126. package/dist/bundle/chunks/{google-vertex-DCPYUEUO.js → google-vertex-G7BZL7GM.js} +1 -1
  127. package/dist/bundle/chunks/image-resize-worker.js +2 -2
  128. package/dist/bundle/chunks/{mistral-conversations-OC6LA5XL.js → mistral-conversations-JXUK24ID.js} +1 -1
  129. package/dist/bundle/chunks/{openai-codex-responses-IO2X4Y7L.js → openai-codex-responses-5GSGFIPG.js} +1 -1
  130. package/dist/bundle/chunks/{openai-completions-XYQQHETU.js → openai-completions-EI2I6DTG.js} +1 -1
  131. package/dist/bundle/chunks/{openai-responses-DLIRN3CI.js → openai-responses-AUJQ3NWT.js} +1 -1
  132. package/dist/bundle/chunks/{pi-messages-E6RRYBO7.js → pi-messages-PWU2VJMR.js} +1 -1
  133. package/dist/bundle/chunks/virtual-modules-WF6WRHP7.js +5 -0
  134. package/dist/bundle/cli.js +1 -1
  135. package/dist/bundle/client.js +1 -1
  136. package/dist/bundle/index.js +3 -3
  137. package/dist/bundle/rpc-entry.js +1 -1
  138. package/dist/capabilities/builtin.d.ts +1 -1
  139. package/dist/capabilities/builtin.d.ts.map +1 -1
  140. package/dist/capabilities/builtin.js +5 -0
  141. package/dist/capabilities/builtin.js.map +1 -1
  142. package/dist/cli/plugin-command.d.ts.map +1 -1
  143. package/dist/cli/plugin-command.js +17 -1
  144. package/dist/cli/plugin-command.js.map +1 -1
  145. package/dist/config.d.ts +2 -3
  146. package/dist/config.d.ts.map +1 -1
  147. package/dist/config.js +2 -4
  148. package/dist/config.js.map +1 -1
  149. package/dist/core/agent-session-bash.d.ts +1 -1
  150. package/dist/core/agent-session-bash.d.ts.map +1 -1
  151. package/dist/core/agent-session-bash.js +1 -1
  152. package/dist/core/agent-session-bash.js.map +1 -1
  153. package/dist/core/agent-session-compaction.d.ts.map +1 -1
  154. package/dist/core/agent-session-compaction.js +14 -1
  155. package/dist/core/agent-session-compaction.js.map +1 -1
  156. package/dist/core/agent-session-internal.d.ts +1 -1
  157. package/dist/core/agent-session-internal.d.ts.map +1 -1
  158. package/dist/core/agent-session-internal.js.map +1 -1
  159. package/dist/core/agent-session-loop.d.ts +4 -3
  160. package/dist/core/agent-session-loop.d.ts.map +1 -1
  161. package/dist/core/agent-session-loop.js +9 -6
  162. package/dist/core/agent-session-loop.js.map +1 -1
  163. package/dist/core/agent-session-retry.d.ts +1 -1
  164. package/dist/core/agent-session-retry.d.ts.map +1 -1
  165. package/dist/core/agent-session-retry.js +32 -3
  166. package/dist/core/agent-session-retry.js.map +1 -1
  167. package/dist/core/agent-session-services.d.ts.map +1 -1
  168. package/dist/core/agent-session-services.js +30 -9
  169. package/dist/core/agent-session-services.js.map +1 -1
  170. package/dist/core/agent-session-tools.d.ts.map +1 -1
  171. package/dist/core/agent-session-tools.js +5 -1
  172. package/dist/core/agent-session-tools.js.map +1 -1
  173. package/dist/core/agent-session.d.ts +12 -13
  174. package/dist/core/agent-session.d.ts.map +1 -1
  175. package/dist/core/agent-session.js +56 -34
  176. package/dist/core/agent-session.js.map +1 -1
  177. package/dist/core/bash-executor.d.ts +1 -1
  178. package/dist/core/bash-executor.d.ts.map +1 -1
  179. package/dist/core/bash-executor.js.map +1 -1
  180. package/dist/core/extensions/bootstrap-agent-loop.d.ts +23 -151
  181. package/dist/core/extensions/bootstrap-agent-loop.d.ts.map +1 -1
  182. package/dist/core/extensions/bootstrap-agent-loop.js +28 -290
  183. package/dist/core/extensions/bootstrap-agent-loop.js.map +1 -1
  184. package/dist/core/extensions/capability-runtime-types.d.ts +5 -3
  185. package/dist/core/extensions/capability-runtime-types.d.ts.map +1 -1
  186. package/dist/core/extensions/capability-runtime-types.js.map +1 -1
  187. package/dist/core/extensions/capability-runtime.d.ts.map +1 -1
  188. package/dist/core/extensions/capability-runtime.js +42 -6
  189. package/dist/core/extensions/capability-runtime.js.map +1 -1
  190. package/dist/core/extensions/index.d.ts +12 -5
  191. package/dist/core/extensions/index.d.ts.map +1 -1
  192. package/dist/core/extensions/index.js +12 -5
  193. package/dist/core/extensions/index.js.map +1 -1
  194. package/dist/core/extensions/virtual-modules.d.ts.map +1 -1
  195. package/dist/core/extensions/virtual-modules.js +65 -0
  196. package/dist/core/extensions/virtual-modules.js.map +1 -1
  197. package/dist/core/facade/coding-agent-facade.d.ts +1 -1
  198. package/dist/core/facade/coding-agent-facade.d.ts.map +1 -1
  199. package/dist/core/facade/coding-agent-facade.js.map +1 -1
  200. package/dist/core/i18n/locales/zh-cn/core-contract-core.d.ts +1 -1
  201. package/dist/core/i18n/locales/zh-cn/core-contract-core.d.ts.map +1 -1
  202. package/dist/core/i18n/locales/zh-cn/core-contract-core.js +1 -1
  203. package/dist/core/i18n/locales/zh-cn/core-contract-core.js.map +1 -1
  204. package/dist/core/i18n/locales/zh-cn/core-contract-extensions.d.ts.map +1 -1
  205. package/dist/core/i18n/locales/zh-cn/core-contract-extensions.js +2 -4
  206. package/dist/core/i18n/locales/zh-cn/core-contract-extensions.js.map +1 -1
  207. package/dist/core/i18n/locales/zh-cn/core-errors.d.ts.map +1 -1
  208. package/dist/core/i18n/locales/zh-cn/core-errors.js +3 -1
  209. package/dist/core/i18n/locales/zh-cn/core-errors.js.map +1 -1
  210. package/dist/core/sdk.d.ts +10 -3
  211. package/dist/core/sdk.d.ts.map +1 -1
  212. package/dist/core/sdk.js +263 -77
  213. package/dist/core/sdk.js.map +1 -1
  214. package/dist/core/tools/bash-operations.d.ts +41 -0
  215. package/dist/core/tools/bash-operations.d.ts.map +1 -0
  216. package/dist/core/tools/bash-operations.js +113 -0
  217. package/dist/core/tools/bash-operations.js.map +1 -0
  218. package/dist/core/tools/index.d.ts +12 -36
  219. package/dist/core/tools/index.d.ts.map +1 -1
  220. package/dist/core/tools/index.js +1 -117
  221. package/dist/core/tools/index.js.map +1 -1
  222. package/dist/core/tools/readme-path.d.ts +3 -0
  223. package/dist/core/tools/readme-path.d.ts.map +1 -0
  224. package/dist/core/tools/readme-path.js +15 -0
  225. package/dist/core/tools/readme-path.js.map +1 -0
  226. package/dist/index.d.ts +3 -19
  227. package/dist/index.d.ts.map +1 -1
  228. package/dist/index.js +6 -39
  229. package/dist/index.js.map +1 -1
  230. package/dist/modes/interactive/components/tool-execution.d.ts +0 -1
  231. package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  232. package/dist/modes/interactive/components/tool-execution.js +9 -25
  233. package/dist/modes/interactive/components/tool-execution.js.map +1 -1
  234. package/dist/plugins/ecosystem/cli.d.ts.map +1 -1
  235. package/dist/plugins/ecosystem/cli.js +14 -2
  236. package/dist/plugins/ecosystem/cli.js.map +1 -1
  237. package/dist/plugins/ecosystem/node-npm-registry-source.d.ts +7 -2
  238. package/dist/plugins/ecosystem/node-npm-registry-source.d.ts.map +1 -1
  239. package/dist/plugins/ecosystem/node-npm-registry-source.js +64 -9
  240. package/dist/plugins/ecosystem/node-npm-registry-source.js.map +1 -1
  241. package/dist/plugins/ecosystem/node-plugin-acquisition-host.d.ts.map +1 -1
  242. package/dist/plugins/ecosystem/node-plugin-acquisition-host.js +6 -0
  243. package/dist/plugins/ecosystem/node-plugin-acquisition-host.js.map +1 -1
  244. package/dist/profiles/builtin-suites.d.ts +5 -1
  245. package/dist/profiles/builtin-suites.d.ts.map +1 -1
  246. package/dist/profiles/builtin-suites.js +6 -1
  247. package/dist/profiles/builtin-suites.js.map +1 -1
  248. package/examples/extensions/bash-spawn-hook/index.ts +7 -2
  249. package/examples/extensions/built-in-tool-renderer/index.ts +4 -2
  250. package/examples/extensions/minimal-mode/index.ts +2 -2
  251. package/examples/extensions/truncated-tool/index.ts +1 -1
  252. package/examples/extensions/with-deps/package-lock.json +2 -2
  253. package/examples/extensions/with-deps/package.json +1 -1
  254. package/examples/extensions/with-deps/plugin.json +1 -1
  255. package/package.json +3 -2
  256. package/dist/bundle/chunks/chunk-6ZKDNZHA.js +0 -145
  257. package/dist/bundle/chunks/chunk-HLJEVRWP.js +0 -13
  258. package/dist/bundle/chunks/chunk-YGHQME4V.js +0 -1456
  259. package/dist/bundle/chunks/virtual-modules-KZ5DRH7Q.js +0 -2
  260. package/dist/core/extensions/bootstrap-branch-summary-policy.d.ts +0 -7
  261. package/dist/core/extensions/bootstrap-branch-summary-policy.d.ts.map +0 -1
  262. package/dist/core/extensions/bootstrap-branch-summary-policy.js +0 -28
  263. package/dist/core/extensions/bootstrap-branch-summary-policy.js.map +0 -1
  264. package/dist/core/extensions/bootstrap-compaction-policy.d.ts +0 -7
  265. package/dist/core/extensions/bootstrap-compaction-policy.d.ts.map +0 -1
  266. package/dist/core/extensions/bootstrap-compaction-policy.js +0 -48
  267. package/dist/core/extensions/bootstrap-compaction-policy.js.map +0 -1
  268. package/dist/core/extensions/bootstrap-overflow-policy.d.ts +0 -7
  269. package/dist/core/extensions/bootstrap-overflow-policy.d.ts.map +0 -1
  270. package/dist/core/extensions/bootstrap-overflow-policy.js +0 -30
  271. package/dist/core/extensions/bootstrap-overflow-policy.js.map +0 -1
  272. package/dist/core/extensions/bootstrap-retry-policy.d.ts +0 -7
  273. package/dist/core/extensions/bootstrap-retry-policy.d.ts.map +0 -1
  274. package/dist/core/extensions/bootstrap-retry-policy.js +0 -29
  275. package/dist/core/extensions/bootstrap-retry-policy.js.map +0 -1
  276. package/dist/core/extensions/bootstrap-tools.d.ts +0 -20
  277. package/dist/core/extensions/bootstrap-tools.d.ts.map +0 -1
  278. package/dist/core/extensions/bootstrap-tools.js +0 -36
  279. package/dist/core/extensions/bootstrap-tools.js.map +0 -1
  280. package/dist/core/extensions/provider-failover.d.ts +0 -110
  281. package/dist/core/extensions/provider-failover.d.ts.map +0 -1
  282. package/dist/core/extensions/provider-failover.js.map +0 -1
  283. package/dist/core/tools/bash.d.ts.map +0 -1
  284. package/dist/core/tools/bash.js.map +0 -1
  285. package/dist/core/tools/edit.d.ts.map +0 -1
  286. package/dist/core/tools/edit.js.map +0 -1
  287. package/dist/core/tools/find.d.ts.map +0 -1
  288. package/dist/core/tools/find.js.map +0 -1
  289. package/dist/core/tools/grep.d.ts.map +0 -1
  290. package/dist/core/tools/grep.js.map +0 -1
  291. package/dist/core/tools/ls.d.ts.map +0 -1
  292. package/dist/core/tools/powershell.d.ts.map +0 -1
  293. package/dist/core/tools/powershell.js.map +0 -1
  294. package/dist/core/tools/read.d.ts.map +0 -1
  295. package/dist/core/tools/read.js.map +0 -1
  296. package/dist/core/tools/write.d.ts.map +0 -1
  297. package/dist/core/tools/write.js.map +0 -1
  298. package/dist/plugins/mcp-http.d.ts.map +0 -1
  299. package/dist/plugins/mcp-http.js.map +0 -1
  300. package/dist/profile/child-facade.d.ts +0 -44
  301. package/dist/profile/child-facade.d.ts.map +0 -1
  302. package/dist/profile/child-facade.js +0 -56
  303. package/dist/profile/child-facade.js.map +0 -1
  304. package/dist/profile/dependency-wiring.d.ts +0 -48
  305. package/dist/profile/dependency-wiring.d.ts.map +0 -1
  306. package/dist/profile/dependency-wiring.js +0 -56
  307. package/dist/profile/dependency-wiring.js.map +0 -1
  308. package/dist/profile/domain-recovery.d.ts +0 -60
  309. package/dist/profile/domain-recovery.d.ts.map +0 -1
  310. package/dist/profile/domain-recovery.js +0 -94
  311. package/dist/profile/domain-recovery.js.map +0 -1
  312. package/dist/profile/first-roles.d.ts +0 -30
  313. package/dist/profile/first-roles.d.ts.map +0 -1
  314. package/dist/profile/first-roles.js +0 -83
  315. package/dist/profile/first-roles.js.map +0 -1
  316. package/dist/profile/goal-plugin.d.ts +0 -38
  317. package/dist/profile/goal-plugin.d.ts.map +0 -1
  318. package/dist/profile/goal-plugin.js +0 -132
  319. package/dist/profile/goal-plugin.js.map +0 -1
  320. package/dist/profile/plan-plugin.d.ts +0 -44
  321. package/dist/profile/plan-plugin.d.ts.map +0 -1
  322. package/dist/profile/plan-plugin.js +0 -157
  323. package/dist/profile/plan-plugin.js.map +0 -1
  324. package/dist/profile/policy-manifest.d.ts +0 -53
  325. package/dist/profile/policy-manifest.d.ts.map +0 -1
  326. package/dist/profile/policy-manifest.js +0 -53
  327. package/dist/profile/policy-manifest.js.map +0 -1
  328. package/dist/profile/role-assembly.d.ts +0 -47
  329. package/dist/profile/role-assembly.d.ts.map +0 -1
  330. package/dist/profile/role-assembly.js +0 -31
  331. package/dist/profile/role-assembly.js.map +0 -1
  332. package/dist/profile/role-catalog.d.ts +0 -43
  333. package/dist/profile/role-catalog.d.ts.map +0 -1
  334. package/dist/profile/role-catalog.js +0 -132
  335. package/dist/profile/role-catalog.js.map +0 -1
  336. package/dist/profile/role-orchestrator.d.ts +0 -123
  337. package/dist/profile/role-orchestrator.d.ts.map +0 -1
  338. package/dist/profile/role-orchestrator.js +0 -195
  339. package/dist/profile/role-orchestrator.js.map +0 -1
  340. package/dist/profile/role-runner.d.ts +0 -99
  341. package/dist/profile/role-runner.d.ts.map +0 -1
  342. package/dist/profile/role-runner.js +0 -79
  343. package/dist/profile/role-runner.js.map +0 -1
  344. package/dist/profile/root-facade.d.ts +0 -36
  345. package/dist/profile/root-facade.d.ts.map +0 -1
  346. package/dist/profile/root-facade.js +0 -49
  347. package/dist/profile/root-facade.js.map +0 -1
  348. package/dist/profile/skill-discovery-wiring.d.ts +0 -58
  349. package/dist/profile/skill-discovery-wiring.d.ts.map +0 -1
  350. package/dist/profile/skill-discovery-wiring.js +0 -80
  351. package/dist/profile/skill-discovery-wiring.js.map +0 -1
  352. package/dist/profile/state-store.d.ts +0 -62
  353. package/dist/profile/state-store.d.ts.map +0 -1
  354. package/dist/profile/state-store.js +0 -144
  355. package/dist/profile/state-store.js.map +0 -1
  356. package/dist/profile/todo-plugin.d.ts +0 -37
  357. package/dist/profile/todo-plugin.d.ts.map +0 -1
  358. package/dist/profile/todo-plugin.js +0 -137
  359. package/dist/profile/todo-plugin.js.map +0 -1
  360. /package/{dist/plugins → bundled-plugins/mcp-http/dist}/mcp-http.d.ts +0 -0
package/dist/core/sdk.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { existsSync, realpathSync } from "node:fs";
2
2
  import { readFile } from "node:fs/promises";
3
- import { join, resolve } from "node:path";
3
+ import { dirname, join, resolve } from "node:path";
4
+ import { fileURLToPath } from "node:url";
4
5
  import { Agent, setDefaultStreamFn, } from "@agent-forge/agent-core";
5
6
  import { clampThinkingLevel, streamSimple, } from "@agent-forge/ai/compat";
6
7
  import { createSubagentMailbox } from "@agent-forge/protocol/subagent";
@@ -19,7 +20,7 @@ import { formatNoModelsAvailableMessage } from "./auth-guidance.js";
19
20
  import { DEFAULT_THINKING_LEVEL } from "./defaults.js";
20
21
  import { discoverCapabilityPluginManifests, parseCapabilityPluginManifest } from "./extensions/capability-plugin.js";
21
22
  import { resolvePluginCapabilityOrder } from "./extensions/capability-runtime.js";
22
- import { installProviderFailoverPlugin, readProviderFailoverSettingsNode } from "./extensions/provider-failover.js";
23
+ import { isPluginConfigValue } from "./extensions/capability-runtime-manifest.js";
23
24
  import { createCodingAgentFacade } from "./facade/coding-agent-facade.js";
24
25
  import { createCodingAgentRuntimeFacade, } from "./facade/coding-agent-runtime-facade.js";
25
26
  import { t } from "./i18n/index.js";
@@ -30,7 +31,6 @@ import { DefaultResourceLoader } from "./resource-loader.js";
30
31
  import { getDefaultSessionDir, getTraceFilePathForSession, SessionManager } from "./session-manager.js";
31
32
  import { SettingsManager } from "./settings-manager.js";
32
33
  import { time } from "./timings.js";
33
- import { createBashTool, createCodingTools, createEditTool, createFindTool, createGrepTool, createLsTool, createPowerShellTool, createReadOnlyTools, createReadTool, createWriteTool, withFileMutationQueue, } from "./tools/index.js";
34
34
  // Preserve the pre-0.81 fallback for extensions that construct Agent instances
35
35
  // or invoke low-level agent loops without supplying streamFn. Agent core remains
36
36
  // provider-agnostic and does not import pi-ai/compat itself.
@@ -133,6 +133,126 @@ const MEMORY_PACKAGE_ID = "agent-forge.plugin.memory";
133
133
  * users keep the final say.
134
134
  */
135
135
  const IMAGE_GENERATION_PACKAGE_ID = "agent-forge.plugin.image-generation";
136
+ /**
137
+ * Plugin id of the standalone coding-tools package (D-082 批 1, S6 工具批):
138
+ * the default coding tools (read/write/edit/bash/powershell/grep/find/ls) live
139
+ * in the `plugins/coding-tools` package and assemble through the bundled
140
+ * distribution channel (§4.9) instead of the retired embedded
141
+ * bootstrap-tools install. At load the assembler merges the
142
+ * session facts the embedded install used to receive as direct options — the
143
+ * working directory plus the settings-resolved read/bash options — into the
144
+ * manifest config (`{version: 1, cwd, read, bash}`), the exact shape the
145
+ * package's `CodingToolsPluginConfigV1` consumes. The agent-dir config file
146
+ * still merges over it inside the plugin entry, so users keep the final say.
147
+ */
148
+ const CODING_TOOLS_PACKAGE_ID = "agent-forge.plugin.coding-tools";
149
+ /**
150
+ * Plugin id of the provider-failover package (D-082 批 3b): the primary/backup
151
+ * provider failover (设计 供应商能力槽位与主备切换 §4) lives in the
152
+ * `plugins/provider-failover` package and assembles through the bundled
153
+ * distribution channel (§4.9) instead of the retired embedded install. Unlike
154
+ * the bundled default face it is NOT a default policy: settings `failover`
155
+ * 节存在时宿主经 configOverride 通道注入 `{version: 1, failover: <节点原样>}`
156
+ * (节点不存在则不注入,插件工厂自守卫 no-op)——"配置存在即装配"是内嵌时代
157
+ * 语义,因此它不受 suite capabilities 声明门控(见装配豁免集合)。failover
158
+ * wrapper 以 priority -100 注册(契约 A),无论装载顺序都在链最外层。
159
+ */
160
+ const PROVIDER_FAILOVER_PACKAGE_ID = "agent-forge.plugin.provider-failover";
161
+ /**
162
+ * Bundled 默认面插件 id 集合(D-082 批 3):随发行物 bundled 分发、不受 suite
163
+ * capabilities 声明门控的第一方默认插件——内嵌时代的默认工具面(coding-tools,
164
+ * 批 1)与四个默认策略插件(agent-loop-policy / retry-policy / overflow-policy /
165
+ * compaction-policy,批 3 退役的内嵌 installBootstrap* 安装)。disabledPluginIds
166
+ * 仍可逐个禁用其中任何一个。
167
+ */
168
+ const BUNDLED_DEFAULT_PLUGIN_IDS = new Set([
169
+ CODING_TOOLS_PACKAGE_ID,
170
+ "agent-forge.plugin.agent-loop-policy",
171
+ "agent-forge.plugin.retry-policy",
172
+ "agent-forge.plugin.overflow-policy",
173
+ "agent-forge.plugin.compaction-policy",
174
+ ]);
175
+ /**
176
+ * Bundled 装配豁免集合(D-082 批 3b):bundled 候选中不受 suite capabilities
177
+ * 声明门控的插件 id——默认面({@link BUNDLED_DEFAULT_PLUGIN_IDS},五 id)加上
178
+ * config 门控可选能力 provider-failover(第六 id,config 门控豁免而非默认策略:
179
+ * settings `failover` 节存在即装配,与内嵌装配同语义;节点不存在时插件工厂
180
+ * 自守卫 no-op)。disabledPluginIds 仍可禁用其中任何一个。
181
+ */
182
+ const BUNDLED_WIRING_EXEMPT_PLUGIN_IDS = new Set([
183
+ ...BUNDLED_DEFAULT_PLUGIN_IDS,
184
+ PROVIDER_FAILOVER_PACKAGE_ID,
185
+ ]);
186
+ /**
187
+ * Bundled 默认策略包的目录名(plugins/ 工作副本与发行物 bundled-plugins/ 快照
188
+ * 同名)。与 {@link BUNDLED_DEFAULT_PLUGIN_IDS} 的四个策略 id 一一对应。
189
+ */
190
+ const BUNDLED_DEFAULT_POLICY_PACKAGES = [
191
+ "agent-loop-policy",
192
+ "retry-policy",
193
+ "overflow-policy",
194
+ "compaction-policy",
195
+ ];
196
+ /**
197
+ * Bundled distribution roots (D-082 §4.9 bundled 分发通道):按工具面与策略面
198
+ * 分组的插件目录,其 plugin.json 清单加入候选池。两组各自探测两种布局,目录
199
+ * 不存在即跳过:
200
+ *
201
+ * - Released form: the build copies built plugin packages to
202
+ * `<packageRoot>/bundled-plugins/<name>/` (data files, not npm deps).
203
+ * - Dev repository form: the repo-root working copies of the packages this
204
+ * batch migrated (`<repoRoot>/plugins/coding-tools` — 批 1;四个策略包 — 批 3;
205
+ * provider-failover — 批 3b).
206
+ * Sibling first-party packages keep their install-store assembly (D-075
207
+ * S4/S5 semantics, pinned by the ecosystem assembly tests) until their own
208
+ * migration batch (S7-S9) widens this root.
209
+ *
210
+ * 工具面(coding-tools)受 noTools 整层跳过(对照内嵌工具装配的跳过语义);
211
+ * 策略面不受 noTools 门控——内嵌 installBootstrap* 时代它们随会话无条件安装。
212
+ *
213
+ * The package root is derived from this module's URL: src runs sit at
214
+ * `src/core/`, unbundled dist runs at `dist/core/` (both two levels up), and
215
+ * the Node bundle runs at `dist/bundle/` (three levels up). Depth candidates
216
+ * are tried in order and the first ancestor carrying a `package.json` wins.
217
+ */
218
+ function bundledCapabilityPluginRoots() {
219
+ const moduleDir = fileURLToPath(new URL(".", import.meta.url));
220
+ let packageRoot;
221
+ for (const depth of [2, 3]) {
222
+ let candidate = moduleDir;
223
+ for (let index = 0; index < depth; index++)
224
+ candidate = dirname(candidate);
225
+ if (existsSync(join(candidate, "package.json"))) {
226
+ packageRoot = candidate;
227
+ break;
228
+ }
229
+ }
230
+ if (packageRoot === undefined)
231
+ return { toolRoots: [], policyRoots: [] };
232
+ const toolRoots = [];
233
+ const policyRoots = [];
234
+ // Dev repository layout first: the repo-root plugins/ working copies (two
235
+ // levels above the package root; exist only inside a source checkout).
236
+ // When both roots exist the fresh working copy must win — the bundled copy
237
+ // is a build-time snapshot that lags plugin src until the next root build,
238
+ // and letting it shadow the working copy would silently run stale tool
239
+ // code in dev (review finding, D-082 批 1). check:plugin-dist-fresh pins
240
+ // the two copies content-identical so a stale bundled snapshot fails the
241
+ // gate instead of passing unnoticed.
242
+ const devPluginsRoot = join(packageRoot, "..", "..", "plugins");
243
+ toolRoots.push(join(devPluginsRoot, "coding-tools"));
244
+ for (const name of BUNDLED_DEFAULT_POLICY_PACKAGES)
245
+ policyRoots.push(join(devPluginsRoot, name));
246
+ // provider-failover(D-082 批 3b):config 门控可选能力,随策略面根分发
247
+ // (不受 noTools 门控,与内嵌装配同语义)。
248
+ policyRoots.push(join(devPluginsRoot, "provider-failover"));
249
+ const bundledRoot = join(packageRoot, "bundled-plugins");
250
+ toolRoots.push(join(bundledRoot, "coding-tools"));
251
+ for (const name of BUNDLED_DEFAULT_POLICY_PACKAGES)
252
+ policyRoots.push(join(bundledRoot, name));
253
+ policyRoots.push(join(bundledRoot, "provider-failover"));
254
+ return { toolRoots, policyRoots };
255
+ }
136
256
  const isMemoryModeV1 = (value) => value === "off" || value === "light" || value === "full";
137
257
  function resolveSdkMemoryMode(explicitMode, env, settingsMode) {
138
258
  if (explicitMode !== undefined) {
@@ -175,9 +295,7 @@ export const HEADLESS_INTERACTION_HOST = {
175
295
  };
176
296
  // Re-exports
177
297
  export * from "./agent-session-runtime.js";
178
- export { withFileMutationQueue,
179
- // Tool factories (for custom cwd)
180
- createCodingTools, createReadOnlyTools, createReadTool, createBashTool, createEditTool, createWriteTool, createGrepTool, createFindTool, createLsTool, createPowerShellTool, };
298
+ export { withFileMutationQueue } from "./tools/index.js";
181
299
  // Helper Functions
182
300
  function getDefaultAgentDir() {
183
301
  return getAgentDir();
@@ -626,11 +744,13 @@ export async function createAgentSession(options = {}) {
626
744
  }
627
745
  };
628
746
  // streamFn wrapper 链(provider-failover 家族注册面,设计 供应商能力槽位
629
- // 与主备切换 §4.8):注册的 wrapper 按注册序包在默认闭包外层(先注册者最
630
- // 外层),wrapper 拿到的 next 即链上下一个直至底层默认调用。每次请求时从
631
- // 会话 capability runtime 读取,使嵌入式 failover 插件(会话构造后装配)与
632
- // 后续加载的第三方 wrapper 都进入链中。调用方显式传 options.streamFn 的会话
633
- // 整体绕过本装配(含 wrapper),不参与 failover——已知边界。
747
+ // 与主备切换 §4.8):getStreamFnWrappers 已按 (priority 升序, 注册序升序)
748
+ // 稳定排序(D-082 批 3b 契约 A,低值更外层);从数组末尾向前包裹,首位
749
+ // wrapper 即最外层,其 next 覆盖其余 wrapper 直至底层默认调用。每次请求
750
+ // 时从会话 capability runtime 读取,使 bundled failover 插件(随 manifest
751
+ // 链装载)与第三方 wrapper 都进入链中——failover 以 priority -100 注册,
752
+ // 无论装载顺序都在最外层。调用方显式传 options.streamFn 的会话整体绕过
753
+ // 本装配(含 wrapper),不参与 failover——已知边界。
634
754
  const wrappers = agentSessionRef.current?.getCapabilityRuntime().getStreamFnWrappers() ?? [];
635
755
  let chain = baseStreamFn;
636
756
  for (let index = wrappers.length - 1; index >= 0; index -= 1) {
@@ -843,29 +963,13 @@ export async function createAgentSession(options = {}) {
843
963
  ...(capabilitySkillsFilter === undefined ? {} : { capabilitySkillsFilter }),
844
964
  });
845
965
  agentSessionRef.current = session;
846
- // provider-failover 装配(设计 供应商能力槽位与主备切换 §4.8):嵌入式第一方
847
- // 插件经公共 registerStreamFnWrapper 注册面挂进上方默认 streamFn 装配(此处早于
848
- // 下方外部插件装载,故 failover wrapper 位于链最外层,观察到的是其余 wrapper 与
849
- // 默认闭包之后的最终流)。熔断状态是模块级单例,随进程生命周期跨会话共享(§4.2)。
850
- // 配置从 settings `failover` 节原始读出(未配置 / 无有效候选 / 配置错误则不装配;
851
- // 残留 `failover.enabled` 键已移除并警告忽略,D-079);
852
- // 装配失败只警告——可靠性能力不得阻断会话构造。装载预检(§4.6)随装配同步执行:
853
- // 检查面全部为 modelRuntime 静态读取(目录解析/provider 存在/凭据条目快照),
854
- // 零网络请求、不触发 OAuth 刷新。
855
- try {
856
- installProviderFailoverPlugin(session.getCapabilityRuntime(), {
857
- failoverSettings: readProviderFailoverSettingsNode(settingsManager),
858
- preflight: {
859
- resolveModel: (provider, modelId) => modelRuntime.getModel(provider, modelId),
860
- hasProvider: (providerId) => modelRuntime.getProvider(providerId) !== undefined,
861
- hasConfiguredAuth: (providerId) => modelRuntime.hasConfiguredAuth(providerId),
862
- },
863
- hostLogger,
864
- });
865
- }
866
- catch (error) {
867
- hostLogger?.warn("sdk", "provider failover plugin load failed", { cause: error });
868
- }
966
+ // provider-failover 装配(设计 供应商能力槽位与主备切换 §4.8,D-082 批 3b):
967
+ // 内嵌 installProviderFailoverPlugin 退役为 bundled 插件包
968
+ // (plugins/provider-failover,id agent-forge.plugin.provider-failover),经
969
+ // 下方 bundled 分发通道装载。配置注入见装载循环的 configOverride 分支
970
+ // (settings `failover` 节存在时注入 `{version: 1, failover: <节点原样>}`,
971
+ // 预检读面经 api.host.modelCatalog 契约 B 注入);wrapper 以 priority -100
972
+ // 注册(契约 A),无论装载顺序都在链最外层——装配时序不再依赖 manifest 链。
869
973
  // Session-suite binding (设计 §10.1): record the suite as session protocol
870
974
  // data via the existing custom-entry extension point. New sessions only;
871
975
  // resumed sessions keep their original binding.
@@ -980,15 +1084,31 @@ export async function createAgentSession(options = {}) {
980
1084
  if (skippedInstalledPluginIds.length > 0) {
981
1085
  capabilityDiagnostics.push(`Installed capability plugins stay unloaded because the active profile did not select them: ${skippedInstalledPluginIds.sort().join(", ")}`);
982
1086
  }
1087
+ // Bundled 分发通道(D-082 §4.9,批 1 工具批 / 批 3 策略批):发行物附带的第一方
1088
+ // 插件包作为数据文件随宿主分发,经与安装店完全相同的 manifest/jiti 通道装载;
1089
+ // 优先级在 installed 之后、目录发现之前(安装店显式安装 > bundled >
1090
+ // 目录发现)。这不是用户插件发现通道:内嵌默认面不受
1091
+ // discoverCapabilityPlugins 与 suite capabilities 声明门控——工具面
1092
+ // (coding-tools)沿用内嵌装配的无条件下发语义;策略面(四个默认策略插件,
1093
+ // 内嵌 installBootstrap* 时代随会话无条件安装)同样无条件下发且不受
1094
+ // noTools 门控;其余 bundled 候选按套件成员资格过滤。noTools("all"/
1095
+ // "builtin",对照内嵌工具装配的跳过语义)只跳过工具面。
1096
+ const bundledRoots = bundledCapabilityPluginRoots();
1097
+ const bundledToolManifestPaths = options.noTools === undefined ? discoverCapabilityPluginManifests(bundledRoots.toolRoots) : [];
1098
+ const bundledPolicyManifestPaths = discoverCapabilityPluginManifests(bundledRoots.policyRoots);
1099
+ const bundledManifestPaths = [...bundledToolManifestPaths, ...bundledPolicyManifestPaths];
1100
+ const bundledManifestPathSet = new Set(bundledManifestPaths);
983
1101
  const manifestPaths = [
984
1102
  ...suiteLocalManifestPaths,
985
1103
  ...installedPluginManifestPaths,
1104
+ ...bundledManifestPaths,
986
1105
  ...discoveredManifestPaths,
987
1106
  ...(options.capabilityPluginPaths ?? []),
988
1107
  ];
989
1108
  const explicitCandidatePaths = new Set([
990
1109
  ...suiteLocalManifestPaths,
991
1110
  ...installedPluginManifestPaths,
1111
+ ...bundledManifestPaths,
992
1112
  ...(options.capabilityPluginPaths ?? []),
993
1113
  ]);
994
1114
  const loadedManifestPaths = new Set();
@@ -1050,6 +1170,23 @@ export async function createAgentSession(options = {}) {
1050
1170
  const discoveredPluginIds = [];
1051
1171
  for (const entry of manifestEntries) {
1052
1172
  discoveredPluginIds.push(entry.manifest.id);
1173
+ const bundledCandidate = bundledManifestPathSet.has(entry.path);
1174
+ // Bundled 层过滤:bundled 装配豁免集合(coding-tools 工具面 + 四个默认
1175
+ // 策略插件 + config 门控的 provider-failover,BUNDLED_WIRING_EXEMPT_
1176
+ // PLUGIN_IDS)不受 suite capabilities 声明门控,与内嵌装配同语义——
1177
+ // failover 的"配置存在即装配"不是套件声明可关闭的面(disabledPluginIds
1178
+ // 仍可显式禁用);其余 bundled 候选与 installed 层同法——
1179
+ // capabilityWiring 开启时插件 id 必须命中 capabilityPackageIds(套件
1180
+ // 未选中的包静默缺席),关闭(自持 loader 的宿主)全收,保底拿到产品
1181
+ // 默认面。disabledPluginIds(既有用户面)作用于全部 bundled 候选。
1182
+ if (bundledCandidate) {
1183
+ if (!BUNDLED_WIRING_EXEMPT_PLUGIN_IDS.has(entry.manifest.id) && capabilityWiring) {
1184
+ if (!capabilityPackageIds.includes(entry.manifest.id))
1185
+ continue;
1186
+ }
1187
+ if (disabledPluginIdSet.has(entry.manifest.id))
1188
+ continue;
1189
+ }
1053
1190
  if (poolFilter && !explicitManifestPaths.has(entry.path)) {
1054
1191
  const decision = poolFilter.decide(entry.manifest.id, entry.path);
1055
1192
  if (!decision.keep) {
@@ -1059,7 +1196,13 @@ export async function createAgentSession(options = {}) {
1059
1196
  }
1060
1197
  }
1061
1198
  if (seenPluginIds.has(entry.manifest.id)) {
1062
- await recordRejection("duplicate_plugin_id", entry.path, entry.manifest.id, `Capability plugin is already loaded: ${entry.manifest.id}; the first manifest in discovery order wins`);
1199
+ // Bundled 候选与更高优先层(suiteLocal/installed/前一根 bundled)同 id
1200
+ // 时按发现优先级静默让位(安装店显式安装 > bundled;产品自带副本被
1201
+ // 遮蔽是设计内的优先级,不是冲突)。目录发现层的重复 id 保持既有
1202
+ // duplicate_plugin_id rejection(第三方同 id 冲突需要显形)。
1203
+ if (!bundledCandidate) {
1204
+ await recordRejection("duplicate_plugin_id", entry.path, entry.manifest.id, `Capability plugin is already loaded: ${entry.manifest.id}; the first manifest in discovery order wins`);
1205
+ }
1063
1206
  continue;
1064
1207
  }
1065
1208
  seenPluginIds.add(entry.manifest.id);
@@ -1106,50 +1249,93 @@ export async function createAgentSession(options = {}) {
1106
1249
  // v8 ignore next -- 顺序解析返回的 manifest 均来自同一 survivors 集合,路径恒存在
1107
1250
  if (!manifestPath)
1108
1251
  throw new Error(t("Capability plugin manifest path is unavailable: {id}", { id: manifest.id }));
1252
+ // 宿主装配事实注入(公共 configOverride 通道):各插件分支注释记载注入
1253
+ // 内容与取值链;caller 的 capabilityPluginConfigs[插件 id](D-082 批 1
1254
+ // 新增会话选项)按 configOverride 既有分层合并在宿主事实之上(顶层键
1255
+ // caller 赢),插件入口的 agent-dir 配置文件仍合并在其上,用户显式配置
1256
+ // 保持最终决定权。
1257
+ let hostConfigOverride;
1258
+ // CLI 自动池化(承载退役切片 1,D-075 S4 第三批收敛):宿主声明自身
1259
+ // 入口可信时改写插件 config 的 runnerEntryAuto(原 builtin 注入链的
1260
+ // selfInvocationPool 旗标退役);插件入口的 agent-dir 配置文件仍合并
1261
+ // 在其上,用户显式配置保持最终决定权。
1262
+ if (manifest.id === SUBAGENT_DELEGATE_PACKAGE_ID && options.subagentPoolFromSelfInvocation === true) {
1263
+ hostConfigOverride = { runnerEntryAuto: true };
1264
+ }
1265
+ // 记忆档位注入(D-075 S4 第四批):显式定档与 settings.json 持久档位经
1266
+ // 公共 configOverride 通道合并进 memory 插件包 manifest config——包 entry
1267
+ // 按同一解析链定档(显式 > env > settings > 旧别名 > off);agent-dir
1268
+ // 配置文件(capabilities/builtin.memory.json)仍合并在其上,用户显式
1269
+ // 配置保持最终决定权。mode=off 的包已在上面的成员资格门控中排除,
1270
+ // 不会走到这里。
1271
+ if (manifest.id === MEMORY_PACKAGE_ID) {
1272
+ hostConfigOverride = {
1273
+ ...hostConfigOverride,
1274
+ ...(memoryModeOption === undefined ? {} : { memoryMode: memoryModeOption }),
1275
+ ...(settingsMemoryMode === undefined ? {} : { memorySettingsMode: settingsMemoryMode }),
1276
+ };
1277
+ }
1278
+ // 生图槽位注入(供应商能力槽位设计 §3.3):settings 槽位(provider/model,
1279
+ // model 可省)与 models.json 生图目录快照经公共 configOverride 通道注入
1280
+ // image-generation 插件包;插件按六层取值链消费(设计 §3.2)。槽位缺省时
1281
+ // 只注入快照——插件回落到 env/主推断/唯一候选推断。
1282
+ if (manifest.id === IMAGE_GENERATION_PACKAGE_ID) {
1283
+ hostConfigOverride = {
1284
+ ...hostConfigOverride,
1285
+ ...(imageGenerationSlot === undefined
1286
+ ? {}
1287
+ : {
1288
+ imageGeneration: {
1289
+ provider: imageGenerationSlot.provider,
1290
+ ...(imageGenerationSlot.model === undefined ? {} : { model: imageGenerationSlot.model }),
1291
+ },
1292
+ }),
1293
+ imageModelCatalog,
1294
+ };
1295
+ }
1296
+ // 默认编码工具会话事实注入(D-082 批 1):cwd 用会话 cwd,read/bash 选项
1297
+ // 取值来源对齐内嵌 installSessionBootstrapTools 时代的 settings 解析链
1298
+ // (SettingsManager.getImageAutoResize/getShellCommandPrefix/getShellPath),
1299
+ // 形状即插件包 CodingToolsPluginConfigV1;未定义的设置键省略(插件侧
1300
+ // 保持自身缺省值,与内嵌时代传 undefined 同语义)。
1301
+ if (manifest.id === CODING_TOOLS_PACKAGE_ID) {
1302
+ const autoResizeImages = settingsManager.getImageAutoResize();
1303
+ const shellCommandPrefix = settingsManager.getShellCommandPrefix();
1304
+ const shellPath = settingsManager.getShellPath();
1305
+ hostConfigOverride = {
1306
+ ...hostConfigOverride,
1307
+ version: 1,
1308
+ cwd,
1309
+ read: { autoResizeImages },
1310
+ bash: {
1311
+ ...(shellCommandPrefix === undefined ? {} : { commandPrefix: shellCommandPrefix }),
1312
+ ...(shellPath === undefined ? {} : { shellPath }),
1313
+ },
1314
+ };
1315
+ }
1316
+ // provider-failover 配置注入(D-082 批 3b):settings `failover` 节存在
1317
+ // 时经 configOverride 通道注入 `{version: 1, failover: <节点原样>}`(节点
1318
+ // 来源与内嵌装配时代同一读面:settingsManager.getFailoverSettings 原样
1319
+ // 透传合并层对象,解析与校验收在插件包内);节点不存在则不注入——插件
1320
+ // 工厂自守卫 no-op(不注册任何面)。caller 的 capabilityPluginConfigs
1321
+ // 仍按既有分层合并在其上(顶层键 caller 赢),agent-dir 配置文件保持
1322
+ // 用户最终决定权。
1323
+ if (manifest.id === PROVIDER_FAILOVER_PACKAGE_ID) {
1324
+ const failoverSettings = settingsManager.getFailoverSettings();
1325
+ // settings 层合并对象是 JSON 数据,仅静态接口不带索引签名;经公共
1326
+ // 守卫收窄为 PluginConfigValue 后节点原样透传(真实 settings 数据
1327
+ // 恒为 JSON,守卫不构成行为分支),解析与校验收在插件包内。
1328
+ if (failoverSettings !== undefined && isPluginConfigValue(failoverSettings)) {
1329
+ hostConfigOverride = { version: 1, failover: failoverSettings };
1330
+ }
1331
+ }
1332
+ const callerConfigOverride = options.capabilityPluginConfigs?.[manifest.id];
1333
+ const configOverride = hostConfigOverride === undefined
1334
+ ? callerConfigOverride
1335
+ : { ...hostConfigOverride, ...(callerConfigOverride ?? {}) };
1109
1336
  try {
1110
1337
  await session.loadCapabilityPluginManifest(manifestPath, {
1111
- // CLI 自动池化(承载退役切片 1,D-075 S4 第三批收敛):宿主声明自身
1112
- // 入口可信时改写插件 config 的 runnerEntryAuto(原 builtin 注入链的
1113
- // selfInvocationPool 旗标退役);插件入口的 agent-dir 配置文件仍合并
1114
- // 在其上,用户显式配置保持最终决定权。
1115
- ...(manifest.id === SUBAGENT_DELEGATE_PACKAGE_ID && options.subagentPoolFromSelfInvocation === true
1116
- ? { configOverride: { runnerEntryAuto: true } }
1117
- : {}),
1118
- // 记忆档位注入(D-075 S4 第四批):显式定档与 settings.json 持久档位经
1119
- // 公共 configOverride 通道合并进 memory 插件包 manifest config——包 entry
1120
- // 按同一解析链定档(显式 > env > settings > 旧别名 > off);agent-dir
1121
- // 配置文件(capabilities/builtin.memory.json)仍合并在其上,用户显式
1122
- // 配置保持最终决定权。mode=off 的包已在上面的成员资格门控中排除,
1123
- // 不会走到这里。
1124
- ...(manifest.id === MEMORY_PACKAGE_ID
1125
- ? {
1126
- configOverride: {
1127
- ...(memoryModeOption === undefined ? {} : { memoryMode: memoryModeOption }),
1128
- ...(settingsMemoryMode === undefined ? {} : { memorySettingsMode: settingsMemoryMode }),
1129
- },
1130
- }
1131
- : {}),
1132
- // 生图槽位注入(供应商能力槽位设计 §3.3):settings 槽位(provider/model,
1133
- // model 可省)与 models.json 生图目录快照经公共 configOverride 通道注入
1134
- // image-generation 插件包;插件按六层取值链消费(设计 §3.2)。槽位缺省时
1135
- // 只注入快照——插件回落到 env/主推断/唯一候选推断。
1136
- ...(manifest.id === IMAGE_GENERATION_PACKAGE_ID
1137
- ? {
1138
- configOverride: {
1139
- ...(imageGenerationSlot === undefined
1140
- ? {}
1141
- : {
1142
- imageGeneration: {
1143
- provider: imageGenerationSlot.provider,
1144
- ...(imageGenerationSlot.model === undefined
1145
- ? {}
1146
- : { model: imageGenerationSlot.model }),
1147
- },
1148
- }),
1149
- imageModelCatalog,
1150
- },
1151
- }
1152
- : {}),
1338
+ ...(configOverride === undefined ? {} : { configOverride }),
1153
1339
  });
1154
1340
  }
1155
1341
  catch (error) {