@frontmcp/sdk 1.11.0 → 1.11.1-rc.2
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/app/instances/app.esm.instance.d.ts.map +1 -1
- package/app/instances/empty-app-registries.d.ts +1 -0
- package/app/instances/empty-app-registries.d.ts.map +1 -1
- package/auth/flows/oauth.callback.flow.d.ts +5 -0
- package/auth/flows/oauth.callback.flow.d.ts.map +1 -1
- package/auth/flows/oauth.connect.flow.d.ts +4 -2
- package/auth/flows/oauth.connect.flow.d.ts.map +1 -1
- package/auth/vault/auth-providers.providers.d.ts +7 -16
- package/auth/vault/auth-providers.providers.d.ts.map +1 -1
- package/auth/vault/index.d.ts +1 -2
- package/auth/vault/index.d.ts.map +1 -1
- package/auth/vault/unconfigured-auth-providers.d.ts +4 -0
- package/auth/vault/unconfigured-auth-providers.d.ts.map +1 -0
- package/browser/app/instances/app.esm.instance.mjs +2 -0
- package/browser/app/instances/empty-app-registries.mjs +2 -0
- package/browser/auth/flows/oauth.callback.flow.mjs +26 -1
- package/browser/auth/flows/oauth.connect.flow.mjs +31 -24
- package/browser/auth/vault/auth-providers.providers.mjs +96 -0
- package/browser/auth/vault/credential-cache.mjs +5 -0
- package/browser/auth/vault/unconfigured-auth-providers.mjs +21 -0
- package/browser/common/entries/scope.entry.mjs +35 -0
- package/browser/common/interfaces/execution-context.interface.mjs +5 -0
- package/browser/common/interfaces/server.interface.mjs +2 -0
- package/browser/common/metadata/front-mcp.metadata.mjs +3 -0
- package/browser/common/metadata/plugin.metadata.mjs +2 -1
- package/browser/common/schemas/http-output.schema.mjs +12 -1
- package/browser/common/tokens/front-mcp.tokens.mjs +1 -0
- package/browser/common/tokens/plugin.tokens.mjs +2 -1
- package/browser/common/types/options/skills-http/schema.mjs +13 -0
- package/browser/direct/direct-client.mjs +10 -1
- package/browser/direct/token-auth-info.mjs +33 -0
- package/browser/elicitation/helpers/elicit.helper.mjs +10 -7
- package/browser/errors/http-route.errors.mjs +9 -0
- package/browser/errors/index.mjs +3 -1
- package/browser/errors/misconfiguration.mjs +4 -1
- package/browser/errors/plugin.errors.mjs +30 -0
- package/browser/errors/tool-credentials-required.error.mjs +18 -5
- package/browser/front-mcp/front-mcp.mjs +7 -5
- package/browser/health/health.service.mjs +14 -6
- package/browser/http-route/flows/http.route.flow.mjs +47 -19
- package/browser/index.cjs +3581 -2501
- package/browser/index.mjs +20 -4
- package/browser/job/enclave/browser-enclave-core.mjs +9 -0
- package/browser/job/enclave/job-enclave.bridge.mjs +3 -20
- package/browser/notification/notification.service.mjs +5 -5
- package/browser/plugin/plugin.registry.mjs +56 -3
- package/browser/provider/provider.registry.mjs +2 -0
- package/browser/resource/flows/resources-list.flow.mjs +31 -1
- package/browser/scope/dev-events-observability.mjs +9 -5
- package/browser/scope/scope.instance.mjs +15 -6
- package/browser/server/server.validation.mjs +3 -6
- package/browser/skill/decision/decisions-api.decider.mjs +62 -0
- package/browser/skill/decision/skill-decision.ranker.mjs +96 -0
- package/browser/skill/errors/skill-bundle-not-loaded.error.mjs +21 -0
- package/browser/skill/flows/load-skill.flow.mjs +21 -12
- package/browser/skill/flows/search-skills.flow.mjs +10 -2
- package/browser/skill/index.mjs +6 -0
- package/browser/skill/providers/memory-skill.provider.mjs +41 -135
- package/browser/skill/sep-2640/resources/skill-index.resource.mjs +2 -0
- package/browser/skill/sep-2640/resources/skill-md.resource.mjs +3 -3
- package/browser/skill/sep-2640/sep-2640.builders.mjs +24 -2
- package/browser/skill/sep-2640/sep-2640.per-skill.mjs +3 -4
- package/browser/skill/sep-2640/sep-2640.resource-helpers.mjs +14 -2
- package/browser/skill/skill-catalog-source.mjs +55 -0
- package/browser/skill/skill-instructions.helper.mjs +25 -7
- package/browser/skill/skill-search-text.mjs +166 -0
- package/browser/skill/skill.registry.mjs +64 -3
- package/browser/subsystems.mjs +14 -1
- package/browser/surface/index.mjs +6 -0
- package/browser/surface/list-change-batch.mjs +51 -0
- package/browser/surface/live-surface.mjs +2 -2
- package/browser/tool/flows/call-tool.flow.mjs +18 -4
- package/browser/tool/flows/tool-credentials.gate.mjs +60 -10
- package/browser/tool/tool.registry.mjs +9 -2
- package/browser/transport/mcp-20260728/mrtr.mjs +13 -6
- package/browser/transport/mcp-20260728/subscriptions.mjs +6 -6
- package/browser/transport/mcp-handlers/skills-list-request.handler.mjs +19 -7
- package/browser/transport/mcp-handlers/skills-mcp.types.mjs +8 -4
- package/browser/transport/relay/relay-http.mjs +2 -1
- package/browser/transport/web-fetch-handler.mjs +6 -8
- package/browser/transport/web-response.renderer.mjs +6 -2
- package/browser/utils/http-location.utils.mjs +8 -0
- package/common/decorators/tool.decorator.d.ts +2 -1
- package/common/decorators/tool.decorator.d.ts.map +1 -1
- package/common/entries/scope.entry.d.ts +20 -0
- package/common/entries/scope.entry.d.ts.map +1 -1
- package/common/interfaces/execution-context.interface.d.ts +3 -1
- package/common/interfaces/execution-context.interface.d.ts.map +1 -1
- package/common/interfaces/server.interface.d.ts +2 -0
- package/common/interfaces/server.interface.d.ts.map +1 -1
- package/common/interfaces/skill.interface.d.ts +5 -0
- package/common/interfaces/skill.interface.d.ts.map +1 -1
- package/common/metadata/app.metadata.d.ts +1 -1
- package/common/metadata/front-mcp.metadata.d.ts +394 -92
- package/common/metadata/front-mcp.metadata.d.ts.map +1 -1
- package/common/metadata/plugin.metadata.d.ts +8 -0
- package/common/metadata/plugin.metadata.d.ts.map +1 -1
- package/common/schemas/http-output.schema.d.ts.map +1 -1
- package/common/tokens/front-mcp.tokens.d.ts.map +1 -1
- package/common/tokens/plugin.tokens.d.ts +1 -0
- package/common/tokens/plugin.tokens.d.ts.map +1 -1
- package/common/types/options/elicitation/schema.d.ts +1 -1
- package/common/types/options/redis/schema.d.ts +3 -3
- package/common/types/options/redis/schema.d.ts.map +1 -1
- package/common/types/options/skills-http/interfaces.d.ts +16 -0
- package/common/types/options/skills-http/interfaces.d.ts.map +1 -1
- package/common/types/options/skills-http/schema.d.ts +13 -2
- package/common/types/options/skills-http/schema.d.ts.map +1 -1
- package/common/types/options/transport/schema.d.ts +4 -4
- package/context/frontmcp-context.d.ts +1 -1
- package/context/frontmcp-context.d.ts.map +1 -1
- package/direct/client.types.d.ts +60 -21
- package/direct/client.types.d.ts.map +1 -1
- package/direct/create.types.d.ts +6 -1
- package/direct/create.types.d.ts.map +1 -1
- package/direct/index.d.ts +1 -1
- package/direct/index.d.ts.map +1 -1
- package/direct/token-auth-info.d.ts +9 -0
- package/direct/token-auth-info.d.ts.map +1 -0
- package/elicitation/helpers/elicit.helper.d.ts +5 -0
- package/elicitation/helpers/elicit.helper.d.ts.map +1 -1
- package/errors/error-handler.d.ts +1 -0
- package/errors/error-handler.d.ts.map +1 -1
- package/errors/http-route.errors.d.ts +4 -0
- package/errors/http-route.errors.d.ts.map +1 -1
- package/errors/index.d.ts +1 -1
- package/errors/index.d.ts.map +1 -1
- package/errors/mcp.error.d.ts +2 -0
- package/errors/mcp.error.d.ts.map +1 -1
- package/errors/misconfiguration.d.ts.map +1 -1
- package/errors/plugin.errors.d.ts +12 -0
- package/errors/plugin.errors.d.ts.map +1 -1
- package/errors/tool-credentials-required.error.d.ts +10 -2
- package/errors/tool-credentials-required.error.d.ts.map +1 -1
- package/esm/index.mjs +39 -31
- package/front-mcp/front-mcp.d.ts +3 -0
- package/front-mcp/front-mcp.d.ts.map +1 -1
- package/health/health.service.d.ts +10 -3
- package/health/health.service.d.ts.map +1 -1
- package/http-route/flows/http.route.flow.d.ts +6 -0
- package/http-route/flows/http.route.flow.d.ts.map +1 -1
- package/index.d.ts +10 -10
- package/index.d.ts.map +1 -1
- package/index.js +46 -38
- package/job/enclave/browser-enclave-core.d.ts +3 -0
- package/job/enclave/browser-enclave-core.d.ts.map +1 -0
- package/job/enclave/enclave-core.d.ts +3 -0
- package/job/enclave/enclave-core.d.ts.map +1 -0
- package/job/enclave/job-enclave.bridge.d.ts +1 -9
- package/job/enclave/job-enclave.bridge.d.ts.map +1 -1
- package/package.json +16 -11
- package/plugin/plugin.registry.d.ts +5 -1
- package/plugin/plugin.registry.d.ts.map +1 -1
- package/provider/provider.registry.d.ts.map +1 -1
- package/resource/flows/resources-list.flow.d.ts +3 -1
- package/resource/flows/resources-list.flow.d.ts.map +1 -1
- package/scope/dev-events-observability.d.ts +2 -0
- package/scope/dev-events-observability.d.ts.map +1 -1
- package/scope/scope.instance.d.ts.map +1 -1
- package/server/adapters/utf8-json.parser.d.ts +2 -0
- package/server/adapters/utf8-json.parser.d.ts.map +1 -1
- package/server/server.validation.d.ts.map +1 -1
- package/skill/decision/decisions-api.decider.d.ts +26 -0
- package/skill/decision/decisions-api.decider.d.ts.map +1 -0
- package/skill/decision/index.d.ts +4 -0
- package/skill/decision/index.d.ts.map +1 -0
- package/skill/decision/skill-decision.ranker.d.ts +28 -0
- package/skill/decision/skill-decision.ranker.d.ts.map +1 -0
- package/skill/decision/skill-decision.types.d.ts +63 -0
- package/skill/decision/skill-decision.types.d.ts.map +1 -0
- package/skill/errors/index.d.ts +1 -0
- package/skill/errors/index.d.ts.map +1 -1
- package/skill/errors/skill-bundle-not-loaded.error.d.ts +16 -0
- package/skill/errors/skill-bundle-not-loaded.error.d.ts.map +1 -0
- package/skill/flows/load-skill.flow.d.ts +4 -2
- package/skill/flows/load-skill.flow.d.ts.map +1 -1
- package/skill/flows/search-skills.flow.d.ts +5 -1
- package/skill/flows/search-skills.flow.d.ts.map +1 -1
- package/skill/index.d.ts +6 -0
- package/skill/index.d.ts.map +1 -1
- package/skill/providers/memory-skill.provider.d.ts +10 -12
- package/skill/providers/memory-skill.provider.d.ts.map +1 -1
- package/skill/sep-2640/resources/skill-index.resource.d.ts.map +1 -1
- package/skill/sep-2640/sep-2640.builders.d.ts +7 -2
- package/skill/sep-2640/sep-2640.builders.d.ts.map +1 -1
- package/skill/sep-2640/sep-2640.per-skill.d.ts.map +1 -1
- package/skill/sep-2640/sep-2640.resource-helpers.d.ts +7 -1
- package/skill/sep-2640/sep-2640.resource-helpers.d.ts.map +1 -1
- package/skill/skill-catalog-source.d.ts +69 -0
- package/skill/skill-catalog-source.d.ts.map +1 -0
- package/skill/skill-instructions.helper.d.ts +15 -0
- package/skill/skill-instructions.helper.d.ts.map +1 -1
- package/skill/skill-search-text.d.ts +60 -0
- package/skill/skill-search-text.d.ts.map +1 -0
- package/skill/skill-storage.interface.d.ts +5 -0
- package/skill/skill-storage.interface.d.ts.map +1 -1
- package/skill/skill.registry.d.ts +29 -0
- package/skill/skill.registry.d.ts.map +1 -1
- package/subsystems.d.ts +1 -1
- package/subsystems.d.ts.map +1 -1
- package/surface/index.d.ts +1 -0
- package/surface/index.d.ts.map +1 -1
- package/surface/list-change-batch.d.ts +28 -0
- package/surface/list-change-batch.d.ts.map +1 -0
- package/tool/flows/call-tool.flow.d.ts +5 -2
- package/tool/flows/call-tool.flow.d.ts.map +1 -1
- package/tool/flows/tool-credentials.gate.d.ts +26 -0
- package/tool/flows/tool-credentials.gate.d.ts.map +1 -1
- package/tool/tool.registry.d.ts +2 -0
- package/tool/tool.registry.d.ts.map +1 -1
- package/transport/mcp-20260728/mrtr.d.ts +6 -2
- package/transport/mcp-20260728/mrtr.d.ts.map +1 -1
- package/transport/mcp-20260728/subscriptions.d.ts.map +1 -1
- package/transport/mcp-handlers/index.d.ts +1 -1
- package/transport/mcp-handlers/skills-list-request.handler.d.ts.map +1 -1
- package/transport/mcp-handlers/skills-mcp.types.d.ts +4 -1
- package/transport/mcp-handlers/skills-mcp.types.d.ts.map +1 -1
- package/transport/relay/relay-http.d.ts.map +1 -1
- package/transport/web-response.renderer.d.ts.map +1 -1
- package/utils/http-location.utils.d.ts +8 -0
- package/utils/http-location.utils.d.ts.map +1 -0
- package/auth/vault/auth-providers.context-extension.d.ts +0 -68
- package/auth/vault/auth-providers.context-extension.d.ts.map +0 -1
package/browser/index.mjs
CHANGED
|
@@ -19,14 +19,18 @@ import {
|
|
|
19
19
|
fitResourceAnswer,
|
|
20
20
|
fitToolAnswer
|
|
21
21
|
} from "./answer/index.mjs";
|
|
22
|
-
import {
|
|
22
|
+
import {
|
|
23
|
+
fileSignal,
|
|
24
|
+
SURFACE_META_KEY,
|
|
25
|
+
surfaceHash
|
|
26
|
+
} from "./surface/index.mjs";
|
|
23
27
|
import {
|
|
24
28
|
MATERIALIZED_META_KEY,
|
|
25
29
|
MaterializedResourceContext,
|
|
26
30
|
resourceStore,
|
|
27
31
|
ResourceStore
|
|
28
32
|
} from "./resource/materialized/index.mjs";
|
|
29
|
-
export { AgentCallDepthExceededError, AgentConfigKeyNotFoundError, AgentConfigurationError, AgentExecutionError, AgentLlmError, AgentLoopExceededError, AgentMethodNotAvailableError, AgentNotConfiguredError, AgentNotFoundError, AgentTimeoutError, AgentToolExecutionError, AgentToolNotFoundError, AgentVisibilityError, AuthConfigurationError, AuthProvidersNotConfiguredError, AuthorizationRequiredError, BrowserEntryPointUnavailableError, BrowserStoreUnavailableError, CallRecorderConfigurationError, ConfigNotFoundError, ContextExtensionNotAvailableError, CredentialProviderAlreadyRegisteredError, CrossOriginRequestError, DependencyCycleError, DependencyNotFoundError, DuplicateAppIdError, DutyNameConflictError, DynamicAdapterNameError, DynamicJobDirectExecutionError, ElicitationDisabledError, ElicitationEncryptionError, ElicitationFallbackRequired, ElicitationNotOwnedError, ElicitationNotSupportedError, ElicitationSecretRequiredError, ElicitationStoreNotInitializedError, ElicitationSubscriptionError, ElicitationTimeoutError, EnclaveExecutionError, EncryptionContextNotSetError, EncryptionKeyNotConfiguredError, EntryUnavailableError, EntryValidationError, ErrorHandler, EsmCacheError, EsmInvalidSpecifierError, EsmManifestInvalidError, EsmPackageLoadError, EsmRegistryAuthError, EsmVersionResolutionError, ExternalEntryError, ExternalEntryLoadError, ExternalEntryNotFoundError, ExternalEntryNotSupportedError, FeatureOffError, FlowExitedWithoutOutputError, FlowInputMissingError, FlowNotRegisteredError, GenericServerError, GlobalConfigNotFoundError, GuardLimitMcpError, HaConfigurationError, HookOrderCycleError, HookTargetNotDefinedError, InMemoryStoreRequiredError, InputRequiredSignal, InternalMcpError, InvalidDecoratorMetadataError, InvalidDependencyScopeError, InvalidEntityError, InvalidFileSignalError, InvalidHookFlowError, InvalidHttpRouteError, InvalidInputError, InvalidInstructionSourceError, InvalidMethodError, InvalidOffloadCallError, InvalidOutputError, InvalidPeopleAuthOptionsError, InvalidPluginScopeError, InvalidRegistryKindError, InvalidResourceStoreError, InvalidResourceUriError, InvalidRetryOptionsError, InvalidSharedServerOptionsError, InvalidSkillError, InvalidTransportSessionError, InvalidUseClassError, InvalidUseFactoryError, InvalidUseValueError, InvokeStateMissingKeyError, JwtSecretRequiredError, JwtSecretWeakError, LazyAppConfigurationError, LazyAppLoadError, MCP_ERROR_CODES, McpError, MethodNotImplementedError, MissingClientCapabilityError, MissingPromptArgumentError, MissingProvideError, NameDisambiguationError, NoProviderIdError, OffloadAbortedError, OffloadBudgetExceededError, OffloadNotCloneableError, OffloadUnsupportedRuntimeError, OffloadWorkerError, OrchestratedAuthNotAvailableError, OrchestratorJwksNotAvailableError, PayloadTooLargeError, PersonNotSignedInError, PluginDependencyError, PromptExecutionError, PromptNotFoundError, ProviderBootstrapError, ProviderConstructionError, ProviderDependencyError, ProviderNotAvailableError, ProviderNotInstantiatedError, ProviderNotRegisteredError, ProviderScopeMismatchError, ProviderScopedAccessError, PublicAccessDeniedError, PublicMcpError, QuotaExceededError, RateLimitError, RegistryDefinitionNotFoundError, RegistryDependencyNotRegisteredError, RegistryGraphEntryNotFoundError, RegistryNotInitializedError, RemoteAuthError, RemoteAuthorizationError, RemoteCapabilityDiscoveryError, RemoteCapabilityNotSupportedError, RemoteConfigurationError, RemoteConnectionError, RemoteDisconnectError, RemoteNotConnectedError, RemotePromptGetError, RemotePromptNotFoundError, RemoteResourceNotFoundError, RemoteResourceReadError, RemoteTimeoutError, RemoteToolExecutionError, RemoteToolNotFoundError, RemoteTransportError, RemoteUnsupportedTransportError, RequestContextNotAvailableError, RequiredConfigUndefinedError, ReservedAppIdError, ResourceNotFoundError, ResourceReadError, SamplingNotAvailableError, ScopeConfigurationError, ScopeDeniedError, ServerNotFoundError, ServerlessHandlerNotInitializedError, SessionClaimConflictError, SessionIdEmptyError, SessionIdentityRequiredError, SessionMissingError, SessionOwnerUnreachableError, SessionSecretRequiredError, SessionVerificationFailedError, SharedServerIdentityError, SharedServerStartError, SignInLockedError, SignInRefusedError, SkillContextNotImplementedError, SkillInstructionFetchError, SkillSessionError, SocketInUseError, SocketPathConflictError, SocketPermissionError, StaleToolListError, StoreNotOpenedInBuildError, TaskAlreadyTerminalError, TaskAugmentationNotSupportedError, TaskAugmentationRequiredError, TaskConcurrencyLimitError, TaskNotFoundError, TaskStoreNotInitializedError, TokenLeakDetectedError, TokenNotAvailableError, TokenStoreRequiredError, ToolAliasConflictError, ToolCallError, ToolCredentialsRequiredError, ToolExecutionError, ToolNameConflictError, ToolNotConsentedError, ToolNotFoundError, TransportAlreadyStartedError, TransportBusRequiredError, TransportNotConnectedError, TransportServiceNotAvailableError, UnauthorizedError, UnsafeDutyStoreError, UnsafeSharedServerDirectoryError, UnsafeSocketDirectoryError, UnsupportedClientVersionError, UnsupportedContentTypeError, UnsupportedHookOwnerKindError, UnsupportedTransportTypeError, VaultLoadError, VaultNotFoundError, VercelKvAsyncInitRequiredError, VercelKvNotSupportedError, WorkflowDagValidationError, WorkflowJobTimeoutError, WorkflowStepNotFoundError, WorkflowTimeoutError, authorizationRequiredDataSchema, authorizationRequiredMetaSchema, authorizationRequiredParamsSchema, createErrorHandler, describeConfigIssues, extractPublicMessage, formatMcpErrorResponse, isClientFacingError, isMrtrSignal, isPublicError, refused, shouldStopExecution, toMcpError, DynamicJobRegistrationDisabledError, JobAdmissionTimeoutError, JobCancelledError, JobInterruptedError, JobNotAuthorizedError, JobRunFinishedError, JobRunNotCancellableError, JobRunNotFoundError, JobRunnerBootError, JobRunnerUnavailableError, JobStoreNotSupportedError, JobTimeoutError, UnenforcedMetadataError } from "./errors/index.mjs";
|
|
33
|
+
export { AgentCallDepthExceededError, AgentConfigKeyNotFoundError, AgentConfigurationError, AgentExecutionError, AgentLlmError, AgentLoopExceededError, AgentMethodNotAvailableError, AgentNotConfiguredError, AgentNotFoundError, AgentTimeoutError, AgentToolExecutionError, AgentToolNotFoundError, AgentVisibilityError, AuthConfigurationError, AuthProvidersNotConfiguredError, AuthorizationRequiredError, BrowserEntryPointUnavailableError, BrowserStoreUnavailableError, CallRecorderConfigurationError, ConfigNotFoundError, ContextExtensionNotAvailableError, CredentialProviderAlreadyRegisteredError, CrossOriginRequestError, DependencyCycleError, DependencyNotFoundError, DuplicateAppIdError, DutyNameConflictError, DynamicAdapterNameError, DynamicJobDirectExecutionError, ElicitationDisabledError, ElicitationEncryptionError, ElicitationFallbackRequired, ElicitationNotOwnedError, ElicitationNotSupportedError, ElicitationSecretRequiredError, ElicitationStoreNotInitializedError, ElicitationSubscriptionError, ElicitationTimeoutError, EnclaveExecutionError, EncryptionContextNotSetError, EncryptionKeyNotConfiguredError, EntryUnavailableError, EntryValidationError, ErrorHandler, EsmCacheError, EsmInvalidSpecifierError, EsmManifestInvalidError, EsmPackageLoadError, EsmRegistryAuthError, EsmVersionResolutionError, ExternalEntryError, ExternalEntryLoadError, ExternalEntryNotFoundError, ExternalEntryNotSupportedError, FeatureOffError, FlowExitedWithoutOutputError, FlowInputMissingError, FlowNotRegisteredError, GenericServerError, GlobalConfigNotFoundError, GuardLimitMcpError, HaConfigurationError, HookOrderCycleError, HookTargetNotDefinedError, InMemoryStoreRequiredError, InputRequiredSignal, InternalMcpError, InvalidDecoratorMetadataError, InvalidDependencyScopeError, InvalidEntityError, InvalidFileSignalError, InvalidHookFlowError, InvalidHttpRouteError, InvalidHttpRouteResponseError, InvalidInputError, InvalidInstructionSourceError, InvalidMethodError, InvalidOffloadCallError, InvalidOutputError, InvalidPeopleAuthOptionsError, InvalidPluginScopeError, InvalidRegistryKindError, InvalidResourceStoreError, InvalidResourceUriError, InvalidRetryOptionsError, InvalidSharedServerOptionsError, InvalidSkillError, InvalidTransportSessionError, InvalidUseClassError, InvalidUseFactoryError, InvalidUseValueError, InvokeStateMissingKeyError, JwtSecretRequiredError, JwtSecretWeakError, LazyAppConfigurationError, LazyAppLoadError, MCP_ERROR_CODES, McpError, MethodNotImplementedError, MissingClientCapabilityError, MissingPromptArgumentError, MissingProvideError, NameDisambiguationError, NoProviderIdError, OffloadAbortedError, OffloadBudgetExceededError, OffloadNotCloneableError, OffloadUnsupportedRuntimeError, OffloadWorkerError, OrchestratedAuthNotAvailableError, OrchestratorJwksNotAvailableError, PayloadTooLargeError, PersonNotSignedInError, PluginDependencyError, PromptExecutionError, PromptNotFoundError, ProviderBootstrapError, ProviderConstructionError, ProviderDependencyError, ProviderNotAvailableError, ProviderNotInstantiatedError, ProviderNotRegisteredError, ProviderScopeMismatchError, ProviderScopedAccessError, PublicAccessDeniedError, PublicMcpError, QuotaExceededError, RateLimitError, RegistryDefinitionNotFoundError, RegistryDependencyNotRegisteredError, RegistryGraphEntryNotFoundError, RegistryNotInitializedError, RemoteAuthError, RemoteAuthorizationError, RemoteCapabilityDiscoveryError, RemoteCapabilityNotSupportedError, RemoteConfigurationError, RemoteConnectionError, RemoteDisconnectError, RemoteNotConnectedError, RemotePromptGetError, RemotePromptNotFoundError, RemoteResourceNotFoundError, RemoteResourceReadError, RemoteTimeoutError, RemoteToolExecutionError, RemoteToolNotFoundError, RemoteTransportError, RemoteUnsupportedTransportError, RequestContextNotAvailableError, RequiredConfigUndefinedError, ReservedAppIdError, ResourceNotFoundError, ResourceReadError, SamplingNotAvailableError, ScopeConfigurationError, ScopeDeniedError, ServerNotFoundError, ServerlessHandlerNotInitializedError, SessionClaimConflictError, SessionIdEmptyError, SessionIdentityRequiredError, SessionMissingError, SessionOwnerUnreachableError, SessionSecretRequiredError, SessionVerificationFailedError, SharedServerIdentityError, SharedServerStartError, SignInLockedError, SignInRefusedError, SkillContextNotImplementedError, SkillInstructionFetchError, SkillSessionError, SocketInUseError, SocketPathConflictError, SocketPermissionError, StaleToolListError, StoreNotOpenedInBuildError, TaskAlreadyTerminalError, TaskAugmentationNotSupportedError, TaskAugmentationRequiredError, TaskConcurrencyLimitError, TaskNotFoundError, TaskStoreNotInitializedError, TokenLeakDetectedError, TokenNotAvailableError, TokenStoreRequiredError, ToolAliasConflictError, ToolCallError, ToolCredentialsRequiredError, ToolExecutionError, ToolNameConflictError, ToolNotConsentedError, ToolNotFoundError, TransportAlreadyStartedError, TransportBusRequiredError, TransportNotConnectedError, TransportServiceNotAvailableError, UnauthorizedError, UnsafeDutyStoreError, UnsafeSharedServerDirectoryError, UnsafeSocketDirectoryError, UnsupportedClientVersionError, UnsupportedContentTypeError, UnsupportedHookOwnerKindError, UnsupportedTransportTypeError, VaultLoadError, VaultNotFoundError, VercelKvAsyncInitRequiredError, VercelKvNotSupportedError, WorkflowDagValidationError, WorkflowJobTimeoutError, WorkflowStepNotFoundError, WorkflowTimeoutError, authorizationRequiredDataSchema, authorizationRequiredMetaSchema, authorizationRequiredParamsSchema, createErrorHandler, describeConfigIssues, extractPublicMessage, formatMcpErrorResponse, isClientFacingError, isMrtrSignal, isPublicError, refused, shouldStopExecution, toMcpError, DynamicJobRegistrationDisabledError, JobAdmissionTimeoutError, JobCancelledError, JobInterruptedError, JobNotAuthorizedError, JobRunFinishedError, JobRunNotCancellableError, JobRunNotFoundError, JobRunnerBootError, JobRunnerUnavailableError, JobStoreNotSupportedError, JobTimeoutError, DuplicatePluginEntryError, DuplicatePluginError, PluginConfiguredTwiceError, UnenforcedMetadataError } from "./errors/index.mjs";
|
|
30
34
|
import {
|
|
31
35
|
addHookObserver,
|
|
32
36
|
HOOK_OBSERVER_KEY,
|
|
@@ -152,8 +156,11 @@ import {
|
|
|
152
156
|
JobInstance,
|
|
153
157
|
JobPermissionGuard,
|
|
154
158
|
JobExecutionManager,
|
|
159
|
+
JobAdmission,
|
|
155
160
|
JobEmitter,
|
|
156
|
-
JobRunResource
|
|
161
|
+
JobRunResource,
|
|
162
|
+
jobRunUri,
|
|
163
|
+
mayAccessRun
|
|
157
164
|
} from "./subsystems.mjs";
|
|
158
165
|
import { JOB_WORKER_MARKER } from "./front-mcp/detached-job.flag.mjs";
|
|
159
166
|
import {
|
|
@@ -206,13 +213,16 @@ import {
|
|
|
206
213
|
composeInitializeInstructions,
|
|
207
214
|
composeCallerInstructions,
|
|
208
215
|
buildChannelInstructions,
|
|
216
|
+
SkillCatalogSourceToken,
|
|
217
|
+
decisionsApiDecider,
|
|
209
218
|
setSkillAuditFactory,
|
|
210
219
|
hasSkillAuditFactory,
|
|
211
220
|
filterServableSkills,
|
|
212
221
|
authorizeSkillHttpRequest,
|
|
213
222
|
createSkillHttpAuthValidator,
|
|
214
223
|
SkillHttpAuthValidator,
|
|
215
|
-
SkillValidationError
|
|
224
|
+
SkillValidationError,
|
|
225
|
+
SkillBundleNotLoadedError
|
|
216
226
|
} from "./skill/index.mjs";
|
|
217
227
|
import {
|
|
218
228
|
Agent,
|
|
@@ -392,6 +402,7 @@ export {
|
|
|
392
402
|
HttpRouteHook,
|
|
393
403
|
InMemoryOrchestratedTokenStore,
|
|
394
404
|
JOB_WORKER_MARKER,
|
|
405
|
+
JobAdmission,
|
|
395
406
|
JobEmitter,
|
|
396
407
|
JobExecutionManager,
|
|
397
408
|
JobHook,
|
|
@@ -442,6 +453,8 @@ export {
|
|
|
442
453
|
SSEServerTransport,
|
|
443
454
|
STATELESS_SESSION_ID,
|
|
444
455
|
SURFACE_META_KEY,
|
|
456
|
+
SkillBundleNotLoadedError,
|
|
457
|
+
SkillCatalogSourceToken,
|
|
445
458
|
SkillEmitter,
|
|
446
459
|
SkillHttpAuthValidator,
|
|
447
460
|
SkillInstance,
|
|
@@ -541,6 +554,7 @@ export {
|
|
|
541
554
|
createSkillInstance,
|
|
542
555
|
createSkillStorageProvider,
|
|
543
556
|
createWebFetchHandler,
|
|
557
|
+
decisionsApiDecider,
|
|
544
558
|
deepMerge,
|
|
545
559
|
default3 as default,
|
|
546
560
|
detectPlatform,
|
|
@@ -580,6 +594,7 @@ export {
|
|
|
580
594
|
isTransientError,
|
|
581
595
|
isValidRange,
|
|
582
596
|
isValidVersion,
|
|
597
|
+
jobRunUri,
|
|
583
598
|
lazyZ,
|
|
584
599
|
lintServerManifest,
|
|
585
600
|
loadConfig,
|
|
@@ -587,6 +602,7 @@ export {
|
|
|
587
602
|
loadSkillDirectory,
|
|
588
603
|
mapEnvToNestedConfig,
|
|
589
604
|
maxSatisfying,
|
|
605
|
+
mayAccessRun,
|
|
590
606
|
negotiateRemoteProtocol,
|
|
591
607
|
normalizeEsmExport,
|
|
592
608
|
normalizeNameForEnv,
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// libs/sdk/src/job/enclave/browser-enclave-core.ts
|
|
2
|
+
var importEnclaveCore = async () => {
|
|
3
|
+
throw new Error(
|
|
4
|
+
"Dynamic jobs need Node.js: @enclave-vm/core, the sandbox they run in, does not run in a browser or a Worker"
|
|
5
|
+
);
|
|
6
|
+
};
|
|
7
|
+
export {
|
|
8
|
+
importEnclaveCore
|
|
9
|
+
};
|
|
@@ -1,7 +1,5 @@
|
|
|
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
1
|
// libs/sdk/src/job/enclave/job-enclave.bridge.ts
|
|
2
|
+
import { importEnclaveCore } from "./browser-enclave-core.mjs";
|
|
5
3
|
import { EnclaveExecutionError } from "../../errors/index.mjs";
|
|
6
4
|
function toSandboxValue(value) {
|
|
7
5
|
try {
|
|
@@ -21,25 +19,10 @@ var JobEnclaveBridge = class {
|
|
|
21
19
|
maxIterations: options.maxIterations ?? 1e3
|
|
22
20
|
};
|
|
23
21
|
}
|
|
24
|
-
/**
|
|
25
|
-
* Lazy-load @enclave-vm/core.
|
|
26
|
-
*
|
|
27
|
-
* Uses a dynamic `import()` (not `require`) so the SDK's ESM build stays
|
|
28
|
-
* runtime-agnostic and the bundler can treat the enclave sandbox as a lazy
|
|
29
|
-
* optional dependency, matching the rest of the codebase. The full
|
|
30
|
-
* `@enclave-vm/core` is Node-only (it pulls in the `worker_threads`/`node:vm`
|
|
31
|
-
* adapters); the isolate-safe interpreter lives behind `@enclave-vm/core/worker`.
|
|
32
|
-
*/
|
|
22
|
+
/** Lazy-load @enclave-vm/core through `#enclave-core`, a stub in the browser and worker builds: its sandbox is Node-only. */
|
|
33
23
|
async getEnclaveCore() {
|
|
34
24
|
if (!this.enclaveCore) {
|
|
35
|
-
|
|
36
|
-
try {
|
|
37
|
-
mod = await import("@enclave-vm/core");
|
|
38
|
-
} catch {
|
|
39
|
-
throw new Error(
|
|
40
|
-
"Missing optional dependency: dynamic jobs require @enclave-vm/core. Install it with: npm install @enclave-vm/core"
|
|
41
|
-
);
|
|
42
|
-
}
|
|
25
|
+
const mod = await importEnclaveCore();
|
|
43
26
|
const core = typeof mod?.Sandbox === "function" ? mod : mod?.default;
|
|
44
27
|
if (!core || typeof core.Sandbox !== "function") {
|
|
45
28
|
throw new Error(
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
ListRootsResultSchema
|
|
4
4
|
} from "@frontmcp/protocol";
|
|
5
5
|
import { awaitOutsideRequest } from "@frontmcp/utils";
|
|
6
|
-
import {
|
|
6
|
+
import { announcesListChangeNow } from "../surface/list-change-batch.mjs";
|
|
7
7
|
var MCP_APPS_EXTENSION_KEY = "io.modelcontextprotocol/ui";
|
|
8
8
|
function hasMcpAppsExtension(capabilities) {
|
|
9
9
|
const declared = capabilities?.experimental?.[MCP_APPS_EXTENSION_KEY] ?? capabilities?.extensions?.[MCP_APPS_EXTENSION_KEY];
|
|
@@ -159,20 +159,20 @@ var NotificationService = class _NotificationService {
|
|
|
159
159
|
if (event.changeScope === "global") {
|
|
160
160
|
if (event.kind === "updated" && event.updatedUri) {
|
|
161
161
|
this.notifyResourceUpdated(event.updatedUri);
|
|
162
|
-
} else if (
|
|
162
|
+
} else if (announcesListChangeNow(this.scope, "resources")) {
|
|
163
163
|
this.broadcastNotification("notifications/resources/list_changed");
|
|
164
164
|
}
|
|
165
165
|
}
|
|
166
166
|
});
|
|
167
167
|
this.unsubscribers.push(unsubResources);
|
|
168
168
|
const unsubTools = this.scope.tools.subscribe({ immediate: false }, (event) => {
|
|
169
|
-
if (event.changeScope === "global" &&
|
|
169
|
+
if (event.changeScope === "global" && announcesListChangeNow(this.scope, "tools")) {
|
|
170
170
|
this.broadcastNotification("notifications/tools/list_changed");
|
|
171
171
|
}
|
|
172
172
|
});
|
|
173
173
|
this.unsubscribers.push(unsubTools);
|
|
174
174
|
const unsubPrompts = this.scope.prompts.subscribe({ immediate: false }, (event) => {
|
|
175
|
-
if (event.changeScope === "global" &&
|
|
175
|
+
if (event.changeScope === "global" && announcesListChangeNow(this.scope, "prompts")) {
|
|
176
176
|
this.broadcastNotification("notifications/prompts/list_changed");
|
|
177
177
|
}
|
|
178
178
|
});
|
|
@@ -180,7 +180,7 @@ var NotificationService = class _NotificationService {
|
|
|
180
180
|
const skillRegistry = this.scope.skills;
|
|
181
181
|
if (skillRegistry?.subscribe) {
|
|
182
182
|
const unsubSkills = skillRegistry.subscribe({ immediate: false }, (event) => {
|
|
183
|
-
if (event.changeScope === "global") {
|
|
183
|
+
if (event.changeScope === "global" && announcesListChangeNow(this.scope, "skills")) {
|
|
184
184
|
this.broadcastNotification("notifications/skills/list_changed");
|
|
185
185
|
}
|
|
186
186
|
});
|
|
@@ -11,7 +11,13 @@ import {
|
|
|
11
11
|
import { initOptionsOf } from "../common/dynamic/dynamic.plugin.mjs";
|
|
12
12
|
import { collectDynamicProviders, collectDynamicTools, dedupePluginProviders } from "../common/dynamic/dynamic.utils.mjs";
|
|
13
13
|
import { installContextExtensions } from "../context/context-extension.mjs";
|
|
14
|
-
import {
|
|
14
|
+
import {
|
|
15
|
+
DuplicatePluginEntryError,
|
|
16
|
+
DuplicatePluginError,
|
|
17
|
+
InvalidPluginScopeError,
|
|
18
|
+
InvalidRegistryKindError,
|
|
19
|
+
RegistryDependencyNotRegisteredError
|
|
20
|
+
} from "../errors/index.mjs";
|
|
15
21
|
import { normalizeHooksFromCls, normalizeHooksFromProviders } from "../hooks/hooks.utils.mjs";
|
|
16
22
|
import PromptRegistry from "../prompt/prompt.registry.mjs";
|
|
17
23
|
import ProviderRegistry from "../provider/provider.registry.mjs";
|
|
@@ -23,6 +29,7 @@ import SkillRegistry from "../skill/skill.registry.mjs";
|
|
|
23
29
|
import ToolRegistry from "../tool/tool.registry.mjs";
|
|
24
30
|
import { normalizePlugin, pluginDiscoveryDeps } from "./plugin.utils.mjs";
|
|
25
31
|
var installedPluginValues = /* @__PURE__ */ new WeakSet();
|
|
32
|
+
var oncePerServerPlugins = /* @__PURE__ */ new WeakMap();
|
|
26
33
|
function instantiateClassPlugin(klass, depsInstances, recordProviders) {
|
|
27
34
|
if (!isConfiguredByOptions(klass)) {
|
|
28
35
|
return { pluginInstance: new klass(...depsInstances), dynamicProviders: recordProviders, dynamicTools: [] };
|
|
@@ -41,6 +48,35 @@ function isConfiguredByOptions(klass) {
|
|
|
41
48
|
const hooks = klass;
|
|
42
49
|
return typeof hooks.dynamicProviders === "function" || typeof hooks.dynamicTools === "function";
|
|
43
50
|
}
|
|
51
|
+
function pluginListName(owner, hostPluginName) {
|
|
52
|
+
if (hostPluginName !== void 0) return `the plugins of plugin "${hostPluginName}"`;
|
|
53
|
+
if (owner === void 0) return "one plugins list";
|
|
54
|
+
if (owner.kind === "scope") return "@FrontMcp({ plugins })";
|
|
55
|
+
return `the plugins of ${owner.kind} "${owner.id}"`;
|
|
56
|
+
}
|
|
57
|
+
function refuseDuplicateEntries(list, listName) {
|
|
58
|
+
const firstEntries = /* @__PURE__ */ new Map();
|
|
59
|
+
for (const [index, raw] of list.entries()) {
|
|
60
|
+
const { provide, metadata } = normalizePlugin(raw);
|
|
61
|
+
const firstEntry = firstEntries.get(provide);
|
|
62
|
+
if (firstEntry === void 0) {
|
|
63
|
+
firstEntries.set(provide, {
|
|
64
|
+
entryNumber: index + 1,
|
|
65
|
+
name: metadata.name,
|
|
66
|
+
oncePerServer: metadata.oncePerServer !== void 0
|
|
67
|
+
});
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
const sameOncePerServerPlugin = firstEntry.oncePerServer && metadata.oncePerServer !== void 0 && firstEntry.name === metadata.name;
|
|
71
|
+
if (sameOncePerServerPlugin) continue;
|
|
72
|
+
throw new DuplicatePluginEntryError(
|
|
73
|
+
metadata.name ?? tokenName(provide),
|
|
74
|
+
listName,
|
|
75
|
+
firstEntry.entryNumber,
|
|
76
|
+
index + 1
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
44
80
|
var PluginRegistry = class _PluginRegistry extends RegistryAbstract {
|
|
45
81
|
/** providers by token */
|
|
46
82
|
pProviders = /* @__PURE__ */ new Map();
|
|
@@ -60,7 +96,8 @@ var PluginRegistry = class _PluginRegistry extends RegistryAbstract {
|
|
|
60
96
|
scopeInfo;
|
|
61
97
|
owner;
|
|
62
98
|
logger;
|
|
63
|
-
constructor(providers, list, owner, scopeInfo) {
|
|
99
|
+
constructor(providers, list, owner, scopeInfo, hostPluginName) {
|
|
100
|
+
refuseDuplicateEntries(list, pluginListName(owner, hostPluginName));
|
|
64
101
|
super("PluginRegistry", providers, list);
|
|
65
102
|
this.scope = providers.getActiveScope();
|
|
66
103
|
this.scopeInfo = scopeInfo;
|
|
@@ -94,6 +131,7 @@ var PluginRegistry = class _PluginRegistry extends RegistryAbstract {
|
|
|
94
131
|
const graph = /* @__PURE__ */ new Map();
|
|
95
132
|
for (const raw of list) {
|
|
96
133
|
const rec = normalizePlugin(raw);
|
|
134
|
+
this.claimOncePerServer(rec.metadata);
|
|
97
135
|
const provide = rec.provide;
|
|
98
136
|
tokens.add(provide);
|
|
99
137
|
defs.set(provide, rec);
|
|
@@ -101,6 +139,15 @@ var PluginRegistry = class _PluginRegistry extends RegistryAbstract {
|
|
|
101
139
|
}
|
|
102
140
|
return { tokens, defs, graph };
|
|
103
141
|
}
|
|
142
|
+
/** Refuses a second install in this server of a plugin that can be installed once per server. */
|
|
143
|
+
claimOncePerServer({ name, oncePerServer }) {
|
|
144
|
+
if (oncePerServer === void 0) return;
|
|
145
|
+
const scope = this.providers.getActiveScope();
|
|
146
|
+
const installed = oncePerServerPlugins.get(scope) ?? /* @__PURE__ */ new Set();
|
|
147
|
+
if (installed.has(name)) throw new DuplicatePluginError(name, oncePerServer);
|
|
148
|
+
installed.add(name);
|
|
149
|
+
oncePerServerPlugins.set(scope, installed);
|
|
150
|
+
}
|
|
104
151
|
buildGraph() {
|
|
105
152
|
for (const token of this.tokens) {
|
|
106
153
|
const rec = this.defs.get(token);
|
|
@@ -134,7 +181,13 @@ var PluginRegistry = class _PluginRegistry extends RegistryAbstract {
|
|
|
134
181
|
ref: token
|
|
135
182
|
};
|
|
136
183
|
const nestedHookOwner = this.owner?.kind === "app" || this.owner?.kind === "agent" || this.owner?.kind === "scope" ? this.owner : pluginOwner;
|
|
137
|
-
const plugins = new _PluginRegistry(
|
|
184
|
+
const plugins = new _PluginRegistry(
|
|
185
|
+
providers,
|
|
186
|
+
rec.metadata.plugins ?? [],
|
|
187
|
+
nestedHookOwner,
|
|
188
|
+
this.scopeInfo,
|
|
189
|
+
rec.metadata.name
|
|
190
|
+
);
|
|
138
191
|
await plugins.ready;
|
|
139
192
|
const adapters = new AdapterRegistry(providers, rec.metadata.adapters ?? []);
|
|
140
193
|
await adapters.ready;
|
|
@@ -340,6 +340,7 @@ var ProviderRegistry = class _ProviderRegistry extends RegistryAbstract {
|
|
|
340
340
|
}
|
|
341
341
|
}
|
|
342
342
|
async resolveFactoryArg(t, store, scopeKey) {
|
|
343
|
+
if (t === _ProviderRegistry) return this;
|
|
343
344
|
if (store.has(t)) return store.get(t);
|
|
344
345
|
if (this.instances.has(t)) return this.instances.get(t);
|
|
345
346
|
const rec = this.defs.get(t);
|
|
@@ -1012,6 +1013,7 @@ var ProviderRegistry = class _ProviderRegistry extends RegistryAbstract {
|
|
|
1012
1013
|
* Resolve a dependency from the available views (context \u2192 global).
|
|
1013
1014
|
*/
|
|
1014
1015
|
async resolveFromViews(token, contextStore, globalStore, scopeKey) {
|
|
1016
|
+
if (token === _ProviderRegistry) return this;
|
|
1015
1017
|
if (contextStore.has(token)) return contextStore.get(token);
|
|
1016
1018
|
if (globalStore.has(token)) return globalStore.get(token);
|
|
1017
1019
|
if (this.instances.has(token)) return this.instances.get(token);
|
|
@@ -23,6 +23,8 @@ import { ListResourcesRequestSchema, ListResourcesResultSchema } from "@frontmcp
|
|
|
23
23
|
import { annotationsForClient, callerClientProfile } from "../../answer/index.mjs";
|
|
24
24
|
import { callSurfaceOf, isOfferedOnSurface } from "../../common/availability/index.mjs";
|
|
25
25
|
import { InvalidInputError, InvalidMethodError } from "../../errors/index.mjs";
|
|
26
|
+
import { SEP_2640_META_NAMESPACE } from "../../skill/sep-2640/sep-2640.constants.mjs";
|
|
27
|
+
import { filterServableSkills } from "../../skill/skill-filter.helper.mjs";
|
|
26
28
|
import { enabledItems, SURFACE_META_KEY, surfaceHash } from "../../surface/index.mjs";
|
|
27
29
|
var inputSchema = z.object({
|
|
28
30
|
request: ListResourcesRequestSchema,
|
|
@@ -47,7 +49,7 @@ var stateSchema = z.object({
|
|
|
47
49
|
});
|
|
48
50
|
var plan = {
|
|
49
51
|
pre: ["parseInput", "ensureRemoteCapabilities"],
|
|
50
|
-
execute: ["findResources", "filterByEnabled", "filterByAuthorities", "resolveConflicts"],
|
|
52
|
+
execute: ["findResources", "filterByEnabled", "filterByAuthorities", "filterSkillResources", "resolveConflicts"],
|
|
51
53
|
post: ["parseResources"]
|
|
52
54
|
};
|
|
53
55
|
var name = "resources:list-resources";
|
|
@@ -168,6 +170,31 @@ var ResourcesListFlow = class extends FlowBase {
|
|
|
168
170
|
);
|
|
169
171
|
this.logger.verbose("filterByAuthorities:done");
|
|
170
172
|
}
|
|
173
|
+
async filterSkillResources() {
|
|
174
|
+
const { resources } = this.state.required;
|
|
175
|
+
const skillRegistry = this.scope.skills;
|
|
176
|
+
if (!skillRegistry?.hasAny()) return;
|
|
177
|
+
const skillsByPath = /* @__PURE__ */ new Map();
|
|
178
|
+
for (const skill of skillRegistry.getSkills({ visibility: "mcp" })) {
|
|
179
|
+
if (!skillsByPath.has(skill.getSkillPath())) skillsByPath.set(skill.getSkillPath(), skill);
|
|
180
|
+
}
|
|
181
|
+
const skillOfResource = /* @__PURE__ */ new Map();
|
|
182
|
+
for (const item of resources) {
|
|
183
|
+
const skillPath = item.resource.metadata._meta?.[`${SEP_2640_META_NAMESPACE}path`];
|
|
184
|
+
if (typeof skillPath === "string") skillOfResource.set(item, skillsByPath.get(skillPath));
|
|
185
|
+
}
|
|
186
|
+
if (skillOfResource.size === 0) return;
|
|
187
|
+
const listedSkills = [...skillOfResource.values()].filter((skill) => skill !== void 0);
|
|
188
|
+
const ctx = this.rawInput?.ctx;
|
|
189
|
+
const servableSkills = new Set(await filterServableSkills(this.scope, listedSkills, ctx));
|
|
190
|
+
this.state.set(
|
|
191
|
+
"resources",
|
|
192
|
+
resources.filter((item) => {
|
|
193
|
+
const skill = skillOfResource.get(item);
|
|
194
|
+
return skill === void 0 || servableSkills.has(skill);
|
|
195
|
+
})
|
|
196
|
+
);
|
|
197
|
+
}
|
|
171
198
|
async resolveConflicts() {
|
|
172
199
|
this.logger.verbose("resolveConflicts:start");
|
|
173
200
|
try {
|
|
@@ -270,6 +297,9 @@ __decorateClass([
|
|
|
270
297
|
__decorateClass([
|
|
271
298
|
Stage("filterByAuthorities")
|
|
272
299
|
], ResourcesListFlow.prototype, "filterByAuthorities", 1);
|
|
300
|
+
__decorateClass([
|
|
301
|
+
Stage("filterSkillResources")
|
|
302
|
+
], ResourcesListFlow.prototype, "filterSkillResources", 1);
|
|
273
303
|
__decorateClass([
|
|
274
304
|
Stage("resolveConflicts")
|
|
275
305
|
], ResourcesListFlow.prototype, "resolveConflicts", 1);
|
|
@@ -3,12 +3,16 @@ import { getEnv } from "@frontmcp/utils";
|
|
|
3
3
|
import { normalizePlugin } from "../plugin/plugin.utils.mjs";
|
|
4
4
|
function devEventsObservabilityConfig(installedPlugins) {
|
|
5
5
|
const underFrontmcpDev = !!getEnv("FRONTMCP_DEV_EVENTS_FILE") || getEnv("FRONTMCP_DEV_EVENTS_IPC") === "1";
|
|
6
|
-
if (!underFrontmcpDev) return void 0;
|
|
7
|
-
for (const plugin of installedPlugins) {
|
|
8
|
-
if (normalizePlugin(plugin).metadata.name === "observability") return void 0;
|
|
9
|
-
}
|
|
6
|
+
if (!underFrontmcpDev || listsObservabilityPlugin(installedPlugins)) return void 0;
|
|
10
7
|
return { tracing: false, logging: false };
|
|
11
8
|
}
|
|
9
|
+
function listsObservabilityPlugin(plugins) {
|
|
10
|
+
for (const plugin of plugins) {
|
|
11
|
+
if (normalizePlugin(plugin).metadata.name === "observability") return true;
|
|
12
|
+
}
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
12
15
|
export {
|
|
13
|
-
devEventsObservabilityConfig
|
|
16
|
+
devEventsObservabilityConfig,
|
|
17
|
+
listsObservabilityPlugin
|
|
14
18
|
};
|
|
@@ -31,7 +31,7 @@ import CompleteFlow from "../completion/flows/complete.flow.mjs";
|
|
|
31
31
|
import { FrontMcpContextProvider, FrontMcpContextStorage } from "../context/index.mjs";
|
|
32
32
|
import { proxyTrustOf } from "../context/metadata.utils.mjs";
|
|
33
33
|
import { AuthConfigurationError, FlowExitedWithoutOutputError } from "../errors/index.mjs";
|
|
34
|
-
import { UnenforcedMetadataError } from "../errors/plugin.errors.mjs";
|
|
34
|
+
import { PluginConfiguredTwiceError, UnenforcedMetadataError } from "../errors/plugin.errors.mjs";
|
|
35
35
|
import FlowRegistry from "../flows/flow.registry.mjs";
|
|
36
36
|
import { assertAuthoritiesRules } from "../front-mcp/authorities-rules.check.mjs";
|
|
37
37
|
import { isEntryServer, isJobWorker } from "../front-mcp/detached-job.flag.mjs";
|
|
@@ -64,7 +64,7 @@ import { hasUIConfig, ToolUIRegistry } from "../tool/ui/ui-shared.mjs";
|
|
|
64
64
|
import { warnIfRequestStateKeyNotShared } from "../transport/mcp-20260728/request-state.mjs";
|
|
65
65
|
import { warnIfSessionModeIgnored } from "../transport/session-mode.check.mjs";
|
|
66
66
|
import { guardStorageInBrowser, refuseServerStoresInBrowser, refuseStoresInBrowser } from "./browser-stores.mjs";
|
|
67
|
-
import { devEventsObservabilityConfig } from "./dev-events-observability.mjs";
|
|
67
|
+
import { devEventsObservabilityConfig, listsObservabilityPlugin } from "./dev-events-observability.mjs";
|
|
68
68
|
import { registerServerEntries } from "./server-entries.helper.mjs";
|
|
69
69
|
import { reportStartup } from "./startup-report.helper.mjs";
|
|
70
70
|
var SCOPE_NON_DISPATCHABLE_FLOWS = /* @__PURE__ */ new Set(["http:request"]);
|
|
@@ -187,6 +187,10 @@ var Scope = class _Scope extends ScopeEntry {
|
|
|
187
187
|
const mark = perf ? (label) => this.logger.info(`[PERF] ${label}: ${(performance.now() - t0).toFixed(1)}ms`) : () => {
|
|
188
188
|
};
|
|
189
189
|
await refuseStoresInBrowser(this.metadata);
|
|
190
|
+
if (this.metadata.authProvidersVault) {
|
|
191
|
+
const { registerAuthProvidersVault } = await import("../auth/vault/auth-providers.providers.mjs");
|
|
192
|
+
await registerAuthProvidersVault(scopeProviders, this.metadata.authProvidersVault);
|
|
193
|
+
}
|
|
190
194
|
const httpServing = this.directOnly ? void 0 : await import("./http-scope.helper.mjs");
|
|
191
195
|
const createPrimaryAuth = await this.primaryAuthFactory();
|
|
192
196
|
this.scopeHooks = new HookRegistry(scopeProviders, []);
|
|
@@ -271,13 +275,14 @@ var Scope = class _Scope extends ScopeEntry {
|
|
|
271
275
|
autoEnabled: !transportConfig?.eventStore && isDistributed
|
|
272
276
|
});
|
|
273
277
|
}
|
|
274
|
-
const
|
|
275
|
-
const
|
|
278
|
+
const elicitationConfigured = this.metadata.elicitation?.enabled === true;
|
|
279
|
+
const elicitationEnabled = elicitationConfigured && !this.cliMode;
|
|
280
|
+
const elicitationPromise = elicitationConfigured ? (async () => {
|
|
276
281
|
const inheritedRedis = this.metadata.elicitation?.redis ?? this.metadata.redis;
|
|
277
|
-
const elicitationInMemory = this.metadata.elicitation?.store === false;
|
|
282
|
+
const elicitationInMemory = this.cliMode || this.metadata.elicitation?.store === false;
|
|
278
283
|
const elicitationRedis = elicitationInMemory ? void 0 : inheritedRedis;
|
|
279
284
|
const elicitationSqlite = elicitationInMemory || elicitationRedis ? void 0 : resolvedTopLevelSqlite;
|
|
280
|
-
const persistent = this.metadata.elicitation?.persistent;
|
|
285
|
+
const persistent = this.cliMode ? void 0 : this.metadata.elicitation?.persistent;
|
|
281
286
|
const questionsHelper = persistent ? await import("../elicitation/questions/question-scope.helper.mjs") : void 0;
|
|
282
287
|
const onEdgeRuntime2 = isEdgeRuntime();
|
|
283
288
|
const questionsStorage = questionsHelper?.persistentQuestionsSettings(persistent, onEdgeRuntime2).storage;
|
|
@@ -446,6 +451,9 @@ var Scope = class _Scope extends ScopeEntry {
|
|
|
446
451
|
const impliedObservability = this.metadata.observability === void 0 ? devEventsObservabilityConfig([...serverPlugins, ...appPlugins]) : void 0;
|
|
447
452
|
const observabilityConfig = this.metadata.observability ?? impliedObservability;
|
|
448
453
|
if (observabilityConfig) {
|
|
454
|
+
if (listsObservabilityPlugin(serverPlugins)) {
|
|
455
|
+
throw new PluginConfiguredTwiceError("ObservabilityPlugin", "observability");
|
|
456
|
+
}
|
|
449
457
|
const { observabilityPlugins } = await import("./observability-scope.helper.mjs");
|
|
450
458
|
serverPlugins.push(
|
|
451
459
|
...observabilityPlugins({
|
|
@@ -486,6 +494,7 @@ var Scope = class _Scope extends ScopeEntry {
|
|
|
486
494
|
const skillsConfig = this.metadata.skillsConfig;
|
|
487
495
|
this.scopeSkills = new SkillRegistry(this.scopeProviders, this.metadata.skills ?? [], scopeRef, {
|
|
488
496
|
...skillsConfig?.scoring ? { scoring: skillsConfig.scoring } : {},
|
|
497
|
+
...skillsConfig?.decision ? { decision: skillsConfig.decision } : {},
|
|
489
498
|
...skillsConfig?.failOnInvalidSkills !== void 0 && { failOnInvalidSkills: skillsConfig.failOnInvalidSkills }
|
|
490
499
|
});
|
|
491
500
|
await Promise.all([
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// libs/sdk/src/server/server.validation.ts
|
|
2
2
|
import { base64Decode } from "@frontmcp/utils";
|
|
3
3
|
import { httpOutputSchema, serializeHttpCookie } from "../common/index.mjs";
|
|
4
|
+
import { toLocationHeader } from "../utils/http-location.utils.mjs";
|
|
4
5
|
function applyHeaders(res, headers) {
|
|
5
6
|
if (!headers) return;
|
|
6
7
|
for (const [k, v] of Object.entries(headers)) {
|
|
@@ -74,12 +75,8 @@ async function writeHttpResponse(res, value) {
|
|
|
74
75
|
}
|
|
75
76
|
switch (out.kind) {
|
|
76
77
|
case "redirect": {
|
|
77
|
-
res.setHeader("Location", out.location);
|
|
78
|
-
|
|
79
|
-
res.redirect(out.location);
|
|
80
|
-
} else {
|
|
81
|
-
res.status(out.status).end();
|
|
82
|
-
}
|
|
78
|
+
res.setHeader("Location", toLocationHeader(out.location));
|
|
79
|
+
res.status(out.status).end();
|
|
83
80
|
return;
|
|
84
81
|
}
|
|
85
82
|
case "json": {
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
// libs/sdk/src/skill/decision/decisions-api.decider.ts
|
|
2
|
+
import { sha256Hex } from "@frontmcp/utils";
|
|
3
|
+
var NO_SKILL_CHOICE = "__none__";
|
|
4
|
+
function withoutTrailingSlashes(url) {
|
|
5
|
+
let end = url.length;
|
|
6
|
+
while (end > 0 && url[end - 1] === "/") end--;
|
|
7
|
+
return url.slice(0, end);
|
|
8
|
+
}
|
|
9
|
+
function catalogText(candidates) {
|
|
10
|
+
const lines = candidates.map((c) => {
|
|
11
|
+
const tags = c.tags?.length ? ` [${c.tags.join(", ")}]` : "";
|
|
12
|
+
return `- ${c.id}: ${c.name}: ${c.description}${tags}`;
|
|
13
|
+
});
|
|
14
|
+
return `These are the skills of a server. A skill is a playbook for a kind of task.
|
|
15
|
+
|
|
16
|
+
${lines.join("\n")}`;
|
|
17
|
+
}
|
|
18
|
+
function decisionsApiDecider(options) {
|
|
19
|
+
const baseUrl = withoutTrailingSlashes(options.baseUrl ?? "https://api.openai.com/v1");
|
|
20
|
+
const model = options.model ?? "gpt-6-luna";
|
|
21
|
+
return async ({ query, notQuery, candidates, signal }) => {
|
|
22
|
+
if (candidates.length === 0) return [];
|
|
23
|
+
const catalog = catalogText(candidates);
|
|
24
|
+
const unwanted = notQuery.length > 0 ? ` The user does not want: ${notQuery.join("; ")}.` : "";
|
|
25
|
+
const doFetch = options.fetch ?? fetch;
|
|
26
|
+
const response = await doFetch(`${baseUrl}/decisions`, {
|
|
27
|
+
method: "POST",
|
|
28
|
+
headers: { "content-type": "application/json", authorization: `Bearer ${options.apiKey}` },
|
|
29
|
+
signal,
|
|
30
|
+
body: JSON.stringify({
|
|
31
|
+
model,
|
|
32
|
+
input: catalog,
|
|
33
|
+
prompt_cache_key: `skills-${sha256Hex(catalog).slice(0, 32)}`,
|
|
34
|
+
questions: [
|
|
35
|
+
{
|
|
36
|
+
type: "choice",
|
|
37
|
+
name: "skill",
|
|
38
|
+
instructions: `Which skill best handles this request: "${query}"?${unwanted}`,
|
|
39
|
+
choices: [
|
|
40
|
+
...candidates.map((c) => ({ value: c.id, description: c.name })),
|
|
41
|
+
{ value: NO_SKILL_CHOICE, description: "None of these skills fits the request." }
|
|
42
|
+
]
|
|
43
|
+
}
|
|
44
|
+
]
|
|
45
|
+
})
|
|
46
|
+
});
|
|
47
|
+
if (!response.ok) {
|
|
48
|
+
throw new Error(`the Decisions API answered ${response.status}`);
|
|
49
|
+
}
|
|
50
|
+
const decision = await response.json();
|
|
51
|
+
const answer = decision.answers?.[0];
|
|
52
|
+
if (!answer || answer.type !== "choice" || !Array.isArray(answer.probabilities)) {
|
|
53
|
+
throw new Error(`the Decisions API answered with no choice (${answer?.type ?? "no answer"})`);
|
|
54
|
+
}
|
|
55
|
+
const ids = new Set(candidates.map((c) => c.id));
|
|
56
|
+
return answer.probabilities.filter((p) => typeof p.value === "string" && ids.has(p.value)).map((p) => ({ id: p.value, probability: p.probability }));
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
export {
|
|
60
|
+
NO_SKILL_CHOICE,
|
|
61
|
+
decisionsApiDecider
|
|
62
|
+
};
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
// libs/sdk/src/skill/decision/skill-decision.ranker.ts
|
|
2
|
+
import { sha256Hex } from "@frontmcp/utils";
|
|
3
|
+
var MAX_DECISION_CANDIDATES = 254;
|
|
4
|
+
var DEFAULTS = { maxCandidates: 50, minProbability: 0.1, timeoutMs: 5e3, ttlMs: 6e5, maxEntries: 500 };
|
|
5
|
+
function isProbability(value) {
|
|
6
|
+
return typeof value === "number" && Number.isFinite(value) && value >= 0 && value <= 1;
|
|
7
|
+
}
|
|
8
|
+
var SkillDecisionRanker = class {
|
|
9
|
+
constructor(options, logger) {
|
|
10
|
+
this.options = options;
|
|
11
|
+
this.logger = logger;
|
|
12
|
+
this.maxCandidates = Math.min(
|
|
13
|
+
Math.max(options.maxCandidates ?? DEFAULTS.maxCandidates, 1),
|
|
14
|
+
MAX_DECISION_CANDIDATES
|
|
15
|
+
);
|
|
16
|
+
this.minProbability = options.minProbability ?? DEFAULTS.minProbability;
|
|
17
|
+
this.timeoutMs = options.timeoutMs ?? DEFAULTS.timeoutMs;
|
|
18
|
+
if (options.cache !== false) {
|
|
19
|
+
this.cache = {
|
|
20
|
+
ttlMs: options.cache?.ttlMs ?? DEFAULTS.ttlMs,
|
|
21
|
+
maxEntries: options.cache?.maxEntries ?? DEFAULTS.maxEntries,
|
|
22
|
+
entries: /* @__PURE__ */ new Map()
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
options;
|
|
27
|
+
logger;
|
|
28
|
+
maxCandidates;
|
|
29
|
+
minProbability;
|
|
30
|
+
timeoutMs;
|
|
31
|
+
cache;
|
|
32
|
+
/**
|
|
33
|
+
* `pool`, the index's candidates, ranked by the decision model: each scored by its probability, those under
|
|
34
|
+
* `minProbability` left out, at most `topK`. `undefined` when the model failed, timed out or was refused (logged),
|
|
35
|
+
* for the caller to keep the index's ranking.
|
|
36
|
+
*/
|
|
37
|
+
async rank(query, negativeQuery, pool, topK) {
|
|
38
|
+
const candidatePool = pool.slice(0, this.maxCandidates);
|
|
39
|
+
if (candidatePool.length === 0) return [];
|
|
40
|
+
const notQuery = negativeQuery === void 0 ? [] : typeof negativeQuery === "string" ? [negativeQuery] : negativeQuery;
|
|
41
|
+
const candidates = candidatePool.map((r) => ({
|
|
42
|
+
id: r.metadata.id ?? r.metadata.name,
|
|
43
|
+
name: r.metadata.name,
|
|
44
|
+
description: r.metadata.description ?? "",
|
|
45
|
+
...r.metadata.tags?.length ? { tags: [...r.metadata.tags] } : {}
|
|
46
|
+
}));
|
|
47
|
+
const decisions = await this.decide(query, notQuery, candidates);
|
|
48
|
+
if (!decisions) return void 0;
|
|
49
|
+
const probabilityOf = new Map(decisions.map((d) => [d.id, d.probability]));
|
|
50
|
+
const ranked = candidatePool.map((result, i) => ({ ...result, score: probabilityOf.get(candidates[i].id) ?? 0 })).filter((result) => result.score >= this.minProbability).sort((a, b) => b.score - a.score);
|
|
51
|
+
return typeof topK === "number" && topK >= 0 ? ranked.slice(0, topK) : ranked;
|
|
52
|
+
}
|
|
53
|
+
async decide(query, notQuery, candidates) {
|
|
54
|
+
const key = this.cache ? sha256Hex(JSON.stringify([query, notQuery, candidates])) : "";
|
|
55
|
+
const cached = this.cache?.entries.get(key);
|
|
56
|
+
if (cached && cached.expiresAt > Date.now()) return cached.decisions;
|
|
57
|
+
const controller = new AbortController();
|
|
58
|
+
let timer;
|
|
59
|
+
const timeout = new Promise((_, reject) => {
|
|
60
|
+
timer = setTimeout(() => {
|
|
61
|
+
controller.abort();
|
|
62
|
+
reject(new Error(`no decision within ${this.timeoutMs} ms`));
|
|
63
|
+
}, this.timeoutMs);
|
|
64
|
+
});
|
|
65
|
+
let decisions;
|
|
66
|
+
try {
|
|
67
|
+
decisions = await Promise.race([
|
|
68
|
+
this.options.decider({ query, notQuery, candidates, signal: controller.signal }),
|
|
69
|
+
timeout
|
|
70
|
+
]);
|
|
71
|
+
const invalid = decisions.find((decision) => !isProbability(decision.probability));
|
|
72
|
+
if (invalid) throw new Error(`the decision for "${invalid.id}" has no probability from 0 to 1`);
|
|
73
|
+
} catch (error) {
|
|
74
|
+
this.logger.warn("skill search: the decision model failed; results are ranked by the index", {
|
|
75
|
+
error: error instanceof Error ? error.message : String(error)
|
|
76
|
+
});
|
|
77
|
+
return void 0;
|
|
78
|
+
} finally {
|
|
79
|
+
clearTimeout(timer);
|
|
80
|
+
}
|
|
81
|
+
if (this.cache) {
|
|
82
|
+
this.cache.entries.delete(key);
|
|
83
|
+
this.cache.entries.set(key, { expiresAt: Date.now() + this.cache.ttlMs, decisions });
|
|
84
|
+
while (this.cache.entries.size > this.cache.maxEntries) {
|
|
85
|
+
const oldest = this.cache.entries.keys().next().value;
|
|
86
|
+
if (oldest === void 0) break;
|
|
87
|
+
this.cache.entries.delete(oldest);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return decisions;
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
export {
|
|
94
|
+
MAX_DECISION_CANDIDATES,
|
|
95
|
+
SkillDecisionRanker
|
|
96
|
+
};
|