@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,31 +0,0 @@
|
|
|
1
|
-
import { createRoleCatalog } from "./role-catalog.js";
|
|
2
|
-
import { createRoleRunner, runFirstBatchRole, } from "./role-runner.js";
|
|
3
|
-
/** Assembles registered role metadata into a catalog + runner binding object. */
|
|
4
|
-
export function assembleRoles(input) {
|
|
5
|
-
const catalog = createRoleCatalog(input.roles.map((role) => role.metadata));
|
|
6
|
-
const overrides = new Map(input.roles.flatMap((role) => (role.run ? [[role.metadata.roleId, role.run]] : [])));
|
|
7
|
-
const runner = createRoleRunner({
|
|
8
|
-
catalog,
|
|
9
|
-
...(input.owner === undefined ? {} : { owner: input.owner }),
|
|
10
|
-
...(overrides.size > 0
|
|
11
|
-
? {
|
|
12
|
-
run: ((roleId, runInput, context) => {
|
|
13
|
-
const override = overrides.get(roleId);
|
|
14
|
-
return override ? override(runInput, context) : runFirstBatchRole(roleId, runInput, context);
|
|
15
|
-
}),
|
|
16
|
-
}
|
|
17
|
-
: {}),
|
|
18
|
-
});
|
|
19
|
-
const roleIds = catalog.list().map((role) => role.roleId);
|
|
20
|
-
const missing = roleIds.flatMap((roleId) => runner.checkCapabilities(roleId, input.availableCapabilities).missing);
|
|
21
|
-
return Object.freeze({
|
|
22
|
-
catalog,
|
|
23
|
-
runner,
|
|
24
|
-
roleIds: Object.freeze([...roleIds]),
|
|
25
|
-
capabilityDiagnostics: Object.freeze({
|
|
26
|
-
status: missing.length > 0 ? "missing" : "satisfied",
|
|
27
|
-
missing: Object.freeze(missing),
|
|
28
|
-
}),
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
//# sourceMappingURL=role-assembly.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"role-assembly.js","sourceRoot":"","sources":["../../src/profile/role-assembly.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,iBAAiB,EAA2C,MAAM,mBAAmB,CAAC;AAC/F,OAAO,EACN,gBAAgB,EAKhB,iBAAiB,GACjB,MAAM,kBAAkB,CAAC;AAkC1B,iFAAiF;AACjF,MAAM,UAAU,aAAa,CAAC,KAK7B,EAAkB;IAClB,MAAM,OAAO,GAAG,iBAAiB,CAAC,KAAK,CAAC,KAAK,CAAC,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,KAAK,CAAC,qBAAqB,CAAC,CAAC,OAAO,CAAC,CAAC;IACnH,OAAO,MAAM,CAAC,MAAM,CAAC;QACpB,OAAO;QACP,MAAM;QACN,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC;QACpC,qBAAqB,EAAE,MAAM,CAAC,MAAM,CAAC;YACpC,MAAM,EAAE,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW;YACpD,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC;SAC/B,CAAC;KACF,CAAC,CAAC;AAAA,CACH","sourcesContent":["/**\n * Role assembly (2.2d) — builds a `RoleCatalogV1` plus a role-runner binding\n * from registered role metadata, evaluates every role's REQUIRED capability\n * dependencies against the available capability registry (2.5a structured\n * `missing` diagnostics), and exposes the sorted roleId summary consumed by\n * the code profile package assembly (2.7c). The same input always assembles\n * identically; duplicate roleIds fail explicitly through the catalog.\n */\nimport type { AvailableCapabilityV1 } from \"./dependency-wiring.ts\";\nimport { createRoleCatalog, type RoleCatalogV1, type RoleMetadataV1 } from \"./role-catalog.ts\";\nimport {\n\tcreateRoleRunner,\n\ttype RoleMissingCapabilityV1,\n\ttype RoleRunCallbackV1,\n\ttype RoleRunnerV1,\n\ttype RoleRunResolverV1,\n\trunFirstBatchRole,\n} from \"./role-runner.ts\";\n\n/** One registered role: catalog metadata plus an optional per-role run binding. */\nexport interface RegisteredRoleMetaV1 {\n\treadonly metadata: RoleMetadataV1;\n\t/**\n\t * Optional per-role run override. Run-binding precedence: per-role override\n\t * → deterministic first-batch callback → explicit failure for roles\n\t * without any first-batch callback.\n\t */\n\treadonly run?: RoleRunCallbackV1;\n}\n\n/** Aggregated required-dependency diagnostics across all assembled roles. */\nexport interface RoleAssemblyDiagnosticsV1 {\n\treadonly status: \"satisfied\" | \"missing\";\n\treadonly missing: readonly RoleMissingCapabilityV1[];\n}\n\n/** Assembled role mount: catalog + runner binding + identity summary + diagnostics. */\nexport interface RoleAssemblyV1 {\n\treadonly catalog: RoleCatalogV1;\n\treadonly runner: RoleRunnerV1;\n\t/** Sorted registered roleId summary (package identity/diagnostics surface). */\n\treadonly roleIds: readonly string[];\n\treadonly capabilityDiagnostics: RoleAssemblyDiagnosticsV1;\n}\n\n/** Data-only role mount summary carried by a ready code profile package. */\nexport interface MountedRoleSummaryV1 {\n\treadonly roleIds: readonly string[];\n\treadonly capabilityDiagnostics: RoleAssemblyDiagnosticsV1;\n}\n\n/** Assembles registered role metadata into a catalog + runner binding object. */\nexport function assembleRoles(input: {\n\treadonly roles: readonly RegisteredRoleMetaV1[];\n\treadonly availableCapabilities: readonly AvailableCapabilityV1[];\n\t/** Owner stamped onto produced child definitions (see `createRoleRunner`). */\n\treadonly owner?: string;\n}): RoleAssemblyV1 {\n\tconst catalog = createRoleCatalog(input.roles.map((role) => role.metadata));\n\tconst overrides = new Map<string, RoleRunCallbackV1>(\n\t\tinput.roles.flatMap((role) => (role.run ? [[role.metadata.roleId, role.run] as const] : [])),\n\t);\n\tconst runner = createRoleRunner({\n\t\tcatalog,\n\t\t...(input.owner === undefined ? {} : { owner: input.owner }),\n\t\t...(overrides.size > 0\n\t\t\t? {\n\t\t\t\t\trun: ((roleId, runInput, context) => {\n\t\t\t\t\t\tconst override = overrides.get(roleId);\n\t\t\t\t\t\treturn override ? override(runInput, context) : runFirstBatchRole(roleId, runInput, context);\n\t\t\t\t\t}) satisfies RoleRunResolverV1,\n\t\t\t\t}\n\t\t\t: {}),\n\t});\n\tconst roleIds = catalog.list().map((role) => role.roleId);\n\tconst missing = roleIds.flatMap((roleId) => runner.checkCapabilities(roleId, input.availableCapabilities).missing);\n\treturn Object.freeze({\n\t\tcatalog,\n\t\trunner,\n\t\troleIds: Object.freeze([...roleIds]),\n\t\tcapabilityDiagnostics: Object.freeze({\n\t\t\tstatus: missing.length > 0 ? \"missing\" : \"satisfied\",\n\t\t\tmissing: Object.freeze(missing),\n\t\t}),\n\t});\n}\n"]}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Role metadata catalog (2.2a).
|
|
3
|
-
*
|
|
4
|
-
* Role metadata is DISCOVERY data, not a security policy: roleId, input/output
|
|
5
|
-
* schema references, capability dependencies, writable memory scopes,
|
|
6
|
-
* concurrency, and completion criteria are all discoverable through the
|
|
7
|
-
* catalog. Registered roles are validated and served as detached, frozen
|
|
8
|
-
* snapshots.
|
|
9
|
-
*/
|
|
10
|
-
export type RoleWritableScopeV1 = "session" | "cycle" | "long-term";
|
|
11
|
-
export interface RoleCapabilityDependencyV1 {
|
|
12
|
-
readonly capabilityId: string;
|
|
13
|
-
readonly capabilityVersion: number;
|
|
14
|
-
/** Required dependencies fail role activation when missing. */
|
|
15
|
-
readonly required: boolean;
|
|
16
|
-
}
|
|
17
|
-
/** Versioned input/output schema reference (schema bodies live with the domain plugin). */
|
|
18
|
-
export interface RoleIOSchemaRefV1 {
|
|
19
|
-
readonly schemaId: string;
|
|
20
|
-
readonly schemaVersion: number;
|
|
21
|
-
}
|
|
22
|
-
export interface RoleMetadataV1 {
|
|
23
|
-
readonly roleId: string;
|
|
24
|
-
readonly title: string;
|
|
25
|
-
readonly input: RoleIOSchemaRefV1;
|
|
26
|
-
readonly output: RoleIOSchemaRefV1;
|
|
27
|
-
readonly capabilityDependencies: readonly RoleCapabilityDependencyV1[];
|
|
28
|
-
readonly writableScopes: readonly RoleWritableScopeV1[];
|
|
29
|
-
readonly concurrency: "single" | "parallel";
|
|
30
|
-
readonly completionCriteria: string;
|
|
31
|
-
}
|
|
32
|
-
export interface RoleCatalogV1 {
|
|
33
|
-
register(metadata: RoleMetadataV1): RoleMetadataV1;
|
|
34
|
-
get(roleId: string): RoleMetadataV1 | undefined;
|
|
35
|
-
list(): readonly RoleMetadataV1[];
|
|
36
|
-
/** Roles declaring the given capability as a dependency (required or optional). */
|
|
37
|
-
findByCapability(capabilityId: string): readonly RoleMetadataV1[];
|
|
38
|
-
}
|
|
39
|
-
/** Validates role metadata and returns a detached, frozen snapshot. */
|
|
40
|
-
export declare function validateRoleMetadataV1(value: unknown): RoleMetadataV1;
|
|
41
|
-
/** Discoverable role catalog: register, get, list (sorted), find by capability. */
|
|
42
|
-
export declare function createRoleCatalog(initial?: readonly RoleMetadataV1[]): RoleCatalogV1;
|
|
43
|
-
//# sourceMappingURL=role-catalog.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"role-catalog.d.ts","sourceRoot":"","sources":["../../src/profile/role-catalog.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH,MAAM,MAAM,mBAAmB,GAAG,SAAS,GAAG,OAAO,GAAG,WAAW,CAAC;AAEpE,MAAM,WAAW,0BAA0B;IAC1C,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;IACnC,+DAA+D;IAC/D,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;CAC3B;AAED,2FAA2F;AAC3F,MAAM,WAAW,iBAAiB;IACjC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;CAC/B;AAED,MAAM,WAAW,cAAc;IAC9B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,iBAAiB,CAAC;IAClC,QAAQ,CAAC,MAAM,EAAE,iBAAiB,CAAC;IACnC,QAAQ,CAAC,sBAAsB,EAAE,SAAS,0BAA0B,EAAE,CAAC;IACvE,QAAQ,CAAC,cAAc,EAAE,SAAS,mBAAmB,EAAE,CAAC;IACxD,QAAQ,CAAC,WAAW,EAAE,QAAQ,GAAG,UAAU,CAAC;IAC5C,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAAC;CACpC;AAED,MAAM,WAAW,aAAa;IAC7B,QAAQ,CAAC,QAAQ,EAAE,cAAc,GAAG,cAAc,CAAC;IACnD,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS,CAAC;IAChD,IAAI,IAAI,SAAS,cAAc,EAAE,CAAC;IAClC,mFAAmF;IACnF,gBAAgB,CAAC,YAAY,EAAE,MAAM,GAAG,SAAS,cAAc,EAAE,CAAC;CAClE;AAyBD,uEAAuE;AACvE,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,OAAO,GAAG,cAAc,CA4ErE;AAED,mFAAmF;AACnF,wBAAgB,iBAAiB,CAAC,OAAO,GAAE,SAAS,cAAc,EAAO,GAAG,aAAa,CA8BxF","sourcesContent":["/**\n * Role metadata catalog (2.2a).\n *\n * Role metadata is DISCOVERY data, not a security policy: roleId, input/output\n * schema references, capability dependencies, writable memory scopes,\n * concurrency, and completion criteria are all discoverable through the\n * catalog. Registered roles are validated and served as detached, frozen\n * snapshots.\n */\n\n/** Memory scopes a role may write to (aligned with the 1C.1b store scopes). */\nimport { t } from \"../core/i18n/index.ts\";\n\nexport type RoleWritableScopeV1 = \"session\" | \"cycle\" | \"long-term\";\n\nexport interface RoleCapabilityDependencyV1 {\n\treadonly capabilityId: string;\n\treadonly capabilityVersion: number;\n\t/** Required dependencies fail role activation when missing. */\n\treadonly required: boolean;\n}\n\n/** Versioned input/output schema reference (schema bodies live with the domain plugin). */\nexport interface RoleIOSchemaRefV1 {\n\treadonly schemaId: string;\n\treadonly schemaVersion: number;\n}\n\nexport interface RoleMetadataV1 {\n\treadonly roleId: string;\n\treadonly title: string;\n\treadonly input: RoleIOSchemaRefV1;\n\treadonly output: RoleIOSchemaRefV1;\n\treadonly capabilityDependencies: readonly RoleCapabilityDependencyV1[];\n\treadonly writableScopes: readonly RoleWritableScopeV1[];\n\treadonly concurrency: \"single\" | \"parallel\";\n\treadonly completionCriteria: string;\n}\n\nexport interface RoleCatalogV1 {\n\tregister(metadata: RoleMetadataV1): RoleMetadataV1;\n\tget(roleId: string): RoleMetadataV1 | undefined;\n\tlist(): readonly RoleMetadataV1[];\n\t/** Roles declaring the given capability as a dependency (required or optional). */\n\tfindByCapability(capabilityId: string): readonly RoleMetadataV1[];\n}\n\nconst WRITABLE_SCOPES: readonly RoleWritableScopeV1[] = [\"session\", \"cycle\", \"long-term\"];\n\nfunction assertNonEmptyString(value: unknown, label: string): asserts value is string {\n\tif (typeof value !== \"string\" || value.trim().length === 0)\n\t\tthrow new Error(t(\"{label} must be a non-empty string\", { label }));\n}\n\nfunction assertIOSchemaRef(value: unknown, label: string): RoleIOSchemaRefV1 {\n\tif (value === null || typeof value !== \"object\" || Array.isArray(value)) {\n\t\tthrow new Error(t(\"{label} must be a plain object\", { label }));\n\t}\n\tconst record = value as Record<string, unknown>;\n\tassertNonEmptyString(record.schemaId, `${label}.schemaId`);\n\tif (\n\t\ttypeof record.schemaVersion !== \"number\" ||\n\t\t!Number.isSafeInteger(record.schemaVersion) ||\n\t\trecord.schemaVersion < 1\n\t) {\n\t\tthrow new Error(t(\"{label}.schemaVersion must be a positive safe integer\", { label }));\n\t}\n\treturn Object.freeze({ schemaId: record.schemaId, schemaVersion: record.schemaVersion });\n}\n\n/** Validates role metadata and returns a detached, frozen snapshot. */\nexport function validateRoleMetadataV1(value: unknown): RoleMetadataV1 {\n\tif (value === null || typeof value !== \"object\" || Array.isArray(value)) {\n\t\tthrow new Error(t(\"Role metadata must be a plain object\"));\n\t}\n\tconst record = value as Record<string, unknown>;\n\tconst required = [\n\t\t\"roleId\",\n\t\t\"title\",\n\t\t\"input\",\n\t\t\"output\",\n\t\t\"capabilityDependencies\",\n\t\t\"writableScopes\",\n\t\t\"concurrency\",\n\t\t\"completionCriteria\",\n\t];\n\tfor (const key of required) {\n\t\tif (!(key in record)) throw new Error(t(\"Role metadata is missing required field: {key}\", { key }));\n\t}\n\tconst unsupported = Object.keys(record)\n\t\t.filter((key) => !required.includes(key))\n\t\t.sort();\n\tif (unsupported.length > 0)\n\t\tthrow new Error(t(\"Role metadata has unsupported fields: {fields}\", { fields: unsupported.join(\", \") }));\n\n\tassertNonEmptyString(record.roleId, \"Role metadata.roleId\");\n\tassertNonEmptyString(record.title, \"Role metadata.title\");\n\tconst input = assertIOSchemaRef(record.input, \"Role metadata.input\");\n\tconst output = assertIOSchemaRef(record.output, \"Role metadata.output\");\n\n\tif (!Array.isArray(record.capabilityDependencies)) {\n\t\tthrow new Error(t(\"Role metadata.capabilityDependencies must be an array\"));\n\t}\n\tconst capabilityDependencies = record.capabilityDependencies.map((item, index) => {\n\t\tconst depLabel = `Role metadata.capabilityDependencies[${index}]`;\n\t\tif (item === null || typeof item !== \"object\" || Array.isArray(item)) {\n\t\t\tthrow new Error(t(\"{label} must be a plain object\", { label: depLabel }));\n\t\t}\n\t\tconst dep = item as Record<string, unknown>;\n\t\tassertNonEmptyString(dep.capabilityId, `${depLabel}.capabilityId`);\n\t\tif (\n\t\t\ttypeof dep.capabilityVersion !== \"number\" ||\n\t\t\t!Number.isSafeInteger(dep.capabilityVersion) ||\n\t\t\tdep.capabilityVersion < 1\n\t\t) {\n\t\t\tthrow new Error(t(\"{label}.capabilityVersion must be a positive safe integer\", { label: depLabel }));\n\t\t}\n\t\tif (typeof dep.required !== \"boolean\")\n\t\t\tthrow new Error(t(\"{label}.required must be boolean\", { label: depLabel }));\n\t\treturn Object.freeze({\n\t\t\tcapabilityId: dep.capabilityId,\n\t\t\tcapabilityVersion: dep.capabilityVersion,\n\t\t\trequired: dep.required,\n\t\t});\n\t});\n\n\tif (!Array.isArray(record.writableScopes)) throw new Error(t(\"Role metadata.writableScopes must be an array\"));\n\tfor (const [index, scope] of record.writableScopes.entries()) {\n\t\tif (!WRITABLE_SCOPES.includes(scope as RoleWritableScopeV1)) {\n\t\t\tthrow new Error(t(\"Role metadata.writableScopes[{index}] is invalid\", { index }));\n\t\t}\n\t}\n\tassertNonEmptyString(record.completionCriteria, \"Role metadata.completionCriteria\");\n\tif (record.concurrency !== \"single\" && record.concurrency !== \"parallel\") {\n\t\tthrow new Error(t(\"Role metadata.concurrency is invalid\"));\n\t}\n\n\treturn Object.freeze({\n\t\troleId: record.roleId,\n\t\ttitle: record.title,\n\t\tinput,\n\t\toutput,\n\t\tcapabilityDependencies: Object.freeze(capabilityDependencies),\n\t\twritableScopes: Object.freeze([...(record.writableScopes as readonly RoleWritableScopeV1[])]),\n\t\tconcurrency: record.concurrency as RoleMetadataV1[\"concurrency\"],\n\t\tcompletionCriteria: record.completionCriteria,\n\t});\n}\n\n/** Discoverable role catalog: register, get, list (sorted), find by capability. */\nexport function createRoleCatalog(initial: readonly RoleMetadataV1[] = []): RoleCatalogV1 {\n\tconst roles = new Map<string, RoleMetadataV1>();\n\tfor (const metadata of initial) {\n\t\tconst validated = validateRoleMetadataV1(metadata);\n\t\tif (roles.has(validated.roleId))\n\t\t\tthrow new Error(t(\"Role already registered: {roleId}\", { roleId: validated.roleId }));\n\t\troles.set(validated.roleId, validated);\n\t}\n\treturn {\n\t\tregister(metadata) {\n\t\t\tconst validated = validateRoleMetadataV1(metadata);\n\t\t\tif (roles.has(validated.roleId))\n\t\t\t\tthrow new Error(t(\"Role already registered: {roleId}\", { roleId: validated.roleId }));\n\t\t\troles.set(validated.roleId, validated);\n\t\t\treturn validated;\n\t\t},\n\t\tget(roleId) {\n\t\t\treturn roles.get(roleId);\n\t\t},\n\t\tlist() {\n\t\t\treturn Object.freeze([...roles.values()].sort((left, right) => left.roleId.localeCompare(right.roleId)));\n\t\t},\n\t\tfindByCapability(capabilityId) {\n\t\t\treturn Object.freeze(\n\t\t\t\t[...roles.values()].filter((role) =>\n\t\t\t\t\trole.capabilityDependencies.some((dependency) => dependency.capabilityId === capabilityId),\n\t\t\t\t),\n\t\t\t);\n\t\t},\n\t};\n}\n"]}
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Role metadata catalog (2.2a).
|
|
3
|
-
*
|
|
4
|
-
* Role metadata is DISCOVERY data, not a security policy: roleId, input/output
|
|
5
|
-
* schema references, capability dependencies, writable memory scopes,
|
|
6
|
-
* concurrency, and completion criteria are all discoverable through the
|
|
7
|
-
* catalog. Registered roles are validated and served as detached, frozen
|
|
8
|
-
* snapshots.
|
|
9
|
-
*/
|
|
10
|
-
/** Memory scopes a role may write to (aligned with the 1C.1b store scopes). */
|
|
11
|
-
import { t } from "../core/i18n/index.js";
|
|
12
|
-
const WRITABLE_SCOPES = ["session", "cycle", "long-term"];
|
|
13
|
-
function assertNonEmptyString(value, label) {
|
|
14
|
-
if (typeof value !== "string" || value.trim().length === 0)
|
|
15
|
-
throw new Error(t("{label} must be a non-empty string", { label }));
|
|
16
|
-
}
|
|
17
|
-
function assertIOSchemaRef(value, label) {
|
|
18
|
-
if (value === null || typeof value !== "object" || Array.isArray(value)) {
|
|
19
|
-
throw new Error(t("{label} must be a plain object", { label }));
|
|
20
|
-
}
|
|
21
|
-
const record = value;
|
|
22
|
-
assertNonEmptyString(record.schemaId, `${label}.schemaId`);
|
|
23
|
-
if (typeof record.schemaVersion !== "number" ||
|
|
24
|
-
!Number.isSafeInteger(record.schemaVersion) ||
|
|
25
|
-
record.schemaVersion < 1) {
|
|
26
|
-
throw new Error(t("{label}.schemaVersion must be a positive safe integer", { label }));
|
|
27
|
-
}
|
|
28
|
-
return Object.freeze({ schemaId: record.schemaId, schemaVersion: record.schemaVersion });
|
|
29
|
-
}
|
|
30
|
-
/** Validates role metadata and returns a detached, frozen snapshot. */
|
|
31
|
-
export function validateRoleMetadataV1(value) {
|
|
32
|
-
if (value === null || typeof value !== "object" || Array.isArray(value)) {
|
|
33
|
-
throw new Error(t("Role metadata must be a plain object"));
|
|
34
|
-
}
|
|
35
|
-
const record = value;
|
|
36
|
-
const required = [
|
|
37
|
-
"roleId",
|
|
38
|
-
"title",
|
|
39
|
-
"input",
|
|
40
|
-
"output",
|
|
41
|
-
"capabilityDependencies",
|
|
42
|
-
"writableScopes",
|
|
43
|
-
"concurrency",
|
|
44
|
-
"completionCriteria",
|
|
45
|
-
];
|
|
46
|
-
for (const key of required) {
|
|
47
|
-
if (!(key in record))
|
|
48
|
-
throw new Error(t("Role metadata is missing required field: {key}", { key }));
|
|
49
|
-
}
|
|
50
|
-
const unsupported = Object.keys(record)
|
|
51
|
-
.filter((key) => !required.includes(key))
|
|
52
|
-
.sort();
|
|
53
|
-
if (unsupported.length > 0)
|
|
54
|
-
throw new Error(t("Role metadata has unsupported fields: {fields}", { fields: unsupported.join(", ") }));
|
|
55
|
-
assertNonEmptyString(record.roleId, "Role metadata.roleId");
|
|
56
|
-
assertNonEmptyString(record.title, "Role metadata.title");
|
|
57
|
-
const input = assertIOSchemaRef(record.input, "Role metadata.input");
|
|
58
|
-
const output = assertIOSchemaRef(record.output, "Role metadata.output");
|
|
59
|
-
if (!Array.isArray(record.capabilityDependencies)) {
|
|
60
|
-
throw new Error(t("Role metadata.capabilityDependencies must be an array"));
|
|
61
|
-
}
|
|
62
|
-
const capabilityDependencies = record.capabilityDependencies.map((item, index) => {
|
|
63
|
-
const depLabel = `Role metadata.capabilityDependencies[${index}]`;
|
|
64
|
-
if (item === null || typeof item !== "object" || Array.isArray(item)) {
|
|
65
|
-
throw new Error(t("{label} must be a plain object", { label: depLabel }));
|
|
66
|
-
}
|
|
67
|
-
const dep = item;
|
|
68
|
-
assertNonEmptyString(dep.capabilityId, `${depLabel}.capabilityId`);
|
|
69
|
-
if (typeof dep.capabilityVersion !== "number" ||
|
|
70
|
-
!Number.isSafeInteger(dep.capabilityVersion) ||
|
|
71
|
-
dep.capabilityVersion < 1) {
|
|
72
|
-
throw new Error(t("{label}.capabilityVersion must be a positive safe integer", { label: depLabel }));
|
|
73
|
-
}
|
|
74
|
-
if (typeof dep.required !== "boolean")
|
|
75
|
-
throw new Error(t("{label}.required must be boolean", { label: depLabel }));
|
|
76
|
-
return Object.freeze({
|
|
77
|
-
capabilityId: dep.capabilityId,
|
|
78
|
-
capabilityVersion: dep.capabilityVersion,
|
|
79
|
-
required: dep.required,
|
|
80
|
-
});
|
|
81
|
-
});
|
|
82
|
-
if (!Array.isArray(record.writableScopes))
|
|
83
|
-
throw new Error(t("Role metadata.writableScopes must be an array"));
|
|
84
|
-
for (const [index, scope] of record.writableScopes.entries()) {
|
|
85
|
-
if (!WRITABLE_SCOPES.includes(scope)) {
|
|
86
|
-
throw new Error(t("Role metadata.writableScopes[{index}] is invalid", { index }));
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
assertNonEmptyString(record.completionCriteria, "Role metadata.completionCriteria");
|
|
90
|
-
if (record.concurrency !== "single" && record.concurrency !== "parallel") {
|
|
91
|
-
throw new Error(t("Role metadata.concurrency is invalid"));
|
|
92
|
-
}
|
|
93
|
-
return Object.freeze({
|
|
94
|
-
roleId: record.roleId,
|
|
95
|
-
title: record.title,
|
|
96
|
-
input,
|
|
97
|
-
output,
|
|
98
|
-
capabilityDependencies: Object.freeze(capabilityDependencies),
|
|
99
|
-
writableScopes: Object.freeze([...record.writableScopes]),
|
|
100
|
-
concurrency: record.concurrency,
|
|
101
|
-
completionCriteria: record.completionCriteria,
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
/** Discoverable role catalog: register, get, list (sorted), find by capability. */
|
|
105
|
-
export function createRoleCatalog(initial = []) {
|
|
106
|
-
const roles = new Map();
|
|
107
|
-
for (const metadata of initial) {
|
|
108
|
-
const validated = validateRoleMetadataV1(metadata);
|
|
109
|
-
if (roles.has(validated.roleId))
|
|
110
|
-
throw new Error(t("Role already registered: {roleId}", { roleId: validated.roleId }));
|
|
111
|
-
roles.set(validated.roleId, validated);
|
|
112
|
-
}
|
|
113
|
-
return {
|
|
114
|
-
register(metadata) {
|
|
115
|
-
const validated = validateRoleMetadataV1(metadata);
|
|
116
|
-
if (roles.has(validated.roleId))
|
|
117
|
-
throw new Error(t("Role already registered: {roleId}", { roleId: validated.roleId }));
|
|
118
|
-
roles.set(validated.roleId, validated);
|
|
119
|
-
return validated;
|
|
120
|
-
},
|
|
121
|
-
get(roleId) {
|
|
122
|
-
return roles.get(roleId);
|
|
123
|
-
},
|
|
124
|
-
list() {
|
|
125
|
-
return Object.freeze([...roles.values()].sort((left, right) => left.roleId.localeCompare(right.roleId)));
|
|
126
|
-
},
|
|
127
|
-
findByCapability(capabilityId) {
|
|
128
|
-
return Object.freeze([...roles.values()].filter((role) => role.capabilityDependencies.some((dependency) => dependency.capabilityId === capabilityId)));
|
|
129
|
-
},
|
|
130
|
-
};
|
|
131
|
-
}
|
|
132
|
-
//# sourceMappingURL=role-catalog.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"role-catalog.js","sourceRoot":"","sources":["../../src/profile/role-catalog.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,+EAA+E;AAC/E,OAAO,EAAE,CAAC,EAAE,MAAM,uBAAuB,CAAC;AAoC1C,MAAM,eAAe,GAAmC,CAAC,SAAS,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC;AAE1F,SAAS,oBAAoB,CAAC,KAAc,EAAE,KAAa,EAA2B;IACrF,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC;QACzD,MAAM,IAAI,KAAK,CAAC,CAAC,CAAC,oCAAoC,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;AAAA,CACrE;AAED,SAAS,iBAAiB,CAAC,KAAc,EAAE,KAAa,EAAqB;IAC5E,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACzE,MAAM,IAAI,KAAK,CAAC,CAAC,CAAC,gCAAgC,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;IACjE,CAAC;IACD,MAAM,MAAM,GAAG,KAAgC,CAAC;IAChD,oBAAoB,CAAC,MAAM,CAAC,QAAQ,EAAE,GAAG,KAAK,WAAW,CAA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,GAAG,CAAC,MAAM,EAAE;YACX,OAAO,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QAAA,CACzB;QACD,IAAI,GAAG;YACN,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QAAA,CACzG;QACD,gBAAgB,CAAC,YAAY,EAAE;YAC9B,OAAO,MAAM,CAAC,MAAM,CACnB,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CACnC,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,YAAY,KAAK,YAAY,CAAC,CAC1F,CACD,CAAC;QAAA,CACF;KACD,CAAC;AAAA,CACF","sourcesContent":["/**\n * Role metadata catalog (2.2a).\n *\n * Role metadata is DISCOVERY data, not a security policy: roleId, input/output\n * schema references, capability dependencies, writable memory scopes,\n * concurrency, and completion criteria are all discoverable through the\n * catalog. Registered roles are validated and served as detached, frozen\n * snapshots.\n */\n\n/** Memory scopes a role may write to (aligned with the 1C.1b store scopes). */\nimport { t } from \"../core/i18n/index.ts\";\n\nexport type RoleWritableScopeV1 = \"session\" | \"cycle\" | \"long-term\";\n\nexport interface RoleCapabilityDependencyV1 {\n\treadonly capabilityId: string;\n\treadonly capabilityVersion: number;\n\t/** Required dependencies fail role activation when missing. */\n\treadonly required: boolean;\n}\n\n/** Versioned input/output schema reference (schema bodies live with the domain plugin). */\nexport interface RoleIOSchemaRefV1 {\n\treadonly schemaId: string;\n\treadonly schemaVersion: number;\n}\n\nexport interface RoleMetadataV1 {\n\treadonly roleId: string;\n\treadonly title: string;\n\treadonly input: RoleIOSchemaRefV1;\n\treadonly output: RoleIOSchemaRefV1;\n\treadonly capabilityDependencies: readonly RoleCapabilityDependencyV1[];\n\treadonly writableScopes: readonly RoleWritableScopeV1[];\n\treadonly concurrency: \"single\" | \"parallel\";\n\treadonly completionCriteria: string;\n}\n\nexport interface RoleCatalogV1 {\n\tregister(metadata: RoleMetadataV1): RoleMetadataV1;\n\tget(roleId: string): RoleMetadataV1 | undefined;\n\tlist(): readonly RoleMetadataV1[];\n\t/** Roles declaring the given capability as a dependency (required or optional). */\n\tfindByCapability(capabilityId: string): readonly RoleMetadataV1[];\n}\n\nconst WRITABLE_SCOPES: readonly RoleWritableScopeV1[] = [\"session\", \"cycle\", \"long-term\"];\n\nfunction assertNonEmptyString(value: unknown, label: string): asserts value is string {\n\tif (typeof value !== \"string\" || value.trim().length === 0)\n\t\tthrow new Error(t(\"{label} must be a non-empty string\", { label }));\n}\n\nfunction assertIOSchemaRef(value: unknown, label: string): RoleIOSchemaRefV1 {\n\tif (value === null || typeof value !== \"object\" || Array.isArray(value)) {\n\t\tthrow new Error(t(\"{label} must be a plain object\", { label }));\n\t}\n\tconst record = value as Record<string, unknown>;\n\tassertNonEmptyString(record.schemaId, `${label}.schemaId`);\n\tif (\n\t\ttypeof record.schemaVersion !== \"number\" ||\n\t\t!Number.isSafeInteger(record.schemaVersion) ||\n\t\trecord.schemaVersion < 1\n\t) {\n\t\tthrow new Error(t(\"{label}.schemaVersion must be a positive safe integer\", { label }));\n\t}\n\treturn Object.freeze({ schemaId: record.schemaId, schemaVersion: record.schemaVersion });\n}\n\n/** Validates role metadata and returns a detached, frozen snapshot. */\nexport function validateRoleMetadataV1(value: unknown): RoleMetadataV1 {\n\tif (value === null || typeof value !== \"object\" || Array.isArray(value)) {\n\t\tthrow new Error(t(\"Role metadata must be a plain object\"));\n\t}\n\tconst record = value as Record<string, unknown>;\n\tconst required = [\n\t\t\"roleId\",\n\t\t\"title\",\n\t\t\"input\",\n\t\t\"output\",\n\t\t\"capabilityDependencies\",\n\t\t\"writableScopes\",\n\t\t\"concurrency\",\n\t\t\"completionCriteria\",\n\t];\n\tfor (const key of required) {\n\t\tif (!(key in record)) throw new Error(t(\"Role metadata is missing required field: {key}\", { key }));\n\t}\n\tconst unsupported = Object.keys(record)\n\t\t.filter((key) => !required.includes(key))\n\t\t.sort();\n\tif (unsupported.length > 0)\n\t\tthrow new Error(t(\"Role metadata has unsupported fields: {fields}\", { fields: unsupported.join(\", \") }));\n\n\tassertNonEmptyString(record.roleId, \"Role metadata.roleId\");\n\tassertNonEmptyString(record.title, \"Role metadata.title\");\n\tconst input = assertIOSchemaRef(record.input, \"Role metadata.input\");\n\tconst output = assertIOSchemaRef(record.output, \"Role metadata.output\");\n\n\tif (!Array.isArray(record.capabilityDependencies)) {\n\t\tthrow new Error(t(\"Role metadata.capabilityDependencies must be an array\"));\n\t}\n\tconst capabilityDependencies = record.capabilityDependencies.map((item, index) => {\n\t\tconst depLabel = `Role metadata.capabilityDependencies[${index}]`;\n\t\tif (item === null || typeof item !== \"object\" || Array.isArray(item)) {\n\t\t\tthrow new Error(t(\"{label} must be a plain object\", { label: depLabel }));\n\t\t}\n\t\tconst dep = item as Record<string, unknown>;\n\t\tassertNonEmptyString(dep.capabilityId, `${depLabel}.capabilityId`);\n\t\tif (\n\t\t\ttypeof dep.capabilityVersion !== \"number\" ||\n\t\t\t!Number.isSafeInteger(dep.capabilityVersion) ||\n\t\t\tdep.capabilityVersion < 1\n\t\t) {\n\t\t\tthrow new Error(t(\"{label}.capabilityVersion must be a positive safe integer\", { label: depLabel }));\n\t\t}\n\t\tif (typeof dep.required !== \"boolean\")\n\t\t\tthrow new Error(t(\"{label}.required must be boolean\", { label: depLabel }));\n\t\treturn Object.freeze({\n\t\t\tcapabilityId: dep.capabilityId,\n\t\t\tcapabilityVersion: dep.capabilityVersion,\n\t\t\trequired: dep.required,\n\t\t});\n\t});\n\n\tif (!Array.isArray(record.writableScopes)) throw new Error(t(\"Role metadata.writableScopes must be an array\"));\n\tfor (const [index, scope] of record.writableScopes.entries()) {\n\t\tif (!WRITABLE_SCOPES.includes(scope as RoleWritableScopeV1)) {\n\t\t\tthrow new Error(t(\"Role metadata.writableScopes[{index}] is invalid\", { index }));\n\t\t}\n\t}\n\tassertNonEmptyString(record.completionCriteria, \"Role metadata.completionCriteria\");\n\tif (record.concurrency !== \"single\" && record.concurrency !== \"parallel\") {\n\t\tthrow new Error(t(\"Role metadata.concurrency is invalid\"));\n\t}\n\n\treturn Object.freeze({\n\t\troleId: record.roleId,\n\t\ttitle: record.title,\n\t\tinput,\n\t\toutput,\n\t\tcapabilityDependencies: Object.freeze(capabilityDependencies),\n\t\twritableScopes: Object.freeze([...(record.writableScopes as readonly RoleWritableScopeV1[])]),\n\t\tconcurrency: record.concurrency as RoleMetadataV1[\"concurrency\"],\n\t\tcompletionCriteria: record.completionCriteria,\n\t});\n}\n\n/** Discoverable role catalog: register, get, list (sorted), find by capability. */\nexport function createRoleCatalog(initial: readonly RoleMetadataV1[] = []): RoleCatalogV1 {\n\tconst roles = new Map<string, RoleMetadataV1>();\n\tfor (const metadata of initial) {\n\t\tconst validated = validateRoleMetadataV1(metadata);\n\t\tif (roles.has(validated.roleId))\n\t\t\tthrow new Error(t(\"Role already registered: {roleId}\", { roleId: validated.roleId }));\n\t\troles.set(validated.roleId, validated);\n\t}\n\treturn {\n\t\tregister(metadata) {\n\t\t\tconst validated = validateRoleMetadataV1(metadata);\n\t\t\tif (roles.has(validated.roleId))\n\t\t\t\tthrow new Error(t(\"Role already registered: {roleId}\", { roleId: validated.roleId }));\n\t\t\troles.set(validated.roleId, validated);\n\t\t\treturn validated;\n\t\t},\n\t\tget(roleId) {\n\t\t\treturn roles.get(roleId);\n\t\t},\n\t\tlist() {\n\t\t\treturn Object.freeze([...roles.values()].sort((left, right) => left.roleId.localeCompare(right.roleId)));\n\t\t},\n\t\tfindByCapability(capabilityId) {\n\t\t\treturn Object.freeze(\n\t\t\t\t[...roles.values()].filter((role) =>\n\t\t\t\t\trole.capabilityDependencies.some((dependency) => dependency.capabilityId === capabilityId),\n\t\t\t\t),\n\t\t\t);\n\t\t},\n\t};\n}\n"]}
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Role orchestrator (2.2e) — root-side concurrent orchestration of registered
|
|
3
|
-
* roles with bounded aggregation.
|
|
4
|
-
*
|
|
5
|
-
* Spawns one child per requested roleId through the public
|
|
6
|
-
* `AgentCompositionAPI` (create/lease/run/wait bound to the root via
|
|
7
|
-
* `parentInstanceId`), honoring the role's `RoleMetadataV1.concurrency`
|
|
8
|
-
* metadata: `parallel` roles run concurrently, `single` roles execute one at
|
|
9
|
-
* a time in stable roleId order. Aggregation reuses the multi-agent-tasks 6.3
|
|
10
|
-
* semantics — entries sorted by roleId (never completion order), a per-entry
|
|
11
|
-
* byte budget over the JSON-serialized output (`limitBytes`; over-budget
|
|
12
|
-
* entries are dropped whole with an explicit `truncated` flag, outputs that
|
|
13
|
-
* are absent carry `missing`), and `completionCriteria` metadata checked per
|
|
14
|
-
* role into a structured satisfied/unmet/unchecked list (never thrown).
|
|
15
|
-
* Child failures are collected, never swallowed: a failed child lands in its
|
|
16
|
-
* structured entry while the orchestration still resolves (fail-collect at
|
|
17
|
-
* the orchestration level, not fail-fast).
|
|
18
|
-
*
|
|
19
|
-
* Limit constants: multi-agent-tasks itself has no built-in numeric caps —
|
|
20
|
-
* its `limitBytes`/`maxResultBytes` are caller-injected and default to
|
|
21
|
-
* unbounded. This contract therefore defaults `limitBytes` to 16 KiB, the
|
|
22
|
-
* magnitude of the repo's existing `DEFAULT_MAX_RESULT_BYTES_V1` (office
|
|
23
|
-
* writer). No separate entry cap is added: the multi-agent-tasks aggregate
|
|
24
|
-
* has none either, and the entry count here is already bounded by the
|
|
25
|
-
* explicit `roleIds` list.
|
|
26
|
-
*
|
|
27
|
-
* Honest state-namespace boundary: state namespaces are partitioned per
|
|
28
|
-
* plugin owner, not per child instance. Concurrent children therefore do NOT
|
|
29
|
-
* get per-instance state isolation under this contract. The deterministic
|
|
30
|
-
* injected run callbacks of this milestone never write state, so the boundary
|
|
31
|
-
* is not exercised here; concurrent child state writes remain outside this
|
|
32
|
-
* contract.
|
|
33
|
-
*/
|
|
34
|
-
import type { AgentCompositionAPI } from "../core/extensions/public-api.ts";
|
|
35
|
-
import type { RoleRunCallbackV1, RoleRunnerResultV1, RoleRunnerV1 } from "./role-runner.ts";
|
|
36
|
-
/**
|
|
37
|
-
* Default aggregation byte budget. The multi-agent-tasks aggregate defaults
|
|
38
|
-
* to unbounded (caller-injected limits); this default anchors the contract to
|
|
39
|
-
* the repo's existing 16 KiB result-cap magnitude.
|
|
40
|
-
*/
|
|
41
|
-
export declare const DEFAULT_ROLE_AGGREGATION_LIMIT_BYTES: number;
|
|
42
|
-
/** Terminal instance states an orchestrated child can settle into. */
|
|
43
|
-
export type RoleOrchestrationStatusV1 = "succeeded" | "failed" | "cancelled" | "disposed";
|
|
44
|
-
/** One orchestrated child's aggregation entry (sorted by roleId, never completion order). */
|
|
45
|
-
export interface RoleOrchestrationEntryV1 {
|
|
46
|
-
readonly roleId: string;
|
|
47
|
-
readonly definitionId: string;
|
|
48
|
-
readonly childInstanceId: string;
|
|
49
|
-
/** Terminal revision of the child instance (result reference half, see 2.2b). */
|
|
50
|
-
readonly revision: number;
|
|
51
|
-
readonly status: RoleOrchestrationStatusV1;
|
|
52
|
-
/** The entry's output exceeded the remaining byte budget and was dropped whole. */
|
|
53
|
-
readonly truncated: boolean;
|
|
54
|
-
/** No output was available (failure, cancellation, disposal, or truncation). */
|
|
55
|
-
readonly missing: boolean;
|
|
56
|
-
/** Present only for succeeded entries that fit the byte budget. */
|
|
57
|
-
readonly result?: RoleRunnerResultV1;
|
|
58
|
-
/** Structured failure text; present when the instance settled with an error. */
|
|
59
|
-
readonly error?: string;
|
|
60
|
-
}
|
|
61
|
-
/** Per-role completion-criteria verdict produced at aggregation time (never thrown). */
|
|
62
|
-
export interface RoleCompletionCheckV1 {
|
|
63
|
-
readonly roleId: string;
|
|
64
|
-
readonly criteria: string;
|
|
65
|
-
/**
|
|
66
|
-
* `satisfied`/`unmet` come from an injected evaluator; `unchecked` means no
|
|
67
|
-
* evaluator was available or the entry had no in-budget output to judge.
|
|
68
|
-
*/
|
|
69
|
-
readonly status: "satisfied" | "unmet" | "unchecked";
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Deterministic completion evaluator. Returns `true`/`false` for a verdict or
|
|
73
|
-
* `undefined` when the criteria cannot be judged from the result.
|
|
74
|
-
*/
|
|
75
|
-
export type RoleCompletionEvaluatorV1 = (input: {
|
|
76
|
-
readonly roleId: string;
|
|
77
|
-
readonly criteria: string;
|
|
78
|
-
readonly result: RoleRunnerResultV1;
|
|
79
|
-
}) => boolean | undefined;
|
|
80
|
-
/** One orchestration request: explicit roleIds plus one shared spec string. */
|
|
81
|
-
export interface RoleOrchestratorRunRequestV1 {
|
|
82
|
-
readonly roleIds: readonly string[];
|
|
83
|
-
readonly spec: string;
|
|
84
|
-
/** Per-role run overrides taking precedence for this request only. */
|
|
85
|
-
readonly runs?: readonly {
|
|
86
|
-
readonly roleId: string;
|
|
87
|
-
readonly run: RoleRunCallbackV1;
|
|
88
|
-
}[];
|
|
89
|
-
/** Aggregation byte budget for this request (defaults to the orchestrator option). */
|
|
90
|
-
readonly limitBytes?: number;
|
|
91
|
-
/** Completion evaluator for this request (defaults to the orchestrator option). */
|
|
92
|
-
readonly evaluateCompletion?: RoleCompletionEvaluatorV1;
|
|
93
|
-
}
|
|
94
|
-
export interface RoleOrchestratorOptionsV1 {
|
|
95
|
-
readonly composition: AgentCompositionAPI;
|
|
96
|
-
readonly runner: RoleRunnerV1;
|
|
97
|
-
/** Root instance the children are parented to via `parentInstanceId`. */
|
|
98
|
-
readonly parentInstanceId: string;
|
|
99
|
-
/** Controller-lease owner for the orchestrated children. */
|
|
100
|
-
readonly owner?: string;
|
|
101
|
-
/** Default aggregation byte budget (see {@link DEFAULT_ROLE_AGGREGATION_LIMIT_BYTES}). */
|
|
102
|
-
readonly limitBytes?: number;
|
|
103
|
-
/** Default completion evaluator. Without one every check reports `unchecked`. */
|
|
104
|
-
readonly evaluateCompletion?: RoleCompletionEvaluatorV1;
|
|
105
|
-
}
|
|
106
|
-
/** Orchestration result: bounded aggregation plus completion verdicts. */
|
|
107
|
-
export interface RoleOrchestrationResultV1 {
|
|
108
|
-
/** One entry per requested role, sorted by roleId (stable, never completion order). */
|
|
109
|
-
readonly entries: readonly RoleOrchestrationEntryV1[];
|
|
110
|
-
/** True when at least one entry was dropped for exceeding the byte budget. */
|
|
111
|
-
readonly truncated: boolean;
|
|
112
|
-
/** Completion verdicts per requested role, sorted by roleId. */
|
|
113
|
-
readonly completionChecks: readonly RoleCompletionCheckV1[];
|
|
114
|
-
}
|
|
115
|
-
export interface RoleOrchestratorV1 {
|
|
116
|
-
readonly composition: AgentCompositionAPI;
|
|
117
|
-
readonly runner: RoleRunnerV1;
|
|
118
|
-
readonly parentInstanceId: string;
|
|
119
|
-
runRoles(request: RoleOrchestratorRunRequestV1): Promise<RoleOrchestrationResultV1>;
|
|
120
|
-
}
|
|
121
|
-
/** Creates the root-side concurrent role orchestrator (2.2e). */
|
|
122
|
-
export declare function createRoleOrchestrator(options: RoleOrchestratorOptionsV1): RoleOrchestratorV1;
|
|
123
|
-
//# sourceMappingURL=role-orchestrator.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"role-orchestrator.d.ts","sourceRoot":"","sources":["../../src/profile/role-orchestrator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,OAAO,KAAK,EAAE,mBAAmB,EAAmB,MAAM,kCAAkC,CAAC;AAG7F,OAAO,KAAK,EAAE,iBAAiB,EAAqB,kBAAkB,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAE/G;;;;GAIG;AACH,eAAO,MAAM,oCAAoC,QAAY,CAAC;AAE9D,sEAA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B,GAAG,kBAAkB,CA6L7F","sourcesContent":["/**\n * Role orchestrator (2.2e) — root-side concurrent orchestration of registered\n * roles with bounded aggregation.\n *\n * Spawns one child per requested roleId through the public\n * `AgentCompositionAPI` (create/lease/run/wait bound to the root via\n * `parentInstanceId`), honoring the role's `RoleMetadataV1.concurrency`\n * metadata: `parallel` roles run concurrently, `single` roles execute one at\n * a time in stable roleId order. Aggregation reuses the multi-agent-tasks 6.3\n * semantics — entries sorted by roleId (never completion order), a per-entry\n * byte budget over the JSON-serialized output (`limitBytes`; over-budget\n * entries are dropped whole with an explicit `truncated` flag, outputs that\n * are absent carry `missing`), and `completionCriteria` metadata checked per\n * role into a structured satisfied/unmet/unchecked list (never thrown).\n * Child failures are collected, never swallowed: a failed child lands in its\n * structured entry while the orchestration still resolves (fail-collect at\n * the orchestration level, not fail-fast).\n *\n * Limit constants: multi-agent-tasks itself has no built-in numeric caps —\n * its `limitBytes`/`maxResultBytes` are caller-injected and default to\n * unbounded. This contract therefore defaults `limitBytes` to 16 KiB, the\n * magnitude of the repo's existing `DEFAULT_MAX_RESULT_BYTES_V1` (office\n * writer). No separate entry cap is added: the multi-agent-tasks aggregate\n * has none either, and the entry count here is already bounded by the\n * explicit `roleIds` list.\n *\n * Honest state-namespace boundary: state namespaces are partitioned per\n * plugin owner, not per child instance. Concurrent children therefore do NOT\n * get per-instance state isolation under this contract. The deterministic\n * injected run callbacks of this milestone never write state, so the boundary\n * is not exercised here; concurrent child state writes remain outside this\n * contract.\n */\nimport type { AgentCompositionAPI, AgentDefinition } from \"../core/extensions/public-api.ts\";\nimport { t } from \"../core/i18n/index.ts\";\nimport type { RoleMetadataV1 } from \"./role-catalog.ts\";\nimport type { RoleRunCallbackV1, RoleRunnerInputV1, RoleRunnerResultV1, RoleRunnerV1 } from \"./role-runner.ts\";\n\n/**\n * Default aggregation byte budget. The multi-agent-tasks aggregate defaults\n * to unbounded (caller-injected limits); this default anchors the contract to\n * the repo's existing 16 KiB result-cap magnitude.\n */\nexport const DEFAULT_ROLE_AGGREGATION_LIMIT_BYTES = 16 * 1024;\n\n/** Terminal instance states an orchestrated child can settle into. */\nexport type RoleOrchestrationStatusV1 = \"succeeded\" | \"failed\" | \"cancelled\" | \"disposed\";\n\n/** One orchestrated child's aggregation entry (sorted by roleId, never completion order). */\nexport interface RoleOrchestrationEntryV1 {\n\treadonly roleId: string;\n\treadonly definitionId: string;\n\treadonly childInstanceId: string;\n\t/** Terminal revision of the child instance (result reference half, see 2.2b). */\n\treadonly revision: number;\n\treadonly status: RoleOrchestrationStatusV1;\n\t/** The entry's output exceeded the remaining byte budget and was dropped whole. */\n\treadonly truncated: boolean;\n\t/** No output was available (failure, cancellation, disposal, or truncation). */\n\treadonly missing: boolean;\n\t/** Present only for succeeded entries that fit the byte budget. */\n\treadonly result?: RoleRunnerResultV1;\n\t/** Structured failure text; present when the instance settled with an error. */\n\treadonly error?: string;\n}\n\n/** Per-role completion-criteria verdict produced at aggregation time (never thrown). */\nexport interface RoleCompletionCheckV1 {\n\treadonly roleId: string;\n\treadonly criteria: string;\n\t/**\n\t * `satisfied`/`unmet` come from an injected evaluator; `unchecked` means no\n\t * evaluator was available or the entry had no in-budget output to judge.\n\t */\n\treadonly status: \"satisfied\" | \"unmet\" | \"unchecked\";\n}\n\n/**\n * Deterministic completion evaluator. Returns `true`/`false` for a verdict or\n * `undefined` when the criteria cannot be judged from the result.\n */\nexport type RoleCompletionEvaluatorV1 = (input: {\n\treadonly roleId: string;\n\treadonly criteria: string;\n\treadonly result: RoleRunnerResultV1;\n}) => boolean | undefined;\n\n/** One orchestration request: explicit roleIds plus one shared spec string. */\nexport interface RoleOrchestratorRunRequestV1 {\n\treadonly roleIds: readonly string[];\n\treadonly spec: string;\n\t/** Per-role run overrides taking precedence for this request only. */\n\treadonly runs?: readonly { readonly roleId: string; readonly run: RoleRunCallbackV1 }[];\n\t/** Aggregation byte budget for this request (defaults to the orchestrator option). */\n\treadonly limitBytes?: number;\n\t/** Completion evaluator for this request (defaults to the orchestrator option). */\n\treadonly evaluateCompletion?: RoleCompletionEvaluatorV1;\n}\n\nexport interface RoleOrchestratorOptionsV1 {\n\treadonly composition: AgentCompositionAPI;\n\treadonly runner: RoleRunnerV1;\n\t/** Root instance the children are parented to via `parentInstanceId`. */\n\treadonly parentInstanceId: string;\n\t/** Controller-lease owner for the orchestrated children. */\n\treadonly owner?: string;\n\t/** Default aggregation byte budget (see {@link DEFAULT_ROLE_AGGREGATION_LIMIT_BYTES}). */\n\treadonly limitBytes?: number;\n\t/** Default completion evaluator. Without one every check reports `unchecked`. */\n\treadonly evaluateCompletion?: RoleCompletionEvaluatorV1;\n}\n\n/** Orchestration result: bounded aggregation plus completion verdicts. */\nexport interface RoleOrchestrationResultV1 {\n\t/** One entry per requested role, sorted by roleId (stable, never completion order). */\n\treadonly entries: readonly RoleOrchestrationEntryV1[];\n\t/** True when at least one entry was dropped for exceeding the byte budget. */\n\treadonly truncated: boolean;\n\t/** Completion verdicts per requested role, sorted by roleId. */\n\treadonly completionChecks: readonly RoleCompletionCheckV1[];\n}\n\nexport interface RoleOrchestratorV1 {\n\treadonly composition: AgentCompositionAPI;\n\treadonly runner: RoleRunnerV1;\n\treadonly parentInstanceId: string;\n\trunRoles(request: RoleOrchestratorRunRequestV1): Promise<RoleOrchestrationResultV1>;\n}\n\nconst DEFAULT_ORCHESTRATION_OWNER = \"role-orchestrator\";\n\ninterface SettledChildV1 {\n\treadonly roleId: string;\n\treadonly definitionId: string;\n\treadonly childInstanceId: string;\n\treadonly revision: number;\n\treadonly status: RoleOrchestrationStatusV1;\n\treadonly output?: RoleRunnerResultV1;\n\treadonly error?: string;\n}\n\n/** Creates the root-side concurrent role orchestrator (2.2e). */\nexport function createRoleOrchestrator(options: RoleOrchestratorOptionsV1): RoleOrchestratorV1 {\n\tconst owner = options.owner ?? DEFAULT_ORCHESTRATION_OWNER;\n\t// Definitions are registered once per roleId and reused across runs: a\n\t// composition instance is single-run, so every orchestration creates fresh\n\t// child instances from the same definitions.\n\tconst definitions = new Map<string, AgentDefinition<RoleRunnerInputV1, RoleRunnerResultV1>>();\n\tlet activeOverrides: ReadonlyMap<string, RoleRunCallbackV1> = new Map();\n\tlet runInFlight = false;\n\n\tfunction requireMetadata(roleId: string): RoleMetadataV1 {\n\t\tconst metadata = options.runner.catalog.get(roleId);\n\t\tif (!metadata) throw new Error(t(\"Unknown role: {roleId}\", { roleId }));\n\t\treturn metadata;\n\t}\n\n\tfunction definitionFor(roleId: string): AgentDefinition<RoleRunnerInputV1, RoleRunnerResultV1> {\n\t\tconst cached = definitions.get(roleId);\n\t\tif (cached) return cached;\n\t\tconst base = options.runner.createDefinition(roleId);\n\t\tconst definition: AgentDefinition<RoleRunnerInputV1, RoleRunnerResultV1> = {\n\t\t\t...base,\n\t\t\trun: (input, context) => {\n\t\t\t\tconst override = activeOverrides.get(roleId);\n\t\t\t\treturn override ? override(input, context) : options.runner.run(roleId, input, context);\n\t\t\t},\n\t\t};\n\t\tconst registered = options.composition.define(definition);\n\t\tdefinitions.set(roleId, registered);\n\t\treturn registered;\n\t}\n\n\tasync function runOne(roleId: string, spec: string, settled: Map<string, SettledChildV1>): Promise<void> {\n\t\tconst definition = definitionFor(roleId);\n\t\tconst instance = options.composition.create<RoleRunnerInputV1, RoleRunnerResultV1>(\n\t\t\t{ id: definition.id, version: definition.version },\n\t\t\t{ parentInstanceId: options.parentInstanceId },\n\t\t);\n\t\tconst childInstanceId = instance.id;\n\t\tconst lease = await instance.acquireControllerLease(owner);\n\t\ttry {\n\t\t\tconst operation = instance.run({ spec }, { lease });\n\t\t\ttry {\n\t\t\t\tawait operation.result;\n\t\t\t} catch {\n\t\t\t\t// run() rejects on failure/cancellation mid-flight; instance.wait()\n\t\t\t\t// below yields the terminal status and error.\n\t\t\t}\n\t\t\tconst terminal = await instance.wait();\n\t\t\tconst error =\n\t\t\t\tterminal.error === undefined\n\t\t\t\t\t? undefined\n\t\t\t\t\t: terminal.error instanceof Error\n\t\t\t\t\t\t? terminal.error.message\n\t\t\t\t\t\t: String(terminal.error);\n\t\t\tsettled.set(roleId, {\n\t\t\t\troleId,\n\t\t\t\tdefinitionId: definition.id,\n\t\t\t\tchildInstanceId,\n\t\t\t\trevision: terminal.revision,\n\t\t\t\tstatus: terminal.status,\n\t\t\t\t...(terminal.output !== undefined ? { output: terminal.output } : {}),\n\t\t\t\t...(error !== undefined ? { error } : {}),\n\t\t\t});\n\t\t} finally {\n\t\t\tif (lease.isActive()) await lease.release();\n\t\t}\n\t}\n\n\tasync function runRoles(request: RoleOrchestratorRunRequestV1): Promise<RoleOrchestrationResultV1> {\n\t\tif (runInFlight) throw new Error(t(\"Role orchestrator is already running an orchestration\"));\n\t\t// Input validation fails explicitly before any child is spawned.\n\t\tconst seen = new Set<string>();\n\t\tfor (const roleId of request.roleIds) {\n\t\t\tif (typeof roleId !== \"string\" || roleId.trim().length === 0) {\n\t\t\t\tthrow new Error(t(\"Role id must be a non-empty string\"));\n\t\t\t}\n\t\t\tif (seen.has(roleId)) throw new Error(t(\"Duplicate roleId in orchestration request: {roleId}\", { roleId }));\n\t\t\tseen.add(roleId);\n\t\t}\n\t\tconst overrides = new Map<string, RoleRunCallbackV1>();\n\t\tfor (const override of request.runs ?? []) {\n\t\t\tif (overrides.has(override.roleId))\n\t\t\t\tthrow new Error(t(\"Duplicate run override for role: {roleId}\", { roleId: override.roleId }));\n\t\t\toverrides.set(override.roleId, override.run);\n\t\t}\n\t\tfor (const roleId of overrides.keys()) {\n\t\t\tif (!seen.has(roleId)) throw new Error(t(\"Run override for unrequested role: {roleId}\", { roleId }));\n\t\t}\n\t\t// Stable execution order: roleId-sorted, `parallel` roles concurrent,\n\t\t// `single` roles strictly sequential. Aggregation order is independent\n\t\t// of this execution order.\n\t\tconst sorted = [...request.roleIds].sort((left, right) => left.localeCompare(right));\n\t\tfor (const roleId of sorted) {\n\t\t\trequireMetadata(roleId);\n\t\t\tdefinitionFor(roleId);\n\t\t}\n\n\t\trunInFlight = true;\n\t\ttry {\n\t\t\tactiveOverrides = overrides;\n\t\t\tconst settled = new Map<string, SettledChildV1>();\n\t\t\tif (sorted.length > 0) {\n\t\t\t\tconst parallelIds = sorted.filter((roleId) => requireMetadata(roleId).concurrency === \"parallel\");\n\t\t\t\tconst singleIds = sorted.filter((roleId) => requireMetadata(roleId).concurrency === \"single\");\n\t\t\t\tawait Promise.all(parallelIds.map((roleId) => runOne(roleId, request.spec, settled)));\n\t\t\t\tfor (const roleId of singleIds) await runOne(roleId, request.spec, settled);\n\t\t\t}\n\t\t\treturn aggregate(sorted, settled, request);\n\t\t} finally {\n\t\t\tactiveOverrides = new Map();\n\t\t\trunInFlight = false;\n\t\t}\n\t}\n\n\tfunction aggregate(\n\t\tsorted: readonly string[],\n\t\tsettled: ReadonlyMap<string, SettledChildV1>,\n\t\trequest: RoleOrchestratorRunRequestV1,\n\t): RoleOrchestrationResultV1 {\n\t\tconst limitBytes = request.limitBytes ?? options.limitBytes ?? DEFAULT_ROLE_AGGREGATION_LIMIT_BYTES;\n\t\t// 6.3 budget semantics: a running byte total over roleId-sorted entries;\n\t\t// an entry that would exceed the budget is dropped whole (truncated),\n\t\t// never partially sliced — mirroring multi-agent-tasks aggregate().\n\t\tlet used = 0;\n\t\tlet truncated = false;\n\t\tconst frozenEntries = sorted.map((roleId): RoleOrchestrationEntryV1 => {\n\t\t\tconst outcome = settled.get(roleId);\n\t\t\tif (!outcome) throw new Error(t(\"Orchestration outcome missing for role: {roleId}\", { roleId }));\n\t\t\tconst base = {\n\t\t\t\troleId: outcome.roleId,\n\t\t\t\tdefinitionId: outcome.definitionId,\n\t\t\t\tchildInstanceId: outcome.childInstanceId,\n\t\t\t\trevision: outcome.revision,\n\t\t\t\tstatus: outcome.status,\n\t\t\t};\n\t\t\tif (outcome.status !== \"succeeded\" || outcome.output === undefined) {\n\t\t\t\treturn Object.freeze({\n\t\t\t\t\t...base,\n\t\t\t\t\ttruncated: false,\n\t\t\t\t\tmissing: true,\n\t\t\t\t\t...(outcome.error !== undefined ? { error: outcome.error } : {}),\n\t\t\t\t});\n\t\t\t}\n\t\t\tconst size = JSON.stringify(outcome.output).length;\n\t\t\tif (used + size > limitBytes) {\n\t\t\t\ttruncated = true;\n\t\t\t\treturn Object.freeze({ ...base, truncated: true, missing: false });\n\t\t\t}\n\t\t\tused += size;\n\t\t\treturn Object.freeze({ ...base, truncated: false, missing: false, result: outcome.output });\n\t\t});\n\t\tconst entryByRole = new Map(frozenEntries.map((entry) => [entry.roleId, entry]));\n\t\tconst evaluate = request.evaluateCompletion ?? options.evaluateCompletion;\n\t\tconst frozenChecks = sorted.map((roleId): RoleCompletionCheckV1 => {\n\t\t\tconst criteria = requireMetadata(roleId).completionCriteria;\n\t\t\tconst outcome = settled.get(roleId);\n\t\t\tconst entry = entryByRole.get(roleId);\n\t\t\tconst output = outcome?.output;\n\t\t\t// No evaluator, no output, or an output dropped by the byte budget:\n\t\t\t// the criteria cannot be judged, which is reported as unchecked\n\t\t\t// instead of being silently treated as satisfied or unmet.\n\t\t\tif (!evaluate || !output || entry?.truncated === true) {\n\t\t\t\treturn Object.freeze({ roleId, criteria, status: \"unchecked\" as const });\n\t\t\t}\n\t\t\tconst verdict = evaluate({ roleId, criteria, result: output });\n\t\t\treturn Object.freeze({\n\t\t\t\troleId,\n\t\t\t\tcriteria,\n\t\t\t\tstatus:\n\t\t\t\t\tverdict === true\n\t\t\t\t\t\t? (\"satisfied\" as const)\n\t\t\t\t\t\t: verdict === false\n\t\t\t\t\t\t\t? (\"unmet\" as const)\n\t\t\t\t\t\t\t: (\"unchecked\" as const),\n\t\t\t});\n\t\t});\n\t\treturn Object.freeze({\n\t\t\tentries: Object.freeze(frozenEntries),\n\t\t\ttruncated,\n\t\t\tcompletionChecks: Object.freeze(frozenChecks),\n\t\t});\n\t}\n\n\treturn {\n\t\tcomposition: options.composition,\n\t\trunner: options.runner,\n\t\tparentInstanceId: options.parentInstanceId,\n\t\trunRoles,\n\t};\n}\n"]}
|
|
@@ -1,195 +0,0 @@
|
|
|
1
|
-
import { t } from "../core/i18n/index.js";
|
|
2
|
-
/**
|
|
3
|
-
* Default aggregation byte budget. The multi-agent-tasks aggregate defaults
|
|
4
|
-
* to unbounded (caller-injected limits); this default anchors the contract to
|
|
5
|
-
* the repo's existing 16 KiB result-cap magnitude.
|
|
6
|
-
*/
|
|
7
|
-
export const DEFAULT_ROLE_AGGREGATION_LIMIT_BYTES = 16 * 1024;
|
|
8
|
-
const DEFAULT_ORCHESTRATION_OWNER = "role-orchestrator";
|
|
9
|
-
/** Creates the root-side concurrent role orchestrator (2.2e). */
|
|
10
|
-
export function createRoleOrchestrator(options) {
|
|
11
|
-
const owner = options.owner ?? DEFAULT_ORCHESTRATION_OWNER;
|
|
12
|
-
// Definitions are registered once per roleId and reused across runs: a
|
|
13
|
-
// composition instance is single-run, so every orchestration creates fresh
|
|
14
|
-
// child instances from the same definitions.
|
|
15
|
-
const definitions = new Map();
|
|
16
|
-
let activeOverrides = new Map();
|
|
17
|
-
let runInFlight = false;
|
|
18
|
-
function requireMetadata(roleId) {
|
|
19
|
-
const metadata = options.runner.catalog.get(roleId);
|
|
20
|
-
if (!metadata)
|
|
21
|
-
throw new Error(t("Unknown role: {roleId}", { roleId }));
|
|
22
|
-
return metadata;
|
|
23
|
-
}
|
|
24
|
-
function definitionFor(roleId) {
|
|
25
|
-
const cached = definitions.get(roleId);
|
|
26
|
-
if (cached)
|
|
27
|
-
return cached;
|
|
28
|
-
const base = options.runner.createDefinition(roleId);
|
|
29
|
-
const definition = {
|
|
30
|
-
...base,
|
|
31
|
-
run: (input, context) => {
|
|
32
|
-
const override = activeOverrides.get(roleId);
|
|
33
|
-
return override ? override(input, context) : options.runner.run(roleId, input, context);
|
|
34
|
-
},
|
|
35
|
-
};
|
|
36
|
-
const registered = options.composition.define(definition);
|
|
37
|
-
definitions.set(roleId, registered);
|
|
38
|
-
return registered;
|
|
39
|
-
}
|
|
40
|
-
async function runOne(roleId, spec, settled) {
|
|
41
|
-
const definition = definitionFor(roleId);
|
|
42
|
-
const instance = options.composition.create({ id: definition.id, version: definition.version }, { parentInstanceId: options.parentInstanceId });
|
|
43
|
-
const childInstanceId = instance.id;
|
|
44
|
-
const lease = await instance.acquireControllerLease(owner);
|
|
45
|
-
try {
|
|
46
|
-
const operation = instance.run({ spec }, { lease });
|
|
47
|
-
try {
|
|
48
|
-
await operation.result;
|
|
49
|
-
}
|
|
50
|
-
catch {
|
|
51
|
-
// run() rejects on failure/cancellation mid-flight; instance.wait()
|
|
52
|
-
// below yields the terminal status and error.
|
|
53
|
-
}
|
|
54
|
-
const terminal = await instance.wait();
|
|
55
|
-
const error = terminal.error === undefined
|
|
56
|
-
? undefined
|
|
57
|
-
: terminal.error instanceof Error
|
|
58
|
-
? terminal.error.message
|
|
59
|
-
: String(terminal.error);
|
|
60
|
-
settled.set(roleId, {
|
|
61
|
-
roleId,
|
|
62
|
-
definitionId: definition.id,
|
|
63
|
-
childInstanceId,
|
|
64
|
-
revision: terminal.revision,
|
|
65
|
-
status: terminal.status,
|
|
66
|
-
...(terminal.output !== undefined ? { output: terminal.output } : {}),
|
|
67
|
-
...(error !== undefined ? { error } : {}),
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
finally {
|
|
71
|
-
if (lease.isActive())
|
|
72
|
-
await lease.release();
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
async function runRoles(request) {
|
|
76
|
-
if (runInFlight)
|
|
77
|
-
throw new Error(t("Role orchestrator is already running an orchestration"));
|
|
78
|
-
// Input validation fails explicitly before any child is spawned.
|
|
79
|
-
const seen = new Set();
|
|
80
|
-
for (const roleId of request.roleIds) {
|
|
81
|
-
if (typeof roleId !== "string" || roleId.trim().length === 0) {
|
|
82
|
-
throw new Error(t("Role id must be a non-empty string"));
|
|
83
|
-
}
|
|
84
|
-
if (seen.has(roleId))
|
|
85
|
-
throw new Error(t("Duplicate roleId in orchestration request: {roleId}", { roleId }));
|
|
86
|
-
seen.add(roleId);
|
|
87
|
-
}
|
|
88
|
-
const overrides = new Map();
|
|
89
|
-
for (const override of request.runs ?? []) {
|
|
90
|
-
if (overrides.has(override.roleId))
|
|
91
|
-
throw new Error(t("Duplicate run override for role: {roleId}", { roleId: override.roleId }));
|
|
92
|
-
overrides.set(override.roleId, override.run);
|
|
93
|
-
}
|
|
94
|
-
for (const roleId of overrides.keys()) {
|
|
95
|
-
if (!seen.has(roleId))
|
|
96
|
-
throw new Error(t("Run override for unrequested role: {roleId}", { roleId }));
|
|
97
|
-
}
|
|
98
|
-
// Stable execution order: roleId-sorted, `parallel` roles concurrent,
|
|
99
|
-
// `single` roles strictly sequential. Aggregation order is independent
|
|
100
|
-
// of this execution order.
|
|
101
|
-
const sorted = [...request.roleIds].sort((left, right) => left.localeCompare(right));
|
|
102
|
-
for (const roleId of sorted) {
|
|
103
|
-
requireMetadata(roleId);
|
|
104
|
-
definitionFor(roleId);
|
|
105
|
-
}
|
|
106
|
-
runInFlight = true;
|
|
107
|
-
try {
|
|
108
|
-
activeOverrides = overrides;
|
|
109
|
-
const settled = new Map();
|
|
110
|
-
if (sorted.length > 0) {
|
|
111
|
-
const parallelIds = sorted.filter((roleId) => requireMetadata(roleId).concurrency === "parallel");
|
|
112
|
-
const singleIds = sorted.filter((roleId) => requireMetadata(roleId).concurrency === "single");
|
|
113
|
-
await Promise.all(parallelIds.map((roleId) => runOne(roleId, request.spec, settled)));
|
|
114
|
-
for (const roleId of singleIds)
|
|
115
|
-
await runOne(roleId, request.spec, settled);
|
|
116
|
-
}
|
|
117
|
-
return aggregate(sorted, settled, request);
|
|
118
|
-
}
|
|
119
|
-
finally {
|
|
120
|
-
activeOverrides = new Map();
|
|
121
|
-
runInFlight = false;
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
function aggregate(sorted, settled, request) {
|
|
125
|
-
const limitBytes = request.limitBytes ?? options.limitBytes ?? DEFAULT_ROLE_AGGREGATION_LIMIT_BYTES;
|
|
126
|
-
// 6.3 budget semantics: a running byte total over roleId-sorted entries;
|
|
127
|
-
// an entry that would exceed the budget is dropped whole (truncated),
|
|
128
|
-
// never partially sliced — mirroring multi-agent-tasks aggregate().
|
|
129
|
-
let used = 0;
|
|
130
|
-
let truncated = false;
|
|
131
|
-
const frozenEntries = sorted.map((roleId) => {
|
|
132
|
-
const outcome = settled.get(roleId);
|
|
133
|
-
if (!outcome)
|
|
134
|
-
throw new Error(t("Orchestration outcome missing for role: {roleId}", { roleId }));
|
|
135
|
-
const base = {
|
|
136
|
-
roleId: outcome.roleId,
|
|
137
|
-
definitionId: outcome.definitionId,
|
|
138
|
-
childInstanceId: outcome.childInstanceId,
|
|
139
|
-
revision: outcome.revision,
|
|
140
|
-
status: outcome.status,
|
|
141
|
-
};
|
|
142
|
-
if (outcome.status !== "succeeded" || outcome.output === undefined) {
|
|
143
|
-
return Object.freeze({
|
|
144
|
-
...base,
|
|
145
|
-
truncated: false,
|
|
146
|
-
missing: true,
|
|
147
|
-
...(outcome.error !== undefined ? { error: outcome.error } : {}),
|
|
148
|
-
});
|
|
149
|
-
}
|
|
150
|
-
const size = JSON.stringify(outcome.output).length;
|
|
151
|
-
if (used + size > limitBytes) {
|
|
152
|
-
truncated = true;
|
|
153
|
-
return Object.freeze({ ...base, truncated: true, missing: false });
|
|
154
|
-
}
|
|
155
|
-
used += size;
|
|
156
|
-
return Object.freeze({ ...base, truncated: false, missing: false, result: outcome.output });
|
|
157
|
-
});
|
|
158
|
-
const entryByRole = new Map(frozenEntries.map((entry) => [entry.roleId, entry]));
|
|
159
|
-
const evaluate = request.evaluateCompletion ?? options.evaluateCompletion;
|
|
160
|
-
const frozenChecks = sorted.map((roleId) => {
|
|
161
|
-
const criteria = requireMetadata(roleId).completionCriteria;
|
|
162
|
-
const outcome = settled.get(roleId);
|
|
163
|
-
const entry = entryByRole.get(roleId);
|
|
164
|
-
const output = outcome?.output;
|
|
165
|
-
// No evaluator, no output, or an output dropped by the byte budget:
|
|
166
|
-
// the criteria cannot be judged, which is reported as unchecked
|
|
167
|
-
// instead of being silently treated as satisfied or unmet.
|
|
168
|
-
if (!evaluate || !output || entry?.truncated === true) {
|
|
169
|
-
return Object.freeze({ roleId, criteria, status: "unchecked" });
|
|
170
|
-
}
|
|
171
|
-
const verdict = evaluate({ roleId, criteria, result: output });
|
|
172
|
-
return Object.freeze({
|
|
173
|
-
roleId,
|
|
174
|
-
criteria,
|
|
175
|
-
status: verdict === true
|
|
176
|
-
? "satisfied"
|
|
177
|
-
: verdict === false
|
|
178
|
-
? "unmet"
|
|
179
|
-
: "unchecked",
|
|
180
|
-
});
|
|
181
|
-
});
|
|
182
|
-
return Object.freeze({
|
|
183
|
-
entries: Object.freeze(frozenEntries),
|
|
184
|
-
truncated,
|
|
185
|
-
completionChecks: Object.freeze(frozenChecks),
|
|
186
|
-
});
|
|
187
|
-
}
|
|
188
|
-
return {
|
|
189
|
-
composition: options.composition,
|
|
190
|
-
runner: options.runner,
|
|
191
|
-
parentInstanceId: options.parentInstanceId,
|
|
192
|
-
runRoles,
|
|
193
|
-
};
|
|
194
|
-
}
|
|
195
|
-
//# sourceMappingURL=role-orchestrator.js.map
|