@ai-agent-forge/agent-forge 0.87.0 → 0.88.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +56 -0
- package/README.md +2 -2
- package/bundled-plugins/agent-loop-policy/agent-forge.json +19 -0
- package/bundled-plugins/agent-loop-policy/dist/entry.d.ts +28 -0
- package/bundled-plugins/agent-loop-policy/dist/entry.d.ts.map +1 -0
- package/bundled-plugins/agent-loop-policy/dist/entry.js +69 -0
- package/bundled-plugins/agent-loop-policy/dist/entry.js.map +1 -0
- package/bundled-plugins/agent-loop-policy/dist/loop-guard.d.ts +199 -0
- package/bundled-plugins/agent-loop-policy/dist/loop-guard.d.ts.map +1 -0
- package/bundled-plugins/agent-loop-policy/dist/loop-guard.js +208 -0
- package/bundled-plugins/agent-loop-policy/dist/loop-guard.js.map +1 -0
- package/bundled-plugins/agent-loop-policy/dist/run-loop-strategy.d.ts +17 -0
- package/bundled-plugins/agent-loop-policy/dist/run-loop-strategy.d.ts.map +1 -0
- package/bundled-plugins/agent-loop-policy/dist/run-loop-strategy.js +18 -0
- package/bundled-plugins/agent-loop-policy/dist/run-loop-strategy.js.map +1 -0
- package/bundled-plugins/agent-loop-policy/plugin.json +7 -0
- package/bundled-plugins/coding-tools/agent-forge.json +19 -0
- package/{dist/core/tools → bundled-plugins/coding-tools/dist}/bash.d.ts +5 -44
- package/bundled-plugins/coding-tools/dist/bash.d.ts.map +1 -0
- package/{dist/core/tools → bundled-plugins/coding-tools/dist}/bash.js +15 -119
- package/bundled-plugins/coding-tools/dist/bash.js.map +1 -0
- package/bundled-plugins/coding-tools/dist/capability.d.ts +25 -0
- package/bundled-plugins/coding-tools/dist/capability.d.ts.map +1 -0
- package/bundled-plugins/coding-tools/dist/capability.js +98 -0
- package/bundled-plugins/coding-tools/dist/capability.js.map +1 -0
- package/bundled-plugins/coding-tools/dist/config.d.ts +8 -0
- package/bundled-plugins/coding-tools/dist/config.d.ts.map +1 -0
- package/bundled-plugins/coding-tools/dist/config.js +8 -0
- package/bundled-plugins/coding-tools/dist/config.js.map +1 -0
- package/{dist/core/tools → bundled-plugins/coding-tools/dist}/edit.d.ts +3 -3
- package/bundled-plugins/coding-tools/dist/edit.d.ts.map +1 -0
- package/{dist/core/tools → bundled-plugins/coding-tools/dist}/edit.js +12 -10
- package/bundled-plugins/coding-tools/dist/edit.js.map +1 -0
- package/bundled-plugins/coding-tools/dist/entry.d.ts +14 -0
- package/bundled-plugins/coding-tools/dist/entry.d.ts.map +1 -0
- package/bundled-plugins/coding-tools/dist/entry.js +23 -0
- package/bundled-plugins/coding-tools/dist/entry.js.map +1 -0
- package/{dist/core/tools → bundled-plugins/coding-tools/dist}/find.d.ts +4 -4
- package/bundled-plugins/coding-tools/dist/find.d.ts.map +1 -0
- package/{dist/core/tools → bundled-plugins/coding-tools/dist}/find.js +10 -8
- package/bundled-plugins/coding-tools/dist/find.js.map +1 -0
- package/{dist/core/tools → bundled-plugins/coding-tools/dist}/grep.d.ts +3 -3
- package/bundled-plugins/coding-tools/dist/grep.d.ts.map +1 -0
- package/{dist/core/tools → bundled-plugins/coding-tools/dist}/grep.js +10 -8
- package/bundled-plugins/coding-tools/dist/grep.js.map +1 -0
- package/bundled-plugins/coding-tools/dist/index.d.ts +17 -0
- package/bundled-plugins/coding-tools/dist/index.d.ts.map +1 -0
- package/bundled-plugins/coding-tools/dist/index.js +17 -0
- package/bundled-plugins/coding-tools/dist/index.js.map +1 -0
- package/{dist/core/tools → bundled-plugins/coding-tools/dist}/ls.d.ts +3 -3
- package/bundled-plugins/coding-tools/dist/ls.d.ts.map +1 -0
- package/{dist/core/tools → bundled-plugins/coding-tools/dist}/ls.js +8 -6
- package/{dist/core/tools → bundled-plugins/coding-tools/dist}/ls.js.map +1 -1
- package/{dist/core/tools → bundled-plugins/coding-tools/dist}/powershell.d.ts +2 -1
- package/bundled-plugins/coding-tools/dist/powershell.d.ts.map +1 -0
- package/{dist/core/tools → bundled-plugins/coding-tools/dist}/powershell.js +6 -3
- package/bundled-plugins/coding-tools/dist/powershell.js.map +1 -0
- package/{dist/core/tools → bundled-plugins/coding-tools/dist}/read.d.ts +3 -3
- package/bundled-plugins/coding-tools/dist/read.d.ts.map +1 -0
- package/{dist/core/tools → bundled-plugins/coding-tools/dist}/read.js +15 -13
- package/bundled-plugins/coding-tools/dist/read.js.map +1 -0
- package/bundled-plugins/coding-tools/dist/types.d.ts +74 -0
- package/bundled-plugins/coding-tools/dist/types.d.ts.map +1 -0
- package/bundled-plugins/coding-tools/dist/types.js +28 -0
- package/bundled-plugins/coding-tools/dist/types.js.map +1 -0
- package/{dist/core/tools → bundled-plugins/coding-tools/dist}/write.d.ts +2 -2
- package/bundled-plugins/coding-tools/dist/write.d.ts.map +1 -0
- package/{dist/core/tools → bundled-plugins/coding-tools/dist}/write.js +11 -9
- package/bundled-plugins/coding-tools/dist/write.js.map +1 -0
- package/bundled-plugins/coding-tools/plugin.json +10 -0
- package/bundled-plugins/compaction-policy/agent-forge.json +19 -0
- package/bundled-plugins/compaction-policy/dist/branch-summary-policy.d.ts +6 -0
- package/bundled-plugins/compaction-policy/dist/branch-summary-policy.d.ts.map +1 -0
- package/bundled-plugins/compaction-policy/dist/branch-summary-policy.js +19 -0
- package/bundled-plugins/compaction-policy/dist/branch-summary-policy.js.map +1 -0
- package/bundled-plugins/compaction-policy/dist/compaction-policy.d.ts +6 -0
- package/bundled-plugins/compaction-policy/dist/compaction-policy.d.ts.map +1 -0
- package/bundled-plugins/compaction-policy/dist/compaction-policy.js +38 -0
- package/bundled-plugins/compaction-policy/dist/compaction-policy.js.map +1 -0
- package/bundled-plugins/compaction-policy/dist/entry.d.ts +13 -0
- package/bundled-plugins/compaction-policy/dist/entry.d.ts.map +1 -0
- package/bundled-plugins/compaction-policy/dist/entry.js +23 -0
- package/bundled-plugins/compaction-policy/dist/entry.js.map +1 -0
- package/bundled-plugins/compaction-policy/plugin.json +10 -0
- package/bundled-plugins/mcp-http/dist/index.d.ts +8 -0
- package/bundled-plugins/mcp-http/dist/index.d.ts.map +1 -0
- package/bundled-plugins/mcp-http/dist/index.js +8 -0
- package/bundled-plugins/mcp-http/dist/index.js.map +1 -0
- package/bundled-plugins/mcp-http/dist/mcp-http.d.ts.map +1 -0
- package/{dist/plugins → bundled-plugins/mcp-http/dist}/mcp-http.js +1 -1
- package/bundled-plugins/mcp-http/dist/mcp-http.js.map +1 -0
- package/bundled-plugins/overflow-policy/agent-forge.json +19 -0
- package/bundled-plugins/overflow-policy/dist/entry.d.ts +16 -0
- package/bundled-plugins/overflow-policy/dist/entry.d.ts.map +1 -0
- package/bundled-plugins/overflow-policy/dist/entry.js +35 -0
- package/bundled-plugins/overflow-policy/dist/entry.js.map +1 -0
- package/bundled-plugins/overflow-policy/plugin.json +10 -0
- package/bundled-plugins/provider-failover/agent-forge.json +19 -0
- package/bundled-plugins/provider-failover/dist/entry.d.ts +8 -0
- package/bundled-plugins/provider-failover/dist/entry.d.ts.map +1 -0
- package/bundled-plugins/provider-failover/dist/entry.js +8 -0
- package/bundled-plugins/provider-failover/dist/entry.js.map +1 -0
- package/bundled-plugins/provider-failover/dist/provider-failover.d.ts +122 -0
- package/bundled-plugins/provider-failover/dist/provider-failover.d.ts.map +1 -0
- package/{dist/core/extensions → bundled-plugins/provider-failover/dist}/provider-failover.js +149 -61
- package/bundled-plugins/provider-failover/dist/provider-failover.js.map +1 -0
- package/bundled-plugins/provider-failover/plugin.json +7 -0
- package/bundled-plugins/retry-policy/agent-forge.json +19 -0
- package/bundled-plugins/retry-policy/dist/entry.d.ts +16 -0
- package/bundled-plugins/retry-policy/dist/entry.d.ts.map +1 -0
- package/bundled-plugins/retry-policy/dist/entry.js +34 -0
- package/bundled-plugins/retry-policy/dist/entry.js.map +1 -0
- package/bundled-plugins/retry-policy/plugin.json +10 -0
- package/dist/bundle/.build-manifest.json +105 -183
- package/dist/bundle/chunks/{anthropic-messages-ALDZBUKI.js → anthropic-messages-PLAKXR73.js} +1 -1
- package/dist/bundle/chunks/{azure-openai-responses-A2WJWZFB.js → azure-openai-responses-OUWQ2AZD.js} +1 -1
- package/dist/bundle/chunks/{chunk-CIX3FSBK.js → chunk-A3JYRWB6.js} +1 -1
- package/dist/bundle/chunks/{chunk-SQFG22WN.js → chunk-AC2FIS4G.js} +1 -1
- package/dist/bundle/chunks/chunk-AQLNTW2B.js +664 -0
- package/dist/bundle/chunks/chunk-D3ARGZFR.js +13 -0
- package/dist/bundle/chunks/{chunk-YJCQVXW5.js → chunk-HTEVUY7F.js} +1 -1
- package/dist/bundle/chunks/{chunk-Y7HXTASS.js → chunk-HV64ASMT.js} +1 -1
- package/dist/bundle/chunks/chunk-LZOEQITZ.js +855 -0
- package/dist/bundle/chunks/{chunk-7ZY7IXZD.js → chunk-TRDNDS6A.js} +1 -1
- package/dist/bundle/chunks/chunk-Z72JWUZ4.js +4 -0
- package/dist/bundle/chunks/{google-generative-ai-NIB4WONV.js → google-generative-ai-DLII6DAT.js} +1 -1
- package/dist/bundle/chunks/{google-vertex-DCPYUEUO.js → google-vertex-G7BZL7GM.js} +1 -1
- package/dist/bundle/chunks/image-resize-worker.js +3 -3
- package/dist/bundle/chunks/{mistral-conversations-OC6LA5XL.js → mistral-conversations-JXUK24ID.js} +1 -1
- package/dist/bundle/chunks/{openai-codex-responses-IO2X4Y7L.js → openai-codex-responses-5GSGFIPG.js} +1 -1
- package/dist/bundle/chunks/{openai-completions-XYQQHETU.js → openai-completions-EI2I6DTG.js} +1 -1
- package/dist/bundle/chunks/{openai-responses-DLIRN3CI.js → openai-responses-AUJQ3NWT.js} +1 -1
- package/dist/bundle/chunks/{pi-messages-E6RRYBO7.js → pi-messages-PWU2VJMR.js} +1 -1
- package/dist/bundle/chunks/virtual-modules-WF6WRHP7.js +5 -0
- package/dist/bundle/cli.js +1 -1
- package/dist/bundle/client.js +1 -1
- package/dist/bundle/index.js +3 -3
- package/dist/bundle/rpc-entry.js +1 -1
- package/dist/capabilities/builtin.d.ts +1 -1
- package/dist/capabilities/builtin.d.ts.map +1 -1
- package/dist/capabilities/builtin.js +5 -0
- package/dist/capabilities/builtin.js.map +1 -1
- package/dist/cli/auth-check.d.ts.map +1 -1
- package/dist/cli/auth-check.js +14 -2
- package/dist/cli/auth-check.js.map +1 -1
- package/dist/cli/auth-command.d.ts.map +1 -1
- package/dist/cli/auth-command.js +1 -1
- package/dist/cli/auth-command.js.map +1 -1
- package/dist/cli/plugin-command.d.ts.map +1 -1
- package/dist/cli/plugin-command.js +17 -1
- package/dist/cli/plugin-command.js.map +1 -1
- package/dist/config.d.ts +2 -3
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +5 -6
- package/dist/config.js.map +1 -1
- package/dist/core/agent-session-bash.d.ts +1 -1
- package/dist/core/agent-session-bash.d.ts.map +1 -1
- package/dist/core/agent-session-bash.js +1 -1
- package/dist/core/agent-session-bash.js.map +1 -1
- package/dist/core/agent-session-compaction.d.ts +6 -10
- package/dist/core/agent-session-compaction.d.ts.map +1 -1
- package/dist/core/agent-session-compaction.js +21 -112
- package/dist/core/agent-session-compaction.js.map +1 -1
- package/dist/core/agent-session-internal.d.ts +1 -7
- package/dist/core/agent-session-internal.d.ts.map +1 -1
- package/dist/core/agent-session-internal.js.map +1 -1
- package/dist/core/agent-session-loop.d.ts +4 -3
- package/dist/core/agent-session-loop.d.ts.map +1 -1
- package/dist/core/agent-session-loop.js +9 -6
- package/dist/core/agent-session-loop.js.map +1 -1
- package/dist/core/agent-session-retry.d.ts +1 -1
- package/dist/core/agent-session-retry.d.ts.map +1 -1
- package/dist/core/agent-session-retry.js +32 -4
- package/dist/core/agent-session-retry.js.map +1 -1
- package/dist/core/agent-session-services.d.ts.map +1 -1
- package/dist/core/agent-session-services.js +30 -9
- package/dist/core/agent-session-services.js.map +1 -1
- package/dist/core/agent-session-tools.d.ts.map +1 -1
- package/dist/core/agent-session-tools.js +5 -1
- package/dist/core/agent-session-tools.js.map +1 -1
- package/dist/core/agent-session.d.ts +12 -33
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +61 -67
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/bash-executor.d.ts +1 -1
- package/dist/core/bash-executor.d.ts.map +1 -1
- package/dist/core/bash-executor.js.map +1 -1
- package/dist/core/extensions/bootstrap-agent-loop.d.ts +23 -151
- package/dist/core/extensions/bootstrap-agent-loop.d.ts.map +1 -1
- package/dist/core/extensions/bootstrap-agent-loop.js +28 -290
- package/dist/core/extensions/bootstrap-agent-loop.js.map +1 -1
- package/dist/core/extensions/capability-runtime-types.d.ts +5 -3
- package/dist/core/extensions/capability-runtime-types.d.ts.map +1 -1
- package/dist/core/extensions/capability-runtime-types.js.map +1 -1
- package/dist/core/extensions/capability-runtime.d.ts.map +1 -1
- package/dist/core/extensions/capability-runtime.js +42 -6
- package/dist/core/extensions/capability-runtime.js.map +1 -1
- package/dist/core/extensions/index.d.ts +12 -5
- package/dist/core/extensions/index.d.ts.map +1 -1
- package/dist/core/extensions/index.js +12 -5
- package/dist/core/extensions/index.js.map +1 -1
- package/dist/core/extensions/virtual-modules.d.ts.map +1 -1
- package/dist/core/extensions/virtual-modules.js +65 -0
- package/dist/core/extensions/virtual-modules.js.map +1 -1
- package/dist/core/facade/coding-agent-facade.d.ts +1 -7
- package/dist/core/facade/coding-agent-facade.d.ts.map +1 -1
- package/dist/core/facade/coding-agent-facade.js +0 -3
- package/dist/core/facade/coding-agent-facade.js.map +1 -1
- package/dist/core/i18n/locales/zh-cn/cli.d.ts.map +1 -1
- package/dist/core/i18n/locales/zh-cn/cli.js +3 -1
- package/dist/core/i18n/locales/zh-cn/cli.js.map +1 -1
- package/dist/core/i18n/locales/zh-cn/core-contract-core.d.ts +1 -1
- package/dist/core/i18n/locales/zh-cn/core-contract-core.d.ts.map +1 -1
- package/dist/core/i18n/locales/zh-cn/core-contract-core.js +1 -1
- package/dist/core/i18n/locales/zh-cn/core-contract-core.js.map +1 -1
- package/dist/core/i18n/locales/zh-cn/core-contract-extensions.d.ts.map +1 -1
- package/dist/core/i18n/locales/zh-cn/core-contract-extensions.js +2 -4
- package/dist/core/i18n/locales/zh-cn/core-contract-extensions.js.map +1 -1
- package/dist/core/i18n/locales/zh-cn/core-errors.d.ts.map +1 -1
- package/dist/core/i18n/locales/zh-cn/core-errors.js +3 -1
- package/dist/core/i18n/locales/zh-cn/core-errors.js.map +1 -1
- package/dist/core/i18n/locales/zh-cn/interactive-mode.d.ts.map +1 -1
- package/dist/core/i18n/locales/zh-cn/interactive-mode.js +2 -0
- package/dist/core/i18n/locales/zh-cn/interactive-mode.js.map +1 -1
- package/dist/core/i18n/locales/zh-cn/tui-components-selectors.d.ts.map +1 -1
- package/dist/core/i18n/locales/zh-cn/tui-components-selectors.js +0 -2
- package/dist/core/i18n/locales/zh-cn/tui-components-selectors.js.map +1 -1
- package/dist/core/model-config.d.ts +0 -1
- package/dist/core/model-config.d.ts.map +1 -1
- package/dist/core/model-config.js +9 -1
- package/dist/core/model-config.js.map +1 -1
- package/dist/core/model-runtime.d.ts.map +1 -1
- package/dist/core/model-runtime.js +3 -3
- package/dist/core/model-runtime.js.map +1 -1
- package/dist/core/provider-composer.d.ts +2 -2
- package/dist/core/provider-composer.d.ts.map +1 -1
- package/dist/core/provider-composer.js +7 -8
- package/dist/core/provider-composer.js.map +1 -1
- package/dist/core/sdk.d.ts +18 -3
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +267 -76
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/settings-manager.d.ts +9 -20
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +20 -54
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/tools/bash-operations.d.ts +41 -0
- package/dist/core/tools/bash-operations.d.ts.map +1 -0
- package/dist/core/tools/bash-operations.js +113 -0
- package/dist/core/tools/bash-operations.js.map +1 -0
- package/dist/core/tools/index.d.ts +12 -36
- package/dist/core/tools/index.d.ts.map +1 -1
- package/dist/core/tools/index.js +1 -117
- package/dist/core/tools/index.js.map +1 -1
- package/dist/core/tools/readme-path.d.ts +3 -0
- package/dist/core/tools/readme-path.d.ts.map +1 -0
- package/dist/core/tools/readme-path.js +15 -0
- package/dist/core/tools/readme-path.js.map +1 -0
- package/dist/index.d.ts +3 -19
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -39
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +3 -2
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/components/footer.d.ts +0 -2
- package/dist/modes/interactive/components/footer.d.ts.map +1 -1
- package/dist/modes/interactive/components/footer.js +2 -7
- package/dist/modes/interactive/components/footer.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts +2 -6
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +6 -28
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/components/tool-execution.d.ts +0 -1
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution.js +9 -25
- package/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +0 -1
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +23 -36
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-client.d.ts +0 -8
- package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client.js +0 -12
- package/dist/modes/rpc/rpc-client.js.map +1 -1
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-mode.js +0 -9
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-types.d.ts +0 -19
- package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-types.js.map +1 -1
- package/dist/plugins/ecosystem/cli.d.ts.map +1 -1
- package/dist/plugins/ecosystem/cli.js +14 -2
- package/dist/plugins/ecosystem/cli.js.map +1 -1
- package/dist/plugins/ecosystem/node-npm-registry-source.d.ts +7 -2
- package/dist/plugins/ecosystem/node-npm-registry-source.d.ts.map +1 -1
- package/dist/plugins/ecosystem/node-npm-registry-source.js +64 -9
- package/dist/plugins/ecosystem/node-npm-registry-source.js.map +1 -1
- package/dist/plugins/ecosystem/node-plugin-acquisition-host.d.ts.map +1 -1
- package/dist/plugins/ecosystem/node-plugin-acquisition-host.js +6 -0
- package/dist/plugins/ecosystem/node-plugin-acquisition-host.js.map +1 -1
- package/dist/plugins/ecosystem/node-plugin-bootstrap.d.ts +9 -2
- package/dist/plugins/ecosystem/node-plugin-bootstrap.d.ts.map +1 -1
- package/dist/plugins/ecosystem/node-plugin-bootstrap.js +23 -0
- package/dist/plugins/ecosystem/node-plugin-bootstrap.js.map +1 -1
- package/dist/plugins/ecosystem/plugin-bootstrap.d.ts +9 -1
- package/dist/plugins/ecosystem/plugin-bootstrap.d.ts.map +1 -1
- package/dist/plugins/ecosystem/plugin-bootstrap.js +5 -0
- package/dist/plugins/ecosystem/plugin-bootstrap.js.map +1 -1
- package/dist/profiles/builtin-suites.d.ts +5 -1
- package/dist/profiles/builtin-suites.d.ts.map +1 -1
- package/dist/profiles/builtin-suites.js +6 -1
- package/dist/profiles/builtin-suites.js.map +1 -1
- package/dist/utils/photon.d.ts +2 -2
- package/dist/utils/photon.d.ts.map +1 -1
- package/dist/utils/photon.js +2 -2
- package/dist/utils/photon.js.map +1 -1
- package/docs/compaction.md +1 -3
- package/docs/docs.json +4 -0
- package/docs/index.md +1 -0
- package/docs/mcp.md +103 -0
- package/docs/models.md +14 -22
- package/docs/providers.md +0 -1
- package/docs/rpc.md +1 -26
- package/docs/sdk.md +4 -6
- package/docs/settings.md +9 -12
- package/docs/skills.md +1 -9
- package/docs/usage.md +1 -1
- package/examples/extensions/bash-spawn-hook/index.ts +7 -2
- package/examples/extensions/built-in-tool-renderer/index.ts +4 -2
- package/examples/extensions/minimal-mode/index.ts +2 -2
- package/examples/extensions/truncated-tool/index.ts +1 -1
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/examples/extensions/with-deps/plugin.json +1 -1
- package/examples/sdk/10-settings.ts +2 -4
- package/examples/sdk/12-full-control.ts +1 -2
- package/package.json +3 -4
- package/dist/bundle/chunks/chunk-6ZKDNZHA.js +0 -145
- package/dist/bundle/chunks/chunk-BFC2BDVJ.js +0 -13
- package/dist/bundle/chunks/chunk-MOHOLL3F.js +0 -1456
- package/dist/bundle/chunks/virtual-modules-KZ5DRH7Q.js +0 -2
- package/dist/core/extensions/bootstrap-branch-summary-policy.d.ts +0 -7
- package/dist/core/extensions/bootstrap-branch-summary-policy.d.ts.map +0 -1
- package/dist/core/extensions/bootstrap-branch-summary-policy.js +0 -28
- package/dist/core/extensions/bootstrap-branch-summary-policy.js.map +0 -1
- package/dist/core/extensions/bootstrap-compaction-policy.d.ts +0 -7
- package/dist/core/extensions/bootstrap-compaction-policy.d.ts.map +0 -1
- package/dist/core/extensions/bootstrap-compaction-policy.js +0 -82
- package/dist/core/extensions/bootstrap-compaction-policy.js.map +0 -1
- package/dist/core/extensions/bootstrap-overflow-policy.d.ts +0 -7
- package/dist/core/extensions/bootstrap-overflow-policy.d.ts.map +0 -1
- package/dist/core/extensions/bootstrap-overflow-policy.js +0 -30
- package/dist/core/extensions/bootstrap-overflow-policy.js.map +0 -1
- package/dist/core/extensions/bootstrap-retry-policy.d.ts +0 -7
- package/dist/core/extensions/bootstrap-retry-policy.d.ts.map +0 -1
- package/dist/core/extensions/bootstrap-retry-policy.js +0 -29
- package/dist/core/extensions/bootstrap-retry-policy.js.map +0 -1
- package/dist/core/extensions/bootstrap-tools.d.ts +0 -20
- package/dist/core/extensions/bootstrap-tools.d.ts.map +0 -1
- package/dist/core/extensions/bootstrap-tools.js +0 -36
- package/dist/core/extensions/bootstrap-tools.js.map +0 -1
- package/dist/core/extensions/microcompact.d.ts +0 -80
- package/dist/core/extensions/microcompact.d.ts.map +0 -1
- package/dist/core/extensions/microcompact.js +0 -134
- package/dist/core/extensions/microcompact.js.map +0 -1
- package/dist/core/extensions/provider-failover.d.ts +0 -106
- package/dist/core/extensions/provider-failover.d.ts.map +0 -1
- package/dist/core/extensions/provider-failover.js.map +0 -1
- package/dist/core/tools/bash.d.ts.map +0 -1
- package/dist/core/tools/bash.js.map +0 -1
- package/dist/core/tools/edit.d.ts.map +0 -1
- package/dist/core/tools/edit.js.map +0 -1
- package/dist/core/tools/find.d.ts.map +0 -1
- package/dist/core/tools/find.js.map +0 -1
- package/dist/core/tools/grep.d.ts.map +0 -1
- package/dist/core/tools/grep.js.map +0 -1
- package/dist/core/tools/ls.d.ts.map +0 -1
- package/dist/core/tools/powershell.d.ts.map +0 -1
- package/dist/core/tools/powershell.js.map +0 -1
- package/dist/core/tools/read.d.ts.map +0 -1
- package/dist/core/tools/read.js.map +0 -1
- package/dist/core/tools/write.d.ts.map +0 -1
- package/dist/core/tools/write.js.map +0 -1
- package/dist/plugins/mcp-http.d.ts.map +0 -1
- package/dist/plugins/mcp-http.js.map +0 -1
- package/dist/profile/child-facade.d.ts +0 -44
- package/dist/profile/child-facade.d.ts.map +0 -1
- package/dist/profile/child-facade.js +0 -56
- package/dist/profile/child-facade.js.map +0 -1
- package/dist/profile/dependency-wiring.d.ts +0 -48
- package/dist/profile/dependency-wiring.d.ts.map +0 -1
- package/dist/profile/dependency-wiring.js +0 -56
- package/dist/profile/dependency-wiring.js.map +0 -1
- package/dist/profile/domain-recovery.d.ts +0 -60
- package/dist/profile/domain-recovery.d.ts.map +0 -1
- package/dist/profile/domain-recovery.js +0 -94
- package/dist/profile/domain-recovery.js.map +0 -1
- package/dist/profile/first-roles.d.ts +0 -30
- package/dist/profile/first-roles.d.ts.map +0 -1
- package/dist/profile/first-roles.js +0 -83
- package/dist/profile/first-roles.js.map +0 -1
- package/dist/profile/goal-plugin.d.ts +0 -38
- package/dist/profile/goal-plugin.d.ts.map +0 -1
- package/dist/profile/goal-plugin.js +0 -132
- package/dist/profile/goal-plugin.js.map +0 -1
- package/dist/profile/plan-plugin.d.ts +0 -44
- package/dist/profile/plan-plugin.d.ts.map +0 -1
- package/dist/profile/plan-plugin.js +0 -157
- package/dist/profile/plan-plugin.js.map +0 -1
- package/dist/profile/policy-manifest.d.ts +0 -53
- package/dist/profile/policy-manifest.d.ts.map +0 -1
- package/dist/profile/policy-manifest.js +0 -53
- package/dist/profile/policy-manifest.js.map +0 -1
- package/dist/profile/role-assembly.d.ts +0 -47
- package/dist/profile/role-assembly.d.ts.map +0 -1
- package/dist/profile/role-assembly.js +0 -31
- package/dist/profile/role-assembly.js.map +0 -1
- package/dist/profile/role-catalog.d.ts +0 -43
- package/dist/profile/role-catalog.d.ts.map +0 -1
- package/dist/profile/role-catalog.js +0 -132
- package/dist/profile/role-catalog.js.map +0 -1
- package/dist/profile/role-orchestrator.d.ts +0 -123
- package/dist/profile/role-orchestrator.d.ts.map +0 -1
- package/dist/profile/role-orchestrator.js +0 -195
- package/dist/profile/role-orchestrator.js.map +0 -1
- package/dist/profile/role-runner.d.ts +0 -99
- package/dist/profile/role-runner.d.ts.map +0 -1
- package/dist/profile/role-runner.js +0 -79
- package/dist/profile/role-runner.js.map +0 -1
- package/dist/profile/root-facade.d.ts +0 -36
- package/dist/profile/root-facade.d.ts.map +0 -1
- package/dist/profile/root-facade.js +0 -49
- package/dist/profile/root-facade.js.map +0 -1
- package/dist/profile/skill-discovery-wiring.d.ts +0 -58
- package/dist/profile/skill-discovery-wiring.d.ts.map +0 -1
- package/dist/profile/skill-discovery-wiring.js +0 -80
- package/dist/profile/skill-discovery-wiring.js.map +0 -1
- package/dist/profile/state-store.d.ts +0 -62
- package/dist/profile/state-store.d.ts.map +0 -1
- package/dist/profile/state-store.js +0 -144
- package/dist/profile/state-store.js.map +0 -1
- package/dist/profile/todo-plugin.d.ts +0 -37
- package/dist/profile/todo-plugin.d.ts.map +0 -1
- package/dist/profile/todo-plugin.js +0 -137
- package/dist/profile/todo-plugin.js.map +0 -1
- package/dist/server/create-harness.d.ts +0 -26
- package/dist/server/create-harness.d.ts.map +0 -1
- package/dist/server/create-harness.js +0 -106
- package/dist/server/create-harness.js.map +0 -1
- /package/{dist/plugins → bundled-plugins/mcp-http/dist}/mcp-http.d.ts +0 -0
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Role runner binding (2.2d) — maps registered `RoleMetadataV1` roles to child
|
|
3
|
-
* `AgentDefinition`s executable through the experimental `AgentCompositionAPI`.
|
|
4
|
-
*
|
|
5
|
-
* The default run implementation is the deterministic first-batch role
|
|
6
|
-
* callbacks (architecture-analyst / implementer / test-designer, 2.2c); a
|
|
7
|
-
* caller may inject a real implementation via `run`. This slice never calls a
|
|
8
|
-
* model.
|
|
9
|
-
*
|
|
10
|
-
* Library-level use works without any guard. When used through the
|
|
11
|
-
* capability-runtime guards (`src/core/extensions/capability-runtime-guards.ts`),
|
|
12
|
-
* the produced definitions must be defined/created by a manifest that declares
|
|
13
|
-
* the `child-agent-controller` role and the `owner` must equal that manifest
|
|
14
|
-
* id — the guards enforce this at the plugin boundary; this contract does not
|
|
15
|
-
* duplicate guard logic.
|
|
16
|
-
*
|
|
17
|
-
* Required capability dependencies are checked explicitly (2.5a structured
|
|
18
|
-
* `missing` shape) before activation (create/lease); they are never silently
|
|
19
|
-
* skipped. Domain role runtimes live INSIDE the composition's child role: the
|
|
20
|
-
* root/child two-value role enum is unchanged by design.
|
|
21
|
-
*/
|
|
22
|
-
import type { AgentDefinition, AgentExecutionContext } from "../core/extensions/public-api.ts";
|
|
23
|
-
import type { AvailableCapabilityV1 } from "./dependency-wiring.ts";
|
|
24
|
-
import type { RoleCatalogV1 } from "./role-catalog.ts";
|
|
25
|
-
/** Deterministic role input: a single spec string (first-batch contract). */
|
|
26
|
-
export interface RoleRunnerInputV1 {
|
|
27
|
-
readonly spec: string;
|
|
28
|
-
}
|
|
29
|
-
/** Deterministic role output: a single result string (first-batch contract). */
|
|
30
|
-
export interface RoleRunnerResultV1 {
|
|
31
|
-
readonly result: string;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Per-role run implementation. `context` is present when executed through
|
|
35
|
-
* `AgentCompositionAPI`; direct deterministic execution may omit it.
|
|
36
|
-
*/
|
|
37
|
-
export type RoleRunCallbackV1 = (input: RoleRunnerInputV1, context?: AgentExecutionContext) => RoleRunnerResultV1 | Promise<RoleRunnerResultV1>;
|
|
38
|
-
/** Runner-level run resolver; receives the roleId in addition to the callback arguments. */
|
|
39
|
-
export type RoleRunResolverV1 = (roleId: string, input: RoleRunnerInputV1, context?: AgentExecutionContext) => RoleRunnerResultV1 | Promise<RoleRunnerResultV1>;
|
|
40
|
-
/**
|
|
41
|
-
* Role capability-dependency diagnostic: the 2.5a structured `missing` shape
|
|
42
|
-
* (`capabilityId`/`requestedVersion`/`availableVersion?`/`reason`) with
|
|
43
|
-
* `roleId` as the requester.
|
|
44
|
-
*/
|
|
45
|
-
export interface RoleMissingCapabilityV1 {
|
|
46
|
-
readonly roleId: string;
|
|
47
|
-
readonly capabilityId: string;
|
|
48
|
-
readonly requestedVersion: number;
|
|
49
|
-
/** Undefined when the capability is entirely absent from the registry. */
|
|
50
|
-
readonly availableVersion?: number;
|
|
51
|
-
readonly reason: "missing" | "version_mismatch";
|
|
52
|
-
}
|
|
53
|
-
/** Activation check result for one role's REQUIRED capability dependencies. */
|
|
54
|
-
export interface RoleCapabilityCheckV1 {
|
|
55
|
-
readonly roleId: string;
|
|
56
|
-
readonly status: "satisfied" | "missing";
|
|
57
|
-
/** Required dependencies that are absent or version-mismatched; empty when satisfied. */
|
|
58
|
-
readonly missing: readonly RoleMissingCapabilityV1[];
|
|
59
|
-
}
|
|
60
|
-
export interface RoleRunnerOptionsV1 {
|
|
61
|
-
readonly catalog: RoleCatalogV1;
|
|
62
|
-
/**
|
|
63
|
-
* Owner stamped onto produced child definitions. Required to equal the
|
|
64
|
-
* declaring plugin manifest id when used behind the capability-runtime
|
|
65
|
-
* guards; plain library use may omit it.
|
|
66
|
-
*/
|
|
67
|
-
readonly owner?: string;
|
|
68
|
-
/**
|
|
69
|
-
* Injected run implementation replacing the deterministic first-batch
|
|
70
|
-
* defaults entirely. Roles without any binding still fail explicitly on
|
|
71
|
-
* execution.
|
|
72
|
-
*/
|
|
73
|
-
readonly run?: RoleRunResolverV1;
|
|
74
|
-
}
|
|
75
|
-
export interface RoleRunnerV1 {
|
|
76
|
-
readonly catalog: RoleCatalogV1;
|
|
77
|
-
/** Sorted registered roleIds. */
|
|
78
|
-
listRoleIds(): readonly string[];
|
|
79
|
-
/**
|
|
80
|
-
* Maps a registered role to a child agent definition (composition role
|
|
81
|
-
* `child-agent-controller`, id `role:<roleId>`, version 1). Run the
|
|
82
|
-
* capability check before creating/leasing an instance.
|
|
83
|
-
*/
|
|
84
|
-
createDefinition(roleId: string): AgentDefinition<RoleRunnerInputV1, RoleRunnerResultV1>;
|
|
85
|
-
/**
|
|
86
|
-
* Pre-activation capability-dependency check against an exact-version
|
|
87
|
-
* registry: a required dependency is satisfied only when the registry
|
|
88
|
-
* offers the same capability id at exactly the requested version. Optional
|
|
89
|
-
* dependencies never block activation and are not reported as missing.
|
|
90
|
-
*/
|
|
91
|
-
checkCapabilities(roleId: string, availableCapabilities: readonly AvailableCapabilityV1[]): RoleCapabilityCheckV1;
|
|
92
|
-
/** Direct deterministic execution (the same run a produced definition binds). */
|
|
93
|
-
run(roleId: string, input: RoleRunnerInputV1, context?: AgentExecutionContext): Promise<RoleRunnerResultV1>;
|
|
94
|
-
}
|
|
95
|
-
/** Default deterministic run dispatch: first-batch callbacks; explicit failure otherwise. */
|
|
96
|
-
export declare function runFirstBatchRole(roleId: string, input: RoleRunnerInputV1, context?: AgentExecutionContext): RoleRunnerResultV1 | Promise<RoleRunnerResultV1>;
|
|
97
|
-
/** Binds the catalog's registered roles to child agent definitions. */
|
|
98
|
-
export declare function createRoleRunner(options: RoleRunnerOptionsV1): RoleRunnerV1;
|
|
99
|
-
//# sourceMappingURL=role-runner.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"role-runner.d.ts","sourceRoot":"","sources":["../../src/profile/role-runner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,KAAK,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AAE/F,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAEpE,OAAO,KAAK,EAAE,aAAa,EAAkB,MAAM,mBAAmB,CAAC;AAEvE,6EAA6E;AAC7E,MAAM,WAAW,iBAAiB;IACjC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACtB;AAED,gFAAgF;AAChF,MAAM,WAAW,kBAAkB;IAClC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACxB;AAED;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG,CAC/B,KAAK,EAAE,iBAAiB,EACxB,OAAO,CAAC,EAAE,qBAAqB,KAC3B,kBAAkB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;AAEtD,4FAA4F;AAC5F,MAAM,MAAM,iBAAiB,GAAG,CAC/B,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,iBAAiB,EACxB,OAAO,CAAC,EAAE,qBAAqB,KAC3B,kBAAkB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;AAEtD;;;;GAIG;AACH,MAAM,WAAW,uBAAuB;IACvC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,0EAA0E;IAC1E,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IACnC,QAAQ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E","sourcesContent":["/**\n * Role runner binding (2.2d) — maps registered `RoleMetadataV1` roles to child\n * `AgentDefinition`s executable through the experimental `AgentCompositionAPI`.\n *\n * The default run implementation is the deterministic first-batch role\n * callbacks (architecture-analyst / implementer / test-designer, 2.2c); a\n * caller may inject a real implementation via `run`. This slice never calls a\n * model.\n *\n * Library-level use works without any guard. When used through the\n * capability-runtime guards (`src/core/extensions/capability-runtime-guards.ts`),\n * the produced definitions must be defined/created by a manifest that declares\n * the `child-agent-controller` role and the `owner` must equal that manifest\n * id — the guards enforce this at the plugin boundary; this contract does not\n * duplicate guard logic.\n *\n * Required capability dependencies are checked explicitly (2.5a structured\n * `missing` shape) before activation (create/lease); they are never silently\n * skipped. Domain role runtimes live INSIDE the composition's child role: the\n * root/child two-value role enum is unchanged by design.\n */\nimport type { AgentDefinition, AgentExecutionContext } from \"../core/extensions/public-api.ts\";\nimport { t } from \"../core/i18n/index.ts\";\nimport type { AvailableCapabilityV1 } from \"./dependency-wiring.ts\";\nimport { FIRST_BATCH_ROLES } from \"./first-roles.ts\";\nimport type { RoleCatalogV1, RoleMetadataV1 } from \"./role-catalog.ts\";\n\n/** Deterministic role input: a single spec string (first-batch contract). */\nexport interface RoleRunnerInputV1 {\n\treadonly spec: string;\n}\n\n/** Deterministic role output: a single result string (first-batch contract). */\nexport interface RoleRunnerResultV1 {\n\treadonly result: string;\n}\n\n/**\n * Per-role run implementation. `context` is present when executed through\n * `AgentCompositionAPI`; direct deterministic execution may omit it.\n */\nexport type RoleRunCallbackV1 = (\n\tinput: RoleRunnerInputV1,\n\tcontext?: AgentExecutionContext,\n) => RoleRunnerResultV1 | Promise<RoleRunnerResultV1>;\n\n/** Runner-level run resolver; receives the roleId in addition to the callback arguments. */\nexport type RoleRunResolverV1 = (\n\troleId: string,\n\tinput: RoleRunnerInputV1,\n\tcontext?: AgentExecutionContext,\n) => RoleRunnerResultV1 | Promise<RoleRunnerResultV1>;\n\n/**\n * Role capability-dependency diagnostic: the 2.5a structured `missing` shape\n * (`capabilityId`/`requestedVersion`/`availableVersion?`/`reason`) with\n * `roleId` as the requester.\n */\nexport interface RoleMissingCapabilityV1 {\n\treadonly roleId: string;\n\treadonly capabilityId: string;\n\treadonly requestedVersion: number;\n\t/** Undefined when the capability is entirely absent from the registry. */\n\treadonly availableVersion?: number;\n\treadonly reason: \"missing\" | \"version_mismatch\";\n}\n\n/** Activation check result for one role's REQUIRED capability dependencies. */\nexport interface RoleCapabilityCheckV1 {\n\treadonly roleId: string;\n\treadonly status: \"satisfied\" | \"missing\";\n\t/** Required dependencies that are absent or version-mismatched; empty when satisfied. */\n\treadonly missing: readonly RoleMissingCapabilityV1[];\n}\n\nexport interface RoleRunnerOptionsV1 {\n\treadonly catalog: RoleCatalogV1;\n\t/**\n\t * Owner stamped onto produced child definitions. Required to equal the\n\t * declaring plugin manifest id when used behind the capability-runtime\n\t * guards; plain library use may omit it.\n\t */\n\treadonly owner?: string;\n\t/**\n\t * Injected run implementation replacing the deterministic first-batch\n\t * defaults entirely. Roles without any binding still fail explicitly on\n\t * execution.\n\t */\n\treadonly run?: RoleRunResolverV1;\n}\n\nexport interface RoleRunnerV1 {\n\treadonly catalog: RoleCatalogV1;\n\t/** Sorted registered roleIds. */\n\tlistRoleIds(): readonly string[];\n\t/**\n\t * Maps a registered role to a child agent definition (composition role\n\t * `child-agent-controller`, id `role:<roleId>`, version 1). Run the\n\t * capability check before creating/leasing an instance.\n\t */\n\tcreateDefinition(roleId: string): AgentDefinition<RoleRunnerInputV1, RoleRunnerResultV1>;\n\t/**\n\t * Pre-activation capability-dependency check against an exact-version\n\t * registry: a required dependency is satisfied only when the registry\n\t * offers the same capability id at exactly the requested version. Optional\n\t * dependencies never block activation and are not reported as missing.\n\t */\n\tcheckCapabilities(roleId: string, availableCapabilities: readonly AvailableCapabilityV1[]): RoleCapabilityCheckV1;\n\t/** Direct deterministic execution (the same run a produced definition binds). */\n\trun(roleId: string, input: RoleRunnerInputV1, context?: AgentExecutionContext): Promise<RoleRunnerResultV1>;\n}\n\nconst DEFINITION_VERSION = 1;\n\nconst FIRST_BATCH_RUNS = new Map<string, RoleRunCallbackV1>(\n\tFIRST_BATCH_ROLES.map((role) => [role.metadata.roleId, role.run]),\n);\n\n/** Default deterministic run dispatch: first-batch callbacks; explicit failure otherwise. */\nexport function runFirstBatchRole(\n\troleId: string,\n\tinput: RoleRunnerInputV1,\n\tcontext?: AgentExecutionContext,\n): RoleRunnerResultV1 | Promise<RoleRunnerResultV1> {\n\tconst callback = FIRST_BATCH_RUNS.get(roleId);\n\tif (!callback) throw new Error(t(\"No run binding for role: {roleId}\", { roleId }));\n\treturn callback(input, context);\n}\n\n/** Binds the catalog's registered roles to child agent definitions. */\nexport function createRoleRunner(options: RoleRunnerOptionsV1): RoleRunnerV1 {\n\tconst catalog = options.catalog;\n\n\tfunction requireRole(roleId: string): RoleMetadataV1 {\n\t\tconst metadata = catalog.get(roleId);\n\t\tif (!metadata) throw new Error(t(\"Unknown role: {roleId}\", { roleId }));\n\t\treturn metadata;\n\t}\n\n\tasync function execute(\n\t\troleId: string,\n\t\tinput: RoleRunnerInputV1,\n\t\tcontext?: AgentExecutionContext,\n\t): Promise<RoleRunnerResultV1> {\n\t\trequireRole(roleId);\n\t\tif (options.run) return options.run(roleId, input, context);\n\t\treturn runFirstBatchRole(roleId, input, context);\n\t}\n\n\treturn {\n\t\tcatalog,\n\t\tlistRoleIds() {\n\t\t\treturn catalog.list().map((role) => role.roleId);\n\t\t},\n\t\tcreateDefinition(roleId) {\n\t\t\tconst metadata = requireRole(roleId);\n\t\t\treturn {\n\t\t\t\tid: `role:${metadata.roleId}`,\n\t\t\t\tversion: DEFINITION_VERSION,\n\t\t\t\trole: \"child-agent-controller\",\n\t\t\t\t...(options.owner === undefined ? {} : { owner: options.owner }),\n\t\t\t\trun: (input, context) => execute(metadata.roleId, input, context),\n\t\t\t};\n\t\t},\n\t\tcheckCapabilities(roleId, availableCapabilities) {\n\t\t\tconst metadata = requireRole(roleId);\n\t\t\tconst registry = new Map(availableCapabilities.map((capability) => [capability.id, capability.version]));\n\t\t\tconst missing: RoleMissingCapabilityV1[] = [];\n\t\t\tfor (const dependency of metadata.capabilityDependencies) {\n\t\t\t\tif (!dependency.required) continue;\n\t\t\t\tconst availableVersion = registry.get(dependency.capabilityId);\n\t\t\t\tif (availableVersion === undefined) {\n\t\t\t\t\tmissing.push({\n\t\t\t\t\t\troleId,\n\t\t\t\t\t\tcapabilityId: dependency.capabilityId,\n\t\t\t\t\t\trequestedVersion: dependency.capabilityVersion,\n\t\t\t\t\t\treason: \"missing\",\n\t\t\t\t\t});\n\t\t\t\t} else if (availableVersion !== dependency.capabilityVersion) {\n\t\t\t\t\tmissing.push({\n\t\t\t\t\t\troleId,\n\t\t\t\t\t\tcapabilityId: dependency.capabilityId,\n\t\t\t\t\t\trequestedVersion: dependency.capabilityVersion,\n\t\t\t\t\t\tavailableVersion,\n\t\t\t\t\t\treason: \"version_mismatch\",\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn {\n\t\t\t\troleId,\n\t\t\t\tstatus: missing.length > 0 ? \"missing\" : \"satisfied\",\n\t\t\t\tmissing,\n\t\t\t};\n\t\t},\n\t\trun(roleId, input, context) {\n\t\t\treturn execute(roleId, input, context);\n\t\t},\n\t};\n}\n"]}
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { t } from "../core/i18n/index.js";
|
|
2
|
-
import { FIRST_BATCH_ROLES } from "./first-roles.js";
|
|
3
|
-
const DEFINITION_VERSION = 1;
|
|
4
|
-
const FIRST_BATCH_RUNS = new Map(FIRST_BATCH_ROLES.map((role) => [role.metadata.roleId, role.run]));
|
|
5
|
-
/** Default deterministic run dispatch: first-batch callbacks; explicit failure otherwise. */
|
|
6
|
-
export function runFirstBatchRole(roleId, input, context) {
|
|
7
|
-
const callback = FIRST_BATCH_RUNS.get(roleId);
|
|
8
|
-
if (!callback)
|
|
9
|
-
throw new Error(t("No run binding for role: {roleId}", { roleId }));
|
|
10
|
-
return callback(input, context);
|
|
11
|
-
}
|
|
12
|
-
/** Binds the catalog's registered roles to child agent definitions. */
|
|
13
|
-
export function createRoleRunner(options) {
|
|
14
|
-
const catalog = options.catalog;
|
|
15
|
-
function requireRole(roleId) {
|
|
16
|
-
const metadata = catalog.get(roleId);
|
|
17
|
-
if (!metadata)
|
|
18
|
-
throw new Error(t("Unknown role: {roleId}", { roleId }));
|
|
19
|
-
return metadata;
|
|
20
|
-
}
|
|
21
|
-
async function execute(roleId, input, context) {
|
|
22
|
-
requireRole(roleId);
|
|
23
|
-
if (options.run)
|
|
24
|
-
return options.run(roleId, input, context);
|
|
25
|
-
return runFirstBatchRole(roleId, input, context);
|
|
26
|
-
}
|
|
27
|
-
return {
|
|
28
|
-
catalog,
|
|
29
|
-
listRoleIds() {
|
|
30
|
-
return catalog.list().map((role) => role.roleId);
|
|
31
|
-
},
|
|
32
|
-
createDefinition(roleId) {
|
|
33
|
-
const metadata = requireRole(roleId);
|
|
34
|
-
return {
|
|
35
|
-
id: `role:${metadata.roleId}`,
|
|
36
|
-
version: DEFINITION_VERSION,
|
|
37
|
-
role: "child-agent-controller",
|
|
38
|
-
...(options.owner === undefined ? {} : { owner: options.owner }),
|
|
39
|
-
run: (input, context) => execute(metadata.roleId, input, context),
|
|
40
|
-
};
|
|
41
|
-
},
|
|
42
|
-
checkCapabilities(roleId, availableCapabilities) {
|
|
43
|
-
const metadata = requireRole(roleId);
|
|
44
|
-
const registry = new Map(availableCapabilities.map((capability) => [capability.id, capability.version]));
|
|
45
|
-
const missing = [];
|
|
46
|
-
for (const dependency of metadata.capabilityDependencies) {
|
|
47
|
-
if (!dependency.required)
|
|
48
|
-
continue;
|
|
49
|
-
const availableVersion = registry.get(dependency.capabilityId);
|
|
50
|
-
if (availableVersion === undefined) {
|
|
51
|
-
missing.push({
|
|
52
|
-
roleId,
|
|
53
|
-
capabilityId: dependency.capabilityId,
|
|
54
|
-
requestedVersion: dependency.capabilityVersion,
|
|
55
|
-
reason: "missing",
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
else if (availableVersion !== dependency.capabilityVersion) {
|
|
59
|
-
missing.push({
|
|
60
|
-
roleId,
|
|
61
|
-
capabilityId: dependency.capabilityId,
|
|
62
|
-
requestedVersion: dependency.capabilityVersion,
|
|
63
|
-
availableVersion,
|
|
64
|
-
reason: "version_mismatch",
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
return {
|
|
69
|
-
roleId,
|
|
70
|
-
status: missing.length > 0 ? "missing" : "satisfied",
|
|
71
|
-
missing,
|
|
72
|
-
};
|
|
73
|
-
},
|
|
74
|
-
run(roleId, input, context) {
|
|
75
|
-
return execute(roleId, input, context);
|
|
76
|
-
},
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
//# sourceMappingURL=role-runner.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"role-runner.js","sourceRoot":"","sources":["../../src/profile/role-runner.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAE,CAAC,EAAE,MAAM,uBAAuB,CAAC;AAE1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAwFrD,MAAM,kBAAkB,GAAG,CAAC,CAAC;AAE7B,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAC/B,iBAAiB,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,CACjE,CAAC;AAEF,6FAA6F;AAC7F,MAAM,UAAU,iBAAiB,CAChC,MAAc,EACd,KAAwB,EACxB,OAA+B,EACoB;IACnD,MAAM,QAAQ,GAAG,gBAAgB,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAC9C,IAAI,CAAC,QAAQ;QAAE,MAAM,IAAI,KAAK,CAAC,CAAC,CAAC,mCAAmC,EAAE,EAAE,MAAM,EAA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AO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW;gBACpD,OAAO;aACP,CAAC;QAAA,CACF;QACD,GAAG,CAAC,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE;YAC3B,OAAO,OAAO,CAAC,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;QAAA,CACvC;KACD,CAAC;AAAA,CACF","sourcesContent":["/**\n * Role runner binding (2.2d) — maps registered `RoleMetadataV1` roles to child\n * `AgentDefinition`s executable through the experimental `AgentCompositionAPI`.\n *\n * The default run implementation is the deterministic first-batch role\n * callbacks (architecture-analyst / implementer / test-designer, 2.2c); a\n * caller may inject a real implementation via `run`. This slice never calls a\n * model.\n *\n * Library-level use works without any guard. When used through the\n * capability-runtime guards (`src/core/extensions/capability-runtime-guards.ts`),\n * the produced definitions must be defined/created by a manifest that declares\n * the `child-agent-controller` role and the `owner` must equal that manifest\n * id — the guards enforce this at the plugin boundary; this contract does not\n * duplicate guard logic.\n *\n * Required capability dependencies are checked explicitly (2.5a structured\n * `missing` shape) before activation (create/lease); they are never silently\n * skipped. Domain role runtimes live INSIDE the composition's child role: the\n * root/child two-value role enum is unchanged by design.\n */\nimport type { AgentDefinition, AgentExecutionContext } from \"../core/extensions/public-api.ts\";\nimport { t } from \"../core/i18n/index.ts\";\nimport type { AvailableCapabilityV1 } from \"./dependency-wiring.ts\";\nimport { FIRST_BATCH_ROLES } from \"./first-roles.ts\";\nimport type { RoleCatalogV1, RoleMetadataV1 } from \"./role-catalog.ts\";\n\n/** Deterministic role input: a single spec string (first-batch contract). */\nexport interface RoleRunnerInputV1 {\n\treadonly spec: string;\n}\n\n/** Deterministic role output: a single result string (first-batch contract). */\nexport interface RoleRunnerResultV1 {\n\treadonly result: string;\n}\n\n/**\n * Per-role run implementation. `context` is present when executed through\n * `AgentCompositionAPI`; direct deterministic execution may omit it.\n */\nexport type RoleRunCallbackV1 = (\n\tinput: RoleRunnerInputV1,\n\tcontext?: AgentExecutionContext,\n) => RoleRunnerResultV1 | Promise<RoleRunnerResultV1>;\n\n/** Runner-level run resolver; receives the roleId in addition to the callback arguments. */\nexport type RoleRunResolverV1 = (\n\troleId: string,\n\tinput: RoleRunnerInputV1,\n\tcontext?: AgentExecutionContext,\n) => RoleRunnerResultV1 | Promise<RoleRunnerResultV1>;\n\n/**\n * Role capability-dependency diagnostic: the 2.5a structured `missing` shape\n * (`capabilityId`/`requestedVersion`/`availableVersion?`/`reason`) with\n * `roleId` as the requester.\n */\nexport interface RoleMissingCapabilityV1 {\n\treadonly roleId: string;\n\treadonly capabilityId: string;\n\treadonly requestedVersion: number;\n\t/** Undefined when the capability is entirely absent from the registry. */\n\treadonly availableVersion?: number;\n\treadonly reason: \"missing\" | \"version_mismatch\";\n}\n\n/** Activation check result for one role's REQUIRED capability dependencies. */\nexport interface RoleCapabilityCheckV1 {\n\treadonly roleId: string;\n\treadonly status: \"satisfied\" | \"missing\";\n\t/** Required dependencies that are absent or version-mismatched; empty when satisfied. */\n\treadonly missing: readonly RoleMissingCapabilityV1[];\n}\n\nexport interface RoleRunnerOptionsV1 {\n\treadonly catalog: RoleCatalogV1;\n\t/**\n\t * Owner stamped onto produced child definitions. Required to equal the\n\t * declaring plugin manifest id when used behind the capability-runtime\n\t * guards; plain library use may omit it.\n\t */\n\treadonly owner?: string;\n\t/**\n\t * Injected run implementation replacing the deterministic first-batch\n\t * defaults entirely. Roles without any binding still fail explicitly on\n\t * execution.\n\t */\n\treadonly run?: RoleRunResolverV1;\n}\n\nexport interface RoleRunnerV1 {\n\treadonly catalog: RoleCatalogV1;\n\t/** Sorted registered roleIds. */\n\tlistRoleIds(): readonly string[];\n\t/**\n\t * Maps a registered role to a child agent definition (composition role\n\t * `child-agent-controller`, id `role:<roleId>`, version 1). Run the\n\t * capability check before creating/leasing an instance.\n\t */\n\tcreateDefinition(roleId: string): AgentDefinition<RoleRunnerInputV1, RoleRunnerResultV1>;\n\t/**\n\t * Pre-activation capability-dependency check against an exact-version\n\t * registry: a required dependency is satisfied only when the registry\n\t * offers the same capability id at exactly the requested version. Optional\n\t * dependencies never block activation and are not reported as missing.\n\t */\n\tcheckCapabilities(roleId: string, availableCapabilities: readonly AvailableCapabilityV1[]): RoleCapabilityCheckV1;\n\t/** Direct deterministic execution (the same run a produced definition binds). */\n\trun(roleId: string, input: RoleRunnerInputV1, context?: AgentExecutionContext): Promise<RoleRunnerResultV1>;\n}\n\nconst DEFINITION_VERSION = 1;\n\nconst FIRST_BATCH_RUNS = new Map<string, RoleRunCallbackV1>(\n\tFIRST_BATCH_ROLES.map((role) => [role.metadata.roleId, role.run]),\n);\n\n/** Default deterministic run dispatch: first-batch callbacks; explicit failure otherwise. */\nexport function runFirstBatchRole(\n\troleId: string,\n\tinput: RoleRunnerInputV1,\n\tcontext?: AgentExecutionContext,\n): RoleRunnerResultV1 | Promise<RoleRunnerResultV1> {\n\tconst callback = FIRST_BATCH_RUNS.get(roleId);\n\tif (!callback) throw new Error(t(\"No run binding for role: {roleId}\", { roleId }));\n\treturn callback(input, context);\n}\n\n/** Binds the catalog's registered roles to child agent definitions. */\nexport function createRoleRunner(options: RoleRunnerOptionsV1): RoleRunnerV1 {\n\tconst catalog = options.catalog;\n\n\tfunction requireRole(roleId: string): RoleMetadataV1 {\n\t\tconst metadata = catalog.get(roleId);\n\t\tif (!metadata) throw new Error(t(\"Unknown role: {roleId}\", { roleId }));\n\t\treturn metadata;\n\t}\n\n\tasync function execute(\n\t\troleId: string,\n\t\tinput: RoleRunnerInputV1,\n\t\tcontext?: AgentExecutionContext,\n\t): Promise<RoleRunnerResultV1> {\n\t\trequireRole(roleId);\n\t\tif (options.run) return options.run(roleId, input, context);\n\t\treturn runFirstBatchRole(roleId, input, context);\n\t}\n\n\treturn {\n\t\tcatalog,\n\t\tlistRoleIds() {\n\t\t\treturn catalog.list().map((role) => role.roleId);\n\t\t},\n\t\tcreateDefinition(roleId) {\n\t\t\tconst metadata = requireRole(roleId);\n\t\t\treturn {\n\t\t\t\tid: `role:${metadata.roleId}`,\n\t\t\t\tversion: DEFINITION_VERSION,\n\t\t\t\trole: \"child-agent-controller\",\n\t\t\t\t...(options.owner === undefined ? {} : { owner: options.owner }),\n\t\t\t\trun: (input, context) => execute(metadata.roleId, input, context),\n\t\t\t};\n\t\t},\n\t\tcheckCapabilities(roleId, availableCapabilities) {\n\t\t\tconst metadata = requireRole(roleId);\n\t\t\tconst registry = new Map(availableCapabilities.map((capability) => [capability.id, capability.version]));\n\t\t\tconst missing: RoleMissingCapabilityV1[] = [];\n\t\t\tfor (const dependency of metadata.capabilityDependencies) {\n\t\t\t\tif (!dependency.required) continue;\n\t\t\t\tconst availableVersion = registry.get(dependency.capabilityId);\n\t\t\t\tif (availableVersion === undefined) {\n\t\t\t\t\tmissing.push({\n\t\t\t\t\t\troleId,\n\t\t\t\t\t\tcapabilityId: dependency.capabilityId,\n\t\t\t\t\t\trequestedVersion: dependency.capabilityVersion,\n\t\t\t\t\t\treason: \"missing\",\n\t\t\t\t\t});\n\t\t\t\t} else if (availableVersion !== dependency.capabilityVersion) {\n\t\t\t\t\tmissing.push({\n\t\t\t\t\t\troleId,\n\t\t\t\t\t\tcapabilityId: dependency.capabilityId,\n\t\t\t\t\t\trequestedVersion: dependency.capabilityVersion,\n\t\t\t\t\t\tavailableVersion,\n\t\t\t\t\t\treason: \"version_mismatch\",\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn {\n\t\t\t\troleId,\n\t\t\t\tstatus: missing.length > 0 ? \"missing\" : \"satisfied\",\n\t\t\t\tmissing,\n\t\t\t};\n\t\t},\n\t\trun(roleId, input, context) {\n\t\t\treturn execute(roleId, input, context);\n\t\t},\n\t};\n}\n"]}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Root-agent-controller facade adapter (2.1a).
|
|
3
|
-
*
|
|
4
|
-
* Proves the default root can be created and run through the public facade:
|
|
5
|
-
* the adapter defines (or reuses) a `root-agent-controller` definition on the
|
|
6
|
-
* composition and runs each turn on a fresh instance with the controller
|
|
7
|
-
* lease acquired and released through the public API — no private main-loop
|
|
8
|
-
* access. The TUI keeps its transitional path until 2.1c.
|
|
9
|
-
*/
|
|
10
|
-
import type { AgentCompositionAPI } from "../core/extensions/public-api.ts";
|
|
11
|
-
export interface RootAgentFacadeTurnResultV1<TResult> {
|
|
12
|
-
readonly status: "succeeded" | "failed" | "cancelled" | "disposed";
|
|
13
|
-
readonly output?: TResult;
|
|
14
|
-
readonly revision: number;
|
|
15
|
-
readonly error?: Error;
|
|
16
|
-
readonly instanceId: string;
|
|
17
|
-
readonly leaseId: string;
|
|
18
|
-
}
|
|
19
|
-
export interface RootAgentFacadeV1<TInput = unknown, TResult = unknown> {
|
|
20
|
-
readonly definitionId: string;
|
|
21
|
-
/** Runs one minimal turn: create instance → acquire controller lease → run → release. */
|
|
22
|
-
runTurn(input: TInput, options?: {
|
|
23
|
-
readonly signal?: AbortSignal;
|
|
24
|
-
}): Promise<RootAgentFacadeTurnResultV1<TResult>>;
|
|
25
|
-
}
|
|
26
|
-
export declare function createRootAgentFacade<TInput, TResult = unknown>(options: {
|
|
27
|
-
readonly composition: AgentCompositionAPI;
|
|
28
|
-
readonly rootDefinitionId?: string;
|
|
29
|
-
readonly rootVersion?: number;
|
|
30
|
-
readonly owner?: string;
|
|
31
|
-
/** The root turn implementation (deterministic in tests). */
|
|
32
|
-
readonly run: (input: TInput, context: {
|
|
33
|
-
readonly signal?: AbortSignal;
|
|
34
|
-
}) => Promise<TResult> | TResult;
|
|
35
|
-
}): RootAgentFacadeV1<TInput, TResult>;
|
|
36
|
-
//# sourceMappingURL=root-facade.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"root-facade.d.ts","sourceRoot":"","sources":["../../src/profile/root-facade.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kCAAk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adapter (2.1a).\n *\n * Proves the default root can be created and run through the public facade:\n * the adapter defines (or reuses) a `root-agent-controller` definition on the\n * composition and runs each turn on a fresh instance with the controller\n * lease acquired and released through the public API — no private main-loop\n * access. The TUI keeps its transitional path until 2.1c.\n */\nimport type { AgentCompositionAPI } from \"../core/extensions/public-api.ts\";\nimport { t } from \"../core/i18n/index.ts\";\n\nexport interface RootAgentFacadeTurnResultV1<TResult> {\n\treadonly status: \"succeeded\" | \"failed\" | \"cancelled\" | \"disposed\";\n\treadonly output?: TResult;\n\treadonly revision: number;\n\treadonly error?: Error;\n\treadonly instanceId: string;\n\treadonly leaseId: string;\n}\n\nexport interface RootAgentFacadeV1<TInput = unknown, TResult = unknown> {\n\treadonly definitionId: string;\n\t/** Runs one minimal turn: create instance → acquire controller lease → run → release. */\n\trunTurn(input: TInput, options?: { readonly signal?: AbortSignal }): Promise<RootAgentFacadeTurnResultV1<TResult>>;\n}\n\nexport function createRootAgentFacade<TInput, TResult = unknown>(options: {\n\treadonly composition: AgentCompositionAPI;\n\treadonly rootDefinitionId?: string;\n\treadonly rootVersion?: number;\n\treadonly owner?: string;\n\t/** The root turn implementation (deterministic in tests). */\n\treadonly run: (input: TInput, context: { readonly signal?: AbortSignal }) => Promise<TResult> | TResult;\n}): RootAgentFacadeV1<TInput, TResult> {\n\tconst definitionId = options.rootDefinitionId ?? \"root-agent-controller\";\n\tconst owner = options.owner ?? \"root-facade\";\n\tconst definition = options.composition.define({\n\t\tid: definitionId,\n\t\tversion: options.rootVersion ?? 1,\n\t\trole: \"root-agent-controller\",\n\t\trun: (input: TInput, context: { readonly signal?: AbortSignal }) => options.run(input, context),\n\t});\n\tlet turnInFlight = false;\n\n\treturn {\n\t\tdefinitionId,\n\t\tasync runTurn(input, runOptions) {\n\t\t\t// Single-controller rule: one turn at a time per root facade.\n\t\t\tif (turnInFlight) {\n\t\t\t\tthrow new Error(t(\"Root facade is already running a turn\"));\n\t\t\t}\n\t\t\tturnInFlight = true;\n\t\t\ttry {\n\t\t\t\t// A composition instance is single-run; every turn gets a fresh one.\n\t\t\t\tconst instance = options.composition.create<TInput, TResult>(definition);\n\t\t\t\tconst lease = await instance.acquireControllerLease(owner);\n\t\t\t\tconst leaseId = lease.id;\n\t\t\t\ttry {\n\t\t\t\t\tconst operation = instance.run(input, { lease, signal: runOptions?.signal });\n\t\t\t\t\tawait operation.result;\n\t\t\t\t\tconst instanceResult = await instance.wait();\n\t\t\t\t\treturn {\n\t\t\t\t\t\tstatus: instanceResult.status,\n\t\t\t\t\t\t...(instanceResult.output !== undefined ? { output: instanceResult.output } : {}),\n\t\t\t\t\t\t...(instanceResult.error instanceof Error ? { error: instanceResult.error } : {}),\n\t\t\t\t\t\trevision: instanceResult.revision,\n\t\t\t\t\t\tinstanceId: instance.id,\n\t\t\t\t\t\tleaseId,\n\t\t\t\t\t};\n\t\t\t\t} finally {\n\t\t\t\t\tif (lease.isActive()) await lease.release();\n\t\t\t\t}\n\t\t\t} finally {\n\t\t\t\tturnInFlight = false;\n\t\t\t}\n\t\t},\n\t};\n}\n"]}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { t } from "../core/i18n/index.js";
|
|
2
|
-
export function createRootAgentFacade(options) {
|
|
3
|
-
const definitionId = options.rootDefinitionId ?? "root-agent-controller";
|
|
4
|
-
const owner = options.owner ?? "root-facade";
|
|
5
|
-
const definition = options.composition.define({
|
|
6
|
-
id: definitionId,
|
|
7
|
-
version: options.rootVersion ?? 1,
|
|
8
|
-
role: "root-agent-controller",
|
|
9
|
-
run: (input, context) => options.run(input, context),
|
|
10
|
-
});
|
|
11
|
-
let turnInFlight = false;
|
|
12
|
-
return {
|
|
13
|
-
definitionId,
|
|
14
|
-
async runTurn(input, runOptions) {
|
|
15
|
-
// Single-controller rule: one turn at a time per root facade.
|
|
16
|
-
if (turnInFlight) {
|
|
17
|
-
throw new Error(t("Root facade is already running a turn"));
|
|
18
|
-
}
|
|
19
|
-
turnInFlight = true;
|
|
20
|
-
try {
|
|
21
|
-
// A composition instance is single-run; every turn gets a fresh one.
|
|
22
|
-
const instance = options.composition.create(definition);
|
|
23
|
-
const lease = await instance.acquireControllerLease(owner);
|
|
24
|
-
const leaseId = lease.id;
|
|
25
|
-
try {
|
|
26
|
-
const operation = instance.run(input, { lease, signal: runOptions?.signal });
|
|
27
|
-
await operation.result;
|
|
28
|
-
const instanceResult = await instance.wait();
|
|
29
|
-
return {
|
|
30
|
-
status: instanceResult.status,
|
|
31
|
-
...(instanceResult.output !== undefined ? { output: instanceResult.output } : {}),
|
|
32
|
-
...(instanceResult.error instanceof Error ? { error: instanceResult.error } : {}),
|
|
33
|
-
revision: instanceResult.revision,
|
|
34
|
-
instanceId: instance.id,
|
|
35
|
-
leaseId,
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
finally {
|
|
39
|
-
if (lease.isActive())
|
|
40
|
-
await lease.release();
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
finally {
|
|
44
|
-
turnInFlight = false;
|
|
45
|
-
}
|
|
46
|
-
},
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
//# sourceMappingURL=root-facade.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"root-facade.js","sourceRoot":"","sources":["../../src/profile/root-facade.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,CAAC,EAAE,MAAM,uBAAuB,CAAC;AAiB1C,MAAM,UAAU,qBAAqB,CAA4B,OAOhE,EAAsC;IACtC,MAAM,YAAY,GAAG,OAAO,CAAC,gBAAgB,IAAI,uBAAuB,CAAC;IACzE,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,aAAa,CAAC;IAC7C,MAAM,UAAU,GAAG,OAAO,CAAC,WAAW,CAAC,MAAM,CAAC;QAC7C,EAAE,EAAE,YAAY;QAChB,OAAO,EAAE,OAAO,CAAC,WAAW,IAAI,CAAC;QACjC,IAAI,EAAE,uBAAuB;QAC7B,GAAG,EAAE,CAAC,K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AQ;wBACjC,UAAU,EAAE,QAAQ,CAAC,EAAE;wBACvB,OAAO;qBACP,CAAC;gBACH,CAAC;wBAAS,CAAC;oBACV,IAAI,KAAK,CAAC,QAAQ,EAAE;wBAAE,MAAM,KAAK,CAAC,OAAO,EAAE,CAAC;gBAC7C,CAAC;YACF,CAAC;oBAAS,CAAC;gBACV,YAAY,GAAG,KAAK,CAAC;YACtB,CAAC;QAAA,CACD;KACD,CAAC;AAAA,CACF","sourcesContent":["/**\n * Root-agent-controller facade adapter (2.1a).\n *\n * Proves the default root can be created and run through the public facade:\n * the adapter defines (or reuses) a `root-agent-controller` definition on the\n * composition and runs each turn on a fresh instance with the controller\n * lease acquired and released through the public API — no private main-loop\n * access. The TUI keeps its transitional path until 2.1c.\n */\nimport type { AgentCompositionAPI } from \"../core/extensions/public-api.ts\";\nimport { t } from \"../core/i18n/index.ts\";\n\nexport interface RootAgentFacadeTurnResultV1<TResult> {\n\treadonly status: \"succeeded\" | \"failed\" | \"cancelled\" | \"disposed\";\n\treadonly output?: TResult;\n\treadonly revision: number;\n\treadonly error?: Error;\n\treadonly instanceId: string;\n\treadonly leaseId: string;\n}\n\nexport interface RootAgentFacadeV1<TInput = unknown, TResult = unknown> {\n\treadonly definitionId: string;\n\t/** Runs one minimal turn: create instance → acquire controller lease → run → release. */\n\trunTurn(input: TInput, options?: { readonly signal?: AbortSignal }): Promise<RootAgentFacadeTurnResultV1<TResult>>;\n}\n\nexport function createRootAgentFacade<TInput, TResult = unknown>(options: {\n\treadonly composition: AgentCompositionAPI;\n\treadonly rootDefinitionId?: string;\n\treadonly rootVersion?: number;\n\treadonly owner?: string;\n\t/** The root turn implementation (deterministic in tests). */\n\treadonly run: (input: TInput, context: { readonly signal?: AbortSignal }) => Promise<TResult> | TResult;\n}): RootAgentFacadeV1<TInput, TResult> {\n\tconst definitionId = options.rootDefinitionId ?? \"root-agent-controller\";\n\tconst owner = options.owner ?? \"root-facade\";\n\tconst definition = options.composition.define({\n\t\tid: definitionId,\n\t\tversion: options.rootVersion ?? 1,\n\t\trole: \"root-agent-controller\",\n\t\trun: (input: TInput, context: { readonly signal?: AbortSignal }) => options.run(input, context),\n\t});\n\tlet turnInFlight = false;\n\n\treturn {\n\t\tdefinitionId,\n\t\tasync runTurn(input, runOptions) {\n\t\t\t// Single-controller rule: one turn at a time per root facade.\n\t\t\tif (turnInFlight) {\n\t\t\t\tthrow new Error(t(\"Root facade is already running a turn\"));\n\t\t\t}\n\t\t\tturnInFlight = true;\n\t\t\ttry {\n\t\t\t\t// A composition instance is single-run; every turn gets a fresh one.\n\t\t\t\tconst instance = options.composition.create<TInput, TResult>(definition);\n\t\t\t\tconst lease = await instance.acquireControllerLease(owner);\n\t\t\t\tconst leaseId = lease.id;\n\t\t\t\ttry {\n\t\t\t\t\tconst operation = instance.run(input, { lease, signal: runOptions?.signal });\n\t\t\t\t\tawait operation.result;\n\t\t\t\t\tconst instanceResult = await instance.wait();\n\t\t\t\t\treturn {\n\t\t\t\t\t\tstatus: instanceResult.status,\n\t\t\t\t\t\t...(instanceResult.output !== undefined ? { output: instanceResult.output } : {}),\n\t\t\t\t\t\t...(instanceResult.error instanceof Error ? { error: instanceResult.error } : {}),\n\t\t\t\t\t\trevision: instanceResult.revision,\n\t\t\t\t\t\tinstanceId: instance.id,\n\t\t\t\t\t\tleaseId,\n\t\t\t\t\t};\n\t\t\t\t} finally {\n\t\t\t\t\tif (lease.isActive()) await lease.release();\n\t\t\t\t}\n\t\t\t} finally {\n\t\t\t\tturnInFlight = false;\n\t\t\t}\n\t\t},\n\t};\n}\n"]}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Skill/MCP discovery wiring (4.4) — turns discovered Skill and MCP tool
|
|
3
|
-
* capabilities into profile-assembly inputs, with all four failure modes
|
|
4
|
-
* explicit BEFORE a session exists: missing dependencies, version conflicts
|
|
5
|
-
* between sources, disabled items, and replacements.
|
|
6
|
-
*
|
|
7
|
-
* Each registered item (a Skill or an MCP server) contributes capability
|
|
8
|
-
* declarations; MCP tools derive capability ids `mcp:<serverId>:<toolName>`.
|
|
9
|
-
* Two enabled items declaring the SAME capability id with DIFFERENT
|
|
10
|
-
* versions is a structured version conflict; identical versions dedupe.
|
|
11
|
-
* Disabled items contribute nothing (replacement = disable + register).
|
|
12
|
-
* Resolution reuses the 2.5a exact-version wiring — no kernel special
|
|
13
|
-
* cases. Implementation lives entirely in profile/assembly land.
|
|
14
|
-
*/
|
|
15
|
-
import type { ProfileDependencyWiringV1 } from "./dependency-wiring.ts";
|
|
16
|
-
export type DiscoverySourceKindV1 = "skill" | "mcp";
|
|
17
|
-
export interface DiscoveredItemV1 {
|
|
18
|
-
readonly sourceKind: DiscoverySourceKindV1;
|
|
19
|
-
readonly itemId: string;
|
|
20
|
-
readonly version: string;
|
|
21
|
-
readonly capabilities: readonly {
|
|
22
|
-
readonly id: string;
|
|
23
|
-
readonly version: number;
|
|
24
|
-
}[];
|
|
25
|
-
readonly enabled: boolean;
|
|
26
|
-
}
|
|
27
|
-
export interface DiscoveryVersionConflictV1 {
|
|
28
|
-
readonly capabilityId: string;
|
|
29
|
-
readonly declarations: readonly {
|
|
30
|
-
readonly sourceKind: DiscoverySourceKindV1;
|
|
31
|
-
readonly itemId: string;
|
|
32
|
-
readonly version: number;
|
|
33
|
-
}[];
|
|
34
|
-
}
|
|
35
|
-
export interface DiscoveryWiringV1 {
|
|
36
|
-
register(item: DiscoveredItemV1): void;
|
|
37
|
-
deriveMcpItem(input: {
|
|
38
|
-
readonly serverId: string;
|
|
39
|
-
readonly version: string;
|
|
40
|
-
readonly tools: readonly {
|
|
41
|
-
readonly name: string;
|
|
42
|
-
readonly description?: string;
|
|
43
|
-
}[];
|
|
44
|
-
readonly enabled?: boolean;
|
|
45
|
-
}): DiscoveredItemV1;
|
|
46
|
-
wireDiscoveredDependencies(input: {
|
|
47
|
-
readonly availableCapabilities: readonly {
|
|
48
|
-
readonly id: string;
|
|
49
|
-
readonly version: number;
|
|
50
|
-
}[];
|
|
51
|
-
readonly disabledItemIds?: readonly string[];
|
|
52
|
-
}): {
|
|
53
|
-
readonly conflicts: readonly DiscoveryVersionConflictV1[];
|
|
54
|
-
readonly wiring: ProfileDependencyWiringV1;
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
export declare function createSkillDiscoveryWiring(): DiscoveryWiringV1;
|
|
58
|
-
//# sourceMappingURL=skill-discovery-wiring.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"skill-discovery-wiring.d.ts","sourceRoot":"","sources":["../../src/profile/skill-discovery-wiring.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AAIxE,MAAM,MAAM,qBAAqB,GAAG,OAAO,GAAG,KAAK,CAAC;AAEpD,MAAM,WAAW,gBAAgB;IAChC,QAAQ,CAAC,UAAU,EAAE,qBAAqB,CAAC;IAC3C,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,YAAY,EAAE,SAAS;QAAE,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACpF,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;CAC1B;AAED,MAAM,WAAW,0BAA0B;IAC1C,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,YAAY,EAAE,SAAS;QAC/B,QAAQ,CAAC,UAAU,EAAE,qBAAqB,CAAC;QAC3C,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;QACxB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;KACzB,EAAE,CAAC;CACJ;AAED,MAAM,WAAW,iBAAiB;IACjC,QAAQ,CAAC,IAAI,EAAE,gBAAgB,GAAG,IAAI,CAAC;IACvC,aAAa,CAAC,KAAK,EAAE;QACpB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;QAC1B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;QACzB,QAAQ,CAAC,KAAK,EAAE,SAAS;YAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;YAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAA;SAAE,EAAE,CAAC;QACpF,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;KAC3B,GAAG,gBAAgB,CAAC;IACrB,0BAA0B,CAAC,KAAK,EAAE;QACjC,QAAQ,CAAC,qBAAqB,EAAE,SAAS;YAAE,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;YAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;SAAE,EAAE,CAAC;QAC7F,QAAQ,CAAC,eAAe,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;KAC7C,GAAG;QAAE,QAAQ,CAAC,SAAS,EAAE,SAAS,0BAA0B,EAAE,CAAC;QAAC,QAAQ,CAAC,MAAM,EAAE,yBAAyB,CAAA;KAAE,CAAC;CAC9G;AAED,wBAAgB,0BAA0B,IAAI,iBAAiB,CAoE9D","sourcesContent":["/**\n * Skill/MCP discovery wiring (4.4) — turns discovered Skill and MCP tool\n * capabilities into profile-assembly inputs, with all four failure modes\n * explicit BEFORE a session exists: missing dependencies, version conflicts\n * between sources, disabled items, and replacements.\n *\n * Each registered item (a Skill or an MCP server) contributes capability\n * declarations; MCP tools derive capability ids `mcp:<serverId>:<toolName>`.\n * Two enabled items declaring the SAME capability id with DIFFERENT\n * versions is a structured version conflict; identical versions dedupe.\n * Disabled items contribute nothing (replacement = disable + register).\n * Resolution reuses the 2.5a exact-version wiring — no kernel special\n * cases. Implementation lives entirely in profile/assembly land.\n */\n\nimport { t } from \"../core/i18n/index.ts\";\nimport type { ProfileDependencyWiringV1 } from \"./dependency-wiring.ts\";\nimport { wireProfileDependencies } from \"./dependency-wiring.ts\";\nimport type { ResolvedPluginManifestV1 } from \"./identity.ts\";\n\nexport type DiscoverySourceKindV1 = \"skill\" | \"mcp\";\n\nexport interface DiscoveredItemV1 {\n\treadonly sourceKind: DiscoverySourceKindV1;\n\treadonly itemId: string;\n\treadonly version: string;\n\treadonly capabilities: readonly { readonly id: string; readonly version: number }[];\n\treadonly enabled: boolean;\n}\n\nexport interface DiscoveryVersionConflictV1 {\n\treadonly capabilityId: string;\n\treadonly declarations: readonly {\n\t\treadonly sourceKind: DiscoverySourceKindV1;\n\t\treadonly itemId: string;\n\t\treadonly version: number;\n\t}[];\n}\n\nexport interface DiscoveryWiringV1 {\n\tregister(item: DiscoveredItemV1): void;\n\tderiveMcpItem(input: {\n\t\treadonly serverId: string;\n\t\treadonly version: string;\n\t\treadonly tools: readonly { readonly name: string; readonly description?: string }[];\n\t\treadonly enabled?: boolean;\n\t}): DiscoveredItemV1;\n\twireDiscoveredDependencies(input: {\n\t\treadonly availableCapabilities: readonly { readonly id: string; readonly version: number }[];\n\t\treadonly disabledItemIds?: readonly string[];\n\t}): { readonly conflicts: readonly DiscoveryVersionConflictV1[]; readonly wiring: ProfileDependencyWiringV1 };\n}\n\nexport function createSkillDiscoveryWiring(): DiscoveryWiringV1 {\n\tconst items = new Map<string, DiscoveredItemV1>();\n\tconst keyOf = (item: DiscoveredItemV1): string => `${item.sourceKind}:${item.itemId}`;\n\n\treturn {\n\t\tregister(item) {\n\t\t\tif (item.itemId.trim().length === 0) throw new Error(t(\"Discovered item id must be a non-empty string\"));\n\t\t\tconst existing = items.get(keyOf(item));\n\t\t\tif (existing && existing.version !== item.version) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\tt(\"Item {key} re-registered with a different version ({from} -> {to})\", {\n\t\t\t\t\t\tkey: keyOf(item),\n\t\t\t\t\t\tfrom: existing.version,\n\t\t\t\t\t\tto: item.version,\n\t\t\t\t\t}),\n\t\t\t\t);\n\t\t\t}\n\t\t\titems.set(keyOf(item), { ...item, capabilities: [...item.capabilities] });\n\t\t},\n\t\tderiveMcpItem({ serverId, version, tools, enabled = true }) {\n\t\t\treturn {\n\t\t\t\tsourceKind: \"mcp\",\n\t\t\t\titemId: serverId,\n\t\t\t\tversion,\n\t\t\t\tcapabilities: tools.map((tool) => ({ id: `mcp:${serverId}:${tool.name}`, version: 1 })),\n\t\t\t\tenabled,\n\t\t\t};\n\t\t},\n\t\twireDiscoveredDependencies({ availableCapabilities, disabledItemIds }) {\n\t\t\tconst disabled = new Set(disabledItemIds ?? []);\n\t\t\tconst enabledItems = [...items.values()].filter((item) => item.enabled && !disabled.has(keyOf(item)));\n\n\t\t\t// Version conflicts: same capability id, different declared versions,\n\t\t\t// across different enabled items.\n\t\t\tconst byCapability = new Map<\n\t\t\t\tstring,\n\t\t\t\tArray<{ sourceKind: DiscoverySourceKindV1; itemId: string; version: number }>\n\t\t\t>();\n\t\t\tfor (const item of enabledItems) {\n\t\t\t\tfor (const capability of item.capabilities) {\n\t\t\t\t\tconst list = byCapability.get(capability.id) ?? [];\n\t\t\t\t\tif (!list.some((entry) => entry.itemId === item.itemId)) {\n\t\t\t\t\t\tlist.push({ sourceKind: item.sourceKind, itemId: item.itemId, version: capability.version });\n\t\t\t\t\t}\n\t\t\t\t\tbyCapability.set(capability.id, list);\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst conflicts: DiscoveryVersionConflictV1[] = [];\n\t\t\tfor (const [capabilityId, declarations] of byCapability) {\n\t\t\t\tconst versions = new Set(declarations.map((entry) => entry.version));\n\t\t\t\tif (versions.size > 1) conflicts.push({ capabilityId, declarations });\n\t\t\t}\n\n\t\t\t// Disabled items stay in the manifests so the wiring result shows an\n\t\t\t// explicit skipped_disabled entry (visible audit, not silent removal).\n\t\t\tconst manifests: ResolvedPluginManifestV1[] = [...items.values()].map((item) => ({\n\t\t\t\tpluginId: keyOf(item),\n\t\t\t\tpluginVersion: item.version,\n\t\t\t\tcapabilityRefs: [...item.capabilities],\n\t\t\t}));\n\t\t\tconst wiring = wireProfileDependencies({\n\t\t\t\tresolvedPlugins: manifests,\n\t\t\t\tavailableCapabilities,\n\t\t\t\tdisabledPluginIds: disabledItemIds,\n\t\t\t});\n\t\t\treturn { conflicts: Object.freeze(conflicts), wiring };\n\t\t},\n\t};\n}\n"]}
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Skill/MCP discovery wiring (4.4) — turns discovered Skill and MCP tool
|
|
3
|
-
* capabilities into profile-assembly inputs, with all four failure modes
|
|
4
|
-
* explicit BEFORE a session exists: missing dependencies, version conflicts
|
|
5
|
-
* between sources, disabled items, and replacements.
|
|
6
|
-
*
|
|
7
|
-
* Each registered item (a Skill or an MCP server) contributes capability
|
|
8
|
-
* declarations; MCP tools derive capability ids `mcp:<serverId>:<toolName>`.
|
|
9
|
-
* Two enabled items declaring the SAME capability id with DIFFERENT
|
|
10
|
-
* versions is a structured version conflict; identical versions dedupe.
|
|
11
|
-
* Disabled items contribute nothing (replacement = disable + register).
|
|
12
|
-
* Resolution reuses the 2.5a exact-version wiring — no kernel special
|
|
13
|
-
* cases. Implementation lives entirely in profile/assembly land.
|
|
14
|
-
*/
|
|
15
|
-
import { t } from "../core/i18n/index.js";
|
|
16
|
-
import { wireProfileDependencies } from "./dependency-wiring.js";
|
|
17
|
-
export function createSkillDiscoveryWiring() {
|
|
18
|
-
const items = new Map();
|
|
19
|
-
const keyOf = (item) => `${item.sourceKind}:${item.itemId}`;
|
|
20
|
-
return {
|
|
21
|
-
register(item) {
|
|
22
|
-
if (item.itemId.trim().length === 0)
|
|
23
|
-
throw new Error(t("Discovered item id must be a non-empty string"));
|
|
24
|
-
const existing = items.get(keyOf(item));
|
|
25
|
-
if (existing && existing.version !== item.version) {
|
|
26
|
-
throw new Error(t("Item {key} re-registered with a different version ({from} -> {to})", {
|
|
27
|
-
key: keyOf(item),
|
|
28
|
-
from: existing.version,
|
|
29
|
-
to: item.version,
|
|
30
|
-
}));
|
|
31
|
-
}
|
|
32
|
-
items.set(keyOf(item), { ...item, capabilities: [...item.capabilities] });
|
|
33
|
-
},
|
|
34
|
-
deriveMcpItem({ serverId, version, tools, enabled = true }) {
|
|
35
|
-
return {
|
|
36
|
-
sourceKind: "mcp",
|
|
37
|
-
itemId: serverId,
|
|
38
|
-
version,
|
|
39
|
-
capabilities: tools.map((tool) => ({ id: `mcp:${serverId}:${tool.name}`, version: 1 })),
|
|
40
|
-
enabled,
|
|
41
|
-
};
|
|
42
|
-
},
|
|
43
|
-
wireDiscoveredDependencies({ availableCapabilities, disabledItemIds }) {
|
|
44
|
-
const disabled = new Set(disabledItemIds ?? []);
|
|
45
|
-
const enabledItems = [...items.values()].filter((item) => item.enabled && !disabled.has(keyOf(item)));
|
|
46
|
-
// Version conflicts: same capability id, different declared versions,
|
|
47
|
-
// across different enabled items.
|
|
48
|
-
const byCapability = new Map();
|
|
49
|
-
for (const item of enabledItems) {
|
|
50
|
-
for (const capability of item.capabilities) {
|
|
51
|
-
const list = byCapability.get(capability.id) ?? [];
|
|
52
|
-
if (!list.some((entry) => entry.itemId === item.itemId)) {
|
|
53
|
-
list.push({ sourceKind: item.sourceKind, itemId: item.itemId, version: capability.version });
|
|
54
|
-
}
|
|
55
|
-
byCapability.set(capability.id, list);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
const conflicts = [];
|
|
59
|
-
for (const [capabilityId, declarations] of byCapability) {
|
|
60
|
-
const versions = new Set(declarations.map((entry) => entry.version));
|
|
61
|
-
if (versions.size > 1)
|
|
62
|
-
conflicts.push({ capabilityId, declarations });
|
|
63
|
-
}
|
|
64
|
-
// Disabled items stay in the manifests so the wiring result shows an
|
|
65
|
-
// explicit skipped_disabled entry (visible audit, not silent removal).
|
|
66
|
-
const manifests = [...items.values()].map((item) => ({
|
|
67
|
-
pluginId: keyOf(item),
|
|
68
|
-
pluginVersion: item.version,
|
|
69
|
-
capabilityRefs: [...item.capabilities],
|
|
70
|
-
}));
|
|
71
|
-
const wiring = wireProfileDependencies({
|
|
72
|
-
resolvedPlugins: manifests,
|
|
73
|
-
availableCapabilities,
|
|
74
|
-
disabledPluginIds: disabledItemIds,
|
|
75
|
-
});
|
|
76
|
-
return { conflicts: Object.freeze(conflicts), wiring };
|
|
77
|
-
},
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
//# sourceMappingURL=skill-discovery-wiring.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"skill-discovery-wiring.js","sourceRoot":"","sources":["../../src/profile/skill-discovery-wiring.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,uBAAuB,CAAC;AAE1C,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAoCjE,MAAM,UAAU,0BAA0B,GAAsB;IAC/D,MAAM,KAAK,GAAG,IAAI,GAAG,EAA4B,CAAC;IAClD,MAAM,KAAK,GAAG,CAAC,IAAsB,EAAU,EAAE,CAAC,GAAG,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;IAEtF,OAAO;QACN,QAAQ,CAAC,IAAI,EAAE;YACd,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC;gBAAE,MAAM,IAAI,KAAK,CAAC,CAAC,CAAC,+CAA+C,CAAC,CAAC,CAAC;YACzG,MAAM,QAAQ,GAAG,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;YACxC,IAAI,QAAQ,IAAI,QAAQ,CAAC,OAAO,KAAK,IAAI,CAAC,OAAO,EAAE,CAAC;gBACnD,MAAM,IAAI,KAAK,CACd,CAAC,CAAC,oEAAoE,EAAE;oBACvE,GAAG,EAAE,KAAK,CAAC,IAAI,CAAC;oBAChB,IAAI,EAAE,QAAQ,CAAC,OAAO;oBACtB,EAAE,EAAE,IAAI,CAAC,OAAO;iBACh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C,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;QAAA,CACvD;KACD,CAAC;AAAA,CACF","sourcesContent":["/**\n * Skill/MCP discovery wiring (4.4) — turns discovered Skill and MCP tool\n * capabilities into profile-assembly inputs, with all four failure modes\n * explicit BEFORE a session exists: missing dependencies, version conflicts\n * between sources, disabled items, and replacements.\n *\n * Each registered item (a Skill or an MCP server) contributes capability\n * declarations; MCP tools derive capability ids `mcp:<serverId>:<toolName>`.\n * Two enabled items declaring the SAME capability id with DIFFERENT\n * versions is a structured version conflict; identical versions dedupe.\n * Disabled items contribute nothing (replacement = disable + register).\n * Resolution reuses the 2.5a exact-version wiring — no kernel special\n * cases. Implementation lives entirely in profile/assembly land.\n */\n\nimport { t } from \"../core/i18n/index.ts\";\nimport type { ProfileDependencyWiringV1 } from \"./dependency-wiring.ts\";\nimport { wireProfileDependencies } from \"./dependency-wiring.ts\";\nimport type { ResolvedPluginManifestV1 } from \"./identity.ts\";\n\nexport type DiscoverySourceKindV1 = \"skill\" | \"mcp\";\n\nexport interface DiscoveredItemV1 {\n\treadonly sourceKind: DiscoverySourceKindV1;\n\treadonly itemId: string;\n\treadonly version: string;\n\treadonly capabilities: readonly { readonly id: string; readonly version: number }[];\n\treadonly enabled: boolean;\n}\n\nexport interface DiscoveryVersionConflictV1 {\n\treadonly capabilityId: string;\n\treadonly declarations: readonly {\n\t\treadonly sourceKind: DiscoverySourceKindV1;\n\t\treadonly itemId: string;\n\t\treadonly version: number;\n\t}[];\n}\n\nexport interface DiscoveryWiringV1 {\n\tregister(item: DiscoveredItemV1): void;\n\tderiveMcpItem(input: {\n\t\treadonly serverId: string;\n\t\treadonly version: string;\n\t\treadonly tools: readonly { readonly name: string; readonly description?: string }[];\n\t\treadonly enabled?: boolean;\n\t}): DiscoveredItemV1;\n\twireDiscoveredDependencies(input: {\n\t\treadonly availableCapabilities: readonly { readonly id: string; readonly version: number }[];\n\t\treadonly disabledItemIds?: readonly string[];\n\t}): { readonly conflicts: readonly DiscoveryVersionConflictV1[]; readonly wiring: ProfileDependencyWiringV1 };\n}\n\nexport function createSkillDiscoveryWiring(): DiscoveryWiringV1 {\n\tconst items = new Map<string, DiscoveredItemV1>();\n\tconst keyOf = (item: DiscoveredItemV1): string => `${item.sourceKind}:${item.itemId}`;\n\n\treturn {\n\t\tregister(item) {\n\t\t\tif (item.itemId.trim().length === 0) throw new Error(t(\"Discovered item id must be a non-empty string\"));\n\t\t\tconst existing = items.get(keyOf(item));\n\t\t\tif (existing && existing.version !== item.version) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\tt(\"Item {key} re-registered with a different version ({from} -> {to})\", {\n\t\t\t\t\t\tkey: keyOf(item),\n\t\t\t\t\t\tfrom: existing.version,\n\t\t\t\t\t\tto: item.version,\n\t\t\t\t\t}),\n\t\t\t\t);\n\t\t\t}\n\t\t\titems.set(keyOf(item), { ...item, capabilities: [...item.capabilities] });\n\t\t},\n\t\tderiveMcpItem({ serverId, version, tools, enabled = true }) {\n\t\t\treturn {\n\t\t\t\tsourceKind: \"mcp\",\n\t\t\t\titemId: serverId,\n\t\t\t\tversion,\n\t\t\t\tcapabilities: tools.map((tool) => ({ id: `mcp:${serverId}:${tool.name}`, version: 1 })),\n\t\t\t\tenabled,\n\t\t\t};\n\t\t},\n\t\twireDiscoveredDependencies({ availableCapabilities, disabledItemIds }) {\n\t\t\tconst disabled = new Set(disabledItemIds ?? []);\n\t\t\tconst enabledItems = [...items.values()].filter((item) => item.enabled && !disabled.has(keyOf(item)));\n\n\t\t\t// Version conflicts: same capability id, different declared versions,\n\t\t\t// across different enabled items.\n\t\t\tconst byCapability = new Map<\n\t\t\t\tstring,\n\t\t\t\tArray<{ sourceKind: DiscoverySourceKindV1; itemId: string; version: number }>\n\t\t\t>();\n\t\t\tfor (const item of enabledItems) {\n\t\t\t\tfor (const capability of item.capabilities) {\n\t\t\t\t\tconst list = byCapability.get(capability.id) ?? [];\n\t\t\t\t\tif (!list.some((entry) => entry.itemId === item.itemId)) {\n\t\t\t\t\t\tlist.push({ sourceKind: item.sourceKind, itemId: item.itemId, version: capability.version });\n\t\t\t\t\t}\n\t\t\t\t\tbyCapability.set(capability.id, list);\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst conflicts: DiscoveryVersionConflictV1[] = [];\n\t\t\tfor (const [capabilityId, declarations] of byCapability) {\n\t\t\t\tconst versions = new Set(declarations.map((entry) => entry.version));\n\t\t\t\tif (versions.size > 1) conflicts.push({ capabilityId, declarations });\n\t\t\t}\n\n\t\t\t// Disabled items stay in the manifests so the wiring result shows an\n\t\t\t// explicit skipped_disabled entry (visible audit, not silent removal).\n\t\t\tconst manifests: ResolvedPluginManifestV1[] = [...items.values()].map((item) => ({\n\t\t\t\tpluginId: keyOf(item),\n\t\t\t\tpluginVersion: item.version,\n\t\t\t\tcapabilityRefs: [...item.capabilities],\n\t\t\t}));\n\t\t\tconst wiring = wireProfileDependencies({\n\t\t\t\tresolvedPlugins: manifests,\n\t\t\t\tavailableCapabilities,\n\t\t\t\tdisabledPluginIds: disabledItemIds,\n\t\t\t});\n\t\t\treturn { conflicts: Object.freeze(conflicts), wiring };\n\t\t},\n\t};\n}\n"]}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Generic transition/evidence/revision store (2.3a) — the domain-agnostic
|
|
3
|
-
* contract base for Goal/Plan/Todo plugins.
|
|
4
|
-
*
|
|
5
|
-
* The store knows NOTHING about goal/plan/todo semantics. It only enforces:
|
|
6
|
-
* - causality: a transition's `fromStatus` must equal the entity's current
|
|
7
|
-
* status (null = initial transition), otherwise an explicit conflict;
|
|
8
|
-
* - idempotency: replaying the same (domain, entityId, operationId, toStatus)
|
|
9
|
-
* returns the existing record and never advances the revision;
|
|
10
|
-
* - evidence: every transition carries structured evidence references;
|
|
11
|
-
* - payload: transitions may carry an optional domain payload (e.g. a goal
|
|
12
|
-
* title) that is validated JSON and part of the replayable record;
|
|
13
|
-
* - replay: the full history rebuilds the identical current state.
|
|
14
|
-
*/
|
|
15
|
-
import type { JsonValue } from "@agent-forge/ai";
|
|
16
|
-
export interface TransitionEvidenceRefV1 {
|
|
17
|
-
readonly kind: string;
|
|
18
|
-
readonly ref: string;
|
|
19
|
-
readonly digest?: string;
|
|
20
|
-
}
|
|
21
|
-
export interface TransitionRecordV1 {
|
|
22
|
-
readonly domain: string;
|
|
23
|
-
readonly entityId: string;
|
|
24
|
-
readonly owner: string;
|
|
25
|
-
readonly fromStatus: string | null;
|
|
26
|
-
readonly toStatus: string;
|
|
27
|
-
readonly operationId: string;
|
|
28
|
-
readonly evidence: readonly TransitionEvidenceRefV1[];
|
|
29
|
-
readonly payload?: JsonValue;
|
|
30
|
-
readonly revision: number;
|
|
31
|
-
readonly at: number;
|
|
32
|
-
}
|
|
33
|
-
export interface TransitionInputV1 {
|
|
34
|
-
readonly domain: string;
|
|
35
|
-
readonly entityId: string;
|
|
36
|
-
readonly owner: string;
|
|
37
|
-
readonly fromStatus: string | null;
|
|
38
|
-
readonly toStatus: string;
|
|
39
|
-
readonly operationId: string;
|
|
40
|
-
readonly evidence?: readonly TransitionEvidenceRefV1[];
|
|
41
|
-
readonly payload?: JsonValue;
|
|
42
|
-
readonly at?: number;
|
|
43
|
-
}
|
|
44
|
-
export interface TransitionResultV1 {
|
|
45
|
-
readonly record: TransitionRecordV1;
|
|
46
|
-
readonly deduped: boolean;
|
|
47
|
-
}
|
|
48
|
-
export interface TransitionStoreV1 {
|
|
49
|
-
transition(input: TransitionInputV1): TransitionResultV1;
|
|
50
|
-
currentStatus(domain: string, entityId: string): {
|
|
51
|
-
readonly status: string;
|
|
52
|
-
readonly revision: number;
|
|
53
|
-
} | undefined;
|
|
54
|
-
history(entityId: string): readonly TransitionRecordV1[];
|
|
55
|
-
/** Replays a history into a fresh store; the rebuilt state must be identical. */
|
|
56
|
-
replay(history: readonly TransitionRecordV1[]): void;
|
|
57
|
-
entities(): readonly string[];
|
|
58
|
-
}
|
|
59
|
-
export declare function createTransitionStore(options?: {
|
|
60
|
-
readonly now?: () => number;
|
|
61
|
-
}): TransitionStoreV1;
|
|
62
|
-
//# sourceMappingURL=state-store.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"state-store.d.ts","sourceRoot":"","sources":["../../src/profile/state-store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAGjD,MAAM,WAAW,uBAAuB;IACvC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,kBAAkB;IAClC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,QAAQ,EAAE,SAAS,uBAAuB,EAAE,CAAC;IACtD,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,CAAC;IAC7B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,iBAAiB;IACjC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,uBAAuB,EAAE,CAAC;IACvD,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,CAAC;IAC7B,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,kBAAkB;IAClC,QAAQ,CAAC,MAAM,EAAE,kBAAkB,CAAC;IACpC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;CAC1B;AA+DD,MAAM,WAAW,iBAAiB;IACjC,UAAU,CAAC,KAAK,EAAE,iBAAiB,GAAG,kBAAkB,CAAC;IACzD,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG;QAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS,CAAC;IACpH,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,kBAAkB,EAAE,CAAC;IACzD,iFAAiF;IACjF,MAAM,CAAC,OAAO,EAAE,SAAS,kBAAkB,EAAE,GAAG,IAAI,CAAC;IACrD,QAAQ,IAAI,SAAS,MAAM,EAAE,CAAC;CAC9B;AAED,wBAAgB,qBAAqB,CAAC,OAAO,GAAE;IAAE,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,MAAM,CAAA;CAAO,GAAG,iBAAiB,CAoFtG","sourcesContent":["/**\n * Generic transition/evidence/revision store (2.3a) — the domain-agnostic\n * contract base for Goal/Plan/Todo plugins.\n *\n * The store knows NOTHING about goal/plan/todo semantics. It only enforces:\n * - causality: a transition's `fromStatus` must equal the entity's current\n * status (null = initial transition), otherwise an explicit conflict;\n * - idempotency: replaying the same (domain, entityId, operationId, toStatus)\n * returns the existing record and never advances the revision;\n * - evidence: every transition carries structured evidence references;\n * - payload: transitions may carry an optional domain payload (e.g. a goal\n * title) that is validated JSON and part of the replayable record;\n * - replay: the full history rebuilds the identical current state.\n */\nimport type { JsonValue } from \"@agent-forge/ai\";\nimport { t } from \"../core/i18n/index.ts\";\n\nexport interface TransitionEvidenceRefV1 {\n\treadonly kind: string;\n\treadonly ref: string;\n\treadonly digest?: string;\n}\n\nexport interface TransitionRecordV1 {\n\treadonly domain: string;\n\treadonly entityId: string;\n\treadonly owner: string;\n\treadonly fromStatus: string | null;\n\treadonly toStatus: string;\n\treadonly operationId: string;\n\treadonly evidence: readonly TransitionEvidenceRefV1[];\n\treadonly payload?: JsonValue;\n\treadonly revision: number;\n\treadonly at: number;\n}\n\nexport interface TransitionInputV1 {\n\treadonly domain: string;\n\treadonly entityId: string;\n\treadonly owner: string;\n\treadonly fromStatus: string | null;\n\treadonly toStatus: string;\n\treadonly operationId: string;\n\treadonly evidence?: readonly TransitionEvidenceRefV1[];\n\treadonly payload?: JsonValue;\n\treadonly at?: number;\n}\n\nexport interface TransitionResultV1 {\n\treadonly record: TransitionRecordV1;\n\treadonly deduped: boolean;\n}\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 validateEvidence(value: unknown, label: string): TransitionEvidenceRefV1[] {\n\tif (value === undefined) return [];\n\tif (!Array.isArray(value)) throw new Error(t(\"{label} must be an array\", { label }));\n\treturn value.map((item, index) => {\n\t\tconst depLabel = `${label}[${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 record = item as Record<string, unknown>;\n\t\tassertNonEmptyString(record.kind, `${depLabel}.kind`);\n\t\tassertNonEmptyString(record.ref, `${depLabel}.ref`);\n\t\tif (record.digest !== undefined) assertNonEmptyString(record.digest, `${depLabel}.digest`);\n\t\treturn Object.freeze({\n\t\t\tkind: record.kind,\n\t\t\tref: record.ref,\n\t\t\t...(record.digest === undefined ? {} : { digest: record.digest }),\n\t\t});\n\t});\n}\n\nfunction validatePayload(value: unknown, label: string): JsonValue | undefined {\n\tif (value === undefined) return undefined;\n\tconst seen = new Set<object>();\n\tconst check = (node: unknown): void => {\n\t\tif (node === null || typeof node === \"string\" || typeof node === \"boolean\") return;\n\t\tif (typeof node === \"number\") {\n\t\t\tif (!Number.isFinite(node))\n\t\t\t\tthrow new Error(\n\t\t\t\t\tt(\"{label} must be JSON-safe: {node} is not a finite number\", { label, node: String(node) }),\n\t\t\t\t);\n\t\t\treturn;\n\t\t}\n\t\tif (typeof node === \"object\") {\n\t\t\tif (seen.has(node)) throw new Error(t(\"{label} must be JSON-safe: circular reference\", { label }));\n\t\t\tseen.add(node);\n\t\t\tif (Array.isArray(node)) {\n\t\t\t\tfor (const item of node) check(item);\n\t\t\t} else {\n\t\t\t\tconst proto = Object.getPrototypeOf(node) as unknown;\n\t\t\t\tif (proto !== Object.prototype && proto !== null)\n\t\t\t\t\tthrow new Error(t(\"{label} must be a plain object\", { label }));\n\t\t\t\tfor (const entry of Object.entries(node)) {\n\t\t\t\t\tif (entry[1] === undefined)\n\t\t\t\t\t\tthrow new Error(t(\"{label} must be JSON-safe: {key} is undefined\", { label, key: entry[0] }));\n\t\t\t\t\tcheck(entry[1]);\n\t\t\t\t}\n\t\t\t}\n\t\t\tseen.delete(node);\n\t\t\treturn;\n\t\t}\n\t\tthrow new Error(t(\"{label} must be JSON-safe: unsupported value of type {type}\", { label, type: typeof node }));\n\t};\n\tcheck(value);\n\treturn JSON.parse(JSON.stringify(value)) as JsonValue;\n}\n\nexport interface TransitionStoreV1 {\n\ttransition(input: TransitionInputV1): TransitionResultV1;\n\tcurrentStatus(domain: string, entityId: string): { readonly status: string; readonly revision: number } | undefined;\n\thistory(entityId: string): readonly TransitionRecordV1[];\n\t/** Replays a history into a fresh store; the rebuilt state must be identical. */\n\treplay(history: readonly TransitionRecordV1[]): void;\n\tentities(): readonly string[];\n}\n\nexport function createTransitionStore(options: { readonly now?: () => number } = {}): TransitionStoreV1 {\n\tconst now = options.now ?? (() => Date.now());\n\tconst recordsByEntity = new Map<string, TransitionRecordV1[]>();\n\tconst idempotency = new Map<string, TransitionRecordV1>();\n\tconst currentStatus = new Map<string, { status: string; revision: number }>();\n\tconst revisions = new Map<string, number>();\n\n\tconst entityKey = (domain: string, entityId: string): string => `${domain}\\u0000${entityId}`;\n\n\treturn {\n\t\ttransition(input) {\n\t\t\tassertNonEmptyString(input.domain, \"Transition domain\");\n\t\t\tassertNonEmptyString(input.entityId, \"Transition entityId\");\n\t\t\tassertNonEmptyString(input.owner, \"Transition owner\");\n\t\t\tassertNonEmptyString(input.operationId, \"Transition operationId\");\n\t\t\tassertNonEmptyString(input.toStatus, \"Transition toStatus\");\n\t\t\tconst evidence = validateEvidence(input.evidence, \"Transition evidence\");\n\t\t\tconst payload = validatePayload(input.payload, \"Transition payload\");\n\t\t\tconst key = `${entityKey(input.domain, input.entityId)}\\u0000${input.operationId}\\u0000${input.toStatus}`;\n\n\t\t\tconst existing = idempotency.get(key);\n\t\t\tif (existing) return { record: existing, deduped: true };\n\n\t\t\tconst entityKeyId = entityKey(input.domain, input.entityId);\n\t\t\tconst current = currentStatus.get(entityKeyId);\n\t\t\tconst fromStatus = input.fromStatus;\n\t\t\tif ((current?.status ?? null) !== fromStatus) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\tt(\"Transition conflict: expected fromStatus {from}, got {to}\", {\n\t\t\t\t\t\tfrom: JSON.stringify(current?.status ?? null),\n\t\t\t\t\t\tto: JSON.stringify(fromStatus),\n\t\t\t\t\t}),\n\t\t\t\t);\n\t\t\t}\n\t\t\tconst revision = (revisions.get(entityKeyId) ?? 0) + 1;\n\t\t\trevisions.set(entityKeyId, revision);\n\t\t\tconst record: TransitionRecordV1 = Object.freeze({\n\t\t\t\tdomain: input.domain,\n\t\t\t\tentityId: input.entityId,\n\t\t\t\towner: input.owner,\n\t\t\t\tfromStatus,\n\t\t\t\ttoStatus: input.toStatus,\n\t\t\t\toperationId: input.operationId,\n\t\t\t\tevidence: Object.freeze(evidence),\n\t\t\t\t...(payload === undefined ? {} : { payload }),\n\t\t\t\trevision,\n\t\t\t\tat: input.at ?? now(),\n\t\t\t});\n\t\t\tconst log = recordsByEntity.get(entityKeyId) ?? [];\n\t\t\tlog.push(record);\n\t\t\trecordsByEntity.set(entityKeyId, log);\n\t\t\tcurrentStatus.set(entityKeyId, { status: input.toStatus, revision });\n\t\t\tidempotency.set(key, record);\n\t\t\treturn { record, deduped: false };\n\t\t},\n\t\tcurrentStatus(domain: string, entityId: string) {\n\t\t\treturn currentStatus.get(entityKey(domain, entityId));\n\t\t},\n\t\thistory(entityId: string) {\n\t\t\treturn Object.freeze(\n\t\t\t\t[...recordsByEntity.entries()]\n\t\t\t\t\t.filter(([entityKeyId]) => entityKeyId.endsWith(`\\u0000${entityId}`))\n\t\t\t\t\t.flatMap(([, log]) => log),\n\t\t\t);\n\t\t},\n\t\treplay(history) {\n\t\t\tfor (const record of history) {\n\t\t\t\tthis.transition({\n\t\t\t\t\tdomain: record.domain,\n\t\t\t\t\tentityId: record.entityId,\n\t\t\t\t\towner: record.owner,\n\t\t\t\t\tfromStatus: record.fromStatus,\n\t\t\t\t\ttoStatus: record.toStatus,\n\t\t\t\t\toperationId: record.operationId,\n\t\t\t\t\tevidence: record.evidence,\n\t\t\t\t\tpayload: record.payload,\n\t\t\t\t\tat: record.at,\n\t\t\t\t});\n\t\t\t}\n\t\t},\n\t\tentities() {\n\t\t\treturn Object.freeze([...new Set([...currentStatus.keys()].map((key) => key.split(\"\\u0000\")[1]!))]);\n\t\t},\n\t};\n}\n"]}
|