@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
|
@@ -1,128 +1,47 @@
|
|
|
1
1
|
// libs/sdk/src/app/instances/app.esm.instance.ts
|
|
2
|
+
import AgentRegistry from "../../agent/agent.registry.mjs";
|
|
2
3
|
import {
|
|
3
4
|
AppEntry
|
|
4
5
|
} from "../../common/index.mjs";
|
|
5
|
-
import { isPrimitiveIncluded } from "../../common/utils/primitive-filter.mjs";
|
|
6
6
|
import { InternalMcpError } from "../../errors/index.mjs";
|
|
7
|
-
import {
|
|
8
|
-
createPackageModuleLoader,
|
|
9
|
-
esmManifestRecords,
|
|
10
|
-
esmPromptRecord,
|
|
11
|
-
esmResourceRecord,
|
|
12
|
-
esmToolRecord,
|
|
13
|
-
registryAuthOf
|
|
14
|
-
} from "../../esm-loader/esm-entries.mjs";
|
|
7
|
+
import { createPackageModuleLoader, mergePackageLoaders, registryAuthOf } from "../../esm-loader/esm-entries.mjs";
|
|
15
8
|
import { parsePackageSpecifier } from "../../esm-loader/package-specifier.mjs";
|
|
16
9
|
import { VersionPoller } from "../../esm-loader/version-poller.mjs";
|
|
17
|
-
import { PromptInstance } from "../../prompt/prompt.instance.mjs";
|
|
18
10
|
import PromptRegistry from "../../prompt/prompt.registry.mjs";
|
|
19
|
-
import
|
|
11
|
+
import ProviderRegistry from "../../provider/provider.registry.mjs";
|
|
20
12
|
import ResourceRegistry from "../../resource/resource.registry.mjs";
|
|
21
|
-
import
|
|
13
|
+
import SkillRegistry from "../../skill/skill.registry.mjs";
|
|
22
14
|
import ToolRegistry from "../../tool/tool.registry.mjs";
|
|
23
15
|
import { appIdOf } from "../app.utils.mjs";
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
getPlugins() {
|
|
27
|
-
return [];
|
|
28
|
-
}
|
|
29
|
-
getPluginNames() {
|
|
30
|
-
return [];
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
var EmptyAdapterRegistry = class {
|
|
34
|
-
getAdapters() {
|
|
35
|
-
return [];
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
var EmptySkillRegistry = class _EmptySkillRegistry {
|
|
39
|
-
owner = { kind: "app", id: "_esm", ref: _EmptySkillRegistry };
|
|
40
|
-
getSkills() {
|
|
41
|
-
return [];
|
|
42
|
-
}
|
|
43
|
-
getExecutableSkills() {
|
|
44
|
-
return [];
|
|
45
|
-
}
|
|
46
|
-
getKnowledgeOnlySkills() {
|
|
47
|
-
return [];
|
|
48
|
-
}
|
|
49
|
-
findByName() {
|
|
50
|
-
return void 0;
|
|
51
|
-
}
|
|
52
|
-
findByQualifiedName() {
|
|
53
|
-
return void 0;
|
|
54
|
-
}
|
|
55
|
-
async search() {
|
|
56
|
-
return [];
|
|
57
|
-
}
|
|
58
|
-
async loadSkill() {
|
|
59
|
-
return void 0;
|
|
60
|
-
}
|
|
61
|
-
async listSkills() {
|
|
62
|
-
return { skills: [], total: 0, hasMore: false };
|
|
63
|
-
}
|
|
64
|
-
hasAny() {
|
|
65
|
-
return false;
|
|
66
|
-
}
|
|
67
|
-
async count() {
|
|
68
|
-
return 0;
|
|
69
|
-
}
|
|
70
|
-
subscribe() {
|
|
71
|
-
return () => {
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
notifyListChanged() {
|
|
75
|
-
}
|
|
76
|
-
getCapabilities() {
|
|
77
|
-
return {};
|
|
78
|
-
}
|
|
79
|
-
async validateAllTools() {
|
|
80
|
-
return {
|
|
81
|
-
results: [],
|
|
82
|
-
isValid: true,
|
|
83
|
-
totalSkills: 0,
|
|
84
|
-
failedCount: 0,
|
|
85
|
-
warningCount: 0
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
async syncToExternal() {
|
|
89
|
-
return null;
|
|
90
|
-
}
|
|
91
|
-
setExternalProvider() {
|
|
92
|
-
return void 0;
|
|
93
|
-
}
|
|
94
|
-
getExternalProvider() {
|
|
95
|
-
return void 0;
|
|
96
|
-
}
|
|
97
|
-
hasExternalProvider() {
|
|
98
|
-
return false;
|
|
99
|
-
}
|
|
100
|
-
async registerSkillContent() {
|
|
101
|
-
throw new InternalMcpError("registerSkillContent is not supported on ESM apps", "UNSUPPORTED_OPERATION");
|
|
102
|
-
}
|
|
103
|
-
async unregisterSkill() {
|
|
104
|
-
return false;
|
|
105
|
-
}
|
|
106
|
-
};
|
|
16
|
+
import { EmptyAdapterRegistry, EmptyPluginRegistry } from "./empty-app-registries.mjs";
|
|
17
|
+
import { EsmPackageVersion } from "./esm-package-version.mjs";
|
|
107
18
|
var AppEsmInstance = class extends AppEntry {
|
|
108
19
|
id;
|
|
109
20
|
get isRemote() {
|
|
110
21
|
return true;
|
|
111
22
|
}
|
|
112
23
|
scopeProviders;
|
|
24
|
+
/** The app's own providers, below the scope's; each loaded version registers the package's providers below them. */
|
|
25
|
+
ownProviders;
|
|
113
26
|
appOwner;
|
|
114
27
|
loader;
|
|
28
|
+
packageLoader;
|
|
115
29
|
specifier;
|
|
116
30
|
poller;
|
|
117
31
|
loadResult;
|
|
118
32
|
updateInProgress = false;
|
|
33
|
+
replacedVersionCount = 0;
|
|
34
|
+
registered;
|
|
35
|
+
/** For each version whose jobs and workflows the scope serves, the function that withdraws them. */
|
|
36
|
+
jobWithdrawals = /* @__PURE__ */ new Map();
|
|
119
37
|
// Standard registries
|
|
120
38
|
_tools;
|
|
121
39
|
_resources;
|
|
122
40
|
_prompts;
|
|
41
|
+
_agents;
|
|
42
|
+
_skills;
|
|
123
43
|
_plugins;
|
|
124
44
|
_adapters;
|
|
125
|
-
_skills;
|
|
126
45
|
constructor(record, scopeProviders) {
|
|
127
46
|
super(record);
|
|
128
47
|
this.id = appIdOf(this.metadata);
|
|
@@ -135,25 +54,36 @@ var AppEsmInstance = class extends AppEntry {
|
|
|
135
54
|
this.specifier = parsePackageSpecifier(this.metadata.url);
|
|
136
55
|
const scope = scopeProviders.getActiveScope();
|
|
137
56
|
const appConfig = this.metadata.packageConfig;
|
|
57
|
+
this.packageLoader = mergePackageLoaders(scope.metadata.loader, appConfig?.loader);
|
|
138
58
|
this.loader = createPackageModuleLoader({
|
|
139
|
-
loader:
|
|
59
|
+
loader: this.packageLoader,
|
|
140
60
|
cacheTTL: appConfig?.cacheTTL,
|
|
141
61
|
importMap: appConfig?.importMap,
|
|
142
62
|
logger: scope.logger
|
|
143
63
|
});
|
|
144
|
-
this.
|
|
145
|
-
this.
|
|
146
|
-
this.
|
|
64
|
+
this.ownProviders = new ProviderRegistry([], scopeProviders);
|
|
65
|
+
this._tools = new ToolRegistry(this.ownProviders, [], this.appOwner, { adopt: false });
|
|
66
|
+
this._resources = new ResourceRegistry(this.ownProviders, [], this.appOwner, { adopt: false });
|
|
67
|
+
this._prompts = new PromptRegistry(this.ownProviders, [], this.appOwner, { adopt: false });
|
|
68
|
+
this._agents = new AgentRegistry(this.ownProviders, [], this.appOwner);
|
|
69
|
+
this._skills = new SkillRegistry(this.ownProviders, [], this.appOwner);
|
|
147
70
|
this._plugins = new EmptyPluginRegistry();
|
|
148
71
|
this._adapters = new EmptyAdapterRegistry();
|
|
149
|
-
this._skills = new EmptySkillRegistry();
|
|
150
72
|
this.ready = this.initialize();
|
|
151
73
|
}
|
|
152
74
|
async initialize() {
|
|
153
75
|
const logger = this.scopeProviders.getActiveScope().logger;
|
|
154
76
|
logger.info(`Initializing ESM app: ${this.id} (${this.specifier.fullName}@${this.specifier.range})`);
|
|
155
77
|
try {
|
|
156
|
-
await Promise.all([
|
|
78
|
+
await Promise.all([
|
|
79
|
+
this.ownProviders.ready,
|
|
80
|
+
this._tools.ready,
|
|
81
|
+
this._resources.ready,
|
|
82
|
+
this._prompts.ready,
|
|
83
|
+
this._agents.ready,
|
|
84
|
+
this._skills.ready
|
|
85
|
+
]);
|
|
86
|
+
this.scopeProviders.getActiveScope().onDispose(() => this.dispose());
|
|
157
87
|
this.loadResult = await this.loader.load(this.specifier);
|
|
158
88
|
logger.info(
|
|
159
89
|
`Loaded ESM package ${this.specifier.fullName}@${this.loadResult.resolvedVersion} (source: ${this.loadResult.source})`
|
|
@@ -161,11 +91,9 @@ var AppEsmInstance = class extends AppEntry {
|
|
|
161
91
|
await this.registerFromManifest(this.loadResult.manifest);
|
|
162
92
|
const autoUpdate = this.metadata.packageConfig?.autoUpdate;
|
|
163
93
|
if (autoUpdate?.enabled) {
|
|
164
|
-
const scopeMeta = this.scopeProviders.getActiveScope().metadata;
|
|
165
|
-
const pollerLoader = this.metadata.packageConfig?.loader ?? scopeMeta.loader;
|
|
166
94
|
this.poller = new VersionPoller({
|
|
167
95
|
intervalMs: autoUpdate.intervalMs,
|
|
168
|
-
registryAuth: registryAuthOf(
|
|
96
|
+
registryAuth: registryAuthOf(this.packageLoader),
|
|
169
97
|
logger,
|
|
170
98
|
onNewVersion: (pkg, oldVer, newVer) => this.handleVersionUpdate(pkg, oldVer, newVer)
|
|
171
99
|
});
|
|
@@ -181,7 +109,7 @@ var AppEsmInstance = class extends AppEntry {
|
|
|
181
109
|
// PUBLIC API
|
|
182
110
|
// \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550
|
|
183
111
|
get providers() {
|
|
184
|
-
return this.
|
|
112
|
+
return this.ownProviders;
|
|
185
113
|
}
|
|
186
114
|
get adapters() {
|
|
187
115
|
return this._adapters;
|
|
@@ -201,6 +129,9 @@ var AppEsmInstance = class extends AppEntry {
|
|
|
201
129
|
get skills() {
|
|
202
130
|
return this._skills;
|
|
203
131
|
}
|
|
132
|
+
get agents() {
|
|
133
|
+
return this._agents;
|
|
134
|
+
}
|
|
204
135
|
/**
|
|
205
136
|
* Get the currently loaded package version.
|
|
206
137
|
*/
|
|
@@ -219,10 +150,11 @@ var AppEsmInstance = class extends AppEntry {
|
|
|
219
150
|
async reload() {
|
|
220
151
|
const logger = this.scopeProviders.getActiveScope().logger;
|
|
221
152
|
logger.info(`Reloading ESM app ${this.id}`);
|
|
222
|
-
|
|
223
|
-
await this.registerFromManifest(
|
|
153
|
+
const loadResult = await this.loader.load(this.specifier);
|
|
154
|
+
await this.registerFromManifest(loadResult.manifest, { replacing: true });
|
|
155
|
+
this.loadResult = loadResult;
|
|
224
156
|
if (this.poller) {
|
|
225
|
-
this.poller.updateCurrentVersion(this.specifier.fullName,
|
|
157
|
+
this.poller.updateCurrentVersion(this.specifier.fullName, loadResult.resolvedVersion);
|
|
226
158
|
}
|
|
227
159
|
}
|
|
228
160
|
/**
|
|
@@ -235,70 +167,104 @@ var AppEsmInstance = class extends AppEntry {
|
|
|
235
167
|
// PRIVATE METHODS
|
|
236
168
|
// \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550
|
|
237
169
|
/**
|
|
238
|
-
* Register
|
|
170
|
+
* Register the entries of a loaded package manifest in place of the ones registered before. Every entry is built
|
|
171
|
+
* first, on the version's own providers, so an entry that fails to build leaves the previous version serving. A
|
|
172
|
+
* version that replaces a served one has its providers' `onReady()` run before it is swapped in; the replaced
|
|
173
|
+
* version's providers stay up, for the calls still running on its entries, until the server shuts down.
|
|
239
174
|
*/
|
|
240
|
-
async registerFromManifest(manifest) {
|
|
175
|
+
async registerFromManifest(manifest, { replacing } = { replacing: false }) {
|
|
241
176
|
const logger = this.scopeProviders.getActiveScope().logger;
|
|
242
|
-
const
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
);
|
|
248
|
-
|
|
249
|
-
const filter = this.metadata.filter;
|
|
250
|
-
const prefixLength = namespace ? namespace.length + 1 : 0;
|
|
251
|
-
const included = (kind) => (record) => isPrimitiveIncluded(record.metadata.name.slice(prefixLength), kind, filter);
|
|
252
|
-
const tools = esmManifestRecords(manifest.tools, (raw) => esmToolRecord(raw, namespace)).filter(included("tools"));
|
|
253
|
-
const resources = esmManifestRecords(manifest.resources, (raw) => esmResourceRecord(raw, namespace)).filter(
|
|
254
|
-
included("resources")
|
|
255
|
-
);
|
|
256
|
-
const prompts = esmManifestRecords(manifest.prompts, (raw) => esmPromptRecord(raw, namespace)).filter(
|
|
257
|
-
included("prompts")
|
|
258
|
-
);
|
|
259
|
-
for (const record of tools) {
|
|
260
|
-
const instance = new ToolInstance(record, this.scopeProviders, this.appOwner);
|
|
261
|
-
await instance.ready;
|
|
262
|
-
this._tools.registerToolInstance(instance);
|
|
263
|
-
}
|
|
264
|
-
for (const record of resources) {
|
|
265
|
-
const instance = new ResourceInstance(record, this.scopeProviders, this.appOwner);
|
|
266
|
-
await instance.ready;
|
|
267
|
-
this._resources.registerResourceInstance(instance);
|
|
268
|
-
}
|
|
269
|
-
for (const record of prompts) {
|
|
270
|
-
const instance = new PromptInstance(record, this.scopeProviders, this.appOwner);
|
|
271
|
-
await instance.ready;
|
|
272
|
-
this._prompts.registerPromptInstance(instance);
|
|
177
|
+
const next = await EsmPackageVersion.build(manifest, this.packageTarget());
|
|
178
|
+
try {
|
|
179
|
+
if (replacing) await next.providers.runReadyHooks(logger);
|
|
180
|
+
await this.swapEntries(next, { replacing });
|
|
181
|
+
} catch (error) {
|
|
182
|
+
await next.discard(logger);
|
|
183
|
+
throw error;
|
|
273
184
|
}
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
185
|
+
if (replacing) this.replacedVersionCount++;
|
|
186
|
+
logger.info(`ESM app ${this.id} registered: ${next.describe()}`);
|
|
187
|
+
}
|
|
188
|
+
packageTarget() {
|
|
189
|
+
return {
|
|
190
|
+
providers: this.ownProviders,
|
|
191
|
+
owner: this.appOwner,
|
|
192
|
+
namespace: this.metadata.namespace ?? this.metadata.name,
|
|
193
|
+
filter: this.metadata.filter,
|
|
194
|
+
logger: this.scopeProviders.getActiveScope().logger
|
|
195
|
+
};
|
|
277
196
|
}
|
|
278
197
|
/**
|
|
279
198
|
* Handle a new version detected by the version poller.
|
|
280
199
|
*/
|
|
281
200
|
async handleVersionUpdate(_packageName, oldVersion, newVersion) {
|
|
282
|
-
const
|
|
201
|
+
const scope = this.scopeProviders.getActiveScope();
|
|
202
|
+
const logger = scope.logger;
|
|
203
|
+
if (scope.isDisposed) return;
|
|
283
204
|
if (this.updateInProgress) {
|
|
284
|
-
|
|
285
|
-
return;
|
|
205
|
+
throw new InternalMcpError(`An update of ESM app ${this.id} is already in progress`, "ESM_UPDATE_IN_PROGRESS");
|
|
286
206
|
}
|
|
287
207
|
this.updateInProgress = true;
|
|
288
208
|
logger.info(`Updating ESM app ${this.id}: ${oldVersion} \u2192 ${newVersion}`);
|
|
289
209
|
try {
|
|
290
|
-
|
|
291
|
-
this.
|
|
292
|
-
this.
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
210
|
+
const loadResult = await this.loader.load(this.specifier);
|
|
211
|
+
await this.registerFromManifest(loadResult.manifest, { replacing: true });
|
|
212
|
+
this.loadResult = loadResult;
|
|
213
|
+
logger.info(
|
|
214
|
+
`ESM app ${this.id} updated to ${newVersion}; ${this.replacedVersionCount} replaced version(s) keep their providers until shutdown`
|
|
215
|
+
);
|
|
296
216
|
} catch (error) {
|
|
297
217
|
logger.error(`Failed to update ESM app ${this.id} to ${newVersion}: ${error.message}`);
|
|
218
|
+
throw error;
|
|
298
219
|
} finally {
|
|
299
220
|
this.updateInProgress = false;
|
|
300
221
|
}
|
|
301
222
|
}
|
|
223
|
+
/**
|
|
224
|
+
* Registers `next` in place of the registered entries; if one fails to register, the previous ones are put back.
|
|
225
|
+
* Clients get one `list_changed` for each list the swap changed. A version that replaces one after startup gets
|
|
226
|
+
* what startup gives an app: the scope serves its kinds of entry, and checks it as it checks every app.
|
|
227
|
+
*/
|
|
228
|
+
async swapEntries(next, { replacing }) {
|
|
229
|
+
const scope = this.scopeProviders.getActiveScope();
|
|
230
|
+
if (replacing) await scope.serveLateEntries(next.lateEntryKinds());
|
|
231
|
+
await scope.batchListChanges(async (batch) => {
|
|
232
|
+
const previous = this.registered;
|
|
233
|
+
if (previous) this.unregisterEntries(previous);
|
|
234
|
+
try {
|
|
235
|
+
await this.registerEntries(next);
|
|
236
|
+
if (replacing) await scope.checkLateApp(this);
|
|
237
|
+
} catch (error) {
|
|
238
|
+
this.unregisterEntries(next);
|
|
239
|
+
if (previous) await this.registerEntries(previous);
|
|
240
|
+
batch.listsRestored();
|
|
241
|
+
throw error;
|
|
242
|
+
}
|
|
243
|
+
});
|
|
244
|
+
this.registered = next;
|
|
245
|
+
}
|
|
246
|
+
async registerEntries(version) {
|
|
247
|
+
const { tools, resources, prompts, agents, skills, jobs, workflows } = version.entries;
|
|
248
|
+
for (const tool of tools) this._tools.registerToolInstance(tool);
|
|
249
|
+
for (const resource of resources) this._resources.registerResourceInstance(resource);
|
|
250
|
+
for (const prompt of prompts) this._prompts.registerPromptInstance(prompt);
|
|
251
|
+
if (agents) this._agents.adoptFromChild(agents, agents.owner);
|
|
252
|
+
if (skills) await this._skills.adoptFromChild(skills, skills.owner);
|
|
253
|
+
if (jobs.length > 0 || workflows.length > 0) {
|
|
254
|
+
const scope = this.scopeProviders.getActiveScope();
|
|
255
|
+
this.jobWithdrawals.set(version, await scope.serveAppJobs({ jobs, workflows, providers: version.providers }));
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
unregisterEntries(version) {
|
|
259
|
+
const { tools, resources, prompts, agents, skills } = version.entries;
|
|
260
|
+
for (const tool of tools) this._tools.unregisterToolInstance(tool.record.provide);
|
|
261
|
+
for (const resource of resources) this._resources.unregisterResourceInstance(resource.record.provide);
|
|
262
|
+
for (const prompt of prompts) this._prompts.unregisterPromptInstance(prompt.record.provide);
|
|
263
|
+
if (agents) this._agents.removeChild(agents);
|
|
264
|
+
if (skills) this._skills.removeChild(skills);
|
|
265
|
+
this.jobWithdrawals.get(version)?.();
|
|
266
|
+
this.jobWithdrawals.delete(version);
|
|
267
|
+
}
|
|
302
268
|
};
|
|
303
269
|
export {
|
|
304
270
|
AppEsmInstance
|
|
@@ -67,9 +67,7 @@ var AppRemoteInstance = class extends AppEntry {
|
|
|
67
67
|
this._plugins = new EmptyPluginRegistry();
|
|
68
68
|
this._adapters = new EmptyAdapterRegistry();
|
|
69
69
|
this._skills = new EmptySkillRegistry();
|
|
70
|
-
this.mcpClient = mcpClientServiceOf(this.scopeProviders.getActiveScope()
|
|
71
|
-
capabilityRefreshInterval: this.metadata.refreshInterval ?? 0
|
|
72
|
-
});
|
|
70
|
+
this.mcpClient = mcpClientServiceOf(this.scopeProviders.getActiveScope());
|
|
73
71
|
this.ready = this.initialize();
|
|
74
72
|
}
|
|
75
73
|
async initialize() {
|
|
@@ -85,7 +83,8 @@ var AppRemoteInstance = class extends AppEntry {
|
|
|
85
83
|
transportType: this.mapUrlTypeToTransportType(this.metadata.urlType),
|
|
86
84
|
transportOptions: this.metadata.transportOptions,
|
|
87
85
|
remoteAuth: this.metadata.remoteAuth,
|
|
88
|
-
namespace: this.metadata.namespace
|
|
86
|
+
namespace: this.metadata.namespace,
|
|
87
|
+
refreshInterval: this.metadata.refreshInterval ?? 0
|
|
89
88
|
})
|
|
90
89
|
);
|
|
91
90
|
this.isConnected = true;
|
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
import { getMetadata, isClass } from "@frontmcp/di";
|
|
3
3
|
import { isValidMcpUri } from "@frontmcp/utils";
|
|
4
4
|
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
FrontMcpPromptTokens,
|
|
5
|
+
FrontMcpAgentTokens,
|
|
6
|
+
FrontMcpJobTokens,
|
|
8
7
|
FrontMcpLocalAppTokens,
|
|
8
|
+
FrontMcpPromptTokens,
|
|
9
|
+
FrontMcpProviderTokens,
|
|
10
|
+
FrontMcpResourceTokens,
|
|
9
11
|
FrontMcpSkillTokens,
|
|
10
|
-
|
|
11
|
-
FrontMcpAgentTokens,
|
|
12
|
+
FrontMcpToolTokens,
|
|
12
13
|
FrontMcpWorkflowTokens
|
|
13
14
|
} from "../../common/tokens/index.mjs";
|
|
14
15
|
function isDecoratedAppClass(raw) {
|
|
@@ -35,6 +36,9 @@ function isDecoratedAgentClass(raw) {
|
|
|
35
36
|
function isDecoratedWorkflowClass(raw) {
|
|
36
37
|
return isClass(raw) && getMetadata(FrontMcpWorkflowTokens.type, raw) === true;
|
|
37
38
|
}
|
|
39
|
+
function isDecoratedProviderClass(raw) {
|
|
40
|
+
return isClass(raw) && getMetadata(FrontMcpProviderTokens.type, raw) === true;
|
|
41
|
+
}
|
|
38
42
|
function normalizeToolFromEsmExport(raw) {
|
|
39
43
|
if (!raw || typeof raw !== "object" || isClass(raw)) return void 0;
|
|
40
44
|
const obj = raw;
|
|
@@ -90,6 +94,7 @@ export {
|
|
|
90
94
|
isDecoratedAppClass,
|
|
91
95
|
isDecoratedJobClass,
|
|
92
96
|
isDecoratedPromptClass,
|
|
97
|
+
isDecoratedProviderClass,
|
|
93
98
|
isDecoratedResourceClass,
|
|
94
99
|
isDecoratedSkillClass,
|
|
95
100
|
isDecoratedToolClass,
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
// libs/sdk/src/app/instances/esm-package-version.ts
|
|
2
|
+
import AgentRegistry from "../../agent/agent.registry.mjs";
|
|
3
|
+
import { normalizeAgent } from "../../agent/agent.utils.mjs";
|
|
4
|
+
import {
|
|
5
|
+
normalizeToolRef
|
|
6
|
+
} from "../../common/index.mjs";
|
|
7
|
+
import { isPrimitiveIncluded } from "../../common/utils/primitive-filter.mjs";
|
|
8
|
+
import { InvalidEntityError } from "../../errors/index.mjs";
|
|
9
|
+
import {
|
|
10
|
+
esmManifestRecords,
|
|
11
|
+
esmPromptRecord,
|
|
12
|
+
esmResourceRecord,
|
|
13
|
+
esmSkillRecord,
|
|
14
|
+
esmToolRecord
|
|
15
|
+
} from "../../esm-loader/esm-entries.mjs";
|
|
16
|
+
import { normalizeJob } from "../../job/job.utils.mjs";
|
|
17
|
+
import { PromptInstance } from "../../prompt/prompt.instance.mjs";
|
|
18
|
+
import ProviderRegistry from "../../provider/provider.registry.mjs";
|
|
19
|
+
import { ResourceInstance } from "../../resource/resource.instance.mjs";
|
|
20
|
+
import SkillRegistry from "../../skill/skill.registry.mjs";
|
|
21
|
+
import { ToolInstance } from "../../tool/tool.instance.mjs";
|
|
22
|
+
import { normalizeWorkflow } from "../../workflow/workflow.utils.mjs";
|
|
23
|
+
var EsmPackageVersion = class _EsmPackageVersion {
|
|
24
|
+
constructor(providers, entries) {
|
|
25
|
+
this.providers = providers;
|
|
26
|
+
this.entries = entries;
|
|
27
|
+
}
|
|
28
|
+
providers;
|
|
29
|
+
entries;
|
|
30
|
+
/** Build every entry of `manifest`; when one fails, the providers built for it are shut down and the error thrown. */
|
|
31
|
+
static async build(manifest, target) {
|
|
32
|
+
const providers = new ProviderRegistry(manifest.providers ?? [], target.providers);
|
|
33
|
+
try {
|
|
34
|
+
await providers.ready;
|
|
35
|
+
const prefixLength = target.namespace ? target.namespace.length + 1 : 0;
|
|
36
|
+
const included = (kind) => (record) => isPrimitiveIncluded(record.metadata.name.slice(prefixLength), kind, target.filter);
|
|
37
|
+
const recordsOf = (kind, recordOf) => esmManifestRecords(manifest[kind], (raw) => recordOf(raw, target.namespace)).filter(included(kind));
|
|
38
|
+
const toolRecords = recordsOf("tools", esmToolRecord);
|
|
39
|
+
const [tools, resources, prompts] = await Promise.all([
|
|
40
|
+
readyAll(toolRecords.map((record) => new ToolInstance(record, providers, target.owner))),
|
|
41
|
+
readyAll(
|
|
42
|
+
recordsOf("resources", esmResourceRecord).map(
|
|
43
|
+
(record) => new ResourceInstance(record, providers, target.owner)
|
|
44
|
+
)
|
|
45
|
+
),
|
|
46
|
+
readyAll(
|
|
47
|
+
recordsOf("prompts", esmPromptRecord).map((record) => new PromptInstance(record, providers, target.owner))
|
|
48
|
+
)
|
|
49
|
+
]);
|
|
50
|
+
const toolNames = new Map(
|
|
51
|
+
toolRecords.map((record) => [record.metadata.name.slice(prefixLength), record.metadata.name])
|
|
52
|
+
);
|
|
53
|
+
const skillRecords = (manifest.skills ?? []).map((raw) => withPackageToolNames(esmSkillRecord(raw), toolNames)).filter((record) => isPrimitiveIncluded(record.metadata.name, "skills", target.filter));
|
|
54
|
+
const agentList = (manifest.agents ?? []).filter(
|
|
55
|
+
(raw) => isPrimitiveIncluded(normalizeAgent(raw).metadata.name, "agents", target.filter)
|
|
56
|
+
);
|
|
57
|
+
const jobs = (manifest.jobs ?? []).filter(
|
|
58
|
+
(raw) => isPrimitiveIncluded(namedEntryOf("job", normalizeJob(raw)), "jobs", target.filter)
|
|
59
|
+
);
|
|
60
|
+
const workflows = (manifest.workflows ?? []).filter(
|
|
61
|
+
(raw) => isPrimitiveIncluded(namedEntryOf("workflow", normalizeWorkflow(raw)), "workflows", target.filter)
|
|
62
|
+
);
|
|
63
|
+
const agents = agentList.length > 0 ? new AgentRegistry(providers, agentList, target.owner) : void 0;
|
|
64
|
+
const skills = skillRecords.length > 0 ? new SkillRegistry(providers, skillRecords, target.owner) : void 0;
|
|
65
|
+
await Promise.all([agents?.ready, skills?.ready]);
|
|
66
|
+
return new _EsmPackageVersion(providers, { tools, resources, prompts, agents, skills, jobs, workflows });
|
|
67
|
+
} catch (error) {
|
|
68
|
+
await discardProviders(providers, target.logger);
|
|
69
|
+
throw error;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
/** Shut down the providers of a version that will not be served. */
|
|
73
|
+
discard(logger) {
|
|
74
|
+
return discardProviders(this.providers, logger);
|
|
75
|
+
}
|
|
76
|
+
/** The kinds of entry the version has that a scope serves only once it has one. */
|
|
77
|
+
lateEntryKinds() {
|
|
78
|
+
const kinds = [];
|
|
79
|
+
if (this.entries.agents) kinds.push("agents");
|
|
80
|
+
if (this.entries.skills) kinds.push("skills");
|
|
81
|
+
return kinds;
|
|
82
|
+
}
|
|
83
|
+
/** How many entries of each kind the version serves, for the log. */
|
|
84
|
+
describe() {
|
|
85
|
+
const { tools, resources, prompts, agents, skills, jobs, workflows } = this.entries;
|
|
86
|
+
const agentCount = agents?.listAllInstances().length ?? 0;
|
|
87
|
+
const skillCount = skills?.getSkills(true).length ?? 0;
|
|
88
|
+
return `${tools.length} tools, ${resources.length} resources, ${prompts.length} prompts, ${agentCount} agents, ${skillCount} skills, ${jobs.length} jobs, ${workflows.length} workflows`;
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
function namedEntryOf(kind, record) {
|
|
92
|
+
const name = record.metadata.name;
|
|
93
|
+
if (typeof name !== "string" || name.length === 0) {
|
|
94
|
+
throw new InvalidEntityError(kind, String(name), `a class decorated with @${kind === "job" ? "Job" : "Workflow"}`);
|
|
95
|
+
}
|
|
96
|
+
return name;
|
|
97
|
+
}
|
|
98
|
+
function withPackageToolNames(record, servedNames) {
|
|
99
|
+
const tools = record.metadata.tools;
|
|
100
|
+
if (!tools?.length || servedNames.size === 0) return record;
|
|
101
|
+
const renamed = tools.map((ref) => {
|
|
102
|
+
const { name, purpose, required } = normalizeToolRef(ref);
|
|
103
|
+
const servedName = servedNames.get(name);
|
|
104
|
+
return servedName ? { name: servedName, purpose, required } : ref;
|
|
105
|
+
});
|
|
106
|
+
return { ...record, metadata: { ...record.metadata, tools: renamed } };
|
|
107
|
+
}
|
|
108
|
+
async function discardProviders(providers, logger) {
|
|
109
|
+
await providers.runShutdownHooks(logger);
|
|
110
|
+
providers.dispose();
|
|
111
|
+
}
|
|
112
|
+
async function readyAll(instances) {
|
|
113
|
+
await Promise.all(instances.map((instance) => instance.ready));
|
|
114
|
+
return instances;
|
|
115
|
+
}
|
|
116
|
+
export {
|
|
117
|
+
EsmPackageVersion
|
|
118
|
+
};
|
|
@@ -48,7 +48,7 @@ function buildFederatedState(common, data) {
|
|
|
48
48
|
extraUrl: common.extraUrl,
|
|
49
49
|
addedItems: common.addedItems,
|
|
50
50
|
// The federated form marks itself with `federated=true`.
|
|
51
|
-
extras: { [AUTH_WIRE_FIELDS.federated]: true }
|
|
51
|
+
extras: { [AUTH_WIRE_FIELDS.federated]: true, ...data.step ? { step: data.step } : {} }
|
|
52
52
|
};
|
|
53
53
|
}
|
|
54
54
|
function buildIncrementalState(common, data) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// libs/sdk/src/auth/authorization/orchestrated.context-extension.ts
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
NullOrchestratedAuthAccessor,
|
|
4
|
+
ORCHESTRATED_AUTH_ACCESSOR
|
|
5
5
|
} from "@frontmcp/auth";
|
|
6
6
|
var orchestratedAuthContextExtension = {
|
|
7
7
|
property: "orchestration",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// libs/sdk/src/auth/authorized-apps.utils.ts
|
|
2
|
-
import { decodeJwtPayloadSafe } from "@frontmcp/auth";
|
|
2
|
+
import { decodeJwtPayloadSafe, isOrchestratedMode } from "@frontmcp/auth";
|
|
3
3
|
function readAuthorizedApps(source) {
|
|
4
4
|
if (!source || typeof source !== "object") return void 0;
|
|
5
5
|
return source["authorized_apps"];
|
|
@@ -18,6 +18,28 @@ function getAuthorizedAppIds(authInfo) {
|
|
|
18
18
|
if (!list) return void 0;
|
|
19
19
|
return new Set(list);
|
|
20
20
|
}
|
|
21
|
+
function grantAppId(app) {
|
|
22
|
+
return app.id ?? app.metadata.id ?? "";
|
|
23
|
+
}
|
|
24
|
+
function isIncrementalAuthEnabled(authOptions) {
|
|
25
|
+
if (!authOptions || !isOrchestratedMode(authOptions)) return false;
|
|
26
|
+
return authOptions.incrementalAuth !== void 0 && authOptions.incrementalAuth.enabled !== false;
|
|
27
|
+
}
|
|
28
|
+
function initialAuthorizedApps(authOptions, apps, requestedAppIds) {
|
|
29
|
+
if (!isIncrementalAuthEnabled(authOptions)) return void 0;
|
|
30
|
+
const knownAppIds = new Set(apps.map(grantAppId).filter(Boolean));
|
|
31
|
+
return requestedAppIds ? [...new Set(requestedAppIds)].filter((id) => knownAppIds.has(id)) : [...knownAppIds];
|
|
32
|
+
}
|
|
33
|
+
function withoutSkippedApps(grant, apps, skippedProviderIds) {
|
|
34
|
+
if (!skippedProviderIds || skippedProviderIds.length === 0) return [...grant];
|
|
35
|
+
const skippedAppIds = new Set(
|
|
36
|
+
apps.filter((app) => app.metadata.auth && skippedProviderIds.includes(app.metadata.id || app.metadata.name || "")).map(grantAppId)
|
|
37
|
+
);
|
|
38
|
+
return grant.filter((id) => !skippedAppIds.has(id));
|
|
39
|
+
}
|
|
21
40
|
export {
|
|
22
|
-
getAuthorizedAppIds
|
|
41
|
+
getAuthorizedAppIds,
|
|
42
|
+
initialAuthorizedApps,
|
|
43
|
+
isIncrementalAuthEnabled,
|
|
44
|
+
withoutSkippedApps
|
|
23
45
|
};
|