@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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-plugin-testkit.d.ts","sourceRoot":"","sources":["../../src/testing/session-plugin-testkit.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EACN,KAAK,wBAAwB,EAC7B,KAAK,gBAAgB,EAGrB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,YAAY,EAAE,M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,MAAM,CAAC;QAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC/E,QAAQ,CAAC,OAAO,EAAE,SAAS;QAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,CAAA;KAAE,EAAE,CAAC;IAC9G,QAAQ,CAAC,SAAS,EAAE,6BAA6B,CAAC;CAClD;AAED,MAAM,WAAW,oBAAoB;IACpC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9B,QAAQ,CAAC,OAAO,EAAE,YAAY,CAAC;IAC/B,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,iBAAiB,CAAC;IACpC,QAAQ,CAAC,IAAI,EAAE,wBAAwB,CAAC;IACxC,GAAG,CAAC,QAAQ,EAAE,MAAM,GAAG,aAAa,CAAC;IACrC,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,uEAAuE;IACvE,uBAAuB,IAAI,IAAI,CAAC;IAChC,OAAO,IAAI,wBAAwB,CAAC;IACpC,UAAU,IAAI,8BAA8B,CAAC;IAC7C,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACzB;AAkOD,+FAA+F;AAC/F,wBAAsB,0BAA0B,CAAC,OAAO,EAAE,2BAA2B,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAiNpH;AAED,wFAAwF;AACxF,wBAAsB,0BAA0B,CAC/C,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,MAAM,OAAO,CAAC,8BAA8B,CAAC,GAChD,OAAO,CAAC,8BAA8B,CAAC,CAYzC","sourcesContent":["import { mkdtemp, rm } from \"node:fs/promises\";\nimport { tmpdir } from \"node:os\";\nimport { join } from \"node:path\";\nimport type { Agent } from \"@agent-forge/agent-core\";\nimport {\n\ttype FauxProviderRegistration,\n\ttype FauxResponseStep,\n\tregisterFauxProvider,\n\tstreamSimple,\n} from \"@agent-forge/ai/compat\";\nimport type { AgentSession } from \"../core/agent-session.ts\";\nimport { AuthStorage } from \"../core/auth-storage.ts\";\nimport type { CapabilityPluginFactory, CapabilityPluginHandle } from \"../core/extensions/capability-plugin.ts\";\nimport { type CapabilityRuntime, resolvePluginCapabilityOrder } from \"../core/extensions/capability-runtime.ts\";\nimport type {\n\tAgentCompositionAPI,\n\tCapabilityAPI,\n\tHostCapabilities,\n\tPluginManifest,\n\tRuntimeInspectorSnapshot,\n} from \"../core/extensions/public-api.ts\";\nimport { ModelRuntime } from \"../core/model-runtime.ts\";\nimport { InMemoryCodingAgentModelsStore } from \"../core/models-store.ts\";\nimport { DefaultResourceLoader } from \"../core/resource-loader.ts\";\nimport { createAgentSession } from \"../core/sdk.ts\";\nimport { SessionManager } from \"../core/session-manager.ts\";\nimport { SettingsManager } from \"../core/settings-manager.ts\";\nimport type { ToolDefinition } from \"../core/tools/tool-definition.ts\";\n\nexport interface SessionPluginTestKitPlugin {\n\treadonly manifest: PluginManifest;\n\treadonly factory: CapabilityPluginFactory;\n}\n\nexport interface SessionPluginTestKitOptions {\n\treadonly plugins: readonly SessionPluginTestKitPlugin[];\n\treadonly responses?: readonly FauxResponseStep[];\n\treadonly providerId?: string;\n\treadonly api?: string;\n\treadonly composition?: AgentCompositionAPI;\n\t/** Custom tools registered on the fixture session for gated lifecycle scenarios. */\n\treadonly tools?: readonly ToolDefinition[];\n\t/** Post-run continuation strategy name selected through the public AgentSession config. */\n\treadonly runLoopStrategyName?: string;\n}\n\nexport interface SessionPluginTestKitInspector {\n\treadonly host: HostCapabilities;\n\treadonly plugins: readonly {\n\t\treadonly id: string;\n\t\treadonly version: string;\n\t\treadonly active: boolean;\n\t\treadonly provides: RuntimeInspectorSnapshot[\"plugins\"][number][\"provides\"];\n\t\treadonly requires: RuntimeInspectorSnapshot[\"plugins\"][number][\"requires\"];\n\t}[];\n\treadonly registrations: RuntimeInspectorSnapshot[\"registrations\"];\n\treadonly contributionPoints: readonly {\n\t\treadonly id: string;\n\t\treadonly version: number;\n\t\treadonly lifecycle: string;\n\t\treadonly owner: string;\n\t\treadonly active: boolean;\n\t}[];\n\treadonly contributions: readonly {\n\t\treadonly id: string;\n\t\treadonly pointId: string;\n\t\treadonly version: number;\n\t\treadonly owner: string;\n\t\treadonly lifecycle: string;\n\t}[];\n\treadonly lifecycle: readonly {\n\t\treadonly id: string;\n\t\treadonly version: number;\n\t\treadonly phase: string;\n\t\treadonly schema: string;\n\t\treadonly owner: string;\n\t\treadonly active: boolean;\n\t\treadonly registrations: readonly { readonly id: string; readonly kind: string; readonly owner: string }[];\n\t}[];\n\treadonly lifecycleReports: readonly {\n\t\treadonly eventId: string;\n\t\treadonly type: string;\n\t\treadonly version: number;\n\t\treadonly phase: string;\n\t\treadonly status: string;\n\t\treadonly attempted: number;\n\t\treadonly succeeded: number;\n\t\treadonly queued?: number;\n\t\treadonly failed: number;\n\t\treadonly failures: readonly {\n\t\t\treadonly pluginId: string;\n\t\t\treadonly registrationId: string;\n\t\t\treadonly kind: string;\n\t\t\treadonly error: unknown;\n\t\t}[];\n\t}[];\n\treadonly pluginRejections: RuntimeInspectorSnapshot[\"pluginRejections\"];\n\treadonly subscriptions: RuntimeInspectorSnapshot[\"subscriptions\"];\n\treadonly operations: RuntimeInspectorSnapshot[\"operations\"];\n\treadonly logs: readonly {\n\t\treadonly version: 1;\n\t\treadonly level: string;\n\t\treadonly message: string;\n\t\treadonly fields?: unknown;\n\t\treadonly cause?: unknown;\n\t\treadonly pluginId: string;\n\t\treadonly sessionId?: string;\n\t\treadonly operationId?: string;\n\t\treadonly correlationId?: string;\n\t\treadonly phase?: string;\n\t}[];\n\treadonly spans: readonly {\n\t\treadonly version: 1;\n\t\treadonly traceId: string;\n\t\treadonly spanId: string;\n\t\treadonly parentSpanId?: string;\n\t\treadonly name: string;\n\t\treadonly pluginId: string;\n\t\treadonly sessionId?: string;\n\t\treadonly status: string;\n\t\treadonly attributes: unknown;\n\t\treadonly result?: unknown;\n\t\treadonly cause?: unknown;\n\t\treadonly operationId?: string;\n\t\treadonly correlationId?: string;\n\t\treadonly phase?: string;\n\t}[];\n}\n\nexport interface SessionPluginTestKitTranscript {\n\treadonly version: 1;\n\treadonly sessionId: string;\n\treadonly revision: number;\n\treadonly loadOrder: readonly string[];\n\treadonly fauxCallCount: number;\n\treadonly messages: readonly { readonly role: string; readonly text: string }[];\n\treadonly entries: readonly { readonly type: string; readonly customType?: string; readonly data?: unknown }[];\n\treadonly inspector: SessionPluginTestKitInspector;\n}\n\nexport interface SessionPluginTestKit {\n\treadonly ready: Promise<void>;\n\treadonly session: AgentSession;\n\treadonly agent: Agent;\n\treadonly runtime: CapabilityRuntime;\n\treadonly faux: FauxProviderRegistration;\n\tapi(pluginId: string): CapabilityAPI;\n\trevoke(pluginId: string): void;\n\t/** Throws when a scripted response was not consumed by the fixture. */\n\tassertResponsesConsumed(): void;\n\tinspect(): RuntimeInspectorSnapshot;\n\ttranscript(): SessionPluginTestKitTranscript;\n\tdispose(): Promise<void>;\n}\n\nconst FIXED_SESSION_ID = \"session-plugin-testkit\";\nconst DEFAULT_PROVIDER_ID = \"faux-session-plugin-testkit\";\nconst DEFAULT_API = \"faux:session-plugin-testkit\";\n\nfunction stableText(message: unknown): string {\n\t// v8 ignore next -- 消息对象恒带 content 字段(AgentMessage 类型契约)\n\tif (!message || typeof message !== \"object\" || !(\"content\" in message)) return \"\";\n\tconst content = (message as { content?: unknown }).content;\n\t// v8 ignore next -- 助手消息的 content 恒为分段数组,字符串路径不会被命中\n\tif (typeof content === \"string\") return content;\n\t// v8 ignore next -- 同上:content 恒为数组\n\tif (!Array.isArray(content)) return \"\";\n\treturn content\n\t\t.filter((part): part is { type: \"text\"; text: string } => {\n\t\t\treturn (\n\t\t\t\ttypeof part === \"object\" &&\n\t\t\t\tpart !== null &&\n\t\t\t\t(part as { type?: unknown }).type === \"text\" &&\n\t\t\t\ttypeof (part as { text?: unknown }).text === \"string\"\n\t\t\t);\n\t\t})\n\t\t.map((part) => part.text)\n\t\t.join(\"\\n\");\n}\n\nfunction freezeSnapshot<T>(value: T): T {\n\tconst clone = structuredClone(value);\n\tconst freeze = (candidate: unknown): void => {\n\t\tif (!candidate || typeof candidate !== \"object\" || ArrayBuffer.isView(candidate)) return;\n\t\tfor (const child of Object.values(candidate as Record<string, unknown>)) freeze(child);\n\t\tObject.freeze(candidate);\n\t};\n\tfreeze(clone);\n\treturn clone;\n}\n\nfunction transcriptValue(value: unknown, seen = new WeakSet<object>()): unknown {\n\tif (value === null || typeof value === \"string\" || typeof value === \"boolean\") return value;\n\tif (typeof value === \"number\") return Number.isFinite(value) ? value : String(value);\n\tif (typeof value === \"bigint\") return `${value}n`;\n\tif (value === undefined) return null;\n\tif (value instanceof Error) {\n\t\t// v8 ignore next -- 错误经过 structuredClone 落盘,克隆体不可能形成循环引用\n\t\tif (seen.has(value)) return \"[Circular]\";\n\t\tseen.add(value);\n\t\tconst output: Record<string, unknown> = { name: value.name, message: value.message };\n\t\tconst code = (value as Error & { code?: unknown }).code;\n\t\tif (code !== undefined) output.code = transcriptValue(code, seen);\n\t\tconst cause = (value as Error & { cause?: unknown }).cause;\n\t\tif (cause !== undefined) output.cause = transcriptValue(cause, seen);\n\t\tfor (const key of Object.keys(value).sort()) {\n\t\t\tif (key === \"code\" || key === \"cause\") continue;\n\t\t\toutput[key] = transcriptValue((value as unknown as Record<string, unknown>)[key], seen);\n\t\t}\n\t\treturn output;\n\t}\n\t// v8 ignore next -- 值均来自 structuredClone 克隆,函数/符号无法存活\n\tif (typeof value !== \"object\") return String(value);\n\t// v8 ignore next -- 同上:克隆后的对象图无循环引用\n\tif (seen.has(value)) return \"[Circular]\";\n\tseen.add(value);\n\tif (Array.isArray(value)) return value.map((item) => transcriptValue(item, seen));\n\tconst output: Record<string, unknown> = {};\n\tfor (const key of Object.keys(value as Record<string, unknown>).sort()) {\n\t\toutput[key] = transcriptValue((value as Record<string, unknown>)[key], seen);\n\t}\n\treturn output;\n}\n\nfunction canonicalJson(value: unknown): string {\n\tconst serialized = JSON.stringify(transcriptValue(value));\n\t// v8 ignore next -- transcriptValue 已消毒全部值,JSON.stringify 不会返回 undefined\n\tif (serialized === undefined) throw new Error(\"Session plugin testkit transcript is not JSON-serializable\");\n\treturn serialized;\n}\n\n/**\n * The host's agentDir and workspaceDirectory are the fixture's mkdtemp paths —\n * environment-specific and random per run, not a behavioral signal. Mask them\n * so repeated-run transcript comparisons stay deterministic (D-075 S4 added\n * agentDir to HostCapabilities; workspaceDirectory rides the same channel).\n */\nfunction normalizeInspectorHost(host: HostCapabilities): HostCapabilities {\n\tif (host.agentDir === undefined && host.workspaceDirectory === undefined) return host;\n\treturn {\n\t\t...host,\n\t\t...(typeof host.agentDir === \"string\" && host.agentDir.length > 0 ? { agentDir: \"<agentDir>\" } : {}),\n\t\t...(typeof host.workspaceDirectory === \"string\" && host.workspaceDirectory.length > 0\n\t\t\t? { workspaceDirectory: \"<workspaceDirectory>\" }\n\t\t\t: {}),\n\t};\n}\n\nfunction stableInspector(snapshot: RuntimeInspectorSnapshot): SessionPluginTestKitInspector {\n\treturn {\n\t\thost: normalizeInspectorHost(snapshot.host),\n\t\tplugins: snapshot.plugins.map(({ id, version, active, provides, requires }) => ({\n\t\t\tid,\n\t\t\tversion,\n\t\t\tactive,\n\t\t\tprovides,\n\t\t\trequires,\n\t\t})),\n\t\tregistrations: snapshot.registrations,\n\t\tcontributionPoints: snapshot.contributionPoints.map(({ id, version, lifecycle, owner, active }) => ({\n\t\t\tid,\n\t\t\tversion,\n\t\t\tlifecycle,\n\t\t\towner,\n\t\t\tactive,\n\t\t})),\n\t\tcontributions: snapshot.contributions.map(({ id, pointId, version, owner, lifecycle }) => ({\n\t\t\tid,\n\t\t\tpointId,\n\t\t\tversion,\n\t\t\towner,\n\t\t\tlifecycle,\n\t\t})),\n\t\tlifecycle: snapshot.lifecycle.map(({ id, version, phase, schema, owner, active, registrations }) => ({\n\t\t\tid,\n\t\t\tversion,\n\t\t\tphase,\n\t\t\tschema,\n\t\t\towner,\n\t\t\tactive,\n\t\t\tregistrations,\n\t\t})),\n\t\tlifecycleReports: snapshot.lifecycleReports.map(\n\t\t\t({ eventId, type, version, phase, status, attempted, succeeded, failed, failures }) => ({\n\t\t\t\teventId,\n\t\t\t\ttype,\n\t\t\t\tversion,\n\t\t\t\tphase,\n\t\t\t\tstatus,\n\t\t\t\tattempted,\n\t\t\t\tsucceeded,\n\t\t\t\tfailed,\n\t\t\t\tfailures: failures.map(({ pluginId, registrationId, kind, error }) => ({\n\t\t\t\t\tpluginId,\n\t\t\t\t\tregistrationId,\n\t\t\t\t\tkind,\n\t\t\t\t\terror: transcriptValue(error),\n\t\t\t\t})),\n\t\t\t}),\n\t\t),\n\t\tpluginRejections: snapshot.pluginRejections,\n\t\tsubscriptions: snapshot.subscriptions,\n\t\toperations: snapshot.operations,\n\t\tlogs: snapshot.logs.map(\n\t\t\t({ version, level, message, fields, cause, pluginId, sessionId, operationId, correlationId, phase }) => ({\n\t\t\t\tversion,\n\t\t\t\tlevel,\n\t\t\t\tmessage,\n\t\t\t\t...(fields === undefined ? {} : { fields: transcriptValue(fields) }),\n\t\t\t\t...(cause === undefined ? {} : { cause: transcriptValue(cause) }),\n\t\t\t\tpluginId,\n\t\t\t\t...(sessionId === undefined ? {} : { sessionId }),\n\t\t\t\t...(operationId === undefined ? {} : { operationId }),\n\t\t\t\t...(correlationId === undefined ? {} : { correlationId }),\n\t\t\t\t...(phase === undefined ? {} : { phase }),\n\t\t\t}),\n\t\t),\n\t\tspans: snapshot.spans.map(\n\t\t\t({\n\t\t\t\tversion,\n\t\t\t\ttraceId,\n\t\t\t\tspanId,\n\t\t\t\tparentSpanId,\n\t\t\t\tname,\n\t\t\t\tpluginId,\n\t\t\t\tsessionId,\n\t\t\t\tstatus,\n\t\t\t\tattributes,\n\t\t\t\tresult,\n\t\t\t\tcause,\n\t\t\t\toperationId,\n\t\t\t\tcorrelationId,\n\t\t\t\tphase,\n\t\t\t}) => ({\n\t\t\t\tversion,\n\t\t\t\ttraceId,\n\t\t\t\tspanId,\n\t\t\t\t...(parentSpanId === undefined ? {} : { parentSpanId }),\n\t\t\t\tname,\n\t\t\t\tpluginId,\n\t\t\t\t...(sessionId === undefined ? {} : { sessionId }),\n\t\t\t\tattributes: transcriptValue(attributes),\n\t\t\t\tstatus,\n\t\t\t\t...(result === undefined ? {} : { result: transcriptValue(result) }),\n\t\t\t\t...(cause === undefined ? {} : { cause: transcriptValue(cause) }),\n\t\t\t\t...(operationId === undefined ? {} : { operationId }),\n\t\t\t\t...(correlationId === undefined ? {} : { correlationId }),\n\t\t\t\t...(phase === undefined ? {} : { phase }),\n\t\t\t}),\n\t\t),\n\t};\n}\n\nfunction modelConfig(model: {\n\tid: string;\n\tname: string;\n\tapi: string;\n\tprovider: string;\n\tbaseUrl: string;\n\treasoning: boolean;\n\tinput: readonly (\"text\" | \"image\")[];\n\tcost: { input: number; output: number; cacheRead: number; cacheWrite: number };\n\tcontextWindow: number;\n\tmaxTokens: number;\n}) {\n\treturn {\n\t\tid: model.id,\n\t\tname: model.name,\n\t\tapi: model.api,\n\t\tprovider: model.provider,\n\t\tbaseUrl: model.baseUrl,\n\t\treasoning: model.reasoning,\n\t\tinput: [...model.input],\n\t\tcost: model.cost,\n\t\tcontextWindow: model.contextWindow,\n\t\tmaxTokens: model.maxTokens,\n\t};\n}\n\n/** Create a complete deterministic AgentSession fixture and load inline capability plugins. */\nexport async function createSessionPluginTestKit(options: SessionPluginTestKitOptions): Promise<SessionPluginTestKit> {\n\tconst tempDir = await mkdtemp(join(tmpdir(), \"agent-forge-session-plugin-testkit-\"));\n\tconst providerId = options.providerId ?? DEFAULT_PROVIDER_ID;\n\tconst apiName = options.api ?? DEFAULT_API;\n\tlet faux: FauxProviderRegistration | undefined;\n\tlet session: AgentSession | undefined;\n\ttry {\n\t\tfaux = registerFauxProvider({\n\t\t\tapi: apiName,\n\t\t\tprovider: providerId,\n\t\t\tclock: () => 0,\n\t\t\tidFactory: (prefix, sequence) => `${prefix}-${sequence}`,\n\t\t});\n\t\tif (options.responses) faux.setResponses([...options.responses]);\n\t\tconst fauxRegistration = faux;\n\t\tconst model = fauxRegistration.getModel();\n\t\tconst authStorage = AuthStorage.inMemory();\n\t\tawait authStorage.modify(providerId, async () => ({ type: \"api_key\", key: \"faux-key\" }));\n\t\tconst modelRuntime = await ModelRuntime.create({\n\t\t\tcredentials: authStorage,\n\t\t\tmodelsPath: null,\n\t\t\tmodelsStore: new InMemoryCodingAgentModelsStore(),\n\t\t\tallowModelNetwork: false,\n\t\t\trefreshOnCreate: false,\n\t\t});\n\t\tmodelRuntime.registerProvider(providerId, {\n\t\t\tbaseUrl: model.baseUrl,\n\t\t\tapi: apiName,\n\t\t\tapiKey: \"faux-key\",\n\t\t\tmodels: fauxRegistration.models.map(modelConfig),\n\t\t});\n\t\tconst settingsManager = SettingsManager.create(tempDir, tempDir);\n\t\tconst resourceLoader = new DefaultResourceLoader({\n\t\t\tcwd: tempDir,\n\t\t\tagentDir: tempDir,\n\t\t\tsettingsManager,\n\t\t\tnoSkills: true,\n\t\t\tnoPromptTemplates: true,\n\t\t\tnoThemes: true,\n\t\t\tnoContextFiles: true,\n\t\t});\n\t\tawait resourceLoader.reload();\n\t\tconst sessionManager = SessionManager.inMemory(tempDir, { id: FIXED_SESSION_ID });\n\t\tconst created = await createAgentSession({\n\t\t\tagentDir: tempDir,\n\t\t\tnoTools: \"all\",\n\t\t\t// Custom fixture tools must be allowlisted explicitly: noTools=\"all\"\n\t\t\t// clears the allowlist, which would otherwise leave them inactive.\n\t\t\t...(options.tools === undefined\n\t\t\t\t? {}\n\t\t\t\t: { tools: options.tools.map((tool) => tool.name), customTools: [...options.tools] }),\n\t\t\tdiscoverCapabilityPlugins: false,\n\t\t\tenableAgentTasks: false,\n\t\t\t...(options.runLoopStrategyName === undefined ? {} : { runLoopStrategyName: options.runLoopStrategyName }),\n\t\t\tstreamFn: streamSimple,\n\t\t\tmodel,\n\t\t\tmodelRuntime,\n\t\t\tresourceLoader,\n\t\t\tsessionManager,\n\t\t\tsettingsManager,\n\t\t\tcwd: tempDir,\n\t\t\tagentComposition: options.composition,\n\t\t}).then(({ session: createdSession }) => createdSession);\n\t\tsession = created;\n\t\tconst activeSession = session;\n\t\tconst initialRuntime = activeSession.getCapabilityRuntime();\n\t\tconst handles = new Map<string, CapabilityPluginHandle>();\n\t\tconst pluginByManifest = new Map(options.plugins.map((plugin) => [plugin.manifest, plugin]));\n\t\tlet closing = false;\n\t\tlet disposed = false;\n\t\tlet disposePromise: Promise<void> | undefined;\n\t\tconst cleanup = async (): Promise<void> => {\n\t\t\tconst failures: unknown[] = [];\n\t\t\tfor (const handle of [...handles.values()].reverse()) {\n\t\t\t\ttry {\n\t\t\t\t\tawait handle.dispose();\n\t\t\t\t} catch (error) {\n\t\t\t\t\tfailures.push(error);\n\t\t\t\t}\n\t\t\t}\n\t\t\thandles.clear();\n\t\t\ttry {\n\t\t\t\tawait session?.dispose();\n\t\t\t} catch (error) {\n\t\t\t\tfailures.push(error);\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tfaux?.unregister();\n\t\t\t\tawait rm(tempDir, { recursive: true, force: true });\n\t\t\t} catch (error) {\n\t\t\t\tfailures.push(error);\n\t\t\t}\n\t\t\tif (failures.length === 1) throw failures[0];\n\t\t\tif (failures.length > 1) throw new AggregateError(failures, \"Session plugin testkit cleanup failed\");\n\t\t};\n\t\tconst ready = (async () => {\n\t\t\ttry {\n\t\t\t\tfor (const manifest of resolvePluginCapabilityOrder(options.plugins.map((plugin) => plugin.manifest))) {\n\t\t\t\t\t// v8 ignore next -- kit 仅在 ready 成功后返回,startup 期间不会调用 dispose\n\t\t\t\t\tif (closing) throw new Error(\"Session plugin testkit was disposed during startup\");\n\t\t\t\t\tconst plugin = pluginByManifest.get(manifest);\n\t\t\t\t\t// v8 ignore next -- plugins 数组同时供给加载顺序与 factory 映射,必可解析\n\t\t\t\t\tif (!plugin) throw new Error(`Session plugin testkit cannot resolve factory: ${manifest.id}`);\n\t\t\t\t\tconst handle = await activeSession.loadCapabilityPlugin(manifest, plugin.factory);\n\t\t\t\t\thandles.set(manifest.id, handle);\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\ttry {\n\t\t\t\t\tawait cleanup();\n\t\t\t\t} catch (cleanupError) {\n\t\t\t\t\tthrow new AggregateError([error, cleanupError], \"Session plugin testkit startup rollback failed\");\n\t\t\t\t}\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t})();\n\t\tconst kit: SessionPluginTestKit = {\n\t\t\tready,\n\t\t\tsession: activeSession,\n\t\t\tagent: activeSession.agent,\n\t\t\tget runtime(): CapabilityRuntime {\n\t\t\t\tif (disposed) throw new Error(\"Session plugin testkit runtime is disposed\");\n\t\t\t\treturn activeSession.getCapabilityRuntime();\n\t\t\t},\n\t\t\tfaux: fauxRegistration,\n\t\t\tapi(pluginId) {\n\t\t\t\tif (activeSession.getCapabilityRuntime() !== initialRuntime) {\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\"Session plugin testkit plugin API handles expire after session reload; access the current runtime directly\",\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tconst handle = handles.get(pluginId);\n\t\t\t\tif (!handle) throw new Error(`Session plugin testkit has no loaded plugin: ${pluginId}`);\n\t\t\t\treturn handle.api;\n\t\t\t},\n\t\t\trevoke(pluginId) {\n\t\t\t\tif (activeSession.getCapabilityRuntime() !== initialRuntime) {\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\"Session plugin testkit plugin API handles expire after session reload; access the current runtime directly\",\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tconst handle = handles.get(pluginId);\n\t\t\t\tif (!handle) throw new Error(`Session plugin testkit has no loaded plugin: ${pluginId}`);\n\t\t\t\tactiveSession.getCapabilityRuntime().revokeAPI(handle.api);\n\t\t\t},\n\t\t\tassertResponsesConsumed() {\n\t\t\t\tconst pending = fauxRegistration.getPendingResponseCount();\n\t\t\t\tif (pending !== 0) {\n\t\t\t\t\tthrow new Error(`Session plugin testkit has ${pending} unused faux response${pending === 1 ? \"\" : \"s\"}`);\n\t\t\t\t}\n\t\t\t},\n\t\t\tinspect: () => activeSession.getCapabilityRuntime().inspect(),\n\t\t\ttranscript: () => {\n\t\t\t\tconst branch = sessionManager.getBranch();\n\t\t\t\tconst transcript: SessionPluginTestKitTranscript = {\n\t\t\t\t\tversion: 1,\n\t\t\t\t\tsessionId: sessionManager.getSessionId(),\n\t\t\t\t\trevision: sessionManager.getRevision().sequence,\n\t\t\t\t\tloadOrder: [...handles.keys()],\n\t\t\t\t\tfauxCallCount: fauxRegistration.state.callCount,\n\t\t\t\t\tmessages: activeSession.agent.state.messages.map((message) => ({\n\t\t\t\t\t\trole: message.role,\n\t\t\t\t\t\ttext: stableText(message),\n\t\t\t\t\t})),\n\t\t\t\t\tentries: branch.map((entry) => ({\n\t\t\t\t\t\ttype: entry.type,\n\t\t\t\t\t\t...(entry.type === \"custom\"\n\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\tcustomType: entry.customType,\n\t\t\t\t\t\t\t\t\t...(entry.data === undefined ? {} : { data: transcriptValue(entry.data) }),\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t})),\n\t\t\t\t\tinspector: stableInspector(activeSession.getCapabilityRuntime().inspect()),\n\t\t\t\t};\n\t\t\t\treturn freezeSnapshot(transcript);\n\t\t\t},\n\t\t\tdispose: async () => {\n\t\t\t\tdisposePromise ??= (async () => {\n\t\t\t\t\tclosing = true;\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait ready;\n\t\t\t\t\t} catch {\n\t\t\t\t\t\t// Startup rollback already disposed the session and faux provider.\n\t\t\t\t\t\t// v8 ignore next -- ready 已在返回前 await,dispose 中不会进入该 catch\n\t\t\t\t\t\tif (session?.isDisposed) {\n\t\t\t\t\t\t\tdisposed = true;\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait cleanup();\n\t\t\t\t\t} finally {\n\t\t\t\t\t\tdisposed = true;\n\t\t\t\t\t}\n\t\t\t\t})();\n\t\t\t\treturn disposePromise;\n\t\t\t},\n\t\t};\n\t\tawait ready;\n\t\treturn kit;\n\t} catch (error) {\n\t\ttry {\n\t\t\tsession && (await session.dispose());\n\t\t} finally {\n\t\t\tfaux?.unregister();\n\t\t\tawait rm(tempDir, { recursive: true, force: true });\n\t\t}\n\t\tthrow error;\n\t}\n}\n\n/** Runs a session fixture repeatedly and rejects on the first transcript divergence. */\nexport async function repeatSessionPluginTestKit(\n\ttimes: number,\n\trun: () => Promise<SessionPluginTestKitTranscript>,\n): Promise<SessionPluginTestKitTranscript> {\n\tif (!Number.isSafeInteger(times) || times < 1)\n\t\tthrow new Error(\"Session plugin testkit repeat count must be a positive integer\");\n\tlet baseline: SessionPluginTestKitTranscript | undefined;\n\tfor (let index = 0; index < times; index += 1) {\n\t\tconst transcript = await run();\n\t\tif (baseline && canonicalJson(transcript) !== canonicalJson(baseline)) {\n\t\t\tthrow new Error(`Session plugin testkit transcript diverged on run ${index + 1}`);\n\t\t}\n\t\tbaseline = transcript;\n\t}\n\treturn baseline!;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"session-plugin-testkit.d.ts","sourceRoot":"","sources":["../../src/testing/session-plugin-testkit.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EACN,KAAK,wBAAwB,EAC7B,KAAK,gBAAgB,EAGrB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAE7D,OAAO,KAAK,EAAE,uBAAuB,EAA0B,MAAM,yCAAyC,CAAC;AA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QAAQ,CAAC,OAAO,EAAE,SAAS;QAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,CAAA;KAAE,EAAE,CAAC;IAC9G,QAAQ,CAAC,SAAS,EAAE,6BAA6B,CAAC;CAClD;AAED,MAAM,WAAW,oBAAoB;IACpC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9B,QAAQ,CAAC,OAAO,EAAE,YAAY,CAAC;IAC/B,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,iBAAiB,CAAC;IACpC,QAAQ,CAAC,IAAI,EAAE,wBAAwB,CAAC;IACxC,GAAG,CAAC,QAAQ,EAAE,MAAM,GAAG,aAAa,CAAC;IACrC,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,uEAAuE;IACvE,uBAAuB,IAAI,IAAI,CAAC;IAChC,OAAO,IAAI,wBAAwB,CAAC;IACpC,UAAU,IAAI,8BAA8B,CAAC;IAC7C,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACzB;AAkOD,+FAA+F;AAC/F,wBAAsB,0BAA0B,CAAC,OAAO,EAAE,2BAA2B,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAyNpH;AAED,wFAAwF;AACxF,wBAAsB,0BAA0B,CAC/C,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,MAAM,OAAO,CAAC,8BAA8B,CAAC,GAChD,OAAO,CAAC,8BAA8B,CAAC,CAYzC","sourcesContent":["import { mkdtemp, rm } from \"node:fs/promises\";\nimport { tmpdir } from \"node:os\";\nimport { join } from \"node:path\";\nimport type { Agent } from \"@agent-forge/agent-core\";\nimport {\n\ttype FauxProviderRegistration,\n\ttype FauxResponseStep,\n\tregisterFauxProvider,\n\tstreamSimple,\n} from \"@agent-forge/ai/compat\";\nimport type { AgentSession } from \"../core/agent-session.ts\";\nimport { AuthStorage } from \"../core/auth-storage.ts\";\nimport type { CapabilityPluginFactory, CapabilityPluginHandle } from \"../core/extensions/capability-plugin.ts\";\nimport { type CapabilityRuntime, resolvePluginCapabilityOrder } from \"../core/extensions/capability-runtime.ts\";\nimport type {\n\tAgentCompositionAPI,\n\tCapabilityAPI,\n\tHostCapabilities,\n\tPluginManifest,\n\tRuntimeInspectorSnapshot,\n} from \"../core/extensions/public-api.ts\";\nimport { t } from \"../core/i18n/index.ts\";\nimport { ModelRuntime } from \"../core/model-runtime.ts\";\nimport { InMemoryCodingAgentModelsStore } from \"../core/models-store.ts\";\nimport { DefaultResourceLoader } from \"../core/resource-loader.ts\";\nimport { createAgentSession } from \"../core/sdk.ts\";\nimport { SessionManager } from \"../core/session-manager.ts\";\nimport { SettingsManager } from \"../core/settings-manager.ts\";\nimport type { ToolDefinition } from \"../core/tools/tool-definition.ts\";\n\nexport interface SessionPluginTestKitPlugin {\n\treadonly manifest: PluginManifest;\n\treadonly factory: CapabilityPluginFactory;\n}\n\nexport interface SessionPluginTestKitOptions {\n\treadonly plugins: readonly SessionPluginTestKitPlugin[];\n\treadonly responses?: readonly FauxResponseStep[];\n\treadonly providerId?: string;\n\treadonly api?: string;\n\treadonly composition?: AgentCompositionAPI;\n\t/** Custom tools registered on the fixture session for gated lifecycle scenarios. */\n\treadonly tools?: readonly ToolDefinition[];\n\t/** Post-run continuation strategy name selected through the public AgentSession config. */\n\treadonly runLoopStrategyName?: string;\n}\n\nexport interface SessionPluginTestKitInspector {\n\treadonly host: HostCapabilities;\n\treadonly plugins: readonly {\n\t\treadonly id: string;\n\t\treadonly version: string;\n\t\treadonly active: boolean;\n\t\treadonly provides: RuntimeInspectorSnapshot[\"plugins\"][number][\"provides\"];\n\t\treadonly requires: RuntimeInspectorSnapshot[\"plugins\"][number][\"requires\"];\n\t}[];\n\treadonly registrations: RuntimeInspectorSnapshot[\"registrations\"];\n\treadonly contributionPoints: readonly {\n\t\treadonly id: string;\n\t\treadonly version: number;\n\t\treadonly lifecycle: string;\n\t\treadonly owner: string;\n\t\treadonly active: boolean;\n\t}[];\n\treadonly contributions: readonly {\n\t\treadonly id: string;\n\t\treadonly pointId: string;\n\t\treadonly version: number;\n\t\treadonly owner: string;\n\t\treadonly lifecycle: string;\n\t}[];\n\treadonly lifecycle: readonly {\n\t\treadonly id: string;\n\t\treadonly version: number;\n\t\treadonly phase: string;\n\t\treadonly schema: string;\n\t\treadonly owner: string;\n\t\treadonly active: boolean;\n\t\treadonly registrations: readonly { readonly id: string; readonly kind: string; readonly owner: string }[];\n\t}[];\n\treadonly lifecycleReports: readonly {\n\t\treadonly eventId: string;\n\t\treadonly type: string;\n\t\treadonly version: number;\n\t\treadonly phase: string;\n\t\treadonly status: string;\n\t\treadonly attempted: number;\n\t\treadonly succeeded: number;\n\t\treadonly queued?: number;\n\t\treadonly failed: number;\n\t\treadonly failures: readonly {\n\t\t\treadonly pluginId: string;\n\t\t\treadonly registrationId: string;\n\t\t\treadonly kind: string;\n\t\t\treadonly error: unknown;\n\t\t}[];\n\t}[];\n\treadonly pluginRejections: RuntimeInspectorSnapshot[\"pluginRejections\"];\n\treadonly subscriptions: RuntimeInspectorSnapshot[\"subscriptions\"];\n\treadonly operations: RuntimeInspectorSnapshot[\"operations\"];\n\treadonly logs: readonly {\n\t\treadonly version: 1;\n\t\treadonly level: string;\n\t\treadonly message: string;\n\t\treadonly fields?: unknown;\n\t\treadonly cause?: unknown;\n\t\treadonly pluginId: string;\n\t\treadonly sessionId?: string;\n\t\treadonly operationId?: string;\n\t\treadonly correlationId?: string;\n\t\treadonly phase?: string;\n\t}[];\n\treadonly spans: readonly {\n\t\treadonly version: 1;\n\t\treadonly traceId: string;\n\t\treadonly spanId: string;\n\t\treadonly parentSpanId?: string;\n\t\treadonly name: string;\n\t\treadonly pluginId: string;\n\t\treadonly sessionId?: string;\n\t\treadonly status: string;\n\t\treadonly attributes: unknown;\n\t\treadonly result?: unknown;\n\t\treadonly cause?: unknown;\n\t\treadonly operationId?: string;\n\t\treadonly correlationId?: string;\n\t\treadonly phase?: string;\n\t}[];\n}\n\nexport interface SessionPluginTestKitTranscript {\n\treadonly version: 1;\n\treadonly sessionId: string;\n\treadonly revision: number;\n\treadonly loadOrder: readonly string[];\n\treadonly fauxCallCount: number;\n\treadonly messages: readonly { readonly role: string; readonly text: string }[];\n\treadonly entries: readonly { readonly type: string; readonly customType?: string; readonly data?: unknown }[];\n\treadonly inspector: SessionPluginTestKitInspector;\n}\n\nexport interface SessionPluginTestKit {\n\treadonly ready: Promise<void>;\n\treadonly session: AgentSession;\n\treadonly agent: Agent;\n\treadonly runtime: CapabilityRuntime;\n\treadonly faux: FauxProviderRegistration;\n\tapi(pluginId: string): CapabilityAPI;\n\trevoke(pluginId: string): void;\n\t/** Throws when a scripted response was not consumed by the fixture. */\n\tassertResponsesConsumed(): void;\n\tinspect(): RuntimeInspectorSnapshot;\n\ttranscript(): SessionPluginTestKitTranscript;\n\tdispose(): Promise<void>;\n}\n\nconst FIXED_SESSION_ID = \"session-plugin-testkit\";\nconst DEFAULT_PROVIDER_ID = \"faux-session-plugin-testkit\";\nconst DEFAULT_API = \"faux:session-plugin-testkit\";\n\nfunction stableText(message: unknown): string {\n\t// v8 ignore next -- 消息对象恒带 content 字段(AgentMessage 类型契约)\n\tif (!message || typeof message !== \"object\" || !(\"content\" in message)) return \"\";\n\tconst content = (message as { content?: unknown }).content;\n\t// v8 ignore next -- 助手消息的 content 恒为分段数组,字符串路径不会被命中\n\tif (typeof content === \"string\") return content;\n\t// v8 ignore next -- 同上:content 恒为数组\n\tif (!Array.isArray(content)) return \"\";\n\treturn content\n\t\t.filter((part): part is { type: \"text\"; text: string } => {\n\t\t\treturn (\n\t\t\t\ttypeof part === \"object\" &&\n\t\t\t\tpart !== null &&\n\t\t\t\t(part as { type?: unknown }).type === \"text\" &&\n\t\t\t\ttypeof (part as { text?: unknown }).text === \"string\"\n\t\t\t);\n\t\t})\n\t\t.map((part) => part.text)\n\t\t.join(\"\\n\");\n}\n\nfunction freezeSnapshot<T>(value: T): T {\n\tconst clone = structuredClone(value);\n\tconst freeze = (candidate: unknown): void => {\n\t\tif (!candidate || typeof candidate !== \"object\" || ArrayBuffer.isView(candidate)) return;\n\t\tfor (const child of Object.values(candidate as Record<string, unknown>)) freeze(child);\n\t\tObject.freeze(candidate);\n\t};\n\tfreeze(clone);\n\treturn clone;\n}\n\nfunction transcriptValue(value: unknown, seen = new WeakSet<object>()): unknown {\n\tif (value === null || typeof value === \"string\" || typeof value === \"boolean\") return value;\n\tif (typeof value === \"number\") return Number.isFinite(value) ? value : String(value);\n\tif (typeof value === \"bigint\") return `${value}n`;\n\tif (value === undefined) return null;\n\tif (value instanceof Error) {\n\t\t// v8 ignore next -- 错误经过 structuredClone 落盘,克隆体不可能形成循环引用\n\t\tif (seen.has(value)) return \"[Circular]\";\n\t\tseen.add(value);\n\t\tconst output: Record<string, unknown> = { name: value.name, message: value.message };\n\t\tconst code = (value as Error & { code?: unknown }).code;\n\t\tif (code !== undefined) output.code = transcriptValue(code, seen);\n\t\tconst cause = (value as Error & { cause?: unknown }).cause;\n\t\tif (cause !== undefined) output.cause = transcriptValue(cause, seen);\n\t\tfor (const key of Object.keys(value).sort()) {\n\t\t\tif (key === \"code\" || key === \"cause\") continue;\n\t\t\toutput[key] = transcriptValue((value as unknown as Record<string, unknown>)[key], seen);\n\t\t}\n\t\treturn output;\n\t}\n\t// v8 ignore next -- 值均来自 structuredClone 克隆,函数/符号无法存活\n\tif (typeof value !== \"object\") return String(value);\n\t// v8 ignore next -- 同上:克隆后的对象图无循环引用\n\tif (seen.has(value)) return \"[Circular]\";\n\tseen.add(value);\n\tif (Array.isArray(value)) return value.map((item) => transcriptValue(item, seen));\n\tconst output: Record<string, unknown> = {};\n\tfor (const key of Object.keys(value as Record<string, unknown>).sort()) {\n\t\toutput[key] = transcriptValue((value as Record<string, unknown>)[key], seen);\n\t}\n\treturn output;\n}\n\nfunction canonicalJson(value: unknown): string {\n\tconst serialized = JSON.stringify(transcriptValue(value));\n\t// v8 ignore next -- transcriptValue 已消毒全部值,JSON.stringify 不会返回 undefined\n\tif (serialized === undefined) throw new Error(\"Session plugin testkit transcript is not JSON-serializable\");\n\treturn serialized;\n}\n\n/**\n * The host's agentDir and workspaceDirectory are the fixture's mkdtemp paths —\n * environment-specific and random per run, not a behavioral signal. Mask them\n * so repeated-run transcript comparisons stay deterministic (D-075 S4 added\n * agentDir to HostCapabilities; workspaceDirectory rides the same channel).\n */\nfunction normalizeInspectorHost(host: HostCapabilities): HostCapabilities {\n\tif (host.agentDir === undefined && host.workspaceDirectory === undefined) return host;\n\treturn {\n\t\t...host,\n\t\t...(typeof host.agentDir === \"string\" && host.agentDir.length > 0 ? { agentDir: \"<agentDir>\" } : {}),\n\t\t...(typeof host.workspaceDirectory === \"string\" && host.workspaceDirectory.length > 0\n\t\t\t? { workspaceDirectory: \"<workspaceDirectory>\" }\n\t\t\t: {}),\n\t};\n}\n\nfunction stableInspector(snapshot: RuntimeInspectorSnapshot): SessionPluginTestKitInspector {\n\treturn {\n\t\thost: normalizeInspectorHost(snapshot.host),\n\t\tplugins: snapshot.plugins.map(({ id, version, active, provides, requires }) => ({\n\t\t\tid,\n\t\t\tversion,\n\t\t\tactive,\n\t\t\tprovides,\n\t\t\trequires,\n\t\t})),\n\t\tregistrations: snapshot.registrations,\n\t\tcontributionPoints: snapshot.contributionPoints.map(({ id, version, lifecycle, owner, active }) => ({\n\t\t\tid,\n\t\t\tversion,\n\t\t\tlifecycle,\n\t\t\towner,\n\t\t\tactive,\n\t\t})),\n\t\tcontributions: snapshot.contributions.map(({ id, pointId, version, owner, lifecycle }) => ({\n\t\t\tid,\n\t\t\tpointId,\n\t\t\tversion,\n\t\t\towner,\n\t\t\tlifecycle,\n\t\t})),\n\t\tlifecycle: snapshot.lifecycle.map(({ id, version, phase, schema, owner, active, registrations }) => ({\n\t\t\tid,\n\t\t\tversion,\n\t\t\tphase,\n\t\t\tschema,\n\t\t\towner,\n\t\t\tactive,\n\t\t\tregistrations,\n\t\t})),\n\t\tlifecycleReports: snapshot.lifecycleReports.map(\n\t\t\t({ eventId, type, version, phase, status, attempted, succeeded, failed, failures }) => ({\n\t\t\t\teventId,\n\t\t\t\ttype,\n\t\t\t\tversion,\n\t\t\t\tphase,\n\t\t\t\tstatus,\n\t\t\t\tattempted,\n\t\t\t\tsucceeded,\n\t\t\t\tfailed,\n\t\t\t\tfailures: failures.map(({ pluginId, registrationId, kind, error }) => ({\n\t\t\t\t\tpluginId,\n\t\t\t\t\tregistrationId,\n\t\t\t\t\tkind,\n\t\t\t\t\terror: transcriptValue(error),\n\t\t\t\t})),\n\t\t\t}),\n\t\t),\n\t\tpluginRejections: snapshot.pluginRejections,\n\t\tsubscriptions: snapshot.subscriptions,\n\t\toperations: snapshot.operations,\n\t\tlogs: snapshot.logs.map(\n\t\t\t({ version, level, message, fields, cause, pluginId, sessionId, operationId, correlationId, phase }) => ({\n\t\t\t\tversion,\n\t\t\t\tlevel,\n\t\t\t\tmessage,\n\t\t\t\t...(fields === undefined ? {} : { fields: transcriptValue(fields) }),\n\t\t\t\t...(cause === undefined ? {} : { cause: transcriptValue(cause) }),\n\t\t\t\tpluginId,\n\t\t\t\t...(sessionId === undefined ? {} : { sessionId }),\n\t\t\t\t...(operationId === undefined ? {} : { operationId }),\n\t\t\t\t...(correlationId === undefined ? {} : { correlationId }),\n\t\t\t\t...(phase === undefined ? {} : { phase }),\n\t\t\t}),\n\t\t),\n\t\tspans: snapshot.spans.map(\n\t\t\t({\n\t\t\t\tversion,\n\t\t\t\ttraceId,\n\t\t\t\tspanId,\n\t\t\t\tparentSpanId,\n\t\t\t\tname,\n\t\t\t\tpluginId,\n\t\t\t\tsessionId,\n\t\t\t\tstatus,\n\t\t\t\tattributes,\n\t\t\t\tresult,\n\t\t\t\tcause,\n\t\t\t\toperationId,\n\t\t\t\tcorrelationId,\n\t\t\t\tphase,\n\t\t\t}) => ({\n\t\t\t\tversion,\n\t\t\t\ttraceId,\n\t\t\t\tspanId,\n\t\t\t\t...(parentSpanId === undefined ? {} : { parentSpanId }),\n\t\t\t\tname,\n\t\t\t\tpluginId,\n\t\t\t\t...(sessionId === undefined ? {} : { sessionId }),\n\t\t\t\tattributes: transcriptValue(attributes),\n\t\t\t\tstatus,\n\t\t\t\t...(result === undefined ? {} : { result: transcriptValue(result) }),\n\t\t\t\t...(cause === undefined ? {} : { cause: transcriptValue(cause) }),\n\t\t\t\t...(operationId === undefined ? {} : { operationId }),\n\t\t\t\t...(correlationId === undefined ? {} : { correlationId }),\n\t\t\t\t...(phase === undefined ? {} : { phase }),\n\t\t\t}),\n\t\t),\n\t};\n}\n\nfunction modelConfig(model: {\n\tid: string;\n\tname: string;\n\tapi: string;\n\tprovider: string;\n\tbaseUrl: string;\n\treasoning: boolean;\n\tinput: readonly (\"text\" | \"image\")[];\n\tcost: { input: number; output: number; cacheRead: number; cacheWrite: number };\n\tcontextWindow: number;\n\tmaxTokens: number;\n}) {\n\treturn {\n\t\tid: model.id,\n\t\tname: model.name,\n\t\tapi: model.api,\n\t\tprovider: model.provider,\n\t\tbaseUrl: model.baseUrl,\n\t\treasoning: model.reasoning,\n\t\tinput: [...model.input],\n\t\tcost: model.cost,\n\t\tcontextWindow: model.contextWindow,\n\t\tmaxTokens: model.maxTokens,\n\t};\n}\n\n/** Create a complete deterministic AgentSession fixture and load inline capability plugins. */\nexport async function createSessionPluginTestKit(options: SessionPluginTestKitOptions): Promise<SessionPluginTestKit> {\n\tconst tempDir = await mkdtemp(join(tmpdir(), \"agent-forge-session-plugin-testkit-\"));\n\tconst providerId = options.providerId ?? DEFAULT_PROVIDER_ID;\n\tconst apiName = options.api ?? DEFAULT_API;\n\tlet faux: FauxProviderRegistration | undefined;\n\tlet session: AgentSession | undefined;\n\ttry {\n\t\tfaux = registerFauxProvider({\n\t\t\tapi: apiName,\n\t\t\tprovider: providerId,\n\t\t\tclock: () => 0,\n\t\t\tidFactory: (prefix, sequence) => `${prefix}-${sequence}`,\n\t\t});\n\t\tif (options.responses) faux.setResponses([...options.responses]);\n\t\tconst fauxRegistration = faux;\n\t\tconst model = fauxRegistration.getModel();\n\t\tconst authStorage = AuthStorage.inMemory();\n\t\tawait authStorage.modify(providerId, async () => ({ type: \"api_key\", key: \"faux-key\" }));\n\t\tconst modelRuntime = await ModelRuntime.create({\n\t\t\tcredentials: authStorage,\n\t\t\tmodelsPath: null,\n\t\t\tmodelsStore: new InMemoryCodingAgentModelsStore(),\n\t\t\tallowModelNetwork: false,\n\t\t\trefreshOnCreate: false,\n\t\t});\n\t\tmodelRuntime.registerProvider(providerId, {\n\t\t\tbaseUrl: model.baseUrl,\n\t\t\tapi: apiName,\n\t\t\tapiKey: \"faux-key\",\n\t\t\tmodels: fauxRegistration.models.map(modelConfig),\n\t\t});\n\t\tconst settingsManager = SettingsManager.create(tempDir, tempDir);\n\t\tconst resourceLoader = new DefaultResourceLoader({\n\t\t\tcwd: tempDir,\n\t\t\tagentDir: tempDir,\n\t\t\tsettingsManager,\n\t\t\tnoSkills: true,\n\t\t\tnoPromptTemplates: true,\n\t\t\tnoThemes: true,\n\t\t\tnoContextFiles: true,\n\t\t});\n\t\tawait resourceLoader.reload();\n\t\tconst sessionManager = SessionManager.inMemory(tempDir, { id: FIXED_SESSION_ID });\n\t\tconst created = await createAgentSession({\n\t\t\tagentDir: tempDir,\n\t\t\tnoTools: \"all\",\n\t\t\t// Custom fixture tools must be allowlisted explicitly: noTools=\"all\"\n\t\t\t// clears the allowlist, which would otherwise leave them inactive.\n\t\t\t...(options.tools === undefined\n\t\t\t\t? {}\n\t\t\t\t: { tools: options.tools.map((tool) => tool.name), customTools: [...options.tools] }),\n\t\t\tdiscoverCapabilityPlugins: false,\n\t\t\tenableAgentTasks: false,\n\t\t\t...(options.runLoopStrategyName === undefined ? {} : { runLoopStrategyName: options.runLoopStrategyName }),\n\t\t\tstreamFn: streamSimple,\n\t\t\tmodel,\n\t\t\tmodelRuntime,\n\t\t\tresourceLoader,\n\t\t\tsessionManager,\n\t\t\tsettingsManager,\n\t\t\tcwd: tempDir,\n\t\t\tagentComposition: options.composition,\n\t\t}).then(({ session: createdSession }) => createdSession);\n\t\tsession = created;\n\t\tconst activeSession = session;\n\t\tconst initialRuntime = activeSession.getCapabilityRuntime();\n\t\tconst handles = new Map<string, CapabilityPluginHandle>();\n\t\tconst pluginByManifest = new Map(options.plugins.map((plugin) => [plugin.manifest, plugin]));\n\t\tlet closing = false;\n\t\tlet disposed = false;\n\t\tlet disposePromise: Promise<void> | undefined;\n\t\tconst cleanup = async (): Promise<void> => {\n\t\t\tconst failures: unknown[] = [];\n\t\t\tfor (const handle of [...handles.values()].reverse()) {\n\t\t\t\ttry {\n\t\t\t\t\tawait handle.dispose();\n\t\t\t\t} catch (error) {\n\t\t\t\t\tfailures.push(error);\n\t\t\t\t}\n\t\t\t}\n\t\t\thandles.clear();\n\t\t\ttry {\n\t\t\t\tawait session?.dispose();\n\t\t\t} catch (error) {\n\t\t\t\tfailures.push(error);\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tfaux?.unregister();\n\t\t\t\tawait rm(tempDir, { recursive: true, force: true });\n\t\t\t} catch (error) {\n\t\t\t\tfailures.push(error);\n\t\t\t}\n\t\t\tif (failures.length === 1) throw failures[0];\n\t\t\tif (failures.length > 1) throw new AggregateError(failures, \"Session plugin testkit cleanup failed\");\n\t\t};\n\t\tconst ready = (async () => {\n\t\t\ttry {\n\t\t\t\tfor (const manifest of resolvePluginCapabilityOrder(options.plugins.map((plugin) => plugin.manifest))) {\n\t\t\t\t\t// v8 ignore next -- kit 仅在 ready 成功后返回,startup 期间不会调用 dispose\n\t\t\t\t\tif (closing) throw new Error(\"Session plugin testkit was disposed during startup\");\n\t\t\t\t\tconst plugin = pluginByManifest.get(manifest);\n\t\t\t\t\t// v8 ignore next -- plugins 数组同时供给加载顺序与 factory 映射,必可解析\n\t\t\t\t\tif (!plugin) throw new Error(`Session plugin testkit cannot resolve factory: ${manifest.id}`);\n\t\t\t\t\tconst handle = await activeSession.loadCapabilityPlugin(manifest, plugin.factory);\n\t\t\t\t\thandles.set(manifest.id, handle);\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\ttry {\n\t\t\t\t\tawait cleanup();\n\t\t\t\t} catch (cleanupError) {\n\t\t\t\t\tthrow new AggregateError([error, cleanupError], \"Session plugin testkit startup rollback failed\");\n\t\t\t\t}\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t})();\n\t\tconst kit: SessionPluginTestKit = {\n\t\t\tready,\n\t\t\tsession: activeSession,\n\t\t\tagent: activeSession.agent,\n\t\t\tget runtime(): CapabilityRuntime {\n\t\t\t\tif (disposed) throw new Error(\"Session plugin testkit runtime is disposed\");\n\t\t\t\treturn activeSession.getCapabilityRuntime();\n\t\t\t},\n\t\t\tfaux: fauxRegistration,\n\t\t\tapi(pluginId) {\n\t\t\t\tif (activeSession.getCapabilityRuntime() !== initialRuntime) {\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\tt(\n\t\t\t\t\t\t\t\"Session plugin testkit plugin API handles expire after session reload; access the current runtime directly\",\n\t\t\t\t\t\t),\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tconst handle = handles.get(pluginId);\n\t\t\t\tif (!handle) throw new Error(t(\"Session plugin testkit has no loaded plugin: {pluginId}\", { pluginId }));\n\t\t\t\treturn handle.api;\n\t\t\t},\n\t\t\trevoke(pluginId) {\n\t\t\t\tif (activeSession.getCapabilityRuntime() !== initialRuntime) {\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\tt(\n\t\t\t\t\t\t\t\"Session plugin testkit plugin API handles expire after session reload; access the current runtime directly\",\n\t\t\t\t\t\t),\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tconst handle = handles.get(pluginId);\n\t\t\t\tif (!handle) throw new Error(t(\"Session plugin testkit has no loaded plugin: {pluginId}\", { pluginId }));\n\t\t\t\tactiveSession.getCapabilityRuntime().revokeAPI(handle.api);\n\t\t\t},\n\t\t\tassertResponsesConsumed() {\n\t\t\t\tconst pending = fauxRegistration.getPendingResponseCount();\n\t\t\t\tif (pending !== 0) {\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\tpending === 1\n\t\t\t\t\t\t\t? t(\"Session plugin testkit has {count} unused faux response\", { count: pending })\n\t\t\t\t\t\t\t: t(\"Session plugin testkit has {count} unused faux responses\", { count: pending }),\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t},\n\t\t\tinspect: () => activeSession.getCapabilityRuntime().inspect(),\n\t\t\ttranscript: () => {\n\t\t\t\tconst branch = sessionManager.getBranch();\n\t\t\t\tconst transcript: SessionPluginTestKitTranscript = {\n\t\t\t\t\tversion: 1,\n\t\t\t\t\tsessionId: sessionManager.getSessionId(),\n\t\t\t\t\trevision: sessionManager.getRevision().sequence,\n\t\t\t\t\tloadOrder: [...handles.keys()],\n\t\t\t\t\tfauxCallCount: fauxRegistration.state.callCount,\n\t\t\t\t\tmessages: activeSession.agent.state.messages.map((message) => ({\n\t\t\t\t\t\trole: message.role,\n\t\t\t\t\t\ttext: stableText(message),\n\t\t\t\t\t})),\n\t\t\t\t\tentries: branch.map((entry) => ({\n\t\t\t\t\t\ttype: entry.type,\n\t\t\t\t\t\t...(entry.type === \"custom\"\n\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\tcustomType: entry.customType,\n\t\t\t\t\t\t\t\t\t...(entry.data === undefined ? {} : { data: transcriptValue(entry.data) }),\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t})),\n\t\t\t\t\tinspector: stableInspector(activeSession.getCapabilityRuntime().inspect()),\n\t\t\t\t};\n\t\t\t\treturn freezeSnapshot(transcript);\n\t\t\t},\n\t\t\tdispose: async () => {\n\t\t\t\tdisposePromise ??= (async () => {\n\t\t\t\t\tclosing = true;\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait ready;\n\t\t\t\t\t} catch {\n\t\t\t\t\t\t// Startup rollback already disposed the session and faux provider.\n\t\t\t\t\t\t// v8 ignore next -- ready 已在返回前 await,dispose 中不会进入该 catch\n\t\t\t\t\t\tif (session?.isDisposed) {\n\t\t\t\t\t\t\tdisposed = true;\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait cleanup();\n\t\t\t\t\t} finally {\n\t\t\t\t\t\tdisposed = true;\n\t\t\t\t\t}\n\t\t\t\t})();\n\t\t\t\treturn disposePromise;\n\t\t\t},\n\t\t};\n\t\tawait ready;\n\t\treturn kit;\n\t} catch (error) {\n\t\ttry {\n\t\t\tsession && (await session.dispose());\n\t\t} finally {\n\t\t\tfaux?.unregister();\n\t\t\tawait rm(tempDir, { recursive: true, force: true });\n\t\t}\n\t\tthrow error;\n\t}\n}\n\n/** Runs a session fixture repeatedly and rejects on the first transcript divergence. */\nexport async function repeatSessionPluginTestKit(\n\ttimes: number,\n\trun: () => Promise<SessionPluginTestKitTranscript>,\n): Promise<SessionPluginTestKitTranscript> {\n\tif (!Number.isSafeInteger(times) || times < 1)\n\t\tthrow new Error(t(\"Session plugin testkit repeat count must be a positive integer\"));\n\tlet baseline: SessionPluginTestKitTranscript | undefined;\n\tfor (let index = 0; index < times; index += 1) {\n\t\tconst transcript = await run();\n\t\tif (baseline && canonicalJson(transcript) !== canonicalJson(baseline)) {\n\t\t\tthrow new Error(t(\"Session plugin testkit transcript diverged on run {run}\", { run: index + 1 }));\n\t\t}\n\t\tbaseline = transcript;\n\t}\n\treturn baseline!;\n}\n"]}
|
|
@@ -4,6 +4,7 @@ import { join } from "node:path";
|
|
|
4
4
|
import { registerFauxProvider, streamSimple, } from "@agent-forge/ai/compat";
|
|
5
5
|
import { AuthStorage } from "../core/auth-storage.js";
|
|
6
6
|
import { resolvePluginCapabilityOrder } from "../core/extensions/capability-runtime.js";
|
|
7
|
+
import { t } from "../core/i18n/index.js";
|
|
7
8
|
import { ModelRuntime } from "../core/model-runtime.js";
|
|
8
9
|
import { InMemoryCodingAgentModelsStore } from "../core/models-store.js";
|
|
9
10
|
import { DefaultResourceLoader } from "../core/resource-loader.js";
|
|
@@ -348,26 +349,28 @@ export async function createSessionPluginTestKit(options) {
|
|
|
348
349
|
faux: fauxRegistration,
|
|
349
350
|
api(pluginId) {
|
|
350
351
|
if (activeSession.getCapabilityRuntime() !== initialRuntime) {
|
|
351
|
-
throw new Error("Session plugin testkit plugin API handles expire after session reload; access the current runtime directly");
|
|
352
|
+
throw new Error(t("Session plugin testkit plugin API handles expire after session reload; access the current runtime directly"));
|
|
352
353
|
}
|
|
353
354
|
const handle = handles.get(pluginId);
|
|
354
355
|
if (!handle)
|
|
355
|
-
throw new Error(
|
|
356
|
+
throw new Error(t("Session plugin testkit has no loaded plugin: {pluginId}", { pluginId }));
|
|
356
357
|
return handle.api;
|
|
357
358
|
},
|
|
358
359
|
revoke(pluginId) {
|
|
359
360
|
if (activeSession.getCapabilityRuntime() !== initialRuntime) {
|
|
360
|
-
throw new Error("Session plugin testkit plugin API handles expire after session reload; access the current runtime directly");
|
|
361
|
+
throw new Error(t("Session plugin testkit plugin API handles expire after session reload; access the current runtime directly"));
|
|
361
362
|
}
|
|
362
363
|
const handle = handles.get(pluginId);
|
|
363
364
|
if (!handle)
|
|
364
|
-
throw new Error(
|
|
365
|
+
throw new Error(t("Session plugin testkit has no loaded plugin: {pluginId}", { pluginId }));
|
|
365
366
|
activeSession.getCapabilityRuntime().revokeAPI(handle.api);
|
|
366
367
|
},
|
|
367
368
|
assertResponsesConsumed() {
|
|
368
369
|
const pending = fauxRegistration.getPendingResponseCount();
|
|
369
370
|
if (pending !== 0) {
|
|
370
|
-
throw new Error(
|
|
371
|
+
throw new Error(pending === 1
|
|
372
|
+
? t("Session plugin testkit has {count} unused faux response", { count: pending })
|
|
373
|
+
: t("Session plugin testkit has {count} unused faux responses", { count: pending }));
|
|
371
374
|
}
|
|
372
375
|
},
|
|
373
376
|
inspect: () => activeSession.getCapabilityRuntime().inspect(),
|
|
@@ -437,12 +440,12 @@ export async function createSessionPluginTestKit(options) {
|
|
|
437
440
|
/** Runs a session fixture repeatedly and rejects on the first transcript divergence. */
|
|
438
441
|
export async function repeatSessionPluginTestKit(times, run) {
|
|
439
442
|
if (!Number.isSafeInteger(times) || times < 1)
|
|
440
|
-
throw new Error("Session plugin testkit repeat count must be a positive integer");
|
|
443
|
+
throw new Error(t("Session plugin testkit repeat count must be a positive integer"));
|
|
441
444
|
let baseline;
|
|
442
445
|
for (let index = 0; index < times; index += 1) {
|
|
443
446
|
const transcript = await run();
|
|
444
447
|
if (baseline && canonicalJson(transcript) !== canonicalJson(baseline)) {
|
|
445
|
-
throw new Error(
|
|
448
|
+
throw new Error(t("Session plugin testkit transcript diverged on run {run}", { run: index + 1 }));
|
|
446
449
|
}
|
|
447
450
|
baseline = transcript;
|
|
448
451
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-plugin-testkit.js","sourceRoot":"","sources":["../../src/testing/session-plugin-testkit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAGN,oBAAoB,EACpB,YAAY,GACZ,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD,OAAO,EAA0B,4BAA4B,EAAE,MAAM,0CAA0C,CAAC;AAQhH,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,8BAA8B,EAAE,MAAM,yBAAyB,CAAC;AACzE,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE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C,CAAC;gBAAS,CAAC;YACV,IAAI,EAAE,UAAU,EAAE,CAAC;YACnB,MAAM,EAAE,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QACrD,CAAC;QACD,MAAM,KAAK,CAAC;IACb,CAAC;AAAA,CACD;AAED,wFAAwF;AACxF,MAAM,CAAC,KAAK,UAAU,0BAA0B,CAC/C,KAAa,EACb,GAAkD,EACR;IAC1C,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,KAAK,GAAG,CAAC;QAC5C,MAAM,IAAI,KAAK,CAAC,gEAAgE,CAAC,CAAC;IACnF,IAAI,QAAoD,CAAC;IACzD,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC;QAC/C,MAAM,UAAU,GAAG,MAAM,GAAG,EAAE,CAAC;QAC/B,IAAI,QAAQ,IAAI,aAAa,CAAC,UAAU,CAAC,KAAK,aAAa,CAAC,QAAQ,CAAC,EAAE,CAAC;YACvE,MAAM,IAAI,KAAK,CAAC,qDAAqD,KAAK,GAAG,CAAC,EAAE,CAAC,CAAC;QACnF,CAAC;QACD,QAAQ,GAAG,UAAU,CAAC;IACvB,CAAC;IACD,OAAO,QAAS,CAAC;AAAA,CACjB","sourcesContent":["import { mkdtemp, rm } from \"node:fs/promises\";\nimport { tmpdir } from \"node:os\";\nimport { join } from \"node:path\";\nimport type { Agent } from \"@agent-forge/agent-core\";\nimport {\n\ttype FauxProviderRegistration,\n\ttype FauxResponseStep,\n\tregisterFauxProvider,\n\tstreamSimple,\n} from \"@agent-forge/ai/compat\";\nimport type { AgentSession } from \"../core/agent-session.ts\";\nimport { AuthStorage } from \"../core/auth-storage.ts\";\nimport type { CapabilityPluginFactory, CapabilityPluginHandle } from \"../core/extensions/capability-plugin.ts\";\nimport { type CapabilityRuntime, resolvePluginCapabilityOrder } from \"../core/extensions/capability-runtime.ts\";\nimport type {\n\tAgentCompositionAPI,\n\tCapabilityAPI,\n\tHostCapabilities,\n\tPluginManifest,\n\tRuntimeInspectorSnapshot,\n} from \"../core/extensions/public-api.ts\";\nimport { ModelRuntime } from \"../core/model-runtime.ts\";\nimport { InMemoryCodingAgentModelsStore } from \"../core/models-store.ts\";\nimport { DefaultResourceLoader } from \"../core/resource-loader.ts\";\nimport { createAgentSession } from \"../core/sdk.ts\";\nimport { SessionManager } from \"../core/session-manager.ts\";\nimport { SettingsManager } from \"../core/settings-manager.ts\";\nimport type { ToolDefinition } from \"../core/tools/tool-definition.ts\";\n\nexport interface SessionPluginTestKitPlugin {\n\treadonly manifest: PluginManifest;\n\treadonly factory: CapabilityPluginFactory;\n}\n\nexport interface SessionPluginTestKitOptions {\n\treadonly plugins: readonly SessionPluginTestKitPlugin[];\n\treadonly responses?: readonly FauxResponseStep[];\n\treadonly providerId?: string;\n\treadonly api?: string;\n\treadonly composition?: AgentCompositionAPI;\n\t/** Custom tools registered on the fixture session for gated lifecycle scenarios. */\n\treadonly tools?: readonly ToolDefinition[];\n\t/** Post-run continuation strategy name selected through the public AgentSession config. */\n\treadonly runLoopStrategyName?: string;\n}\n\nexport interface SessionPluginTestKitInspector {\n\treadonly host: HostCapabilities;\n\treadonly plugins: readonly {\n\t\treadonly id: string;\n\t\treadonly version: string;\n\t\treadonly active: boolean;\n\t\treadonly provides: RuntimeInspectorSnapshot[\"plugins\"][number][\"provides\"];\n\t\treadonly requires: RuntimeInspectorSnapshot[\"plugins\"][number][\"requires\"];\n\t}[];\n\treadonly registrations: RuntimeInspectorSnapshot[\"registrations\"];\n\treadonly contributionPoints: readonly {\n\t\treadonly id: string;\n\t\treadonly version: number;\n\t\treadonly lifecycle: string;\n\t\treadonly owner: string;\n\t\treadonly active: boolean;\n\t}[];\n\treadonly contributions: readonly {\n\t\treadonly id: string;\n\t\treadonly pointId: string;\n\t\treadonly version: number;\n\t\treadonly owner: string;\n\t\treadonly lifecycle: string;\n\t}[];\n\treadonly lifecycle: readonly {\n\t\treadonly id: string;\n\t\treadonly version: number;\n\t\treadonly phase: string;\n\t\treadonly schema: string;\n\t\treadonly owner: string;\n\t\treadonly active: boolean;\n\t\treadonly registrations: readonly { readonly id: string; readonly kind: string; readonly owner: string }[];\n\t}[];\n\treadonly lifecycleReports: readonly {\n\t\treadonly eventId: string;\n\t\treadonly type: string;\n\t\treadonly version: number;\n\t\treadonly phase: string;\n\t\treadonly status: string;\n\t\treadonly attempted: number;\n\t\treadonly succeeded: number;\n\t\treadonly queued?: number;\n\t\treadonly failed: number;\n\t\treadonly failures: readonly {\n\t\t\treadonly pluginId: string;\n\t\t\treadonly registrationId: string;\n\t\t\treadonly kind: string;\n\t\t\treadonly error: unknown;\n\t\t}[];\n\t}[];\n\treadonly pluginRejections: RuntimeInspectorSnapshot[\"pluginRejections\"];\n\treadonly subscriptions: RuntimeInspectorSnapshot[\"subscriptions\"];\n\treadonly operations: RuntimeInspectorSnapshot[\"operations\"];\n\treadonly logs: readonly {\n\t\treadonly version: 1;\n\t\treadonly level: string;\n\t\treadonly message: string;\n\t\treadonly fields?: unknown;\n\t\treadonly cause?: unknown;\n\t\treadonly pluginId: string;\n\t\treadonly sessionId?: string;\n\t\treadonly operationId?: string;\n\t\treadonly correlationId?: string;\n\t\treadonly phase?: string;\n\t}[];\n\treadonly spans: readonly {\n\t\treadonly version: 1;\n\t\treadonly traceId: string;\n\t\treadonly spanId: string;\n\t\treadonly parentSpanId?: string;\n\t\treadonly name: string;\n\t\treadonly pluginId: string;\n\t\treadonly sessionId?: string;\n\t\treadonly status: string;\n\t\treadonly attributes: unknown;\n\t\treadonly result?: unknown;\n\t\treadonly cause?: unknown;\n\t\treadonly operationId?: string;\n\t\treadonly correlationId?: string;\n\t\treadonly phase?: string;\n\t}[];\n}\n\nexport interface SessionPluginTestKitTranscript {\n\treadonly version: 1;\n\treadonly sessionId: string;\n\treadonly revision: number;\n\treadonly loadOrder: readonly string[];\n\treadonly fauxCallCount: number;\n\treadonly messages: readonly { readonly role: string; readonly text: string }[];\n\treadonly entries: readonly { readonly type: string; readonly customType?: string; readonly data?: unknown }[];\n\treadonly inspector: SessionPluginTestKitInspector;\n}\n\nexport interface SessionPluginTestKit {\n\treadonly ready: Promise<void>;\n\treadonly session: AgentSession;\n\treadonly agent: Agent;\n\treadonly runtime: CapabilityRuntime;\n\treadonly faux: FauxProviderRegistration;\n\tapi(pluginId: string): CapabilityAPI;\n\trevoke(pluginId: string): void;\n\t/** Throws when a scripted response was not consumed by the fixture. */\n\tassertResponsesConsumed(): void;\n\tinspect(): RuntimeInspectorSnapshot;\n\ttranscript(): SessionPluginTestKitTranscript;\n\tdispose(): Promise<void>;\n}\n\nconst FIXED_SESSION_ID = \"session-plugin-testkit\";\nconst DEFAULT_PROVIDER_ID = \"faux-session-plugin-testkit\";\nconst DEFAULT_API = \"faux:session-plugin-testkit\";\n\nfunction stableText(message: unknown): string {\n\t// v8 ignore next -- 消息对象恒带 content 字段(AgentMessage 类型契约)\n\tif (!message || typeof message !== \"object\" || !(\"content\" in message)) return \"\";\n\tconst content = (message as { content?: unknown }).content;\n\t// v8 ignore next -- 助手消息的 content 恒为分段数组,字符串路径不会被命中\n\tif (typeof content === \"string\") return content;\n\t// v8 ignore next -- 同上:content 恒为数组\n\tif (!Array.isArray(content)) return \"\";\n\treturn content\n\t\t.filter((part): part is { type: \"text\"; text: string } => {\n\t\t\treturn (\n\t\t\t\ttypeof part === \"object\" &&\n\t\t\t\tpart !== null &&\n\t\t\t\t(part as { type?: unknown }).type === \"text\" &&\n\t\t\t\ttypeof (part as { text?: unknown }).text === \"string\"\n\t\t\t);\n\t\t})\n\t\t.map((part) => part.text)\n\t\t.join(\"\\n\");\n}\n\nfunction freezeSnapshot<T>(value: T): T {\n\tconst clone = structuredClone(value);\n\tconst freeze = (candidate: unknown): void => {\n\t\tif (!candidate || typeof candidate !== \"object\" || ArrayBuffer.isView(candidate)) return;\n\t\tfor (const child of Object.values(candidate as Record<string, unknown>)) freeze(child);\n\t\tObject.freeze(candidate);\n\t};\n\tfreeze(clone);\n\treturn clone;\n}\n\nfunction transcriptValue(value: unknown, seen = new WeakSet<object>()): unknown {\n\tif (value === null || typeof value === \"string\" || typeof value === \"boolean\") return value;\n\tif (typeof value === \"number\") return Number.isFinite(value) ? value : String(value);\n\tif (typeof value === \"bigint\") return `${value}n`;\n\tif (value === undefined) return null;\n\tif (value instanceof Error) {\n\t\t// v8 ignore next -- 错误经过 structuredClone 落盘,克隆体不可能形成循环引用\n\t\tif (seen.has(value)) return \"[Circular]\";\n\t\tseen.add(value);\n\t\tconst output: Record<string, unknown> = { name: value.name, message: value.message };\n\t\tconst code = (value as Error & { code?: unknown }).code;\n\t\tif (code !== undefined) output.code = transcriptValue(code, seen);\n\t\tconst cause = (value as Error & { cause?: unknown }).cause;\n\t\tif (cause !== undefined) output.cause = transcriptValue(cause, seen);\n\t\tfor (const key of Object.keys(value).sort()) {\n\t\t\tif (key === \"code\" || key === \"cause\") continue;\n\t\t\toutput[key] = transcriptValue((value as unknown as Record<string, unknown>)[key], seen);\n\t\t}\n\t\treturn output;\n\t}\n\t// v8 ignore next -- 值均来自 structuredClone 克隆,函数/符号无法存活\n\tif (typeof value !== \"object\") return String(value);\n\t// v8 ignore next -- 同上:克隆后的对象图无循环引用\n\tif (seen.has(value)) return \"[Circular]\";\n\tseen.add(value);\n\tif (Array.isArray(value)) return value.map((item) => transcriptValue(item, seen));\n\tconst output: Record<string, unknown> = {};\n\tfor (const key of Object.keys(value as Record<string, unknown>).sort()) {\n\t\toutput[key] = transcriptValue((value as Record<string, unknown>)[key], seen);\n\t}\n\treturn output;\n}\n\nfunction canonicalJson(value: unknown): string {\n\tconst serialized = JSON.stringify(transcriptValue(value));\n\t// v8 ignore next -- transcriptValue 已消毒全部值,JSON.stringify 不会返回 undefined\n\tif (serialized === undefined) throw new Error(\"Session plugin testkit transcript is not JSON-serializable\");\n\treturn serialized;\n}\n\n/**\n * The host's agentDir and workspaceDirectory are the fixture's mkdtemp paths —\n * environment-specific and random per run, not a behavioral signal. Mask them\n * so repeated-run transcript comparisons stay deterministic (D-075 S4 added\n * agentDir to HostCapabilities; workspaceDirectory rides the same channel).\n */\nfunction normalizeInspectorHost(host: HostCapabilities): HostCapabilities {\n\tif (host.agentDir === undefined && host.workspaceDirectory === undefined) return host;\n\treturn {\n\t\t...host,\n\t\t...(typeof host.agentDir === \"string\" && host.agentDir.length > 0 ? { agentDir: \"<agentDir>\" } : {}),\n\t\t...(typeof host.workspaceDirectory === \"string\" && host.workspaceDirectory.length > 0\n\t\t\t? { workspaceDirectory: \"<workspaceDirectory>\" }\n\t\t\t: {}),\n\t};\n}\n\nfunction stableInspector(snapshot: RuntimeInspectorSnapshot): SessionPluginTestKitInspector {\n\treturn {\n\t\thost: normalizeInspectorHost(snapshot.host),\n\t\tplugins: snapshot.plugins.map(({ id, version, active, provides, requires }) => ({\n\t\t\tid,\n\t\t\tversion,\n\t\t\tactive,\n\t\t\tprovides,\n\t\t\trequires,\n\t\t})),\n\t\tregistrations: snapshot.registrations,\n\t\tcontributionPoints: snapshot.contributionPoints.map(({ id, version, lifecycle, owner, active }) => ({\n\t\t\tid,\n\t\t\tversion,\n\t\t\tlifecycle,\n\t\t\towner,\n\t\t\tactive,\n\t\t})),\n\t\tcontributions: snapshot.contributions.map(({ id, pointId, version, owner, lifecycle }) => ({\n\t\t\tid,\n\t\t\tpointId,\n\t\t\tversion,\n\t\t\towner,\n\t\t\tlifecycle,\n\t\t})),\n\t\tlifecycle: snapshot.lifecycle.map(({ id, version, phase, schema, owner, active, registrations }) => ({\n\t\t\tid,\n\t\t\tversion,\n\t\t\tphase,\n\t\t\tschema,\n\t\t\towner,\n\t\t\tactive,\n\t\t\tregistrations,\n\t\t})),\n\t\tlifecycleReports: snapshot.lifecycleReports.map(\n\t\t\t({ eventId, type, version, phase, status, attempted, succeeded, failed, failures }) => ({\n\t\t\t\teventId,\n\t\t\t\ttype,\n\t\t\t\tversion,\n\t\t\t\tphase,\n\t\t\t\tstatus,\n\t\t\t\tattempted,\n\t\t\t\tsucceeded,\n\t\t\t\tfailed,\n\t\t\t\tfailures: failures.map(({ pluginId, registrationId, kind, error }) => ({\n\t\t\t\t\tpluginId,\n\t\t\t\t\tregistrationId,\n\t\t\t\t\tkind,\n\t\t\t\t\terror: transcriptValue(error),\n\t\t\t\t})),\n\t\t\t}),\n\t\t),\n\t\tpluginRejections: snapshot.pluginRejections,\n\t\tsubscriptions: snapshot.subscriptions,\n\t\toperations: snapshot.operations,\n\t\tlogs: snapshot.logs.map(\n\t\t\t({ version, level, message, fields, cause, pluginId, sessionId, operationId, correlationId, phase }) => ({\n\t\t\t\tversion,\n\t\t\t\tlevel,\n\t\t\t\tmessage,\n\t\t\t\t...(fields === undefined ? {} : { fields: transcriptValue(fields) }),\n\t\t\t\t...(cause === undefined ? {} : { cause: transcriptValue(cause) }),\n\t\t\t\tpluginId,\n\t\t\t\t...(sessionId === undefined ? {} : { sessionId }),\n\t\t\t\t...(operationId === undefined ? {} : { operationId }),\n\t\t\t\t...(correlationId === undefined ? {} : { correlationId }),\n\t\t\t\t...(phase === undefined ? {} : { phase }),\n\t\t\t}),\n\t\t),\n\t\tspans: snapshot.spans.map(\n\t\t\t({\n\t\t\t\tversion,\n\t\t\t\ttraceId,\n\t\t\t\tspanId,\n\t\t\t\tparentSpanId,\n\t\t\t\tname,\n\t\t\t\tpluginId,\n\t\t\t\tsessionId,\n\t\t\t\tstatus,\n\t\t\t\tattributes,\n\t\t\t\tresult,\n\t\t\t\tcause,\n\t\t\t\toperationId,\n\t\t\t\tcorrelationId,\n\t\t\t\tphase,\n\t\t\t}) => ({\n\t\t\t\tversion,\n\t\t\t\ttraceId,\n\t\t\t\tspanId,\n\t\t\t\t...(parentSpanId === undefined ? {} : { parentSpanId }),\n\t\t\t\tname,\n\t\t\t\tpluginId,\n\t\t\t\t...(sessionId === undefined ? {} : { sessionId }),\n\t\t\t\tattributes: transcriptValue(attributes),\n\t\t\t\tstatus,\n\t\t\t\t...(result === undefined ? {} : { result: transcriptValue(result) }),\n\t\t\t\t...(cause === undefined ? {} : { cause: transcriptValue(cause) }),\n\t\t\t\t...(operationId === undefined ? {} : { operationId }),\n\t\t\t\t...(correlationId === undefined ? {} : { correlationId }),\n\t\t\t\t...(phase === undefined ? {} : { phase }),\n\t\t\t}),\n\t\t),\n\t};\n}\n\nfunction modelConfig(model: {\n\tid: string;\n\tname: string;\n\tapi: string;\n\tprovider: string;\n\tbaseUrl: string;\n\treasoning: boolean;\n\tinput: readonly (\"text\" | \"image\")[];\n\tcost: { input: number; output: number; cacheRead: number; cacheWrite: number };\n\tcontextWindow: number;\n\tmaxTokens: number;\n}) {\n\treturn {\n\t\tid: model.id,\n\t\tname: model.name,\n\t\tapi: model.api,\n\t\tprovider: model.provider,\n\t\tbaseUrl: model.baseUrl,\n\t\treasoning: model.reasoning,\n\t\tinput: [...model.input],\n\t\tcost: model.cost,\n\t\tcontextWindow: model.contextWindow,\n\t\tmaxTokens: model.maxTokens,\n\t};\n}\n\n/** Create a complete deterministic AgentSession fixture and load inline capability plugins. */\nexport async function createSessionPluginTestKit(options: SessionPluginTestKitOptions): Promise<SessionPluginTestKit> {\n\tconst tempDir = await mkdtemp(join(tmpdir(), \"agent-forge-session-plugin-testkit-\"));\n\tconst providerId = options.providerId ?? DEFAULT_PROVIDER_ID;\n\tconst apiName = options.api ?? DEFAULT_API;\n\tlet faux: FauxProviderRegistration | undefined;\n\tlet session: AgentSession | undefined;\n\ttry {\n\t\tfaux = registerFauxProvider({\n\t\t\tapi: apiName,\n\t\t\tprovider: providerId,\n\t\t\tclock: () => 0,\n\t\t\tidFactory: (prefix, sequence) => `${prefix}-${sequence}`,\n\t\t});\n\t\tif (options.responses) faux.setResponses([...options.responses]);\n\t\tconst fauxRegistration = faux;\n\t\tconst model = fauxRegistration.getModel();\n\t\tconst authStorage = AuthStorage.inMemory();\n\t\tawait authStorage.modify(providerId, async () => ({ type: \"api_key\", key: \"faux-key\" }));\n\t\tconst modelRuntime = await ModelRuntime.create({\n\t\t\tcredentials: authStorage,\n\t\t\tmodelsPath: null,\n\t\t\tmodelsStore: new InMemoryCodingAgentModelsStore(),\n\t\t\tallowModelNetwork: false,\n\t\t\trefreshOnCreate: false,\n\t\t});\n\t\tmodelRuntime.registerProvider(providerId, {\n\t\t\tbaseUrl: model.baseUrl,\n\t\t\tapi: apiName,\n\t\t\tapiKey: \"faux-key\",\n\t\t\tmodels: fauxRegistration.models.map(modelConfig),\n\t\t});\n\t\tconst settingsManager = SettingsManager.create(tempDir, tempDir);\n\t\tconst resourceLoader = new DefaultResourceLoader({\n\t\t\tcwd: tempDir,\n\t\t\tagentDir: tempDir,\n\t\t\tsettingsManager,\n\t\t\tnoSkills: true,\n\t\t\tnoPromptTemplates: true,\n\t\t\tnoThemes: true,\n\t\t\tnoContextFiles: true,\n\t\t});\n\t\tawait resourceLoader.reload();\n\t\tconst sessionManager = SessionManager.inMemory(tempDir, { id: FIXED_SESSION_ID });\n\t\tconst created = await createAgentSession({\n\t\t\tagentDir: tempDir,\n\t\t\tnoTools: \"all\",\n\t\t\t// Custom fixture tools must be allowlisted explicitly: noTools=\"all\"\n\t\t\t// clears the allowlist, which would otherwise leave them inactive.\n\t\t\t...(options.tools === undefined\n\t\t\t\t? {}\n\t\t\t\t: { tools: options.tools.map((tool) => tool.name), customTools: [...options.tools] }),\n\t\t\tdiscoverCapabilityPlugins: false,\n\t\t\tenableAgentTasks: false,\n\t\t\t...(options.runLoopStrategyName === undefined ? {} : { runLoopStrategyName: options.runLoopStrategyName }),\n\t\t\tstreamFn: streamSimple,\n\t\t\tmodel,\n\t\t\tmodelRuntime,\n\t\t\tresourceLoader,\n\t\t\tsessionManager,\n\t\t\tsettingsManager,\n\t\t\tcwd: tempDir,\n\t\t\tagentComposition: options.composition,\n\t\t}).then(({ session: createdSession }) => createdSession);\n\t\tsession = created;\n\t\tconst activeSession = session;\n\t\tconst initialRuntime = activeSession.getCapabilityRuntime();\n\t\tconst handles = new Map<string, CapabilityPluginHandle>();\n\t\tconst pluginByManifest = new Map(options.plugins.map((plugin) => [plugin.manifest, plugin]));\n\t\tlet closing = false;\n\t\tlet disposed = false;\n\t\tlet disposePromise: Promise<void> | undefined;\n\t\tconst cleanup = async (): Promise<void> => {\n\t\t\tconst failures: unknown[] = [];\n\t\t\tfor (const handle of [...handles.values()].reverse()) {\n\t\t\t\ttry {\n\t\t\t\t\tawait handle.dispose();\n\t\t\t\t} catch (error) {\n\t\t\t\t\tfailures.push(error);\n\t\t\t\t}\n\t\t\t}\n\t\t\thandles.clear();\n\t\t\ttry {\n\t\t\t\tawait session?.dispose();\n\t\t\t} catch (error) {\n\t\t\t\tfailures.push(error);\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tfaux?.unregister();\n\t\t\t\tawait rm(tempDir, { recursive: true, force: true });\n\t\t\t} catch (error) {\n\t\t\t\tfailures.push(error);\n\t\t\t}\n\t\t\tif (failures.length === 1) throw failures[0];\n\t\t\tif (failures.length > 1) throw new AggregateError(failures, \"Session plugin testkit cleanup failed\");\n\t\t};\n\t\tconst ready = (async () => {\n\t\t\ttry {\n\t\t\t\tfor (const manifest of resolvePluginCapabilityOrder(options.plugins.map((plugin) => plugin.manifest))) {\n\t\t\t\t\t// v8 ignore next -- kit 仅在 ready 成功后返回,startup 期间不会调用 dispose\n\t\t\t\t\tif (closing) throw new Error(\"Session plugin testkit was disposed during startup\");\n\t\t\t\t\tconst plugin = pluginByManifest.get(manifest);\n\t\t\t\t\t// v8 ignore next -- plugins 数组同时供给加载顺序与 factory 映射,必可解析\n\t\t\t\t\tif (!plugin) throw new Error(`Session plugin testkit cannot resolve factory: ${manifest.id}`);\n\t\t\t\t\tconst handle = await activeSession.loadCapabilityPlugin(manifest, plugin.factory);\n\t\t\t\t\thandles.set(manifest.id, handle);\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\ttry {\n\t\t\t\t\tawait cleanup();\n\t\t\t\t} catch (cleanupError) {\n\t\t\t\t\tthrow new AggregateError([error, cleanupError], \"Session plugin testkit startup rollback failed\");\n\t\t\t\t}\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t})();\n\t\tconst kit: SessionPluginTestKit = {\n\t\t\tready,\n\t\t\tsession: activeSession,\n\t\t\tagent: activeSession.agent,\n\t\t\tget runtime(): CapabilityRuntime {\n\t\t\t\tif (disposed) throw new Error(\"Session plugin testkit runtime is disposed\");\n\t\t\t\treturn activeSession.getCapabilityRuntime();\n\t\t\t},\n\t\t\tfaux: fauxRegistration,\n\t\t\tapi(pluginId) {\n\t\t\t\tif (activeSession.getCapabilityRuntime() !== initialRuntime) {\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\"Session plugin testkit plugin API handles expire after session reload; access the current runtime directly\",\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tconst handle = handles.get(pluginId);\n\t\t\t\tif (!handle) throw new Error(`Session plugin testkit has no loaded plugin: ${pluginId}`);\n\t\t\t\treturn handle.api;\n\t\t\t},\n\t\t\trevoke(pluginId) {\n\t\t\t\tif (activeSession.getCapabilityRuntime() !== initialRuntime) {\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\"Session plugin testkit plugin API handles expire after session reload; access the current runtime directly\",\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tconst handle = handles.get(pluginId);\n\t\t\t\tif (!handle) throw new Error(`Session plugin testkit has no loaded plugin: ${pluginId}`);\n\t\t\t\tactiveSession.getCapabilityRuntime().revokeAPI(handle.api);\n\t\t\t},\n\t\t\tassertResponsesConsumed() {\n\t\t\t\tconst pending = fauxRegistration.getPendingResponseCount();\n\t\t\t\tif (pending !== 0) {\n\t\t\t\t\tthrow new Error(`Session plugin testkit has ${pending} unused faux response${pending === 1 ? \"\" : \"s\"}`);\n\t\t\t\t}\n\t\t\t},\n\t\t\tinspect: () => activeSession.getCapabilityRuntime().inspect(),\n\t\t\ttranscript: () => {\n\t\t\t\tconst branch = sessionManager.getBranch();\n\t\t\t\tconst transcript: SessionPluginTestKitTranscript = {\n\t\t\t\t\tversion: 1,\n\t\t\t\t\tsessionId: sessionManager.getSessionId(),\n\t\t\t\t\trevision: sessionManager.getRevision().sequence,\n\t\t\t\t\tloadOrder: [...handles.keys()],\n\t\t\t\t\tfauxCallCount: fauxRegistration.state.callCount,\n\t\t\t\t\tmessages: activeSession.agent.state.messages.map((message) => ({\n\t\t\t\t\t\trole: message.role,\n\t\t\t\t\t\ttext: stableText(message),\n\t\t\t\t\t})),\n\t\t\t\t\tentries: branch.map((entry) => ({\n\t\t\t\t\t\ttype: entry.type,\n\t\t\t\t\t\t...(entry.type === \"custom\"\n\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\tcustomType: entry.customType,\n\t\t\t\t\t\t\t\t\t...(entry.data === undefined ? {} : { data: transcriptValue(entry.data) }),\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t})),\n\t\t\t\t\tinspector: stableInspector(activeSession.getCapabilityRuntime().inspect()),\n\t\t\t\t};\n\t\t\t\treturn freezeSnapshot(transcript);\n\t\t\t},\n\t\t\tdispose: async () => {\n\t\t\t\tdisposePromise ??= (async () => {\n\t\t\t\t\tclosing = true;\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait ready;\n\t\t\t\t\t} catch {\n\t\t\t\t\t\t// Startup rollback already disposed the session and faux provider.\n\t\t\t\t\t\t// v8 ignore next -- ready 已在返回前 await,dispose 中不会进入该 catch\n\t\t\t\t\t\tif (session?.isDisposed) {\n\t\t\t\t\t\t\tdisposed = true;\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait cleanup();\n\t\t\t\t\t} finally {\n\t\t\t\t\t\tdisposed = true;\n\t\t\t\t\t}\n\t\t\t\t})();\n\t\t\t\treturn disposePromise;\n\t\t\t},\n\t\t};\n\t\tawait ready;\n\t\treturn kit;\n\t} catch (error) {\n\t\ttry {\n\t\t\tsession && (await session.dispose());\n\t\t} finally {\n\t\t\tfaux?.unregister();\n\t\t\tawait rm(tempDir, { recursive: true, force: true });\n\t\t}\n\t\tthrow error;\n\t}\n}\n\n/** Runs a session fixture repeatedly and rejects on the first transcript divergence. */\nexport async function repeatSessionPluginTestKit(\n\ttimes: number,\n\trun: () => Promise<SessionPluginTestKitTranscript>,\n): Promise<SessionPluginTestKitTranscript> {\n\tif (!Number.isSafeInteger(times) || times < 1)\n\t\tthrow new Error(\"Session plugin testkit repeat count must be a positive integer\");\n\tlet baseline: SessionPluginTestKitTranscript | undefined;\n\tfor (let index = 0; index < times; index += 1) {\n\t\tconst transcript = await run();\n\t\tif (baseline && canonicalJson(transcript) !== canonicalJson(baseline)) {\n\t\t\tthrow new Error(`Session plugin testkit transcript diverged on run ${index + 1}`);\n\t\t}\n\t\tbaseline = transcript;\n\t}\n\treturn baseline!;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"session-plugin-testkit.js","sourceRoot":"","sources":["../../src/testing/session-plugin-testkit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAGN,oBAAoB,EACpB,YAAY,GACZ,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD,OAAO,EAA0B,4BAA4B,EAAE,MAAM,0CAA0C,CAAC;AAQhH,OAAO,EAAE,CAAC,EAAE,MAAM,uBAAuB,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,8BAA8B,EAAE,MAAM,yBAAyB,CAAC;AACzE,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4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YAAA,CACtB;SACD,CAAC;QACF,MAAM,KAAK,CAAC;QACZ,OAAO,GAAG,CAAC;IACZ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,IAAI,CAAC;YACJ,OAAO,IAAI,CAAC,MAAM,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;QACtC,CAAC;gBAAS,CAAC;YACV,IAAI,EAAE,UAAU,EAAE,CAAC;YACnB,MAAM,EAAE,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QACrD,CAAC;QACD,MAAM,KAAK,CAAC;IACb,CAAC;AAAA,CACD;AAED,wFAAwF;AACxF,MAAM,CAAC,KAAK,UAAU,0BAA0B,CAC/C,KAAa,EACb,GAAkD,EACR;IAC1C,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,KAAK,GAAG,CAAC;QAC5C,MAAM,IAAI,KAAK,CAAC,CAAC,CAAC,gEAAgE,CAAC,CAAC,CAAC;IACtF,IAAI,QAAoD,CAAC;IACzD,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC;QAC/C,MAAM,UAAU,GAAG,MAAM,GAAG,EAAE,CAAC;QAC/B,IAAI,QAAQ,IAAI,aAAa,CAAC,UAAU,CAAC,KAAK,aAAa,CAAC,QAAQ,CAAC,EAAE,CAAC;YACvE,MAAM,IAAI,KAAK,CAAC,CAAC,CAAC,yDAAyD,EAAE,EAAE,GAAG,EAAE,KAAK,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;QACnG,CAAC;QACD,QAAQ,GAAG,UAAU,CAAC;IACvB,CAAC;IACD,OAAO,QAAS,CAAC;AAAA,CACjB","sourcesContent":["import { mkdtemp, rm } from \"node:fs/promises\";\nimport { tmpdir } from \"node:os\";\nimport { join } from \"node:path\";\nimport type { Agent } from \"@agent-forge/agent-core\";\nimport {\n\ttype FauxProviderRegistration,\n\ttype FauxResponseStep,\n\tregisterFauxProvider,\n\tstreamSimple,\n} from \"@agent-forge/ai/compat\";\nimport type { AgentSession } from \"../core/agent-session.ts\";\nimport { AuthStorage } from \"../core/auth-storage.ts\";\nimport type { CapabilityPluginFactory, CapabilityPluginHandle } from \"../core/extensions/capability-plugin.ts\";\nimport { type CapabilityRuntime, resolvePluginCapabilityOrder } from \"../core/extensions/capability-runtime.ts\";\nimport type {\n\tAgentCompositionAPI,\n\tCapabilityAPI,\n\tHostCapabilities,\n\tPluginManifest,\n\tRuntimeInspectorSnapshot,\n} from \"../core/extensions/public-api.ts\";\nimport { t } from \"../core/i18n/index.ts\";\nimport { ModelRuntime } from \"../core/model-runtime.ts\";\nimport { InMemoryCodingAgentModelsStore } from \"../core/models-store.ts\";\nimport { DefaultResourceLoader } from \"../core/resource-loader.ts\";\nimport { createAgentSession } from \"../core/sdk.ts\";\nimport { SessionManager } from \"../core/session-manager.ts\";\nimport { SettingsManager } from \"../core/settings-manager.ts\";\nimport type { ToolDefinition } from \"../core/tools/tool-definition.ts\";\n\nexport interface SessionPluginTestKitPlugin {\n\treadonly manifest: PluginManifest;\n\treadonly factory: CapabilityPluginFactory;\n}\n\nexport interface SessionPluginTestKitOptions {\n\treadonly plugins: readonly SessionPluginTestKitPlugin[];\n\treadonly responses?: readonly FauxResponseStep[];\n\treadonly providerId?: string;\n\treadonly api?: string;\n\treadonly composition?: AgentCompositionAPI;\n\t/** Custom tools registered on the fixture session for gated lifecycle scenarios. */\n\treadonly tools?: readonly ToolDefinition[];\n\t/** Post-run continuation strategy name selected through the public AgentSession config. */\n\treadonly runLoopStrategyName?: string;\n}\n\nexport interface SessionPluginTestKitInspector {\n\treadonly host: HostCapabilities;\n\treadonly plugins: readonly {\n\t\treadonly id: string;\n\t\treadonly version: string;\n\t\treadonly active: boolean;\n\t\treadonly provides: RuntimeInspectorSnapshot[\"plugins\"][number][\"provides\"];\n\t\treadonly requires: RuntimeInspectorSnapshot[\"plugins\"][number][\"requires\"];\n\t}[];\n\treadonly registrations: RuntimeInspectorSnapshot[\"registrations\"];\n\treadonly contributionPoints: readonly {\n\t\treadonly id: string;\n\t\treadonly version: number;\n\t\treadonly lifecycle: string;\n\t\treadonly owner: string;\n\t\treadonly active: boolean;\n\t}[];\n\treadonly contributions: readonly {\n\t\treadonly id: string;\n\t\treadonly pointId: string;\n\t\treadonly version: number;\n\t\treadonly owner: string;\n\t\treadonly lifecycle: string;\n\t}[];\n\treadonly lifecycle: readonly {\n\t\treadonly id: string;\n\t\treadonly version: number;\n\t\treadonly phase: string;\n\t\treadonly schema: string;\n\t\treadonly owner: string;\n\t\treadonly active: boolean;\n\t\treadonly registrations: readonly { readonly id: string; readonly kind: string; readonly owner: string }[];\n\t}[];\n\treadonly lifecycleReports: readonly {\n\t\treadonly eventId: string;\n\t\treadonly type: string;\n\t\treadonly version: number;\n\t\treadonly phase: string;\n\t\treadonly status: string;\n\t\treadonly attempted: number;\n\t\treadonly succeeded: number;\n\t\treadonly queued?: number;\n\t\treadonly failed: number;\n\t\treadonly failures: readonly {\n\t\t\treadonly pluginId: string;\n\t\t\treadonly registrationId: string;\n\t\t\treadonly kind: string;\n\t\t\treadonly error: unknown;\n\t\t}[];\n\t}[];\n\treadonly pluginRejections: RuntimeInspectorSnapshot[\"pluginRejections\"];\n\treadonly subscriptions: RuntimeInspectorSnapshot[\"subscriptions\"];\n\treadonly operations: RuntimeInspectorSnapshot[\"operations\"];\n\treadonly logs: readonly {\n\t\treadonly version: 1;\n\t\treadonly level: string;\n\t\treadonly message: string;\n\t\treadonly fields?: unknown;\n\t\treadonly cause?: unknown;\n\t\treadonly pluginId: string;\n\t\treadonly sessionId?: string;\n\t\treadonly operationId?: string;\n\t\treadonly correlationId?: string;\n\t\treadonly phase?: string;\n\t}[];\n\treadonly spans: readonly {\n\t\treadonly version: 1;\n\t\treadonly traceId: string;\n\t\treadonly spanId: string;\n\t\treadonly parentSpanId?: string;\n\t\treadonly name: string;\n\t\treadonly pluginId: string;\n\t\treadonly sessionId?: string;\n\t\treadonly status: string;\n\t\treadonly attributes: unknown;\n\t\treadonly result?: unknown;\n\t\treadonly cause?: unknown;\n\t\treadonly operationId?: string;\n\t\treadonly correlationId?: string;\n\t\treadonly phase?: string;\n\t}[];\n}\n\nexport interface SessionPluginTestKitTranscript {\n\treadonly version: 1;\n\treadonly sessionId: string;\n\treadonly revision: number;\n\treadonly loadOrder: readonly string[];\n\treadonly fauxCallCount: number;\n\treadonly messages: readonly { readonly role: string; readonly text: string }[];\n\treadonly entries: readonly { readonly type: string; readonly customType?: string; readonly data?: unknown }[];\n\treadonly inspector: SessionPluginTestKitInspector;\n}\n\nexport interface SessionPluginTestKit {\n\treadonly ready: Promise<void>;\n\treadonly session: AgentSession;\n\treadonly agent: Agent;\n\treadonly runtime: CapabilityRuntime;\n\treadonly faux: FauxProviderRegistration;\n\tapi(pluginId: string): CapabilityAPI;\n\trevoke(pluginId: string): void;\n\t/** Throws when a scripted response was not consumed by the fixture. */\n\tassertResponsesConsumed(): void;\n\tinspect(): RuntimeInspectorSnapshot;\n\ttranscript(): SessionPluginTestKitTranscript;\n\tdispose(): Promise<void>;\n}\n\nconst FIXED_SESSION_ID = \"session-plugin-testkit\";\nconst DEFAULT_PROVIDER_ID = \"faux-session-plugin-testkit\";\nconst DEFAULT_API = \"faux:session-plugin-testkit\";\n\nfunction stableText(message: unknown): string {\n\t// v8 ignore next -- 消息对象恒带 content 字段(AgentMessage 类型契约)\n\tif (!message || typeof message !== \"object\" || !(\"content\" in message)) return \"\";\n\tconst content = (message as { content?: unknown }).content;\n\t// v8 ignore next -- 助手消息的 content 恒为分段数组,字符串路径不会被命中\n\tif (typeof content === \"string\") return content;\n\t// v8 ignore next -- 同上:content 恒为数组\n\tif (!Array.isArray(content)) return \"\";\n\treturn content\n\t\t.filter((part): part is { type: \"text\"; text: string } => {\n\t\t\treturn (\n\t\t\t\ttypeof part === \"object\" &&\n\t\t\t\tpart !== null &&\n\t\t\t\t(part as { type?: unknown }).type === \"text\" &&\n\t\t\t\ttypeof (part as { text?: unknown }).text === \"string\"\n\t\t\t);\n\t\t})\n\t\t.map((part) => part.text)\n\t\t.join(\"\\n\");\n}\n\nfunction freezeSnapshot<T>(value: T): T {\n\tconst clone = structuredClone(value);\n\tconst freeze = (candidate: unknown): void => {\n\t\tif (!candidate || typeof candidate !== \"object\" || ArrayBuffer.isView(candidate)) return;\n\t\tfor (const child of Object.values(candidate as Record<string, unknown>)) freeze(child);\n\t\tObject.freeze(candidate);\n\t};\n\tfreeze(clone);\n\treturn clone;\n}\n\nfunction transcriptValue(value: unknown, seen = new WeakSet<object>()): unknown {\n\tif (value === null || typeof value === \"string\" || typeof value === \"boolean\") return value;\n\tif (typeof value === \"number\") return Number.isFinite(value) ? value : String(value);\n\tif (typeof value === \"bigint\") return `${value}n`;\n\tif (value === undefined) return null;\n\tif (value instanceof Error) {\n\t\t// v8 ignore next -- 错误经过 structuredClone 落盘,克隆体不可能形成循环引用\n\t\tif (seen.has(value)) return \"[Circular]\";\n\t\tseen.add(value);\n\t\tconst output: Record<string, unknown> = { name: value.name, message: value.message };\n\t\tconst code = (value as Error & { code?: unknown }).code;\n\t\tif (code !== undefined) output.code = transcriptValue(code, seen);\n\t\tconst cause = (value as Error & { cause?: unknown }).cause;\n\t\tif (cause !== undefined) output.cause = transcriptValue(cause, seen);\n\t\tfor (const key of Object.keys(value).sort()) {\n\t\t\tif (key === \"code\" || key === \"cause\") continue;\n\t\t\toutput[key] = transcriptValue((value as unknown as Record<string, unknown>)[key], seen);\n\t\t}\n\t\treturn output;\n\t}\n\t// v8 ignore next -- 值均来自 structuredClone 克隆,函数/符号无法存活\n\tif (typeof value !== \"object\") return String(value);\n\t// v8 ignore next -- 同上:克隆后的对象图无循环引用\n\tif (seen.has(value)) return \"[Circular]\";\n\tseen.add(value);\n\tif (Array.isArray(value)) return value.map((item) => transcriptValue(item, seen));\n\tconst output: Record<string, unknown> = {};\n\tfor (const key of Object.keys(value as Record<string, unknown>).sort()) {\n\t\toutput[key] = transcriptValue((value as Record<string, unknown>)[key], seen);\n\t}\n\treturn output;\n}\n\nfunction canonicalJson(value: unknown): string {\n\tconst serialized = JSON.stringify(transcriptValue(value));\n\t// v8 ignore next -- transcriptValue 已消毒全部值,JSON.stringify 不会返回 undefined\n\tif (serialized === undefined) throw new Error(\"Session plugin testkit transcript is not JSON-serializable\");\n\treturn serialized;\n}\n\n/**\n * The host's agentDir and workspaceDirectory are the fixture's mkdtemp paths —\n * environment-specific and random per run, not a behavioral signal. Mask them\n * so repeated-run transcript comparisons stay deterministic (D-075 S4 added\n * agentDir to HostCapabilities; workspaceDirectory rides the same channel).\n */\nfunction normalizeInspectorHost(host: HostCapabilities): HostCapabilities {\n\tif (host.agentDir === undefined && host.workspaceDirectory === undefined) return host;\n\treturn {\n\t\t...host,\n\t\t...(typeof host.agentDir === \"string\" && host.agentDir.length > 0 ? { agentDir: \"<agentDir>\" } : {}),\n\t\t...(typeof host.workspaceDirectory === \"string\" && host.workspaceDirectory.length > 0\n\t\t\t? { workspaceDirectory: \"<workspaceDirectory>\" }\n\t\t\t: {}),\n\t};\n}\n\nfunction stableInspector(snapshot: RuntimeInspectorSnapshot): SessionPluginTestKitInspector {\n\treturn {\n\t\thost: normalizeInspectorHost(snapshot.host),\n\t\tplugins: snapshot.plugins.map(({ id, version, active, provides, requires }) => ({\n\t\t\tid,\n\t\t\tversion,\n\t\t\tactive,\n\t\t\tprovides,\n\t\t\trequires,\n\t\t})),\n\t\tregistrations: snapshot.registrations,\n\t\tcontributionPoints: snapshot.contributionPoints.map(({ id, version, lifecycle, owner, active }) => ({\n\t\t\tid,\n\t\t\tversion,\n\t\t\tlifecycle,\n\t\t\towner,\n\t\t\tactive,\n\t\t})),\n\t\tcontributions: snapshot.contributions.map(({ id, pointId, version, owner, lifecycle }) => ({\n\t\t\tid,\n\t\t\tpointId,\n\t\t\tversion,\n\t\t\towner,\n\t\t\tlifecycle,\n\t\t})),\n\t\tlifecycle: snapshot.lifecycle.map(({ id, version, phase, schema, owner, active, registrations }) => ({\n\t\t\tid,\n\t\t\tversion,\n\t\t\tphase,\n\t\t\tschema,\n\t\t\towner,\n\t\t\tactive,\n\t\t\tregistrations,\n\t\t})),\n\t\tlifecycleReports: snapshot.lifecycleReports.map(\n\t\t\t({ eventId, type, version, phase, status, attempted, succeeded, failed, failures }) => ({\n\t\t\t\teventId,\n\t\t\t\ttype,\n\t\t\t\tversion,\n\t\t\t\tphase,\n\t\t\t\tstatus,\n\t\t\t\tattempted,\n\t\t\t\tsucceeded,\n\t\t\t\tfailed,\n\t\t\t\tfailures: failures.map(({ pluginId, registrationId, kind, error }) => ({\n\t\t\t\t\tpluginId,\n\t\t\t\t\tregistrationId,\n\t\t\t\t\tkind,\n\t\t\t\t\terror: transcriptValue(error),\n\t\t\t\t})),\n\t\t\t}),\n\t\t),\n\t\tpluginRejections: snapshot.pluginRejections,\n\t\tsubscriptions: snapshot.subscriptions,\n\t\toperations: snapshot.operations,\n\t\tlogs: snapshot.logs.map(\n\t\t\t({ version, level, message, fields, cause, pluginId, sessionId, operationId, correlationId, phase }) => ({\n\t\t\t\tversion,\n\t\t\t\tlevel,\n\t\t\t\tmessage,\n\t\t\t\t...(fields === undefined ? {} : { fields: transcriptValue(fields) }),\n\t\t\t\t...(cause === undefined ? {} : { cause: transcriptValue(cause) }),\n\t\t\t\tpluginId,\n\t\t\t\t...(sessionId === undefined ? {} : { sessionId }),\n\t\t\t\t...(operationId === undefined ? {} : { operationId }),\n\t\t\t\t...(correlationId === undefined ? {} : { correlationId }),\n\t\t\t\t...(phase === undefined ? {} : { phase }),\n\t\t\t}),\n\t\t),\n\t\tspans: snapshot.spans.map(\n\t\t\t({\n\t\t\t\tversion,\n\t\t\t\ttraceId,\n\t\t\t\tspanId,\n\t\t\t\tparentSpanId,\n\t\t\t\tname,\n\t\t\t\tpluginId,\n\t\t\t\tsessionId,\n\t\t\t\tstatus,\n\t\t\t\tattributes,\n\t\t\t\tresult,\n\t\t\t\tcause,\n\t\t\t\toperationId,\n\t\t\t\tcorrelationId,\n\t\t\t\tphase,\n\t\t\t}) => ({\n\t\t\t\tversion,\n\t\t\t\ttraceId,\n\t\t\t\tspanId,\n\t\t\t\t...(parentSpanId === undefined ? {} : { parentSpanId }),\n\t\t\t\tname,\n\t\t\t\tpluginId,\n\t\t\t\t...(sessionId === undefined ? {} : { sessionId }),\n\t\t\t\tattributes: transcriptValue(attributes),\n\t\t\t\tstatus,\n\t\t\t\t...(result === undefined ? {} : { result: transcriptValue(result) }),\n\t\t\t\t...(cause === undefined ? {} : { cause: transcriptValue(cause) }),\n\t\t\t\t...(operationId === undefined ? {} : { operationId }),\n\t\t\t\t...(correlationId === undefined ? {} : { correlationId }),\n\t\t\t\t...(phase === undefined ? {} : { phase }),\n\t\t\t}),\n\t\t),\n\t};\n}\n\nfunction modelConfig(model: {\n\tid: string;\n\tname: string;\n\tapi: string;\n\tprovider: string;\n\tbaseUrl: string;\n\treasoning: boolean;\n\tinput: readonly (\"text\" | \"image\")[];\n\tcost: { input: number; output: number; cacheRead: number; cacheWrite: number };\n\tcontextWindow: number;\n\tmaxTokens: number;\n}) {\n\treturn {\n\t\tid: model.id,\n\t\tname: model.name,\n\t\tapi: model.api,\n\t\tprovider: model.provider,\n\t\tbaseUrl: model.baseUrl,\n\t\treasoning: model.reasoning,\n\t\tinput: [...model.input],\n\t\tcost: model.cost,\n\t\tcontextWindow: model.contextWindow,\n\t\tmaxTokens: model.maxTokens,\n\t};\n}\n\n/** Create a complete deterministic AgentSession fixture and load inline capability plugins. */\nexport async function createSessionPluginTestKit(options: SessionPluginTestKitOptions): Promise<SessionPluginTestKit> {\n\tconst tempDir = await mkdtemp(join(tmpdir(), \"agent-forge-session-plugin-testkit-\"));\n\tconst providerId = options.providerId ?? DEFAULT_PROVIDER_ID;\n\tconst apiName = options.api ?? DEFAULT_API;\n\tlet faux: FauxProviderRegistration | undefined;\n\tlet session: AgentSession | undefined;\n\ttry {\n\t\tfaux = registerFauxProvider({\n\t\t\tapi: apiName,\n\t\t\tprovider: providerId,\n\t\t\tclock: () => 0,\n\t\t\tidFactory: (prefix, sequence) => `${prefix}-${sequence}`,\n\t\t});\n\t\tif (options.responses) faux.setResponses([...options.responses]);\n\t\tconst fauxRegistration = faux;\n\t\tconst model = fauxRegistration.getModel();\n\t\tconst authStorage = AuthStorage.inMemory();\n\t\tawait authStorage.modify(providerId, async () => ({ type: \"api_key\", key: \"faux-key\" }));\n\t\tconst modelRuntime = await ModelRuntime.create({\n\t\t\tcredentials: authStorage,\n\t\t\tmodelsPath: null,\n\t\t\tmodelsStore: new InMemoryCodingAgentModelsStore(),\n\t\t\tallowModelNetwork: false,\n\t\t\trefreshOnCreate: false,\n\t\t});\n\t\tmodelRuntime.registerProvider(providerId, {\n\t\t\tbaseUrl: model.baseUrl,\n\t\t\tapi: apiName,\n\t\t\tapiKey: \"faux-key\",\n\t\t\tmodels: fauxRegistration.models.map(modelConfig),\n\t\t});\n\t\tconst settingsManager = SettingsManager.create(tempDir, tempDir);\n\t\tconst resourceLoader = new DefaultResourceLoader({\n\t\t\tcwd: tempDir,\n\t\t\tagentDir: tempDir,\n\t\t\tsettingsManager,\n\t\t\tnoSkills: true,\n\t\t\tnoPromptTemplates: true,\n\t\t\tnoThemes: true,\n\t\t\tnoContextFiles: true,\n\t\t});\n\t\tawait resourceLoader.reload();\n\t\tconst sessionManager = SessionManager.inMemory(tempDir, { id: FIXED_SESSION_ID });\n\t\tconst created = await createAgentSession({\n\t\t\tagentDir: tempDir,\n\t\t\tnoTools: \"all\",\n\t\t\t// Custom fixture tools must be allowlisted explicitly: noTools=\"all\"\n\t\t\t// clears the allowlist, which would otherwise leave them inactive.\n\t\t\t...(options.tools === undefined\n\t\t\t\t? {}\n\t\t\t\t: { tools: options.tools.map((tool) => tool.name), customTools: [...options.tools] }),\n\t\t\tdiscoverCapabilityPlugins: false,\n\t\t\tenableAgentTasks: false,\n\t\t\t...(options.runLoopStrategyName === undefined ? {} : { runLoopStrategyName: options.runLoopStrategyName }),\n\t\t\tstreamFn: streamSimple,\n\t\t\tmodel,\n\t\t\tmodelRuntime,\n\t\t\tresourceLoader,\n\t\t\tsessionManager,\n\t\t\tsettingsManager,\n\t\t\tcwd: tempDir,\n\t\t\tagentComposition: options.composition,\n\t\t}).then(({ session: createdSession }) => createdSession);\n\t\tsession = created;\n\t\tconst activeSession = session;\n\t\tconst initialRuntime = activeSession.getCapabilityRuntime();\n\t\tconst handles = new Map<string, CapabilityPluginHandle>();\n\t\tconst pluginByManifest = new Map(options.plugins.map((plugin) => [plugin.manifest, plugin]));\n\t\tlet closing = false;\n\t\tlet disposed = false;\n\t\tlet disposePromise: Promise<void> | undefined;\n\t\tconst cleanup = async (): Promise<void> => {\n\t\t\tconst failures: unknown[] = [];\n\t\t\tfor (const handle of [...handles.values()].reverse()) {\n\t\t\t\ttry {\n\t\t\t\t\tawait handle.dispose();\n\t\t\t\t} catch (error) {\n\t\t\t\t\tfailures.push(error);\n\t\t\t\t}\n\t\t\t}\n\t\t\thandles.clear();\n\t\t\ttry {\n\t\t\t\tawait session?.dispose();\n\t\t\t} catch (error) {\n\t\t\t\tfailures.push(error);\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tfaux?.unregister();\n\t\t\t\tawait rm(tempDir, { recursive: true, force: true });\n\t\t\t} catch (error) {\n\t\t\t\tfailures.push(error);\n\t\t\t}\n\t\t\tif (failures.length === 1) throw failures[0];\n\t\t\tif (failures.length > 1) throw new AggregateError(failures, \"Session plugin testkit cleanup failed\");\n\t\t};\n\t\tconst ready = (async () => {\n\t\t\ttry {\n\t\t\t\tfor (const manifest of resolvePluginCapabilityOrder(options.plugins.map((plugin) => plugin.manifest))) {\n\t\t\t\t\t// v8 ignore next -- kit 仅在 ready 成功后返回,startup 期间不会调用 dispose\n\t\t\t\t\tif (closing) throw new Error(\"Session plugin testkit was disposed during startup\");\n\t\t\t\t\tconst plugin = pluginByManifest.get(manifest);\n\t\t\t\t\t// v8 ignore next -- plugins 数组同时供给加载顺序与 factory 映射,必可解析\n\t\t\t\t\tif (!plugin) throw new Error(`Session plugin testkit cannot resolve factory: ${manifest.id}`);\n\t\t\t\t\tconst handle = await activeSession.loadCapabilityPlugin(manifest, plugin.factory);\n\t\t\t\t\thandles.set(manifest.id, handle);\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\ttry {\n\t\t\t\t\tawait cleanup();\n\t\t\t\t} catch (cleanupError) {\n\t\t\t\t\tthrow new AggregateError([error, cleanupError], \"Session plugin testkit startup rollback failed\");\n\t\t\t\t}\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t})();\n\t\tconst kit: SessionPluginTestKit = {\n\t\t\tready,\n\t\t\tsession: activeSession,\n\t\t\tagent: activeSession.agent,\n\t\t\tget runtime(): CapabilityRuntime {\n\t\t\t\tif (disposed) throw new Error(\"Session plugin testkit runtime is disposed\");\n\t\t\t\treturn activeSession.getCapabilityRuntime();\n\t\t\t},\n\t\t\tfaux: fauxRegistration,\n\t\t\tapi(pluginId) {\n\t\t\t\tif (activeSession.getCapabilityRuntime() !== initialRuntime) {\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\tt(\n\t\t\t\t\t\t\t\"Session plugin testkit plugin API handles expire after session reload; access the current runtime directly\",\n\t\t\t\t\t\t),\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tconst handle = handles.get(pluginId);\n\t\t\t\tif (!handle) throw new Error(t(\"Session plugin testkit has no loaded plugin: {pluginId}\", { pluginId }));\n\t\t\t\treturn handle.api;\n\t\t\t},\n\t\t\trevoke(pluginId) {\n\t\t\t\tif (activeSession.getCapabilityRuntime() !== initialRuntime) {\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\tt(\n\t\t\t\t\t\t\t\"Session plugin testkit plugin API handles expire after session reload; access the current runtime directly\",\n\t\t\t\t\t\t),\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tconst handle = handles.get(pluginId);\n\t\t\t\tif (!handle) throw new Error(t(\"Session plugin testkit has no loaded plugin: {pluginId}\", { pluginId }));\n\t\t\t\tactiveSession.getCapabilityRuntime().revokeAPI(handle.api);\n\t\t\t},\n\t\t\tassertResponsesConsumed() {\n\t\t\t\tconst pending = fauxRegistration.getPendingResponseCount();\n\t\t\t\tif (pending !== 0) {\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\tpending === 1\n\t\t\t\t\t\t\t? t(\"Session plugin testkit has {count} unused faux response\", { count: pending })\n\t\t\t\t\t\t\t: t(\"Session plugin testkit has {count} unused faux responses\", { count: pending }),\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t},\n\t\t\tinspect: () => activeSession.getCapabilityRuntime().inspect(),\n\t\t\ttranscript: () => {\n\t\t\t\tconst branch = sessionManager.getBranch();\n\t\t\t\tconst transcript: SessionPluginTestKitTranscript = {\n\t\t\t\t\tversion: 1,\n\t\t\t\t\tsessionId: sessionManager.getSessionId(),\n\t\t\t\t\trevision: sessionManager.getRevision().sequence,\n\t\t\t\t\tloadOrder: [...handles.keys()],\n\t\t\t\t\tfauxCallCount: fauxRegistration.state.callCount,\n\t\t\t\t\tmessages: activeSession.agent.state.messages.map((message) => ({\n\t\t\t\t\t\trole: message.role,\n\t\t\t\t\t\ttext: stableText(message),\n\t\t\t\t\t})),\n\t\t\t\t\tentries: branch.map((entry) => ({\n\t\t\t\t\t\ttype: entry.type,\n\t\t\t\t\t\t...(entry.type === \"custom\"\n\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\tcustomType: entry.customType,\n\t\t\t\t\t\t\t\t\t...(entry.data === undefined ? {} : { data: transcriptValue(entry.data) }),\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t})),\n\t\t\t\t\tinspector: stableInspector(activeSession.getCapabilityRuntime().inspect()),\n\t\t\t\t};\n\t\t\t\treturn freezeSnapshot(transcript);\n\t\t\t},\n\t\t\tdispose: async () => {\n\t\t\t\tdisposePromise ??= (async () => {\n\t\t\t\t\tclosing = true;\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait ready;\n\t\t\t\t\t} catch {\n\t\t\t\t\t\t// Startup rollback already disposed the session and faux provider.\n\t\t\t\t\t\t// v8 ignore next -- ready 已在返回前 await,dispose 中不会进入该 catch\n\t\t\t\t\t\tif (session?.isDisposed) {\n\t\t\t\t\t\t\tdisposed = true;\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait cleanup();\n\t\t\t\t\t} finally {\n\t\t\t\t\t\tdisposed = true;\n\t\t\t\t\t}\n\t\t\t\t})();\n\t\t\t\treturn disposePromise;\n\t\t\t},\n\t\t};\n\t\tawait ready;\n\t\treturn kit;\n\t} catch (error) {\n\t\ttry {\n\t\t\tsession && (await session.dispose());\n\t\t} finally {\n\t\t\tfaux?.unregister();\n\t\t\tawait rm(tempDir, { recursive: true, force: true });\n\t\t}\n\t\tthrow error;\n\t}\n}\n\n/** Runs a session fixture repeatedly and rejects on the first transcript divergence. */\nexport async function repeatSessionPluginTestKit(\n\ttimes: number,\n\trun: () => Promise<SessionPluginTestKitTranscript>,\n): Promise<SessionPluginTestKitTranscript> {\n\tif (!Number.isSafeInteger(times) || times < 1)\n\t\tthrow new Error(t(\"Session plugin testkit repeat count must be a positive integer\"));\n\tlet baseline: SessionPluginTestKitTranscript | undefined;\n\tfor (let index = 0; index < times; index += 1) {\n\t\tconst transcript = await run();\n\t\tif (baseline && canonicalJson(transcript) !== canonicalJson(baseline)) {\n\t\t\tthrow new Error(t(\"Session plugin testkit transcript diverged on run {run}\", { run: index + 1 }));\n\t\t}\n\t\tbaseline = transcript;\n\t}\n\treturn baseline!;\n}\n"]}
|
package/dist/utils/ansi.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ansi.d.ts","sourceRoot":"","sources":["../../src/utils/ansi.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ansi.d.ts","sourceRoot":"","sources":["../../src/utils/ansi.ts"],"names":[],"mappings":"AAgDA,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAc/C","sourcesContent":["/*\n * Portions of this file are derived from:\n * - ansi-regex (https://github.com/chalk/ansi-regex)\n * - strip-ansi (https://github.com/chalk/strip-ansi)\n *\n * MIT License\n *\n * Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { t } from \"../core/i18n/index.ts\";\n\nfunction ansiRegex({ onlyFirst = false }: { onlyFirst?: boolean } = {}): RegExp {\n\t// Valid string terminator sequences are BEL, ESC\\, and 0x9c\n\tconst ST = \"(?:\\\\u0007|\\\\u001B\\\\u005C|\\\\u009C)\";\n\n\t// OSC sequences only: ESC ] ... ST (non-greedy until the first ST)\n\tconst osc = `(?:\\\\u001B\\\\][\\\\s\\\\S]*?${ST})`;\n\n\t// CSI and related: ESC/C1, optional intermediates, optional params (supports ; and :) then final byte\n\tconst csi = \"[\\\\u001B\\\\u009B][[\\\\]()#;?]*(?:\\\\d{1,4}(?:[;:]\\\\d{0,4})*)?[\\\\dA-PR-TZcf-nq-uy=><~]\";\n\n\tconst pattern = `${osc}|${csi}`;\n\n\t// v8 ignore next -- 模块内唯一调用不传 onlyFirst,true 分支不可达\n\treturn new RegExp(pattern, onlyFirst ? undefined : \"g\");\n}\n\nconst regex = ansiRegex();\n\nexport function stripAnsi(value: string): string {\n\tif (typeof value !== \"string\") {\n\t\tthrow new TypeError(t(\"Expected a `string`, got `{type}`\", { type: typeof value }));\n\t}\n\n\t// Fast path: ANSI codes require ESC (7-bit) or CSI (8-bit) introducer\n\tif (!value.includes(\"\\u001B\") && !value.includes(\"\\u009B\")) {\n\t\treturn value;\n\t}\n\n\t// Even though the regex is global, we don't need to reset the `.lastIndex`\n\t// because unlike `.exec()` and `.test()`, `.replace()` does it automatically\n\t// and doing it manually has a performance penalty.\n\treturn value.replace(regex, \"\");\n}\n"]}
|
package/dist/utils/ansi.js
CHANGED
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
26
|
* SOFTWARE.
|
|
27
27
|
*/
|
|
28
|
+
import { t } from "../core/i18n/index.js";
|
|
28
29
|
function ansiRegex({ onlyFirst = false } = {}) {
|
|
29
30
|
// Valid string terminator sequences are BEL, ESC\, and 0x9c
|
|
30
31
|
const ST = "(?:\\u0007|\\u001B\\u005C|\\u009C)";
|
|
@@ -39,7 +40,7 @@ function ansiRegex({ onlyFirst = false } = {}) {
|
|
|
39
40
|
const regex = ansiRegex();
|
|
40
41
|
export function stripAnsi(value) {
|
|
41
42
|
if (typeof value !== "string") {
|
|
42
|
-
throw new TypeError(
|
|
43
|
+
throw new TypeError(t("Expected a `string`, got `{type}`", { type: typeof value }));
|
|
43
44
|
}
|
|
44
45
|
// Fast path: ANSI codes require ESC (7-bit) or CSI (8-bit) introducer
|
|
45
46
|
if (!value.includes("\u001B") && !value.includes("\u009B")) {
|
package/dist/utils/ansi.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ansi.js","sourceRoot":"","sources":["../../src/utils/ansi.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,SAAS,SAAS,CAAC,EAAE,SAAS,GAAG,KAAK,EAAE,GAA4B,EAAE,EAAU;IAC/E,4DAA4D;IAC5D,MAAM,EAAE,GAAG,oCAAoC,CAAC;IAEhD,mEAAmE;IACnE,MAAM,GAAG,GAAG,0BAA0B,EAAE,GAAG,CAAC;IAE5C,sGAAsG;IACtG,MAAM,GAAG,GAAG,oFAAoF,CAAC;IAEjG,MAAM,OAAO,GAAG,GAAG,GAAG,IAAI,GAAG,EAAE,CAAC;IAEhC,iFAAmD;IACnD,OAAO,IAAI,MAAM,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;AAAA,CACxD;AAED,MAAM,KAAK,GAAG,SAAS,EAAE,CAAC;AAE1B,MAAM,UAAU,SAAS,CAAC,KAAa,EAAU;IAChD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC/B,MAAM,IAAI,SAAS,CAAC,
|
|
1
|
+
{"version":3,"file":"ansi.js","sourceRoot":"","sources":["../../src/utils/ansi.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,uBAAuB,CAAC;AAE1C,SAAS,SAAS,CAAC,EAAE,SAAS,GAAG,KAAK,EAAE,GAA4B,EAAE,EAAU;IAC/E,4DAA4D;IAC5D,MAAM,EAAE,GAAG,oCAAoC,CAAC;IAEhD,mEAAmE;IACnE,MAAM,GAAG,GAAG,0BAA0B,EAAE,GAAG,CAAC;IAE5C,sGAAsG;IACtG,MAAM,GAAG,GAAG,oFAAoF,CAAC;IAEjG,MAAM,OAAO,GAAG,GAAG,GAAG,IAAI,GAAG,EAAE,CAAC;IAEhC,iFAAmD;IACnD,OAAO,IAAI,MAAM,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;AAAA,CACxD;AAED,MAAM,KAAK,GAAG,SAAS,EAAE,CAAC;AAE1B,MAAM,UAAU,SAAS,CAAC,KAAa,EAAU;IAChD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC/B,MAAM,IAAI,SAAS,CAAC,CAAC,CAAC,mCAAmC,EAAE,EAAE,IAAI,EAAE,OAAO,KAAK,EAAE,CAAC,CAAC,CAAC;IACrF,CAAC;IAED,sEAAsE;IACtE,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC5D,OAAO,KAAK,CAAC;IACd,CAAC;IAED,2EAA2E;IAC3E,6EAA6E;IAC7E,mDAAmD;IACnD,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;AAAA,CAChC","sourcesContent":["/*\n * Portions of this file are derived from:\n * - ansi-regex (https://github.com/chalk/ansi-regex)\n * - strip-ansi (https://github.com/chalk/strip-ansi)\n *\n * MIT License\n *\n * Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\nimport { t } from \"../core/i18n/index.ts\";\n\nfunction ansiRegex({ onlyFirst = false }: { onlyFirst?: boolean } = {}): RegExp {\n\t// Valid string terminator sequences are BEL, ESC\\, and 0x9c\n\tconst ST = \"(?:\\\\u0007|\\\\u001B\\\\u005C|\\\\u009C)\";\n\n\t// OSC sequences only: ESC ] ... ST (non-greedy until the first ST)\n\tconst osc = `(?:\\\\u001B\\\\][\\\\s\\\\S]*?${ST})`;\n\n\t// CSI and related: ESC/C1, optional intermediates, optional params (supports ; and :) then final byte\n\tconst csi = \"[\\\\u001B\\\\u009B][[\\\\]()#;?]*(?:\\\\d{1,4}(?:[;:]\\\\d{0,4})*)?[\\\\dA-PR-TZcf-nq-uy=><~]\";\n\n\tconst pattern = `${osc}|${csi}`;\n\n\t// v8 ignore next -- 模块内唯一调用不传 onlyFirst,true 分支不可达\n\treturn new RegExp(pattern, onlyFirst ? undefined : \"g\");\n}\n\nconst regex = ansiRegex();\n\nexport function stripAnsi(value: string): string {\n\tif (typeof value !== \"string\") {\n\t\tthrow new TypeError(t(\"Expected a `string`, got `{type}`\", { type: typeof value }));\n\t}\n\n\t// Fast path: ANSI codes require ESC (7-bit) or CSI (8-bit) introducer\n\tif (!value.includes(\"\\u001B\") && !value.includes(\"\\u009B\")) {\n\t\treturn value;\n\t}\n\n\t// Even though the regex is global, we don't need to reset the `.lastIndex`\n\t// because unlike `.exec()` and `.test()`, `.replace()` does it automatically\n\t// and doing it manually has a performance penalty.\n\treturn value.replace(regex, \"\");\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clipboard.d.ts","sourceRoot":"","sources":["../../src/utils/clipboard.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"clipboard.d.ts","sourceRoot":"","sources":["../../src/utils/clipboard.ts"],"names":[],"mappings":"AAwFA,iDAAiD;AACjD,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAkBhE;AAED,wBAAsB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAwIjE","sourcesContent":["import { type ExecFileSyncOptionsWithStringEncoding, execFile, execFileSync, execSync, spawn } from \"child_process\";\nimport { randomUUID } from \"crypto\";\nimport { unlinkSync, writeFileSync } from \"fs\";\nimport { platform, tmpdir } from \"os\";\nimport { join } from \"path\";\nimport { t } from \"../core/i18n/index.ts\";\nimport { isWaylandSession } from \"./clipboard-image.ts\";\nimport { clipboard } from \"./clipboard-native.ts\";\nimport { isWSL } from \"./wsl.ts\";\n\ntype NativeClipboardExecOptions = {\n\tinput: string;\n\ttimeout: number;\n\tstdio: [\"pipe\", \"ignore\", \"ignore\"];\n};\n\nfunction copyToX11Clipboard(options: NativeClipboardExecOptions): void {\n\ttry {\n\t\texecSync(\"xclip -selection clipboard\", options);\n\t} catch {\n\t\texecSync(\"xsel --clipboard --input\", options);\n\t}\n}\n\nconst MAX_OSC52_ENCODED_LENGTH = 100_000;\n\nfunction isRemoteSession(env: NodeJS.ProcessEnv): boolean {\n\treturn Boolean(env.SSH_CONNECTION || env.SSH_CLIENT || env.MOSH_CONNECTION);\n}\n\nfunction emitOsc52(text: string): boolean {\n\tconst encoded = Buffer.from(text).toString(\"base64\");\n\tif (encoded.length > MAX_OSC52_ENCODED_LENGTH) {\n\t\treturn false;\n\t}\n\tprocess.stdout.write(`\\x1b]52;c;${encoded}\\x07`);\n\treturn true;\n}\n\nfunction runWslCommand(command: string, args: string[], timeout: number): Promise<Buffer | null> {\n\treturn new Promise((resolve) => {\n\t\texecFile(command, args, { timeout, encoding: \"buffer\" }, (error, stdout) => {\n\t\t\tresolve(error ? null : stdout);\n\t\t});\n\t});\n}\n\n/**\n * WSL without WSLg has no Linux display, so the Windows clipboard is written through\n * interop. PowerShell reads the text from a file because `clip.exe` and PowerShell stdin\n * decode piped bytes with the console code page, which mangles non-ASCII UTF-8.\n */\nasync function copyViaWindowsClipboard(text: string): Promise<boolean> {\n\tconst tmpFile = join(tmpdir(), `pi-wsl-clip-${randomUUID()}.txt`);\n\ttry {\n\t\twriteFileSync(tmpFile, text, { encoding: \"utf8\", mode: 0o600 });\n\t\tconst winPath = (await runWslCommand(\"wslpath\", [\"-w\", tmpFile], 1000))?.toString(\"utf8\").trim();\n\t\tif (!winPath) return false;\n\t\tconst script = `Set-Clipboard -Value ([System.IO.File]::ReadAllText('${winPath.replaceAll(\"'\", \"''\")}', [System.Text.Encoding]::UTF8))`;\n\t\treturn (await runWslCommand(\"powershell.exe\", [\"-NoProfile\", \"-Command\", script], 5000)) !== null;\n\t} catch {\n\t\treturn false;\n\t} finally {\n\t\ttry {\n\t\t\tunlinkSync(tmpFile);\n\t\t} catch {\n\t\t\t// The file may not have been created.\n\t\t}\n\t}\n}\n\ntype ClipboardReadResult = { ok: true; text: string | null } | { ok: false };\n\nconst READ_CLIPBOARD_OPTIONS: ExecFileSyncOptionsWithStringEncoding = {\n\tencoding: \"utf8\",\n\tmaxBuffer: 50 * 1024 * 1024,\n\ttimeout: 5000,\n};\n\nfunction readWaylandClipboardText(): ClipboardReadResult {\n\ttry {\n\t\tconst text = execFileSync(\"wl-paste\", [\"--no-newline\", \"--type\", \"text\"], READ_CLIPBOARD_OPTIONS);\n\t\treturn { ok: true, text: text || null };\n\t} catch {\n\t\treturn { ok: false };\n\t}\n}\n\n/** Read plain text from the system clipboard. */\nexport async function readClipboardText(): Promise<string | null> {\n\tif (platform() === \"linux\" && isWaylandSession() && process.env.WAYLAND_DISPLAY) {\n\t\tconst result = readWaylandClipboardText();\n\t\tif (result.ok) {\n\t\t\treturn result.text;\n\t\t}\n\t}\n\n\tif (!clipboard) {\n\t\treturn null;\n\t}\n\n\ttry {\n\t\tconst text = await clipboard.getText();\n\t\treturn text || null;\n\t} catch {\n\t\treturn null;\n\t}\n}\n\nexport async function copyToClipboard(text: string): Promise<void> {\n\tlet copied = false;\n\n\tconst p = platform();\n\tconst env = process.env;\n\n\t// Prefer direct clipboard writes. Emitting OSC 52 first can make terminals\n\t// write the same native clipboard concurrently with the addon, and very large\n\t// OSC 52 payloads can desynchronize terminal rendering.\n\t//\n\t// On Linux, skip the native addon. The underlying `clipboard-rs` crate is\n\t// X11-only and does not retain selection ownership after `set_text`\n\t// resolves, so on Wayland-only compositors (Hyprland, Niri, ...) and even\n\t// some X11 sessions the call resolves successfully without populating the\n\t// clipboard. The platform tools below (wl-copy, xclip, xsel) properly\n\t// daemonize and keep ownership.\n\ttry {\n\t\tif (clipboard && p !== \"linux\") {\n\t\t\tawait clipboard.setText(text);\n\t\t\tcopied = true;\n\t\t}\n\t} catch {\n\t\t// Fall through to platform-specific clipboard tools.\n\t}\n\n\tconst remote = isRemoteSession(env);\n\tif (copied && !remote) {\n\t\treturn;\n\t}\n\n\tconst options: NativeClipboardExecOptions = { input: text, timeout: 5000, stdio: [\"pipe\", \"ignore\", \"ignore\"] };\n\n\tif (!copied) {\n\t\ttry {\n\t\t\tif (p === \"darwin\") {\n\t\t\t\texecSync(\"pbcopy\", options);\n\t\t\t\tcopied = true;\n\t\t\t} else if (p === \"win32\") {\n\t\t\t\texecSync(\"clip\", options);\n\t\t\t\tcopied = true;\n\t\t\t} else {\n\t\t\t\t// Linux. Try Termux, Wayland, or X11 clipboard tools.\n\t\t\t\tif (env.TERMUX_VERSION) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\texecSync(\"termux-clipboard-set\", options);\n\t\t\t\t\t\tcopied = true;\n\t\t\t\t\t} catch {\n\t\t\t\t\t\t// Fall back to Wayland or X11 tools.\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (!copied) {\n\t\t\t\t\tconst hasWaylandDisplay = Boolean(env.WAYLAND_DISPLAY);\n\t\t\t\t\tconst hasX11Display = Boolean(env.DISPLAY);\n\t\t\t\t\tconst isWayland = isWaylandSession();\n\t\t\t\t\tif (isWayland && hasWaylandDisplay) {\n\t\t\t\t\t\tlet x11Attempted = false;\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t// Verify wl-copy exists (spawn errors are async and won't be caught)\n\t\t\t\t\t\t\texecSync(\"which wl-copy\", { stdio: \"ignore\" });\n\t\t\t\t\t\t\t// wl-copy with execSync hangs due to fork behavior; use spawn instead.\n\t\t\t\t\t\t\t// Await the exit code and only claim success on a clean exit, so a\n\t\t\t\t\t\t\t// failed wl-copy falls through to the xclip/OSC 52 fallbacks.\n\t\t\t\t\t\t\tconst wlCopyExit = await new Promise<number>((resolve) => {\n\t\t\t\t\t\t\t\tconst proc = spawn(\"wl-copy\", [], { stdio: [\"pipe\", \"ignore\", \"ignore\"] });\n\t\t\t\t\t\t\t\tproc.on(\"error\", () => resolve(1));\n\t\t\t\t\t\t\t\tproc.on(\"close\", (code) => resolve(code ?? 1));\n\t\t\t\t\t\t\t\tproc.stdin.on(\"error\", () => {\n\t\t\t\t\t\t\t\t\t// Ignore EPIPE errors if wl-copy exits early\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\tproc.stdin.write(text);\n\t\t\t\t\t\t\t\tproc.stdin.end();\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tif (wlCopyExit === 0) {\n\t\t\t\t\t\t\t\tcopied = true;\n\t\t\t\t\t\t\t} else if (hasX11Display) {\n\t\t\t\t\t\t\t\tx11Attempted = true;\n\t\t\t\t\t\t\t\tcopyToX11Clipboard(options);\n\t\t\t\t\t\t\t\tcopied = true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} catch {\n\t\t\t\t\t\t\t// Only retry the X11 fallback when it has not been attempted yet,\n\t\t\t\t\t\t\t// so a failed wl-copy plus a failed xclip does not run xclip twice.\n\t\t\t\t\t\t\tif (hasX11Display && !x11Attempted) {\n\t\t\t\t\t\t\t\tcopyToX11Clipboard(options);\n\t\t\t\t\t\t\t\tcopied = true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (hasX11Display) {\n\t\t\t\t\t\tcopyToX11Clipboard(options);\n\t\t\t\t\t\tcopied = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} catch {\n\t\t\t// Fall through to OSC 52 fallback.\n\t\t}\n\t}\n\n\tlet osc52Emitted = false;\n\tif (!copied && p === \"linux\" && isWSL(env)) {\n\t\t// Windows Terminal supports OSC 52; prefer it over the slower PowerShell round trip.\n\t\tif (env.WT_SESSION) osc52Emitted = emitOsc52(text);\n\t\tcopied = osc52Emitted || (await copyViaWindowsClipboard(text));\n\t}\n\t// OSC 52 cannot be verified, so a desktop session with a display reports the failure\n\t// instead (#9618). Without a display the terminal is the only clipboard route (containers,\n\t// WSL without WSLg), and remote sessions always emit it to reach the client clipboard.\n\tconst headless = p === \"linux\" && !env.DISPLAY && !env.WAYLAND_DISPLAY && !env.TERMUX_VERSION;\n\tlet oversized = false;\n\tif (!osc52Emitted && (remote || (!copied && headless))) {\n\t\tif (emitOsc52(text)) copied = true;\n\t\telse oversized = true;\n\t}\n\n\tif (copied) {\n\t\treturn;\n\t}\n\tif (oversized) {\n\t\tthrow new Error(t(\"Clipboard unavailable: text exceeds the OSC 52 size limit\"));\n\t}\n\tif (p === \"linux\") {\n\t\tif (env.TERMUX_VERSION) {\n\t\t\tthrow new Error(t(\"Clipboard unavailable: install the Termux:API app and `termux-api` package\"));\n\t\t}\n\t\tif (env.WAYLAND_DISPLAY) {\n\t\t\tthrow new Error(t(\"Clipboard unavailable: install `wl-clipboard` (`wl-copy`) or check Wayland access\"));\n\t\t}\n\t\tif (env.DISPLAY) {\n\t\t\tthrow new Error(t(\"Clipboard unavailable: install `xclip` or `xsel`, or check X11 access\"));\n\t\t}\n\t}\n\tif (p === \"win32\") {\n\t\tthrow new Error(t(\"Clipboard unavailable: ensure the built-in `clip` command is on PATH\"));\n\t}\n\tthrow new Error(t(\"Clipboard unavailable\"));\n}\n"]}
|
package/dist/utils/clipboard.js
CHANGED
|
@@ -3,6 +3,7 @@ import { randomUUID } from "crypto";
|
|
|
3
3
|
import { unlinkSync, writeFileSync } from "fs";
|
|
4
4
|
import { platform, tmpdir } from "os";
|
|
5
5
|
import { join } from "path";
|
|
6
|
+
import { t } from "../core/i18n/index.js";
|
|
6
7
|
import { isWaylandSession } from "./clipboard-image.js";
|
|
7
8
|
import { clipboard } from "./clipboard-native.js";
|
|
8
9
|
import { isWSL } from "./wsl.js";
|
|
@@ -215,22 +216,22 @@ export async function copyToClipboard(text) {
|
|
|
215
216
|
return;
|
|
216
217
|
}
|
|
217
218
|
if (oversized) {
|
|
218
|
-
throw new Error("Clipboard unavailable: text exceeds the OSC 52 size limit");
|
|
219
|
+
throw new Error(t("Clipboard unavailable: text exceeds the OSC 52 size limit"));
|
|
219
220
|
}
|
|
220
221
|
if (p === "linux") {
|
|
221
222
|
if (env.TERMUX_VERSION) {
|
|
222
|
-
throw new Error("Clipboard unavailable: install the Termux:API app and `termux-api` package");
|
|
223
|
+
throw new Error(t("Clipboard unavailable: install the Termux:API app and `termux-api` package"));
|
|
223
224
|
}
|
|
224
225
|
if (env.WAYLAND_DISPLAY) {
|
|
225
|
-
throw new Error("Clipboard unavailable: install `wl-clipboard` (`wl-copy`) or check Wayland access");
|
|
226
|
+
throw new Error(t("Clipboard unavailable: install `wl-clipboard` (`wl-copy`) or check Wayland access"));
|
|
226
227
|
}
|
|
227
228
|
if (env.DISPLAY) {
|
|
228
|
-
throw new Error("Clipboard unavailable: install `xclip` or `xsel`, or check X11 access");
|
|
229
|
+
throw new Error(t("Clipboard unavailable: install `xclip` or `xsel`, or check X11 access"));
|
|
229
230
|
}
|
|
230
231
|
}
|
|
231
232
|
if (p === "win32") {
|
|
232
|
-
throw new Error("Clipboard unavailable: ensure the built-in `clip` command is on PATH");
|
|
233
|
+
throw new Error(t("Clipboard unavailable: ensure the built-in `clip` command is on PATH"));
|
|
233
234
|
}
|
|
234
|
-
throw new Error("Clipboard unavailable");
|
|
235
|
+
throw new Error(t("Clipboard unavailable"));
|
|
235
236
|
}
|
|
236
237
|
//# sourceMappingURL=clipboard.js.map
|