@frontmcp/sdk 1.11.1 → 1.11.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -0
- package/agent/adapters/anthropic.adapter.d.ts +4 -4
- package/agent/adapters/anthropic.adapter.d.ts.map +1 -1
- package/agent/adapters/base.adapter.d.ts +12 -2
- package/agent/adapters/base.adapter.d.ts.map +1 -1
- package/agent/adapters/index.d.ts +1 -1
- package/agent/adapters/index.d.ts.map +1 -1
- package/agent/adapters/openai.adapter.d.ts +7 -7
- package/agent/adapters/openai.adapter.d.ts.map +1 -1
- package/agent/agent-execution-loop.d.ts +27 -14
- package/agent/agent-execution-loop.d.ts.map +1 -1
- package/agent/agent.registry.d.ts +9 -0
- package/agent/agent.registry.d.ts.map +1 -1
- package/agent/flows/call-agent.flow.d.ts.map +1 -1
- package/app/instances/app.esm.instance.d.ts +27 -5
- package/app/instances/app.esm.instance.d.ts.map +1 -1
- package/app/instances/app.remote.instance.d.ts.map +1 -1
- package/app/instances/esm-normalize.utils.d.ts +3 -1
- package/app/instances/esm-normalize.utils.d.ts.map +1 -1
- package/app/instances/esm-package-version.d.ts +48 -0
- package/app/instances/esm-package-version.d.ts.map +1 -0
- package/auth/auth-ui/auth-ui.contract.d.ts +27 -0
- package/auth/auth-ui/auth-ui.contract.d.ts.map +1 -1
- package/auth/auth-ui/auth-ui.state.d.ts +2 -1
- package/auth/auth-ui/auth-ui.state.d.ts.map +1 -1
- package/auth/auth-ui/index.d.ts +1 -1
- package/auth/auth-ui/index.d.ts.map +1 -1
- package/auth/authorization/orchestrated.context-extension.d.ts +1 -1
- package/auth/authorization/orchestrated.context-extension.d.ts.map +1 -1
- package/auth/authorized-apps.utils.d.ts +22 -0
- package/auth/authorized-apps.utils.d.ts.map +1 -1
- package/auth/federated-steps.d.ts +66 -0
- package/auth/federated-steps.d.ts.map +1 -0
- package/auth/flows/oauth.authorize.flow.d.ts +2 -2
- package/auth/flows/oauth.authorize.flow.d.ts.map +1 -1
- package/auth/flows/oauth.callback.flow.d.ts +17 -6
- package/auth/flows/oauth.callback.flow.d.ts.map +1 -1
- package/auth/flows/oauth.provider-callback.flow.d.ts.map +1 -1
- package/auth/flows/oauth.register.flow.d.ts +1 -1
- package/auth/flows/oauth.register.flow.d.ts.map +1 -1
- package/auth/flows/oauth.token.flow.d.ts +9 -0
- package/auth/flows/oauth.token.flow.d.ts.map +1 -1
- package/auth/flows/oauth.userinfo.flow.d.ts +1 -1
- package/auth/flows/well-known.oauth-authorization-server.flow.d.ts +3 -0
- package/auth/flows/well-known.oauth-authorization-server.flow.d.ts.map +1 -1
- package/auth/flows/well-known.prm.flow.d.ts.map +1 -1
- package/auth/instances/instance.local-primary-auth.d.ts +38 -7
- package/auth/instances/instance.local-primary-auth.d.ts.map +1 -1
- package/auth/required-providers.utils.d.ts +19 -0
- package/auth/required-providers.utils.d.ts.map +1 -0
- package/browser/agent/adapters/anthropic.adapter.mjs +14 -10
- package/browser/agent/adapters/base.adapter.mjs +10 -3
- package/browser/agent/adapters/openai.adapter.mjs +39 -25
- package/browser/agent/agent-execution-loop.mjs +102 -70
- package/browser/agent/agent.registry.mjs +56 -20
- package/browser/agent/flows/call-agent.flow.mjs +2 -1
- package/browser/agent/index.mjs +1 -1
- package/browser/app/instances/app.esm.instance.mjs +120 -154
- package/browser/app/instances/app.remote.instance.mjs +3 -4
- package/browser/app/instances/esm-normalize.utils.mjs +10 -5
- package/browser/app/instances/esm-package-version.mjs +118 -0
- package/browser/auth/auth-ui/auth-ui.state.mjs +1 -1
- package/browser/auth/authorization/orchestrated.context-extension.mjs +2 -2
- package/browser/auth/authorized-apps.utils.mjs +24 -2
- package/browser/auth/federated-steps.mjs +199 -0
- package/browser/auth/flows/oauth.authorize.flow.mjs +61 -76
- package/browser/auth/flows/oauth.callback.flow.mjs +112 -42
- package/browser/auth/flows/oauth.provider-callback.flow.mjs +14 -2
- package/browser/auth/flows/oauth.register.flow.mjs +3 -3
- package/browser/auth/flows/oauth.token.flow.mjs +33 -3
- package/browser/auth/flows/session.verify.flow.mjs +1 -1
- package/browser/auth/flows/well-known.oauth-authorization-server.flow.mjs +11 -6
- package/browser/auth/flows/well-known.prm.flow.mjs +2 -1
- package/browser/auth/instances/instance.local-primary-auth.mjs +131 -37
- package/browser/auth/required-providers.utils.mjs +16 -0
- package/browser/channel/channel-scope.helper.mjs +2 -2
- package/browser/channel/flows/send-channel-notification.flow.mjs +1 -1
- package/browser/common/entries/tool.entry.mjs +21 -4
- package/browser/common/index.mjs +2 -2
- package/browser/common/interfaces/agent.interface.mjs +25 -4
- package/browser/common/interfaces/tool.interface.mjs +31 -5
- package/browser/common/metadata/app.metadata.mjs +8 -2
- package/browser/common/metadata/index.mjs +1 -1
- package/browser/common/metadata/output-policy.mjs +4 -0
- package/browser/common/metadata/workflow.metadata.mjs +3 -1
- package/browser/common/tokens/workflow.tokens.mjs +1 -0
- package/browser/common/types/options/transport/schema.mjs +3 -0
- package/browser/common/utils/auth-info.utils.mjs +1 -2
- package/browser/common/utils/index.mjs +1 -1
- package/browser/common/utils/principal.utils.mjs +25 -1
- package/browser/context/frontmcp-context-storage.mjs +14 -3
- package/browser/context/frontmcp-context.mjs +24 -2
- package/browser/elicitation/helpers/checked-elicit-answer.mjs +18 -0
- package/browser/elicitation/helpers/elicit.helper.mjs +5 -21
- package/browser/elicitation/store/elicitation-encryption.mjs +6 -6
- package/browser/elicitation/store/encrypted-elicitation.store.mjs +2 -2
- package/browser/elicitation/store/storage-elicitation.store.mjs +1 -2
- package/browser/errors/auth-internal.errors.mjs +2 -0
- package/browser/errors/index.mjs +6 -1
- package/browser/errors/mcp.error.mjs +22 -3
- package/browser/errors/misconfiguration.mjs +2 -0
- package/browser/errors/remote.errors.mjs +1 -1
- package/browser/errors/tool-ui.errors.mjs +22 -0
- package/browser/errors/workflow.errors.mjs +7 -1
- package/browser/esm-loader/esm-cache.mjs +2 -2
- package/browser/esm-loader/esm-entries.mjs +15 -1
- package/browser/esm-loader/esm-manifest.mjs +32 -25
- package/browser/esm-loader/esm-module-loader.mjs +22 -4
- package/browser/esm-loader/factories/esm-context-factories.mjs +3 -3
- package/browser/esm-loader/factories/esm-instance-factories.mjs +7 -3
- package/browser/esm-loader/factories/esm-record-builders.mjs +27 -2
- package/browser/esm-loader/semver.utils.mjs +3 -5
- package/browser/esm-loader/version-poller.mjs +1 -1
- package/browser/esm-loader/version-resolver.mjs +5 -1
- package/browser/ext-apps/ext-apps.handler.mjs +6 -1
- package/browser/flows/flow.http-path.mjs +5 -1
- package/browser/flows/flow.instance.mjs +42 -9
- package/browser/front-mcp/front-mcp.mjs +19 -2
- package/browser/front-mcp/session-secret.check.mjs +22 -0
- package/browser/http-route/http-route.table.mjs +23 -3
- package/browser/index.cjs +30225 -27807
- package/browser/index.mjs +8 -4
- package/browser/job/execution/job-execution.manager.mjs +20 -17
- package/browser/job/flows/execute-job.flow.mjs +5 -3
- package/browser/job/index.mjs +2 -2
- package/browser/job/job-attempt.mjs +15 -10
- package/browser/job/job-context-providers.mjs +2 -1
- package/browser/job/job-scope.helper.mjs +76 -4
- package/browser/job/job.registry.mjs +30 -0
- package/browser/job/tools/index.mjs +3 -1
- package/browser/job/tools/list-jobs.tool.mjs +7 -5
- package/browser/job/tools/update-job.tool.mjs +75 -0
- package/browser/logger/instances/instance.logger.mjs +31 -6
- package/browser/notification/notification.service.mjs +26 -5
- package/browser/prompt/flows/get-prompt.flow.mjs +3 -3
- package/browser/prompt/flows/prompts-list.flow.mjs +11 -4
- package/browser/provider/provider.registry.mjs +1 -1
- package/browser/remote-mcp/factories/instance-factories.mjs +4 -4
- package/browser/remote-mcp/factories/record-builders.mjs +5 -0
- package/browser/remote-mcp/mcp-client.service.mjs +113 -68
- package/browser/remote-mcp/mcp-stateless-client.adapter.mjs +2 -2
- package/browser/remote-mcp/remote-entries.mjs +2 -1
- package/browser/remote-mcp/remote-oauth.mjs +102 -0
- package/browser/remote-mcp/remote-request-headers.mjs +42 -12
- package/browser/remote-mcp/resilience/circuit-breaker.mjs +3 -2
- package/browser/resource/flows/read-resource.flow.mjs +6 -4
- package/browser/resource/flows/resource-templates-list.flow.mjs +24 -9
- package/browser/resource/flows/resources-list.flow.mjs +11 -4
- package/browser/scope/flows/http.request.flow.mjs +1 -1
- package/browser/scope/observability-scope.helper.mjs +6 -1
- package/browser/scope/scope.instance.mjs +284 -81
- package/browser/skill/errors/tool-not-allowed.error.mjs +2 -2
- package/browser/skill/flows/filter-skills.flow.mjs +1 -1
- package/browser/skill/flows/load-skill.flow.mjs +27 -15
- package/browser/skill/guards/tool-authorization.guard.mjs +1 -1
- package/browser/skill/hooks/skill-tool.hook.mjs +32 -24
- package/browser/skill/providers/external-skill.provider.mjs +4 -2
- package/browser/skill/session/skill-session-store.interface.mjs +10 -0
- package/browser/skill/session/skill-session.manager.mjs +8 -0
- package/browser/skill/skill-authorities.helper.mjs +9 -3
- package/browser/skill/skill-scope.helper.mjs +7 -2
- package/browser/skill/skill.registry.mjs +21 -2
- package/browser/subsystems.mjs +6 -2
- package/browser/surface/entry-authorized.mjs +15 -0
- package/browser/tool/flows/call-tool.flow.mjs +59 -13
- package/browser/tool/flows/tools-list.flow.mjs +11 -4
- package/browser/tool/tool.utils.mjs +46 -61
- package/browser/tool/ui/serving-mode-default.mjs +11 -2
- package/browser/tool/ui/template-detection.mjs +1 -1
- package/browser/tool/ui/ui-option-warnings.mjs +1 -28
- package/browser/tool/ui/ui-render.mjs +6 -0
- package/browser/tool/ui/ui-resource.handler.mjs +50 -6
- package/browser/tool/ui/ui-shared.mjs +61 -7
- package/browser/tool/ui/widget-routes.mjs +73 -0
- package/browser/tool/ui/widget-serving.mjs +112 -0
- package/browser/transport/flows/handle.mcp-20260728.flow.mjs +1 -1
- package/browser/transport/flows/handle.stateless-http.flow.mjs +1 -2
- package/browser/transport/mcp-20260728/client/index.mjs +1 -1
- package/browser/transport/mcp-20260728/client/mcp-stateless.client.mjs +2 -1
- package/browser/transport/mcp-20260728/index.mjs +1 -1
- package/browser/transport/web-fetch-handler.mjs +5 -1
- package/browser/utils/abort.utils.mjs +7 -2
- package/browser/utils/content.utils.mjs +1 -1
- package/browser/workflow/engine/workflow-step.executor.mjs +1 -1
- package/browser/workflow/engine/workflow.engine.mjs +13 -10
- package/browser/workflow/index.mjs +2 -2
- package/browser/workflow/tools/execute-workflow.tool.mjs +1 -1
- package/browser/workflow/tools/index.mjs +3 -1
- package/browser/workflow/tools/list-workflows.tool.mjs +4 -2
- package/browser/workflow/tools/register-workflow.tool.mjs +11 -2
- package/browser/workflow/tools/update-workflow.tool.mjs +80 -0
- package/browser/workflow/trigger/workflow-events.mjs +39 -0
- package/browser/workflow/trigger/workflow-triggers.mjs +80 -0
- package/browser/workflow/trigger/workflow-webhook.routes.mjs +104 -0
- package/browser/workflow/trigger/workflow-webhook.signature.mjs +59 -0
- package/browser/workflow/workflow.registry.mjs +27 -0
- package/browser/workflow/workflow.utils.mjs +13 -2
- package/builtin/authorities/authorities.plugin.d.ts +1 -1
- package/builtin/authorities/authorities.plugin.d.ts.map +1 -1
- package/builtin/authorities/authorities.plugin.options.d.ts +1 -1
- package/builtin/authorities/authorities.plugin.options.d.ts.map +1 -1
- package/builtin/config/config-resolver.d.ts.map +1 -1
- package/channel/channel-scope.helper.d.ts +2 -0
- package/channel/channel-scope.helper.d.ts.map +1 -1
- package/channel/channel.types.d.ts +1 -1
- package/channel/channel.types.d.ts.map +1 -1
- package/channel/sources/agent-completion.source.d.ts +1 -1
- package/channel/sources/agent-completion.source.d.ts.map +1 -1
- package/common/decorators/app.decorator.d.ts +1 -1
- package/common/decorators/app.decorator.d.ts.map +1 -1
- package/common/entries/provider.entry.d.ts +2 -2
- package/common/entries/provider.entry.d.ts.map +1 -1
- package/common/entries/scope.entry.d.ts +25 -3
- package/common/entries/scope.entry.d.ts.map +1 -1
- package/common/entries/tool.entry.d.ts +5 -3
- package/common/entries/tool.entry.d.ts.map +1 -1
- package/common/interfaces/agent.interface.d.ts +4 -2
- package/common/interfaces/agent.interface.d.ts.map +1 -1
- package/common/interfaces/llm-adapter.interface.d.ts +5 -0
- package/common/interfaces/llm-adapter.interface.d.ts.map +1 -1
- package/common/interfaces/logger.interface.d.ts +2 -1
- package/common/interfaces/logger.interface.d.ts.map +1 -1
- package/common/interfaces/tool.interface.d.ts +12 -2
- package/common/interfaces/tool.interface.d.ts.map +1 -1
- package/common/metadata/agent.metadata.d.ts +7 -2
- package/common/metadata/agent.metadata.d.ts.map +1 -1
- package/common/metadata/app.metadata.d.ts +35 -11
- package/common/metadata/app.metadata.d.ts.map +1 -1
- package/common/metadata/flow.metadata.d.ts +14 -0
- package/common/metadata/flow.metadata.d.ts.map +1 -1
- package/common/metadata/front-mcp.metadata.d.ts +2 -1
- package/common/metadata/front-mcp.metadata.d.ts.map +1 -1
- package/common/metadata/job.metadata.d.ts +11 -0
- package/common/metadata/job.metadata.d.ts.map +1 -1
- package/common/metadata/output-policy.d.ts +2 -0
- package/common/metadata/output-policy.d.ts.map +1 -1
- package/common/metadata/remote-primitive.metadata.d.ts +6 -3
- package/common/metadata/remote-primitive.metadata.d.ts.map +1 -1
- package/common/metadata/resource.metadata.d.ts +1 -1
- package/common/metadata/workflow.metadata.d.ts +50 -14
- package/common/metadata/workflow.metadata.d.ts.map +1 -1
- package/common/tokens/workflow.tokens.d.ts +1 -0
- package/common/tokens/workflow.tokens.d.ts.map +1 -1
- package/common/types/options/logging/interfaces.d.ts +3 -1
- package/common/types/options/logging/interfaces.d.ts.map +1 -1
- package/common/types/options/observability/interfaces.d.ts +4 -2
- package/common/types/options/observability/interfaces.d.ts.map +1 -1
- package/common/types/options/transport/interfaces.d.ts +3 -0
- package/common/types/options/transport/interfaces.d.ts.map +1 -1
- package/common/types/options/transport/schema.d.ts.map +1 -1
- package/common/utils/auth-info.utils.d.ts +1 -0
- package/common/utils/auth-info.utils.d.ts.map +1 -1
- package/common/utils/global-config.utils.d.ts.map +1 -1
- package/common/utils/principal.utils.d.ts +24 -0
- package/common/utils/principal.utils.d.ts.map +1 -1
- package/context/frontmcp-context-storage.d.ts +3 -1
- package/context/frontmcp-context-storage.d.ts.map +1 -1
- package/context/frontmcp-context.d.ts +9 -1
- package/context/frontmcp-context.d.ts.map +1 -1
- package/elicitation/helpers/checked-elicit-answer.d.ts +10 -0
- package/elicitation/helpers/checked-elicit-answer.d.ts.map +1 -0
- package/elicitation/helpers/elicit.helper.d.ts.map +1 -1
- package/elicitation/store/elicitation-encryption.d.ts.map +1 -1
- package/elicitation/store/encrypted-elicitation.store.d.ts +2 -2
- package/elicitation/store/encrypted-elicitation.store.d.ts.map +1 -1
- package/elicitation/store/storage-elicitation.store.d.ts +3 -3
- package/elicitation/store/storage-elicitation.store.d.ts.map +1 -1
- package/errors/auth-internal.errors.d.ts +1 -1
- package/errors/auth-internal.errors.d.ts.map +1 -1
- package/errors/error-handler.d.ts.map +1 -1
- package/errors/index.d.ts +3 -2
- package/errors/index.d.ts.map +1 -1
- package/errors/mcp.error.d.ts +6 -1
- package/errors/mcp.error.d.ts.map +1 -1
- package/errors/misconfiguration.d.ts.map +1 -1
- package/errors/remote.errors.d.ts +1 -1
- package/errors/remote.errors.d.ts.map +1 -1
- package/errors/tool-ui.errors.d.ts +13 -0
- package/errors/tool-ui.errors.d.ts.map +1 -0
- package/errors/workflow.errors.d.ts +4 -0
- package/errors/workflow.errors.d.ts.map +1 -1
- package/esm/index.mjs +46 -45
- package/esm/job/tools/index.mjs +3 -2
- package/esm/workflow/tools/index.mjs +3 -2
- package/esm-loader/app-helpers.d.ts +4 -4
- package/esm-loader/app-helpers.d.ts.map +1 -1
- package/esm-loader/esm-entries.d.ts +11 -1
- package/esm-loader/esm-entries.d.ts.map +1 -1
- package/esm-loader/esm-manifest.d.ts +11 -8
- package/esm-loader/esm-manifest.d.ts.map +1 -1
- package/esm-loader/esm-module-loader.d.ts +6 -1
- package/esm-loader/esm-module-loader.d.ts.map +1 -1
- package/esm-loader/factories/esm-context-factories.d.ts +6 -3
- package/esm-loader/factories/esm-context-factories.d.ts.map +1 -1
- package/esm-loader/factories/esm-instance-factories.d.ts +3 -3
- package/esm-loader/factories/esm-instance-factories.d.ts.map +1 -1
- package/esm-loader/factories/esm-record-builders.d.ts.map +1 -1
- package/esm-loader/semver.utils.d.ts +8 -0
- package/esm-loader/semver.utils.d.ts.map +1 -1
- package/esm-loader/version-resolver.d.ts.map +1 -1
- package/ext-apps/ext-apps.handler.d.ts +2 -1
- package/ext-apps/ext-apps.handler.d.ts.map +1 -1
- package/flows/flow.http-path.d.ts +8 -0
- package/flows/flow.http-path.d.ts.map +1 -1
- package/flows/flow.instance.d.ts +9 -0
- package/flows/flow.instance.d.ts.map +1 -1
- package/front-mcp/front-mcp.d.ts +2 -0
- package/front-mcp/front-mcp.d.ts.map +1 -1
- package/front-mcp/session-secret.check.d.ts +19 -0
- package/front-mcp/session-secret.check.d.ts.map +1 -0
- package/http-route/http-route.table.d.ts.map +1 -1
- package/index.d.ts +4 -4
- package/index.d.ts.map +1 -1
- package/index.js +53 -52
- package/job/execution/job-execution.manager.d.ts +8 -3
- package/job/execution/job-execution.manager.d.ts.map +1 -1
- package/job/flows/execute-job.flow.d.ts +1 -0
- package/job/flows/execute-job.flow.d.ts.map +1 -1
- package/job/job-attempt.d.ts +7 -2
- package/job/job-attempt.d.ts.map +1 -1
- package/job/job-context-providers.d.ts +2 -2
- package/job/job-context-providers.d.ts.map +1 -1
- package/job/job-scope.helper.d.ts +26 -0
- package/job/job-scope.helper.d.ts.map +1 -1
- package/job/job.registry.d.ts +11 -0
- package/job/job.registry.d.ts.map +1 -1
- package/job/tools/index.d.ts +1 -0
- package/job/tools/index.d.ts.map +1 -1
- package/job/tools/index.js +4 -2
- package/job/tools/list-jobs.tool.d.ts +3 -3
- package/job/tools/list-jobs.tool.d.ts.map +1 -1
- package/job/tools/update-job.tool.d.ts +16 -0
- package/job/tools/update-job.tool.d.ts.map +1 -0
- package/logger/instances/instance.logger.d.ts +1 -0
- package/logger/instances/instance.logger.d.ts.map +1 -1
- package/notification/notification.service.d.ts +10 -3
- package/notification/notification.service.d.ts.map +1 -1
- package/package.json +10 -10
- package/prompt/flows/prompts-list.flow.d.ts.map +1 -1
- package/provider/provider.registry.d.ts.map +1 -1
- package/remote-mcp/factories/instance-factories.d.ts +4 -4
- package/remote-mcp/factories/instance-factories.d.ts.map +1 -1
- package/remote-mcp/factories/record-builders.d.ts.map +1 -1
- package/remote-mcp/mcp-client.service.d.ts +11 -0
- package/remote-mcp/mcp-client.service.d.ts.map +1 -1
- package/remote-mcp/mcp-client.types.d.ts +15 -2
- package/remote-mcp/mcp-client.types.d.ts.map +1 -1
- package/remote-mcp/mcp-stateless-client.adapter.d.ts +1 -1
- package/remote-mcp/mcp-stateless-client.adapter.d.ts.map +1 -1
- package/remote-mcp/remote-entries.d.ts +2 -1
- package/remote-mcp/remote-entries.d.ts.map +1 -1
- package/remote-mcp/remote-oauth.d.ts +27 -0
- package/remote-mcp/remote-oauth.d.ts.map +1 -0
- package/remote-mcp/remote-request-headers.d.ts +8 -2
- package/remote-mcp/remote-request-headers.d.ts.map +1 -1
- package/remote-mcp/resilience/circuit-breaker.d.ts +3 -2
- package/remote-mcp/resilience/circuit-breaker.d.ts.map +1 -1
- package/resource/flows/read-resource.flow.d.ts.map +1 -1
- package/resource/flows/resource-templates-list.flow.d.ts.map +1 -1
- package/resource/flows/resources-list.flow.d.ts.map +1 -1
- package/scope/observability-scope.helper.d.ts.map +1 -1
- package/scope/scope.instance.d.ts +35 -1
- package/scope/scope.instance.d.ts.map +1 -1
- package/skill/errors/tool-not-allowed.error.d.ts.map +1 -1
- package/skill/flows/load-skill.flow.d.ts.map +1 -1
- package/skill/guards/tool-authorization.guard.d.ts +1 -1
- package/skill/guards/tool-authorization.guard.d.ts.map +1 -1
- package/skill/hooks/skill-tool.hook.d.ts +2 -0
- package/skill/hooks/skill-tool.hook.d.ts.map +1 -1
- package/skill/providers/external-skill.provider.d.ts +2 -2
- package/skill/providers/external-skill.provider.d.ts.map +1 -1
- package/skill/session/skill-session-store.interface.d.ts +5 -0
- package/skill/session/skill-session-store.interface.d.ts.map +1 -1
- package/skill/session/skill-session.manager.d.ts +4 -0
- package/skill/session/skill-session.manager.d.ts.map +1 -1
- package/skill/session/skill-session.types.d.ts +1 -1
- package/skill/skill-authorities.helper.d.ts +6 -3
- package/skill/skill-authorities.helper.d.ts.map +1 -1
- package/skill/skill-scope.helper.d.ts +5 -0
- package/skill/skill-scope.helper.d.ts.map +1 -1
- package/skill/skill.registry.d.ts +7 -0
- package/skill/skill.registry.d.ts.map +1 -1
- package/subsystems.d.ts +2 -2
- package/subsystems.d.ts.map +1 -1
- package/surface/entry-authorized.d.ts +5 -0
- package/surface/entry-authorized.d.ts.map +1 -0
- package/tool/flows/call-tool.flow.d.ts +6 -0
- package/tool/flows/call-tool.flow.d.ts.map +1 -1
- package/tool/flows/tools-list.flow.d.ts +1 -1
- package/tool/flows/tools-list.flow.d.ts.map +1 -1
- package/tool/tool.utils.d.ts.map +1 -1
- package/tool/ui/serving-mode-default.d.ts +6 -2
- package/tool/ui/serving-mode-default.d.ts.map +1 -1
- package/tool/ui/ui-option-warnings.d.ts.map +1 -1
- package/tool/ui/ui-render.d.ts +2 -2
- package/tool/ui/ui-render.d.ts.map +1 -1
- package/tool/ui/ui-resource.handler.d.ts +10 -2
- package/tool/ui/ui-resource.handler.d.ts.map +1 -1
- package/tool/ui/ui-shared.d.ts +31 -5
- package/tool/ui/ui-shared.d.ts.map +1 -1
- package/tool/ui/widget-routes.d.ts +38 -0
- package/tool/ui/widget-routes.d.ts.map +1 -0
- package/tool/ui/widget-serving.d.ts +37 -0
- package/tool/ui/widget-serving.d.ts.map +1 -0
- package/transport/mcp-20260728/client/mcp-stateless.client.d.ts +2 -0
- package/transport/mcp-20260728/client/mcp-stateless.client.d.ts.map +1 -1
- package/transport/web-fetch-handler.d.ts.map +1 -1
- package/utils/abort.utils.d.ts +5 -0
- package/utils/abort.utils.d.ts.map +1 -1
- package/workflow/engine/workflow.engine.d.ts +8 -1
- package/workflow/engine/workflow.engine.d.ts.map +1 -1
- package/workflow/tools/execute-workflow.tool.d.ts.map +1 -1
- package/workflow/tools/index.d.ts +1 -0
- package/workflow/tools/index.d.ts.map +1 -1
- package/workflow/tools/index.js +4 -2
- package/workflow/tools/list-workflows.tool.d.ts.map +1 -1
- package/workflow/tools/register-workflow.tool.d.ts.map +1 -1
- package/workflow/tools/update-workflow.tool.d.ts +21 -0
- package/workflow/tools/update-workflow.tool.d.ts.map +1 -0
- package/workflow/trigger/workflow-events.d.ts +22 -0
- package/workflow/trigger/workflow-events.d.ts.map +1 -0
- package/workflow/trigger/workflow-triggers.d.ts +34 -0
- package/workflow/trigger/workflow-triggers.d.ts.map +1 -0
- package/workflow/trigger/workflow-webhook.routes.d.ts +16 -0
- package/workflow/trigger/workflow-webhook.routes.d.ts.map +1 -0
- package/workflow/trigger/workflow-webhook.signature.d.ts +41 -0
- package/workflow/trigger/workflow-webhook.signature.d.ts.map +1 -0
- package/workflow/workflow.registry.d.ts +11 -0
- package/workflow/workflow.registry.d.ts.map +1 -1
- package/workflow/workflow.utils.d.ts +7 -0
- package/workflow/workflow.utils.d.ts.map +1 -1
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
// libs/sdk/src/esm-loader/esm-manifest.ts
|
|
2
|
+
import { getMetadata } from "@frontmcp/di";
|
|
2
3
|
import { internalZ as z } from "@frontmcp/lazy-zod";
|
|
4
|
+
import { collectAppMetadata } from "../app/app.utils.mjs";
|
|
3
5
|
import {
|
|
4
6
|
isDecoratedAgentClass,
|
|
5
7
|
isDecoratedJobClass,
|
|
6
8
|
isDecoratedPromptClass,
|
|
9
|
+
isDecoratedProviderClass,
|
|
7
10
|
isDecoratedResourceClass,
|
|
8
11
|
isDecoratedSkillClass,
|
|
9
12
|
isDecoratedToolClass,
|
|
10
13
|
isDecoratedWorkflowClass
|
|
11
14
|
} from "../app/instances/esm-normalize.utils.mjs";
|
|
12
15
|
import { getDecoratorConfig } from "../common/decorators/front-mcp.decorator.mjs";
|
|
16
|
+
import { FrontMcpLocalAppTokens } from "../common/tokens/app.tokens.mjs";
|
|
13
17
|
var frontMcpPackageManifestSchema = z.object({
|
|
14
18
|
name: z.string().min(1),
|
|
15
19
|
version: z.string().min(1),
|
|
@@ -43,8 +47,12 @@ function normalizeEsmExport(moduleExport) {
|
|
|
43
47
|
if (isManifestObject(defaultExport)) {
|
|
44
48
|
return validateManifest(defaultExport);
|
|
45
49
|
}
|
|
46
|
-
if (
|
|
47
|
-
return
|
|
50
|
+
if (isDecoratedAppClass(defaultExport)) {
|
|
51
|
+
return manifestOfApp(defaultExport);
|
|
52
|
+
}
|
|
53
|
+
const serverConfig = getDecoratorConfig(defaultExport);
|
|
54
|
+
if (serverConfig) {
|
|
55
|
+
return manifestOfServer(serverConfig);
|
|
48
56
|
}
|
|
49
57
|
if (isDecoratedPrimitive(defaultExport)) {
|
|
50
58
|
return collectDecoratedExports({ default: defaultExport });
|
|
@@ -72,33 +80,29 @@ function normalizeEsmExport(moduleExport) {
|
|
|
72
80
|
function isManifestObject(obj) {
|
|
73
81
|
return typeof obj["name"] === "string" && typeof obj["version"] === "string";
|
|
74
82
|
}
|
|
75
|
-
function
|
|
76
|
-
|
|
77
|
-
try {
|
|
78
|
-
return Reflect.getMetadata?.("frontmcp:type", value) === true;
|
|
79
|
-
} catch {
|
|
80
|
-
return false;
|
|
81
|
-
}
|
|
83
|
+
function isDecoratedAppClass(value) {
|
|
84
|
+
return typeof value === "function" && getMetadata(FrontMcpLocalAppTokens.type, value) === true;
|
|
82
85
|
}
|
|
83
86
|
function hasManifestPrimitives(obj) {
|
|
84
87
|
return MANIFEST_PRIMITIVE_KEYS.some((key) => Array.isArray(obj[key]));
|
|
85
88
|
}
|
|
86
|
-
function
|
|
87
|
-
const
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
89
|
+
function manifestOfApp(cls) {
|
|
90
|
+
const metadata = collectAppMetadata(cls);
|
|
91
|
+
return { ...collectNamedExports(metadata), version: "0.0.0" };
|
|
92
|
+
}
|
|
93
|
+
function manifestOfServer(config) {
|
|
94
|
+
const server = config;
|
|
95
|
+
const info = server["info"] ?? {};
|
|
96
|
+
const apps = Array.isArray(server["apps"]) ? server["apps"].filter(isDecoratedAppClass).map(manifestOfApp) : [];
|
|
97
|
+
const parts = [collectNamedExports(server), ...apps];
|
|
98
|
+
const entriesOf = (key) => {
|
|
99
|
+
const entries = parts.flatMap((part) => part[key] ?? []);
|
|
100
|
+
return entries.length > 0 ? entries : void 0;
|
|
101
|
+
};
|
|
91
102
|
return {
|
|
92
|
-
name:
|
|
93
|
-
version: "0.0.0",
|
|
94
|
-
|
|
95
|
-
prompts: Array.isArray(config["prompts"]) ? config["prompts"] : void 0,
|
|
96
|
-
resources: Array.isArray(config["resources"]) ? config["resources"] : void 0,
|
|
97
|
-
skills: Array.isArray(config["skills"]) ? config["skills"] : void 0,
|
|
98
|
-
agents: Array.isArray(config["agents"]) ? config["agents"] : void 0,
|
|
99
|
-
jobs: Array.isArray(config["jobs"]) ? config["jobs"] : void 0,
|
|
100
|
-
workflows: Array.isArray(config["workflows"]) ? config["workflows"] : void 0,
|
|
101
|
-
providers: Array.isArray(config["providers"]) ? config["providers"] : void 0
|
|
103
|
+
name: typeof info["name"] === "string" ? info["name"] : "unknown",
|
|
104
|
+
version: typeof info["version"] === "string" ? info["version"] : "0.0.0",
|
|
105
|
+
...Object.fromEntries(MANIFEST_PRIMITIVE_KEYS.map((key) => [key, entriesOf(key)]))
|
|
102
106
|
};
|
|
103
107
|
}
|
|
104
108
|
function collectNamedExports(mod) {
|
|
@@ -130,6 +134,7 @@ function collectDecoratedExports(mod) {
|
|
|
130
134
|
const jobs = [];
|
|
131
135
|
const agents = [];
|
|
132
136
|
const workflows = [];
|
|
137
|
+
const providers = [];
|
|
133
138
|
for (const value of Object.values(mod)) {
|
|
134
139
|
if (!value || typeof value !== "function") continue;
|
|
135
140
|
if (isDecoratedToolClass(value)) tools.push(value);
|
|
@@ -139,6 +144,7 @@ function collectDecoratedExports(mod) {
|
|
|
139
144
|
else if (isDecoratedJobClass(value)) jobs.push(value);
|
|
140
145
|
else if (isDecoratedAgentClass(value)) agents.push(value);
|
|
141
146
|
else if (isDecoratedWorkflowClass(value)) workflows.push(value);
|
|
147
|
+
else if (isDecoratedProviderClass(value)) providers.push(value);
|
|
142
148
|
}
|
|
143
149
|
return {
|
|
144
150
|
name: typeof mod["name"] === "string" ? mod["name"] : "unknown",
|
|
@@ -149,7 +155,8 @@ function collectDecoratedExports(mod) {
|
|
|
149
155
|
...skills.length ? { skills } : {},
|
|
150
156
|
...jobs.length ? { jobs } : {},
|
|
151
157
|
...agents.length ? { agents } : {},
|
|
152
|
-
...workflows.length ? { workflows } : {}
|
|
158
|
+
...workflows.length ? { workflows } : {},
|
|
159
|
+
...providers.length ? { providers } : {}
|
|
153
160
|
};
|
|
154
161
|
}
|
|
155
162
|
function validateManifest(obj) {
|
|
@@ -12,12 +12,19 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
|
|
|
12
12
|
import { sha256Hex } from "@frontmcp/utils";
|
|
13
13
|
import { importComputed } from "./import-computed.mjs";
|
|
14
14
|
import { EsmCacheError, EsmManifestInvalidError, EsmPackageLoadError } from "../errors/esm.errors.mjs";
|
|
15
|
+
import { resolveRegistryToken } from "./esm-auth.types.mjs";
|
|
15
16
|
import { normalizeEsmExport } from "./esm-manifest.mjs";
|
|
16
|
-
import {
|
|
17
|
+
import {
|
|
18
|
+
applyImportMap,
|
|
19
|
+
buildEsmShUrl,
|
|
20
|
+
ESM_SH_BASE_URL,
|
|
21
|
+
importMapPackages
|
|
22
|
+
} from "./package-specifier.mjs";
|
|
17
23
|
import { VersionResolver } from "./version-resolver.mjs";
|
|
18
24
|
var EsmModuleLoader = class {
|
|
19
25
|
cache;
|
|
20
26
|
versionResolver;
|
|
27
|
+
registryAuth;
|
|
21
28
|
timeout;
|
|
22
29
|
logger;
|
|
23
30
|
esmBaseUrl;
|
|
@@ -28,6 +35,7 @@ var EsmModuleLoader = class {
|
|
|
28
35
|
this.logger = options.logger;
|
|
29
36
|
this.esmBaseUrl = options.esmBaseUrl;
|
|
30
37
|
this.importMap = options.importMap ?? {};
|
|
38
|
+
this.registryAuth = options.registryAuth;
|
|
31
39
|
this.versionResolver = new VersionResolver({
|
|
32
40
|
registryAuth: options.registryAuth,
|
|
33
41
|
timeout: options.timeout
|
|
@@ -49,7 +57,7 @@ var EsmModuleLoader = class {
|
|
|
49
57
|
this.logger?.debug(`Cache hit for ${specifier.fullName}@${resolvedVersion}`);
|
|
50
58
|
return this.loadFromCache(cached, specifier, resolvedVersion);
|
|
51
59
|
}
|
|
52
|
-
this.logger?.debug(`Cache miss, fetching ${specifier.fullName}@${resolvedVersion} from
|
|
60
|
+
this.logger?.debug(`Cache miss, fetching ${specifier.fullName}@${resolvedVersion} from ${this.bundleServer}`);
|
|
53
61
|
return this.fetchAndCache(specifier, resolvedVersion, cacheVersion);
|
|
54
62
|
}
|
|
55
63
|
/** The version a bundle is cached under: a bundle rewritten by an import map is cached apart, per map. */
|
|
@@ -125,6 +133,7 @@ var EsmModuleLoader = class {
|
|
|
125
133
|
let response;
|
|
126
134
|
try {
|
|
127
135
|
response = await fetch(url, {
|
|
136
|
+
headers: this.bundleHeaders(),
|
|
128
137
|
signal: controller.signal
|
|
129
138
|
});
|
|
130
139
|
} catch (error) {
|
|
@@ -143,7 +152,7 @@ var EsmModuleLoader = class {
|
|
|
143
152
|
}
|
|
144
153
|
if (!response.ok) {
|
|
145
154
|
throw new Error(
|
|
146
|
-
|
|
155
|
+
`${this.bundleServer} returned ${response.status} for "${specifier.fullName}@${resolvedVersion}": ${response.statusText}`
|
|
147
156
|
);
|
|
148
157
|
}
|
|
149
158
|
const bundleContent = applyImportMap(await response.text(), this.importMap);
|
|
@@ -151,7 +160,7 @@ var EsmModuleLoader = class {
|
|
|
151
160
|
const entry = await this.cache.put(specifier.fullName, cacheVersion, bundleContent, url, etag);
|
|
152
161
|
const rawModule = entry.bundlePath ? await this.importFromPath(entry.bundlePath) : await this.importBundle(bundleContent);
|
|
153
162
|
const manifest = this.manifestOf(rawModule, specifier);
|
|
154
|
-
this.logger?.info(`Loaded ${specifier.fullName}@${resolvedVersion} from
|
|
163
|
+
this.logger?.info(`Loaded ${specifier.fullName}@${resolvedVersion} from ${this.bundleServer}`);
|
|
155
164
|
return {
|
|
156
165
|
manifest,
|
|
157
166
|
resolvedVersion,
|
|
@@ -160,6 +169,15 @@ var EsmModuleLoader = class {
|
|
|
160
169
|
rawModule
|
|
161
170
|
};
|
|
162
171
|
}
|
|
172
|
+
/** Where bundles are downloaded from: the loader `url`, else esm.sh. */
|
|
173
|
+
get bundleServer() {
|
|
174
|
+
return this.esmBaseUrl ?? ESM_SH_BASE_URL;
|
|
175
|
+
}
|
|
176
|
+
/** The token goes with a bundle download from the configured loader `url`, never to the default esm.sh. */
|
|
177
|
+
bundleHeaders() {
|
|
178
|
+
const token = this.esmBaseUrl ? resolveRegistryToken(this.registryAuth) : void 0;
|
|
179
|
+
return token ? { Authorization: `Bearer ${token}` } : void 0;
|
|
180
|
+
}
|
|
163
181
|
/**
|
|
164
182
|
* Import a bundle from a local file path (Node.js only).
|
|
165
183
|
* Uses dynamic import with file:// URL for cross-platform compatibility.
|
|
@@ -3,7 +3,7 @@ import { PromptContext, ResourceContext, ToolContext } from "../../common/index.
|
|
|
3
3
|
function createEsmToolContextClass(executeFn, toolName) {
|
|
4
4
|
const cls = class DynamicEsmToolContext extends ToolContext {
|
|
5
5
|
async execute(input) {
|
|
6
|
-
return executeFn(input);
|
|
6
|
+
return executeFn(input, this);
|
|
7
7
|
}
|
|
8
8
|
};
|
|
9
9
|
Object.defineProperty(cls, "name", { value: `EsmTool_${toolName}` });
|
|
@@ -12,7 +12,7 @@ function createEsmToolContextClass(executeFn, toolName) {
|
|
|
12
12
|
function createEsmResourceContextClass(readFn, resourceName) {
|
|
13
13
|
const cls = class DynamicEsmResourceContext extends ResourceContext {
|
|
14
14
|
async execute(uri, params) {
|
|
15
|
-
return readFn(uri, params);
|
|
15
|
+
return readFn(uri, params, this);
|
|
16
16
|
}
|
|
17
17
|
};
|
|
18
18
|
Object.defineProperty(cls, "name", { value: `EsmResource_${resourceName}` });
|
|
@@ -21,7 +21,7 @@ function createEsmResourceContextClass(readFn, resourceName) {
|
|
|
21
21
|
function createEsmPromptContextClass(executeFn, promptName) {
|
|
22
22
|
const cls = class DynamicEsmPromptContext extends PromptContext {
|
|
23
23
|
async execute(args) {
|
|
24
|
-
return executeFn(args);
|
|
24
|
+
return executeFn(args, this);
|
|
25
25
|
}
|
|
26
26
|
};
|
|
27
27
|
Object.defineProperty(cls, "name", { value: `EsmPrompt_${promptName}` });
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
// libs/sdk/src/esm-loader/factories/esm-instance-factories.ts
|
|
2
|
-
import { ToolInstance } from "../../tool/tool.instance.mjs";
|
|
3
|
-
import { ResourceInstance } from "../../resource/resource.instance.mjs";
|
|
4
2
|
import { PromptInstance } from "../../prompt/prompt.instance.mjs";
|
|
5
|
-
import {
|
|
3
|
+
import { ResourceInstance } from "../../resource/resource.instance.mjs";
|
|
4
|
+
import { ToolInstance } from "../../tool/tool.instance.mjs";
|
|
5
|
+
import {
|
|
6
|
+
buildEsmPromptRecord,
|
|
7
|
+
buildEsmResourceRecord,
|
|
8
|
+
buildEsmToolRecord
|
|
9
|
+
} from "./esm-record-builders.mjs";
|
|
6
10
|
function createEsmToolInstance(tool, providers, owner, namespace) {
|
|
7
11
|
const record = buildEsmToolRecord(tool, namespace);
|
|
8
12
|
return new ToolInstance(record, providers, owner);
|
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
ResourceKind,
|
|
6
6
|
ToolKind
|
|
7
7
|
} from "../../common/index.mjs";
|
|
8
|
+
import { InvalidInputError } from "../../errors/mcp.error.mjs";
|
|
8
9
|
import {
|
|
9
10
|
createEsmPromptContextClass,
|
|
10
11
|
createEsmResourceContextClass,
|
|
@@ -15,7 +16,6 @@ function isZodShape(schema) {
|
|
|
15
16
|
}
|
|
16
17
|
function buildEsmToolRecord(tool, namespace) {
|
|
17
18
|
const toolName = namespace ? `${namespace}:${tool.name}` : tool.name;
|
|
18
|
-
const ContextClass = createEsmToolContextClass(tool.execute, tool.name);
|
|
19
19
|
let inputSchema = {};
|
|
20
20
|
let rawInputSchema = void 0;
|
|
21
21
|
if (tool.inputSchema) {
|
|
@@ -25,13 +25,14 @@ function buildEsmToolRecord(tool, namespace) {
|
|
|
25
25
|
rawInputSchema = tool.inputSchema;
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
|
+
const ContextClass = createEsmToolContextClass(esmToolHandler(tool, rawInputSchema), tool.name);
|
|
28
29
|
const metadata = {
|
|
29
30
|
name: toolName,
|
|
30
31
|
id: toolName,
|
|
31
32
|
description: tool.description ?? `ESM tool: ${tool.name}`,
|
|
32
33
|
inputSchema,
|
|
33
34
|
rawInputSchema,
|
|
34
|
-
outputSchema: tool.outputSchema
|
|
35
|
+
outputSchema: tool.outputSchema,
|
|
35
36
|
annotations: {
|
|
36
37
|
"frontmcp:esm": true,
|
|
37
38
|
"frontmcp:esmTool": tool.name
|
|
@@ -43,6 +44,30 @@ function buildEsmToolRecord(tool, namespace) {
|
|
|
43
44
|
metadata
|
|
44
45
|
};
|
|
45
46
|
}
|
|
47
|
+
function esmToolHandler(tool, jsonInputSchema) {
|
|
48
|
+
const inputParser = jsonInputSchema && jsonSchemaParserOf(jsonInputSchema);
|
|
49
|
+
return async (input, context) => {
|
|
50
|
+
const parsed = inputParser?.safeParse(input);
|
|
51
|
+
if (parsed && !parsed.success) throw new InvalidInputError("Invalid tool input", parsed.error.issues);
|
|
52
|
+
const answer = await tool.execute(parsed?.data ?? input, context);
|
|
53
|
+
return tool.outputSchema === void 0 ? primitiveAnswerAsText(answer) : answer;
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
function jsonSchemaParserOf(jsonSchema) {
|
|
57
|
+
try {
|
|
58
|
+
return z.fromJSONSchema(
|
|
59
|
+
jsonSchema,
|
|
60
|
+
{ defaultTarget: "draft-2020-12" }
|
|
61
|
+
);
|
|
62
|
+
} catch {
|
|
63
|
+
return void 0;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
function primitiveAnswerAsText(answer) {
|
|
67
|
+
if (answer === void 0 || answer === null) return { content: [] };
|
|
68
|
+
if (typeof answer === "object") return answer;
|
|
69
|
+
return { content: [{ type: "text", text: String(answer) }] };
|
|
70
|
+
}
|
|
46
71
|
function buildEsmResourceRecord(resource, namespace) {
|
|
47
72
|
const resourceName = namespace ? `${namespace}:${resource.name}` : resource.name;
|
|
48
73
|
const ContextClass = createEsmResourceContextClass(resource.read, resource.name);
|
|
@@ -3,7 +3,6 @@ import {
|
|
|
3
3
|
compare as semverCompare,
|
|
4
4
|
gt as semverGt,
|
|
5
5
|
maxSatisfying as semverMaxSatisfying,
|
|
6
|
-
rcompare as semverRcompare,
|
|
7
6
|
satisfies as semverSatisfies,
|
|
8
7
|
valid as semverValid,
|
|
9
8
|
validRange as semverValidRange
|
|
@@ -16,10 +15,8 @@ function satisfiesRange(version, range) {
|
|
|
16
15
|
return semverSatisfies(version, range);
|
|
17
16
|
}
|
|
18
17
|
function maxSatisfying(versions, range) {
|
|
19
|
-
if (range === "latest"
|
|
20
|
-
|
|
21
|
-
return sorted[0] ?? null;
|
|
22
|
-
}
|
|
18
|
+
if (range === "latest") return semverMaxSatisfying(versions, "*");
|
|
19
|
+
if (isDistTag(range)) return null;
|
|
23
20
|
return semverMaxSatisfying(versions, range);
|
|
24
21
|
}
|
|
25
22
|
function isValidRange(range) {
|
|
@@ -37,6 +34,7 @@ function isNewerVersion(v1, v2) {
|
|
|
37
34
|
}
|
|
38
35
|
export {
|
|
39
36
|
compareVersions,
|
|
37
|
+
isDistTag,
|
|
40
38
|
isNewerVersion,
|
|
41
39
|
isValidRange,
|
|
42
40
|
isValidVersion,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// libs/sdk/src/esm-loader/version-poller.ts
|
|
2
|
-
import { VersionResolver } from "./version-resolver.mjs";
|
|
3
2
|
import { isNewerVersion, satisfiesRange } from "./semver.utils.mjs";
|
|
3
|
+
import { VersionResolver } from "./version-resolver.mjs";
|
|
4
4
|
var DEFAULT_INTERVAL_MS = 5 * 60 * 1e3;
|
|
5
5
|
var VersionPoller = class {
|
|
6
6
|
intervalMs;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// libs/sdk/src/esm-loader/version-resolver.ts
|
|
2
2
|
import { EsmRegistryAuthError, EsmVersionResolutionError } from "../errors/esm.errors.mjs";
|
|
3
3
|
import { getRegistryUrl, resolveRegistryToken } from "./esm-auth.types.mjs";
|
|
4
|
-
import { isValidVersion, maxSatisfying } from "./semver.utils.mjs";
|
|
4
|
+
import { isDistTag, isValidVersion, maxSatisfying } from "./semver.utils.mjs";
|
|
5
5
|
var VersionResolver = class {
|
|
6
6
|
registryAuth;
|
|
7
7
|
timeout;
|
|
@@ -95,6 +95,10 @@ var VersionResolver = class {
|
|
|
95
95
|
};
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
|
+
if (specifier.range !== "latest" && isDistTag(specifier.range)) {
|
|
99
|
+
const tags = Object.keys(data["dist-tags"] ?? {}).join(", ") || "none";
|
|
100
|
+
throw new Error(`"${specifier.range}" is not a dist-tag of "${specifier.fullName}" (its dist-tags: ${tags})`);
|
|
101
|
+
}
|
|
98
102
|
const resolved = maxSatisfying(versions, specifier.range);
|
|
99
103
|
if (!resolved) {
|
|
100
104
|
throw new Error(
|
|
@@ -63,7 +63,8 @@ var ExtAppsMessageHandler = class {
|
|
|
63
63
|
/**
|
|
64
64
|
* Handle a JSON-RPC notification from a widget (`notifications/message`,
|
|
65
65
|
* `ui/notifications/request-teardown`). A notification gets no answer, so a failure is only
|
|
66
|
-
* logged, and a notification this handler does not know is ignored
|
|
66
|
+
* logged, and a notification this handler does not know is ignored, as is a
|
|
67
|
+
* `ui/notifications/request-teardown` when the context has no `close` callback.
|
|
67
68
|
*
|
|
68
69
|
* @param notification - The JSON-RPC notification
|
|
69
70
|
*/
|
|
@@ -73,6 +74,10 @@ var ExtAppsMessageHandler = class {
|
|
|
73
74
|
this.logger.verbose(`handleNotification: ignoring method=${method}`);
|
|
74
75
|
return;
|
|
75
76
|
}
|
|
77
|
+
if (method === "ui/notifications/request-teardown" && !this.context.close) {
|
|
78
|
+
this.logger.verbose("handleNotification: ignoring ui/notifications/request-teardown (no close callback)");
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
76
81
|
try {
|
|
77
82
|
await this.routeMethod(method, params);
|
|
78
83
|
} catch (error) {
|
|
@@ -37,7 +37,11 @@ function captureSegments(expected, actual) {
|
|
|
37
37
|
}
|
|
38
38
|
return params;
|
|
39
39
|
}
|
|
40
|
+
function oauthBasePath(scope) {
|
|
41
|
+
return scope.routeBase ? scope.fullPath ?? "" : "";
|
|
42
|
+
}
|
|
40
43
|
export {
|
|
41
44
|
matchMountedPath,
|
|
42
|
-
matchRoutePath
|
|
45
|
+
matchRoutePath,
|
|
46
|
+
oauthBasePath
|
|
43
47
|
};
|
|
@@ -3,13 +3,14 @@ import "reflect-metadata";
|
|
|
3
3
|
import { tokenName } from "@frontmcp/di";
|
|
4
4
|
import { isDebug, isDevelopment } from "@frontmcp/utils";
|
|
5
5
|
import {
|
|
6
|
+
authInfoFromAuthorization,
|
|
6
7
|
FlowControl,
|
|
7
8
|
FlowEntry,
|
|
8
9
|
withHttpHeaders
|
|
9
10
|
} from "../common/index.mjs";
|
|
10
11
|
import { FRONTMCP_CONTEXT, FrontMcpContextStorage } from "../context/index.mjs";
|
|
11
12
|
import { runAsFlow } from "../context/running-flow.mjs";
|
|
12
|
-
import { InternalMcpError, PublicMcpError, RequestContextNotAvailableError } from "../errors/index.mjs";
|
|
13
|
+
import { InternalMcpError, PublicMcpError, RequestContextNotAvailableError, UnauthorizedError } from "../errors/index.mjs";
|
|
13
14
|
import { findMisconfiguration, misconfigurationBody } from "../errors/misconfiguration.mjs";
|
|
14
15
|
import { entryContextStageOf } from "../hooks/entry-class-hooks.mjs";
|
|
15
16
|
import {
|
|
@@ -23,7 +24,7 @@ import { bindContextHookTargets, staticHooksFor } from "../hooks/hooks.utils.mjs
|
|
|
23
24
|
import { writeHttpResponse } from "../server/server.validation.mjs";
|
|
24
25
|
import { flowErrorToHttpOutput } from "../transport/flow-error-output.mjs";
|
|
25
26
|
import { deferredFlowLoader } from "./deferred-flow.mjs";
|
|
26
|
-
import { matchMountedPath } from "./flow.http-path.mjs";
|
|
27
|
+
import { matchMountedPath, oauthBasePath } from "./flow.http-path.mjs";
|
|
27
28
|
import {
|
|
28
29
|
cloneStageMap,
|
|
29
30
|
collectFlowHookMap,
|
|
@@ -130,8 +131,7 @@ var FlowInstance = class extends FlowEntry {
|
|
|
130
131
|
this.stages = collectFlowHookMap(this.FlowClass);
|
|
131
132
|
const { middleware } = this.metadata;
|
|
132
133
|
if (middleware) {
|
|
133
|
-
|
|
134
|
-
server.registerMiddleware(path, async (request, response, next) => {
|
|
134
|
+
server.registerMiddleware(this.mountPath(), async (request, response, next) => {
|
|
135
135
|
const canActivate = await this.canActivate(request);
|
|
136
136
|
if (!canActivate) return next();
|
|
137
137
|
const contextStorage = this.getContextStorage();
|
|
@@ -241,7 +241,7 @@ var FlowInstance = class extends FlowEntry {
|
|
|
241
241
|
async matchHttp(request) {
|
|
242
242
|
const mw = this.metadata.middleware;
|
|
243
243
|
if (!mw) return false;
|
|
244
|
-
const path =
|
|
244
|
+
const path = this.mountPath();
|
|
245
245
|
const hasStaticCanActivate = typeof this.FlowClass.canActivate === "function";
|
|
246
246
|
const hasMwCanActivate = (mw.canActivate?.length ?? 0) > 0;
|
|
247
247
|
if (!path && !hasStaticCanActivate && !hasMwCanActivate) return false;
|
|
@@ -257,6 +257,11 @@ var FlowInstance = class extends FlowEntry {
|
|
|
257
257
|
}
|
|
258
258
|
return activated;
|
|
259
259
|
}
|
|
260
|
+
/** The path the flow is mounted at: its `middleware.path`, with an `/oauth/*` path under the scope's OAuth base. */
|
|
261
|
+
mountPath() {
|
|
262
|
+
const path = typeof this.metadata.middleware?.path === "string" ? this.metadata.middleware.path : "";
|
|
263
|
+
return path.startsWith("/oauth/") ? `${oauthBasePath(this.scope)}${path}` : path;
|
|
264
|
+
}
|
|
260
265
|
/**
|
|
261
266
|
* Get FrontMcpContextStorage from providers (with fallback).
|
|
262
267
|
* Returns undefined if not available (backward compatibility).
|
|
@@ -300,13 +305,41 @@ var FlowInstance = class extends FlowEntry {
|
|
|
300
305
|
"FrontMcpContext unavailable - session ID required for provider resolution. Ensure flow is wrapped with runWithContext."
|
|
301
306
|
);
|
|
302
307
|
}
|
|
303
|
-
const runStages = () =>
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
308
|
+
const runStages = async () => {
|
|
309
|
+
await this.authorizeCaller(currentContext, scope);
|
|
310
|
+
return runAsFlow(
|
|
311
|
+
{ context: currentContext, flow: this, scope },
|
|
312
|
+
() => this.runStages(input, deps, scope, currentContext, sessionKey)
|
|
313
|
+
);
|
|
314
|
+
};
|
|
307
315
|
const responseHeaders = this.metadata.middleware?.responseHeaders;
|
|
308
316
|
return responseHeaders ? this.respondWithHeaders(runStages, responseHeaders) : runStages();
|
|
309
317
|
}
|
|
318
|
+
/**
|
|
319
|
+
* `access: 'authorized'`: the flow runs only for a caller the server's auth admitted. The context of an HTTP request
|
|
320
|
+
* that no flow has verified yet holds that request: it is verified here with `session:verify`, without minting a
|
|
321
|
+
* session, and the caller it admits is recorded in the context for the run and the flows it runs. Every other
|
|
322
|
+
* context's caller is authorized: an MCP client `http:request` verified, or the server process itself.
|
|
323
|
+
*/
|
|
324
|
+
async authorizeCaller(context, scope) {
|
|
325
|
+
const request = context.unverifiedRequest;
|
|
326
|
+
if (this.metadata.access !== "authorized" || !request) return;
|
|
327
|
+
const verified = await scope.runFlow("session:verify", { request, sessionless: true });
|
|
328
|
+
if (verified?.kind === "authorized") {
|
|
329
|
+
context.recordAuthorization(authInfoFromAuthorization(verified.authorization));
|
|
330
|
+
return;
|
|
331
|
+
}
|
|
332
|
+
this.logger.verbose(`run: refused '${this.name}': its caller is not authorized`);
|
|
333
|
+
if (verified?.kind === "forbidden") {
|
|
334
|
+
throw new PublicMcpError(
|
|
335
|
+
"The caller lacks the scopes the server requires",
|
|
336
|
+
"INSUFFICIENT_SCOPE",
|
|
337
|
+
403,
|
|
338
|
+
verified.prmMetadataHeader
|
|
339
|
+
);
|
|
340
|
+
}
|
|
341
|
+
throw new UnauthorizedError("Unauthorized", verified?.prmMetadataHeader);
|
|
342
|
+
}
|
|
310
343
|
/**
|
|
311
344
|
* Run the stages of a route whose every response carries `headers`, whichever stage, hook or guard
|
|
312
345
|
* responded. A failure is answered here, with the headers, rather than by the adapter.
|
|
@@ -21,6 +21,7 @@ import { detachedJobRunId, markEntryServer } from "./detached-job.flag.mjs";
|
|
|
21
21
|
import { markDirectOnly } from "./direct-only.flag.mjs";
|
|
22
22
|
import { createMcpGlobalProviders } from "./front-mcp.providers.mjs";
|
|
23
23
|
import { markManifestMode } from "./manifest-mode.flag.mjs";
|
|
24
|
+
import { checkSessionSecret, MISSING_SESSION_SECRET_WARNING, missingSessionSecretProbe } from "./session-secret.check.mjs";
|
|
24
25
|
import {
|
|
25
26
|
DEFAULT_SHUTDOWN_DEADLINE_MS,
|
|
26
27
|
exitOnShutdownSignals,
|
|
@@ -145,6 +146,11 @@ var FrontMcpInstance = class _FrontMcpInstance {
|
|
|
145
146
|
return this.releaseFailedStart(error);
|
|
146
147
|
}
|
|
147
148
|
}
|
|
149
|
+
/** A production server that serves MCP over HTTP and starts without `MCP_SESSION_SECRET` says so, and on `/readyz`. */
|
|
150
|
+
reportMissingSessionSecret() {
|
|
151
|
+
this.log?.warn(MISSING_SESSION_SECRET_WARNING);
|
|
152
|
+
for (const scope of this.getScopes()) scope.registerHealthProbe(missingSessionSecretProbe);
|
|
153
|
+
}
|
|
148
154
|
/** Where this server serves MCP, as reported to the `frontmcp dev --stdio` bridge. */
|
|
149
155
|
devListenerInfo(server) {
|
|
150
156
|
const http = server.config;
|
|
@@ -311,8 +317,10 @@ var FrontMcpInstance = class _FrontMcpInstance {
|
|
|
311
317
|
return void 0;
|
|
312
318
|
}
|
|
313
319
|
markEntryServer(parsedConfig);
|
|
320
|
+
const sessionSecretMissing = parsedConfig.serve !== false && checkSessionSecret(parsedConfig, "legacy");
|
|
314
321
|
const frontMcp = new _FrontMcpInstance(parsedConfig);
|
|
315
322
|
await frontMcp.ready;
|
|
323
|
+
if (sessionSecretMissing) frontMcp.reportMissingSessionSecret();
|
|
316
324
|
await frontMcp.startOrRelease();
|
|
317
325
|
exitOnShutdownSignals(() => frontMcp.shutdown(), {
|
|
318
326
|
logger: frontMcp.log,
|
|
@@ -333,8 +341,11 @@ var FrontMcpInstance = class _FrontMcpInstance {
|
|
|
333
341
|
* export default FrontMcpInstance.createHandler(config);
|
|
334
342
|
*/
|
|
335
343
|
static async createHandler(options) {
|
|
336
|
-
const
|
|
344
|
+
const parsedConfig = frontMcpMetadataSchema.parse(options);
|
|
345
|
+
const sessionSecretMissing = checkSessionSecret(parsedConfig, "legacy");
|
|
346
|
+
const frontMcp = new _FrontMcpInstance(parsedConfig);
|
|
337
347
|
await frontMcp.ready;
|
|
348
|
+
if (sessionSecretMissing) frontMcp.reportMissingSessionSecret();
|
|
338
349
|
const server = frontMcp.providers.get(FrontMcpServer);
|
|
339
350
|
if (!server) {
|
|
340
351
|
throw new ServerNotFoundError();
|
|
@@ -367,8 +378,11 @@ var FrontMcpInstance = class _FrontMcpInstance {
|
|
|
367
378
|
const { createDeferredServerBuild, createServerFetchHandler, startupFailureResponse } = await import("../transport/web-fetch-handler.mjs");
|
|
368
379
|
const build = async (deferred) => {
|
|
369
380
|
let frontMcp;
|
|
381
|
+
let sessionSecretMissing;
|
|
370
382
|
try {
|
|
371
|
-
|
|
383
|
+
const parsedConfig = frontMcpMetadataSchema.parse({ ...options, serve: false });
|
|
384
|
+
sessionSecretMissing = checkSessionSecret(parsedConfig, "2026-07-28");
|
|
385
|
+
frontMcp = new _FrontMcpInstance(parsedConfig);
|
|
372
386
|
await frontMcp.ready;
|
|
373
387
|
} catch (err) {
|
|
374
388
|
if (deferred) {
|
|
@@ -379,6 +393,7 @@ var FrontMcpInstance = class _FrontMcpInstance {
|
|
|
379
393
|
}
|
|
380
394
|
throw err;
|
|
381
395
|
}
|
|
396
|
+
if (sessionSecretMissing) frontMcp.reportMissingSessionSecret();
|
|
382
397
|
const scope = frontMcp.getPrimaryScope();
|
|
383
398
|
if (!scope) {
|
|
384
399
|
throw new ServerNotFoundError();
|
|
@@ -570,8 +585,10 @@ var FrontMcpInstance = class _FrontMcpInstance {
|
|
|
570
585
|
...sqlite ? { sqlite } : {}
|
|
571
586
|
});
|
|
572
587
|
markEntryServer(parsedConfig);
|
|
588
|
+
const sessionSecretMissing = checkSessionSecret(parsedConfig, "legacy");
|
|
573
589
|
const frontMcp = new _FrontMcpInstance(parsedConfig);
|
|
574
590
|
await frontMcp.ready;
|
|
591
|
+
if (sessionSecretMissing) frontMcp.reportMissingSessionSecret();
|
|
575
592
|
await frontMcp.startOrRelease();
|
|
576
593
|
frontMcp.log?.info(`MCP server listening on unix://${socketPath}`);
|
|
577
594
|
const shutdown = () => frontMcp.shutdown();
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// libs/sdk/src/front-mcp/session-secret.check.ts
|
|
2
|
+
import { isSessionSecretConfigured, SessionSecretRequiredError } from "@frontmcp/auth";
|
|
3
|
+
import { isProduction } from "@frontmcp/utils";
|
|
4
|
+
var MISSING_SESSION_SECRET_WARNING = "MCP_SESSION_SECRET is not set: clients before MCP 2026-07-28 get 500 SESSION_SECRET_REQUIRED on initialize, while clients on MCP 2026-07-28 are served. Set MCP_SESSION_SECRET (openssl rand -hex 32).";
|
|
5
|
+
var missingSessionSecretProbe = {
|
|
6
|
+
name: "session-secret",
|
|
7
|
+
check: async () => ({ status: "degraded", error: MISSING_SESSION_SECRET_WARNING })
|
|
8
|
+
};
|
|
9
|
+
function checkSessionSecret(config, entryFallback) {
|
|
10
|
+
if (!isProduction() || isSessionSecretConfigured()) return false;
|
|
11
|
+
if ((config.transport?.defaultProtocolVersion ?? entryFallback) === "legacy") {
|
|
12
|
+
throw new SessionSecretRequiredError(
|
|
13
|
+
"the session ids of MCP clients before 2026-07-28: set MCP_SESSION_SECRET (openssl rand -hex 32), or, if every client uses MCP 2026-07-28, set transport.defaultProtocolVersion to '2026-07-28'"
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
|
+
return true;
|
|
17
|
+
}
|
|
18
|
+
export {
|
|
19
|
+
MISSING_SESSION_SECRET_WARNING,
|
|
20
|
+
checkSessionSecret,
|
|
21
|
+
missingSessionSecretProbe
|
|
22
|
+
};
|
|
@@ -11,6 +11,7 @@ import { InvalidHttpRouteError, InvalidPeopleAuthOptionsError } from "../errors/
|
|
|
11
11
|
import { matchRoutePath } from "../flows/flow.http-path.mjs";
|
|
12
12
|
import { servedHealthPaths } from "../health/health.routes.mjs";
|
|
13
13
|
import { assertNotReserved, computeReservedPaths } from "../server/custom-routes.helper.mjs";
|
|
14
|
+
import { workflowWebhookRoutes } from "../workflow/trigger/workflow-webhook.routes.mjs";
|
|
14
15
|
import { PEOPLE_SIGN_IN_ROUTES } from "./people-sign-in.routes.mjs";
|
|
15
16
|
function header(request, name) {
|
|
16
17
|
const value = request.headers[name];
|
|
@@ -84,6 +85,7 @@ function attachHttpRoutes(scope, server) {
|
|
|
84
85
|
const routes2 = app.metadata.routes ?? [];
|
|
85
86
|
return routes2.map((target) => ({ target, providers: app.providers }));
|
|
86
87
|
});
|
|
88
|
+
const webhooks = workflowWebhookRoutes(scope.workflows?.getWorkflows(true) ?? []);
|
|
87
89
|
const peopleOption = scope.metadata.http?.auth?.people;
|
|
88
90
|
const questions = scope.persistentQuestions;
|
|
89
91
|
if (questions && peopleOption === void 0) {
|
|
@@ -91,14 +93,17 @@ function attachHttpRoutes(scope, server) {
|
|
|
91
93
|
"elicitation.persistent is on but http.auth.people is not set, so the question inbox is off: set http: { auth: { people: 'loopback-token' } } to answer questions at /_frontmcp/inbox or with frontmcp inbox"
|
|
92
94
|
);
|
|
93
95
|
}
|
|
94
|
-
if (declared.length === 0 && peopleOption === void 0) return;
|
|
96
|
+
if (declared.length === 0 && webhooks.length === 0 && peopleOption === void 0) return;
|
|
95
97
|
const people = peopleOption === void 0 ? void 0 : peopleAuthFor(server, peopleOption, scope.providers);
|
|
96
98
|
const builtInRoutes = [...PEOPLE_SIGN_IN_ROUTES, ...questions ? questionInboxRoutes(questions.store) : []];
|
|
97
99
|
const builtIn = people ? builtInRoutes.map((target) => ({ target, providers: scope.providers })) : [];
|
|
98
100
|
const reserved = computeReservedPaths(scope.entryPath, scope.routeBase, servedHealthPaths(scope.metadata.health));
|
|
99
101
|
const mcpPath = scope.fullPath || "/";
|
|
100
102
|
const served = /* @__PURE__ */ new Set();
|
|
101
|
-
const
|
|
103
|
+
const toEntry = ({
|
|
104
|
+
target,
|
|
105
|
+
providers
|
|
106
|
+
}) => {
|
|
102
107
|
const metadata = httpRouteMetadataOf(target);
|
|
103
108
|
if (!metadata) {
|
|
104
109
|
throw new InvalidHttpRouteError("?", String(target.name), "not an @HttpRoute class");
|
|
@@ -137,11 +142,26 @@ function attachHttpRoutes(scope, server) {
|
|
|
137
142
|
providers,
|
|
138
143
|
sharesMcpPath
|
|
139
144
|
};
|
|
140
|
-
}
|
|
145
|
+
};
|
|
146
|
+
const routes = [...builtIn, ...declared].map(toEntry);
|
|
147
|
+
for (const webhook of webhooks) {
|
|
148
|
+
assertWebhookPathFree(webhook, routes, scope.metadata.http?.routes ?? [], { reserved, mcpPath });
|
|
149
|
+
routes.push(toEntry({ target: webhook.target, providers: scope.providers }));
|
|
150
|
+
}
|
|
141
151
|
const table = new HttpRouteTable(routes, people);
|
|
142
152
|
scope.httpRouteTable = table;
|
|
143
153
|
scope.onDispose(() => table.closeStreams());
|
|
144
154
|
}
|
|
155
|
+
function assertWebhookPathFree(webhook, routes, customRoutes, paths) {
|
|
156
|
+
const { method, path, workflow } = webhook;
|
|
157
|
+
const refuse = (reason) => new InvalidHttpRouteError(method, path, `the webhook of workflow "${workflow}" ${reason}`);
|
|
158
|
+
if (withoutTrailingSlash(path) === paths.mcpPath) throw refuse("is on the MCP endpoint's path");
|
|
159
|
+
assertNotReserved(method, path, paths.reserved);
|
|
160
|
+
const other = [...routes, ...customRoutes].find(
|
|
161
|
+
(route) => route.method.toUpperCase() === method && matchRoutePath(route.path, path) !== void 0
|
|
162
|
+
);
|
|
163
|
+
if (other) throw refuse(`collides with the route ${other.method} ${other.path}`);
|
|
164
|
+
}
|
|
145
165
|
export {
|
|
146
166
|
HttpRouteTable,
|
|
147
167
|
attachHttpRoutes
|