@ai-agent-forge/agent-forge 0.86.7 → 0.88.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 +45 -0
- package/README.md +10 -11
- 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 +430 -413
- package/dist/bundle/chunks/{chunk-A7GUOX2H.js → chunk-6ZKDNZHA.js} +5 -1
- package/dist/bundle/chunks/chunk-HLJEVRWP.js +13 -0
- package/dist/bundle/chunks/chunk-YGHQME4V.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 +17 -4
- 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 +5 -3
- 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 +6 -10
- package/dist/core/agent-session-compaction.d.ts.map +1 -1
- package/dist/core/agent-session-compaction.js +35 -133
- 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-internal.d.ts +0 -6
- package/dist/core/agent-session-internal.d.ts.map +1 -1
- package/dist/core/agent-session-internal.js.map +1 -1
- package/dist/core/agent-session-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 -3
- 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 -22
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +147 -67
- 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-compaction-policy.d.ts.map +1 -1
- package/dist/core/extensions/bootstrap-compaction-policy.js +0 -34
- package/dist/core/extensions/bootstrap-compaction-policy.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 +4 -3
- 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/extensions/provider-failover.d.ts +7 -3
- package/dist/core/extensions/provider-failover.d.ts.map +1 -1
- package/dist/core/extensions/provider-failover.js +9 -8
- package/dist/core/extensions/provider-failover.js.map +1 -1
- package/dist/core/facade/coding-agent-facade.d.ts +6 -6
- package/dist/core/facade/coding-agent-facade.d.ts.map +1 -1
- package/dist/core/facade/coding-agent-facade.js +2 -3
- 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 +229 -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 +267 -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 +286 -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-config.d.ts +0 -1
- package/dist/core/model-config.d.ts.map +1 -1
- package/dist/core/model-config.js +9 -1
- package/dist/core/model-config.js.map +1 -1
- package/dist/core/model-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 +11 -7
- 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 +2 -2
- package/dist/core/provider-composer.d.ts.map +1 -1
- package/dist/core/provider-composer.js +29 -21
- 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 +27 -5
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +80 -55
- 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 +20 -20
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +47 -59
- 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 +97 -60
- 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 +0 -2
- package/dist/modes/interactive/components/footer.d.ts.map +1 -1
- package/dist/modes/interactive/components/footer.js +8 -10
- 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 +4 -6
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +115 -120
- 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 -2
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +350 -279
- 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 +0 -8
- package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client.js +3 -14
- package/dist/modes/rpc/rpc-client.js.map +1 -1
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-mode.js +0 -9
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-types.d.ts +0 -19
- package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-types.js.map +1 -1
- package/dist/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 +9 -2
- package/dist/plugins/ecosystem/node-plugin-bootstrap.d.ts.map +1 -1
- package/dist/plugins/ecosystem/node-plugin-bootstrap.js +44 -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/plugin-bootstrap.d.ts +9 -1
- package/dist/plugins/ecosystem/plugin-bootstrap.d.ts.map +1 -1
- package/dist/plugins/ecosystem/plugin-bootstrap.js +5 -0
- package/dist/plugins/ecosystem/plugin-bootstrap.js.map +1 -1
- package/dist/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/photon.d.ts +2 -2
- package/dist/utils/photon.d.ts.map +1 -1
- package/dist/utils/photon.js +2 -2
- package/dist/utils/photon.js.map +1 -1
- package/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/compaction.md +1 -3
- package/docs/docs.json +4 -0
- package/docs/index.md +1 -0
- package/docs/keybindings.md +3 -0
- package/docs/mcp.md +103 -0
- package/docs/models.md +14 -22
- package/docs/providers.md +0 -1
- package/docs/quickstart.md +1 -1
- package/docs/rpc.md +1 -26
- package/docs/sdk.md +4 -6
- package/docs/settings.md +10 -12
- package/docs/skills.md +1 -9
- package/docs/terminal-setup.md +2 -3
- package/docs/usage.md +7 -6
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/examples/extensions/with-deps/plugin.json +1 -1
- package/examples/sdk/10-settings.ts +2 -4
- package/examples/sdk/12-full-control.ts +1 -2
- package/package.json +1 -3
- package/dist/bundle/chunks/chunk-EALJ5DDX.js +0 -1452
- package/dist/core/extensions/microcompact.d.ts +0 -80
- package/dist/core/extensions/microcompact.d.ts.map +0 -1
- package/dist/core/extensions/microcompact.js +0 -134
- package/dist/core/extensions/microcompact.js.map +0 -1
- package/dist/server/create-harness.d.ts +0 -26
- package/dist/server/create-harness.d.ts.map +0 -1
- package/dist/server/create-harness.js +0 -106
- package/dist/server/create-harness.js.map +0 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { t } from "../i18n/index.js";
|
|
1
2
|
export const PLUGIN_DISPOSE_EVENT_ID = "plugin.dispose";
|
|
2
3
|
export const PLUGIN_DISPOSE_EVENT_VERSION = 1;
|
|
3
4
|
export const PLUGIN_READY_EVENT_ID = "plugin.ready";
|
|
@@ -70,7 +71,7 @@ export const OPERATION_END_EVENT_ID = "operation.end";
|
|
|
70
71
|
export const OPERATION_END_EVENT_VERSION = 1;
|
|
71
72
|
function assertString(value, label) {
|
|
72
73
|
if (typeof value !== "string" || value.trim() === "")
|
|
73
|
-
throw new Error(
|
|
74
|
+
throw new Error(t("{label} must be a non-empty string", { label }));
|
|
74
75
|
}
|
|
75
76
|
function assertJsonSafe(value, label, seen = new Set()) {
|
|
76
77
|
if (value === null || typeof value === "string" || typeof value === "boolean")
|
|
@@ -78,12 +79,12 @@ function assertJsonSafe(value, label, seen = new Set()) {
|
|
|
78
79
|
if (typeof value === "number") {
|
|
79
80
|
if (Number.isFinite(value))
|
|
80
81
|
return;
|
|
81
|
-
throw new Error(
|
|
82
|
+
throw new Error(t("{label} must contain only finite JSON numbers", { label }));
|
|
82
83
|
}
|
|
83
84
|
if (typeof value !== "object")
|
|
84
|
-
throw new Error(
|
|
85
|
+
throw new Error(t("{label} must be JSON-safe", { label }));
|
|
85
86
|
if (seen.has(value))
|
|
86
|
-
throw new Error(
|
|
87
|
+
throw new Error(t("{label} must not contain cycles", { label }));
|
|
87
88
|
seen.add(value);
|
|
88
89
|
if (Array.isArray(value)) {
|
|
89
90
|
for (const [index, entry] of value.entries())
|
|
@@ -94,7 +95,7 @@ function assertJsonSafe(value, label, seen = new Set()) {
|
|
|
94
95
|
assertJsonSafe(entry, `${label}.${key}`, seen);
|
|
95
96
|
}
|
|
96
97
|
else {
|
|
97
|
-
throw new Error(
|
|
98
|
+
throw new Error(t("{label} must contain only JSON arrays and plain objects", { label }));
|
|
98
99
|
}
|
|
99
100
|
seen.delete(value);
|
|
100
101
|
}
|
|
@@ -103,19 +104,19 @@ export function validatePluginDisposeEventDataV1(value) {
|
|
|
103
104
|
typeof value !== "object" ||
|
|
104
105
|
Array.isArray(value) ||
|
|
105
106
|
Object.getPrototypeOf(value) !== Object.prototype) {
|
|
106
|
-
throw new Error("plugin.dispose data must be a plain object");
|
|
107
|
+
throw new Error(t("plugin.dispose data must be a plain object"));
|
|
107
108
|
}
|
|
108
109
|
const record = value;
|
|
109
110
|
const keys = Object.keys(record).sort();
|
|
110
111
|
if (keys.join(",") !== "pluginId,pluginVersion,status,version") {
|
|
111
|
-
throw new Error("plugin.dispose data has unsupported fields");
|
|
112
|
+
throw new Error(t("plugin.dispose data has unsupported fields"));
|
|
112
113
|
}
|
|
113
114
|
if (record.version !== 1)
|
|
114
|
-
throw new Error("plugin.dispose data.version must be 1");
|
|
115
|
+
throw new Error(t("plugin.dispose data.version must be 1"));
|
|
115
116
|
assertString(record.pluginId, "plugin.dispose data.pluginId");
|
|
116
117
|
assertString(record.pluginVersion, "plugin.dispose data.pluginVersion");
|
|
117
118
|
if (record.status !== "disposed" && record.status !== "failed") {
|
|
118
|
-
throw new Error("plugin.dispose data.status is invalid");
|
|
119
|
+
throw new Error(t("plugin.dispose data.status is invalid"));
|
|
119
120
|
}
|
|
120
121
|
return value;
|
|
121
122
|
}
|
|
@@ -135,15 +136,15 @@ export function validatePluginReadyEventDataV1(value) {
|
|
|
135
136
|
typeof value !== "object" ||
|
|
136
137
|
Array.isArray(value) ||
|
|
137
138
|
Object.getPrototypeOf(value) !== Object.prototype) {
|
|
138
|
-
throw new Error("plugin.ready data must be a plain object");
|
|
139
|
+
throw new Error(t("plugin.ready data must be a plain object"));
|
|
139
140
|
}
|
|
140
141
|
const record = value;
|
|
141
142
|
const keys = Object.keys(record).sort();
|
|
142
143
|
if (keys.join(",") !== "pluginId,pluginVersion,version") {
|
|
143
|
-
throw new Error("plugin.ready data has unsupported fields");
|
|
144
|
+
throw new Error(t("plugin.ready data has unsupported fields"));
|
|
144
145
|
}
|
|
145
146
|
if (record.version !== 1)
|
|
146
|
-
throw new Error("plugin.ready data.version must be 1");
|
|
147
|
+
throw new Error(t("plugin.ready data.version must be 1"));
|
|
147
148
|
assertString(record.pluginId, "plugin.ready data.pluginId");
|
|
148
149
|
assertString(record.pluginVersion, "plugin.ready data.pluginVersion");
|
|
149
150
|
return value;
|
|
@@ -166,19 +167,19 @@ export function validatePluginRejectedEventDataV1(value) {
|
|
|
166
167
|
typeof value !== "object" ||
|
|
167
168
|
Array.isArray(value) ||
|
|
168
169
|
Object.getPrototypeOf(value) !== Object.prototype) {
|
|
169
|
-
throw new Error("plugin.rejected data must be a plain object");
|
|
170
|
+
throw new Error(t("plugin.rejected data must be a plain object"));
|
|
170
171
|
}
|
|
171
172
|
const record = value;
|
|
172
173
|
const keys = Object.keys(record)
|
|
173
174
|
.filter((key) => key !== "pluginId")
|
|
174
175
|
.sort();
|
|
175
176
|
if (keys.join(",") !== "code,manifestPath,message,version") {
|
|
176
|
-
throw new Error("plugin.rejected data has unsupported fields");
|
|
177
|
+
throw new Error(t("plugin.rejected data has unsupported fields"));
|
|
177
178
|
}
|
|
178
179
|
if (record.version !== 1)
|
|
179
|
-
throw new Error("plugin.rejected data.version must be 1");
|
|
180
|
+
throw new Error(t("plugin.rejected data.version must be 1"));
|
|
180
181
|
if (record.pluginId !== undefined && typeof record.pluginId !== "string") {
|
|
181
|
-
throw new Error("plugin.rejected data.pluginId must be a string when present");
|
|
182
|
+
throw new Error(t("plugin.rejected data.pluginId must be a string when present"));
|
|
182
183
|
}
|
|
183
184
|
assertString(record.manifestPath, "plugin.rejected data.manifestPath");
|
|
184
185
|
assertString(record.message, "plugin.rejected data.message");
|
|
@@ -186,7 +187,7 @@ export function validatePluginRejectedEventDataV1(value) {
|
|
|
186
187
|
record.code !== "duplicate_plugin_id" &&
|
|
187
188
|
record.code !== "missing_dependency" &&
|
|
188
189
|
record.code !== "plugin_load_failed") {
|
|
189
|
-
throw new Error("plugin.rejected data.code is invalid");
|
|
190
|
+
throw new Error(t("plugin.rejected data.code is invalid"));
|
|
190
191
|
}
|
|
191
192
|
return value;
|
|
192
193
|
}
|
|
@@ -215,29 +216,31 @@ export function validateSessionContextReplacedEventDataV1(value) {
|
|
|
215
216
|
typeof value !== "object" ||
|
|
216
217
|
Array.isArray(value) ||
|
|
217
218
|
Object.getPrototypeOf(value) !== Object.prototype) {
|
|
218
|
-
throw new Error("session.context.replaced data must be a plain object");
|
|
219
|
+
throw new Error(t("session.context.replaced data must be a plain object"));
|
|
219
220
|
}
|
|
220
221
|
const record = value;
|
|
221
222
|
const allowed = new Set(["version", "sessionId", "reason", "messageCount", "strategyName"]);
|
|
222
223
|
const unsupported = Object.keys(record).filter((key) => !allowed.has(key));
|
|
223
224
|
if (unsupported.length > 0) {
|
|
224
|
-
throw new Error(
|
|
225
|
+
throw new Error(t("session.context.replaced data has unsupported fields: {unsupported}", {
|
|
226
|
+
unsupported: unsupported.join(", "),
|
|
227
|
+
}));
|
|
225
228
|
}
|
|
226
229
|
for (const key of ["version", "sessionId", "reason", "messageCount"]) {
|
|
227
230
|
if (!(key in record))
|
|
228
|
-
throw new Error(
|
|
231
|
+
throw new Error(t("session.context.replaced data is missing required field: {key}", { key }));
|
|
229
232
|
}
|
|
230
233
|
if (record.version !== 1)
|
|
231
|
-
throw new Error("session.context.replaced data.version must be 1");
|
|
234
|
+
throw new Error(t("session.context.replaced data.version must be 1"));
|
|
232
235
|
assertString(record.sessionId, "session.context.replaced data.sessionId");
|
|
233
236
|
if (typeof record.reason !== "string" ||
|
|
234
237
|
!contextReasons.has(record.reason)) {
|
|
235
|
-
throw new Error("session.context.replaced data.reason is invalid");
|
|
238
|
+
throw new Error(t("session.context.replaced data.reason is invalid"));
|
|
236
239
|
}
|
|
237
240
|
if (typeof record.messageCount !== "number" ||
|
|
238
241
|
!Number.isSafeInteger(record.messageCount) ||
|
|
239
242
|
record.messageCount < 0) {
|
|
240
|
-
throw new Error("session.context.replaced data.messageCount must be a non-negative safe integer");
|
|
243
|
+
throw new Error(t("session.context.replaced data.messageCount must be a non-negative safe integer"));
|
|
241
244
|
}
|
|
242
245
|
if (record.strategyName !== undefined) {
|
|
243
246
|
assertString(record.strategyName, "session.context.replaced data.strategyName");
|
|
@@ -257,18 +260,18 @@ export function sessionContextReplacedEventDefinition() {
|
|
|
257
260
|
}
|
|
258
261
|
export function validateSessionReloadEventDataV1(value) {
|
|
259
262
|
if (!isPlainRecord(value))
|
|
260
|
-
throw new Error("session.reload data must be a plain object");
|
|
263
|
+
throw new Error(t("session.reload data must be a plain object"));
|
|
261
264
|
if (Object.keys(value).sort().join(",") !== "generation,reason,sessionId,version") {
|
|
262
|
-
throw new Error("session.reload data has unsupported fields");
|
|
265
|
+
throw new Error(t("session.reload data has unsupported fields"));
|
|
263
266
|
}
|
|
264
267
|
if (value.version !== 1)
|
|
265
|
-
throw new Error("session.reload data.version must be 1");
|
|
268
|
+
throw new Error(t("session.reload data.version must be 1"));
|
|
266
269
|
assertString(value.sessionId, "session.reload data.sessionId");
|
|
267
270
|
if (typeof value.generation !== "number" || !Number.isSafeInteger(value.generation) || value.generation < 1) {
|
|
268
|
-
throw new Error("session.reload data.generation must be a positive safe integer");
|
|
271
|
+
throw new Error(t("session.reload data.generation must be a positive safe integer"));
|
|
269
272
|
}
|
|
270
273
|
if (value.reason !== "reload")
|
|
271
|
-
throw new Error("session.reload data.reason is invalid");
|
|
274
|
+
throw new Error(t("session.reload data.reason is invalid"));
|
|
272
275
|
return value;
|
|
273
276
|
}
|
|
274
277
|
export function sessionReloadEventDefinition() {
|
|
@@ -284,12 +287,12 @@ export function sessionReloadEventDefinition() {
|
|
|
284
287
|
}
|
|
285
288
|
export function validateAgentLifecycleEventDataV1(value) {
|
|
286
289
|
if (!isPlainRecord(value))
|
|
287
|
-
throw new Error("agent lifecycle data must be a plain object");
|
|
290
|
+
throw new Error(t("agent lifecycle data must be a plain object"));
|
|
288
291
|
if (Object.keys(value).sort().join(",") !== "sessionId,version") {
|
|
289
|
-
throw new Error("agent lifecycle data has unsupported fields");
|
|
292
|
+
throw new Error(t("agent lifecycle data has unsupported fields"));
|
|
290
293
|
}
|
|
291
294
|
if (value.version !== 1)
|
|
292
|
-
throw new Error("agent lifecycle data.version must be 1");
|
|
295
|
+
throw new Error(t("agent lifecycle data.version must be 1"));
|
|
293
296
|
assertString(value.sessionId, "agent lifecycle data.sessionId");
|
|
294
297
|
return value;
|
|
295
298
|
}
|
|
@@ -317,48 +320,48 @@ export function agentSettledEventDefinition() {
|
|
|
317
320
|
}
|
|
318
321
|
export function validateTurnStartEventDataV1(value) {
|
|
319
322
|
if (!isPlainRecord(value))
|
|
320
|
-
throw new Error("turn.start data must be a plain object");
|
|
323
|
+
throw new Error(t("turn.start data must be a plain object"));
|
|
321
324
|
if (Object.keys(value).sort().join(",") !== "sessionId,turnIndex,version") {
|
|
322
|
-
throw new Error("turn.start data has unsupported fields");
|
|
325
|
+
throw new Error(t("turn.start data has unsupported fields"));
|
|
323
326
|
}
|
|
324
327
|
if (value.version !== 1)
|
|
325
|
-
throw new Error("turn.start data.version must be 1");
|
|
328
|
+
throw new Error(t("turn.start data.version must be 1"));
|
|
326
329
|
assertString(value.sessionId, "turn.start data.sessionId");
|
|
327
330
|
if (typeof value.turnIndex !== "number" || !Number.isSafeInteger(value.turnIndex) || value.turnIndex < 0) {
|
|
328
|
-
throw new Error("turn.start data.turnIndex must be a non-negative safe integer");
|
|
331
|
+
throw new Error(t("turn.start data.turnIndex must be a non-negative safe integer"));
|
|
329
332
|
}
|
|
330
333
|
return value;
|
|
331
334
|
}
|
|
332
335
|
export function validateTurnEndEventDataV1(value) {
|
|
333
336
|
if (!isPlainRecord(value))
|
|
334
|
-
throw new Error("turn.end data must be a plain object");
|
|
337
|
+
throw new Error(t("turn.end data must be a plain object"));
|
|
335
338
|
const keys = Object.keys(value).sort().join(",");
|
|
336
339
|
if (keys !== "messageCount,sessionId,turnIndex,version" &&
|
|
337
340
|
keys !== "messageCount,outcome,sessionId,turnIndex,version") {
|
|
338
|
-
throw new Error("turn.end data has unsupported fields");
|
|
341
|
+
throw new Error(t("turn.end data has unsupported fields"));
|
|
339
342
|
}
|
|
340
343
|
if (value.version !== 1)
|
|
341
|
-
throw new Error("turn.end data.version must be 1");
|
|
344
|
+
throw new Error(t("turn.end data.version must be 1"));
|
|
342
345
|
assertString(value.sessionId, "turn.end data.sessionId");
|
|
343
346
|
if (typeof value.turnIndex !== "number" || !Number.isSafeInteger(value.turnIndex) || value.turnIndex < 0) {
|
|
344
|
-
throw new Error("turn.end data.turnIndex must be a non-negative safe integer");
|
|
347
|
+
throw new Error(t("turn.end data.turnIndex must be a non-negative safe integer"));
|
|
345
348
|
}
|
|
346
349
|
if (typeof value.messageCount !== "number" || !Number.isSafeInteger(value.messageCount) || value.messageCount < 0) {
|
|
347
|
-
throw new Error("turn.end data.messageCount must be a non-negative safe integer");
|
|
350
|
+
throw new Error(t("turn.end data.messageCount must be a non-negative safe integer"));
|
|
348
351
|
}
|
|
349
352
|
if (value.outcome !== undefined && value.outcome !== "aborted" && value.outcome !== "error") {
|
|
350
|
-
throw new Error("turn.end data.outcome is invalid");
|
|
353
|
+
throw new Error(t("turn.end data.outcome is invalid"));
|
|
351
354
|
}
|
|
352
355
|
return value;
|
|
353
356
|
}
|
|
354
357
|
export function validateMessageBoundaryEventDataV1(value) {
|
|
355
358
|
if (!isPlainRecord(value))
|
|
356
|
-
throw new Error("message lifecycle data must be a plain object");
|
|
359
|
+
throw new Error(t("message lifecycle data must be a plain object"));
|
|
357
360
|
if (Object.keys(value).sort().join(",") !== "role,sessionId,version") {
|
|
358
|
-
throw new Error("message lifecycle data has unsupported fields");
|
|
361
|
+
throw new Error(t("message lifecycle data has unsupported fields"));
|
|
359
362
|
}
|
|
360
363
|
if (value.version !== 1)
|
|
361
|
-
throw new Error("message lifecycle data.version must be 1");
|
|
364
|
+
throw new Error(t("message lifecycle data.version must be 1"));
|
|
362
365
|
assertString(value.sessionId, "message lifecycle data.sessionId");
|
|
363
366
|
assertString(value.role, "message lifecycle data.role");
|
|
364
367
|
return value;
|
|
@@ -409,12 +412,12 @@ export function messageEndEventDefinition() {
|
|
|
409
412
|
}
|
|
410
413
|
export function validateToolExecutionStartEventDataV1(value) {
|
|
411
414
|
if (!isPlainRecord(value))
|
|
412
|
-
throw new Error("tool.execution.start data must be a plain object");
|
|
415
|
+
throw new Error(t("tool.execution.start data must be a plain object"));
|
|
413
416
|
if (Object.keys(value).sort().join(",") !== "sessionId,toolCallId,toolName,version") {
|
|
414
|
-
throw new Error("tool.execution.start data has unsupported fields");
|
|
417
|
+
throw new Error(t("tool.execution.start data has unsupported fields"));
|
|
415
418
|
}
|
|
416
419
|
if (value.version !== 1)
|
|
417
|
-
throw new Error("tool.execution.start data.version must be 1");
|
|
420
|
+
throw new Error(t("tool.execution.start data.version must be 1"));
|
|
418
421
|
assertString(value.sessionId, "tool.execution.start data.sessionId");
|
|
419
422
|
assertString(value.toolCallId, "tool.execution.start data.toolCallId");
|
|
420
423
|
assertString(value.toolName, "tool.execution.start data.toolName");
|
|
@@ -433,28 +436,28 @@ export function toolExecutionStartEventDefinition() {
|
|
|
433
436
|
}
|
|
434
437
|
export function validateModelSelectEventDataV1(value) {
|
|
435
438
|
if (!isPlainRecord(value))
|
|
436
|
-
throw new Error("model.select data must be a plain object");
|
|
439
|
+
throw new Error(t("model.select data must be a plain object"));
|
|
437
440
|
if (Object.keys(value).sort().join(",") !== "id,provider,sessionId,source,version") {
|
|
438
|
-
throw new Error("model.select data has unsupported fields");
|
|
441
|
+
throw new Error(t("model.select data has unsupported fields"));
|
|
439
442
|
}
|
|
440
443
|
if (value.version !== 1)
|
|
441
|
-
throw new Error("model.select data.version must be 1");
|
|
444
|
+
throw new Error(t("model.select data.version must be 1"));
|
|
442
445
|
assertString(value.sessionId, "model.select data.sessionId");
|
|
443
446
|
assertString(value.provider, "model.select data.provider");
|
|
444
447
|
assertString(value.id, "model.select data.id");
|
|
445
448
|
if (value.source !== "set" && value.source !== "cycle" && value.source !== "restore") {
|
|
446
|
-
throw new Error("model.select data.source is invalid");
|
|
449
|
+
throw new Error(t("model.select data.source is invalid"));
|
|
447
450
|
}
|
|
448
451
|
return value;
|
|
449
452
|
}
|
|
450
453
|
export function validateThinkingLevelSelectEventDataV1(value) {
|
|
451
454
|
if (!isPlainRecord(value))
|
|
452
|
-
throw new Error("thinking_level.select data must be a plain object");
|
|
455
|
+
throw new Error(t("thinking_level.select data must be a plain object"));
|
|
453
456
|
if (Object.keys(value).sort().join(",") !== "level,previousLevel,sessionId,version") {
|
|
454
|
-
throw new Error("thinking_level.select data has unsupported fields");
|
|
457
|
+
throw new Error(t("thinking_level.select data has unsupported fields"));
|
|
455
458
|
}
|
|
456
459
|
if (value.version !== 1)
|
|
457
|
-
throw new Error("thinking_level.select data.version must be 1");
|
|
460
|
+
throw new Error(t("thinking_level.select data.version must be 1"));
|
|
458
461
|
assertString(value.sessionId, "thinking_level.select data.sessionId");
|
|
459
462
|
assertString(value.level, "thinking_level.select data.level");
|
|
460
463
|
assertString(value.previousLevel, "thinking_level.select data.previousLevel");
|
|
@@ -484,13 +487,13 @@ export function thinkingLevelSelectEventDefinition() {
|
|
|
484
487
|
}
|
|
485
488
|
export function validateSessionInfoChangedEventDataV1(value) {
|
|
486
489
|
if (!isPlainRecord(value))
|
|
487
|
-
throw new Error("session.info.changed data must be a plain object");
|
|
490
|
+
throw new Error(t("session.info.changed data must be a plain object"));
|
|
488
491
|
if (Object.keys(value).sort().join(",") !== "sessionId,version" &&
|
|
489
492
|
Object.keys(value).sort().join(",") !== "name,sessionId,version") {
|
|
490
|
-
throw new Error("session.info.changed data has unsupported fields");
|
|
493
|
+
throw new Error(t("session.info.changed data has unsupported fields"));
|
|
491
494
|
}
|
|
492
495
|
if (value.version !== 1)
|
|
493
|
-
throw new Error("session.info.changed data.version must be 1");
|
|
496
|
+
throw new Error(t("session.info.changed data.version must be 1"));
|
|
494
497
|
assertString(value.sessionId, "session.info.changed data.sessionId");
|
|
495
498
|
if (value.name !== undefined)
|
|
496
499
|
assertString(value.name, "session.info.changed data.name");
|
|
@@ -498,12 +501,12 @@ export function validateSessionInfoChangedEventDataV1(value) {
|
|
|
498
501
|
}
|
|
499
502
|
export function validateSessionEntryAppendedEventDataV1(value) {
|
|
500
503
|
if (!isPlainRecord(value))
|
|
501
|
-
throw new Error("session.entry.appended data must be a plain object");
|
|
504
|
+
throw new Error(t("session.entry.appended data must be a plain object"));
|
|
502
505
|
if (Object.keys(value).sort().join(",") !== "entryId,entryType,sessionId,version") {
|
|
503
|
-
throw new Error("session.entry.appended data has unsupported fields");
|
|
506
|
+
throw new Error(t("session.entry.appended data has unsupported fields"));
|
|
504
507
|
}
|
|
505
508
|
if (value.version !== 1)
|
|
506
|
-
throw new Error("session.entry.appended data.version must be 1");
|
|
509
|
+
throw new Error(t("session.entry.appended data.version must be 1"));
|
|
507
510
|
assertString(value.sessionId, "session.entry.appended data.sessionId");
|
|
508
511
|
assertString(value.entryId, "session.entry.appended data.entryId");
|
|
509
512
|
assertString(value.entryType, "session.entry.appended data.entryType");
|
|
@@ -533,29 +536,29 @@ export function sessionEntryAppendedEventDefinition() {
|
|
|
533
536
|
}
|
|
534
537
|
export function validateAgentEndEventDataV1(value) {
|
|
535
538
|
if (!isPlainRecord(value))
|
|
536
|
-
throw new Error("agent.end data must be a plain object");
|
|
539
|
+
throw new Error(t("agent.end data must be a plain object"));
|
|
537
540
|
if (Object.keys(value).sort().join(",") !== "messageCount,sessionId,version") {
|
|
538
|
-
throw new Error("agent.end data has unsupported fields");
|
|
541
|
+
throw new Error(t("agent.end data has unsupported fields"));
|
|
539
542
|
}
|
|
540
543
|
if (value.version !== 1)
|
|
541
|
-
throw new Error("agent.end data.version must be 1");
|
|
544
|
+
throw new Error(t("agent.end data.version must be 1"));
|
|
542
545
|
assertString(value.sessionId, "agent.end data.sessionId");
|
|
543
546
|
if (typeof value.messageCount !== "number" || !Number.isSafeInteger(value.messageCount) || value.messageCount < 0) {
|
|
544
|
-
throw new Error("agent.end data.messageCount must be a non-negative safe integer");
|
|
547
|
+
throw new Error(t("agent.end data.messageCount must be a non-negative safe integer"));
|
|
545
548
|
}
|
|
546
549
|
return value;
|
|
547
550
|
}
|
|
548
551
|
export function validateBeforeAgentStartEventDataV1(value) {
|
|
549
552
|
if (!isPlainRecord(value))
|
|
550
|
-
throw new Error("before.agent.start data must be a plain object");
|
|
553
|
+
throw new Error(t("before.agent.start data must be a plain object"));
|
|
551
554
|
if (Object.keys(value).sort().join(",") !== "hasImages,sessionId,version") {
|
|
552
|
-
throw new Error("before.agent.start data has unsupported fields");
|
|
555
|
+
throw new Error(t("before.agent.start data has unsupported fields"));
|
|
553
556
|
}
|
|
554
557
|
if (value.version !== 1)
|
|
555
|
-
throw new Error("before.agent.start data.version must be 1");
|
|
558
|
+
throw new Error(t("before.agent.start data.version must be 1"));
|
|
556
559
|
assertString(value.sessionId, "before.agent.start data.sessionId");
|
|
557
560
|
if (typeof value.hasImages !== "boolean")
|
|
558
|
-
throw new Error("before.agent.start data.hasImages must be a boolean");
|
|
561
|
+
throw new Error(t("before.agent.start data.hasImages must be a boolean"));
|
|
559
562
|
return value;
|
|
560
563
|
}
|
|
561
564
|
export function agentEndEventDefinition() {
|
|
@@ -582,28 +585,28 @@ export function beforeAgentStartEventDefinition() {
|
|
|
582
585
|
}
|
|
583
586
|
export function validateBeforeAgentStartEventDataV2(value) {
|
|
584
587
|
if (!isPlainRecord(value))
|
|
585
|
-
throw new Error("before.agent.start data must be a plain object");
|
|
588
|
+
throw new Error(t("before.agent.start data must be a plain object"));
|
|
586
589
|
const allowed = new Set(["version", "sessionId", "systemPrompt", "systemPromptOptions"]);
|
|
587
590
|
const unsupported = Object.keys(value).filter((key) => !allowed.has(key));
|
|
588
591
|
if (unsupported.length > 0) {
|
|
589
|
-
throw new Error(
|
|
592
|
+
throw new Error(t("before.agent.start data has unsupported fields: {unsupported}", { unsupported: unsupported.join(", ") }));
|
|
590
593
|
}
|
|
591
594
|
for (const key of ["version", "sessionId", "systemPrompt", "systemPromptOptions"]) {
|
|
592
595
|
if (!(key in value))
|
|
593
|
-
throw new Error(
|
|
596
|
+
throw new Error(t("before.agent.start data is missing required field: {key}", { key }));
|
|
594
597
|
}
|
|
595
598
|
if (value.version !== 2)
|
|
596
|
-
throw new Error("before.agent.start data.version must be 2");
|
|
599
|
+
throw new Error(t("before.agent.start data.version must be 2"));
|
|
597
600
|
assertString(value.sessionId, "before.agent.start data.sessionId");
|
|
598
601
|
if (typeof value.systemPrompt !== "string") {
|
|
599
|
-
throw new Error("before.agent.start data.systemPrompt must be a string");
|
|
602
|
+
throw new Error(t("before.agent.start data.systemPrompt must be a string"));
|
|
600
603
|
}
|
|
601
604
|
// Only the shape is enforced here: JSON-safety (no functions, cycles, or
|
|
602
605
|
// non-finite numbers) is already guaranteed because the dispatcher runs the
|
|
603
606
|
// payload through a detached structured clone before validation, and the
|
|
604
607
|
// build-options snapshot legitimately carries explicit `undefined` fields.
|
|
605
608
|
if (!isPlainRecord(value.systemPromptOptions)) {
|
|
606
|
-
throw new Error("before.agent.start data.systemPromptOptions must be a plain object");
|
|
609
|
+
throw new Error(t("before.agent.start data.systemPromptOptions must be a plain object"));
|
|
607
610
|
}
|
|
608
611
|
return value;
|
|
609
612
|
}
|
|
@@ -620,13 +623,13 @@ export function beforeAgentStartV2EventDefinition() {
|
|
|
620
623
|
}
|
|
621
624
|
export function validateUIPromptBoundaryEventDataV1(value) {
|
|
622
625
|
if (!isPlainRecord(value))
|
|
623
|
-
throw new Error("ui.prompt lifecycle data must be a plain object");
|
|
626
|
+
throw new Error(t("ui.prompt lifecycle data must be a plain object"));
|
|
624
627
|
const keys = Object.keys(value).sort();
|
|
625
628
|
if (keys.join(",") !== "kind,sessionId,version" && keys.join(",") !== "kind,sessionId,title,version") {
|
|
626
|
-
throw new Error("ui.prompt lifecycle data has unsupported fields");
|
|
629
|
+
throw new Error(t("ui.prompt lifecycle data has unsupported fields"));
|
|
627
630
|
}
|
|
628
631
|
if (value.version !== 1)
|
|
629
|
-
throw new Error("ui.prompt lifecycle data.version must be 1");
|
|
632
|
+
throw new Error(t("ui.prompt lifecycle data.version must be 1"));
|
|
630
633
|
assertString(value.sessionId, "ui.prompt lifecycle data.sessionId");
|
|
631
634
|
assertString(value.kind, "ui.prompt lifecycle data.kind");
|
|
632
635
|
if (value.title !== undefined)
|
|
@@ -635,16 +638,16 @@ export function validateUIPromptBoundaryEventDataV1(value) {
|
|
|
635
638
|
}
|
|
636
639
|
export function validateResourcesDiscoverEventDataV1(value) {
|
|
637
640
|
if (!isPlainRecord(value))
|
|
638
|
-
throw new Error("resources.discover data must be a plain object");
|
|
641
|
+
throw new Error(t("resources.discover data must be a plain object"));
|
|
639
642
|
if (Object.keys(value).sort().join(",") !== "cwd,reason,sessionId,version") {
|
|
640
|
-
throw new Error("resources.discover data has unsupported fields");
|
|
643
|
+
throw new Error(t("resources.discover data has unsupported fields"));
|
|
641
644
|
}
|
|
642
645
|
if (value.version !== 1)
|
|
643
|
-
throw new Error("resources.discover data.version must be 1");
|
|
646
|
+
throw new Error(t("resources.discover data.version must be 1"));
|
|
644
647
|
assertString(value.sessionId, "resources.discover data.sessionId");
|
|
645
648
|
assertString(value.cwd, "resources.discover data.cwd");
|
|
646
649
|
if (value.reason !== "startup" && value.reason !== "reload") {
|
|
647
|
-
throw new Error("resources.discover data.reason is invalid");
|
|
650
|
+
throw new Error(t("resources.discover data.reason is invalid"));
|
|
648
651
|
}
|
|
649
652
|
return value;
|
|
650
653
|
}
|
|
@@ -683,12 +686,12 @@ export function resourcesDiscoverEventDefinition() {
|
|
|
683
686
|
}
|
|
684
687
|
function validateResourcesDiscoverContributionV2(value, label) {
|
|
685
688
|
if (!Array.isArray(value))
|
|
686
|
-
throw new Error(
|
|
689
|
+
throw new Error(t("{label} must be an array", { label }));
|
|
687
690
|
for (const [index, entry] of value.entries()) {
|
|
688
691
|
if (!isPlainRecord(entry))
|
|
689
|
-
throw new Error(
|
|
692
|
+
throw new Error(t("{label}[{index}] must be a plain object", { label, index }));
|
|
690
693
|
if (Object.keys(entry).sort().join(",") !== "extensionPath,path") {
|
|
691
|
-
throw new Error(
|
|
694
|
+
throw new Error(t("{label}[{index}] has unsupported fields", { label, index }));
|
|
692
695
|
}
|
|
693
696
|
assertString(entry.path, `${label}[${index}].path`);
|
|
694
697
|
assertString(entry.extensionPath, `${label}[${index}].extensionPath`);
|
|
@@ -696,22 +699,22 @@ function validateResourcesDiscoverContributionV2(value, label) {
|
|
|
696
699
|
}
|
|
697
700
|
export function validateResourcesDiscoverEventDataV2(value) {
|
|
698
701
|
if (!isPlainRecord(value))
|
|
699
|
-
throw new Error("resources.discover data must be a plain object");
|
|
702
|
+
throw new Error(t("resources.discover data must be a plain object"));
|
|
700
703
|
const allowed = new Set(["version", "sessionId", "cwd", "reason", "skillPaths", "promptPaths", "themePaths"]);
|
|
701
704
|
const unsupported = Object.keys(value).filter((key) => !allowed.has(key));
|
|
702
705
|
if (unsupported.length > 0) {
|
|
703
|
-
throw new Error(
|
|
706
|
+
throw new Error(t("resources.discover data has unsupported fields: {unsupported}", { unsupported: unsupported.join(", ") }));
|
|
704
707
|
}
|
|
705
708
|
for (const key of ["version", "sessionId", "cwd", "reason"]) {
|
|
706
709
|
if (!(key in value))
|
|
707
|
-
throw new Error(
|
|
710
|
+
throw new Error(t("resources.discover data is missing required field: {key}", { key }));
|
|
708
711
|
}
|
|
709
712
|
if (value.version !== 2)
|
|
710
|
-
throw new Error("resources.discover data.version must be 2");
|
|
713
|
+
throw new Error(t("resources.discover data.version must be 2"));
|
|
711
714
|
assertString(value.sessionId, "resources.discover data.sessionId");
|
|
712
715
|
assertString(value.cwd, "resources.discover data.cwd");
|
|
713
716
|
if (value.reason !== "startup" && value.reason !== "reload") {
|
|
714
|
-
throw new Error("resources.discover data.reason is invalid");
|
|
717
|
+
throw new Error(t("resources.discover data.reason is invalid"));
|
|
715
718
|
}
|
|
716
719
|
if (value.skillPaths !== undefined) {
|
|
717
720
|
validateResourcesDiscoverContributionV2(value.skillPaths, "resources.discover data.skillPaths");
|
|
@@ -737,45 +740,45 @@ export function resourcesDiscoverV2EventDefinition() {
|
|
|
737
740
|
}
|
|
738
741
|
export function validateContextAssembledEventDataV1(value) {
|
|
739
742
|
if (!isPlainRecord(value))
|
|
740
|
-
throw new Error("context.assembled data must be a plain object");
|
|
743
|
+
throw new Error(t("context.assembled data must be a plain object"));
|
|
741
744
|
if (Object.keys(value).sort().join(",") !== "messageCount,sessionId,version") {
|
|
742
|
-
throw new Error("context.assembled data has unsupported fields");
|
|
745
|
+
throw new Error(t("context.assembled data has unsupported fields"));
|
|
743
746
|
}
|
|
744
747
|
if (value.version !== 1)
|
|
745
|
-
throw new Error("context.assembled data.version must be 1");
|
|
748
|
+
throw new Error(t("context.assembled data.version must be 1"));
|
|
746
749
|
assertString(value.sessionId, "context.assembled data.sessionId");
|
|
747
750
|
if (typeof value.messageCount !== "number" || !Number.isSafeInteger(value.messageCount) || value.messageCount < 0) {
|
|
748
|
-
throw new Error("context.assembled data.messageCount must be a non-negative safe integer");
|
|
751
|
+
throw new Error(t("context.assembled data.messageCount must be a non-negative safe integer"));
|
|
749
752
|
}
|
|
750
753
|
return value;
|
|
751
754
|
}
|
|
752
755
|
export function validateInputReceivedEventDataV1(value) {
|
|
753
756
|
if (!isPlainRecord(value))
|
|
754
|
-
throw new Error("input.received data must be a plain object");
|
|
757
|
+
throw new Error(t("input.received data must be a plain object"));
|
|
755
758
|
if (Object.keys(value).sort().join(",") !== "sessionId,textLength,version,source".split(",").sort().join(",")) {
|
|
756
|
-
throw new Error("input.received data has unsupported fields");
|
|
759
|
+
throw new Error(t("input.received data has unsupported fields"));
|
|
757
760
|
}
|
|
758
761
|
if (value.version !== 1)
|
|
759
|
-
throw new Error("input.received data.version must be 1");
|
|
762
|
+
throw new Error(t("input.received data.version must be 1"));
|
|
760
763
|
assertString(value.sessionId, "input.received data.sessionId");
|
|
761
764
|
assertString(value.source, "input.received data.source");
|
|
762
765
|
if (typeof value.textLength !== "number" || !Number.isSafeInteger(value.textLength) || value.textLength < 0) {
|
|
763
|
-
throw new Error("input.received data.textLength must be a non-negative safe integer");
|
|
766
|
+
throw new Error(t("input.received data.textLength must be a non-negative safe integer"));
|
|
764
767
|
}
|
|
765
768
|
return value;
|
|
766
769
|
}
|
|
767
770
|
export function validateUserBashEventDataV1(value) {
|
|
768
771
|
if (!isPlainRecord(value))
|
|
769
|
-
throw new Error("user.bash data must be a plain object");
|
|
772
|
+
throw new Error(t("user.bash data must be a plain object"));
|
|
770
773
|
if (Object.keys(value).sort().join(",") !== "cwd,excludeFromContext,sessionId,version") {
|
|
771
|
-
throw new Error("user.bash data has unsupported fields");
|
|
774
|
+
throw new Error(t("user.bash data has unsupported fields"));
|
|
772
775
|
}
|
|
773
776
|
if (value.version !== 1)
|
|
774
|
-
throw new Error("user.bash data.version must be 1");
|
|
777
|
+
throw new Error(t("user.bash data.version must be 1"));
|
|
775
778
|
assertString(value.sessionId, "user.bash data.sessionId");
|
|
776
779
|
assertString(value.cwd, "user.bash data.cwd");
|
|
777
780
|
if (typeof value.excludeFromContext !== "boolean") {
|
|
778
|
-
throw new Error("user.bash data.excludeFromContext must be a boolean");
|
|
781
|
+
throw new Error(t("user.bash data.excludeFromContext must be a boolean"));
|
|
779
782
|
}
|
|
780
783
|
return value;
|
|
781
784
|
}
|
|
@@ -814,21 +817,21 @@ export function userBashEventDefinition() {
|
|
|
814
817
|
}
|
|
815
818
|
export function validateSessionStartEventDataV1(value) {
|
|
816
819
|
if (!isPlainRecord(value))
|
|
817
|
-
throw new Error("session.start data must be a plain object");
|
|
820
|
+
throw new Error(t("session.start data must be a plain object"));
|
|
818
821
|
const keys = Object.keys(value).sort();
|
|
819
822
|
if (keys.join(",") !== "reason,sessionId,version" &&
|
|
820
823
|
keys.join(",") !== "previousSessionFile,reason,sessionId,version") {
|
|
821
|
-
throw new Error("session.start data has unsupported fields");
|
|
824
|
+
throw new Error(t("session.start data has unsupported fields"));
|
|
822
825
|
}
|
|
823
826
|
if (value.version !== 1)
|
|
824
|
-
throw new Error("session.start data.version must be 1");
|
|
827
|
+
throw new Error(t("session.start data.version must be 1"));
|
|
825
828
|
assertString(value.sessionId, "session.start data.sessionId");
|
|
826
829
|
if (value.reason !== "startup" &&
|
|
827
830
|
value.reason !== "reload" &&
|
|
828
831
|
value.reason !== "new" &&
|
|
829
832
|
value.reason !== "resume" &&
|
|
830
833
|
value.reason !== "fork") {
|
|
831
|
-
throw new Error("session.start data.reason is invalid");
|
|
834
|
+
throw new Error(t("session.start data.reason is invalid"));
|
|
832
835
|
}
|
|
833
836
|
if (value.previousSessionFile !== undefined)
|
|
834
837
|
assertString(value.previousSessionFile, "session.start data.previousSessionFile");
|
|
@@ -850,7 +853,7 @@ export function validateModelResponseEventDataV1(value) {
|
|
|
850
853
|
typeof value !== "object" ||
|
|
851
854
|
Array.isArray(value) ||
|
|
852
855
|
Object.getPrototypeOf(value) !== Object.prototype) {
|
|
853
|
-
throw new Error("model.response data must be a plain object");
|
|
856
|
+
throw new Error(t("model.response data must be a plain object"));
|
|
854
857
|
}
|
|
855
858
|
const record = value;
|
|
856
859
|
const allowed = new Set([
|
|
@@ -866,13 +869,13 @@ export function validateModelResponseEventDataV1(value) {
|
|
|
866
869
|
]);
|
|
867
870
|
const unsupported = Object.keys(record).filter((key) => !allowed.has(key));
|
|
868
871
|
if (unsupported.length > 0)
|
|
869
|
-
throw new Error(
|
|
872
|
+
throw new Error(t("model.response data has unsupported fields: {unsupported}", { unsupported: unsupported.join(", ") }));
|
|
870
873
|
for (const key of ["version", "sessionId", "entryId", "revision", "provider", "model", "stopReason", "message"]) {
|
|
871
874
|
if (!(key in record))
|
|
872
|
-
throw new Error(
|
|
875
|
+
throw new Error(t("model.response data is missing required field: {key}", { key }));
|
|
873
876
|
}
|
|
874
877
|
if (record.version !== 1)
|
|
875
|
-
throw new Error("model.response data.version must be 1");
|
|
878
|
+
throw new Error(t("model.response data.version must be 1"));
|
|
876
879
|
assertString(record.sessionId, "model.response data.sessionId");
|
|
877
880
|
assertString(record.entryId, "model.response data.entryId");
|
|
878
881
|
assertString(record.provider, "model.response data.provider");
|
|
@@ -884,30 +887,30 @@ export function validateModelResponseEventDataV1(value) {
|
|
|
884
887
|
record.stopReason !== "error" &&
|
|
885
888
|
record.stopReason !== "aborted" &&
|
|
886
889
|
record.stopReason !== "deferred") {
|
|
887
|
-
throw new Error("model.response data.stopReason is invalid");
|
|
890
|
+
throw new Error(t("model.response data.stopReason is invalid"));
|
|
888
891
|
}
|
|
889
892
|
if (!record.message || typeof record.message !== "object" || Array.isArray(record.message)) {
|
|
890
|
-
throw new Error("model.response data.message must be an assistant message object");
|
|
893
|
+
throw new Error(t("model.response data.message must be an assistant message object"));
|
|
891
894
|
}
|
|
892
895
|
const message = record.message;
|
|
893
896
|
if (message.role !== "assistant")
|
|
894
|
-
throw new Error("model.response data.message.role must be assistant");
|
|
897
|
+
throw new Error(t("model.response data.message.role must be assistant"));
|
|
895
898
|
if (!isPlainRecord(record.revision))
|
|
896
|
-
throw new Error("model.response data.revision must be a plain object");
|
|
899
|
+
throw new Error(t("model.response data.revision must be a plain object"));
|
|
897
900
|
const revision = record.revision;
|
|
898
901
|
if (Object.keys(revision).sort().join(",") !== "leafId,sequence,sessionId,version") {
|
|
899
|
-
throw new Error("model.response data.revision has unsupported fields");
|
|
902
|
+
throw new Error(t("model.response data.revision has unsupported fields"));
|
|
900
903
|
}
|
|
901
904
|
if (revision.version !== 1)
|
|
902
|
-
throw new Error("model.response data.revision.version must be 1");
|
|
905
|
+
throw new Error(t("model.response data.revision.version must be 1"));
|
|
903
906
|
assertString(revision.sessionId, "model.response data.revision.sessionId");
|
|
904
907
|
if (typeof revision.sequence !== "number" || !Number.isSafeInteger(revision.sequence) || revision.sequence < 0) {
|
|
905
|
-
throw new Error("model.response data.revision.sequence must be a non-negative safe integer");
|
|
908
|
+
throw new Error(t("model.response data.revision.sequence must be a non-negative safe integer"));
|
|
906
909
|
}
|
|
907
910
|
if (revision.leafId !== null)
|
|
908
911
|
assertString(revision.leafId, "model.response data.revision.leafId");
|
|
909
912
|
if (revision.sessionId !== record.sessionId) {
|
|
910
|
-
throw new Error("model.response data.revision.sessionId must match sessionId");
|
|
913
|
+
throw new Error(t("model.response data.revision.sessionId must match sessionId"));
|
|
911
914
|
}
|
|
912
915
|
if (record.errorMessage !== undefined)
|
|
913
916
|
assertString(record.errorMessage, "model.response data.errorMessage");
|
|
@@ -946,7 +949,7 @@ const modelStreamEvents = new Set([
|
|
|
946
949
|
]);
|
|
947
950
|
export function validateModelStreamEventDataV1(value) {
|
|
948
951
|
if (!isPlainRecord(value))
|
|
949
|
-
throw new Error("model.stream data must be a plain object");
|
|
952
|
+
throw new Error(t("model.stream data must be a plain object"));
|
|
950
953
|
const allowed = new Set([
|
|
951
954
|
"version",
|
|
952
955
|
"sessionId",
|
|
@@ -960,7 +963,7 @@ export function validateModelStreamEventDataV1(value) {
|
|
|
960
963
|
]);
|
|
961
964
|
const unsupported = Object.keys(value).filter((key) => !allowed.has(key));
|
|
962
965
|
if (unsupported.length > 0)
|
|
963
|
-
throw new Error(
|
|
966
|
+
throw new Error(t("model.stream data has unsupported fields: {unsupported}", { unsupported: unsupported.join(", ") }));
|
|
964
967
|
for (const key of [
|
|
965
968
|
"version",
|
|
966
969
|
"sessionId",
|
|
@@ -973,38 +976,38 @@ export function validateModelStreamEventDataV1(value) {
|
|
|
973
976
|
"error",
|
|
974
977
|
]) {
|
|
975
978
|
if (!(key in value))
|
|
976
|
-
throw new Error(
|
|
979
|
+
throw new Error(t("model.stream data is missing required field: {key}", { key }));
|
|
977
980
|
}
|
|
978
981
|
if (value.version !== 1)
|
|
979
|
-
throw new Error("model.stream data.version must be 1");
|
|
982
|
+
throw new Error(t("model.stream data.version must be 1"));
|
|
980
983
|
assertString(value.sessionId, "model.stream data.sessionId");
|
|
981
984
|
assertString(value.streamId, "model.stream data.streamId");
|
|
982
985
|
if (typeof value.sequence !== "number" || !Number.isSafeInteger(value.sequence) || value.sequence < 1) {
|
|
983
|
-
throw new Error("model.stream data.sequence must be a positive safe integer");
|
|
986
|
+
throw new Error(t("model.stream data.sequence must be a positive safe integer"));
|
|
984
987
|
}
|
|
985
988
|
if (value.phase !== "raw" && value.phase !== "candidate" && value.phase !== "committed") {
|
|
986
|
-
throw new Error("model.stream data.phase is invalid");
|
|
989
|
+
throw new Error(t("model.stream data.phase is invalid"));
|
|
987
990
|
}
|
|
988
991
|
if (typeof value.event !== "string" || !modelStreamEvents.has(value.event)) {
|
|
989
|
-
throw new Error("model.stream data.event is invalid");
|
|
992
|
+
throw new Error(t("model.stream data.event is invalid"));
|
|
990
993
|
}
|
|
991
994
|
if (value.phase === "committed" && value.event !== "done" && value.event !== "error") {
|
|
992
|
-
throw new Error("model.stream committed phase only permits terminal events");
|
|
995
|
+
throw new Error(t("model.stream committed phase only permits terminal events"));
|
|
993
996
|
}
|
|
994
997
|
const terminal = value.event === "done" || value.event === "error";
|
|
995
998
|
if (value.terminal !== terminal)
|
|
996
|
-
throw new Error("model.stream data.terminal does not match event");
|
|
999
|
+
throw new Error(t("model.stream data.terminal does not match event"));
|
|
997
1000
|
if (value.partial !== null)
|
|
998
1001
|
assertJsonSafe(value.partial, "model.stream data.partial");
|
|
999
1002
|
if (terminal && value.event === "done" && value.error !== null) {
|
|
1000
|
-
throw new Error("model.stream done event cannot contain error");
|
|
1003
|
+
throw new Error(t("model.stream done event cannot contain error"));
|
|
1001
1004
|
}
|
|
1002
1005
|
if (terminal && value.event === "error") {
|
|
1003
1006
|
if (!isPlainRecord(value.error))
|
|
1004
|
-
throw new Error("model.stream error event requires error object");
|
|
1007
|
+
throw new Error(t("model.stream error event requires error object"));
|
|
1005
1008
|
const errorKeys = Object.keys(value.error);
|
|
1006
1009
|
if (errorKeys.some((key) => key !== "code" && key !== "message" && key !== "name")) {
|
|
1007
|
-
throw new Error("model.stream error has unsupported fields");
|
|
1010
|
+
throw new Error(t("model.stream error has unsupported fields"));
|
|
1008
1011
|
}
|
|
1009
1012
|
assertString(value.error.code, "model.stream data.error.code");
|
|
1010
1013
|
assertString(value.error.message, "model.stream data.error.message");
|
|
@@ -1012,7 +1015,7 @@ export function validateModelStreamEventDataV1(value) {
|
|
|
1012
1015
|
assertString(value.error.name, "model.stream data.error.name");
|
|
1013
1016
|
}
|
|
1014
1017
|
else if (value.error !== null) {
|
|
1015
|
-
throw new Error("model.stream non-terminal event cannot contain error");
|
|
1018
|
+
throw new Error(t("model.stream non-terminal event cannot contain error"));
|
|
1016
1019
|
}
|
|
1017
1020
|
return value;
|
|
1018
1021
|
}
|
|
@@ -1029,7 +1032,7 @@ export function modelStreamEventDefinition() {
|
|
|
1029
1032
|
}
|
|
1030
1033
|
export function validateToolResultEventDataV1(value) {
|
|
1031
1034
|
if (!isPlainRecord(value))
|
|
1032
|
-
throw new Error("tool.result data must be a plain object");
|
|
1035
|
+
throw new Error(t("tool.result data must be a plain object"));
|
|
1033
1036
|
const allowed = new Set([
|
|
1034
1037
|
"version",
|
|
1035
1038
|
"sessionId",
|
|
@@ -1042,54 +1045,54 @@ export function validateToolResultEventDataV1(value) {
|
|
|
1042
1045
|
]);
|
|
1043
1046
|
const unsupported = Object.keys(value).filter((key) => !allowed.has(key));
|
|
1044
1047
|
if (unsupported.length > 0)
|
|
1045
|
-
throw new Error(
|
|
1048
|
+
throw new Error(t("tool.result data has unsupported fields: {unsupported}", { unsupported: unsupported.join(", ") }));
|
|
1046
1049
|
for (const key of ["version", "sessionId", "entryId", "revision", "toolCallId", "toolName", "isError", "message"]) {
|
|
1047
1050
|
if (!(key in value))
|
|
1048
|
-
throw new Error(
|
|
1051
|
+
throw new Error(t("tool.result data is missing required field: {key}", { key }));
|
|
1049
1052
|
}
|
|
1050
1053
|
if (value.version !== 1)
|
|
1051
|
-
throw new Error("tool.result data.version must be 1");
|
|
1054
|
+
throw new Error(t("tool.result data.version must be 1"));
|
|
1052
1055
|
assertString(value.sessionId, "tool.result data.sessionId");
|
|
1053
1056
|
assertString(value.entryId, "tool.result data.entryId");
|
|
1054
1057
|
assertString(value.toolCallId, "tool.result data.toolCallId");
|
|
1055
1058
|
assertString(value.toolName, "tool.result data.toolName");
|
|
1056
1059
|
if (typeof value.isError !== "boolean")
|
|
1057
|
-
throw new Error("tool.result data.isError must be boolean");
|
|
1060
|
+
throw new Error(t("tool.result data.isError must be boolean"));
|
|
1058
1061
|
if (!isPlainRecord(value.message))
|
|
1059
|
-
throw new Error("tool.result data.message must be a tool result message object");
|
|
1062
|
+
throw new Error(t("tool.result data.message must be a tool result message object"));
|
|
1060
1063
|
if (value.message.role !== "toolResult")
|
|
1061
|
-
throw new Error("tool.result data.message.role must be toolResult");
|
|
1064
|
+
throw new Error(t("tool.result data.message.role must be toolResult"));
|
|
1062
1065
|
assertString(value.message.toolCallId, "tool.result data.message.toolCallId");
|
|
1063
1066
|
assertString(value.message.toolName, "tool.result data.message.toolName");
|
|
1064
1067
|
if (!Array.isArray(value.message.content))
|
|
1065
|
-
throw new Error("tool.result data.message.content must be an array");
|
|
1068
|
+
throw new Error(t("tool.result data.message.content must be an array"));
|
|
1066
1069
|
if (typeof value.message.isError !== "boolean")
|
|
1067
|
-
throw new Error("tool.result data.message.isError must be boolean");
|
|
1070
|
+
throw new Error(t("tool.result data.message.isError must be boolean"));
|
|
1068
1071
|
if (value.message.toolCallId !== value.toolCallId) {
|
|
1069
|
-
throw new Error("tool.result data.message.toolCallId must match toolCallId");
|
|
1072
|
+
throw new Error(t("tool.result data.message.toolCallId must match toolCallId"));
|
|
1070
1073
|
}
|
|
1071
1074
|
if (value.message.toolName !== value.toolName) {
|
|
1072
|
-
throw new Error("tool.result data.message.toolName must match toolName");
|
|
1075
|
+
throw new Error(t("tool.result data.message.toolName must match toolName"));
|
|
1073
1076
|
}
|
|
1074
1077
|
if (value.message.isError !== value.isError) {
|
|
1075
|
-
throw new Error("tool.result data.message.isError must match isError");
|
|
1078
|
+
throw new Error(t("tool.result data.message.isError must match isError"));
|
|
1076
1079
|
}
|
|
1077
1080
|
if (!isPlainRecord(value.revision))
|
|
1078
|
-
throw new Error("tool.result data.revision must be a plain object");
|
|
1081
|
+
throw new Error(t("tool.result data.revision must be a plain object"));
|
|
1079
1082
|
const revision = value.revision;
|
|
1080
1083
|
if (Object.keys(revision).sort().join(",") !== "leafId,sequence,sessionId,version") {
|
|
1081
|
-
throw new Error("tool.result data.revision has unsupported fields");
|
|
1084
|
+
throw new Error(t("tool.result data.revision has unsupported fields"));
|
|
1082
1085
|
}
|
|
1083
1086
|
if (revision.version !== 1)
|
|
1084
|
-
throw new Error("tool.result data.revision.version must be 1");
|
|
1087
|
+
throw new Error(t("tool.result data.revision.version must be 1"));
|
|
1085
1088
|
assertString(revision.sessionId, "tool.result data.revision.sessionId");
|
|
1086
1089
|
if (typeof revision.sequence !== "number" || !Number.isSafeInteger(revision.sequence) || revision.sequence < 0) {
|
|
1087
|
-
throw new Error("tool.result data.revision.sequence must be a non-negative safe integer");
|
|
1090
|
+
throw new Error(t("tool.result data.revision.sequence must be a non-negative safe integer"));
|
|
1088
1091
|
}
|
|
1089
1092
|
if (revision.leafId !== null)
|
|
1090
1093
|
assertString(revision.leafId, "tool.result data.revision.leafId");
|
|
1091
1094
|
if (revision.sessionId !== value.sessionId) {
|
|
1092
|
-
throw new Error("tool.result data.revision.sessionId must match sessionId");
|
|
1095
|
+
throw new Error(t("tool.result data.revision.sessionId must match sessionId"));
|
|
1093
1096
|
}
|
|
1094
1097
|
return value;
|
|
1095
1098
|
}
|
|
@@ -1106,36 +1109,36 @@ export function toolResultEventDefinition() {
|
|
|
1106
1109
|
}
|
|
1107
1110
|
export function validateToolCallEventDataV1(value) {
|
|
1108
1111
|
if (!isPlainRecord(value))
|
|
1109
|
-
throw new Error("tool.call data must be a plain object");
|
|
1112
|
+
throw new Error(t("tool.call data must be a plain object"));
|
|
1110
1113
|
const allowed = new Set(["version", "sessionId", "revision", "toolCallId", "toolName", "input"]);
|
|
1111
1114
|
const unsupported = Object.keys(value).filter((key) => !allowed.has(key));
|
|
1112
1115
|
if (unsupported.length > 0)
|
|
1113
|
-
throw new Error(
|
|
1116
|
+
throw new Error(t("tool.call data has unsupported fields: {unsupported}", { unsupported: unsupported.join(", ") }));
|
|
1114
1117
|
for (const key of ["version", "sessionId", "revision", "toolCallId", "toolName", "input"]) {
|
|
1115
1118
|
if (!(key in value))
|
|
1116
|
-
throw new Error(
|
|
1119
|
+
throw new Error(t("tool.call data is missing required field: {key}", { key }));
|
|
1117
1120
|
}
|
|
1118
1121
|
if (value.version !== 1)
|
|
1119
|
-
throw new Error("tool.call data.version must be 1");
|
|
1122
|
+
throw new Error(t("tool.call data.version must be 1"));
|
|
1120
1123
|
assertString(value.sessionId, "tool.call data.sessionId");
|
|
1121
1124
|
assertString(value.toolCallId, "tool.call data.toolCallId");
|
|
1122
1125
|
assertString(value.toolName, "tool.call data.toolName");
|
|
1123
1126
|
if (!isPlainRecord(value.revision))
|
|
1124
|
-
throw new Error("tool.call data.revision must be a plain object");
|
|
1127
|
+
throw new Error(t("tool.call data.revision must be a plain object"));
|
|
1125
1128
|
const revision = value.revision;
|
|
1126
1129
|
if (Object.keys(revision).sort().join(",") !== "leafId,sequence,sessionId,version") {
|
|
1127
|
-
throw new Error("tool.call data.revision has unsupported fields");
|
|
1130
|
+
throw new Error(t("tool.call data.revision has unsupported fields"));
|
|
1128
1131
|
}
|
|
1129
1132
|
if (revision.version !== 1)
|
|
1130
|
-
throw new Error("tool.call data.revision.version must be 1");
|
|
1133
|
+
throw new Error(t("tool.call data.revision.version must be 1"));
|
|
1131
1134
|
assertString(revision.sessionId, "tool.call data.revision.sessionId");
|
|
1132
1135
|
if (typeof revision.sequence !== "number" || !Number.isSafeInteger(revision.sequence) || revision.sequence < 0) {
|
|
1133
|
-
throw new Error("tool.call data.revision.sequence must be a non-negative safe integer");
|
|
1136
|
+
throw new Error(t("tool.call data.revision.sequence must be a non-negative safe integer"));
|
|
1134
1137
|
}
|
|
1135
1138
|
if (revision.leafId !== null)
|
|
1136
1139
|
assertString(revision.leafId, "tool.call data.revision.leafId");
|
|
1137
1140
|
if (revision.sessionId !== value.sessionId)
|
|
1138
|
-
throw new Error("tool.call data.revision.sessionId must match sessionId");
|
|
1141
|
+
throw new Error(t("tool.call data.revision.sessionId must match sessionId"));
|
|
1139
1142
|
assertJsonSafe(value.input, "tool.call data.input");
|
|
1140
1143
|
return value;
|
|
1141
1144
|
}
|
|
@@ -1152,7 +1155,7 @@ export function toolCallEventDefinition() {
|
|
|
1152
1155
|
}
|
|
1153
1156
|
export function validateToolExecuteEventDataV1(value) {
|
|
1154
1157
|
if (!isPlainRecord(value))
|
|
1155
|
-
throw new Error("tool.execute data must be a plain object");
|
|
1158
|
+
throw new Error(t("tool.execute data must be a plain object"));
|
|
1156
1159
|
const allowed = new Set([
|
|
1157
1160
|
"version",
|
|
1158
1161
|
"sessionId",
|
|
@@ -1165,18 +1168,18 @@ export function validateToolExecuteEventDataV1(value) {
|
|
|
1165
1168
|
]);
|
|
1166
1169
|
const unsupported = Object.keys(value).filter((key) => !allowed.has(key));
|
|
1167
1170
|
if (unsupported.length > 0)
|
|
1168
|
-
throw new Error(
|
|
1171
|
+
throw new Error(t("tool.execute data has unsupported fields: {unsupported}", { unsupported: unsupported.join(", ") }));
|
|
1169
1172
|
for (const key of ["version", "sessionId", "revision", "toolCallId", "toolName", "input", "isError", "content"]) {
|
|
1170
1173
|
if (!(key in value))
|
|
1171
|
-
throw new Error(
|
|
1174
|
+
throw new Error(t("tool.execute data is missing required field: {key}", { key }));
|
|
1172
1175
|
}
|
|
1173
1176
|
if (value.version !== 1)
|
|
1174
|
-
throw new Error("tool.execute data.version must be 1");
|
|
1177
|
+
throw new Error(t("tool.execute data.version must be 1"));
|
|
1175
1178
|
assertString(value.sessionId, "tool.execute data.sessionId");
|
|
1176
1179
|
assertString(value.toolCallId, "tool.execute data.toolCallId");
|
|
1177
1180
|
assertString(value.toolName, "tool.execute data.toolName");
|
|
1178
1181
|
if (typeof value.isError !== "boolean")
|
|
1179
|
-
throw new Error("tool.execute data.isError must be boolean");
|
|
1182
|
+
throw new Error(t("tool.execute data.isError must be boolean"));
|
|
1180
1183
|
assertJsonSafe(value.input, "tool.execute data.input");
|
|
1181
1184
|
validateToolResultRawEventDataV1({
|
|
1182
1185
|
version: 1,
|
|
@@ -1202,39 +1205,39 @@ export function toolExecuteEventDefinition() {
|
|
|
1202
1205
|
}
|
|
1203
1206
|
export function validateToolCommitEventDataV1(value) {
|
|
1204
1207
|
if (!isPlainRecord(value))
|
|
1205
|
-
throw new Error("tool.commit data must be a plain object");
|
|
1208
|
+
throw new Error(t("tool.commit data must be a plain object"));
|
|
1206
1209
|
const allowed = new Set(["version", "sessionId", "entryId", "revision", "toolCallId", "toolName", "isError"]);
|
|
1207
1210
|
const unsupported = Object.keys(value).filter((key) => !allowed.has(key));
|
|
1208
1211
|
if (unsupported.length > 0)
|
|
1209
|
-
throw new Error(
|
|
1212
|
+
throw new Error(t("tool.commit data has unsupported fields: {unsupported}", { unsupported: unsupported.join(", ") }));
|
|
1210
1213
|
for (const key of ["version", "sessionId", "entryId", "revision", "toolCallId", "toolName", "isError"]) {
|
|
1211
1214
|
if (!(key in value))
|
|
1212
|
-
throw new Error(
|
|
1215
|
+
throw new Error(t("tool.commit data is missing required field: {key}", { key }));
|
|
1213
1216
|
}
|
|
1214
1217
|
if (value.version !== 1)
|
|
1215
|
-
throw new Error("tool.commit data.version must be 1");
|
|
1218
|
+
throw new Error(t("tool.commit data.version must be 1"));
|
|
1216
1219
|
assertString(value.sessionId, "tool.commit data.sessionId");
|
|
1217
1220
|
assertString(value.entryId, "tool.commit data.entryId");
|
|
1218
1221
|
assertString(value.toolCallId, "tool.commit data.toolCallId");
|
|
1219
1222
|
assertString(value.toolName, "tool.commit data.toolName");
|
|
1220
1223
|
if (typeof value.isError !== "boolean")
|
|
1221
|
-
throw new Error("tool.commit data.isError must be boolean");
|
|
1224
|
+
throw new Error(t("tool.commit data.isError must be boolean"));
|
|
1222
1225
|
if (!isPlainRecord(value.revision))
|
|
1223
|
-
throw new Error("tool.commit data.revision must be a plain object");
|
|
1226
|
+
throw new Error(t("tool.commit data.revision must be a plain object"));
|
|
1224
1227
|
const revision = value.revision;
|
|
1225
1228
|
if (Object.keys(revision).sort().join(",") !== "leafId,sequence,sessionId,version") {
|
|
1226
|
-
throw new Error("tool.commit data.revision has unsupported fields");
|
|
1229
|
+
throw new Error(t("tool.commit data.revision has unsupported fields"));
|
|
1227
1230
|
}
|
|
1228
1231
|
if (revision.version !== 1)
|
|
1229
|
-
throw new Error("tool.commit data.revision.version must be 1");
|
|
1232
|
+
throw new Error(t("tool.commit data.revision.version must be 1"));
|
|
1230
1233
|
assertString(revision.sessionId, "tool.commit data.revision.sessionId");
|
|
1231
1234
|
if (typeof revision.sequence !== "number" || !Number.isSafeInteger(revision.sequence) || revision.sequence < 0) {
|
|
1232
|
-
throw new Error("tool.commit data.revision.sequence must be a non-negative safe integer");
|
|
1235
|
+
throw new Error(t("tool.commit data.revision.sequence must be a non-negative safe integer"));
|
|
1233
1236
|
}
|
|
1234
1237
|
if (revision.leafId !== null)
|
|
1235
1238
|
assertString(revision.leafId, "tool.commit data.revision.leafId");
|
|
1236
1239
|
if (revision.sessionId !== value.sessionId)
|
|
1237
|
-
throw new Error("tool.commit data.revision.sessionId must match sessionId");
|
|
1240
|
+
throw new Error(t("tool.commit data.revision.sessionId must match sessionId"));
|
|
1238
1241
|
return value;
|
|
1239
1242
|
}
|
|
1240
1243
|
export function toolCommitEventDefinition() {
|
|
@@ -1250,49 +1253,49 @@ export function toolCommitEventDefinition() {
|
|
|
1250
1253
|
}
|
|
1251
1254
|
export function validateToolResultRawEventDataV1(value) {
|
|
1252
1255
|
if (!isPlainRecord(value))
|
|
1253
|
-
throw new Error("tool.result.raw data must be a plain object");
|
|
1256
|
+
throw new Error(t("tool.result.raw data must be a plain object"));
|
|
1254
1257
|
const allowed = new Set(["version", "sessionId", "revision", "toolCallId", "toolName", "isError", "content"]);
|
|
1255
1258
|
const unsupported = Object.keys(value).filter((key) => !allowed.has(key));
|
|
1256
1259
|
if (unsupported.length > 0) {
|
|
1257
|
-
throw new Error(
|
|
1260
|
+
throw new Error(t("tool.result.raw data has unsupported fields: {unsupported}", { unsupported: unsupported.join(", ") }));
|
|
1258
1261
|
}
|
|
1259
1262
|
for (const key of ["version", "sessionId", "revision", "toolCallId", "toolName", "isError", "content"]) {
|
|
1260
1263
|
if (!(key in value))
|
|
1261
|
-
throw new Error(
|
|
1264
|
+
throw new Error(t("tool.result.raw data is missing required field: {key}", { key }));
|
|
1262
1265
|
}
|
|
1263
1266
|
if (value.version !== 1)
|
|
1264
|
-
throw new Error("tool.result.raw data.version must be 1");
|
|
1267
|
+
throw new Error(t("tool.result.raw data.version must be 1"));
|
|
1265
1268
|
assertString(value.sessionId, "tool.result.raw data.sessionId");
|
|
1266
1269
|
assertString(value.toolCallId, "tool.result.raw data.toolCallId");
|
|
1267
1270
|
assertString(value.toolName, "tool.result.raw data.toolName");
|
|
1268
1271
|
if (typeof value.isError !== "boolean")
|
|
1269
|
-
throw new Error("tool.result.raw data.isError must be boolean");
|
|
1272
|
+
throw new Error(t("tool.result.raw data.isError must be boolean"));
|
|
1270
1273
|
if (!isPlainRecord(value.revision))
|
|
1271
|
-
throw new Error("tool.result.raw data.revision must be a plain object");
|
|
1274
|
+
throw new Error(t("tool.result.raw data.revision must be a plain object"));
|
|
1272
1275
|
const revision = value.revision;
|
|
1273
1276
|
if (Object.keys(revision).sort().join(",") !== "leafId,sequence,sessionId,version") {
|
|
1274
|
-
throw new Error("tool.result.raw data.revision has unsupported fields");
|
|
1277
|
+
throw new Error(t("tool.result.raw data.revision has unsupported fields"));
|
|
1275
1278
|
}
|
|
1276
1279
|
if (revision.version !== 1)
|
|
1277
|
-
throw new Error("tool.result.raw data.revision.version must be 1");
|
|
1280
|
+
throw new Error(t("tool.result.raw data.revision.version must be 1"));
|
|
1278
1281
|
assertString(revision.sessionId, "tool.result.raw data.revision.sessionId");
|
|
1279
1282
|
if (typeof revision.sequence !== "number" || !Number.isSafeInteger(revision.sequence) || revision.sequence < 0) {
|
|
1280
|
-
throw new Error("tool.result.raw data.revision.sequence must be a non-negative safe integer");
|
|
1283
|
+
throw new Error(t("tool.result.raw data.revision.sequence must be a non-negative safe integer"));
|
|
1281
1284
|
}
|
|
1282
1285
|
if (revision.leafId !== null)
|
|
1283
1286
|
assertString(revision.leafId, "tool.result.raw data.revision.leafId");
|
|
1284
1287
|
if (revision.sessionId !== value.sessionId) {
|
|
1285
|
-
throw new Error("tool.result.raw data.revision.sessionId must match sessionId");
|
|
1288
|
+
throw new Error(t("tool.result.raw data.revision.sessionId must match sessionId"));
|
|
1286
1289
|
}
|
|
1287
1290
|
if (!Array.isArray(value.content))
|
|
1288
|
-
throw new Error("tool.result.raw data.content must be an array");
|
|
1291
|
+
throw new Error(t("tool.result.raw data.content must be an array"));
|
|
1289
1292
|
for (const [index, content] of value.content.entries()) {
|
|
1290
1293
|
if (!isPlainRecord(content))
|
|
1291
|
-
throw new Error(
|
|
1294
|
+
throw new Error(t("tool.result.raw data.content[{index}] must be a plain object", { index }));
|
|
1292
1295
|
if (content.type === "text") {
|
|
1293
1296
|
const keys = Object.keys(content).sort().join(",");
|
|
1294
1297
|
if (keys !== "text,type" && keys !== "text,textSignature,type") {
|
|
1295
|
-
throw new Error(
|
|
1298
|
+
throw new Error(t("tool.result.raw data.content[{index}] has unsupported text fields", { index }));
|
|
1296
1299
|
}
|
|
1297
1300
|
assertString(content.text, `tool.result.raw data.content[${index}].text`);
|
|
1298
1301
|
if (content.textSignature !== undefined) {
|
|
@@ -1302,13 +1305,13 @@ export function validateToolResultRawEventDataV1(value) {
|
|
|
1302
1305
|
}
|
|
1303
1306
|
if (content.type === "image") {
|
|
1304
1307
|
if (Object.keys(content).sort().join(",") !== "data,mimeType,type") {
|
|
1305
|
-
throw new Error(
|
|
1308
|
+
throw new Error(t("tool.result.raw data.content[{index}] has unsupported image fields", { index }));
|
|
1306
1309
|
}
|
|
1307
1310
|
assertString(content.data, `tool.result.raw data.content[${index}].data`);
|
|
1308
1311
|
assertString(content.mimeType, `tool.result.raw data.content[${index}].mimeType`);
|
|
1309
1312
|
continue;
|
|
1310
1313
|
}
|
|
1311
|
-
throw new Error(
|
|
1314
|
+
throw new Error(t("tool.result.raw data.content[{index}].type is invalid", { index }));
|
|
1312
1315
|
}
|
|
1313
1316
|
return value;
|
|
1314
1317
|
}
|
|
@@ -1327,50 +1330,50 @@ export const TOOL_RESULT_TRANSFORM_EVENT_ID = "tool.result.transform";
|
|
|
1327
1330
|
export const TOOL_RESULT_TRANSFORM_EVENT_VERSION = 1;
|
|
1328
1331
|
export function validateToolResultTransformEventDataV1(value) {
|
|
1329
1332
|
if (!isPlainRecord(value))
|
|
1330
|
-
throw new Error("tool.result.transform data must be a plain object");
|
|
1333
|
+
throw new Error(t("tool.result.transform data must be a plain object"));
|
|
1331
1334
|
const allowed = new Set(["version", "sessionId", "revision", "toolCallId", "toolName", "isError", "content"]);
|
|
1332
1335
|
const unsupported = Object.keys(value).filter((key) => !allowed.has(key));
|
|
1333
1336
|
if (unsupported.length > 0) {
|
|
1334
|
-
throw new Error(
|
|
1337
|
+
throw new Error(t("tool.result.transform data has unsupported fields: {unsupported}", { unsupported: unsupported.join(", ") }));
|
|
1335
1338
|
}
|
|
1336
1339
|
for (const key of ["version", "sessionId", "revision", "toolCallId", "toolName", "isError", "content"]) {
|
|
1337
1340
|
if (!(key in value))
|
|
1338
|
-
throw new Error(
|
|
1341
|
+
throw new Error(t("tool.result.transform data is missing required field: {key}", { key }));
|
|
1339
1342
|
}
|
|
1340
1343
|
if (value.version !== 1)
|
|
1341
|
-
throw new Error("tool.result.transform data.version must be 1");
|
|
1344
|
+
throw new Error(t("tool.result.transform data.version must be 1"));
|
|
1342
1345
|
assertString(value.sessionId, "tool.result.transform data.sessionId");
|
|
1343
1346
|
assertString(value.toolCallId, "tool.result.transform data.toolCallId");
|
|
1344
1347
|
assertString(value.toolName, "tool.result.transform data.toolName");
|
|
1345
1348
|
if (typeof value.isError !== "boolean")
|
|
1346
|
-
throw new Error("tool.result.transform data.isError must be boolean");
|
|
1349
|
+
throw new Error(t("tool.result.transform data.isError must be boolean"));
|
|
1347
1350
|
if (!isPlainRecord(value.revision))
|
|
1348
|
-
throw new Error("tool.result.transform data.revision must be a plain object");
|
|
1351
|
+
throw new Error(t("tool.result.transform data.revision must be a plain object"));
|
|
1349
1352
|
const revision = value.revision;
|
|
1350
1353
|
if (Object.keys(revision).sort().join(",") !== "leafId,sequence,sessionId,version") {
|
|
1351
|
-
throw new Error("tool.result.transform data.revision has unsupported fields");
|
|
1354
|
+
throw new Error(t("tool.result.transform data.revision has unsupported fields"));
|
|
1352
1355
|
}
|
|
1353
1356
|
if (revision.version !== 1)
|
|
1354
|
-
throw new Error("tool.result.transform data.revision.version must be 1");
|
|
1357
|
+
throw new Error(t("tool.result.transform data.revision.version must be 1"));
|
|
1355
1358
|
assertString(revision.sessionId, "tool.result.transform data.revision.sessionId");
|
|
1356
1359
|
if (typeof revision.sequence !== "number" || !Number.isSafeInteger(revision.sequence) || revision.sequence < 0) {
|
|
1357
|
-
throw new Error("tool.result.transform data.revision.sequence must be a non-negative safe integer");
|
|
1360
|
+
throw new Error(t("tool.result.transform data.revision.sequence must be a non-negative safe integer"));
|
|
1358
1361
|
}
|
|
1359
1362
|
if (revision.leafId !== null)
|
|
1360
1363
|
assertString(revision.leafId, "tool.result.transform data.revision.leafId");
|
|
1361
1364
|
if (revision.sessionId !== value.sessionId) {
|
|
1362
|
-
throw new Error("tool.result.transform data.revision.sessionId must match sessionId");
|
|
1365
|
+
throw new Error(t("tool.result.transform data.revision.sessionId must match sessionId"));
|
|
1363
1366
|
}
|
|
1364
1367
|
if (!Array.isArray(value.content))
|
|
1365
|
-
throw new Error("tool.result.transform data.content must be an array");
|
|
1368
|
+
throw new Error(t("tool.result.transform data.content must be an array"));
|
|
1366
1369
|
for (const [index, content] of value.content.entries()) {
|
|
1367
1370
|
if (!isPlainRecord(content)) {
|
|
1368
|
-
throw new Error(
|
|
1371
|
+
throw new Error(t("tool.result.transform data.content[{index}] must be a plain object", { index }));
|
|
1369
1372
|
}
|
|
1370
1373
|
if (content.type === "text") {
|
|
1371
1374
|
const keys = Object.keys(content).sort().join(",");
|
|
1372
1375
|
if (keys !== "text,type" && keys !== "text,textSignature,type") {
|
|
1373
|
-
throw new Error(
|
|
1376
|
+
throw new Error(t("tool.result.transform data.content[{index}] has unsupported text fields", { index }));
|
|
1374
1377
|
}
|
|
1375
1378
|
assertString(content.text, `tool.result.transform data.content[${index}].text`);
|
|
1376
1379
|
if (content.textSignature !== undefined) {
|
|
@@ -1380,13 +1383,13 @@ export function validateToolResultTransformEventDataV1(value) {
|
|
|
1380
1383
|
}
|
|
1381
1384
|
if (content.type === "image") {
|
|
1382
1385
|
if (Object.keys(content).sort().join(",") !== "data,mimeType,type") {
|
|
1383
|
-
throw new Error(
|
|
1386
|
+
throw new Error(t("tool.result.transform data.content[{index}] has unsupported image fields", { index }));
|
|
1384
1387
|
}
|
|
1385
1388
|
assertString(content.data, `tool.result.transform data.content[${index}].data`);
|
|
1386
1389
|
assertString(content.mimeType, `tool.result.transform data.content[${index}].mimeType`);
|
|
1387
1390
|
continue;
|
|
1388
1391
|
}
|
|
1389
|
-
throw new Error(
|
|
1392
|
+
throw new Error(t("tool.result.transform data.content[{index}].type is invalid", { index }));
|
|
1390
1393
|
}
|
|
1391
1394
|
return value;
|
|
1392
1395
|
}
|
|
@@ -1403,21 +1406,21 @@ export function toolResultTransformEventDefinition() {
|
|
|
1403
1406
|
}
|
|
1404
1407
|
export function validateOperationEndEventDataV1(value) {
|
|
1405
1408
|
if (!isPlainRecord(value))
|
|
1406
|
-
throw new Error("operation.end data must be a plain object");
|
|
1409
|
+
throw new Error(t("operation.end data must be a plain object"));
|
|
1407
1410
|
const allowed = new Set(["version", "operationId", "operationKind", "status", "errorMessage", "reason"]);
|
|
1408
1411
|
const unsupported = Object.keys(value).filter((key) => !allowed.has(key));
|
|
1409
1412
|
if (unsupported.length > 0)
|
|
1410
|
-
throw new Error(
|
|
1413
|
+
throw new Error(t("operation.end data has unsupported fields: {unsupported}", { unsupported: unsupported.join(", ") }));
|
|
1411
1414
|
for (const key of ["version", "operationId", "operationKind", "status"]) {
|
|
1412
1415
|
if (!(key in value))
|
|
1413
|
-
throw new Error(
|
|
1416
|
+
throw new Error(t("operation.end data is missing required field: {key}", { key }));
|
|
1414
1417
|
}
|
|
1415
1418
|
if (value.version !== 1)
|
|
1416
|
-
throw new Error("operation.end data.version must be 1");
|
|
1419
|
+
throw new Error(t("operation.end data.version must be 1"));
|
|
1417
1420
|
assertString(value.operationId, "operation.end data.operationId");
|
|
1418
1421
|
assertString(value.operationKind, "operation.end data.operationKind");
|
|
1419
1422
|
if (value.status !== "succeeded" && value.status !== "failed" && value.status !== "cancelled") {
|
|
1420
|
-
throw new Error("operation.end data.status is invalid");
|
|
1423
|
+
throw new Error(t("operation.end data.status is invalid"));
|
|
1421
1424
|
}
|
|
1422
1425
|
if (value.errorMessage !== undefined)
|
|
1423
1426
|
assertString(value.errorMessage, "operation.end data.errorMessage");
|
|
@@ -1442,7 +1445,7 @@ const capabilityCallEvents = new Set(["start", "cancel", "end"]);
|
|
|
1442
1445
|
const capabilityCallStatuses = new Set(["succeeded", "failed", "cancelled"]);
|
|
1443
1446
|
export function validateCapabilityCallEventDataV1(value) {
|
|
1444
1447
|
if (!isPlainRecord(value))
|
|
1445
|
-
throw new Error("capability.call data must be a plain object");
|
|
1448
|
+
throw new Error(t("capability.call data must be a plain object"));
|
|
1446
1449
|
const allowed = new Set([
|
|
1447
1450
|
"version",
|
|
1448
1451
|
"operationId",
|
|
@@ -1457,7 +1460,7 @@ export function validateCapabilityCallEventDataV1(value) {
|
|
|
1457
1460
|
]);
|
|
1458
1461
|
const unsupported = Object.keys(value).filter((key) => !allowed.has(key));
|
|
1459
1462
|
if (unsupported.length > 0) {
|
|
1460
|
-
throw new Error(
|
|
1463
|
+
throw new Error(t("capability.call data has unsupported fields: {unsupported}", { unsupported: unsupported.join(", ") }));
|
|
1461
1464
|
}
|
|
1462
1465
|
for (const key of [
|
|
1463
1466
|
"version",
|
|
@@ -1470,59 +1473,59 @@ export function validateCapabilityCallEventDataV1(value) {
|
|
|
1470
1473
|
"event",
|
|
1471
1474
|
]) {
|
|
1472
1475
|
if (!(key in value))
|
|
1473
|
-
throw new Error(
|
|
1476
|
+
throw new Error(t("capability.call data is missing required field: {key}", { key }));
|
|
1474
1477
|
}
|
|
1475
1478
|
if (value.version !== 1)
|
|
1476
|
-
throw new Error("capability.call data.version must be 1");
|
|
1479
|
+
throw new Error(t("capability.call data.version must be 1"));
|
|
1477
1480
|
assertString(value.operationId, "capability.call data.operationId");
|
|
1478
1481
|
assertString(value.capabilityId, "capability.call data.capabilityId");
|
|
1479
1482
|
if (typeof value.capabilityVersion !== "number" ||
|
|
1480
1483
|
!Number.isSafeInteger(value.capabilityVersion) ||
|
|
1481
1484
|
value.capabilityVersion < 1) {
|
|
1482
|
-
throw new Error("capability.call data.capabilityVersion must be a positive safe integer");
|
|
1485
|
+
throw new Error(t("capability.call data.capabilityVersion must be a positive safe integer"));
|
|
1483
1486
|
}
|
|
1484
1487
|
if (value.capabilityKind !== "service" &&
|
|
1485
1488
|
value.capabilityKind !== "contribution" &&
|
|
1486
1489
|
value.capabilityKind !== "transform") {
|
|
1487
|
-
throw new Error("capability.call data.capabilityKind is invalid");
|
|
1490
|
+
throw new Error(t("capability.call data.capabilityKind is invalid"));
|
|
1488
1491
|
}
|
|
1489
1492
|
assertString(value.callerPluginId, "capability.call data.callerPluginId");
|
|
1490
1493
|
assertString(value.providerPluginId, "capability.call data.providerPluginId");
|
|
1491
1494
|
if (typeof value.event !== "string" || !capabilityCallEvents.has(value.event)) {
|
|
1492
|
-
throw new Error("capability.call data.event is invalid");
|
|
1495
|
+
throw new Error(t("capability.call data.event is invalid"));
|
|
1493
1496
|
}
|
|
1494
1497
|
if ((value.event === "start" || value.event === "cancel") && value.status !== undefined) {
|
|
1495
|
-
throw new Error("capability.call start/cancel must not include status");
|
|
1498
|
+
throw new Error(t("capability.call start/cancel must not include status"));
|
|
1496
1499
|
}
|
|
1497
1500
|
if (value.event === "end" && value.status === undefined) {
|
|
1498
|
-
throw new Error("capability.call end requires status");
|
|
1501
|
+
throw new Error(t("capability.call end requires status"));
|
|
1499
1502
|
}
|
|
1500
1503
|
if (value.status !== undefined) {
|
|
1501
1504
|
if (typeof value.status !== "string" || !capabilityCallStatuses.has(value.status)) {
|
|
1502
|
-
throw new Error("capability.call data.status is invalid");
|
|
1505
|
+
throw new Error(t("capability.call data.status is invalid"));
|
|
1503
1506
|
}
|
|
1504
1507
|
}
|
|
1505
1508
|
if (value.error !== undefined) {
|
|
1506
1509
|
if (!isPlainRecord(value.error))
|
|
1507
|
-
throw new Error("capability.call data.error must be a plain object");
|
|
1510
|
+
throw new Error(t("capability.call data.error must be a plain object"));
|
|
1508
1511
|
const errorKeys = Object.keys(value.error);
|
|
1509
1512
|
if (errorKeys.some((key) => key !== "code" && key !== "message" && key !== "name")) {
|
|
1510
|
-
throw new Error("capability.call data.error has unsupported fields");
|
|
1513
|
+
throw new Error(t("capability.call data.error has unsupported fields"));
|
|
1511
1514
|
}
|
|
1512
1515
|
if (!("code" in value.error))
|
|
1513
|
-
throw new Error("capability.call data.error is missing required field: code");
|
|
1516
|
+
throw new Error(t("capability.call data.error is missing required field: code"));
|
|
1514
1517
|
if (!("message" in value.error))
|
|
1515
|
-
throw new Error("capability.call data.error is missing required field: message");
|
|
1518
|
+
throw new Error(t("capability.call data.error is missing required field: message"));
|
|
1516
1519
|
assertString(value.error.code, "capability.call data.error.code");
|
|
1517
1520
|
assertString(value.error.message, "capability.call data.error.message");
|
|
1518
1521
|
if (value.error.name !== undefined)
|
|
1519
1522
|
assertString(value.error.name, "capability.call data.error.name");
|
|
1520
1523
|
}
|
|
1521
1524
|
if (value.event !== "end" && value.error !== undefined) {
|
|
1522
|
-
throw new Error("capability.call start/cancel must not include error");
|
|
1525
|
+
throw new Error(t("capability.call start/cancel must not include error"));
|
|
1523
1526
|
}
|
|
1524
1527
|
if (value.event === "end" && value.status === "succeeded" && value.error !== undefined) {
|
|
1525
|
-
throw new Error("capability.call succeeded end must not include error");
|
|
1528
|
+
throw new Error(t("capability.call succeeded end must not include error"));
|
|
1526
1529
|
}
|
|
1527
1530
|
return value;
|
|
1528
1531
|
}
|
|
@@ -1543,13 +1546,13 @@ export const OPERATION_STEP_EVENT_ID = "operation.step";
|
|
|
1543
1546
|
export const OPERATION_STEP_EVENT_VERSION = 1;
|
|
1544
1547
|
export function validateOperationStartEventDataV1(value) {
|
|
1545
1548
|
if (!isPlainRecord(value))
|
|
1546
|
-
throw new Error("operation.start data must be a plain object");
|
|
1549
|
+
throw new Error(t("operation.start data must be a plain object"));
|
|
1547
1550
|
const keys = Object.keys(value).sort().join(",");
|
|
1548
1551
|
if (keys !== "operationId,operationKind,version") {
|
|
1549
|
-
throw new Error("operation.start data has unsupported fields");
|
|
1552
|
+
throw new Error(t("operation.start data has unsupported fields"));
|
|
1550
1553
|
}
|
|
1551
1554
|
if (value.version !== 1)
|
|
1552
|
-
throw new Error("operation.start data.version must be 1");
|
|
1555
|
+
throw new Error(t("operation.start data.version must be 1"));
|
|
1553
1556
|
assertString(value.operationId, "operation.start data.operationId");
|
|
1554
1557
|
assertString(value.operationKind, "operation.start data.operationKind");
|
|
1555
1558
|
return value;
|
|
@@ -1567,17 +1570,17 @@ export function operationStartEventDefinition() {
|
|
|
1567
1570
|
}
|
|
1568
1571
|
export function validateOperationStepEventDataV1(value) {
|
|
1569
1572
|
if (!isPlainRecord(value))
|
|
1570
|
-
throw new Error("operation.step data must be a plain object");
|
|
1573
|
+
throw new Error(t("operation.step data must be a plain object"));
|
|
1571
1574
|
const allowed = new Set(["version", "operationId", "operationKind", "step", "message", "data"]);
|
|
1572
1575
|
const unsupported = Object.keys(value).filter((key) => !allowed.has(key));
|
|
1573
1576
|
if (unsupported.length > 0)
|
|
1574
|
-
throw new Error("operation.step data has unsupported fields");
|
|
1577
|
+
throw new Error(t("operation.step data has unsupported fields"));
|
|
1575
1578
|
if (value.version !== 1)
|
|
1576
|
-
throw new Error("operation.step data.version must be 1");
|
|
1579
|
+
throw new Error(t("operation.step data.version must be 1"));
|
|
1577
1580
|
assertString(value.operationId, "operation.step data.operationId");
|
|
1578
1581
|
assertString(value.operationKind, "operation.step data.operationKind");
|
|
1579
1582
|
if (typeof value.step !== "number" || !Number.isSafeInteger(value.step) || value.step < 1) {
|
|
1580
|
-
throw new Error("operation.step data.step must be a positive safe integer");
|
|
1583
|
+
throw new Error(t("operation.step data.step must be a positive safe integer"));
|
|
1581
1584
|
}
|
|
1582
1585
|
if (value.message !== undefined)
|
|
1583
1586
|
assertString(value.message, "operation.step data.message");
|
|
@@ -1600,13 +1603,13 @@ export const OPERATION_CANCEL_EVENT_ID = "operation.cancel";
|
|
|
1600
1603
|
export const OPERATION_CANCEL_EVENT_VERSION = 1;
|
|
1601
1604
|
export function validateOperationCancelEventDataV1(value) {
|
|
1602
1605
|
if (!isPlainRecord(value))
|
|
1603
|
-
throw new Error("operation.cancel data must be a plain object");
|
|
1606
|
+
throw new Error(t("operation.cancel data must be a plain object"));
|
|
1604
1607
|
const keys = Object.keys(value).sort().join(",");
|
|
1605
1608
|
if (keys !== "operationId,operationKind,version") {
|
|
1606
|
-
throw new Error("operation.cancel data has unsupported fields");
|
|
1609
|
+
throw new Error(t("operation.cancel data has unsupported fields"));
|
|
1607
1610
|
}
|
|
1608
1611
|
if (value.version !== 1)
|
|
1609
|
-
throw new Error("operation.cancel data.version must be 1");
|
|
1612
|
+
throw new Error(t("operation.cancel data.version must be 1"));
|
|
1610
1613
|
assertString(value.operationId, "operation.cancel data.operationId");
|
|
1611
1614
|
assertString(value.operationKind, "operation.cancel data.operationKind");
|
|
1612
1615
|
return value;
|
|
@@ -1630,28 +1633,28 @@ export const SESSION_COMPACTION_FAILED_EVENT_ID = "session.compaction.failed";
|
|
|
1630
1633
|
export const SESSION_COMPACTION_FAILED_EVENT_VERSION = 1;
|
|
1631
1634
|
function assertNonNegativeSafeInteger(value, label) {
|
|
1632
1635
|
if (typeof value !== "number" || !Number.isSafeInteger(value) || value < 0) {
|
|
1633
|
-
throw new Error(
|
|
1636
|
+
throw new Error(t("{label} must be a non-negative safe integer", { label }));
|
|
1634
1637
|
}
|
|
1635
1638
|
}
|
|
1636
1639
|
function assertPositiveSafeInteger(value, label) {
|
|
1637
1640
|
if (typeof value !== "number" || !Number.isSafeInteger(value) || value < 1) {
|
|
1638
|
-
throw new Error(
|
|
1641
|
+
throw new Error(t("{label} must be a positive safe integer", { label }));
|
|
1639
1642
|
}
|
|
1640
1643
|
}
|
|
1641
1644
|
export function validateSessionAutoRetryEventDataV1(value) {
|
|
1642
1645
|
if (!isPlainRecord(value))
|
|
1643
|
-
throw new Error("session.auto.retry data must be a plain object");
|
|
1646
|
+
throw new Error(t("session.auto.retry data must be a plain object"));
|
|
1644
1647
|
const allowed = new Set(["version", "sessionId", "attempt", "maxAttempts", "delayMs", "errorMessage"]);
|
|
1645
1648
|
const unsupported = Object.keys(value).filter((key) => !allowed.has(key));
|
|
1646
1649
|
if (unsupported.length > 0) {
|
|
1647
|
-
throw new Error(
|
|
1650
|
+
throw new Error(t("session.auto.retry data has unsupported fields: {unsupported}", { unsupported: unsupported.join(", ") }));
|
|
1648
1651
|
}
|
|
1649
1652
|
for (const key of ["version", "sessionId", "attempt", "maxAttempts", "delayMs", "errorMessage"]) {
|
|
1650
1653
|
if (!(key in value))
|
|
1651
|
-
throw new Error(
|
|
1654
|
+
throw new Error(t("session.auto.retry data is missing required field: {key}", { key }));
|
|
1652
1655
|
}
|
|
1653
1656
|
if (value.version !== 1)
|
|
1654
|
-
throw new Error("session.auto.retry data.version must be 1");
|
|
1657
|
+
throw new Error(t("session.auto.retry data.version must be 1"));
|
|
1655
1658
|
assertString(value.sessionId, "session.auto.retry data.sessionId");
|
|
1656
1659
|
assertPositiveSafeInteger(value.attempt, "session.auto.retry data.attempt");
|
|
1657
1660
|
assertPositiveSafeInteger(value.maxAttempts, "session.auto.retry data.maxAttempts");
|
|
@@ -1678,7 +1681,7 @@ function assertOptionalPositiveSafeInteger(value, label) {
|
|
|
1678
1681
|
}
|
|
1679
1682
|
export function validateSessionCompactionDecisionEventDataV1(value) {
|
|
1680
1683
|
if (!isPlainRecord(value))
|
|
1681
|
-
throw new Error("session.compaction.decision data must be a plain object");
|
|
1684
|
+
throw new Error(t("session.compaction.decision data must be a plain object"));
|
|
1682
1685
|
const allowed = new Set([
|
|
1683
1686
|
"version",
|
|
1684
1687
|
"sessionId",
|
|
@@ -1692,24 +1695,26 @@ export function validateSessionCompactionDecisionEventDataV1(value) {
|
|
|
1692
1695
|
]);
|
|
1693
1696
|
const unsupported = Object.keys(value).filter((key) => !allowed.has(key));
|
|
1694
1697
|
if (unsupported.length > 0) {
|
|
1695
|
-
throw new Error(
|
|
1698
|
+
throw new Error(t("session.compaction.decision data has unsupported fields: {unsupported}", {
|
|
1699
|
+
unsupported: unsupported.join(", "),
|
|
1700
|
+
}));
|
|
1696
1701
|
}
|
|
1697
1702
|
for (const key of ["version", "sessionId", "reason", "compact", "willRetry"]) {
|
|
1698
1703
|
if (!(key in value))
|
|
1699
|
-
throw new Error(
|
|
1704
|
+
throw new Error(t("session.compaction.decision data is missing required field: {key}", { key }));
|
|
1700
1705
|
}
|
|
1701
1706
|
if (value.version !== 1)
|
|
1702
|
-
throw new Error("session.compaction.decision data.version must be 1");
|
|
1707
|
+
throw new Error(t("session.compaction.decision data.version must be 1"));
|
|
1703
1708
|
assertString(value.sessionId, "session.compaction.decision data.sessionId");
|
|
1704
1709
|
if (typeof value.reason !== "string" ||
|
|
1705
1710
|
!sessionCompactionDecisionReasons.has(value.reason)) {
|
|
1706
|
-
throw new Error("session.compaction.decision data.reason is invalid");
|
|
1711
|
+
throw new Error(t("session.compaction.decision data.reason is invalid"));
|
|
1707
1712
|
}
|
|
1708
1713
|
if (typeof value.compact !== "boolean") {
|
|
1709
|
-
throw new Error("session.compaction.decision data.compact must be a boolean");
|
|
1714
|
+
throw new Error(t("session.compaction.decision data.compact must be a boolean"));
|
|
1710
1715
|
}
|
|
1711
1716
|
if (typeof value.willRetry !== "boolean") {
|
|
1712
|
-
throw new Error("session.compaction.decision data.willRetry must be a boolean");
|
|
1717
|
+
throw new Error(t("session.compaction.decision data.willRetry must be a boolean"));
|
|
1713
1718
|
}
|
|
1714
1719
|
assertOptionalPositiveSafeInteger(value.contextTokens, "session.compaction.decision data.contextTokens");
|
|
1715
1720
|
assertOptionalPositiveSafeInteger(value.contextWindow, "session.compaction.decision data.contextWindow");
|
|
@@ -1733,22 +1738,24 @@ export function sessionCompactionDecisionEventDefinition() {
|
|
|
1733
1738
|
const sessionCompactionFailedReasons = new Set(["manual", "overflow", "threshold"]);
|
|
1734
1739
|
export function validateSessionCompactionFailedEventDataV1(value) {
|
|
1735
1740
|
if (!isPlainRecord(value))
|
|
1736
|
-
throw new Error("session.compaction.failed data must be a plain object");
|
|
1741
|
+
throw new Error(t("session.compaction.failed data must be a plain object"));
|
|
1737
1742
|
const allowed = new Set(["version", "sessionId", "reason", "errorMessage"]);
|
|
1738
1743
|
const unsupported = Object.keys(value).filter((key) => !allowed.has(key));
|
|
1739
1744
|
if (unsupported.length > 0) {
|
|
1740
|
-
throw new Error(
|
|
1745
|
+
throw new Error(t("session.compaction.failed data has unsupported fields: {unsupported}", {
|
|
1746
|
+
unsupported: unsupported.join(", "),
|
|
1747
|
+
}));
|
|
1741
1748
|
}
|
|
1742
1749
|
for (const key of ["version", "sessionId", "reason", "errorMessage"]) {
|
|
1743
1750
|
if (!(key in value))
|
|
1744
|
-
throw new Error(
|
|
1751
|
+
throw new Error(t("session.compaction.failed data is missing required field: {key}", { key }));
|
|
1745
1752
|
}
|
|
1746
1753
|
if (value.version !== 1)
|
|
1747
|
-
throw new Error("session.compaction.failed data.version must be 1");
|
|
1754
|
+
throw new Error(t("session.compaction.failed data.version must be 1"));
|
|
1748
1755
|
assertString(value.sessionId, "session.compaction.failed data.sessionId");
|
|
1749
1756
|
if (typeof value.reason !== "string" ||
|
|
1750
1757
|
!sessionCompactionFailedReasons.has(value.reason)) {
|
|
1751
|
-
throw new Error("session.compaction.failed data.reason is invalid");
|
|
1758
|
+
throw new Error(t("session.compaction.failed data.reason is invalid"));
|
|
1752
1759
|
}
|
|
1753
1760
|
assertString(value.errorMessage, "session.compaction.failed data.errorMessage");
|
|
1754
1761
|
return value;
|
|
@@ -1768,12 +1775,12 @@ export const SESSION_END_EVENT_ID = "session.end";
|
|
|
1768
1775
|
export const SESSION_END_EVENT_VERSION = 1;
|
|
1769
1776
|
export function validateSessionEndEventDataV1(value) {
|
|
1770
1777
|
if (!isPlainRecord(value))
|
|
1771
|
-
throw new Error("session.end data must be a plain object");
|
|
1778
|
+
throw new Error(t("session.end data must be a plain object"));
|
|
1772
1779
|
if (Object.keys(value).sort().join(",") !== "sessionId,version") {
|
|
1773
|
-
throw new Error("session.end data has unsupported fields");
|
|
1780
|
+
throw new Error(t("session.end data has unsupported fields"));
|
|
1774
1781
|
}
|
|
1775
1782
|
if (value.version !== 1)
|
|
1776
|
-
throw new Error("session.end data.version must be 1");
|
|
1783
|
+
throw new Error(t("session.end data.version must be 1"));
|
|
1777
1784
|
assertString(value.sessionId, "session.end data.sessionId");
|
|
1778
1785
|
return value;
|
|
1779
1786
|
}
|
|
@@ -1803,23 +1810,23 @@ const agentTaskSettledStatuses = new Set([
|
|
|
1803
1810
|
]);
|
|
1804
1811
|
export function validateAgentTaskSettledEventDataV1(value) {
|
|
1805
1812
|
if (!isPlainRecord(value))
|
|
1806
|
-
throw new Error("agent.task.settled data must be a plain object");
|
|
1813
|
+
throw new Error(t("agent.task.settled data must be a plain object"));
|
|
1807
1814
|
const allowed = new Set(["version", "sessionId", "taskSessionId", "taskId", "status", "reasonCode"]);
|
|
1808
1815
|
const unsupported = Object.keys(value).filter((key) => !allowed.has(key));
|
|
1809
1816
|
if (unsupported.length > 0) {
|
|
1810
|
-
throw new Error(
|
|
1817
|
+
throw new Error(t("agent.task.settled data has unsupported fields: {unsupported}", { unsupported: unsupported.join(", ") }));
|
|
1811
1818
|
}
|
|
1812
1819
|
for (const key of ["version", "sessionId", "taskSessionId", "taskId", "status"]) {
|
|
1813
1820
|
if (!(key in value))
|
|
1814
|
-
throw new Error(
|
|
1821
|
+
throw new Error(t("agent.task.settled data is missing required field: {key}", { key }));
|
|
1815
1822
|
}
|
|
1816
1823
|
if (value.version !== 1)
|
|
1817
|
-
throw new Error("agent.task.settled data.version must be 1");
|
|
1824
|
+
throw new Error(t("agent.task.settled data.version must be 1"));
|
|
1818
1825
|
assertString(value.sessionId, "agent.task.settled data.sessionId");
|
|
1819
1826
|
assertString(value.taskSessionId, "agent.task.settled data.taskSessionId");
|
|
1820
1827
|
assertString(value.taskId, "agent.task.settled data.taskId");
|
|
1821
1828
|
if (typeof value.status !== "string" || !agentTaskSettledStatuses.has(value.status)) {
|
|
1822
|
-
throw new Error("agent.task.settled data.status is invalid");
|
|
1829
|
+
throw new Error(t("agent.task.settled data.status is invalid"));
|
|
1823
1830
|
}
|
|
1824
1831
|
if (value.reasonCode !== undefined)
|
|
1825
1832
|
assertString(value.reasonCode, "agent.task.settled data.reasonCode");
|
|
@@ -1838,17 +1845,17 @@ export function agentTaskSettledEventDefinition() {
|
|
|
1838
1845
|
}
|
|
1839
1846
|
export function validateToolGateBlockedEventDataV1(value) {
|
|
1840
1847
|
if (!isPlainRecord(value))
|
|
1841
|
-
throw new Error("tool.gate.blocked data must be a plain object");
|
|
1848
|
+
throw new Error(t("tool.gate.blocked data must be a plain object"));
|
|
1842
1849
|
const allowed = new Set(["version", "sessionId", "toolCallId", "toolName", "reason"]);
|
|
1843
1850
|
const unsupported = Object.keys(value).filter((key) => !allowed.has(key));
|
|
1844
1851
|
if (unsupported.length > 0)
|
|
1845
|
-
throw new Error(
|
|
1852
|
+
throw new Error(t("tool.gate.blocked data has unsupported fields: {unsupported}", { unsupported: unsupported.join(", ") }));
|
|
1846
1853
|
for (const key of ["version", "sessionId", "toolCallId", "toolName"]) {
|
|
1847
1854
|
if (!(key in value))
|
|
1848
|
-
throw new Error(
|
|
1855
|
+
throw new Error(t("tool.gate.blocked data is missing required field: {key}", { key }));
|
|
1849
1856
|
}
|
|
1850
1857
|
if (value.version !== 1)
|
|
1851
|
-
throw new Error("tool.gate.blocked data.version must be 1");
|
|
1858
|
+
throw new Error(t("tool.gate.blocked data.version must be 1"));
|
|
1852
1859
|
assertString(value.sessionId, "tool.gate.blocked data.sessionId");
|
|
1853
1860
|
assertString(value.toolCallId, "tool.gate.blocked data.toolCallId");
|
|
1854
1861
|
assertString(value.toolName, "tool.gate.blocked data.toolName");
|
|
@@ -1869,21 +1876,21 @@ export function toolGateBlockedEventDefinition() {
|
|
|
1869
1876
|
}
|
|
1870
1877
|
export function validateInputGateBlockedEventDataV1(value) {
|
|
1871
1878
|
if (!isPlainRecord(value))
|
|
1872
|
-
throw new Error("input.gate.blocked data must be a plain object");
|
|
1879
|
+
throw new Error(t("input.gate.blocked data must be a plain object"));
|
|
1873
1880
|
const allowed = new Set(["version", "sessionId", "source", "textLength", "reason"]);
|
|
1874
1881
|
const unsupported = Object.keys(value).filter((key) => !allowed.has(key));
|
|
1875
1882
|
if (unsupported.length > 0)
|
|
1876
|
-
throw new Error(
|
|
1883
|
+
throw new Error(t("input.gate.blocked data has unsupported fields: {unsupported}", { unsupported: unsupported.join(", ") }));
|
|
1877
1884
|
for (const key of ["version", "sessionId", "source", "textLength"]) {
|
|
1878
1885
|
if (!(key in value))
|
|
1879
|
-
throw new Error(
|
|
1886
|
+
throw new Error(t("input.gate.blocked data is missing required field: {key}", { key }));
|
|
1880
1887
|
}
|
|
1881
1888
|
if (value.version !== 1)
|
|
1882
|
-
throw new Error("input.gate.blocked data.version must be 1");
|
|
1889
|
+
throw new Error(t("input.gate.blocked data.version must be 1"));
|
|
1883
1890
|
assertString(value.sessionId, "input.gate.blocked data.sessionId");
|
|
1884
1891
|
assertString(value.source, "input.gate.blocked data.source");
|
|
1885
1892
|
if (typeof value.textLength !== "number" || !Number.isInteger(value.textLength) || value.textLength < 0) {
|
|
1886
|
-
throw new Error("input.gate.blocked data.textLength must be a non-negative integer");
|
|
1893
|
+
throw new Error(t("input.gate.blocked data.textLength must be a non-negative integer"));
|
|
1887
1894
|
}
|
|
1888
1895
|
if (value.reason !== undefined)
|
|
1889
1896
|
assertString(value.reason, "input.gate.blocked data.reason");
|
|
@@ -1913,22 +1920,24 @@ const isModelReference = (value) => {
|
|
|
1913
1920
|
function validateFailoverModelReference(value, label) {
|
|
1914
1921
|
assertString(value, label);
|
|
1915
1922
|
if (!isModelReference(value))
|
|
1916
|
-
throw new Error(
|
|
1923
|
+
throw new Error(t("{label} must be a provider/modelId reference", { label }));
|
|
1917
1924
|
}
|
|
1918
1925
|
export function validateProviderFailoverSwitchedEventDataV1(value) {
|
|
1919
1926
|
if (!isPlainRecord(value))
|
|
1920
|
-
throw new Error("provider.failover.switched data must be a plain object");
|
|
1927
|
+
throw new Error(t("provider.failover.switched data must be a plain object"));
|
|
1921
1928
|
const allowed = new Set(["version", "chainId", "from", "to", "attempt", "rawError"]);
|
|
1922
1929
|
const unsupported = Object.keys(value).filter((key) => !allowed.has(key));
|
|
1923
1930
|
if (unsupported.length > 0) {
|
|
1924
|
-
throw new Error(
|
|
1931
|
+
throw new Error(t("provider.failover.switched data has unsupported fields: {unsupported}", {
|
|
1932
|
+
unsupported: unsupported.join(", "),
|
|
1933
|
+
}));
|
|
1925
1934
|
}
|
|
1926
1935
|
for (const key of ["version", "chainId", "from", "to", "attempt", "rawError"]) {
|
|
1927
1936
|
if (!(key in value))
|
|
1928
|
-
throw new Error(
|
|
1937
|
+
throw new Error(t("provider.failover.switched data is missing required field: {key}", { key }));
|
|
1929
1938
|
}
|
|
1930
1939
|
if (value.version !== 1)
|
|
1931
|
-
throw new Error("provider.failover.switched data.version must be 1");
|
|
1940
|
+
throw new Error(t("provider.failover.switched data.version must be 1"));
|
|
1932
1941
|
validateFailoverModelReference(value.chainId, "provider.failover.switched data.chainId");
|
|
1933
1942
|
validateFailoverModelReference(value.from, "provider.failover.switched data.from");
|
|
1934
1943
|
validateFailoverModelReference(value.to, "provider.failover.switched data.to");
|
|
@@ -1949,12 +1958,12 @@ export function providerFailoverSwitchedEventDefinition() {
|
|
|
1949
1958
|
}
|
|
1950
1959
|
export function validateProviderFailoverRecoveredEventDataV1(value) {
|
|
1951
1960
|
if (!isPlainRecord(value))
|
|
1952
|
-
throw new Error("provider.failover.recovered data must be a plain object");
|
|
1961
|
+
throw new Error(t("provider.failover.recovered data must be a plain object"));
|
|
1953
1962
|
if (Object.keys(value).sort().join(",") !== "chainId,provider,version") {
|
|
1954
|
-
throw new Error("provider.failover.recovered data has unsupported fields");
|
|
1963
|
+
throw new Error(t("provider.failover.recovered data has unsupported fields"));
|
|
1955
1964
|
}
|
|
1956
1965
|
if (value.version !== 1)
|
|
1957
|
-
throw new Error("provider.failover.recovered data.version must be 1");
|
|
1966
|
+
throw new Error(t("provider.failover.recovered data.version must be 1"));
|
|
1958
1967
|
validateFailoverModelReference(value.chainId, "provider.failover.recovered data.chainId");
|
|
1959
1968
|
assertString(value.provider, "provider.failover.recovered data.provider");
|
|
1960
1969
|
return value;
|
|
@@ -1972,18 +1981,20 @@ export function providerFailoverRecoveredEventDefinition() {
|
|
|
1972
1981
|
}
|
|
1973
1982
|
export function validateProviderFailoverProbeFailedEventDataV1(value) {
|
|
1974
1983
|
if (!isPlainRecord(value))
|
|
1975
|
-
throw new Error("provider.failover.probe.failed data must be a plain object");
|
|
1984
|
+
throw new Error(t("provider.failover.probe.failed data must be a plain object"));
|
|
1976
1985
|
const allowed = new Set(["version", "chainId", "provider", "rawError", "nextCooldownMs"]);
|
|
1977
1986
|
const unsupported = Object.keys(value).filter((key) => !allowed.has(key));
|
|
1978
1987
|
if (unsupported.length > 0) {
|
|
1979
|
-
throw new Error(
|
|
1988
|
+
throw new Error(t("provider.failover.probe.failed data has unsupported fields: {unsupported}", {
|
|
1989
|
+
unsupported: unsupported.join(", "),
|
|
1990
|
+
}));
|
|
1980
1991
|
}
|
|
1981
1992
|
for (const key of ["version", "chainId", "provider", "rawError", "nextCooldownMs"]) {
|
|
1982
1993
|
if (!(key in value))
|
|
1983
|
-
throw new Error(
|
|
1994
|
+
throw new Error(t("provider.failover.probe.failed data is missing required field: {key}", { key }));
|
|
1984
1995
|
}
|
|
1985
1996
|
if (value.version !== 1)
|
|
1986
|
-
throw new Error("provider.failover.probe.failed data.version must be 1");
|
|
1997
|
+
throw new Error(t("provider.failover.probe.failed data.version must be 1"));
|
|
1987
1998
|
validateFailoverModelReference(value.chainId, "provider.failover.probe.failed data.chainId");
|
|
1988
1999
|
assertString(value.provider, "provider.failover.probe.failed data.provider");
|
|
1989
2000
|
assertString(value.rawError, "provider.failover.probe.failed data.rawError");
|