@frontmcp/sdk 1.9.7 → 1.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/agent/agent.registry.d.ts +3 -1
- package/agent/agent.registry.d.ts.map +1 -1
- package/agent/hooks/agent.hooks.d.ts +4 -4
- package/app/app.registry.d.ts.map +1 -1
- package/auth/auth.registry.d.ts +4 -6
- package/auth/auth.registry.d.ts.map +1 -1
- package/auth/direct-public-auth.d.ts +10 -0
- package/auth/direct-public-auth.d.ts.map +1 -0
- package/auth/primary-auth.factory.d.ts +4 -0
- package/auth/primary-auth.factory.d.ts.map +1 -0
- package/browser/adapter/adapter.instance.mjs +166 -0
- package/browser/adapter/adapter.registry.mjs +97 -0
- package/browser/adapter/adapter.utils.mjs +85 -0
- package/browser/agent/adapters/adapter.factory.mjs +168 -0
- package/browser/agent/adapters/anthropic.adapter.mjs +332 -0
- package/browser/agent/adapters/base.adapter.mjs +120 -0
- package/browser/agent/adapters/index.mjs +30 -0
- package/browser/agent/adapters/openai.adapter.mjs +551 -0
- package/browser/agent/adapters/providers/index.mjs +84 -0
- package/browser/agent/adapters/providers/types.mjs +0 -0
- package/browser/agent/agent-builtin-tools.mjs +193 -0
- package/browser/agent/agent-call-chain.mjs +22 -0
- package/browser/agent/agent-execution-loop.mjs +371 -0
- package/browser/agent/agent.events.mjs +133 -0
- package/browser/agent/agent.instance.mjs +869 -0
- package/browser/agent/agent.registry.mjs +398 -0
- package/browser/agent/agent.scope.mjs +352 -0
- package/browser/agent/agent.utils.mjs +161 -0
- package/browser/agent/flows/call-agent.flow.mjs +559 -0
- package/browser/agent/flows/index.mjs +5 -0
- package/browser/agent/hooks/agent.hooks.mjs +10 -0
- package/browser/agent/hooks/index.mjs +2 -0
- package/browser/agent/index.mjs +32 -0
- package/browser/app/app.registry.mjs +88 -0
- package/browser/app/app.utils.mjs +84 -0
- package/browser/app/instances/app.esm.instance.mjs +303 -0
- package/browser/app/instances/app.local.instance.mjs +120 -0
- package/browser/app/instances/app.remote.instance.mjs +397 -0
- package/browser/app/instances/esm-normalize.utils.mjs +100 -0
- package/browser/app/remote-capabilities.utils.mjs +18 -0
- package/browser/auth/auth-ui/auth-ui.contract.mjs +16 -0
- package/browser/auth/auth-ui/auth-ui.registry.mjs +262 -0
- package/browser/auth/auth-ui/auth-ui.render.mjs +127 -0
- package/browser/auth/auth-ui/auth-ui.state.mjs +86 -0
- package/browser/auth/auth-ui/index.mjs +35 -0
- package/browser/auth/auth.registry.mjs +200 -0
- package/browser/auth/auth.utils.mjs +80 -0
- package/browser/auth/authorization/orchestrated.context-extension.mjs +23 -0
- package/browser/auth/authorized-apps.utils.mjs +23 -0
- package/browser/auth/cimd/index.mjs +53 -0
- package/browser/auth/consent-tools.helper.mjs +32 -0
- package/browser/auth/consent.utils.mjs +31 -0
- package/browser/auth/credentials/credentials.context-extension.mjs +18 -0
- package/browser/auth/credentials/credentials.providers.mjs +45 -0
- package/browser/auth/credentials/index.mjs +11 -0
- package/browser/auth/direct-public-auth.mjs +21 -0
- package/browser/auth/flows/form-body.utils.mjs +14 -0
- package/browser/auth/flows/oauth.auth-ui.flow.mjs +135 -0
- package/browser/auth/flows/oauth.authorize.flow.mjs +1053 -0
- package/browser/auth/flows/oauth.callback.flow.mjs +1149 -0
- package/browser/auth/flows/oauth.connect.flow.mjs +296 -0
- package/browser/auth/flows/oauth.provider-callback.flow.mjs +829 -0
- package/browser/auth/flows/oauth.register.flow.mjs +304 -0
- package/browser/auth/flows/oauth.token.flow.mjs +417 -0
- package/browser/auth/flows/oauth.userinfo.flow.mjs +126 -0
- package/browser/auth/flows/session.verify.flow.mjs +529 -0
- package/browser/auth/flows/signin-binding.utils.mjs +72 -0
- package/browser/auth/flows/well-known.jwks.flow.mjs +113 -0
- package/browser/auth/flows/well-known.oauth-authorization-server.flow.mjs +215 -0
- package/browser/auth/flows/well-known.prm.flow.mjs +150 -0
- package/browser/auth/instances/instance.local-primary-auth.mjs +1466 -0
- package/browser/auth/instances/instance.remote-primary-auth.mjs +52 -0
- package/browser/auth/primary-auth.factory.mjs +34 -0
- package/browser/auth/public-access.utils.mjs +32 -0
- package/browser/auth/secure-store/index.mjs +11 -0
- package/browser/auth/secure-store/secure-store.context-extension.mjs +18 -0
- package/browser/auth/secure-store/secure-store.providers.mjs +46 -0
- package/browser/auth/session/session-store.factory.mjs +107 -0
- package/browser/auth/session/utils/session-id.utils.mjs +137 -0
- package/browser/auth/session-scope-identity.mjs +15 -0
- package/browser/builtin/config/config-resolver.mjs +82 -0
- package/browser/builtin/config/config.plugin.mjs +104 -0
- package/browser/builtin/config/config.symbols.mjs +7 -0
- package/browser/builtin/config/index.mjs +62 -0
- package/browser/builtin/config/providers/config-loader.mjs +99 -0
- package/browser/builtin/config/providers/config.service.mjs +154 -0
- package/browser/builtin/config/providers/env-loader.mjs +172 -0
- package/browser/channel/channel-notification.service.mjs +142 -0
- package/browser/channel/channel-scope.helper.mjs +175 -0
- package/browser/channel/channel.events.mjs +14 -0
- package/browser/channel/channel.instance.mjs +254 -0
- package/browser/channel/channel.registry.mjs +149 -0
- package/browser/channel/channel.utils.mjs +42 -0
- package/browser/channel/flows/list-channels.flow.mjs +78 -0
- package/browser/channel/flows/send-channel-notification.flow.mjs +121 -0
- package/browser/channel/index.mjs +20 -0
- package/browser/channel/reply/channel-reply.tool.mjs +80 -0
- package/browser/channel/reply/reply.types.mjs +10 -0
- package/browser/channel/sources/agent-completion.source.mjs +26 -0
- package/browser/channel/sources/app-event.source.mjs +74 -0
- package/browser/channel/sources/completion-events.mjs +45 -0
- package/browser/channel/sources/job-completion.source.mjs +24 -0
- package/browser/channel/sources/webhook.source.mjs +32 -0
- package/browser/common/availability/availability.utils.mjs +87 -0
- package/browser/common/availability/index.mjs +15 -0
- package/browser/common/decorators/adapter.decorator.mjs +17 -0
- package/browser/common/decorators/agent.decorator.mjs +87 -0
- package/browser/common/decorators/app.decorator.mjs +128 -0
- package/browser/common/decorators/auth-provider.decorator.mjs +17 -0
- package/browser/common/decorators/channel.decorator.mjs +49 -0
- package/browser/common/decorators/decorator-utils.mjs +116 -0
- package/browser/common/decorators/flow.decorator.mjs +16 -0
- package/browser/common/decorators/front-mcp.decorator.mjs +103 -0
- package/browser/common/decorators/hook.decorator.mjs +111 -0
- package/browser/common/decorators/index.mjs +18 -0
- package/browser/common/decorators/job.decorator.mjs +82 -0
- package/browser/common/decorators/logger.decorator.mjs +17 -0
- package/browser/common/decorators/plugin.decorator.mjs +41 -0
- package/browser/common/decorators/prompt.decorator.mjs +80 -0
- package/browser/common/decorators/provider.decorator.mjs +17 -0
- package/browser/common/decorators/resource.decorator.mjs +121 -0
- package/browser/common/decorators/skill.decorator.mjs +111 -0
- package/browser/common/decorators/tool.decorator.mjs +82 -0
- package/browser/common/decorators/workflow.decorator.mjs +36 -0
- package/browser/common/dynamic/dynamic.adapter.mjs +91 -0
- package/browser/common/dynamic/dynamic.plugin.mjs +64 -0
- package/browser/common/dynamic/dynamic.utils.mjs +67 -0
- package/browser/common/dynamic/index.mjs +3 -0
- package/browser/common/entries/adapter.entry.mjs +7 -0
- package/browser/common/entries/agent.entry.mjs +54 -0
- package/browser/common/entries/app.entry.mjs +17 -0
- package/browser/common/entries/auth-provider.entry.mjs +7 -0
- package/browser/common/entries/base.entry.mjs +16 -0
- package/browser/common/entries/channel.entry.mjs +43 -0
- package/browser/common/entries/flow.entry.mjs +21 -0
- package/browser/common/entries/hook.entry.mjs +19 -0
- package/browser/common/entries/index.mjs +19 -0
- package/browser/common/entries/job.entry.mjs +59 -0
- package/browser/common/entries/logger.entry.mjs +7 -0
- package/browser/common/entries/plugin.entry.mjs +7 -0
- package/browser/common/entries/prompt.entry.mjs +16 -0
- package/browser/common/entries/provider.entry.mjs +7 -0
- package/browser/common/entries/resource.entry.mjs +36 -0
- package/browser/common/entries/scope.entry.mjs +86 -0
- package/browser/common/entries/skill.entry.mjs +131 -0
- package/browser/common/entries/tool.entry.mjs +125 -0
- package/browser/common/entries/workflow.entry.mjs +29 -0
- package/browser/common/flow/flow.utils.mjs +58 -0
- package/browser/common/index.mjs +16 -0
- package/browser/common/interfaces/adapter.interface.mjs +0 -0
- package/browser/common/interfaces/agent.interface.mjs +577 -0
- package/browser/common/interfaces/app.interface.mjs +0 -0
- package/browser/common/interfaces/auth-hook.interface.mjs +24 -0
- package/browser/common/interfaces/auth-provider.interface.mjs +7 -0
- package/browser/common/interfaces/base.interface.mjs +0 -0
- package/browser/common/interfaces/channel.interface.mjs +90 -0
- package/browser/common/interfaces/execution-context.interface.mjs +388 -0
- package/browser/common/interfaces/flow.interface.mjs +114 -0
- package/browser/common/interfaces/front-mcp.interface.mjs +0 -0
- package/browser/common/interfaces/hook.interface.mjs +0 -0
- package/browser/common/interfaces/index.mjs +24 -0
- package/browser/common/interfaces/internal/flow.utils.mjs +81 -0
- package/browser/common/interfaces/internal/index.mjs +3 -0
- package/browser/common/interfaces/internal/primary-auth-provider.interface.mjs +69 -0
- package/browser/common/interfaces/internal/registry.interface.mjs +0 -0
- package/browser/common/interfaces/job.interface.mjs +81 -0
- package/browser/common/interfaces/llm-adapter.interface.mjs +9 -0
- package/browser/common/interfaces/logger.interface.mjs +9 -0
- package/browser/common/interfaces/plugin.interface.mjs +0 -0
- package/browser/common/interfaces/prompt.interface.mjs +47 -0
- package/browser/common/interfaces/provider.interface.mjs +7 -0
- package/browser/common/interfaces/resource.interface.mjs +91 -0
- package/browser/common/interfaces/scope.interface.mjs +0 -0
- package/browser/common/interfaces/server.interface.mjs +23 -0
- package/browser/common/interfaces/session-hook.interface.mjs +24 -0
- package/browser/common/interfaces/skill.interface.mjs +63 -0
- package/browser/common/interfaces/tool-hook.interface.mjs +39 -0
- package/browser/common/interfaces/tool.interface.mjs +350 -0
- package/browser/common/interfaces/workflow.interface.mjs +31 -0
- package/browser/common/metadata/adapter.metadata.mjs +10 -0
- package/browser/common/metadata/agent.metadata.mjs +110 -0
- package/browser/common/metadata/app-filter.metadata.mjs +29 -0
- package/browser/common/metadata/app.metadata.mjs +120 -0
- package/browser/common/metadata/auth-provider.metadata.mjs +17 -0
- package/browser/common/metadata/channel.metadata.mjs +73 -0
- package/browser/common/metadata/flow.metadata.mjs +15 -0
- package/browser/common/metadata/front-mcp.metadata.mjs +237 -0
- package/browser/common/metadata/hook.metadata.mjs +0 -0
- package/browser/common/metadata/index.mjs +26 -0
- package/browser/common/metadata/job.metadata.mjs +30 -0
- package/browser/common/metadata/logger.metadata.mjs +10 -0
- package/browser/common/metadata/output-policy.mjs +63 -0
- package/browser/common/metadata/plugin.metadata.mjs +37 -0
- package/browser/common/metadata/prompt.metadata.mjs +29 -0
- package/browser/common/metadata/provider.metadata.mjs +12 -0
- package/browser/common/metadata/remote-primitive.metadata.mjs +0 -0
- package/browser/common/metadata/resource.metadata.mjs +39 -0
- package/browser/common/metadata/skill.metadata.mjs +191 -0
- package/browser/common/metadata/tool-ui.metadata.mjs +0 -0
- package/browser/common/metadata/tool.metadata.mjs +108 -0
- package/browser/common/metadata/ui-serving-mode.mjs +21 -0
- package/browser/common/metadata/workflow.metadata.mjs +55 -0
- package/browser/common/providers/base-config.provider.mjs +118 -0
- package/browser/common/records/adapter.record.mjs +11 -0
- package/browser/common/records/agent.record.mjs +13 -0
- package/browser/common/records/app.record.mjs +9 -0
- package/browser/common/records/auth-provider.record.mjs +12 -0
- package/browser/common/records/channel.record.mjs +9 -0
- package/browser/common/records/flow.record.mjs +8 -0
- package/browser/common/records/hook.record.mjs +8 -0
- package/browser/common/records/index.mjs +22 -0
- package/browser/common/records/job.record.mjs +12 -0
- package/browser/common/records/logger.record.mjs +8 -0
- package/browser/common/records/plugin.record.mjs +11 -0
- package/browser/common/records/prompt.record.mjs +11 -0
- package/browser/common/records/provider.record.mjs +7 -0
- package/browser/common/records/resource.record.mjs +17 -0
- package/browser/common/records/scope.record.mjs +9 -0
- package/browser/common/records/skill.record.mjs +12 -0
- package/browser/common/records/tool.record.mjs +11 -0
- package/browser/common/records/workflow.record.mjs +12 -0
- package/browser/common/schemas/annotated-class.schema.mjs +309 -0
- package/browser/common/schemas/http-input.schema.mjs +16 -0
- package/browser/common/schemas/http-output.schema.mjs +315 -0
- package/browser/common/schemas/index.mjs +5 -0
- package/browser/common/schemas/session-header.schema.mjs +25 -0
- package/browser/common/tokens/adapter.tokens.mjs +11 -0
- package/browser/common/tokens/agent.tokens.mjs +35 -0
- package/browser/common/tokens/app.tokens.mjs +48 -0
- package/browser/common/tokens/auth-provider.tokens.mjs +12 -0
- package/browser/common/tokens/base.tokens.mjs +8 -0
- package/browser/common/tokens/channel.tokens.mjs +19 -0
- package/browser/common/tokens/flow-hook.tokens.mjs +10 -0
- package/browser/common/tokens/flow.tokens.mjs +16 -0
- package/browser/common/tokens/front-mcp.tokens.mjs +71 -0
- package/browser/common/tokens/index.mjs +19 -0
- package/browser/common/tokens/job.tokens.mjs +22 -0
- package/browser/common/tokens/logger.tokens.mjs +11 -0
- package/browser/common/tokens/plugin.tokens.mjs +23 -0
- package/browser/common/tokens/prompt.tokens.mjs +18 -0
- package/browser/common/tokens/provider.tokens.mjs +12 -0
- package/browser/common/tokens/resource.tokens.mjs +38 -0
- package/browser/common/tokens/server.tokens.mjs +17 -0
- package/browser/common/tokens/skill.tokens.mjs +37 -0
- package/browser/common/tokens/tool.tokens.mjs +41 -0
- package/browser/common/tokens/workflow.tokens.mjs +25 -0
- package/browser/common/types/auth/index.mjs +3 -0
- package/browser/common/types/auth/jwt.types.mjs +7 -0
- package/browser/common/types/auth/session.types.mjs +24 -0
- package/browser/common/types/common.types.mjs +0 -0
- package/browser/common/types/index.mjs +4 -0
- package/browser/common/types/options/auth/index.mjs +89 -0
- package/browser/common/types/options/elicitation/index.mjs +6 -0
- package/browser/common/types/options/elicitation/schema.mjs +14 -0
- package/browser/common/types/options/ext-apps/index.mjs +2 -0
- package/browser/common/types/options/ext-apps/schema.mjs +66 -0
- package/browser/common/types/options/health/index.mjs +7 -0
- package/browser/common/types/options/health/schema.mjs +24 -0
- package/browser/common/types/options/http/index.mjs +6 -0
- package/browser/common/types/options/http/schema.mjs +118 -0
- package/browser/common/types/options/index.mjs +18 -0
- package/browser/common/types/options/logging/index.mjs +8 -0
- package/browser/common/types/options/logging/interfaces.mjs +22 -0
- package/browser/common/types/options/logging/schema.mjs +20 -0
- package/browser/common/types/options/metrics/index.mjs +11 -0
- package/browser/common/types/options/metrics/schema.mjs +40 -0
- package/browser/common/types/options/observability/index.mjs +5 -0
- package/browser/common/types/options/observability/schema.mjs +13 -0
- package/browser/common/types/options/outbound-fetch/index.mjs +5 -0
- package/browser/common/types/options/outbound-fetch/schema.mjs +12 -0
- package/browser/common/types/options/pagination/index.mjs +7 -0
- package/browser/common/types/options/pagination/schema.mjs +20 -0
- package/browser/common/types/options/redis/index.mjs +25 -0
- package/browser/common/types/options/redis/schema.mjs +174 -0
- package/browser/common/types/options/registry/index.mjs +10 -0
- package/browser/common/types/options/registry/schema.mjs +28 -0
- package/browser/common/types/options/registry/utils.mjs +29 -0
- package/browser/common/types/options/server-info/index.mjs +5 -0
- package/browser/common/types/options/server-info/schema.mjs +13 -0
- package/browser/common/types/options/session/index.mjs +7 -0
- package/browser/common/types/options/session/schema.mjs +25 -0
- package/browser/common/types/options/skills-http/index.mjs +15 -0
- package/browser/common/types/options/skills-http/schema.mjs +130 -0
- package/browser/common/types/options/sqlite/index.mjs +7 -0
- package/browser/common/types/options/sqlite/resolve.mjs +56 -0
- package/browser/common/types/options/sqlite/schema.mjs +40 -0
- package/browser/common/types/options/transport/index.mjs +19 -0
- package/browser/common/types/options/transport/schema.mjs +194 -0
- package/browser/common/utils/auth-info.utils.mjs +29 -0
- package/browser/common/utils/caller-dir.utils.mjs +50 -0
- package/browser/common/utils/decide-request-intent.utils.mjs +362 -0
- package/browser/common/utils/enforced-metadata.utils.mjs +25 -0
- package/browser/common/utils/external-entry.utils.mjs +56 -0
- package/browser/common/utils/global-config.utils.mjs +11 -0
- package/browser/common/utils/guard.utils.mjs +107 -0
- package/browser/common/utils/index.mjs +10 -0
- package/browser/common/utils/list-all-pages.utils.mjs +24 -0
- package/browser/common/utils/path.utils.mjs +116 -0
- package/browser/common/utils/primitive-filter.mjs +39 -0
- package/browser/common/utils/principal.utils.mjs +46 -0
- package/browser/common/utils/tool-lookup.utils.mjs +32 -0
- package/browser/common/utils/validate-remote-url.mjs +10 -0
- package/browser/completion/flows/complete.flow.mjs +316 -0
- package/browser/context/call-surface.mjs +13 -0
- package/browser/context/context-extension.mjs +40 -0
- package/browser/context/frontmcp-context-storage.mjs +169 -0
- package/browser/context/frontmcp-context.mjs +575 -0
- package/browser/context/frontmcp-context.provider.mjs +21 -0
- package/browser/context/index.mjs +31 -0
- package/browser/context/metadata.utils.mjs +132 -0
- package/browser/context/running-flow.mjs +14 -0
- package/browser/context/running-tool.mjs +13 -0
- package/browser/context/trace-context.mjs +77 -0
- package/browser/direct/connect.mjs +97 -0
- package/browser/direct/create.mjs +109 -0
- package/browser/direct/direct-client.mjs +596 -0
- package/browser/direct/direct-server.mjs +235 -0
- package/browser/direct/index.mjs +19 -0
- package/browser/direct/llm-platform.mjs +208 -0
- package/browser/direct/runtime-tools.mjs +103 -0
- package/browser/elicitation/elicitation-fallback.schema.mjs +34 -0
- package/browser/elicitation/elicitation-meta.mjs +5 -0
- package/browser/elicitation/elicitation.types.mjs +7 -0
- package/browser/elicitation/flows/elicitation-request.flow.mjs +188 -0
- package/browser/elicitation/flows/elicitation-result.flow.mjs +189 -0
- package/browser/elicitation/flows/index.mjs +12 -0
- package/browser/elicitation/helpers/elicit.helper.mjs +85 -0
- package/browser/elicitation/helpers/extend-output-schema.mjs +31 -0
- package/browser/elicitation/helpers/fallback.helper.mjs +128 -0
- package/browser/elicitation/helpers/index.mjs +24 -0
- package/browser/elicitation/helpers/mrtr-request.helper.mjs +25 -0
- package/browser/elicitation/helpers/validate-elicitation-content.mjs +34 -0
- package/browser/elicitation/index.mjs +8 -0
- package/browser/elicitation/send-elicitation-result.tool.mjs +151 -0
- package/browser/elicitation/send-elicitation-result.utils.mjs +7 -0
- package/browser/elicitation/store/elicitation-encryption.mjs +101 -0
- package/browser/elicitation/store/elicitation-store.factory.mjs +224 -0
- package/browser/elicitation/store/encrypted-elicitation.store.mjs +392 -0
- package/browser/elicitation/store/index.mjs +39 -0
- package/browser/elicitation/store/storage-elicitation.store.mjs +470 -0
- package/browser/errors/agent.errors.mjs +139 -0
- package/browser/errors/auth-internal.errors.mjs +43 -0
- package/browser/errors/authorization-required.error.mjs +219 -0
- package/browser/errors/decorator.errors.mjs +16 -0
- package/browser/errors/elicitation.error.mjs +122 -0
- package/browser/errors/error-handler.mjs +91 -0
- package/browser/errors/esm.errors.mjs +88 -0
- package/browser/errors/external-entry.errors.mjs +68 -0
- package/browser/errors/index.mjs +414 -0
- package/browser/errors/job.errors.mjs +23 -0
- package/browser/errors/mcp.error.mjs +588 -0
- package/browser/errors/misconfiguration.mjs +53 -0
- package/browser/errors/mrtr.error.mjs +36 -0
- package/browser/errors/normalization.errors.mjs +34 -0
- package/browser/errors/plugin.errors.mjs +27 -0
- package/browser/errors/provider.errors.mjs +82 -0
- package/browser/errors/registry.errors.mjs +79 -0
- package/browser/errors/remote.errors.mjs +240 -0
- package/browser/errors/sdk.errors.mjs +180 -0
- package/browser/errors/session-identity-required.error.mjs +15 -0
- package/browser/errors/task.error.mjs +68 -0
- package/browser/errors/tool-call.error.mjs +15 -0
- package/browser/errors/tool-credentials-required.error.mjs +49 -0
- package/browser/errors/transport.errors.mjs +81 -0
- package/browser/errors/workflow.errors.mjs +28 -0
- package/browser/esm-loader/esm-auth.types.mjs +35 -0
- package/browser/esm-loader/esm-cache.mjs +270 -0
- package/browser/esm-loader/esm-entries.mjs +119 -0
- package/browser/esm-loader/esm-manifest.mjs +166 -0
- package/browser/esm-loader/esm-module-loader.mjs +224 -0
- package/browser/esm-loader/factories/esm-context-factories.mjs +34 -0
- package/browser/esm-loader/factories/esm-instance-factories.mjs +22 -0
- package/browser/esm-loader/factories/esm-record-builders.mjs +83 -0
- package/browser/esm-loader/factories/index.mjs +23 -0
- package/browser/esm-loader/index.mjs +73 -0
- package/browser/esm-loader/module-specifiers.mjs +172 -0
- package/browser/esm-loader/package-specifier.mjs +63 -0
- package/browser/esm-loader/semver.utils.mjs +37 -0
- package/browser/esm-loader/version-poller.mjs +150 -0
- package/browser/esm-loader/version-resolver.mjs +116 -0
- package/browser/ext-apps/ext-apps.handler.mjs +402 -0
- package/browser/ext-apps/ext-apps.types.mjs +24 -0
- package/browser/ext-apps/index.mjs +21 -0
- package/browser/flows/flow.http-path.mjs +43 -0
- package/browser/flows/flow.instance.mjs +478 -0
- package/browser/flows/flow.registry.mjs +147 -0
- package/browser/flows/flow.stages.mjs +88 -0
- package/browser/flows/flow.utils.mjs +30 -0
- package/browser/flows/resolved-entries.mjs +23 -0
- package/browser/front-mcp/authorities-engine.mjs +33 -0
- package/browser/front-mcp/authorities-rules.check.mjs +19 -0
- package/browser/front-mcp/direct-only.flag.mjs +13 -0
- package/browser/front-mcp/front-mcp.mjs +699 -0
- package/browser/front-mcp/front-mcp.providers.mjs +44 -0
- package/browser/front-mcp/front-mcp.tokens.mjs +5 -0
- package/browser/front-mcp/index.mjs +6 -0
- package/browser/front-mcp/serverless-handler.mjs +39 -0
- package/browser/front-mcp/shutdown-signals.mjs +32 -0
- package/browser/front-mcp/static-startup.check.mjs +181 -0
- package/browser/ha/ha-config.mjs +30 -0
- package/browser/ha/ha-headers.mjs +34 -0
- package/browser/ha/ha-manager.mjs +227 -0
- package/browser/ha/ha.constants.mjs +7 -0
- package/browser/ha/ha.types.mjs +13 -0
- package/browser/ha/heartbeat.service.mjs +95 -0
- package/browser/ha/index.mjs +25 -0
- package/browser/ha/notification-relay.mjs +74 -0
- package/browser/ha/relay-messages.mjs +7 -0
- package/browser/ha/session-takeover.mjs +42 -0
- package/browser/health/health.probes.mjs +72 -0
- package/browser/health/health.routes.mjs +38 -0
- package/browser/health/health.service.mjs +198 -0
- package/browser/health/index.mjs +13 -0
- package/browser/hooks/entry-class-hooks.mjs +39 -0
- package/browser/hooks/hook-coverage.mjs +33 -0
- package/browser/hooks/hook.instance.mjs +28 -0
- package/browser/hooks/hook.registry.mjs +178 -0
- package/browser/hooks/hooks.utils.mjs +91 -0
- package/browser/index.cjs +54708 -53711
- package/browser/index.mjs +191 -75307
- package/browser/job/enclave/index.mjs +7 -0
- package/browser/job/enclave/job-dynamic.executor.mjs +18 -0
- package/browser/job/enclave/job-enclave.bridge.mjs +105 -0
- package/browser/job/execution/index.mjs +5 -0
- package/browser/job/execution/job-execution.manager.mjs +308 -0
- package/browser/job/flows/execute-job.flow.mjs +246 -0
- package/browser/job/index.mjs +19 -0
- package/browser/job/job-attempt.mjs +53 -0
- package/browser/job/job-context-providers.mjs +26 -0
- package/browser/job/job-permission.guard.mjs +43 -0
- package/browser/job/job-scope.helper.mjs +107 -0
- package/browser/job/job.events.mjs +14 -0
- package/browser/job/job.instance.mjs +149 -0
- package/browser/job/job.registry.mjs +190 -0
- package/browser/job/job.utils.mjs +56 -0
- package/browser/job/store/index.mjs +17 -0
- package/browser/job/store/job-definition-store.factory.mjs +59 -0
- package/browser/job/store/job-definition.interface.mjs +0 -0
- package/browser/job/store/job-state-store.factory.mjs +28 -0
- package/browser/job/store/job-state.interface.mjs +0 -0
- package/browser/job/store/memory-job-definition.store.mjs +36 -0
- package/browser/job/store/memory-job-state.store.mjs +51 -0
- package/browser/job/store/redis-job-definition.store.mjs +100 -0
- package/browser/job/store/redis-job-state.store.mjs +93 -0
- package/browser/job/tools/execute-job.tool.mjs +57 -0
- package/browser/job/tools/get-job-status.tool.mjs +83 -0
- package/browser/job/tools/index.mjs +13 -0
- package/browser/job/tools/list-jobs.tool.mjs +80 -0
- package/browser/job/tools/register-job.tool.mjs +74 -0
- package/browser/job/tools/remove-job.tool.mjs +62 -0
- package/browser/logger/instances/instance.console-logger.mjs +78 -0
- package/browser/logger/instances/instance.file-logger.mjs +121 -0
- package/browser/logger/instances/instance.logger.mjs +80 -0
- package/browser/logger/logger.registry.mjs +136 -0
- package/browser/logger/logger.types.mjs +8 -0
- package/browser/logger/logger.utils.mjs +34 -0
- package/browser/logging/flows/set-level.flow.mjs +101 -0
- package/browser/mcp-registry/flows/index.mjs +9 -0
- package/browser/mcp-registry/flows/server-card.flow.mjs +136 -0
- package/browser/mcp-registry/flows/well-known.ai-catalog.flow.mjs +96 -0
- package/browser/mcp-registry/flows/well-known.mcp-registry-auth.flow.mjs +73 -0
- package/browser/mcp-registry/mcp-registry-scope.helper.mjs +15 -0
- package/browser/mcp-registry/mcp-registry.utils.mjs +34 -0
- package/browser/metrics/index.mjs +20 -0
- package/browser/metrics/metrics.errors.mjs +26 -0
- package/browser/metrics/metrics.routes.mjs +64 -0
- package/browser/metrics/metrics.service.mjs +121 -0
- package/browser/notification/index.mjs +25 -0
- package/browser/notification/notification.service.mjs +867 -0
- package/browser/plugin/enforced-metadata.check.mjs +90 -0
- package/browser/plugin/plugin.registry.mjs +273 -0
- package/browser/plugin/plugin.utils.mjs +107 -0
- package/browser/prompt/flows/get-prompt.flow.mjs +351 -0
- package/browser/prompt/flows/prompts-list.flow.mjs +269 -0
- package/browser/prompt/prompt.events.mjs +20 -0
- package/browser/prompt/prompt.instance.mjs +131 -0
- package/browser/prompt/prompt.registry.mjs +540 -0
- package/browser/prompt/prompt.types.mjs +10 -0
- package/browser/prompt/prompt.utils.mjs +94 -0
- package/browser/provider/flow-context-providers.mjs +30 -0
- package/browser/provider/provider.registry.mjs +994 -0
- package/browser/provider/provider.utils.mjs +108 -0
- package/browser/regsitry/index.mjs +2 -0
- package/browser/regsitry/registry.base.mjs +31 -0
- package/browser/remote-mcp/cache/capability-cache.mjs +131 -0
- package/browser/remote-mcp/cache/index.mjs +5 -0
- package/browser/remote-mcp/factories/context-factories.mjs +31 -0
- package/browser/remote-mcp/factories/index.mjs +31 -0
- package/browser/remote-mcp/factories/instance-factories.mjs +32 -0
- package/browser/remote-mcp/factories/record-builders.mjs +93 -0
- package/browser/remote-mcp/index.mjs +51 -0
- package/browser/remote-mcp/mcp-client.service.mjs +919 -0
- package/browser/remote-mcp/mcp-stateless-client.adapter.mjs +77 -0
- package/browser/remote-mcp/remote-entries.mjs +121 -0
- package/browser/remote-mcp/remote-request-headers.mjs +21 -0
- package/browser/remote-mcp/resilience/circuit-breaker.mjs +193 -0
- package/browser/remote-mcp/resilience/health-check.mjs +218 -0
- package/browser/remote-mcp/resilience/index.mjs +29 -0
- package/browser/remote-mcp/resilience/retry.mjs +80 -0
- package/browser/resource/flows/read-resource.flow.mjs +382 -0
- package/browser/resource/flows/resource-templates-list.flow.mjs +254 -0
- package/browser/resource/flows/resources-list.flow.mjs +272 -0
- package/browser/resource/flows/subscribe-resource.flow.mjs +132 -0
- package/browser/resource/flows/unsubscribe-resource.flow.mjs +102 -0
- package/browser/resource/resource.events.mjs +14 -0
- package/browser/resource/resource.instance.mjs +220 -0
- package/browser/resource/resource.registry.mjs +665 -0
- package/browser/resource/resource.types.mjs +10 -0
- package/browser/resource/resource.utils.mjs +157 -0
- package/browser/scope/flows/http.ip-filter.flow.mjs +45 -0
- package/browser/scope/flows/http.request.flow.mjs +872 -0
- package/browser/scope/flows/request-log.redaction.mjs +34 -0
- package/browser/scope/http-scope.helper.mjs +14 -0
- package/browser/scope/index.mjs +5 -0
- package/browser/scope/observability-scope.helper.mjs +131 -0
- package/browser/scope/optional-dependency.util.mjs +47 -0
- package/browser/scope/scope.instance.mjs +1478 -0
- package/browser/scope/scope.registry.mjs +121 -0
- package/browser/scope/scope.utils.mjs +61 -0
- package/browser/scope/server-entries.helper.mjs +20 -0
- package/browser/scope/startup-report.helper.mjs +16 -0
- package/browser/scope/tracer-provider.utils.mjs +14 -0
- package/browser/server/adapters/base.host.adapter.mjs +7 -0
- package/browser/server/custom-routes.helper.mjs +115 -0
- package/browser/server/middleware/cors-env.mjs +27 -0
- package/browser/server/middleware/csp.middleware.mjs +123 -0
- package/browser/server/noop-server.mjs +18 -0
- package/browser/server/security/host-validation.mjs +54 -0
- package/browser/server/security/resolve-allowed-hosts.mjs +75 -0
- package/browser/server/security/security-audit.mjs +148 -0
- package/browser/server/server.instance.mjs +173 -0
- package/browser/server/server.validation.mjs +169 -0
- package/browser/skill/auth/index.mjs +7 -0
- package/browser/skill/auth/skill-http-auth.mjs +209 -0
- package/browser/skill/cache/index.mjs +18 -0
- package/browser/skill/cache/skill-http-cache.factory.mjs +71 -0
- package/browser/skill/cache/skill-http-cache.holder.mjs +72 -0
- package/browser/skill/cache/skill-http-cache.mjs +150 -0
- package/browser/skill/errors/skill-validation.error.mjs +50 -0
- package/browser/skill/errors/tool-not-allowed.error.mjs +112 -0
- package/browser/skill/flows/filter-skills.flow.mjs +64 -0
- package/browser/skill/flows/http/index.mjs +9 -0
- package/browser/skill/flows/http/llm-full-txt.flow.mjs +174 -0
- package/browser/skill/flows/http/llm-txt.flow.mjs +173 -0
- package/browser/skill/flows/http/skills-api.flow.mjs +468 -0
- package/browser/skill/flows/index.mjs +13 -0
- package/browser/skill/flows/load-skill.flow.mjs +202 -0
- package/browser/skill/flows/search-skills.flow.mjs +149 -0
- package/browser/skill/guards/tool-authorization.guard.mjs +113 -0
- package/browser/skill/hooks/index.mjs +7 -0
- package/browser/skill/hooks/skill-tool.hook.mjs +100 -0
- package/browser/skill/index.mjs +213 -0
- package/browser/skill/providers/external-skill.provider.mjs +311 -0
- package/browser/skill/providers/memory-skill.provider.mjs +531 -0
- package/browser/skill/semantic/skill-semantic-search.interface.mjs +7 -0
- package/browser/skill/sep-2640/index.mjs +53 -0
- package/browser/skill/sep-2640/resources/index.mjs +13 -0
- package/browser/skill/sep-2640/resources/skill-file.resource.mjs +93 -0
- package/browser/skill/sep-2640/resources/skill-index.resource.mjs +78 -0
- package/browser/skill/sep-2640/resources/skill-md.resource.mjs +71 -0
- package/browser/skill/sep-2640/sep-2640.builders.mjs +97 -0
- package/browser/skill/sep-2640/sep-2640.constants.mjs +23 -0
- package/browser/skill/sep-2640/sep-2640.last-modified.mjs +18 -0
- package/browser/skill/sep-2640/sep-2640.per-skill.mjs +137 -0
- package/browser/skill/sep-2640/sep-2640.resource-helpers.mjs +230 -0
- package/browser/skill/sep-2640/sep-2640.uri.mjs +128 -0
- package/browser/skill/session/index.mjs +4 -0
- package/browser/skill/session/skill-session-store.interface.mjs +122 -0
- package/browser/skill/session/skill-session.manager.mjs +485 -0
- package/browser/skill/session/skill-session.types.mjs +73 -0
- package/browser/skill/skill-audit.helper.mjs +106 -0
- package/browser/skill/skill-authorities.helper.mjs +58 -0
- package/browser/skill/skill-directory-loader.mjs +154 -0
- package/browser/skill/skill-entry.resolver.mjs +35 -0
- package/browser/skill/skill-filter.helper.mjs +68 -0
- package/browser/skill/skill-http.utils.mjs +170 -0
- package/browser/skill/skill-instructions.helper.mjs +148 -0
- package/browser/skill/skill-md-parser.mjs +176 -0
- package/browser/skill/skill-mode.utils.mjs +25 -0
- package/browser/skill/skill-scope.helper.mjs +69 -0
- package/browser/skill/skill-storage.factory.mjs +86 -0
- package/browser/skill/skill-validator.mjs +100 -0
- package/browser/skill/skill.events.mjs +43 -0
- package/browser/skill/skill.instance.mjs +310 -0
- package/browser/skill/skill.registry.mjs +1258 -0
- package/browser/skill/skill.utils.mjs +379 -0
- package/browser/skill/sync/index.mjs +13 -0
- package/browser/skill/sync/memory-sync-state.store.mjs +51 -0
- package/browser/skill/sync/skill-hash.mjs +43 -0
- package/browser/skill/sync/sync-state.interface.mjs +27 -0
- package/browser/task/flows/tasks-cancel.flow.mjs +124 -0
- package/browser/task/flows/tasks-get.flow.mjs +89 -0
- package/browser/task/flows/tasks-list.flow.mjs +86 -0
- package/browser/task/flows/tasks-result.flow.mjs +190 -0
- package/browser/task/helpers/cli-task-runner.mjs +126 -0
- package/browser/task/helpers/in-process-task-runner.mjs +30 -0
- package/browser/task/helpers/process-liveness.mjs +20 -0
- package/browser/task/helpers/task-id.mjs +8 -0
- package/browser/task/helpers/task-notifier.mjs +30 -0
- package/browser/task/helpers/task-runner.mjs +128 -0
- package/browser/task/index.mjs +38 -0
- package/browser/task/runtime/execute-task-flag.mjs +10 -0
- package/browser/task/runtime/execute-task.mjs +142 -0
- package/browser/task/store/index.mjs +15 -0
- package/browser/task/store/storage-task.store.mjs +358 -0
- package/browser/task/store/task-backend.utils.mjs +14 -0
- package/browser/task/store/task-store.factory.mjs +122 -0
- package/browser/task/task-scope.helper.mjs +14 -0
- package/browser/task/task.registry.mjs +76 -0
- package/browser/task/task.types.mjs +33 -0
- package/browser/tool/flows/call-tool.flow.mjs +1134 -0
- package/browser/tool/flows/tool-credentials.gate.mjs +57 -0
- package/browser/tool/flows/tools-list.flow.mjs +503 -0
- package/browser/tool/tool-external.loader.mjs +13 -0
- package/browser/tool/tool.events.mjs +14 -0
- package/browser/tool/tool.instance.mjs +157 -0
- package/browser/tool/tool.registry.mjs +615 -0
- package/browser/tool/tool.types.mjs +10 -0
- package/browser/tool/tool.utils.mjs +365 -0
- package/browser/tool/ui/serving-mode-default.mjs +14 -0
- package/browser/tool/ui/template-detection.mjs +40 -0
- package/browser/tool/ui/template-helpers.mjs +44 -0
- package/browser/tool/ui/ui-option-warnings.mjs +67 -0
- package/browser/tool/ui/ui-render.mjs +60 -0
- package/browser/tool/ui/ui-resource-template.mjs +29 -0
- package/browser/tool/ui/ui-resource.handler.mjs +86 -0
- package/browser/tool/ui/ui-shared.mjs +239 -0
- package/browser/transport/adapters/polyfills/browser-sse-transport.mjs +9 -0
- package/browser/transport/adapters/sse-transport.mjs +70 -0
- package/browser/transport/adapters/streamable-http-transport.mjs +134 -0
- package/browser/transport/adapters/transport.local.adapter.mjs +380 -0
- package/browser/transport/adapters/transport.sse.adapter.mjs +167 -0
- package/browser/transport/adapters/transport.streamable-http.adapter.mjs +228 -0
- package/browser/transport/build-scoped-server-options.mjs +61 -0
- package/browser/transport/bus/index.mjs +5 -0
- package/browser/transport/bus/redis-transport-bus.mjs +164 -0
- package/browser/transport/event-stores/event-store.factory.mjs +79 -0
- package/browser/transport/event-stores/index.mjs +11 -0
- package/browser/transport/event-stores/memory.event-store.mjs +112 -0
- package/browser/transport/event-stores/redis.event-store.mjs +153 -0
- package/browser/transport/event-stores/session-scoped.event-store.mjs +40 -0
- package/browser/transport/flow-error-output.mjs +40 -0
- package/browser/transport/flows/handle.mcp-20260728.flow.mjs +395 -0
- package/browser/transport/flows/handle.sse.flow.mjs +216 -0
- package/browser/transport/flows/handle.stateless-http.flow.mjs +132 -0
- package/browser/transport/flows/handle.streamable-http.flow.mjs +613 -0
- package/browser/transport/in-memory-server.mjs +96 -0
- package/browser/transport/index.mjs +32 -0
- package/browser/transport/ipc-server.transport.mjs +48 -0
- package/browser/transport/mcp-20260728/client/header-params.mjs +75 -0
- package/browser/transport/mcp-20260728/client/index.mjs +3 -0
- package/browser/transport/mcp-20260728/client/mcp-stateless.client.mjs +368 -0
- package/browser/transport/mcp-20260728/discover.mjs +31 -0
- package/browser/transport/mcp-20260728/dispatcher.mjs +257 -0
- package/browser/transport/mcp-20260728/header-codec.mjs +48 -0
- package/browser/transport/mcp-20260728/index.mjs +13 -0
- package/browser/transport/mcp-20260728/mrtr.mjs +129 -0
- package/browser/transport/mcp-20260728/protocol-20260728.constants.mjs +47 -0
- package/browser/transport/mcp-20260728/request-notifications.mjs +86 -0
- package/browser/transport/mcp-20260728/request-state.mjs +111 -0
- package/browser/transport/mcp-20260728/request-validation.mjs +212 -0
- package/browser/transport/mcp-20260728/result-decorator.mjs +64 -0
- package/browser/transport/mcp-20260728/subscriptions.mjs +130 -0
- package/browser/transport/mcp-20260728/tasks-extension.mjs +118 -0
- package/browser/transport/mcp-handlers/Initialized-notification.hanlder.mjs +13 -0
- package/browser/transport/mcp-handlers/call-tool-error.utils.mjs +47 -0
- package/browser/transport/mcp-handlers/call-tool-request.handler.mjs +30 -0
- package/browser/transport/mcp-handlers/complete-request.handler.mjs +31 -0
- package/browser/transport/mcp-handlers/get-prompt-request.handler.mjs +33 -0
- package/browser/transport/mcp-handlers/index.mjs +62 -0
- package/browser/transport/mcp-handlers/initialize-request.handler.mjs +144 -0
- package/browser/transport/mcp-handlers/list-prompts-request.handler.mjs +31 -0
- package/browser/transport/mcp-handlers/list-resource-templates-request.handler.mjs +33 -0
- package/browser/transport/mcp-handlers/list-resources-request.handler.mjs +31 -0
- package/browser/transport/mcp-handlers/list-tools-request.handler.mjs +28 -0
- package/browser/transport/mcp-handlers/logging-set-level-request.handler.mjs +19 -0
- package/browser/transport/mcp-handlers/mcp-error.utils.mjs +42 -0
- package/browser/transport/mcp-handlers/mcp-surface.mjs +16 -0
- package/browser/transport/mcp-handlers/read-resource-request.handler.mjs +36 -0
- package/browser/transport/mcp-handlers/roots-list-changed-notification.handler.mjs +19 -0
- package/browser/transport/mcp-handlers/skills-list-request.handler.mjs +64 -0
- package/browser/transport/mcp-handlers/skills-load-request.handler.mjs +27 -0
- package/browser/transport/mcp-handlers/skills-mcp.types.mjs +113 -0
- package/browser/transport/mcp-handlers/skills-search-request.handler.mjs +27 -0
- package/browser/transport/mcp-handlers/subscribe-request.handler.mjs +19 -0
- package/browser/transport/mcp-handlers/tasks-cancel-request.handler.mjs +24 -0
- package/browser/transport/mcp-handlers/tasks-get-request.handler.mjs +24 -0
- package/browser/transport/mcp-handlers/tasks-list-request.handler.mjs +24 -0
- package/browser/transport/mcp-handlers/tasks-result-request.handler.mjs +24 -0
- package/browser/transport/mcp-handlers/unsubscribe-request.handler.mjs +19 -0
- package/browser/transport/persistent-session-owner.mjs +27 -0
- package/browser/transport/relay/relay-flow.mjs +28 -0
- package/browser/transport/relay/relay-http.mjs +343 -0
- package/browser/transport/relay/relay-scope.helper.mjs +89 -0
- package/browser/transport/relay/session-relay.mjs +276 -0
- package/browser/transport/session-mode.check.mjs +38 -0
- package/browser/transport/transport.error.mjs +25 -0
- package/browser/transport/transport.local.mjs +80 -0
- package/browser/transport/transport.registry.mjs +1038 -0
- package/browser/transport/transport.remote.mjs +57 -0
- package/browser/transport/transport.types.mjs +5 -0
- package/browser/transport/web-fetch-handler.mjs +408 -0
- package/browser/transport/web-http-route.mjs +70 -0
- package/browser/transport/web-response.renderer.mjs +93 -0
- package/browser/transport/web-standard-mcp.mjs +72 -0
- package/browser/utils/content.utils.mjs +61 -0
- package/browser/utils/dynamic-import.utils.mjs +15 -0
- package/browser/utils/index.mjs +24 -0
- package/browser/utils/lineage.utils.mjs +75 -0
- package/browser/utils/naming.utils.mjs +30 -0
- package/browser/workflow/engine/index.mjs +7 -0
- package/browser/workflow/engine/workflow-step.executor.mjs +75 -0
- package/browser/workflow/engine/workflow.engine.mjs +180 -0
- package/browser/workflow/index.mjs +11 -0
- package/browser/workflow/tools/execute-workflow.tool.mjs +58 -0
- package/browser/workflow/tools/get-workflow-status.tool.mjs +80 -0
- package/browser/workflow/tools/index.mjs +13 -0
- package/browser/workflow/tools/list-workflows.tool.mjs +75 -0
- package/browser/workflow/tools/register-workflow.tool.mjs +81 -0
- package/browser/workflow/tools/remove-workflow.tool.mjs +62 -0
- package/browser/workflow/workflow.events.mjs +14 -0
- package/browser/workflow/workflow.instance.mjs +29 -0
- package/browser/workflow/workflow.registry.mjs +171 -0
- package/browser/workflow/workflow.utils.mjs +39 -0
- package/builtin/config/providers/config.service.d.ts.map +1 -1
- package/channel/channel-notification.service.d.ts +0 -5
- package/channel/channel-notification.service.d.ts.map +1 -1
- package/channel/channel.utils.d.ts +6 -1
- package/channel/channel.utils.d.ts.map +1 -1
- package/common/decorators/front-mcp.decorator.d.ts.map +1 -1
- package/common/interfaces/agent.interface.d.ts +1 -1
- package/common/interfaces/agent.interface.d.ts.map +1 -1
- package/common/interfaces/tool.interface.d.ts +2 -1
- package/common/interfaces/tool.interface.d.ts.map +1 -1
- package/common/metadata/agent.metadata.d.ts +2 -2
- package/common/metadata/app.metadata.d.ts +14 -14
- package/common/metadata/app.metadata.d.ts.map +1 -1
- package/common/metadata/channel.metadata.d.ts +2 -2
- package/common/metadata/front-mcp.metadata.d.ts +244 -110
- package/common/metadata/front-mcp.metadata.d.ts.map +1 -1
- package/common/metadata/job.metadata.d.ts +2 -2
- package/common/metadata/plugin.metadata.d.ts +8 -8
- package/common/metadata/tool.metadata.d.ts +1 -1
- package/common/metadata/ui-serving-mode.d.ts +1 -1
- package/common/metadata/workflow.metadata.d.ts +3 -3
- package/common/schemas/annotated-class.schema.d.ts +1 -1
- package/common/schemas/annotated-class.schema.d.ts.map +1 -1
- package/common/tokens/front-mcp.tokens.d.ts.map +1 -1
- package/common/types/options/index.d.ts +1 -0
- package/common/types/options/index.d.ts.map +1 -1
- package/common/types/options/registry/index.d.ts +5 -0
- package/common/types/options/registry/index.d.ts.map +1 -0
- package/common/types/options/registry/interfaces.d.ts +40 -0
- package/common/types/options/registry/interfaces.d.ts.map +1 -0
- package/common/types/options/registry/schema.d.ts +30 -0
- package/common/types/options/registry/schema.d.ts.map +1 -0
- package/common/types/options/registry/typecheck.d.ts +2 -0
- package/common/types/options/registry/typecheck.d.ts.map +1 -0
- package/common/types/options/registry/utils.d.ts +5 -0
- package/common/types/options/registry/utils.d.ts.map +1 -0
- package/common/types/options/skills-http/schema.d.ts +4 -4
- package/common/types/options/transport/schema.d.ts +2 -2
- package/context/frontmcp-context.provider.d.ts +1 -1
- package/elicitation/send-elicitation-result.tool.d.ts +1 -4
- package/elicitation/send-elicitation-result.tool.d.ts.map +1 -1
- package/elicitation/send-elicitation-result.utils.d.ts +5 -0
- package/elicitation/send-elicitation-result.utils.d.ts.map +1 -0
- package/errors/error-handler.d.ts.map +1 -1
- package/esm/index.mjs +51353 -50362
- package/front-mcp/authorities-engine.d.ts +10 -0
- package/front-mcp/authorities-engine.d.ts.map +1 -0
- package/front-mcp/authorities-rules.check.d.ts +1 -3
- package/front-mcp/authorities-rules.check.d.ts.map +1 -1
- package/front-mcp/direct-only.flag.d.ts +6 -0
- package/front-mcp/direct-only.flag.d.ts.map +1 -0
- package/front-mcp/front-mcp.d.ts +1 -1
- package/front-mcp/front-mcp.d.ts.map +1 -1
- package/front-mcp/static-startup.check.d.ts.map +1 -1
- package/health/health.service.d.ts +1 -1
- package/health/health.service.d.ts.map +1 -1
- package/index.d.ts +55 -52
- package/index.d.ts.map +1 -1
- package/index.js +56365 -55368
- package/job/store/job-definition-store.factory.d.ts.map +1 -1
- package/job/store/job-state-store.factory.d.ts.map +1 -1
- package/job/store/redis-job-state.store.d.ts +2 -2
- package/job/store/redis-job-state.store.d.ts.map +1 -1
- package/mcp-registry/flows/index.d.ts +4 -0
- package/mcp-registry/flows/index.d.ts.map +1 -0
- package/mcp-registry/flows/server-card.flow.d.ts +93 -0
- package/mcp-registry/flows/server-card.flow.d.ts.map +1 -0
- package/mcp-registry/flows/well-known.ai-catalog.flow.d.ts +69 -0
- package/mcp-registry/flows/well-known.ai-catalog.flow.d.ts.map +1 -0
- package/mcp-registry/flows/well-known.mcp-registry-auth.flow.d.ts +48 -0
- package/mcp-registry/flows/well-known.mcp-registry-auth.flow.d.ts.map +1 -0
- package/mcp-registry/mcp-registry-scope.helper.d.ts +11 -0
- package/mcp-registry/mcp-registry-scope.helper.d.ts.map +1 -0
- package/mcp-registry/mcp-registry.utils.d.ts +7 -0
- package/mcp-registry/mcp-registry.utils.d.ts.map +1 -0
- package/package.json +10 -10
- package/prompt/prompt.registry.d.ts.map +1 -1
- package/resource/flows/read-resource.flow.d.ts.map +1 -1
- package/resource/resource.registry.d.ts.map +1 -1
- package/scope/http-scope.helper.d.ts +7 -0
- package/scope/http-scope.helper.d.ts.map +1 -0
- package/scope/observability-scope.helper.d.ts +11 -0
- package/scope/observability-scope.helper.d.ts.map +1 -0
- package/scope/scope.instance.d.ts +15 -10
- package/scope/scope.instance.d.ts.map +1 -1
- package/server/adapters/express.host.adapter.d.ts +2 -0
- package/server/adapters/express.host.adapter.d.ts.map +1 -1
- package/server/custom-routes.helper.d.ts +1 -1
- package/server/custom-routes.helper.d.ts.map +1 -1
- package/server/server.instance.d.ts.map +1 -1
- package/skill/flows/http/skills-api.flow.d.ts +1 -1
- package/skill/flows/http/skills-api.flow.d.ts.map +1 -1
- package/skill/skill-scope.helper.d.ts.map +1 -1
- package/skill/skill.registry.d.ts +13 -4
- package/skill/skill.registry.d.ts.map +1 -1
- package/skill/skill.utils.d.ts.map +1 -1
- package/task/store/task-backend.utils.d.ts +11 -0
- package/task/store/task-backend.utils.d.ts.map +1 -0
- package/task/store/task-store.factory.d.ts +1 -6
- package/task/store/task-store.factory.d.ts.map +1 -1
- package/tool/flows/call-tool.flow.d.ts +1 -1
- package/tool/flows/call-tool.flow.d.ts.map +1 -1
- package/tool/flows/tools-list.flow.d.ts +3 -1
- package/tool/flows/tools-list.flow.d.ts.map +1 -1
- package/tool/tool-external.loader.d.ts.map +1 -1
- package/tool/ui/index.d.ts +3 -3
- package/tool/ui/index.d.ts.map +1 -1
- package/tool/ui/template-detection.d.ts +8 -0
- package/tool/ui/template-detection.d.ts.map +1 -0
- package/tool/ui/ui-render.d.ts +21 -0
- package/tool/ui/ui-render.d.ts.map +1 -0
- package/tool/ui/ui-resource.handler.d.ts.map +1 -1
- package/tool/ui/ui-shared.d.ts +9 -3
- package/tool/ui/ui-shared.d.ts.map +1 -1
- package/transport/adapters/transport.sse.adapter.d.ts +1 -1
- package/transport/adapters/transport.sse.adapter.d.ts.map +1 -1
- package/transport/event-stores/event-store.factory.d.ts.map +1 -1
- package/transport/mcp-handlers/index.d.ts +559 -559
- package/transport/mcp-handlers/index.d.ts.map +1 -1
- package/transport/mcp-handlers/logging-set-level-request.handler.d.ts +1 -1
- package/transport/web-fetch-handler.d.ts.map +1 -1
|
@@ -0,0 +1,1134 @@
|
|
|
1
|
+
var __frontmcpModule = typeof process !== "undefined" && typeof process.getBuiltinModule === "function" ? process.getBuiltinModule("module") : undefined;
|
|
2
|
+
const require = __frontmcpModule ? __frontmcpModule.createRequire(import.meta.url || 'file:///') : undefined;
|
|
3
|
+
// __frontmcpCreateRequire
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
7
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
8
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
9
|
+
if (decorator = decorators[i])
|
|
10
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
11
|
+
if (kind && result) __defProp(target, key, result);
|
|
12
|
+
return result;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
// libs/sdk/src/tool/flows/call-tool.flow.ts
|
|
16
|
+
import { AuthorityDeniedError, resolveRequiredScopes, signIncrementalAuthTicket } from "@frontmcp/auth";
|
|
17
|
+
import { ExecutionTimeoutError, withTimeout } from "@frontmcp/guard";
|
|
18
|
+
import { z } from "@frontmcp/lazy-zod";
|
|
19
|
+
import { CallToolRequestSchema, CallToolResultSchema } from "@frontmcp/protocol";
|
|
20
|
+
import {
|
|
21
|
+
awaitOutsideRequest,
|
|
22
|
+
findNonFiniteNumber,
|
|
23
|
+
getRuntimeContext,
|
|
24
|
+
isDebug,
|
|
25
|
+
isDevelopment,
|
|
26
|
+
randomUUID
|
|
27
|
+
} from "@frontmcp/utils";
|
|
28
|
+
import { loadRemoteAppCapabilities } from "../../app/remote-capabilities.utils.mjs";
|
|
29
|
+
import { getAuthorizedAppIds } from "../../auth/authorized-apps.utils.mjs";
|
|
30
|
+
import { getConsentedToolIds, isToolConsented } from "../../auth/consent.utils.mjs";
|
|
31
|
+
import { enforcePublicAccess, publicAccessFor } from "../../auth/public-access.utils.mjs";
|
|
32
|
+
import {
|
|
33
|
+
acquireConcurrencySlots,
|
|
34
|
+
buildPartitionContext,
|
|
35
|
+
Flow,
|
|
36
|
+
FlowBase,
|
|
37
|
+
FlowControl,
|
|
38
|
+
FlowHooksOf,
|
|
39
|
+
GLOBAL_RATE_LIMIT_CHECKED,
|
|
40
|
+
isOrchestratedMode,
|
|
41
|
+
ToolContext,
|
|
42
|
+
ToolEntry
|
|
43
|
+
} from "../../common/index.mjs";
|
|
44
|
+
import { callSurfaceOf, entryUnavailableError, isOfferedOnSurface } from "../../common/availability/index.mjs";
|
|
45
|
+
import { normalizeToolAuthProviders, resolveToolVisibility } from "../../common/metadata/tool.metadata.mjs";
|
|
46
|
+
import { lookupTool, ownerQualifiedName, toolNameCandidates } from "../../common/utils/tool-lookup.utils.mjs";
|
|
47
|
+
import { runOnSurface } from "../../context/call-surface.mjs";
|
|
48
|
+
import { getRunningTool, runAsTool } from "../../context/running-tool.mjs";
|
|
49
|
+
import { canDeliverNotifications, handleWaitingFallback } from "../../elicitation/helpers/index.mjs";
|
|
50
|
+
import { resolveElicitationOwner } from "../../elicitation/helpers/fallback.helper.mjs";
|
|
51
|
+
import {
|
|
52
|
+
AuthorizationRequiredError,
|
|
53
|
+
ElicitationFallbackRequired,
|
|
54
|
+
ElicitationNotSupportedError,
|
|
55
|
+
InputRequiredSignal,
|
|
56
|
+
InternalMcpError,
|
|
57
|
+
InvalidInputError,
|
|
58
|
+
InvalidMethodError,
|
|
59
|
+
InvalidOutputError,
|
|
60
|
+
isClientFacingError,
|
|
61
|
+
MissingClientCapabilityError,
|
|
62
|
+
RateLimitError,
|
|
63
|
+
TaskAugmentationNotSupportedError,
|
|
64
|
+
TaskAugmentationRequiredError,
|
|
65
|
+
TaskConcurrencyLimitError,
|
|
66
|
+
TaskStoreNotInitializedError,
|
|
67
|
+
ToolCredentialsRequiredError,
|
|
68
|
+
ToolExecutionError,
|
|
69
|
+
ToolNotConsentedError,
|
|
70
|
+
ToolNotFoundError
|
|
71
|
+
} from "../../errors/index.mjs";
|
|
72
|
+
import { ResolvedEntries } from "../../flows/resolved-entries.mjs";
|
|
73
|
+
import { hooksBoundTo } from "../../hooks/hooks.utils.mjs";
|
|
74
|
+
import { FlowContextProviders } from "../../provider/flow-context-providers.mjs";
|
|
75
|
+
import { isSkillsOnlyRequest } from "../../skill/skill-mode.utils.mjs";
|
|
76
|
+
import { generateTaskId } from "../../task/helpers/task-id.mjs";
|
|
77
|
+
import { TaskNotifier } from "../../task/helpers/task-notifier.mjs";
|
|
78
|
+
import { TASK_DEFAULTS, toWireShape } from "../../task/task.types.mjs";
|
|
79
|
+
import { hookOwnerIdOf, isServerEntryOwner } from "../../utils/lineage.utils.mjs";
|
|
80
|
+
import { toolServingMode } from "../ui/serving-mode-default.mjs";
|
|
81
|
+
import { hasUIConfig, WIDGET_CALL_META_KEY } from "../ui/ui-shared.mjs";
|
|
82
|
+
import { evaluateToolCredentialGate } from "./tool-credentials.gate.mjs";
|
|
83
|
+
function isWidgetCall(requestMeta) {
|
|
84
|
+
return typeof requestMeta === "object" && requestMeta !== null && Reflect.get(requestMeta, WIDGET_CALL_META_KEY) === true;
|
|
85
|
+
}
|
|
86
|
+
var inputSchema = z.object({
|
|
87
|
+
request: CallToolRequestSchema,
|
|
88
|
+
// z.any() used because ctx is the MCP SDK's ToolCallExtra type which varies by SDK version
|
|
89
|
+
ctx: z.any()
|
|
90
|
+
});
|
|
91
|
+
var outputSchema = CallToolResultSchema;
|
|
92
|
+
var stateSchema = z.object({
|
|
93
|
+
input: z.looseObject({
|
|
94
|
+
name: z.string().min(1).max(64),
|
|
95
|
+
arguments: z.looseObject({}).optional()
|
|
96
|
+
}),
|
|
97
|
+
authInfo: z.any().optional(),
|
|
98
|
+
tool: z.instanceof(ToolEntry),
|
|
99
|
+
toolContext: z.instanceof(ToolContext),
|
|
100
|
+
// Store the raw executed output for plugins to see
|
|
101
|
+
rawOutput: z.any().optional(),
|
|
102
|
+
output: outputSchema,
|
|
103
|
+
// UI result from applyUI stage (if UI config exists)
|
|
104
|
+
uiResult: z.any().optional(),
|
|
105
|
+
// UI metadata from rendering (merged into _meta)
|
|
106
|
+
uiMeta: z.record(z.string(), z.unknown()).optional(),
|
|
107
|
+
// Metadata hooks add to the result (e.g. the cache plugin's `cache: 'hit'`), merged into the
|
|
108
|
+
// result's _meta; never merged into rawOutput, which is the tool's data
|
|
109
|
+
resultMeta: z.record(z.string(), z.unknown()).optional(),
|
|
110
|
+
// Progress token from request's _meta (for progress notifications)
|
|
111
|
+
progressToken: z.union([z.string(), z.number()]).optional(),
|
|
112
|
+
// JSON-RPC request ID (for elicitation routing)
|
|
113
|
+
jsonRpcRequestId: z.union([z.string(), z.number()]).optional(),
|
|
114
|
+
// Semaphore ticket for concurrency control (set by acquireSemaphore, used by releaseSemaphore)
|
|
115
|
+
semaphoreTicket: z.any().optional(),
|
|
116
|
+
// Aborts the tool's this.signal: linked to the request's signal, and fired on an execution timeout
|
|
117
|
+
executionAbort: z.instanceof(AbortController).optional(),
|
|
118
|
+
// A timed-out execute() that is still running; its concurrency slot is released when it settles
|
|
119
|
+
abandonedExecution: z.instanceof(Promise).optional(),
|
|
120
|
+
// Task augmentation request (MCP 2025-11-25 tasks spec). Present when the
|
|
121
|
+
// client sent `params.task`. `ttl` MUST be positive — 0 or negative values
|
|
122
|
+
// create a task that expires the instant it's persisted, which looks to the
|
|
123
|
+
// client like a silent drop. Reject them at the validation boundary so the
|
|
124
|
+
// client gets an InvalidInputError instead.
|
|
125
|
+
taskRequest: z.object({
|
|
126
|
+
ttl: z.number().int().positive().nullish()
|
|
127
|
+
}).passthrough().optional()
|
|
128
|
+
});
|
|
129
|
+
var plan = {
|
|
130
|
+
pre: [
|
|
131
|
+
"parseInput",
|
|
132
|
+
// `?mode=skills_only`: a client's call is answered as for an unknown tool
|
|
133
|
+
"checkSkillsOnlyMode",
|
|
134
|
+
"ensureRemoteCapabilities",
|
|
135
|
+
"findTool",
|
|
136
|
+
"checkPublicAccess",
|
|
137
|
+
// Auth checks run BEFORE task creation so unauthorized callers cannot
|
|
138
|
+
// materialize a task record (which would leak tool existence + hand back a
|
|
139
|
+
// valid taskId). Quota/semaphore are NOT acquired here; the background
|
|
140
|
+
// re-dispatch pays that cost once, not twice.
|
|
141
|
+
"checkToolAuthorization",
|
|
142
|
+
"checkEntryAuthorities",
|
|
143
|
+
"createTaskIfRequested",
|
|
144
|
+
"createToolCallContext",
|
|
145
|
+
// Credential gate runs AFTER the tool context is built (so the
|
|
146
|
+
// CONTEXT-scoped credential accessors — this.authProviders /
|
|
147
|
+
// this.credentials — are resolvable) but BEFORE quota/semaphore and the
|
|
148
|
+
// execute stage, so a missing required credential aborts before execute().
|
|
149
|
+
"checkToolCredentials",
|
|
150
|
+
"acquireQuota",
|
|
151
|
+
"acquireSemaphore"
|
|
152
|
+
],
|
|
153
|
+
execute: ["validateInput", "execute", "validateOutput"],
|
|
154
|
+
finalize: ["releaseSemaphore", "releaseQuota", "applyUI", "finalize"]
|
|
155
|
+
};
|
|
156
|
+
var name = "tools:call-tool";
|
|
157
|
+
var toolClassHooksJoin = { flow: name, plan, contextStage: "createToolCallContext" };
|
|
158
|
+
var { Stage } = FlowHooksOf(name);
|
|
159
|
+
var resolvedTools = new ResolvedEntries();
|
|
160
|
+
var CallToolFlow = class extends FlowBase {
|
|
161
|
+
static async resolveHookOwnerId(rawInput, scope) {
|
|
162
|
+
const toolName = rawInput?.request?.params?.name;
|
|
163
|
+
if (typeof toolName !== "string") return void 0;
|
|
164
|
+
let tool = lookupTool(scope, toolName);
|
|
165
|
+
if (!tool) {
|
|
166
|
+
await loadRemoteAppCapabilities(scope);
|
|
167
|
+
tool = lookupTool(scope, toolName);
|
|
168
|
+
}
|
|
169
|
+
if (!tool) return void 0;
|
|
170
|
+
resolvedTools.remember(rawInput, toolName, tool);
|
|
171
|
+
return hookOwnerIdOf(scope.tools.lineageOf(tool) ?? [], tool.owner);
|
|
172
|
+
}
|
|
173
|
+
/** The class of the tool the call names, whose `static` hooks run from `parseInput` on (#701). */
|
|
174
|
+
static resolveHookEntryClass(rawInput, scope) {
|
|
175
|
+
const toolName = rawInput?.request?.params?.name;
|
|
176
|
+
if (typeof toolName !== "string") return void 0;
|
|
177
|
+
return (resolvedTools.peek(rawInput, toolName) ?? lookupTool(scope, toolName))?.record.provide;
|
|
178
|
+
}
|
|
179
|
+
logger = this.scopeLogger.child("CallToolFlow");
|
|
180
|
+
async parseInput() {
|
|
181
|
+
this.logger.verbose("parseInput:start");
|
|
182
|
+
let method;
|
|
183
|
+
let params;
|
|
184
|
+
let ctx;
|
|
185
|
+
try {
|
|
186
|
+
const inputData = inputSchema.parse(this.rawInput);
|
|
187
|
+
method = inputData.request.method;
|
|
188
|
+
params = inputData.request.params;
|
|
189
|
+
ctx = inputData.ctx;
|
|
190
|
+
} catch (e) {
|
|
191
|
+
throw new InvalidInputError("Invalid Input", e instanceof z.ZodError ? e.issues : void 0);
|
|
192
|
+
}
|
|
193
|
+
if (method !== "tools/call") {
|
|
194
|
+
this.logger.warn(`parseInput: invalid method "${method}"`);
|
|
195
|
+
throw new InvalidMethodError(method, "tools/call");
|
|
196
|
+
}
|
|
197
|
+
const progressToken = params._meta?.progressToken;
|
|
198
|
+
const jsonRpcRequestId = ctx.requestId;
|
|
199
|
+
const taskRequest = params.task && typeof params.task === "object" ? params.task : void 0;
|
|
200
|
+
this.state.set({
|
|
201
|
+
input: params,
|
|
202
|
+
authInfo: ctx.authInfo,
|
|
203
|
+
progressToken,
|
|
204
|
+
jsonRpcRequestId,
|
|
205
|
+
taskRequest
|
|
206
|
+
});
|
|
207
|
+
this.logger.verbose("parseInput:done");
|
|
208
|
+
}
|
|
209
|
+
async checkSkillsOnlyMode() {
|
|
210
|
+
const callerCtx = this.input.ctx;
|
|
211
|
+
if (callerCtx?.internalCall || callerCtx?.agentPrivateCall || getRunningTool()) return;
|
|
212
|
+
if (!isSkillsOnlyRequest(this.state.authInfo, this.tryGetContext())) return;
|
|
213
|
+
const { name: name2 } = this.state.required.input;
|
|
214
|
+
this.logger.verbose(`checkSkillsOnlyMode: refusing tool "${name2}" in skills-only mode`);
|
|
215
|
+
throw new ToolNotFoundError(name2);
|
|
216
|
+
}
|
|
217
|
+
async ensureRemoteCapabilities() {
|
|
218
|
+
this.logger.verbose("ensureRemoteCapabilities:start");
|
|
219
|
+
const remoteAppCount = await loadRemoteAppCapabilities(
|
|
220
|
+
this.scope,
|
|
221
|
+
(appId, error) => this.logger.warn(`Failed to load capabilities for remote app ${appId}: ${error.message}`)
|
|
222
|
+
);
|
|
223
|
+
this.logger.verbose(`ensureRemoteCapabilities:done (${remoteAppCount} remote app(s))`);
|
|
224
|
+
}
|
|
225
|
+
async findTool() {
|
|
226
|
+
this.logger.verbose("findTool:start");
|
|
227
|
+
const { name: name2 } = this.state.required.input;
|
|
228
|
+
const tool = resolvedTools.take(this.rawInput, name2) ?? lookupTool(this.scope, name2);
|
|
229
|
+
const exactNames = [name2, ownerQualifiedName(name2)];
|
|
230
|
+
if (tool && !exactNames.includes(tool.fullName) && !exactNames.includes(tool.name)) {
|
|
231
|
+
const [, alias] = toolNameCandidates(name2);
|
|
232
|
+
this.logger.warn(
|
|
233
|
+
`findTool: tool "${name2}" resolved via legacy name alias to "${alias}". Update callers to use "${alias}" \u2014 the alias will be removed in a future release.`
|
|
234
|
+
);
|
|
235
|
+
}
|
|
236
|
+
const callSurface = callSurfaceOf(this.input.ctx);
|
|
237
|
+
if (!tool) {
|
|
238
|
+
const allUnfiltered = this.scope.tools.listAllInstances();
|
|
239
|
+
const unavailable = allUnfiltered.find((t) => exactNames.includes(t.fullName) || exactNames.includes(t.name));
|
|
240
|
+
if (unavailable && isOfferedOnSurface(unavailable.metadata.availableWhen, callSurface)) {
|
|
241
|
+
const error = entryUnavailableError("Tool", name2, unavailable.metadata.availableWhen, callSurface);
|
|
242
|
+
const ctx = getRuntimeContext();
|
|
243
|
+
this.logger.warn(
|
|
244
|
+
`findTool: tool "${name2}" exists but is unavailable \u2014 constraint=${JSON.stringify(unavailable.metadata.availableWhen)}, missingAxes=${JSON.stringify(error.missingAxes)}, current=[os=${ctx.os}, runtime=${ctx.runtime}, deployment=${ctx.deployment}, provider=${ctx.provider}, target=${ctx.target}, surface=${callSurface ?? "none"}, env=${ctx.env}]`
|
|
245
|
+
);
|
|
246
|
+
throw error;
|
|
247
|
+
}
|
|
248
|
+
this.logger.warn(`findTool: tool "${name2}" not found`);
|
|
249
|
+
throw new ToolNotFoundError(name2);
|
|
250
|
+
}
|
|
251
|
+
if (!isOfferedOnSurface(tool.metadata.availableWhen, callSurface)) {
|
|
252
|
+
this.logger.warn(`findTool: tool "${name2}" is not offered on surface "${callSurface}"`);
|
|
253
|
+
throw new ToolNotFoundError(name2);
|
|
254
|
+
}
|
|
255
|
+
const ctxObj = this.input.ctx;
|
|
256
|
+
const visibility = resolveToolVisibility(tool.metadata);
|
|
257
|
+
if (visibility === "internal" && !ctxObj?.internalCall) {
|
|
258
|
+
this.logger.warn(`findTool: rejecting external tools/call for internal tool "${name2}"`);
|
|
259
|
+
throw new ToolNotFoundError(name2);
|
|
260
|
+
}
|
|
261
|
+
this.logger = this.logger.child(`CallToolFlow(${name2})`);
|
|
262
|
+
this.state.set("tool", tool);
|
|
263
|
+
this.logger.verbose(`findTool: tool "${name2}" found`);
|
|
264
|
+
this.logger.verbose("findTool:done");
|
|
265
|
+
}
|
|
266
|
+
async createTaskIfRequested() {
|
|
267
|
+
this.logger.verbose("createTaskIfRequested:start");
|
|
268
|
+
const { tool } = this.state.required;
|
|
269
|
+
const taskRequest = this.state.taskRequest;
|
|
270
|
+
const taskSupport = tool.metadata.execution?.taskSupport;
|
|
271
|
+
const toolName = tool.fullName || tool.metadata.name;
|
|
272
|
+
const ctx = this.input.ctx;
|
|
273
|
+
if (ctx?.taskId) {
|
|
274
|
+
this.logger.verbose("createTaskIfRequested:skip (internal task re-dispatch)");
|
|
275
|
+
return;
|
|
276
|
+
}
|
|
277
|
+
if (taskRequest && (!taskSupport || taskSupport === "forbidden")) {
|
|
278
|
+
throw new TaskAugmentationNotSupportedError(toolName);
|
|
279
|
+
}
|
|
280
|
+
if (!taskRequest && taskSupport === "required") {
|
|
281
|
+
throw new TaskAugmentationRequiredError(toolName);
|
|
282
|
+
}
|
|
283
|
+
if (!taskRequest) {
|
|
284
|
+
this.logger.verbose("createTaskIfRequested:skip (non-task call)");
|
|
285
|
+
return;
|
|
286
|
+
}
|
|
287
|
+
const store = this.scope.taskStore;
|
|
288
|
+
const registry = this.scope.tasks;
|
|
289
|
+
if (!store || !registry) {
|
|
290
|
+
throw new TaskStoreNotInitializedError();
|
|
291
|
+
}
|
|
292
|
+
const authInfo = this.state.authInfo;
|
|
293
|
+
const sessionId = authInfo?.sessionId;
|
|
294
|
+
if (!sessionId) {
|
|
295
|
+
throw new InternalMcpError("Task-augmented tools/call requires an identified session", "TASK_SESSION_REQUIRED");
|
|
296
|
+
}
|
|
297
|
+
const config = registry.getConfig();
|
|
298
|
+
const rawTtlValue = taskRequest["ttl"];
|
|
299
|
+
const rawTtl = rawTtlValue === null ? null : typeof rawTtlValue === "number" ? rawTtlValue : void 0;
|
|
300
|
+
const maxTtl = config.maxTtlMs ?? TASK_DEFAULTS.maxTtlMs;
|
|
301
|
+
const defaultTtl = config.defaultTtlMs ?? TASK_DEFAULTS.defaultTtlMs;
|
|
302
|
+
const ttlMs = rawTtl === null ? maxTtl : rawTtl === void 0 ? defaultTtl : Math.min(rawTtl, maxTtl);
|
|
303
|
+
const pollIntervalMs = config.defaultPollIntervalMs ?? TASK_DEFAULTS.defaultPollIntervalMs;
|
|
304
|
+
const now = Date.now();
|
|
305
|
+
const nowIso = new Date(now).toISOString();
|
|
306
|
+
const taskId = generateTaskId();
|
|
307
|
+
const expiresAt = now + ttlMs;
|
|
308
|
+
const cleanedParams = { ...this.state.required.input };
|
|
309
|
+
delete cleanedParams["task"];
|
|
310
|
+
const record = {
|
|
311
|
+
taskId,
|
|
312
|
+
sessionId,
|
|
313
|
+
status: "working",
|
|
314
|
+
statusMessage: "The operation is now in progress.",
|
|
315
|
+
createdAt: nowIso,
|
|
316
|
+
lastUpdatedAt: nowIso,
|
|
317
|
+
ttlMs,
|
|
318
|
+
pollIntervalMs,
|
|
319
|
+
expiresAt,
|
|
320
|
+
request: { method: "tools/call", params: cleanedParams },
|
|
321
|
+
scopeId: this.scope.id
|
|
322
|
+
};
|
|
323
|
+
const callSurface = callSurfaceOf(this.input.ctx);
|
|
324
|
+
if (callSurface !== void 0) record.surface = callSurface;
|
|
325
|
+
if (this.state.progressToken !== void 0) {
|
|
326
|
+
record.progressToken = this.state.progressToken;
|
|
327
|
+
}
|
|
328
|
+
const maxActive = config.maxConcurrentPerSession ?? TASK_DEFAULTS.maxConcurrentPerSession;
|
|
329
|
+
if (!await store.createWithinLimit(record, maxActive)) {
|
|
330
|
+
throw new TaskConcurrencyLimitError(maxActive);
|
|
331
|
+
}
|
|
332
|
+
const notifier = new TaskNotifier(this.scope.notifications, this.logger);
|
|
333
|
+
notifier.sendStatus(record);
|
|
334
|
+
const runner = registry.runner;
|
|
335
|
+
if (!runner) {
|
|
336
|
+
throw new InternalMcpError(
|
|
337
|
+
"Task runner is not configured \u2014 scope initialization did not set one",
|
|
338
|
+
"TASK_RUNNER_MISSING"
|
|
339
|
+
);
|
|
340
|
+
}
|
|
341
|
+
try {
|
|
342
|
+
await runner.run(record, { cleanedRequestParams: cleanedParams, ctx: this.input.ctx });
|
|
343
|
+
} catch (err) {
|
|
344
|
+
this.logger.error("createTaskIfRequested: runner.run threw", {
|
|
345
|
+
taskId,
|
|
346
|
+
error: err instanceof Error ? err.message : String(err)
|
|
347
|
+
});
|
|
348
|
+
try {
|
|
349
|
+
await store.update(taskId, sessionId, {
|
|
350
|
+
status: "failed",
|
|
351
|
+
statusMessage: "Task runner failed to schedule execution"
|
|
352
|
+
});
|
|
353
|
+
} catch (bookkeepingErr) {
|
|
354
|
+
this.logger.warn("createTaskIfRequested: failed to mark task failed after runner error", {
|
|
355
|
+
taskId,
|
|
356
|
+
sessionId,
|
|
357
|
+
error: bookkeepingErr instanceof Error ? bookkeepingErr.message : String(bookkeepingErr)
|
|
358
|
+
});
|
|
359
|
+
}
|
|
360
|
+
throw err;
|
|
361
|
+
}
|
|
362
|
+
const createTaskResult = {
|
|
363
|
+
task: toWireShape(record),
|
|
364
|
+
_meta: {
|
|
365
|
+
"io.modelcontextprotocol/related-task": { taskId }
|
|
366
|
+
}
|
|
367
|
+
};
|
|
368
|
+
this.logger.info("createTaskIfRequested: task created, responding with CreateTaskResult", {
|
|
369
|
+
taskId,
|
|
370
|
+
tool: toolName
|
|
371
|
+
});
|
|
372
|
+
this.respond(createTaskResult);
|
|
373
|
+
}
|
|
374
|
+
async checkPublicAccess() {
|
|
375
|
+
const { tool, authInfo } = this.state;
|
|
376
|
+
const callerCtx = this.input.ctx;
|
|
377
|
+
const publicAccess = publicAccessFor(this.scope.auth?.options, authInfo);
|
|
378
|
+
if (!tool || !publicAccess || callerCtx?.internalCall || callerCtx?.agentPrivateCall) return;
|
|
379
|
+
if (callerCtx?.taskId) return;
|
|
380
|
+
await enforcePublicAccess(
|
|
381
|
+
publicAccess,
|
|
382
|
+
{ kind: "tool", names: [tool.fullName || tool.name, tool.name] },
|
|
383
|
+
this.scope.publicAccessGuard,
|
|
384
|
+
buildPartitionContext(this.tryGetContext())
|
|
385
|
+
);
|
|
386
|
+
}
|
|
387
|
+
async checkToolAuthorization() {
|
|
388
|
+
this.logger.verbose("checkToolAuthorization:start");
|
|
389
|
+
const { tool, authInfo } = this.state;
|
|
390
|
+
const consentCtx = this.input.ctx;
|
|
391
|
+
if (!consentCtx?.internalCall && !consentCtx?.agentPrivateCall) {
|
|
392
|
+
const consentedToolIds = getConsentedToolIds(authInfo);
|
|
393
|
+
if (consentedToolIds && tool) {
|
|
394
|
+
const bareNameCount = this.scope.tools.getTools(true).filter((t) => t.name === tool.name).length;
|
|
395
|
+
const consented = bareNameCount > 1 ? isToolConsented(consentedToolIds, tool.fullName) : isToolConsented(consentedToolIds, tool.name, tool.fullName);
|
|
396
|
+
if (!consented) {
|
|
397
|
+
this.logger.info(
|
|
398
|
+
`checkToolAuthorization: tool "${tool.fullName || tool.name}" not in consented set \u2014 rejecting`
|
|
399
|
+
);
|
|
400
|
+
throw new ToolNotConsentedError(tool.fullName || tool.name);
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
const claimAuthorizedApps = getAuthorizedAppIds(authInfo);
|
|
405
|
+
const legacyAuthorization = authInfo?.extra?.["authorization"];
|
|
406
|
+
if (!claimAuthorizedApps && !legacyAuthorization) {
|
|
407
|
+
const incrementalEnabled = !consentCtx?.internalCall && !!authInfo?.token && this.scope.auth?.options?.incrementalAuth?.enabled === true;
|
|
408
|
+
if (!incrementalEnabled) {
|
|
409
|
+
this.logger.verbose("checkToolAuthorization:skip (no auth context)");
|
|
410
|
+
return;
|
|
411
|
+
}
|
|
412
|
+
this.logger.warn(
|
|
413
|
+
"checkToolAuthorization: incrementalAuth enabled but the verified token carries no authorized_apps claim \u2014 failing closed"
|
|
414
|
+
);
|
|
415
|
+
}
|
|
416
|
+
const appId = isServerEntryOwner(tool?.owner) ? void 0 : tool?.owner?.id;
|
|
417
|
+
if (!appId) {
|
|
418
|
+
this.logger.verbose("checkToolAuthorization:skip (no app owner)");
|
|
419
|
+
return;
|
|
420
|
+
}
|
|
421
|
+
const isAppAuthorized = (claimAuthorizedApps?.has(appId) ?? false) || (legacyAuthorization?.authorizedAppIds?.includes(appId) ?? false) || appId in (legacyAuthorization?.authorizedApps || {});
|
|
422
|
+
if (!isAppAuthorized) {
|
|
423
|
+
const apps = this.scope.apps.getApps();
|
|
424
|
+
const app = apps.find((a) => a.metadata.id === appId);
|
|
425
|
+
const authOptions = this.scope.auth?.options;
|
|
426
|
+
let skippedBehavior = "anonymous";
|
|
427
|
+
if (authOptions && isOrchestratedMode(authOptions)) {
|
|
428
|
+
const incrementalConfig = authOptions.incrementalAuth;
|
|
429
|
+
if (incrementalConfig) {
|
|
430
|
+
if (incrementalConfig.enabled === false) {
|
|
431
|
+
skippedBehavior = "require-auth";
|
|
432
|
+
} else {
|
|
433
|
+
skippedBehavior = incrementalConfig.skippedAppBehavior || "anonymous";
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
if (skippedBehavior === "anonymous" && app?.metadata?.auth?.mode === "public") {
|
|
438
|
+
this.logger.verbose(`checkToolAuthorization: using anonymous for ${appId}`);
|
|
439
|
+
return;
|
|
440
|
+
}
|
|
441
|
+
const authUrl = this.buildProgressiveAuthUrl(appId, tool?.fullName || "", authInfo, claimAuthorizedApps);
|
|
442
|
+
const requiredScopes = normalizeToolAuthProviders(tool?.metadata?.authProviders).flatMap(
|
|
443
|
+
(provider) => provider.scopes ?? []
|
|
444
|
+
);
|
|
445
|
+
this.logger.info(`checkToolAuthorization: authorization required for app "${appId}"`);
|
|
446
|
+
throw new AuthorizationRequiredError({
|
|
447
|
+
appId,
|
|
448
|
+
toolId: tool?.fullName || tool?.name || "unknown",
|
|
449
|
+
authUrl,
|
|
450
|
+
requiredScopes: requiredScopes.length > 0 ? [...new Set(requiredScopes)] : void 0,
|
|
451
|
+
message: `Authorization required for ${appId}. Please authorize to use ${tool?.fullName || tool?.name}.`
|
|
452
|
+
});
|
|
453
|
+
}
|
|
454
|
+
this.logger.verbose("checkToolAuthorization:done");
|
|
455
|
+
}
|
|
456
|
+
/**
|
|
457
|
+
* Build the URL for progressive/incremental authorization.
|
|
458
|
+
*
|
|
459
|
+
* This is the ONE point in the request lifecycle where the caller's identity
|
|
460
|
+
* is both known and verified, so it is where the incremental-authorization
|
|
461
|
+
* ticket is minted (GHSA-2c4g-9c8x-6m8g). The ticket is what later authorizes
|
|
462
|
+
* `/oauth/authorize` to skip the login step; `app`/`tool` are carried purely
|
|
463
|
+
* for display and are re-read from the signed payload server-side.
|
|
464
|
+
*
|
|
465
|
+
* When no verified subject or signing secret is available the URL is emitted
|
|
466
|
+
* WITHOUT a ticket — the user then completes an ordinary login, which is the
|
|
467
|
+
* correct fail-closed outcome rather than a credential-free shortcut.
|
|
468
|
+
*/
|
|
469
|
+
buildProgressiveAuthUrl(appId, toolId, authInfo, priorAppIds) {
|
|
470
|
+
const baseUrl = this.scope.fullPath || "";
|
|
471
|
+
const url = new URL(`${baseUrl}/oauth/authorize`, "http://placeholder.invalid");
|
|
472
|
+
url.searchParams.set("app", appId);
|
|
473
|
+
url.searchParams.set("tool", toolId);
|
|
474
|
+
const ticket = this.mintIncrementalTicket(appId, toolId, authInfo, priorAppIds);
|
|
475
|
+
if (ticket) {
|
|
476
|
+
url.searchParams.set("ticket", ticket);
|
|
477
|
+
} else {
|
|
478
|
+
this.logger.verbose("buildProgressiveAuthUrl: no incremental ticket minted \u2014 link requires a full login");
|
|
479
|
+
}
|
|
480
|
+
return baseUrl.startsWith("http") ? url.toString() : `${url.pathname}${url.search}`;
|
|
481
|
+
}
|
|
482
|
+
/**
|
|
483
|
+
* Mint a single-use, short-lived incremental-authorization ticket for the
|
|
484
|
+
* verified caller. Returns undefined when the scope has no local signing
|
|
485
|
+
* secret or the request has no verified subject.
|
|
486
|
+
*/
|
|
487
|
+
mintIncrementalTicket(appId, toolId, authInfo, priorAppIds) {
|
|
488
|
+
const extraUser = authInfo?.extra?.user;
|
|
489
|
+
const sub = extraUser?.sub ?? authInfo?.user?.sub;
|
|
490
|
+
if (!sub) return void 0;
|
|
491
|
+
const secret = this.scope.auth?.signingSecret;
|
|
492
|
+
if (!secret) return void 0;
|
|
493
|
+
return signIncrementalAuthTicket(
|
|
494
|
+
{
|
|
495
|
+
sub,
|
|
496
|
+
appId,
|
|
497
|
+
toolId,
|
|
498
|
+
...priorAppIds && priorAppIds.size > 0 ? { priorAppIds: [...priorAppIds] } : {}
|
|
499
|
+
},
|
|
500
|
+
secret
|
|
501
|
+
);
|
|
502
|
+
}
|
|
503
|
+
async checkEntryAuthorities() {
|
|
504
|
+
this.logger.verbose("checkEntryAuthorities:start");
|
|
505
|
+
const engine = this.scope.authoritiesEngine;
|
|
506
|
+
const ctxBuilder = this.scope.authoritiesContextBuilder;
|
|
507
|
+
if (!engine || !ctxBuilder) {
|
|
508
|
+
this.logger.verbose("checkEntryAuthorities:skip (no engine configured)");
|
|
509
|
+
return;
|
|
510
|
+
}
|
|
511
|
+
const tool = this.state.tool;
|
|
512
|
+
if (!tool) return;
|
|
513
|
+
const metadata = tool.metadata;
|
|
514
|
+
const authorities = metadata["authorities"];
|
|
515
|
+
if (!authorities) {
|
|
516
|
+
this.logger.verbose("checkEntryAuthorities:skip (no authorities on tool)");
|
|
517
|
+
return;
|
|
518
|
+
}
|
|
519
|
+
const authInfo = this.state.authInfo ?? {};
|
|
520
|
+
const stateInput = this.state.input;
|
|
521
|
+
const input = stateInput?.["arguments"] ?? stateInput ?? {};
|
|
522
|
+
const evalCtx = ctxBuilder.build(authInfo, input);
|
|
523
|
+
const result = await engine.evaluate(authorities, evalCtx);
|
|
524
|
+
if (!result.granted) {
|
|
525
|
+
let requiredScopes;
|
|
526
|
+
const scopeMapping = this.scope.authoritiesScopeMapping;
|
|
527
|
+
if (scopeMapping && result.denial) {
|
|
528
|
+
requiredScopes = resolveRequiredScopes(
|
|
529
|
+
result.denial,
|
|
530
|
+
scopeMapping,
|
|
531
|
+
authorities
|
|
532
|
+
);
|
|
533
|
+
}
|
|
534
|
+
throw new AuthorityDeniedError({
|
|
535
|
+
entryType: "Tool",
|
|
536
|
+
entryName: tool.fullName || tool.name,
|
|
537
|
+
deniedBy: result.deniedBy ?? "policy denied",
|
|
538
|
+
denial: result.denial,
|
|
539
|
+
requiredScopes
|
|
540
|
+
});
|
|
541
|
+
}
|
|
542
|
+
this.logger.verbose("checkEntryAuthorities:done");
|
|
543
|
+
}
|
|
544
|
+
async createToolCallContext() {
|
|
545
|
+
this.logger.verbose("createToolCallContext:start");
|
|
546
|
+
const { ctx } = this.input;
|
|
547
|
+
const { tool, input } = this.state.required;
|
|
548
|
+
const authInfo = this.state.authInfo;
|
|
549
|
+
const progressToken = this.state.progressToken;
|
|
550
|
+
try {
|
|
551
|
+
const sessionKey = authInfo?.sessionId ?? "anonymous";
|
|
552
|
+
const toolViews = await tool.providers.buildViews(sessionKey, new Map(this.deps), this.scope.providers);
|
|
553
|
+
const contextProviders = new FlowContextProviders(tool.providers, toolViews.context);
|
|
554
|
+
const executionAbort = linkedAbortController(ctx.signal);
|
|
555
|
+
this.state.set("executionAbort", executionAbort);
|
|
556
|
+
const context = runAsTool(
|
|
557
|
+
{ name: tool.name, fullName: tool.fullName },
|
|
558
|
+
() => tool.create(input.arguments, {
|
|
559
|
+
...ctx,
|
|
560
|
+
progressToken,
|
|
561
|
+
contextProviders,
|
|
562
|
+
signal: executionAbort.signal
|
|
563
|
+
})
|
|
564
|
+
);
|
|
565
|
+
await context.loadAuthContext();
|
|
566
|
+
this.appendContextHooks(hooksBoundTo(this.scope.hooks.getClsHooks(tool.record.provide), context));
|
|
567
|
+
context.mark("createToolCallContext");
|
|
568
|
+
context._toolNameInternal = tool.metadata.id ?? tool.metadata.name;
|
|
569
|
+
context._toolInputInternal = input.arguments;
|
|
570
|
+
context._jsonRpcRequestIdInternal = this.state.jsonRpcRequestId;
|
|
571
|
+
const frontmcpContext = context.tryGetContext();
|
|
572
|
+
const authInfoWithTransport = authInfo;
|
|
573
|
+
if (frontmcpContext && authInfoWithTransport?.transport?.sendElicitRequest) {
|
|
574
|
+
const transport = authInfoWithTransport.transport;
|
|
575
|
+
const jsonRpcRequestId = this.state.jsonRpcRequestId;
|
|
576
|
+
frontmcpContext.setTransport({
|
|
577
|
+
sendElicitRequest: transport.sendElicitRequest.bind(transport),
|
|
578
|
+
type: transport.type,
|
|
579
|
+
jsonRpcRequestId
|
|
580
|
+
});
|
|
581
|
+
}
|
|
582
|
+
this.state.set("toolContext", context);
|
|
583
|
+
this.logger.verbose("createToolCallContext:done");
|
|
584
|
+
} catch (error) {
|
|
585
|
+
if (error instanceof FlowControl || isClientFacingError(error)) throw error;
|
|
586
|
+
this.logger.error("createToolCallContext: failed to create context", error);
|
|
587
|
+
throw new ToolExecutionError(tool.metadata.name, error instanceof Error ? error : void 0);
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
async checkToolCredentials() {
|
|
591
|
+
this.logger.verbose("checkToolCredentials:start");
|
|
592
|
+
const { tool } = this.state.required;
|
|
593
|
+
const ctxObj = this.input.ctx;
|
|
594
|
+
if (ctxObj?.internalCall || ctxObj?.taskId) {
|
|
595
|
+
this.logger.verbose("checkToolCredentials:skip (internal call)");
|
|
596
|
+
return;
|
|
597
|
+
}
|
|
598
|
+
const providers = normalizeToolAuthProviders(
|
|
599
|
+
tool.metadata["authProviders"]
|
|
600
|
+
);
|
|
601
|
+
if (providers.length === 0) {
|
|
602
|
+
this.logger.verbose("checkToolCredentials:skip (no authProviders)");
|
|
603
|
+
return;
|
|
604
|
+
}
|
|
605
|
+
const toolContext = this.state.toolContext;
|
|
606
|
+
if (!toolContext) {
|
|
607
|
+
this.logger.verbose("checkToolCredentials:skip (no tool context)");
|
|
608
|
+
return;
|
|
609
|
+
}
|
|
610
|
+
toolContext.mark("checkToolCredentials");
|
|
611
|
+
const result = await evaluateToolCredentialGate(providers, (token) => toolContext.tryGet(token));
|
|
612
|
+
if (!result.evaluated) {
|
|
613
|
+
this.logger.verbose("checkToolCredentials:skip (no credential accessor configured)");
|
|
614
|
+
return;
|
|
615
|
+
}
|
|
616
|
+
if (result.missing.length === 0) {
|
|
617
|
+
this.logger.verbose("checkToolCredentials:done (all required credentials present)");
|
|
618
|
+
return;
|
|
619
|
+
}
|
|
620
|
+
const toolId = tool.fullName || tool.metadata.name;
|
|
621
|
+
const missingNames = result.missing.map((m) => m.name);
|
|
622
|
+
const authUrl = result.missing.find((m) => m.authUrl)?.authUrl;
|
|
623
|
+
this.logger.info(
|
|
624
|
+
`checkToolCredentials: tool "${toolId}" missing required credential(s): ${missingNames.join(", ")}`
|
|
625
|
+
);
|
|
626
|
+
throw new ToolCredentialsRequiredError({ toolId, providers: missingNames, authUrl });
|
|
627
|
+
}
|
|
628
|
+
async acquireQuota() {
|
|
629
|
+
this.logger.verbose("acquireQuota:start");
|
|
630
|
+
const manager = this.scope.rateLimitManager;
|
|
631
|
+
if (!manager) {
|
|
632
|
+
this.state.toolContext?.mark("acquireQuota");
|
|
633
|
+
this.logger.verbose("acquireQuota:done (no rate limit manager)");
|
|
634
|
+
return;
|
|
635
|
+
}
|
|
636
|
+
const { tool } = this.state.required;
|
|
637
|
+
const context = this.tryGetContext();
|
|
638
|
+
const partitionCtx = buildPartitionContext(context);
|
|
639
|
+
if (!context?.has(GLOBAL_RATE_LIMIT_CHECKED)) {
|
|
640
|
+
const globalResult = await manager.checkGlobalRateLimit(partitionCtx);
|
|
641
|
+
if (!globalResult.allowed) {
|
|
642
|
+
this.logger.warn("acquireQuota: global rate limit exceeded", {
|
|
643
|
+
retryAfterMs: globalResult.retryAfterMs
|
|
644
|
+
});
|
|
645
|
+
throw new RateLimitError(Math.ceil((globalResult.retryAfterMs ?? 6e4) / 1e3));
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
const result = await manager.checkRateLimit(tool.metadata.name, tool.metadata.rateLimit, partitionCtx);
|
|
649
|
+
if (!result.allowed) {
|
|
650
|
+
this.logger.warn("acquireQuota: tool rate limit exceeded", {
|
|
651
|
+
tool: tool.metadata.name,
|
|
652
|
+
retryAfterMs: result.retryAfterMs
|
|
653
|
+
});
|
|
654
|
+
throw new RateLimitError(Math.ceil((result.retryAfterMs ?? 6e4) / 1e3));
|
|
655
|
+
}
|
|
656
|
+
this.state.toolContext?.mark("acquireQuota");
|
|
657
|
+
this.logger.verbose("acquireQuota:done");
|
|
658
|
+
}
|
|
659
|
+
async acquireSemaphore() {
|
|
660
|
+
this.logger.verbose("acquireSemaphore:start");
|
|
661
|
+
const manager = this.scope.rateLimitManager;
|
|
662
|
+
if (!manager) {
|
|
663
|
+
this.state.toolContext?.mark("acquireSemaphore");
|
|
664
|
+
this.logger.verbose("acquireSemaphore:done (no rate limit manager)");
|
|
665
|
+
return;
|
|
666
|
+
}
|
|
667
|
+
const { tool } = this.state.required;
|
|
668
|
+
const partitionCtx = buildPartitionContext(this.tryGetContext());
|
|
669
|
+
const isNestedCall = this.input.ctx?.internalCall === true || callSurfaceOf(this.input.ctx) === "agent";
|
|
670
|
+
const ticket = await acquireConcurrencySlots(manager, tool.metadata.name, tool.metadata.concurrency, partitionCtx, {
|
|
671
|
+
skipGlobal: isNestedCall
|
|
672
|
+
});
|
|
673
|
+
this.state.set("semaphoreTicket", ticket);
|
|
674
|
+
this.state.toolContext?.mark("acquireSemaphore");
|
|
675
|
+
this.logger.verbose("acquireSemaphore:done");
|
|
676
|
+
}
|
|
677
|
+
async validateInput() {
|
|
678
|
+
this.logger.verbose("validateInput:start");
|
|
679
|
+
const { tool, input } = this.state.required;
|
|
680
|
+
const { toolContext } = this.state;
|
|
681
|
+
if (!toolContext) {
|
|
682
|
+
return;
|
|
683
|
+
}
|
|
684
|
+
toolContext.mark("validateInput");
|
|
685
|
+
try {
|
|
686
|
+
toolContext.input = tool.parseInput(input);
|
|
687
|
+
this.logger.verbose("validateInput:done");
|
|
688
|
+
} catch (err) {
|
|
689
|
+
if (err instanceof z.ZodError) {
|
|
690
|
+
throw new InvalidInputError("Invalid tool input", err.issues);
|
|
691
|
+
}
|
|
692
|
+
this.logger.error("validateInput: failed to parse input", err);
|
|
693
|
+
throw new InvalidInputError("Unknown error occurred when trying to parse input");
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
async execute() {
|
|
697
|
+
this.logger.verbose("execute:start");
|
|
698
|
+
const toolContext = this.state.toolContext;
|
|
699
|
+
if (!toolContext) {
|
|
700
|
+
return;
|
|
701
|
+
}
|
|
702
|
+
toolContext.mark("execute");
|
|
703
|
+
const { tool } = this.state.required;
|
|
704
|
+
const timeoutMs = tool.metadata.timeout?.executeMs ?? this.scope.rateLimitManager?.config?.defaultTimeout?.executeMs;
|
|
705
|
+
const running = runOnSurface(
|
|
706
|
+
callSurfaceOf(this.input.ctx),
|
|
707
|
+
() => runAsTool({ name: tool.name, fullName: tool.fullName }, async () => {
|
|
708
|
+
toolContext.output = await toolContext.execute(toolContext.input);
|
|
709
|
+
})
|
|
710
|
+
);
|
|
711
|
+
try {
|
|
712
|
+
await (timeoutMs ? withTimeout(() => running, timeoutMs, tool.metadata.name) : running);
|
|
713
|
+
this.logger.verbose("execute:done");
|
|
714
|
+
} catch (error) {
|
|
715
|
+
if (error instanceof FlowControl) {
|
|
716
|
+
throw error;
|
|
717
|
+
}
|
|
718
|
+
if (error instanceof InputRequiredSignal || error instanceof MissingClientCapabilityError) {
|
|
719
|
+
throw error;
|
|
720
|
+
}
|
|
721
|
+
if (error instanceof ExecutionTimeoutError) {
|
|
722
|
+
this.logger.warn("execute: tool execution timed out", {
|
|
723
|
+
tool: tool.metadata.name,
|
|
724
|
+
timeoutMs
|
|
725
|
+
});
|
|
726
|
+
this.state.executionAbort?.abort(error);
|
|
727
|
+
this.state.set("abandonedExecution", running);
|
|
728
|
+
throw error;
|
|
729
|
+
}
|
|
730
|
+
if (error instanceof ElicitationFallbackRequired) {
|
|
731
|
+
this.logger.info("execute: elicitation fallback required", {
|
|
732
|
+
elicitId: error.elicitId,
|
|
733
|
+
toolName: error.toolName
|
|
734
|
+
});
|
|
735
|
+
const authInfo = this.state.authInfo;
|
|
736
|
+
const authInfoWithTransport = authInfo;
|
|
737
|
+
const sessionId = authInfo?.sessionId ?? "anonymous";
|
|
738
|
+
const store = this.scope.elicitationStore;
|
|
739
|
+
if (!store) {
|
|
740
|
+
throw new InternalMcpError("Elicitation store not initialized");
|
|
741
|
+
}
|
|
742
|
+
const owner = resolveElicitationOwner(this.tryGetContext());
|
|
743
|
+
if (!owner) {
|
|
744
|
+
throw new ElicitationNotSupportedError(
|
|
745
|
+
"This client does not support elicitation, and the elicitation fallback needs a verified session or an authenticated caller to know who may answer it"
|
|
746
|
+
);
|
|
747
|
+
}
|
|
748
|
+
await store.setPendingFallback({
|
|
749
|
+
elicitId: error.elicitId,
|
|
750
|
+
sessionId,
|
|
751
|
+
owner,
|
|
752
|
+
// The answer re-runs the call this flow ran: this tool, with these arguments. What asked
|
|
753
|
+
// may be an entry the tool runs, like the agent behind `invoke_<agent>`, whose own name
|
|
754
|
+
// no `tools/call` resolves.
|
|
755
|
+
toolName: tool.fullName,
|
|
756
|
+
toolInput: this.state.required.input.arguments,
|
|
757
|
+
elicitMessage: error.elicitMessage,
|
|
758
|
+
elicitSchema: error.schema,
|
|
759
|
+
createdAt: Date.now(),
|
|
760
|
+
expiresAt: Date.now() + error.ttl
|
|
761
|
+
});
|
|
762
|
+
const transportType = authInfoWithTransport?.transport?.type;
|
|
763
|
+
if (transportType === "streamable-http" && canDeliverNotifications(this.scope, sessionId)) {
|
|
764
|
+
this.logger.info("execute: using waiting fallback for streamable-http", {
|
|
765
|
+
elicitId: error.elicitId
|
|
766
|
+
});
|
|
767
|
+
const deps = { scope: this.scope, sessionId, logger: this.logger };
|
|
768
|
+
const result = await awaitOutsideRequest(handleWaitingFallback(deps, error));
|
|
769
|
+
toolContext.output = result;
|
|
770
|
+
this.logger.verbose("execute:done (elicitation waiting fallback)");
|
|
771
|
+
return;
|
|
772
|
+
}
|
|
773
|
+
const fallbackResponse = {
|
|
774
|
+
content: [
|
|
775
|
+
{
|
|
776
|
+
type: "text",
|
|
777
|
+
text: `This tool requires user input to continue.
|
|
778
|
+
|
|
779
|
+
**Question:** ${error.elicitMessage}
|
|
780
|
+
|
|
781
|
+
After collecting the user's response, call the \`sendElicitationResult\` tool with:
|
|
782
|
+
- elicitId: "${error.elicitId}"
|
|
783
|
+
- action: "accept", "cancel", or "decline"
|
|
784
|
+
- content: (the user's response matching the schema below)
|
|
785
|
+
|
|
786
|
+
**Expected Response Schema:**
|
|
787
|
+
\`\`\`json
|
|
788
|
+
${JSON.stringify(error.schema, null, 2)}
|
|
789
|
+
\`\`\``
|
|
790
|
+
}
|
|
791
|
+
],
|
|
792
|
+
_meta: {
|
|
793
|
+
elicitationPending: {
|
|
794
|
+
elicitId: error.elicitId,
|
|
795
|
+
message: error.elicitMessage,
|
|
796
|
+
schema: error.schema,
|
|
797
|
+
instructions: "Call sendElicitationResult tool after collecting user input"
|
|
798
|
+
}
|
|
799
|
+
}
|
|
800
|
+
};
|
|
801
|
+
toolContext.output = fallbackResponse;
|
|
802
|
+
this.logger.verbose("execute:done (elicitation fire-and-forget fallback)");
|
|
803
|
+
return;
|
|
804
|
+
}
|
|
805
|
+
if (isClientFacingError(error) || error instanceof InvalidOutputError) throw error;
|
|
806
|
+
throw new ToolExecutionError(
|
|
807
|
+
this.state.tool?.metadata.name || "unknown",
|
|
808
|
+
error instanceof Error ? error : void 0
|
|
809
|
+
);
|
|
810
|
+
}
|
|
811
|
+
}
|
|
812
|
+
async validateOutput() {
|
|
813
|
+
this.logger.verbose("validateOutput:start");
|
|
814
|
+
const { toolContext } = this.state;
|
|
815
|
+
if (!toolContext) {
|
|
816
|
+
return;
|
|
817
|
+
}
|
|
818
|
+
toolContext.mark("validateOutput");
|
|
819
|
+
this.state.set("rawOutput", toolContext.output);
|
|
820
|
+
this.logger.verbose("validateOutput:done");
|
|
821
|
+
}
|
|
822
|
+
async releaseSemaphore() {
|
|
823
|
+
this.logger.verbose("releaseSemaphore:start");
|
|
824
|
+
const ticket = this.state.semaphoreTicket;
|
|
825
|
+
if (ticket) {
|
|
826
|
+
const release = async () => {
|
|
827
|
+
try {
|
|
828
|
+
await ticket.release();
|
|
829
|
+
this.logger.verbose("releaseSemaphore: slot released");
|
|
830
|
+
} catch (error) {
|
|
831
|
+
this.logger.warn("releaseSemaphore: failed to release slot", error);
|
|
832
|
+
}
|
|
833
|
+
};
|
|
834
|
+
const abandonedExecution = this.state.abandonedExecution;
|
|
835
|
+
if (abandonedExecution) void abandonedExecution.then(release, release);
|
|
836
|
+
else await release();
|
|
837
|
+
}
|
|
838
|
+
this.state.toolContext?.mark("releaseSemaphore");
|
|
839
|
+
this.logger.verbose("releaseSemaphore:done");
|
|
840
|
+
}
|
|
841
|
+
async releaseQuota() {
|
|
842
|
+
this.logger.verbose("releaseQuota:start");
|
|
843
|
+
this.state.toolContext?.mark("releaseQuota");
|
|
844
|
+
this.logger.verbose("releaseQuota:done");
|
|
845
|
+
}
|
|
846
|
+
async applyUI() {
|
|
847
|
+
this.logger.verbose("applyUI:start");
|
|
848
|
+
const { tool, rawOutput: executeOutput, input } = this.state;
|
|
849
|
+
const rawOutput = declaredOutput(tool, executeOutput);
|
|
850
|
+
const ctx = this.input.ctx;
|
|
851
|
+
if (ctx?._skipUI || isWidgetCall(input?.["_meta"])) {
|
|
852
|
+
this.logger.verbose("applyUI:skip (agent or widget call - structured data only)");
|
|
853
|
+
return;
|
|
854
|
+
}
|
|
855
|
+
if (!tool || !hasUIConfig(tool.metadata)) {
|
|
856
|
+
this.logger.verbose("applyUI:skip (no UI config)");
|
|
857
|
+
return;
|
|
858
|
+
}
|
|
859
|
+
try {
|
|
860
|
+
const scope = this.scope;
|
|
861
|
+
const { buildToolResponseContent, isUIRenderFailure, MCP_APPS_MIME_TYPE, resolveServingMode } = await import("../ui/ui-render.mjs");
|
|
862
|
+
const { authInfo } = this.state;
|
|
863
|
+
const sessionId = authInfo?.sessionId;
|
|
864
|
+
const requestId = randomUUID();
|
|
865
|
+
const platformType = authInfo?.sessionIdPayload?.platformType ?? this.tryGetContext()?.platformType ?? (sessionId ? scope.notifications.getPlatformType(sessionId) : void 0) ?? "unknown";
|
|
866
|
+
const configuredMode = toolServingMode(tool, this.scope);
|
|
867
|
+
const resolvedMode = resolveServingMode({
|
|
868
|
+
configuredMode,
|
|
869
|
+
platformType
|
|
870
|
+
});
|
|
871
|
+
if (!resolvedMode.supportsUI || resolvedMode.effectiveMode === null) {
|
|
872
|
+
this.logger.verbose("applyUI: Skipping UI (client does not support it)", {
|
|
873
|
+
tool: tool.metadata.name,
|
|
874
|
+
platform: platformType,
|
|
875
|
+
configuredMode,
|
|
876
|
+
reason: resolvedMode.reason
|
|
877
|
+
});
|
|
878
|
+
return;
|
|
879
|
+
}
|
|
880
|
+
const servingMode = resolvedMode.effectiveMode;
|
|
881
|
+
const useStructuredContent = resolvedMode.useStructuredContent;
|
|
882
|
+
let htmlContent;
|
|
883
|
+
let uiMeta = {};
|
|
884
|
+
if (!scope.toolUI) {
|
|
885
|
+
this.logger.verbose("applyUI: toolUI not available, skipping UI rendering");
|
|
886
|
+
return;
|
|
887
|
+
}
|
|
888
|
+
if (servingMode === "static") {
|
|
889
|
+
this.logger.verbose("applyUI: UI using static mode (structured data only)", {
|
|
890
|
+
tool: tool.metadata.name,
|
|
891
|
+
platform: platformType
|
|
892
|
+
});
|
|
893
|
+
} else if (servingMode === "hybrid") {
|
|
894
|
+
const componentPayload = scope.toolUI.buildHybridComponentPayload({
|
|
895
|
+
toolName: tool.metadata.name,
|
|
896
|
+
template: tool.metadata.ui?.template,
|
|
897
|
+
uiConfig: tool.metadata.ui
|
|
898
|
+
});
|
|
899
|
+
if (componentPayload) {
|
|
900
|
+
uiMeta = {
|
|
901
|
+
"ui/component": componentPayload,
|
|
902
|
+
"ui/type": componentPayload["type"],
|
|
903
|
+
"ui/mimeType": MCP_APPS_MIME_TYPE
|
|
904
|
+
};
|
|
905
|
+
}
|
|
906
|
+
this.logger.verbose("applyUI: UI using hybrid mode (structured data + component)", {
|
|
907
|
+
tool: tool.metadata.name,
|
|
908
|
+
platform: platformType,
|
|
909
|
+
hasComponent: !!componentPayload,
|
|
910
|
+
componentType: componentPayload?.["type"],
|
|
911
|
+
componentHash: componentPayload?.["hash"]
|
|
912
|
+
});
|
|
913
|
+
} else {
|
|
914
|
+
const uiRenderResult = await scope.toolUI.renderAndRegisterAsync({
|
|
915
|
+
toolName: tool.metadata.name,
|
|
916
|
+
requestId,
|
|
917
|
+
input: input?.arguments && typeof input.arguments === "object" && !Array.isArray(input.arguments) ? input.arguments : {},
|
|
918
|
+
output: rawOutput,
|
|
919
|
+
structuredContent: void 0,
|
|
920
|
+
uiConfig: tool.metadata.ui,
|
|
921
|
+
platformType
|
|
922
|
+
});
|
|
923
|
+
if (isUIRenderFailure(uiRenderResult)) {
|
|
924
|
+
this.logger.warn("applyUI: UI rendering failed (graceful degradation)", {
|
|
925
|
+
tool: tool.metadata.name,
|
|
926
|
+
reason: uiRenderResult.reason,
|
|
927
|
+
platform: platformType
|
|
928
|
+
});
|
|
929
|
+
htmlContent = void 0;
|
|
930
|
+
uiMeta = {};
|
|
931
|
+
} else {
|
|
932
|
+
const htmlKey = "ui/html";
|
|
933
|
+
htmlContent = uiRenderResult?.meta?.[htmlKey];
|
|
934
|
+
if (!htmlContent) {
|
|
935
|
+
htmlContent = uiRenderResult?.meta?.["ui/html"];
|
|
936
|
+
}
|
|
937
|
+
uiMeta = uiRenderResult.meta || {};
|
|
938
|
+
}
|
|
939
|
+
}
|
|
940
|
+
const uiResult = buildToolResponseContent({
|
|
941
|
+
rawOutput,
|
|
942
|
+
htmlContent,
|
|
943
|
+
servingMode,
|
|
944
|
+
useStructuredContent,
|
|
945
|
+
platformType
|
|
946
|
+
});
|
|
947
|
+
this.state.set("uiResult", uiResult);
|
|
948
|
+
this.state.set("uiMeta", uiMeta);
|
|
949
|
+
this.logger.verbose("applyUI: UI processed", {
|
|
950
|
+
tool: tool.metadata.name,
|
|
951
|
+
platform: platformType,
|
|
952
|
+
servingMode,
|
|
953
|
+
useStructuredContent,
|
|
954
|
+
format: uiResult.format,
|
|
955
|
+
contentCleared: uiResult.contentCleared
|
|
956
|
+
});
|
|
957
|
+
} catch (error) {
|
|
958
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
959
|
+
const errorStack = error instanceof Error ? error.stack : void 0;
|
|
960
|
+
const uiConfig = tool.metadata.ui;
|
|
961
|
+
this.logger.error("applyUI: UI rendering failed", {
|
|
962
|
+
tool: tool.metadata.name,
|
|
963
|
+
error: errorMessage,
|
|
964
|
+
stack: errorStack,
|
|
965
|
+
templateType: uiConfig?.template ? typeof uiConfig.template === "function" ? "react-component" : typeof uiConfig.template === "string" ? uiConfig.template.endsWith(".tsx") || uiConfig.template.endsWith(".jsx") ? "react-file" : "html-file" : "unknown" : "none"
|
|
966
|
+
});
|
|
967
|
+
if (isDebug() || isDevelopment()) {
|
|
968
|
+
console.error("[FrontMCP] UI Rendering Error:", {
|
|
969
|
+
tool: tool.metadata.name,
|
|
970
|
+
error: errorMessage,
|
|
971
|
+
stack: errorStack
|
|
972
|
+
});
|
|
973
|
+
}
|
|
974
|
+
}
|
|
975
|
+
this.logger.verbose("applyUI:done");
|
|
976
|
+
}
|
|
977
|
+
async finalize() {
|
|
978
|
+
this.logger.verbose("finalize:start");
|
|
979
|
+
const { tool, rawOutput, uiResult, uiMeta, resultMeta } = this.state;
|
|
980
|
+
if (!tool) {
|
|
981
|
+
this.logger.verbose("finalize: skipping (no tool in state)");
|
|
982
|
+
return;
|
|
983
|
+
}
|
|
984
|
+
if (rawOutput === void 0) {
|
|
985
|
+
this.logger.verbose("finalize: skipping (no output - execute stage likely failed)");
|
|
986
|
+
return;
|
|
987
|
+
}
|
|
988
|
+
const parseResult = tool.safeParseOutput(rawOutput);
|
|
989
|
+
if (!parseResult.success) {
|
|
990
|
+
this.logger.error("finalize: output validation failed", {
|
|
991
|
+
tool: tool.metadata.name,
|
|
992
|
+
errors: parseResult.error
|
|
993
|
+
});
|
|
994
|
+
throw parseResult.error instanceof InvalidOutputError ? parseResult.error : new InvalidOutputError();
|
|
995
|
+
}
|
|
996
|
+
const allowNonFinite = this.scope.metadata.output?.allowNonFinite;
|
|
997
|
+
if (allowNonFinite !== true) {
|
|
998
|
+
const found = findNonFiniteNumber(parseResult.data);
|
|
999
|
+
if (found) {
|
|
1000
|
+
this.logger.error("finalize: non-finite number in tool output", {
|
|
1001
|
+
tool: tool.metadata.name,
|
|
1002
|
+
path: found.path,
|
|
1003
|
+
value: String(found.value)
|
|
1004
|
+
});
|
|
1005
|
+
throw new InvalidOutputError({
|
|
1006
|
+
reason: "non-finite-number",
|
|
1007
|
+
path: found.path,
|
|
1008
|
+
value: String(found.value)
|
|
1009
|
+
});
|
|
1010
|
+
}
|
|
1011
|
+
}
|
|
1012
|
+
const result = parseResult.data;
|
|
1013
|
+
const rawMeta = (() => {
|
|
1014
|
+
if (typeof rawOutput !== "object" || rawOutput === null) return void 0;
|
|
1015
|
+
const meta = rawOutput["_meta"];
|
|
1016
|
+
if (typeof meta !== "object" || meta === null) return void 0;
|
|
1017
|
+
return meta;
|
|
1018
|
+
})();
|
|
1019
|
+
if (rawMeta) {
|
|
1020
|
+
result._meta = { ...result._meta, ...rawMeta };
|
|
1021
|
+
}
|
|
1022
|
+
if (resultMeta) {
|
|
1023
|
+
result._meta = { ...result._meta, ...resultMeta };
|
|
1024
|
+
}
|
|
1025
|
+
if (uiResult) {
|
|
1026
|
+
result.content = uiResult.content;
|
|
1027
|
+
if (uiResult.structuredContent !== void 0 && uiResult.structuredContent !== null) {
|
|
1028
|
+
result.structuredContent = uiResult.structuredContent;
|
|
1029
|
+
}
|
|
1030
|
+
if (uiMeta) {
|
|
1031
|
+
result._meta = { ...result._meta, ...uiMeta };
|
|
1032
|
+
}
|
|
1033
|
+
}
|
|
1034
|
+
this.logger.verbose("finalize: sending response", {
|
|
1035
|
+
tool: tool.metadata.name,
|
|
1036
|
+
hasContent: Array.isArray(result.content) && result.content.length > 0,
|
|
1037
|
+
contentParts: Array.isArray(result.content) ? result.content.length : 0,
|
|
1038
|
+
contentBytes: Array.isArray(result.content) ? result.content.reduce((sum, part) => {
|
|
1039
|
+
const str = JSON.stringify(part);
|
|
1040
|
+
return sum + (typeof Buffer !== "undefined" ? Buffer.byteLength(str, "utf8") : new TextEncoder().encode(str).byteLength);
|
|
1041
|
+
}, 0) : 0,
|
|
1042
|
+
hasStructuredContent: result.structuredContent !== void 0,
|
|
1043
|
+
hasMeta: result._meta !== void 0,
|
|
1044
|
+
metaKeys: result._meta ? Object.keys(result._meta) : [],
|
|
1045
|
+
isError: result.isError
|
|
1046
|
+
});
|
|
1047
|
+
this.respond(result);
|
|
1048
|
+
this.logger.verbose("finalize:done");
|
|
1049
|
+
}
|
|
1050
|
+
};
|
|
1051
|
+
__decorateClass([
|
|
1052
|
+
Stage("parseInput")
|
|
1053
|
+
], CallToolFlow.prototype, "parseInput", 1);
|
|
1054
|
+
__decorateClass([
|
|
1055
|
+
Stage("checkSkillsOnlyMode")
|
|
1056
|
+
], CallToolFlow.prototype, "checkSkillsOnlyMode", 1);
|
|
1057
|
+
__decorateClass([
|
|
1058
|
+
Stage("ensureRemoteCapabilities")
|
|
1059
|
+
], CallToolFlow.prototype, "ensureRemoteCapabilities", 1);
|
|
1060
|
+
__decorateClass([
|
|
1061
|
+
Stage("findTool")
|
|
1062
|
+
], CallToolFlow.prototype, "findTool", 1);
|
|
1063
|
+
__decorateClass([
|
|
1064
|
+
Stage("createTaskIfRequested")
|
|
1065
|
+
], CallToolFlow.prototype, "createTaskIfRequested", 1);
|
|
1066
|
+
__decorateClass([
|
|
1067
|
+
Stage("checkPublicAccess")
|
|
1068
|
+
], CallToolFlow.prototype, "checkPublicAccess", 1);
|
|
1069
|
+
__decorateClass([
|
|
1070
|
+
Stage("checkToolAuthorization")
|
|
1071
|
+
], CallToolFlow.prototype, "checkToolAuthorization", 1);
|
|
1072
|
+
__decorateClass([
|
|
1073
|
+
Stage("checkEntryAuthorities")
|
|
1074
|
+
], CallToolFlow.prototype, "checkEntryAuthorities", 1);
|
|
1075
|
+
__decorateClass([
|
|
1076
|
+
Stage("createToolCallContext")
|
|
1077
|
+
], CallToolFlow.prototype, "createToolCallContext", 1);
|
|
1078
|
+
__decorateClass([
|
|
1079
|
+
Stage("checkToolCredentials")
|
|
1080
|
+
], CallToolFlow.prototype, "checkToolCredentials", 1);
|
|
1081
|
+
__decorateClass([
|
|
1082
|
+
Stage("acquireQuota")
|
|
1083
|
+
], CallToolFlow.prototype, "acquireQuota", 1);
|
|
1084
|
+
__decorateClass([
|
|
1085
|
+
Stage("acquireSemaphore")
|
|
1086
|
+
], CallToolFlow.prototype, "acquireSemaphore", 1);
|
|
1087
|
+
__decorateClass([
|
|
1088
|
+
Stage("validateInput")
|
|
1089
|
+
], CallToolFlow.prototype, "validateInput", 1);
|
|
1090
|
+
__decorateClass([
|
|
1091
|
+
Stage("execute")
|
|
1092
|
+
], CallToolFlow.prototype, "execute", 1);
|
|
1093
|
+
__decorateClass([
|
|
1094
|
+
Stage("validateOutput")
|
|
1095
|
+
], CallToolFlow.prototype, "validateOutput", 1);
|
|
1096
|
+
__decorateClass([
|
|
1097
|
+
Stage("releaseSemaphore")
|
|
1098
|
+
], CallToolFlow.prototype, "releaseSemaphore", 1);
|
|
1099
|
+
__decorateClass([
|
|
1100
|
+
Stage("releaseQuota")
|
|
1101
|
+
], CallToolFlow.prototype, "releaseQuota", 1);
|
|
1102
|
+
__decorateClass([
|
|
1103
|
+
Stage("applyUI")
|
|
1104
|
+
], CallToolFlow.prototype, "applyUI", 1);
|
|
1105
|
+
__decorateClass([
|
|
1106
|
+
Stage("finalize")
|
|
1107
|
+
], CallToolFlow.prototype, "finalize", 1);
|
|
1108
|
+
CallToolFlow = __decorateClass([
|
|
1109
|
+
Flow({
|
|
1110
|
+
name,
|
|
1111
|
+
plan,
|
|
1112
|
+
inputSchema,
|
|
1113
|
+
outputSchema,
|
|
1114
|
+
access: "authorized"
|
|
1115
|
+
})
|
|
1116
|
+
], CallToolFlow);
|
|
1117
|
+
function declaredOutput(tool, output) {
|
|
1118
|
+
if (!tool?.outputSchema || typeof output !== "object" || output === null || Array.isArray(output)) return output;
|
|
1119
|
+
if (Array.isArray(output["content"])) return output;
|
|
1120
|
+
const parsed = tool.safeParseOutput(output);
|
|
1121
|
+
if (!parsed.success) return output;
|
|
1122
|
+
const structured = parsed.data.structuredContent;
|
|
1123
|
+
return typeof structured === "object" && structured !== null && !Array.isArray(structured) ? structured : output;
|
|
1124
|
+
}
|
|
1125
|
+
function linkedAbortController(signal) {
|
|
1126
|
+
const controller = new AbortController();
|
|
1127
|
+
if (signal?.aborted) controller.abort(signal.reason);
|
|
1128
|
+
else signal?.addEventListener("abort", () => controller.abort(signal.reason), { once: true });
|
|
1129
|
+
return controller;
|
|
1130
|
+
}
|
|
1131
|
+
export {
|
|
1132
|
+
CallToolFlow as default,
|
|
1133
|
+
toolClassHooksJoin
|
|
1134
|
+
};
|