@ai-agent-forge/agent-forge 0.86.7 → 0.87.0
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 +18 -0
- package/README.md +8 -9
- package/dist/artifacts/artifact-store.d.ts.map +1 -1
- package/dist/artifacts/artifact-store.js +9 -5
- package/dist/artifacts/artifact-store.js.map +1 -1
- package/dist/bundle/.build-manifest.json +410 -371
- package/dist/bundle/chunks/{chunk-A7GUOX2H.js → chunk-6ZKDNZHA.js} +5 -1
- package/dist/bundle/chunks/chunk-BFC2BDVJ.js +13 -0
- package/dist/bundle/chunks/chunk-MOHOLL3F.js +1456 -0
- package/dist/bundle/chunks/image-resize-worker.js +12 -1
- package/dist/bundle/chunks/{virtual-modules-3IZ4MYSQ.js → virtual-modules-KZ5DRH7Q.js} +1 -1
- package/dist/bundle/cli.js +1 -1
- package/dist/bundle/client.js +1 -1
- package/dist/bundle/index.js +2 -2
- package/dist/bundle/rpc-entry.js +1 -1
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +231 -185
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/auth-check.d.ts.map +1 -1
- package/dist/cli/auth-check.js +3 -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 +15 -9
- package/dist/cli/auth-command.js.map +1 -1
- package/dist/cli/credential-print.d.ts.map +1 -1
- package/dist/cli/credential-print.js +14 -7
- package/dist/cli/credential-print.js.map +1 -1
- package/dist/cli/experimental/command.d.ts.map +1 -1
- package/dist/cli/experimental/command.js +6 -5
- package/dist/cli/experimental/command.js.map +1 -1
- package/dist/cli/list-models.d.ts.map +1 -1
- package/dist/cli/list-models.js +9 -8
- package/dist/cli/list-models.js.map +1 -1
- package/dist/cli/plugin-manager-controller.d.ts.map +1 -1
- package/dist/cli/plugin-manager-controller.js +2 -1
- package/dist/cli/plugin-manager-controller.js.map +1 -1
- package/dist/cli/serve.d.ts.map +1 -1
- package/dist/cli/serve.js +8 -5
- package/dist/cli/serve.js.map +1 -1
- package/dist/client/remote-session.d.ts.map +1 -1
- package/dist/client/remote-session.js +16 -9
- package/dist/client/remote-session.js.map +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +2 -1
- package/dist/config.js.map +1 -1
- package/dist/core/agent-capability-contract.d.ts +0 -7
- package/dist/core/agent-capability-contract.d.ts.map +1 -1
- package/dist/core/agent-capability-contract.js +72 -68
- package/dist/core/agent-capability-contract.js.map +1 -1
- package/dist/core/agent-session-bash.d.ts.map +1 -1
- package/dist/core/agent-session-bash.js +5 -4
- package/dist/core/agent-session-bash.js.map +1 -1
- package/dist/core/agent-session-compaction.d.ts.map +1 -1
- package/dist/core/agent-session-compaction.js +28 -22
- package/dist/core/agent-session-compaction.js.map +1 -1
- package/dist/core/agent-session-context.d.ts.map +1 -1
- package/dist/core/agent-session-context.js +18 -13
- package/dist/core/agent-session-context.js.map +1 -1
- package/dist/core/agent-session-model.d.ts.map +1 -1
- package/dist/core/agent-session-model.js +2 -1
- package/dist/core/agent-session-model.js.map +1 -1
- package/dist/core/agent-session-retry.d.ts.map +1 -1
- package/dist/core/agent-session-retry.js +3 -2
- package/dist/core/agent-session-retry.js.map +1 -1
- package/dist/core/agent-session-runtime.d.ts.map +1 -1
- package/dist/core/agent-session-runtime.js +7 -6
- package/dist/core/agent-session-runtime.js.map +1 -1
- package/dist/core/agent-session-services.d.ts +1 -1
- package/dist/core/agent-session-services.d.ts.map +1 -1
- 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 +3 -2
- package/dist/core/agent-session-tools.js.map +1 -1
- package/dist/core/agent-session.d.ts +40 -2
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +142 -34
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/auth-guidance.d.ts.map +1 -1
- package/dist/core/auth-guidance.js +11 -5
- package/dist/core/auth-guidance.js.map +1 -1
- package/dist/core/auth-storage.d.ts.map +1 -1
- package/dist/core/auth-storage.js +9 -6
- package/dist/core/auth-storage.js.map +1 -1
- package/dist/core/compaction/compaction.d.ts.map +1 -1
- package/dist/core/compaction/compaction.js +2 -1
- package/dist/core/compaction/compaction.js.map +1 -1
- package/dist/core/embedded-sdk.d.ts.map +1 -1
- package/dist/core/embedded-sdk.js +10 -6
- package/dist/core/embedded-sdk.js.map +1 -1
- package/dist/core/export-html/index.d.ts.map +1 -1
- package/dist/core/export-html/index.js +9 -4
- package/dist/core/export-html/index.js.map +1 -1
- package/dist/core/extensions/agent-composition.d.ts.map +1 -1
- package/dist/core/extensions/agent-composition.js +26 -19
- package/dist/core/extensions/agent-composition.js.map +1 -1
- package/dist/core/extensions/bootstrap-agent-loop.d.ts.map +1 -1
- package/dist/core/extensions/bootstrap-agent-loop.js +3 -2
- package/dist/core/extensions/bootstrap-agent-loop.js.map +1 -1
- package/dist/core/extensions/bootstrap-lifecycle.d.ts.map +1 -1
- package/dist/core/extensions/bootstrap-lifecycle.js +20 -17
- package/dist/core/extensions/bootstrap-lifecycle.js.map +1 -1
- package/dist/core/extensions/bootstrap-overflow-policy.d.ts.map +1 -1
- package/dist/core/extensions/bootstrap-overflow-policy.js +2 -1
- package/dist/core/extensions/bootstrap-overflow-policy.js.map +1 -1
- package/dist/core/extensions/bootstrap-retry-policy.d.ts.map +1 -1
- package/dist/core/extensions/bootstrap-retry-policy.js +2 -1
- package/dist/core/extensions/bootstrap-retry-policy.js.map +1 -1
- package/dist/core/extensions/bootstrap-skills.d.ts.map +1 -1
- package/dist/core/extensions/bootstrap-skills.js +7 -6
- package/dist/core/extensions/bootstrap-skills.js.map +1 -1
- package/dist/core/extensions/bootstrap-tools.d.ts.map +1 -1
- package/dist/core/extensions/bootstrap-tools.js +2 -1
- package/dist/core/extensions/bootstrap-tools.js.map +1 -1
- package/dist/core/extensions/capability-plugin.d.ts.map +1 -1
- package/dist/core/extensions/capability-plugin.js +37 -13
- package/dist/core/extensions/capability-plugin.js.map +1 -1
- package/dist/core/extensions/capability-runtime-events.d.ts.map +1 -1
- package/dist/core/extensions/capability-runtime-events.js +17 -13
- package/dist/core/extensions/capability-runtime-events.js.map +1 -1
- package/dist/core/extensions/capability-runtime-guards.d.ts.map +1 -1
- package/dist/core/extensions/capability-runtime-guards.js +16 -15
- package/dist/core/extensions/capability-runtime-guards.js.map +1 -1
- package/dist/core/extensions/capability-runtime-manifest.d.ts.map +1 -1
- package/dist/core/extensions/capability-runtime-manifest.js +52 -30
- package/dist/core/extensions/capability-runtime-manifest.js.map +1 -1
- package/dist/core/extensions/capability-runtime-validation.d.ts.map +1 -1
- package/dist/core/extensions/capability-runtime-validation.js +66 -65
- package/dist/core/extensions/capability-runtime-validation.js.map +1 -1
- package/dist/core/extensions/capability-runtime.d.ts.map +1 -1
- package/dist/core/extensions/capability-runtime.js +147 -127
- package/dist/core/extensions/capability-runtime.js.map +1 -1
- package/dist/core/extensions/compaction-memory-failure-mode.d.ts.map +1 -1
- package/dist/core/extensions/compaction-memory-failure-mode.js +3 -2
- package/dist/core/extensions/compaction-memory-failure-mode.js.map +1 -1
- package/dist/core/extensions/context-strategy-binding.d.ts.map +1 -1
- package/dist/core/extensions/context-strategy-binding.js +7 -4
- package/dist/core/extensions/context-strategy-binding.js.map +1 -1
- package/dist/core/extensions/lifecycle-catalog.d.ts.map +1 -1
- package/dist/core/extensions/lifecycle-catalog.js +290 -279
- package/dist/core/extensions/lifecycle-catalog.js.map +1 -1
- package/dist/core/extensions/lifecycle-delivery-queue.d.ts.map +1 -1
- package/dist/core/extensions/lifecycle-delivery-queue.js +3 -2
- package/dist/core/extensions/lifecycle-delivery-queue.js.map +1 -1
- package/dist/core/facade/coding-agent-facade.d.ts +6 -0
- package/dist/core/facade/coding-agent-facade.d.ts.map +1 -1
- package/dist/core/facade/coding-agent-facade.js +2 -0
- package/dist/core/facade/coding-agent-facade.js.map +1 -1
- package/dist/core/http-dispatcher.d.ts.map +1 -1
- package/dist/core/http-dispatcher.js +2 -1
- package/dist/core/http-dispatcher.js.map +1 -1
- package/dist/core/i18n/index.d.ts +14 -0
- package/dist/core/i18n/index.d.ts.map +1 -0
- package/dist/core/i18n/index.js +67 -0
- package/dist/core/i18n/index.js.map +1 -0
- package/dist/core/i18n/locales/en/example.d.ts +7 -0
- package/dist/core/i18n/locales/en/example.d.ts.map +1 -0
- package/dist/core/i18n/locales/en/example.js +7 -0
- package/dist/core/i18n/locales/en/example.js.map +1 -0
- package/dist/core/i18n/locales/zh-cn/cli.d.ts +8 -0
- package/dist/core/i18n/locales/zh-cn/cli.d.ts.map +1 -0
- package/dist/core/i18n/locales/zh-cn/cli.js +227 -0
- package/dist/core/i18n/locales/zh-cn/cli.js.map +1 -0
- package/dist/core/i18n/locales/zh-cn/common.d.ts +6 -0
- package/dist/core/i18n/locales/zh-cn/common.d.ts.map +1 -0
- package/dist/core/i18n/locales/zh-cn/common.js +6 -0
- package/dist/core/i18n/locales/zh-cn/common.js.map +1 -0
- package/dist/core/i18n/locales/zh-cn/core-contract-core.d.ts +13 -0
- package/dist/core/i18n/locales/zh-cn/core-contract-core.d.ts.map +1 -0
- package/dist/core/i18n/locales/zh-cn/core-contract-core.js +173 -0
- package/dist/core/i18n/locales/zh-cn/core-contract-core.js.map +1 -0
- package/dist/core/i18n/locales/zh-cn/core-contract-extensions.d.ts +12 -0
- package/dist/core/i18n/locales/zh-cn/core-contract-extensions.d.ts.map +1 -0
- package/dist/core/i18n/locales/zh-cn/core-contract-extensions.js +582 -0
- package/dist/core/i18n/locales/zh-cn/core-contract-extensions.js.map +1 -0
- package/dist/core/i18n/locales/zh-cn/core-contract-final.d.ts +9 -0
- package/dist/core/i18n/locales/zh-cn/core-contract-final.d.ts.map +1 -0
- package/dist/core/i18n/locales/zh-cn/core-contract-final.js +55 -0
- package/dist/core/i18n/locales/zh-cn/core-contract-final.js.map +1 -0
- package/dist/core/i18n/locales/zh-cn/core-contract-plugins.d.ts +11 -0
- package/dist/core/i18n/locales/zh-cn/core-contract-plugins.d.ts.map +1 -0
- package/dist/core/i18n/locales/zh-cn/core-contract-plugins.js +455 -0
- package/dist/core/i18n/locales/zh-cn/core-contract-plugins.js.map +1 -0
- package/dist/core/i18n/locales/zh-cn/core-errors.d.ts +9 -0
- package/dist/core/i18n/locales/zh-cn/core-errors.d.ts.map +1 -0
- package/dist/core/i18n/locales/zh-cn/core-errors.js +191 -0
- package/dist/core/i18n/locales/zh-cn/core-errors.js.map +1 -0
- package/dist/core/i18n/locales/zh-cn/example.d.ts +7 -0
- package/dist/core/i18n/locales/zh-cn/example.d.ts.map +1 -0
- package/dist/core/i18n/locales/zh-cn/example.js +10 -0
- package/dist/core/i18n/locales/zh-cn/example.js.map +1 -0
- package/dist/core/i18n/locales/zh-cn/index.d.ts +2 -0
- package/dist/core/i18n/locales/zh-cn/index.d.ts.map +1 -0
- package/dist/core/i18n/locales/zh-cn/index.js +41 -0
- package/dist/core/i18n/locales/zh-cn/index.js.map +1 -0
- package/dist/core/i18n/locales/zh-cn/interactive-mode.d.ts +10 -0
- package/dist/core/i18n/locales/zh-cn/interactive-mode.d.ts.map +1 -0
- package/dist/core/i18n/locales/zh-cn/interactive-mode.js +265 -0
- package/dist/core/i18n/locales/zh-cn/interactive-mode.js.map +1 -0
- package/dist/core/i18n/locales/zh-cn/keybindings.d.ts +11 -0
- package/dist/core/i18n/locales/zh-cn/keybindings.d.ts.map +1 -0
- package/dist/core/i18n/locales/zh-cn/keybindings.js +67 -0
- package/dist/core/i18n/locales/zh-cn/keybindings.js.map +1 -0
- package/dist/core/i18n/locales/zh-cn/slash-commands.d.ts +7 -0
- package/dist/core/i18n/locales/zh-cn/slash-commands.d.ts.map +1 -0
- package/dist/core/i18n/locales/zh-cn/slash-commands.js +39 -0
- package/dist/core/i18n/locales/zh-cn/slash-commands.js.map +1 -0
- package/dist/core/i18n/locales/zh-cn/tui-builtin.d.ts +10 -0
- package/dist/core/i18n/locales/zh-cn/tui-builtin.d.ts.map +1 -0
- package/dist/core/i18n/locales/zh-cn/tui-builtin.js +15 -0
- package/dist/core/i18n/locales/zh-cn/tui-builtin.js.map +1 -0
- package/dist/core/i18n/locales/zh-cn/tui-components-misc.d.ts +13 -0
- package/dist/core/i18n/locales/zh-cn/tui-components-misc.d.ts.map +1 -0
- package/dist/core/i18n/locales/zh-cn/tui-components-misc.js +102 -0
- package/dist/core/i18n/locales/zh-cn/tui-components-misc.js.map +1 -0
- package/dist/core/i18n/locales/zh-cn/tui-components-selectors.d.ts +12 -0
- package/dist/core/i18n/locales/zh-cn/tui-components-selectors.d.ts.map +1 -0
- package/dist/core/i18n/locales/zh-cn/tui-components-selectors.js +288 -0
- package/dist/core/i18n/locales/zh-cn/tui-components-selectors.js.map +1 -0
- package/dist/core/i18n/locales/zh-cn/tui-interactive-misc.d.ts +9 -0
- package/dist/core/i18n/locales/zh-cn/tui-interactive-misc.d.ts.map +1 -0
- package/dist/core/i18n/locales/zh-cn/tui-interactive-misc.js +79 -0
- package/dist/core/i18n/locales/zh-cn/tui-interactive-misc.js.map +1 -0
- package/dist/core/i18n/locales/zh-cn/tui-self-owned.d.ts +8 -0
- package/dist/core/i18n/locales/zh-cn/tui-self-owned.d.ts.map +1 -0
- package/dist/core/i18n/locales/zh-cn/tui-self-owned.js +72 -0
- package/dist/core/i18n/locales/zh-cn/tui-self-owned.js.map +1 -0
- package/dist/core/keybindings.d.ts +15 -0
- package/dist/core/keybindings.d.ts.map +1 -1
- package/dist/core/keybindings.js +18 -0
- package/dist/core/keybindings.js.map +1 -1
- package/dist/core/logger.d.ts.map +1 -1
- package/dist/core/logger.js +5 -1
- package/dist/core/logger.js.map +1 -1
- package/dist/core/model-registry.d.ts.map +1 -1
- package/dist/core/model-registry.js +2 -1
- package/dist/core/model-registry.js.map +1 -1
- package/dist/core/model-runtime.d.ts.map +1 -1
- package/dist/core/model-runtime.js +8 -4
- package/dist/core/model-runtime.js.map +1 -1
- package/dist/core/package-install-host.d.ts.map +1 -1
- package/dist/core/package-install-host.js +4 -3
- package/dist/core/package-install-host.js.map +1 -1
- package/dist/core/package-manager.d.ts.map +1 -1
- package/dist/core/package-manager.js +15 -10
- package/dist/core/package-manager.js.map +1 -1
- package/dist/core/package-resource-collection.d.ts.map +1 -1
- package/dist/core/package-resource-collection.js +2 -1
- package/dist/core/package-resource-collection.js.map +1 -1
- package/dist/core/package-source.d.ts.map +1 -1
- package/dist/core/package-source.js +3 -2
- package/dist/core/package-source.js.map +1 -1
- package/dist/core/provider-composer.d.ts.map +1 -1
- package/dist/core/provider-composer.js +22 -13
- package/dist/core/provider-composer.js.map +1 -1
- package/dist/core/remote-catalog-provider.d.ts.map +1 -1
- package/dist/core/remote-catalog-provider.js +6 -2
- package/dist/core/remote-catalog-provider.js.map +1 -1
- package/dist/core/resolve-config-value.d.ts.map +1 -1
- package/dist/core/resolve-config-value.js +15 -5
- package/dist/core/resolve-config-value.js.map +1 -1
- package/dist/core/sdk.d.ts +19 -5
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +74 -54
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/session-cwd.d.ts.map +1 -1
- package/dist/core/session-cwd.js +5 -2
- package/dist/core/session-cwd.js.map +1 -1
- package/dist/core/session-export.d.ts.map +1 -1
- package/dist/core/session-export.js +2 -1
- package/dist/core/session-export.js.map +1 -1
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +39 -29
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/session-storage.d.ts.map +1 -1
- package/dist/core/session-storage.js +3 -3
- package/dist/core/session-storage.js.map +1 -1
- package/dist/core/settings-manager.d.ts +11 -0
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +27 -5
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/slash-commands.d.ts.map +1 -1
- package/dist/core/slash-commands.js +53 -32
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +25 -2
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +11 -7
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/edit-diff.d.ts.map +1 -1
- package/dist/core/tools/edit-diff.js +9 -4
- package/dist/core/tools/edit-diff.js.map +1 -1
- package/dist/core/tools/edit.d.ts.map +1 -1
- package/dist/core/tools/edit.js +4 -3
- package/dist/core/tools/edit.js.map +1 -1
- package/dist/core/tools/index.d.ts.map +1 -1
- package/dist/core/tools/index.js +3 -2
- package/dist/core/tools/index.js.map +1 -1
- package/dist/core/tools/output-accumulator.d.ts.map +1 -1
- package/dist/core/tools/output-accumulator.js +2 -1
- package/dist/core/tools/output-accumulator.js.map +1 -1
- package/dist/core/tools/read.d.ts.map +1 -1
- package/dist/core/tools/read.js +6 -2
- package/dist/core/tools/read.js.map +1 -1
- package/dist/core/tools/write.d.ts.map +1 -1
- package/dist/core/tools/write.js +2 -1
- package/dist/core/tools/write.js.map +1 -1
- package/dist/durable/durable-service.d.ts.map +1 -1
- package/dist/durable/durable-service.js +25 -18
- package/dist/durable/durable-service.js.map +1 -1
- package/dist/host/checkpoint-commit.d.ts.map +1 -1
- package/dist/host/checkpoint-commit.js +2 -1
- package/dist/host/checkpoint-commit.js.map +1 -1
- package/dist/host/manual-compaction.d.ts.map +1 -1
- package/dist/host/manual-compaction.js +2 -1
- package/dist/host/manual-compaction.js.map +1 -1
- package/dist/host/output-projection.d.ts +0 -13
- package/dist/host/output-projection.d.ts.map +1 -1
- package/dist/host/output-projection.js +16 -2
- package/dist/host/output-projection.js.map +1 -1
- package/dist/host/summary-retry.d.ts.map +1 -1
- package/dist/host/summary-retry.js +3 -2
- package/dist/host/summary-retry.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +94 -58
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/components/agents-view.d.ts.map +1 -1
- package/dist/modes/interactive/components/agents-view.js +18 -15
- package/dist/modes/interactive/components/agents-view.js.map +1 -1
- package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/assistant-message.js +6 -5
- package/dist/modes/interactive/components/assistant-message.js.map +1 -1
- package/dist/modes/interactive/components/bash-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/bash-execution.js +12 -7
- package/dist/modes/interactive/components/bash-execution.js.map +1 -1
- package/dist/modes/interactive/components/bordered-loader.d.ts.map +1 -1
- package/dist/modes/interactive/components/bordered-loader.js +2 -1
- package/dist/modes/interactive/components/bordered-loader.js.map +1 -1
- package/dist/modes/interactive/components/branch-summary-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/branch-summary-message.js +6 -5
- package/dist/modes/interactive/components/branch-summary-message.js.map +1 -1
- package/dist/modes/interactive/components/compaction-summary-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/compaction-summary-message.js +9 -5
- package/dist/modes/interactive/components/compaction-summary-message.js.map +1 -1
- package/dist/modes/interactive/components/config-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/config-selector.js +18 -15
- package/dist/modes/interactive/components/config-selector.js.map +1 -1
- package/dist/modes/interactive/components/custom-entry.d.ts.map +1 -1
- package/dist/modes/interactive/components/custom-entry.js +2 -1
- package/dist/modes/interactive/components/custom-entry.js.map +1 -1
- package/dist/modes/interactive/components/dialog-editor.d.ts.map +1 -1
- package/dist/modes/interactive/components/dialog-editor.js +5 -4
- package/dist/modes/interactive/components/dialog-editor.js.map +1 -1
- package/dist/modes/interactive/components/dialog-input.d.ts.map +1 -1
- package/dist/modes/interactive/components/dialog-input.js +2 -1
- package/dist/modes/interactive/components/dialog-input.js.map +1 -1
- package/dist/modes/interactive/components/dialog-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/dialog-selector.js +4 -3
- package/dist/modes/interactive/components/dialog-selector.js.map +1 -1
- package/dist/modes/interactive/components/first-time-setup.d.ts.map +1 -1
- package/dist/modes/interactive/components/first-time-setup.js +11 -10
- package/dist/modes/interactive/components/first-time-setup.js.map +1 -1
- package/dist/modes/interactive/components/footer.d.ts.map +1 -1
- package/dist/modes/interactive/components/footer.js +7 -4
- package/dist/modes/interactive/components/footer.js.map +1 -1
- package/dist/modes/interactive/components/index.d.ts +1 -0
- package/dist/modes/interactive/components/index.d.ts.map +1 -1
- package/dist/modes/interactive/components/index.js +1 -0
- package/dist/modes/interactive/components/index.js.map +1 -1
- package/dist/modes/interactive/components/keybinding-hints.d.ts.map +1 -1
- package/dist/modes/interactive/components/keybinding-hints.js +3 -2
- package/dist/modes/interactive/components/keybinding-hints.js.map +1 -1
- package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -1
- package/dist/modes/interactive/components/login-dialog.js +12 -11
- package/dist/modes/interactive/components/login-dialog.js.map +1 -1
- package/dist/modes/interactive/components/mermaid.d.ts.map +1 -1
- package/dist/modes/interactive/components/mermaid.js +6 -2
- package/dist/modes/interactive/components/mermaid.js.map +1 -1
- package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/model-selector.js +28 -16
- package/dist/modes/interactive/components/model-selector.js.map +1 -1
- package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/oauth-selector.js +10 -9
- package/dist/modes/interactive/components/oauth-selector.js.map +1 -1
- package/dist/modes/interactive/components/plugin-manager-entry.d.ts.map +1 -1
- package/dist/modes/interactive/components/plugin-manager-entry.js +22 -13
- package/dist/modes/interactive/components/plugin-manager-entry.js.map +1 -1
- package/dist/modes/interactive/components/plugin-selection-entry.d.ts.map +1 -1
- package/dist/modes/interactive/components/plugin-selection-entry.js +27 -12
- package/dist/modes/interactive/components/plugin-selection-entry.js.map +1 -1
- package/dist/modes/interactive/components/queue-manager-selector.d.ts +60 -0
- package/dist/modes/interactive/components/queue-manager-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/queue-manager-selector.js +166 -0
- package/dist/modes/interactive/components/queue-manager-selector.js.map +1 -0
- package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.js +16 -14
- package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -1
- package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/session-selector.js +43 -31
- package/dist/modes/interactive/components/session-selector.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts +2 -0
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +113 -96
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/components/settings-submenu.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-submenu.js +5 -4
- package/dist/modes/interactive/components/settings-submenu.js.map +1 -1
- package/dist/modes/interactive/components/show-images-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/show-images-selector.js +3 -2
- package/dist/modes/interactive/components/show-images-selector.js.map +1 -1
- package/dist/modes/interactive/components/skill-invocation-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/skill-invocation-message.js +4 -3
- package/dist/modes/interactive/components/skill-invocation-message.js.map +1 -1
- package/dist/modes/interactive/components/status-indicator.d.ts.map +1 -1
- package/dist/modes/interactive/components/status-indicator.js +14 -5
- package/dist/modes/interactive/components/status-indicator.js.map +1 -1
- package/dist/modes/interactive/components/theme-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/theme-selector.js +2 -1
- package/dist/modes/interactive/components/theme-selector.js.map +1 -1
- package/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/thinking-selector.js +11 -4
- package/dist/modes/interactive/components/thinking-selector.js.map +1 -1
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution.js +8 -3
- package/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/dist/modes/interactive/components/tree-list.d.ts.map +1 -1
- package/dist/modes/interactive/components/tree-list.js +7 -6
- package/dist/modes/interactive/components/tree-list.js.map +1 -1
- package/dist/modes/interactive/components/tree-render.d.ts.map +1 -1
- package/dist/modes/interactive/components/tree-render.js +28 -23
- package/dist/modes/interactive/components/tree-render.js.map +1 -1
- package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/tree-selector.js +9 -7
- package/dist/modes/interactive/components/tree-selector.js.map +1 -1
- package/dist/modes/interactive/components/user-message-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/user-message-selector.js +5 -4
- package/dist/modes/interactive/components/user-message-selector.js.map +1 -1
- package/dist/modes/interactive/components/workflow-view.d.ts.map +1 -1
- package/dist/modes/interactive/components/workflow-view.js +36 -21
- package/dist/modes/interactive/components/workflow-view.js.map +1 -1
- package/dist/modes/interactive/external-editor.d.ts.map +1 -1
- package/dist/modes/interactive/external-editor.js +2 -1
- package/dist/modes/interactive/external-editor.js.map +1 -1
- package/dist/modes/interactive/interactive-auth.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-auth.js +71 -40
- package/dist/modes/interactive/interactive-auth.js.map +1 -1
- package/dist/modes/interactive/interactive-commands.d.ts +1 -0
- package/dist/modes/interactive/interactive-commands.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-commands.js +3 -0
- package/dist/modes/interactive/interactive-commands.js.map +1 -1
- package/dist/modes/interactive/interactive-dialog-ui.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-dialog-ui.js +5 -5
- package/dist/modes/interactive/interactive-dialog-ui.js.map +1 -1
- package/dist/modes/interactive/interactive-format.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-format.js +34 -18
- package/dist/modes/interactive/interactive-format.js.map +1 -1
- package/dist/modes/interactive/interactive-helpers.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-helpers.js +7 -2
- package/dist/modes/interactive/interactive-helpers.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +4 -1
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +327 -243
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/interactive-selectors.d.ts +9 -0
- package/dist/modes/interactive/interactive-selectors.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-selectors.js +79 -25
- package/dist/modes/interactive/interactive-selectors.js.map +1 -1
- package/dist/modes/interactive/theme/theme-controller.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme-controller.js +5 -1
- package/dist/modes/interactive/theme/theme-controller.js.map +1 -1
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme.js +26 -23
- package/dist/modes/interactive/theme/theme.js.map +1 -1
- package/dist/modes/json-event.d.ts.map +1 -1
- package/dist/modes/json-event.js +3 -2
- package/dist/modes/json-event.js.map +1 -1
- package/dist/modes/print-mode.d.ts.map +1 -1
- package/dist/modes/print-mode.js +3 -2
- package/dist/modes/print-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client.js +3 -2
- package/dist/modes/rpc/rpc-client.js.map +1 -1
- package/dist/package-manager-cli.d.ts.map +1 -1
- package/dist/package-manager-cli.js +28 -13
- package/dist/package-manager-cli.js.map +1 -1
- package/dist/plugins/ecosystem/catalog.d.ts.map +1 -1
- package/dist/plugins/ecosystem/catalog.js +3 -2
- package/dist/plugins/ecosystem/catalog.js.map +1 -1
- package/dist/plugins/ecosystem/cli.d.ts.map +1 -1
- package/dist/plugins/ecosystem/cli.js +2 -1
- package/dist/plugins/ecosystem/cli.js.map +1 -1
- package/dist/plugins/ecosystem/default-plugin-market.d.ts.map +1 -1
- package/dist/plugins/ecosystem/default-plugin-market.js +3 -2
- package/dist/plugins/ecosystem/default-plugin-market.js.map +1 -1
- package/dist/plugins/ecosystem/distribution.d.ts.map +1 -1
- package/dist/plugins/ecosystem/distribution.js +2 -1
- package/dist/plugins/ecosystem/distribution.js.map +1 -1
- package/dist/plugins/ecosystem/installer.d.ts.map +1 -1
- package/dist/plugins/ecosystem/installer.js +3 -2
- package/dist/plugins/ecosystem/installer.js.map +1 -1
- package/dist/plugins/ecosystem/node-disk-registry-source.d.ts.map +1 -1
- package/dist/plugins/ecosystem/node-disk-registry-source.js +20 -17
- package/dist/plugins/ecosystem/node-disk-registry-source.js.map +1 -1
- package/dist/plugins/ecosystem/node-distribution-host.d.ts.map +1 -1
- package/dist/plugins/ecosystem/node-distribution-host.js +35 -34
- package/dist/plugins/ecosystem/node-distribution-host.js.map +1 -1
- package/dist/plugins/ecosystem/node-npm-registry-source.d.ts.map +1 -1
- package/dist/plugins/ecosystem/node-npm-registry-source.js +35 -34
- package/dist/plugins/ecosystem/node-npm-registry-source.js.map +1 -1
- package/dist/plugins/ecosystem/node-package-install-host.d.ts.map +1 -1
- package/dist/plugins/ecosystem/node-package-install-host.js +9 -8
- package/dist/plugins/ecosystem/node-package-install-host.js.map +1 -1
- package/dist/plugins/ecosystem/node-package-install-persistence.d.ts.map +1 -1
- package/dist/plugins/ecosystem/node-package-install-persistence.js +4 -3
- package/dist/plugins/ecosystem/node-package-install-persistence.js.map +1 -1
- package/dist/plugins/ecosystem/node-plugin-bootstrap.d.ts.map +1 -1
- package/dist/plugins/ecosystem/node-plugin-bootstrap.js +21 -5
- package/dist/plugins/ecosystem/node-plugin-bootstrap.js.map +1 -1
- package/dist/plugins/ecosystem/node-plugin-trust-root.d.ts.map +1 -1
- package/dist/plugins/ecosystem/node-plugin-trust-root.js +10 -9
- package/dist/plugins/ecosystem/node-plugin-trust-root.js.map +1 -1
- package/dist/plugins/ecosystem/node-registry-source.d.ts.map +1 -1
- package/dist/plugins/ecosystem/node-registry-source.js +31 -30
- package/dist/plugins/ecosystem/node-registry-source.js.map +1 -1
- package/dist/plugins/ecosystem/node-release-package-source.d.ts.map +1 -1
- package/dist/plugins/ecosystem/node-release-package-source.js +30 -29
- package/dist/plugins/ecosystem/node-release-package-source.js.map +1 -1
- package/dist/plugins/ecosystem/node-tar-writer.d.ts.map +1 -1
- package/dist/plugins/ecosystem/node-tar-writer.js +11 -10
- package/dist/plugins/ecosystem/node-tar-writer.js.map +1 -1
- package/dist/plugins/ecosystem/node-url-package-source.d.ts.map +1 -1
- package/dist/plugins/ecosystem/node-url-package-source.js +21 -20
- package/dist/plugins/ecosystem/node-url-package-source.js.map +1 -1
- package/dist/plugins/ecosystem/plugin-acquisition.d.ts.map +1 -1
- package/dist/plugins/ecosystem/plugin-acquisition.js +3 -2
- package/dist/plugins/ecosystem/plugin-acquisition.js.map +1 -1
- package/dist/plugins/ecosystem/registry-cli-adapter.d.ts.map +1 -1
- package/dist/plugins/ecosystem/registry-cli-adapter.js +2 -1
- package/dist/plugins/ecosystem/registry-cli-adapter.js.map +1 -1
- package/dist/plugins/ecosystem/registry.d.ts.map +1 -1
- package/dist/plugins/ecosystem/registry.js +35 -32
- package/dist/plugins/ecosystem/registry.js.map +1 -1
- package/dist/plugins/ecosystem/resolver.d.ts.map +1 -1
- package/dist/plugins/ecosystem/resolver.js +3 -2
- package/dist/plugins/ecosystem/resolver.js.map +1 -1
- package/dist/plugins/ecosystem/selection-store.d.ts.map +1 -1
- package/dist/plugins/ecosystem/selection-store.js +11 -10
- package/dist/plugins/ecosystem/selection-store.js.map +1 -1
- package/dist/plugins/ecosystem/selection.d.ts.map +1 -1
- package/dist/plugins/ecosystem/selection.js +8 -7
- package/dist/plugins/ecosystem/selection.js.map +1 -1
- package/dist/plugins/ecosystem/state.d.ts.map +1 -1
- package/dist/plugins/ecosystem/state.js +24 -23
- package/dist/plugins/ecosystem/state.js.map +1 -1
- package/dist/plugins/ecosystem/updates.d.ts.map +1 -1
- package/dist/plugins/ecosystem/updates.js +5 -4
- package/dist/plugins/ecosystem/updates.js.map +1 -1
- package/dist/plugins/mcp-http.d.ts +0 -17
- package/dist/plugins/mcp-http.d.ts.map +1 -1
- package/dist/plugins/mcp-http.js +30 -7
- package/dist/plugins/mcp-http.js.map +1 -1
- package/dist/plugins/plugin-supervisor.d.ts.map +1 -1
- package/dist/plugins/plugin-supervisor.js +19 -1
- package/dist/plugins/plugin-supervisor.js.map +1 -1
- package/dist/profile/first-roles.d.ts.map +1 -1
- package/dist/profile/first-roles.js +10 -1
- package/dist/profile/first-roles.js.map +1 -1
- package/dist/profile/goal-plugin.d.ts.map +1 -1
- package/dist/profile/goal-plugin.js +24 -5
- package/dist/profile/goal-plugin.js.map +1 -1
- package/dist/profile/identity.d.ts.map +1 -1
- package/dist/profile/identity.js +7 -6
- package/dist/profile/identity.js.map +1 -1
- package/dist/profile/lock.d.ts.map +1 -1
- package/dist/profile/lock.js +15 -1
- package/dist/profile/lock.js.map +1 -1
- package/dist/profile/plan-plugin.d.ts.map +1 -1
- package/dist/profile/plan-plugin.js +26 -13
- package/dist/profile/plan-plugin.js.map +1 -1
- package/dist/profile/plugin-profiles.d.ts.map +1 -1
- package/dist/profile/plugin-profiles.js +2 -1
- package/dist/profile/plugin-profiles.js.map +1 -1
- package/dist/profile/policy-manifest.d.ts.map +1 -1
- package/dist/profile/policy-manifest.js +5 -4
- package/dist/profile/policy-manifest.js.map +1 -1
- package/dist/profile/profile-registry.d.ts +0 -12
- package/dist/profile/profile-registry.d.ts.map +1 -1
- package/dist/profile/profile-registry.js +14 -1
- package/dist/profile/profile-registry.js.map +1 -1
- package/dist/profile/role-catalog.d.ts +0 -1
- package/dist/profile/role-catalog.d.ts.map +1 -1
- package/dist/profile/role-catalog.js +17 -15
- package/dist/profile/role-catalog.js.map +1 -1
- package/dist/profile/role-orchestrator.d.ts.map +1 -1
- package/dist/profile/role-orchestrator.js +8 -7
- package/dist/profile/role-orchestrator.js.map +1 -1
- package/dist/profile/role-runner.d.ts.map +1 -1
- package/dist/profile/role-runner.js +3 -2
- package/dist/profile/role-runner.js.map +1 -1
- package/dist/profile/root-facade.d.ts.map +1 -1
- package/dist/profile/root-facade.js +2 -1
- package/dist/profile/root-facade.js.map +1 -1
- package/dist/profile/skill-discovery-wiring.d.ts.map +1 -1
- package/dist/profile/skill-discovery-wiring.js +7 -2
- package/dist/profile/skill-discovery-wiring.js.map +1 -1
- package/dist/profile/state-store.d.ts.map +1 -1
- package/dist/profile/state-store.js +13 -9
- package/dist/profile/state-store.js.map +1 -1
- package/dist/profile/todo-plugin.d.ts.map +1 -1
- package/dist/profile/todo-plugin.js +9 -4
- package/dist/profile/todo-plugin.js.map +1 -1
- package/dist/profiles/builtin-suites.d.ts +13 -6
- package/dist/profiles/builtin-suites.d.ts.map +1 -1
- package/dist/profiles/builtin-suites.js +15 -6
- package/dist/profiles/builtin-suites.js.map +1 -1
- package/dist/profiles/suite-loader.d.ts +25 -1
- package/dist/profiles/suite-loader.d.ts.map +1 -1
- package/dist/profiles/suite-loader.js +34 -9
- package/dist/profiles/suite-loader.js.map +1 -1
- package/dist/remote/server-entry.d.ts.map +1 -1
- package/dist/remote/server-entry.js +3 -2
- package/dist/remote/server-entry.js.map +1 -1
- package/dist/remote/session-source.d.ts.map +1 -1
- package/dist/remote/session-source.js +8 -4
- package/dist/remote/session-source.js.map +1 -1
- package/dist/share/session-share.d.ts.map +1 -1
- package/dist/share/session-share.js +14 -2
- package/dist/share/session-share.js.map +1 -1
- package/dist/testing/plugin-testkit.d.ts.map +1 -1
- package/dist/testing/plugin-testkit.js +4 -3
- package/dist/testing/plugin-testkit.js.map +1 -1
- package/dist/testing/runtime-delivery-queue.d.ts.map +1 -1
- package/dist/testing/runtime-delivery-queue.js +2 -1
- package/dist/testing/runtime-delivery-queue.js.map +1 -1
- package/dist/testing/session-plugin-testkit.d.ts.map +1 -1
- package/dist/testing/session-plugin-testkit.js +10 -7
- package/dist/testing/session-plugin-testkit.js.map +1 -1
- package/dist/utils/ansi.d.ts.map +1 -1
- package/dist/utils/ansi.js +2 -1
- package/dist/utils/ansi.js.map +1 -1
- package/dist/utils/clipboard.d.ts.map +1 -1
- package/dist/utils/clipboard.js +7 -6
- package/dist/utils/clipboard.js.map +1 -1
- package/dist/utils/image-resize-worker.d.ts.map +1 -1
- package/dist/utils/image-resize-worker.js +3 -2
- package/dist/utils/image-resize-worker.js.map +1 -1
- package/dist/utils/shell.d.ts.map +1 -1
- package/dist/utils/shell.js +9 -8
- package/dist/utils/shell.js.map +1 -1
- package/dist/utils/tools-manager.d.ts.map +1 -1
- package/dist/utils/tools-manager.js +23 -13
- package/dist/utils/tools-manager.js.map +1 -1
- package/dist/utils/version-check.d.ts.map +1 -1
- package/dist/utils/version-check.js +5 -1
- package/dist/utils/version-check.js.map +1 -1
- package/docs/keybindings.md +3 -0
- package/docs/quickstart.md +1 -1
- package/docs/settings.md +1 -0
- package/docs/terminal-setup.md +2 -3
- package/docs/usage.md +6 -5
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/examples/extensions/with-deps/plugin.json +1 -1
- package/package.json +1 -1
- package/dist/bundle/chunks/chunk-EALJ5DDX.js +0 -1452
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"capability-runtime-manifest.js","sourceRoot":"","sources":["../../../src/core/extensions/capability-runtime-manifest.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,+BAA+B,EAAE,MAAM,iBAAiB,CAAC;AAElE,MAAM,UAAU,cAAc,CAAC,QAAwB,EAAE,IAAsB,EAAQ;IACtF,IACC,CAAC,QAAQ;QACT,OAAO,QAAQ,CAAC,EAAE,KAAK,QAAQ;QAC/B,CAAC,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE;QACnB,OAAO,QAAQ,CAAC,OAAO,KAAK,QAAQ;QACpC,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE;QACxB,OAAO,QAAQ,CAAC,KAAK,KAAK,QAAQ;QAClC,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,EACrB,CAAC;QACF,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;IACpE,CAAC;IACD,IAAI,QAAQ,CAAC,UAAU,K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AClF,OAAO,kBAAkB,CAAC,eAAe,CAAC,MAAM,IAAI,EAAE,CAAC,CAAiB,CAAC;AAAA,CACzE","sourcesContent":["import type {\n\tHostCapabilities,\n\tPluginCapabilityDeclaration,\n\tPluginCapabilityRequirement,\n\tPluginConfig,\n\tPluginConfigValue,\n\tPluginManifest,\n} from \"./public-api.ts\";\nimport { EXPERIMENTAL_PUBLIC_API_VERSION } from \"./public-api.ts\";\n\nexport function assertManifest(manifest: PluginManifest, host: HostCapabilities): void {\n\tif (\n\t\t!manifest ||\n\t\ttypeof manifest.id !== \"string\" ||\n\t\t!manifest.id.trim() ||\n\t\ttypeof manifest.version !== \"string\" ||\n\t\t!manifest.version.trim() ||\n\t\ttypeof manifest.entry !== \"string\" ||\n\t\t!manifest.entry.trim()\n\t) {\n\t\tthrow new Error(\"Plugin manifest requires id, version, and entry\");\n\t}\n\tif (manifest.apiVersion !== EXPERIMENTAL_PUBLIC_API_VERSION) {\n\t\tthrow new Error(`Unsupported plugin API version: ${manifest.apiVersion}`);\n\t}\n\tif (manifest.config !== undefined && !isPluginConfig(manifest.config)) {\n\t\tthrow new Error(\"Plugin manifest config must be a JSON object\");\n\t}\n\tif (manifest.requiredCapabilities !== undefined && !Array.isArray(manifest.requiredCapabilities)) {\n\t\tthrow new Error(\"Plugin manifest requiredCapabilities must be an array\");\n\t}\n\tif (manifest.optionalCapabilities !== undefined && !Array.isArray(manifest.optionalCapabilities)) {\n\t\tthrow new Error(\"Plugin manifest optionalCapabilities must be an array\");\n\t}\n\tif (manifest.requiredCapabilities?.some((capability) => typeof capability !== \"string\")) {\n\t\tthrow new Error(\"Plugin manifest requiredCapabilities must be a string array\");\n\t}\n\tif (manifest.optionalCapabilities?.some((capability) => typeof capability !== \"string\")) {\n\t\tthrow new Error(\"Plugin manifest optionalCapabilities must be a string array\");\n\t}\n\tconst available = new Set(host.features);\n\tconst missing = manifest.requiredCapabilities?.filter((capability) => !available.has(capability)) ?? [];\n\tif (missing.length > 0) {\n\t\tthrow new Error(`Host is missing required capabilities: ${missing.join(\", \")}`);\n\t}\n\tassertPluginCapabilityDeclarations(manifest.provides, `Plugin manifest provides: ${manifest.id}`);\n\tassertPluginCapabilityRequirements(manifest.requires, `Plugin manifest requires: ${manifest.id}`);\n\tassertAgentDeclarations(manifest, `Plugin manifest: ${manifest.id}`);\n}\n\nexport function assertPluginCapabilityId(value: unknown, label: string): asserts value is string {\n\tif (typeof value !== \"string\" || !value.trim()) throw new Error(`${label} must be a non-empty string`);\n}\n\nexport function assertPluginCapabilityVersion(value: unknown, label: string): asserts value is number {\n\tif (typeof value !== \"number\" || !Number.isSafeInteger(value) || value < 1) {\n\t\tthrow new Error(`${label} must be a positive safe integer`);\n\t}\n}\n\nexport function capabilityKey(id: string, version: number): string {\n\treturn `${id}\\u0000${version}`;\n}\n\nexport function comparePluginManifests(left: PluginManifest, right: PluginManifest): number {\n\tif (left.id !== right.id) return left.id < right.id ? -1 : 1;\n\tif (left.version !== right.version) return left.version < right.version ? -1 : 1;\n\tif (left.entry !== right.entry) return left.entry < right.entry ? -1 : 1;\n\treturn 0;\n}\n\nexport function assertPluginCapabilityDeclarations(\n\tdeclarations: readonly PluginCapabilityDeclaration[] | undefined,\n\tlabel: string,\n): void {\n\tif (declarations === undefined) return;\n\tif (!Array.isArray(declarations)) throw new Error(`${label} must be an array`);\n\tconst keys = new Set<string>();\n\tfor (const declaration of declarations) {\n\t\tif (!declaration || typeof declaration !== \"object\") throw new Error(`${label} has an invalid declaration`);\n\t\tassertPluginCapabilityId(declaration.id, `${label}.id`);\n\t\tassertPluginCapabilityVersion(declaration.version, `${label}.version`);\n\t\tif (declaration.kind !== \"service\" && declaration.kind !== \"contribution\" && declaration.kind !== \"transform\") {\n\t\t\tthrow new Error(`${label}.kind is invalid`);\n\t\t}\n\t\tconst key = capabilityKey(declaration.id, declaration.version);\n\t\tif (keys.has(key))\n\t\t\tthrow new Error(`${label} declares capability more than once: ${declaration.id}@${declaration.version}`);\n\t\tkeys.add(key);\n\t}\n}\n\nexport function assertPluginCapabilityRequirements(\n\trequirements: readonly PluginCapabilityRequirement[] | undefined,\n\tlabel: string,\n): void {\n\tif (requirements === undefined) return;\n\tif (!Array.isArray(requirements)) throw new Error(`${label} must be an array`);\n\tconst keys = new Set<string>();\n\tfor (const requirement of requirements) {\n\t\tif (!requirement || typeof requirement !== \"object\") throw new Error(`${label} has an invalid requirement`);\n\t\tassertPluginCapabilityId(requirement.id, `${label}.id`);\n\t\tassertPluginCapabilityVersion(requirement.version, `${label}.version`);\n\t\tif (requirement.optional !== undefined && typeof requirement.optional !== \"boolean\") {\n\t\t\tthrow new Error(`${label}.optional must be a boolean`);\n\t\t}\n\t\tconst key = capabilityKey(requirement.id, requirement.version);\n\t\tif (keys.has(key))\n\t\t\tthrow new Error(`${label} requires capability more than once: ${requirement.id}@${requirement.version}`);\n\t\tkeys.add(key);\n\t}\n}\n\nexport function assertAgentDeclarations(manifest: PluginManifest, label: string): void {\n\tif (manifest.roles !== undefined) {\n\t\tif (!Array.isArray(manifest.roles)) throw new Error(`${label}.roles must be an array`);\n\t\tconst seen = new Set<string>();\n\t\tfor (const role of manifest.roles) {\n\t\t\tif (role !== \"root-agent-controller\" && role !== \"child-agent-controller\") {\n\t\t\t\tthrow new Error(`${label}.roles contains an invalid role`);\n\t\t\t}\n\t\t\tif (seen.has(role)) throw new Error(`${label}.roles declares role more than once: ${role}`);\n\t\t\tseen.add(role);\n\t\t}\n\t}\n\tif (manifest.agents === undefined) return;\n\tif (!Array.isArray(manifest.agents)) throw new Error(`${label}.agents must be an array`);\n\tconst seen = new Set<string>();\n\tfor (const agent of manifest.agents) {\n\t\tif (!agent || typeof agent !== \"object\") throw new Error(`${label}.agents has an invalid declaration`);\n\t\tassertPluginCapabilityId(agent.id, `${label}.agents.id`);\n\t\tassertPluginCapabilityVersion(agent.version, `${label}.agents.version`);\n\t\tif (agent.role !== \"root-agent-controller\" && agent.role !== \"child-agent-controller\") {\n\t\t\tthrow new Error(`${label}.agents.role is invalid`);\n\t\t}\n\t\tif (typeof agent.entry !== \"string\" || !agent.entry.trim()) {\n\t\t\tthrow new Error(`${label}.agents.entry must be a non-empty string`);\n\t\t}\n\t\tif (manifest.roles !== undefined && !manifest.roles.includes(agent.role)) {\n\t\t\tthrow new Error(`${label}.agents.role is not declared in roles`);\n\t\t}\n\t\tconst key = capabilityKey(agent.id, agent.version);\n\t\tif (seen.has(key))\n\t\t\tthrow new Error(`${label}.agents declares definition more than once: ${agent.id}@${agent.version}`);\n\t\tseen.add(key);\n\t}\n}\n\n/**\n * Validate a manifest set before factories execute and return its deterministic\n * dependency order. Plugin capability versions match exactly; a capability\n * identity has one provider in a single load set.\n */\nexport function resolvePluginCapabilityOrder(manifests: readonly PluginManifest[]): readonly PluginManifest[] {\n\tconst providers = new Map<string, PluginManifest>();\n\tfor (const manifest of manifests) {\n\t\tassertPluginCapabilityDeclarations(manifest.provides, `Plugin manifest provides: ${manifest.id}`);\n\t\tassertPluginCapabilityRequirements(manifest.requires, `Plugin manifest requires: ${manifest.id}`);\n\t\tfor (const declaration of manifest.provides ?? []) {\n\t\t\tconst key = capabilityKey(declaration.id, declaration.version);\n\t\t\tconst prior = providers.get(key);\n\t\t\tif (prior) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Plugin capability is provided more than once: ${declaration.id}@${declaration.version} (${prior.id}, ${manifest.id})`,\n\t\t\t\t);\n\t\t\t}\n\t\t\tproviders.set(key, manifest);\n\t\t}\n\t}\n\n\tconst dependencies = new Map<PluginManifest, Set<PluginManifest>>();\n\tfor (const manifest of manifests) {\n\t\tconst required = new Set<PluginManifest>();\n\t\tfor (const requirement of manifest.requires ?? []) {\n\t\t\tconst provider = providers.get(capabilityKey(requirement.id, requirement.version));\n\t\t\tif (!provider) {\n\t\t\t\tif (requirement.optional) continue;\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Plugin capability is required but unavailable: ${requirement.id}@${requirement.version} (${manifest.id})`,\n\t\t\t\t);\n\t\t\t}\n\t\t\tif (provider !== manifest) required.add(provider);\n\t\t}\n\t\tdependencies.set(manifest, required);\n\t}\n\n\tconst ordered: PluginManifest[] = [];\n\tconst pending = new Set(manifests);\n\twhile (pending.size > 0) {\n\t\tconst ready = [...pending]\n\t\t\t.filter((manifest) => [...(dependencies.get(manifest) ?? [])].every((dependency) => !pending.has(dependency)))\n\t\t\t.sort(comparePluginManifests);\n\t\tif (ready.length === 0) {\n\t\t\tconst cycle = [...pending].sort(comparePluginManifests).map((manifest) => manifest.id);\n\t\t\tthrow new Error(`Plugin capability dependency cycle: ${cycle.join(\", \")}`);\n\t\t}\n\t\tfor (const manifest of ready) {\n\t\t\tpending.delete(manifest);\n\t\t\tordered.push(manifest);\n\t\t}\n\t}\n\treturn Object.freeze(ordered);\n}\n\nexport function isPluginConfigValue(value: unknown): value is PluginConfigValue {\n\tif (value === null || typeof value === \"boolean\" || typeof value === \"string\") return true;\n\tif (typeof value === \"number\") return Number.isFinite(value);\n\tif (Array.isArray(value)) return value.every(isPluginConfigValue);\n\tif (!value || typeof value !== \"object\" || Object.getPrototypeOf(value) !== Object.prototype) return false;\n\treturn Object.values(value).every(isPluginConfigValue);\n}\n\nexport function isPluginConfig(value: unknown): value is PluginConfig {\n\treturn !!value && typeof value === \"object\" && !Array.isArray(value) && isPluginConfigValue(value);\n}\n\nfunction freezePluginConfig<T extends PluginConfigValue>(value: T): T {\n\tif (Array.isArray(value)) {\n\t\tfor (const item of value) freezePluginConfig(item);\n\t} else if (value && typeof value === \"object\") {\n\t\tfor (const item of Object.values(value)) freezePluginConfig(item);\n\t}\n\treturn Object.freeze(value);\n}\n\nexport function createPluginConfig(config: PluginConfig | undefined): PluginConfig {\n\treturn freezePluginConfig(structuredClone(config ?? {})) as PluginConfig;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"capability-runtime-manifest.js","sourceRoot":"","sources":["../../../src/core/extensions/capability-runtime-manifest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAA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kBAAkB,CAAC,IAAI,CAAC,CAAC;IACpD,CAAC;SAAM,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC/C,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC;YAAE,kBAAkB,CAAC,IAAI,CAAC,CAAC;IACnE,CAAC;IACD,OAAO,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAAA,CAC5B;AAED,MAAM,UAAU,kBAAkB,CAAC,MAAgC,EAAgB;IAClF,OAAO,kBAAkB,CAAC,eAAe,CAAC,MAAM,IAAI,EAAE,CAAC,CAAiB,CAAC;AAAA,CACzE","sourcesContent":["import { t } from \"../i18n/index.ts\";\nimport type {\n\tHostCapabilities,\n\tPluginCapabilityDeclaration,\n\tPluginCapabilityRequirement,\n\tPluginConfig,\n\tPluginConfigValue,\n\tPluginManifest,\n} from \"./public-api.ts\";\nimport { EXPERIMENTAL_PUBLIC_API_VERSION } from \"./public-api.ts\";\n\nexport function assertManifest(manifest: PluginManifest, host: HostCapabilities): void {\n\tif (\n\t\t!manifest ||\n\t\ttypeof manifest.id !== \"string\" ||\n\t\t!manifest.id.trim() ||\n\t\ttypeof manifest.version !== \"string\" ||\n\t\t!manifest.version.trim() ||\n\t\ttypeof manifest.entry !== \"string\" ||\n\t\t!manifest.entry.trim()\n\t) {\n\t\tthrow new Error(t(\"Plugin manifest requires id, version, and entry\"));\n\t}\n\tif (manifest.apiVersion !== EXPERIMENTAL_PUBLIC_API_VERSION) {\n\t\tthrow new Error(t(\"Unsupported plugin API version: {apiVersion}\", { apiVersion: manifest.apiVersion }));\n\t}\n\tif (manifest.config !== undefined && !isPluginConfig(manifest.config)) {\n\t\tthrow new Error(t(\"Plugin manifest config must be a JSON object\"));\n\t}\n\tif (manifest.requiredCapabilities !== undefined && !Array.isArray(manifest.requiredCapabilities)) {\n\t\tthrow new Error(t(\"Plugin manifest requiredCapabilities must be an array\"));\n\t}\n\tif (manifest.optionalCapabilities !== undefined && !Array.isArray(manifest.optionalCapabilities)) {\n\t\tthrow new Error(t(\"Plugin manifest optionalCapabilities must be an array\"));\n\t}\n\tif (manifest.requiredCapabilities?.some((capability) => typeof capability !== \"string\")) {\n\t\tthrow new Error(t(\"Plugin manifest requiredCapabilities must be a string array\"));\n\t}\n\tif (manifest.optionalCapabilities?.some((capability) => typeof capability !== \"string\")) {\n\t\tthrow new Error(t(\"Plugin manifest optionalCapabilities must be a string array\"));\n\t}\n\tconst available = new Set(host.features);\n\tconst missing = manifest.requiredCapabilities?.filter((capability) => !available.has(capability)) ?? [];\n\tif (missing.length > 0) {\n\t\tthrow new Error(t(\"Host is missing required capabilities: {value}\", { value: missing.join(\", \") }));\n\t}\n\tassertPluginCapabilityDeclarations(manifest.provides, `Plugin manifest provides: ${manifest.id}`);\n\tassertPluginCapabilityRequirements(manifest.requires, `Plugin manifest requires: ${manifest.id}`);\n\tassertAgentDeclarations(manifest, `Plugin manifest: ${manifest.id}`);\n}\n\nexport function assertPluginCapabilityId(value: unknown, label: string): asserts value is string {\n\tif (typeof value !== \"string\" || !value.trim()) throw new Error(t(\"{label} must be a non-empty string\", { label }));\n}\n\nexport function assertPluginCapabilityVersion(value: unknown, label: string): asserts value is number {\n\tif (typeof value !== \"number\" || !Number.isSafeInteger(value) || value < 1) {\n\t\tthrow new Error(t(\"{label} must be a positive safe integer\", { label }));\n\t}\n}\n\nexport function capabilityKey(id: string, version: number): string {\n\treturn `${id}\\u0000${version}`;\n}\n\nexport function comparePluginManifests(left: PluginManifest, right: PluginManifest): number {\n\tif (left.id !== right.id) return left.id < right.id ? -1 : 1;\n\tif (left.version !== right.version) return left.version < right.version ? -1 : 1;\n\tif (left.entry !== right.entry) return left.entry < right.entry ? -1 : 1;\n\treturn 0;\n}\n\nexport function assertPluginCapabilityDeclarations(\n\tdeclarations: readonly PluginCapabilityDeclaration[] | undefined,\n\tlabel: string,\n): void {\n\tif (declarations === undefined) return;\n\tif (!Array.isArray(declarations)) throw new Error(t(\"{label} must be an array\", { label }));\n\tconst keys = new Set<string>();\n\tfor (const declaration of declarations) {\n\t\tif (!declaration || typeof declaration !== \"object\")\n\t\t\tthrow new Error(t(\"{label} has an invalid declaration\", { label }));\n\t\tassertPluginCapabilityId(declaration.id, `${label}.id`);\n\t\tassertPluginCapabilityVersion(declaration.version, `${label}.version`);\n\t\tif (declaration.kind !== \"service\" && declaration.kind !== \"contribution\" && declaration.kind !== \"transform\") {\n\t\t\tthrow new Error(t(\"{label}.kind is invalid\", { label }));\n\t\t}\n\t\tconst key = capabilityKey(declaration.id, declaration.version);\n\t\tif (keys.has(key))\n\t\t\tthrow new Error(\n\t\t\t\tt(\"{label} declares capability more than once: {id}@{version}\", {\n\t\t\t\t\tlabel,\n\t\t\t\t\tid: declaration.id,\n\t\t\t\t\tversion: declaration.version,\n\t\t\t\t}),\n\t\t\t);\n\t\tkeys.add(key);\n\t}\n}\n\nexport function assertPluginCapabilityRequirements(\n\trequirements: readonly PluginCapabilityRequirement[] | undefined,\n\tlabel: string,\n): void {\n\tif (requirements === undefined) return;\n\tif (!Array.isArray(requirements)) throw new Error(t(\"{label} must be an array\", { label }));\n\tconst keys = new Set<string>();\n\tfor (const requirement of requirements) {\n\t\tif (!requirement || typeof requirement !== \"object\")\n\t\t\tthrow new Error(t(\"{label} has an invalid requirement\", { label }));\n\t\tassertPluginCapabilityId(requirement.id, `${label}.id`);\n\t\tassertPluginCapabilityVersion(requirement.version, `${label}.version`);\n\t\tif (requirement.optional !== undefined && typeof requirement.optional !== \"boolean\") {\n\t\t\tthrow new Error(t(\"{label}.optional must be a boolean\", { label }));\n\t\t}\n\t\tconst key = capabilityKey(requirement.id, requirement.version);\n\t\tif (keys.has(key))\n\t\t\tthrow new Error(\n\t\t\t\tt(\"{label} requires capability more than once: {id}@{version}\", {\n\t\t\t\t\tlabel,\n\t\t\t\t\tid: requirement.id,\n\t\t\t\t\tversion: requirement.version,\n\t\t\t\t}),\n\t\t\t);\n\t\tkeys.add(key);\n\t}\n}\n\nexport function assertAgentDeclarations(manifest: PluginManifest, label: string): void {\n\tif (manifest.roles !== undefined) {\n\t\tif (!Array.isArray(manifest.roles)) throw new Error(t(\"{label}.roles must be an array\", { label }));\n\t\tconst seen = new Set<string>();\n\t\tfor (const role of manifest.roles) {\n\t\t\tif (role !== \"root-agent-controller\" && role !== \"child-agent-controller\") {\n\t\t\t\tthrow new Error(t(\"{label}.roles contains an invalid role\", { label }));\n\t\t\t}\n\t\t\tif (seen.has(role)) throw new Error(t(\"{label}.roles declares role more than once: {role}\", { label, role }));\n\t\t\tseen.add(role);\n\t\t}\n\t}\n\tif (manifest.agents === undefined) return;\n\tif (!Array.isArray(manifest.agents)) throw new Error(t(\"{label}.agents must be an array\", { label }));\n\tconst seen = new Set<string>();\n\tfor (const agent of manifest.agents) {\n\t\tif (!agent || typeof agent !== \"object\")\n\t\t\tthrow new Error(t(\"{label}.agents has an invalid declaration\", { label }));\n\t\tassertPluginCapabilityId(agent.id, `${label}.agents.id`);\n\t\tassertPluginCapabilityVersion(agent.version, `${label}.agents.version`);\n\t\tif (agent.role !== \"root-agent-controller\" && agent.role !== \"child-agent-controller\") {\n\t\t\tthrow new Error(t(\"{label}.agents.role is invalid\", { label }));\n\t\t}\n\t\tif (typeof agent.entry !== \"string\" || !agent.entry.trim()) {\n\t\t\tthrow new Error(t(\"{label}.agents.entry must be a non-empty string\", { label }));\n\t\t}\n\t\tif (manifest.roles !== undefined && !manifest.roles.includes(agent.role)) {\n\t\t\tthrow new Error(t(\"{label}.agents.role is not declared in roles\", { label }));\n\t\t}\n\t\tconst key = capabilityKey(agent.id, agent.version);\n\t\tif (seen.has(key))\n\t\t\tthrow new Error(\n\t\t\t\tt(\"{label}.agents declares definition more than once: {id}@{version}\", {\n\t\t\t\t\tlabel,\n\t\t\t\t\tid: agent.id,\n\t\t\t\t\tversion: agent.version,\n\t\t\t\t}),\n\t\t\t);\n\t\tseen.add(key);\n\t}\n}\n\n/**\n * Validate a manifest set before factories execute and return its deterministic\n * dependency order. Plugin capability versions match exactly; a capability\n * identity has one provider in a single load set.\n */\nexport function resolvePluginCapabilityOrder(manifests: readonly PluginManifest[]): readonly PluginManifest[] {\n\tconst providers = new Map<string, PluginManifest>();\n\tfor (const manifest of manifests) {\n\t\tassertPluginCapabilityDeclarations(manifest.provides, `Plugin manifest provides: ${manifest.id}`);\n\t\tassertPluginCapabilityRequirements(manifest.requires, `Plugin manifest requires: ${manifest.id}`);\n\t\tfor (const declaration of manifest.provides ?? []) {\n\t\t\tconst key = capabilityKey(declaration.id, declaration.version);\n\t\t\tconst prior = providers.get(key);\n\t\t\tif (prior) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\tt(\"Plugin capability is provided more than once: {id}@{version} ({priorId}, {manifestId})\", {\n\t\t\t\t\t\tid: declaration.id,\n\t\t\t\t\t\tversion: declaration.version,\n\t\t\t\t\t\tpriorId: prior.id,\n\t\t\t\t\t\tmanifestId: manifest.id,\n\t\t\t\t\t}),\n\t\t\t\t);\n\t\t\t}\n\t\t\tproviders.set(key, manifest);\n\t\t}\n\t}\n\n\tconst dependencies = new Map<PluginManifest, Set<PluginManifest>>();\n\tfor (const manifest of manifests) {\n\t\tconst required = new Set<PluginManifest>();\n\t\tfor (const requirement of manifest.requires ?? []) {\n\t\t\tconst provider = providers.get(capabilityKey(requirement.id, requirement.version));\n\t\t\tif (!provider) {\n\t\t\t\tif (requirement.optional) continue;\n\t\t\t\tthrow new Error(\n\t\t\t\t\tt(\"Plugin capability is required but unavailable: {capabilityId}@{version} ({pluginId})\", {\n\t\t\t\t\t\tcapabilityId: requirement.id,\n\t\t\t\t\t\tversion: requirement.version,\n\t\t\t\t\t\tpluginId: manifest.id,\n\t\t\t\t\t}),\n\t\t\t\t);\n\t\t\t}\n\t\t\tif (provider !== manifest) required.add(provider);\n\t\t}\n\t\tdependencies.set(manifest, required);\n\t}\n\n\tconst ordered: PluginManifest[] = [];\n\tconst pending = new Set(manifests);\n\twhile (pending.size > 0) {\n\t\tconst ready = [...pending]\n\t\t\t.filter((manifest) => [...(dependencies.get(manifest) ?? [])].every((dependency) => !pending.has(dependency)))\n\t\t\t.sort(comparePluginManifests);\n\t\tif (ready.length === 0) {\n\t\t\tconst cycle = [...pending].sort(comparePluginManifests).map((manifest) => manifest.id);\n\t\t\tthrow new Error(t(\"Plugin capability dependency cycle: {value}\", { value: cycle.join(\", \") }));\n\t\t}\n\t\tfor (const manifest of ready) {\n\t\t\tpending.delete(manifest);\n\t\t\tordered.push(manifest);\n\t\t}\n\t}\n\treturn Object.freeze(ordered);\n}\n\nexport function isPluginConfigValue(value: unknown): value is PluginConfigValue {\n\tif (value === null || typeof value === \"boolean\" || typeof value === \"string\") return true;\n\tif (typeof value === \"number\") return Number.isFinite(value);\n\tif (Array.isArray(value)) return value.every(isPluginConfigValue);\n\tif (!value || typeof value !== \"object\" || Object.getPrototypeOf(value) !== Object.prototype) return false;\n\treturn Object.values(value).every(isPluginConfigValue);\n}\n\nexport function isPluginConfig(value: unknown): value is PluginConfig {\n\treturn !!value && typeof value === \"object\" && !Array.isArray(value) && isPluginConfigValue(value);\n}\n\nfunction freezePluginConfig<T extends PluginConfigValue>(value: T): T {\n\tif (Array.isArray(value)) {\n\t\tfor (const item of value) freezePluginConfig(item);\n\t} else if (value && typeof value === \"object\") {\n\t\tfor (const item of Object.values(value)) freezePluginConfig(item);\n\t}\n\treturn Object.freeze(value);\n}\n\nexport function createPluginConfig(config: PluginConfig | undefined): PluginConfig {\n\treturn freezePluginConfig(structuredClone(config ?? {})) as PluginConfig;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"capability-runtime-validation.d.ts","sourceRoot":"","sources":["../../../src/core/extensions/capability-runtime-validation.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACX,sBAAsB,EACtB,2BAA2B,EAC3B,uBAAuB,EAEvB,2BAA2B,EAC3B,wBAAwB,EACxB,gBAAgB,EAEhB,gBAAgB,EAChB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AE,OAAO,GAAG,OAAO,CAAC,IAAI,IAAI,gBAAgB,CA0B1E;AAED,6FAAwF;AACxF,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,OAAO,GAAG,OAAO,CAE7D;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAKnE;AAED,wBAAgB,yBAAyB,CAAC,UAAU,EAAE,2BAA2B,GAAG,2BAA2B,CAkB9G;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,GAAG,uBAAuB,GAAG,SAAS,CA6B9G;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAU1G;AAED,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,sBAAsB,GAAG,IAAI,CAO5E;AAED,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,CAYvG","sourcesContent":["import { isPluginConfigValue } from \"./capability-runtime-manifest.ts\";\nimport type {\n\tAgentTaskCreateRequest,\n\tCapabilityCommandDefinition,\n\tCapabilityCommandResult,\n\tContributionLifecycle,\n\tContributionPointDefinition,\n\tCredentialResolveRequest,\n\tExecutionFactsV1,\n\tExecutionPhaseV1,\n\tHostCapabilities,\n\tInteractionNotifyLevel,\n\tInteractionRequestV1,\n\tLifecycleEventDefinition,\n\tLifecyclePhase,\n\tLifecycleRegistrationKind,\n\tRetryScheduleV1,\n\tSessionRevisionV1,\n} from \"./public-api.ts\";\nimport { EXPERIMENTAL_PUBLIC_API_VERSION } from \"./public-api.ts\";\n\nconst contributionLifecycles = new Set<ContributionLifecycle>([\"observe\", \"transform\", \"execute\", \"after-commit\"]);\n\nexport const lifecyclePhases = new Set<LifecyclePhase>([\"raw\", \"candidate\", \"committed\"]);\nexport const lifecycleRegistrationKinds = new Set<LifecycleRegistrationKind>([\n\t\"observe\",\n\t\"transform\",\n\t\"execute\",\n\t\"after-commit\",\n]);\n\nexport function validateContributionPointDefinition<TValue>(\n\tdefinition: ContributionPointDefinition<TValue>,\n): ContributionPointDefinition<TValue> {\n\tif (!definition || typeof definition !== \"object\") {\n\t\tthrow new Error(\"Contribution point definition is required\");\n\t}\n\tif (typeof definition.id !== \"string\" || !definition.id.trim()) {\n\t\tthrow new Error(\"Contribution point requires a non-empty id\");\n\t}\n\tif (!Number.isSafeInteger(definition.version) || definition.version < 1) {\n\t\tthrow new Error(\"Contribution point version must be a positive safe integer\");\n\t}\n\tif (typeof definition.schema !== \"string\" || !definition.schema.trim()) {\n\t\tthrow new Error(\"Contribution point requires a non-empty schema\");\n\t}\n\tif (definition.lifecycle !== undefined && !contributionLifecycles.has(definition.lifecycle)) {\n\t\tthrow new Error(`Contribution point lifecycle is invalid: ${String(definition.lifecycle)}`);\n\t}\n\tif (typeof definition.validate !== \"function\") {\n\t\tthrow new Error(\"Contribution point requires a validate function\");\n\t}\n\treturn definition;\n}\n\nexport function contributionPointKey(id: string, version: number): string {\n\treturn `${id}@${version}`;\n}\n\nexport function lifecycleEventKey(id: string, version: number): string {\n\treturn `${id}@${version}`;\n}\n\nexport function validateLifecycleEventDefinition<TData>(\n\tdefinition: LifecycleEventDefinition<TData>,\n): LifecycleEventDefinition<TData> {\n\tif (!definition || typeof definition !== \"object\") throw new Error(\"Lifecycle event definition is required\");\n\tif (typeof definition.id !== \"string\" || !definition.id.trim()) {\n\t\tthrow new Error(\"Lifecycle event requires a non-empty id\");\n\t}\n\tif (!Number.isSafeInteger(definition.version) || definition.version < 1) {\n\t\tthrow new Error(\"Lifecycle event version must be a positive safe integer\");\n\t}\n\tif (!lifecyclePhases.has(definition.phase)) {\n\t\tthrow new Error(`Lifecycle event phase is invalid: ${String(definition.phase)}`);\n\t}\n\tconst allowedPhases = definition.allowedPhases;\n\tif (\n\t\tallowedPhases !== undefined &&\n\t\t(!Array.isArray(allowedPhases) ||\n\t\t\tallowedPhases.length === 0 ||\n\t\t\tallowedPhases.some((phase) => !lifecyclePhases.has(phase)))\n\t) {\n\t\tthrow new Error(\"Lifecycle event allowedPhases must be a non-empty array of valid phases when provided\");\n\t}\n\tif (allowedPhases && new Set(allowedPhases).size !== allowedPhases.length) {\n\t\tthrow new Error(\"Lifecycle event allowedPhases must not contain duplicates\");\n\t}\n\tif (allowedPhases && !allowedPhases.includes(definition.phase)) {\n\t\tthrow new Error(\"Lifecycle event allowedPhases must include phase\");\n\t}\n\tif (typeof definition.schema !== \"string\" || !definition.schema.trim()) {\n\t\tthrow new Error(\"Lifecycle event requires a non-empty schema\");\n\t}\n\tif (typeof definition.validate !== \"function\") {\n\t\tthrow new Error(\"Lifecycle event requires a validate function\");\n\t}\n\tconst allowedRegistrationKinds = definition.allowedRegistrationKinds;\n\tif (\n\t\tallowedRegistrationKinds !== undefined &&\n\t\t(!Array.isArray(allowedRegistrationKinds) || allowedRegistrationKinds.length === 0)\n\t) {\n\t\tthrow new Error(\"Lifecycle event allowedRegistrationKinds must be a non-empty array when provided\");\n\t}\n\tif (allowedRegistrationKinds?.some((kind) => !lifecycleRegistrationKinds.has(kind))) {\n\t\tthrow new Error(\"Lifecycle event allowedRegistrationKinds contains an invalid registration kind\");\n\t}\n\tif (allowedRegistrationKinds && new Set(allowedRegistrationKinds).size !== allowedRegistrationKinds.length) {\n\t\tthrow new Error(\"Lifecycle event allowedRegistrationKinds must not contain duplicates\");\n\t}\n\treturn Object.freeze({\n\t\tid: definition.id,\n\t\tversion: definition.version,\n\t\tphase: definition.phase,\n\t\t...(allowedPhases === undefined ? {} : { allowedPhases: Object.freeze([...allowedPhases]) }),\n\t\tschema: definition.schema,\n\t\t...(allowedRegistrationKinds === undefined\n\t\t\t? {}\n\t\t\t: { allowedRegistrationKinds: Object.freeze([...allowedRegistrationKinds]) }),\n\t\tvalidate: definition.validate,\n\t});\n}\n\nexport function stableTextCompare(left: string, right: string): number {\n\treturn left < right ? -1 : left > right ? 1 : 0;\n}\n\nexport function validateCredentialRequest(request: CredentialResolveRequest): void {\n\tif (!request || typeof request.providerId !== \"string\" || !request.providerId.trim()) {\n\t\tthrow new Error(\"Credential resolution requires a non-empty providerId\");\n\t}\n\tif (request.minValidityMs !== undefined && (!Number.isFinite(request.minValidityMs) || request.minValidityMs < 0)) {\n\t\tthrow new Error(\"Credential minValidityMs must be a non-negative finite number\");\n\t}\n}\n\nconst INTERACTION_NOTIFY_LEVELS = new Set<InteractionNotifyLevel>([\"info\", \"warning\", \"error\"]);\n\nexport function validateInteractionNotifyRequest(request: { message: string; level?: InteractionNotifyLevel }): void {\n\tif (!request || typeof request !== \"object\" || typeof request.message !== \"string\" || !request.message.trim()) {\n\t\tthrow new Error(\"Interaction notify requires a non-empty message\");\n\t}\n\tif (request.level !== undefined && !INTERACTION_NOTIFY_LEVELS.has(request.level)) {\n\t\tthrow new Error(\"Interaction notify level must be info, warning, or error\");\n\t}\n}\n\nexport function validateInteractionRequest(request: InteractionRequestV1): void {\n\tif (!request || typeof request !== \"object\") {\n\t\tthrow new Error(\"Interaction request must be an object with a known kind\");\n\t}\n\tswitch (request.kind) {\n\t\tcase \"notify\":\n\t\t\tvalidateInteractionNotifyRequest(request);\n\t\t\treturn;\n\t\tcase \"confirm\":\n\t\t\tassertNonEmptyString(request.title, \"Interaction confirm title\");\n\t\t\tassertNonEmptyString(request.message, \"Interaction confirm message\");\n\t\t\treturn;\n\t\tcase \"select\":\n\t\t\tassertNonEmptyString(request.title, \"Interaction select title\");\n\t\t\tif (!Array.isArray(request.options) || request.options.length === 0) {\n\t\t\t\tthrow new Error(\"Interaction select requires a non-empty options array\");\n\t\t\t}\n\t\t\tif (request.options.some((option) => typeof option !== \"string\" || !option.trim())) {\n\t\t\t\tthrow new Error(\"Interaction select options must be non-empty strings\");\n\t\t\t}\n\t\t\treturn;\n\t\tcase \"input\":\n\t\t\tassertNonEmptyString(request.title, \"Interaction input title\");\n\t\t\tif (request.placeholder !== undefined && typeof request.placeholder !== \"string\") {\n\t\t\t\tthrow new Error(\"Interaction input placeholder must be a string\");\n\t\t\t}\n\t\t\tif (request.defaultValue !== undefined && typeof request.defaultValue !== \"string\") {\n\t\t\t\tthrow new Error(\"Interaction input defaultValue must be a string\");\n\t\t\t}\n\t\t\treturn;\n\t\tdefault:\n\t\t\tthrow new Error(\"Interaction request requires a known kind: notify, confirm, select, or input\");\n\t}\n}\n\nexport function validateInteractionTimeoutMs(timeoutMs: number | undefined): void {\n\tif (timeoutMs === undefined) return;\n\tif (!Number.isSafeInteger(timeoutMs) || timeoutMs <= 0) {\n\t\tthrow new Error(\"Interaction timeoutMs must be a positive integer\");\n\t}\n}\n\nconst EXECUTION_FACT_KEYS = [\"version\", \"operationId\", \"sessionId\", \"inputRevision\", \"phase\"] as const;\nconst RETRY_SCHEDULE_KEYS = [...EXECUTION_FACT_KEYS, \"action\", \"attempt\", \"delayMs\"] as const;\nconst executionPhases = new Set<ExecutionPhaseV1>([\n\t\"agent\",\n\t\"compaction\",\n\t\"overflow\",\n\t\"retry\",\n\t\"branch_summary\",\n\t\"reload\",\n\t\"tree\",\n]);\n\nfunction assertPlainRecord(value: unknown, label: string): Record<string, unknown> {\n\tif (\n\t\t!value ||\n\t\ttypeof value !== \"object\" ||\n\t\tArray.isArray(value) ||\n\t\tObject.getPrototypeOf(value) !== Object.prototype\n\t) {\n\t\tthrow new Error(`${label} must be a plain object`);\n\t}\n\treturn value as Record<string, unknown>;\n}\n\nfunction assertExactKeys(value: Record<string, unknown>, keys: readonly string[], label: string): void {\n\tconst allowed = new Set(keys);\n\tconst unexpected = Object.keys(value).filter((key) => !allowed.has(key));\n\tif (unexpected.length > 0) {\n\t\tthrow new Error(`${label} has unsupported fields: ${unexpected.join(\", \")}`);\n\t}\n\tconst missing = keys.filter((key) => !(key in value));\n\tif (missing.length > 0) {\n\t\tthrow new Error(`${label} is missing required fields: ${missing.join(\", \")}`);\n\t}\n}\n\nfunction assertNonEmptyString(value: unknown, label: string): asserts value is string {\n\tif (typeof value !== \"string\" || !value.trim()) throw new Error(`${label} must be a non-empty string`);\n}\n\nfunction assertNonNegativeSafeInteger(value: unknown, label: string): asserts value is number {\n\tif (typeof value !== \"number\" || !Number.isSafeInteger(value) || value < 0) {\n\t\tthrow new Error(`${label} must be a non-negative safe integer`);\n\t}\n}\n\nfunction assertNonNegativeFinite(value: unknown, label: string): asserts value is number {\n\tif (typeof value !== \"number\" || !Number.isFinite(value) || value < 0) {\n\t\tthrow new Error(`${label} must be a non-negative finite number`);\n\t}\n}\n\nfunction validateSessionRevisionV1(value: unknown, label: string): SessionRevisionV1 {\n\tconst revision = assertPlainRecord(value, label);\n\tassertExactKeys(revision, [\"version\", \"sessionId\", \"sequence\", \"leafId\"], label);\n\tif (revision.version !== 1) throw new Error(`${label}.version must be 1`);\n\tassertNonEmptyString(revision.sessionId, `${label}.sessionId`);\n\tassertNonNegativeSafeInteger(revision.sequence, `${label}.sequence`);\n\tif (typeof revision.leafId !== \"string\" && revision.leafId !== null) {\n\t\tthrow new Error(`${label}.leafId must be a string or null`);\n\t}\n\tif (typeof revision.leafId === \"string\" && !revision.leafId.trim()) {\n\t\tthrow new Error(`${label}.leafId must be a non-empty string or null`);\n\t}\n\treturn Object.freeze({\n\t\tversion: 1,\n\t\tsessionId: revision.sessionId,\n\t\tsequence: revision.sequence,\n\t\tleafId: revision.leafId,\n\t});\n}\n\n/**\n * Strictly validates host-supplied execution facts and returns an immutable,\n * detached V1 value. It performs no state lookup and grants no commit right.\n */\nexport function validateExecutionFactsV1(value: unknown): ExecutionFactsV1 {\n\tconst facts = assertPlainRecord(value, \"Execution facts\");\n\tassertExactKeys(facts, EXECUTION_FACT_KEYS, \"Execution facts\");\n\tif (facts.version !== 1) throw new Error(\"Execution facts.version must be 1\");\n\tassertNonEmptyString(facts.operationId, \"Execution facts.operationId\");\n\tassertNonEmptyString(facts.sessionId, \"Execution facts.sessionId\");\n\tif (typeof facts.phase !== \"string\" || !executionPhases.has(facts.phase as ExecutionPhaseV1)) {\n\t\tthrow new Error(\"Execution facts.phase is invalid\");\n\t}\n\tconst inputRevision = validateSessionRevisionV1(facts.inputRevision, \"Execution facts.inputRevision\");\n\tif (inputRevision.sessionId !== facts.sessionId) {\n\t\tthrow new Error(\"Execution facts.inputRevision.sessionId must match Execution facts.sessionId\");\n\t}\n\treturn Object.freeze({\n\t\tversion: 1,\n\t\toperationId: facts.operationId,\n\t\tsessionId: facts.sessionId,\n\t\tinputRevision,\n\t\tphase: facts.phase as ExecutionPhaseV1,\n\t});\n}\n\n/**\n * Strictly validates a retry decision bound to one execution boundary. A\n * scheduled retry is one-based; a stop outcome cannot request a delay.\n */\nexport function validateRetryScheduleV1(value: unknown): RetryScheduleV1 {\n\tconst schedule = assertPlainRecord(value, \"Retry schedule\");\n\tassertExactKeys(schedule, RETRY_SCHEDULE_KEYS, \"Retry schedule\");\n\tconst facts = validateExecutionFactsV1({\n\t\tversion: schedule.version,\n\t\toperationId: schedule.operationId,\n\t\tsessionId: schedule.sessionId,\n\t\tinputRevision: schedule.inputRevision,\n\t\tphase: schedule.phase,\n\t});\n\tif (schedule.action !== \"retry\" && schedule.action !== \"stop\") {\n\t\tthrow new Error(\"Retry schedule.action must be retry or stop\");\n\t}\n\tassertNonNegativeSafeInteger(schedule.attempt, \"Retry schedule.attempt\");\n\tassertNonNegativeFinite(schedule.delayMs, \"Retry schedule.delayMs\");\n\tif (schedule.action === \"retry\" && schedule.attempt === 0) {\n\t\tthrow new Error(\"Retry schedule.retry requires a one-based attempt\");\n\t}\n\tif (schedule.action === \"stop\" && schedule.delayMs !== 0) {\n\t\tthrow new Error(\"Retry schedule.stop must have delayMs 0\");\n\t}\n\treturn Object.freeze({ ...facts, action: schedule.action, attempt: schedule.attempt, delayMs: schedule.delayMs });\n}\n\nexport function assertHost(host: unknown): asserts host is HostCapabilities {\n\tif (!host || typeof host !== \"object\" || Array.isArray(host)) {\n\t\tthrow new Error(\"Host capabilities must be an object\");\n\t}\n\tconst candidate = host as Partial<HostCapabilities>;\n\tif (candidate.apiVersion !== EXPERIMENTAL_PUBLIC_API_VERSION) {\n\t\tthrow new Error(`Unsupported host API version: ${candidate.apiVersion}`);\n\t}\n\tif (candidate.mode !== \"readonly\" && candidate.mode !== \"full-control\") {\n\t\tthrow new Error(\"Host mode must be readonly or full-control\");\n\t}\n\tif (\n\t\t!Array.isArray(candidate.features) ||\n\t\tcandidate.features.some((feature) => typeof feature !== \"string\" || !feature.trim())\n\t) {\n\t\tthrow new Error(\"Host features must be an array of non-empty strings\");\n\t}\n\tif (\n\t\t!Array.isArray(candidate.transports) ||\n\t\tcandidate.transports.some(\n\t\t\t(transport) =>\n\t\t\t\ttransport !== \"in-process\" && transport !== \"stdio\" && transport !== \"http\" && transport !== \"rpc\",\n\t\t)\n\t) {\n\t\tthrow new Error(\"Host transports must be an array of supported transports\");\n\t}\n}\n\n/** Read the owning plugin's readonly-mode declaration off a tool definition (宪法 §6). */\nexport function toolReadonlySafe(definition: unknown): boolean {\n\treturn (definition as { readonlySafe?: unknown } | undefined)?.readonlySafe === true;\n}\n\nexport function capabilityName(value: unknown, kind: string): string {\n\tif (!value || typeof value !== \"object\" || !(\"name\" in value) || typeof value.name !== \"string\" || !value.name) {\n\t\tthrow new Error(`${kind} definition requires a non-empty name`);\n\t}\n\treturn value.name;\n}\n\nexport function validateCommandDefinition(definition: CapabilityCommandDefinition): CapabilityCommandDefinition {\n\tif (!definition || typeof definition !== \"object\") {\n\t\tthrow new Error(\"Command requires a definition\");\n\t}\n\tconst { name, description, argumentHint, execute } = definition;\n\tif (typeof name !== \"string\" || !name || name.startsWith(\"/\") || /\\s/.test(name)) {\n\t\tthrow new Error(\"Command definition requires a non-empty name without slash or whitespace\");\n\t}\n\tif (typeof description !== \"string\" || !description.trim()) {\n\t\tthrow new Error(\"Command definition requires a non-empty description\");\n\t}\n\tif (argumentHint !== undefined && typeof argumentHint !== \"string\") {\n\t\tthrow new Error(\"Command definition argumentHint must be a string\");\n\t}\n\tif (typeof execute !== \"function\") {\n\t\tthrow new Error(\"Command definition requires an execute function\");\n\t}\n\treturn definition;\n}\n\nexport function validateCommandResult(value: unknown, commandName: string): CapabilityCommandResult | undefined {\n\tif (value === undefined) return undefined;\n\tif (!value || typeof value !== \"object\" || Array.isArray(value)) {\n\t\tthrow new Error(`Capability command returned an invalid result: ${commandName}`);\n\t}\n\tconst result = value as Partial<CapabilityCommandResult>;\n\tif (result.status !== \"success\" && result.status !== \"error\") {\n\t\tthrow new Error(`Capability command returned an invalid status: ${commandName}`);\n\t}\n\tif (typeof result.message !== \"string\") {\n\t\tthrow new Error(`Capability command returned an invalid message: ${commandName}`);\n\t}\n\tif (\n\t\tresult.links !== undefined &&\n\t\t(!Array.isArray(result.links) ||\n\t\t\tresult.links.some(\n\t\t\t\t(link) =>\n\t\t\t\t\t!link ||\n\t\t\t\t\ttypeof link !== \"object\" ||\n\t\t\t\t\ttypeof (link as { label?: unknown }).label !== \"string\" ||\n\t\t\t\t\ttypeof (link as { url?: unknown }).url !== \"string\",\n\t\t\t))\n\t) {\n\t\tthrow new Error(`Capability command returned invalid links: ${commandName}`);\n\t}\n\tif (result.data !== undefined && !isPluginConfigValue(result.data)) {\n\t\tthrow new Error(`Capability command returned non-serializable data: ${commandName}`);\n\t}\n\treturn value as CapabilityCommandResult;\n}\n\nexport function asHandler(value: unknown, kind: string): (...args: unknown[]) => unknown | Promise<unknown> {\n\tif (typeof value === \"function\") return value as (...args: unknown[]) => unknown | Promise<unknown>;\n\tif (value && typeof value === \"object\") {\n\t\tconst handlers = value as Record<string, unknown>;\n\t\tfor (const key of [\"execute\", \"run\", \"handler\"] as const) {\n\t\t\tconst candidate = handlers[key];\n\t\t\tif (typeof candidate === \"function\") return candidate as (...args: unknown[]) => unknown | Promise<unknown>;\n\t\t}\n\t}\n\tthrow new Error(`${kind} requires a callable handler`);\n}\n\nexport function assertAgentTaskRequest(request: AgentTaskCreateRequest): void {\n\tif (!request || typeof request.prompt !== \"string\" || !request.prompt.trim()) {\n\t\tthrow new Error(\"Agent task requires a non-empty prompt\");\n\t}\n\tif (request.metadata !== undefined && (typeof request.metadata !== \"object\" || Array.isArray(request.metadata))) {\n\t\tthrow new Error(\"Agent task metadata must be an object\");\n\t}\n}\n\nexport function validateProviderHeaders(headers: unknown, source: string): Record<string, string | null> {\n\tif (!headers || typeof headers !== \"object\" || Array.isArray(headers)) {\n\t\tthrow new Error(`Provider header transform returned invalid headers: ${source}`);\n\t}\n\tconst validated: Record<string, string | null> = {};\n\tfor (const [name, value] of Object.entries(headers)) {\n\t\tif (!name || (typeof value !== \"string\" && value !== null)) {\n\t\t\tthrow new Error(`Provider header transform returned invalid headers: ${source}`);\n\t\t}\n\t\tvalidated[name] = value;\n\t}\n\treturn validated;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"capability-runtime-validation.d.ts","sourceRoot":"","sources":["../../../src/core/extensions/capability-runtime-validation.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACX,sBAAsB,EACtB,2BAA2B,EAC3B,uBAAuB,EAEvB,2BAA2B,EAC3B,wBAAwB,EACxB,gBAAgB,EAEhB,gBAAgB,EAChB,sBAAsB,EACtB,oBAAoB,EACpB,wBAAwB,EACxB,cAAc,EACd,yBAAyB,EACzB,eAAe,EAEf,MAAM,iBAAiB,CAAC;AAKzB,eAAO,MAAM,eAAe,qBAA6D,CAAC;AAC1F,eAAO,MAAM,0BAA0B,gCAKrC,CAAC;AAEH,wBAAgB,mCAAmC,CAAC,MAAM,EACzD,UAAU,EAAE,2BAA2B,CAAC,MAAM,CAAC,GAC7C,2BAA2B,CAAC,MAAM,CAAC,CAoBrC;AAED,wBAAgB,oBAAoB,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAExE;AAED,wBAAgB,iBAAiB,CAAC,EA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KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAU1G;AAED,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,sBAAsB,GAAG,IAAI,CAO5E;AAED,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,CAYvG","sourcesContent":["import { t } from \"../i18n/index.ts\";\nimport { isPluginConfigValue } from \"./capability-runtime-manifest.ts\";\nimport type {\n\tAgentTaskCreateRequest,\n\tCapabilityCommandDefinition,\n\tCapabilityCommandResult,\n\tContributionLifecycle,\n\tContributionPointDefinition,\n\tCredentialResolveRequest,\n\tExecutionFactsV1,\n\tExecutionPhaseV1,\n\tHostCapabilities,\n\tInteractionNotifyLevel,\n\tInteractionRequestV1,\n\tLifecycleEventDefinition,\n\tLifecyclePhase,\n\tLifecycleRegistrationKind,\n\tRetryScheduleV1,\n\tSessionRevisionV1,\n} from \"./public-api.ts\";\nimport { EXPERIMENTAL_PUBLIC_API_VERSION } from \"./public-api.ts\";\n\nconst contributionLifecycles = new Set<ContributionLifecycle>([\"observe\", \"transform\", \"execute\", \"after-commit\"]);\n\nexport const lifecyclePhases = new Set<LifecyclePhase>([\"raw\", \"candidate\", \"committed\"]);\nexport const lifecycleRegistrationKinds = new Set<LifecycleRegistrationKind>([\n\t\"observe\",\n\t\"transform\",\n\t\"execute\",\n\t\"after-commit\",\n]);\n\nexport function validateContributionPointDefinition<TValue>(\n\tdefinition: ContributionPointDefinition<TValue>,\n): ContributionPointDefinition<TValue> {\n\tif (!definition || typeof definition !== \"object\") {\n\t\tthrow new Error(t(\"Contribution point definition is required\"));\n\t}\n\tif (typeof definition.id !== \"string\" || !definition.id.trim()) {\n\t\tthrow new Error(t(\"Contribution point requires a non-empty id\"));\n\t}\n\tif (!Number.isSafeInteger(definition.version) || definition.version < 1) {\n\t\tthrow new Error(t(\"Contribution point version must be a positive safe integer\"));\n\t}\n\tif (typeof definition.schema !== \"string\" || !definition.schema.trim()) {\n\t\tthrow new Error(t(\"Contribution point requires a non-empty schema\"));\n\t}\n\tif (definition.lifecycle !== undefined && !contributionLifecycles.has(definition.lifecycle)) {\n\t\tthrow new Error(t(\"Contribution point lifecycle is invalid: {value}\", { value: String(definition.lifecycle) }));\n\t}\n\tif (typeof definition.validate !== \"function\") {\n\t\tthrow new Error(t(\"Contribution point requires a validate function\"));\n\t}\n\treturn definition;\n}\n\nexport function contributionPointKey(id: string, version: number): string {\n\treturn `${id}@${version}`;\n}\n\nexport function lifecycleEventKey(id: string, version: number): string {\n\treturn `${id}@${version}`;\n}\n\nexport function validateLifecycleEventDefinition<TData>(\n\tdefinition: LifecycleEventDefinition<TData>,\n): LifecycleEventDefinition<TData> {\n\tif (!definition || typeof definition !== \"object\") throw new Error(t(\"Lifecycle event definition is required\"));\n\tif (typeof definition.id !== \"string\" || !definition.id.trim()) {\n\t\tthrow new Error(t(\"Lifecycle event requires a non-empty id\"));\n\t}\n\tif (!Number.isSafeInteger(definition.version) || definition.version < 1) {\n\t\tthrow new Error(t(\"Lifecycle event version must be a positive safe integer\"));\n\t}\n\tif (!lifecyclePhases.has(definition.phase)) {\n\t\tthrow new Error(t(\"Lifecycle event phase is invalid: {value}\", { value: String(definition.phase) }));\n\t}\n\tconst allowedPhases = definition.allowedPhases;\n\tif (\n\t\tallowedPhases !== undefined &&\n\t\t(!Array.isArray(allowedPhases) ||\n\t\t\tallowedPhases.length === 0 ||\n\t\t\tallowedPhases.some((phase) => !lifecyclePhases.has(phase)))\n\t) {\n\t\tthrow new Error(t(\"Lifecycle event allowedPhases must be a non-empty array of valid phases when provided\"));\n\t}\n\tif (allowedPhases && new Set(allowedPhases).size !== allowedPhases.length) {\n\t\tthrow new Error(t(\"Lifecycle event allowedPhases must not contain duplicates\"));\n\t}\n\tif (allowedPhases && !allowedPhases.includes(definition.phase)) {\n\t\tthrow new Error(t(\"Lifecycle event allowedPhases must include phase\"));\n\t}\n\tif (typeof definition.schema !== \"string\" || !definition.schema.trim()) {\n\t\tthrow new Error(t(\"Lifecycle event requires a non-empty schema\"));\n\t}\n\tif (typeof definition.validate !== \"function\") {\n\t\tthrow new Error(t(\"Lifecycle event requires a validate function\"));\n\t}\n\tconst allowedRegistrationKinds = definition.allowedRegistrationKinds;\n\tif (\n\t\tallowedRegistrationKinds !== undefined &&\n\t\t(!Array.isArray(allowedRegistrationKinds) || allowedRegistrationKinds.length === 0)\n\t) {\n\t\tthrow new Error(t(\"Lifecycle event allowedRegistrationKinds must be a non-empty array when provided\"));\n\t}\n\tif (allowedRegistrationKinds?.some((kind) => !lifecycleRegistrationKinds.has(kind))) {\n\t\tthrow new Error(t(\"Lifecycle event allowedRegistrationKinds contains an invalid registration kind\"));\n\t}\n\tif (allowedRegistrationKinds && new Set(allowedRegistrationKinds).size !== allowedRegistrationKinds.length) {\n\t\tthrow new Error(t(\"Lifecycle event allowedRegistrationKinds must not contain duplicates\"));\n\t}\n\treturn Object.freeze({\n\t\tid: definition.id,\n\t\tversion: definition.version,\n\t\tphase: definition.phase,\n\t\t...(allowedPhases === undefined ? {} : { allowedPhases: Object.freeze([...allowedPhases]) }),\n\t\tschema: definition.schema,\n\t\t...(allowedRegistrationKinds === undefined\n\t\t\t? {}\n\t\t\t: { allowedRegistrationKinds: Object.freeze([...allowedRegistrationKinds]) }),\n\t\tvalidate: definition.validate,\n\t});\n}\n\nexport function stableTextCompare(left: string, right: string): number {\n\treturn left < right ? -1 : left > right ? 1 : 0;\n}\n\nexport function validateCredentialRequest(request: CredentialResolveRequest): void {\n\tif (!request || typeof request.providerId !== \"string\" || !request.providerId.trim()) {\n\t\tthrow new Error(t(\"Credential resolution requires a non-empty providerId\"));\n\t}\n\tif (request.minValidityMs !== undefined && (!Number.isFinite(request.minValidityMs) || request.minValidityMs < 0)) {\n\t\tthrow new Error(t(\"Credential minValidityMs must be a non-negative finite number\"));\n\t}\n}\n\nconst INTERACTION_NOTIFY_LEVELS = new Set<InteractionNotifyLevel>([\"info\", \"warning\", \"error\"]);\n\nexport function validateInteractionNotifyRequest(request: { message: string; level?: InteractionNotifyLevel }): void {\n\tif (!request || typeof request !== \"object\" || typeof request.message !== \"string\" || !request.message.trim()) {\n\t\tthrow new Error(t(\"Interaction notify requires a non-empty message\"));\n\t}\n\tif (request.level !== undefined && !INTERACTION_NOTIFY_LEVELS.has(request.level)) {\n\t\tthrow new Error(t(\"Interaction notify level must be info, warning, or error\"));\n\t}\n}\n\nexport function validateInteractionRequest(request: InteractionRequestV1): void {\n\tif (!request || typeof request !== \"object\") {\n\t\tthrow new Error(t(\"Interaction request must be an object with a known kind\"));\n\t}\n\tswitch (request.kind) {\n\t\tcase \"notify\":\n\t\t\tvalidateInteractionNotifyRequest(request);\n\t\t\treturn;\n\t\tcase \"confirm\":\n\t\t\tassertNonEmptyString(request.title, \"Interaction confirm title\");\n\t\t\tassertNonEmptyString(request.message, \"Interaction confirm message\");\n\t\t\treturn;\n\t\tcase \"select\":\n\t\t\tassertNonEmptyString(request.title, \"Interaction select title\");\n\t\t\tif (!Array.isArray(request.options) || request.options.length === 0) {\n\t\t\t\tthrow new Error(t(\"Interaction select requires a non-empty options array\"));\n\t\t\t}\n\t\t\tif (request.options.some((option) => typeof option !== \"string\" || !option.trim())) {\n\t\t\t\tthrow new Error(t(\"Interaction select options must be non-empty strings\"));\n\t\t\t}\n\t\t\treturn;\n\t\tcase \"input\":\n\t\t\tassertNonEmptyString(request.title, \"Interaction input title\");\n\t\t\tif (request.placeholder !== undefined && typeof request.placeholder !== \"string\") {\n\t\t\t\tthrow new Error(t(\"Interaction input placeholder must be a string\"));\n\t\t\t}\n\t\t\tif (request.defaultValue !== undefined && typeof request.defaultValue !== \"string\") {\n\t\t\t\tthrow new Error(t(\"Interaction input defaultValue must be a string\"));\n\t\t\t}\n\t\t\treturn;\n\t\tdefault:\n\t\t\tthrow new Error(t(\"Interaction request requires a known kind: notify, confirm, select, or input\"));\n\t}\n}\n\nexport function validateInteractionTimeoutMs(timeoutMs: number | undefined): void {\n\tif (timeoutMs === undefined) return;\n\tif (!Number.isSafeInteger(timeoutMs) || timeoutMs <= 0) {\n\t\tthrow new Error(t(\"Interaction timeoutMs must be a positive integer\"));\n\t}\n}\n\nconst EXECUTION_FACT_KEYS = [\"version\", \"operationId\", \"sessionId\", \"inputRevision\", \"phase\"] as const;\nconst RETRY_SCHEDULE_KEYS = [...EXECUTION_FACT_KEYS, \"action\", \"attempt\", \"delayMs\"] as const;\nconst executionPhases = new Set<ExecutionPhaseV1>([\n\t\"agent\",\n\t\"compaction\",\n\t\"overflow\",\n\t\"retry\",\n\t\"branch_summary\",\n\t\"reload\",\n\t\"tree\",\n]);\n\nfunction assertPlainRecord(value: unknown, label: string): Record<string, unknown> {\n\tif (\n\t\t!value ||\n\t\ttypeof value !== \"object\" ||\n\t\tArray.isArray(value) ||\n\t\tObject.getPrototypeOf(value) !== Object.prototype\n\t) {\n\t\tthrow new Error(t(\"{label} must be a plain object\", { label }));\n\t}\n\treturn value as Record<string, unknown>;\n}\n\nfunction assertExactKeys(value: Record<string, unknown>, keys: readonly string[], label: string): void {\n\tconst allowed = new Set(keys);\n\tconst unexpected = Object.keys(value).filter((key) => !allowed.has(key));\n\tif (unexpected.length > 0) {\n\t\tthrow new Error(t(\"{label} has unsupported fields: {value}\", { label, value: unexpected.join(\", \") }));\n\t}\n\tconst missing = keys.filter((key) => !(key in value));\n\tif (missing.length > 0) {\n\t\tthrow new Error(t(\"{label} is missing required fields: {value}\", { label, value: missing.join(\", \") }));\n\t}\n}\n\nfunction assertNonEmptyString(value: unknown, label: string): asserts value is string {\n\tif (typeof value !== \"string\" || !value.trim()) throw new Error(t(\"{label} must be a non-empty string\", { label }));\n}\n\nfunction assertNonNegativeSafeInteger(value: unknown, label: string): asserts value is number {\n\tif (typeof value !== \"number\" || !Number.isSafeInteger(value) || value < 0) {\n\t\tthrow new Error(t(\"{label} must be a non-negative safe integer\", { label }));\n\t}\n}\n\nfunction assertNonNegativeFinite(value: unknown, label: string): asserts value is number {\n\tif (typeof value !== \"number\" || !Number.isFinite(value) || value < 0) {\n\t\tthrow new Error(t(\"{label} must be a non-negative finite number\", { label }));\n\t}\n}\n\nfunction validateSessionRevisionV1(value: unknown, label: string): SessionRevisionV1 {\n\tconst revision = assertPlainRecord(value, label);\n\tassertExactKeys(revision, [\"version\", \"sessionId\", \"sequence\", \"leafId\"], label);\n\tif (revision.version !== 1) throw new Error(t(\"{label}.version must be 1\", { label }));\n\tassertNonEmptyString(revision.sessionId, `${label}.sessionId`);\n\tassertNonNegativeSafeInteger(revision.sequence, `${label}.sequence`);\n\tif (typeof revision.leafId !== \"string\" && revision.leafId !== null) {\n\t\tthrow new Error(t(\"{label}.leafId must be a string or null\", { label }));\n\t}\n\tif (typeof revision.leafId === \"string\" && !revision.leafId.trim()) {\n\t\tthrow new Error(t(\"{label}.leafId must be a non-empty string or null\", { label }));\n\t}\n\treturn Object.freeze({\n\t\tversion: 1,\n\t\tsessionId: revision.sessionId,\n\t\tsequence: revision.sequence,\n\t\tleafId: revision.leafId,\n\t});\n}\n\n/**\n * Strictly validates host-supplied execution facts and returns an immutable,\n * detached V1 value. It performs no state lookup and grants no commit right.\n */\nexport function validateExecutionFactsV1(value: unknown): ExecutionFactsV1 {\n\tconst facts = assertPlainRecord(value, \"Execution facts\");\n\tassertExactKeys(facts, EXECUTION_FACT_KEYS, \"Execution facts\");\n\tif (facts.version !== 1) throw new Error(t(\"Execution facts.version must be 1\"));\n\tassertNonEmptyString(facts.operationId, \"Execution facts.operationId\");\n\tassertNonEmptyString(facts.sessionId, \"Execution facts.sessionId\");\n\tif (typeof facts.phase !== \"string\" || !executionPhases.has(facts.phase as ExecutionPhaseV1)) {\n\t\tthrow new Error(t(\"Execution facts.phase is invalid\"));\n\t}\n\tconst inputRevision = validateSessionRevisionV1(facts.inputRevision, \"Execution facts.inputRevision\");\n\tif (inputRevision.sessionId !== facts.sessionId) {\n\t\tthrow new Error(t(\"Execution facts.inputRevision.sessionId must match Execution facts.sessionId\"));\n\t}\n\treturn Object.freeze({\n\t\tversion: 1,\n\t\toperationId: facts.operationId,\n\t\tsessionId: facts.sessionId,\n\t\tinputRevision,\n\t\tphase: facts.phase as ExecutionPhaseV1,\n\t});\n}\n\n/**\n * Strictly validates a retry decision bound to one execution boundary. A\n * scheduled retry is one-based; a stop outcome cannot request a delay.\n */\nexport function validateRetryScheduleV1(value: unknown): RetryScheduleV1 {\n\tconst schedule = assertPlainRecord(value, \"Retry schedule\");\n\tassertExactKeys(schedule, RETRY_SCHEDULE_KEYS, \"Retry schedule\");\n\tconst facts = validateExecutionFactsV1({\n\t\tversion: schedule.version,\n\t\toperationId: schedule.operationId,\n\t\tsessionId: schedule.sessionId,\n\t\tinputRevision: schedule.inputRevision,\n\t\tphase: schedule.phase,\n\t});\n\tif (schedule.action !== \"retry\" && schedule.action !== \"stop\") {\n\t\tthrow new Error(t(\"Retry schedule.action must be retry or stop\"));\n\t}\n\tassertNonNegativeSafeInteger(schedule.attempt, \"Retry schedule.attempt\");\n\tassertNonNegativeFinite(schedule.delayMs, \"Retry schedule.delayMs\");\n\tif (schedule.action === \"retry\" && schedule.attempt === 0) {\n\t\tthrow new Error(t(\"Retry schedule.retry requires a one-based attempt\"));\n\t}\n\tif (schedule.action === \"stop\" && schedule.delayMs !== 0) {\n\t\tthrow new Error(t(\"Retry schedule.stop must have delayMs 0\"));\n\t}\n\treturn Object.freeze({ ...facts, action: schedule.action, attempt: schedule.attempt, delayMs: schedule.delayMs });\n}\n\nexport function assertHost(host: unknown): asserts host is HostCapabilities {\n\tif (!host || typeof host !== \"object\" || Array.isArray(host)) {\n\t\tthrow new Error(t(\"Host capabilities must be an object\"));\n\t}\n\tconst candidate = host as Partial<HostCapabilities>;\n\tif (candidate.apiVersion !== EXPERIMENTAL_PUBLIC_API_VERSION) {\n\t\tthrow new Error(\n\t\t\tt(\"Unsupported host API version: {apiVersion}\", { apiVersion: candidate.apiVersion ?? \"unknown\" }),\n\t\t);\n\t}\n\tif (candidate.mode !== \"readonly\" && candidate.mode !== \"full-control\") {\n\t\tthrow new Error(t(\"Host mode must be readonly or full-control\"));\n\t}\n\tif (\n\t\t!Array.isArray(candidate.features) ||\n\t\tcandidate.features.some((feature) => typeof feature !== \"string\" || !feature.trim())\n\t) {\n\t\tthrow new Error(t(\"Host features must be an array of non-empty strings\"));\n\t}\n\tif (\n\t\t!Array.isArray(candidate.transports) ||\n\t\tcandidate.transports.some(\n\t\t\t(transport) =>\n\t\t\t\ttransport !== \"in-process\" && transport !== \"stdio\" && transport !== \"http\" && transport !== \"rpc\",\n\t\t)\n\t) {\n\t\tthrow new Error(t(\"Host transports must be an array of supported transports\"));\n\t}\n}\n\n/** Read the owning plugin's readonly-mode declaration off a tool definition (宪法 §6). */\nexport function toolReadonlySafe(definition: unknown): boolean {\n\treturn (definition as { readonlySafe?: unknown } | undefined)?.readonlySafe === true;\n}\n\nexport function capabilityName(value: unknown, kind: string): string {\n\tif (!value || typeof value !== \"object\" || !(\"name\" in value) || typeof value.name !== \"string\" || !value.name) {\n\t\tthrow new Error(t(\"{kind} definition requires a non-empty name\", { kind }));\n\t}\n\treturn value.name;\n}\n\nexport function validateCommandDefinition(definition: CapabilityCommandDefinition): CapabilityCommandDefinition {\n\tif (!definition || typeof definition !== \"object\") {\n\t\tthrow new Error(t(\"Command requires a definition\"));\n\t}\n\tconst { name, description, argumentHint, execute } = definition;\n\tif (typeof name !== \"string\" || !name || name.startsWith(\"/\") || /\\s/.test(name)) {\n\t\tthrow new Error(t(\"Command definition requires a non-empty name without slash or whitespace\"));\n\t}\n\tif (typeof description !== \"string\" || !description.trim()) {\n\t\tthrow new Error(t(\"Command definition requires a non-empty description\"));\n\t}\n\tif (argumentHint !== undefined && typeof argumentHint !== \"string\") {\n\t\tthrow new Error(t(\"Command definition argumentHint must be a string\"));\n\t}\n\tif (typeof execute !== \"function\") {\n\t\tthrow new Error(t(\"Command definition requires an execute function\"));\n\t}\n\treturn definition;\n}\n\nexport function validateCommandResult(value: unknown, commandName: string): CapabilityCommandResult | undefined {\n\tif (value === undefined) return undefined;\n\tif (!value || typeof value !== \"object\" || Array.isArray(value)) {\n\t\tthrow new Error(t(\"Capability command returned an invalid result: {commandName}\", { commandName }));\n\t}\n\tconst result = value as Partial<CapabilityCommandResult>;\n\tif (result.status !== \"success\" && result.status !== \"error\") {\n\t\tthrow new Error(t(\"Capability command returned an invalid status: {commandName}\", { commandName }));\n\t}\n\tif (typeof result.message !== \"string\") {\n\t\tthrow new Error(t(\"Capability command returned an invalid message: {commandName}\", { commandName }));\n\t}\n\tif (\n\t\tresult.links !== undefined &&\n\t\t(!Array.isArray(result.links) ||\n\t\t\tresult.links.some(\n\t\t\t\t(link) =>\n\t\t\t\t\t!link ||\n\t\t\t\t\ttypeof link !== \"object\" ||\n\t\t\t\t\ttypeof (link as { label?: unknown }).label !== \"string\" ||\n\t\t\t\t\ttypeof (link as { url?: unknown }).url !== \"string\",\n\t\t\t))\n\t) {\n\t\tthrow new Error(t(\"Capability command returned invalid links: {commandName}\", { commandName }));\n\t}\n\tif (result.data !== undefined && !isPluginConfigValue(result.data)) {\n\t\tthrow new Error(t(\"Capability command returned non-serializable data: {commandName}\", { commandName }));\n\t}\n\treturn value as CapabilityCommandResult;\n}\n\nexport function asHandler(value: unknown, kind: string): (...args: unknown[]) => unknown | Promise<unknown> {\n\tif (typeof value === \"function\") return value as (...args: unknown[]) => unknown | Promise<unknown>;\n\tif (value && typeof value === \"object\") {\n\t\tconst handlers = value as Record<string, unknown>;\n\t\tfor (const key of [\"execute\", \"run\", \"handler\"] as const) {\n\t\t\tconst candidate = handlers[key];\n\t\t\tif (typeof candidate === \"function\") return candidate as (...args: unknown[]) => unknown | Promise<unknown>;\n\t\t}\n\t}\n\tthrow new Error(t(\"{kind} requires a callable handler\", { kind }));\n}\n\nexport function assertAgentTaskRequest(request: AgentTaskCreateRequest): void {\n\tif (!request || typeof request.prompt !== \"string\" || !request.prompt.trim()) {\n\t\tthrow new Error(t(\"Agent task requires a non-empty prompt\"));\n\t}\n\tif (request.metadata !== undefined && (typeof request.metadata !== \"object\" || Array.isArray(request.metadata))) {\n\t\tthrow new Error(t(\"Agent task metadata must be an object\"));\n\t}\n}\n\nexport function validateProviderHeaders(headers: unknown, source: string): Record<string, string | null> {\n\tif (!headers || typeof headers !== \"object\" || Array.isArray(headers)) {\n\t\tthrow new Error(t(\"Provider header transform returned invalid headers: {source}\", { source }));\n\t}\n\tconst validated: Record<string, string | null> = {};\n\tfor (const [name, value] of Object.entries(headers)) {\n\t\tif (!name || (typeof value !== \"string\" && value !== null)) {\n\t\t\tthrow new Error(t(\"Provider header transform returned invalid headers: {source}\", { source }));\n\t\t}\n\t\tvalidated[name] = value;\n\t}\n\treturn validated;\n}\n"]}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { t } from "../i18n/index.js";
|
|
1
2
|
import { isPluginConfigValue } from "./capability-runtime-manifest.js";
|
|
2
3
|
import { EXPERIMENTAL_PUBLIC_API_VERSION } from "./public-api.js";
|
|
3
4
|
const contributionLifecycles = new Set(["observe", "transform", "execute", "after-commit"]);
|
|
@@ -10,22 +11,22 @@ export const lifecycleRegistrationKinds = new Set([
|
|
|
10
11
|
]);
|
|
11
12
|
export function validateContributionPointDefinition(definition) {
|
|
12
13
|
if (!definition || typeof definition !== "object") {
|
|
13
|
-
throw new Error("Contribution point definition is required");
|
|
14
|
+
throw new Error(t("Contribution point definition is required"));
|
|
14
15
|
}
|
|
15
16
|
if (typeof definition.id !== "string" || !definition.id.trim()) {
|
|
16
|
-
throw new Error("Contribution point requires a non-empty id");
|
|
17
|
+
throw new Error(t("Contribution point requires a non-empty id"));
|
|
17
18
|
}
|
|
18
19
|
if (!Number.isSafeInteger(definition.version) || definition.version < 1) {
|
|
19
|
-
throw new Error("Contribution point version must be a positive safe integer");
|
|
20
|
+
throw new Error(t("Contribution point version must be a positive safe integer"));
|
|
20
21
|
}
|
|
21
22
|
if (typeof definition.schema !== "string" || !definition.schema.trim()) {
|
|
22
|
-
throw new Error("Contribution point requires a non-empty schema");
|
|
23
|
+
throw new Error(t("Contribution point requires a non-empty schema"));
|
|
23
24
|
}
|
|
24
25
|
if (definition.lifecycle !== undefined && !contributionLifecycles.has(definition.lifecycle)) {
|
|
25
|
-
throw new Error(
|
|
26
|
+
throw new Error(t("Contribution point lifecycle is invalid: {value}", { value: String(definition.lifecycle) }));
|
|
26
27
|
}
|
|
27
28
|
if (typeof definition.validate !== "function") {
|
|
28
|
-
throw new Error("Contribution point requires a validate function");
|
|
29
|
+
throw new Error(t("Contribution point requires a validate function"));
|
|
29
30
|
}
|
|
30
31
|
return definition;
|
|
31
32
|
}
|
|
@@ -37,45 +38,45 @@ export function lifecycleEventKey(id, version) {
|
|
|
37
38
|
}
|
|
38
39
|
export function validateLifecycleEventDefinition(definition) {
|
|
39
40
|
if (!definition || typeof definition !== "object")
|
|
40
|
-
throw new Error("Lifecycle event definition is required");
|
|
41
|
+
throw new Error(t("Lifecycle event definition is required"));
|
|
41
42
|
if (typeof definition.id !== "string" || !definition.id.trim()) {
|
|
42
|
-
throw new Error("Lifecycle event requires a non-empty id");
|
|
43
|
+
throw new Error(t("Lifecycle event requires a non-empty id"));
|
|
43
44
|
}
|
|
44
45
|
if (!Number.isSafeInteger(definition.version) || definition.version < 1) {
|
|
45
|
-
throw new Error("Lifecycle event version must be a positive safe integer");
|
|
46
|
+
throw new Error(t("Lifecycle event version must be a positive safe integer"));
|
|
46
47
|
}
|
|
47
48
|
if (!lifecyclePhases.has(definition.phase)) {
|
|
48
|
-
throw new Error(
|
|
49
|
+
throw new Error(t("Lifecycle event phase is invalid: {value}", { value: String(definition.phase) }));
|
|
49
50
|
}
|
|
50
51
|
const allowedPhases = definition.allowedPhases;
|
|
51
52
|
if (allowedPhases !== undefined &&
|
|
52
53
|
(!Array.isArray(allowedPhases) ||
|
|
53
54
|
allowedPhases.length === 0 ||
|
|
54
55
|
allowedPhases.some((phase) => !lifecyclePhases.has(phase)))) {
|
|
55
|
-
throw new Error("Lifecycle event allowedPhases must be a non-empty array of valid phases when provided");
|
|
56
|
+
throw new Error(t("Lifecycle event allowedPhases must be a non-empty array of valid phases when provided"));
|
|
56
57
|
}
|
|
57
58
|
if (allowedPhases && new Set(allowedPhases).size !== allowedPhases.length) {
|
|
58
|
-
throw new Error("Lifecycle event allowedPhases must not contain duplicates");
|
|
59
|
+
throw new Error(t("Lifecycle event allowedPhases must not contain duplicates"));
|
|
59
60
|
}
|
|
60
61
|
if (allowedPhases && !allowedPhases.includes(definition.phase)) {
|
|
61
|
-
throw new Error("Lifecycle event allowedPhases must include phase");
|
|
62
|
+
throw new Error(t("Lifecycle event allowedPhases must include phase"));
|
|
62
63
|
}
|
|
63
64
|
if (typeof definition.schema !== "string" || !definition.schema.trim()) {
|
|
64
|
-
throw new Error("Lifecycle event requires a non-empty schema");
|
|
65
|
+
throw new Error(t("Lifecycle event requires a non-empty schema"));
|
|
65
66
|
}
|
|
66
67
|
if (typeof definition.validate !== "function") {
|
|
67
|
-
throw new Error("Lifecycle event requires a validate function");
|
|
68
|
+
throw new Error(t("Lifecycle event requires a validate function"));
|
|
68
69
|
}
|
|
69
70
|
const allowedRegistrationKinds = definition.allowedRegistrationKinds;
|
|
70
71
|
if (allowedRegistrationKinds !== undefined &&
|
|
71
72
|
(!Array.isArray(allowedRegistrationKinds) || allowedRegistrationKinds.length === 0)) {
|
|
72
|
-
throw new Error("Lifecycle event allowedRegistrationKinds must be a non-empty array when provided");
|
|
73
|
+
throw new Error(t("Lifecycle event allowedRegistrationKinds must be a non-empty array when provided"));
|
|
73
74
|
}
|
|
74
75
|
if (allowedRegistrationKinds?.some((kind) => !lifecycleRegistrationKinds.has(kind))) {
|
|
75
|
-
throw new Error("Lifecycle event allowedRegistrationKinds contains an invalid registration kind");
|
|
76
|
+
throw new Error(t("Lifecycle event allowedRegistrationKinds contains an invalid registration kind"));
|
|
76
77
|
}
|
|
77
78
|
if (allowedRegistrationKinds && new Set(allowedRegistrationKinds).size !== allowedRegistrationKinds.length) {
|
|
78
|
-
throw new Error("Lifecycle event allowedRegistrationKinds must not contain duplicates");
|
|
79
|
+
throw new Error(t("Lifecycle event allowedRegistrationKinds must not contain duplicates"));
|
|
79
80
|
}
|
|
80
81
|
return Object.freeze({
|
|
81
82
|
id: definition.id,
|
|
@@ -94,24 +95,24 @@ export function stableTextCompare(left, right) {
|
|
|
94
95
|
}
|
|
95
96
|
export function validateCredentialRequest(request) {
|
|
96
97
|
if (!request || typeof request.providerId !== "string" || !request.providerId.trim()) {
|
|
97
|
-
throw new Error("Credential resolution requires a non-empty providerId");
|
|
98
|
+
throw new Error(t("Credential resolution requires a non-empty providerId"));
|
|
98
99
|
}
|
|
99
100
|
if (request.minValidityMs !== undefined && (!Number.isFinite(request.minValidityMs) || request.minValidityMs < 0)) {
|
|
100
|
-
throw new Error("Credential minValidityMs must be a non-negative finite number");
|
|
101
|
+
throw new Error(t("Credential minValidityMs must be a non-negative finite number"));
|
|
101
102
|
}
|
|
102
103
|
}
|
|
103
104
|
const INTERACTION_NOTIFY_LEVELS = new Set(["info", "warning", "error"]);
|
|
104
105
|
export function validateInteractionNotifyRequest(request) {
|
|
105
106
|
if (!request || typeof request !== "object" || typeof request.message !== "string" || !request.message.trim()) {
|
|
106
|
-
throw new Error("Interaction notify requires a non-empty message");
|
|
107
|
+
throw new Error(t("Interaction notify requires a non-empty message"));
|
|
107
108
|
}
|
|
108
109
|
if (request.level !== undefined && !INTERACTION_NOTIFY_LEVELS.has(request.level)) {
|
|
109
|
-
throw new Error("Interaction notify level must be info, warning, or error");
|
|
110
|
+
throw new Error(t("Interaction notify level must be info, warning, or error"));
|
|
110
111
|
}
|
|
111
112
|
}
|
|
112
113
|
export function validateInteractionRequest(request) {
|
|
113
114
|
if (!request || typeof request !== "object") {
|
|
114
|
-
throw new Error("Interaction request must be an object with a known kind");
|
|
115
|
+
throw new Error(t("Interaction request must be an object with a known kind"));
|
|
115
116
|
}
|
|
116
117
|
switch (request.kind) {
|
|
117
118
|
case "notify":
|
|
@@ -124,30 +125,30 @@ export function validateInteractionRequest(request) {
|
|
|
124
125
|
case "select":
|
|
125
126
|
assertNonEmptyString(request.title, "Interaction select title");
|
|
126
127
|
if (!Array.isArray(request.options) || request.options.length === 0) {
|
|
127
|
-
throw new Error("Interaction select requires a non-empty options array");
|
|
128
|
+
throw new Error(t("Interaction select requires a non-empty options array"));
|
|
128
129
|
}
|
|
129
130
|
if (request.options.some((option) => typeof option !== "string" || !option.trim())) {
|
|
130
|
-
throw new Error("Interaction select options must be non-empty strings");
|
|
131
|
+
throw new Error(t("Interaction select options must be non-empty strings"));
|
|
131
132
|
}
|
|
132
133
|
return;
|
|
133
134
|
case "input":
|
|
134
135
|
assertNonEmptyString(request.title, "Interaction input title");
|
|
135
136
|
if (request.placeholder !== undefined && typeof request.placeholder !== "string") {
|
|
136
|
-
throw new Error("Interaction input placeholder must be a string");
|
|
137
|
+
throw new Error(t("Interaction input placeholder must be a string"));
|
|
137
138
|
}
|
|
138
139
|
if (request.defaultValue !== undefined && typeof request.defaultValue !== "string") {
|
|
139
|
-
throw new Error("Interaction input defaultValue must be a string");
|
|
140
|
+
throw new Error(t("Interaction input defaultValue must be a string"));
|
|
140
141
|
}
|
|
141
142
|
return;
|
|
142
143
|
default:
|
|
143
|
-
throw new Error("Interaction request requires a known kind: notify, confirm, select, or input");
|
|
144
|
+
throw new Error(t("Interaction request requires a known kind: notify, confirm, select, or input"));
|
|
144
145
|
}
|
|
145
146
|
}
|
|
146
147
|
export function validateInteractionTimeoutMs(timeoutMs) {
|
|
147
148
|
if (timeoutMs === undefined)
|
|
148
149
|
return;
|
|
149
150
|
if (!Number.isSafeInteger(timeoutMs) || timeoutMs <= 0) {
|
|
150
|
-
throw new Error("Interaction timeoutMs must be a positive integer");
|
|
151
|
+
throw new Error(t("Interaction timeoutMs must be a positive integer"));
|
|
151
152
|
}
|
|
152
153
|
}
|
|
153
154
|
const EXECUTION_FACT_KEYS = ["version", "operationId", "sessionId", "inputRevision", "phase"];
|
|
@@ -166,7 +167,7 @@ function assertPlainRecord(value, label) {
|
|
|
166
167
|
typeof value !== "object" ||
|
|
167
168
|
Array.isArray(value) ||
|
|
168
169
|
Object.getPrototypeOf(value) !== Object.prototype) {
|
|
169
|
-
throw new Error(
|
|
170
|
+
throw new Error(t("{label} must be a plain object", { label }));
|
|
170
171
|
}
|
|
171
172
|
return value;
|
|
172
173
|
}
|
|
@@ -174,39 +175,39 @@ function assertExactKeys(value, keys, label) {
|
|
|
174
175
|
const allowed = new Set(keys);
|
|
175
176
|
const unexpected = Object.keys(value).filter((key) => !allowed.has(key));
|
|
176
177
|
if (unexpected.length > 0) {
|
|
177
|
-
throw new Error(
|
|
178
|
+
throw new Error(t("{label} has unsupported fields: {value}", { label, value: unexpected.join(", ") }));
|
|
178
179
|
}
|
|
179
180
|
const missing = keys.filter((key) => !(key in value));
|
|
180
181
|
if (missing.length > 0) {
|
|
181
|
-
throw new Error(
|
|
182
|
+
throw new Error(t("{label} is missing required fields: {value}", { label, value: missing.join(", ") }));
|
|
182
183
|
}
|
|
183
184
|
}
|
|
184
185
|
function assertNonEmptyString(value, label) {
|
|
185
186
|
if (typeof value !== "string" || !value.trim())
|
|
186
|
-
throw new Error(
|
|
187
|
+
throw new Error(t("{label} must be a non-empty string", { label }));
|
|
187
188
|
}
|
|
188
189
|
function assertNonNegativeSafeInteger(value, label) {
|
|
189
190
|
if (typeof value !== "number" || !Number.isSafeInteger(value) || value < 0) {
|
|
190
|
-
throw new Error(
|
|
191
|
+
throw new Error(t("{label} must be a non-negative safe integer", { label }));
|
|
191
192
|
}
|
|
192
193
|
}
|
|
193
194
|
function assertNonNegativeFinite(value, label) {
|
|
194
195
|
if (typeof value !== "number" || !Number.isFinite(value) || value < 0) {
|
|
195
|
-
throw new Error(
|
|
196
|
+
throw new Error(t("{label} must be a non-negative finite number", { label }));
|
|
196
197
|
}
|
|
197
198
|
}
|
|
198
199
|
function validateSessionRevisionV1(value, label) {
|
|
199
200
|
const revision = assertPlainRecord(value, label);
|
|
200
201
|
assertExactKeys(revision, ["version", "sessionId", "sequence", "leafId"], label);
|
|
201
202
|
if (revision.version !== 1)
|
|
202
|
-
throw new Error(
|
|
203
|
+
throw new Error(t("{label}.version must be 1", { label }));
|
|
203
204
|
assertNonEmptyString(revision.sessionId, `${label}.sessionId`);
|
|
204
205
|
assertNonNegativeSafeInteger(revision.sequence, `${label}.sequence`);
|
|
205
206
|
if (typeof revision.leafId !== "string" && revision.leafId !== null) {
|
|
206
|
-
throw new Error(
|
|
207
|
+
throw new Error(t("{label}.leafId must be a string or null", { label }));
|
|
207
208
|
}
|
|
208
209
|
if (typeof revision.leafId === "string" && !revision.leafId.trim()) {
|
|
209
|
-
throw new Error(
|
|
210
|
+
throw new Error(t("{label}.leafId must be a non-empty string or null", { label }));
|
|
210
211
|
}
|
|
211
212
|
return Object.freeze({
|
|
212
213
|
version: 1,
|
|
@@ -223,15 +224,15 @@ export function validateExecutionFactsV1(value) {
|
|
|
223
224
|
const facts = assertPlainRecord(value, "Execution facts");
|
|
224
225
|
assertExactKeys(facts, EXECUTION_FACT_KEYS, "Execution facts");
|
|
225
226
|
if (facts.version !== 1)
|
|
226
|
-
throw new Error("Execution facts.version must be 1");
|
|
227
|
+
throw new Error(t("Execution facts.version must be 1"));
|
|
227
228
|
assertNonEmptyString(facts.operationId, "Execution facts.operationId");
|
|
228
229
|
assertNonEmptyString(facts.sessionId, "Execution facts.sessionId");
|
|
229
230
|
if (typeof facts.phase !== "string" || !executionPhases.has(facts.phase)) {
|
|
230
|
-
throw new Error("Execution facts.phase is invalid");
|
|
231
|
+
throw new Error(t("Execution facts.phase is invalid"));
|
|
231
232
|
}
|
|
232
233
|
const inputRevision = validateSessionRevisionV1(facts.inputRevision, "Execution facts.inputRevision");
|
|
233
234
|
if (inputRevision.sessionId !== facts.sessionId) {
|
|
234
|
-
throw new Error("Execution facts.inputRevision.sessionId must match Execution facts.sessionId");
|
|
235
|
+
throw new Error(t("Execution facts.inputRevision.sessionId must match Execution facts.sessionId"));
|
|
235
236
|
}
|
|
236
237
|
return Object.freeze({
|
|
237
238
|
version: 1,
|
|
@@ -256,36 +257,36 @@ export function validateRetryScheduleV1(value) {
|
|
|
256
257
|
phase: schedule.phase,
|
|
257
258
|
});
|
|
258
259
|
if (schedule.action !== "retry" && schedule.action !== "stop") {
|
|
259
|
-
throw new Error("Retry schedule.action must be retry or stop");
|
|
260
|
+
throw new Error(t("Retry schedule.action must be retry or stop"));
|
|
260
261
|
}
|
|
261
262
|
assertNonNegativeSafeInteger(schedule.attempt, "Retry schedule.attempt");
|
|
262
263
|
assertNonNegativeFinite(schedule.delayMs, "Retry schedule.delayMs");
|
|
263
264
|
if (schedule.action === "retry" && schedule.attempt === 0) {
|
|
264
|
-
throw new Error("Retry schedule.retry requires a one-based attempt");
|
|
265
|
+
throw new Error(t("Retry schedule.retry requires a one-based attempt"));
|
|
265
266
|
}
|
|
266
267
|
if (schedule.action === "stop" && schedule.delayMs !== 0) {
|
|
267
|
-
throw new Error("Retry schedule.stop must have delayMs 0");
|
|
268
|
+
throw new Error(t("Retry schedule.stop must have delayMs 0"));
|
|
268
269
|
}
|
|
269
270
|
return Object.freeze({ ...facts, action: schedule.action, attempt: schedule.attempt, delayMs: schedule.delayMs });
|
|
270
271
|
}
|
|
271
272
|
export function assertHost(host) {
|
|
272
273
|
if (!host || typeof host !== "object" || Array.isArray(host)) {
|
|
273
|
-
throw new Error("Host capabilities must be an object");
|
|
274
|
+
throw new Error(t("Host capabilities must be an object"));
|
|
274
275
|
}
|
|
275
276
|
const candidate = host;
|
|
276
277
|
if (candidate.apiVersion !== EXPERIMENTAL_PUBLIC_API_VERSION) {
|
|
277
|
-
throw new Error(
|
|
278
|
+
throw new Error(t("Unsupported host API version: {apiVersion}", { apiVersion: candidate.apiVersion ?? "unknown" }));
|
|
278
279
|
}
|
|
279
280
|
if (candidate.mode !== "readonly" && candidate.mode !== "full-control") {
|
|
280
|
-
throw new Error("Host mode must be readonly or full-control");
|
|
281
|
+
throw new Error(t("Host mode must be readonly or full-control"));
|
|
281
282
|
}
|
|
282
283
|
if (!Array.isArray(candidate.features) ||
|
|
283
284
|
candidate.features.some((feature) => typeof feature !== "string" || !feature.trim())) {
|
|
284
|
-
throw new Error("Host features must be an array of non-empty strings");
|
|
285
|
+
throw new Error(t("Host features must be an array of non-empty strings"));
|
|
285
286
|
}
|
|
286
287
|
if (!Array.isArray(candidate.transports) ||
|
|
287
288
|
candidate.transports.some((transport) => transport !== "in-process" && transport !== "stdio" && transport !== "http" && transport !== "rpc")) {
|
|
288
|
-
throw new Error("Host transports must be an array of supported transports");
|
|
289
|
+
throw new Error(t("Host transports must be an array of supported transports"));
|
|
289
290
|
}
|
|
290
291
|
}
|
|
291
292
|
/** Read the owning plugin's readonly-mode declaration off a tool definition (宪法 §6). */
|
|
@@ -294,26 +295,26 @@ export function toolReadonlySafe(definition) {
|
|
|
294
295
|
}
|
|
295
296
|
export function capabilityName(value, kind) {
|
|
296
297
|
if (!value || typeof value !== "object" || !("name" in value) || typeof value.name !== "string" || !value.name) {
|
|
297
|
-
throw new Error(
|
|
298
|
+
throw new Error(t("{kind} definition requires a non-empty name", { kind }));
|
|
298
299
|
}
|
|
299
300
|
return value.name;
|
|
300
301
|
}
|
|
301
302
|
export function validateCommandDefinition(definition) {
|
|
302
303
|
if (!definition || typeof definition !== "object") {
|
|
303
|
-
throw new Error("Command requires a definition");
|
|
304
|
+
throw new Error(t("Command requires a definition"));
|
|
304
305
|
}
|
|
305
306
|
const { name, description, argumentHint, execute } = definition;
|
|
306
307
|
if (typeof name !== "string" || !name || name.startsWith("/") || /\s/.test(name)) {
|
|
307
|
-
throw new Error("Command definition requires a non-empty name without slash or whitespace");
|
|
308
|
+
throw new Error(t("Command definition requires a non-empty name without slash or whitespace"));
|
|
308
309
|
}
|
|
309
310
|
if (typeof description !== "string" || !description.trim()) {
|
|
310
|
-
throw new Error("Command definition requires a non-empty description");
|
|
311
|
+
throw new Error(t("Command definition requires a non-empty description"));
|
|
311
312
|
}
|
|
312
313
|
if (argumentHint !== undefined && typeof argumentHint !== "string") {
|
|
313
|
-
throw new Error("Command definition argumentHint must be a string");
|
|
314
|
+
throw new Error(t("Command definition argumentHint must be a string"));
|
|
314
315
|
}
|
|
315
316
|
if (typeof execute !== "function") {
|
|
316
|
-
throw new Error("Command definition requires an execute function");
|
|
317
|
+
throw new Error(t("Command definition requires an execute function"));
|
|
317
318
|
}
|
|
318
319
|
return definition;
|
|
319
320
|
}
|
|
@@ -321,14 +322,14 @@ export function validateCommandResult(value, commandName) {
|
|
|
321
322
|
if (value === undefined)
|
|
322
323
|
return undefined;
|
|
323
324
|
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
324
|
-
throw new Error(
|
|
325
|
+
throw new Error(t("Capability command returned an invalid result: {commandName}", { commandName }));
|
|
325
326
|
}
|
|
326
327
|
const result = value;
|
|
327
328
|
if (result.status !== "success" && result.status !== "error") {
|
|
328
|
-
throw new Error(
|
|
329
|
+
throw new Error(t("Capability command returned an invalid status: {commandName}", { commandName }));
|
|
329
330
|
}
|
|
330
331
|
if (typeof result.message !== "string") {
|
|
331
|
-
throw new Error(
|
|
332
|
+
throw new Error(t("Capability command returned an invalid message: {commandName}", { commandName }));
|
|
332
333
|
}
|
|
333
334
|
if (result.links !== undefined &&
|
|
334
335
|
(!Array.isArray(result.links) ||
|
|
@@ -336,10 +337,10 @@ export function validateCommandResult(value, commandName) {
|
|
|
336
337
|
typeof link !== "object" ||
|
|
337
338
|
typeof link.label !== "string" ||
|
|
338
339
|
typeof link.url !== "string"))) {
|
|
339
|
-
throw new Error(
|
|
340
|
+
throw new Error(t("Capability command returned invalid links: {commandName}", { commandName }));
|
|
340
341
|
}
|
|
341
342
|
if (result.data !== undefined && !isPluginConfigValue(result.data)) {
|
|
342
|
-
throw new Error(
|
|
343
|
+
throw new Error(t("Capability command returned non-serializable data: {commandName}", { commandName }));
|
|
343
344
|
}
|
|
344
345
|
return value;
|
|
345
346
|
}
|
|
@@ -354,24 +355,24 @@ export function asHandler(value, kind) {
|
|
|
354
355
|
return candidate;
|
|
355
356
|
}
|
|
356
357
|
}
|
|
357
|
-
throw new Error(
|
|
358
|
+
throw new Error(t("{kind} requires a callable handler", { kind }));
|
|
358
359
|
}
|
|
359
360
|
export function assertAgentTaskRequest(request) {
|
|
360
361
|
if (!request || typeof request.prompt !== "string" || !request.prompt.trim()) {
|
|
361
|
-
throw new Error("Agent task requires a non-empty prompt");
|
|
362
|
+
throw new Error(t("Agent task requires a non-empty prompt"));
|
|
362
363
|
}
|
|
363
364
|
if (request.metadata !== undefined && (typeof request.metadata !== "object" || Array.isArray(request.metadata))) {
|
|
364
|
-
throw new Error("Agent task metadata must be an object");
|
|
365
|
+
throw new Error(t("Agent task metadata must be an object"));
|
|
365
366
|
}
|
|
366
367
|
}
|
|
367
368
|
export function validateProviderHeaders(headers, source) {
|
|
368
369
|
if (!headers || typeof headers !== "object" || Array.isArray(headers)) {
|
|
369
|
-
throw new Error(
|
|
370
|
+
throw new Error(t("Provider header transform returned invalid headers: {source}", { source }));
|
|
370
371
|
}
|
|
371
372
|
const validated = {};
|
|
372
373
|
for (const [name, value] of Object.entries(headers)) {
|
|
373
374
|
if (!name || (typeof value !== "string" && value !== null)) {
|
|
374
|
-
throw new Error(
|
|
375
|
+
throw new Error(t("Provider header transform returned invalid headers: {source}", { source }));
|
|
375
376
|
}
|
|
376
377
|
validated[name] = value;
|
|
377
378
|
}
|