@frontmcp/sdk 1.11.2 → 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
|
@@ -30,7 +30,12 @@ import { resolveEntryPath } from "../common/utils/path.utils.mjs";
|
|
|
30
30
|
import CompleteFlow from "../completion/flows/complete.flow.mjs";
|
|
31
31
|
import { FrontMcpContextProvider, FrontMcpContextStorage } from "../context/index.mjs";
|
|
32
32
|
import { proxyTrustOf } from "../context/metadata.utils.mjs";
|
|
33
|
-
import {
|
|
33
|
+
import {
|
|
34
|
+
AuthConfigurationError,
|
|
35
|
+
FlowExitedWithoutOutputError,
|
|
36
|
+
InternalMcpError,
|
|
37
|
+
InvalidToolUiConfigError
|
|
38
|
+
} from "../errors/index.mjs";
|
|
34
39
|
import { PluginConfiguredTwiceError, UnenforcedMetadataError } from "../errors/plugin.errors.mjs";
|
|
35
40
|
import FlowRegistry from "../flows/flow.registry.mjs";
|
|
36
41
|
import { assertAuthoritiesRules } from "../front-mcp/authorities-rules.check.mjs";
|
|
@@ -51,7 +56,11 @@ import ProviderRegistry from "../provider/provider.registry.mjs";
|
|
|
51
56
|
import { MaterializedResources } from "../resource/materialized/materialized-resources.mjs";
|
|
52
57
|
import ResourceRegistry from "../resource/resource.registry.mjs";
|
|
53
58
|
import { SkillValidationError } from "../skill/errors/skill-validation.error.mjs";
|
|
54
|
-
import {
|
|
59
|
+
import {
|
|
60
|
+
pluginsRegisterDynamicSkills,
|
|
61
|
+
registerSkillCapabilities,
|
|
62
|
+
serveSkillMethods
|
|
63
|
+
} from "../skill/skill-scope.helper.mjs";
|
|
55
64
|
import SkillRegistry from "../skill/skill.registry.mjs";
|
|
56
65
|
import { LiveSurface } from "../surface/live-surface.mjs";
|
|
57
66
|
import { resolvesToVercelKvTaskBackend } from "../task/store/task-backend.utils.mjs";
|
|
@@ -68,6 +77,12 @@ import { devEventsObservabilityConfig, listsObservabilityPlugin } from "./dev-ev
|
|
|
68
77
|
import { registerServerEntries } from "./server-entries.helper.mjs";
|
|
69
78
|
import { reportStartup } from "./startup-report.helper.mjs";
|
|
70
79
|
var SCOPE_NON_DISPATCHABLE_FLOWS = /* @__PURE__ */ new Set(["http:request"]);
|
|
80
|
+
function keptUntilFailure(start, forget) {
|
|
81
|
+
return start.catch((error) => {
|
|
82
|
+
forget();
|
|
83
|
+
throw error;
|
|
84
|
+
});
|
|
85
|
+
}
|
|
71
86
|
var Scope = class _Scope extends ScopeEntry {
|
|
72
87
|
id;
|
|
73
88
|
globalProviders;
|
|
@@ -124,6 +139,18 @@ var Scope = class _Scope extends ScopeEntry {
|
|
|
124
139
|
_taskRegistry;
|
|
125
140
|
/** Optional skill session manager for tool authorization enforcement */
|
|
126
141
|
_skillSession;
|
|
142
|
+
/** Set once the `agents:call-agent` flow is registered, or being registered. */
|
|
143
|
+
agentCallsServed;
|
|
144
|
+
/** Set once the scope serves skills: from startup, or since an app added the first one. */
|
|
145
|
+
skillsServed;
|
|
146
|
+
/** The jobs and workflows apps loaded themselves before startup decided whether the job system runs. */
|
|
147
|
+
pendingAppJobs = [];
|
|
148
|
+
/** Whether startup has decided whether the job system runs. */
|
|
149
|
+
jobsDecided = false;
|
|
150
|
+
/** The top-level SQLite startup resolved, for a job system an app's jobs start later. */
|
|
151
|
+
topLevelSqlite;
|
|
152
|
+
/** The start of a job system the first jobs an app loaded after startup brought. */
|
|
153
|
+
lateJobsStart;
|
|
127
154
|
/** EventStore for SSE resumability support (optional) */
|
|
128
155
|
_eventStore;
|
|
129
156
|
/** Job/workflow registries and execution (optional) */
|
|
@@ -147,6 +174,7 @@ var Scope = class _Scope extends ScopeEntry {
|
|
|
147
174
|
_scopeChannels;
|
|
148
175
|
_channelNotificationService;
|
|
149
176
|
_channelEventBus;
|
|
177
|
+
_workflowEvents;
|
|
150
178
|
_channelTeardown;
|
|
151
179
|
/** Health service for liveness and readiness probes (optional) */
|
|
152
180
|
_healthService;
|
|
@@ -550,31 +578,7 @@ var Scope = class _Scope extends ScopeEntry {
|
|
|
550
578
|
}
|
|
551
579
|
const dynamicSkills = pluginsRegisterDynamicSkills([...serverPlugins, ...appPlugins]);
|
|
552
580
|
if (this.scopeSkills.hasAny() || dynamicSkills) {
|
|
553
|
-
|
|
554
|
-
import("../skill/session/index.mjs"),
|
|
555
|
-
import("../skill/hooks/index.mjs")
|
|
556
|
-
]);
|
|
557
|
-
const store = skillSession.createSkillSessionStore({ type: "memory" });
|
|
558
|
-
this._skillSession = new skillSession.SkillSessionManager(
|
|
559
|
-
{
|
|
560
|
-
defaultPolicyMode: "permissive"
|
|
561
|
-
},
|
|
562
|
-
this.logger,
|
|
563
|
-
store
|
|
564
|
-
);
|
|
565
|
-
const GuardHookClass = createSkillToolGuardHook(this._skillSession, {
|
|
566
|
-
logger: this.logger,
|
|
567
|
-
trackToolCalls: true
|
|
568
|
-
});
|
|
569
|
-
const guardHookInstance = new GuardHookClass();
|
|
570
|
-
const hookRecords = normalizeHooksFromCls(guardHookInstance);
|
|
571
|
-
if (hookRecords.length > 0) {
|
|
572
|
-
await this.scopeHooks.registerHooks(false, ...hookRecords);
|
|
573
|
-
this.logger.verbose("Skill tool authorization guard hook registered");
|
|
574
|
-
}
|
|
575
|
-
this.logger.verbose("Skill session manager initialized", {
|
|
576
|
-
storeType: store.type
|
|
577
|
-
});
|
|
581
|
+
await this.startSkillSession();
|
|
578
582
|
}
|
|
579
583
|
if (this.scopeSkills.hasAny()) {
|
|
580
584
|
try {
|
|
@@ -607,6 +611,7 @@ var Scope = class _Scope extends ScopeEntry {
|
|
|
607
611
|
logger: this.logger,
|
|
608
612
|
dynamicSkills
|
|
609
613
|
});
|
|
614
|
+
if (this.scopeSkills.servesSkills()) this.skillsServed = Promise.resolve();
|
|
610
615
|
const jobsConfig = this.metadata.jobs;
|
|
611
616
|
const metaRecord = this.metadata;
|
|
612
617
|
const jobsList = metaRecord["jobTypes"] ?? [];
|
|
@@ -617,6 +622,13 @@ var Scope = class _Scope extends ScopeEntry {
|
|
|
617
622
|
const appMeta = app.metadata;
|
|
618
623
|
if (Array.isArray(appMeta["workflows"])) appWorkflows.push(...appMeta["workflows"]);
|
|
619
624
|
}
|
|
625
|
+
for (const served of this.pendingAppJobs) {
|
|
626
|
+
appJobs.push(...served.entries.jobs);
|
|
627
|
+
for (const job of served.entries.jobs) {
|
|
628
|
+
jobProviders.set(normalizeJob(job).provide, served.entries.providers);
|
|
629
|
+
}
|
|
630
|
+
appWorkflows.push(...served.entries.workflows);
|
|
631
|
+
}
|
|
620
632
|
const allJobs = [...jobsList, ...appJobs];
|
|
621
633
|
const allWorkflows = [...workflowsList, ...appWorkflows];
|
|
622
634
|
const hasJobDeclarations = allJobs.length > 0 || allWorkflows.length > 0;
|
|
@@ -635,56 +647,20 @@ var Scope = class _Scope extends ScopeEntry {
|
|
|
635
647
|
`Jobs auto-enabled: detected ${allJobs.length} job(s) and ${allWorkflows.length} workflow(s) in @App declarations. Their runs are kept in jobs.store, else the top-level redis or sqlite, else in memory.`
|
|
636
648
|
);
|
|
637
649
|
}
|
|
638
|
-
const
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
redis: this.metadata.redis,
|
|
647
|
-
sqlite: resolvedTopLevelSqlite
|
|
648
|
-
});
|
|
649
|
-
const effectiveConfig = { ...jobsConfig ?? {}, enabled: true, store: jobsStore };
|
|
650
|
-
topLevelSqliteUsed ||= Boolean(resolvedTopLevelSqlite) && jobsStore?.sqlite === resolvedTopLevelSqlite;
|
|
651
|
-
const result = await registerJobCapabilities({
|
|
652
|
-
providers: this.scopeProviders,
|
|
653
|
-
flowRegistry: this.scopeFlows,
|
|
654
|
-
owner: scopeRef,
|
|
655
|
-
jobsList: allJobs,
|
|
656
|
-
jobProviders,
|
|
657
|
-
workflowsList: allWorkflows,
|
|
658
|
-
jobsConfig: effectiveConfig,
|
|
659
|
-
logger: this.logger,
|
|
660
|
-
notifyFn,
|
|
661
|
-
entryServer: isEntryServer(this.metadata),
|
|
662
|
-
jobWorker: isJobWorker(this.metadata)
|
|
663
|
-
});
|
|
664
|
-
this._scopeJobs = result.jobRegistry;
|
|
665
|
-
this._scopeWorkflows = result.workflowRegistry;
|
|
666
|
-
this._jobExecutionManager = result.executionManager;
|
|
667
|
-
this._jobStateStore = result.stateStore;
|
|
668
|
-
this._jobDefinitionStore = result.definitionStore;
|
|
669
|
-
for (const toolCls of result.managementTools) {
|
|
670
|
-
try {
|
|
671
|
-
const toolRecord = normalizeTool(toolCls);
|
|
672
|
-
const toolInstance = new ToolInstance(toolRecord, this.scopeProviders, {
|
|
673
|
-
kind: "scope",
|
|
674
|
-
id: "_jobs",
|
|
675
|
-
ref: toolCls
|
|
676
|
-
});
|
|
677
|
-
this.scopeTools.registerToolInstance(toolInstance);
|
|
678
|
-
} catch (error) {
|
|
679
|
-
this.logger.warn(
|
|
680
|
-
`Failed to register job management tool: ${error instanceof Error ? error.message : String(error)}`
|
|
681
|
-
);
|
|
650
|
+
const jobsUseTopLevelSqlite = await this.startJobs(allJobs, jobProviders, allWorkflows, resolvedTopLevelSqlite);
|
|
651
|
+
topLevelSqliteUsed ||= jobsUseTopLevelSqlite;
|
|
652
|
+
const jobRegistry = this._scopeJobs;
|
|
653
|
+
const workflowRegistry = this._scopeWorkflows;
|
|
654
|
+
if (jobRegistry && workflowRegistry && this.pendingAppJobs.length > 0) {
|
|
655
|
+
const { unregistersAppJobEntries } = await import("../job/job-scope.helper.mjs");
|
|
656
|
+
for (const served of this.pendingAppJobs) {
|
|
657
|
+
served.unregister = unregistersAppJobEntries(jobRegistry, workflowRegistry, served.entries);
|
|
682
658
|
}
|
|
683
659
|
}
|
|
684
|
-
this.logger.info(
|
|
685
|
-
`Jobs system initialized: ${this._scopeJobs.getJobs().length} jobs, ${this._scopeWorkflows.getWorkflows().length} workflows`
|
|
686
|
-
);
|
|
687
660
|
}
|
|
661
|
+
this.pendingAppJobs.length = 0;
|
|
662
|
+
this.jobsDecided = true;
|
|
663
|
+
this.topLevelSqlite = resolvedTopLevelSqlite;
|
|
688
664
|
if (this.metadata.sqlite && !topLevelSqliteUsed && getRuntimeContext().runtime !== "browser") {
|
|
689
665
|
this.logger.warn(
|
|
690
666
|
"[FrontMcp] Top-level `sqlite` config was provided but no subsystem consumes it (transport persistence, tasks, elicitation and jobs were all disabled or pre-configured with a different backend). Sessions will use in-memory storage. Remove the `sqlite` block or enable one of the subsystems."
|
|
@@ -703,8 +679,7 @@ var Scope = class _Scope extends ScopeEntry {
|
|
|
703
679
|
installTaskRunner?.();
|
|
704
680
|
await this.scopeFlows.registryFlows([SetLevelFlow, CompleteFlow]);
|
|
705
681
|
if (this.scopeAgents.listAllInstances().length > 0) {
|
|
706
|
-
|
|
707
|
-
await this.scopeFlows.registryFlows([CallAgentFlow]);
|
|
682
|
+
await this.serveAgentCalls();
|
|
708
683
|
}
|
|
709
684
|
if (this.metadata.elicitation?.enabled === true) {
|
|
710
685
|
const { ElicitationRequestFlow, ElicitationResultFlow } = await import("../elicitation/flows/index.mjs");
|
|
@@ -767,6 +742,7 @@ var Scope = class _Scope extends ScopeEntry {
|
|
|
767
742
|
channelsList: appChannels,
|
|
768
743
|
channelProviders,
|
|
769
744
|
channelsConfig,
|
|
745
|
+
eventBus: this._channelEventBus,
|
|
770
746
|
notificationService: this.notificationService,
|
|
771
747
|
flowRegistry: this.scopeFlows,
|
|
772
748
|
toolRegistry: this.scopeTools,
|
|
@@ -789,6 +765,7 @@ var Scope = class _Scope extends ScopeEntry {
|
|
|
789
765
|
this.onDispose(() => this.teardownChannels());
|
|
790
766
|
if (!isJobWorker(this.metadata)) await channelResult.connectServices();
|
|
791
767
|
}
|
|
768
|
+
await this.registerWidgetRoutes(httpServing);
|
|
792
769
|
if (httpServing && this.metadata.health?.enabled !== false) {
|
|
793
770
|
this._healthService = new httpServing.HealthService(this.metadata.health ?? {}, this.metadata.info);
|
|
794
771
|
this._healthService.autoDiscoverProbes(this);
|
|
@@ -854,15 +831,24 @@ var Scope = class _Scope extends ScopeEntry {
|
|
|
854
831
|
async compileUIWidgets() {
|
|
855
832
|
const toolsWithUI = this.scopeTools.getTools(true).filter((t) => hasUIConfig(t.metadata));
|
|
856
833
|
if (toolsWithUI.length === 0) return;
|
|
857
|
-
const [
|
|
834
|
+
const [
|
|
835
|
+
{ describeIgnoredUiOptions, describeServingModeDefault },
|
|
836
|
+
{ StaticWidgetResourceTemplate },
|
|
837
|
+
{ describeWidgetServingProblems, widgetUrlSourceOf }
|
|
838
|
+
] = await Promise.all([
|
|
858
839
|
import("../tool/ui/ui-option-warnings.mjs"),
|
|
859
840
|
import("../tool/ui/ui-resource-template.mjs"),
|
|
841
|
+
import("../tool/ui/widget-serving.mjs"),
|
|
860
842
|
this.toolUIRegistry.load()
|
|
861
843
|
]);
|
|
862
844
|
for (const tool of toolsWithUI) {
|
|
863
845
|
const resourceUri = tool.metadata.ui?.resourceUri;
|
|
864
846
|
this.toolUIRegistry.registerTool(tool.metadata.name, typeof resourceUri === "string" ? resourceUri : void 0);
|
|
865
|
-
this.toolUIRegistry.checkTemplate(tool.metadata.name, tool.metadata.ui?.template);
|
|
847
|
+
this.toolUIRegistry.checkTemplate(tool.metadata.name, tool.metadata.ui?.template, tool.metadata.ui?.uiType);
|
|
848
|
+
await this.toolUIRegistry.checkRenderOptions(
|
|
849
|
+
tool.metadata.name,
|
|
850
|
+
tool.metadata.ui
|
|
851
|
+
);
|
|
866
852
|
for (const message of describeIgnoredUiOptions(
|
|
867
853
|
tool.metadata.name,
|
|
868
854
|
tool.metadata.ui
|
|
@@ -882,9 +868,26 @@ var Scope = class _Scope extends ScopeEntry {
|
|
|
882
868
|
this.scopeResources.registerDynamicResource(StaticWidgetResourceTemplate);
|
|
883
869
|
this.logger.verbose(`Registered UI resource template for ${toolsWithUI.length} tool(s) with UI configs`);
|
|
884
870
|
const servingModes = new Map(toolsWithUI.map((t) => [t, toolServingMode(t, this)]));
|
|
885
|
-
const
|
|
886
|
-
(t) =>
|
|
871
|
+
const servingProblems = toolsWithUI.flatMap(
|
|
872
|
+
(t) => describeWidgetServingProblems(
|
|
873
|
+
t.metadata.name,
|
|
874
|
+
t.metadata.ui ?? {},
|
|
875
|
+
servingModes.get(t) ?? "auto"
|
|
876
|
+
)
|
|
887
877
|
);
|
|
878
|
+
if (servingProblems.length > 0) throw new InvalidToolUiConfigError(servingProblems);
|
|
879
|
+
for (const tool of toolsWithUI) {
|
|
880
|
+
const uiConfig = tool.metadata.ui ?? {};
|
|
881
|
+
const source = widgetUrlSourceOf(tool.metadata.name, uiConfig, servingModes.get(tool) ?? "auto");
|
|
882
|
+
if (!source) continue;
|
|
883
|
+
this.toolUIRegistry.registerWidgetUrl(tool.metadata.name, source);
|
|
884
|
+
if (source.servingMode === "custom-url")
|
|
885
|
+
this.toolUIRegistry.updateResourceMetaFromConfig(tool.metadata.name, uiConfig);
|
|
886
|
+
}
|
|
887
|
+
const staticModeTools = toolsWithUI.filter((t) => {
|
|
888
|
+
const mode = servingModes.get(t);
|
|
889
|
+
return t.metadata.ui && (mode === "static" || mode === "direct-url") && t.metadata.ui.template;
|
|
890
|
+
});
|
|
888
891
|
if (staticModeTools.length > 0) {
|
|
889
892
|
let staticCompiledCount = 0;
|
|
890
893
|
await Promise.all(
|
|
@@ -981,6 +984,42 @@ var Scope = class _Scope extends ScopeEntry {
|
|
|
981
984
|
);
|
|
982
985
|
}
|
|
983
986
|
}
|
|
987
|
+
/**
|
|
988
|
+
* Serve each `'direct-url'` widget's page on its route, once every other route of the scope is
|
|
989
|
+
* known, so a path that collides with one refuses startup. A scope without HTTP has no route to
|
|
990
|
+
* serve them from.
|
|
991
|
+
*/
|
|
992
|
+
async registerWidgetRoutes(httpServing) {
|
|
993
|
+
const widgets = this.toolUIRegistry?.widgetRoutes() ?? [];
|
|
994
|
+
if (widgets.length === 0) return;
|
|
995
|
+
if (!httpServing) {
|
|
996
|
+
for (const { toolName, path } of widgets) {
|
|
997
|
+
this.logger.warn(
|
|
998
|
+
`Tool "${toolName}": \`ui.servingMode: 'direct-url'\` serves the widget on GET ${path}, and this in-process server serves no HTTP, so hosts cannot load it.`
|
|
999
|
+
);
|
|
1000
|
+
}
|
|
1001
|
+
return;
|
|
1002
|
+
}
|
|
1003
|
+
const { registerWidgetRoutes } = await import("../tool/ui/widget-routes.mjs");
|
|
1004
|
+
await registerWidgetRoutes({
|
|
1005
|
+
widgets,
|
|
1006
|
+
registry: this.toolUIRegistry,
|
|
1007
|
+
server: this.httpRouteRegistrar,
|
|
1008
|
+
checkClientIp: (request, response) => this.runFlow("http:ip-filter", {
|
|
1009
|
+
request,
|
|
1010
|
+
response
|
|
1011
|
+
}),
|
|
1012
|
+
entryPath: this.entryPath,
|
|
1013
|
+
routeBase: this.routeBase,
|
|
1014
|
+
healthPaths: httpServing.servedHealthPaths(this.metadata.health),
|
|
1015
|
+
takenRoutes: [
|
|
1016
|
+
...this.registeredHttpRoutes.map((route) => ({ ...route, owner: "a route of the server" })),
|
|
1017
|
+
...(this.httpRouteTable?.routes ?? []).map((route) => ({ ...route, owner: "an @HttpRoute" }))
|
|
1018
|
+
],
|
|
1019
|
+
flowFor: (request) => this.findHttpFlowName(request),
|
|
1020
|
+
logger: this.logger
|
|
1021
|
+
});
|
|
1022
|
+
}
|
|
984
1023
|
/**
|
|
985
1024
|
* Build the custom auth-UI registry (#469) PER SCOPE from this scope's resolved
|
|
986
1025
|
* auth options (`auth.ui` / `auth.extras`). The parent multi-app scope reads
|
|
@@ -1135,7 +1174,171 @@ var Scope = class _Scope extends ScopeEntry {
|
|
|
1135
1174
|
return this._channelNotificationService;
|
|
1136
1175
|
}
|
|
1137
1176
|
get channelEventBus() {
|
|
1138
|
-
return this._channelEventBus;
|
|
1177
|
+
return this._channelEventBus ?? this._workflowEvents?.bus;
|
|
1178
|
+
}
|
|
1179
|
+
/**
|
|
1180
|
+
* Start the job system with these jobs and workflows: its stores, registries, execution manager and management
|
|
1181
|
+
* tools. Answers whether its store is the top-level SQLite.
|
|
1182
|
+
*/
|
|
1183
|
+
async startJobs(jobs, jobProviders, workflows, topLevelSqlite) {
|
|
1184
|
+
const jobsConfig = this.metadata.jobs;
|
|
1185
|
+
const scopeRef = { kind: "scope", id: this.id, ref: _Scope };
|
|
1186
|
+
const notifyFn = async (data) => {
|
|
1187
|
+
if (this.notificationService) {
|
|
1188
|
+
this.logger.debug("Job notification", data);
|
|
1189
|
+
}
|
|
1190
|
+
};
|
|
1191
|
+
const { registerJobCapabilities, resolveJobsStore, jobsServerStore } = await import("../job/job-scope.helper.mjs");
|
|
1192
|
+
refuseServerStoresInBrowser({ jobs: jobsServerStore(jobsConfig?.store, this.metadata) });
|
|
1193
|
+
const jobsStore = resolveJobsStore(jobsConfig?.store, {
|
|
1194
|
+
redis: this.metadata.redis,
|
|
1195
|
+
sqlite: topLevelSqlite
|
|
1196
|
+
});
|
|
1197
|
+
const effectiveConfig = { ...jobsConfig ?? {}, enabled: true, store: jobsStore };
|
|
1198
|
+
const result = await registerJobCapabilities({
|
|
1199
|
+
providers: this.scopeProviders,
|
|
1200
|
+
flowRegistry: this.scopeFlows,
|
|
1201
|
+
owner: scopeRef,
|
|
1202
|
+
jobsList: jobs,
|
|
1203
|
+
jobProviders,
|
|
1204
|
+
workflowsList: workflows,
|
|
1205
|
+
jobsConfig: effectiveConfig,
|
|
1206
|
+
logger: this.logger,
|
|
1207
|
+
notifyFn,
|
|
1208
|
+
entryServer: isEntryServer(this.metadata),
|
|
1209
|
+
jobWorker: isJobWorker(this.metadata)
|
|
1210
|
+
});
|
|
1211
|
+
this._scopeJobs = result.jobRegistry;
|
|
1212
|
+
this._scopeWorkflows = result.workflowRegistry;
|
|
1213
|
+
this._jobExecutionManager = result.executionManager;
|
|
1214
|
+
this._jobStateStore = result.stateStore;
|
|
1215
|
+
this._jobDefinitionStore = result.definitionStore;
|
|
1216
|
+
this._workflowEvents = result.workflowEvents;
|
|
1217
|
+
this._channelEventBus ??= result.workflowEvents?.bus;
|
|
1218
|
+
for (const toolCls of result.managementTools) {
|
|
1219
|
+
try {
|
|
1220
|
+
const toolRecord = normalizeTool(toolCls);
|
|
1221
|
+
const toolInstance = new ToolInstance(toolRecord, this.scopeProviders, {
|
|
1222
|
+
kind: "scope",
|
|
1223
|
+
id: "_jobs",
|
|
1224
|
+
ref: toolCls
|
|
1225
|
+
});
|
|
1226
|
+
this.scopeTools.registerToolInstance(toolInstance);
|
|
1227
|
+
} catch (error) {
|
|
1228
|
+
this.logger.warn(
|
|
1229
|
+
`Failed to register job management tool: ${error instanceof Error ? error.message : String(error)}`
|
|
1230
|
+
);
|
|
1231
|
+
}
|
|
1232
|
+
}
|
|
1233
|
+
this.logger.info(
|
|
1234
|
+
`Jobs system initialized: ${this._scopeJobs.getJobs().length} jobs, ${this._scopeWorkflows.getWorkflows().length} workflows`
|
|
1235
|
+
);
|
|
1236
|
+
return Boolean(topLevelSqlite) && jobsStore?.sqlite === topLevelSqlite;
|
|
1237
|
+
}
|
|
1238
|
+
async serveAppJobs(entries) {
|
|
1239
|
+
const served = { entries };
|
|
1240
|
+
const withdraw = () => {
|
|
1241
|
+
const pending = this.pendingAppJobs.indexOf(served);
|
|
1242
|
+
if (pending !== -1) this.pendingAppJobs.splice(pending, 1);
|
|
1243
|
+
served.unregister?.();
|
|
1244
|
+
served.unregister = void 0;
|
|
1245
|
+
};
|
|
1246
|
+
if (!this.jobsDecided) {
|
|
1247
|
+
this.pendingAppJobs.push(served);
|
|
1248
|
+
return withdraw;
|
|
1249
|
+
}
|
|
1250
|
+
if (this.metadata.jobs?.enabled === false) {
|
|
1251
|
+
this.logger.warn(
|
|
1252
|
+
`Jobs are explicitly disabled, so the ${entries.jobs.length} job(s) and ${entries.workflows.length} workflow(s) an app loaded are not served. Remove jobs.enabled: false to serve them.`
|
|
1253
|
+
);
|
|
1254
|
+
return withdraw;
|
|
1255
|
+
}
|
|
1256
|
+
this.lateJobsStart ??= this._scopeJobs ? Promise.resolve() : keptUntilFailure(
|
|
1257
|
+
this.startJobs([], /* @__PURE__ */ new Map(), [], this.topLevelSqlite).then(() => void 0),
|
|
1258
|
+
() => this.lateJobsStart = void 0
|
|
1259
|
+
);
|
|
1260
|
+
await this.lateJobsStart;
|
|
1261
|
+
const jobRegistry = this._scopeJobs;
|
|
1262
|
+
const workflowRegistry = this._scopeWorkflows;
|
|
1263
|
+
if (!jobRegistry || !workflowRegistry) throw new InternalMcpError("The job system did not start");
|
|
1264
|
+
const { registerAppJobEntries } = await import("../job/job-scope.helper.mjs");
|
|
1265
|
+
served.unregister = await registerAppJobEntries({
|
|
1266
|
+
jobRegistry,
|
|
1267
|
+
workflowRegistry,
|
|
1268
|
+
jobs: entries.jobs,
|
|
1269
|
+
workflows: entries.workflows,
|
|
1270
|
+
providers: entries.providers,
|
|
1271
|
+
runner: this.metadata.jobs?.runner
|
|
1272
|
+
});
|
|
1273
|
+
return withdraw;
|
|
1274
|
+
}
|
|
1275
|
+
serveLateEntries(kinds) {
|
|
1276
|
+
return Promise.all(
|
|
1277
|
+
kinds.map((kind) => kind === "agents" ? this.serveAgentCalls() : this.serveSkillsAddedLater())
|
|
1278
|
+
).then(() => void 0);
|
|
1279
|
+
}
|
|
1280
|
+
/** Register the `agents:call-agent` flow an agent's tool runs through, once. */
|
|
1281
|
+
serveAgentCalls() {
|
|
1282
|
+
this.agentCallsServed ??= keptUntilFailure(
|
|
1283
|
+
import("../agent/flows/index.mjs").then(({ CallAgentFlow }) => this.scopeFlows.registryFlows([CallAgentFlow])),
|
|
1284
|
+
() => this.agentCallsServed = void 0
|
|
1285
|
+
);
|
|
1286
|
+
return this.agentCallsServed;
|
|
1287
|
+
}
|
|
1288
|
+
/** Serve skills to a scope that served none at startup: the skill session guard, the skill methods and resources. */
|
|
1289
|
+
serveSkillsAddedLater() {
|
|
1290
|
+
this.skillsServed ??= keptUntilFailure(
|
|
1291
|
+
(async () => {
|
|
1292
|
+
if (!this._skillSession) await this.startSkillSession();
|
|
1293
|
+
await serveSkillMethods({
|
|
1294
|
+
skillRegistry: this.scopeSkills,
|
|
1295
|
+
flowRegistry: this.scopeFlows,
|
|
1296
|
+
resourceRegistry: this.scopeResources,
|
|
1297
|
+
providers: this.scopeProviders,
|
|
1298
|
+
skillsConfig: this.metadata.skillsConfig,
|
|
1299
|
+
logger: this.logger
|
|
1300
|
+
});
|
|
1301
|
+
})(),
|
|
1302
|
+
() => this.skillsServed = void 0
|
|
1303
|
+
);
|
|
1304
|
+
return this.skillsServed;
|
|
1305
|
+
}
|
|
1306
|
+
/** Start the skill session manager, and the hook that guards tool calls by the active skill's allowlist. */
|
|
1307
|
+
async startSkillSession() {
|
|
1308
|
+
const [skillSession, { createSkillToolGuardHook }] = await Promise.all([
|
|
1309
|
+
import("../skill/session/index.mjs"),
|
|
1310
|
+
import("../skill/hooks/index.mjs")
|
|
1311
|
+
]);
|
|
1312
|
+
const store = skillSession.createSkillSessionStore({ type: "memory" });
|
|
1313
|
+
this._skillSession = new skillSession.SkillSessionManager(
|
|
1314
|
+
{
|
|
1315
|
+
defaultPolicyMode: "permissive"
|
|
1316
|
+
},
|
|
1317
|
+
this.logger,
|
|
1318
|
+
store
|
|
1319
|
+
);
|
|
1320
|
+
const GuardHookClass = createSkillToolGuardHook(this._skillSession, {
|
|
1321
|
+
logger: this.logger,
|
|
1322
|
+
trackToolCalls: true,
|
|
1323
|
+
verifiedSessionId: () => this.verifiedRequestSessionId()
|
|
1324
|
+
});
|
|
1325
|
+
const guardHookInstance = new GuardHookClass();
|
|
1326
|
+
const hookRecords = normalizeHooksFromCls(guardHookInstance);
|
|
1327
|
+
if (hookRecords.length > 0) {
|
|
1328
|
+
await this.scopeHooks.registerHooks(false, ...hookRecords);
|
|
1329
|
+
this.logger.verbose("Skill tool authorization guard hook registered");
|
|
1330
|
+
}
|
|
1331
|
+
this.logger.verbose("Skill session manager initialized", {
|
|
1332
|
+
storeType: store.type
|
|
1333
|
+
});
|
|
1334
|
+
}
|
|
1335
|
+
/** The MCP session the server verified for the request being served, if any. */
|
|
1336
|
+
verifiedRequestSessionId() {
|
|
1337
|
+
try {
|
|
1338
|
+
return this.scopeProviders.get(FrontMcpContextStorage).getStore()?.verifiedSessionId;
|
|
1339
|
+
} catch {
|
|
1340
|
+
return void 0;
|
|
1341
|
+
}
|
|
1139
1342
|
}
|
|
1140
1343
|
/**
|
|
1141
1344
|
* Get the skill session manager for tool authorization enforcement.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// libs/sdk/src/skill/errors/tool-not-allowed.error.ts
|
|
2
|
-
import {
|
|
2
|
+
import { MCP_ERROR_CODES, PublicMcpError } from "../../errors/index.mjs";
|
|
3
3
|
var ToolNotAllowedError = class _ToolNotAllowedError extends PublicMcpError {
|
|
4
4
|
mcpErrorCode = MCP_ERROR_CODES.INVALID_REQUEST;
|
|
5
5
|
toolName;
|
|
@@ -47,7 +47,7 @@ The '${skillDisplay}' skill session has reached its maximum tool call limit.`;
|
|
|
47
47
|
case "no_active_skill":
|
|
48
48
|
return `Cannot call tool '${toolName}': no skill is active and explicit activation is required.
|
|
49
49
|
|
|
50
|
-
|
|
50
|
+
Activate a skill first: send a skills/load request with activateSession: true.`;
|
|
51
51
|
default:
|
|
52
52
|
return `Tool '${toolName}' is not authorized for use in this skill session.`;
|
|
53
53
|
}
|
|
@@ -103,22 +103,34 @@ var LoadSkillFlow = class extends FlowBase {
|
|
|
103
103
|
this.logger.verbose("activateSessions:skip (no session manager available)");
|
|
104
104
|
return;
|
|
105
105
|
}
|
|
106
|
-
const
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
106
|
+
const policy = policyMode ? { policyMode } : void 0;
|
|
107
|
+
const activate = async () => {
|
|
108
|
+
for (const item of loadResults) {
|
|
109
|
+
const { skill } = item.loadResult;
|
|
110
|
+
const activationResult = sessionManager.activateSkill(skill.id, skill, item.loadResult, policy);
|
|
111
|
+
item.activationResult = activationResult;
|
|
112
|
+
this.logger.info(`activateSessions: activated skill "${skill.id}"`, {
|
|
113
|
+
policyMode: activationResult.session.policyMode,
|
|
114
|
+
allowedTools: activationResult.availableTools
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
const sessionId = this.tryGetContext()?.verifiedSessionId;
|
|
119
|
+
const targetSessionId = sessionId ?? sessionManager.getActiveSession()?.sessionId;
|
|
120
|
+
if (targetSessionId && !await sessionManager.hasRoomFor(targetSessionId)) {
|
|
121
|
+
throw new PublicMcpError(
|
|
122
|
+
"The server keeps as many skill sessions as it can; activate again once a session has ended (DELETE)",
|
|
123
|
+
"SKILL_SESSION_LIMIT",
|
|
124
|
+
503
|
|
125
|
+
);
|
|
113
126
|
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
});
|
|
127
|
+
if (sessionId && sessionManager.getActiveSession()?.sessionId !== sessionId) {
|
|
128
|
+
await sessionManager.runWithSession(sessionId, activate);
|
|
129
|
+
} else if (sessionManager.getActiveSession()) {
|
|
130
|
+
await activate();
|
|
131
|
+
} else {
|
|
132
|
+
this.logger.warn("activateSessions: the request has no MCP session, cannot activate skill sessions");
|
|
133
|
+
return;
|
|
122
134
|
}
|
|
123
135
|
this.state.set({ loadResults });
|
|
124
136
|
this.logger.verbose("activateSessions:done");
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// libs/sdk/src/skill/guards/tool-authorization.guard.ts
|
|
2
|
-
import {
|
|
2
|
+
import { ToolApprovalRequiredError, ToolNotAllowedError } from "../errors/tool-not-allowed.error.mjs";
|
|
3
3
|
var ToolAuthorizationGuard = class {
|
|
4
4
|
sessionManager;
|
|
5
5
|
logger;
|
|
@@ -54,7 +54,7 @@ async function handleAuthorizationResult(authResult, sessionManager, policyMode,
|
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
function createSkillToolGuardHook(sessionManager, options = {}) {
|
|
57
|
-
const { logger, onApprovalRequired, trackToolCalls = true } = options;
|
|
57
|
+
const { logger, onApprovalRequired, trackToolCalls = true, verifiedSessionId } = options;
|
|
58
58
|
class SkillToolGuardHookImpl {
|
|
59
59
|
async checkSkillToolAuthorization(ctx) {
|
|
60
60
|
const rawToolName = ctx.state.tool?.metadata?.name || ctx.state.input?.name || ctx.state.tool?.fullName;
|
|
@@ -63,36 +63,44 @@ function createSkillToolGuardHook(sessionManager, options = {}) {
|
|
|
63
63
|
return;
|
|
64
64
|
}
|
|
65
65
|
const toolName = rawToolName.includes(":") ? rawToolName.substring(rawToolName.lastIndexOf(":") + 1) : rawToolName;
|
|
66
|
-
const
|
|
67
|
-
if (
|
|
68
|
-
|
|
66
|
+
const sessionId = verifiedSessionId?.();
|
|
67
|
+
if (sessionId && sessionManager.getActiveSession()?.sessionId !== sessionId) {
|
|
68
|
+
await sessionManager.runWithSession(sessionId, () => authorizeInActiveSession(toolName));
|
|
69
69
|
return;
|
|
70
70
|
}
|
|
71
|
-
|
|
72
|
-
logger?.verbose("SkillToolGuard: skipping (no active skill)");
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
logger?.verbose(`SkillToolGuard: checking authorization for tool "${toolName}"`, {
|
|
76
|
-
skillId: session.activeSkillId,
|
|
77
|
-
policyMode: session.policyMode
|
|
78
|
-
});
|
|
79
|
-
const authResult = sessionManager.checkToolAuthorization(toolName);
|
|
80
|
-
if (trackToolCalls && authResult.allowed) {
|
|
81
|
-
sessionManager.recordToolCall(toolName);
|
|
82
|
-
}
|
|
83
|
-
await handleAuthorizationResult(
|
|
84
|
-
authResult,
|
|
85
|
-
sessionManager,
|
|
86
|
-
session.policyMode,
|
|
87
|
-
session.activeSkillId,
|
|
88
|
-
onApprovalRequired,
|
|
89
|
-
logger
|
|
90
|
-
);
|
|
71
|
+
await authorizeInActiveSession(toolName);
|
|
91
72
|
}
|
|
92
73
|
}
|
|
93
74
|
__decorateClass([
|
|
94
75
|
Will("checkToolAuthorization", { priority: -1e3 })
|
|
95
76
|
], SkillToolGuardHookImpl.prototype, "checkSkillToolAuthorization", 1);
|
|
77
|
+
async function authorizeInActiveSession(toolName) {
|
|
78
|
+
const session = sessionManager.getActiveSession();
|
|
79
|
+
if (!session) {
|
|
80
|
+
logger?.verbose("SkillToolGuard: skipping (no active session)");
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
if (!session.activeSkillId) {
|
|
84
|
+
logger?.verbose("SkillToolGuard: skipping (no active skill)");
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
logger?.verbose(`SkillToolGuard: checking authorization for tool "${toolName}"`, {
|
|
88
|
+
skillId: session.activeSkillId,
|
|
89
|
+
policyMode: session.policyMode
|
|
90
|
+
});
|
|
91
|
+
const authResult = sessionManager.checkToolAuthorization(toolName);
|
|
92
|
+
if (trackToolCalls && authResult.allowed) {
|
|
93
|
+
sessionManager.recordToolCall(toolName);
|
|
94
|
+
}
|
|
95
|
+
await handleAuthorizationResult(
|
|
96
|
+
authResult,
|
|
97
|
+
sessionManager,
|
|
98
|
+
session.policyMode,
|
|
99
|
+
session.activeSkillId,
|
|
100
|
+
onApprovalRequired,
|
|
101
|
+
logger
|
|
102
|
+
);
|
|
103
|
+
}
|
|
96
104
|
return SkillToolGuardHookImpl;
|
|
97
105
|
}
|
|
98
106
|
export {
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
// libs/sdk/src/skill/providers/external-skill.provider.ts
|
|
2
|
-
import {
|
|
2
|
+
import { MCP_ERROR_CODES, PublicMcpError } from "../../errors/index.mjs";
|
|
3
3
|
import { computeSkillHash } from "../sync/skill-hash.mjs";
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
createEmptySyncState
|
|
6
|
+
} from "../sync/sync-state.interface.mjs";
|
|
5
7
|
var ExternalSkillProviderBase = class {
|
|
6
8
|
type = "external";
|
|
7
9
|
/** Operating mode */
|