@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.
- package/CHANGELOG.md +29 -0
- 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 +143 -56
- 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 +61 -117
- 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 +2 -2
- 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/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 +2 -4
- 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.map +1 -1
- package/dist/core/agent-session-compaction.js +14 -1
- package/dist/core/agent-session-compaction.js.map +1 -1
- package/dist/core/agent-session-internal.d.ts +1 -1
- 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 -3
- 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 -13
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +56 -34
- 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 -1
- package/dist/core/facade/coding-agent-facade.d.ts.map +1 -1
- package/dist/core/facade/coding-agent-facade.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/sdk.d.ts +10 -3
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +263 -77
- package/dist/core/sdk.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/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/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/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/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/package.json +3 -2
- package/dist/bundle/chunks/chunk-6ZKDNZHA.js +0 -145
- package/dist/bundle/chunks/chunk-HLJEVRWP.js +0 -13
- package/dist/bundle/chunks/chunk-YGHQME4V.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 -48
- 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/provider-failover.d.ts +0 -110
- 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/plugins → bundled-plugins/mcp-http/dist}/mcp-http.d.ts +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node-plugin-acquisition-host.js","sourceRoot":"","sources":["../../../src/plugins/ecosystem/node-plugin-acquisition-host.ts"],"names":[],"mapp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AC,MAAM,EAAE,OAAO,KAAK,IAAI;wBAAE,MAAM,IAAI,yBAAyB,CAAC,WAAW,CAAC,CAAC;oBACrF,MAAM,IAAI,UAAU,CACnB,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,MAAM,GAAG,uBAAuB,EAAE,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAClG,CAAC;gBACH,CAAC;YAAA,CACD,CAAC,EAAE,CAAC;QAAA,CACL;QACD,eAAe;QACf,YAAY,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,WAAW,CAAC;QACzD,KAAK,CAAC,KAAK,GAAG;YACb,MAAM,GAAG,IAAI,CAAC;YACd,SAAS,CAAC,KAAK,EAAE,CAAC;QAAA,CAClB;KACD,CAAC;AAAA,CACF","sourcesContent":["import { createHash, randomUUID } from \"node:crypto\";\nimport { lstatSync } from \"node:fs\";\nimport type { PluginDistributionArtifactV1 } from \"./distribution.ts\";\nimport { collectLocalDirectoryPackageEntriesV1, readLocalPackageFileV1 } from \"./node-local-package-source.ts\";\nimport {\n\tcreateNodeNpmRegistrySourceV1,\n\tNodeNpmRegistrySourceErrorV1,\n\ttype NodeNpmRegistrySourceV1,\n} from \"./node-npm-registry-source.ts\";\nimport {\n\tNodePackageInstallErrorV1,\n\ttype NodeZipPackageEntryV1,\n\ttype NodeZipPackageLimitsV1,\n\tparseNodeZipPackageV1,\n} from \"./node-package-install-host.ts\";\nimport { detectPluginPackageMediaTypeV1 } from \"./node-package-media.ts\";\nimport {\n\tcreateNodeReleasePackageSourceV1,\n\tNodeReleasePackageSourceErrorV1,\n\ttype NodeReleasePackageSourceV1,\n} from \"./node-release-package-source.ts\";\nimport { parseNodeTarGzPackageV1 } from \"./node-tar-package.ts\";\nimport { buildNodeTarGzBytesV1 } from \"./node-tar-writer.ts\";\nimport {\n\tPluginAcquisitionErrorV1,\n\ttype PluginAcquisitionLocalProbeV1,\n\ttype PluginAcquisitionPackageV1,\n\ttype PluginAcquisitionRefV1,\n\tparsePluginAcquisitionRefV1,\n} from \"./plugin-acquisition.ts\";\nimport type { PluginManifestV1 } from \"./types.ts\";\nimport { pluginManifestDigestV1 } from \"./updates.ts\";\n\nexport type { PluginAcquisitionPackageV1 } from \"./plugin-acquisition.ts\";\n\nimport { downloadNodeUrlPackageV1, NodeUrlPackageSourceErrorV1 } from \"./node-url-package-source.ts\";\n\n/**\n * Node acquisition orchestration for `plugin install <ref>` (design §4.6).\n * One boundary acquires package bytes for every source (npm packument+tarball,\n * GitHub/Gitee release asset, custom URL, local file, local directory),\n * verifies the source-specific integrity layer (npm SRI > ref digest fragment\n * > sha256 on exchange), discovers the `agent-forge.json` identity through the\n * shared bounded unpackers, and exposes the result as an opaque distribution\n * artifact the existing installer/install-host chain consumes unchanged.\n */\n\nconst NODE_PLUGIN_ACQUISITION_HOST_VERSION_V1 = 1 as const;\nconst MAX_PACKAGE_MANIFEST_BYTES_V1 = 64 * 1024;\nconst ECOSYSTEM_MANIFEST_FILE_V1 = \"agent-forge.json\";\n/** Fixed far-future expiry; the artifact handle is single-transaction and never persisted. */\nconst ACQUISITION_ARTIFACT_EXPIRES_AT_V1 = \"2099-01-01T00:00:00.000Z\";\nconst ARTIFACT_CHUNK_BYTES_V1 = 64 * 1024;\n\n/** Environment variable overriding the npm registry origin (bare http(s) origin). */\nexport const AGENT_FORGE_NPM_REGISTRY_ENV_V1 = \"AGENT_FORGE_NPM_REGISTRY\";\n/** Environment variable carrying the npm registry bearer token. */\nexport const AGENT_FORGE_NPM_TOKEN_ENV_V1 = \"AGENT_FORGE_NPM_TOKEN\";\n/** Environment variable overriding the GitHub release API origin (bare http(s) origin). */\nexport const AGENT_FORGE_GITHUB_API_ENV_V1 = \"AGENT_FORGE_GITHUB_API\";\n/** Environment variable overriding the Gitee release API origin (bare http(s) origin, includes the /api/v5 path). */\nexport const AGENT_FORGE_GITEE_API_ENV_V1 = \"AGENT_FORGE_GITEE_API\";\n/** Environment variable carrying the optional GitHub API token. */\nexport const GITHUB_TOKEN_ENV_V1 = \"GITHUB_TOKEN\";\n/** Environment variable carrying the optional Gitee API token. */\nexport const GITEE_TOKEN_ENV_V1 = \"GITEE_TOKEN\";\n\nexport interface NodePluginAcquisitionHostV1 {\n\treadonly version: typeof NODE_PLUGIN_ACQUISITION_HOST_VERSION_V1;\n\t/** Parse and acquire one ref into a package + artifact pair. */\n\treadonly resolvePackage: (input: {\n\t\treadonly ref: string;\n\t\treadonly signal?: AbortSignal;\n\t}) => Promise<PluginAcquisitionPackageV1>;\n\t/** Private installer-facing reader; mirrors the HTTP distribution host boundary. */\n\treadonly openArtifact: (input: {\n\t\treadonly artifact: PluginDistributionArtifactV1;\n\t\treadonly signal?: AbortSignal;\n\t}) => AsyncIterable<Uint8Array>;\n\treadonly releaseArtifact: (input: { readonly artifact: { readonly artifactRef: string } }) => Promise<void>;\n\t/** Whether this host owns the artifact reference (used to compose artifact readers). */\n\treadonly ownsArtifact: (input: { readonly artifactRef: string }) => boolean;\n\treadonly close: () => Promise<void>;\n}\n\nexport interface NodePluginAcquisitionHostOptionsV1 {\n\t/** Real fetch or a deterministic test replacement. */\n\treadonly fetch?: typeof globalThis.fetch;\n\t/** Bare http(s) npm registry origin; defaults to the environment variable, then the npm public registry. */\n\treadonly npmRegistry?: string;\n\t/** npm registry bearer token; defaults to the environment variable. */\n\treadonly npmToken?: string;\n\t/** Bare http(s) GitHub release API origin; defaults to the environment variable, then api.github.com. */\n\treadonly githubApiOrigin?: string;\n\t/** Bare http(s) Gitee release API origin; defaults to the environment variable, then gitee.com/api/v5. */\n\treadonly giteeApiOrigin?: string;\n\t/** GitHub API token sent as a bearer header; defaults to the environment variable. */\n\treadonly githubToken?: string;\n\t/** Gitee API token sent as an access_token query parameter; defaults to the environment variable. */\n\treadonly giteeToken?: string;\n\treadonly requestTimeoutMs?: number;\n\treadonly maxResponseBytes?: number;\n\treadonly maxTarballBytes?: number;\n\treadonly limits?: NodeZipPackageLimitsV1;\n\treadonly userAgent?: string;\n}\n\ninterface AcquiredBytesV1 {\n\treadonly bytes: Uint8Array;\n\treadonly mediaType: \"application/zip\" | \"application/gzip\";\n\treadonly digest: { readonly algorithm: \"sha256\" | \"sha512\"; readonly hex: string };\n\treadonly source: string;\n}\n\ninterface AcquiredArtifactRecordV1 {\n\treadonly bytes: Uint8Array;\n\treadonly artifact: PluginDistributionArtifactV1;\n}\n\nconst LOCAL_PROBE_V1: PluginAcquisitionLocalProbeV1 = {\n\t// The parser contract is synchronous; one lstat per candidate ref keeps\n\t// this bounded. Symlinks classify as \"other\" so they never install as local.\n\tstatLocalRef: (path) => {\n\t\tconst stats = lstatSync(path, { throwIfNoEntry: false });\n\t\tif (stats === undefined) return \"missing\";\n\t\tif (stats.isSymbolicLink()) return \"other\";\n\t\tif (stats.isDirectory()) return \"directory\";\n\t\tif (stats.isFile()) return \"file\";\n\t\treturn \"other\";\n\t},\n};\n\nfunction mapInstallError(error: unknown): PluginAcquisitionErrorV1 {\n\tif (error instanceof PluginAcquisitionErrorV1) return error;\n\tif (error instanceof NodePackageInstallErrorV1) {\n\t\tif (error.code === \"cancelled\") return new PluginAcquisitionErrorV1(\"cancelled\");\n\t\tif (error.code === \"archive_budget_exceeded\") return new PluginAcquisitionErrorV1(\"budget_exceeded\");\n\t\tif (error.code === \"unsupported_media_type\") return new PluginAcquisitionErrorV1(\"unsupported_media_type\");\n\t\treturn new PluginAcquisitionErrorV1(\"package_invalid\");\n\t}\n\treturn new PluginAcquisitionErrorV1(\"download_failed\");\n}\n\nfunction mapNpmError(error: unknown): PluginAcquisitionErrorV1 {\n\tif (error instanceof PluginAcquisitionErrorV1) return error;\n\tif (error instanceof NodeNpmRegistrySourceErrorV1) {\n\t\tif (error.code === \"package_not_found\") return new PluginAcquisitionErrorV1(\"package_not_found\");\n\t\tif (error.code === \"version_not_found\") return new PluginAcquisitionErrorV1(\"version_not_found\");\n\t\tif (error.code === \"cancelled\") return new PluginAcquisitionErrorV1(\"cancelled\");\n\t\tif (error.code === \"invalid_response\" || error.code === \"integrity_unsupported\")\n\t\t\treturn new PluginAcquisitionErrorV1(\"package_invalid\");\n\t\treturn new PluginAcquisitionErrorV1(\"download_failed\");\n\t}\n\treturn mapInstallError(error);\n}\n\nfunction mapUrlError(error: unknown): PluginAcquisitionErrorV1 {\n\tif (error instanceof PluginAcquisitionErrorV1) return error;\n\tif (error instanceof NodeUrlPackageSourceErrorV1) {\n\t\tif (error.code === \"digest_mismatch\") return new PluginAcquisitionErrorV1(\"digest_mismatch\");\n\t\tif (error.code === \"cancelled\") return new PluginAcquisitionErrorV1(\"cancelled\");\n\t\tif (error.code === \"invalid_url\" || error.code === \"invalid_configuration\")\n\t\t\treturn new PluginAcquisitionErrorV1(\"invalid_ref\");\n\t\tif (error.code === \"response_too_large\") return new PluginAcquisitionErrorV1(\"budget_exceeded\");\n\t\treturn new PluginAcquisitionErrorV1(\"download_failed\");\n\t}\n\treturn mapInstallError(error);\n}\n\nfunction mapReleaseError(error: unknown): PluginAcquisitionErrorV1 {\n\tif (error instanceof PluginAcquisitionErrorV1) return error;\n\tif (error instanceof NodeReleasePackageSourceErrorV1) {\n\t\tif (error.code === \"cancelled\") return new PluginAcquisitionErrorV1(\"cancelled\");\n\t\tif (error.code === \"invalid_configuration\") return new PluginAcquisitionErrorV1(\"invalid_ref\");\n\t\tif (error.code === \"response_too_large\") return new PluginAcquisitionErrorV1(\"budget_exceeded\");\n\t\tif (error.code === \"invalid_response\") return new PluginAcquisitionErrorV1(\"package_invalid\");\n\t\tif (error.code === \"rate_limited\")\n\t\t\treturn new PluginAcquisitionErrorV1(\n\t\t\t\t\"rate_limited\",\n\t\t\t\terror.resetEpochSeconds === undefined\n\t\t\t\t\t? undefined\n\t\t\t\t\t: `rate limit resets at ${new Date(error.resetEpochSeconds * 1000).toISOString()}`,\n\t\t\t);\n\t\tif (\n\t\t\terror.code === \"release_not_found\" ||\n\t\t\terror.code === \"release_asset_not_found\" ||\n\t\t\terror.code === \"release_asset_ambiguous\"\n\t\t)\n\t\t\treturn new PluginAcquisitionErrorV1(error.code, error.message);\n\t\treturn new PluginAcquisitionErrorV1(\"download_failed\");\n\t}\n\t// Asset downloads ride the URL package source; digest and budget errors pass through unchanged.\n\treturn mapUrlError(error);\n}\n\nfunction shaHex(algorithm: \"sha256\" | \"sha512\", bytes: Uint8Array): string {\n\treturn createHash(algorithm).update(bytes).digest(\"hex\");\n}\n\n/** Abort probe as a function so later re-checks are not flow-narrowed away after awaits. */\nfunction signalAborted(signal: AbortSignal | undefined): boolean {\n\treturn signal?.aborted === true;\n}\n\n/** Discover the `agent-forge.json` identity in already-bounded package entries. */\nexport function pluginAcquisitionManifestFromEntriesV1(entries: readonly NodeZipPackageEntryV1[]): {\n\treadonly manifest: PluginManifestV1;\n\treadonly manifestDigest: string;\n} {\n\tconst manifestEntry = entries.find((entry) => entry.name === ECOSYSTEM_MANIFEST_FILE_V1 && !entry.directory);\n\tif (manifestEntry === undefined || manifestEntry.bytes.byteLength > MAX_PACKAGE_MANIFEST_BYTES_V1)\n\t\tthrow new PluginAcquisitionErrorV1(\"package_invalid\");\n\tlet value: unknown;\n\ttry {\n\t\tvalue = JSON.parse(new TextDecoder(\"utf-8\", { fatal: true }).decode(manifestEntry.bytes));\n\t} catch {\n\t\tthrow new PluginAcquisitionErrorV1(\"package_invalid\");\n\t}\n\tif (typeof value !== \"object\" || value === null || Array.isArray(value))\n\t\tthrow new PluginAcquisitionErrorV1(\"package_invalid\");\n\tconst record = value as Record<string, unknown>;\n\tconst manifestKeys = new Set([\n\t\t\"id\",\n\t\t\"pluginVersion\",\n\t\t\"apiVersion\",\n\t\t\"minHostVersion\",\n\t\t\"maxHostVersion\",\n\t\t\"capabilityRefs\",\n\t\t\"requires\",\n\t\t\"platform\",\n\t\t\"testOnly\",\n\t]);\n\tif (\n\t\trecord.packageFormatVersion !== 1 ||\n\t\tObject.keys(record).some((key) => key !== \"packageFormatVersion\" && !manifestKeys.has(key))\n\t)\n\t\tthrow new PluginAcquisitionErrorV1(\"package_invalid\");\n\tconst id = record.id;\n\tconst pluginVersion = record.pluginVersion;\n\tconst apiVersion = record.apiVersion;\n\tif (\n\t\ttypeof id !== \"string\" ||\n\t\tid.trim().length === 0 ||\n\t\tid.length > 256 ||\n\t\ttypeof pluginVersion !== \"string\" ||\n\t\tpluginVersion.trim().length === 0 ||\n\t\tpluginVersion.length > 256 ||\n\t\ttypeof apiVersion !== \"string\" ||\n\t\tapiVersion.trim().length === 0 ||\n\t\tapiVersion.length > 256\n\t)\n\t\tthrow new PluginAcquisitionErrorV1(\"package_invalid\");\n\tif (record.minHostVersion === undefined && record.maxHostVersion === undefined)\n\t\tthrow new PluginAcquisitionErrorV1(\"package_invalid\");\n\tconst manifest: PluginManifestV1 = Object.freeze({\n\t\tid,\n\t\tpluginVersion,\n\t\tapiVersion,\n\t\t...(record.minHostVersion === undefined ? {} : { minHostVersion: record.minHostVersion as string }),\n\t\t...(record.maxHostVersion === undefined ? {} : { maxHostVersion: record.maxHostVersion as string }),\n\t\t...(record.capabilityRefs === undefined\n\t\t\t? {}\n\t\t\t: { capabilityRefs: record.capabilityRefs as PluginManifestV1[\"capabilityRefs\"] }),\n\t\t...(record.requires === undefined ? {} : { requires: record.requires as PluginManifestV1[\"requires\"] }),\n\t\t...(record.platform === undefined ? {} : { platform: record.platform as PluginManifestV1[\"platform\"] }),\n\t\t...(record.testOnly === undefined ? {} : { testOnly: record.testOnly as boolean }),\n\t});\n\treturn { manifest, manifestDigest: pluginManifestDigestV1(manifest) };\n}\n\n/**\n * Create the Node acquisition host. All sources share the bounded unpackers,\n * the manifest identity discovery, and the artifact reader contract used by\n * the existing install host. Nothing is downloaded until `resolvePackage`.\n */\nexport function createNodePluginAcquisitionHostV1(\n\toptions: NodePluginAcquisitionHostOptionsV1 = {},\n): NodePluginAcquisitionHostV1 {\n\tconst limits = options.limits ?? {};\n\tconst npmRegistryOption = options.npmRegistry ?? process.env[AGENT_FORGE_NPM_REGISTRY_ENV_V1]?.trim();\n\tconst npmTokenOption = options.npmToken ?? process.env[AGENT_FORGE_NPM_TOKEN_ENV_V1]?.trim();\n\tconst githubApiOriginOption = options.githubApiOrigin ?? process.env[AGENT_FORGE_GITHUB_API_ENV_V1]?.trim();\n\tconst giteeApiOriginOption = options.giteeApiOrigin ?? process.env[AGENT_FORGE_GITEE_API_ENV_V1]?.trim();\n\tconst githubTokenOption = options.githubToken ?? process.env[GITHUB_TOKEN_ENV_V1]?.trim();\n\tconst giteeTokenOption = options.giteeToken ?? process.env[GITEE_TOKEN_ENV_V1]?.trim();\n\tconst npmSource: NodeNpmRegistrySourceV1 = createNodeNpmRegistrySourceV1({\n\t\t...(npmRegistryOption === undefined || npmRegistryOption === \"\" ? {} : { registry: npmRegistryOption }),\n\t\t...(npmTokenOption === undefined || npmTokenOption === \"\" ? {} : { token: npmTokenOption }),\n\t\t...(options.fetch === undefined ? {} : { fetch: options.fetch }),\n\t\t...(options.requestTimeoutMs === undefined ? {} : { requestTimeoutMs: options.requestTimeoutMs }),\n\t\t...(options.maxResponseBytes === undefined ? {} : { maxResponseBytes: options.maxResponseBytes }),\n\t\t...(options.maxTarballBytes === undefined ? {} : { maxTarballBytes: options.maxTarballBytes }),\n\t\t...(options.userAgent === undefined ? {} : { userAgent: options.userAgent }),\n\t});\n\tconst releaseSource: NodeReleasePackageSourceV1 = createNodeReleasePackageSourceV1({\n\t\t...(githubApiOriginOption === undefined || githubApiOriginOption === \"\"\n\t\t\t? {}\n\t\t\t: { githubApiOrigin: githubApiOriginOption }),\n\t\t...(giteeApiOriginOption === undefined || giteeApiOriginOption === \"\"\n\t\t\t? {}\n\t\t\t: { giteeApiOrigin: giteeApiOriginOption }),\n\t\t...(githubTokenOption === undefined || githubTokenOption === \"\" ? {} : { githubToken: githubTokenOption }),\n\t\t...(giteeTokenOption === undefined || giteeTokenOption === \"\" ? {} : { giteeToken: giteeTokenOption }),\n\t\t...(options.fetch === undefined ? {} : { fetch: options.fetch }),\n\t\t...(options.requestTimeoutMs === undefined ? {} : { requestTimeoutMs: options.requestTimeoutMs }),\n\t\t...(options.maxResponseBytes === undefined ? {} : { maxResponseBytes: options.maxResponseBytes }),\n\t\t...(options.maxTarballBytes === undefined ? {} : { maxAssetBytes: options.maxTarballBytes }),\n\t\t...(options.userAgent === undefined ? {} : { userAgent: options.userAgent }),\n\t});\n\tconst artifacts = new Map<string, AcquiredArtifactRecordV1>();\n\tlet closed = false;\n\n\tconst acquireBytes = async (\n\t\tref: PluginAcquisitionRefV1,\n\t\tsignal: AbortSignal | undefined,\n\t): Promise<AcquiredBytesV1> => {\n\t\tif (ref.kind === \"github\" || ref.kind === \"gitee\") {\n\t\t\ttry {\n\t\t\t\tconst download = await releaseSource.downloadReleaseAsset({\n\t\t\t\t\tkind: ref.kind,\n\t\t\t\t\towner: ref.owner,\n\t\t\t\t\trepo: ref.repo,\n\t\t\t\t\t...(ref.tag === undefined ? {} : { tag: ref.tag }),\n\t\t\t\t\t...(ref.expectedDigestHex === undefined ? {} : { expectedDigestHex: ref.expectedDigestHex }),\n\t\t\t\t\tsignal,\n\t\t\t\t});\n\t\t\t\treturn {\n\t\t\t\t\tbytes: download.bytes,\n\t\t\t\t\tmediaType: download.mediaType,\n\t\t\t\t\tdigest: { algorithm: \"sha256\", hex: download.sha256Hex },\n\t\t\t\t\tsource: download.sourceLabel,\n\t\t\t\t};\n\t\t\t} catch (error) {\n\t\t\t\tthrow mapReleaseError(error);\n\t\t\t}\n\t\t}\n\t\tif (ref.kind === \"npm\") {\n\t\t\ttry {\n\t\t\t\tconst resolved = await npmSource.resolveNpmPackage({\n\t\t\t\t\tname: ref.name,\n\t\t\t\t\t...(ref.range === undefined ? {} : { range: ref.range }),\n\t\t\t\t\tsignal,\n\t\t\t\t});\n\t\t\t\tconst bytes = await npmSource.fetchTarball({ url: resolved.tarballUrl, signal });\n\t\t\t\tconst hex = shaHex(resolved.integrity.algorithm, bytes);\n\t\t\t\tif (hex !== resolved.integrity.hex) throw new PluginAcquisitionErrorV1(\"digest_mismatch\");\n\t\t\t\treturn {\n\t\t\t\t\tbytes,\n\t\t\t\t\tmediaType: \"application/gzip\",\n\t\t\t\t\tdigest: resolved.integrity,\n\t\t\t\t\tsource: `npm:${new URL(resolved.tarballUrl).host}`,\n\t\t\t\t};\n\t\t\t} catch (error) {\n\t\t\t\tthrow mapNpmError(error);\n\t\t\t}\n\t\t}\n\t\tif (ref.kind === \"url\") {\n\t\t\ttry {\n\t\t\t\tconst download = await downloadNodeUrlPackageV1(\n\t\t\t\t\t{\n\t\t\t\t\t\t...(options.fetch === undefined ? {} : { fetch: options.fetch }),\n\t\t\t\t\t\t...(options.requestTimeoutMs === undefined ? {} : { requestTimeoutMs: options.requestTimeoutMs }),\n\t\t\t\t\t\t...(options.maxTarballBytes === undefined ? {} : { maxPackageBytes: options.maxTarballBytes }),\n\t\t\t\t\t\t...(options.userAgent === undefined ? {} : { userAgent: options.userAgent }),\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\turl: ref.url,\n\t\t\t\t\t\t...(ref.expectedDigestHex === undefined ? {} : { expectedDigestHex: ref.expectedDigestHex }),\n\t\t\t\t\t\tsignal,\n\t\t\t\t\t},\n\t\t\t\t);\n\t\t\t\treturn {\n\t\t\t\t\tbytes: download.bytes,\n\t\t\t\t\tmediaType: download.mediaType,\n\t\t\t\t\tdigest: { algorithm: \"sha256\", hex: download.digestHex },\n\t\t\t\t\tsource: `url:${new URL(ref.url).host}`,\n\t\t\t\t};\n\t\t\t} catch (error) {\n\t\t\t\tthrow mapUrlError(error);\n\t\t\t}\n\t\t}\n\t\tif (ref.kind === \"local-file\") {\n\t\t\ttry {\n\t\t\t\tconst bytes = await readLocalPackageFileV1(ref.path, limits, signal);\n\t\t\t\tconst fileName = ref.path.split(/[\\\\/]/u).pop();\n\t\t\t\tconst mediaType = detectPluginPackageMediaTypeV1(\n\t\t\t\t\tbytes,\n\t\t\t\t\tfileName === undefined || fileName.length === 0 ? undefined : fileName,\n\t\t\t\t);\n\t\t\t\treturn {\n\t\t\t\t\tbytes,\n\t\t\t\t\tmediaType,\n\t\t\t\t\tdigest: { algorithm: \"sha256\", hex: shaHex(\"sha256\", bytes) },\n\t\t\t\t\tsource: \"local:file\",\n\t\t\t\t};\n\t\t\t} catch (error) {\n\t\t\t\tthrow mapInstallError(error);\n\t\t\t}\n\t\t}\n\t\tif (ref.kind === \"local-path\") {\n\t\t\ttry {\n\t\t\t\tconst entries = await collectLocalDirectoryPackageEntriesV1(ref.path, limits, signal);\n\t\t\t\tconst bytes = buildNodeTarGzBytesV1(\n\t\t\t\t\tentries.map((entry) => ({ name: entry.name, directory: entry.directory, bytes: entry.bytes })),\n\t\t\t\t);\n\t\t\t\treturn {\n\t\t\t\t\tbytes,\n\t\t\t\t\tmediaType: \"application/gzip\",\n\t\t\t\t\tdigest: { algorithm: \"sha256\", hex: shaHex(\"sha256\", bytes) },\n\t\t\t\t\tsource: \"local:dir\",\n\t\t\t\t};\n\t\t\t} catch (error) {\n\t\t\t\tthrow mapInstallError(error);\n\t\t\t}\n\t\t}\n\t\tthrow new PluginAcquisitionErrorV1(\"invalid_ref\");\n\t};\n\n\tconst releaseArtifact = async (input: { readonly artifact: { readonly artifactRef: string } }): Promise<void> => {\n\t\tif (!artifacts.delete(input.artifact.artifactRef)) throw new NodePackageInstallErrorV1(\"invalid_artifact\");\n\t};\n\n\tconst resolvePackage = async (input: {\n\t\treadonly ref: string;\n\t\treadonly signal?: AbortSignal;\n\t}): Promise<PluginAcquisitionPackageV1> => {\n\t\tif (closed || signalAborted(input.signal)) throw new PluginAcquisitionErrorV1(\"cancelled\");\n\t\tlet ref: PluginAcquisitionRefV1;\n\t\ttry {\n\t\t\tref = parsePluginAcquisitionRefV1(input.ref, LOCAL_PROBE_V1);\n\t\t} catch (error) {\n\t\t\tif (error instanceof PluginAcquisitionErrorV1) throw error;\n\t\t\tthrow new PluginAcquisitionErrorV1(\"invalid_ref\");\n\t\t}\n\t\tconst acquired = await acquireBytes(ref, input.signal);\n\t\tif (signalAborted(input.signal)) throw new PluginAcquisitionErrorV1(\"cancelled\");\n\t\tlet entries: readonly NodeZipPackageEntryV1[];\n\t\ttry {\n\t\t\tentries =\n\t\t\t\tacquired.mediaType === \"application/gzip\"\n\t\t\t\t\t? await parseNodeTarGzPackageV1(acquired.bytes, limits)\n\t\t\t\t\t: parseNodeZipPackageV1(acquired.bytes, limits);\n\t\t} catch (error) {\n\t\t\tthrow mapInstallError(error);\n\t\t}\n\t\tconst identity = pluginAcquisitionManifestFromEntriesV1(entries);\n\t\tif (closed) throw new PluginAcquisitionErrorV1(\"cancelled\");\n\t\tconst artifactRef = `plugin-acquisition://node/${randomUUID()}`;\n\t\tconst artifact: PluginDistributionArtifactV1 = Object.freeze({\n\t\t\tversion: 1,\n\t\t\tsource: acquired.source,\n\t\t\tpluginId: identity.manifest.id,\n\t\t\tpluginVersion: identity.manifest.pluginVersion,\n\t\t\tmanifestDigest: identity.manifestDigest,\n\t\t\tartifactDigest:\n\t\t\t\tacquired.digest.algorithm === \"sha512\" ? `sha512:${acquired.digest.hex}` : `sha256:${acquired.digest.hex}`,\n\t\t\texpiresAt: ACQUISITION_ARTIFACT_EXPIRES_AT_V1,\n\t\t\tsizeBytes: acquired.bytes.byteLength,\n\t\t\tmediaType: acquired.mediaType,\n\t\t\tartifactRef,\n\t\t});\n\t\tartifacts.set(artifactRef, { bytes: acquired.bytes, artifact });\n\t\treturn Object.freeze({\n\t\t\tmanifest: identity.manifest,\n\t\t\tmanifestDigest: identity.manifestDigest,\n\t\t\tsource: acquired.source,\n\t\t\tartifact,\n\t\t\trelease: async () => {\n\t\t\t\ttry {\n\t\t\t\t\tawait releaseArtifact({ artifact: { artifactRef } });\n\t\t\t\t\treturn true;\n\t\t\t\t} catch {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t},\n\t\t});\n\t};\n\n\treturn {\n\t\tversion: NODE_PLUGIN_ACQUISITION_HOST_VERSION_V1,\n\t\tresolvePackage,\n\t\topenArtifact(input) {\n\t\t\treturn (async function* (): AsyncGenerator<Uint8Array> {\n\t\t\t\tconst record = artifacts.get(input.artifact.artifactRef);\n\t\t\t\tif (record === undefined) throw new NodePackageInstallErrorV1(\"invalid_artifact\");\n\t\t\t\tif (\n\t\t\t\t\trecord.artifact.pluginId !== input.artifact.pluginId ||\n\t\t\t\t\trecord.artifact.pluginVersion !== input.artifact.pluginVersion ||\n\t\t\t\t\trecord.artifact.manifestDigest !== input.artifact.manifestDigest ||\n\t\t\t\t\trecord.artifact.artifactDigest !== input.artifact.artifactDigest ||\n\t\t\t\t\trecord.artifact.sizeBytes !== input.artifact.sizeBytes\n\t\t\t\t)\n\t\t\t\t\tthrow new NodePackageInstallErrorV1(\"invalid_artifact\");\n\t\t\t\tfor (let offset = 0; offset < record.bytes.byteLength; offset += ARTIFACT_CHUNK_BYTES_V1) {\n\t\t\t\t\tif (input.signal?.aborted === true) throw new NodePackageInstallErrorV1(\"cancelled\");\n\t\t\t\t\tyield new Uint8Array(\n\t\t\t\t\t\trecord.bytes.subarray(offset, Math.min(offset + ARTIFACT_CHUNK_BYTES_V1, record.bytes.byteLength)),\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t})();\n\t\t},\n\t\treleaseArtifact,\n\t\townsArtifact: (input) => artifacts.has(input.artifactRef),\n\t\tasync close() {\n\t\t\tclosed = true;\n\t\t\tartifacts.clear();\n\t\t},\n\t};\n}\n"]}
|
|
1
|
+
{"version":3,"file":"node-plugin-acquisition-host.js","sourceRoot":"","sources":["../../../src/plugins/ecosystem/node-plugin-acquisition-host.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEpC,OAAO,EAAE,qCAAqC,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAC/G,OA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AC,QAAQ,CAAC,SAAS;oBAEtD,MAAM,IAAI,yBAAyB,CAAC,kBAAkB,CAAC,CAAC;gBACzD,KAAK,IAAI,MAAM,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,UAAU,EAAE,MAAM,IAAI,uBAAuB,EAAE,CAAC;oBAC1F,IAAI,KAAK,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI;wBAAE,MAAM,IAAI,yBAAyB,CAAC,WAAW,CAAC,CAAC;oBACrF,MAAM,IAAI,UAAU,CACnB,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,MAAM,GAAG,uBAAuB,EAAE,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAClG,CAAC;gBACH,CAAC;YAAA,CACD,CAAC,EAAE,CAAC;QAAA,CACL;QACD,eAAe;QACf,YAAY,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,WAAW,CAAC;QACzD,KAAK,CAAC,KAAK,GAAG;YACb,MAAM,GAAG,IAAI,CAAC;YACd,SAAS,CAAC,KAAK,EAAE,CAAC;QAAA,CAClB;KACD,CAAC;AAAA,CACF","sourcesContent":["import { createHash, randomUUID } from \"node:crypto\";\nimport { lstatSync } from \"node:fs\";\nimport type { PluginDistributionArtifactV1 } from \"./distribution.ts\";\nimport { collectLocalDirectoryPackageEntriesV1, readLocalPackageFileV1 } from \"./node-local-package-source.ts\";\nimport {\n\tcreateNodeNpmRegistrySourceV1,\n\tNodeNpmRegistrySourceErrorV1,\n\ttype NodeNpmRegistrySourceV1,\n} from \"./node-npm-registry-source.ts\";\nimport {\n\tNodePackageInstallErrorV1,\n\ttype NodeZipPackageEntryV1,\n\ttype NodeZipPackageLimitsV1,\n\tparseNodeZipPackageV1,\n} from \"./node-package-install-host.ts\";\nimport { detectPluginPackageMediaTypeV1 } from \"./node-package-media.ts\";\nimport {\n\tcreateNodeReleasePackageSourceV1,\n\tNodeReleasePackageSourceErrorV1,\n\ttype NodeReleasePackageSourceV1,\n} from \"./node-release-package-source.ts\";\nimport { parseNodeTarGzPackageV1 } from \"./node-tar-package.ts\";\nimport { buildNodeTarGzBytesV1 } from \"./node-tar-writer.ts\";\nimport {\n\tPluginAcquisitionErrorV1,\n\ttype PluginAcquisitionLocalProbeV1,\n\ttype PluginAcquisitionPackageV1,\n\ttype PluginAcquisitionRefV1,\n\tparsePluginAcquisitionRefV1,\n} from \"./plugin-acquisition.ts\";\nimport type { PluginManifestV1 } from \"./types.ts\";\nimport { pluginManifestDigestV1 } from \"./updates.ts\";\n\nexport type { PluginAcquisitionPackageV1 } from \"./plugin-acquisition.ts\";\n\nimport { downloadNodeUrlPackageV1, NodeUrlPackageSourceErrorV1 } from \"./node-url-package-source.ts\";\n\n/**\n * Node acquisition orchestration for `plugin install <ref>` (design §4.6).\n * One boundary acquires package bytes for every source (npm packument+tarball,\n * GitHub/Gitee release asset, custom URL, local file, local directory),\n * verifies the source-specific integrity layer (npm SRI > ref digest fragment\n * > sha256 on exchange), discovers the `agent-forge.json` identity through the\n * shared bounded unpackers, and exposes the result as an opaque distribution\n * artifact the existing installer/install-host chain consumes unchanged.\n */\n\nconst NODE_PLUGIN_ACQUISITION_HOST_VERSION_V1 = 1 as const;\nconst MAX_PACKAGE_MANIFEST_BYTES_V1 = 64 * 1024;\nconst ECOSYSTEM_MANIFEST_FILE_V1 = \"agent-forge.json\";\n/** Fixed far-future expiry; the artifact handle is single-transaction and never persisted. */\nconst ACQUISITION_ARTIFACT_EXPIRES_AT_V1 = \"2099-01-01T00:00:00.000Z\";\nconst ARTIFACT_CHUNK_BYTES_V1 = 64 * 1024;\n\n/** Environment variable overriding the npm registry origin (bare http(s) origin). */\nexport const AGENT_FORGE_NPM_REGISTRY_ENV_V1 = \"AGENT_FORGE_NPM_REGISTRY\";\n/** Environment variable carrying the npm registry bearer token. */\nexport const AGENT_FORGE_NPM_TOKEN_ENV_V1 = \"AGENT_FORGE_NPM_TOKEN\";\n/** Environment variable overriding the GitHub release API origin (bare http(s) origin). */\nexport const AGENT_FORGE_GITHUB_API_ENV_V1 = \"AGENT_FORGE_GITHUB_API\";\n/** Environment variable overriding the Gitee release API origin (bare http(s) origin, includes the /api/v5 path). */\nexport const AGENT_FORGE_GITEE_API_ENV_V1 = \"AGENT_FORGE_GITEE_API\";\n/** Environment variable carrying the optional GitHub API token. */\nexport const GITHUB_TOKEN_ENV_V1 = \"GITHUB_TOKEN\";\n/** Environment variable carrying the optional Gitee API token. */\nexport const GITEE_TOKEN_ENV_V1 = \"GITEE_TOKEN\";\n\nexport interface NodePluginAcquisitionHostV1 {\n\treadonly version: typeof NODE_PLUGIN_ACQUISITION_HOST_VERSION_V1;\n\t/** Parse and acquire one ref into a package + artifact pair. */\n\treadonly resolvePackage: (input: {\n\t\treadonly ref: string;\n\t\treadonly signal?: AbortSignal;\n\t}) => Promise<PluginAcquisitionPackageV1>;\n\t/** Private installer-facing reader; mirrors the HTTP distribution host boundary. */\n\treadonly openArtifact: (input: {\n\t\treadonly artifact: PluginDistributionArtifactV1;\n\t\treadonly signal?: AbortSignal;\n\t}) => AsyncIterable<Uint8Array>;\n\treadonly releaseArtifact: (input: { readonly artifact: { readonly artifactRef: string } }) => Promise<void>;\n\t/** Whether this host owns the artifact reference (used to compose artifact readers). */\n\treadonly ownsArtifact: (input: { readonly artifactRef: string }) => boolean;\n\treadonly close: () => Promise<void>;\n}\n\nexport interface NodePluginAcquisitionHostOptionsV1 {\n\t/** Real fetch or a deterministic test replacement. */\n\treadonly fetch?: typeof globalThis.fetch;\n\t/** Bare http(s) npm registry origin; defaults to the environment variable, then the npm public registry. */\n\treadonly npmRegistry?: string;\n\t/** npm registry bearer token; defaults to the environment variable. */\n\treadonly npmToken?: string;\n\t/** Bare http(s) GitHub release API origin; defaults to the environment variable, then api.github.com. */\n\treadonly githubApiOrigin?: string;\n\t/** Bare http(s) Gitee release API origin; defaults to the environment variable, then gitee.com/api/v5. */\n\treadonly giteeApiOrigin?: string;\n\t/** GitHub API token sent as a bearer header; defaults to the environment variable. */\n\treadonly githubToken?: string;\n\t/** Gitee API token sent as an access_token query parameter; defaults to the environment variable. */\n\treadonly giteeToken?: string;\n\treadonly requestTimeoutMs?: number;\n\treadonly maxResponseBytes?: number;\n\treadonly maxTarballBytes?: number;\n\treadonly limits?: NodeZipPackageLimitsV1;\n\treadonly userAgent?: string;\n}\n\ninterface AcquiredBytesV1 {\n\treadonly bytes: Uint8Array;\n\treadonly mediaType: \"application/zip\" | \"application/gzip\";\n\treadonly digest: { readonly algorithm: \"sha256\" | \"sha512\"; readonly hex: string };\n\treadonly source: string;\n}\n\ninterface AcquiredArtifactRecordV1 {\n\treadonly bytes: Uint8Array;\n\treadonly artifact: PluginDistributionArtifactV1;\n}\n\nconst LOCAL_PROBE_V1: PluginAcquisitionLocalProbeV1 = {\n\t// The parser contract is synchronous; one lstat per candidate ref keeps\n\t// this bounded. Symlinks classify as \"other\" so they never install as local.\n\tstatLocalRef: (path) => {\n\t\tconst stats = lstatSync(path, { throwIfNoEntry: false });\n\t\tif (stats === undefined) return \"missing\";\n\t\tif (stats.isSymbolicLink()) return \"other\";\n\t\tif (stats.isDirectory()) return \"directory\";\n\t\tif (stats.isFile()) return \"file\";\n\t\treturn \"other\";\n\t},\n};\n\nfunction mapInstallError(error: unknown): PluginAcquisitionErrorV1 {\n\tif (error instanceof PluginAcquisitionErrorV1) return error;\n\tif (error instanceof NodePackageInstallErrorV1) {\n\t\tif (error.code === \"cancelled\") return new PluginAcquisitionErrorV1(\"cancelled\");\n\t\tif (error.code === \"archive_budget_exceeded\") return new PluginAcquisitionErrorV1(\"budget_exceeded\");\n\t\tif (error.code === \"unsupported_media_type\") return new PluginAcquisitionErrorV1(\"unsupported_media_type\");\n\t\treturn new PluginAcquisitionErrorV1(\"package_invalid\");\n\t}\n\treturn new PluginAcquisitionErrorV1(\"download_failed\");\n}\n\nfunction mapNpmError(error: unknown): PluginAcquisitionErrorV1 {\n\tif (error instanceof PluginAcquisitionErrorV1) return error;\n\tif (error instanceof NodeNpmRegistrySourceErrorV1) {\n\t\tif (error.code === \"package_not_found\") return new PluginAcquisitionErrorV1(\"package_not_found\");\n\t\tif (error.code === \"version_not_found\") return new PluginAcquisitionErrorV1(\"version_not_found\");\n\t\tif (error.code === \"cancelled\") return new PluginAcquisitionErrorV1(\"cancelled\");\n\t\tif (error.code === \"rate_limited\")\n\t\t\treturn new PluginAcquisitionErrorV1(\n\t\t\t\t\"rate_limited\",\n\t\t\t\terror.retryAfterSeconds === undefined ? undefined : `retry after ${error.retryAfterSeconds}s`,\n\t\t\t);\n\t\tif (error.code === \"response_too_large\") return new PluginAcquisitionErrorV1(\"budget_exceeded\");\n\t\tif (error.code === \"request_timed_out\")\n\t\t\treturn new PluginAcquisitionErrorV1(\"download_failed\", \"request timed out\");\n\t\tif (error.code === \"invalid_response\" || error.code === \"integrity_unsupported\")\n\t\t\treturn new PluginAcquisitionErrorV1(\"package_invalid\");\n\t\treturn new PluginAcquisitionErrorV1(\"download_failed\");\n\t}\n\treturn mapInstallError(error);\n}\n\nfunction mapUrlError(error: unknown): PluginAcquisitionErrorV1 {\n\tif (error instanceof PluginAcquisitionErrorV1) return error;\n\tif (error instanceof NodeUrlPackageSourceErrorV1) {\n\t\tif (error.code === \"digest_mismatch\") return new PluginAcquisitionErrorV1(\"digest_mismatch\");\n\t\tif (error.code === \"cancelled\") return new PluginAcquisitionErrorV1(\"cancelled\");\n\t\tif (error.code === \"invalid_url\" || error.code === \"invalid_configuration\")\n\t\t\treturn new PluginAcquisitionErrorV1(\"invalid_ref\");\n\t\tif (error.code === \"response_too_large\") return new PluginAcquisitionErrorV1(\"budget_exceeded\");\n\t\treturn new PluginAcquisitionErrorV1(\"download_failed\");\n\t}\n\treturn mapInstallError(error);\n}\n\nfunction mapReleaseError(error: unknown): PluginAcquisitionErrorV1 {\n\tif (error instanceof PluginAcquisitionErrorV1) return error;\n\tif (error instanceof NodeReleasePackageSourceErrorV1) {\n\t\tif (error.code === \"cancelled\") return new PluginAcquisitionErrorV1(\"cancelled\");\n\t\tif (error.code === \"invalid_configuration\") return new PluginAcquisitionErrorV1(\"invalid_ref\");\n\t\tif (error.code === \"response_too_large\") return new PluginAcquisitionErrorV1(\"budget_exceeded\");\n\t\tif (error.code === \"invalid_response\") return new PluginAcquisitionErrorV1(\"package_invalid\");\n\t\tif (error.code === \"rate_limited\")\n\t\t\treturn new PluginAcquisitionErrorV1(\n\t\t\t\t\"rate_limited\",\n\t\t\t\terror.resetEpochSeconds === undefined\n\t\t\t\t\t? undefined\n\t\t\t\t\t: `rate limit resets at ${new Date(error.resetEpochSeconds * 1000).toISOString()}`,\n\t\t\t);\n\t\tif (\n\t\t\terror.code === \"release_not_found\" ||\n\t\t\terror.code === \"release_asset_not_found\" ||\n\t\t\terror.code === \"release_asset_ambiguous\"\n\t\t)\n\t\t\treturn new PluginAcquisitionErrorV1(error.code, error.message);\n\t\treturn new PluginAcquisitionErrorV1(\"download_failed\");\n\t}\n\t// Asset downloads ride the URL package source; digest and budget errors pass through unchanged.\n\treturn mapUrlError(error);\n}\n\nfunction shaHex(algorithm: \"sha256\" | \"sha512\", bytes: Uint8Array): string {\n\treturn createHash(algorithm).update(bytes).digest(\"hex\");\n}\n\n/** Abort probe as a function so later re-checks are not flow-narrowed away after awaits. */\nfunction signalAborted(signal: AbortSignal | undefined): boolean {\n\treturn signal?.aborted === true;\n}\n\n/** Discover the `agent-forge.json` identity in already-bounded package entries. */\nexport function pluginAcquisitionManifestFromEntriesV1(entries: readonly NodeZipPackageEntryV1[]): {\n\treadonly manifest: PluginManifestV1;\n\treadonly manifestDigest: string;\n} {\n\tconst manifestEntry = entries.find((entry) => entry.name === ECOSYSTEM_MANIFEST_FILE_V1 && !entry.directory);\n\tif (manifestEntry === undefined || manifestEntry.bytes.byteLength > MAX_PACKAGE_MANIFEST_BYTES_V1)\n\t\tthrow new PluginAcquisitionErrorV1(\"package_invalid\");\n\tlet value: unknown;\n\ttry {\n\t\tvalue = JSON.parse(new TextDecoder(\"utf-8\", { fatal: true }).decode(manifestEntry.bytes));\n\t} catch {\n\t\tthrow new PluginAcquisitionErrorV1(\"package_invalid\");\n\t}\n\tif (typeof value !== \"object\" || value === null || Array.isArray(value))\n\t\tthrow new PluginAcquisitionErrorV1(\"package_invalid\");\n\tconst record = value as Record<string, unknown>;\n\tconst manifestKeys = new Set([\n\t\t\"id\",\n\t\t\"pluginVersion\",\n\t\t\"apiVersion\",\n\t\t\"minHostVersion\",\n\t\t\"maxHostVersion\",\n\t\t\"capabilityRefs\",\n\t\t\"requires\",\n\t\t\"platform\",\n\t\t\"testOnly\",\n\t]);\n\tif (\n\t\trecord.packageFormatVersion !== 1 ||\n\t\tObject.keys(record).some((key) => key !== \"packageFormatVersion\" && !manifestKeys.has(key))\n\t)\n\t\tthrow new PluginAcquisitionErrorV1(\"package_invalid\");\n\tconst id = record.id;\n\tconst pluginVersion = record.pluginVersion;\n\tconst apiVersion = record.apiVersion;\n\tif (\n\t\ttypeof id !== \"string\" ||\n\t\tid.trim().length === 0 ||\n\t\tid.length > 256 ||\n\t\ttypeof pluginVersion !== \"string\" ||\n\t\tpluginVersion.trim().length === 0 ||\n\t\tpluginVersion.length > 256 ||\n\t\ttypeof apiVersion !== \"string\" ||\n\t\tapiVersion.trim().length === 0 ||\n\t\tapiVersion.length > 256\n\t)\n\t\tthrow new PluginAcquisitionErrorV1(\"package_invalid\");\n\tif (record.minHostVersion === undefined && record.maxHostVersion === undefined)\n\t\tthrow new PluginAcquisitionErrorV1(\"package_invalid\");\n\tconst manifest: PluginManifestV1 = Object.freeze({\n\t\tid,\n\t\tpluginVersion,\n\t\tapiVersion,\n\t\t...(record.minHostVersion === undefined ? {} : { minHostVersion: record.minHostVersion as string }),\n\t\t...(record.maxHostVersion === undefined ? {} : { maxHostVersion: record.maxHostVersion as string }),\n\t\t...(record.capabilityRefs === undefined\n\t\t\t? {}\n\t\t\t: { capabilityRefs: record.capabilityRefs as PluginManifestV1[\"capabilityRefs\"] }),\n\t\t...(record.requires === undefined ? {} : { requires: record.requires as PluginManifestV1[\"requires\"] }),\n\t\t...(record.platform === undefined ? {} : { platform: record.platform as PluginManifestV1[\"platform\"] }),\n\t\t...(record.testOnly === undefined ? {} : { testOnly: record.testOnly as boolean }),\n\t});\n\treturn { manifest, manifestDigest: pluginManifestDigestV1(manifest) };\n}\n\n/**\n * Create the Node acquisition host. All sources share the bounded unpackers,\n * the manifest identity discovery, and the artifact reader contract used by\n * the existing install host. Nothing is downloaded until `resolvePackage`.\n */\nexport function createNodePluginAcquisitionHostV1(\n\toptions: NodePluginAcquisitionHostOptionsV1 = {},\n): NodePluginAcquisitionHostV1 {\n\tconst limits = options.limits ?? {};\n\tconst npmRegistryOption = options.npmRegistry ?? process.env[AGENT_FORGE_NPM_REGISTRY_ENV_V1]?.trim();\n\tconst npmTokenOption = options.npmToken ?? process.env[AGENT_FORGE_NPM_TOKEN_ENV_V1]?.trim();\n\tconst githubApiOriginOption = options.githubApiOrigin ?? process.env[AGENT_FORGE_GITHUB_API_ENV_V1]?.trim();\n\tconst giteeApiOriginOption = options.giteeApiOrigin ?? process.env[AGENT_FORGE_GITEE_API_ENV_V1]?.trim();\n\tconst githubTokenOption = options.githubToken ?? process.env[GITHUB_TOKEN_ENV_V1]?.trim();\n\tconst giteeTokenOption = options.giteeToken ?? process.env[GITEE_TOKEN_ENV_V1]?.trim();\n\tconst npmSource: NodeNpmRegistrySourceV1 = createNodeNpmRegistrySourceV1({\n\t\t...(npmRegistryOption === undefined || npmRegistryOption === \"\" ? {} : { registry: npmRegistryOption }),\n\t\t...(npmTokenOption === undefined || npmTokenOption === \"\" ? {} : { token: npmTokenOption }),\n\t\t...(options.fetch === undefined ? {} : { fetch: options.fetch }),\n\t\t...(options.requestTimeoutMs === undefined ? {} : { requestTimeoutMs: options.requestTimeoutMs }),\n\t\t...(options.maxResponseBytes === undefined ? {} : { maxResponseBytes: options.maxResponseBytes }),\n\t\t...(options.maxTarballBytes === undefined ? {} : { maxTarballBytes: options.maxTarballBytes }),\n\t\t...(options.userAgent === undefined ? {} : { userAgent: options.userAgent }),\n\t});\n\tconst releaseSource: NodeReleasePackageSourceV1 = createNodeReleasePackageSourceV1({\n\t\t...(githubApiOriginOption === undefined || githubApiOriginOption === \"\"\n\t\t\t? {}\n\t\t\t: { githubApiOrigin: githubApiOriginOption }),\n\t\t...(giteeApiOriginOption === undefined || giteeApiOriginOption === \"\"\n\t\t\t? {}\n\t\t\t: { giteeApiOrigin: giteeApiOriginOption }),\n\t\t...(githubTokenOption === undefined || githubTokenOption === \"\" ? {} : { githubToken: githubTokenOption }),\n\t\t...(giteeTokenOption === undefined || giteeTokenOption === \"\" ? {} : { giteeToken: giteeTokenOption }),\n\t\t...(options.fetch === undefined ? {} : { fetch: options.fetch }),\n\t\t...(options.requestTimeoutMs === undefined ? {} : { requestTimeoutMs: options.requestTimeoutMs }),\n\t\t...(options.maxResponseBytes === undefined ? {} : { maxResponseBytes: options.maxResponseBytes }),\n\t\t...(options.maxTarballBytes === undefined ? {} : { maxAssetBytes: options.maxTarballBytes }),\n\t\t...(options.userAgent === undefined ? {} : { userAgent: options.userAgent }),\n\t});\n\tconst artifacts = new Map<string, AcquiredArtifactRecordV1>();\n\tlet closed = false;\n\n\tconst acquireBytes = async (\n\t\tref: PluginAcquisitionRefV1,\n\t\tsignal: AbortSignal | undefined,\n\t): Promise<AcquiredBytesV1> => {\n\t\tif (ref.kind === \"github\" || ref.kind === \"gitee\") {\n\t\t\ttry {\n\t\t\t\tconst download = await releaseSource.downloadReleaseAsset({\n\t\t\t\t\tkind: ref.kind,\n\t\t\t\t\towner: ref.owner,\n\t\t\t\t\trepo: ref.repo,\n\t\t\t\t\t...(ref.tag === undefined ? {} : { tag: ref.tag }),\n\t\t\t\t\t...(ref.expectedDigestHex === undefined ? {} : { expectedDigestHex: ref.expectedDigestHex }),\n\t\t\t\t\tsignal,\n\t\t\t\t});\n\t\t\t\treturn {\n\t\t\t\t\tbytes: download.bytes,\n\t\t\t\t\tmediaType: download.mediaType,\n\t\t\t\t\tdigest: { algorithm: \"sha256\", hex: download.sha256Hex },\n\t\t\t\t\tsource: download.sourceLabel,\n\t\t\t\t};\n\t\t\t} catch (error) {\n\t\t\t\tthrow mapReleaseError(error);\n\t\t\t}\n\t\t}\n\t\tif (ref.kind === \"npm\") {\n\t\t\ttry {\n\t\t\t\tconst resolved = await npmSource.resolveNpmPackage({\n\t\t\t\t\tname: ref.name,\n\t\t\t\t\t...(ref.range === undefined ? {} : { range: ref.range }),\n\t\t\t\t\tsignal,\n\t\t\t\t});\n\t\t\t\tconst bytes = await npmSource.fetchTarball({ url: resolved.tarballUrl, signal });\n\t\t\t\tconst hex = shaHex(resolved.integrity.algorithm, bytes);\n\t\t\t\tif (hex !== resolved.integrity.hex) throw new PluginAcquisitionErrorV1(\"digest_mismatch\");\n\t\t\t\treturn {\n\t\t\t\t\tbytes,\n\t\t\t\t\tmediaType: \"application/gzip\",\n\t\t\t\t\tdigest: resolved.integrity,\n\t\t\t\t\tsource: `npm:${new URL(resolved.tarballUrl).host}`,\n\t\t\t\t};\n\t\t\t} catch (error) {\n\t\t\t\tthrow mapNpmError(error);\n\t\t\t}\n\t\t}\n\t\tif (ref.kind === \"url\") {\n\t\t\ttry {\n\t\t\t\tconst download = await downloadNodeUrlPackageV1(\n\t\t\t\t\t{\n\t\t\t\t\t\t...(options.fetch === undefined ? {} : { fetch: options.fetch }),\n\t\t\t\t\t\t...(options.requestTimeoutMs === undefined ? {} : { requestTimeoutMs: options.requestTimeoutMs }),\n\t\t\t\t\t\t...(options.maxTarballBytes === undefined ? {} : { maxPackageBytes: options.maxTarballBytes }),\n\t\t\t\t\t\t...(options.userAgent === undefined ? {} : { userAgent: options.userAgent }),\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\turl: ref.url,\n\t\t\t\t\t\t...(ref.expectedDigestHex === undefined ? {} : { expectedDigestHex: ref.expectedDigestHex }),\n\t\t\t\t\t\tsignal,\n\t\t\t\t\t},\n\t\t\t\t);\n\t\t\t\treturn {\n\t\t\t\t\tbytes: download.bytes,\n\t\t\t\t\tmediaType: download.mediaType,\n\t\t\t\t\tdigest: { algorithm: \"sha256\", hex: download.digestHex },\n\t\t\t\t\tsource: `url:${new URL(ref.url).host}`,\n\t\t\t\t};\n\t\t\t} catch (error) {\n\t\t\t\tthrow mapUrlError(error);\n\t\t\t}\n\t\t}\n\t\tif (ref.kind === \"local-file\") {\n\t\t\ttry {\n\t\t\t\tconst bytes = await readLocalPackageFileV1(ref.path, limits, signal);\n\t\t\t\tconst fileName = ref.path.split(/[\\\\/]/u).pop();\n\t\t\t\tconst mediaType = detectPluginPackageMediaTypeV1(\n\t\t\t\t\tbytes,\n\t\t\t\t\tfileName === undefined || fileName.length === 0 ? undefined : fileName,\n\t\t\t\t);\n\t\t\t\treturn {\n\t\t\t\t\tbytes,\n\t\t\t\t\tmediaType,\n\t\t\t\t\tdigest: { algorithm: \"sha256\", hex: shaHex(\"sha256\", bytes) },\n\t\t\t\t\tsource: \"local:file\",\n\t\t\t\t};\n\t\t\t} catch (error) {\n\t\t\t\tthrow mapInstallError(error);\n\t\t\t}\n\t\t}\n\t\tif (ref.kind === \"local-path\") {\n\t\t\ttry {\n\t\t\t\tconst entries = await collectLocalDirectoryPackageEntriesV1(ref.path, limits, signal);\n\t\t\t\tconst bytes = buildNodeTarGzBytesV1(\n\t\t\t\t\tentries.map((entry) => ({ name: entry.name, directory: entry.directory, bytes: entry.bytes })),\n\t\t\t\t);\n\t\t\t\treturn {\n\t\t\t\t\tbytes,\n\t\t\t\t\tmediaType: \"application/gzip\",\n\t\t\t\t\tdigest: { algorithm: \"sha256\", hex: shaHex(\"sha256\", bytes) },\n\t\t\t\t\tsource: \"local:dir\",\n\t\t\t\t};\n\t\t\t} catch (error) {\n\t\t\t\tthrow mapInstallError(error);\n\t\t\t}\n\t\t}\n\t\tthrow new PluginAcquisitionErrorV1(\"invalid_ref\");\n\t};\n\n\tconst releaseArtifact = async (input: { readonly artifact: { readonly artifactRef: string } }): Promise<void> => {\n\t\tif (!artifacts.delete(input.artifact.artifactRef)) throw new NodePackageInstallErrorV1(\"invalid_artifact\");\n\t};\n\n\tconst resolvePackage = async (input: {\n\t\treadonly ref: string;\n\t\treadonly signal?: AbortSignal;\n\t}): Promise<PluginAcquisitionPackageV1> => {\n\t\tif (closed || signalAborted(input.signal)) throw new PluginAcquisitionErrorV1(\"cancelled\");\n\t\tlet ref: PluginAcquisitionRefV1;\n\t\ttry {\n\t\t\tref = parsePluginAcquisitionRefV1(input.ref, LOCAL_PROBE_V1);\n\t\t} catch (error) {\n\t\t\tif (error instanceof PluginAcquisitionErrorV1) throw error;\n\t\t\tthrow new PluginAcquisitionErrorV1(\"invalid_ref\");\n\t\t}\n\t\tconst acquired = await acquireBytes(ref, input.signal);\n\t\tif (signalAborted(input.signal)) throw new PluginAcquisitionErrorV1(\"cancelled\");\n\t\tlet entries: readonly NodeZipPackageEntryV1[];\n\t\ttry {\n\t\t\tentries =\n\t\t\t\tacquired.mediaType === \"application/gzip\"\n\t\t\t\t\t? await parseNodeTarGzPackageV1(acquired.bytes, limits)\n\t\t\t\t\t: parseNodeZipPackageV1(acquired.bytes, limits);\n\t\t} catch (error) {\n\t\t\tthrow mapInstallError(error);\n\t\t}\n\t\tconst identity = pluginAcquisitionManifestFromEntriesV1(entries);\n\t\tif (closed) throw new PluginAcquisitionErrorV1(\"cancelled\");\n\t\tconst artifactRef = `plugin-acquisition://node/${randomUUID()}`;\n\t\tconst artifact: PluginDistributionArtifactV1 = Object.freeze({\n\t\t\tversion: 1,\n\t\t\tsource: acquired.source,\n\t\t\tpluginId: identity.manifest.id,\n\t\t\tpluginVersion: identity.manifest.pluginVersion,\n\t\t\tmanifestDigest: identity.manifestDigest,\n\t\t\tartifactDigest:\n\t\t\t\tacquired.digest.algorithm === \"sha512\" ? `sha512:${acquired.digest.hex}` : `sha256:${acquired.digest.hex}`,\n\t\t\texpiresAt: ACQUISITION_ARTIFACT_EXPIRES_AT_V1,\n\t\t\tsizeBytes: acquired.bytes.byteLength,\n\t\t\tmediaType: acquired.mediaType,\n\t\t\tartifactRef,\n\t\t});\n\t\tartifacts.set(artifactRef, { bytes: acquired.bytes, artifact });\n\t\treturn Object.freeze({\n\t\t\tmanifest: identity.manifest,\n\t\t\tmanifestDigest: identity.manifestDigest,\n\t\t\tsource: acquired.source,\n\t\t\tartifact,\n\t\t\trelease: async () => {\n\t\t\t\ttry {\n\t\t\t\t\tawait releaseArtifact({ artifact: { artifactRef } });\n\t\t\t\t\treturn true;\n\t\t\t\t} catch {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t},\n\t\t});\n\t};\n\n\treturn {\n\t\tversion: NODE_PLUGIN_ACQUISITION_HOST_VERSION_V1,\n\t\tresolvePackage,\n\t\topenArtifact(input) {\n\t\t\treturn (async function* (): AsyncGenerator<Uint8Array> {\n\t\t\t\tconst record = artifacts.get(input.artifact.artifactRef);\n\t\t\t\tif (record === undefined) throw new NodePackageInstallErrorV1(\"invalid_artifact\");\n\t\t\t\tif (\n\t\t\t\t\trecord.artifact.pluginId !== input.artifact.pluginId ||\n\t\t\t\t\trecord.artifact.pluginVersion !== input.artifact.pluginVersion ||\n\t\t\t\t\trecord.artifact.manifestDigest !== input.artifact.manifestDigest ||\n\t\t\t\t\trecord.artifact.artifactDigest !== input.artifact.artifactDigest ||\n\t\t\t\t\trecord.artifact.sizeBytes !== input.artifact.sizeBytes\n\t\t\t\t)\n\t\t\t\t\tthrow new NodePackageInstallErrorV1(\"invalid_artifact\");\n\t\t\t\tfor (let offset = 0; offset < record.bytes.byteLength; offset += ARTIFACT_CHUNK_BYTES_V1) {\n\t\t\t\t\tif (input.signal?.aborted === true) throw new NodePackageInstallErrorV1(\"cancelled\");\n\t\t\t\t\tyield new Uint8Array(\n\t\t\t\t\t\trecord.bytes.subarray(offset, Math.min(offset + ARTIFACT_CHUNK_BYTES_V1, record.bytes.byteLength)),\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t})();\n\t\t},\n\t\treleaseArtifact,\n\t\townsArtifact: (input) => artifacts.has(input.artifactRef),\n\t\tasync close() {\n\t\t\tclosed = true;\n\t\t\tartifacts.clear();\n\t\t},\n\t};\n}\n"]}
|
|
@@ -77,7 +77,11 @@ export declare const BUILTIN_SUITE_TOOLS: readonly string[];
|
|
|
77
77
|
* unconfigured default answers `/share` with the explicit configuration
|
|
78
78
|
* prompt — never an implicit Radius/Gist fallback. `builtin.workflow` joins
|
|
79
79
|
* at goal/plan/todo-set parity (D-077, 2026-10-02: factory default install
|
|
80
|
-
* plus this suite declaration, plugin form unchanged).
|
|
80
|
+
* plus this suite declaration, plugin form unchanged). `builtin.coding-tools`
|
|
81
|
+
* joins with the D-082 batch-1 tool split (2026-10-03): the default coding
|
|
82
|
+
* tools assemble from the `plugins/coding-tools` package through the bundled
|
|
83
|
+
* distribution channel (插件独立分发与启动装配设计 §4.9), not the install
|
|
84
|
+
* store.
|
|
81
85
|
*/
|
|
82
86
|
export declare const BUILTIN_SUITE_CAPABILITIES: readonly string[];
|
|
83
87
|
export type SuiteMemoryStrategy = "assistant" | "code";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builtin-suites.d.ts","sourceRoot":"","sources":["../../src/profiles/builtin-suites.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,eAAO,MAAM,oBAAoB,IAAI,CAAC;AAEtC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,eAAO,MAAM,wBAAwB,IAAI,CAAC;AAE1C;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,WAAW,CAAC;AAEzC,yFAAoF;AACpF,eAAO,MAAM,mBAAmB,KAAK,CAAC;AAEtC,2FAAqF;AACrF,eAAO,MAAM,mBAAmB,EAAE,SAAS,MAAM,EAShD,CAAC;AAEF;;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["/**\n * Builtin suite (方案) declarations and suite.json (schemaVersion 1)\n * serialization, parsing, and validation — 方案系统设计.md v2 §5/§6/§9, M1a.\n *\n * Suites are pure data plus default policy: both builtin suites share the same\n * unrestricted tool surface and differ only in orientation and memory strategy\n * (the orientation persona text is injected into the system prompt, M2).\n * Nothing here touches the packages/agent kernel; association resolution is\n * declaration-only until M1b.\n */\n\nexport const SUITE_SCHEMA_VERSION = 1;\n\n/**\n * Factory contents revision (M4): the revision of the factory builtin\n * declarations, independent of SUITE_SCHEMA_VERSION. Bump it (and update both\n * builtin declarations' `factoryRevision`) whenever the factory contents\n * change; the registry upgrade proposal then offers `--suite-reset` for\n * workspaces still on an older revision. Suite schema evolution keeps using\n * SUITE_SCHEMA_VERSION.\n *\n * Revision 2 (统一修复轮集成收口, 2026-09-08): assistant and coding now share\n * the same active 8-tool surface in full-control — the sdk `suiteToolOverride`\n * DEFAULT_SUITE_ID exemption was removed (方案设计 §5 + user decision). Existing\n * workspaces provisioned at revision 1 receive the upgrade-proposal diagnostic\n * and adopt via `--suite-reset`.\n *\n * Revision 3 (2026-09-18): `builtin.session-share` joins both builtin suites\n * (开发计划 §216: session-share productized from the example plugin into a\n * first-party default-distributed capability) once the agent-dir config\n * channel for embedded capabilities landed\n * (`<agentDir>/capabilities/<short-id>.json`, see capabilities/builtin.ts).\n * Existing workspaces provisioned at revision 2 receive the upgrade-proposal\n * diagnostic and adopt via `--suite-reset`.\n *\n * Revision 4 (2026-09-18): `builtin.subagent-delegate` joins both builtin\n * suites — the first-party subagent delegation tool (`subagent_run`) now ships\n * by default in shared mode (zero extra processes; pooled runner processes stay\n * opt-in through the capability config channel). Existing workspaces\n * provisioned at revision 3 receive the upgrade-proposal diagnostic and adopt\n * via `--suite-reset`.\n *\n * Revision 5 (2026-09-20): subagent role profiles land on disk only\n * (`<agentDir>/roles/<id>.json` — the factory seeds explore/reviewer and never\n * overwrites user edits) and both builtin suites associate them by default via\n * the new `suite.associations.roles` field, with skill/MCP-isomorphic\n * visibility: unassociated roles stay invisible, associated-but-missing files\n * surface as dangling diagnostics. Existing workspaces provisioned at\n * revision 4 receive the upgrade-proposal diagnostic and adopt via\n * `--suite-reset`.\n *\n * Revision 6 (D-077, 2026-10-02): `builtin.workflow` joins both builtin suites\n * — the workflow orchestration plugin enters the factory bootstrap manifest\n * (ninth package) and the suite capability declaration at goal/plan/todo-set\n * parity, keeping its plugin form. Existing workspaces provisioned at revision\n * 5 receive the upgrade-proposal diagnostic and adopt via `--suite-reset`.\n */\nexport const FACTORY_CONTENTS_VERSION = 6;\n\n/**\n * Factory default suite used when no suite is configured anywhere (设计 §9).\n * 2026-10-02 user ruling: the product is a coding agent, so the factory\n * default flipped from \"assistant\" to \"coding\"; assistant stays as the\n * explicit-switch fallback suite.\n */\nexport const DEFAULT_SUITE_ID = \"coding\";\n\n/** Suite ids become directory names: lowercase letters, digits, hyphens (设计 §9). */\nexport const SUITE_ID_MAX_LENGTH = 64;\n\n/** The single unrestricted tool surface shared by both builtin suites (设计 §5/§6). */\nexport const BUILTIN_SUITE_TOOLS: readonly string[] = [\n\t\"read\",\n\t\"write\",\n\t\"edit\",\n\t\"bash\",\n\t\"ls\",\n\t\"find\",\n\t\"grep\",\n\t\"powershell\",\n];\n\n/**\n * Builtin capability plugins associated with both suites. Declaration-only\n * data in M1a; the actual plugin wiring is delivered in M3. `builtin.memory`\n * joins in the 统一修复轮 A 路 (方案系统设计 §6.1: both suites share the same\n * memory tool surface; the strategy difference lives in the suiteId domain\n * isolation and the assistant preference card). `builtin.session-share` joins\n * in the session-share productization slice (开发计划 §216); its\n * target/gateway/viewerUrl are configured through the agent-dir config\n * channel (`<agentDir>/capabilities/builtin.session-share.json`), and the\n * unconfigured default answers `/share` with the explicit configuration\n * prompt — never an implicit Radius/Gist fallback. `builtin.workflow` joins\n * at goal/plan/todo-set parity (D-077, 2026-10-02: factory default install\n * plus this suite declaration, plugin form unchanged).\n */\nexport const BUILTIN_SUITE_CAPABILITIES: readonly string[] = [\n\t\"builtin.goal\",\n\t\"builtin.plan\",\n\t\"builtin.todo-set\",\n\t\"builtin.workflow\",\n\t\"builtin.memory\",\n\t\"builtin.session-share\",\n\t\"builtin.subagent-delegate\",\n];\n\nexport type SuiteMemoryStrategy = \"assistant\" | \"code\";\nexport type SuiteOrientation = \"assistant\" | \"coding\" | \"custom\";\n\n/**\n * Orientation persona texts injected into the system prompt (设计 §6.2, M2).\n * The strings are verbatim from the design spec: the assistant persona is the\n * companion style, the coding persona is the rigor-first style. Both are\n * session-nature declarations, so they ride every system prompt branch\n * (default and customPrompt). The custom orientation is not in this table: its\n * persona text comes from the suite workspace persona.md (设计 §6.3, resolved\n * by suite-loader).\n */\nexport const ORIENTATION_PROMPTS: Record<\"assistant\" | \"coding\", string> = {\n\tassistant: `You are the user's thoughtful companion — warm, patient, and helpful.\n- Understand the intent behind the question, including the unspoken parts; when something that matters is ambiguous, ask one short clarifying question instead of assuming.\n- Pay attention to detail: notice what the user might have missed and gently point it out.\n- Be proactive and divergent: after answering, offer next steps, related ideas, or creative alternatives — without being pushy.\n- Adapt tone to the user; stay natural and flexible, never robotic or formulaic.\n- When you can help by doing, act through tools autonomously (minimal interruption).\n- Structure longer answers clearly: short paragraphs, lists where they help, and a concrete \"what you can do next\" at the end.`,\n\tcoding: `You are an autonomous software engineering agent with a rigor-first mindset.\n- Never guess. Ground every claim in code you have read, commands you have run, or documented evidence; cite file paths and line numbers. If the evidence is insufficient, investigate, and report what is unverified — or \"unknown\" — instead of a plausible invention.\n- First principles: trace problems to the earliest reasonable root cause and fix that; do not patch symptoms.\n- No over-engineering: add no abstraction, options, or defensive handling for imagined future needs; generalise only when a second concrete case demands it.\n- Tests first: pin expected behavior with a failing or updated test before or alongside the fix, then run the smallest sufficient relevant checks; the work is not done until they pass.\n- Reproducible: prefer deterministic tests and mocks over ad-hoc verification, and report the exact commands and results so others can re-run them.\n- Docs as code: repository documentation is part of the change — keep design docs, READMEs, and changelogs consistent with the behavior they describe.\n- Self-review before finishing: re-check your changes for correctness, edge cases, regressions, and missing tests; prefer a second review pass over shipping the first draft.\n- Cautious: weigh side effects, compatibility, and failure modes; when in doubt, take the safer path.`,\n};\n\nexport interface SuiteAssociations {\n\treadonly skills: readonly string[];\n\treadonly mcp: readonly string[];\n\treadonly plugins: readonly string[];\n\t/**\n\t * 子代理角色关联(D-044 角色机制):关联的是 `<agentDir>/roles/<id>.json` 里的角色 id。\n\t * 角色定义只在磁盘上(工厂仅做种子落盘),方案只决定哪些角色对主代理可见——与\n\t * skill/MCP/插件同构,第一方与第三方角色没有区别。\n\t */\n\treadonly roles: readonly string[];\n}\n\nexport interface SuiteClonedFrom {\n\treadonly id: string;\n\treadonly digest: string;\n\treadonly at: number;\n}\n\n/** The serializable suite definition persisted as suite.json (设计 §5). */\nexport interface SuiteDefinition {\n\treadonly schemaVersion: number;\n\treadonly id: string;\n\treadonly name: string;\n\treadonly builtin: boolean;\n\treadonly tools: readonly string[];\n\treadonly capabilities: readonly string[];\n\treadonly associations: SuiteAssociations;\n\treadonly inheritSystemAgentsMd: boolean;\n\treadonly memory: SuiteMemoryStrategy;\n\treadonly orientation: SuiteOrientation;\n\treadonly model: string | null;\n\treadonly thinking: string | null;\n\treadonly clonedFrom: SuiteClonedFrom | null;\n\t/**\n\t * Factory contents revision this declaration was written at (M4). Builtin\n\t * declarations carry it; on-disk builtin suite.json may omit it (pre-M4\n\t * files parse as FACTORY_CONTENTS_VERSION). User suites are outside factory\n\t * upgrade governance: the key stays optional and may be absent.\n\t */\n\treadonly factoryRevision?: number;\n}\n\nconst EMPTY_ASSOCIATIONS: SuiteAssociations = { skills: [], mcp: [], plugins: [], roles: [] };\n\n/**\n * 默认方案关联的子代理角色(开箱即用):这两个 id 对应工厂种子落盘的两个普通角色文件\n * (`<agentDir>/roles/{explore,reviewer}.json`,用户可改可删)。工厂不在运行期回退到任何\n * 编译内的角色定义;删掉文件只会让该关联成为 dangling 诊断。\n */\nexport const DEFAULT_ROLE_ASSOCIATIONS: readonly string[] = [\"explore\", \"reviewer\"];\n\nconst assistantSuite: SuiteDefinition = {\n\tschemaVersion: SUITE_SCHEMA_VERSION,\n\tid: \"assistant\",\n\tname: \"Assistant\",\n\tbuiltin: true,\n\ttools: BUILTIN_SUITE_TOOLS,\n\tcapabilities: BUILTIN_SUITE_CAPABILITIES,\n\tassociations: { ...EMPTY_ASSOCIATIONS, roles: DEFAULT_ROLE_ASSOCIATIONS },\n\tinheritSystemAgentsMd: false,\n\tmemory: \"assistant\",\n\torientation: \"assistant\",\n\tmodel: null,\n\tthinking: null,\n\tclonedFrom: null,\n\tfactoryRevision: FACTORY_CONTENTS_VERSION,\n};\n\nconst codingSuite: SuiteDefinition = {\n\tschemaVersion: SUITE_SCHEMA_VERSION,\n\tid: \"coding\",\n\tname: \"Coding\",\n\tbuiltin: true,\n\ttools: BUILTIN_SUITE_TOOLS,\n\tcapabilities: BUILTIN_SUITE_CAPABILITIES,\n\tassociations: { ...EMPTY_ASSOCIATIONS, roles: DEFAULT_ROLE_ASSOCIATIONS },\n\tinheritSystemAgentsMd: false,\n\tmemory: \"code\",\n\torientation: \"coding\",\n\tmodel: null,\n\tthinking: null,\n\tclonedFrom: null,\n\tfactoryRevision: FACTORY_CONTENTS_VERSION,\n};\n\n/** The factory builtin pair: coding (factory default 尖刀) and assistant (fallback). */\nexport const BUILTIN_SUITES: readonly SuiteDefinition[] = [assistantSuite, codingSuite];\n\nexport function getBuiltinSuite(id: string): SuiteDefinition | undefined {\n\treturn BUILTIN_SUITES.find((suite) => suite.id === id);\n}\n\nexport function isBuiltinSuiteId(id: string): boolean {\n\treturn BUILTIN_SUITES.some((suite) => suite.id === id);\n}\n\nconst WINDOWS_RESERVED_IDS = new Set([\n\t\"con\",\n\t\"prn\",\n\t\"aux\",\n\t\"nul\",\n\t\"com1\",\n\t\"com2\",\n\t\"com3\",\n\t\"com4\",\n\t\"com5\",\n\t\"com6\",\n\t\"com7\",\n\t\"com8\",\n\t\"com9\",\n\t\"lpt1\",\n\t\"lpt2\",\n\t\"lpt3\",\n\t\"lpt4\",\n\t\"lpt5\",\n\t\"lpt6\",\n\t\"lpt7\",\n\t\"lpt8\",\n\t\"lpt9\",\n\t\"conin$\",\n\t\"conout$\",\n]);\n\n/** Suite id rule (设计 §9): `a-z0-9-`, no leading/trailing hyphen, no Windows reserved names. */\nexport function isValidSuiteId(id: string): boolean {\n\tif (id.length === 0 || id.length > SUITE_ID_MAX_LENGTH) return false;\n\tif (!/^[a-z0-9-]+$/.test(id)) return false;\n\tif (id.startsWith(\"-\") || id.endsWith(\"-\")) return false;\n\tif (WINDOWS_RESERVED_IDS.has(id)) return false;\n\treturn true;\n}\n\n/** Serializes a suite to the canonical suite.json text (stable field order, trailing newline). */\nexport function serializeSuiteJson(suite: SuiteDefinition): string {\n\tconst ordered = {\n\t\tschemaVersion: suite.schemaVersion,\n\t\tid: suite.id,\n\t\tname: suite.name,\n\t\tbuiltin: suite.builtin,\n\t\ttools: [...suite.tools],\n\t\tcapabilities: [...suite.capabilities],\n\t\tassociations: {\n\t\t\tskills: [...suite.associations.skills],\n\t\t\tmcp: [...suite.associations.mcp],\n\t\t\tplugins: [...suite.associations.plugins],\n\t\t\troles: [...suite.associations.roles],\n\t\t},\n\t\tinheritSystemAgentsMd: suite.inheritSystemAgentsMd,\n\t\tmemory: suite.memory,\n\t\torientation: suite.orientation,\n\t\tmodel: suite.model,\n\t\tthinking: suite.thinking,\n\t\tclonedFrom: suite.clonedFrom\n\t\t\t? { id: suite.clonedFrom.id, digest: suite.clonedFrom.digest, at: suite.clonedFrom.at }\n\t\t\t: null,\n\t\tfactoryRevision: suite.factoryRevision,\n\t};\n\treturn `${JSON.stringify(ordered, null, 2)}\\n`;\n}\n\nexport interface SuiteJsonParseResult {\n\treadonly valid: boolean;\n\treadonly suite?: SuiteDefinition;\n\treadonly errors: readonly string[];\n}\n\n/**\n * Parses suite.json text. Never throws: an invalid result carries every\n * validation error so callers can apply the corruption policy (设计 §9) —\n * builtin suites fall back to factory content, user suites fail fast.\n */\nexport function parseSuiteJson(\n\traw: string,\n\toptions: { expectedBuiltin?: boolean; expectedId?: string },\n): SuiteJsonParseResult {\n\tlet value: unknown;\n\ttry {\n\t\tvalue = JSON.parse(raw);\n\t} catch (error) {\n\t\treturn {\n\t\t\tvalid: false,\n\t\t\terrors: [`invalid JSON: ${error instanceof Error ? error.message : String(error)}`],\n\t\t};\n\t}\n\treturn validateSuiteJson(value, options);\n}\n\nexport function validateSuiteJson(\n\tvalue: unknown,\n\toptions: { expectedBuiltin?: boolean; expectedId?: string } = {},\n): SuiteJsonParseResult {\n\tif (value === null || typeof value !== \"object\" || Array.isArray(value)) {\n\t\treturn { valid: false, errors: [\"suite.json must be a JSON object\"] };\n\t}\n\tconst record = value as Record<string, unknown>;\n\tconst errors: string[] = [];\n\n\tif (record.schemaVersion !== SUITE_SCHEMA_VERSION) {\n\t\terrors.push(`schemaVersion must be ${SUITE_SCHEMA_VERSION}, found ${JSON.stringify(record.schemaVersion)}`);\n\t}\n\n\t// Each field keeps a typed local: valid values land here, invalid ones only\n\t// contribute errors. The suite below is constructed exclusively when\n\t// `errors` is empty, so the fallbacks/coercions at that point are dead.\n\tconst idValue = record.id;\n\tconst id = typeof idValue === \"string\" && isValidSuiteId(idValue) ? idValue : undefined;\n\tif (id === undefined) {\n\t\terrors.push(\n\t\t\t`id must be a suite id (^[a-z0-9-]+$, no leading/trailing hyphen, Windows reserved names rejected), found ${JSON.stringify(idValue)}`,\n\t\t);\n\t} else if (options.expectedId !== undefined && id !== options.expectedId) {\n\t\terrors.push(`id \"${id}\" does not match the suite workspace directory id \"${options.expectedId}\"`);\n\t}\n\n\tconst nameValue = record.name;\n\tconst name = typeof nameValue === \"string\" && nameValue.trim().length > 0 ? nameValue : undefined;\n\tif (name === undefined) {\n\t\terrors.push(`name must be a non-empty string, found ${JSON.stringify(nameValue)}`);\n\t}\n\n\tconst builtinValue = record.builtin;\n\tconst builtin = typeof builtinValue === \"boolean\" ? builtinValue : undefined;\n\tif (builtin === undefined) {\n\t\terrors.push(`builtin must be a boolean, found ${JSON.stringify(builtinValue)}`);\n\t} else if (options.expectedBuiltin === true && builtin !== true) {\n\t\terrors.push(`builtin must be true for a builtin suite workspace, found ${builtin}`);\n\t}\n\n\tconst tools = readStringArray(record, \"tools\", errors);\n\tconst capabilities = readStringArray(record, \"capabilities\", errors);\n\tconst associations = readAssociations(record.associations, errors);\n\n\tconst inheritValue = record.inheritSystemAgentsMd;\n\tconst inheritSystemAgentsMd = typeof inheritValue === \"boolean\" ? inheritValue : undefined;\n\tif (inheritSystemAgentsMd === undefined) {\n\t\terrors.push(`inheritSystemAgentsMd must be a boolean, found ${JSON.stringify(inheritValue)}`);\n\t}\n\n\tconst memoryValue = record.memory;\n\tconst memory = memoryValue === \"assistant\" || memoryValue === \"code\" ? memoryValue : undefined;\n\tif (memory === undefined) {\n\t\terrors.push(`memory must be \"assistant\" or \"code\", found ${JSON.stringify(memoryValue)}`);\n\t}\n\n\tconst orientationValue = record.orientation;\n\tconst orientation =\n\t\torientationValue === \"assistant\" || orientationValue === \"coding\" || orientationValue === \"custom\"\n\t\t\t? orientationValue\n\t\t\t: undefined;\n\tif (orientationValue !== undefined && orientation === undefined) {\n\t\terrors.push(`orientation must be \"assistant\", \"coding\", or \"custom\", found ${JSON.stringify(orientationValue)}`);\n\t}\n\n\tconst model = readOptionalString(record, \"model\", errors);\n\tconst thinking = readOptionalString(record, \"thinking\", errors);\n\tconst clonedFrom = readClonedFrom(record.clonedFrom, errors);\n\tconst factoryRevision = readFactoryRevision(record.factoryRevision, options.expectedBuiltin === true, errors);\n\n\tif (errors.length > 0) return { valid: false, errors };\n\n\treturn {\n\t\tvalid: true,\n\t\terrors: [],\n\t\tsuite: {\n\t\t\tschemaVersion: SUITE_SCHEMA_VERSION,\n\t\t\tid: id!,\n\t\t\tname: name!,\n\t\t\tbuiltin: builtin!,\n\t\t\ttools,\n\t\t\tcapabilities,\n\t\t\tassociations,\n\t\t\tinheritSystemAgentsMd: inheritSystemAgentsMd!,\n\t\t\tmemory: memory!,\n\t\t\torientation: orientation ?? \"assistant\",\n\t\t\tmodel,\n\t\t\tthinking,\n\t\t\tclonedFrom,\n\t\t\t...(factoryRevision === undefined ? {} : { factoryRevision }),\n\t\t},\n\t};\n}\n\nfunction readStringArray(record: Record<string, unknown>, key: string, errors: string[]): readonly string[] {\n\tconst value = record[key];\n\tif (!Array.isArray(value)) {\n\t\terrors.push(`${key} must be an array of strings, found ${JSON.stringify(value)}`);\n\t\treturn [];\n\t}\n\tconst entries: string[] = [];\n\tconst seen = new Set<string>();\n\tfor (const item of value) {\n\t\tif (typeof item !== \"string\" || item.trim().length === 0) {\n\t\t\terrors.push(`${key} entries must be non-empty strings, found ${JSON.stringify(item)}`);\n\t\t\tcontinue;\n\t\t}\n\t\tif (seen.has(item)) {\n\t\t\terrors.push(`${key} contains duplicate entry \"${item}\"`);\n\t\t\tcontinue;\n\t\t}\n\t\tseen.add(item);\n\t\tentries.push(item);\n\t}\n\treturn entries;\n}\n\nfunction readAssociations(value: unknown, errors: string[]): SuiteAssociations {\n\tif (value === undefined) return { skills: [], mcp: [], plugins: [], roles: [] };\n\tif (value === null || typeof value !== \"object\" || Array.isArray(value)) {\n\t\terrors.push(\n\t\t\t`associations must be an object with skills/mcp/plugins/roles arrays, found ${JSON.stringify(value)}`,\n\t\t);\n\t\treturn { skills: [], mcp: [], plugins: [], roles: [] };\n\t}\n\tconst record = value as Record<string, unknown>;\n\t// A key left out entirely means an empty list, consistent with a fully\n\t// absent `associations` object; a key that is present but malformed still\n\t// reports its errors. The removed legacy `extensions` kind is ignored on\n\t// read (it lost its loader with the old ExtensionAPI surface).\n\treturn {\n\t\tskills: record.skills === undefined ? [] : readStringArray(record, \"skills\", errors),\n\t\tmcp: record.mcp === undefined ? [] : readStringArray(record, \"mcp\", errors),\n\t\tplugins: record.plugins === undefined ? [] : readStringArray(record, \"plugins\", errors),\n\t\troles: record.roles === undefined ? [] : readStringArray(record, \"roles\", errors),\n\t};\n}\n\nfunction readOptionalString(record: Record<string, unknown>, key: string, errors: string[]): string | null {\n\tconst value = record[key];\n\tif (value === undefined || value === null) return null;\n\tif (typeof value !== \"string\" || value.trim().length === 0) {\n\t\terrors.push(`${key} must be a non-empty string or null, found ${JSON.stringify(value)}`);\n\t\treturn null;\n\t}\n\treturn value;\n}\n\n/**\n * Reads the optional `factoryRevision` key (M4). A missing key means\n * FACTORY_CONTENTS_VERSION for builtin workspaces (pre-M4 on-disk files stay\n * compatible) and stays absent for user suites (outside factory upgrade\n * governance). A present key must be a positive integer.\n */\nfunction readFactoryRevision(value: unknown, expectedBuiltin: boolean, errors: string[]): number | undefined {\n\tif (value === undefined) return expectedBuiltin ? FACTORY_CONTENTS_VERSION : undefined;\n\tif (typeof value !== \"number\" || !Number.isSafeInteger(value) || value <= 0) {\n\t\terrors.push(`factoryRevision must be a positive integer, found ${JSON.stringify(value)}`);\n\t\treturn undefined;\n\t}\n\treturn value;\n}\n\nfunction readClonedFrom(value: unknown, errors: string[]): SuiteClonedFrom | null {\n\tif (value === undefined || value === null) return null;\n\tif (typeof value !== \"object\" || Array.isArray(value)) {\n\t\terrors.push(`clonedFrom must be an object with id/digest/at, found ${JSON.stringify(value)}`);\n\t\treturn null;\n\t}\n\tconst record = value as Record<string, unknown>;\n\tif (\n\t\ttypeof record.id !== \"string\" ||\n\t\trecord.id.trim().length === 0 ||\n\t\ttypeof record.digest !== \"string\" ||\n\t\trecord.digest.trim().length === 0 ||\n\t\ttypeof record.at !== \"number\" ||\n\t\t!Number.isSafeInteger(record.at)\n\t) {\n\t\terrors.push(\n\t\t\t`clonedFrom must be an object with non-empty id/digest strings and an integer at, found ${JSON.stringify(value)}`,\n\t\t);\n\t\treturn null;\n\t}\n\treturn { id: record.id, digest: record.digest, at: record.at };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"builtin-suites.d.ts","sourceRoot":"","sources":["../../src/profiles/builtin-suites.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GAS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G;AACH,wBAAgB,cAAc,CAC7B,GAAG,EAAE,MAAM,EACX,OAAO,EAAE;IAAE,eAAe,CAAC,EAAE,OAAO,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,GACzD,oBAAoB,CAWtB;AAED,wBAAgB,iBAAiB,CAChC,KAAK,EAAE,OAAO,EACd,OAAO,GAAE;IAAE,eAAe,CAAC,EAAE,OAAO,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAO,GAC9D,oBAAoB,CA0FtB","sourcesContent":["/**\n * Builtin suite (方案) declarations and suite.json (schemaVersion 1)\n * serialization, parsing, and validation — 方案系统设计.md v2 §5/§6/§9, M1a.\n *\n * Suites are pure data plus default policy: both builtin suites share the same\n * unrestricted tool surface and differ only in orientation and memory strategy\n * (the orientation persona text is injected into the system prompt, M2).\n * Nothing here touches the packages/agent kernel; association resolution is\n * declaration-only until M1b.\n */\n\nexport const SUITE_SCHEMA_VERSION = 1;\n\n/**\n * Factory contents revision (M4): the revision of the factory builtin\n * declarations, independent of SUITE_SCHEMA_VERSION. Bump it (and update both\n * builtin declarations' `factoryRevision`) whenever the factory contents\n * change; the registry upgrade proposal then offers `--suite-reset` for\n * workspaces still on an older revision. Suite schema evolution keeps using\n * SUITE_SCHEMA_VERSION.\n *\n * Revision 2 (统一修复轮集成收口, 2026-09-08): assistant and coding now share\n * the same active 8-tool surface in full-control — the sdk `suiteToolOverride`\n * DEFAULT_SUITE_ID exemption was removed (方案设计 §5 + user decision). Existing\n * workspaces provisioned at revision 1 receive the upgrade-proposal diagnostic\n * and adopt via `--suite-reset`.\n *\n * Revision 3 (2026-09-18): `builtin.session-share` joins both builtin suites\n * (开发计划 §216: session-share productized from the example plugin into a\n * first-party default-distributed capability) once the agent-dir config\n * channel for embedded capabilities landed\n * (`<agentDir>/capabilities/<short-id>.json`, see capabilities/builtin.ts).\n * Existing workspaces provisioned at revision 2 receive the upgrade-proposal\n * diagnostic and adopt via `--suite-reset`.\n *\n * Revision 4 (2026-09-18): `builtin.subagent-delegate` joins both builtin\n * suites — the first-party subagent delegation tool (`subagent_run`) now ships\n * by default in shared mode (zero extra processes; pooled runner processes stay\n * opt-in through the capability config channel). Existing workspaces\n * provisioned at revision 3 receive the upgrade-proposal diagnostic and adopt\n * via `--suite-reset`.\n *\n * Revision 5 (2026-09-20): subagent role profiles land on disk only\n * (`<agentDir>/roles/<id>.json` — the factory seeds explore/reviewer and never\n * overwrites user edits) and both builtin suites associate them by default via\n * the new `suite.associations.roles` field, with skill/MCP-isomorphic\n * visibility: unassociated roles stay invisible, associated-but-missing files\n * surface as dangling diagnostics. Existing workspaces provisioned at\n * revision 4 receive the upgrade-proposal diagnostic and adopt via\n * `--suite-reset`.\n *\n * Revision 6 (D-077, 2026-10-02): `builtin.workflow` joins both builtin suites\n * — the workflow orchestration plugin enters the factory bootstrap manifest\n * (ninth package) and the suite capability declaration at goal/plan/todo-set\n * parity, keeping its plugin form. Existing workspaces provisioned at revision\n * 5 receive the upgrade-proposal diagnostic and adopt via `--suite-reset`.\n */\nexport const FACTORY_CONTENTS_VERSION = 6;\n\n/**\n * Factory default suite used when no suite is configured anywhere (设计 §9).\n * 2026-10-02 user ruling: the product is a coding agent, so the factory\n * default flipped from \"assistant\" to \"coding\"; assistant stays as the\n * explicit-switch fallback suite.\n */\nexport const DEFAULT_SUITE_ID = \"coding\";\n\n/** Suite ids become directory names: lowercase letters, digits, hyphens (设计 §9). */\nexport const SUITE_ID_MAX_LENGTH = 64;\n\n/** The single unrestricted tool surface shared by both builtin suites (设计 §5/§6). */\nexport const BUILTIN_SUITE_TOOLS: readonly string[] = [\n\t\"read\",\n\t\"write\",\n\t\"edit\",\n\t\"bash\",\n\t\"ls\",\n\t\"find\",\n\t\"grep\",\n\t\"powershell\",\n];\n\n/**\n * Builtin capability plugins associated with both suites. Declaration-only\n * data in M1a; the actual plugin wiring is delivered in M3. `builtin.memory`\n * joins in the 统一修复轮 A 路 (方案系统设计 §6.1: both suites share the same\n * memory tool surface; the strategy difference lives in the suiteId domain\n * isolation and the assistant preference card). `builtin.session-share` joins\n * in the session-share productization slice (开发计划 §216); its\n * target/gateway/viewerUrl are configured through the agent-dir config\n * channel (`<agentDir>/capabilities/builtin.session-share.json`), and the\n * unconfigured default answers `/share` with the explicit configuration\n * prompt — never an implicit Radius/Gist fallback. `builtin.workflow` joins\n * at goal/plan/todo-set parity (D-077, 2026-10-02: factory default install\n * plus this suite declaration, plugin form unchanged). `builtin.coding-tools`\n * joins with the D-082 batch-1 tool split (2026-10-03): the default coding\n * tools assemble from the `plugins/coding-tools` package through the bundled\n * distribution channel (插件独立分发与启动装配设计 §4.9), not the install\n * store.\n */\nexport const BUILTIN_SUITE_CAPABILITIES: readonly string[] = [\n\t\"builtin.goal\",\n\t\"builtin.plan\",\n\t\"builtin.todo-set\",\n\t\"builtin.workflow\",\n\t\"builtin.memory\",\n\t\"builtin.session-share\",\n\t\"builtin.subagent-delegate\",\n\t\"builtin.coding-tools\",\n];\n\nexport type SuiteMemoryStrategy = \"assistant\" | \"code\";\nexport type SuiteOrientation = \"assistant\" | \"coding\" | \"custom\";\n\n/**\n * Orientation persona texts injected into the system prompt (设计 §6.2, M2).\n * The strings are verbatim from the design spec: the assistant persona is the\n * companion style, the coding persona is the rigor-first style. Both are\n * session-nature declarations, so they ride every system prompt branch\n * (default and customPrompt). The custom orientation is not in this table: its\n * persona text comes from the suite workspace persona.md (设计 §6.3, resolved\n * by suite-loader).\n */\nexport const ORIENTATION_PROMPTS: Record<\"assistant\" | \"coding\", string> = {\n\tassistant: `You are the user's thoughtful companion — warm, patient, and helpful.\n- Understand the intent behind the question, including the unspoken parts; when something that matters is ambiguous, ask one short clarifying question instead of assuming.\n- Pay attention to detail: notice what the user might have missed and gently point it out.\n- Be proactive and divergent: after answering, offer next steps, related ideas, or creative alternatives — without being pushy.\n- Adapt tone to the user; stay natural and flexible, never robotic or formulaic.\n- When you can help by doing, act through tools autonomously (minimal interruption).\n- Structure longer answers clearly: short paragraphs, lists where they help, and a concrete \"what you can do next\" at the end.`,\n\tcoding: `You are an autonomous software engineering agent with a rigor-first mindset.\n- Never guess. Ground every claim in code you have read, commands you have run, or documented evidence; cite file paths and line numbers. If the evidence is insufficient, investigate, and report what is unverified — or \"unknown\" — instead of a plausible invention.\n- First principles: trace problems to the earliest reasonable root cause and fix that; do not patch symptoms.\n- No over-engineering: add no abstraction, options, or defensive handling for imagined future needs; generalise only when a second concrete case demands it.\n- Tests first: pin expected behavior with a failing or updated test before or alongside the fix, then run the smallest sufficient relevant checks; the work is not done until they pass.\n- Reproducible: prefer deterministic tests and mocks over ad-hoc verification, and report the exact commands and results so others can re-run them.\n- Docs as code: repository documentation is part of the change — keep design docs, READMEs, and changelogs consistent with the behavior they describe.\n- Self-review before finishing: re-check your changes for correctness, edge cases, regressions, and missing tests; prefer a second review pass over shipping the first draft.\n- Cautious: weigh side effects, compatibility, and failure modes; when in doubt, take the safer path.`,\n};\n\nexport interface SuiteAssociations {\n\treadonly skills: readonly string[];\n\treadonly mcp: readonly string[];\n\treadonly plugins: readonly string[];\n\t/**\n\t * 子代理角色关联(D-044 角色机制):关联的是 `<agentDir>/roles/<id>.json` 里的角色 id。\n\t * 角色定义只在磁盘上(工厂仅做种子落盘),方案只决定哪些角色对主代理可见——与\n\t * skill/MCP/插件同构,第一方与第三方角色没有区别。\n\t */\n\treadonly roles: readonly string[];\n}\n\nexport interface SuiteClonedFrom {\n\treadonly id: string;\n\treadonly digest: string;\n\treadonly at: number;\n}\n\n/** The serializable suite definition persisted as suite.json (设计 §5). */\nexport interface SuiteDefinition {\n\treadonly schemaVersion: number;\n\treadonly id: string;\n\treadonly name: string;\n\treadonly builtin: boolean;\n\treadonly tools: readonly string[];\n\treadonly capabilities: readonly string[];\n\treadonly associations: SuiteAssociations;\n\treadonly inheritSystemAgentsMd: boolean;\n\treadonly memory: SuiteMemoryStrategy;\n\treadonly orientation: SuiteOrientation;\n\treadonly model: string | null;\n\treadonly thinking: string | null;\n\treadonly clonedFrom: SuiteClonedFrom | null;\n\t/**\n\t * Factory contents revision this declaration was written at (M4). Builtin\n\t * declarations carry it; on-disk builtin suite.json may omit it (pre-M4\n\t * files parse as FACTORY_CONTENTS_VERSION). User suites are outside factory\n\t * upgrade governance: the key stays optional and may be absent.\n\t */\n\treadonly factoryRevision?: number;\n}\n\nconst EMPTY_ASSOCIATIONS: SuiteAssociations = { skills: [], mcp: [], plugins: [], roles: [] };\n\n/**\n * 默认方案关联的子代理角色(开箱即用):这两个 id 对应工厂种子落盘的两个普通角色文件\n * (`<agentDir>/roles/{explore,reviewer}.json`,用户可改可删)。工厂不在运行期回退到任何\n * 编译内的角色定义;删掉文件只会让该关联成为 dangling 诊断。\n */\nexport const DEFAULT_ROLE_ASSOCIATIONS: readonly string[] = [\"explore\", \"reviewer\"];\n\nconst assistantSuite: SuiteDefinition = {\n\tschemaVersion: SUITE_SCHEMA_VERSION,\n\tid: \"assistant\",\n\tname: \"Assistant\",\n\tbuiltin: true,\n\ttools: BUILTIN_SUITE_TOOLS,\n\tcapabilities: BUILTIN_SUITE_CAPABILITIES,\n\tassociations: { ...EMPTY_ASSOCIATIONS, roles: DEFAULT_ROLE_ASSOCIATIONS },\n\tinheritSystemAgentsMd: false,\n\tmemory: \"assistant\",\n\torientation: \"assistant\",\n\tmodel: null,\n\tthinking: null,\n\tclonedFrom: null,\n\tfactoryRevision: FACTORY_CONTENTS_VERSION,\n};\n\nconst codingSuite: SuiteDefinition = {\n\tschemaVersion: SUITE_SCHEMA_VERSION,\n\tid: \"coding\",\n\tname: \"Coding\",\n\tbuiltin: true,\n\ttools: BUILTIN_SUITE_TOOLS,\n\tcapabilities: BUILTIN_SUITE_CAPABILITIES,\n\tassociations: { ...EMPTY_ASSOCIATIONS, roles: DEFAULT_ROLE_ASSOCIATIONS },\n\tinheritSystemAgentsMd: false,\n\tmemory: \"code\",\n\torientation: \"coding\",\n\tmodel: null,\n\tthinking: null,\n\tclonedFrom: null,\n\tfactoryRevision: FACTORY_CONTENTS_VERSION,\n};\n\n/** The factory builtin pair: coding (factory default 尖刀) and assistant (fallback). */\nexport const BUILTIN_SUITES: readonly SuiteDefinition[] = [assistantSuite, codingSuite];\n\nexport function getBuiltinSuite(id: string): SuiteDefinition | undefined {\n\treturn BUILTIN_SUITES.find((suite) => suite.id === id);\n}\n\nexport function isBuiltinSuiteId(id: string): boolean {\n\treturn BUILTIN_SUITES.some((suite) => suite.id === id);\n}\n\nconst WINDOWS_RESERVED_IDS = new Set([\n\t\"con\",\n\t\"prn\",\n\t\"aux\",\n\t\"nul\",\n\t\"com1\",\n\t\"com2\",\n\t\"com3\",\n\t\"com4\",\n\t\"com5\",\n\t\"com6\",\n\t\"com7\",\n\t\"com8\",\n\t\"com9\",\n\t\"lpt1\",\n\t\"lpt2\",\n\t\"lpt3\",\n\t\"lpt4\",\n\t\"lpt5\",\n\t\"lpt6\",\n\t\"lpt7\",\n\t\"lpt8\",\n\t\"lpt9\",\n\t\"conin$\",\n\t\"conout$\",\n]);\n\n/** Suite id rule (设计 §9): `a-z0-9-`, no leading/trailing hyphen, no Windows reserved names. */\nexport function isValidSuiteId(id: string): boolean {\n\tif (id.length === 0 || id.length > SUITE_ID_MAX_LENGTH) return false;\n\tif (!/^[a-z0-9-]+$/.test(id)) return false;\n\tif (id.startsWith(\"-\") || id.endsWith(\"-\")) return false;\n\tif (WINDOWS_RESERVED_IDS.has(id)) return false;\n\treturn true;\n}\n\n/** Serializes a suite to the canonical suite.json text (stable field order, trailing newline). */\nexport function serializeSuiteJson(suite: SuiteDefinition): string {\n\tconst ordered = {\n\t\tschemaVersion: suite.schemaVersion,\n\t\tid: suite.id,\n\t\tname: suite.name,\n\t\tbuiltin: suite.builtin,\n\t\ttools: [...suite.tools],\n\t\tcapabilities: [...suite.capabilities],\n\t\tassociations: {\n\t\t\tskills: [...suite.associations.skills],\n\t\t\tmcp: [...suite.associations.mcp],\n\t\t\tplugins: [...suite.associations.plugins],\n\t\t\troles: [...suite.associations.roles],\n\t\t},\n\t\tinheritSystemAgentsMd: suite.inheritSystemAgentsMd,\n\t\tmemory: suite.memory,\n\t\torientation: suite.orientation,\n\t\tmodel: suite.model,\n\t\tthinking: suite.thinking,\n\t\tclonedFrom: suite.clonedFrom\n\t\t\t? { id: suite.clonedFrom.id, digest: suite.clonedFrom.digest, at: suite.clonedFrom.at }\n\t\t\t: null,\n\t\tfactoryRevision: suite.factoryRevision,\n\t};\n\treturn `${JSON.stringify(ordered, null, 2)}\\n`;\n}\n\nexport interface SuiteJsonParseResult {\n\treadonly valid: boolean;\n\treadonly suite?: SuiteDefinition;\n\treadonly errors: readonly string[];\n}\n\n/**\n * Parses suite.json text. Never throws: an invalid result carries every\n * validation error so callers can apply the corruption policy (设计 §9) —\n * builtin suites fall back to factory content, user suites fail fast.\n */\nexport function parseSuiteJson(\n\traw: string,\n\toptions: { expectedBuiltin?: boolean; expectedId?: string },\n): SuiteJsonParseResult {\n\tlet value: unknown;\n\ttry {\n\t\tvalue = JSON.parse(raw);\n\t} catch (error) {\n\t\treturn {\n\t\t\tvalid: false,\n\t\t\terrors: [`invalid JSON: ${error instanceof Error ? error.message : String(error)}`],\n\t\t};\n\t}\n\treturn validateSuiteJson(value, options);\n}\n\nexport function validateSuiteJson(\n\tvalue: unknown,\n\toptions: { expectedBuiltin?: boolean; expectedId?: string } = {},\n): SuiteJsonParseResult {\n\tif (value === null || typeof value !== \"object\" || Array.isArray(value)) {\n\t\treturn { valid: false, errors: [\"suite.json must be a JSON object\"] };\n\t}\n\tconst record = value as Record<string, unknown>;\n\tconst errors: string[] = [];\n\n\tif (record.schemaVersion !== SUITE_SCHEMA_VERSION) {\n\t\terrors.push(`schemaVersion must be ${SUITE_SCHEMA_VERSION}, found ${JSON.stringify(record.schemaVersion)}`);\n\t}\n\n\t// Each field keeps a typed local: valid values land here, invalid ones only\n\t// contribute errors. The suite below is constructed exclusively when\n\t// `errors` is empty, so the fallbacks/coercions at that point are dead.\n\tconst idValue = record.id;\n\tconst id = typeof idValue === \"string\" && isValidSuiteId(idValue) ? idValue : undefined;\n\tif (id === undefined) {\n\t\terrors.push(\n\t\t\t`id must be a suite id (^[a-z0-9-]+$, no leading/trailing hyphen, Windows reserved names rejected), found ${JSON.stringify(idValue)}`,\n\t\t);\n\t} else if (options.expectedId !== undefined && id !== options.expectedId) {\n\t\terrors.push(`id \"${id}\" does not match the suite workspace directory id \"${options.expectedId}\"`);\n\t}\n\n\tconst nameValue = record.name;\n\tconst name = typeof nameValue === \"string\" && nameValue.trim().length > 0 ? nameValue : undefined;\n\tif (name === undefined) {\n\t\terrors.push(`name must be a non-empty string, found ${JSON.stringify(nameValue)}`);\n\t}\n\n\tconst builtinValue = record.builtin;\n\tconst builtin = typeof builtinValue === \"boolean\" ? builtinValue : undefined;\n\tif (builtin === undefined) {\n\t\terrors.push(`builtin must be a boolean, found ${JSON.stringify(builtinValue)}`);\n\t} else if (options.expectedBuiltin === true && builtin !== true) {\n\t\terrors.push(`builtin must be true for a builtin suite workspace, found ${builtin}`);\n\t}\n\n\tconst tools = readStringArray(record, \"tools\", errors);\n\tconst capabilities = readStringArray(record, \"capabilities\", errors);\n\tconst associations = readAssociations(record.associations, errors);\n\n\tconst inheritValue = record.inheritSystemAgentsMd;\n\tconst inheritSystemAgentsMd = typeof inheritValue === \"boolean\" ? inheritValue : undefined;\n\tif (inheritSystemAgentsMd === undefined) {\n\t\terrors.push(`inheritSystemAgentsMd must be a boolean, found ${JSON.stringify(inheritValue)}`);\n\t}\n\n\tconst memoryValue = record.memory;\n\tconst memory = memoryValue === \"assistant\" || memoryValue === \"code\" ? memoryValue : undefined;\n\tif (memory === undefined) {\n\t\terrors.push(`memory must be \"assistant\" or \"code\", found ${JSON.stringify(memoryValue)}`);\n\t}\n\n\tconst orientationValue = record.orientation;\n\tconst orientation =\n\t\torientationValue === \"assistant\" || orientationValue === \"coding\" || orientationValue === \"custom\"\n\t\t\t? orientationValue\n\t\t\t: undefined;\n\tif (orientationValue !== undefined && orientation === undefined) {\n\t\terrors.push(`orientation must be \"assistant\", \"coding\", or \"custom\", found ${JSON.stringify(orientationValue)}`);\n\t}\n\n\tconst model = readOptionalString(record, \"model\", errors);\n\tconst thinking = readOptionalString(record, \"thinking\", errors);\n\tconst clonedFrom = readClonedFrom(record.clonedFrom, errors);\n\tconst factoryRevision = readFactoryRevision(record.factoryRevision, options.expectedBuiltin === true, errors);\n\n\tif (errors.length > 0) return { valid: false, errors };\n\n\treturn {\n\t\tvalid: true,\n\t\terrors: [],\n\t\tsuite: {\n\t\t\tschemaVersion: SUITE_SCHEMA_VERSION,\n\t\t\tid: id!,\n\t\t\tname: name!,\n\t\t\tbuiltin: builtin!,\n\t\t\ttools,\n\t\t\tcapabilities,\n\t\t\tassociations,\n\t\t\tinheritSystemAgentsMd: inheritSystemAgentsMd!,\n\t\t\tmemory: memory!,\n\t\t\torientation: orientation ?? \"assistant\",\n\t\t\tmodel,\n\t\t\tthinking,\n\t\t\tclonedFrom,\n\t\t\t...(factoryRevision === undefined ? {} : { factoryRevision }),\n\t\t},\n\t};\n}\n\nfunction readStringArray(record: Record<string, unknown>, key: string, errors: string[]): readonly string[] {\n\tconst value = record[key];\n\tif (!Array.isArray(value)) {\n\t\terrors.push(`${key} must be an array of strings, found ${JSON.stringify(value)}`);\n\t\treturn [];\n\t}\n\tconst entries: string[] = [];\n\tconst seen = new Set<string>();\n\tfor (const item of value) {\n\t\tif (typeof item !== \"string\" || item.trim().length === 0) {\n\t\t\terrors.push(`${key} entries must be non-empty strings, found ${JSON.stringify(item)}`);\n\t\t\tcontinue;\n\t\t}\n\t\tif (seen.has(item)) {\n\t\t\terrors.push(`${key} contains duplicate entry \"${item}\"`);\n\t\t\tcontinue;\n\t\t}\n\t\tseen.add(item);\n\t\tentries.push(item);\n\t}\n\treturn entries;\n}\n\nfunction readAssociations(value: unknown, errors: string[]): SuiteAssociations {\n\tif (value === undefined) return { skills: [], mcp: [], plugins: [], roles: [] };\n\tif (value === null || typeof value !== \"object\" || Array.isArray(value)) {\n\t\terrors.push(\n\t\t\t`associations must be an object with skills/mcp/plugins/roles arrays, found ${JSON.stringify(value)}`,\n\t\t);\n\t\treturn { skills: [], mcp: [], plugins: [], roles: [] };\n\t}\n\tconst record = value as Record<string, unknown>;\n\t// A key left out entirely means an empty list, consistent with a fully\n\t// absent `associations` object; a key that is present but malformed still\n\t// reports its errors. The removed legacy `extensions` kind is ignored on\n\t// read (it lost its loader with the old ExtensionAPI surface).\n\treturn {\n\t\tskills: record.skills === undefined ? [] : readStringArray(record, \"skills\", errors),\n\t\tmcp: record.mcp === undefined ? [] : readStringArray(record, \"mcp\", errors),\n\t\tplugins: record.plugins === undefined ? [] : readStringArray(record, \"plugins\", errors),\n\t\troles: record.roles === undefined ? [] : readStringArray(record, \"roles\", errors),\n\t};\n}\n\nfunction readOptionalString(record: Record<string, unknown>, key: string, errors: string[]): string | null {\n\tconst value = record[key];\n\tif (value === undefined || value === null) return null;\n\tif (typeof value !== \"string\" || value.trim().length === 0) {\n\t\terrors.push(`${key} must be a non-empty string or null, found ${JSON.stringify(value)}`);\n\t\treturn null;\n\t}\n\treturn value;\n}\n\n/**\n * Reads the optional `factoryRevision` key (M4). A missing key means\n * FACTORY_CONTENTS_VERSION for builtin workspaces (pre-M4 on-disk files stay\n * compatible) and stays absent for user suites (outside factory upgrade\n * governance). A present key must be a positive integer.\n */\nfunction readFactoryRevision(value: unknown, expectedBuiltin: boolean, errors: string[]): number | undefined {\n\tif (value === undefined) return expectedBuiltin ? FACTORY_CONTENTS_VERSION : undefined;\n\tif (typeof value !== \"number\" || !Number.isSafeInteger(value) || value <= 0) {\n\t\terrors.push(`factoryRevision must be a positive integer, found ${JSON.stringify(value)}`);\n\t\treturn undefined;\n\t}\n\treturn value;\n}\n\nfunction readClonedFrom(value: unknown, errors: string[]): SuiteClonedFrom | null {\n\tif (value === undefined || value === null) return null;\n\tif (typeof value !== \"object\" || Array.isArray(value)) {\n\t\terrors.push(`clonedFrom must be an object with id/digest/at, found ${JSON.stringify(value)}`);\n\t\treturn null;\n\t}\n\tconst record = value as Record<string, unknown>;\n\tif (\n\t\ttypeof record.id !== \"string\" ||\n\t\trecord.id.trim().length === 0 ||\n\t\ttypeof record.digest !== \"string\" ||\n\t\trecord.digest.trim().length === 0 ||\n\t\ttypeof record.at !== \"number\" ||\n\t\t!Number.isSafeInteger(record.at)\n\t) {\n\t\terrors.push(\n\t\t\t`clonedFrom must be an object with non-empty id/digest strings and an integer at, found ${JSON.stringify(value)}`,\n\t\t);\n\t\treturn null;\n\t}\n\treturn { id: record.id, digest: record.digest, at: record.at };\n}\n"]}
|
|
@@ -86,7 +86,11 @@ export const BUILTIN_SUITE_TOOLS = [
|
|
|
86
86
|
* unconfigured default answers `/share` with the explicit configuration
|
|
87
87
|
* prompt — never an implicit Radius/Gist fallback. `builtin.workflow` joins
|
|
88
88
|
* at goal/plan/todo-set parity (D-077, 2026-10-02: factory default install
|
|
89
|
-
* plus this suite declaration, plugin form unchanged).
|
|
89
|
+
* plus this suite declaration, plugin form unchanged). `builtin.coding-tools`
|
|
90
|
+
* joins with the D-082 batch-1 tool split (2026-10-03): the default coding
|
|
91
|
+
* tools assemble from the `plugins/coding-tools` package through the bundled
|
|
92
|
+
* distribution channel (插件独立分发与启动装配设计 §4.9), not the install
|
|
93
|
+
* store.
|
|
90
94
|
*/
|
|
91
95
|
export const BUILTIN_SUITE_CAPABILITIES = [
|
|
92
96
|
"builtin.goal",
|
|
@@ -96,6 +100,7 @@ export const BUILTIN_SUITE_CAPABILITIES = [
|
|
|
96
100
|
"builtin.memory",
|
|
97
101
|
"builtin.session-share",
|
|
98
102
|
"builtin.subagent-delegate",
|
|
103
|
+
"builtin.coding-tools",
|
|
99
104
|
];
|
|
100
105
|
/**
|
|
101
106
|
* Orientation persona texts injected into the system prompt (设计 §6.2, M2).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builtin-suites.js","sourceRoot":"","sources":["../../src/profiles/builtin-suites.ts"],"names":[],"m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QAC9F,OAAO,IAAI,CAAC;IACb,CAAC;IACD,MAAM,MAAM,GAAG,KAAgC,CAAC;IAChD,IACC,OAAO,MAAM,CAAC,EAAE,KAAK,QAAQ;QAC7B,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC;QAC7B,OAAO,MAAM,CAAC,MAAM,KAAK,QAAQ;QACjC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC;QACjC,OAAO,MAAM,CAAC,EAAE,KAAK,QAAQ;QAC7B,CAAC,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,EAAE,CAAC,EAC/B,CAAC;QACF,MAAM,CAAC,IAAI,CACV,0FAA0F,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CACjH,CAAC;QACF,OAAO,IAAI,CAAC;IACb,CAAC;IACD,OAAO,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,CAAC;AAAA,CAC/D","sourcesContent":["/**\n * Builtin suite (方案) declarations and suite.json (schemaVersion 1)\n * serialization, parsing, and validation — 方案系统设计.md v2 §5/§6/§9, M1a.\n *\n * Suites are pure data plus default policy: both builtin suites share the same\n * unrestricted tool surface and differ only in orientation and memory strategy\n * (the orientation persona text is injected into the system prompt, M2).\n * Nothing here touches the packages/agent kernel; association resolution is\n * declaration-only until M1b.\n */\n\nexport const SUITE_SCHEMA_VERSION = 1;\n\n/**\n * Factory contents revision (M4): the revision of the factory builtin\n * declarations, independent of SUITE_SCHEMA_VERSION. Bump it (and update both\n * builtin declarations' `factoryRevision`) whenever the factory contents\n * change; the registry upgrade proposal then offers `--suite-reset` for\n * workspaces still on an older revision. Suite schema evolution keeps using\n * SUITE_SCHEMA_VERSION.\n *\n * Revision 2 (统一修复轮集成收口, 2026-09-08): assistant and coding now share\n * the same active 8-tool surface in full-control — the sdk `suiteToolOverride`\n * DEFAULT_SUITE_ID exemption was removed (方案设计 §5 + user decision). Existing\n * workspaces provisioned at revision 1 receive the upgrade-proposal diagnostic\n * and adopt via `--suite-reset`.\n *\n * Revision 3 (2026-09-18): `builtin.session-share` joins both builtin suites\n * (开发计划 §216: session-share productized from the example plugin into a\n * first-party default-distributed capability) once the agent-dir config\n * channel for embedded capabilities landed\n * (`<agentDir>/capabilities/<short-id>.json`, see capabilities/builtin.ts).\n * Existing workspaces provisioned at revision 2 receive the upgrade-proposal\n * diagnostic and adopt via `--suite-reset`.\n *\n * Revision 4 (2026-09-18): `builtin.subagent-delegate` joins both builtin\n * suites — the first-party subagent delegation tool (`subagent_run`) now ships\n * by default in shared mode (zero extra processes; pooled runner processes stay\n * opt-in through the capability config channel). Existing workspaces\n * provisioned at revision 3 receive the upgrade-proposal diagnostic and adopt\n * via `--suite-reset`.\n *\n * Revision 5 (2026-09-20): subagent role profiles land on disk only\n * (`<agentDir>/roles/<id>.json` — the factory seeds explore/reviewer and never\n * overwrites user edits) and both builtin suites associate them by default via\n * the new `suite.associations.roles` field, with skill/MCP-isomorphic\n * visibility: unassociated roles stay invisible, associated-but-missing files\n * surface as dangling diagnostics. Existing workspaces provisioned at\n * revision 4 receive the upgrade-proposal diagnostic and adopt via\n * `--suite-reset`.\n *\n * Revision 6 (D-077, 2026-10-02): `builtin.workflow` joins both builtin suites\n * — the workflow orchestration plugin enters the factory bootstrap manifest\n * (ninth package) and the suite capability declaration at goal/plan/todo-set\n * parity, keeping its plugin form. Existing workspaces provisioned at revision\n * 5 receive the upgrade-proposal diagnostic and adopt via `--suite-reset`.\n */\nexport const FACTORY_CONTENTS_VERSION = 6;\n\n/**\n * Factory default suite used when no suite is configured anywhere (设计 §9).\n * 2026-10-02 user ruling: the product is a coding agent, so the factory\n * default flipped from \"assistant\" to \"coding\"; assistant stays as the\n * explicit-switch fallback suite.\n */\nexport const DEFAULT_SUITE_ID = \"coding\";\n\n/** Suite ids become directory names: lowercase letters, digits, hyphens (设计 §9). */\nexport const SUITE_ID_MAX_LENGTH = 64;\n\n/** The single unrestricted tool surface shared by both builtin suites (设计 §5/§6). */\nexport const BUILTIN_SUITE_TOOLS: readonly string[] = [\n\t\"read\",\n\t\"write\",\n\t\"edit\",\n\t\"bash\",\n\t\"ls\",\n\t\"find\",\n\t\"grep\",\n\t\"powershell\",\n];\n\n/**\n * Builtin capability plugins associated with both suites. Declaration-only\n * data in M1a; the actual plugin wiring is delivered in M3. `builtin.memory`\n * joins in the 统一修复轮 A 路 (方案系统设计 §6.1: both suites share the same\n * memory tool surface; the strategy difference lives in the suiteId domain\n * isolation and the assistant preference card). `builtin.session-share` joins\n * in the session-share productization slice (开发计划 §216); its\n * target/gateway/viewerUrl are configured through the agent-dir config\n * channel (`<agentDir>/capabilities/builtin.session-share.json`), and the\n * unconfigured default answers `/share` with the explicit configuration\n * prompt — never an implicit Radius/Gist fallback. `builtin.workflow` joins\n * at goal/plan/todo-set parity (D-077, 2026-10-02: factory default install\n * plus this suite declaration, plugin form unchanged).\n */\nexport const BUILTIN_SUITE_CAPABILITIES: readonly string[] = [\n\t\"builtin.goal\",\n\t\"builtin.plan\",\n\t\"builtin.todo-set\",\n\t\"builtin.workflow\",\n\t\"builtin.memory\",\n\t\"builtin.session-share\",\n\t\"builtin.subagent-delegate\",\n];\n\nexport type SuiteMemoryStrategy = \"assistant\" | \"code\";\nexport type SuiteOrientation = \"assistant\" | \"coding\" | \"custom\";\n\n/**\n * Orientation persona texts injected into the system prompt (设计 §6.2, M2).\n * The strings are verbatim from the design spec: the assistant persona is the\n * companion style, the coding persona is the rigor-first style. Both are\n * session-nature declarations, so they ride every system prompt branch\n * (default and customPrompt). The custom orientation is not in this table: its\n * persona text comes from the suite workspace persona.md (设计 §6.3, resolved\n * by suite-loader).\n */\nexport const ORIENTATION_PROMPTS: Record<\"assistant\" | \"coding\", string> = {\n\tassistant: `You are the user's thoughtful companion — warm, patient, and helpful.\n- Understand the intent behind the question, including the unspoken parts; when something that matters is ambiguous, ask one short clarifying question instead of assuming.\n- Pay attention to detail: notice what the user might have missed and gently point it out.\n- Be proactive and divergent: after answering, offer next steps, related ideas, or creative alternatives — without being pushy.\n- Adapt tone to the user; stay natural and flexible, never robotic or formulaic.\n- When you can help by doing, act through tools autonomously (minimal interruption).\n- Structure longer answers clearly: short paragraphs, lists where they help, and a concrete \"what you can do next\" at the end.`,\n\tcoding: `You are an autonomous software engineering agent with a rigor-first mindset.\n- Never guess. Ground every claim in code you have read, commands you have run, or documented evidence; cite file paths and line numbers. If the evidence is insufficient, investigate, and report what is unverified — or \"unknown\" — instead of a plausible invention.\n- First principles: trace problems to the earliest reasonable root cause and fix that; do not patch symptoms.\n- No over-engineering: add no abstraction, options, or defensive handling for imagined future needs; generalise only when a second concrete case demands it.\n- Tests first: pin expected behavior with a failing or updated test before or alongside the fix, then run the smallest sufficient relevant checks; the work is not done until they pass.\n- Reproducible: prefer deterministic tests and mocks over ad-hoc verification, and report the exact commands and results so others can re-run them.\n- Docs as code: repository documentation is part of the change — keep design docs, READMEs, and changelogs consistent with the behavior they describe.\n- Self-review before finishing: re-check your changes for correctness, edge cases, regressions, and missing tests; prefer a second review pass over shipping the first draft.\n- Cautious: weigh side effects, compatibility, and failure modes; when in doubt, take the safer path.`,\n};\n\nexport interface SuiteAssociations {\n\treadonly skills: readonly string[];\n\treadonly mcp: readonly string[];\n\treadonly plugins: readonly string[];\n\t/**\n\t * 子代理角色关联(D-044 角色机制):关联的是 `<agentDir>/roles/<id>.json` 里的角色 id。\n\t * 角色定义只在磁盘上(工厂仅做种子落盘),方案只决定哪些角色对主代理可见——与\n\t * skill/MCP/插件同构,第一方与第三方角色没有区别。\n\t */\n\treadonly roles: readonly string[];\n}\n\nexport interface SuiteClonedFrom {\n\treadonly id: string;\n\treadonly digest: string;\n\treadonly at: number;\n}\n\n/** The serializable suite definition persisted as suite.json (设计 §5). */\nexport interface SuiteDefinition {\n\treadonly schemaVersion: number;\n\treadonly id: string;\n\treadonly name: string;\n\treadonly builtin: boolean;\n\treadonly tools: readonly string[];\n\treadonly capabilities: readonly string[];\n\treadonly associations: SuiteAssociations;\n\treadonly inheritSystemAgentsMd: boolean;\n\treadonly memory: SuiteMemoryStrategy;\n\treadonly orientation: SuiteOrientation;\n\treadonly model: string | null;\n\treadonly thinking: string | null;\n\treadonly clonedFrom: SuiteClonedFrom | null;\n\t/**\n\t * Factory contents revision this declaration was written at (M4). Builtin\n\t * declarations carry it; on-disk builtin suite.json may omit it (pre-M4\n\t * files parse as FACTORY_CONTENTS_VERSION). User suites are outside factory\n\t * upgrade governance: the key stays optional and may be absent.\n\t */\n\treadonly factoryRevision?: number;\n}\n\nconst EMPTY_ASSOCIATIONS: SuiteAssociations = { skills: [], mcp: [], plugins: [], roles: [] };\n\n/**\n * 默认方案关联的子代理角色(开箱即用):这两个 id 对应工厂种子落盘的两个普通角色文件\n * (`<agentDir>/roles/{explore,reviewer}.json`,用户可改可删)。工厂不在运行期回退到任何\n * 编译内的角色定义;删掉文件只会让该关联成为 dangling 诊断。\n */\nexport const DEFAULT_ROLE_ASSOCIATIONS: readonly string[] = [\"explore\", \"reviewer\"];\n\nconst assistantSuite: SuiteDefinition = {\n\tschemaVersion: SUITE_SCHEMA_VERSION,\n\tid: \"assistant\",\n\tname: \"Assistant\",\n\tbuiltin: true,\n\ttools: BUILTIN_SUITE_TOOLS,\n\tcapabilities: BUILTIN_SUITE_CAPABILITIES,\n\tassociations: { ...EMPTY_ASSOCIATIONS, roles: DEFAULT_ROLE_ASSOCIATIONS },\n\tinheritSystemAgentsMd: false,\n\tmemory: \"assistant\",\n\torientation: \"assistant\",\n\tmodel: null,\n\tthinking: null,\n\tclonedFrom: null,\n\tfactoryRevision: FACTORY_CONTENTS_VERSION,\n};\n\nconst codingSuite: SuiteDefinition = {\n\tschemaVersion: SUITE_SCHEMA_VERSION,\n\tid: \"coding\",\n\tname: \"Coding\",\n\tbuiltin: true,\n\ttools: BUILTIN_SUITE_TOOLS,\n\tcapabilities: BUILTIN_SUITE_CAPABILITIES,\n\tassociations: { ...EMPTY_ASSOCIATIONS, roles: DEFAULT_ROLE_ASSOCIATIONS },\n\tinheritSystemAgentsMd: false,\n\tmemory: \"code\",\n\torientation: \"coding\",\n\tmodel: null,\n\tthinking: null,\n\tclonedFrom: null,\n\tfactoryRevision: FACTORY_CONTENTS_VERSION,\n};\n\n/** The factory builtin pair: coding (factory default 尖刀) and assistant (fallback). */\nexport const BUILTIN_SUITES: readonly SuiteDefinition[] = [assistantSuite, codingSuite];\n\nexport function getBuiltinSuite(id: string): SuiteDefinition | undefined {\n\treturn BUILTIN_SUITES.find((suite) => suite.id === id);\n}\n\nexport function isBuiltinSuiteId(id: string): boolean {\n\treturn BUILTIN_SUITES.some((suite) => suite.id === id);\n}\n\nconst WINDOWS_RESERVED_IDS = new Set([\n\t\"con\",\n\t\"prn\",\n\t\"aux\",\n\t\"nul\",\n\t\"com1\",\n\t\"com2\",\n\t\"com3\",\n\t\"com4\",\n\t\"com5\",\n\t\"com6\",\n\t\"com7\",\n\t\"com8\",\n\t\"com9\",\n\t\"lpt1\",\n\t\"lpt2\",\n\t\"lpt3\",\n\t\"lpt4\",\n\t\"lpt5\",\n\t\"lpt6\",\n\t\"lpt7\",\n\t\"lpt8\",\n\t\"lpt9\",\n\t\"conin$\",\n\t\"conout$\",\n]);\n\n/** Suite id rule (设计 §9): `a-z0-9-`, no leading/trailing hyphen, no Windows reserved names. */\nexport function isValidSuiteId(id: string): boolean {\n\tif (id.length === 0 || id.length > SUITE_ID_MAX_LENGTH) return false;\n\tif (!/^[a-z0-9-]+$/.test(id)) return false;\n\tif (id.startsWith(\"-\") || id.endsWith(\"-\")) return false;\n\tif (WINDOWS_RESERVED_IDS.has(id)) return false;\n\treturn true;\n}\n\n/** Serializes a suite to the canonical suite.json text (stable field order, trailing newline). */\nexport function serializeSuiteJson(suite: SuiteDefinition): string {\n\tconst ordered = {\n\t\tschemaVersion: suite.schemaVersion,\n\t\tid: suite.id,\n\t\tname: suite.name,\n\t\tbuiltin: suite.builtin,\n\t\ttools: [...suite.tools],\n\t\tcapabilities: [...suite.capabilities],\n\t\tassociations: {\n\t\t\tskills: [...suite.associations.skills],\n\t\t\tmcp: [...suite.associations.mcp],\n\t\t\tplugins: [...suite.associations.plugins],\n\t\t\troles: [...suite.associations.roles],\n\t\t},\n\t\tinheritSystemAgentsMd: suite.inheritSystemAgentsMd,\n\t\tmemory: suite.memory,\n\t\torientation: suite.orientation,\n\t\tmodel: suite.model,\n\t\tthinking: suite.thinking,\n\t\tclonedFrom: suite.clonedFrom\n\t\t\t? { id: suite.clonedFrom.id, digest: suite.clonedFrom.digest, at: suite.clonedFrom.at }\n\t\t\t: null,\n\t\tfactoryRevision: suite.factoryRevision,\n\t};\n\treturn `${JSON.stringify(ordered, null, 2)}\\n`;\n}\n\nexport interface SuiteJsonParseResult {\n\treadonly valid: boolean;\n\treadonly suite?: SuiteDefinition;\n\treadonly errors: readonly string[];\n}\n\n/**\n * Parses suite.json text. Never throws: an invalid result carries every\n * validation error so callers can apply the corruption policy (设计 §9) —\n * builtin suites fall back to factory content, user suites fail fast.\n */\nexport function parseSuiteJson(\n\traw: string,\n\toptions: { expectedBuiltin?: boolean; expectedId?: string },\n): SuiteJsonParseResult {\n\tlet value: unknown;\n\ttry {\n\t\tvalue = JSON.parse(raw);\n\t} catch (error) {\n\t\treturn {\n\t\t\tvalid: false,\n\t\t\terrors: [`invalid JSON: ${error instanceof Error ? error.message : String(error)}`],\n\t\t};\n\t}\n\treturn validateSuiteJson(value, options);\n}\n\nexport function validateSuiteJson(\n\tvalue: unknown,\n\toptions: { expectedBuiltin?: boolean; expectedId?: string } = {},\n): SuiteJsonParseResult {\n\tif (value === null || typeof value !== \"object\" || Array.isArray(value)) {\n\t\treturn { valid: false, errors: [\"suite.json must be a JSON object\"] };\n\t}\n\tconst record = value as Record<string, unknown>;\n\tconst errors: string[] = [];\n\n\tif (record.schemaVersion !== SUITE_SCHEMA_VERSION) {\n\t\terrors.push(`schemaVersion must be ${SUITE_SCHEMA_VERSION}, found ${JSON.stringify(record.schemaVersion)}`);\n\t}\n\n\t// Each field keeps a typed local: valid values land here, invalid ones only\n\t// contribute errors. The suite below is constructed exclusively when\n\t// `errors` is empty, so the fallbacks/coercions at that point are dead.\n\tconst idValue = record.id;\n\tconst id = typeof idValue === \"string\" && isValidSuiteId(idValue) ? idValue : undefined;\n\tif (id === undefined) {\n\t\terrors.push(\n\t\t\t`id must be a suite id (^[a-z0-9-]+$, no leading/trailing hyphen, Windows reserved names rejected), found ${JSON.stringify(idValue)}`,\n\t\t);\n\t} else if (options.expectedId !== undefined && id !== options.expectedId) {\n\t\terrors.push(`id \"${id}\" does not match the suite workspace directory id \"${options.expectedId}\"`);\n\t}\n\n\tconst nameValue = record.name;\n\tconst name = typeof nameValue === \"string\" && nameValue.trim().length > 0 ? nameValue : undefined;\n\tif (name === undefined) {\n\t\terrors.push(`name must be a non-empty string, found ${JSON.stringify(nameValue)}`);\n\t}\n\n\tconst builtinValue = record.builtin;\n\tconst builtin = typeof builtinValue === \"boolean\" ? builtinValue : undefined;\n\tif (builtin === undefined) {\n\t\terrors.push(`builtin must be a boolean, found ${JSON.stringify(builtinValue)}`);\n\t} else if (options.expectedBuiltin === true && builtin !== true) {\n\t\terrors.push(`builtin must be true for a builtin suite workspace, found ${builtin}`);\n\t}\n\n\tconst tools = readStringArray(record, \"tools\", errors);\n\tconst capabilities = readStringArray(record, \"capabilities\", errors);\n\tconst associations = readAssociations(record.associations, errors);\n\n\tconst inheritValue = record.inheritSystemAgentsMd;\n\tconst inheritSystemAgentsMd = typeof inheritValue === \"boolean\" ? inheritValue : undefined;\n\tif (inheritSystemAgentsMd === undefined) {\n\t\terrors.push(`inheritSystemAgentsMd must be a boolean, found ${JSON.stringify(inheritValue)}`);\n\t}\n\n\tconst memoryValue = record.memory;\n\tconst memory = memoryValue === \"assistant\" || memoryValue === \"code\" ? memoryValue : undefined;\n\tif (memory === undefined) {\n\t\terrors.push(`memory must be \"assistant\" or \"code\", found ${JSON.stringify(memoryValue)}`);\n\t}\n\n\tconst orientationValue = record.orientation;\n\tconst orientation =\n\t\torientationValue === \"assistant\" || orientationValue === \"coding\" || orientationValue === \"custom\"\n\t\t\t? orientationValue\n\t\t\t: undefined;\n\tif (orientationValue !== undefined && orientation === undefined) {\n\t\terrors.push(`orientation must be \"assistant\", \"coding\", or \"custom\", found ${JSON.stringify(orientationValue)}`);\n\t}\n\n\tconst model = readOptionalString(record, \"model\", errors);\n\tconst thinking = readOptionalString(record, \"thinking\", errors);\n\tconst clonedFrom = readClonedFrom(record.clonedFrom, errors);\n\tconst factoryRevision = readFactoryRevision(record.factoryRevision, options.expectedBuiltin === true, errors);\n\n\tif (errors.length > 0) return { valid: false, errors };\n\n\treturn {\n\t\tvalid: true,\n\t\terrors: [],\n\t\tsuite: {\n\t\t\tschemaVersion: SUITE_SCHEMA_VERSION,\n\t\t\tid: id!,\n\t\t\tname: name!,\n\t\t\tbuiltin: builtin!,\n\t\t\ttools,\n\t\t\tcapabilities,\n\t\t\tassociations,\n\t\t\tinheritSystemAgentsMd: inheritSystemAgentsMd!,\n\t\t\tmemory: memory!,\n\t\t\torientation: orientation ?? \"assistant\",\n\t\t\tmodel,\n\t\t\tthinking,\n\t\t\tclonedFrom,\n\t\t\t...(factoryRevision === undefined ? {} : { factoryRevision }),\n\t\t},\n\t};\n}\n\nfunction readStringArray(record: Record<string, unknown>, key: string, errors: string[]): readonly string[] {\n\tconst value = record[key];\n\tif (!Array.isArray(value)) {\n\t\terrors.push(`${key} must be an array of strings, found ${JSON.stringify(value)}`);\n\t\treturn [];\n\t}\n\tconst entries: string[] = [];\n\tconst seen = new Set<string>();\n\tfor (const item of value) {\n\t\tif (typeof item !== \"string\" || item.trim().length === 0) {\n\t\t\terrors.push(`${key} entries must be non-empty strings, found ${JSON.stringify(item)}`);\n\t\t\tcontinue;\n\t\t}\n\t\tif (seen.has(item)) {\n\t\t\terrors.push(`${key} contains duplicate entry \"${item}\"`);\n\t\t\tcontinue;\n\t\t}\n\t\tseen.add(item);\n\t\tentries.push(item);\n\t}\n\treturn entries;\n}\n\nfunction readAssociations(value: unknown, errors: string[]): SuiteAssociations {\n\tif (value === undefined) return { skills: [], mcp: [], plugins: [], roles: [] };\n\tif (value === null || typeof value !== \"object\" || Array.isArray(value)) {\n\t\terrors.push(\n\t\t\t`associations must be an object with skills/mcp/plugins/roles arrays, found ${JSON.stringify(value)}`,\n\t\t);\n\t\treturn { skills: [], mcp: [], plugins: [], roles: [] };\n\t}\n\tconst record = value as Record<string, unknown>;\n\t// A key left out entirely means an empty list, consistent with a fully\n\t// absent `associations` object; a key that is present but malformed still\n\t// reports its errors. The removed legacy `extensions` kind is ignored on\n\t// read (it lost its loader with the old ExtensionAPI surface).\n\treturn {\n\t\tskills: record.skills === undefined ? [] : readStringArray(record, \"skills\", errors),\n\t\tmcp: record.mcp === undefined ? [] : readStringArray(record, \"mcp\", errors),\n\t\tplugins: record.plugins === undefined ? [] : readStringArray(record, \"plugins\", errors),\n\t\troles: record.roles === undefined ? [] : readStringArray(record, \"roles\", errors),\n\t};\n}\n\nfunction readOptionalString(record: Record<string, unknown>, key: string, errors: string[]): string | null {\n\tconst value = record[key];\n\tif (value === undefined || value === null) return null;\n\tif (typeof value !== \"string\" || value.trim().length === 0) {\n\t\terrors.push(`${key} must be a non-empty string or null, found ${JSON.stringify(value)}`);\n\t\treturn null;\n\t}\n\treturn value;\n}\n\n/**\n * Reads the optional `factoryRevision` key (M4). A missing key means\n * FACTORY_CONTENTS_VERSION for builtin workspaces (pre-M4 on-disk files stay\n * compatible) and stays absent for user suites (outside factory upgrade\n * governance). A present key must be a positive integer.\n */\nfunction readFactoryRevision(value: unknown, expectedBuiltin: boolean, errors: string[]): number | undefined {\n\tif (value === undefined) return expectedBuiltin ? FACTORY_CONTENTS_VERSION : undefined;\n\tif (typeof value !== \"number\" || !Number.isSafeInteger(value) || value <= 0) {\n\t\terrors.push(`factoryRevision must be a positive integer, found ${JSON.stringify(value)}`);\n\t\treturn undefined;\n\t}\n\treturn value;\n}\n\nfunction readClonedFrom(value: unknown, errors: string[]): SuiteClonedFrom | null {\n\tif (value === undefined || value === null) return null;\n\tif (typeof value !== \"object\" || Array.isArray(value)) {\n\t\terrors.push(`clonedFrom must be an object with id/digest/at, found ${JSON.stringify(value)}`);\n\t\treturn null;\n\t}\n\tconst record = value as Record<string, unknown>;\n\tif (\n\t\ttypeof record.id !== \"string\" ||\n\t\trecord.id.trim().length === 0 ||\n\t\ttypeof record.digest !== \"string\" ||\n\t\trecord.digest.trim().length === 0 ||\n\t\ttypeof record.at !== \"number\" ||\n\t\t!Number.isSafeInteger(record.at)\n\t) {\n\t\terrors.push(\n\t\t\t`clonedFrom must be an object with non-empty id/digest strings and an integer at, found ${JSON.stringify(value)}`,\n\t\t);\n\t\treturn null;\n\t}\n\treturn { id: record.id, digest: record.digest, at: record.at };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"builtin-suites.js","sourceRoot":"","sources":["../../src/profiles/builtin-suites.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC;AAEtC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC;AAE1C;;;;;GAKG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,QAAQ,CAAC;AAEzC,yFAAoF;AACpF,MAAM,CAAC,MAAM,mBAAmB,GAAG,EAAE,CAAC;AAEtC,2FAAqF;AACrF,MAAM,CAAC,MAAM,mBAAmB,GAAsB;IACrD,MAAM;IACN,OAAO;IACP,MAAM;IACN,MAAM;IACN,IAAI;IACJ,MAAM;IACN,MAAM;IACN,YAAY;CACZ,CAAC;AAEF;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAsB;IAC5D,cAAc;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OAAO,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,CAAC;AAAA,CAC/D","sourcesContent":["/**\n * Builtin suite (方案) declarations and suite.json (schemaVersion 1)\n * serialization, parsing, and validation — 方案系统设计.md v2 §5/§6/§9, M1a.\n *\n * Suites are pure data plus default policy: both builtin suites share the same\n * unrestricted tool surface and differ only in orientation and memory strategy\n * (the orientation persona text is injected into the system prompt, M2).\n * Nothing here touches the packages/agent kernel; association resolution is\n * declaration-only until M1b.\n */\n\nexport const SUITE_SCHEMA_VERSION = 1;\n\n/**\n * Factory contents revision (M4): the revision of the factory builtin\n * declarations, independent of SUITE_SCHEMA_VERSION. Bump it (and update both\n * builtin declarations' `factoryRevision`) whenever the factory contents\n * change; the registry upgrade proposal then offers `--suite-reset` for\n * workspaces still on an older revision. Suite schema evolution keeps using\n * SUITE_SCHEMA_VERSION.\n *\n * Revision 2 (统一修复轮集成收口, 2026-09-08): assistant and coding now share\n * the same active 8-tool surface in full-control — the sdk `suiteToolOverride`\n * DEFAULT_SUITE_ID exemption was removed (方案设计 §5 + user decision). Existing\n * workspaces provisioned at revision 1 receive the upgrade-proposal diagnostic\n * and adopt via `--suite-reset`.\n *\n * Revision 3 (2026-09-18): `builtin.session-share` joins both builtin suites\n * (开发计划 §216: session-share productized from the example plugin into a\n * first-party default-distributed capability) once the agent-dir config\n * channel for embedded capabilities landed\n * (`<agentDir>/capabilities/<short-id>.json`, see capabilities/builtin.ts).\n * Existing workspaces provisioned at revision 2 receive the upgrade-proposal\n * diagnostic and adopt via `--suite-reset`.\n *\n * Revision 4 (2026-09-18): `builtin.subagent-delegate` joins both builtin\n * suites — the first-party subagent delegation tool (`subagent_run`) now ships\n * by default in shared mode (zero extra processes; pooled runner processes stay\n * opt-in through the capability config channel). Existing workspaces\n * provisioned at revision 3 receive the upgrade-proposal diagnostic and adopt\n * via `--suite-reset`.\n *\n * Revision 5 (2026-09-20): subagent role profiles land on disk only\n * (`<agentDir>/roles/<id>.json` — the factory seeds explore/reviewer and never\n * overwrites user edits) and both builtin suites associate them by default via\n * the new `suite.associations.roles` field, with skill/MCP-isomorphic\n * visibility: unassociated roles stay invisible, associated-but-missing files\n * surface as dangling diagnostics. Existing workspaces provisioned at\n * revision 4 receive the upgrade-proposal diagnostic and adopt via\n * `--suite-reset`.\n *\n * Revision 6 (D-077, 2026-10-02): `builtin.workflow` joins both builtin suites\n * — the workflow orchestration plugin enters the factory bootstrap manifest\n * (ninth package) and the suite capability declaration at goal/plan/todo-set\n * parity, keeping its plugin form. Existing workspaces provisioned at revision\n * 5 receive the upgrade-proposal diagnostic and adopt via `--suite-reset`.\n */\nexport const FACTORY_CONTENTS_VERSION = 6;\n\n/**\n * Factory default suite used when no suite is configured anywhere (设计 §9).\n * 2026-10-02 user ruling: the product is a coding agent, so the factory\n * default flipped from \"assistant\" to \"coding\"; assistant stays as the\n * explicit-switch fallback suite.\n */\nexport const DEFAULT_SUITE_ID = \"coding\";\n\n/** Suite ids become directory names: lowercase letters, digits, hyphens (设计 §9). */\nexport const SUITE_ID_MAX_LENGTH = 64;\n\n/** The single unrestricted tool surface shared by both builtin suites (设计 §5/§6). */\nexport const BUILTIN_SUITE_TOOLS: readonly string[] = [\n\t\"read\",\n\t\"write\",\n\t\"edit\",\n\t\"bash\",\n\t\"ls\",\n\t\"find\",\n\t\"grep\",\n\t\"powershell\",\n];\n\n/**\n * Builtin capability plugins associated with both suites. Declaration-only\n * data in M1a; the actual plugin wiring is delivered in M3. `builtin.memory`\n * joins in the 统一修复轮 A 路 (方案系统设计 §6.1: both suites share the same\n * memory tool surface; the strategy difference lives in the suiteId domain\n * isolation and the assistant preference card). `builtin.session-share` joins\n * in the session-share productization slice (开发计划 §216); its\n * target/gateway/viewerUrl are configured through the agent-dir config\n * channel (`<agentDir>/capabilities/builtin.session-share.json`), and the\n * unconfigured default answers `/share` with the explicit configuration\n * prompt — never an implicit Radius/Gist fallback. `builtin.workflow` joins\n * at goal/plan/todo-set parity (D-077, 2026-10-02: factory default install\n * plus this suite declaration, plugin form unchanged). `builtin.coding-tools`\n * joins with the D-082 batch-1 tool split (2026-10-03): the default coding\n * tools assemble from the `plugins/coding-tools` package through the bundled\n * distribution channel (插件独立分发与启动装配设计 §4.9), not the install\n * store.\n */\nexport const BUILTIN_SUITE_CAPABILITIES: readonly string[] = [\n\t\"builtin.goal\",\n\t\"builtin.plan\",\n\t\"builtin.todo-set\",\n\t\"builtin.workflow\",\n\t\"builtin.memory\",\n\t\"builtin.session-share\",\n\t\"builtin.subagent-delegate\",\n\t\"builtin.coding-tools\",\n];\n\nexport type SuiteMemoryStrategy = \"assistant\" | \"code\";\nexport type SuiteOrientation = \"assistant\" | \"coding\" | \"custom\";\n\n/**\n * Orientation persona texts injected into the system prompt (设计 §6.2, M2).\n * The strings are verbatim from the design spec: the assistant persona is the\n * companion style, the coding persona is the rigor-first style. Both are\n * session-nature declarations, so they ride every system prompt branch\n * (default and customPrompt). The custom orientation is not in this table: its\n * persona text comes from the suite workspace persona.md (设计 §6.3, resolved\n * by suite-loader).\n */\nexport const ORIENTATION_PROMPTS: Record<\"assistant\" | \"coding\", string> = {\n\tassistant: `You are the user's thoughtful companion — warm, patient, and helpful.\n- Understand the intent behind the question, including the unspoken parts; when something that matters is ambiguous, ask one short clarifying question instead of assuming.\n- Pay attention to detail: notice what the user might have missed and gently point it out.\n- Be proactive and divergent: after answering, offer next steps, related ideas, or creative alternatives — without being pushy.\n- Adapt tone to the user; stay natural and flexible, never robotic or formulaic.\n- When you can help by doing, act through tools autonomously (minimal interruption).\n- Structure longer answers clearly: short paragraphs, lists where they help, and a concrete \"what you can do next\" at the end.`,\n\tcoding: `You are an autonomous software engineering agent with a rigor-first mindset.\n- Never guess. Ground every claim in code you have read, commands you have run, or documented evidence; cite file paths and line numbers. If the evidence is insufficient, investigate, and report what is unverified — or \"unknown\" — instead of a plausible invention.\n- First principles: trace problems to the earliest reasonable root cause and fix that; do not patch symptoms.\n- No over-engineering: add no abstraction, options, or defensive handling for imagined future needs; generalise only when a second concrete case demands it.\n- Tests first: pin expected behavior with a failing or updated test before or alongside the fix, then run the smallest sufficient relevant checks; the work is not done until they pass.\n- Reproducible: prefer deterministic tests and mocks over ad-hoc verification, and report the exact commands and results so others can re-run them.\n- Docs as code: repository documentation is part of the change — keep design docs, READMEs, and changelogs consistent with the behavior they describe.\n- Self-review before finishing: re-check your changes for correctness, edge cases, regressions, and missing tests; prefer a second review pass over shipping the first draft.\n- Cautious: weigh side effects, compatibility, and failure modes; when in doubt, take the safer path.`,\n};\n\nexport interface SuiteAssociations {\n\treadonly skills: readonly string[];\n\treadonly mcp: readonly string[];\n\treadonly plugins: readonly string[];\n\t/**\n\t * 子代理角色关联(D-044 角色机制):关联的是 `<agentDir>/roles/<id>.json` 里的角色 id。\n\t * 角色定义只在磁盘上(工厂仅做种子落盘),方案只决定哪些角色对主代理可见——与\n\t * skill/MCP/插件同构,第一方与第三方角色没有区别。\n\t */\n\treadonly roles: readonly string[];\n}\n\nexport interface SuiteClonedFrom {\n\treadonly id: string;\n\treadonly digest: string;\n\treadonly at: number;\n}\n\n/** The serializable suite definition persisted as suite.json (设计 §5). */\nexport interface SuiteDefinition {\n\treadonly schemaVersion: number;\n\treadonly id: string;\n\treadonly name: string;\n\treadonly builtin: boolean;\n\treadonly tools: readonly string[];\n\treadonly capabilities: readonly string[];\n\treadonly associations: SuiteAssociations;\n\treadonly inheritSystemAgentsMd: boolean;\n\treadonly memory: SuiteMemoryStrategy;\n\treadonly orientation: SuiteOrientation;\n\treadonly model: string | null;\n\treadonly thinking: string | null;\n\treadonly clonedFrom: SuiteClonedFrom | null;\n\t/**\n\t * Factory contents revision this declaration was written at (M4). Builtin\n\t * declarations carry it; on-disk builtin suite.json may omit it (pre-M4\n\t * files parse as FACTORY_CONTENTS_VERSION). User suites are outside factory\n\t * upgrade governance: the key stays optional and may be absent.\n\t */\n\treadonly factoryRevision?: number;\n}\n\nconst EMPTY_ASSOCIATIONS: SuiteAssociations = { skills: [], mcp: [], plugins: [], roles: [] };\n\n/**\n * 默认方案关联的子代理角色(开箱即用):这两个 id 对应工厂种子落盘的两个普通角色文件\n * (`<agentDir>/roles/{explore,reviewer}.json`,用户可改可删)。工厂不在运行期回退到任何\n * 编译内的角色定义;删掉文件只会让该关联成为 dangling 诊断。\n */\nexport const DEFAULT_ROLE_ASSOCIATIONS: readonly string[] = [\"explore\", \"reviewer\"];\n\nconst assistantSuite: SuiteDefinition = {\n\tschemaVersion: SUITE_SCHEMA_VERSION,\n\tid: \"assistant\",\n\tname: \"Assistant\",\n\tbuiltin: true,\n\ttools: BUILTIN_SUITE_TOOLS,\n\tcapabilities: BUILTIN_SUITE_CAPABILITIES,\n\tassociations: { ...EMPTY_ASSOCIATIONS, roles: DEFAULT_ROLE_ASSOCIATIONS },\n\tinheritSystemAgentsMd: false,\n\tmemory: \"assistant\",\n\torientation: \"assistant\",\n\tmodel: null,\n\tthinking: null,\n\tclonedFrom: null,\n\tfactoryRevision: FACTORY_CONTENTS_VERSION,\n};\n\nconst codingSuite: SuiteDefinition = {\n\tschemaVersion: SUITE_SCHEMA_VERSION,\n\tid: \"coding\",\n\tname: \"Coding\",\n\tbuiltin: true,\n\ttools: BUILTIN_SUITE_TOOLS,\n\tcapabilities: BUILTIN_SUITE_CAPABILITIES,\n\tassociations: { ...EMPTY_ASSOCIATIONS, roles: DEFAULT_ROLE_ASSOCIATIONS },\n\tinheritSystemAgentsMd: false,\n\tmemory: \"code\",\n\torientation: \"coding\",\n\tmodel: null,\n\tthinking: null,\n\tclonedFrom: null,\n\tfactoryRevision: FACTORY_CONTENTS_VERSION,\n};\n\n/** The factory builtin pair: coding (factory default 尖刀) and assistant (fallback). */\nexport const BUILTIN_SUITES: readonly SuiteDefinition[] = [assistantSuite, codingSuite];\n\nexport function getBuiltinSuite(id: string): SuiteDefinition | undefined {\n\treturn BUILTIN_SUITES.find((suite) => suite.id === id);\n}\n\nexport function isBuiltinSuiteId(id: string): boolean {\n\treturn BUILTIN_SUITES.some((suite) => suite.id === id);\n}\n\nconst WINDOWS_RESERVED_IDS = new Set([\n\t\"con\",\n\t\"prn\",\n\t\"aux\",\n\t\"nul\",\n\t\"com1\",\n\t\"com2\",\n\t\"com3\",\n\t\"com4\",\n\t\"com5\",\n\t\"com6\",\n\t\"com7\",\n\t\"com8\",\n\t\"com9\",\n\t\"lpt1\",\n\t\"lpt2\",\n\t\"lpt3\",\n\t\"lpt4\",\n\t\"lpt5\",\n\t\"lpt6\",\n\t\"lpt7\",\n\t\"lpt8\",\n\t\"lpt9\",\n\t\"conin$\",\n\t\"conout$\",\n]);\n\n/** Suite id rule (设计 §9): `a-z0-9-`, no leading/trailing hyphen, no Windows reserved names. */\nexport function isValidSuiteId(id: string): boolean {\n\tif (id.length === 0 || id.length > SUITE_ID_MAX_LENGTH) return false;\n\tif (!/^[a-z0-9-]+$/.test(id)) return false;\n\tif (id.startsWith(\"-\") || id.endsWith(\"-\")) return false;\n\tif (WINDOWS_RESERVED_IDS.has(id)) return false;\n\treturn true;\n}\n\n/** Serializes a suite to the canonical suite.json text (stable field order, trailing newline). */\nexport function serializeSuiteJson(suite: SuiteDefinition): string {\n\tconst ordered = {\n\t\tschemaVersion: suite.schemaVersion,\n\t\tid: suite.id,\n\t\tname: suite.name,\n\t\tbuiltin: suite.builtin,\n\t\ttools: [...suite.tools],\n\t\tcapabilities: [...suite.capabilities],\n\t\tassociations: {\n\t\t\tskills: [...suite.associations.skills],\n\t\t\tmcp: [...suite.associations.mcp],\n\t\t\tplugins: [...suite.associations.plugins],\n\t\t\troles: [...suite.associations.roles],\n\t\t},\n\t\tinheritSystemAgentsMd: suite.inheritSystemAgentsMd,\n\t\tmemory: suite.memory,\n\t\torientation: suite.orientation,\n\t\tmodel: suite.model,\n\t\tthinking: suite.thinking,\n\t\tclonedFrom: suite.clonedFrom\n\t\t\t? { id: suite.clonedFrom.id, digest: suite.clonedFrom.digest, at: suite.clonedFrom.at }\n\t\t\t: null,\n\t\tfactoryRevision: suite.factoryRevision,\n\t};\n\treturn `${JSON.stringify(ordered, null, 2)}\\n`;\n}\n\nexport interface SuiteJsonParseResult {\n\treadonly valid: boolean;\n\treadonly suite?: SuiteDefinition;\n\treadonly errors: readonly string[];\n}\n\n/**\n * Parses suite.json text. Never throws: an invalid result carries every\n * validation error so callers can apply the corruption policy (设计 §9) —\n * builtin suites fall back to factory content, user suites fail fast.\n */\nexport function parseSuiteJson(\n\traw: string,\n\toptions: { expectedBuiltin?: boolean; expectedId?: string },\n): SuiteJsonParseResult {\n\tlet value: unknown;\n\ttry {\n\t\tvalue = JSON.parse(raw);\n\t} catch (error) {\n\t\treturn {\n\t\t\tvalid: false,\n\t\t\terrors: [`invalid JSON: ${error instanceof Error ? error.message : String(error)}`],\n\t\t};\n\t}\n\treturn validateSuiteJson(value, options);\n}\n\nexport function validateSuiteJson(\n\tvalue: unknown,\n\toptions: { expectedBuiltin?: boolean; expectedId?: string } = {},\n): SuiteJsonParseResult {\n\tif (value === null || typeof value !== \"object\" || Array.isArray(value)) {\n\t\treturn { valid: false, errors: [\"suite.json must be a JSON object\"] };\n\t}\n\tconst record = value as Record<string, unknown>;\n\tconst errors: string[] = [];\n\n\tif (record.schemaVersion !== SUITE_SCHEMA_VERSION) {\n\t\terrors.push(`schemaVersion must be ${SUITE_SCHEMA_VERSION}, found ${JSON.stringify(record.schemaVersion)}`);\n\t}\n\n\t// Each field keeps a typed local: valid values land here, invalid ones only\n\t// contribute errors. The suite below is constructed exclusively when\n\t// `errors` is empty, so the fallbacks/coercions at that point are dead.\n\tconst idValue = record.id;\n\tconst id = typeof idValue === \"string\" && isValidSuiteId(idValue) ? idValue : undefined;\n\tif (id === undefined) {\n\t\terrors.push(\n\t\t\t`id must be a suite id (^[a-z0-9-]+$, no leading/trailing hyphen, Windows reserved names rejected), found ${JSON.stringify(idValue)}`,\n\t\t);\n\t} else if (options.expectedId !== undefined && id !== options.expectedId) {\n\t\terrors.push(`id \"${id}\" does not match the suite workspace directory id \"${options.expectedId}\"`);\n\t}\n\n\tconst nameValue = record.name;\n\tconst name = typeof nameValue === \"string\" && nameValue.trim().length > 0 ? nameValue : undefined;\n\tif (name === undefined) {\n\t\terrors.push(`name must be a non-empty string, found ${JSON.stringify(nameValue)}`);\n\t}\n\n\tconst builtinValue = record.builtin;\n\tconst builtin = typeof builtinValue === \"boolean\" ? builtinValue : undefined;\n\tif (builtin === undefined) {\n\t\terrors.push(`builtin must be a boolean, found ${JSON.stringify(builtinValue)}`);\n\t} else if (options.expectedBuiltin === true && builtin !== true) {\n\t\terrors.push(`builtin must be true for a builtin suite workspace, found ${builtin}`);\n\t}\n\n\tconst tools = readStringArray(record, \"tools\", errors);\n\tconst capabilities = readStringArray(record, \"capabilities\", errors);\n\tconst associations = readAssociations(record.associations, errors);\n\n\tconst inheritValue = record.inheritSystemAgentsMd;\n\tconst inheritSystemAgentsMd = typeof inheritValue === \"boolean\" ? inheritValue : undefined;\n\tif (inheritSystemAgentsMd === undefined) {\n\t\terrors.push(`inheritSystemAgentsMd must be a boolean, found ${JSON.stringify(inheritValue)}`);\n\t}\n\n\tconst memoryValue = record.memory;\n\tconst memory = memoryValue === \"assistant\" || memoryValue === \"code\" ? memoryValue : undefined;\n\tif (memory === undefined) {\n\t\terrors.push(`memory must be \"assistant\" or \"code\", found ${JSON.stringify(memoryValue)}`);\n\t}\n\n\tconst orientationValue = record.orientation;\n\tconst orientation =\n\t\torientationValue === \"assistant\" || orientationValue === \"coding\" || orientationValue === \"custom\"\n\t\t\t? orientationValue\n\t\t\t: undefined;\n\tif (orientationValue !== undefined && orientation === undefined) {\n\t\terrors.push(`orientation must be \"assistant\", \"coding\", or \"custom\", found ${JSON.stringify(orientationValue)}`);\n\t}\n\n\tconst model = readOptionalString(record, \"model\", errors);\n\tconst thinking = readOptionalString(record, \"thinking\", errors);\n\tconst clonedFrom = readClonedFrom(record.clonedFrom, errors);\n\tconst factoryRevision = readFactoryRevision(record.factoryRevision, options.expectedBuiltin === true, errors);\n\n\tif (errors.length > 0) return { valid: false, errors };\n\n\treturn {\n\t\tvalid: true,\n\t\terrors: [],\n\t\tsuite: {\n\t\t\tschemaVersion: SUITE_SCHEMA_VERSION,\n\t\t\tid: id!,\n\t\t\tname: name!,\n\t\t\tbuiltin: builtin!,\n\t\t\ttools,\n\t\t\tcapabilities,\n\t\t\tassociations,\n\t\t\tinheritSystemAgentsMd: inheritSystemAgentsMd!,\n\t\t\tmemory: memory!,\n\t\t\torientation: orientation ?? \"assistant\",\n\t\t\tmodel,\n\t\t\tthinking,\n\t\t\tclonedFrom,\n\t\t\t...(factoryRevision === undefined ? {} : { factoryRevision }),\n\t\t},\n\t};\n}\n\nfunction readStringArray(record: Record<string, unknown>, key: string, errors: string[]): readonly string[] {\n\tconst value = record[key];\n\tif (!Array.isArray(value)) {\n\t\terrors.push(`${key} must be an array of strings, found ${JSON.stringify(value)}`);\n\t\treturn [];\n\t}\n\tconst entries: string[] = [];\n\tconst seen = new Set<string>();\n\tfor (const item of value) {\n\t\tif (typeof item !== \"string\" || item.trim().length === 0) {\n\t\t\terrors.push(`${key} entries must be non-empty strings, found ${JSON.stringify(item)}`);\n\t\t\tcontinue;\n\t\t}\n\t\tif (seen.has(item)) {\n\t\t\terrors.push(`${key} contains duplicate entry \"${item}\"`);\n\t\t\tcontinue;\n\t\t}\n\t\tseen.add(item);\n\t\tentries.push(item);\n\t}\n\treturn entries;\n}\n\nfunction readAssociations(value: unknown, errors: string[]): SuiteAssociations {\n\tif (value === undefined) return { skills: [], mcp: [], plugins: [], roles: [] };\n\tif (value === null || typeof value !== \"object\" || Array.isArray(value)) {\n\t\terrors.push(\n\t\t\t`associations must be an object with skills/mcp/plugins/roles arrays, found ${JSON.stringify(value)}`,\n\t\t);\n\t\treturn { skills: [], mcp: [], plugins: [], roles: [] };\n\t}\n\tconst record = value as Record<string, unknown>;\n\t// A key left out entirely means an empty list, consistent with a fully\n\t// absent `associations` object; a key that is present but malformed still\n\t// reports its errors. The removed legacy `extensions` kind is ignored on\n\t// read (it lost its loader with the old ExtensionAPI surface).\n\treturn {\n\t\tskills: record.skills === undefined ? [] : readStringArray(record, \"skills\", errors),\n\t\tmcp: record.mcp === undefined ? [] : readStringArray(record, \"mcp\", errors),\n\t\tplugins: record.plugins === undefined ? [] : readStringArray(record, \"plugins\", errors),\n\t\troles: record.roles === undefined ? [] : readStringArray(record, \"roles\", errors),\n\t};\n}\n\nfunction readOptionalString(record: Record<string, unknown>, key: string, errors: string[]): string | null {\n\tconst value = record[key];\n\tif (value === undefined || value === null) return null;\n\tif (typeof value !== \"string\" || value.trim().length === 0) {\n\t\terrors.push(`${key} must be a non-empty string or null, found ${JSON.stringify(value)}`);\n\t\treturn null;\n\t}\n\treturn value;\n}\n\n/**\n * Reads the optional `factoryRevision` key (M4). A missing key means\n * FACTORY_CONTENTS_VERSION for builtin workspaces (pre-M4 on-disk files stay\n * compatible) and stays absent for user suites (outside factory upgrade\n * governance). A present key must be a positive integer.\n */\nfunction readFactoryRevision(value: unknown, expectedBuiltin: boolean, errors: string[]): number | undefined {\n\tif (value === undefined) return expectedBuiltin ? FACTORY_CONTENTS_VERSION : undefined;\n\tif (typeof value !== \"number\" || !Number.isSafeInteger(value) || value <= 0) {\n\t\terrors.push(`factoryRevision must be a positive integer, found ${JSON.stringify(value)}`);\n\t\treturn undefined;\n\t}\n\treturn value;\n}\n\nfunction readClonedFrom(value: unknown, errors: string[]): SuiteClonedFrom | null {\n\tif (value === undefined || value === null) return null;\n\tif (typeof value !== \"object\" || Array.isArray(value)) {\n\t\terrors.push(`clonedFrom must be an object with id/digest/at, found ${JSON.stringify(value)}`);\n\t\treturn null;\n\t}\n\tconst record = value as Record<string, unknown>;\n\tif (\n\t\ttypeof record.id !== \"string\" ||\n\t\trecord.id.trim().length === 0 ||\n\t\ttypeof record.digest !== \"string\" ||\n\t\trecord.digest.trim().length === 0 ||\n\t\ttypeof record.at !== \"number\" ||\n\t\t!Number.isSafeInteger(record.at)\n\t) {\n\t\terrors.push(\n\t\t\t`clonedFrom must be an object with non-empty id/digest strings and an integer at, found ${JSON.stringify(value)}`,\n\t\t);\n\t\treturn null;\n\t}\n\treturn { id: record.id, digest: record.digest, at: record.at };\n}\n"]}
|
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
import type { CapabilityAPI } from "@agent-forge/agent-forge";
|
|
16
|
-
import {
|
|
16
|
+
import { defineTool } from "@agent-forge/agent-forge";
|
|
17
|
+
import { createBashTool } from "@agent-forge/plugin-coding-tools";
|
|
17
18
|
|
|
18
19
|
export default function (api: CapabilityAPI) {
|
|
19
20
|
const cwd = process.cwd();
|
|
@@ -26,9 +27,13 @@ export default function (api: CapabilityAPI) {
|
|
|
26
27
|
}),
|
|
27
28
|
});
|
|
28
29
|
|
|
30
|
+
// The plugin package's structural AgentTool keeps the constrained-sampling
|
|
31
|
+
// grammar arm opaque (variants: unknown); bash never sets the flag, so drop
|
|
32
|
+
// the absent member before the host-typed defineTool spread.
|
|
33
|
+
const { constrainedSampling: _omitted, ...bashToolFace } = bashTool;
|
|
29
34
|
api.registerTool(
|
|
30
35
|
defineTool({
|
|
31
|
-
...
|
|
36
|
+
...bashToolFace,
|
|
32
37
|
execute: async (id, params, signal, onUpdate, _ctx) => {
|
|
33
38
|
return bashTool.execute(id, params, signal, onUpdate);
|
|
34
39
|
},
|
|
@@ -30,8 +30,10 @@
|
|
|
30
30
|
* (last load wins, restore on dispose).
|
|
31
31
|
*/
|
|
32
32
|
|
|
33
|
-
import type {
|
|
34
|
-
import {
|
|
33
|
+
import type { CapabilityAPI } from "@agent-forge/agent-forge";
|
|
34
|
+
import { defineTool } from "@agent-forge/agent-forge";
|
|
35
|
+
import type { BashToolDetails, EditToolDetails, ReadToolDetails } from "@agent-forge/plugin-coding-tools";
|
|
36
|
+
import { createBashTool, createEditTool, createReadTool, createWriteTool } from "@agent-forge/plugin-coding-tools";
|
|
35
37
|
import { Text } from "@agent-forge/tui";
|
|
36
38
|
|
|
37
39
|
export default function (api: CapabilityAPI) {
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
25
|
import type { CapabilityAPI } from "@agent-forge/agent-forge";
|
|
26
|
+
import { defineTool } from "@agent-forge/agent-forge";
|
|
26
27
|
import {
|
|
27
28
|
createBashTool,
|
|
28
29
|
createEditTool,
|
|
@@ -31,8 +32,7 @@ import {
|
|
|
31
32
|
createLsTool,
|
|
32
33
|
createReadTool,
|
|
33
34
|
createWriteTool,
|
|
34
|
-
|
|
35
|
-
} from "@agent-forge/agent-forge";
|
|
35
|
+
} from "@agent-forge/plugin-coding-tools";
|
|
36
36
|
import { Text } from "@agent-forge/tui";
|
|
37
37
|
import { homedir } from "os";
|
|
38
38
|
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* 4. Custom rendering of tool calls and results
|
|
13
13
|
*
|
|
14
14
|
* The `rg` tool here wraps ripgrep with proper truncation. Compare this to the
|
|
15
|
-
* built-in `grep` tool in
|
|
15
|
+
* built-in `grep` tool in plugins/coding-tools/src/grep.ts for a more complete implementation.
|
|
16
16
|
*
|
|
17
17
|
* Install: copy this directory (with plugin.json) to ~/.agent-forge/agent/plugins
|
|
18
18
|
* or <cwd>/.agent-forge/plugins for auto-discovery.
|