@ai-agent-forge/agent-forge 0.87.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.
- package/CHANGELOG.md +56 -0
- package/README.md +2 -2
- package/bundled-plugins/agent-loop-policy/agent-forge.json +19 -0
- package/bundled-plugins/agent-loop-policy/dist/entry.d.ts +28 -0
- package/bundled-plugins/agent-loop-policy/dist/entry.d.ts.map +1 -0
- package/bundled-plugins/agent-loop-policy/dist/entry.js +69 -0
- package/bundled-plugins/agent-loop-policy/dist/entry.js.map +1 -0
- package/bundled-plugins/agent-loop-policy/dist/loop-guard.d.ts +199 -0
- package/bundled-plugins/agent-loop-policy/dist/loop-guard.d.ts.map +1 -0
- package/bundled-plugins/agent-loop-policy/dist/loop-guard.js +208 -0
- package/bundled-plugins/agent-loop-policy/dist/loop-guard.js.map +1 -0
- package/bundled-plugins/agent-loop-policy/dist/run-loop-strategy.d.ts +17 -0
- package/bundled-plugins/agent-loop-policy/dist/run-loop-strategy.d.ts.map +1 -0
- package/bundled-plugins/agent-loop-policy/dist/run-loop-strategy.js +18 -0
- package/bundled-plugins/agent-loop-policy/dist/run-loop-strategy.js.map +1 -0
- package/bundled-plugins/agent-loop-policy/plugin.json +7 -0
- package/bundled-plugins/coding-tools/agent-forge.json +19 -0
- package/{dist/core/tools → bundled-plugins/coding-tools/dist}/bash.d.ts +5 -44
- package/bundled-plugins/coding-tools/dist/bash.d.ts.map +1 -0
- package/{dist/core/tools → bundled-plugins/coding-tools/dist}/bash.js +15 -119
- package/bundled-plugins/coding-tools/dist/bash.js.map +1 -0
- package/bundled-plugins/coding-tools/dist/capability.d.ts +25 -0
- package/bundled-plugins/coding-tools/dist/capability.d.ts.map +1 -0
- package/bundled-plugins/coding-tools/dist/capability.js +98 -0
- package/bundled-plugins/coding-tools/dist/capability.js.map +1 -0
- package/bundled-plugins/coding-tools/dist/config.d.ts +8 -0
- package/bundled-plugins/coding-tools/dist/config.d.ts.map +1 -0
- package/bundled-plugins/coding-tools/dist/config.js +8 -0
- package/bundled-plugins/coding-tools/dist/config.js.map +1 -0
- package/{dist/core/tools → bundled-plugins/coding-tools/dist}/edit.d.ts +3 -3
- package/bundled-plugins/coding-tools/dist/edit.d.ts.map +1 -0
- package/{dist/core/tools → bundled-plugins/coding-tools/dist}/edit.js +12 -10
- package/bundled-plugins/coding-tools/dist/edit.js.map +1 -0
- package/bundled-plugins/coding-tools/dist/entry.d.ts +14 -0
- package/bundled-plugins/coding-tools/dist/entry.d.ts.map +1 -0
- package/bundled-plugins/coding-tools/dist/entry.js +23 -0
- package/bundled-plugins/coding-tools/dist/entry.js.map +1 -0
- package/{dist/core/tools → bundled-plugins/coding-tools/dist}/find.d.ts +4 -4
- package/bundled-plugins/coding-tools/dist/find.d.ts.map +1 -0
- package/{dist/core/tools → bundled-plugins/coding-tools/dist}/find.js +10 -8
- package/bundled-plugins/coding-tools/dist/find.js.map +1 -0
- package/{dist/core/tools → bundled-plugins/coding-tools/dist}/grep.d.ts +3 -3
- package/bundled-plugins/coding-tools/dist/grep.d.ts.map +1 -0
- package/{dist/core/tools → bundled-plugins/coding-tools/dist}/grep.js +10 -8
- package/bundled-plugins/coding-tools/dist/grep.js.map +1 -0
- package/bundled-plugins/coding-tools/dist/index.d.ts +17 -0
- package/bundled-plugins/coding-tools/dist/index.d.ts.map +1 -0
- package/bundled-plugins/coding-tools/dist/index.js +17 -0
- package/bundled-plugins/coding-tools/dist/index.js.map +1 -0
- package/{dist/core/tools → bundled-plugins/coding-tools/dist}/ls.d.ts +3 -3
- package/bundled-plugins/coding-tools/dist/ls.d.ts.map +1 -0
- package/{dist/core/tools → bundled-plugins/coding-tools/dist}/ls.js +8 -6
- package/{dist/core/tools → bundled-plugins/coding-tools/dist}/ls.js.map +1 -1
- package/{dist/core/tools → bundled-plugins/coding-tools/dist}/powershell.d.ts +2 -1
- package/bundled-plugins/coding-tools/dist/powershell.d.ts.map +1 -0
- package/{dist/core/tools → bundled-plugins/coding-tools/dist}/powershell.js +6 -3
- package/bundled-plugins/coding-tools/dist/powershell.js.map +1 -0
- package/{dist/core/tools → bundled-plugins/coding-tools/dist}/read.d.ts +3 -3
- package/bundled-plugins/coding-tools/dist/read.d.ts.map +1 -0
- package/{dist/core/tools → bundled-plugins/coding-tools/dist}/read.js +15 -13
- package/bundled-plugins/coding-tools/dist/read.js.map +1 -0
- package/bundled-plugins/coding-tools/dist/types.d.ts +74 -0
- package/bundled-plugins/coding-tools/dist/types.d.ts.map +1 -0
- package/bundled-plugins/coding-tools/dist/types.js +28 -0
- package/bundled-plugins/coding-tools/dist/types.js.map +1 -0
- package/{dist/core/tools → bundled-plugins/coding-tools/dist}/write.d.ts +2 -2
- package/bundled-plugins/coding-tools/dist/write.d.ts.map +1 -0
- package/{dist/core/tools → bundled-plugins/coding-tools/dist}/write.js +11 -9
- package/bundled-plugins/coding-tools/dist/write.js.map +1 -0
- package/bundled-plugins/coding-tools/plugin.json +10 -0
- package/bundled-plugins/compaction-policy/agent-forge.json +19 -0
- package/bundled-plugins/compaction-policy/dist/branch-summary-policy.d.ts +6 -0
- package/bundled-plugins/compaction-policy/dist/branch-summary-policy.d.ts.map +1 -0
- package/bundled-plugins/compaction-policy/dist/branch-summary-policy.js +19 -0
- package/bundled-plugins/compaction-policy/dist/branch-summary-policy.js.map +1 -0
- package/bundled-plugins/compaction-policy/dist/compaction-policy.d.ts +6 -0
- package/bundled-plugins/compaction-policy/dist/compaction-policy.d.ts.map +1 -0
- package/bundled-plugins/compaction-policy/dist/compaction-policy.js +38 -0
- package/bundled-plugins/compaction-policy/dist/compaction-policy.js.map +1 -0
- package/bundled-plugins/compaction-policy/dist/entry.d.ts +13 -0
- package/bundled-plugins/compaction-policy/dist/entry.d.ts.map +1 -0
- package/bundled-plugins/compaction-policy/dist/entry.js +23 -0
- package/bundled-plugins/compaction-policy/dist/entry.js.map +1 -0
- package/bundled-plugins/compaction-policy/plugin.json +10 -0
- package/bundled-plugins/mcp-http/dist/index.d.ts +8 -0
- package/bundled-plugins/mcp-http/dist/index.d.ts.map +1 -0
- package/bundled-plugins/mcp-http/dist/index.js +8 -0
- package/bundled-plugins/mcp-http/dist/index.js.map +1 -0
- package/bundled-plugins/mcp-http/dist/mcp-http.d.ts.map +1 -0
- package/{dist/plugins → bundled-plugins/mcp-http/dist}/mcp-http.js +1 -1
- package/bundled-plugins/mcp-http/dist/mcp-http.js.map +1 -0
- package/bundled-plugins/overflow-policy/agent-forge.json +19 -0
- package/bundled-plugins/overflow-policy/dist/entry.d.ts +16 -0
- package/bundled-plugins/overflow-policy/dist/entry.d.ts.map +1 -0
- package/bundled-plugins/overflow-policy/dist/entry.js +35 -0
- package/bundled-plugins/overflow-policy/dist/entry.js.map +1 -0
- package/bundled-plugins/overflow-policy/plugin.json +10 -0
- package/bundled-plugins/provider-failover/agent-forge.json +19 -0
- package/bundled-plugins/provider-failover/dist/entry.d.ts +8 -0
- package/bundled-plugins/provider-failover/dist/entry.d.ts.map +1 -0
- package/bundled-plugins/provider-failover/dist/entry.js +8 -0
- package/bundled-plugins/provider-failover/dist/entry.js.map +1 -0
- package/bundled-plugins/provider-failover/dist/provider-failover.d.ts +122 -0
- package/bundled-plugins/provider-failover/dist/provider-failover.d.ts.map +1 -0
- package/{dist/core/extensions → bundled-plugins/provider-failover/dist}/provider-failover.js +149 -61
- package/bundled-plugins/provider-failover/dist/provider-failover.js.map +1 -0
- package/bundled-plugins/provider-failover/plugin.json +7 -0
- package/bundled-plugins/retry-policy/agent-forge.json +19 -0
- package/bundled-plugins/retry-policy/dist/entry.d.ts +16 -0
- package/bundled-plugins/retry-policy/dist/entry.d.ts.map +1 -0
- package/bundled-plugins/retry-policy/dist/entry.js +34 -0
- package/bundled-plugins/retry-policy/dist/entry.js.map +1 -0
- package/bundled-plugins/retry-policy/plugin.json +10 -0
- package/dist/bundle/.build-manifest.json +105 -183
- package/dist/bundle/chunks/{anthropic-messages-ALDZBUKI.js → anthropic-messages-PLAKXR73.js} +1 -1
- package/dist/bundle/chunks/{azure-openai-responses-A2WJWZFB.js → azure-openai-responses-OUWQ2AZD.js} +1 -1
- package/dist/bundle/chunks/{chunk-CIX3FSBK.js → chunk-A3JYRWB6.js} +1 -1
- package/dist/bundle/chunks/{chunk-SQFG22WN.js → chunk-AC2FIS4G.js} +1 -1
- package/dist/bundle/chunks/chunk-AQLNTW2B.js +664 -0
- package/dist/bundle/chunks/chunk-D3ARGZFR.js +13 -0
- package/dist/bundle/chunks/{chunk-YJCQVXW5.js → chunk-HTEVUY7F.js} +1 -1
- package/dist/bundle/chunks/{chunk-Y7HXTASS.js → chunk-HV64ASMT.js} +1 -1
- package/dist/bundle/chunks/chunk-LZOEQITZ.js +855 -0
- package/dist/bundle/chunks/{chunk-7ZY7IXZD.js → chunk-TRDNDS6A.js} +1 -1
- package/dist/bundle/chunks/chunk-Z72JWUZ4.js +4 -0
- package/dist/bundle/chunks/{google-generative-ai-NIB4WONV.js → google-generative-ai-DLII6DAT.js} +1 -1
- package/dist/bundle/chunks/{google-vertex-DCPYUEUO.js → google-vertex-G7BZL7GM.js} +1 -1
- package/dist/bundle/chunks/image-resize-worker.js +3 -3
- package/dist/bundle/chunks/{mistral-conversations-OC6LA5XL.js → mistral-conversations-JXUK24ID.js} +1 -1
- package/dist/bundle/chunks/{openai-codex-responses-IO2X4Y7L.js → openai-codex-responses-5GSGFIPG.js} +1 -1
- package/dist/bundle/chunks/{openai-completions-XYQQHETU.js → openai-completions-EI2I6DTG.js} +1 -1
- package/dist/bundle/chunks/{openai-responses-DLIRN3CI.js → openai-responses-AUJQ3NWT.js} +1 -1
- package/dist/bundle/chunks/{pi-messages-E6RRYBO7.js → pi-messages-PWU2VJMR.js} +1 -1
- package/dist/bundle/chunks/virtual-modules-WF6WRHP7.js +5 -0
- package/dist/bundle/cli.js +1 -1
- package/dist/bundle/client.js +1 -1
- package/dist/bundle/index.js +3 -3
- package/dist/bundle/rpc-entry.js +1 -1
- package/dist/capabilities/builtin.d.ts +1 -1
- package/dist/capabilities/builtin.d.ts.map +1 -1
- package/dist/capabilities/builtin.js +5 -0
- package/dist/capabilities/builtin.js.map +1 -1
- package/dist/cli/auth-check.d.ts.map +1 -1
- package/dist/cli/auth-check.js +14 -2
- package/dist/cli/auth-check.js.map +1 -1
- package/dist/cli/auth-command.d.ts.map +1 -1
- package/dist/cli/auth-command.js +1 -1
- package/dist/cli/auth-command.js.map +1 -1
- package/dist/cli/plugin-command.d.ts.map +1 -1
- package/dist/cli/plugin-command.js +17 -1
- package/dist/cli/plugin-command.js.map +1 -1
- package/dist/config.d.ts +2 -3
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +5 -6
- package/dist/config.js.map +1 -1
- package/dist/core/agent-session-bash.d.ts +1 -1
- package/dist/core/agent-session-bash.d.ts.map +1 -1
- package/dist/core/agent-session-bash.js +1 -1
- package/dist/core/agent-session-bash.js.map +1 -1
- package/dist/core/agent-session-compaction.d.ts +6 -10
- package/dist/core/agent-session-compaction.d.ts.map +1 -1
- package/dist/core/agent-session-compaction.js +21 -112
- package/dist/core/agent-session-compaction.js.map +1 -1
- package/dist/core/agent-session-internal.d.ts +1 -7
- package/dist/core/agent-session-internal.d.ts.map +1 -1
- package/dist/core/agent-session-internal.js.map +1 -1
- package/dist/core/agent-session-loop.d.ts +4 -3
- package/dist/core/agent-session-loop.d.ts.map +1 -1
- package/dist/core/agent-session-loop.js +9 -6
- package/dist/core/agent-session-loop.js.map +1 -1
- package/dist/core/agent-session-retry.d.ts +1 -1
- package/dist/core/agent-session-retry.d.ts.map +1 -1
- package/dist/core/agent-session-retry.js +32 -4
- package/dist/core/agent-session-retry.js.map +1 -1
- package/dist/core/agent-session-services.d.ts.map +1 -1
- package/dist/core/agent-session-services.js +30 -9
- package/dist/core/agent-session-services.js.map +1 -1
- package/dist/core/agent-session-tools.d.ts.map +1 -1
- package/dist/core/agent-session-tools.js +5 -1
- package/dist/core/agent-session-tools.js.map +1 -1
- package/dist/core/agent-session.d.ts +12 -33
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +61 -67
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/bash-executor.d.ts +1 -1
- package/dist/core/bash-executor.d.ts.map +1 -1
- package/dist/core/bash-executor.js.map +1 -1
- package/dist/core/extensions/bootstrap-agent-loop.d.ts +23 -151
- package/dist/core/extensions/bootstrap-agent-loop.d.ts.map +1 -1
- package/dist/core/extensions/bootstrap-agent-loop.js +28 -290
- package/dist/core/extensions/bootstrap-agent-loop.js.map +1 -1
- package/dist/core/extensions/capability-runtime-types.d.ts +5 -3
- package/dist/core/extensions/capability-runtime-types.d.ts.map +1 -1
- package/dist/core/extensions/capability-runtime-types.js.map +1 -1
- package/dist/core/extensions/capability-runtime.d.ts.map +1 -1
- package/dist/core/extensions/capability-runtime.js +42 -6
- package/dist/core/extensions/capability-runtime.js.map +1 -1
- package/dist/core/extensions/index.d.ts +12 -5
- package/dist/core/extensions/index.d.ts.map +1 -1
- package/dist/core/extensions/index.js +12 -5
- package/dist/core/extensions/index.js.map +1 -1
- package/dist/core/extensions/virtual-modules.d.ts.map +1 -1
- package/dist/core/extensions/virtual-modules.js +65 -0
- package/dist/core/extensions/virtual-modules.js.map +1 -1
- package/dist/core/facade/coding-agent-facade.d.ts +1 -7
- package/dist/core/facade/coding-agent-facade.d.ts.map +1 -1
- package/dist/core/facade/coding-agent-facade.js +0 -3
- package/dist/core/facade/coding-agent-facade.js.map +1 -1
- package/dist/core/i18n/locales/zh-cn/cli.d.ts.map +1 -1
- package/dist/core/i18n/locales/zh-cn/cli.js +3 -1
- package/dist/core/i18n/locales/zh-cn/cli.js.map +1 -1
- package/dist/core/i18n/locales/zh-cn/core-contract-core.d.ts +1 -1
- package/dist/core/i18n/locales/zh-cn/core-contract-core.d.ts.map +1 -1
- package/dist/core/i18n/locales/zh-cn/core-contract-core.js +1 -1
- package/dist/core/i18n/locales/zh-cn/core-contract-core.js.map +1 -1
- package/dist/core/i18n/locales/zh-cn/core-contract-extensions.d.ts.map +1 -1
- package/dist/core/i18n/locales/zh-cn/core-contract-extensions.js +2 -4
- package/dist/core/i18n/locales/zh-cn/core-contract-extensions.js.map +1 -1
- package/dist/core/i18n/locales/zh-cn/core-errors.d.ts.map +1 -1
- package/dist/core/i18n/locales/zh-cn/core-errors.js +3 -1
- package/dist/core/i18n/locales/zh-cn/core-errors.js.map +1 -1
- package/dist/core/i18n/locales/zh-cn/interactive-mode.d.ts.map +1 -1
- package/dist/core/i18n/locales/zh-cn/interactive-mode.js +2 -0
- package/dist/core/i18n/locales/zh-cn/interactive-mode.js.map +1 -1
- package/dist/core/i18n/locales/zh-cn/tui-components-selectors.d.ts.map +1 -1
- package/dist/core/i18n/locales/zh-cn/tui-components-selectors.js +0 -2
- package/dist/core/i18n/locales/zh-cn/tui-components-selectors.js.map +1 -1
- package/dist/core/model-config.d.ts +0 -1
- package/dist/core/model-config.d.ts.map +1 -1
- package/dist/core/model-config.js +9 -1
- package/dist/core/model-config.js.map +1 -1
- package/dist/core/model-runtime.d.ts.map +1 -1
- package/dist/core/model-runtime.js +3 -3
- package/dist/core/model-runtime.js.map +1 -1
- package/dist/core/provider-composer.d.ts +2 -2
- package/dist/core/provider-composer.d.ts.map +1 -1
- package/dist/core/provider-composer.js +7 -8
- package/dist/core/provider-composer.js.map +1 -1
- package/dist/core/sdk.d.ts +18 -3
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +267 -76
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/settings-manager.d.ts +9 -20
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +20 -54
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/tools/bash-operations.d.ts +41 -0
- package/dist/core/tools/bash-operations.d.ts.map +1 -0
- package/dist/core/tools/bash-operations.js +113 -0
- package/dist/core/tools/bash-operations.js.map +1 -0
- package/dist/core/tools/index.d.ts +12 -36
- package/dist/core/tools/index.d.ts.map +1 -1
- package/dist/core/tools/index.js +1 -117
- package/dist/core/tools/index.js.map +1 -1
- package/dist/core/tools/readme-path.d.ts +3 -0
- package/dist/core/tools/readme-path.d.ts.map +1 -0
- package/dist/core/tools/readme-path.js +15 -0
- package/dist/core/tools/readme-path.js.map +1 -0
- package/dist/index.d.ts +3 -19
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -39
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +3 -2
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/components/footer.d.ts +0 -2
- package/dist/modes/interactive/components/footer.d.ts.map +1 -1
- package/dist/modes/interactive/components/footer.js +2 -7
- package/dist/modes/interactive/components/footer.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts +2 -6
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +6 -28
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/components/tool-execution.d.ts +0 -1
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution.js +9 -25
- package/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +0 -1
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +23 -36
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-client.d.ts +0 -8
- package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client.js +0 -12
- package/dist/modes/rpc/rpc-client.js.map +1 -1
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-mode.js +0 -9
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-types.d.ts +0 -19
- package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-types.js.map +1 -1
- package/dist/plugins/ecosystem/cli.d.ts.map +1 -1
- package/dist/plugins/ecosystem/cli.js +14 -2
- package/dist/plugins/ecosystem/cli.js.map +1 -1
- package/dist/plugins/ecosystem/node-npm-registry-source.d.ts +7 -2
- package/dist/plugins/ecosystem/node-npm-registry-source.d.ts.map +1 -1
- package/dist/plugins/ecosystem/node-npm-registry-source.js +64 -9
- package/dist/plugins/ecosystem/node-npm-registry-source.js.map +1 -1
- package/dist/plugins/ecosystem/node-plugin-acquisition-host.d.ts.map +1 -1
- package/dist/plugins/ecosystem/node-plugin-acquisition-host.js +6 -0
- package/dist/plugins/ecosystem/node-plugin-acquisition-host.js.map +1 -1
- package/dist/plugins/ecosystem/node-plugin-bootstrap.d.ts +9 -2
- package/dist/plugins/ecosystem/node-plugin-bootstrap.d.ts.map +1 -1
- package/dist/plugins/ecosystem/node-plugin-bootstrap.js +23 -0
- package/dist/plugins/ecosystem/node-plugin-bootstrap.js.map +1 -1
- package/dist/plugins/ecosystem/plugin-bootstrap.d.ts +9 -1
- package/dist/plugins/ecosystem/plugin-bootstrap.d.ts.map +1 -1
- package/dist/plugins/ecosystem/plugin-bootstrap.js +5 -0
- package/dist/plugins/ecosystem/plugin-bootstrap.js.map +1 -1
- package/dist/profiles/builtin-suites.d.ts +5 -1
- package/dist/profiles/builtin-suites.d.ts.map +1 -1
- package/dist/profiles/builtin-suites.js +6 -1
- package/dist/profiles/builtin-suites.js.map +1 -1
- package/dist/utils/photon.d.ts +2 -2
- package/dist/utils/photon.d.ts.map +1 -1
- package/dist/utils/photon.js +2 -2
- package/dist/utils/photon.js.map +1 -1
- package/docs/compaction.md +1 -3
- package/docs/docs.json +4 -0
- package/docs/index.md +1 -0
- package/docs/mcp.md +103 -0
- package/docs/models.md +14 -22
- package/docs/providers.md +0 -1
- package/docs/rpc.md +1 -26
- package/docs/sdk.md +4 -6
- package/docs/settings.md +9 -12
- package/docs/skills.md +1 -9
- package/docs/usage.md +1 -1
- package/examples/extensions/bash-spawn-hook/index.ts +7 -2
- package/examples/extensions/built-in-tool-renderer/index.ts +4 -2
- package/examples/extensions/minimal-mode/index.ts +2 -2
- package/examples/extensions/truncated-tool/index.ts +1 -1
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/examples/extensions/with-deps/plugin.json +1 -1
- package/examples/sdk/10-settings.ts +2 -4
- package/examples/sdk/12-full-control.ts +1 -2
- package/package.json +3 -4
- package/dist/bundle/chunks/chunk-6ZKDNZHA.js +0 -145
- package/dist/bundle/chunks/chunk-BFC2BDVJ.js +0 -13
- package/dist/bundle/chunks/chunk-MOHOLL3F.js +0 -1456
- package/dist/bundle/chunks/virtual-modules-KZ5DRH7Q.js +0 -2
- package/dist/core/extensions/bootstrap-branch-summary-policy.d.ts +0 -7
- package/dist/core/extensions/bootstrap-branch-summary-policy.d.ts.map +0 -1
- package/dist/core/extensions/bootstrap-branch-summary-policy.js +0 -28
- package/dist/core/extensions/bootstrap-branch-summary-policy.js.map +0 -1
- package/dist/core/extensions/bootstrap-compaction-policy.d.ts +0 -7
- package/dist/core/extensions/bootstrap-compaction-policy.d.ts.map +0 -1
- package/dist/core/extensions/bootstrap-compaction-policy.js +0 -82
- package/dist/core/extensions/bootstrap-compaction-policy.js.map +0 -1
- package/dist/core/extensions/bootstrap-overflow-policy.d.ts +0 -7
- package/dist/core/extensions/bootstrap-overflow-policy.d.ts.map +0 -1
- package/dist/core/extensions/bootstrap-overflow-policy.js +0 -30
- package/dist/core/extensions/bootstrap-overflow-policy.js.map +0 -1
- package/dist/core/extensions/bootstrap-retry-policy.d.ts +0 -7
- package/dist/core/extensions/bootstrap-retry-policy.d.ts.map +0 -1
- package/dist/core/extensions/bootstrap-retry-policy.js +0 -29
- package/dist/core/extensions/bootstrap-retry-policy.js.map +0 -1
- package/dist/core/extensions/bootstrap-tools.d.ts +0 -20
- package/dist/core/extensions/bootstrap-tools.d.ts.map +0 -1
- package/dist/core/extensions/bootstrap-tools.js +0 -36
- package/dist/core/extensions/bootstrap-tools.js.map +0 -1
- package/dist/core/extensions/microcompact.d.ts +0 -80
- package/dist/core/extensions/microcompact.d.ts.map +0 -1
- package/dist/core/extensions/microcompact.js +0 -134
- package/dist/core/extensions/microcompact.js.map +0 -1
- package/dist/core/extensions/provider-failover.d.ts +0 -106
- package/dist/core/extensions/provider-failover.d.ts.map +0 -1
- package/dist/core/extensions/provider-failover.js.map +0 -1
- package/dist/core/tools/bash.d.ts.map +0 -1
- package/dist/core/tools/bash.js.map +0 -1
- package/dist/core/tools/edit.d.ts.map +0 -1
- package/dist/core/tools/edit.js.map +0 -1
- package/dist/core/tools/find.d.ts.map +0 -1
- package/dist/core/tools/find.js.map +0 -1
- package/dist/core/tools/grep.d.ts.map +0 -1
- package/dist/core/tools/grep.js.map +0 -1
- package/dist/core/tools/ls.d.ts.map +0 -1
- package/dist/core/tools/powershell.d.ts.map +0 -1
- package/dist/core/tools/powershell.js.map +0 -1
- package/dist/core/tools/read.d.ts.map +0 -1
- package/dist/core/tools/read.js.map +0 -1
- package/dist/core/tools/write.d.ts.map +0 -1
- package/dist/core/tools/write.js.map +0 -1
- package/dist/plugins/mcp-http.d.ts.map +0 -1
- package/dist/plugins/mcp-http.js.map +0 -1
- package/dist/profile/child-facade.d.ts +0 -44
- package/dist/profile/child-facade.d.ts.map +0 -1
- package/dist/profile/child-facade.js +0 -56
- package/dist/profile/child-facade.js.map +0 -1
- package/dist/profile/dependency-wiring.d.ts +0 -48
- package/dist/profile/dependency-wiring.d.ts.map +0 -1
- package/dist/profile/dependency-wiring.js +0 -56
- package/dist/profile/dependency-wiring.js.map +0 -1
- package/dist/profile/domain-recovery.d.ts +0 -60
- package/dist/profile/domain-recovery.d.ts.map +0 -1
- package/dist/profile/domain-recovery.js +0 -94
- package/dist/profile/domain-recovery.js.map +0 -1
- package/dist/profile/first-roles.d.ts +0 -30
- package/dist/profile/first-roles.d.ts.map +0 -1
- package/dist/profile/first-roles.js +0 -83
- package/dist/profile/first-roles.js.map +0 -1
- package/dist/profile/goal-plugin.d.ts +0 -38
- package/dist/profile/goal-plugin.d.ts.map +0 -1
- package/dist/profile/goal-plugin.js +0 -132
- package/dist/profile/goal-plugin.js.map +0 -1
- package/dist/profile/plan-plugin.d.ts +0 -44
- package/dist/profile/plan-plugin.d.ts.map +0 -1
- package/dist/profile/plan-plugin.js +0 -157
- package/dist/profile/plan-plugin.js.map +0 -1
- package/dist/profile/policy-manifest.d.ts +0 -53
- package/dist/profile/policy-manifest.d.ts.map +0 -1
- package/dist/profile/policy-manifest.js +0 -53
- package/dist/profile/policy-manifest.js.map +0 -1
- package/dist/profile/role-assembly.d.ts +0 -47
- package/dist/profile/role-assembly.d.ts.map +0 -1
- package/dist/profile/role-assembly.js +0 -31
- package/dist/profile/role-assembly.js.map +0 -1
- package/dist/profile/role-catalog.d.ts +0 -43
- package/dist/profile/role-catalog.d.ts.map +0 -1
- package/dist/profile/role-catalog.js +0 -132
- package/dist/profile/role-catalog.js.map +0 -1
- package/dist/profile/role-orchestrator.d.ts +0 -123
- package/dist/profile/role-orchestrator.d.ts.map +0 -1
- package/dist/profile/role-orchestrator.js +0 -195
- package/dist/profile/role-orchestrator.js.map +0 -1
- package/dist/profile/role-runner.d.ts +0 -99
- package/dist/profile/role-runner.d.ts.map +0 -1
- package/dist/profile/role-runner.js +0 -79
- package/dist/profile/role-runner.js.map +0 -1
- package/dist/profile/root-facade.d.ts +0 -36
- package/dist/profile/root-facade.d.ts.map +0 -1
- package/dist/profile/root-facade.js +0 -49
- package/dist/profile/root-facade.js.map +0 -1
- package/dist/profile/skill-discovery-wiring.d.ts +0 -58
- package/dist/profile/skill-discovery-wiring.d.ts.map +0 -1
- package/dist/profile/skill-discovery-wiring.js +0 -80
- package/dist/profile/skill-discovery-wiring.js.map +0 -1
- package/dist/profile/state-store.d.ts +0 -62
- package/dist/profile/state-store.d.ts.map +0 -1
- package/dist/profile/state-store.js +0 -144
- package/dist/profile/state-store.js.map +0 -1
- package/dist/profile/todo-plugin.d.ts +0 -37
- package/dist/profile/todo-plugin.d.ts.map +0 -1
- package/dist/profile/todo-plugin.js +0 -137
- package/dist/profile/todo-plugin.js.map +0 -1
- package/dist/server/create-harness.d.ts +0 -26
- package/dist/server/create-harness.d.ts.map +0 -1
- package/dist/server/create-harness.js +0 -106
- package/dist/server/create-harness.js.map +0 -1
- /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 {
|
|
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
|
|
630
|
-
//
|
|
631
|
-
//
|
|
632
|
-
//
|
|
633
|
-
//
|
|
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) {
|
|
@@ -696,6 +816,10 @@ export async function createAgentSession(options = {}) {
|
|
|
696
816
|
initialActiveToolNames,
|
|
697
817
|
allowedToolNames,
|
|
698
818
|
excludedToolNames,
|
|
819
|
+
// 延迟工具(MCP `deferredTools: true`):services 装配域解析出的插件 id 集
|
|
820
|
+
// 合在此过线;AgentSession 据此注册 tool_search 并把对应插件的新工具排除出
|
|
821
|
+
// 默认激活集(agent-session-tools 的默认激活分支)。
|
|
822
|
+
...(options.deferredToolPluginIds === undefined ? {} : { deferredToolPluginIds: options.deferredToolPluginIds }),
|
|
699
823
|
sessionStartEvent: options.sessionStartEvent,
|
|
700
824
|
capabilityMode: options.capabilityMode,
|
|
701
825
|
contextStrategyName: options.contextStrategyName,
|
|
@@ -839,28 +963,13 @@ export async function createAgentSession(options = {}) {
|
|
|
839
963
|
...(capabilitySkillsFilter === undefined ? {} : { capabilitySkillsFilter }),
|
|
840
964
|
});
|
|
841
965
|
agentSessionRef.current = session;
|
|
842
|
-
// provider-failover 装配(设计 供应商能力槽位与主备切换 §4.8
|
|
843
|
-
//
|
|
844
|
-
//
|
|
845
|
-
//
|
|
846
|
-
//
|
|
847
|
-
//
|
|
848
|
-
//
|
|
849
|
-
// 零网络请求、不触发 OAuth 刷新。
|
|
850
|
-
try {
|
|
851
|
-
installProviderFailoverPlugin(session.getCapabilityRuntime(), {
|
|
852
|
-
failoverSettings: readProviderFailoverSettingsNode(settingsManager),
|
|
853
|
-
preflight: {
|
|
854
|
-
resolveModel: (provider, modelId) => modelRuntime.getModel(provider, modelId),
|
|
855
|
-
hasProvider: (providerId) => modelRuntime.getProvider(providerId) !== undefined,
|
|
856
|
-
hasConfiguredAuth: (providerId) => modelRuntime.hasConfiguredAuth(providerId),
|
|
857
|
-
},
|
|
858
|
-
hostLogger,
|
|
859
|
-
});
|
|
860
|
-
}
|
|
861
|
-
catch (error) {
|
|
862
|
-
hostLogger?.warn("sdk", "provider failover plugin load failed", { cause: error });
|
|
863
|
-
}
|
|
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 链。
|
|
864
973
|
// Session-suite binding (设计 §10.1): record the suite as session protocol
|
|
865
974
|
// data via the existing custom-entry extension point. New sessions only;
|
|
866
975
|
// resumed sessions keep their original binding.
|
|
@@ -975,15 +1084,31 @@ export async function createAgentSession(options = {}) {
|
|
|
975
1084
|
if (skippedInstalledPluginIds.length > 0) {
|
|
976
1085
|
capabilityDiagnostics.push(`Installed capability plugins stay unloaded because the active profile did not select them: ${skippedInstalledPluginIds.sort().join(", ")}`);
|
|
977
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);
|
|
978
1101
|
const manifestPaths = [
|
|
979
1102
|
...suiteLocalManifestPaths,
|
|
980
1103
|
...installedPluginManifestPaths,
|
|
1104
|
+
...bundledManifestPaths,
|
|
981
1105
|
...discoveredManifestPaths,
|
|
982
1106
|
...(options.capabilityPluginPaths ?? []),
|
|
983
1107
|
];
|
|
984
1108
|
const explicitCandidatePaths = new Set([
|
|
985
1109
|
...suiteLocalManifestPaths,
|
|
986
1110
|
...installedPluginManifestPaths,
|
|
1111
|
+
...bundledManifestPaths,
|
|
987
1112
|
...(options.capabilityPluginPaths ?? []),
|
|
988
1113
|
]);
|
|
989
1114
|
const loadedManifestPaths = new Set();
|
|
@@ -1045,6 +1170,23 @@ export async function createAgentSession(options = {}) {
|
|
|
1045
1170
|
const discoveredPluginIds = [];
|
|
1046
1171
|
for (const entry of manifestEntries) {
|
|
1047
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
|
+
}
|
|
1048
1190
|
if (poolFilter && !explicitManifestPaths.has(entry.path)) {
|
|
1049
1191
|
const decision = poolFilter.decide(entry.manifest.id, entry.path);
|
|
1050
1192
|
if (!decision.keep) {
|
|
@@ -1054,7 +1196,13 @@ export async function createAgentSession(options = {}) {
|
|
|
1054
1196
|
}
|
|
1055
1197
|
}
|
|
1056
1198
|
if (seenPluginIds.has(entry.manifest.id)) {
|
|
1057
|
-
|
|
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
|
+
}
|
|
1058
1206
|
continue;
|
|
1059
1207
|
}
|
|
1060
1208
|
seenPluginIds.add(entry.manifest.id);
|
|
@@ -1101,50 +1249,93 @@ export async function createAgentSession(options = {}) {
|
|
|
1101
1249
|
// v8 ignore next -- 顺序解析返回的 manifest 均来自同一 survivors 集合,路径恒存在
|
|
1102
1250
|
if (!manifestPath)
|
|
1103
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 ?? {}) };
|
|
1104
1336
|
try {
|
|
1105
1337
|
await session.loadCapabilityPluginManifest(manifestPath, {
|
|
1106
|
-
|
|
1107
|
-
// 入口可信时改写插件 config 的 runnerEntryAuto(原 builtin 注入链的
|
|
1108
|
-
// selfInvocationPool 旗标退役);插件入口的 agent-dir 配置文件仍合并
|
|
1109
|
-
// 在其上,用户显式配置保持最终决定权。
|
|
1110
|
-
...(manifest.id === SUBAGENT_DELEGATE_PACKAGE_ID && options.subagentPoolFromSelfInvocation === true
|
|
1111
|
-
? { configOverride: { runnerEntryAuto: true } }
|
|
1112
|
-
: {}),
|
|
1113
|
-
// 记忆档位注入(D-075 S4 第四批):显式定档与 settings.json 持久档位经
|
|
1114
|
-
// 公共 configOverride 通道合并进 memory 插件包 manifest config——包 entry
|
|
1115
|
-
// 按同一解析链定档(显式 > env > settings > 旧别名 > off);agent-dir
|
|
1116
|
-
// 配置文件(capabilities/builtin.memory.json)仍合并在其上,用户显式
|
|
1117
|
-
// 配置保持最终决定权。mode=off 的包已在上面的成员资格门控中排除,
|
|
1118
|
-
// 不会走到这里。
|
|
1119
|
-
...(manifest.id === MEMORY_PACKAGE_ID
|
|
1120
|
-
? {
|
|
1121
|
-
configOverride: {
|
|
1122
|
-
...(memoryModeOption === undefined ? {} : { memoryMode: memoryModeOption }),
|
|
1123
|
-
...(settingsMemoryMode === undefined ? {} : { memorySettingsMode: settingsMemoryMode }),
|
|
1124
|
-
},
|
|
1125
|
-
}
|
|
1126
|
-
: {}),
|
|
1127
|
-
// 生图槽位注入(供应商能力槽位设计 §3.3):settings 槽位(provider/model,
|
|
1128
|
-
// model 可省)与 models.json 生图目录快照经公共 configOverride 通道注入
|
|
1129
|
-
// image-generation 插件包;插件按六层取值链消费(设计 §3.2)。槽位缺省时
|
|
1130
|
-
// 只注入快照——插件回落到 env/主推断/唯一候选推断。
|
|
1131
|
-
...(manifest.id === IMAGE_GENERATION_PACKAGE_ID
|
|
1132
|
-
? {
|
|
1133
|
-
configOverride: {
|
|
1134
|
-
...(imageGenerationSlot === undefined
|
|
1135
|
-
? {}
|
|
1136
|
-
: {
|
|
1137
|
-
imageGeneration: {
|
|
1138
|
-
provider: imageGenerationSlot.provider,
|
|
1139
|
-
...(imageGenerationSlot.model === undefined
|
|
1140
|
-
? {}
|
|
1141
|
-
: { model: imageGenerationSlot.model }),
|
|
1142
|
-
},
|
|
1143
|
-
}),
|
|
1144
|
-
imageModelCatalog,
|
|
1145
|
-
},
|
|
1146
|
-
}
|
|
1147
|
-
: {}),
|
|
1338
|
+
...(configOverride === undefined ? {} : { configOverride }),
|
|
1148
1339
|
});
|
|
1149
1340
|
}
|
|
1150
1341
|
catch (error) {
|