@bastani/atomic 0.9.27 → 0.9.28-alpha.2
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 +61 -0
- package/dist/builtin/intercom/CHANGELOG.md +6 -0
- package/dist/builtin/intercom/broker/broker.ts +13 -1
- package/dist/builtin/intercom/package.json +2 -2
- package/dist/builtin/mcp/CHANGELOG.md +6 -0
- package/dist/builtin/mcp/package.json +1 -1
- package/dist/builtin/subagents/package.json +3 -3
- package/dist/builtin/web-access/index.bundle.mjs +194 -44
- package/dist/builtin/web-access/package.json +3 -3
- package/dist/builtin/workflows/CHANGELOG.md +31 -0
- package/dist/builtin/workflows/builtin/{chunk-gw7rghda.js → chunk-aqv8ny38.js} +257 -259
- package/dist/builtin/workflows/builtin/{chunk-gts8wgjr.js → chunk-br4ac9a3.js} +1 -1
- package/dist/builtin/workflows/builtin/{chunk-9bhs02gm.js → chunk-p3xmajmj.js} +439 -40
- package/dist/builtin/workflows/builtin/chunk-p6jagvyf.js +8 -0
- package/dist/builtin/workflows/builtin/goal.js +2 -2
- package/dist/builtin/workflows/builtin/index.js +4 -4
- package/dist/builtin/workflows/builtin/ralph.js +2 -2
- package/dist/builtin/workflows/package.json +2 -2
- package/dist/builtin/workflows/src/authoring.d.ts +14 -0
- package/dist/builtin/workflows/src/extension/index.bundle.mjs +108110 -107201
- package/dist/builtin/workflows/src/index.js +42226 -41077
- package/dist/builtin/workflows/src/shared/authoring-contract-stage.d.ts +16 -11
- package/dist/builtin/workflows/src/shared/authoring-contract-ui.d.ts +16 -1
- package/dist/cli/args.d.ts +1 -0
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +12 -5
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/credential-print.d.ts +1 -1
- package/dist/cli/credential-print.d.ts.map +1 -1
- package/dist/cli/credential-print.js +2 -56
- package/dist/cli/credential-print.js.map +1 -1
- package/dist/codemode-worker.js +99 -3
- package/dist/core/agent-session-accessors.d.ts.map +1 -1
- package/dist/core/agent-session-accessors.js +6 -1
- package/dist/core/agent-session-accessors.js.map +1 -1
- package/dist/core/agent-session-compaction.d.ts.map +1 -1
- package/dist/core/agent-session-compaction.js +20 -3
- package/dist/core/agent-session-compaction.js.map +1 -1
- package/dist/core/agent-session-events.d.ts.map +1 -1
- package/dist/core/agent-session-events.js +3 -2
- package/dist/core/agent-session-events.js.map +1 -1
- package/dist/core/agent-session-extension-bindings.d.ts +6 -0
- package/dist/core/agent-session-extension-bindings.d.ts.map +1 -1
- package/dist/core/agent-session-extension-bindings.js +96 -12
- package/dist/core/agent-session-extension-bindings.js.map +1 -1
- package/dist/core/agent-session-methods.d.ts +4 -1
- package/dist/core/agent-session-methods.d.ts.map +1 -1
- package/dist/core/agent-session-methods.js.map +1 -1
- package/dist/core/agent-session-prompt.d.ts.map +1 -1
- package/dist/core/agent-session-prompt.js +19 -3
- package/dist/core/agent-session-prompt.js.map +1 -1
- package/dist/core/agent-session-services.d.ts +1 -0
- package/dist/core/agent-session-services.d.ts.map +1 -1
- package/dist/core/agent-session-services.js +1 -0
- package/dist/core/agent-session-services.js.map +1 -1
- package/dist/core/agent-session-state.d.ts.map +1 -1
- package/dist/core/agent-session-state.js +3 -2
- package/dist/core/agent-session-state.js.map +1 -1
- package/dist/core/agent-session-tool-registry.d.ts.map +1 -1
- package/dist/core/agent-session-tool-registry.js +11 -16
- package/dist/core/agent-session-tool-registry.js.map +1 -1
- package/dist/core/agent-session-types.d.ts +1 -0
- package/dist/core/agent-session-types.d.ts.map +1 -1
- package/dist/core/agent-session-types.js.map +1 -1
- package/dist/core/agent-session.d.ts +2 -0
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +5 -0
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/auth-storage-backends.d.ts.map +1 -1
- package/dist/core/auth-storage-backends.js +2 -1
- package/dist/core/auth-storage-backends.js.map +1 -1
- package/dist/core/auth-storage.d.ts +1 -1
- package/dist/core/auth-storage.d.ts.map +1 -1
- package/dist/core/auth-storage.js +15 -7
- package/dist/core/auth-storage.js.map +1 -1
- package/dist/core/azure-provider-compat.d.ts +8 -0
- package/dist/core/azure-provider-compat.d.ts.map +1 -0
- package/dist/core/azure-provider-compat.js +65 -0
- package/dist/core/azure-provider-compat.js.map +1 -0
- package/dist/core/child-session-options.d.ts +1 -1
- package/dist/core/child-session-options.d.ts.map +1 -1
- package/dist/core/child-session-options.js +11 -2
- package/dist/core/child-session-options.js.map +1 -1
- package/dist/core/compaction/classifier-compaction.d.ts +13 -0
- package/dist/core/compaction/classifier-compaction.d.ts.map +1 -0
- package/dist/core/compaction/classifier-compaction.js +110 -0
- package/dist/core/compaction/classifier-compaction.js.map +1 -0
- package/dist/core/compaction/compaction-boundary.d.ts.map +1 -1
- package/dist/core/compaction/compaction-boundary.js +2 -6
- package/dist/core/compaction/compaction-boundary.js.map +1 -1
- package/dist/core/compaction/compaction-runner.d.ts +16 -1
- package/dist/core/compaction/compaction-runner.d.ts.map +1 -1
- package/dist/core/compaction/compaction-runner.js +97 -12
- package/dist/core/compaction/compaction-runner.js.map +1 -1
- package/dist/core/compaction/compaction-types.d.ts +18 -1
- package/dist/core/compaction/compaction-types.d.ts.map +1 -1
- package/dist/core/compaction/compaction-types.js +1 -1
- package/dist/core/compaction/compaction-types.js.map +1 -1
- package/dist/core/compaction/fallback-planner.d.ts +1 -0
- package/dist/core/compaction/fallback-planner.d.ts.map +1 -1
- package/dist/core/compaction/fallback-planner.js +2 -0
- package/dist/core/compaction/fallback-planner.js.map +1 -1
- package/dist/core/compaction/index.d.ts +3 -0
- package/dist/core/compaction/index.d.ts.map +1 -1
- package/dist/core/compaction/index.js +3 -0
- package/dist/core/compaction/index.js.map +1 -1
- package/dist/core/compaction/model-resolver.d.ts +16 -0
- package/dist/core/compaction/model-resolver.d.ts.map +1 -0
- package/dist/core/compaction/model-resolver.js +18 -0
- package/dist/core/compaction/model-resolver.js.map +1 -0
- package/dist/core/compaction/morph-compaction.d.ts +14 -0
- package/dist/core/compaction/morph-compaction.d.ts.map +1 -0
- package/dist/core/compaction/morph-compaction.js +99 -0
- package/dist/core/compaction/morph-compaction.js.map +1 -0
- package/dist/core/compaction/pi-summary-fallback.d.ts +34 -0
- package/dist/core/compaction/pi-summary-fallback.d.ts.map +1 -0
- package/dist/core/compaction/pi-summary-fallback.js +357 -0
- package/dist/core/compaction/pi-summary-fallback.js.map +1 -0
- package/dist/core/compaction/planner-outcome.d.ts +10 -6
- package/dist/core/compaction/planner-outcome.d.ts.map +1 -1
- package/dist/core/compaction/planner-outcome.js +11 -4
- package/dist/core/compaction/planner-outcome.js.map +1 -1
- package/dist/core/compaction/range-planner-diagnostics.d.ts +3 -1
- package/dist/core/compaction/range-planner-diagnostics.d.ts.map +1 -1
- package/dist/core/compaction/range-planner-diagnostics.js +11 -0
- package/dist/core/compaction/range-planner-diagnostics.js.map +1 -1
- package/dist/core/compaction/range-planner.d.ts +3 -3
- package/dist/core/compaction/range-planner.d.ts.map +1 -1
- package/dist/core/compaction/range-planner.js +59 -28
- package/dist/core/compaction/range-planner.js.map +1 -1
- package/dist/core/compaction/region-trimming.d.ts.map +1 -1
- package/dist/core/compaction/region-trimming.js +7 -0
- package/dist/core/compaction/region-trimming.js.map +1 -1
- package/dist/core/compaction/structured-compaction-input.d.ts +19 -0
- package/dist/core/compaction/structured-compaction-input.d.ts.map +1 -0
- package/dist/core/compaction/structured-compaction-input.js +70 -0
- package/dist/core/compaction/structured-compaction-input.js.map +1 -0
- package/dist/core/compaction/transcript-serialization.d.ts +1 -0
- package/dist/core/compaction/transcript-serialization.d.ts.map +1 -1
- package/dist/core/compaction/transcript-serialization.js +26 -0
- package/dist/core/compaction/transcript-serialization.js.map +1 -1
- package/dist/core/extensions/api-types.d.ts +3 -2
- package/dist/core/extensions/api-types.d.ts.map +1 -1
- package/dist/core/extensions/api-types.js.map +1 -1
- package/dist/core/extensions/context-types.d.ts +1 -0
- package/dist/core/extensions/context-types.d.ts.map +1 -1
- package/dist/core/extensions/context-types.js.map +1 -1
- package/dist/core/extensions/loader-api.d.ts.map +1 -1
- package/dist/core/extensions/loader-api.js +5 -0
- package/dist/core/extensions/loader-api.js.map +1 -1
- package/dist/core/extensions/loader-host-modules.d.ts +1 -0
- package/dist/core/extensions/loader-host-modules.d.ts.map +1 -1
- package/dist/core/extensions/loader-host-modules.js +12 -0
- package/dist/core/extensions/loader-host-modules.js.map +1 -1
- package/dist/core/extensions/runner-context.d.ts +10 -4
- package/dist/core/extensions/runner-context.d.ts.map +1 -1
- package/dist/core/extensions/runner-context.js +47 -3
- package/dist/core/extensions/runner-context.js.map +1 -1
- package/dist/core/extensions/runner.d.ts +11 -4
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +38 -9
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/tool-types.d.ts +2 -0
- package/dist/core/extensions/tool-types.d.ts.map +1 -1
- package/dist/core/extensions/tool-types.js.map +1 -1
- package/dist/core/extensions/workflow-events.d.ts +49 -0
- package/dist/core/extensions/workflow-events.d.ts.map +1 -1
- package/dist/core/extensions/workflow-events.js.map +1 -1
- package/dist/core/extensions/workflow-run-control-hub.d.ts +16 -4
- package/dist/core/extensions/workflow-run-control-hub.d.ts.map +1 -1
- package/dist/core/extensions/workflow-run-control-hub.js +72 -1
- package/dist/core/extensions/workflow-run-control-hub.js.map +1 -1
- package/dist/core/extensions/workflow-run-control.d.ts +11 -3
- package/dist/core/extensions/workflow-run-control.d.ts.map +1 -1
- package/dist/core/extensions/workflow-run-control.js.map +1 -1
- package/dist/core/fast-model-variants.d.ts +1 -1
- package/dist/core/fast-model-variants.js +1 -1
- package/dist/core/fast-model-variants.js.map +1 -1
- package/dist/core/keybindings.d.ts +4 -4
- package/dist/core/messages.d.ts +1 -0
- package/dist/core/messages.d.ts.map +1 -1
- package/dist/core/messages.js +5 -1
- package/dist/core/messages.js.map +1 -1
- package/dist/core/model-config.d.ts.map +1 -1
- package/dist/core/model-config.js +2 -1
- package/dist/core/model-config.js.map +1 -1
- package/dist/core/model-fallback-failures.d.ts.map +1 -1
- package/dist/core/model-fallback-failures.js +5 -1
- package/dist/core/model-fallback-failures.js.map +1 -1
- package/dist/core/model-resolver-cli.d.ts.map +1 -1
- package/dist/core/model-resolver-cli.js +5 -1
- package/dist/core/model-resolver-cli.js.map +1 -1
- package/dist/core/model-resolver-defaults.js +1 -1
- package/dist/core/model-resolver-defaults.js.map +1 -1
- package/dist/core/model-resolver-initial.d.ts.map +1 -1
- package/dist/core/model-resolver-initial.js +6 -1
- package/dist/core/model-resolver-initial.js.map +1 -1
- package/dist/core/model-resolver-patterns.d.ts.map +1 -1
- package/dist/core/model-resolver-patterns.js +2 -1
- package/dist/core/model-resolver-patterns.js.map +1 -1
- package/dist/core/model-resolver-scope.d.ts.map +1 -1
- package/dist/core/model-resolver-scope.js +3 -1
- package/dist/core/model-resolver-scope.js.map +1 -1
- package/dist/core/model-runtime-streaming.d.ts.map +1 -1
- package/dist/core/model-runtime-streaming.js +2 -0
- package/dist/core/model-runtime-streaming.js.map +1 -1
- package/dist/core/model-runtime.d.ts.map +1 -1
- package/dist/core/model-runtime.js +48 -22
- package/dist/core/model-runtime.js.map +1 -1
- package/dist/core/provider-composer-internal.d.ts.map +1 -1
- package/dist/core/provider-composer-internal.js +4 -1
- package/dist/core/provider-composer-internal.js.map +1 -1
- package/dist/core/provider-display-names.js +1 -1
- package/dist/core/provider-display-names.js.map +1 -1
- package/dist/core/remote-catalog-provider.d.ts.map +1 -1
- package/dist/core/remote-catalog-provider.js +3 -0
- package/dist/core/remote-catalog-provider.js.map +1 -1
- package/dist/core/resource-loader-core.d.ts +1 -0
- package/dist/core/resource-loader-core.d.ts.map +1 -1
- package/dist/core/resource-loader-core.js +4 -0
- package/dist/core/resource-loader-core.js.map +1 -1
- package/dist/core/resource-loader-internals.d.ts +1 -0
- package/dist/core/resource-loader-internals.d.ts.map +1 -1
- package/dist/core/resource-loader-internals.js.map +1 -1
- package/dist/core/resource-loader-reload.d.ts.map +1 -1
- package/dist/core/resource-loader-reload.js +28 -5
- package/dist/core/resource-loader-reload.js.map +1 -1
- package/dist/core/resource-loader-types.d.ts +2 -0
- package/dist/core/resource-loader-types.d.ts.map +1 -1
- package/dist/core/resource-loader-types.js.map +1 -1
- package/dist/core/sdk-types.d.ts +6 -4
- package/dist/core/sdk-types.d.ts.map +1 -1
- package/dist/core/sdk-types.js.map +1 -1
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +5 -3
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/session-lifecycle-work.d.ts +2 -1
- package/dist/core/session-lifecycle-work.d.ts.map +1 -1
- package/dist/core/session-lifecycle-work.js +15 -1
- package/dist/core/session-lifecycle-work.js.map +1 -1
- package/dist/core/session-manager-history.d.ts.map +1 -1
- package/dist/core/session-manager-history.js +4 -2
- package/dist/core/session-manager-history.js.map +1 -1
- package/dist/core/settings-manager-basic-accessors.d.ts +2 -0
- package/dist/core/settings-manager-basic-accessors.d.ts.map +1 -1
- package/dist/core/settings-manager-basic-accessors.js +33 -4
- package/dist/core/settings-manager-basic-accessors.js.map +1 -1
- package/dist/core/settings-manager-core.d.ts.map +1 -1
- package/dist/core/settings-manager-core.js +2 -0
- package/dist/core/settings-manager-core.js.map +1 -1
- package/dist/core/settings-storage.d.ts.map +1 -1
- package/dist/core/settings-storage.js +2 -1
- package/dist/core/settings-storage.js.map +1 -1
- package/dist/core/settings-types.d.ts +1 -0
- package/dist/core/settings-types.d.ts.map +1 -1
- package/dist/core/settings-types.js.map +1 -1
- package/dist/core/skills.d.ts +1 -1
- package/dist/core/skills.d.ts.map +1 -1
- package/dist/core/skills.js +3 -1
- package/dist/core/skills.js.map +1 -1
- package/dist/core/system-prompt.d.ts +3 -0
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +7 -3
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/tool-loadout.d.ts.map +1 -1
- package/dist/core/tool-loadout.js +8 -1
- package/dist/core/tool-loadout.js.map +1 -1
- package/dist/core/tool-selection.d.ts +13 -0
- package/dist/core/tool-selection.d.ts.map +1 -0
- package/dist/core/tool-selection.js +43 -0
- package/dist/core/tool-selection.js.map +1 -0
- package/dist/core/tools/read.d.ts +7 -0
- package/dist/core/tools/read.d.ts.map +1 -1
- package/dist/core/tools/read.js +11 -1
- package/dist/core/tools/read.js.map +1 -1
- package/dist/core/transcript.d.ts +58 -0
- package/dist/core/transcript.d.ts.map +1 -0
- package/dist/core/transcript.js +185 -0
- package/dist/core/transcript.js.map +1 -0
- package/dist/extensions/codemode/execute.d.ts.map +1 -1
- package/dist/extensions/codemode/execute.js +2 -1
- package/dist/extensions/codemode/execute.js.map +1 -1
- package/dist/extensions/codemode/index.d.ts.map +1 -1
- package/dist/extensions/codemode/index.js +1 -0
- package/dist/extensions/codemode/index.js.map +1 -1
- package/dist/extensions/codemode/tool.d.ts +4 -1
- package/dist/extensions/codemode/tool.d.ts.map +1 -1
- package/dist/extensions/codemode/tool.js +6 -3
- package/dist/extensions/codemode/tool.js.map +1 -1
- package/dist/extensions/herdr/index.d.ts.map +1 -1
- package/dist/extensions/herdr/index.js +15 -10
- package/dist/extensions/herdr/index.js.map +1 -1
- package/dist/extensions/herdr/pane-owner.d.ts +6 -2
- package/dist/extensions/herdr/pane-owner.d.ts.map +1 -1
- package/dist/extensions/herdr/pane-owner.js +19 -4
- package/dist/extensions/herdr/pane-owner.js.map +1 -1
- package/dist/extensions/mcp/client/oauth/flow.d.ts.map +1 -1
- package/dist/extensions/mcp/client/oauth/flow.js +14 -1
- package/dist/extensions/mcp/client/oauth/flow.js.map +1 -1
- package/dist/extensions/mcp/client/oauth/types.d.ts +1 -0
- package/dist/extensions/mcp/client/oauth/types.d.ts.map +1 -1
- package/dist/extensions/mcp/client/oauth/types.js.map +1 -1
- package/dist/extensions/mcp/index.js.map +1 -1
- package/dist/extensions/mcp/runtime.d.ts +5 -2
- package/dist/extensions/mcp/runtime.d.ts.map +1 -1
- package/dist/extensions/mcp/runtime.js +18 -4
- package/dist/extensions/mcp/runtime.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +2 -0
- package/dist/main.js.map +1 -1
- package/dist/migrations-azure.d.ts +4 -0
- package/dist/migrations-azure.d.ts.map +1 -0
- package/dist/migrations-azure.js +41 -0
- package/dist/migrations-azure.js.map +1 -0
- package/dist/migrations.d.ts.map +1 -1
- package/dist/migrations.js +2 -0
- package/dist/migrations.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-state.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-state.js +2 -1
- package/dist/modes/interactive/components/chat-session-host-state.js.map +1 -1
- package/dist/modes/interactive/components/chat-transcript.d.ts +2 -0
- package/dist/modes/interactive/components/chat-transcript.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-transcript.js +9 -3
- package/dist/modes/interactive/components/chat-transcript.js.map +1 -1
- package/dist/modes/interactive/components/compaction-boundary-message.d.ts +2 -0
- package/dist/modes/interactive/components/compaction-boundary-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/compaction-boundary-message.js +15 -3
- package/dist/modes/interactive/components/compaction-boundary-message.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector-items.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector-items.js +43 -0
- package/dist/modes/interactive/components/settings-selector-items.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector-types.d.ts +6 -0
- package/dist/modes/interactive/components/settings-selector-types.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector-types.js.map +1 -1
- package/dist/modes/interactive/interactive-prompt-turn.js +6 -4
- package/dist/modes/interactive/interactive-prompt-turn.js.map +1 -1
- package/dist/modes/interactive/interactive-render-chat.js +13 -1
- package/dist/modes/interactive/interactive-render-chat.js.map +1 -1
- package/dist/modes/interactive/interactive-selectors.js +8 -0
- package/dist/modes/interactive/interactive-selectors.js.map +1 -1
- package/dist/modes/interactive/interactive-session-runtime.js +2 -0
- package/dist/modes/interactive/interactive-session-runtime.js.map +1 -1
- package/dist/modes/interactive/interactive-startup.js +1 -1
- package/dist/modes/interactive/interactive-startup.js.map +1 -1
- package/dist/modes/interactive/theme/tui-theme.d.ts.map +1 -1
- package/dist/modes/interactive/theme/tui-theme.js +1 -0
- package/dist/modes/interactive/theme/tui-theme.js.map +1 -1
- package/dist/modes/interactive-engine/engine-args.d.ts.map +1 -1
- package/dist/modes/interactive-engine/engine-args.js +1 -0
- package/dist/modes/interactive-engine/engine-args.js.map +1 -1
- package/dist/utils/credential-redaction.d.ts +2 -0
- package/dist/utils/credential-redaction.d.ts.map +1 -0
- package/dist/utils/credential-redaction.js +20 -0
- package/dist/utils/credential-redaction.js.map +1 -0
- package/dist/utils/syntax-highlight.d.ts.map +1 -1
- package/dist/utils/syntax-highlight.js +6 -1
- package/dist/utils/syntax-highlight.js.map +1 -1
- package/docs/codemode.md +3 -2
- package/docs/compaction/reference.md +10 -4
- package/docs/compaction.md +40 -8
- package/docs/docs.json +1 -0
- package/docs/extensions/api-reference.md +18 -0
- package/docs/extensions/authoring.md +1 -1
- package/docs/extensions/events.md +2 -2
- package/docs/extensions.md +2 -0
- package/docs/keybindings.md +9 -9
- package/docs/mcp-servers.md +4 -0
- package/docs/providers.md +33 -3
- package/docs/reference/cli.md +10 -3
- package/docs/sdk/reference.md +16 -1
- package/docs/sdk/web-server.md +325 -0
- package/docs/sdk.md +83 -1
- package/docs/security.md +1 -1
- package/docs/workflows/api-reference.md +74 -4
- package/docs/workflows/authoring.md +6 -2
- package/docs/workflows/builtins.md +4 -0
- package/docs/workflows/operations.md +12 -4
- package/npm-shrinkwrap.json +78 -74
- package/package.json +9 -9
|
@@ -81068,6 +81068,9 @@ class Protocol {
|
|
|
81068
81068
|
this.setRequestHandler(GetTaskPayloadRequestSchema, async (request, extra) => {
|
|
81069
81069
|
const handleTaskResult = async () => {
|
|
81070
81070
|
const taskId = request.params.taskId;
|
|
81071
|
+
if (!await this._taskStore.getTask(taskId, extra.sessionId)) {
|
|
81072
|
+
throw new McpError(ErrorCode.InvalidParams, `Task not found: ${taskId}`);
|
|
81073
|
+
}
|
|
81071
81074
|
if (this._taskMessageQueue) {
|
|
81072
81075
|
let queuedMessage;
|
|
81073
81076
|
while (queuedMessage = await this._taskMessageQueue.dequeue(taskId, extra.sessionId)) {
|
|
@@ -81098,12 +81101,12 @@ class Protocol {
|
|
|
81098
81101
|
throw new McpError(ErrorCode.InvalidParams, `Task not found: ${taskId}`);
|
|
81099
81102
|
}
|
|
81100
81103
|
if (!isTerminal(task.status)) {
|
|
81101
|
-
await this._waitForTaskUpdate(taskId, extra.signal);
|
|
81104
|
+
await this._waitForTaskUpdate(taskId, extra.signal, extra.sessionId);
|
|
81102
81105
|
return await handleTaskResult();
|
|
81103
81106
|
}
|
|
81104
81107
|
if (isTerminal(task.status)) {
|
|
81105
81108
|
const result = await this._taskStore.getTaskResult(taskId, extra.sessionId);
|
|
81106
|
-
this._clearTaskQueue(taskId);
|
|
81109
|
+
this._clearTaskQueue(taskId, extra.sessionId);
|
|
81107
81110
|
return {
|
|
81108
81111
|
...result,
|
|
81109
81112
|
_meta: {
|
|
@@ -81140,7 +81143,7 @@ class Protocol {
|
|
|
81140
81143
|
throw new McpError(ErrorCode.InvalidParams, `Cannot cancel task in terminal status: ${task.status}`);
|
|
81141
81144
|
}
|
|
81142
81145
|
await this._taskStore.updateTaskStatus(request.params.taskId, "cancelled", "Client cancelled task execution.", extra.sessionId);
|
|
81143
|
-
this._clearTaskQueue(request.params.taskId);
|
|
81146
|
+
this._clearTaskQueue(request.params.taskId, extra.sessionId);
|
|
81144
81147
|
const cancelledTask = await this._taskStore.getTask(request.params.taskId, extra.sessionId);
|
|
81145
81148
|
if (!cancelledTask) {
|
|
81146
81149
|
throw new McpError(ErrorCode.InvalidParams, `Task not found after cancellation: ${request.params.taskId}`);
|
|
@@ -81263,6 +81266,19 @@ class Protocol {
|
|
|
81263
81266
|
const handler = this._requestHandlers.get(request.method) ?? this.fallbackRequestHandler;
|
|
81264
81267
|
const capturedTransport = this._transport;
|
|
81265
81268
|
const relatedTaskId = request.params?._meta?.[RELATED_TASK_META_KEY]?.taskId;
|
|
81269
|
+
const sessionId = capturedTransport?.sessionId;
|
|
81270
|
+
const store = this._taskStore;
|
|
81271
|
+
let relatedTaskFound = true;
|
|
81272
|
+
let relatedTaskLookup;
|
|
81273
|
+
if (relatedTaskId && store && this._taskMessageQueue && sessionId !== undefined) {
|
|
81274
|
+
relatedTaskFound = false;
|
|
81275
|
+
relatedTaskLookup = (async () => {
|
|
81276
|
+
if (!await store.getTask(relatedTaskId, sessionId)) {
|
|
81277
|
+
throw new McpError(ErrorCode.InvalidParams, `Task not found: ${relatedTaskId}`);
|
|
81278
|
+
}
|
|
81279
|
+
relatedTaskFound = true;
|
|
81280
|
+
})();
|
|
81281
|
+
}
|
|
81266
81282
|
if (handler === undefined) {
|
|
81267
81283
|
const errorResponse = {
|
|
81268
81284
|
jsonrpc: "2.0",
|
|
@@ -81272,7 +81288,10 @@ class Protocol {
|
|
|
81272
81288
|
message: "Method not found"
|
|
81273
81289
|
}
|
|
81274
81290
|
};
|
|
81275
|
-
if (relatedTaskId &&
|
|
81291
|
+
if (relatedTaskId && relatedTaskLookup) {
|
|
81292
|
+
const queuedError = { type: "error", message: errorResponse, timestamp: Date.now() };
|
|
81293
|
+
relatedTaskLookup.then(() => this._enqueueTaskMessage(relatedTaskId, queuedError, sessionId), () => capturedTransport?.send(errorResponse)).catch((error) => this._onerror(new Error(`Failed to send an error response: ${error}`)));
|
|
81294
|
+
} else if (relatedTaskId && this._taskMessageQueue) {
|
|
81276
81295
|
this._enqueueTaskMessage(relatedTaskId, {
|
|
81277
81296
|
type: "error",
|
|
81278
81297
|
message: errorResponse,
|
|
@@ -81323,7 +81342,10 @@ class Protocol {
|
|
|
81323
81342
|
closeSSEStream: extra?.closeSSEStream,
|
|
81324
81343
|
closeStandaloneSSEStream: extra?.closeStandaloneSSEStream
|
|
81325
81344
|
};
|
|
81326
|
-
Promise.resolve().then(() => {
|
|
81345
|
+
(relatedTaskLookup ?? Promise.resolve()).then(() => {
|
|
81346
|
+
if (relatedTaskLookup && abortController.signal.aborted) {
|
|
81347
|
+
throw new McpError(ErrorCode.ConnectionClosed, "Request was cancelled");
|
|
81348
|
+
}
|
|
81327
81349
|
if (taskCreationParams) {
|
|
81328
81350
|
this.assertTaskHandlerCapability(request.method);
|
|
81329
81351
|
}
|
|
@@ -81358,7 +81380,7 @@ class Protocol {
|
|
|
81358
81380
|
...error["data"] !== undefined && { data: error["data"] }
|
|
81359
81381
|
}
|
|
81360
81382
|
};
|
|
81361
|
-
if (relatedTaskId && this._taskMessageQueue) {
|
|
81383
|
+
if (relatedTaskId && this._taskMessageQueue && relatedTaskFound) {
|
|
81362
81384
|
await this._enqueueTaskMessage(relatedTaskId, {
|
|
81363
81385
|
type: "error",
|
|
81364
81386
|
message: errorResponse,
|
|
@@ -81746,7 +81768,7 @@ class Protocol {
|
|
|
81746
81768
|
throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");
|
|
81747
81769
|
}
|
|
81748
81770
|
const maxQueueSize = this._options?.maxTaskQueueSize;
|
|
81749
|
-
await this._taskMessageQueue.enqueue(taskId, message, sessionId, maxQueueSize);
|
|
81771
|
+
await this._taskMessageQueue.enqueue(taskId, message, sessionId ?? this._transport?.sessionId, maxQueueSize);
|
|
81750
81772
|
}
|
|
81751
81773
|
async _clearTaskQueue(taskId, sessionId) {
|
|
81752
81774
|
if (this._taskMessageQueue) {
|
|
@@ -81765,10 +81787,10 @@ class Protocol {
|
|
|
81765
81787
|
}
|
|
81766
81788
|
}
|
|
81767
81789
|
}
|
|
81768
|
-
async _waitForTaskUpdate(taskId, signal) {
|
|
81790
|
+
async _waitForTaskUpdate(taskId, signal, sessionId) {
|
|
81769
81791
|
let interval = this._options?.defaultTaskPollInterval ?? 1000;
|
|
81770
81792
|
try {
|
|
81771
|
-
const task = await this._taskStore?.getTask(taskId);
|
|
81793
|
+
const task = await this._taskStore?.getTask(taskId, sessionId);
|
|
81772
81794
|
if (task?.pollInterval) {
|
|
81773
81795
|
interval = task.pollInterval;
|
|
81774
81796
|
}
|
|
@@ -89490,6 +89512,70 @@ function createFetchWithInit(baseFetch = fetch, baseInit) {
|
|
|
89490
89512
|
return baseFetch(url, mergedInit);
|
|
89491
89513
|
};
|
|
89492
89514
|
}
|
|
89515
|
+
function isWithinOrigin(from, to) {
|
|
89516
|
+
if (from.protocol === to.protocol && from.hostname === to.hostname && from.port === to.port) {
|
|
89517
|
+
return true;
|
|
89518
|
+
}
|
|
89519
|
+
return from.hostname === to.hostname && from.protocol === "http:" && from.port === "" && to.protocol === "https:" && to.port === "";
|
|
89520
|
+
}
|
|
89521
|
+
function redirectTarget(response, requestUrl) {
|
|
89522
|
+
const location = REDIRECT_STATUSES.includes(response.status) ? response.headers.get("location") : null;
|
|
89523
|
+
try {
|
|
89524
|
+
return location ? new URL(location, requestUrl) : undefined;
|
|
89525
|
+
} catch {
|
|
89526
|
+
return;
|
|
89527
|
+
}
|
|
89528
|
+
}
|
|
89529
|
+
function followWithinOrigin(baseFetch, url, init, response, followed = 0) {
|
|
89530
|
+
const target = redirectTarget(response, url);
|
|
89531
|
+
const keepsMethod = response.status === 307 || response.status === 308 || (init?.method ?? "GET").toUpperCase() === "GET";
|
|
89532
|
+
if (!target || followed === MAX_REDIRECTS || !keepsMethod) {
|
|
89533
|
+
return;
|
|
89534
|
+
}
|
|
89535
|
+
const from = new URL(url);
|
|
89536
|
+
const addsUserinfo = (target.username || target.password) && (target.username !== from.username || target.password !== from.password);
|
|
89537
|
+
if (addsUserinfo || !isWithinOrigin(from, target)) {
|
|
89538
|
+
return;
|
|
89539
|
+
}
|
|
89540
|
+
return Promise.resolve(response.body?.cancel()).then(() => baseFetch(target, { ...init, redirect: "manual" })).then((next) => followWithinOrigin(baseFetch, target, init, next, followed + 1) ?? next);
|
|
89541
|
+
}
|
|
89542
|
+
function fetchLeavingRedirects(baseFetch) {
|
|
89543
|
+
const following = (url, init) => (baseFetch ?? fetch)(url, init);
|
|
89544
|
+
followingFetches.add(following);
|
|
89545
|
+
return following;
|
|
89546
|
+
}
|
|
89547
|
+
function fetchWithinOrigin(baseFetch = fetch) {
|
|
89548
|
+
if (followingFetches.has(baseFetch)) {
|
|
89549
|
+
return baseFetch;
|
|
89550
|
+
}
|
|
89551
|
+
return (url, init) => {
|
|
89552
|
+
if (init?.redirect === "error" || init?.redirect === "manual") {
|
|
89553
|
+
return baseFetch(url, init);
|
|
89554
|
+
}
|
|
89555
|
+
return Promise.resolve(baseFetch(url, { ...init, redirect: "manual" })).then((response) => followWithinOrigin(baseFetch, url, init, response) ?? response);
|
|
89556
|
+
};
|
|
89557
|
+
}
|
|
89558
|
+
function unfollowedRedirect(response, requestUrl) {
|
|
89559
|
+
if (response.type === "opaqueredirect") {
|
|
89560
|
+
return "Redirect not followed: this runtime does not expose the redirect target";
|
|
89561
|
+
}
|
|
89562
|
+
const from = response.url || requestUrl;
|
|
89563
|
+
const target = redirectTarget(response, from);
|
|
89564
|
+
if (!target) {
|
|
89565
|
+
return;
|
|
89566
|
+
}
|
|
89567
|
+
target.username = target.password = target.search = target.hash = "";
|
|
89568
|
+
if (target.protocol === "http:" && new URL(from).protocol === "https:") {
|
|
89569
|
+
target.protocol = "https:";
|
|
89570
|
+
return `Redirect to plain http not followed; try ${target.href} instead`;
|
|
89571
|
+
}
|
|
89572
|
+
return `Redirect to ${target.href} not followed`;
|
|
89573
|
+
}
|
|
89574
|
+
var MAX_REDIRECTS = 5, REDIRECT_STATUSES, followingFetches;
|
|
89575
|
+
var init_transport = __esm(() => {
|
|
89576
|
+
REDIRECT_STATUSES = [301, 302, 303, 307, 308];
|
|
89577
|
+
followingFetches = new WeakSet;
|
|
89578
|
+
});
|
|
89493
89579
|
|
|
89494
89580
|
// ../../node_modules/pkce-challenge/dist/index.node.js
|
|
89495
89581
|
async function getRandomValues(size) {
|
|
@@ -89638,7 +89724,8 @@ var init_auth = __esm(() => {
|
|
|
89638
89724
|
token_type: string2(),
|
|
89639
89725
|
expires_in: number3().optional(),
|
|
89640
89726
|
scope: string2().optional(),
|
|
89641
|
-
refresh_token: string2().optional()
|
|
89727
|
+
refresh_token: string2().optional(),
|
|
89728
|
+
issuer: string2().optional().catch(undefined)
|
|
89642
89729
|
}).strip();
|
|
89643
89730
|
OAuthErrorResponseSchema = object2({
|
|
89644
89731
|
error: string2(),
|
|
@@ -89670,7 +89757,8 @@ var init_auth = __esm(() => {
|
|
|
89670
89757
|
client_id: string2(),
|
|
89671
89758
|
client_secret: string2().optional(),
|
|
89672
89759
|
client_id_issued_at: number2().optional(),
|
|
89673
|
-
client_secret_expires_at: number2().optional()
|
|
89760
|
+
client_secret_expires_at: number2().optional(),
|
|
89761
|
+
issuer: string2().optional().catch(undefined)
|
|
89674
89762
|
}).strip();
|
|
89675
89763
|
OAuthClientInformationFullSchema = OAuthClientMetadataSchema.merge(OAuthClientInformationSchema);
|
|
89676
89764
|
OAuthClientRegistrationErrorSchema = object2({
|
|
@@ -89862,10 +89950,28 @@ async function parseErrorResponse(input) {
|
|
|
89862
89950
|
const errorClass = OAUTH_ERRORS[error] || ServerError;
|
|
89863
89951
|
return new errorClass(error_description || "", error_uri);
|
|
89864
89952
|
} catch (error) {
|
|
89865
|
-
const
|
|
89953
|
+
const redirect = input instanceof Response ? unfollowedRedirect(input, input.url) : undefined;
|
|
89954
|
+
const errorMessage = `${statusCode ? `HTTP ${statusCode}: ` : ""}${redirect ?? `Invalid OAuth error response: ${error}. Raw body: ${body}`}`;
|
|
89866
89955
|
return new ServerError(errorMessage);
|
|
89867
89956
|
}
|
|
89868
89957
|
}
|
|
89958
|
+
function issuersMatch(a, b) {
|
|
89959
|
+
let [x, y] = [a, b];
|
|
89960
|
+
try {
|
|
89961
|
+
[x, y] = [new URL(a).href, new URL(b).href];
|
|
89962
|
+
} catch {}
|
|
89963
|
+
return x === y || x.endsWith("/") && x.slice(0, -1) === y || y.endsWith("/") && y.slice(0, -1) === x;
|
|
89964
|
+
}
|
|
89965
|
+
function discardIfIssuerMismatch(stored, issuer) {
|
|
89966
|
+
if (!stored)
|
|
89967
|
+
return;
|
|
89968
|
+
if (typeof stored.issuer !== "string")
|
|
89969
|
+
return stored.issuer == null ? stored : { ...stored, issuer: undefined };
|
|
89970
|
+
return issuersMatch(stored.issuer, issuer) ? stored : undefined;
|
|
89971
|
+
}
|
|
89972
|
+
function boundElsewhereError(stored, issuer) {
|
|
89973
|
+
return new Error(`OAuth client information is bound to authorization server ${stored.issuer} and is not presented to ${issuer}. ` + "Clear the stored client information, or correct `expectedIssuer`, if the authorization server has moved.");
|
|
89974
|
+
}
|
|
89869
89975
|
async function auth(provider, options) {
|
|
89870
89976
|
try {
|
|
89871
89977
|
return await authInternal(provider, options);
|
|
@@ -89918,9 +90024,23 @@ async function authInternal(provider, { serverUrl, authorizationCode, scope, res
|
|
|
89918
90024
|
authorizationServerMetadata: metadata
|
|
89919
90025
|
});
|
|
89920
90026
|
}
|
|
89921
|
-
const
|
|
90027
|
+
const issuer = String(authorizationServerUrl);
|
|
90028
|
+
const selectedResource = await selectResourceURL(serverUrl, provider, resourceMetadata);
|
|
90029
|
+
const resource = selectedResource && resourceMetadata && !provider.validateResourceURL ? resourceMetadata.resource : selectedResource;
|
|
89922
90030
|
const resolvedScope = scope || resourceMetadata?.scopes_supported?.join(" ") || provider.clientMetadata.scope;
|
|
89923
|
-
|
|
90031
|
+
const storedClientInformation = await Promise.resolve(provider.clientInformation());
|
|
90032
|
+
let clientInformation = discardIfIssuerMismatch(storedClientInformation, issuer);
|
|
90033
|
+
const canRegisterAgain = provider.saveClientInformation !== undefined && !!provider.redirectUrl;
|
|
90034
|
+
if (storedClientInformation && !clientInformation && !canRegisterAgain) {
|
|
90035
|
+
throw boundElsewhereError(storedClientInformation, issuer);
|
|
90036
|
+
}
|
|
90037
|
+
const unstampedClientInformation = clientInformation?.issuer == null ? clientInformation : undefined;
|
|
90038
|
+
const bindClientInformation = async () => {
|
|
90039
|
+
try {
|
|
90040
|
+
if (unstampedClientInformation)
|
|
90041
|
+
await provider.saveClientInformation?.({ ...unstampedClientInformation, issuer });
|
|
90042
|
+
} catch {}
|
|
90043
|
+
};
|
|
89924
90044
|
if (!clientInformation) {
|
|
89925
90045
|
if (authorizationCode !== undefined) {
|
|
89926
90046
|
throw new Error("Existing OAuth client information is required when exchanging an authorization code");
|
|
@@ -89932,9 +90052,7 @@ async function authInternal(provider, { serverUrl, authorizationCode, scope, res
|
|
|
89932
90052
|
}
|
|
89933
90053
|
const shouldUseUrlBasedClientId = supportsUrlBasedClientId && clientMetadataUrl;
|
|
89934
90054
|
if (shouldUseUrlBasedClientId) {
|
|
89935
|
-
clientInformation = {
|
|
89936
|
-
client_id: clientMetadataUrl
|
|
89937
|
-
};
|
|
90055
|
+
clientInformation = { client_id: clientMetadataUrl, issuer };
|
|
89938
90056
|
await provider.saveClientInformation?.(clientInformation);
|
|
89939
90057
|
} else {
|
|
89940
90058
|
if (!provider.saveClientInformation) {
|
|
@@ -89946,8 +90064,8 @@ async function authInternal(provider, { serverUrl, authorizationCode, scope, res
|
|
|
89946
90064
|
scope: resolvedScope,
|
|
89947
90065
|
fetchFn
|
|
89948
90066
|
});
|
|
89949
|
-
|
|
89950
|
-
clientInformation
|
|
90067
|
+
clientInformation = { ...fullInformation, issuer };
|
|
90068
|
+
await provider.saveClientInformation(clientInformation);
|
|
89951
90069
|
}
|
|
89952
90070
|
}
|
|
89953
90071
|
const nonInteractiveFlow = !provider.redirectUrl;
|
|
@@ -89958,10 +90076,14 @@ async function authInternal(provider, { serverUrl, authorizationCode, scope, res
|
|
|
89958
90076
|
authorizationCode,
|
|
89959
90077
|
fetchFn
|
|
89960
90078
|
});
|
|
89961
|
-
await
|
|
90079
|
+
await bindClientInformation();
|
|
90080
|
+
await provider.saveTokens({ ...tokens, issuer });
|
|
89962
90081
|
return "AUTHORIZED";
|
|
89963
90082
|
}
|
|
89964
|
-
const tokens = await provider.tokens();
|
|
90083
|
+
const tokens = discardIfIssuerMismatch(await provider.tokens(), issuer);
|
|
90084
|
+
if (tokens?.refresh_token && tokens.issuer == null) {
|
|
90085
|
+
console.warn("[mcp-sdk] stored OAuth tokens have no 'issuer' property (saved by an earlier version, or by a provider that " + "does not keep it) and are used as-is; make sure your OAuthClientProvider stores what saveTokens() and " + "saveClientInformation() receive unchanged.");
|
|
90086
|
+
}
|
|
89965
90087
|
if (tokens?.refresh_token) {
|
|
89966
90088
|
try {
|
|
89967
90089
|
const newTokens = await refreshAuthorization(authorizationServerUrl, {
|
|
@@ -89972,7 +90094,8 @@ async function authInternal(provider, { serverUrl, authorizationCode, scope, res
|
|
|
89972
90094
|
addClientAuthentication: provider.addClientAuthentication,
|
|
89973
90095
|
fetchFn
|
|
89974
90096
|
});
|
|
89975
|
-
await
|
|
90097
|
+
await bindClientInformation();
|
|
90098
|
+
await provider.saveTokens({ ...newTokens, issuer });
|
|
89976
90099
|
return "AUTHORIZED";
|
|
89977
90100
|
} catch (error) {
|
|
89978
90101
|
if (!(error instanceof OAuthError) || error instanceof ServerError) {} else {
|
|
@@ -90069,7 +90192,7 @@ async function discoverOAuthProtectedResourceMetadata(serverUrl, opts, fetchFn =
|
|
|
90069
90192
|
}
|
|
90070
90193
|
async function fetchWithCorsRetry(url, headers, fetchFn = fetch) {
|
|
90071
90194
|
try {
|
|
90072
|
-
return await fetchFn(url, { headers });
|
|
90195
|
+
return await fetchWithinOrigin(fetchFn)(url, { headers });
|
|
90073
90196
|
} catch (error) {
|
|
90074
90197
|
if (error instanceof TypeError) {
|
|
90075
90198
|
if (headers) {
|
|
@@ -90094,7 +90217,7 @@ async function tryMetadataDiscovery(url, protocolVersion, fetchFn = fetch) {
|
|
|
90094
90217
|
return await fetchWithCorsRetry(url, headers, fetchFn);
|
|
90095
90218
|
}
|
|
90096
90219
|
function shouldAttemptFallback(response, pathname) {
|
|
90097
|
-
return !response || response.
|
|
90220
|
+
return !response || !response.ok && response.status < 500 && pathname !== "/";
|
|
90098
90221
|
}
|
|
90099
90222
|
async function discoverMetadataWithFallback(serverUrl, wellKnownType, fetchFn, opts) {
|
|
90100
90223
|
const issuer = new URL(serverUrl);
|
|
@@ -90160,7 +90283,7 @@ async function discoverAuthorizationServerMetadata(authorizationServerUrl, { fet
|
|
|
90160
90283
|
}
|
|
90161
90284
|
if (!response.ok) {
|
|
90162
90285
|
await response.body?.cancel();
|
|
90163
|
-
if (response.status
|
|
90286
|
+
if (response.status < 500) {
|
|
90164
90287
|
continue;
|
|
90165
90288
|
}
|
|
90166
90289
|
throw new Error(`HTTP ${response.status} trying to load ${type === "oauth" ? "OAuth" : "OpenID provider"} metadata from ${endpointUrl}`);
|
|
@@ -90192,6 +90315,9 @@ async function discoverOAuthServerInfo(serverUrl, opts) {
|
|
|
90192
90315
|
resourceMetadata
|
|
90193
90316
|
};
|
|
90194
90317
|
}
|
|
90318
|
+
function resourceIndicatorToString(resource) {
|
|
90319
|
+
return typeof resource === "string" ? resource : resource.href;
|
|
90320
|
+
}
|
|
90195
90321
|
async function startAuthorization(authorizationServerUrl, { metadata, clientInformation, redirectUrl, scope, state, resource }) {
|
|
90196
90322
|
let authorizationUrl;
|
|
90197
90323
|
if (metadata) {
|
|
@@ -90223,7 +90349,7 @@ async function startAuthorization(authorizationServerUrl, { metadata, clientInfo
|
|
|
90223
90349
|
authorizationUrl.searchParams.append("prompt", "consent");
|
|
90224
90350
|
}
|
|
90225
90351
|
if (resource) {
|
|
90226
|
-
authorizationUrl.searchParams.set("resource", resource
|
|
90352
|
+
authorizationUrl.searchParams.set("resource", resourceIndicatorToString(resource));
|
|
90227
90353
|
}
|
|
90228
90354
|
return { authorizationUrl, codeVerifier };
|
|
90229
90355
|
}
|
|
@@ -90242,7 +90368,7 @@ async function executeTokenRequest(authorizationServerUrl, { metadata, tokenRequ
|
|
|
90242
90368
|
Accept: "application/json"
|
|
90243
90369
|
});
|
|
90244
90370
|
if (resource) {
|
|
90245
|
-
tokenRequestParams.set("resource", resource
|
|
90371
|
+
tokenRequestParams.set("resource", resourceIndicatorToString(resource));
|
|
90246
90372
|
}
|
|
90247
90373
|
if (addClientAuthentication) {
|
|
90248
90374
|
await addClientAuthentication(headers, tokenRequestParams, tokenUrl, metadata);
|
|
@@ -90251,7 +90377,7 @@ async function executeTokenRequest(authorizationServerUrl, { metadata, tokenRequ
|
|
|
90251
90377
|
const authMethod = selectClientAuthMethod(clientInformation, supportedMethods);
|
|
90252
90378
|
applyClientAuthentication(authMethod, clientInformation, headers, tokenRequestParams);
|
|
90253
90379
|
}
|
|
90254
|
-
const response = await (fetchFn ?? fetch)(tokenUrl, {
|
|
90380
|
+
const response = await fetchWithinOrigin(fetchFn ?? fetch)(tokenUrl, {
|
|
90255
90381
|
method: "POST",
|
|
90256
90382
|
headers,
|
|
90257
90383
|
body: tokenRequestParams
|
|
@@ -90259,7 +90385,7 @@ async function executeTokenRequest(authorizationServerUrl, { metadata, tokenRequ
|
|
|
90259
90385
|
if (!response.ok) {
|
|
90260
90386
|
throw await parseErrorResponse(response);
|
|
90261
90387
|
}
|
|
90262
|
-
return
|
|
90388
|
+
return TokenResponseSchema.parse(await response.json());
|
|
90263
90389
|
}
|
|
90264
90390
|
async function refreshAuthorization(authorizationServerUrl, { metadata, clientInformation, refreshToken, resource, addClientAuthentication, fetchFn }) {
|
|
90265
90391
|
const tokenRequestParams = new URLSearchParams({
|
|
@@ -90277,6 +90403,15 @@ async function refreshAuthorization(authorizationServerUrl, { metadata, clientIn
|
|
|
90277
90403
|
return { refresh_token: refreshToken, ...tokens };
|
|
90278
90404
|
}
|
|
90279
90405
|
async function fetchToken(provider, authorizationServerUrl, { metadata, resource, authorizationCode, fetchFn } = {}) {
|
|
90406
|
+
const readClientInformation = async () => {
|
|
90407
|
+
const storedClientInformation = await provider.clientInformation();
|
|
90408
|
+
const checked = discardIfIssuerMismatch(storedClientInformation, String(authorizationServerUrl));
|
|
90409
|
+
if (storedClientInformation && !checked) {
|
|
90410
|
+
throw boundElsewhereError(storedClientInformation, String(authorizationServerUrl));
|
|
90411
|
+
}
|
|
90412
|
+
return checked;
|
|
90413
|
+
};
|
|
90414
|
+
let clientInformation = await readClientInformation();
|
|
90280
90415
|
const scope = provider.clientMetadata.scope;
|
|
90281
90416
|
let tokenRequestParams;
|
|
90282
90417
|
if (provider.prepareTokenRequest) {
|
|
@@ -90292,11 +90427,11 @@ async function fetchToken(provider, authorizationServerUrl, { metadata, resource
|
|
|
90292
90427
|
const codeVerifier = await provider.codeVerifier();
|
|
90293
90428
|
tokenRequestParams = prepareAuthorizationCodeRequest(authorizationCode, codeVerifier, provider.redirectUrl);
|
|
90294
90429
|
}
|
|
90295
|
-
|
|
90430
|
+
clientInformation ?? (clientInformation = await readClientInformation());
|
|
90296
90431
|
return executeTokenRequest(authorizationServerUrl, {
|
|
90297
90432
|
metadata,
|
|
90298
90433
|
tokenRequestParams,
|
|
90299
|
-
clientInformation
|
|
90434
|
+
clientInformation,
|
|
90300
90435
|
addClientAuthentication: provider.addClientAuthentication,
|
|
90301
90436
|
resource,
|
|
90302
90437
|
fetchFn
|
|
@@ -90312,7 +90447,7 @@ async function registerClient(authorizationServerUrl, { metadata, clientMetadata
|
|
|
90312
90447
|
} else {
|
|
90313
90448
|
registrationUrl = new URL("/register", authorizationServerUrl);
|
|
90314
90449
|
}
|
|
90315
|
-
const response = await (fetchFn ?? fetch)(registrationUrl, {
|
|
90450
|
+
const response = await fetchWithinOrigin(fetchFn ?? fetch)(registrationUrl, {
|
|
90316
90451
|
method: "POST",
|
|
90317
90452
|
headers: {
|
|
90318
90453
|
"Content-Type": "application/json"
|
|
@@ -90325,20 +90460,23 @@ async function registerClient(authorizationServerUrl, { metadata, clientMetadata
|
|
|
90325
90460
|
if (!response.ok) {
|
|
90326
90461
|
throw await parseErrorResponse(response);
|
|
90327
90462
|
}
|
|
90328
|
-
return
|
|
90463
|
+
return RegistrationResponseSchema.parse(await response.json());
|
|
90329
90464
|
}
|
|
90330
|
-
var UnauthorizedError, AUTHORIZATION_CODE_RESPONSE_TYPE = "code", AUTHORIZATION_CODE_CHALLENGE_METHOD = "S256";
|
|
90465
|
+
var UnauthorizedError, AUTHORIZATION_CODE_RESPONSE_TYPE = "code", AUTHORIZATION_CODE_CHALLENGE_METHOD = "S256", TokenResponseSchema, RegistrationResponseSchema;
|
|
90331
90466
|
var init_auth2 = __esm(() => {
|
|
90332
90467
|
init_index_node();
|
|
90333
90468
|
init_types();
|
|
90334
90469
|
init_auth();
|
|
90335
90470
|
init_auth();
|
|
90336
90471
|
init_errors3();
|
|
90472
|
+
init_transport();
|
|
90337
90473
|
UnauthorizedError = class UnauthorizedError extends Error {
|
|
90338
90474
|
constructor(message) {
|
|
90339
90475
|
super(message ?? "Unauthorized");
|
|
90340
90476
|
}
|
|
90341
90477
|
};
|
|
90478
|
+
TokenResponseSchema = OAuthTokensSchema.omit({ issuer: true });
|
|
90479
|
+
RegistrationResponseSchema = OAuthClientInformationFullSchema.omit({ issuer: true });
|
|
90342
90480
|
});
|
|
90343
90481
|
|
|
90344
90482
|
// ../../node_modules/eventsource-parser/dist/index.js
|
|
@@ -90541,9 +90679,18 @@ class StreamableHTTPClientTransport {
|
|
|
90541
90679
|
this._authProvider = opts?.authProvider;
|
|
90542
90680
|
this._fetch = opts?.fetch;
|
|
90543
90681
|
this._fetchWithInit = createFetchWithInit(opts?.fetch, opts?.requestInit);
|
|
90682
|
+
this._followRedirects = opts?.redirectPolicy === "follow";
|
|
90683
|
+
if (this._followRedirects) {
|
|
90684
|
+
this._fetch = fetchLeavingRedirects(this._fetch);
|
|
90685
|
+
this._fetchWithInit = fetchLeavingRedirects(this._fetchWithInit);
|
|
90686
|
+
}
|
|
90544
90687
|
this._sessionId = opts?.sessionId;
|
|
90545
90688
|
this._reconnectionOptions = opts?.reconnectionOptions ?? DEFAULT_STREAMABLE_HTTP_RECONNECTION_OPTIONS;
|
|
90546
90689
|
}
|
|
90690
|
+
_unfollowedRedirect(response, url) {
|
|
90691
|
+
const text = unfollowedRedirect(response, url);
|
|
90692
|
+
return text && !this._followRedirects ? `${text} (redirectPolicy: 'same-origin')` : text;
|
|
90693
|
+
}
|
|
90547
90694
|
async _authThenStart() {
|
|
90548
90695
|
if (!this._authProvider) {
|
|
90549
90696
|
throw new UnauthorizedError("No auth provider");
|
|
@@ -90593,11 +90740,13 @@ class StreamableHTTPClientTransport {
|
|
|
90593
90740
|
if (resumptionToken) {
|
|
90594
90741
|
headers.set("last-event-id", resumptionToken);
|
|
90595
90742
|
}
|
|
90596
|
-
const
|
|
90597
|
-
|
|
90598
|
-
|
|
90599
|
-
|
|
90600
|
-
|
|
90743
|
+
const fetchFn = this._fetch ?? fetch;
|
|
90744
|
+
const init = { method: "GET", headers, signal: this._abortController?.signal };
|
|
90745
|
+
let response = await fetchFn(this._url, this._followRedirects ? init : { ...init, redirect: "manual" });
|
|
90746
|
+
const followed = this._followRedirects ? undefined : followWithinOrigin(fetchFn, this._url, init, response);
|
|
90747
|
+
if (followed) {
|
|
90748
|
+
response = await followed;
|
|
90749
|
+
}
|
|
90601
90750
|
if (!response.ok) {
|
|
90602
90751
|
await response.body?.cancel();
|
|
90603
90752
|
if (response.status === 401 && this._authProvider) {
|
|
@@ -90606,7 +90755,7 @@ class StreamableHTTPClientTransport {
|
|
|
90606
90755
|
if (response.status === 405) {
|
|
90607
90756
|
return;
|
|
90608
90757
|
}
|
|
90609
|
-
throw new StreamableHTTPError(response.status, `Failed to open SSE stream: ${response.statusText}`);
|
|
90758
|
+
throw new StreamableHTTPError(response.status, `Failed to open SSE stream: ${this._unfollowedRedirect(response, this._url) ?? response.statusText}`);
|
|
90610
90759
|
}
|
|
90611
90760
|
this._handleSseStream(response.body, options, true);
|
|
90612
90761
|
} catch (error) {
|
|
@@ -90754,7 +90903,7 @@ class StreamableHTTPClientTransport {
|
|
|
90754
90903
|
body: JSON.stringify(message),
|
|
90755
90904
|
signal: this._abortController?.signal
|
|
90756
90905
|
};
|
|
90757
|
-
const response = await (this._fetch ?? fetch)(this._url, init);
|
|
90906
|
+
const response = await fetchWithinOrigin(this._fetch ?? fetch)(this._url, init);
|
|
90758
90907
|
const sessionId = response.headers.get("mcp-session-id");
|
|
90759
90908
|
if (sessionId) {
|
|
90760
90909
|
this._sessionId = sessionId;
|
|
@@ -90806,7 +90955,7 @@ class StreamableHTTPClientTransport {
|
|
|
90806
90955
|
return this.send(message);
|
|
90807
90956
|
}
|
|
90808
90957
|
}
|
|
90809
|
-
throw new StreamableHTTPError(response.status, `Error POSTing to endpoint: ${text}`);
|
|
90958
|
+
throw new StreamableHTTPError(response.status, `Error POSTing to endpoint: ${this._unfollowedRedirect(response, this._url) ?? text}`);
|
|
90810
90959
|
}
|
|
90811
90960
|
this._hasCompletedAuthFlow = false;
|
|
90812
90961
|
this._lastUpscopingHeader = undefined;
|
|
@@ -90857,10 +91006,10 @@ class StreamableHTTPClientTransport {
|
|
|
90857
91006
|
headers,
|
|
90858
91007
|
signal: this._abortController?.signal
|
|
90859
91008
|
};
|
|
90860
|
-
const response = await (this._fetch ?? fetch)(this._url, init);
|
|
91009
|
+
const response = await fetchWithinOrigin(this._fetch ?? fetch)(this._url, init);
|
|
90861
91010
|
await response.body?.cancel();
|
|
90862
91011
|
if (!response.ok && response.status !== 405) {
|
|
90863
|
-
throw new StreamableHTTPError(response.status, `Failed to terminate session: ${response.statusText}`);
|
|
91012
|
+
throw new StreamableHTTPError(response.status, `Failed to terminate session: ${this._unfollowedRedirect(response, this._url) ?? response.statusText}`);
|
|
90864
91013
|
}
|
|
90865
91014
|
this._sessionId = undefined;
|
|
90866
91015
|
} catch (error) {
|
|
@@ -90884,6 +91033,7 @@ class StreamableHTTPClientTransport {
|
|
|
90884
91033
|
var DEFAULT_STREAMABLE_HTTP_RECONNECTION_OPTIONS, StreamableHTTPError;
|
|
90885
91034
|
var init_streamableHttp = __esm(() => {
|
|
90886
91035
|
init_mediaType();
|
|
91036
|
+
init_transport();
|
|
90887
91037
|
init_types();
|
|
90888
91038
|
init_auth2();
|
|
90889
91039
|
init_stream();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bastani/web-access",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.28-alpha.2",
|
|
4
4
|
"private": true,
|
|
5
5
|
"description": "Atomic extension for web search, URL fetching, GitHub repo cloning, PDF/video extraction. Fork of: https://github.com/nicobailon/pi-web-access",
|
|
6
6
|
"contributors": [
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"@bastani/atomic": "*",
|
|
34
|
-
"@earendil-works/pi-tui": "^1.0.
|
|
34
|
+
"@earendil-works/pi-tui": "^1.0.4"
|
|
35
35
|
},
|
|
36
36
|
"peerDependenciesMeta": {
|
|
37
37
|
"@bastani/atomic": {
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
}
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@modelcontextprotocol/sdk": "1.
|
|
45
|
+
"@modelcontextprotocol/sdk": "1.32.1",
|
|
46
46
|
"@mozilla/readability": "^0.6.0",
|
|
47
47
|
"linkedom": "^0.18.13",
|
|
48
48
|
"p-limit": "^7.3.2",
|
|
@@ -6,6 +6,37 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [0.9.28-alpha.2] - 2026-10-07
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- Added `createAgentSessionAdapter(baseOptions?)`, which builds the default workflow stage-session adapter with `createAgentSession` options shared by every stage ([#3472](https://github.com/bastani-inc/atomic/issues/3472)).
|
|
14
|
+
|
|
15
|
+
### Fixed
|
|
16
|
+
|
|
17
|
+
- Fixed long workflow runs retaining a full metadata snapshot for every checkpoint and message update. Atomic now compacts superseded snapshots, removes their duplicate input payloads, and bounds settled delivery state across root and child runs, including failed-stage sticky receipts, while preserving resume and message deduplication ([#3467](https://github.com/bastani-inc/atomic/issues/3467)).
|
|
18
|
+
- Fixed archived sticky message receipts being ignored when a failed stage retries delivery without an explicit recipient or through live Intercom transport. Retry forwarding and confirmation deduplication survive cold resume, while a new recipient session can still receive the message ([#3467](https://github.com/bastani-inc/atomic/issues/3467)).
|
|
19
|
+
- Fixed sticky messages delivered as pre-start context being forwarded again to the same live session, including after receipt archival and cold resume. Concurrent confirmations remain deduplicated when a stage finishes before they are saved, while a new recipient session can still receive the message ([#3467](https://github.com/bastani-inc/atomic/issues/3467)).
|
|
20
|
+
- Fixed interrupted sticky receipt saves losing delivery counts after retry or cold resume and incorrectly reporting delivered messages as undeliverable ([#3467](https://github.com/bastani-inc/atomic/issues/3467)).
|
|
21
|
+
- Fixed Goal infrastructure failures incorrectly ending the goal as `needs_human`. The ledger now stays `active`, and direct resume in the same session retries the interrupted stage and completes its turn without quitting Atomic. Malformed reviewer output, including exhausted schema corrections, still requires human attention. Older synthetic failure verdicts with identifiable database/checkpoint diagnostics are also recoverable; ambiguous old failures remain unchanged ([#3466](https://github.com/bastani-inc/atomic/issues/3466)).
|
|
22
|
+
- Fixed Goal treating exhausted reviewer corrections for invalid `structured_output` inputs, including whitespace-only instructions and empty named state, as resumable infrastructure failures instead of `needs_human` ([#3466](https://github.com/bastani-inc/atomic/issues/3466)).
|
|
23
|
+
- Fixed Goal reviewer corrections hiding an earlier provider failure when a later `structured_output` call has invalid inputs. If no correction succeeds, the goal remains resumable instead of becoming `needs_human` ([#3466](https://github.com/bastani-inc/atomic/issues/3466)).
|
|
24
|
+
- Fixed `run()` failing at the first `ctx.task` or `ctx.stage` with "prompt adapter not configured" when `opts.adapters` was omitted. Stages now default to in-process `createAgentSession` sessions with in-memory session managers ([#3472](https://github.com/bastani-inc/atomic/issues/3472)).
|
|
25
|
+
- Fixed `resumeInFlight` having no effect at startup. `auto` now resumes eligible interrupted durable workflows, `ask` requests confirmation when a UI is available, and `never` leaves them for `/workflow resume`. Paused, quit, blocked, failed, awaiting-input, and live-owned runs are not automatically restarted ([#3468](https://github.com/bastani-inc/atomic/issues/3468)).
|
|
26
|
+
- Fixed startup recovery of agent-owned workflows retaining the previous session's ownership. Safely recovered runs now allow the current session's agent to inspect and control them ([#3468](https://github.com/bastani-inc/atomic/issues/3468)).
|
|
27
|
+
- Fixed recovered workflows disconnecting Intercom with pending-stage authorization errors when workflow extension modules load more than once ([#3468](https://github.com/bastani-inc/atomic/issues/3468)).
|
|
28
|
+
- Fixed recovered agent stages failing with a stale extension context after accepted startup recovery. Committed host generations hand off synchronously and retired Store observers detach before authority revocation, independently of shutdown handler order ([#3468](https://github.com/bastani-inc/atomic/issues/3468)).
|
|
29
|
+
- Fixed startup recovery offering or restarting another project's workflows when projects share a database. Automatic recovery now requires the original invocation directory to match the current working directory; cross-project recovery remains available through `/workflow resume` ([#3468](https://github.com/bastani-inc/atomic/issues/3468)).
|
|
30
|
+
- Fixed durable-workflow shutdown returning before ownership and protected SQL connections terminated, including pending SQL acquisitions, so immediate recovery no longer races a stale executor lock ([#3489](https://github.com/bastani-inc/atomic/issues/3489)).
|
|
31
|
+
|
|
32
|
+
## [0.9.28-alpha.1] - 2026-10-05
|
|
33
|
+
|
|
34
|
+
### Fixed
|
|
35
|
+
|
|
36
|
+
- Attached stage chats honor configured transcript jump shortcuts, defaulting to Ctrl+Home and Ctrl+End, without intercepting the editor's Home and End keys.
|
|
37
|
+
- Fixed slow workflow discovery for imports of `@bastani/atomic`, `@bastani/pi-ai`, and `@bastani/pi-ai/providers/all` by sharing the running CLI's modules instead of loading them again for each workflow file. The host's versions take precedence over project copies for these three exact specifiers. These imports no longer need project-local packages in standalone-binary installs; workflow files and relative imports still refresh on reload ([#3454](https://github.com/bastani-inc/atomic/issues/3454)).
|
|
38
|
+
- Fixed workflow stage questions in one process hosting several SDK sessions reaching the wrong session. A stage's `ask_user_question`, readiness question, or `ctx.ui.custom` prompt could go to whichever sibling session started last, so its own `HostInput.questionnaire` was never called and the stage stayed `awaiting_input`. Each session now keeps its own workflow store, stage UI broker, and run registries ([#3456](https://github.com/bastani-inc/atomic/issues/3456)).
|
|
39
|
+
|
|
9
40
|
## [0.9.27] - 2026-10-05
|
|
10
41
|
|
|
11
42
|
### Fixed
|