@frontmcp/sdk 1.11.1 → 1.11.3
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/README.md +9 -0
- package/agent/adapters/anthropic.adapter.d.ts +4 -4
- package/agent/adapters/anthropic.adapter.d.ts.map +1 -1
- package/agent/adapters/base.adapter.d.ts +12 -2
- package/agent/adapters/base.adapter.d.ts.map +1 -1
- package/agent/adapters/index.d.ts +1 -1
- package/agent/adapters/index.d.ts.map +1 -1
- package/agent/adapters/openai.adapter.d.ts +7 -7
- package/agent/adapters/openai.adapter.d.ts.map +1 -1
- package/agent/agent-execution-loop.d.ts +27 -14
- package/agent/agent-execution-loop.d.ts.map +1 -1
- package/agent/agent.registry.d.ts +9 -0
- package/agent/agent.registry.d.ts.map +1 -1
- package/agent/flows/call-agent.flow.d.ts.map +1 -1
- package/app/instances/app.esm.instance.d.ts +27 -5
- package/app/instances/app.esm.instance.d.ts.map +1 -1
- package/app/instances/app.remote.instance.d.ts.map +1 -1
- package/app/instances/esm-normalize.utils.d.ts +3 -1
- package/app/instances/esm-normalize.utils.d.ts.map +1 -1
- package/app/instances/esm-package-version.d.ts +48 -0
- package/app/instances/esm-package-version.d.ts.map +1 -0
- package/auth/auth-ui/auth-ui.contract.d.ts +27 -0
- package/auth/auth-ui/auth-ui.contract.d.ts.map +1 -1
- package/auth/auth-ui/auth-ui.state.d.ts +2 -1
- package/auth/auth-ui/auth-ui.state.d.ts.map +1 -1
- package/auth/auth-ui/index.d.ts +1 -1
- package/auth/auth-ui/index.d.ts.map +1 -1
- package/auth/authorization/orchestrated.context-extension.d.ts +1 -1
- package/auth/authorization/orchestrated.context-extension.d.ts.map +1 -1
- package/auth/authorized-apps.utils.d.ts +22 -0
- package/auth/authorized-apps.utils.d.ts.map +1 -1
- package/auth/federated-steps.d.ts +66 -0
- package/auth/federated-steps.d.ts.map +1 -0
- package/auth/flows/oauth.authorize.flow.d.ts +2 -2
- package/auth/flows/oauth.authorize.flow.d.ts.map +1 -1
- package/auth/flows/oauth.callback.flow.d.ts +17 -6
- package/auth/flows/oauth.callback.flow.d.ts.map +1 -1
- package/auth/flows/oauth.provider-callback.flow.d.ts.map +1 -1
- package/auth/flows/oauth.register.flow.d.ts +1 -1
- package/auth/flows/oauth.register.flow.d.ts.map +1 -1
- package/auth/flows/oauth.token.flow.d.ts +9 -0
- package/auth/flows/oauth.token.flow.d.ts.map +1 -1
- package/auth/flows/oauth.userinfo.flow.d.ts +1 -1
- package/auth/flows/well-known.oauth-authorization-server.flow.d.ts +3 -0
- package/auth/flows/well-known.oauth-authorization-server.flow.d.ts.map +1 -1
- package/auth/flows/well-known.prm.flow.d.ts.map +1 -1
- package/auth/instances/instance.local-primary-auth.d.ts +38 -7
- package/auth/instances/instance.local-primary-auth.d.ts.map +1 -1
- package/auth/required-providers.utils.d.ts +19 -0
- package/auth/required-providers.utils.d.ts.map +1 -0
- package/browser/agent/adapters/anthropic.adapter.mjs +14 -10
- package/browser/agent/adapters/base.adapter.mjs +10 -3
- package/browser/agent/adapters/openai.adapter.mjs +39 -25
- package/browser/agent/agent-execution-loop.mjs +102 -70
- package/browser/agent/agent.registry.mjs +56 -20
- package/browser/agent/flows/call-agent.flow.mjs +2 -1
- package/browser/agent/index.mjs +1 -1
- package/browser/app/instances/app.esm.instance.mjs +120 -154
- package/browser/app/instances/app.remote.instance.mjs +3 -4
- package/browser/app/instances/esm-normalize.utils.mjs +10 -5
- package/browser/app/instances/esm-package-version.mjs +118 -0
- package/browser/auth/auth-ui/auth-ui.state.mjs +1 -1
- package/browser/auth/authorization/orchestrated.context-extension.mjs +2 -2
- package/browser/auth/authorized-apps.utils.mjs +24 -2
- package/browser/auth/federated-steps.mjs +199 -0
- package/browser/auth/flows/oauth.authorize.flow.mjs +61 -76
- package/browser/auth/flows/oauth.callback.flow.mjs +112 -42
- package/browser/auth/flows/oauth.provider-callback.flow.mjs +14 -2
- package/browser/auth/flows/oauth.register.flow.mjs +3 -3
- package/browser/auth/flows/oauth.token.flow.mjs +33 -3
- package/browser/auth/flows/session.verify.flow.mjs +1 -1
- package/browser/auth/flows/well-known.oauth-authorization-server.flow.mjs +11 -6
- package/browser/auth/flows/well-known.prm.flow.mjs +2 -1
- package/browser/auth/instances/instance.local-primary-auth.mjs +131 -37
- package/browser/auth/required-providers.utils.mjs +16 -0
- package/browser/channel/channel-scope.helper.mjs +2 -2
- package/browser/channel/flows/send-channel-notification.flow.mjs +1 -1
- package/browser/common/entries/tool.entry.mjs +21 -4
- package/browser/common/index.mjs +2 -2
- package/browser/common/interfaces/agent.interface.mjs +25 -4
- package/browser/common/interfaces/tool.interface.mjs +31 -5
- package/browser/common/metadata/app.metadata.mjs +8 -2
- package/browser/common/metadata/index.mjs +1 -1
- package/browser/common/metadata/output-policy.mjs +4 -0
- package/browser/common/metadata/workflow.metadata.mjs +3 -1
- package/browser/common/tokens/workflow.tokens.mjs +1 -0
- package/browser/common/types/options/transport/schema.mjs +3 -0
- package/browser/common/utils/auth-info.utils.mjs +1 -2
- package/browser/common/utils/index.mjs +1 -1
- package/browser/common/utils/principal.utils.mjs +25 -1
- package/browser/context/frontmcp-context-storage.mjs +14 -3
- package/browser/context/frontmcp-context.mjs +24 -2
- package/browser/elicitation/helpers/checked-elicit-answer.mjs +18 -0
- package/browser/elicitation/helpers/elicit.helper.mjs +5 -21
- package/browser/elicitation/store/elicitation-encryption.mjs +6 -6
- package/browser/elicitation/store/encrypted-elicitation.store.mjs +2 -2
- package/browser/elicitation/store/storage-elicitation.store.mjs +1 -2
- package/browser/errors/auth-internal.errors.mjs +2 -0
- package/browser/errors/index.mjs +6 -1
- package/browser/errors/mcp.error.mjs +22 -3
- package/browser/errors/misconfiguration.mjs +2 -0
- package/browser/errors/remote.errors.mjs +1 -1
- package/browser/errors/tool-ui.errors.mjs +22 -0
- package/browser/errors/workflow.errors.mjs +7 -1
- package/browser/esm-loader/esm-cache.mjs +2 -2
- package/browser/esm-loader/esm-entries.mjs +15 -1
- package/browser/esm-loader/esm-manifest.mjs +32 -25
- package/browser/esm-loader/esm-module-loader.mjs +22 -4
- package/browser/esm-loader/factories/esm-context-factories.mjs +3 -3
- package/browser/esm-loader/factories/esm-instance-factories.mjs +7 -3
- package/browser/esm-loader/factories/esm-record-builders.mjs +27 -2
- package/browser/esm-loader/semver.utils.mjs +3 -5
- package/browser/esm-loader/version-poller.mjs +1 -1
- package/browser/esm-loader/version-resolver.mjs +5 -1
- package/browser/ext-apps/ext-apps.handler.mjs +6 -1
- package/browser/flows/flow.http-path.mjs +5 -1
- package/browser/flows/flow.instance.mjs +42 -9
- package/browser/front-mcp/front-mcp.mjs +19 -2
- package/browser/front-mcp/session-secret.check.mjs +22 -0
- package/browser/http-route/http-route.table.mjs +23 -3
- package/browser/index.cjs +30225 -27807
- package/browser/index.mjs +8 -4
- package/browser/job/execution/job-execution.manager.mjs +20 -17
- package/browser/job/flows/execute-job.flow.mjs +5 -3
- package/browser/job/index.mjs +2 -2
- package/browser/job/job-attempt.mjs +15 -10
- package/browser/job/job-context-providers.mjs +2 -1
- package/browser/job/job-scope.helper.mjs +76 -4
- package/browser/job/job.registry.mjs +30 -0
- package/browser/job/tools/index.mjs +3 -1
- package/browser/job/tools/list-jobs.tool.mjs +7 -5
- package/browser/job/tools/update-job.tool.mjs +75 -0
- package/browser/logger/instances/instance.logger.mjs +31 -6
- package/browser/notification/notification.service.mjs +26 -5
- package/browser/prompt/flows/get-prompt.flow.mjs +3 -3
- package/browser/prompt/flows/prompts-list.flow.mjs +11 -4
- package/browser/provider/provider.registry.mjs +1 -1
- package/browser/remote-mcp/factories/instance-factories.mjs +4 -4
- package/browser/remote-mcp/factories/record-builders.mjs +5 -0
- package/browser/remote-mcp/mcp-client.service.mjs +113 -68
- package/browser/remote-mcp/mcp-stateless-client.adapter.mjs +2 -2
- package/browser/remote-mcp/remote-entries.mjs +2 -1
- package/browser/remote-mcp/remote-oauth.mjs +102 -0
- package/browser/remote-mcp/remote-request-headers.mjs +42 -12
- package/browser/remote-mcp/resilience/circuit-breaker.mjs +3 -2
- package/browser/resource/flows/read-resource.flow.mjs +6 -4
- package/browser/resource/flows/resource-templates-list.flow.mjs +24 -9
- package/browser/resource/flows/resources-list.flow.mjs +11 -4
- package/browser/scope/flows/http.request.flow.mjs +1 -1
- package/browser/scope/observability-scope.helper.mjs +6 -1
- package/browser/scope/scope.instance.mjs +284 -81
- package/browser/skill/errors/tool-not-allowed.error.mjs +2 -2
- package/browser/skill/flows/filter-skills.flow.mjs +1 -1
- package/browser/skill/flows/load-skill.flow.mjs +27 -15
- package/browser/skill/guards/tool-authorization.guard.mjs +1 -1
- package/browser/skill/hooks/skill-tool.hook.mjs +32 -24
- package/browser/skill/providers/external-skill.provider.mjs +4 -2
- package/browser/skill/session/skill-session-store.interface.mjs +10 -0
- package/browser/skill/session/skill-session.manager.mjs +8 -0
- package/browser/skill/skill-authorities.helper.mjs +9 -3
- package/browser/skill/skill-scope.helper.mjs +7 -2
- package/browser/skill/skill.registry.mjs +21 -2
- package/browser/subsystems.mjs +6 -2
- package/browser/surface/entry-authorized.mjs +15 -0
- package/browser/tool/flows/call-tool.flow.mjs +59 -13
- package/browser/tool/flows/tools-list.flow.mjs +11 -4
- package/browser/tool/tool.utils.mjs +46 -61
- package/browser/tool/ui/serving-mode-default.mjs +11 -2
- package/browser/tool/ui/template-detection.mjs +1 -1
- package/browser/tool/ui/ui-option-warnings.mjs +1 -28
- package/browser/tool/ui/ui-render.mjs +6 -0
- package/browser/tool/ui/ui-resource.handler.mjs +50 -6
- package/browser/tool/ui/ui-shared.mjs +61 -7
- package/browser/tool/ui/widget-routes.mjs +73 -0
- package/browser/tool/ui/widget-serving.mjs +112 -0
- package/browser/transport/flows/handle.mcp-20260728.flow.mjs +1 -1
- package/browser/transport/flows/handle.stateless-http.flow.mjs +1 -2
- package/browser/transport/mcp-20260728/client/index.mjs +1 -1
- package/browser/transport/mcp-20260728/client/mcp-stateless.client.mjs +2 -1
- package/browser/transport/mcp-20260728/index.mjs +1 -1
- package/browser/transport/web-fetch-handler.mjs +5 -1
- package/browser/utils/abort.utils.mjs +7 -2
- package/browser/utils/content.utils.mjs +1 -1
- package/browser/workflow/engine/workflow-step.executor.mjs +1 -1
- package/browser/workflow/engine/workflow.engine.mjs +13 -10
- package/browser/workflow/index.mjs +2 -2
- package/browser/workflow/tools/execute-workflow.tool.mjs +1 -1
- package/browser/workflow/tools/index.mjs +3 -1
- package/browser/workflow/tools/list-workflows.tool.mjs +4 -2
- package/browser/workflow/tools/register-workflow.tool.mjs +11 -2
- package/browser/workflow/tools/update-workflow.tool.mjs +80 -0
- package/browser/workflow/trigger/workflow-events.mjs +39 -0
- package/browser/workflow/trigger/workflow-triggers.mjs +80 -0
- package/browser/workflow/trigger/workflow-webhook.routes.mjs +104 -0
- package/browser/workflow/trigger/workflow-webhook.signature.mjs +59 -0
- package/browser/workflow/workflow.registry.mjs +27 -0
- package/browser/workflow/workflow.utils.mjs +13 -2
- package/builtin/authorities/authorities.plugin.d.ts +1 -1
- package/builtin/authorities/authorities.plugin.d.ts.map +1 -1
- package/builtin/authorities/authorities.plugin.options.d.ts +1 -1
- package/builtin/authorities/authorities.plugin.options.d.ts.map +1 -1
- package/builtin/config/config-resolver.d.ts.map +1 -1
- package/channel/channel-scope.helper.d.ts +2 -0
- package/channel/channel-scope.helper.d.ts.map +1 -1
- package/channel/channel.types.d.ts +1 -1
- package/channel/channel.types.d.ts.map +1 -1
- package/channel/sources/agent-completion.source.d.ts +1 -1
- package/channel/sources/agent-completion.source.d.ts.map +1 -1
- package/common/decorators/app.decorator.d.ts +1 -1
- package/common/decorators/app.decorator.d.ts.map +1 -1
- package/common/entries/provider.entry.d.ts +2 -2
- package/common/entries/provider.entry.d.ts.map +1 -1
- package/common/entries/scope.entry.d.ts +25 -3
- package/common/entries/scope.entry.d.ts.map +1 -1
- package/common/entries/tool.entry.d.ts +5 -3
- package/common/entries/tool.entry.d.ts.map +1 -1
- package/common/interfaces/agent.interface.d.ts +4 -2
- package/common/interfaces/agent.interface.d.ts.map +1 -1
- package/common/interfaces/llm-adapter.interface.d.ts +5 -0
- package/common/interfaces/llm-adapter.interface.d.ts.map +1 -1
- package/common/interfaces/logger.interface.d.ts +2 -1
- package/common/interfaces/logger.interface.d.ts.map +1 -1
- package/common/interfaces/tool.interface.d.ts +12 -2
- package/common/interfaces/tool.interface.d.ts.map +1 -1
- package/common/metadata/agent.metadata.d.ts +7 -2
- package/common/metadata/agent.metadata.d.ts.map +1 -1
- package/common/metadata/app.metadata.d.ts +35 -11
- package/common/metadata/app.metadata.d.ts.map +1 -1
- package/common/metadata/flow.metadata.d.ts +14 -0
- package/common/metadata/flow.metadata.d.ts.map +1 -1
- package/common/metadata/front-mcp.metadata.d.ts +2 -1
- package/common/metadata/front-mcp.metadata.d.ts.map +1 -1
- package/common/metadata/job.metadata.d.ts +11 -0
- package/common/metadata/job.metadata.d.ts.map +1 -1
- package/common/metadata/output-policy.d.ts +2 -0
- package/common/metadata/output-policy.d.ts.map +1 -1
- package/common/metadata/remote-primitive.metadata.d.ts +6 -3
- package/common/metadata/remote-primitive.metadata.d.ts.map +1 -1
- package/common/metadata/resource.metadata.d.ts +1 -1
- package/common/metadata/workflow.metadata.d.ts +50 -14
- package/common/metadata/workflow.metadata.d.ts.map +1 -1
- package/common/tokens/workflow.tokens.d.ts +1 -0
- package/common/tokens/workflow.tokens.d.ts.map +1 -1
- package/common/types/options/logging/interfaces.d.ts +3 -1
- package/common/types/options/logging/interfaces.d.ts.map +1 -1
- package/common/types/options/observability/interfaces.d.ts +4 -2
- package/common/types/options/observability/interfaces.d.ts.map +1 -1
- package/common/types/options/transport/interfaces.d.ts +3 -0
- package/common/types/options/transport/interfaces.d.ts.map +1 -1
- package/common/types/options/transport/schema.d.ts.map +1 -1
- package/common/utils/auth-info.utils.d.ts +1 -0
- package/common/utils/auth-info.utils.d.ts.map +1 -1
- package/common/utils/global-config.utils.d.ts.map +1 -1
- package/common/utils/principal.utils.d.ts +24 -0
- package/common/utils/principal.utils.d.ts.map +1 -1
- package/context/frontmcp-context-storage.d.ts +3 -1
- package/context/frontmcp-context-storage.d.ts.map +1 -1
- package/context/frontmcp-context.d.ts +9 -1
- package/context/frontmcp-context.d.ts.map +1 -1
- package/elicitation/helpers/checked-elicit-answer.d.ts +10 -0
- package/elicitation/helpers/checked-elicit-answer.d.ts.map +1 -0
- package/elicitation/helpers/elicit.helper.d.ts.map +1 -1
- package/elicitation/store/elicitation-encryption.d.ts.map +1 -1
- package/elicitation/store/encrypted-elicitation.store.d.ts +2 -2
- package/elicitation/store/encrypted-elicitation.store.d.ts.map +1 -1
- package/elicitation/store/storage-elicitation.store.d.ts +3 -3
- package/elicitation/store/storage-elicitation.store.d.ts.map +1 -1
- package/errors/auth-internal.errors.d.ts +1 -1
- package/errors/auth-internal.errors.d.ts.map +1 -1
- package/errors/error-handler.d.ts.map +1 -1
- package/errors/index.d.ts +3 -2
- package/errors/index.d.ts.map +1 -1
- package/errors/mcp.error.d.ts +6 -1
- package/errors/mcp.error.d.ts.map +1 -1
- package/errors/misconfiguration.d.ts.map +1 -1
- package/errors/remote.errors.d.ts +1 -1
- package/errors/remote.errors.d.ts.map +1 -1
- package/errors/tool-ui.errors.d.ts +13 -0
- package/errors/tool-ui.errors.d.ts.map +1 -0
- package/errors/workflow.errors.d.ts +4 -0
- package/errors/workflow.errors.d.ts.map +1 -1
- package/esm/index.mjs +46 -45
- package/esm/job/tools/index.mjs +3 -2
- package/esm/workflow/tools/index.mjs +3 -2
- package/esm-loader/app-helpers.d.ts +4 -4
- package/esm-loader/app-helpers.d.ts.map +1 -1
- package/esm-loader/esm-entries.d.ts +11 -1
- package/esm-loader/esm-entries.d.ts.map +1 -1
- package/esm-loader/esm-manifest.d.ts +11 -8
- package/esm-loader/esm-manifest.d.ts.map +1 -1
- package/esm-loader/esm-module-loader.d.ts +6 -1
- package/esm-loader/esm-module-loader.d.ts.map +1 -1
- package/esm-loader/factories/esm-context-factories.d.ts +6 -3
- package/esm-loader/factories/esm-context-factories.d.ts.map +1 -1
- package/esm-loader/factories/esm-instance-factories.d.ts +3 -3
- package/esm-loader/factories/esm-instance-factories.d.ts.map +1 -1
- package/esm-loader/factories/esm-record-builders.d.ts.map +1 -1
- package/esm-loader/semver.utils.d.ts +8 -0
- package/esm-loader/semver.utils.d.ts.map +1 -1
- package/esm-loader/version-resolver.d.ts.map +1 -1
- package/ext-apps/ext-apps.handler.d.ts +2 -1
- package/ext-apps/ext-apps.handler.d.ts.map +1 -1
- package/flows/flow.http-path.d.ts +8 -0
- package/flows/flow.http-path.d.ts.map +1 -1
- package/flows/flow.instance.d.ts +9 -0
- package/flows/flow.instance.d.ts.map +1 -1
- package/front-mcp/front-mcp.d.ts +2 -0
- package/front-mcp/front-mcp.d.ts.map +1 -1
- package/front-mcp/session-secret.check.d.ts +19 -0
- package/front-mcp/session-secret.check.d.ts.map +1 -0
- package/http-route/http-route.table.d.ts.map +1 -1
- package/index.d.ts +4 -4
- package/index.d.ts.map +1 -1
- package/index.js +53 -52
- package/job/execution/job-execution.manager.d.ts +8 -3
- package/job/execution/job-execution.manager.d.ts.map +1 -1
- package/job/flows/execute-job.flow.d.ts +1 -0
- package/job/flows/execute-job.flow.d.ts.map +1 -1
- package/job/job-attempt.d.ts +7 -2
- package/job/job-attempt.d.ts.map +1 -1
- package/job/job-context-providers.d.ts +2 -2
- package/job/job-context-providers.d.ts.map +1 -1
- package/job/job-scope.helper.d.ts +26 -0
- package/job/job-scope.helper.d.ts.map +1 -1
- package/job/job.registry.d.ts +11 -0
- package/job/job.registry.d.ts.map +1 -1
- package/job/tools/index.d.ts +1 -0
- package/job/tools/index.d.ts.map +1 -1
- package/job/tools/index.js +4 -2
- package/job/tools/list-jobs.tool.d.ts +3 -3
- package/job/tools/list-jobs.tool.d.ts.map +1 -1
- package/job/tools/update-job.tool.d.ts +16 -0
- package/job/tools/update-job.tool.d.ts.map +1 -0
- package/logger/instances/instance.logger.d.ts +1 -0
- package/logger/instances/instance.logger.d.ts.map +1 -1
- package/notification/notification.service.d.ts +10 -3
- package/notification/notification.service.d.ts.map +1 -1
- package/package.json +10 -10
- package/prompt/flows/prompts-list.flow.d.ts.map +1 -1
- package/provider/provider.registry.d.ts.map +1 -1
- package/remote-mcp/factories/instance-factories.d.ts +4 -4
- package/remote-mcp/factories/instance-factories.d.ts.map +1 -1
- package/remote-mcp/factories/record-builders.d.ts.map +1 -1
- package/remote-mcp/mcp-client.service.d.ts +11 -0
- package/remote-mcp/mcp-client.service.d.ts.map +1 -1
- package/remote-mcp/mcp-client.types.d.ts +15 -2
- package/remote-mcp/mcp-client.types.d.ts.map +1 -1
- package/remote-mcp/mcp-stateless-client.adapter.d.ts +1 -1
- package/remote-mcp/mcp-stateless-client.adapter.d.ts.map +1 -1
- package/remote-mcp/remote-entries.d.ts +2 -1
- package/remote-mcp/remote-entries.d.ts.map +1 -1
- package/remote-mcp/remote-oauth.d.ts +27 -0
- package/remote-mcp/remote-oauth.d.ts.map +1 -0
- package/remote-mcp/remote-request-headers.d.ts +8 -2
- package/remote-mcp/remote-request-headers.d.ts.map +1 -1
- package/remote-mcp/resilience/circuit-breaker.d.ts +3 -2
- package/remote-mcp/resilience/circuit-breaker.d.ts.map +1 -1
- package/resource/flows/read-resource.flow.d.ts.map +1 -1
- package/resource/flows/resource-templates-list.flow.d.ts.map +1 -1
- package/resource/flows/resources-list.flow.d.ts.map +1 -1
- package/scope/observability-scope.helper.d.ts.map +1 -1
- package/scope/scope.instance.d.ts +35 -1
- package/scope/scope.instance.d.ts.map +1 -1
- package/skill/errors/tool-not-allowed.error.d.ts.map +1 -1
- package/skill/flows/load-skill.flow.d.ts.map +1 -1
- package/skill/guards/tool-authorization.guard.d.ts +1 -1
- package/skill/guards/tool-authorization.guard.d.ts.map +1 -1
- package/skill/hooks/skill-tool.hook.d.ts +2 -0
- package/skill/hooks/skill-tool.hook.d.ts.map +1 -1
- package/skill/providers/external-skill.provider.d.ts +2 -2
- package/skill/providers/external-skill.provider.d.ts.map +1 -1
- package/skill/session/skill-session-store.interface.d.ts +5 -0
- package/skill/session/skill-session-store.interface.d.ts.map +1 -1
- package/skill/session/skill-session.manager.d.ts +4 -0
- package/skill/session/skill-session.manager.d.ts.map +1 -1
- package/skill/session/skill-session.types.d.ts +1 -1
- package/skill/skill-authorities.helper.d.ts +6 -3
- package/skill/skill-authorities.helper.d.ts.map +1 -1
- package/skill/skill-scope.helper.d.ts +5 -0
- package/skill/skill-scope.helper.d.ts.map +1 -1
- package/skill/skill.registry.d.ts +7 -0
- package/skill/skill.registry.d.ts.map +1 -1
- package/subsystems.d.ts +2 -2
- package/subsystems.d.ts.map +1 -1
- package/surface/entry-authorized.d.ts +5 -0
- package/surface/entry-authorized.d.ts.map +1 -0
- package/tool/flows/call-tool.flow.d.ts +6 -0
- package/tool/flows/call-tool.flow.d.ts.map +1 -1
- package/tool/flows/tools-list.flow.d.ts +1 -1
- package/tool/flows/tools-list.flow.d.ts.map +1 -1
- package/tool/tool.utils.d.ts.map +1 -1
- package/tool/ui/serving-mode-default.d.ts +6 -2
- package/tool/ui/serving-mode-default.d.ts.map +1 -1
- package/tool/ui/ui-option-warnings.d.ts.map +1 -1
- package/tool/ui/ui-render.d.ts +2 -2
- package/tool/ui/ui-render.d.ts.map +1 -1
- package/tool/ui/ui-resource.handler.d.ts +10 -2
- package/tool/ui/ui-resource.handler.d.ts.map +1 -1
- package/tool/ui/ui-shared.d.ts +31 -5
- package/tool/ui/ui-shared.d.ts.map +1 -1
- package/tool/ui/widget-routes.d.ts +38 -0
- package/tool/ui/widget-routes.d.ts.map +1 -0
- package/tool/ui/widget-serving.d.ts +37 -0
- package/tool/ui/widget-serving.d.ts.map +1 -0
- package/transport/mcp-20260728/client/mcp-stateless.client.d.ts +2 -0
- package/transport/mcp-20260728/client/mcp-stateless.client.d.ts.map +1 -1
- package/transport/web-fetch-handler.d.ts.map +1 -1
- package/utils/abort.utils.d.ts +5 -0
- package/utils/abort.utils.d.ts.map +1 -1
- package/workflow/engine/workflow.engine.d.ts +8 -1
- package/workflow/engine/workflow.engine.d.ts.map +1 -1
- package/workflow/tools/execute-workflow.tool.d.ts.map +1 -1
- package/workflow/tools/index.d.ts +1 -0
- package/workflow/tools/index.d.ts.map +1 -1
- package/workflow/tools/index.js +4 -2
- package/workflow/tools/list-workflows.tool.d.ts.map +1 -1
- package/workflow/tools/register-workflow.tool.d.ts.map +1 -1
- package/workflow/tools/update-workflow.tool.d.ts +21 -0
- package/workflow/tools/update-workflow.tool.d.ts.map +1 -0
- package/workflow/trigger/workflow-events.d.ts +22 -0
- package/workflow/trigger/workflow-events.d.ts.map +1 -0
- package/workflow/trigger/workflow-triggers.d.ts +34 -0
- package/workflow/trigger/workflow-triggers.d.ts.map +1 -0
- package/workflow/trigger/workflow-webhook.routes.d.ts +16 -0
- package/workflow/trigger/workflow-webhook.routes.d.ts.map +1 -0
- package/workflow/trigger/workflow-webhook.signature.d.ts +41 -0
- package/workflow/trigger/workflow-webhook.signature.d.ts.map +1 -0
- package/workflow/workflow.registry.d.ts +11 -0
- package/workflow/workflow.registry.d.ts.map +1 -1
- package/workflow/workflow.utils.d.ts +7 -0
- package/workflow/workflow.utils.d.ts.map +1 -1
|
@@ -22,6 +22,8 @@ import {
|
|
|
22
22
|
isRedisTokenStorage,
|
|
23
23
|
isSqliteTokenStorage,
|
|
24
24
|
JwksService,
|
|
25
|
+
LocalTokenKeys,
|
|
26
|
+
resolveUpstreamClient,
|
|
25
27
|
SessionCredentialVault,
|
|
26
28
|
StorageAuthorizationStore,
|
|
27
29
|
StorageConsentStore,
|
|
@@ -165,6 +167,12 @@ var LocalPrimaryAuth = class extends FrontMcpAuth {
|
|
|
165
167
|
}
|
|
166
168
|
this.secret = getDefaultNoAuthSecret();
|
|
167
169
|
}
|
|
170
|
+
this.tokenKeys = LocalTokenKeys.fromConfig(
|
|
171
|
+
this.signingConfig(options),
|
|
172
|
+
this.secret,
|
|
173
|
+
isPublicMode(options) ? "auth" : "auth.local"
|
|
174
|
+
);
|
|
175
|
+
this.jwks.setPublicJwks(this.tokenKeys.publicJwks);
|
|
168
176
|
this.tokenStorage = this.readTokenStorage(options);
|
|
169
177
|
this.authorizationStoreImpl = new InMemoryAuthorizationStore();
|
|
170
178
|
this.federatedSessionStoreImpl = new InMemoryFederatedAuthSessionStore();
|
|
@@ -194,6 +202,8 @@ var LocalPrimaryAuth = class extends FrontMcpAuth {
|
|
|
194
202
|
secret;
|
|
195
203
|
logger;
|
|
196
204
|
jwks = new JwksService();
|
|
205
|
+
/** The keys this server signs and verifies its own tokens with: `signKey`, else HS256 with {@link secret}. */
|
|
206
|
+
tokenKeys;
|
|
197
207
|
cimdService;
|
|
198
208
|
/**
|
|
199
209
|
* Token storage backend selected from `options.tokenStorage`.
|
|
@@ -344,6 +354,11 @@ var LocalPrimaryAuth = class extends FrontMcpAuth {
|
|
|
344
354
|
deriveIssuer(options) {
|
|
345
355
|
return this.configuredIssuer(options) ?? `http://${this.host}:${this.port}${this.scope.fullPath}`;
|
|
346
356
|
}
|
|
357
|
+
/** The `signKey` and `jwks`: top-level in public mode, under `local` in local and remote mode. */
|
|
358
|
+
signingConfig(options) {
|
|
359
|
+
if (isPublicMode(options)) return { signKey: options.signKey, jwks: options.jwks };
|
|
360
|
+
return isOrchestratedMode(options) ? options.local ?? {} : {};
|
|
361
|
+
}
|
|
347
362
|
/**
|
|
348
363
|
* The issuer the options name: `issuer` in public mode, `local.issuer` in local and remote mode,
|
|
349
364
|
* without a trailing slash, since the callback and metadata URLs are built by appending paths to it.
|
|
@@ -480,7 +495,15 @@ var LocalPrimaryAuth = class extends FrontMcpAuth {
|
|
|
480
495
|
* @returns true when this caller claimed the ticket, false when it was already used.
|
|
481
496
|
*/
|
|
482
497
|
async claimIncrementalTicket(jti, ttlMs) {
|
|
483
|
-
|
|
498
|
+
return this.claimOnce(`incremental-ticket:${jti}`, ttlMs);
|
|
499
|
+
}
|
|
500
|
+
/**
|
|
501
|
+
* Claim `key` for `ttlMs`, exactly once: the replay guard of incremental-authorization tickets and of
|
|
502
|
+
* `private_key_jwt` client assertions. See {@link claimIncrementalTicket}.
|
|
503
|
+
*
|
|
504
|
+
* @returns true when this caller claimed the key, false when it was already claimed or the guard is unavailable.
|
|
505
|
+
*/
|
|
506
|
+
async claimOnce(key, ttlMs) {
|
|
484
507
|
const nonce = randomUUID();
|
|
485
508
|
const ttlSeconds = Math.max(1, Math.ceil(ttlMs / 1e3));
|
|
486
509
|
let storage = await this.getTicketReplayStorage();
|
|
@@ -488,24 +511,24 @@ var LocalPrimaryAuth = class extends FrontMcpAuth {
|
|
|
488
511
|
await storage.set(key, nonce, { ifNotExists: true, ttlSeconds });
|
|
489
512
|
} catch (error) {
|
|
490
513
|
if (!isUnsupportedOperation(error)) {
|
|
491
|
-
this.logger.warn(`
|
|
514
|
+
this.logger.warn(`Replay guard unavailable: ${String(error)}`);
|
|
492
515
|
return false;
|
|
493
516
|
}
|
|
494
517
|
this.logger.warn(
|
|
495
|
-
"
|
|
518
|
+
"Replay guard: the configured storage has no conditional write; falling back to an in-memory guard (single use holds within this instance only)."
|
|
496
519
|
);
|
|
497
520
|
storage = await this.useInMemoryTicketReplayStorage();
|
|
498
521
|
try {
|
|
499
522
|
await storage.set(key, nonce, { ifNotExists: true, ttlSeconds });
|
|
500
523
|
} catch (fallbackError) {
|
|
501
|
-
this.logger.warn(`
|
|
524
|
+
this.logger.warn(`Replay guard unavailable: ${String(fallbackError)}`);
|
|
502
525
|
return false;
|
|
503
526
|
}
|
|
504
527
|
}
|
|
505
528
|
try {
|
|
506
529
|
return await storage.get(key) === nonce;
|
|
507
530
|
} catch (error) {
|
|
508
|
-
this.logger.warn(`
|
|
531
|
+
this.logger.warn(`Replay guard unavailable: ${String(error)}`);
|
|
509
532
|
return false;
|
|
510
533
|
}
|
|
511
534
|
}
|
|
@@ -515,7 +538,7 @@ var LocalPrimaryAuth = class extends FrontMcpAuth {
|
|
|
515
538
|
this.ticketReplayStorage = Promise.resolve(this.storageAdapter);
|
|
516
539
|
} else {
|
|
517
540
|
this.logger.debug(
|
|
518
|
-
"
|
|
541
|
+
"Replay guard is in-memory (no persistent tokenStorage configured); single use holds within this instance only."
|
|
519
542
|
);
|
|
520
543
|
this.ticketReplayStorage = this.useInMemoryTicketReplayStorage();
|
|
521
544
|
}
|
|
@@ -656,9 +679,9 @@ var LocalPrimaryAuth = class extends FrontMcpAuth {
|
|
|
656
679
|
*/
|
|
657
680
|
async signAnonymousJwt(options = {}) {
|
|
658
681
|
const { SignJWT } = await loadJose();
|
|
659
|
-
const jwt = new SignJWT({ sub: `anon:${randomUUID()}`, anonymous: true, scope: this.anonymousScopes().join(" ") }).setProtectedHeader(
|
|
682
|
+
const jwt = new SignJWT({ sub: `anon:${randomUUID()}`, anonymous: true, scope: this.anonymousScopes().join(" ") }).setProtectedHeader(this.tokenKeys.protectedHeader()).setIssuedAt().setIssuer(options.issuer ?? this.issuer).setExpirationTime(`${this.anonymousTokenTtlSeconds()}s`).setJti(randomUUID());
|
|
660
683
|
if (options.audience) jwt.setAudience(options.audience);
|
|
661
|
-
return jwt.sign(this.
|
|
684
|
+
return jwt.sign(await this.tokenKeys.signingKey());
|
|
662
685
|
}
|
|
663
686
|
/** How long an anonymous token lives: public mode's `sessionTtl` (default an hour), a day otherwise. */
|
|
664
687
|
anonymousTokenTtlSeconds() {
|
|
@@ -673,10 +696,11 @@ var LocalPrimaryAuth = class extends FrontMcpAuth {
|
|
|
673
696
|
* Cryptographically verify a gateway-issued access token (public/local/remote
|
|
674
697
|
* "gateway" modes). Gateway tokens \u2014 both authenticated access tokens
|
|
675
698
|
* ({@link signAccessToken}) and anonymous tokens ({@link signAnonymousJwt}) \u2014
|
|
676
|
-
* are
|
|
699
|
+
* are signed with {@link tokenKeys}: the configured `signKey`, else HS256 with
|
|
700
|
+
* `this.secret`.
|
|
677
701
|
*
|
|
678
|
-
* The
|
|
679
|
-
* with the same JWT_SECRET holds it. So a token must also (#269):
|
|
702
|
+
* The key alone doesn't make a token this server's: every server started
|
|
703
|
+
* with the same JWT_SECRET or `signKey` holds it. So a token must also (#269):
|
|
680
704
|
* - name THIS instance as its issuer (`iss`): `expectedIssuer` (one issuer or
|
|
681
705
|
* several), which callers take from {@link acceptedIssuersFor} the request,
|
|
682
706
|
* matching what the token endpoint names when it signs ({@link issuerFor});
|
|
@@ -687,13 +711,11 @@ var LocalPrimaryAuth = class extends FrontMcpAuth {
|
|
|
687
711
|
* `auth.expectedAudience` when there is one.
|
|
688
712
|
*
|
|
689
713
|
* Lifetime: `exp` is required (#272) and checked with `nbf` by `jose`. The
|
|
690
|
-
*
|
|
714
|
+
* algorithms are pinned to the ones the keys sign with, to block `alg` confusion.
|
|
691
715
|
*/
|
|
692
716
|
async verifyGatewayToken(token, requestBaseUrl, expectedAudience, expectedIssuer) {
|
|
693
717
|
try {
|
|
694
|
-
const {
|
|
695
|
-
const { payload, protectedHeader } = await jwtVerify(token, this.secret, {
|
|
696
|
-
algorithms: ["HS256"],
|
|
718
|
+
const { payload, protectedHeader } = await this.tokenKeys.verify(token, {
|
|
697
719
|
issuer: typeof expectedIssuer === "string" ? expectedIssuer : expectedIssuer ? [...expectedIssuer] : this.issuer,
|
|
698
720
|
requiredClaims: ["exp"]
|
|
699
721
|
});
|
|
@@ -752,20 +774,22 @@ var LocalPrimaryAuth = class extends FrontMcpAuth {
|
|
|
752
774
|
}
|
|
753
775
|
}
|
|
754
776
|
const { SignJWT } = await loadJose();
|
|
755
|
-
const jwt = new SignJWT(claims).setProtectedHeader(
|
|
777
|
+
const jwt = new SignJWT(claims).setProtectedHeader(this.tokenKeys.protectedHeader()).setIssuedAt().setIssuer(issuer ?? this.issuer).setExpirationTime(`${this.accessTokenTtlSeconds}s`).setJti(randomUUID());
|
|
756
778
|
if (audience) {
|
|
757
779
|
jwt.setAudience(audience);
|
|
758
780
|
}
|
|
759
|
-
return jwt.sign(this.
|
|
781
|
+
return jwt.sign(await this.tokenKeys.signingKey());
|
|
760
782
|
}
|
|
761
783
|
/**
|
|
762
784
|
* Exchange an authorization code for tokens
|
|
763
785
|
*/
|
|
764
|
-
async exchangeCode(code, clientId, redirectUri, codeVerifier, clientSecret, defaultAudience, issuer) {
|
|
786
|
+
async exchangeCode(code, clientId, redirectUri, codeVerifier, clientSecret, defaultAudience, issuer, clientAssertion) {
|
|
765
787
|
if (this.dcrClientRegistryImpl.verifyClientSecret(clientId, clientSecret) === "invalid") {
|
|
766
788
|
this.logger.warn("Client authentication failed at token endpoint (authorization_code)");
|
|
767
789
|
return { error: "invalid_client", error_description: "Client authentication failed" };
|
|
768
790
|
}
|
|
791
|
+
const declared = await this.checkDeclaredGrant(clientId, "authorization_code", clientAssertion);
|
|
792
|
+
if ("error" in declared) return declared;
|
|
769
793
|
const codeRecord = await this.authorizationStore.getAuthorizationCode(code);
|
|
770
794
|
if (!codeRecord) {
|
|
771
795
|
this.logger.warn(`Authorization code not found or expired: ${code.substring(0, 8)}...`);
|
|
@@ -833,6 +857,14 @@ var LocalPrimaryAuth = class extends FrontMcpAuth {
|
|
|
833
857
|
if (codeRecord.pendingAuthId && codeRecord.federatedLoginUsed) {
|
|
834
858
|
providerTokensId = await this.moveProviderTokens(`pending:${codeRecord.pendingAuthId}`, accessToken);
|
|
835
859
|
}
|
|
860
|
+
this.logger.info(`Tokens issued for user: ${user.sub}`);
|
|
861
|
+
const tokens = {
|
|
862
|
+
access_token: accessToken,
|
|
863
|
+
token_type: "Bearer",
|
|
864
|
+
expires_in: this.accessTokenTtlSeconds,
|
|
865
|
+
scope: codeRecord.scopes.join(" ")
|
|
866
|
+
};
|
|
867
|
+
if (declared.grantTypes && !declared.grantTypes.includes("refresh_token")) return tokens;
|
|
836
868
|
const refreshTokenRecord = this.authorizationStore.createRefreshTokenRecord({
|
|
837
869
|
clientId,
|
|
838
870
|
userSub: user.sub,
|
|
@@ -851,14 +883,41 @@ var LocalPrimaryAuth = class extends FrontMcpAuth {
|
|
|
851
883
|
});
|
|
852
884
|
await this.authorizationStore.storeRefreshToken(refreshTokenRecord);
|
|
853
885
|
await this.authorizationStore.markCodeUsed(code, refreshTokenRecord.token);
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
886
|
+
return { ...tokens, refresh_token: refreshTokenRecord.token };
|
|
887
|
+
}
|
|
888
|
+
/**
|
|
889
|
+
* Refuse a grant the client did not declare in its `grant_types` (RFC 7591): in its registration, its
|
|
890
|
+
* `dcr.clients` entry or its client ID metadata document. A client that declared nothing (an unregistered
|
|
891
|
+
* id under `requireRegisteredClients: false`) is not limited, and gets `grantTypes: undefined`. A CIMD client
|
|
892
|
+
* whose document declares `private_key_jwt` must also present a valid client assertion.
|
|
893
|
+
*/
|
|
894
|
+
async checkDeclaredGrant(clientId, grantType, clientAssertion) {
|
|
895
|
+
let grantTypes;
|
|
896
|
+
try {
|
|
897
|
+
const cimd = this.cimdService;
|
|
898
|
+
if (cimd?.enabled && cimd.isCimdClientId(clientId)) {
|
|
899
|
+
const { metadata } = await cimd.resolveClientMetadata(clientId);
|
|
900
|
+
if (metadata) cimd.assertSupportedClient(metadata);
|
|
901
|
+
if (metadata?.token_endpoint_auth_method === "private_key_jwt") {
|
|
902
|
+
await cimd.verifyClientAssertion(metadata, {
|
|
903
|
+
audiences: [],
|
|
904
|
+
...clientAssertion,
|
|
905
|
+
claimOnce: (key, ttlMs) => this.claimOnce(key, ttlMs)
|
|
906
|
+
});
|
|
907
|
+
}
|
|
908
|
+
grantTypes = metadata?.grant_types;
|
|
909
|
+
} else {
|
|
910
|
+
grantTypes = this.dcrClientRegistryImpl.get(clientId)?.grant_types;
|
|
911
|
+
}
|
|
912
|
+
} catch (err) {
|
|
913
|
+
this.logger.warn(`Client metadata refused at token endpoint (${grantType}): ${err.message}`);
|
|
914
|
+
return { error: "invalid_client", error_description: "Client authentication failed" };
|
|
915
|
+
}
|
|
916
|
+
if (grantTypes && !grantTypes.includes(grantType)) {
|
|
917
|
+
this.logger.warn(`Client did not declare the ${grantType} grant`);
|
|
918
|
+
return { error: "unauthorized_client", error_description: `This client may not use the ${grantType} grant` };
|
|
919
|
+
}
|
|
920
|
+
return { grantTypes };
|
|
862
921
|
}
|
|
863
922
|
/**
|
|
864
923
|
* Move the upstream provider tokens stored under `fromAuthorizationId` to the authorization id of
|
|
@@ -908,11 +967,13 @@ var LocalPrimaryAuth = class extends FrontMcpAuth {
|
|
|
908
967
|
/**
|
|
909
968
|
* Refresh an access token using a refresh token
|
|
910
969
|
*/
|
|
911
|
-
async refreshAccessToken(refreshToken, clientId, clientSecret, defaultAudience, issuer) {
|
|
970
|
+
async refreshAccessToken(refreshToken, clientId, clientSecret, defaultAudience, issuer, clientAssertion) {
|
|
912
971
|
if (this.dcrClientRegistryImpl.verifyClientSecret(clientId, clientSecret) === "invalid") {
|
|
913
972
|
this.logger.warn("Client authentication failed at token endpoint (refresh_token)");
|
|
914
973
|
return { error: "invalid_client", error_description: "Client authentication failed" };
|
|
915
974
|
}
|
|
975
|
+
const declared = await this.checkDeclaredGrant(clientId, "refresh_token", clientAssertion);
|
|
976
|
+
if ("error" in declared) return declared;
|
|
916
977
|
const tokenRecord = await this.authorizationStore.getRefreshToken(refreshToken);
|
|
917
978
|
if (!tokenRecord) {
|
|
918
979
|
this.logger.warn("Refresh token not found or expired");
|
|
@@ -1023,9 +1084,10 @@ var LocalPrimaryAuth = class extends FrontMcpAuth {
|
|
|
1023
1084
|
return codeRecord.code;
|
|
1024
1085
|
}
|
|
1025
1086
|
async initialize() {
|
|
1087
|
+
await this.tokenKeys.signingKey();
|
|
1026
1088
|
await this.initializeStores();
|
|
1027
1089
|
this.registerConfiguredProviders();
|
|
1028
|
-
this.registerRemoteProvider();
|
|
1090
|
+
await this.registerRemoteProvider();
|
|
1029
1091
|
await this.initializeCredentialVault();
|
|
1030
1092
|
await this.initializeSecureStore();
|
|
1031
1093
|
this.providers.injectProvider({
|
|
@@ -1168,12 +1230,15 @@ var LocalPrimaryAuth = class extends FrontMcpAuth {
|
|
|
1168
1230
|
* discovery. The provider id comes from `providerConfig.id` when set, else it
|
|
1169
1231
|
* is derived from the provider hostname (mirroring `deriveProviderId`).
|
|
1170
1232
|
*
|
|
1233
|
+
* Without a `clientId`, `providerConfig.dcrEnabled` registers this server with
|
|
1234
|
+
* the provider (RFC 7591) and uses that client; a failed registration fails startup.
|
|
1235
|
+
*
|
|
1171
1236
|
* No-op outside remote mode, so local/public/transparent are unaffected.
|
|
1172
1237
|
*
|
|
1173
1238
|
* Security: only non-PII provider metadata is read here; the client secret is
|
|
1174
1239
|
* kept in the provider config and never logged or exposed to the LLM.
|
|
1175
1240
|
*/
|
|
1176
|
-
registerRemoteProvider() {
|
|
1241
|
+
async registerRemoteProvider() {
|
|
1177
1242
|
if (!isRemoteMode(this.options)) {
|
|
1178
1243
|
return;
|
|
1179
1244
|
}
|
|
@@ -1182,10 +1247,10 @@ var LocalPrimaryAuth = class extends FrontMcpAuth {
|
|
|
1182
1247
|
const cfg = options.providerConfig;
|
|
1183
1248
|
const id = cfg?.id ?? this.deriveRemoteProviderId(options.provider);
|
|
1184
1249
|
this.remoteProviderIdImpl = id;
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1250
|
+
const callbackUrl = `${this.issuer}/oauth/provider/${id}/callback`;
|
|
1251
|
+
const scopes = options.scopes ?? ["openid"];
|
|
1252
|
+
const client = await this.resolveRemoteClient(options, id, callbackUrl, scopes);
|
|
1253
|
+
if (!client) {
|
|
1189
1254
|
return;
|
|
1190
1255
|
}
|
|
1191
1256
|
this.registerProvider({
|
|
@@ -1196,10 +1261,10 @@ var LocalPrimaryAuth = class extends FrontMcpAuth {
|
|
|
1196
1261
|
userInfoEndpoint: cfg?.userInfoEndpoint ?? `${base}/userinfo`,
|
|
1197
1262
|
jwksUri: cfg?.jwksUri ?? `${base}/.well-known/jwks.json`,
|
|
1198
1263
|
jwks: cfg?.jwks,
|
|
1199
|
-
clientId:
|
|
1200
|
-
clientSecret:
|
|
1201
|
-
scopes
|
|
1202
|
-
callbackUrl
|
|
1264
|
+
clientId: client.clientId,
|
|
1265
|
+
clientSecret: client.clientSecret,
|
|
1266
|
+
scopes,
|
|
1267
|
+
callbackUrl,
|
|
1203
1268
|
// The provider is the issuer, as in transparent mode (#271): an RFC 9207
|
|
1204
1269
|
// `iss` on its callback and its id_token's `iss` must name it.
|
|
1205
1270
|
issuer: options.provider,
|
|
@@ -1207,6 +1272,35 @@ var LocalPrimaryAuth = class extends FrontMcpAuth {
|
|
|
1207
1272
|
verifyIssuer: cfg?.verifyIssuer
|
|
1208
1273
|
});
|
|
1209
1274
|
}
|
|
1275
|
+
/**
|
|
1276
|
+
* The client remote mode signs in to the provider with: the configured `clientId`, or one
|
|
1277
|
+
* registered with the provider when `providerConfig.dcrEnabled` is set. Undefined when there is neither.
|
|
1278
|
+
*/
|
|
1279
|
+
async resolveRemoteClient(options, providerId, callbackUrl, scopes) {
|
|
1280
|
+
const cfg = options.providerConfig;
|
|
1281
|
+
if (options.clientId) {
|
|
1282
|
+
if (cfg?.dcrEnabled) {
|
|
1283
|
+
this.logger.info(`Remote mode: clientId is set, so provider "${providerId}" is not registered dynamically`);
|
|
1284
|
+
}
|
|
1285
|
+
return { clientId: options.clientId, clientSecret: options.clientSecret };
|
|
1286
|
+
}
|
|
1287
|
+
if (!cfg?.dcrEnabled) {
|
|
1288
|
+
this.logger.warn(
|
|
1289
|
+
`Remote mode: no clientId configured for provider "${providerId}"; upstream OAuth is not available. Set clientId, or providerConfig.dcrEnabled to register with the provider.`
|
|
1290
|
+
);
|
|
1291
|
+
return void 0;
|
|
1292
|
+
}
|
|
1293
|
+
return resolveUpstreamClient({
|
|
1294
|
+
provider: options.provider,
|
|
1295
|
+
registrationEndpoint: cfg.registrationEndpoint,
|
|
1296
|
+
redirectUri: callbackUrl,
|
|
1297
|
+
clientName: this.scope.metadata.info?.name ?? "FrontMCP",
|
|
1298
|
+
scopes,
|
|
1299
|
+
storage: this.storageAdapter,
|
|
1300
|
+
encryptionKey: this.secret,
|
|
1301
|
+
logger: this.logger
|
|
1302
|
+
});
|
|
1303
|
+
}
|
|
1210
1304
|
/**
|
|
1211
1305
|
* Derive a stable provider id from the upstream `provider` base URL, mirroring
|
|
1212
1306
|
* the detection layer's `deriveProviderId`/`urlToProviderId` (hostname with
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// libs/sdk/src/auth/required-providers.utils.ts
|
|
2
|
+
import { isOrchestratedMode } from "@frontmcp/auth";
|
|
3
|
+
function allowsSkippingApps(authOptions) {
|
|
4
|
+
return !(authOptions && isOrchestratedMode(authOptions) && authOptions.incrementalAuth?.allowSkip === false);
|
|
5
|
+
}
|
|
6
|
+
function requiredProviderIds(authOptions, apps) {
|
|
7
|
+
if (!authOptions || !isOrchestratedMode(authOptions)) return [];
|
|
8
|
+
const configured = authOptions.federatedAuth?.requiredProviders ?? [];
|
|
9
|
+
if (allowsSkippingApps(authOptions)) return configured;
|
|
10
|
+
const appProviderIds = apps.filter((app) => app.metadata.auth).map((app) => app.metadata.id || app.metadata.name || "").filter(Boolean);
|
|
11
|
+
return [.../* @__PURE__ */ new Set([...configured, ...appProviderIds])];
|
|
12
|
+
}
|
|
13
|
+
export {
|
|
14
|
+
allowsSkippingApps,
|
|
15
|
+
requiredProviderIds
|
|
16
|
+
};
|
|
@@ -44,7 +44,7 @@ async function registerChannelCapabilities(args) {
|
|
|
44
44
|
channelsConfig?.defaultMeta,
|
|
45
45
|
(input) => flowRegistry.runFlow("channels:send-notification", input)
|
|
46
46
|
);
|
|
47
|
-
const channelEventBus = new ChannelEventBus(logger);
|
|
47
|
+
const channelEventBus = args.eventBus ?? new ChannelEventBus(logger);
|
|
48
48
|
for (const instance of channelRegistry.getChannelInstances()) {
|
|
49
49
|
instance.setNotificationService(channelNotificationService);
|
|
50
50
|
}
|
|
@@ -153,7 +153,7 @@ async function registerChannelCapabilities(args) {
|
|
|
153
153
|
}
|
|
154
154
|
}
|
|
155
155
|
for (const unsub of unsubscribers) unsub();
|
|
156
|
-
channelEventBus.clear();
|
|
156
|
+
if (!args.eventBus) channelEventBus.clear();
|
|
157
157
|
};
|
|
158
158
|
return {
|
|
159
159
|
channelRegistry,
|
|
@@ -3,6 +3,18 @@ import { toJSONSchema, internalZ as z } from "@frontmcp/lazy-zod";
|
|
|
3
3
|
import { isDebug, isDevelopment } from "@frontmcp/utils";
|
|
4
4
|
import { BaseEntry } from "./base.entry.mjs";
|
|
5
5
|
var PRIMITIVE_ZOD_OUTPUT_TYPES = /* @__PURE__ */ new Set(["string", "number", "boolean", "bigint", "date"]);
|
|
6
|
+
function literalOutputJsonSchema(literal) {
|
|
7
|
+
if (literal === "string" || literal === "number" || literal === "boolean") {
|
|
8
|
+
return objectJsonSchema({ content: { type: literal } });
|
|
9
|
+
}
|
|
10
|
+
if (literal === "date") {
|
|
11
|
+
return objectJsonSchema({ iso: { type: "string", format: "date-time" }, timeInMilli: { type: "integer" } });
|
|
12
|
+
}
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
function objectJsonSchema(properties) {
|
|
16
|
+
return { type: "object", properties, required: Object.keys(properties), additionalProperties: false };
|
|
17
|
+
}
|
|
6
18
|
var DEFINITION_REF_PREFIX = "#/$defs/";
|
|
7
19
|
function asObjectOutputSchema(json) {
|
|
8
20
|
if (json["type"] === "object") return json;
|
|
@@ -103,9 +115,11 @@ var ToolEntry = class extends BaseEntry {
|
|
|
103
115
|
* remote tools); otherwise converts a Zod-shape or Zod `outputSchema` to JSON Schema \u2014
|
|
104
116
|
* symmetric with {@link getInputJsonSchema}. MCP requires a top-level `type: 'object'`, so
|
|
105
117
|
* an object schema is returned as is and a union whose members are all object schemas is
|
|
106
|
-
* returned typed `object` (`{ type: 'object', anyOf | oneOf }`).
|
|
107
|
-
*
|
|
108
|
-
*
|
|
118
|
+
* returned typed `object` (`{ type: 'object', anyOf | oneOf }`). A primitive literal
|
|
119
|
+
* (`'string'`, `'number'`, `'boolean'`, `'date'`) returns the object its `structuredContent`
|
|
120
|
+
* is (`{ content }`, or `{ iso, timeInMilli }` for a date). Returns `null` for media literals,
|
|
121
|
+
* Zod primitives and multi-content arrays, which flow through `content`, and for any other
|
|
122
|
+
* schema (see {@link getUnlistedOutputSchemaReason}).
|
|
109
123
|
*
|
|
110
124
|
* @returns JSON Schema object, or null if there is no advertisable output schema.
|
|
111
125
|
*/
|
|
@@ -128,7 +142,10 @@ var ToolEntry = class extends BaseEntry {
|
|
|
128
142
|
return { schema: this.rawOutputSchema };
|
|
129
143
|
}
|
|
130
144
|
const schema = this.outputSchema;
|
|
131
|
-
if (
|
|
145
|
+
if (typeof schema === "string") {
|
|
146
|
+
return { schema: literalOutputJsonSchema(schema) };
|
|
147
|
+
}
|
|
148
|
+
if (!schema || Array.isArray(schema)) {
|
|
132
149
|
return { schema: null };
|
|
133
150
|
}
|
|
134
151
|
const isZodSchema = typeof schema.safeParse === "function" && typeof schema.parse === "function";
|
package/browser/common/index.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
// libs/sdk/src/common/index.ts
|
|
2
2
|
export { FRONTMCP_CONFIG_METADATA_KEY, FrontMcp, getDecoratorConfig, Flow, FrontMcpFlow, AroundHookOf, DidHookOf, FinallyHookOf, FlowHooksOf, StageHookOf, WillHookOf, consumePendingTC39Hooks, peekPendingTC39HooksForClass, registerPendingTC39Hook, resolvePendingTC39HooksForClass, App, FrontMcpApp, app, frontMcpApp, FrontMcpProvider, Provider, AuthProvider, FrontMcpAuthProvider, Adapter, FrontMcpAdapter, FrontMcpPlugin, Plugin, FrontMcpTool, Tool, frontMcpTool, tool, FrontMcpResource, FrontMcpResourceTemplate, Resource, ResourceTemplate, frontMcpResource, frontMcpResourceTemplate, resource, resourceTemplate, FrontMcpPrompt, Prompt, frontMcpPrompt, prompt, FrontMcpLogTransport, LogTransport, Agent, FrontMcpAgent, agent, frontMcpAgent, FrontMcpSkill, Skill, frontMcpSkill, getSkillMetadata, isSkillDecorated, skill, FrontMcpJob, Job, frontMcpJob, job, FrontMcpWorkflow, Workflow, frontMcpWorkflow, workflow, Channel, channel, isChannelClass, isChannelFunction, Duty, HttpRoute } from "./decorators/index.mjs";
|
|
3
3
|
export { jsonWebKeySetSchema, jwkParametersSchema, jwkSchema, aiPlatformTypeSchema, authorizationSchema, sessionIdPayloadSchema, sessionIdSchema, userClaimSchema, serverInfoOptionsSchema, platformDetectionConfigSchema, platformMappingEntrySchema, sessionOptionsSchema, defaultHttpPort, httpOptionsSchema, allowsPublicAccess, appAuthOptionsSchema, authOptionsSchema, authenticateFnSchema, consentConfigSchema, federatedAuthConfigSchema, flatRemoteProviderFields, incrementalAuthConfigSchema, isLocalMode, isOrchestratedLocal, isOrchestratedMode, isOrchestratedRemote, isPublicMode, isRemoteMode, isStaticMode, isTransparentMode, localAuthSchema, localDcrClientSchema, localDcrConfigSchema, localSigningConfigSchema, loginConfigSchema, orchestratedLocalSchema, orchestratedRemoteSchema, parseAuthOptions, providerConfigSchema, publicAccessConfigSchema, publicAuthOptionsSchema, remoteAuthSchema, remoteProviderConfigSchema, secureStoreConfigSchema, secureStoreCustomBackendSchema, secureStoreEncryptionSchema, secureStoreScopeSchema, skippedAppBehaviorSchema, staticAuthOptionsSchema, tokenRefreshConfigSchema, tokenStorageConfigSchema, tokenStorageSqliteSchema, transparentAuthOptionsSchema, upstreamProviderSchema, LogLevel, LogLevelName, loggingOptionsSchema, isPubsubConfigured, isRedisProvider, isVercelKvProvider, parseRedisUrl, pubsubOptionsSchema, redisOptionsSchema, redisProviderSchema, redisUrlSchema, storageProviderSchema, vercelKvProviderSchema, PROTOCOL_PRESETS, eventStoreConfigSchema, expandProtocolConfig, isDistributedMode, persistenceConfigSchema, shouldCacheProviders, transportOptionsSchema, DEFAULT_TOOL_PAGINATION, paginationOptionsSchema, toolPaginationOptionsSchema, outboundFetchOptionsSchema, DEFAULT_ELICITATION_OPTIONS, elicitationOptionsSchema, normalizeEndpointConfig, normalizeSkillsConfigOptions, skillsConfigAuthModeSchema, skillsConfigEndpointConfigSchema, skillsConfigOptionsSchema, extAppsHostCapabilitiesSchema, extAppsOptionsSchema, resolveDefaultSqlitePath, sqliteOptionsSchema, observabilityOptionsSchema, DEFAULT_HEALTH_OPTIONS, healthOptionsSchema, healthReadyzOptionsSchema, DEFAULT_METRICS_OPTIONS, metricsOptionsSchema, metricsProcessOptionsSchema, DEFAULT_REGISTRY_PUBLIC_KEY_ENV, REGISTRY_SERVER_NAME_PATTERN, mcpRegistryOptionsSchema, mcpRegistryRepositorySchema, toRegistryAuthRecord, lifecycleOptionsSchema, clientProfilesOptionsSchema, offloadOptionsSchema, devtoolsOptionsSchema, DEFAULT_INSTRUCTIONS_BUDGET, instructionsBudgetOptionsSchema, resolveInstructionsBudget } from "./types/index.mjs";
|
|
4
|
-
export { ProviderScope, frontMcpBaseSchema, frontMcpMetadataSchema, parseFrontMcpConfigLite, BUDGET_LIST_POLICIES, DEFAULT_OUTPUT_SCHEMA_MODE, DEFAULT_SCHEMA_DESCRIPTION_FORMAT, MIN_OUTPUT_BUDGET_BYTES, OUTPUT_SCHEMA_MODES, SCHEMA_DESCRIPTION_FORMATS, UNDECLARED_KEYS_POLICIES, formatOutputSchemaForDescription, outputPolicySchema, resolveOutputBudget, resolveOutputSchemaMode, resolveSchemaDescriptionFormat, resolveUndeclaredKeysPolicy, withUndeclaredKeysAllowed, enabledOptionSchema, isEnabledSource, isResourceKey, resourceKeySchema, frontMcpFlowMetadataSchema, HookPhase, hookOptionsSchema, frontMcpLocalAppMetadataSchema, frontMcpRemoteAppMetadataSchema, lazyAppMetadataSchema, packageLoaderSchema, frontMcpProviderMetadataSchema, AuthProviderScope, frontMcpAuthProviderMetadataSchema, frontMcpAdapterMetadataSchema, frontMcpPluginMetadataSchema, AudioOutputSchema, ImageOutputSchema, ResourceLinkOutputSchema, ResourceOutputSchema, frontMcpToolMetadataSchema, normalizeToolAuthProviders, resolveToolVisibility, frontMcpResourceMetadataSchema, frontMcpResourceTemplateMetadataSchema, frontMcpPromptMetadataSchema, frontMcpLogTransportMetadataSchema, frontMcpAgentMetadataSchema, withConfig, extractToolNames, getToolNameFromClass, isFileInstructions, isInlineInstructions, isToolRefWithClass, isToolRefWithName, isUrlInstructions, normalizeToolRef, skillMetadataSchema, MAX_JOB_TIMER_MS, frontMcpJobMetadataSchema, jobRunnerSchema, timerLimitMessage, frontMcpWorkflowMetadataSchema, channelNotificationSchema, channelSourceConfigSchema, channelsConfigSchema, frontMcpChannelMetadataSchema, PRIMITIVE_FILTER_KEYS, appFilterConfigSchema, defineDutyMetadata, dutyMetadataOf, dutyMetadataSchema, HTTP_ROUTE_PATH_MESSAGE, defineHttpRouteMetadata, httpRouteMetadataOf, isHttpRoutePath } from "./metadata/index.mjs";
|
|
4
|
+
export { ProviderScope, frontMcpBaseSchema, frontMcpMetadataSchema, parseFrontMcpConfigLite, BUDGET_LIST_POLICIES, DEFAULT_OUTPUT_SCHEMA_MODE, DEFAULT_SCHEMA_DESCRIPTION_FORMAT, MIN_OUTPUT_BUDGET_BYTES, OUTPUT_SCHEMA_MODES, SCHEMA_DESCRIPTION_FORMATS, UNDECLARED_KEYS_POLICIES, formatOutputSchemaForDescription, outputPolicySchema, resolveAllowNonFinite, resolveOutputBudget, resolveOutputSchemaMode, resolveSchemaDescriptionFormat, resolveUndeclaredKeysPolicy, withUndeclaredKeysAllowed, enabledOptionSchema, isEnabledSource, isResourceKey, resourceKeySchema, frontMcpFlowMetadataSchema, HookPhase, hookOptionsSchema, frontMcpLocalAppMetadataSchema, frontMcpRemoteAppMetadataSchema, lazyAppMetadataSchema, packageLoaderSchema, frontMcpProviderMetadataSchema, AuthProviderScope, frontMcpAuthProviderMetadataSchema, frontMcpAdapterMetadataSchema, frontMcpPluginMetadataSchema, AudioOutputSchema, ImageOutputSchema, ResourceLinkOutputSchema, ResourceOutputSchema, frontMcpToolMetadataSchema, normalizeToolAuthProviders, resolveToolVisibility, frontMcpResourceMetadataSchema, frontMcpResourceTemplateMetadataSchema, frontMcpPromptMetadataSchema, frontMcpLogTransportMetadataSchema, frontMcpAgentMetadataSchema, withConfig, extractToolNames, getToolNameFromClass, isFileInstructions, isInlineInstructions, isToolRefWithClass, isToolRefWithName, isUrlInstructions, normalizeToolRef, skillMetadataSchema, MAX_JOB_TIMER_MS, frontMcpJobMetadataSchema, jobRunnerSchema, timerLimitMessage, frontMcpWorkflowMetadataSchema, channelNotificationSchema, channelSourceConfigSchema, channelsConfigSchema, frontMcpChannelMetadataSchema, PRIMITIVE_FILTER_KEYS, appFilterConfigSchema, defineDutyMetadata, dutyMetadataOf, dutyMetadataSchema, HTTP_ROUTE_PATH_MESSAGE, defineHttpRouteMetadata, httpRouteMetadataOf, isHttpRoutePath } from "./metadata/index.mjs";
|
|
5
5
|
export { ExecutionContextBase, FrontMcpServer, ServerRequest, ServerResponse, FlowBase, FlowControl, AsyncProvider, AsyncAuthProvider, ToolContext, ResourceContext, PromptContext, FRONTMCP_LOGGER, FrontMcpLogger, LogTransportInterface, LLM_ADAPTER, supportsStreaming, AgentContext, SkillContext, JobContext, WorkflowContext, ChannelContext, HttpRouteContext, Auth, FrontMcpAuth } from "./interfaces/index.mjs";
|
|
6
6
|
export { FrontMcpTokens, ServerRequestTokens, FrontMcpFlowTokens, FrontMcpFlowHookTokens, FrontMcpLocalAppTokens, FrontMcpRemoteAppTokens, FrontMcpProviderTokens, FrontMcpAuthProviderTokens, FrontMcpAdapterTokens, FrontMcpPluginTokens, FrontMcpToolTokens, extendedToolMetadata, FrontMcpResourceTemplateTokens, FrontMcpResourceTokens, extendedResourceMetadata, extendedResourceTemplateMetadata, FrontMcpPromptTokens, extendedPromptMetadata, FrontMcpLogTransportTokens, FrontMcpAgentTokens, extendedAgentMetadata, FrontMcpSkillTokens, extendedSkillMetadata, skillCallerDir, FrontMcpJobTokens, extendedJobMetadata, FrontMcpWorkflowTokens, extendedWorkflowMetadata, FrontMcpChannelTokens } from "./tokens/index.mjs";
|
|
7
7
|
export { DynamicAdapter, adapterInitOptionsOf, DynamicPlugin, initOptionsOf, isDynamicPluginClass } from "./dynamic/index.mjs";
|
|
8
8
|
export { ProviderKind, ScopeKind, FlowKind, HookKind, AppKind, AuthProviderKind, PluginKind, AdapterKind, ToolKind, ResourceKind, ResourceTemplateKind, PromptKind, LoggerKind, AgentKind, SkillKind, JobKind, WorkflowKind, ChannelKind } from "./records/index.mjs";
|
|
9
9
|
export { BaseEntry, ScopeEntry, FlowEntry, HookEntry, AppEntry, ProviderEntry, AuthProviderEntry, PluginEntry, AdapterEntry, ToolEntry, ResourceEntry, PromptEntry, LoggerEntry, AgentEntry, SkillEntry, JobEntry, WorkflowEntry, ChannelEntry } from "./entries/index.mjs";
|
|
10
|
-
export { authInfoFromAuthorization, sessionIdPresentedBy, captureCallerDir, captureCallerFile, firstCallerFile, parseCallerDir, authorizeSessionTermination, decideIntent, decisionSchema, intentSchema, GLOBAL_RATE_LIMIT_CHECKED, IP_FILTER_REJECTION_BODY, acquireConcurrencySlots, buildPartitionContext, enforceGlobalRateLimit, enforceIpFilter, partitionsByIdentity, computeIssuer, computeResource, getPinnedPublicUrl, getRequestBaseUrl, isProxyTrusted, isPublicUrlPinned, joinPath, makeWellKnownPaths, normalizeEntryPrefix, normalizeResourceUri, normalizeScopeBase, resolveEntryPath, resourceUriMatches, trimSlashes, urlToSafeId, resolvePrincipal, getGlobalStoreConfig, applyPrimitiveFilter, isPrimitiveIncluded, validateRemoteUrl } from "./utils/index.mjs";
|
|
10
|
+
export { authInfoFromAuthorization, sessionIdPresentedBy, captureCallerDir, captureCallerFile, firstCallerFile, parseCallerDir, authorizeSessionTermination, decideIntent, decisionSchema, intentSchema, GLOBAL_RATE_LIMIT_CHECKED, IP_FILTER_REJECTION_BODY, acquireConcurrencySlots, buildPartitionContext, enforceGlobalRateLimit, enforceIpFilter, partitionsByIdentity, computeIssuer, computeResource, getPinnedPublicUrl, getRequestBaseUrl, isProxyTrusted, isPublicUrlPinned, joinPath, makeWellKnownPaths, normalizeEntryPrefix, normalizeResourceUri, normalizeScopeBase, resolveEntryPath, resourceUriMatches, trimSlashes, urlToSafeId, WorkflowTriggerPrincipal, resolvePrincipal, workflowTriggerOf, getGlobalStoreConfig, applyPrimitiveFilter, isPrimitiveIncluded, validateRemoteUrl } from "./utils/index.mjs";
|
|
11
11
|
export { annotatedFrontMcpAdaptersSchema, annotatedFrontMcpAgentsSchema, annotatedFrontMcpAppSchema, annotatedFrontMcpAuthProvidersSchema, annotatedFrontMcpChannelsSchema, annotatedFrontMcpJobsSchema, annotatedFrontMcpLoggerSchema, annotatedFrontMcpPluginsSchema, annotatedFrontMcpPromptsSchema, annotatedFrontMcpProvidersSchema, annotatedFrontMcpResourcesSchema, annotatedFrontMcpSkillsSchema, annotatedFrontMcpToolsSchema, annotatedFrontMcpWorkflowsSchema, HttpBinarySchema, HttpConsumedSchema, HttpCookieSchema, HttpCookies, HttpEmptySchema, HttpEmptyStatus, HttpHeaders, HttpHtmlSchema, HttpImageSchema, HttpJsonRpcSchema, HttpJsonSchema, HttpNextSchema, HttpProblemSchema, HttpRedirectSchema, HttpRedirectStatus, HttpSseSchema, HttpStatus, HttpStreamSchema, HttpTextSchema, HttpWebResponseSchema, JSON_RPC, NO_BODY_STATUSES, NO_STORE_HEADERS, REDIRECTS, challengeHeaders, httpOutputSchema, httpRespond, serializeHttpCookie, withHttpHeaders, httpInputSchema, httpRequestInputSchema, mcpSessionHeaderSchema, validateMcpSessionHeader } from "./schemas/index.mjs";
|
|
12
12
|
export { detectConflicts, parseListInput, previewItems, resolveNameConflicts } from "./flow/flow.utils.mjs";
|
|
13
13
|
export { ToolHookStage } from "./interfaces/tool-hook.interface.mjs";
|
|
@@ -42,6 +42,8 @@ var AgentContext = class _AgentContext extends ExecutionContextBase {
|
|
|
42
42
|
_outputHistory = [];
|
|
43
43
|
// ---- Progress token from request's _meta (for progress notifications)
|
|
44
44
|
_progressToken;
|
|
45
|
+
/** @internal JSON-RPC id of the request that called the agent - set by CallAgentFlow, for its notifications */
|
|
46
|
+
_jsonRpcRequestIdInternal;
|
|
45
47
|
constructor(args) {
|
|
46
48
|
const {
|
|
47
49
|
metadata,
|
|
@@ -128,6 +130,7 @@ var AgentContext = class _AgentContext extends ExecutionContextBase {
|
|
|
128
130
|
let lastAutoProgressAt;
|
|
129
131
|
const autoProgress = (progress, message, isFinal = false) => {
|
|
130
132
|
if (streaming) return;
|
|
133
|
+
if (this.signal?.aborted) return;
|
|
131
134
|
const now = Date.now();
|
|
132
135
|
if (progress <= lastSentProgress) return;
|
|
133
136
|
if (!isFinal && lastAutoProgressAt !== void 0 && now - lastAutoProgressAt < notificationInterval) return;
|
|
@@ -142,10 +145,13 @@ var AgentContext = class _AgentContext extends ExecutionContextBase {
|
|
|
142
145
|
streamCompletion: (prompt, tools, options) => this.streamCompletion(prompt, tools, options)
|
|
143
146
|
}
|
|
144
147
|
},
|
|
148
|
+
agentId: this.agentId,
|
|
145
149
|
systemInstructions: this.systemInstructions,
|
|
146
150
|
tools: this.toolDefinitions,
|
|
147
151
|
maxIterations,
|
|
148
152
|
timeout: this.metadata.execution?.timeout ?? 12e4,
|
|
153
|
+
// The call's own stop (cancelled, or failed by `timeout.executeMs`) stops the loop too
|
|
154
|
+
signal: this.signal,
|
|
149
155
|
logger: this.logger,
|
|
150
156
|
completionOptions: this.completionOptions(),
|
|
151
157
|
// Auto progress callbacks (only when enabled)
|
|
@@ -387,7 +393,8 @@ var AgentContext = class _AgentContext extends ExecutionContextBase {
|
|
|
387
393
|
// ============================================================================
|
|
388
394
|
/**
|
|
389
395
|
* Send a notification message to the current session.
|
|
390
|
-
* Uses 'notifications/message' per MCP 2025-11-25 spec
|
|
396
|
+
* Uses 'notifications/message' per MCP 2025-11-25 spec, on the call's own response stream,
|
|
397
|
+
* so the client has it before the call's result.
|
|
391
398
|
*
|
|
392
399
|
* Use this to report progress during long-running operations.
|
|
393
400
|
*
|
|
@@ -421,11 +428,18 @@ var AgentContext = class _AgentContext extends ExecutionContextBase {
|
|
|
421
428
|
if (!sessionId) {
|
|
422
429
|
return false;
|
|
423
430
|
}
|
|
424
|
-
return this.scope.notifications.sendLogMessageToSession(
|
|
431
|
+
return this.scope.notifications.sendLogMessageToSession(
|
|
432
|
+
sessionId,
|
|
433
|
+
level,
|
|
434
|
+
this.agentName,
|
|
435
|
+
data,
|
|
436
|
+
this._jsonRpcRequestIdInternal
|
|
437
|
+
);
|
|
425
438
|
}
|
|
426
439
|
/**
|
|
427
440
|
* Send a progress notification to the current session.
|
|
428
|
-
* Uses 'notifications/progress' per MCP 2025-11-25 spec
|
|
441
|
+
* Uses 'notifications/progress' per MCP 2025-11-25 spec, on the call's own response stream,
|
|
442
|
+
* so the client has it before the call's result.
|
|
429
443
|
*
|
|
430
444
|
* Only works if the client requested progress updates by including a
|
|
431
445
|
* progressToken in the request's _meta field. If no progressToken was
|
|
@@ -459,7 +473,14 @@ var AgentContext = class _AgentContext extends ExecutionContextBase {
|
|
|
459
473
|
this.logger.warn("Cannot send progress: no session ID");
|
|
460
474
|
return false;
|
|
461
475
|
}
|
|
462
|
-
return this.scope.notifications.sendProgressNotification(
|
|
476
|
+
return this.scope.notifications.sendProgressNotification(
|
|
477
|
+
sessionId,
|
|
478
|
+
this._progressToken,
|
|
479
|
+
progress,
|
|
480
|
+
total,
|
|
481
|
+
message,
|
|
482
|
+
this._jsonRpcRequestIdInternal
|
|
483
|
+
);
|
|
463
484
|
}
|
|
464
485
|
/**
|
|
465
486
|
* Request interactive input from the user during agent execution.
|
|
@@ -17,6 +17,8 @@ var ToolContext = class extends ExecutionContextBase {
|
|
|
17
17
|
_toolInputInternal;
|
|
18
18
|
/** @internal JSON-RPC id of the tools/call request - set by CallToolFlow, for flows the call is handed on to */
|
|
19
19
|
_jsonRpcRequestIdInternal;
|
|
20
|
+
/** @internal Set by CallToolFlow: records the value `respond()` ends the call with as the tool's output */
|
|
21
|
+
_onRespondInternal;
|
|
20
22
|
// ---- INPUT storages (backing fields)
|
|
21
23
|
_rawInput;
|
|
22
24
|
_input;
|
|
@@ -79,8 +81,17 @@ var ToolContext = class extends ExecutionContextBase {
|
|
|
79
81
|
get outputHistory() {
|
|
80
82
|
return this._outputHistory;
|
|
81
83
|
}
|
|
84
|
+
/**
|
|
85
|
+
* End the call with `value` as the tool's output, as if `execute()` returned it: it is checked
|
|
86
|
+
* against `outputSchema` and sent as `content` and `structuredContent`. A hook that calls it
|
|
87
|
+
* (`ctx.state.toolContext.respond(value)`) answers for the tool, which then does not run.
|
|
88
|
+
* To send a whole `CallToolResult` you built, pass one with a `content` array: it is sent as it is.
|
|
89
|
+
*
|
|
90
|
+
* @param value - The tool's output
|
|
91
|
+
*/
|
|
82
92
|
respond(value) {
|
|
83
93
|
this.output = value;
|
|
94
|
+
this._onRespondInternal?.(value);
|
|
84
95
|
FlowControl.respond(value);
|
|
85
96
|
}
|
|
86
97
|
// ============================================
|
|
@@ -88,7 +99,8 @@ var ToolContext = class extends ExecutionContextBase {
|
|
|
88
99
|
// ============================================
|
|
89
100
|
/**
|
|
90
101
|
* Send a notification message to the current session.
|
|
91
|
-
* Uses 'notifications/message' per MCP 2025-11-25 spec
|
|
102
|
+
* Uses 'notifications/message' per MCP 2025-11-25 spec, on the call's own response stream,
|
|
103
|
+
* so the client has it before the call's result.
|
|
92
104
|
*
|
|
93
105
|
* @param message - The notification message (string) or structured data (object)
|
|
94
106
|
* @param level - One of the eight MCP log levels, 'debug' through 'emergency' (default: 'info')
|
|
@@ -114,11 +126,18 @@ var ToolContext = class extends ExecutionContextBase {
|
|
|
114
126
|
this.logger.warn("Cannot send notification: no session ID");
|
|
115
127
|
return false;
|
|
116
128
|
}
|
|
117
|
-
return this.scope.notifications.sendLogMessageToSession(
|
|
129
|
+
return this.scope.notifications.sendLogMessageToSession(
|
|
130
|
+
sessionId,
|
|
131
|
+
level,
|
|
132
|
+
this.toolName,
|
|
133
|
+
data,
|
|
134
|
+
this._jsonRpcRequestIdInternal
|
|
135
|
+
);
|
|
118
136
|
}
|
|
119
137
|
/**
|
|
120
138
|
* Send a progress notification to the current session.
|
|
121
|
-
* Uses 'notifications/progress' per MCP 2025-11-25 spec
|
|
139
|
+
* Uses 'notifications/progress' per MCP 2025-11-25 spec, on the call's own response stream,
|
|
140
|
+
* so the client has it before the call's result.
|
|
122
141
|
*
|
|
123
142
|
* Only works if the client requested progress updates by including a
|
|
124
143
|
* progressToken in the request's _meta field. If no progressToken was
|
|
@@ -144,7 +163,7 @@ var ToolContext = class extends ExecutionContextBase {
|
|
|
144
163
|
async progress(progress, total, message) {
|
|
145
164
|
const sink = this.tryGetContext()?.getRequestNotificationSink?.();
|
|
146
165
|
if (sink) return sink.progress(progress, total, message);
|
|
147
|
-
if (
|
|
166
|
+
if (this._progressToken === void 0) {
|
|
148
167
|
this.logger.debug("Cannot send progress: no progressToken in request");
|
|
149
168
|
return false;
|
|
150
169
|
}
|
|
@@ -153,7 +172,14 @@ var ToolContext = class extends ExecutionContextBase {
|
|
|
153
172
|
this.logger.warn("Cannot send progress: no session ID");
|
|
154
173
|
return false;
|
|
155
174
|
}
|
|
156
|
-
return this.scope.notifications.sendProgressNotification(
|
|
175
|
+
return this.scope.notifications.sendProgressNotification(
|
|
176
|
+
sessionId,
|
|
177
|
+
this._progressToken,
|
|
178
|
+
progress,
|
|
179
|
+
total,
|
|
180
|
+
message,
|
|
181
|
+
this._jsonRpcRequestIdInternal
|
|
182
|
+
);
|
|
157
183
|
}
|
|
158
184
|
/**
|
|
159
185
|
* Notify subscribed clients that a resource's contents changed.
|
|
@@ -59,7 +59,7 @@ var esmAutoUpdateOptionsSchema = z.object({
|
|
|
59
59
|
var packageConfigSchema = z.object({
|
|
60
60
|
loader: packageLoaderSchema.optional(),
|
|
61
61
|
autoUpdate: esmAutoUpdateOptionsSchema.optional(),
|
|
62
|
-
cacheTTL: z.number().
|
|
62
|
+
cacheTTL: z.number().nonnegative().optional(),
|
|
63
63
|
importMap: z.record(z.string(), z.string()).optional()
|
|
64
64
|
});
|
|
65
65
|
var remoteTransportOptionsSchema = z.object({
|
|
@@ -92,7 +92,13 @@ var remoteAuthConfigSchema = z.discriminatedUnion("mode", [
|
|
|
92
92
|
})
|
|
93
93
|
}),
|
|
94
94
|
z.object({
|
|
95
|
-
mode: z.literal("oauth")
|
|
95
|
+
mode: z.literal("oauth"),
|
|
96
|
+
clientId: z.string().min(1).optional(),
|
|
97
|
+
clientSecret: z.string().min(1).optional(),
|
|
98
|
+
scope: z.string().optional(),
|
|
99
|
+
tokenUrl: z.string().url().optional()
|
|
100
|
+
}).refine((auth) => auth.clientId === void 0 === (auth.clientSecret === void 0), {
|
|
101
|
+
message: "remoteAuth oauth needs both clientId and clientSecret, or neither"
|
|
96
102
|
})
|
|
97
103
|
]);
|
|
98
104
|
var frontMcpRemoteAppMetadataSchema = z.looseObject({
|