@frontmcp/sdk 1.12.0 → 1.12.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/agent/agent.instance.d.ts +3 -0
- package/agent/agent.instance.d.ts.map +1 -1
- package/agent/agent.registry.d.ts.map +1 -1
- package/agent/flows/call-agent.flow.d.ts +1 -1
- package/agent/flows/call-agent.flow.d.ts.map +1 -1
- package/answer/answer-budget.d.ts.map +1 -1
- package/answer/client-profile.d.ts.map +1 -1
- package/auth/auth-ui/auth-ui.registry.d.ts.map +1 -1
- package/auth/auth.registry.d.ts.map +1 -1
- package/auth/authorized-apps.utils.d.ts +8 -0
- package/auth/authorized-apps.utils.d.ts.map +1 -1
- package/auth/flows/form-body.utils.d.ts.map +1 -1
- package/auth/flows/oauth.authorize.flow.d.ts +3 -1
- package/auth/flows/oauth.authorize.flow.d.ts.map +1 -1
- package/auth/flows/oauth.callback.flow.d.ts.map +1 -1
- package/auth/flows/oauth.register.flow.d.ts +5 -0
- package/auth/flows/oauth.register.flow.d.ts.map +1 -1
- package/auth/flows/oauth.token.flow.d.ts +3 -2
- package/auth/flows/oauth.token.flow.d.ts.map +1 -1
- package/auth/instances/instance.local-primary-auth.d.ts.map +1 -1
- package/auth/session/session-store.factory.d.ts.map +1 -1
- package/browser/agent/agent.instance.mjs +4 -0
- package/browser/agent/agent.registry.mjs +2 -2
- package/browser/agent/flows/call-agent.flow.mjs +10 -6
- package/browser/answer/answer-budget.mjs +35 -7
- package/browser/answer/client-profile.mjs +3 -3
- package/browser/auth/auth-ui/auth-ui.registry.mjs +8 -0
- package/browser/auth/auth.registry.mjs +4 -0
- package/browser/auth/authorized-apps.utils.mjs +5 -0
- package/browser/auth/flows/form-body.utils.mjs +4 -2
- package/browser/auth/flows/oauth.authorize.flow.mjs +38 -6
- package/browser/auth/flows/oauth.callback.flow.mjs +30 -16
- package/browser/auth/flows/oauth.register.flow.mjs +17 -5
- package/browser/auth/flows/oauth.token.flow.mjs +17 -8
- package/browser/auth/instances/instance.local-primary-auth.mjs +11 -2
- package/browser/auth/session/session-store.factory.mjs +5 -1
- package/browser/builtin/authorities/authorities-not-configured.mjs +5 -0
- package/browser/channel/channel-notification.service.mjs +16 -12
- package/browser/channel/channel.instance.mjs +9 -12
- package/browser/channel/channel.utils.mjs +18 -3
- package/browser/channel/flows/send-channel-notification.flow.mjs +4 -2
- package/browser/common/metadata/app.metadata.mjs +2 -1
- package/browser/common/metadata/event.metadata.mjs +10 -10
- package/browser/common/schemas/http-output.schema.mjs +6 -1
- package/browser/common/types/options/metrics/schema.mjs +2 -1
- package/browser/common/utils/content-disposition.utils.mjs +7 -0
- package/browser/common/utils/forward-headers.utils.mjs +5 -5
- package/browser/common/utils/issuer-subject.utils.mjs +17 -0
- package/browser/completion/flows/complete.flow.mjs +9 -1
- package/browser/context/frontmcp-context.mjs +5 -1
- package/browser/direct/connect.mjs +14 -4
- package/browser/direct/direct-server.mjs +3 -1
- package/browser/duty/duty.lifecycle.mjs +5 -3
- package/browser/duty/lease-store.mjs +6 -2
- package/browser/elicitation/flows/elicitation-request.flow.mjs +3 -2
- package/browser/elicitation/flows/elicitation-result.flow.mjs +5 -4
- package/browser/elicitation/questions/question-scope.helper.mjs +4 -2
- package/browser/elicitation/store/elicitation-store.factory.mjs +17 -9
- package/browser/elicitation/store/encrypted-elicitation.store.mjs +1 -1
- package/browser/elicitation/store/storage-elicitation.store.mjs +83 -63
- package/browser/errors/error-handler.mjs +4 -4
- package/browser/errors/event.errors.mjs +3 -1
- package/browser/errors/misconfiguration.mjs +7 -1
- package/browser/errors/transport.errors.mjs +1 -1
- package/browser/esm-loader/esm-cache.mjs +5 -1
- package/browser/esm-loader/esm-module-loader.mjs +6 -6
- package/browser/esm-loader/version-resolver.mjs +1 -1
- package/browser/event/event-scope.helper.mjs +13 -5
- package/browser/event/flows/event-poll.flow.mjs +1 -1
- package/browser/event/flows/event-publish-http.flow.mjs +24 -4
- package/browser/event/flows/event-stream.flow.mjs +1 -1
- package/browser/ext-apps/ext-apps.handler.mjs +26 -14
- package/browser/flows/flow.registry.mjs +2 -1
- package/browser/front-mcp/authorities-rules.check.mjs +16 -0
- package/browser/front-mcp/front-mcp.mjs +8 -2
- package/browser/index.cjs +2064 -1344
- package/browser/job/execution/job-execution.manager.mjs +5 -5
- package/browser/job/job-permission.guard.mjs +7 -0
- package/browser/job/job-run-access.mjs +12 -2
- package/browser/job/tools/list-jobs.tool.mjs +2 -7
- package/browser/job/tools/remove-job.tool.mjs +6 -0
- package/browser/job/tools/update-job.tool.mjs +3 -0
- package/browser/logger/instances/instance.console-logger.mjs +14 -4
- package/browser/logger/instances/instance.file-logger.mjs +3 -2
- package/browser/logger/session-id-hash.mjs +8 -0
- package/browser/metrics/metrics.service.mjs +2 -1
- package/browser/offload/offload-worker.globals.mjs +3 -3
- package/browser/offload/worker-jobs.mjs +9 -2
- package/browser/offload/worker-resources.mjs +7 -1
- package/browser/plugin/enforced-metadata.check.mjs +24 -7
- package/browser/prompt/flows/get-prompt.flow.mjs +10 -3
- package/browser/prompt/flows/prompts-list.flow.mjs +1 -1
- package/browser/provider/provider.registry.mjs +21 -10
- package/browser/remote-mcp/mcp-client.service.mjs +4 -3
- package/browser/remote-mcp/remote-entries.mjs +15 -1
- package/browser/remote-mcp/remote-oauth.mjs +29 -2
- package/browser/resource/flows/read-resource.flow.mjs +23 -13
- package/browser/resource/flows/resource-templates-list.flow.mjs +1 -1
- package/browser/resource/flows/resources-list.flow.mjs +1 -1
- package/browser/resource/flows/subscribe-resource.flow.mjs +9 -1
- package/browser/resource/resource.instance.mjs +10 -1
- package/browser/scope/flows/http.request.flow.mjs +15 -3
- package/browser/scope/optional-dependency.util.mjs +1 -13
- package/browser/scope/scope.instance.mjs +39 -30
- package/browser/server/security/replaceable-directory.mjs +7 -2
- package/browser/server/security/resolve-allowed-hosts.mjs +3 -3
- package/browser/server/server.validation.mjs +3 -5
- package/browser/skill/cache/skill-http-cache.catalog.mjs +18 -0
- package/browser/skill/flows/http/llm-full-txt.flow.mjs +3 -2
- package/browser/skill/flows/http/llm-txt.flow.mjs +3 -2
- package/browser/skill/flows/load-skill.flow.mjs +10 -3
- package/browser/skill/hooks/skill-tool.hook.mjs +7 -7
- package/browser/skill/sep-2640/sep-2640.resource-helpers.mjs +29 -10
- package/browser/skill/session/skill-session.manager.mjs +32 -35
- package/browser/skill/session/skill-session.types.mjs +2 -0
- package/browser/skill/skill-authorities.helper.mjs +11 -4
- package/browser/skill/skill-directory-loader.mjs +15 -1
- package/browser/skill/skill-filter.helper.mjs +35 -7
- package/browser/skill/skill-md-parser.mjs +17 -2
- package/browser/skill/skill.instance.mjs +7 -0
- package/browser/storage/sqlite-on-edge.mjs +28 -0
- package/browser/task/store/task-store.factory.mjs +8 -3
- package/browser/tool/flows/call-tool.flow.mjs +29 -14
- package/browser/tool/flows/tools-list.flow.mjs +1 -4
- package/browser/transport/adapters/transport.local.adapter.mjs +3 -2
- package/browser/transport/event-stores/event-store.factory.mjs +5 -1
- package/browser/transport/event-stores/redis.event-store.mjs +13 -9
- package/browser/transport/flows/handle.streamable-http.flow.mjs +13 -6
- package/browser/transport/in-memory-server.mjs +5 -3
- package/browser/transport/mcp-20260728/client/mcp-stateless.client.mjs +25 -6
- package/browser/transport/mcp-20260728/dispatcher.mjs +4 -9
- package/browser/transport/mcp-handlers/index.mjs +19 -1
- package/browser/transport/mcp-handlers/skills-list-request.handler.mjs +2 -1
- package/browser/transport/mcp-handlers/skills-mcp.types.mjs +3 -1
- package/browser/transport/web-fetch-handler.mjs +3 -3
- package/browser/transport/web-response.renderer.mjs +5 -4
- package/browser/transport/web-standard-mcp.mjs +2 -2
- package/browser/worker/worker.lifecycle.mjs +7 -4
- package/browser/workflow/tools/list-workflows.tool.mjs +6 -7
- package/browser/workflow/tools/register-workflow.tool.mjs +3 -2
- package/browser/workflow/tools/remove-workflow.tool.mjs +6 -0
- package/browser/workflow/tools/runtime-workflow.limits.mjs +5 -0
- package/browser/workflow/tools/update-workflow.tool.mjs +6 -2
- package/browser/workflow/trigger/workflow-webhook.routes.mjs +15 -6
- package/browser/workflow/trigger/workflow-webhook.signature.mjs +5 -8
- package/builtin/authorities/authorities-not-configured.d.ts +3 -0
- package/builtin/authorities/authorities-not-configured.d.ts.map +1 -0
- package/channel/channel-notification.service.d.ts +8 -3
- package/channel/channel-notification.service.d.ts.map +1 -1
- package/channel/channel.instance.d.ts +10 -8
- package/channel/channel.instance.d.ts.map +1 -1
- package/channel/channel.utils.d.ts +6 -1
- package/channel/channel.utils.d.ts.map +1 -1
- package/channel/flows/send-channel-notification.flow.d.ts +1 -1
- package/channel/flows/send-channel-notification.flow.d.ts.map +1 -1
- package/common/entries/channel.entry.d.ts +1 -1
- package/common/entries/channel.entry.d.ts.map +1 -1
- package/common/metadata/app.metadata.d.ts +11 -3
- package/common/metadata/app.metadata.d.ts.map +1 -1
- package/common/metadata/channel.metadata.d.ts +7 -4
- package/common/metadata/channel.metadata.d.ts.map +1 -1
- package/common/metadata/duty.metadata.d.ts +1 -1
- package/common/metadata/duty.metadata.d.ts.map +1 -1
- package/common/metadata/event.metadata.d.ts +15 -12
- package/common/metadata/event.metadata.d.ts.map +1 -1
- package/common/metadata/front-mcp.metadata.d.ts +59 -59
- package/common/metadata/worker.metadata.d.ts +1 -1
- package/common/metadata/worker.metadata.d.ts.map +1 -1
- package/common/schemas/http-output.schema.d.ts +1 -1
- package/common/schemas/http-output.schema.d.ts.map +1 -1
- package/common/types/options/http/interfaces.d.ts +3 -2
- package/common/types/options/http/interfaces.d.ts.map +1 -1
- package/common/types/options/metrics/interfaces.d.ts +3 -2
- package/common/types/options/metrics/interfaces.d.ts.map +1 -1
- package/common/types/options/metrics/schema.d.ts +1 -1
- package/common/types/options/metrics/schema.d.ts.map +1 -1
- package/common/utils/content-disposition.utils.d.ts +6 -0
- package/common/utils/content-disposition.utils.d.ts.map +1 -0
- package/common/utils/issuer-subject.utils.d.ts +8 -0
- package/common/utils/issuer-subject.utils.d.ts.map +1 -0
- package/completion/flows/complete.flow.d.ts.map +1 -1
- package/context/frontmcp-context.d.ts +5 -1
- package/context/frontmcp-context.d.ts.map +1 -1
- package/direct/connect.d.ts.map +1 -1
- package/direct/direct-server.d.ts.map +1 -1
- package/duty/duty.lifecycle.d.ts +1 -1
- package/duty/duty.lifecycle.d.ts.map +1 -1
- package/duty/lease-store.d.ts +4 -2
- package/duty/lease-store.d.ts.map +1 -1
- package/elicitation/flows/elicitation-request.flow.d.ts.map +1 -1
- package/elicitation/flows/elicitation-result.flow.d.ts.map +1 -1
- package/elicitation/questions/question-scope.helper.d.ts +4 -1
- package/elicitation/questions/question-scope.helper.d.ts.map +1 -1
- package/elicitation/store/elicitation-store.factory.d.ts.map +1 -1
- package/elicitation/store/elicitation.store.d.ts +8 -8
- package/elicitation/store/storage-elicitation.store.d.ts +11 -11
- package/elicitation/store/storage-elicitation.store.d.ts.map +1 -1
- package/errors/duty.errors.d.ts +1 -1
- package/errors/duty.errors.d.ts.map +1 -1
- package/errors/error-handler.d.ts.map +1 -1
- package/errors/event.errors.d.ts +9 -2
- package/errors/event.errors.d.ts.map +1 -1
- package/errors/misconfiguration.d.ts +10 -0
- package/errors/misconfiguration.d.ts.map +1 -1
- package/errors/worker.errors.d.ts +1 -1
- package/esm/index.mjs +63 -59
- package/esm-loader/esm-cache.d.ts.map +1 -1
- package/esm-loader/esm-module-loader.d.ts.map +1 -1
- package/event/event-scope.helper.d.ts.map +1 -1
- package/event/flows/event-publish-http.flow.d.ts +5 -2
- package/event/flows/event-publish-http.flow.d.ts.map +1 -1
- package/ext-apps/ext-apps.handler.d.ts +3 -0
- package/ext-apps/ext-apps.handler.d.ts.map +1 -1
- package/flows/flow.registry.d.ts.map +1 -1
- package/front-mcp/authorities-rules.check.d.ts +2 -1
- package/front-mcp/authorities-rules.check.d.ts.map +1 -1
- package/front-mcp/front-mcp.d.ts +3 -0
- package/front-mcp/front-mcp.d.ts.map +1 -1
- package/index.js +68 -64
- package/job/execution/job-execution.manager.d.ts.map +1 -1
- package/job/job-permission.guard.d.ts +2 -0
- package/job/job-permission.guard.d.ts.map +1 -1
- package/job/job-run-access.d.ts +7 -3
- package/job/job-run-access.d.ts.map +1 -1
- package/job/store/job-state.interface.d.ts +2 -0
- package/job/store/job-state.interface.d.ts.map +1 -1
- package/job/tools/list-jobs.tool.d.ts.map +1 -1
- package/job/tools/remove-job.tool.d.ts.map +1 -1
- package/job/tools/update-job.tool.d.ts.map +1 -1
- package/logger/instances/instance.console-logger.d.ts +1 -1
- package/logger/instances/instance.console-logger.d.ts.map +1 -1
- package/logger/instances/instance.file-logger.d.ts +2 -1
- package/logger/instances/instance.file-logger.d.ts.map +1 -1
- package/logger/session-id-hash.d.ts +3 -0
- package/logger/session-id-hash.d.ts.map +1 -0
- package/metrics/metrics.service.d.ts.map +1 -1
- package/offload/offload-worker.globals.d.ts +2 -2
- package/offload/offload-worker.globals.d.ts.map +1 -1
- package/offload/worker-jobs.d.ts.map +1 -1
- package/package.json +10 -10
- package/plugin/enforced-metadata.check.d.ts +3 -3
- package/plugin/enforced-metadata.check.d.ts.map +1 -1
- package/prompt/flows/get-prompt.flow.d.ts +1 -0
- package/prompt/flows/get-prompt.flow.d.ts.map +1 -1
- package/prompt/flows/prompts-list.flow.d.ts +2 -1
- package/prompt/flows/prompts-list.flow.d.ts.map +1 -1
- package/provider/provider.registry.d.ts +2 -0
- package/provider/provider.registry.d.ts.map +1 -1
- package/provider/provider.utils.d.ts +2 -2
- package/provider/provider.utils.d.ts.map +1 -1
- package/remote-mcp/mcp-client.service.d.ts.map +1 -1
- package/remote-mcp/mcp-client.types.d.ts +2 -0
- package/remote-mcp/mcp-client.types.d.ts.map +1 -1
- package/remote-mcp/remote-entries.d.ts.map +1 -1
- package/remote-mcp/remote-oauth.d.ts +4 -2
- package/remote-mcp/remote-oauth.d.ts.map +1 -1
- package/resource/flows/read-resource.flow.d.ts +1 -0
- package/resource/flows/read-resource.flow.d.ts.map +1 -1
- package/resource/flows/resource-templates-list.flow.d.ts.map +1 -1
- package/resource/flows/resources-list.flow.d.ts +2 -1
- package/resource/flows/resources-list.flow.d.ts.map +1 -1
- package/resource/flows/subscribe-resource.flow.d.ts.map +1 -1
- package/resource/resource.instance.d.ts.map +1 -1
- package/scope/flows/http.request.flow.d.ts +2 -0
- package/scope/flows/http.request.flow.d.ts.map +1 -1
- package/scope/optional-dependency.util.d.ts +1 -12
- package/scope/optional-dependency.util.d.ts.map +1 -1
- package/scope/scope.instance.d.ts.map +1 -1
- package/server/security/replaceable-directory.d.ts +4 -1
- package/server/security/replaceable-directory.d.ts.map +1 -1
- package/server/security/resolve-allowed-hosts.d.ts.map +1 -1
- package/server/server.validation.d.ts.map +1 -1
- package/shared/shared-endpoint.d.ts.map +1 -1
- package/skill/cache/skill-http-cache.catalog.d.ts +6 -0
- package/skill/cache/skill-http-cache.catalog.d.ts.map +1 -0
- package/skill/flows/http/llm-full-txt.flow.d.ts.map +1 -1
- package/skill/flows/http/llm-txt.flow.d.ts.map +1 -1
- package/skill/flows/load-skill.flow.d.ts.map +1 -1
- package/skill/hooks/skill-tool.hook.d.ts +2 -0
- package/skill/hooks/skill-tool.hook.d.ts.map +1 -1
- package/skill/sep-2640/sep-2640.resource-helpers.d.ts +5 -4
- package/skill/sep-2640/sep-2640.resource-helpers.d.ts.map +1 -1
- package/skill/session/skill-session.manager.d.ts +2 -0
- package/skill/session/skill-session.manager.d.ts.map +1 -1
- package/skill/session/skill-session.types.d.ts +6 -0
- package/skill/session/skill-session.types.d.ts.map +1 -1
- package/skill/skill-authorities.helper.d.ts +4 -5
- package/skill/skill-authorities.helper.d.ts.map +1 -1
- package/skill/skill-directory-loader.d.ts.map +1 -1
- package/skill/skill-filter.helper.d.ts +15 -15
- package/skill/skill-filter.helper.d.ts.map +1 -1
- package/skill/skill-md-parser.d.ts.map +1 -1
- package/skill/skill.instance.d.ts +5 -0
- package/skill/skill.instance.d.ts.map +1 -1
- package/storage/sqlite-on-edge.d.ts +5 -0
- package/storage/sqlite-on-edge.d.ts.map +1 -0
- package/task/store/task-store.factory.d.ts.map +1 -1
- package/tool/flows/call-tool.flow.d.ts +5 -2
- package/tool/flows/call-tool.flow.d.ts.map +1 -1
- package/tool/flows/tools-list.flow.d.ts +2 -1
- package/tool/flows/tools-list.flow.d.ts.map +1 -1
- package/transport/adapters/transport.local.adapter.d.ts.map +1 -1
- package/transport/event-stores/event-store.factory.d.ts.map +1 -1
- package/transport/event-stores/redis.event-store.d.ts.map +1 -1
- package/transport/flows/handle.streamable-http.flow.d.ts.map +1 -1
- package/transport/in-memory-server.d.ts.map +1 -1
- package/transport/mcp-20260728/client/mcp-stateless.client.d.ts +8 -2
- package/transport/mcp-20260728/client/mcp-stateless.client.d.ts.map +1 -1
- package/transport/mcp-20260728/dispatcher.d.ts +3 -1
- package/transport/mcp-20260728/dispatcher.d.ts.map +1 -1
- package/transport/mcp-handlers/index.d.ts +32 -24
- package/transport/mcp-handlers/index.d.ts.map +1 -1
- package/transport/mcp-handlers/skills-list-request.handler.d.ts.map +1 -1
- package/transport/mcp-handlers/skills-mcp.types.d.ts +2 -0
- package/transport/mcp-handlers/skills-mcp.types.d.ts.map +1 -1
- package/transport/web-fetch-handler.d.ts +10 -8
- package/transport/web-fetch-handler.d.ts.map +1 -1
- package/transport/web-response.renderer.d.ts.map +1 -1
- package/worker/worker.lifecycle.d.ts +2 -2
- package/worker/worker.lifecycle.d.ts.map +1 -1
- package/workflow/tools/list-workflows.tool.d.ts.map +1 -1
- package/workflow/tools/register-workflow.tool.d.ts.map +1 -1
- package/workflow/tools/remove-workflow.tool.d.ts.map +1 -1
- package/workflow/tools/runtime-workflow.limits.d.ts +3 -0
- package/workflow/tools/runtime-workflow.limits.d.ts.map +1 -0
- package/workflow/tools/update-workflow.tool.d.ts.map +1 -1
- package/workflow/trigger/workflow-webhook.signature.d.ts +8 -5
- package/workflow/trigger/workflow-webhook.signature.d.ts.map +1 -1
|
@@ -2,9 +2,17 @@
|
|
|
2
2
|
import "reflect-metadata";
|
|
3
3
|
import { getDecoratorConfig } from "../common/index.mjs";
|
|
4
4
|
import { PLATFORM_CLIENT_INFO } from "./llm-platform.mjs";
|
|
5
|
-
var
|
|
5
|
+
var instanceCaches = /* @__PURE__ */ new Map();
|
|
6
6
|
var instanceClients = /* @__PURE__ */ new WeakMap();
|
|
7
|
-
function
|
|
7
|
+
function instanceCacheOf(mode) {
|
|
8
|
+
let cache = instanceCaches.get(mode);
|
|
9
|
+
if (!cache) {
|
|
10
|
+
cache = /* @__PURE__ */ new WeakMap();
|
|
11
|
+
instanceCaches.set(mode, cache);
|
|
12
|
+
}
|
|
13
|
+
return cache;
|
|
14
|
+
}
|
|
15
|
+
function getInstance(config, mode = "full") {
|
|
8
16
|
let resolvedConfig = config;
|
|
9
17
|
if (typeof config === "function") {
|
|
10
18
|
const stored = getDecoratorConfig(config);
|
|
@@ -13,6 +21,7 @@ function getInstance(config, mode) {
|
|
|
13
21
|
}
|
|
14
22
|
}
|
|
15
23
|
const cacheKey = resolvedConfig;
|
|
24
|
+
const instanceCache = instanceCacheOf(mode);
|
|
16
25
|
let instancePromise = instanceCache.get(cacheKey);
|
|
17
26
|
if (!instancePromise) {
|
|
18
27
|
instancePromise = (async () => {
|
|
@@ -30,8 +39,9 @@ function getInstance(config, mode) {
|
|
|
30
39
|
}
|
|
31
40
|
return { cacheKey, instancePromise };
|
|
32
41
|
}
|
|
33
|
-
function joinInstance(config, mode) {
|
|
42
|
+
function joinInstance(config, mode = "full") {
|
|
34
43
|
const { cacheKey, instancePromise } = getInstance(config, mode);
|
|
44
|
+
const instanceCache = instanceCacheOf(mode);
|
|
35
45
|
instanceClients.set(instancePromise, (instanceClients.get(instancePromise) ?? 0) + 1);
|
|
36
46
|
const release = async () => {
|
|
37
47
|
const remaining = (instanceClients.get(instancePromise) ?? 1) - 1;
|
|
@@ -90,7 +100,7 @@ async function connectVercelAI(config, options) {
|
|
|
90
100
|
});
|
|
91
101
|
}
|
|
92
102
|
function clearScopeCache() {
|
|
93
|
-
|
|
103
|
+
instanceCaches = /* @__PURE__ */ new Map();
|
|
94
104
|
}
|
|
95
105
|
export {
|
|
96
106
|
clearScopeCache,
|
|
@@ -66,7 +66,9 @@ var DirectMcpServerImpl = class {
|
|
|
66
66
|
return withMcpSurface(this.scope, {
|
|
67
67
|
authInfo,
|
|
68
68
|
metadata: options?.metadata,
|
|
69
|
-
...platformEnv !== void 0 ? { platformEnv } : {}
|
|
69
|
+
...platformEnv !== void 0 ? { platformEnv } : {},
|
|
70
|
+
// Its own request with its own caller, also when made while another request runs
|
|
71
|
+
ownRequest: true
|
|
70
72
|
});
|
|
71
73
|
}
|
|
72
74
|
/**
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
LeaseClaims,
|
|
13
13
|
leaseKey,
|
|
14
14
|
leaseStorageConfig,
|
|
15
|
+
nameKey,
|
|
15
16
|
registerReadinessProbe,
|
|
16
17
|
startsBackgroundWork
|
|
17
18
|
} from "./lease-store.mjs";
|
|
@@ -139,7 +140,7 @@ var DutyLifecycle = class {
|
|
|
139
140
|
const config = this.providers.get(FrontMcpConfig);
|
|
140
141
|
const serverName = config.info?.name ?? "frontmcp";
|
|
141
142
|
const key = leaseKey(name, scope, serverName);
|
|
142
|
-
this.claim(
|
|
143
|
+
this.claim(serverName);
|
|
143
144
|
const storage = new LazyLeaseStore(dutyStorageConfig(config.redis, scope));
|
|
144
145
|
const run = (context) => this.duty.run(context);
|
|
145
146
|
const common = { name, key, leaseMs, storage, logger, run };
|
|
@@ -153,8 +154,9 @@ var DutyLifecycle = class {
|
|
|
153
154
|
await runner.start();
|
|
154
155
|
return { runner, storage, removeHealthProbe };
|
|
155
156
|
}
|
|
156
|
-
/** Take
|
|
157
|
-
claim(
|
|
157
|
+
/** Take the duty's name in its server for its class: another class with it fails to start, whatever its scope. */
|
|
158
|
+
claim(serverName) {
|
|
159
|
+
const key = nameKey(this.metadata.name, serverName);
|
|
158
160
|
const type = this.duty.constructor;
|
|
159
161
|
const otherClass = claims.claim(key, type);
|
|
160
162
|
if (otherClass !== void 0) {
|
|
@@ -71,8 +71,11 @@ function leaseStorageConfig(redis, kind, scope) {
|
|
|
71
71
|
fallback: "error"
|
|
72
72
|
};
|
|
73
73
|
}
|
|
74
|
+
function nameKey(name, serverName) {
|
|
75
|
+
return [serverName, name].map(encodeURIComponent).join(":");
|
|
76
|
+
}
|
|
74
77
|
function leaseKey(name, scope, serverName) {
|
|
75
|
-
const key =
|
|
78
|
+
const key = nameKey(name, serverName);
|
|
76
79
|
if (scope !== "workspace") return key;
|
|
77
80
|
const cwd = process.cwd();
|
|
78
81
|
return `${key}:${sha256Hex(findProjectRoot(cwd) ?? cwd)}`;
|
|
@@ -96,7 +99,7 @@ async function prepareLeaseFile(file) {
|
|
|
96
99
|
var LeaseClaims = class {
|
|
97
100
|
claims = /* @__PURE__ */ new Map();
|
|
98
101
|
/**
|
|
99
|
-
* Take `key` for `type`: another class with the same key would
|
|
102
|
+
* Take `key` for `type`: another class with the same key would be a second duty or worker of that name.
|
|
100
103
|
*
|
|
101
104
|
* @returns The name of the other class that holds `key`, in which case nothing was taken
|
|
102
105
|
*/
|
|
@@ -119,6 +122,7 @@ export {
|
|
|
119
122
|
isLongLivedProcess,
|
|
120
123
|
leaseKey,
|
|
121
124
|
leaseStorageConfig,
|
|
125
|
+
nameKey,
|
|
122
126
|
openLeaseStore,
|
|
123
127
|
registerReadinessProbe,
|
|
124
128
|
startsBackgroundWork
|
|
@@ -14,6 +14,7 @@ import { internalZ as z } from "@frontmcp/lazy-zod";
|
|
|
14
14
|
import { randomUUID } from "@frontmcp/utils";
|
|
15
15
|
import { Flow, FlowBase, FlowHooksOf } from "../../common/index.mjs";
|
|
16
16
|
import { ElicitationStoreNotInitializedError, InvalidInputError } from "../../errors/index.mjs";
|
|
17
|
+
import { sessionIdHash } from "../../logger/session-id-hash.mjs";
|
|
17
18
|
import { DEFAULT_ELICIT_TTL } from "../elicitation.types.mjs";
|
|
18
19
|
var inputSchema = z.object({
|
|
19
20
|
/** Related request ID from the transport */
|
|
@@ -84,7 +85,7 @@ var ElicitationRequestFlow = class extends FlowBase {
|
|
|
84
85
|
elicitationId,
|
|
85
86
|
url
|
|
86
87
|
});
|
|
87
|
-
this.logger.verbose("parseInput:done", {
|
|
88
|
+
this.logger.verbose("parseInput:done", { sessionIdHash: sessionIdHash(input.sessionId), mode });
|
|
88
89
|
}
|
|
89
90
|
async validateRequest() {
|
|
90
91
|
this.logger.verbose("validateRequest:start");
|
|
@@ -120,7 +121,7 @@ var ElicitationRequestFlow = class extends FlowBase {
|
|
|
120
121
|
};
|
|
121
122
|
await store.setPending(pendingRecord);
|
|
122
123
|
this.state.set("pendingRecord", pendingRecord);
|
|
123
|
-
this.logger.verbose("storePendingRecord:done", { elicitId, sessionId });
|
|
124
|
+
this.logger.verbose("storePendingRecord:done", { elicitId, sessionIdHash: sessionIdHash(sessionId) });
|
|
124
125
|
}
|
|
125
126
|
async buildRequestParams() {
|
|
126
127
|
this.logger.verbose("buildRequestParams:start");
|
|
@@ -13,6 +13,7 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
13
13
|
import { internalZ as z } from "@frontmcp/lazy-zod";
|
|
14
14
|
import { Flow, FlowBase, FlowHooksOf } from "../../common/index.mjs";
|
|
15
15
|
import { ElicitationStoreNotInitializedError, InvalidInputError } from "../../errors/index.mjs";
|
|
16
|
+
import { sessionIdHash } from "../../logger/session-id-hash.mjs";
|
|
16
17
|
import { validateElicitationContent } from "../helpers/index.mjs";
|
|
17
18
|
var inputSchema = z.object({
|
|
18
19
|
/** Session ID for the elicitation */
|
|
@@ -58,7 +59,7 @@ var ElicitationResultFlow = class extends FlowBase {
|
|
|
58
59
|
content: input.result.content
|
|
59
60
|
});
|
|
60
61
|
this.logger.verbose("parseInput:done", {
|
|
61
|
-
|
|
62
|
+
sessionIdHash: sessionIdHash(input.sessionId),
|
|
62
63
|
action: input.result.action
|
|
63
64
|
});
|
|
64
65
|
}
|
|
@@ -72,10 +73,10 @@ var ElicitationResultFlow = class extends FlowBase {
|
|
|
72
73
|
const pendingRecord = await store.getPending(sessionId);
|
|
73
74
|
this.state.set("pendingRecord", pendingRecord ?? void 0);
|
|
74
75
|
if (!pendingRecord) {
|
|
75
|
-
this.logger.verbose("lookupPending:notFound", { sessionId });
|
|
76
|
+
this.logger.verbose("lookupPending:notFound", { sessionIdHash: sessionIdHash(sessionId) });
|
|
76
77
|
} else {
|
|
77
78
|
this.logger.verbose("lookupPending:found", {
|
|
78
|
-
sessionId,
|
|
79
|
+
sessionIdHash: sessionIdHash(sessionId),
|
|
79
80
|
elicitId: pendingRecord.elicitId
|
|
80
81
|
});
|
|
81
82
|
}
|
|
@@ -102,7 +103,7 @@ var ElicitationResultFlow = class extends FlowBase {
|
|
|
102
103
|
const validationResult = validateElicitationContent(content, pendingRecord.requestedSchema);
|
|
103
104
|
if (!validationResult.success) {
|
|
104
105
|
this.logger.warn("validateContent:failed", {
|
|
105
|
-
|
|
106
|
+
sessionIdHash: sessionIdHash(pendingRecord.sessionId),
|
|
106
107
|
elicitId: pendingRecord.elicitId,
|
|
107
108
|
errors: validationResult.errors
|
|
108
109
|
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// libs/sdk/src/elicitation/questions/question-scope.helper.ts
|
|
2
2
|
import { internalZ as z } from "@frontmcp/lazy-zod";
|
|
3
3
|
import { sha256Hex } from "@frontmcp/utils";
|
|
4
|
+
import { hasSqliteDriver, SQLITE_ON_EDGE_REMEDY } from "../../storage/sqlite-on-edge.mjs";
|
|
4
5
|
import { createQuestionStore, resolveQuestionStorage } from "./question-store.factory.mjs";
|
|
5
6
|
import { InvalidQuestionStoreError } from "./question.errors.mjs";
|
|
6
7
|
var DEFAULT_QUESTION_TTL_MS = 864e5;
|
|
@@ -25,10 +26,11 @@ function parsePersistentQuestionsOptions(persistent) {
|
|
|
25
26
|
}
|
|
26
27
|
return { ...parsed.data, storage: parsed.data.storage };
|
|
27
28
|
}
|
|
28
|
-
var NOT_ON_EDGE_RUNTIME =
|
|
29
|
+
var NOT_ON_EDGE_RUNTIME = `it is not available on an edge runtime: a question must outlive the isolate that asked it, and none of its stores runs there ('redis' needs a TCP connection, 'sqlite' a local file, and 'memory' ends with the isolate). Run the server on Node.js to keep questions, turn elicitation.persistent off, or name a 'sqlite' store in elicitation.persistent.storage and give it a SQLite driver: ${SQLITE_ON_EDGE_REMEDY}`;
|
|
29
30
|
function persistentQuestionsSettings(persistent, onEdgeRuntime) {
|
|
30
31
|
const settings = parsePersistentQuestionsOptions(persistent);
|
|
31
|
-
|
|
32
|
+
const opensOnEdge = settings.storage?.type === "sqlite" && hasSqliteDriver();
|
|
33
|
+
if (onEdgeRuntime && !opensOnEdge) throw new InvalidQuestionStoreError(NOT_ON_EDGE_RUNTIME);
|
|
32
34
|
return settings;
|
|
33
35
|
}
|
|
34
36
|
function questionsServerStore(storage, server) {
|
|
@@ -13,6 +13,8 @@ import { createMemoryStorage, createStorage, getEnv } from "@frontmcp/utils";
|
|
|
13
13
|
import { isVercelKvProvider } from "../../common/index.mjs";
|
|
14
14
|
import { normalizeRedisOptions } from "../../common/types/options/redis/schema.mjs";
|
|
15
15
|
import { ElicitationNotSupportedError } from "../../errors/elicitation.error.mjs";
|
|
16
|
+
import { requireOptionalModule } from "../../scope/optional-dependency.util.mjs";
|
|
17
|
+
import { hasSqliteDriver, SQLITE_ON_EDGE_REMEDY } from "../../storage/sqlite-on-edge.mjs";
|
|
16
18
|
import { isElicitationEncryptionAvailable } from "./elicitation-encryption.mjs";
|
|
17
19
|
import { EncryptedElicitationStore } from "./encrypted-elicitation.store.mjs";
|
|
18
20
|
import { StorageElicitationStore } from "./storage-elicitation.store.mjs";
|
|
@@ -44,9 +46,9 @@ async function createElicitationStore(options = {}) {
|
|
|
44
46
|
encryption
|
|
45
47
|
} = options;
|
|
46
48
|
if (sqlite) {
|
|
47
|
-
if (isEdgeRuntime) {
|
|
49
|
+
if (isEdgeRuntime && !hasSqliteDriver()) {
|
|
48
50
|
throw new ElicitationNotSupportedError(
|
|
49
|
-
|
|
51
|
+
`SQLite elicitation store is not supported on Edge runtime without a SQLite driver (better-sqlite3 is a native module). ${SQLITE_ON_EDGE_REMEDY} Otherwise use Redis or Upstash instead.`
|
|
50
52
|
);
|
|
51
53
|
}
|
|
52
54
|
let sqliteStore = createSqliteElicitationStore(sqlite, { keyPrefix, logger });
|
|
@@ -56,9 +58,7 @@ async function createElicitationStore(options = {}) {
|
|
|
56
58
|
const hasSecret2 = encryptionSecret2 || isElicitationEncryptionAvailable();
|
|
57
59
|
if (encryptionEnabled2 === true) {
|
|
58
60
|
if (!hasSecret2) {
|
|
59
|
-
throw
|
|
60
|
-
"Elicitation encryption is enabled but no secret is available. Set MCP_ELICITATION_SECRET, MCP_SESSION_SECRET, or MCP_SERVER_SECRET environment variable, or provide a secret in the encryption configuration."
|
|
61
|
-
);
|
|
61
|
+
throw missingEncryptionSecretError();
|
|
62
62
|
}
|
|
63
63
|
sqliteStore = new EncryptedElicitationStore(sqliteStore, { secret: encryptionSecret2, logger });
|
|
64
64
|
encrypted2 = true;
|
|
@@ -118,9 +118,7 @@ async function createElicitationStore(options = {}) {
|
|
|
118
118
|
let encrypted = false;
|
|
119
119
|
if (encryptionEnabled === true) {
|
|
120
120
|
if (!hasSecret) {
|
|
121
|
-
throw
|
|
122
|
-
"Elicitation encryption is enabled but no secret is available. Set MCP_ELICITATION_SECRET, MCP_SESSION_SECRET, or MCP_SERVER_SECRET environment variable, or provide a secret in the encryption configuration."
|
|
123
|
-
);
|
|
121
|
+
throw missingEncryptionSecretError();
|
|
124
122
|
}
|
|
125
123
|
store = new EncryptedElicitationStore(store, { secret: encryptionSecret, logger });
|
|
126
124
|
encrypted = true;
|
|
@@ -144,6 +142,7 @@ function createMemoryElicitationStore(options = {}) {
|
|
|
144
142
|
const encryptionSecret = encryption?.secret;
|
|
145
143
|
const hasSecret = encryptionSecret || isElicitationEncryptionAvailable();
|
|
146
144
|
let encrypted = false;
|
|
145
|
+
if (encryptionEnabled === true && !hasSecret) throw missingEncryptionSecretError();
|
|
147
146
|
if (encryptionEnabled === true && hasSecret) {
|
|
148
147
|
store = new EncryptedElicitationStore(store, { secret: encryptionSecret, logger });
|
|
149
148
|
encrypted = true;
|
|
@@ -154,6 +153,11 @@ function createMemoryElicitationStore(options = {}) {
|
|
|
154
153
|
logger?.debug("[ElicitationStoreFactory] Created explicit in-memory elicitation store", { encrypted });
|
|
155
154
|
return { store, type: "memory", storage, encrypted };
|
|
156
155
|
}
|
|
156
|
+
function missingEncryptionSecretError() {
|
|
157
|
+
return new ElicitationNotSupportedError(
|
|
158
|
+
"Elicitation encryption is enabled but no secret is available. Set MCP_ELICITATION_SECRET, MCP_SESSION_SECRET, or MCP_SERVER_SECRET environment variable, or provide a secret in the encryption configuration."
|
|
159
|
+
);
|
|
160
|
+
}
|
|
157
161
|
function createElicitationStoreFromStorage(storage, options = {}) {
|
|
158
162
|
const { keyPrefix = "mcp:elicit:", logger, requiresPubSub = true, encryption } = options;
|
|
159
163
|
if (requiresPubSub && !storage.supportsPubSub()) {
|
|
@@ -168,6 +172,7 @@ function createElicitationStoreFromStorage(storage, options = {}) {
|
|
|
168
172
|
const encryptionSecret = encryption?.secret;
|
|
169
173
|
const hasSecret = encryptionSecret || isElicitationEncryptionAvailable();
|
|
170
174
|
let encrypted = false;
|
|
175
|
+
if (encryptionEnabled === true && !hasSecret) throw missingEncryptionSecretError();
|
|
171
176
|
if (encryptionEnabled === true && hasSecret) {
|
|
172
177
|
store = new EncryptedElicitationStore(store, { secret: encryptionSecret, logger });
|
|
173
178
|
encrypted = true;
|
|
@@ -184,7 +189,10 @@ function createElicitationStoreFromStorage(storage, options = {}) {
|
|
|
184
189
|
}
|
|
185
190
|
function createSqliteElicitationStore(sqliteConfig, storeOptions = {}) {
|
|
186
191
|
const { keyPrefix = "mcp:elicit:", logger } = storeOptions;
|
|
187
|
-
const { SqliteElicitationStore } =
|
|
192
|
+
const { SqliteElicitationStore } = requireOptionalModule(
|
|
193
|
+
"@frontmcp/storage-sqlite",
|
|
194
|
+
() => __require("@frontmcp/storage-sqlite")
|
|
195
|
+
);
|
|
188
196
|
logger?.info("[ElicitationStoreFactory] Creating SQLite elicitation store", {
|
|
189
197
|
path: sqliteConfig.path,
|
|
190
198
|
keyPrefix
|
|
@@ -92,7 +92,7 @@ var EncryptedElicitationStore = class {
|
|
|
92
92
|
}
|
|
93
93
|
callback(rawResult);
|
|
94
94
|
};
|
|
95
|
-
return this.store.subscribeResult(elicitId, decryptingCallback);
|
|
95
|
+
return this.store.subscribeResult(elicitId, decryptingCallback, sessionId);
|
|
96
96
|
}
|
|
97
97
|
/**
|
|
98
98
|
* Publish an elicitation result with encryption.
|