@frontmcp/sdk 1.9.7 → 1.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/agent/agent.registry.d.ts +3 -1
- package/agent/agent.registry.d.ts.map +1 -1
- package/agent/hooks/agent.hooks.d.ts +4 -4
- package/app/app.registry.d.ts.map +1 -1
- package/auth/auth.registry.d.ts +4 -6
- package/auth/auth.registry.d.ts.map +1 -1
- package/auth/direct-public-auth.d.ts +10 -0
- package/auth/direct-public-auth.d.ts.map +1 -0
- package/auth/primary-auth.factory.d.ts +4 -0
- package/auth/primary-auth.factory.d.ts.map +1 -0
- package/browser/adapter/adapter.instance.mjs +166 -0
- package/browser/adapter/adapter.registry.mjs +97 -0
- package/browser/adapter/adapter.utils.mjs +85 -0
- package/browser/agent/adapters/adapter.factory.mjs +168 -0
- package/browser/agent/adapters/anthropic.adapter.mjs +332 -0
- package/browser/agent/adapters/base.adapter.mjs +120 -0
- package/browser/agent/adapters/index.mjs +30 -0
- package/browser/agent/adapters/openai.adapter.mjs +551 -0
- package/browser/agent/adapters/providers/index.mjs +84 -0
- package/browser/agent/adapters/providers/types.mjs +0 -0
- package/browser/agent/agent-builtin-tools.mjs +193 -0
- package/browser/agent/agent-call-chain.mjs +22 -0
- package/browser/agent/agent-execution-loop.mjs +371 -0
- package/browser/agent/agent.events.mjs +133 -0
- package/browser/agent/agent.instance.mjs +869 -0
- package/browser/agent/agent.registry.mjs +398 -0
- package/browser/agent/agent.scope.mjs +352 -0
- package/browser/agent/agent.utils.mjs +161 -0
- package/browser/agent/flows/call-agent.flow.mjs +559 -0
- package/browser/agent/flows/index.mjs +5 -0
- package/browser/agent/hooks/agent.hooks.mjs +10 -0
- package/browser/agent/hooks/index.mjs +2 -0
- package/browser/agent/index.mjs +32 -0
- package/browser/app/app.registry.mjs +88 -0
- package/browser/app/app.utils.mjs +84 -0
- package/browser/app/instances/app.esm.instance.mjs +303 -0
- package/browser/app/instances/app.local.instance.mjs +120 -0
- package/browser/app/instances/app.remote.instance.mjs +397 -0
- package/browser/app/instances/esm-normalize.utils.mjs +100 -0
- package/browser/app/remote-capabilities.utils.mjs +18 -0
- package/browser/auth/auth-ui/auth-ui.contract.mjs +16 -0
- package/browser/auth/auth-ui/auth-ui.registry.mjs +262 -0
- package/browser/auth/auth-ui/auth-ui.render.mjs +127 -0
- package/browser/auth/auth-ui/auth-ui.state.mjs +86 -0
- package/browser/auth/auth-ui/index.mjs +35 -0
- package/browser/auth/auth.registry.mjs +200 -0
- package/browser/auth/auth.utils.mjs +80 -0
- package/browser/auth/authorization/orchestrated.context-extension.mjs +23 -0
- package/browser/auth/authorized-apps.utils.mjs +23 -0
- package/browser/auth/cimd/index.mjs +53 -0
- package/browser/auth/consent-tools.helper.mjs +32 -0
- package/browser/auth/consent.utils.mjs +31 -0
- package/browser/auth/credentials/credentials.context-extension.mjs +18 -0
- package/browser/auth/credentials/credentials.providers.mjs +45 -0
- package/browser/auth/credentials/index.mjs +11 -0
- package/browser/auth/direct-public-auth.mjs +21 -0
- package/browser/auth/flows/form-body.utils.mjs +14 -0
- package/browser/auth/flows/oauth.auth-ui.flow.mjs +135 -0
- package/browser/auth/flows/oauth.authorize.flow.mjs +1053 -0
- package/browser/auth/flows/oauth.callback.flow.mjs +1149 -0
- package/browser/auth/flows/oauth.connect.flow.mjs +296 -0
- package/browser/auth/flows/oauth.provider-callback.flow.mjs +829 -0
- package/browser/auth/flows/oauth.register.flow.mjs +304 -0
- package/browser/auth/flows/oauth.token.flow.mjs +417 -0
- package/browser/auth/flows/oauth.userinfo.flow.mjs +126 -0
- package/browser/auth/flows/session.verify.flow.mjs +529 -0
- package/browser/auth/flows/signin-binding.utils.mjs +72 -0
- package/browser/auth/flows/well-known.jwks.flow.mjs +113 -0
- package/browser/auth/flows/well-known.oauth-authorization-server.flow.mjs +215 -0
- package/browser/auth/flows/well-known.prm.flow.mjs +150 -0
- package/browser/auth/instances/instance.local-primary-auth.mjs +1466 -0
- package/browser/auth/instances/instance.remote-primary-auth.mjs +52 -0
- package/browser/auth/primary-auth.factory.mjs +34 -0
- package/browser/auth/public-access.utils.mjs +32 -0
- package/browser/auth/secure-store/index.mjs +11 -0
- package/browser/auth/secure-store/secure-store.context-extension.mjs +18 -0
- package/browser/auth/secure-store/secure-store.providers.mjs +46 -0
- package/browser/auth/session/session-store.factory.mjs +107 -0
- package/browser/auth/session/utils/session-id.utils.mjs +137 -0
- package/browser/auth/session-scope-identity.mjs +15 -0
- package/browser/builtin/config/config-resolver.mjs +82 -0
- package/browser/builtin/config/config.plugin.mjs +104 -0
- package/browser/builtin/config/config.symbols.mjs +7 -0
- package/browser/builtin/config/index.mjs +62 -0
- package/browser/builtin/config/providers/config-loader.mjs +99 -0
- package/browser/builtin/config/providers/config.service.mjs +153 -0
- package/browser/builtin/config/providers/env-loader.mjs +172 -0
- package/browser/channel/channel-notification.service.mjs +142 -0
- package/browser/channel/channel-scope.helper.mjs +175 -0
- package/browser/channel/channel.events.mjs +14 -0
- package/browser/channel/channel.instance.mjs +254 -0
- package/browser/channel/channel.registry.mjs +149 -0
- package/browser/channel/channel.utils.mjs +42 -0
- package/browser/channel/flows/list-channels.flow.mjs +78 -0
- package/browser/channel/flows/send-channel-notification.flow.mjs +121 -0
- package/browser/channel/index.mjs +20 -0
- package/browser/channel/reply/channel-reply.tool.mjs +80 -0
- package/browser/channel/reply/reply.types.mjs +10 -0
- package/browser/channel/sources/agent-completion.source.mjs +26 -0
- package/browser/channel/sources/app-event.source.mjs +74 -0
- package/browser/channel/sources/completion-events.mjs +45 -0
- package/browser/channel/sources/job-completion.source.mjs +24 -0
- package/browser/channel/sources/webhook.source.mjs +32 -0
- package/browser/common/availability/availability.utils.mjs +87 -0
- package/browser/common/availability/index.mjs +15 -0
- package/browser/common/decorators/adapter.decorator.mjs +17 -0
- package/browser/common/decorators/agent.decorator.mjs +87 -0
- package/browser/common/decorators/app.decorator.mjs +128 -0
- package/browser/common/decorators/auth-provider.decorator.mjs +17 -0
- package/browser/common/decorators/channel.decorator.mjs +49 -0
- package/browser/common/decorators/decorator-utils.mjs +116 -0
- package/browser/common/decorators/flow.decorator.mjs +16 -0
- package/browser/common/decorators/front-mcp.decorator.mjs +103 -0
- package/browser/common/decorators/hook.decorator.mjs +111 -0
- package/browser/common/decorators/index.mjs +18 -0
- package/browser/common/decorators/job.decorator.mjs +82 -0
- package/browser/common/decorators/logger.decorator.mjs +17 -0
- package/browser/common/decorators/plugin.decorator.mjs +41 -0
- package/browser/common/decorators/prompt.decorator.mjs +80 -0
- package/browser/common/decorators/provider.decorator.mjs +17 -0
- package/browser/common/decorators/resource.decorator.mjs +121 -0
- package/browser/common/decorators/skill.decorator.mjs +111 -0
- package/browser/common/decorators/tool.decorator.mjs +82 -0
- package/browser/common/decorators/workflow.decorator.mjs +36 -0
- package/browser/common/dynamic/dynamic.adapter.mjs +91 -0
- package/browser/common/dynamic/dynamic.plugin.mjs +64 -0
- package/browser/common/dynamic/dynamic.utils.mjs +67 -0
- package/browser/common/dynamic/index.mjs +3 -0
- package/browser/common/entries/adapter.entry.mjs +7 -0
- package/browser/common/entries/agent.entry.mjs +54 -0
- package/browser/common/entries/app.entry.mjs +17 -0
- package/browser/common/entries/auth-provider.entry.mjs +7 -0
- package/browser/common/entries/base.entry.mjs +16 -0
- package/browser/common/entries/channel.entry.mjs +43 -0
- package/browser/common/entries/flow.entry.mjs +21 -0
- package/browser/common/entries/hook.entry.mjs +19 -0
- package/browser/common/entries/index.mjs +19 -0
- package/browser/common/entries/job.entry.mjs +59 -0
- package/browser/common/entries/logger.entry.mjs +7 -0
- package/browser/common/entries/plugin.entry.mjs +7 -0
- package/browser/common/entries/prompt.entry.mjs +16 -0
- package/browser/common/entries/provider.entry.mjs +7 -0
- package/browser/common/entries/resource.entry.mjs +36 -0
- package/browser/common/entries/scope.entry.mjs +86 -0
- package/browser/common/entries/skill.entry.mjs +131 -0
- package/browser/common/entries/tool.entry.mjs +125 -0
- package/browser/common/entries/workflow.entry.mjs +29 -0
- package/browser/common/flow/flow.utils.mjs +58 -0
- package/browser/common/index.mjs +16 -0
- package/browser/common/interfaces/adapter.interface.mjs +0 -0
- package/browser/common/interfaces/agent.interface.mjs +577 -0
- package/browser/common/interfaces/app.interface.mjs +0 -0
- package/browser/common/interfaces/auth-hook.interface.mjs +24 -0
- package/browser/common/interfaces/auth-provider.interface.mjs +7 -0
- package/browser/common/interfaces/base.interface.mjs +0 -0
- package/browser/common/interfaces/channel.interface.mjs +90 -0
- package/browser/common/interfaces/execution-context.interface.mjs +388 -0
- package/browser/common/interfaces/flow.interface.mjs +114 -0
- package/browser/common/interfaces/front-mcp.interface.mjs +0 -0
- package/browser/common/interfaces/hook.interface.mjs +0 -0
- package/browser/common/interfaces/index.mjs +24 -0
- package/browser/common/interfaces/internal/flow.utils.mjs +81 -0
- package/browser/common/interfaces/internal/index.mjs +3 -0
- package/browser/common/interfaces/internal/primary-auth-provider.interface.mjs +69 -0
- package/browser/common/interfaces/internal/registry.interface.mjs +0 -0
- package/browser/common/interfaces/job.interface.mjs +81 -0
- package/browser/common/interfaces/llm-adapter.interface.mjs +9 -0
- package/browser/common/interfaces/logger.interface.mjs +9 -0
- package/browser/common/interfaces/plugin.interface.mjs +0 -0
- package/browser/common/interfaces/prompt.interface.mjs +47 -0
- package/browser/common/interfaces/provider.interface.mjs +7 -0
- package/browser/common/interfaces/resource.interface.mjs +91 -0
- package/browser/common/interfaces/scope.interface.mjs +0 -0
- package/browser/common/interfaces/server.interface.mjs +23 -0
- package/browser/common/interfaces/session-hook.interface.mjs +24 -0
- package/browser/common/interfaces/skill.interface.mjs +63 -0
- package/browser/common/interfaces/tool-hook.interface.mjs +39 -0
- package/browser/common/interfaces/tool.interface.mjs +350 -0
- package/browser/common/interfaces/workflow.interface.mjs +31 -0
- package/browser/common/metadata/adapter.metadata.mjs +10 -0
- package/browser/common/metadata/agent.metadata.mjs +110 -0
- package/browser/common/metadata/app-filter.metadata.mjs +29 -0
- package/browser/common/metadata/app.metadata.mjs +120 -0
- package/browser/common/metadata/auth-provider.metadata.mjs +17 -0
- package/browser/common/metadata/channel.metadata.mjs +73 -0
- package/browser/common/metadata/flow.metadata.mjs +15 -0
- package/browser/common/metadata/front-mcp.metadata.mjs +237 -0
- package/browser/common/metadata/hook.metadata.mjs +0 -0
- package/browser/common/metadata/index.mjs +26 -0
- package/browser/common/metadata/job.metadata.mjs +30 -0
- package/browser/common/metadata/logger.metadata.mjs +10 -0
- package/browser/common/metadata/output-policy.mjs +63 -0
- package/browser/common/metadata/plugin.metadata.mjs +37 -0
- package/browser/common/metadata/prompt.metadata.mjs +29 -0
- package/browser/common/metadata/provider.metadata.mjs +12 -0
- package/browser/common/metadata/remote-primitive.metadata.mjs +0 -0
- package/browser/common/metadata/resource.metadata.mjs +39 -0
- package/browser/common/metadata/skill.metadata.mjs +191 -0
- package/browser/common/metadata/tool-ui.metadata.mjs +0 -0
- package/browser/common/metadata/tool.metadata.mjs +108 -0
- package/browser/common/metadata/ui-serving-mode.mjs +21 -0
- package/browser/common/metadata/workflow.metadata.mjs +55 -0
- package/browser/common/providers/base-config.provider.mjs +118 -0
- package/browser/common/records/adapter.record.mjs +11 -0
- package/browser/common/records/agent.record.mjs +13 -0
- package/browser/common/records/app.record.mjs +9 -0
- package/browser/common/records/auth-provider.record.mjs +12 -0
- package/browser/common/records/channel.record.mjs +9 -0
- package/browser/common/records/flow.record.mjs +8 -0
- package/browser/common/records/hook.record.mjs +8 -0
- package/browser/common/records/index.mjs +22 -0
- package/browser/common/records/job.record.mjs +12 -0
- package/browser/common/records/logger.record.mjs +8 -0
- package/browser/common/records/plugin.record.mjs +11 -0
- package/browser/common/records/prompt.record.mjs +11 -0
- package/browser/common/records/provider.record.mjs +7 -0
- package/browser/common/records/resource.record.mjs +17 -0
- package/browser/common/records/scope.record.mjs +9 -0
- package/browser/common/records/skill.record.mjs +12 -0
- package/browser/common/records/tool.record.mjs +11 -0
- package/browser/common/records/workflow.record.mjs +12 -0
- package/browser/common/schemas/annotated-class.schema.mjs +311 -0
- package/browser/common/schemas/http-input.schema.mjs +16 -0
- package/browser/common/schemas/http-output.schema.mjs +315 -0
- package/browser/common/schemas/index.mjs +5 -0
- package/browser/common/schemas/session-header.schema.mjs +25 -0
- package/browser/common/tokens/adapter.tokens.mjs +11 -0
- package/browser/common/tokens/agent.tokens.mjs +35 -0
- package/browser/common/tokens/app.tokens.mjs +48 -0
- package/browser/common/tokens/auth-provider.tokens.mjs +12 -0
- package/browser/common/tokens/base.tokens.mjs +8 -0
- package/browser/common/tokens/channel.tokens.mjs +19 -0
- package/browser/common/tokens/flow-hook.tokens.mjs +10 -0
- package/browser/common/tokens/flow.tokens.mjs +16 -0
- package/browser/common/tokens/front-mcp.tokens.mjs +71 -0
- package/browser/common/tokens/index.mjs +19 -0
- package/browser/common/tokens/job.tokens.mjs +22 -0
- package/browser/common/tokens/logger.tokens.mjs +11 -0
- package/browser/common/tokens/plugin.tokens.mjs +23 -0
- package/browser/common/tokens/prompt.tokens.mjs +18 -0
- package/browser/common/tokens/provider.tokens.mjs +12 -0
- package/browser/common/tokens/resource.tokens.mjs +38 -0
- package/browser/common/tokens/server.tokens.mjs +17 -0
- package/browser/common/tokens/skill.tokens.mjs +37 -0
- package/browser/common/tokens/tool.tokens.mjs +41 -0
- package/browser/common/tokens/workflow.tokens.mjs +25 -0
- package/browser/common/types/auth/index.mjs +3 -0
- package/browser/common/types/auth/jwt.types.mjs +7 -0
- package/browser/common/types/auth/session.types.mjs +24 -0
- package/browser/common/types/common.types.mjs +0 -0
- package/browser/common/types/index.mjs +4 -0
- package/browser/common/types/options/auth/index.mjs +89 -0
- package/browser/common/types/options/elicitation/index.mjs +6 -0
- package/browser/common/types/options/elicitation/schema.mjs +14 -0
- package/browser/common/types/options/ext-apps/index.mjs +2 -0
- package/browser/common/types/options/ext-apps/schema.mjs +66 -0
- package/browser/common/types/options/health/index.mjs +7 -0
- package/browser/common/types/options/health/schema.mjs +24 -0
- package/browser/common/types/options/http/index.mjs +6 -0
- package/browser/common/types/options/http/schema.mjs +118 -0
- package/browser/common/types/options/index.mjs +18 -0
- package/browser/common/types/options/logging/index.mjs +8 -0
- package/browser/common/types/options/logging/interfaces.mjs +22 -0
- package/browser/common/types/options/logging/schema.mjs +20 -0
- package/browser/common/types/options/metrics/index.mjs +11 -0
- package/browser/common/types/options/metrics/schema.mjs +40 -0
- package/browser/common/types/options/observability/index.mjs +5 -0
- package/browser/common/types/options/observability/schema.mjs +13 -0
- package/browser/common/types/options/outbound-fetch/index.mjs +5 -0
- package/browser/common/types/options/outbound-fetch/schema.mjs +12 -0
- package/browser/common/types/options/pagination/index.mjs +7 -0
- package/browser/common/types/options/pagination/schema.mjs +20 -0
- package/browser/common/types/options/redis/index.mjs +25 -0
- package/browser/common/types/options/redis/schema.mjs +174 -0
- package/browser/common/types/options/registry/index.mjs +10 -0
- package/browser/common/types/options/registry/schema.mjs +28 -0
- package/browser/common/types/options/registry/utils.mjs +29 -0
- package/browser/common/types/options/server-info/index.mjs +5 -0
- package/browser/common/types/options/server-info/schema.mjs +13 -0
- package/browser/common/types/options/session/index.mjs +7 -0
- package/browser/common/types/options/session/schema.mjs +25 -0
- package/browser/common/types/options/skills-http/index.mjs +15 -0
- package/browser/common/types/options/skills-http/schema.mjs +130 -0
- package/browser/common/types/options/sqlite/index.mjs +7 -0
- package/browser/common/types/options/sqlite/resolve.mjs +56 -0
- package/browser/common/types/options/sqlite/schema.mjs +40 -0
- package/browser/common/types/options/transport/index.mjs +19 -0
- package/browser/common/types/options/transport/schema.mjs +194 -0
- package/browser/common/utils/auth-info.utils.mjs +29 -0
- package/browser/common/utils/caller-dir.utils.mjs +50 -0
- package/browser/common/utils/decide-request-intent.utils.mjs +362 -0
- package/browser/common/utils/enforced-metadata.utils.mjs +25 -0
- package/browser/common/utils/external-entry.utils.mjs +56 -0
- package/browser/common/utils/global-config.utils.mjs +11 -0
- package/browser/common/utils/guard.utils.mjs +107 -0
- package/browser/common/utils/index.mjs +10 -0
- package/browser/common/utils/list-all-pages.utils.mjs +24 -0
- package/browser/common/utils/path.utils.mjs +116 -0
- package/browser/common/utils/primitive-filter.mjs +39 -0
- package/browser/common/utils/principal.utils.mjs +46 -0
- package/browser/common/utils/tool-lookup.utils.mjs +32 -0
- package/browser/common/utils/validate-remote-url.mjs +10 -0
- package/browser/completion/flows/complete.flow.mjs +316 -0
- package/browser/context/call-surface.mjs +13 -0
- package/browser/context/context-extension.mjs +40 -0
- package/browser/context/frontmcp-context-storage.mjs +169 -0
- package/browser/context/frontmcp-context.mjs +575 -0
- package/browser/context/frontmcp-context.provider.mjs +21 -0
- package/browser/context/index.mjs +31 -0
- package/browser/context/metadata.utils.mjs +132 -0
- package/browser/context/running-flow.mjs +14 -0
- package/browser/context/running-tool.mjs +13 -0
- package/browser/context/trace-context.mjs +77 -0
- package/browser/direct/connect.mjs +97 -0
- package/browser/direct/create.mjs +109 -0
- package/browser/direct/direct-client.mjs +596 -0
- package/browser/direct/direct-server.mjs +235 -0
- package/browser/direct/index.mjs +19 -0
- package/browser/direct/llm-platform.mjs +208 -0
- package/browser/direct/runtime-tools.mjs +103 -0
- package/browser/elicitation/elicitation-fallback.schema.mjs +34 -0
- package/browser/elicitation/elicitation-meta.mjs +5 -0
- package/browser/elicitation/elicitation.types.mjs +7 -0
- package/browser/elicitation/flows/elicitation-request.flow.mjs +188 -0
- package/browser/elicitation/flows/elicitation-result.flow.mjs +189 -0
- package/browser/elicitation/flows/index.mjs +12 -0
- package/browser/elicitation/helpers/elicit.helper.mjs +85 -0
- package/browser/elicitation/helpers/extend-output-schema.mjs +31 -0
- package/browser/elicitation/helpers/fallback.helper.mjs +128 -0
- package/browser/elicitation/helpers/index.mjs +24 -0
- package/browser/elicitation/helpers/mrtr-request.helper.mjs +25 -0
- package/browser/elicitation/helpers/validate-elicitation-content.mjs +34 -0
- package/browser/elicitation/index.mjs +8 -0
- package/browser/elicitation/send-elicitation-result.tool.mjs +151 -0
- package/browser/elicitation/send-elicitation-result.utils.mjs +7 -0
- package/browser/elicitation/store/elicitation-encryption.mjs +101 -0
- package/browser/elicitation/store/elicitation-store.factory.mjs +224 -0
- package/browser/elicitation/store/encrypted-elicitation.store.mjs +392 -0
- package/browser/elicitation/store/index.mjs +39 -0
- package/browser/elicitation/store/storage-elicitation.store.mjs +470 -0
- package/browser/errors/agent.errors.mjs +139 -0
- package/browser/errors/auth-internal.errors.mjs +43 -0
- package/browser/errors/authorization-required.error.mjs +219 -0
- package/browser/errors/decorator.errors.mjs +16 -0
- package/browser/errors/elicitation.error.mjs +122 -0
- package/browser/errors/error-handler.mjs +91 -0
- package/browser/errors/esm.errors.mjs +88 -0
- package/browser/errors/external-entry.errors.mjs +68 -0
- package/browser/errors/index.mjs +414 -0
- package/browser/errors/job.errors.mjs +23 -0
- package/browser/errors/mcp.error.mjs +588 -0
- package/browser/errors/misconfiguration.mjs +53 -0
- package/browser/errors/mrtr.error.mjs +36 -0
- package/browser/errors/normalization.errors.mjs +34 -0
- package/browser/errors/plugin.errors.mjs +27 -0
- package/browser/errors/provider.errors.mjs +82 -0
- package/browser/errors/registry.errors.mjs +79 -0
- package/browser/errors/remote.errors.mjs +240 -0
- package/browser/errors/sdk.errors.mjs +180 -0
- package/browser/errors/session-identity-required.error.mjs +15 -0
- package/browser/errors/task.error.mjs +68 -0
- package/browser/errors/tool-call.error.mjs +15 -0
- package/browser/errors/tool-credentials-required.error.mjs +49 -0
- package/browser/errors/transport.errors.mjs +81 -0
- package/browser/errors/workflow.errors.mjs +28 -0
- package/browser/esm-loader/esm-auth.types.mjs +35 -0
- package/browser/esm-loader/esm-cache.mjs +270 -0
- package/browser/esm-loader/esm-entries.mjs +119 -0
- package/browser/esm-loader/esm-manifest.mjs +166 -0
- package/browser/esm-loader/esm-module-loader.mjs +224 -0
- package/browser/esm-loader/factories/esm-context-factories.mjs +34 -0
- package/browser/esm-loader/factories/esm-instance-factories.mjs +22 -0
- package/browser/esm-loader/factories/esm-record-builders.mjs +83 -0
- package/browser/esm-loader/factories/index.mjs +23 -0
- package/browser/esm-loader/index.mjs +73 -0
- package/browser/esm-loader/module-specifiers.mjs +172 -0
- package/browser/esm-loader/package-specifier.mjs +63 -0
- package/browser/esm-loader/semver.utils.mjs +37 -0
- package/browser/esm-loader/version-poller.mjs +150 -0
- package/browser/esm-loader/version-resolver.mjs +116 -0
- package/browser/ext-apps/ext-apps.handler.mjs +402 -0
- package/browser/ext-apps/ext-apps.types.mjs +24 -0
- package/browser/ext-apps/index.mjs +21 -0
- package/browser/flows/flow.http-path.mjs +43 -0
- package/browser/flows/flow.instance.mjs +478 -0
- package/browser/flows/flow.registry.mjs +147 -0
- package/browser/flows/flow.stages.mjs +88 -0
- package/browser/flows/flow.utils.mjs +30 -0
- package/browser/flows/resolved-entries.mjs +23 -0
- package/browser/front-mcp/authorities-engine.mjs +33 -0
- package/browser/front-mcp/authorities-rules.check.mjs +19 -0
- package/browser/front-mcp/direct-only.flag.mjs +13 -0
- package/browser/front-mcp/front-mcp.mjs +699 -0
- package/browser/front-mcp/front-mcp.providers.mjs +44 -0
- package/browser/front-mcp/front-mcp.tokens.mjs +5 -0
- package/browser/front-mcp/index.mjs +6 -0
- package/browser/front-mcp/serverless-handler.mjs +39 -0
- package/browser/front-mcp/shutdown-signals.mjs +32 -0
- package/browser/front-mcp/static-startup.check.mjs +181 -0
- package/browser/ha/ha-config.mjs +30 -0
- package/browser/ha/ha-headers.mjs +34 -0
- package/browser/ha/ha-manager.mjs +227 -0
- package/browser/ha/ha.constants.mjs +7 -0
- package/browser/ha/ha.types.mjs +13 -0
- package/browser/ha/heartbeat.service.mjs +95 -0
- package/browser/ha/index.mjs +25 -0
- package/browser/ha/notification-relay.mjs +74 -0
- package/browser/ha/relay-messages.mjs +7 -0
- package/browser/ha/session-takeover.mjs +42 -0
- package/browser/health/health.probes.mjs +72 -0
- package/browser/health/health.routes.mjs +38 -0
- package/browser/health/health.service.mjs +198 -0
- package/browser/health/index.mjs +13 -0
- package/browser/hooks/entry-class-hooks.mjs +39 -0
- package/browser/hooks/hook-coverage.mjs +33 -0
- package/browser/hooks/hook.instance.mjs +28 -0
- package/browser/hooks/hook.registry.mjs +178 -0
- package/browser/hooks/hooks.utils.mjs +91 -0
- package/browser/index.cjs +55575 -54583
- package/browser/index.mjs +191 -75307
- package/browser/job/enclave/index.mjs +7 -0
- package/browser/job/enclave/job-dynamic.executor.mjs +18 -0
- package/browser/job/enclave/job-enclave.bridge.mjs +105 -0
- package/browser/job/execution/index.mjs +5 -0
- package/browser/job/execution/job-execution.manager.mjs +308 -0
- package/browser/job/flows/execute-job.flow.mjs +246 -0
- package/browser/job/index.mjs +19 -0
- package/browser/job/job-attempt.mjs +53 -0
- package/browser/job/job-context-providers.mjs +26 -0
- package/browser/job/job-permission.guard.mjs +43 -0
- package/browser/job/job-scope.helper.mjs +107 -0
- package/browser/job/job.events.mjs +14 -0
- package/browser/job/job.instance.mjs +149 -0
- package/browser/job/job.registry.mjs +190 -0
- package/browser/job/job.utils.mjs +56 -0
- package/browser/job/store/index.mjs +17 -0
- package/browser/job/store/job-definition-store.factory.mjs +59 -0
- package/browser/job/store/job-definition.interface.mjs +0 -0
- package/browser/job/store/job-state-store.factory.mjs +28 -0
- package/browser/job/store/job-state.interface.mjs +0 -0
- package/browser/job/store/memory-job-definition.store.mjs +36 -0
- package/browser/job/store/memory-job-state.store.mjs +51 -0
- package/browser/job/store/redis-job-definition.store.mjs +100 -0
- package/browser/job/store/redis-job-state.store.mjs +93 -0
- package/browser/job/tools/execute-job.tool.mjs +57 -0
- package/browser/job/tools/get-job-status.tool.mjs +83 -0
- package/browser/job/tools/index.mjs +13 -0
- package/browser/job/tools/list-jobs.tool.mjs +80 -0
- package/browser/job/tools/register-job.tool.mjs +74 -0
- package/browser/job/tools/remove-job.tool.mjs +62 -0
- package/browser/logger/instances/instance.console-logger.mjs +78 -0
- package/browser/logger/instances/instance.file-logger.mjs +121 -0
- package/browser/logger/instances/instance.logger.mjs +80 -0
- package/browser/logger/logger.registry.mjs +136 -0
- package/browser/logger/logger.types.mjs +8 -0
- package/browser/logger/logger.utils.mjs +34 -0
- package/browser/logging/flows/set-level.flow.mjs +101 -0
- package/browser/mcp-registry/flows/index.mjs +9 -0
- package/browser/mcp-registry/flows/server-card.flow.mjs +136 -0
- package/browser/mcp-registry/flows/well-known.ai-catalog.flow.mjs +96 -0
- package/browser/mcp-registry/flows/well-known.mcp-registry-auth.flow.mjs +73 -0
- package/browser/mcp-registry/mcp-registry-scope.helper.mjs +15 -0
- package/browser/mcp-registry/mcp-registry.utils.mjs +34 -0
- package/browser/metrics/index.mjs +20 -0
- package/browser/metrics/metrics.errors.mjs +26 -0
- package/browser/metrics/metrics.routes.mjs +64 -0
- package/browser/metrics/metrics.service.mjs +121 -0
- package/browser/notification/index.mjs +25 -0
- package/browser/notification/notification.service.mjs +867 -0
- package/browser/plugin/enforced-metadata.check.mjs +90 -0
- package/browser/plugin/plugin.registry.mjs +273 -0
- package/browser/plugin/plugin.utils.mjs +107 -0
- package/browser/prompt/flows/get-prompt.flow.mjs +351 -0
- package/browser/prompt/flows/prompts-list.flow.mjs +269 -0
- package/browser/prompt/prompt.events.mjs +20 -0
- package/browser/prompt/prompt.instance.mjs +131 -0
- package/browser/prompt/prompt.registry.mjs +540 -0
- package/browser/prompt/prompt.types.mjs +10 -0
- package/browser/prompt/prompt.utils.mjs +94 -0
- package/browser/provider/flow-context-providers.mjs +30 -0
- package/browser/provider/provider.registry.mjs +994 -0
- package/browser/provider/provider.utils.mjs +108 -0
- package/browser/regsitry/index.mjs +2 -0
- package/browser/regsitry/registry.base.mjs +31 -0
- package/browser/remote-mcp/cache/capability-cache.mjs +131 -0
- package/browser/remote-mcp/cache/index.mjs +5 -0
- package/browser/remote-mcp/factories/context-factories.mjs +31 -0
- package/browser/remote-mcp/factories/index.mjs +31 -0
- package/browser/remote-mcp/factories/instance-factories.mjs +32 -0
- package/browser/remote-mcp/factories/record-builders.mjs +93 -0
- package/browser/remote-mcp/index.mjs +51 -0
- package/browser/remote-mcp/mcp-client.service.mjs +919 -0
- package/browser/remote-mcp/mcp-stateless-client.adapter.mjs +77 -0
- package/browser/remote-mcp/remote-entries.mjs +121 -0
- package/browser/remote-mcp/remote-request-headers.mjs +21 -0
- package/browser/remote-mcp/resilience/circuit-breaker.mjs +193 -0
- package/browser/remote-mcp/resilience/health-check.mjs +218 -0
- package/browser/remote-mcp/resilience/index.mjs +29 -0
- package/browser/remote-mcp/resilience/retry.mjs +80 -0
- package/browser/resource/flows/read-resource.flow.mjs +382 -0
- package/browser/resource/flows/resource-templates-list.flow.mjs +254 -0
- package/browser/resource/flows/resources-list.flow.mjs +272 -0
- package/browser/resource/flows/subscribe-resource.flow.mjs +132 -0
- package/browser/resource/flows/unsubscribe-resource.flow.mjs +102 -0
- package/browser/resource/resource.events.mjs +14 -0
- package/browser/resource/resource.instance.mjs +220 -0
- package/browser/resource/resource.registry.mjs +665 -0
- package/browser/resource/resource.types.mjs +10 -0
- package/browser/resource/resource.utils.mjs +157 -0
- package/browser/scope/flows/http.ip-filter.flow.mjs +45 -0
- package/browser/scope/flows/http.request.flow.mjs +872 -0
- package/browser/scope/flows/request-log.redaction.mjs +34 -0
- package/browser/scope/http-scope.helper.mjs +14 -0
- package/browser/scope/index.mjs +5 -0
- package/browser/scope/observability-scope.helper.mjs +131 -0
- package/browser/scope/optional-dependency.util.mjs +47 -0
- package/browser/scope/scope.instance.mjs +1478 -0
- package/browser/scope/scope.registry.mjs +121 -0
- package/browser/scope/scope.utils.mjs +61 -0
- package/browser/scope/server-entries.helper.mjs +20 -0
- package/browser/scope/startup-report.helper.mjs +16 -0
- package/browser/scope/tracer-provider.utils.mjs +14 -0
- package/browser/server/adapters/base.host.adapter.mjs +7 -0
- package/browser/server/custom-routes.helper.mjs +115 -0
- package/browser/server/middleware/cors-env.mjs +27 -0
- package/browser/server/middleware/csp.middleware.mjs +123 -0
- package/browser/server/noop-server.mjs +18 -0
- package/browser/server/security/host-validation.mjs +54 -0
- package/browser/server/security/resolve-allowed-hosts.mjs +75 -0
- package/browser/server/security/security-audit.mjs +148 -0
- package/browser/server/server.instance.mjs +173 -0
- package/browser/server/server.validation.mjs +169 -0
- package/browser/skill/auth/index.mjs +7 -0
- package/browser/skill/auth/skill-http-auth.mjs +209 -0
- package/browser/skill/cache/index.mjs +18 -0
- package/browser/skill/cache/skill-http-cache.factory.mjs +71 -0
- package/browser/skill/cache/skill-http-cache.holder.mjs +72 -0
- package/browser/skill/cache/skill-http-cache.mjs +150 -0
- package/browser/skill/errors/skill-validation.error.mjs +50 -0
- package/browser/skill/errors/tool-not-allowed.error.mjs +112 -0
- package/browser/skill/flows/filter-skills.flow.mjs +64 -0
- package/browser/skill/flows/http/index.mjs +9 -0
- package/browser/skill/flows/http/llm-full-txt.flow.mjs +174 -0
- package/browser/skill/flows/http/llm-txt.flow.mjs +173 -0
- package/browser/skill/flows/http/skills-api.flow.mjs +468 -0
- package/browser/skill/flows/index.mjs +13 -0
- package/browser/skill/flows/load-skill.flow.mjs +202 -0
- package/browser/skill/flows/search-skills.flow.mjs +149 -0
- package/browser/skill/guards/tool-authorization.guard.mjs +113 -0
- package/browser/skill/hooks/index.mjs +7 -0
- package/browser/skill/hooks/skill-tool.hook.mjs +100 -0
- package/browser/skill/index.mjs +213 -0
- package/browser/skill/providers/external-skill.provider.mjs +311 -0
- package/browser/skill/providers/memory-skill.provider.mjs +531 -0
- package/browser/skill/semantic/skill-semantic-search.interface.mjs +7 -0
- package/browser/skill/sep-2640/index.mjs +53 -0
- package/browser/skill/sep-2640/resources/index.mjs +13 -0
- package/browser/skill/sep-2640/resources/skill-file.resource.mjs +93 -0
- package/browser/skill/sep-2640/resources/skill-index.resource.mjs +78 -0
- package/browser/skill/sep-2640/resources/skill-md.resource.mjs +71 -0
- package/browser/skill/sep-2640/sep-2640.builders.mjs +97 -0
- package/browser/skill/sep-2640/sep-2640.constants.mjs +23 -0
- package/browser/skill/sep-2640/sep-2640.last-modified.mjs +18 -0
- package/browser/skill/sep-2640/sep-2640.per-skill.mjs +137 -0
- package/browser/skill/sep-2640/sep-2640.resource-helpers.mjs +230 -0
- package/browser/skill/sep-2640/sep-2640.uri.mjs +128 -0
- package/browser/skill/session/index.mjs +4 -0
- package/browser/skill/session/skill-session-store.interface.mjs +122 -0
- package/browser/skill/session/skill-session.manager.mjs +485 -0
- package/browser/skill/session/skill-session.types.mjs +73 -0
- package/browser/skill/skill-audit.helper.mjs +106 -0
- package/browser/skill/skill-authorities.helper.mjs +58 -0
- package/browser/skill/skill-directory-loader.mjs +154 -0
- package/browser/skill/skill-entry.resolver.mjs +35 -0
- package/browser/skill/skill-filter.helper.mjs +68 -0
- package/browser/skill/skill-http.utils.mjs +170 -0
- package/browser/skill/skill-instructions.helper.mjs +148 -0
- package/browser/skill/skill-md-parser.mjs +176 -0
- package/browser/skill/skill-mode.utils.mjs +25 -0
- package/browser/skill/skill-scope.helper.mjs +69 -0
- package/browser/skill/skill-storage.factory.mjs +86 -0
- package/browser/skill/skill-validator.mjs +100 -0
- package/browser/skill/skill.events.mjs +43 -0
- package/browser/skill/skill.instance.mjs +310 -0
- package/browser/skill/skill.registry.mjs +1258 -0
- package/browser/skill/skill.utils.mjs +379 -0
- package/browser/skill/sync/index.mjs +13 -0
- package/browser/skill/sync/memory-sync-state.store.mjs +51 -0
- package/browser/skill/sync/skill-hash.mjs +43 -0
- package/browser/skill/sync/sync-state.interface.mjs +27 -0
- package/browser/task/flows/tasks-cancel.flow.mjs +124 -0
- package/browser/task/flows/tasks-get.flow.mjs +89 -0
- package/browser/task/flows/tasks-list.flow.mjs +86 -0
- package/browser/task/flows/tasks-result.flow.mjs +190 -0
- package/browser/task/helpers/cli-task-runner.mjs +126 -0
- package/browser/task/helpers/in-process-task-runner.mjs +30 -0
- package/browser/task/helpers/process-liveness.mjs +20 -0
- package/browser/task/helpers/task-id.mjs +8 -0
- package/browser/task/helpers/task-notifier.mjs +30 -0
- package/browser/task/helpers/task-runner.mjs +128 -0
- package/browser/task/index.mjs +38 -0
- package/browser/task/runtime/execute-task-flag.mjs +10 -0
- package/browser/task/runtime/execute-task.mjs +142 -0
- package/browser/task/store/index.mjs +15 -0
- package/browser/task/store/storage-task.store.mjs +358 -0
- package/browser/task/store/task-backend.utils.mjs +14 -0
- package/browser/task/store/task-store.factory.mjs +122 -0
- package/browser/task/task-scope.helper.mjs +14 -0
- package/browser/task/task.registry.mjs +76 -0
- package/browser/task/task.types.mjs +33 -0
- package/browser/tool/flows/call-tool.flow.mjs +1134 -0
- package/browser/tool/flows/tool-credentials.gate.mjs +57 -0
- package/browser/tool/flows/tools-list.flow.mjs +503 -0
- package/browser/tool/tool-external.loader.mjs +13 -0
- package/browser/tool/tool.events.mjs +14 -0
- package/browser/tool/tool.instance.mjs +157 -0
- package/browser/tool/tool.registry.mjs +615 -0
- package/browser/tool/tool.types.mjs +10 -0
- package/browser/tool/tool.utils.mjs +365 -0
- package/browser/tool/ui/serving-mode-default.mjs +14 -0
- package/browser/tool/ui/template-detection.mjs +40 -0
- package/browser/tool/ui/template-helpers.mjs +44 -0
- package/browser/tool/ui/ui-option-warnings.mjs +67 -0
- package/browser/tool/ui/ui-render.mjs +60 -0
- package/browser/tool/ui/ui-resource-template.mjs +29 -0
- package/browser/tool/ui/ui-resource.handler.mjs +86 -0
- package/browser/tool/ui/ui-shared.mjs +239 -0
- package/browser/transport/adapters/polyfills/browser-sse-transport.mjs +9 -0
- package/browser/transport/adapters/sse-transport.mjs +70 -0
- package/browser/transport/adapters/streamable-http-transport.mjs +134 -0
- package/browser/transport/adapters/transport.local.adapter.mjs +380 -0
- package/browser/transport/adapters/transport.sse.adapter.mjs +167 -0
- package/browser/transport/adapters/transport.streamable-http.adapter.mjs +228 -0
- package/browser/transport/build-scoped-server-options.mjs +61 -0
- package/browser/transport/bus/index.mjs +5 -0
- package/browser/transport/bus/redis-transport-bus.mjs +164 -0
- package/browser/transport/event-stores/event-store.factory.mjs +79 -0
- package/browser/transport/event-stores/index.mjs +11 -0
- package/browser/transport/event-stores/memory.event-store.mjs +112 -0
- package/browser/transport/event-stores/redis.event-store.mjs +153 -0
- package/browser/transport/event-stores/session-scoped.event-store.mjs +40 -0
- package/browser/transport/flow-error-output.mjs +40 -0
- package/browser/transport/flows/handle.mcp-20260728.flow.mjs +395 -0
- package/browser/transport/flows/handle.sse.flow.mjs +216 -0
- package/browser/transport/flows/handle.stateless-http.flow.mjs +132 -0
- package/browser/transport/flows/handle.streamable-http.flow.mjs +613 -0
- package/browser/transport/in-memory-server.mjs +96 -0
- package/browser/transport/index.mjs +32 -0
- package/browser/transport/ipc-server.transport.mjs +48 -0
- package/browser/transport/mcp-20260728/client/header-params.mjs +75 -0
- package/browser/transport/mcp-20260728/client/index.mjs +3 -0
- package/browser/transport/mcp-20260728/client/mcp-stateless.client.mjs +368 -0
- package/browser/transport/mcp-20260728/discover.mjs +31 -0
- package/browser/transport/mcp-20260728/dispatcher.mjs +257 -0
- package/browser/transport/mcp-20260728/header-codec.mjs +48 -0
- package/browser/transport/mcp-20260728/index.mjs +13 -0
- package/browser/transport/mcp-20260728/mrtr.mjs +129 -0
- package/browser/transport/mcp-20260728/protocol-20260728.constants.mjs +47 -0
- package/browser/transport/mcp-20260728/request-notifications.mjs +86 -0
- package/browser/transport/mcp-20260728/request-state.mjs +111 -0
- package/browser/transport/mcp-20260728/request-validation.mjs +212 -0
- package/browser/transport/mcp-20260728/result-decorator.mjs +64 -0
- package/browser/transport/mcp-20260728/subscriptions.mjs +130 -0
- package/browser/transport/mcp-20260728/tasks-extension.mjs +118 -0
- package/browser/transport/mcp-handlers/Initialized-notification.hanlder.mjs +13 -0
- package/browser/transport/mcp-handlers/call-tool-error.utils.mjs +47 -0
- package/browser/transport/mcp-handlers/call-tool-request.handler.mjs +30 -0
- package/browser/transport/mcp-handlers/complete-request.handler.mjs +31 -0
- package/browser/transport/mcp-handlers/get-prompt-request.handler.mjs +33 -0
- package/browser/transport/mcp-handlers/index.mjs +62 -0
- package/browser/transport/mcp-handlers/initialize-request.handler.mjs +144 -0
- package/browser/transport/mcp-handlers/list-prompts-request.handler.mjs +31 -0
- package/browser/transport/mcp-handlers/list-resource-templates-request.handler.mjs +33 -0
- package/browser/transport/mcp-handlers/list-resources-request.handler.mjs +31 -0
- package/browser/transport/mcp-handlers/list-tools-request.handler.mjs +28 -0
- package/browser/transport/mcp-handlers/logging-set-level-request.handler.mjs +19 -0
- package/browser/transport/mcp-handlers/mcp-error.utils.mjs +42 -0
- package/browser/transport/mcp-handlers/mcp-surface.mjs +16 -0
- package/browser/transport/mcp-handlers/read-resource-request.handler.mjs +36 -0
- package/browser/transport/mcp-handlers/roots-list-changed-notification.handler.mjs +19 -0
- package/browser/transport/mcp-handlers/skills-list-request.handler.mjs +64 -0
- package/browser/transport/mcp-handlers/skills-load-request.handler.mjs +27 -0
- package/browser/transport/mcp-handlers/skills-mcp.types.mjs +113 -0
- package/browser/transport/mcp-handlers/skills-search-request.handler.mjs +27 -0
- package/browser/transport/mcp-handlers/subscribe-request.handler.mjs +19 -0
- package/browser/transport/mcp-handlers/tasks-cancel-request.handler.mjs +24 -0
- package/browser/transport/mcp-handlers/tasks-get-request.handler.mjs +24 -0
- package/browser/transport/mcp-handlers/tasks-list-request.handler.mjs +24 -0
- package/browser/transport/mcp-handlers/tasks-result-request.handler.mjs +24 -0
- package/browser/transport/mcp-handlers/unsubscribe-request.handler.mjs +19 -0
- package/browser/transport/persistent-session-owner.mjs +27 -0
- package/browser/transport/relay/relay-flow.mjs +28 -0
- package/browser/transport/relay/relay-http.mjs +343 -0
- package/browser/transport/relay/relay-scope.helper.mjs +89 -0
- package/browser/transport/relay/session-relay.mjs +276 -0
- package/browser/transport/session-mode.check.mjs +38 -0
- package/browser/transport/transport.error.mjs +25 -0
- package/browser/transport/transport.local.mjs +80 -0
- package/browser/transport/transport.registry.mjs +1038 -0
- package/browser/transport/transport.remote.mjs +57 -0
- package/browser/transport/transport.types.mjs +5 -0
- package/browser/transport/web-fetch-handler.mjs +408 -0
- package/browser/transport/web-http-route.mjs +70 -0
- package/browser/transport/web-response.renderer.mjs +93 -0
- package/browser/transport/web-standard-mcp.mjs +72 -0
- package/browser/utils/content.utils.mjs +61 -0
- package/browser/utils/dynamic-import.utils.mjs +15 -0
- package/browser/utils/index.mjs +24 -0
- package/browser/utils/lineage.utils.mjs +75 -0
- package/browser/utils/naming.utils.mjs +30 -0
- package/browser/workflow/engine/index.mjs +7 -0
- package/browser/workflow/engine/workflow-step.executor.mjs +75 -0
- package/browser/workflow/engine/workflow.engine.mjs +180 -0
- package/browser/workflow/index.mjs +11 -0
- package/browser/workflow/tools/execute-workflow.tool.mjs +58 -0
- package/browser/workflow/tools/get-workflow-status.tool.mjs +80 -0
- package/browser/workflow/tools/index.mjs +13 -0
- package/browser/workflow/tools/list-workflows.tool.mjs +75 -0
- package/browser/workflow/tools/register-workflow.tool.mjs +81 -0
- package/browser/workflow/tools/remove-workflow.tool.mjs +62 -0
- package/browser/workflow/workflow.events.mjs +14 -0
- package/browser/workflow/workflow.instance.mjs +29 -0
- package/browser/workflow/workflow.registry.mjs +171 -0
- package/browser/workflow/workflow.utils.mjs +39 -0
- package/channel/channel-notification.service.d.ts +0 -5
- package/channel/channel-notification.service.d.ts.map +1 -1
- package/channel/channel.utils.d.ts +6 -1
- package/channel/channel.utils.d.ts.map +1 -1
- package/common/decorators/front-mcp.decorator.d.ts.map +1 -1
- package/common/interfaces/agent.interface.d.ts +1 -1
- package/common/interfaces/agent.interface.d.ts.map +1 -1
- package/common/interfaces/tool.interface.d.ts +2 -1
- package/common/interfaces/tool.interface.d.ts.map +1 -1
- package/common/metadata/agent.metadata.d.ts +2 -2
- package/common/metadata/app.metadata.d.ts +2 -2
- package/common/metadata/channel.metadata.d.ts +2 -2
- package/common/metadata/front-mcp.metadata.d.ts +162 -28
- package/common/metadata/front-mcp.metadata.d.ts.map +1 -1
- package/common/metadata/plugin.metadata.d.ts +2 -2
- package/common/metadata/workflow.metadata.d.ts +1 -1
- package/common/tokens/front-mcp.tokens.d.ts.map +1 -1
- package/common/types/options/index.d.ts +1 -0
- package/common/types/options/index.d.ts.map +1 -1
- package/common/types/options/registry/index.d.ts +5 -0
- package/common/types/options/registry/index.d.ts.map +1 -0
- package/common/types/options/registry/interfaces.d.ts +40 -0
- package/common/types/options/registry/interfaces.d.ts.map +1 -0
- package/common/types/options/registry/schema.d.ts +30 -0
- package/common/types/options/registry/schema.d.ts.map +1 -0
- package/common/types/options/registry/typecheck.d.ts +2 -0
- package/common/types/options/registry/typecheck.d.ts.map +1 -0
- package/common/types/options/registry/utils.d.ts +5 -0
- package/common/types/options/registry/utils.d.ts.map +1 -0
- package/common/types/options/skills-http/schema.d.ts +2 -2
- package/elicitation/send-elicitation-result.tool.d.ts +1 -4
- package/elicitation/send-elicitation-result.tool.d.ts.map +1 -1
- package/elicitation/send-elicitation-result.utils.d.ts +5 -0
- package/elicitation/send-elicitation-result.utils.d.ts.map +1 -0
- package/esm/index.mjs +52047 -51061
- package/front-mcp/authorities-engine.d.ts +10 -0
- package/front-mcp/authorities-engine.d.ts.map +1 -0
- package/front-mcp/authorities-rules.check.d.ts +1 -3
- package/front-mcp/authorities-rules.check.d.ts.map +1 -1
- package/front-mcp/direct-only.flag.d.ts +6 -0
- package/front-mcp/direct-only.flag.d.ts.map +1 -0
- package/front-mcp/front-mcp.d.ts +1 -1
- package/front-mcp/front-mcp.d.ts.map +1 -1
- package/front-mcp/static-startup.check.d.ts.map +1 -1
- package/health/health.service.d.ts +1 -1
- package/health/health.service.d.ts.map +1 -1
- package/index.d.ts +55 -52
- package/index.d.ts.map +1 -1
- package/index.js +50925 -49933
- package/job/store/job-definition-store.factory.d.ts.map +1 -1
- package/job/store/job-state-store.factory.d.ts.map +1 -1
- package/job/store/redis-job-state.store.d.ts +2 -2
- package/job/store/redis-job-state.store.d.ts.map +1 -1
- package/mcp-registry/flows/index.d.ts +4 -0
- package/mcp-registry/flows/index.d.ts.map +1 -0
- package/mcp-registry/flows/server-card.flow.d.ts +93 -0
- package/mcp-registry/flows/server-card.flow.d.ts.map +1 -0
- package/mcp-registry/flows/well-known.ai-catalog.flow.d.ts +69 -0
- package/mcp-registry/flows/well-known.ai-catalog.flow.d.ts.map +1 -0
- package/mcp-registry/flows/well-known.mcp-registry-auth.flow.d.ts +48 -0
- package/mcp-registry/flows/well-known.mcp-registry-auth.flow.d.ts.map +1 -0
- package/mcp-registry/mcp-registry-scope.helper.d.ts +11 -0
- package/mcp-registry/mcp-registry-scope.helper.d.ts.map +1 -0
- package/mcp-registry/mcp-registry.utils.d.ts +7 -0
- package/mcp-registry/mcp-registry.utils.d.ts.map +1 -0
- package/package.json +10 -10
- package/prompt/prompt.registry.d.ts.map +1 -1
- package/resource/flows/read-resource.flow.d.ts.map +1 -1
- package/resource/resource.registry.d.ts.map +1 -1
- package/scope/http-scope.helper.d.ts +7 -0
- package/scope/http-scope.helper.d.ts.map +1 -0
- package/scope/observability-scope.helper.d.ts +11 -0
- package/scope/observability-scope.helper.d.ts.map +1 -0
- package/scope/scope.instance.d.ts +15 -10
- package/scope/scope.instance.d.ts.map +1 -1
- package/server/adapters/express.host.adapter.d.ts +2 -0
- package/server/adapters/express.host.adapter.d.ts.map +1 -1
- package/server/custom-routes.helper.d.ts +1 -1
- package/server/custom-routes.helper.d.ts.map +1 -1
- package/server/server.instance.d.ts.map +1 -1
- package/skill/flows/http/skills-api.flow.d.ts.map +1 -1
- package/skill/skill-scope.helper.d.ts.map +1 -1
- package/skill/skill.registry.d.ts +13 -4
- package/skill/skill.registry.d.ts.map +1 -1
- package/skill/skill.utils.d.ts.map +1 -1
- package/task/store/task-backend.utils.d.ts +11 -0
- package/task/store/task-backend.utils.d.ts.map +1 -0
- package/task/store/task-store.factory.d.ts +1 -6
- package/task/store/task-store.factory.d.ts.map +1 -1
- package/tool/flows/call-tool.flow.d.ts +1 -1
- package/tool/flows/call-tool.flow.d.ts.map +1 -1
- package/tool/flows/tools-list.flow.d.ts +3 -1
- package/tool/flows/tools-list.flow.d.ts.map +1 -1
- package/tool/tool-external.loader.d.ts.map +1 -1
- package/tool/ui/index.d.ts +3 -3
- package/tool/ui/index.d.ts.map +1 -1
- package/tool/ui/template-detection.d.ts +8 -0
- package/tool/ui/template-detection.d.ts.map +1 -0
- package/tool/ui/ui-render.d.ts +21 -0
- package/tool/ui/ui-render.d.ts.map +1 -0
- package/tool/ui/ui-resource.handler.d.ts.map +1 -1
- package/tool/ui/ui-shared.d.ts +9 -3
- package/tool/ui/ui-shared.d.ts.map +1 -1
- package/transport/adapters/transport.sse.adapter.d.ts +1 -1
- package/transport/adapters/transport.sse.adapter.d.ts.map +1 -1
- package/transport/event-stores/event-store.factory.d.ts.map +1 -1
- package/transport/mcp-handlers/index.d.ts +557 -557
- package/transport/mcp-handlers/index.d.ts.map +1 -1
- package/transport/web-fetch-handler.d.ts.map +1 -1
|
@@ -0,0 +1,1053 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
4
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
5
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
6
|
+
if (decorator = decorators[i])
|
|
7
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
8
|
+
if (kind && result) __defProp(target, key, result);
|
|
9
|
+
return result;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
// libs/sdk/src/auth/flows/oauth.authorize.flow.ts
|
|
13
|
+
import {
|
|
14
|
+
buildFederatedLoginPage,
|
|
15
|
+
buildIncrementalAuthPage,
|
|
16
|
+
builtInAuthPageHeaders,
|
|
17
|
+
createFederatedAuthSession,
|
|
18
|
+
escapeHtml,
|
|
19
|
+
grantScopes,
|
|
20
|
+
isLoopbackRedirectUri,
|
|
21
|
+
renderLocalLoginPage,
|
|
22
|
+
startNextProvider,
|
|
23
|
+
verifyIncrementalAuthTicket
|
|
24
|
+
} from "@frontmcp/auth";
|
|
25
|
+
import { z } from "@frontmcp/lazy-zod";
|
|
26
|
+
import { generateCodeVerifier, randomUUID, sha256Base64url } from "@frontmcp/utils";
|
|
27
|
+
import {
|
|
28
|
+
computeResource,
|
|
29
|
+
enforceGlobalRateLimit,
|
|
30
|
+
enforceIpFilter,
|
|
31
|
+
Flow,
|
|
32
|
+
FlowBase,
|
|
33
|
+
HttpHtmlSchema,
|
|
34
|
+
httpInputSchema,
|
|
35
|
+
HttpRedirectSchema,
|
|
36
|
+
httpRespond,
|
|
37
|
+
HttpTextSchema,
|
|
38
|
+
isOrchestratedMode,
|
|
39
|
+
isPublicMode,
|
|
40
|
+
isRemoteMode,
|
|
41
|
+
resourceUriMatches,
|
|
42
|
+
StageHookOf
|
|
43
|
+
} from "../../common/index.mjs";
|
|
44
|
+
import {
|
|
45
|
+
authUiExtraPath,
|
|
46
|
+
buildAuthUiPage,
|
|
47
|
+
buildFederatedState,
|
|
48
|
+
buildIncrementalState,
|
|
49
|
+
buildLoginState
|
|
50
|
+
} from "../auth-ui/index.mjs";
|
|
51
|
+
import { CimdDisabledError, CimdService, clientMetadataDocumentSchema } from "../cimd/index.mjs";
|
|
52
|
+
import { projectConsentTools } from "../consent-tools.helper.mjs";
|
|
53
|
+
import { createRequestSigninBinding, signinBindingCookie, signinCookiePath, withCookie } from "./signin-binding.utils.mjs";
|
|
54
|
+
var pkceChallengeSchema = z.string().min(43, "code_challenge must be at least 43 characters").max(128, "code_challenge must be at most 128 characters").regex(/^[A-Za-z0-9_-]+$/, "code_challenge must contain only A-Za-z0-9-_");
|
|
55
|
+
var codeChallengeMethodSchema = z.literal("S256", {
|
|
56
|
+
message: 'code_challenge_method must be "S256" (OAuth 2.1)'
|
|
57
|
+
});
|
|
58
|
+
var responseTypeSchema = z.literal("code", {
|
|
59
|
+
message: 'response_type must be "code" (OAuth 2.1)'
|
|
60
|
+
});
|
|
61
|
+
var safeRedirectUriSchema = z.url().refine(
|
|
62
|
+
(uri) => {
|
|
63
|
+
try {
|
|
64
|
+
const url = new URL(uri);
|
|
65
|
+
return url.protocol === "http:" || url.protocol === "https:";
|
|
66
|
+
} catch {
|
|
67
|
+
return false;
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
{ message: "redirect_uri must use http or https scheme" }
|
|
71
|
+
);
|
|
72
|
+
var oauthAuthorizeRequestSchema = z.object({
|
|
73
|
+
response_type: responseTypeSchema,
|
|
74
|
+
client_id: z.string().min(1, "client_id is required"),
|
|
75
|
+
redirect_uri: safeRedirectUriSchema,
|
|
76
|
+
code_challenge: pkceChallengeSchema,
|
|
77
|
+
code_challenge_method: codeChallengeMethodSchema.optional().default("S256"),
|
|
78
|
+
scope: z.string().optional(),
|
|
79
|
+
state: z.string().optional(),
|
|
80
|
+
resource: z.string().url().optional()
|
|
81
|
+
});
|
|
82
|
+
var anonymousAuthorizeRequestSchema = z.object({
|
|
83
|
+
redirect_uri: safeRedirectUriSchema,
|
|
84
|
+
state: z.string().optional()
|
|
85
|
+
});
|
|
86
|
+
var inputSchema = httpInputSchema;
|
|
87
|
+
var stateSchema = z.object({
|
|
88
|
+
isDefaultAuthProvider: z.boolean().describe("No sign-in to run: no auth options, or public mode (the same configuration, written out)"),
|
|
89
|
+
isOrchestrated: z.boolean().describe("If FrontMcp is orchestrated (local oauth proxy, remote oauth proxy)"),
|
|
90
|
+
allowAnonymous: z.boolean().describe("Allow anonymous access, force orchestrated mode"),
|
|
91
|
+
// Validated OAuth request (after validation)
|
|
92
|
+
validatedRequest: oauthAuthorizeRequestSchema.optional(),
|
|
93
|
+
// Raw parameters for error handling
|
|
94
|
+
rawRedirectUri: z.string().optional(),
|
|
95
|
+
rawState: z.string().optional(),
|
|
96
|
+
// Validation errors
|
|
97
|
+
validationErrors: z.array(z.string()).optional(),
|
|
98
|
+
// Pending authorization ID (for login flow)
|
|
99
|
+
pendingAuthId: z.string().optional(),
|
|
100
|
+
// Progressive/Incremental Authorization
|
|
101
|
+
isIncrementalAuth: z.boolean().default(false).describe("Whether this is an incremental auth request"),
|
|
102
|
+
targetAppId: z.string().optional().describe("Target app ID for incremental authorization"),
|
|
103
|
+
targetToolId: z.string().optional().describe("Target tool ID that triggered the incremental auth"),
|
|
104
|
+
existingSessionId: z.string().optional().describe("Existing session ID for incremental auth"),
|
|
105
|
+
/**
|
|
106
|
+
* The VERIFIED incremental-authorization ticket (GHSA-2c4g-9c8x-6m8g). Set
|
|
107
|
+
* only when `?ticket=` carried a valid, unexpired server signature. Its `sub`
|
|
108
|
+
* is the proven identity the expanded grant is minted for; `isIncrementalAuth`
|
|
109
|
+
* is derived from its presence, never from a raw query parameter.
|
|
110
|
+
*/
|
|
111
|
+
incrementalTicket: z.custom().optional(),
|
|
112
|
+
/**
|
|
113
|
+
* Apps the client already holds a grant for (the prior `authorized_apps`
|
|
114
|
+
* claim), carried forward on an incremental authorize so the newly-minted
|
|
115
|
+
* token is the UNION of prior apps + the target app. Only consulted when
|
|
116
|
+
* incremental auth is enabled.
|
|
117
|
+
*/
|
|
118
|
+
priorAuthorizedAppIds: z.array(z.string()).optional().describe("Prior authorized app IDs to carry forward"),
|
|
119
|
+
// Federated Login (multi-provider)
|
|
120
|
+
requiresFederatedLogin: z.boolean().default(false).describe("Whether this auth requires federated login UI"),
|
|
121
|
+
// Consent Flow
|
|
122
|
+
requiresConsent: z.boolean().default(false).describe("Whether consent flow is enabled"),
|
|
123
|
+
// CIMD (Client ID Metadata Documents)
|
|
124
|
+
isCimdClient: z.boolean().default(false).describe("Whether client_id is a CIMD URL"),
|
|
125
|
+
cimdMetadata: clientMetadataDocumentSchema.optional().describe("CIMD metadata document for the client")
|
|
126
|
+
});
|
|
127
|
+
var outputSchema = z.union([
|
|
128
|
+
HttpRedirectSchema,
|
|
129
|
+
// for account/login or oauth/callback
|
|
130
|
+
HttpTextSchema,
|
|
131
|
+
HttpHtmlSchema
|
|
132
|
+
// for login page
|
|
133
|
+
]);
|
|
134
|
+
var plan = {
|
|
135
|
+
pre: [
|
|
136
|
+
"checkIpFilter",
|
|
137
|
+
"acquireQuota",
|
|
138
|
+
"parseInput",
|
|
139
|
+
"validateInput",
|
|
140
|
+
"checkIfAuthorized"
|
|
141
|
+
// used for direct code generation if refresh-token is provided
|
|
142
|
+
],
|
|
143
|
+
execute: ["prepareAuthorizationRequest", "buildAuthorizeOutput"],
|
|
144
|
+
post: ["validateOutput"]
|
|
145
|
+
};
|
|
146
|
+
var name = "oauth:authorize";
|
|
147
|
+
var Stage = StageHookOf(name);
|
|
148
|
+
function getConfiguredProviders(auth) {
|
|
149
|
+
const providers = auth?.providers;
|
|
150
|
+
if (!Array.isArray(providers)) {
|
|
151
|
+
return [];
|
|
152
|
+
}
|
|
153
|
+
return providers.filter(
|
|
154
|
+
(p) => !!p && typeof p.id === "string"
|
|
155
|
+
);
|
|
156
|
+
}
|
|
157
|
+
function getConfiguredProviderIds(auth) {
|
|
158
|
+
return getConfiguredProviders(auth).map((p) => p.id);
|
|
159
|
+
}
|
|
160
|
+
var OauthAuthorizeFlow = class extends FlowBase {
|
|
161
|
+
/**
|
|
162
|
+
* The issuer identifier to advertise on an authorization response (RFC 9207).
|
|
163
|
+
*
|
|
164
|
+
* Returns `undefined` when the configured auth instance has no issuer, so the
|
|
165
|
+
* parameter is simply omitted rather than emitted empty — a client validating
|
|
166
|
+
* `iss` treats absence as "not supported" and proceeds.
|
|
167
|
+
*
|
|
168
|
+
* With `request`, the issuer the tokens redeemed for this request name
|
|
169
|
+
* (`LocalPrimaryAuth.issuerFor`); without it, the boot-time issuer.
|
|
170
|
+
*/
|
|
171
|
+
resolveIssuer(request) {
|
|
172
|
+
const auth = this.scope.auth;
|
|
173
|
+
const issuer = request && auth?.issuerFor ? auth.issuerFor(request) : auth?.issuer;
|
|
174
|
+
return typeof issuer === "string" && issuer.length > 0 ? issuer : void 0;
|
|
175
|
+
}
|
|
176
|
+
logger = this.scope.logger.child("OauthAuthorizeFlow");
|
|
177
|
+
/** The sign-in binding cookie, once the pending authorization exists (see `prepareAuthorizationRequest`). */
|
|
178
|
+
signinCookie;
|
|
179
|
+
/** Its hash, kept on the pending authorization and on remote mode's federated session. */
|
|
180
|
+
signinBindingHash;
|
|
181
|
+
/**
|
|
182
|
+
* Respond, giving the browser the sign-in binding cookie once a pending
|
|
183
|
+
* authorization was created: the sign-in page, the provider-selection and
|
|
184
|
+
* incremental pages, a custom `auth.ui` page and remote mode's redirect to the
|
|
185
|
+
* upstream provider all carry it.
|
|
186
|
+
*/
|
|
187
|
+
respond(output) {
|
|
188
|
+
super.respond(this.signinCookie ? withCookie(output, this.signinCookie) : output);
|
|
189
|
+
}
|
|
190
|
+
async checkIpFilter() {
|
|
191
|
+
enforceIpFilter(this.scope, this.tryGetContext()?.metadata.clientIp);
|
|
192
|
+
}
|
|
193
|
+
async acquireQuota() {
|
|
194
|
+
await enforceGlobalRateLimit(this.scope, this.tryGetContext());
|
|
195
|
+
}
|
|
196
|
+
async parseInput() {
|
|
197
|
+
const { metadata } = this.scope;
|
|
198
|
+
const { request } = this.rawInput;
|
|
199
|
+
const rawRedirectUri = request.query["redirect_uri"];
|
|
200
|
+
const rawState = request.query["state"];
|
|
201
|
+
const incrementalTicket = this.verifyIncrementalTicket(request.query["ticket"]);
|
|
202
|
+
const isIncrementalAuth = incrementalTicket !== void 0;
|
|
203
|
+
const targetAppId = incrementalTicket?.appId;
|
|
204
|
+
const targetToolId = incrementalTicket?.toolId;
|
|
205
|
+
let priorAuthorizedAppIds;
|
|
206
|
+
if (incrementalTicket) {
|
|
207
|
+
priorAuthorizedAppIds = incrementalTicket.priorAppIds && incrementalTicket.priorAppIds.length > 0 ? Array.from(new Set(incrementalTicket.priorAppIds)) : void 0;
|
|
208
|
+
} else {
|
|
209
|
+
const appsParam = request.query["apps"];
|
|
210
|
+
if (appsParam) {
|
|
211
|
+
const ids = (Array.isArray(appsParam) ? appsParam : [appsParam]).flatMap((v) => String(v).split(",")).map((v) => v.trim()).filter(Boolean);
|
|
212
|
+
priorAuthorizedAppIds = ids.length > 0 ? Array.from(new Set(ids)) : void 0;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
const existingSessionId = request.query["session_id"];
|
|
216
|
+
const isDefaultAuthProvider = !metadata.auth || isPublicMode(metadata.auth);
|
|
217
|
+
let requiresFederatedLogin = false;
|
|
218
|
+
if (metadata.auth && isOrchestratedMode(metadata.auth)) {
|
|
219
|
+
const configProviders = getConfiguredProviderIds(metadata.auth);
|
|
220
|
+
const apps = this.scope.apps.getApps();
|
|
221
|
+
const appsWithAuth = apps.filter((app) => app.metadata.auth);
|
|
222
|
+
requiresFederatedLogin = configProviders.length > 0 || appsWithAuth.length > 0;
|
|
223
|
+
}
|
|
224
|
+
let requiresConsent = false;
|
|
225
|
+
if (metadata.auth && isOrchestratedMode(metadata.auth)) {
|
|
226
|
+
const consentConfig = metadata.auth.consent;
|
|
227
|
+
requiresConsent = consentConfig?.enabled === true;
|
|
228
|
+
}
|
|
229
|
+
this.state.set({
|
|
230
|
+
isOrchestrated: true,
|
|
231
|
+
allowAnonymous: isDefaultAuthProvider,
|
|
232
|
+
isDefaultAuthProvider,
|
|
233
|
+
rawRedirectUri,
|
|
234
|
+
rawState,
|
|
235
|
+
// Progressive/Incremental Authorization
|
|
236
|
+
isIncrementalAuth,
|
|
237
|
+
targetAppId,
|
|
238
|
+
targetToolId,
|
|
239
|
+
existingSessionId,
|
|
240
|
+
priorAuthorizedAppIds,
|
|
241
|
+
incrementalTicket,
|
|
242
|
+
// Federated Login
|
|
243
|
+
requiresFederatedLogin,
|
|
244
|
+
// Consent Flow
|
|
245
|
+
requiresConsent
|
|
246
|
+
});
|
|
247
|
+
if (isIncrementalAuth) {
|
|
248
|
+
this.logger.info(`Incremental authorization requested for app: ${targetAppId}, tool: ${targetToolId}`);
|
|
249
|
+
}
|
|
250
|
+
if (requiresFederatedLogin) {
|
|
251
|
+
this.logger.info(`Federated login required: Multiple auth providers detected`);
|
|
252
|
+
}
|
|
253
|
+
if (requiresConsent) {
|
|
254
|
+
this.logger.info(`Consent flow enabled: User will select tools to expose`);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
async validateInput() {
|
|
258
|
+
const { isDefaultAuthProvider, rawRedirectUri, rawState } = this.state;
|
|
259
|
+
const { request } = this.rawInput;
|
|
260
|
+
if (isDefaultAuthProvider) {
|
|
261
|
+
const result2 = anonymousAuthorizeRequestSchema.safeParse({
|
|
262
|
+
redirect_uri: rawRedirectUri,
|
|
263
|
+
state: rawState
|
|
264
|
+
});
|
|
265
|
+
if (!result2.success) {
|
|
266
|
+
const errors = this.formatZodErrors(result2.error);
|
|
267
|
+
this.logger.warn(`Anonymous authorization request validation failed: ${errors.join(", ")}`);
|
|
268
|
+
this.respond(this.htmlPage(this.renderErrorPage("invalid_request", errors.join("; ")), 400));
|
|
269
|
+
return;
|
|
270
|
+
}
|
|
271
|
+
if (!isLoopbackRedirectUri(result2.data.redirect_uri)) {
|
|
272
|
+
this.logger.warn("Anonymous authorization request with a non-loopback redirect_uri refused");
|
|
273
|
+
this.respond(
|
|
274
|
+
this.htmlPage(
|
|
275
|
+
this.renderErrorPage(
|
|
276
|
+
"invalid_request",
|
|
277
|
+
"This server has no authorization configured; only a loopback redirect_uri is accepted"
|
|
278
|
+
),
|
|
279
|
+
400
|
|
280
|
+
)
|
|
281
|
+
);
|
|
282
|
+
return;
|
|
283
|
+
}
|
|
284
|
+
const url = new URL(result2.data.redirect_uri);
|
|
285
|
+
url.searchParams.set("code", "anonymous");
|
|
286
|
+
if (result2.data.state) {
|
|
287
|
+
url.searchParams.set("state", result2.data.state);
|
|
288
|
+
}
|
|
289
|
+
const issuer = this.resolveIssuer(this.rawInput.request);
|
|
290
|
+
if (issuer) url.searchParams.set("iss", issuer);
|
|
291
|
+
this.respond(httpRespond.redirect(url.toString()));
|
|
292
|
+
return;
|
|
293
|
+
}
|
|
294
|
+
const authConfig = this.scope.metadata.auth;
|
|
295
|
+
if (!authConfig || !isOrchestratedMode(authConfig)) {
|
|
296
|
+
const mode = authConfig?.mode ?? "public";
|
|
297
|
+
this.logger.warn(`Authorization request refused: auth mode ${mode} does not sign users in`);
|
|
298
|
+
this.respond(
|
|
299
|
+
this.htmlPage(
|
|
300
|
+
this.renderErrorPage(
|
|
301
|
+
"unsupported_response_type",
|
|
302
|
+
`This server does not sign users in (auth mode: ${mode}). Present its access token instead.`
|
|
303
|
+
),
|
|
304
|
+
400
|
|
305
|
+
)
|
|
306
|
+
);
|
|
307
|
+
return;
|
|
308
|
+
}
|
|
309
|
+
const result = oauthAuthorizeRequestSchema.safeParse({
|
|
310
|
+
response_type: request.query["response_type"],
|
|
311
|
+
client_id: request.query["client_id"],
|
|
312
|
+
redirect_uri: rawRedirectUri,
|
|
313
|
+
code_challenge: request.query["code_challenge"],
|
|
314
|
+
code_challenge_method: request.query["code_challenge_method"] ?? "S256",
|
|
315
|
+
scope: request.query["scope"],
|
|
316
|
+
state: rawState,
|
|
317
|
+
resource: request.query["resource"]
|
|
318
|
+
});
|
|
319
|
+
if (!result.success) {
|
|
320
|
+
const errors = this.formatZodErrors(result.error);
|
|
321
|
+
this.logger.warn(`Authorization request validation failed: ${errors.join(", ")}`);
|
|
322
|
+
this.respondWithError(errors, void 0, rawState);
|
|
323
|
+
return;
|
|
324
|
+
}
|
|
325
|
+
const authOptions = this.scope.auth?.options;
|
|
326
|
+
const requestedScopes = result.data.scope ? result.data.scope.split(" ").filter(Boolean) : [];
|
|
327
|
+
const grantedScopes = grantScopes(requestedScopes, authOptions?.allowedScopes);
|
|
328
|
+
if (grantedScopes.length < requestedScopes.length) {
|
|
329
|
+
this.logger.info(
|
|
330
|
+
`OAuth authorize: not granting scope(s) outside allowedScopes: ${requestedScopes.filter((s) => !grantedScopes.includes(s)).join(" ")}`
|
|
331
|
+
);
|
|
332
|
+
}
|
|
333
|
+
const validatedRequest = {
|
|
334
|
+
...result.data,
|
|
335
|
+
scope: grantedScopes.length > 0 ? grantedScopes.join(" ") : void 0
|
|
336
|
+
};
|
|
337
|
+
this.state.set("validatedRequest", validatedRequest);
|
|
338
|
+
const { client_id, redirect_uri } = validatedRequest;
|
|
339
|
+
const cimdService = this.get(CimdService);
|
|
340
|
+
const registry = this.scope.auth?.dcrClientRegistry;
|
|
341
|
+
const redirectAllowlisted = !!registry?.hasRedirectAllowlist() && registry.isRedirectUriAllowed(redirect_uri);
|
|
342
|
+
let redirectVerified = redirectAllowlisted;
|
|
343
|
+
const isCimdClientId = !!cimdService?.enabled && cimdService.isCimdClientId(client_id);
|
|
344
|
+
const redirectError = this.checkDcrRedirectAllowlist(redirect_uri);
|
|
345
|
+
if (redirectError) {
|
|
346
|
+
this.logger.warn(`OAuth authorize: DCR allowlist rejection \u2014 ${redirectError}`);
|
|
347
|
+
this.respondWithError([redirectError], void 0, rawState);
|
|
348
|
+
return;
|
|
349
|
+
}
|
|
350
|
+
if (cimdService && !cimdService.enabled && cimdService.isCimdClientId(client_id) && !registry?.get?.(client_id)) {
|
|
351
|
+
const disabled = new CimdDisabledError();
|
|
352
|
+
this.logger.warn(`OAuth authorize: CIMD client_id refused, CIMD is disabled: ${client_id}`);
|
|
353
|
+
this.respondWithError([disabled.message], void 0, rawState);
|
|
354
|
+
return;
|
|
355
|
+
}
|
|
356
|
+
if (isCimdClientId) {
|
|
357
|
+
try {
|
|
358
|
+
this.logger.debug(`Processing CIMD client_id: ${client_id}`);
|
|
359
|
+
const resolution = await cimdService.resolveClientMetadata(client_id);
|
|
360
|
+
if (resolution.isCimdClient && resolution.metadata) {
|
|
361
|
+
cimdService.validateRedirectUri(redirect_uri, resolution.metadata);
|
|
362
|
+
redirectVerified = true;
|
|
363
|
+
this.state.set("isCimdClient", true);
|
|
364
|
+
this.state.set("cimdMetadata", resolution.metadata);
|
|
365
|
+
this.logger.info(
|
|
366
|
+
`CIMD client validated: ${resolution.metadata.client_name} (${client_id})`,
|
|
367
|
+
resolution.fromCache ? " [from cache]" : ""
|
|
368
|
+
);
|
|
369
|
+
}
|
|
370
|
+
} catch (error) {
|
|
371
|
+
const errorMessage = error instanceof Error ? error.message : "CIMD validation failed";
|
|
372
|
+
this.logger.warn(`CIMD validation failed for ${client_id}: ${errorMessage}`);
|
|
373
|
+
this.respondWithError([errorMessage], void 0, rawState);
|
|
374
|
+
return;
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
const registered = isCimdClientId ? void 0 : registry?.get?.(client_id);
|
|
378
|
+
if (registered) {
|
|
379
|
+
if (!registered.redirect_uris.includes(redirect_uri)) {
|
|
380
|
+
this.logger.warn(`OAuth authorize: redirect_uri "${redirect_uri}" not registered for client "${client_id}"`);
|
|
381
|
+
this.respondWithError(["redirect_uri is not registered for this client"], void 0, rawState);
|
|
382
|
+
return;
|
|
383
|
+
}
|
|
384
|
+
redirectVerified = true;
|
|
385
|
+
}
|
|
386
|
+
const clientIdError = isCimdClientId ? void 0 : this.checkDcrClientIdAllowlist(client_id);
|
|
387
|
+
if (clientIdError) {
|
|
388
|
+
this.logger.warn(`OAuth authorize: DCR allowlist rejection \u2014 ${clientIdError}`);
|
|
389
|
+
this.respondWithError(
|
|
390
|
+
[clientIdError],
|
|
391
|
+
redirectVerified ? redirect_uri : void 0,
|
|
392
|
+
rawState,
|
|
393
|
+
"unauthorized_client"
|
|
394
|
+
);
|
|
395
|
+
return;
|
|
396
|
+
}
|
|
397
|
+
if (!isCimdClientId && !registered && authOptions?.requireRegisteredClients !== false) {
|
|
398
|
+
this.logger.warn(`OAuth authorize: rejecting unregistered client_id "${client_id}" (requireRegisteredClients)`);
|
|
399
|
+
this.respondWithError(
|
|
400
|
+
["Unknown client_id: register the client (DCR / pre-registered) or use a CIMD client-id URL"],
|
|
401
|
+
void 0,
|
|
402
|
+
rawState
|
|
403
|
+
);
|
|
404
|
+
return;
|
|
405
|
+
}
|
|
406
|
+
const canonicalResource = computeResource(request, this.scope.entryPath, this.scope.routeBase);
|
|
407
|
+
if (!validatedRequest.resource) {
|
|
408
|
+
this.state.set("validatedRequest", { ...validatedRequest, resource: canonicalResource });
|
|
409
|
+
} else if (!resourceUriMatches(validatedRequest.resource, canonicalResource)) {
|
|
410
|
+
this.logger.warn(
|
|
411
|
+
`OAuth authorize: resource mismatch. Provided: ${validatedRequest.resource}, canonical: ${canonicalResource}`
|
|
412
|
+
);
|
|
413
|
+
this.respondWithError(
|
|
414
|
+
["Invalid resource parameter: does not match server resource URI"],
|
|
415
|
+
redirectVerified ? redirect_uri : void 0,
|
|
416
|
+
rawState
|
|
417
|
+
);
|
|
418
|
+
return;
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
/**
|
|
422
|
+
* Verify a client-supplied incremental-authorization ticket.
|
|
423
|
+
*
|
|
424
|
+
* Returns the verified payload, or `undefined` when the parameter is absent,
|
|
425
|
+
* malformed, expired, or not signed by this server. Verification is
|
|
426
|
+
* side-effect free — the ticket is CLAIMED (single use) later, in
|
|
427
|
+
* {@link prepareAuthorizationRequest}, so a request that fails OAuth
|
|
428
|
+
* validation does not burn the user's ticket.
|
|
429
|
+
*/
|
|
430
|
+
verifyIncrementalTicket(raw) {
|
|
431
|
+
const token = typeof raw === "string" ? raw : Array.isArray(raw) ? raw[0] : void 0;
|
|
432
|
+
if (typeof token !== "string" || token.length === 0) return void 0;
|
|
433
|
+
const localAuth = this.scope.auth;
|
|
434
|
+
const secret = localAuth?.signingSecret;
|
|
435
|
+
if (!secret) return void 0;
|
|
436
|
+
const payload = verifyIncrementalAuthTicket(token, secret);
|
|
437
|
+
if (!payload) {
|
|
438
|
+
this.logger.warn("Incremental auth ticket failed verification \u2014 treating as an ordinary login");
|
|
439
|
+
return void 0;
|
|
440
|
+
}
|
|
441
|
+
return payload;
|
|
442
|
+
}
|
|
443
|
+
async checkIfAuthorized() {
|
|
444
|
+
}
|
|
445
|
+
async prepareAuthorizationRequest() {
|
|
446
|
+
const {
|
|
447
|
+
validatedRequest,
|
|
448
|
+
isIncrementalAuth,
|
|
449
|
+
targetAppId,
|
|
450
|
+
targetToolId,
|
|
451
|
+
existingSessionId,
|
|
452
|
+
priorAuthorizedAppIds,
|
|
453
|
+
requiresFederatedLogin,
|
|
454
|
+
requiresConsent,
|
|
455
|
+
incrementalTicket
|
|
456
|
+
} = this.state;
|
|
457
|
+
const { metadata } = this.scope;
|
|
458
|
+
if (!validatedRequest) {
|
|
459
|
+
return;
|
|
460
|
+
}
|
|
461
|
+
const auth = this.scope.auth;
|
|
462
|
+
if (!auth || !("authorizationStore" in auth)) {
|
|
463
|
+
this.respond(this.htmlPage(this.renderErrorPage("server_error", "Authorization not configured"), 500));
|
|
464
|
+
return;
|
|
465
|
+
}
|
|
466
|
+
const localAuth = auth;
|
|
467
|
+
const store = localAuth.authorizationStore;
|
|
468
|
+
let effectiveIncremental = isIncrementalAuth;
|
|
469
|
+
let effectivePriorAppIds = priorAuthorizedAppIds;
|
|
470
|
+
if (incrementalTicket) {
|
|
471
|
+
const claimed = await localAuth.claimIncrementalTicket(
|
|
472
|
+
incrementalTicket.jti,
|
|
473
|
+
Math.max(0, incrementalTicket.exp - Date.now())
|
|
474
|
+
);
|
|
475
|
+
if (!claimed) {
|
|
476
|
+
this.logger.warn("Incremental auth ticket already used \u2014 falling back to an ordinary login");
|
|
477
|
+
effectiveIncremental = false;
|
|
478
|
+
effectivePriorAppIds = void 0;
|
|
479
|
+
this.state.set({
|
|
480
|
+
isIncrementalAuth: false,
|
|
481
|
+
targetAppId: void 0,
|
|
482
|
+
targetToolId: void 0,
|
|
483
|
+
priorAuthorizedAppIds: void 0
|
|
484
|
+
});
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
let federatedLogin;
|
|
488
|
+
if (requiresFederatedLogin) {
|
|
489
|
+
const apps = this.scope.apps.getApps();
|
|
490
|
+
const providerIds = [];
|
|
491
|
+
for (const id of getConfiguredProviderIds(metadata.auth)) {
|
|
492
|
+
if (!providerIds.includes(id)) {
|
|
493
|
+
providerIds.push(id);
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
if (providerIds.length === 0 && metadata.auth && isOrchestratedMode(metadata.auth)) {
|
|
497
|
+
providerIds.push("__parent__");
|
|
498
|
+
}
|
|
499
|
+
for (const app of apps) {
|
|
500
|
+
if (app.metadata.auth) {
|
|
501
|
+
const appId = app.metadata.id || app.metadata.name;
|
|
502
|
+
if (!providerIds.includes(appId)) {
|
|
503
|
+
providerIds.push(appId);
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
federatedLogin = {
|
|
508
|
+
providerIds,
|
|
509
|
+
selectedProviderIds: void 0,
|
|
510
|
+
skippedProviderIds: void 0
|
|
511
|
+
};
|
|
512
|
+
}
|
|
513
|
+
let consent;
|
|
514
|
+
if (requiresConsent) {
|
|
515
|
+
const consentConfig = metadata.auth && isOrchestratedMode(metadata.auth) ? metadata.auth.consent : void 0;
|
|
516
|
+
const { availableToolIds } = projectConsentTools(this.scope, consentConfig?.excludedTools);
|
|
517
|
+
consent = {
|
|
518
|
+
enabled: true,
|
|
519
|
+
availableToolIds,
|
|
520
|
+
selectedToolIds: void 0,
|
|
521
|
+
consentCompleted: false
|
|
522
|
+
};
|
|
523
|
+
}
|
|
524
|
+
const pendingRecord = store.createPendingRecord({
|
|
525
|
+
clientId: validatedRequest.client_id,
|
|
526
|
+
redirectUri: validatedRequest.redirect_uri,
|
|
527
|
+
scopes: validatedRequest.scope ? validatedRequest.scope.split(" ") : [],
|
|
528
|
+
pkce: {
|
|
529
|
+
challenge: validatedRequest.code_challenge,
|
|
530
|
+
method: "S256"
|
|
531
|
+
},
|
|
532
|
+
state: validatedRequest.state,
|
|
533
|
+
resource: validatedRequest.resource,
|
|
534
|
+
// Progressive/Incremental Authorization Fields. `isIncremental` reflects a
|
|
535
|
+
// CLAIMED, server-signed ticket; `incrementalSub` is the identity that
|
|
536
|
+
// ticket proved, and is the only subject the callback may mint for when
|
|
537
|
+
// it skips the credential gate.
|
|
538
|
+
isIncremental: effectiveIncremental,
|
|
539
|
+
incrementalSub: effectiveIncremental ? incrementalTicket?.sub : void 0,
|
|
540
|
+
targetAppId: effectiveIncremental ? targetAppId : void 0,
|
|
541
|
+
targetToolId: effectiveIncremental ? targetToolId : void 0,
|
|
542
|
+
existingSessionId,
|
|
543
|
+
priorAuthorizedAppIds: effectivePriorAppIds,
|
|
544
|
+
// Federated Login State
|
|
545
|
+
federatedLogin,
|
|
546
|
+
// Consent State
|
|
547
|
+
consent
|
|
548
|
+
});
|
|
549
|
+
const binding = createRequestSigninBinding(this.rawInput.request, pendingRecord.id);
|
|
550
|
+
pendingRecord.signinBinding = binding.hash;
|
|
551
|
+
this.signinBindingHash = binding.hash;
|
|
552
|
+
this.signinCookie = signinBindingCookie(
|
|
553
|
+
this.rawInput.request,
|
|
554
|
+
binding,
|
|
555
|
+
signinCookiePath(localAuth.issuer, this.scope.fullPath)
|
|
556
|
+
);
|
|
557
|
+
await localAuth.authorizationStore.storePendingAuthorization(pendingRecord);
|
|
558
|
+
this.logger.info(
|
|
559
|
+
`Pending authorization created: ${pendingRecord.id}${effectiveIncremental ? ` (incremental for app: ${targetAppId})` : ""}${requiresFederatedLogin ? " (federated)" : ""}${requiresConsent ? " (consent enabled)" : ""}`
|
|
560
|
+
);
|
|
561
|
+
this.state.set("pendingAuthId", pendingRecord.id);
|
|
562
|
+
}
|
|
563
|
+
async buildAuthorizeOutput() {
|
|
564
|
+
const {
|
|
565
|
+
pendingAuthId,
|
|
566
|
+
validatedRequest,
|
|
567
|
+
isIncrementalAuth,
|
|
568
|
+
targetAppId,
|
|
569
|
+
targetToolId,
|
|
570
|
+
requiresFederatedLogin,
|
|
571
|
+
isCimdClient,
|
|
572
|
+
cimdMetadata
|
|
573
|
+
} = this.state;
|
|
574
|
+
if (!validatedRequest || !pendingAuthId) {
|
|
575
|
+
return;
|
|
576
|
+
}
|
|
577
|
+
const { metadata } = this.scope;
|
|
578
|
+
if (metadata.auth && isRemoteMode(metadata.auth) && !isIncrementalAuth) {
|
|
579
|
+
await this.startRemoteFederation(pendingAuthId, validatedRequest);
|
|
580
|
+
return;
|
|
581
|
+
}
|
|
582
|
+
const clientDisplayName = cimdMetadata?.client_name ?? validatedRequest.client_id;
|
|
583
|
+
if (isIncrementalAuth && targetAppId) {
|
|
584
|
+
const apps = this.scope.apps.getApps();
|
|
585
|
+
const app = apps.find((a) => a.metadata.id === targetAppId);
|
|
586
|
+
const appName = app?.metadata?.name || targetAppId;
|
|
587
|
+
const appDescription = app?.metadata?.description;
|
|
588
|
+
const customIncremental = await this.tryRenderCustomSlot(
|
|
589
|
+
"incremental",
|
|
590
|
+
pendingAuthId,
|
|
591
|
+
(common) => buildIncrementalState(common, {
|
|
592
|
+
appId: targetAppId,
|
|
593
|
+
appName,
|
|
594
|
+
appDescription,
|
|
595
|
+
toolId: targetToolId,
|
|
596
|
+
redirectUri: validatedRequest.redirect_uri
|
|
597
|
+
}),
|
|
598
|
+
[validatedRequest.redirect_uri]
|
|
599
|
+
);
|
|
600
|
+
if (customIncremental) return;
|
|
601
|
+
const incrementalAuthHtml = this.renderIncrementalAuthPage({
|
|
602
|
+
pendingAuthId,
|
|
603
|
+
appId: targetAppId,
|
|
604
|
+
appName,
|
|
605
|
+
appDescription,
|
|
606
|
+
toolId: targetToolId,
|
|
607
|
+
redirectUri: validatedRequest.redirect_uri
|
|
608
|
+
});
|
|
609
|
+
this.respond(this.htmlPage(incrementalAuthHtml));
|
|
610
|
+
return;
|
|
611
|
+
}
|
|
612
|
+
if (requiresFederatedLogin) {
|
|
613
|
+
const apps = this.scope.apps.getApps();
|
|
614
|
+
const providers = [];
|
|
615
|
+
const { metadata: metadata2 } = this.scope;
|
|
616
|
+
const configuredProviders = getConfiguredProviders(metadata2.auth);
|
|
617
|
+
const hasConfiguredProviders = configuredProviders.length > 0;
|
|
618
|
+
for (const p of configuredProviders) {
|
|
619
|
+
providers.push({
|
|
620
|
+
id: p.id,
|
|
621
|
+
mode: "local",
|
|
622
|
+
appIds: [p.id],
|
|
623
|
+
scopes: p.scopes ?? [],
|
|
624
|
+
isParentProvider: false
|
|
625
|
+
});
|
|
626
|
+
}
|
|
627
|
+
if (!hasConfiguredProviders && metadata2.auth && isOrchestratedMode(metadata2.auth)) {
|
|
628
|
+
providers.push({
|
|
629
|
+
id: "__parent__",
|
|
630
|
+
mode: metadata2.auth.mode,
|
|
631
|
+
appIds: ["__parent__"],
|
|
632
|
+
scopes: [],
|
|
633
|
+
isParentProvider: true
|
|
634
|
+
});
|
|
635
|
+
}
|
|
636
|
+
for (const app of apps) {
|
|
637
|
+
if (app.metadata.auth) {
|
|
638
|
+
const appId = app.metadata.id || app.metadata.name;
|
|
639
|
+
if (!providers.some((p) => p.id === appId)) {
|
|
640
|
+
providers.push({
|
|
641
|
+
id: appId,
|
|
642
|
+
providerUrl: app.metadata.auth.mode === "transparent" ? app.metadata.auth.provider : void 0,
|
|
643
|
+
mode: app.metadata.auth.mode,
|
|
644
|
+
appIds: [appId],
|
|
645
|
+
scopes: [],
|
|
646
|
+
isParentProvider: false
|
|
647
|
+
});
|
|
648
|
+
}
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
const detection = {
|
|
652
|
+
providers: new Map(providers.map((p) => [p.id, p])),
|
|
653
|
+
requiresOrchestration: true,
|
|
654
|
+
parentProviderId: hasConfiguredProviders ? void 0 : "__parent__",
|
|
655
|
+
childProviderIds: providers.filter((p) => !p.isParentProvider).map((p) => p.id),
|
|
656
|
+
uniqueProviderCount: providers.length,
|
|
657
|
+
validationErrors: [],
|
|
658
|
+
warnings: []
|
|
659
|
+
};
|
|
660
|
+
const customFederated = await this.tryRenderCustomSlot(
|
|
661
|
+
"federated",
|
|
662
|
+
pendingAuthId,
|
|
663
|
+
(common) => buildFederatedState(common, {
|
|
664
|
+
clientId: validatedRequest.client_id,
|
|
665
|
+
clientName: clientDisplayName,
|
|
666
|
+
redirectUri: validatedRequest.redirect_uri,
|
|
667
|
+
providers: [...detection.providers.values()].map(
|
|
668
|
+
(p) => ({
|
|
669
|
+
id: p.id,
|
|
670
|
+
name: p.id,
|
|
671
|
+
url: p.providerUrl,
|
|
672
|
+
mode: p.mode,
|
|
673
|
+
appIds: p.appIds.filter((id) => id !== "__parent__"),
|
|
674
|
+
primary: p.isParentProvider
|
|
675
|
+
})
|
|
676
|
+
)
|
|
677
|
+
}),
|
|
678
|
+
// The selection is answered with a redirect to the first chosen provider.
|
|
679
|
+
[validatedRequest.redirect_uri, ...this.providerAuthorizationEndpoints(detection.providers.keys())]
|
|
680
|
+
);
|
|
681
|
+
if (customFederated) return;
|
|
682
|
+
const federatedLoginHtml = this.renderFederatedLoginPage({
|
|
683
|
+
pendingAuthId,
|
|
684
|
+
detection,
|
|
685
|
+
clientId: validatedRequest.client_id,
|
|
686
|
+
redirectUri: validatedRequest.redirect_uri
|
|
687
|
+
});
|
|
688
|
+
this.respond(this.htmlPage(federatedLoginHtml));
|
|
689
|
+
return;
|
|
690
|
+
}
|
|
691
|
+
const customLogin = await this.tryRenderCustomSlot(
|
|
692
|
+
"login",
|
|
693
|
+
pendingAuthId,
|
|
694
|
+
(common) => buildLoginState(common, {
|
|
695
|
+
clientId: validatedRequest.client_id,
|
|
696
|
+
clientName: clientDisplayName,
|
|
697
|
+
scopes: validatedRequest.scope ? validatedRequest.scope.split(" ").filter(Boolean) : [],
|
|
698
|
+
redirectUri: validatedRequest.redirect_uri,
|
|
699
|
+
logoUri: cimdMetadata?.logo_uri
|
|
700
|
+
}),
|
|
701
|
+
[validatedRequest.redirect_uri]
|
|
702
|
+
);
|
|
703
|
+
if (customLogin) return;
|
|
704
|
+
const loginHtml = this.renderLoginPage({
|
|
705
|
+
pendingAuthId,
|
|
706
|
+
clientId: validatedRequest.client_id,
|
|
707
|
+
clientName: clientDisplayName,
|
|
708
|
+
// Use CIMD client_name if available
|
|
709
|
+
scope: validatedRequest.scope ?? "",
|
|
710
|
+
redirectUri: validatedRequest.redirect_uri,
|
|
711
|
+
logoUri: cimdMetadata?.logo_uri
|
|
712
|
+
// Use CIMD logo_uri if available
|
|
713
|
+
});
|
|
714
|
+
const auth = this.scope.metadata.auth;
|
|
715
|
+
const customRender = !!(auth && auth.mode === "local" && auth.login?.render);
|
|
716
|
+
this.respond(httpRespond.html(loginHtml, 200, builtInAuthPageHeaders({ csp: !customRender })));
|
|
717
|
+
}
|
|
718
|
+
/**
|
|
719
|
+
* Render a custom `@AuthUi` slot when one is registered for this scope.
|
|
720
|
+
*
|
|
721
|
+
* Mints the per-pending-auth CSRF token (server-owned), persists it onto the
|
|
722
|
+
* pending authorization record (so the callback can verify it across nodes),
|
|
723
|
+
* builds the {@link AuthFlowState} via `buildState`, SSRs the registered
|
|
724
|
+
* component, and responds with the assembled page + CSP / anti-clickjacking
|
|
725
|
+
* headers. `formTargets` are where the callback may redirect a submission of
|
|
726
|
+
* the page (the validated `redirect_uri`, upstream authorization endpoints):
|
|
727
|
+
* the page's CSP `form-action` allows their origins. Returns `true` when it
|
|
728
|
+
* handled the slot (caller should `return`), `false` to fall through to the
|
|
729
|
+
* built-in page (no renderer / build failed).
|
|
730
|
+
*/
|
|
731
|
+
async tryRenderCustomSlot(slot, pendingAuthId, buildState, formTargets) {
|
|
732
|
+
const authUi = this.scope.authUi;
|
|
733
|
+
if (!authUi || !authUi.hasSlot(slot)) return false;
|
|
734
|
+
const csrfToken = authUi.mintCsrf(pendingAuthId);
|
|
735
|
+
try {
|
|
736
|
+
const localAuth = this.scope.auth;
|
|
737
|
+
const record = await localAuth.authorizationStore.getPendingAuthorization(pendingAuthId);
|
|
738
|
+
if (record) {
|
|
739
|
+
record.authUiCsrf = csrfToken;
|
|
740
|
+
await localAuth.authorizationStore.storePendingAuthorization(record);
|
|
741
|
+
}
|
|
742
|
+
} catch (err) {
|
|
743
|
+
this.logger.warn(`Failed to persist auth-UI CSRF on pending record: ${err instanceof Error ? err.message : err}`);
|
|
744
|
+
}
|
|
745
|
+
const state = buildState({
|
|
746
|
+
pendingAuthId,
|
|
747
|
+
submitUrl: "/oauth/callback",
|
|
748
|
+
extraUrl: authUiExtraPath(this.scope.fullPath),
|
|
749
|
+
csrfToken,
|
|
750
|
+
addedItems: authUi.getAddedItems(pendingAuthId)
|
|
751
|
+
});
|
|
752
|
+
const page = buildAuthUiPage({ registry: authUi, slot, state, fullPath: this.scope.fullPath, formTargets });
|
|
753
|
+
if (!page) return false;
|
|
754
|
+
this.respond(httpRespond.html(page.html, 200, page.headers));
|
|
755
|
+
return true;
|
|
756
|
+
}
|
|
757
|
+
/** The authorization endpoints of the upstream providers among `providerIds` (others have none). */
|
|
758
|
+
providerAuthorizationEndpoints(providerIds) {
|
|
759
|
+
const localAuth = this.scope.auth;
|
|
760
|
+
if (typeof localAuth?.getProviderConfig !== "function") return [];
|
|
761
|
+
const endpoints = [];
|
|
762
|
+
for (const id of providerIds) {
|
|
763
|
+
const endpoint = localAuth.getProviderConfig(id)?.authorizationEndpoint;
|
|
764
|
+
if (endpoint) endpoints.push(endpoint);
|
|
765
|
+
}
|
|
766
|
+
return endpoints;
|
|
767
|
+
}
|
|
768
|
+
/**
|
|
769
|
+
* Remote mode (`mode: 'remote'`) auto-federation.
|
|
770
|
+
*
|
|
771
|
+
* Builds a federated auth session for the SINGLE mandatory upstream provider
|
|
772
|
+
* registered by {@link LocalPrimaryAuth.registerRemoteProvider}, starts it
|
|
773
|
+
* (fresh PKCE + state), persists the session, and redirects straight to the
|
|
774
|
+
* upstream IdP's authorization endpoint. This reuses the exact federated
|
|
775
|
+
* machinery the multi-provider local path uses (`/oauth/provider/:id/callback`
|
|
776
|
+
* then completes the exchange, stores upstream tokens, and mints the FrontMCP
|
|
777
|
+
* session token whose identity comes from the upstream user) — but skips the
|
|
778
|
+
* in-tree login page and the provider-selection page entirely.
|
|
779
|
+
*
|
|
780
|
+
* No identity is collected in-tree: the federated session is created with an
|
|
781
|
+
* EMPTY `userInfo` so the minted token's `sub`/`email`/`name` derive solely
|
|
782
|
+
* from the upstream provider (see the provider-callback flow).
|
|
783
|
+
*/
|
|
784
|
+
async startRemoteFederation(pendingAuthId, validatedRequest) {
|
|
785
|
+
const auth = this.scope.auth;
|
|
786
|
+
if (!auth || !("federatedSessionStore" in auth)) {
|
|
787
|
+
this.respond(this.htmlPage(this.renderErrorPage("server_error", "Authorization not configured"), 500));
|
|
788
|
+
return;
|
|
789
|
+
}
|
|
790
|
+
const localAuth = auth;
|
|
791
|
+
const providerId = localAuth.remoteProviderId;
|
|
792
|
+
if (!providerId || !localAuth.getProviderConfig(providerId)) {
|
|
793
|
+
this.logger.error("Remote mode: no upstream provider configured for federation");
|
|
794
|
+
await localAuth.authorizationStore.deletePendingAuthorization(pendingAuthId);
|
|
795
|
+
this.respond(
|
|
796
|
+
this.htmlPage(this.renderErrorPage("server_error", "Upstream identity provider is not configured"), 500)
|
|
797
|
+
);
|
|
798
|
+
return;
|
|
799
|
+
}
|
|
800
|
+
const session = createFederatedAuthSession({
|
|
801
|
+
pendingAuthId,
|
|
802
|
+
clientId: validatedRequest.client_id,
|
|
803
|
+
redirectUri: validatedRequest.redirect_uri,
|
|
804
|
+
scopes: validatedRequest.scope ? validatedRequest.scope.split(" ").filter(Boolean) : [],
|
|
805
|
+
state: validatedRequest.state,
|
|
806
|
+
resource: validatedRequest.resource,
|
|
807
|
+
userInfo: {},
|
|
808
|
+
frontmcpPkce: { challenge: validatedRequest.code_challenge, method: "S256" },
|
|
809
|
+
providerIds: [providerId],
|
|
810
|
+
signinBinding: this.signinBindingHash
|
|
811
|
+
});
|
|
812
|
+
const verifier = generateCodeVerifier();
|
|
813
|
+
const challenge = sha256Base64url(verifier);
|
|
814
|
+
const pkce = { verifier, challenge, method: "S256" };
|
|
815
|
+
const providerState = `federated:${session.id}:${randomUUID()}`;
|
|
816
|
+
startNextProvider(session, pkce, providerState);
|
|
817
|
+
await localAuth.federatedSessionStore.store(session);
|
|
818
|
+
const redirectUrl = await localAuth.buildProviderAuthorizeUrl(providerId, {
|
|
819
|
+
state: providerState,
|
|
820
|
+
codeChallenge: pkce.challenge,
|
|
821
|
+
codeChallengeMethod: "S256"
|
|
822
|
+
});
|
|
823
|
+
if (!redirectUrl) {
|
|
824
|
+
this.logger.error(`Remote mode: failed to build authorize URL for provider: ${providerId}`);
|
|
825
|
+
await localAuth.federatedSessionStore.delete(session.id);
|
|
826
|
+
await localAuth.authorizationStore.deletePendingAuthorization(pendingAuthId);
|
|
827
|
+
this.respond(
|
|
828
|
+
this.htmlPage(
|
|
829
|
+
this.renderErrorPage("server_error", `Failed to initiate authentication with provider: ${providerId}`),
|
|
830
|
+
500
|
|
831
|
+
)
|
|
832
|
+
);
|
|
833
|
+
return;
|
|
834
|
+
}
|
|
835
|
+
this.logger.info(`Remote mode: redirecting to upstream provider: ${providerId}`);
|
|
836
|
+
this.respond(httpRespond.redirect(redirectUrl));
|
|
837
|
+
}
|
|
838
|
+
async validateOutput() {
|
|
839
|
+
}
|
|
840
|
+
/** An HTML response with the built-in auth pages' security headers (#263). */
|
|
841
|
+
htmlPage(markup, status = 200) {
|
|
842
|
+
return httpRespond.html(markup, status, builtInAuthPageHeaders());
|
|
843
|
+
}
|
|
844
|
+
/**
|
|
845
|
+
* Enforce the local-AS DCR `allowedRedirectUris` (#462) at authorize time,
|
|
846
|
+
* for ALL clients (CIMD or not) as an open-redirect / lateral-movement guard.
|
|
847
|
+
* Returns a human-readable rejection reason, or `undefined` when the
|
|
848
|
+
* redirect_uri is allowed (including when no allowlist is configured, or the
|
|
849
|
+
* auth instance does not expose a DCR registry — e.g. non-local modes).
|
|
850
|
+
*/
|
|
851
|
+
checkDcrRedirectAllowlist(redirectUri) {
|
|
852
|
+
const registry = this.scope.auth?.dcrClientRegistry;
|
|
853
|
+
if (registry?.hasRedirectAllowlist() && !registry.isRedirectUriAllowed(redirectUri)) {
|
|
854
|
+
return `redirect_uri "${redirectUri}" is not in the configured allowlist`;
|
|
855
|
+
}
|
|
856
|
+
return void 0;
|
|
857
|
+
}
|
|
858
|
+
/**
|
|
859
|
+
* Enforce the local-AS DCR `allowedClientIds` (#462) at authorize time, for
|
|
860
|
+
* non-CIMD client ids (the caller skips CIMD URLs, which the CIMD layer
|
|
861
|
+
* validates). Returns a human-readable rejection reason, or `undefined` when
|
|
862
|
+
* the client is allowed or no allowlist is configured.
|
|
863
|
+
*/
|
|
864
|
+
checkDcrClientIdAllowlist(clientId) {
|
|
865
|
+
const registry = this.scope.auth?.dcrClientRegistry;
|
|
866
|
+
if (registry?.hasClientIdAllowlist() && !registry.isClientIdAllowed(clientId)) {
|
|
867
|
+
return `client_id "${clientId}" is not in the configured allowlist`;
|
|
868
|
+
}
|
|
869
|
+
return void 0;
|
|
870
|
+
}
|
|
871
|
+
/**
|
|
872
|
+
* Format Zod errors into human-readable strings
|
|
873
|
+
*/
|
|
874
|
+
formatZodErrors(error) {
|
|
875
|
+
return error.issues.map((err) => {
|
|
876
|
+
const path = err.path.length > 0 ? `${err.path.join(".")}: ` : "";
|
|
877
|
+
return `${path}${err.message}`;
|
|
878
|
+
});
|
|
879
|
+
}
|
|
880
|
+
/**
|
|
881
|
+
* Respond with OAuth error - redirect if possible, otherwise show error page.
|
|
882
|
+
*
|
|
883
|
+
* @param redirectUri A redirect_uri validated for the client; omit it for an error page.
|
|
884
|
+
* @param error The RFC 6749 §4.1.2.1 error code. Default `invalid_request`.
|
|
885
|
+
*/
|
|
886
|
+
respondWithError(errors, redirectUri, state, error = "invalid_request") {
|
|
887
|
+
const errorDescription = errors.join("; ");
|
|
888
|
+
if (redirectUri) {
|
|
889
|
+
const safe = safeRedirectUriSchema.safeParse(redirectUri);
|
|
890
|
+
if (safe.success) {
|
|
891
|
+
const url = new URL(safe.data);
|
|
892
|
+
url.searchParams.set("error", error);
|
|
893
|
+
url.searchParams.set("error_description", errorDescription);
|
|
894
|
+
if (state) {
|
|
895
|
+
url.searchParams.set("state", state);
|
|
896
|
+
}
|
|
897
|
+
const issuer = this.resolveIssuer(this.rawInput.request);
|
|
898
|
+
if (issuer) url.searchParams.set("iss", issuer);
|
|
899
|
+
this.respond(httpRespond.redirect(url.toString()));
|
|
900
|
+
return;
|
|
901
|
+
}
|
|
902
|
+
}
|
|
903
|
+
this.respond(this.htmlPage(this.renderErrorPage(error, errorDescription), 400));
|
|
904
|
+
}
|
|
905
|
+
/**
|
|
906
|
+
* Render the local login page.
|
|
907
|
+
*
|
|
908
|
+
* Honors `auth.login` (Checkpoint 3a): a `login.render` override yields full
|
|
909
|
+
* custom HTML, `login.fields` extends the built-in form, and otherwise the
|
|
910
|
+
* unchanged default email/name page is rendered. Rendering is delegated to
|
|
911
|
+
* the shared `renderLocalLoginPage` helper so the authorize flow and the
|
|
912
|
+
* callback error re-render stay in sync.
|
|
913
|
+
*/
|
|
914
|
+
renderLoginPage(params) {
|
|
915
|
+
const { pendingAuthId, clientId, clientName, scope, logoUri } = params;
|
|
916
|
+
const callbackPath = "/oauth/callback";
|
|
917
|
+
const auth = this.scope.metadata.auth;
|
|
918
|
+
const login = auth && auth.mode === "local" ? auth.login : void 0;
|
|
919
|
+
const ctx = {
|
|
920
|
+
clientId,
|
|
921
|
+
clientName: clientName ?? clientId,
|
|
922
|
+
logoUri,
|
|
923
|
+
scopes: scope ? scope.split(" ").filter(Boolean) : [],
|
|
924
|
+
pendingAuthId,
|
|
925
|
+
callbackPath,
|
|
926
|
+
fields: login?.fields ?? {}
|
|
927
|
+
};
|
|
928
|
+
return renderLocalLoginPage(login, ctx);
|
|
929
|
+
}
|
|
930
|
+
/**
|
|
931
|
+
* Render incremental authorization page for a single app using HTMX templates
|
|
932
|
+
*/
|
|
933
|
+
renderIncrementalAuthPage(params) {
|
|
934
|
+
const { pendingAuthId, appId, appName, appDescription, toolId } = params;
|
|
935
|
+
const callbackPath = "/oauth/callback";
|
|
936
|
+
const app = {
|
|
937
|
+
appId,
|
|
938
|
+
appName,
|
|
939
|
+
description: appDescription
|
|
940
|
+
};
|
|
941
|
+
return buildIncrementalAuthPage({
|
|
942
|
+
app,
|
|
943
|
+
toolId: toolId || "unknown tool",
|
|
944
|
+
sessionHint: pendingAuthId,
|
|
945
|
+
callbackPath
|
|
946
|
+
});
|
|
947
|
+
}
|
|
948
|
+
/**
|
|
949
|
+
* Render federated login page for multiple auth providers using HTMX templates
|
|
950
|
+
*/
|
|
951
|
+
renderFederatedLoginPage(params) {
|
|
952
|
+
const { pendingAuthId, detection, clientId } = params;
|
|
953
|
+
const callbackPath = "/oauth/callback";
|
|
954
|
+
const providers = [...detection.providers.values()].map((provider) => ({
|
|
955
|
+
providerId: provider.id,
|
|
956
|
+
providerName: provider.id,
|
|
957
|
+
providerUrl: provider.providerUrl,
|
|
958
|
+
mode: provider.mode,
|
|
959
|
+
appIds: provider.appIds.filter((id) => id !== "__parent__"),
|
|
960
|
+
isPrimary: provider.isParentProvider
|
|
961
|
+
}));
|
|
962
|
+
return buildFederatedLoginPage({
|
|
963
|
+
providers,
|
|
964
|
+
clientName: clientId,
|
|
965
|
+
pendingAuthId,
|
|
966
|
+
callbackPath
|
|
967
|
+
});
|
|
968
|
+
}
|
|
969
|
+
/**
|
|
970
|
+
* Render an error page
|
|
971
|
+
*/
|
|
972
|
+
renderErrorPage(error, description) {
|
|
973
|
+
return `<!DOCTYPE html>
|
|
974
|
+
<html lang="en">
|
|
975
|
+
<head>
|
|
976
|
+
<meta charset="UTF-8">
|
|
977
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
978
|
+
<title>Authorization Error</title>
|
|
979
|
+
<style>
|
|
980
|
+
body {
|
|
981
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
982
|
+
background: #f5f5f5;
|
|
983
|
+
min-height: 100vh;
|
|
984
|
+
display: flex;
|
|
985
|
+
align-items: center;
|
|
986
|
+
justify-content: center;
|
|
987
|
+
padding: 20px;
|
|
988
|
+
}
|
|
989
|
+
.error-container {
|
|
990
|
+
background: white;
|
|
991
|
+
padding: 40px;
|
|
992
|
+
border-radius: 12px;
|
|
993
|
+
box-shadow: 0 4px 20px rgba(0,0,0,0.1);
|
|
994
|
+
max-width: 500px;
|
|
995
|
+
text-align: center;
|
|
996
|
+
}
|
|
997
|
+
.error-icon { font-size: 48px; margin-bottom: 20px; }
|
|
998
|
+
h1 { color: #e53e3e; margin-bottom: 10px; }
|
|
999
|
+
p { color: #666; line-height: 1.6; }
|
|
1000
|
+
.error-code { font-family: monospace; background: #f5f5f5; padding: 4px 8px; border-radius: 4px; }
|
|
1001
|
+
</style>
|
|
1002
|
+
</head>
|
|
1003
|
+
<body>
|
|
1004
|
+
<div class="error-container">
|
|
1005
|
+
<div class="error-icon">\u26A0\uFE0F</div>
|
|
1006
|
+
<h1>Authorization Error</h1>
|
|
1007
|
+
<p><span class="error-code">${escapeHtml(error)}</span></p>
|
|
1008
|
+
<p>${escapeHtml(description)}</p>
|
|
1009
|
+
</div>
|
|
1010
|
+
</body>
|
|
1011
|
+
</html>`;
|
|
1012
|
+
}
|
|
1013
|
+
};
|
|
1014
|
+
__decorateClass([
|
|
1015
|
+
Stage("checkIpFilter")
|
|
1016
|
+
], OauthAuthorizeFlow.prototype, "checkIpFilter", 1);
|
|
1017
|
+
__decorateClass([
|
|
1018
|
+
Stage("acquireQuota")
|
|
1019
|
+
], OauthAuthorizeFlow.prototype, "acquireQuota", 1);
|
|
1020
|
+
__decorateClass([
|
|
1021
|
+
Stage("parseInput")
|
|
1022
|
+
], OauthAuthorizeFlow.prototype, "parseInput", 1);
|
|
1023
|
+
__decorateClass([
|
|
1024
|
+
Stage("validateInput")
|
|
1025
|
+
], OauthAuthorizeFlow.prototype, "validateInput", 1);
|
|
1026
|
+
__decorateClass([
|
|
1027
|
+
Stage("checkIfAuthorized")
|
|
1028
|
+
], OauthAuthorizeFlow.prototype, "checkIfAuthorized", 1);
|
|
1029
|
+
__decorateClass([
|
|
1030
|
+
Stage("prepareAuthorizationRequest")
|
|
1031
|
+
], OauthAuthorizeFlow.prototype, "prepareAuthorizationRequest", 1);
|
|
1032
|
+
__decorateClass([
|
|
1033
|
+
Stage("buildAuthorizeOutput")
|
|
1034
|
+
], OauthAuthorizeFlow.prototype, "buildAuthorizeOutput", 1);
|
|
1035
|
+
__decorateClass([
|
|
1036
|
+
Stage("validateOutput")
|
|
1037
|
+
], OauthAuthorizeFlow.prototype, "validateOutput", 1);
|
|
1038
|
+
OauthAuthorizeFlow = __decorateClass([
|
|
1039
|
+
Flow({
|
|
1040
|
+
name,
|
|
1041
|
+
plan,
|
|
1042
|
+
inputSchema,
|
|
1043
|
+
outputSchema,
|
|
1044
|
+
access: "public",
|
|
1045
|
+
middleware: {
|
|
1046
|
+
method: "GET",
|
|
1047
|
+
path: "/oauth/authorize"
|
|
1048
|
+
}
|
|
1049
|
+
})
|
|
1050
|
+
], OauthAuthorizeFlow);
|
|
1051
|
+
export {
|
|
1052
|
+
OauthAuthorizeFlow as default
|
|
1053
|
+
};
|