@frontmcp/sdk 1.10.16 → 1.11.0-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/agent/agent.instance.d.ts.map +1 -1
- package/agent/agent.scope.d.ts +3 -0
- package/agent/agent.scope.d.ts.map +1 -1
- package/agent/flows/call-agent.flow.d.ts +2 -1
- package/agent/flows/call-agent.flow.d.ts.map +1 -1
- package/agent/hooks/agent.hooks.d.ts +4 -4
- package/answer/answer-budget.d.ts +51 -0
- package/answer/answer-budget.d.ts.map +1 -0
- package/answer/answer-meter.d.ts +30 -0
- package/answer/answer-meter.d.ts.map +1 -0
- package/answer/client-profile.d.ts +48 -0
- package/answer/client-profile.d.ts.map +1 -0
- package/answer/index.d.ts +7 -0
- package/answer/index.d.ts.map +1 -0
- package/app/app.registry.d.ts.map +1 -1
- package/app/app.utils.d.ts +1 -1
- package/app/app.utils.d.ts.map +1 -1
- package/app/instances/app.lazy.instance.d.ts +68 -0
- package/app/instances/app.lazy.instance.d.ts.map +1 -0
- package/app/instances/app.remote.instance.d.ts +2 -0
- package/app/instances/app.remote.instance.d.ts.map +1 -1
- package/app/instances/empty-app-registries.d.ts +52 -0
- package/app/instances/empty-app-registries.d.ts.map +1 -0
- package/app/lazy/lazy-app.rules.d.ts +31 -0
- package/app/lazy/lazy-app.rules.d.ts.map +1 -0
- package/app/lazy/lazy-manifest.d.ts +33 -0
- package/app/lazy/lazy-manifest.d.ts.map +1 -0
- package/app/lazy/lazy-placeholders.d.ts +29 -0
- package/app/lazy/lazy-placeholders.d.ts.map +1 -0
- package/auth/flows/auth.verify.flow.d.ts +1 -1
- package/auth/flows/auth.verify.flow.d.ts.map +1 -1
- package/auth/flows/oauth-flows.d.ts +3 -0
- package/auth/flows/oauth-flows.d.ts.map +1 -0
- package/auth/flows/oauth.auth-ui.flow.d.ts +1 -1
- package/auth/flows/oauth.auth-ui.flow.d.ts.map +1 -1
- package/auth/flows/oauth.authorize.flow.d.ts +2 -2
- package/auth/flows/oauth.authorize.flow.d.ts.map +1 -1
- package/auth/flows/oauth.callback.flow.d.ts +2 -2
- package/auth/flows/oauth.callback.flow.d.ts.map +1 -1
- package/auth/flows/oauth.connect.flow.d.ts +1 -1
- package/auth/flows/oauth.connect.flow.d.ts.map +1 -1
- package/auth/flows/oauth.provider-callback.flow.d.ts +2 -2
- package/auth/flows/oauth.provider-callback.flow.d.ts.map +1 -1
- package/auth/flows/oauth.register.flow.d.ts +1 -1
- package/auth/flows/oauth.register.flow.d.ts.map +1 -1
- package/auth/flows/oauth.token.flow.d.ts +1 -1
- package/auth/flows/oauth.token.flow.d.ts.map +1 -1
- package/auth/flows/oauth.userinfo.flow.d.ts +1 -1
- package/auth/flows/oauth.userinfo.flow.d.ts.map +1 -1
- package/auth/flows/session.verify.flow.d.ts +4 -0
- package/auth/flows/session.verify.flow.d.ts.map +1 -1
- package/auth/flows/well-known.jwks.flow.d.ts +1 -1
- package/auth/flows/well-known.jwks.flow.d.ts.map +1 -1
- package/auth/flows/well-known.oauth-authorization-server.flow.d.ts +1 -1
- package/auth/flows/well-known.oauth-authorization-server.flow.d.ts.map +1 -1
- package/auth/instances/instance.local-primary-auth.d.ts.map +1 -1
- package/browser/agent/agent-builtin-tools.mjs +1 -1
- package/browser/agent/agent.instance.mjs +5 -2
- package/browser/agent/agent.scope.mjs +9 -0
- package/browser/agent/flows/call-agent.flow.mjs +13 -2
- package/browser/answer/answer-budget.mjs +221 -0
- package/browser/answer/answer-meter.mjs +53 -0
- package/browser/answer/client-profile.mjs +79 -0
- package/browser/answer/index.mjs +34 -0
- package/browser/app/app.registry.mjs +19 -7
- package/browser/app/app.utils.mjs +23 -2
- package/browser/app/instances/app.lazy.instance.mjs +371 -0
- package/browser/app/instances/app.remote.instance.mjs +12 -82
- package/browser/app/instances/empty-app-registries.mjs +87 -0
- package/browser/app/lazy/lazy-app.rules.mjs +104 -0
- package/browser/app/lazy/lazy-manifest.mjs +102 -0
- package/browser/app/lazy/lazy-placeholders.mjs +36 -0
- package/browser/auth/flows/oauth-flows.mjs +39 -0
- package/browser/auth/flows/oauth.auth-ui.flow.mjs +2 -1
- package/browser/auth/flows/oauth.authorize.flow.mjs +2 -1
- package/browser/auth/flows/oauth.callback.flow.mjs +2 -1
- package/browser/auth/flows/oauth.connect.flow.mjs +2 -1
- package/browser/auth/flows/oauth.provider-callback.flow.mjs +2 -1
- package/browser/auth/flows/oauth.register.flow.mjs +2 -1
- package/browser/auth/flows/oauth.token.flow.mjs +2 -1
- package/browser/auth/flows/oauth.userinfo.flow.mjs +2 -1
- package/browser/auth/flows/session.verify.flow.mjs +1 -1
- package/browser/auth/flows/well-known.jwks.flow.mjs +1 -1
- package/browser/auth/flows/well-known.oauth-authorization-server.flow.mjs +1 -1
- package/browser/auth/flows/well-known.prm.flow.mjs +1 -1
- package/browser/auth/instances/instance.local-primary-auth.mjs +2 -16
- package/browser/builtin/call-recorder/call-record.mjs +7 -0
- package/browser/builtin/call-recorder/call-record.writer.mjs +70 -0
- package/browser/builtin/call-recorder/call-recorder.options.mjs +23 -0
- package/browser/builtin/call-recorder/call-recorder.plugin.mjs +209 -0
- package/browser/builtin/call-recorder/index.mjs +5 -0
- package/browser/channel/flows/list-channels.flow.mjs +1 -1
- package/browser/channel/flows/send-channel-notification.flow.mjs +1 -1
- package/browser/channel/reply/reply.types.mjs +1 -1
- package/browser/common/decorators/duty.decorator.mjs +24 -0
- package/browser/common/decorators/front-mcp.decorator.mjs +12 -8
- package/browser/common/decorators/hook.decorator.mjs +10 -0
- package/browser/common/decorators/http-route.decorator.mjs +46 -0
- package/browser/common/decorators/index.mjs +2 -0
- package/browser/common/decorators/job.decorator.mjs +7 -0
- package/browser/common/decorators/resource.decorator.mjs +22 -0
- package/browser/common/entries/job.entry.mjs +1 -1
- package/browser/common/entries/tool.entry.mjs +1 -1
- package/browser/common/flow/flow.utils.mjs +1 -1
- package/browser/common/index.mjs +5 -5
- package/browser/common/interfaces/agent.interface.mjs +6 -2
- package/browser/common/interfaces/duty.interface.mjs +0 -0
- package/browser/common/interfaces/execution-context.interface.mjs +39 -1
- package/browser/common/interfaces/flow.interface.mjs +2 -0
- package/browser/common/interfaces/http-route.interface.mjs +20 -0
- package/browser/common/interfaces/index.mjs +3 -1
- package/browser/common/interfaces/job.interface.mjs +28 -11
- package/browser/common/interfaces/logger.interface.mjs +2 -0
- package/browser/common/interfaces/resource.interface.mjs +3 -2
- package/browser/common/interfaces/tool.interface.mjs +5 -10
- package/browser/common/metadata/adapter.metadata.mjs +1 -1
- package/browser/common/metadata/agent.metadata.mjs +1 -1
- package/browser/common/metadata/app-filter.metadata.mjs +1 -1
- package/browser/common/metadata/app.metadata.mjs +15 -1
- package/browser/common/metadata/auth-provider.metadata.mjs +1 -1
- package/browser/common/metadata/channel.metadata.mjs +1 -1
- package/browser/common/metadata/duty.metadata.mjs +32 -0
- package/browser/common/metadata/enabled.metadata.mjs +16 -0
- package/browser/common/metadata/flow.metadata.mjs +1 -1
- package/browser/common/metadata/front-mcp-stores.mjs +43 -0
- package/browser/common/metadata/front-mcp.metadata.mjs +85 -26
- package/browser/common/metadata/hook.metadata.mjs +26 -0
- package/browser/common/metadata/http-route.metadata.mjs +20 -0
- package/browser/common/metadata/index.mjs +8 -4
- package/browser/common/metadata/job.metadata.mjs +20 -3
- package/browser/common/metadata/logger.metadata.mjs +1 -1
- package/browser/common/metadata/materialized.metadata.mjs +13 -0
- package/browser/common/metadata/output-policy.mjs +20 -2
- package/browser/common/metadata/plugin.metadata.mjs +1 -1
- package/browser/common/metadata/prompt.metadata.mjs +4 -2
- package/browser/common/metadata/provider.metadata.mjs +1 -1
- package/browser/common/metadata/resource.metadata.mjs +20 -4
- package/browser/common/metadata/skill.metadata.mjs +1 -1
- package/browser/common/metadata/tool.metadata.mjs +6 -1
- package/browser/common/metadata/ui-serving-mode.mjs +1 -1
- package/browser/common/metadata/workflow.metadata.mjs +3 -2
- package/browser/common/records/app.record.mjs +1 -0
- package/browser/common/schemas/annotated-class.schema.mjs +8 -3
- package/browser/common/schemas/http-input.schema.mjs +1 -1
- package/browser/common/schemas/http-output.schema.mjs +1 -1
- package/browser/common/schemas/session-header.schema.mjs +1 -1
- package/browser/common/tokens/app.tokens.mjs +1 -0
- package/browser/common/tokens/front-mcp.tokens.mjs +10 -1
- package/browser/common/tokens/job.tokens.mjs +2 -0
- package/browser/common/tokens/prompt.tokens.mjs +1 -0
- package/browser/common/tokens/resource.tokens.mjs +5 -0
- package/browser/common/tokens/tool.tokens.mjs +2 -0
- package/browser/common/types/auth/session.types.mjs +1 -1
- package/browser/common/types/index.mjs +1 -1
- package/browser/common/types/options/clients/index.mjs +5 -0
- package/browser/common/types/options/clients/schema.mjs +15 -0
- package/browser/common/types/options/devtools/index.mjs +5 -0
- package/browser/common/types/options/devtools/schema.mjs +8 -0
- package/browser/common/types/options/elicitation/schema.mjs +7 -2
- package/browser/common/types/options/ext-apps/schema.mjs +1 -1
- package/browser/common/types/options/health/schema.mjs +1 -1
- package/browser/common/types/options/http/schema.mjs +17 -2
- package/browser/common/types/options/index.mjs +5 -0
- package/browser/common/types/options/instructions-budget/index.mjs +7 -0
- package/browser/common/types/options/instructions-budget/schema.mjs +26 -0
- package/browser/common/types/options/lifecycle/index.mjs +5 -0
- package/browser/common/types/options/lifecycle/schema.mjs +9 -0
- package/browser/common/types/options/logging/schema.mjs +1 -1
- package/browser/common/types/options/metrics/schema.mjs +1 -1
- package/browser/common/types/options/observability/schema.mjs +4 -2
- package/browser/common/types/options/offload/index.mjs +5 -0
- package/browser/common/types/options/offload/schema.mjs +16 -0
- package/browser/common/types/options/outbound-fetch/schema.mjs +1 -1
- package/browser/common/types/options/pagination/schema.mjs +1 -1
- package/browser/common/types/options/redis/schema.mjs +13 -3
- package/browser/common/types/options/registry/schema.mjs +1 -1
- package/browser/common/types/options/server-info/schema.mjs +1 -1
- package/browser/common/types/options/session/schema.mjs +1 -1
- package/browser/common/types/options/skills-http/schema.mjs +1 -1
- package/browser/common/types/options/sqlite/resolve.mjs +1 -0
- package/browser/common/types/options/sqlite/schema.mjs +1 -1
- package/browser/common/types/options/transport/schema.mjs +1 -1
- package/browser/common/utils/caller-dir.utils.mjs +36 -0
- package/browser/common/utils/decide-request-intent.utils.mjs +1 -1
- package/browser/common/utils/forward-headers.utils.mjs +58 -0
- package/browser/common/utils/index.mjs +1 -1
- package/browser/common/utils/tool-lookup.utils.mjs +35 -5
- package/browser/completion/flows/complete.flow.mjs +35 -3
- package/browser/context/frontmcp-context-storage.mjs +10 -5
- package/browser/context/metadata.utils.mjs +9 -5
- package/browser/direct/connect.mjs +22 -16
- package/browser/direct/direct-client.mjs +2 -1
- package/browser/duty/duty.lifecycle.mjs +172 -0
- package/browser/duty/duty.runner.mjs +161 -0
- package/browser/elicitation/flows/elicitation-request.flow.mjs +1 -1
- package/browser/elicitation/flows/elicitation-result.flow.mjs +1 -1
- package/browser/elicitation/helpers/elicit.helper.mjs +5 -1
- package/browser/elicitation/helpers/validate-elicitation-content.mjs +1 -1
- package/browser/elicitation/index.mjs +1 -0
- package/browser/elicitation/questions/ask-question.mjs +131 -0
- package/browser/elicitation/questions/index.mjs +43 -0
- package/browser/elicitation/questions/question-inbox.routes.mjs +184 -0
- package/browser/elicitation/questions/question-scope.helper.mjs +66 -0
- package/browser/elicitation/questions/question-store.factory.mjs +104 -0
- package/browser/elicitation/questions/question-subject.mjs +14 -0
- package/browser/elicitation/questions/question.errors.mjs +51 -0
- package/browser/elicitation/questions/question.store.mjs +216 -0
- package/browser/elicitation/send-elicitation-result.tool.mjs +1 -1
- package/browser/elicitation/store/elicitation-store.factory.mjs +10 -32
- package/browser/errors/authorization-required.error.mjs +1 -1
- package/browser/errors/browser-entry-point.errors.mjs +19 -0
- package/browser/errors/browser-store.errors.mjs +39 -0
- package/browser/errors/build-store.errors.mjs +15 -0
- package/browser/errors/duty.errors.mjs +23 -0
- package/browser/errors/http-route.errors.mjs +48 -0
- package/browser/errors/index.mjs +71 -3
- package/browser/errors/job.errors.mjs +92 -2
- package/browser/errors/lazy-app.errors.mjs +30 -0
- package/browser/errors/mcp.error.mjs +90 -2
- package/browser/errors/misconfiguration.mjs +2 -1
- package/browser/errors/offload.errors.mjs +59 -0
- package/browser/errors/provider.errors.mjs +9 -0
- package/browser/errors/registry.errors.mjs +24 -1
- package/browser/errors/sdk.errors.mjs +6 -0
- package/browser/errors/shared-server.errors.mjs +31 -0
- package/browser/esm-loader/esm-auth.types.mjs +1 -1
- package/browser/esm-loader/esm-manifest.mjs +1 -1
- package/browser/esm-loader/factories/esm-record-builders.mjs +1 -1
- package/browser/flows/deferred-flow.mjs +20 -0
- package/browser/flows/flow.instance.mjs +62 -7
- package/browser/flows/flow.registry.mjs +1 -1
- package/browser/flows/flow.stages.mjs +17 -3
- package/browser/front-mcp/detached-job.flag.mjs +26 -0
- package/browser/front-mcp/front-mcp.mjs +142 -55
- package/browser/front-mcp/manifest-mode.flag.mjs +12 -0
- package/browser/front-mcp/shutdown-signals.mjs +22 -2
- package/browser/front-mcp/static-startup.check.mjs +1 -1
- package/browser/front-mcp/stdio-console.mjs +28 -0
- package/browser/hooks/hook-observers.mjs +87 -0
- package/browser/hooks/hook-order.mjs +155 -0
- package/browser/hooks/hook.registry.mjs +32 -1
- package/browser/http-route/flows/http.route.flow.mjs +171 -0
- package/browser/http-route/http-route.table.mjs +148 -0
- package/browser/http-route/people-sign-in.routes.mjs +112 -0
- package/browser/http-route/sse-route.stream.mjs +100 -0
- package/browser/index.cjs +49761 -41211
- package/browser/index.mjs +220 -12
- package/browser/job/execution/index.mjs +2 -1
- package/browser/job/execution/job-execution.manager.mjs +426 -34
- package/browser/job/flows/execute-job.flow.mjs +66 -8
- package/browser/job/index.mjs +12 -5
- package/browser/job/job-admission.mjs +117 -0
- package/browser/job/job-attempt.mjs +72 -6
- package/browser/job/job-run-access.mjs +29 -0
- package/browser/job/job-scope.helper.mjs +98 -16
- package/browser/job/job.instance.mjs +3 -2
- package/browser/job/resources/job-run.resource.mjs +51 -0
- package/browser/job/runner/detached-job.worker.mjs +84 -0
- package/browser/job/runner/job-runner.mjs +74 -0
- package/browser/job/runner/run-flusher.mjs +86 -0
- package/browser/job/store/index.mjs +5 -1
- package/browser/job/store/job-definition-store.factory.mjs +14 -2
- package/browser/job/store/job-state-store.factory.mjs +25 -4
- package/browser/job/store/job-state.interface.mjs +11 -0
- package/browser/job/store/memory-job-state.store.mjs +26 -2
- package/browser/job/store/redis-job-state.store.mjs +39 -10
- package/browser/job/store/storage-job-definition.store.mjs +47 -0
- package/browser/job/store/storage-job-state.store.mjs +83 -0
- package/browser/job/tools/cancel-job.tool.mjs +46 -0
- package/browser/job/tools/execute-job.tool.mjs +5 -3
- package/browser/job/tools/get-job-status.tool.mjs +3 -20
- package/browser/job/tools/index.mjs +6 -4
- package/browser/job/tools/list-jobs.tool.mjs +1 -1
- package/browser/job/tools/register-job.tool.mjs +1 -1
- package/browser/job/tools/remove-job.tool.mjs +1 -1
- package/browser/logger/logger.registry.mjs +11 -0
- package/browser/logging/flows/set-level.flow.mjs +1 -1
- package/browser/manifest/build-manifest.mjs +20 -0
- package/browser/manifest/build-server-manifest.mjs +181 -0
- package/browser/manifest/index.mjs +12 -0
- package/browser/manifest/instructions-budget.check.mjs +14 -0
- package/browser/manifest/manifest-lint.mjs +63 -0
- package/browser/manifest/server-manifest.schema.mjs +107 -0
- package/browser/mcp-registry/flows/server-card.flow.mjs +1 -1
- package/browser/mcp-registry/flows/well-known.ai-catalog.flow.mjs +1 -1
- package/browser/metrics/metrics.service.mjs +1 -1
- package/browser/notification/notification.service.mjs +10 -3
- package/browser/offload/offload-pool.mjs +323 -0
- package/browser/offload/offload-worker.globals.mjs +36 -0
- package/browser/offload/offload-worker.source.mjs +102 -0
- package/browser/offload/offload.service.mjs +29 -0
- package/browser/offload/read-in-worker.mjs +25 -0
- package/browser/offload/run-job-in-worker.mjs +39 -0
- package/browser/offload/worker-job.runner.mjs +38 -0
- package/browser/offload/worker-jobs.mjs +21 -0
- package/browser/offload/worker-resource.reader.mjs +83 -0
- package/browser/offload/worker-resources.mjs +30 -0
- package/browser/plugin/plugin.registry.mjs +15 -2
- package/browser/prompt/flows/get-prompt.flow.mjs +28 -1
- package/browser/prompt/flows/prompts-list.flow.mjs +14 -3
- package/browser/prompt/prompt.registry.mjs +4 -0
- package/browser/provider/create-container.mjs +84 -0
- package/browser/provider/provider.lifecycle.mjs +62 -0
- package/browser/provider/provider.registry.mjs +86 -1
- package/browser/provider/store.provider.mjs +28 -0
- package/browser/remote-mcp/mcp-client.service.mjs +9 -8
- package/browser/resource/flows/read-resource.flow.mjs +62 -6
- package/browser/resource/flows/resource-templates-list.flow.mjs +15 -3
- package/browser/resource/flows/resources-list.flow.mjs +22 -4
- package/browser/resource/flows/subscribe-resource.flow.mjs +33 -11
- package/browser/resource/flows/unsubscribe-resource.flow.mjs +1 -1
- package/browser/resource/materialized/index.mjs +14 -0
- package/browser/resource/materialized/materialized-resource.context.mjs +30 -0
- package/browser/resource/materialized/materialized-resources.mjs +82 -0
- package/browser/resource/materialized/resource-store.mjs +197 -0
- package/browser/resource/resource.instance.mjs +2 -1
- package/browser/resource/resource.registry.mjs +4 -0
- package/browser/scope/browser-stores.mjs +154 -0
- package/browser/scope/dev-events-observability.mjs +14 -0
- package/browser/scope/flows/http.request.flow.mjs +1 -1
- package/browser/scope/flows/request-log.redaction.mjs +17 -3
- package/browser/scope/http-scope.helper.mjs +10 -4
- package/browser/scope/observability-scope.helper.mjs +8 -2
- package/browser/scope/scope.instance.mjs +150 -55
- package/browser/server/security/replaceable-directory.mjs +16 -0
- package/browser/server/security/same-origin.mjs +35 -0
- package/browser/server/server.validation.mjs +25 -4
- package/browser/shared/browser-shared-server.mjs +8 -0
- package/browser/skill/flows/filter-skills.flow.mjs +1 -1
- package/browser/skill/flows/http/llm-full-txt.flow.mjs +1 -1
- package/browser/skill/flows/http/llm-txt.flow.mjs +1 -1
- package/browser/skill/flows/http/skills-api.flow.mjs +1 -1
- package/browser/skill/flows/load-skill.flow.mjs +1 -1
- package/browser/skill/flows/search-skills.flow.mjs +1 -1
- package/browser/skill/skill-instructions.helper.mjs +7 -1
- package/browser/skill/skill.registry.mjs +1 -0
- package/browser/skill/sync/skill-hash.mjs +5 -4
- package/browser/storage/sqlite-storage.provider.mjs +24 -0
- package/browser/subsystems.mjs +71 -0
- package/browser/surface/entry-enabled.mjs +26 -0
- package/browser/surface/file-signal.mjs +118 -0
- package/browser/surface/index.mjs +20 -0
- package/browser/surface/live-surface.mjs +126 -0
- package/browser/surface/unchanged-lists.mjs +17 -0
- package/browser/task/flows/tasks-cancel.flow.mjs +1 -1
- package/browser/task/flows/tasks-get.flow.mjs +1 -1
- package/browser/task/flows/tasks-list.flow.mjs +1 -1
- package/browser/task/flows/tasks-result.flow.mjs +1 -1
- package/browser/task/helpers/cli-task-runner.mjs +6 -3
- package/browser/task/index.mjs +3 -1
- package/browser/task/store/task-store.factory.mjs +9 -22
- package/browser/task/task-scope.runtime.mjs +19 -0
- package/browser/third-party/protocol-client.mjs +6 -0
- package/browser/tool/flows/call-tool.flow.mjs +162 -16
- package/browser/tool/flows/tools-list.flow.mjs +28 -8
- package/browser/tool/tool.instance.mjs +1 -1
- package/browser/tool/tool.registry.mjs +25 -1
- package/browser/tool/tool.utils.mjs +2 -2
- package/browser/transport/adapters/transport.local.adapter.mjs +4 -4
- package/browser/transport/flows/handle.mcp-20260728.flow.mjs +55 -6
- package/browser/transport/flows/handle.sse.flow.mjs +14 -2
- package/browser/transport/flows/handle.stateless-http.flow.mjs +1 -1
- package/browser/transport/flows/handle.streamable-http.flow.mjs +14 -2
- package/browser/transport/in-memory-server.mjs +4 -4
- package/browser/transport/mcp-20260728/dispatcher.mjs +1 -1
- package/browser/transport/mcp-20260728/request-state.mjs +2 -1
- package/browser/transport/mcp-20260728/result-decorator.mjs +11 -1
- package/browser/transport/mcp-20260728/subscriptions.mjs +16 -5
- package/browser/transport/mcp-handlers/initialize-request.handler.mjs +1 -1
- package/browser/transport/mcp-handlers/mcp-error.utils.mjs +15 -3
- package/browser/transport/mcp-handlers/skills-mcp.types.mjs +1 -1
- package/browser/transport/mcp-server.factory.mjs +14 -0
- package/browser/transport/stdio-revision-router.mjs +43 -7
- package/browser/transport/streamable-http-preload.mjs +19 -0
- package/browser/transport/web-fetch-handler.mjs +17 -5
- package/browser/transport/web-standard-mcp.mjs +4 -3
- package/browser/utils/abort.utils.mjs +10 -0
- package/browser/workflow/engine/workflow-step.executor.mjs +6 -5
- package/browser/workflow/tools/execute-workflow.tool.mjs +1 -1
- package/browser/workflow/tools/get-workflow-status.tool.mjs +3 -20
- package/browser/workflow/tools/list-workflows.tool.mjs +1 -1
- package/browser/workflow/tools/register-workflow.tool.mjs +1 -1
- package/browser/workflow/tools/remove-workflow.tool.mjs +1 -1
- package/builtin/call-recorder/call-record.d.ts +34 -0
- package/builtin/call-recorder/call-record.d.ts.map +1 -0
- package/builtin/call-recorder/call-record.writer.d.ts +26 -0
- package/builtin/call-recorder/call-record.writer.d.ts.map +1 -0
- package/builtin/call-recorder/call-recorder.options.d.ts +23 -0
- package/builtin/call-recorder/call-recorder.options.d.ts.map +1 -0
- package/builtin/call-recorder/call-recorder.plugin.d.ts +40 -0
- package/builtin/call-recorder/call-recorder.plugin.d.ts.map +1 -0
- package/builtin/call-recorder/index.d.ts +4 -0
- package/builtin/call-recorder/index.d.ts.map +1 -0
- package/channel/reply/reply.types.d.ts +1 -1
- package/channel/reply/reply.types.d.ts.map +1 -1
- package/common/common.schema.d.ts +1 -1
- package/common/common.schema.d.ts.map +1 -1
- package/common/decorators/duty.decorator.d.ts +11 -0
- package/common/decorators/duty.decorator.d.ts.map +1 -0
- package/common/decorators/front-mcp.decorator.d.ts.map +1 -1
- package/common/decorators/hook.decorator.d.ts.map +1 -1
- package/common/decorators/http-route.decorator.d.ts +9 -0
- package/common/decorators/http-route.decorator.d.ts.map +1 -0
- package/common/decorators/index.d.ts +2 -0
- package/common/decorators/index.d.ts.map +1 -1
- package/common/decorators/job.decorator.d.ts.map +1 -1
- package/common/decorators/resource.decorator.d.ts.map +1 -1
- package/common/dynamic/dynamic.plugin.d.ts +17 -0
- package/common/dynamic/dynamic.plugin.d.ts.map +1 -1
- package/common/entries/job.entry.d.ts +2 -1
- package/common/entries/job.entry.d.ts.map +1 -1
- package/common/entries/scope.entry.d.ts +17 -0
- package/common/entries/scope.entry.d.ts.map +1 -1
- package/common/flow/flow.utils.d.ts.map +1 -1
- package/common/interfaces/agent.interface.d.ts.map +1 -1
- package/common/interfaces/app.interface.d.ts +2 -2
- package/common/interfaces/app.interface.d.ts.map +1 -1
- package/common/interfaces/duty.interface.d.ts +10 -0
- package/common/interfaces/duty.interface.d.ts.map +1 -0
- package/common/interfaces/execution-context.interface.d.ts +27 -0
- package/common/interfaces/execution-context.interface.d.ts.map +1 -1
- package/common/interfaces/flow.interface.d.ts +2 -0
- package/common/interfaces/flow.interface.d.ts.map +1 -1
- package/common/interfaces/http-route.interface.d.ts +42 -0
- package/common/interfaces/http-route.interface.d.ts.map +1 -0
- package/common/interfaces/index.d.ts +2 -0
- package/common/interfaces/index.d.ts.map +1 -1
- package/common/interfaces/job.interface.d.ts +19 -5
- package/common/interfaces/job.interface.d.ts.map +1 -1
- package/common/interfaces/logger.interface.d.ts +6 -1
- package/common/interfaces/logger.interface.d.ts.map +1 -1
- package/common/interfaces/provider.interface.d.ts +12 -0
- package/common/interfaces/provider.interface.d.ts.map +1 -1
- package/common/interfaces/resource.interface.d.ts.map +1 -1
- package/common/interfaces/tool.interface.d.ts.map +1 -1
- package/common/metadata/agent.metadata.d.ts.map +1 -1
- package/common/metadata/app.metadata.d.ts +75 -4
- package/common/metadata/app.metadata.d.ts.map +1 -1
- package/common/metadata/channel.metadata.d.ts +2 -2
- package/common/metadata/duty.metadata.d.ts +32 -0
- package/common/metadata/duty.metadata.d.ts.map +1 -0
- package/common/metadata/enabled.metadata.d.ts +18 -0
- package/common/metadata/enabled.metadata.d.ts.map +1 -0
- package/common/metadata/flow.metadata.d.ts +2 -2
- package/common/metadata/flow.metadata.d.ts.map +1 -1
- package/common/metadata/front-mcp-stores.d.ts +5 -0
- package/common/metadata/front-mcp-stores.d.ts.map +1 -0
- package/common/metadata/front-mcp.metadata.d.ts +2459 -129
- package/common/metadata/front-mcp.metadata.d.ts.map +1 -1
- package/common/metadata/hook.metadata.d.ts +40 -1
- package/common/metadata/hook.metadata.d.ts.map +1 -1
- package/common/metadata/http-route.metadata.d.ts +44 -0
- package/common/metadata/http-route.metadata.d.ts.map +1 -0
- package/common/metadata/index.d.ts +4 -0
- package/common/metadata/index.d.ts.map +1 -1
- package/common/metadata/job.metadata.d.ts +47 -3
- package/common/metadata/job.metadata.d.ts.map +1 -1
- package/common/metadata/materialized.metadata.d.ts +33 -0
- package/common/metadata/materialized.metadata.d.ts.map +1 -0
- package/common/metadata/output-policy.d.ts +39 -1
- package/common/metadata/output-policy.d.ts.map +1 -1
- package/common/metadata/plugin.metadata.d.ts +1 -1
- package/common/metadata/prompt.metadata.d.ts +8 -0
- package/common/metadata/prompt.metadata.d.ts.map +1 -1
- package/common/metadata/resource.metadata.d.ts +43 -0
- package/common/metadata/resource.metadata.d.ts.map +1 -1
- package/common/metadata/skill.metadata.d.ts +2 -2
- package/common/metadata/skill.metadata.d.ts.map +1 -1
- package/common/metadata/tool.metadata.d.ts +26 -10
- package/common/metadata/tool.metadata.d.ts.map +1 -1
- package/common/metadata/workflow.metadata.d.ts +2 -2
- package/common/metadata/workflow.metadata.d.ts.map +1 -1
- package/common/records/app.record.d.ts +18 -3
- package/common/records/app.record.d.ts.map +1 -1
- package/common/schemas/annotated-class.schema.d.ts +2 -2
- package/common/schemas/annotated-class.schema.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/tokens/app.tokens.d.ts.map +1 -1
- package/common/tokens/front-mcp.tokens.d.ts.map +1 -1
- package/common/tokens/job.tokens.d.ts +2 -0
- package/common/tokens/job.tokens.d.ts.map +1 -1
- package/common/tokens/prompt.tokens.d.ts +1 -0
- package/common/tokens/prompt.tokens.d.ts.map +1 -1
- package/common/tokens/resource.tokens.d.ts +5 -0
- package/common/tokens/resource.tokens.d.ts.map +1 -1
- package/common/tokens/tool.tokens.d.ts +2 -0
- package/common/tokens/tool.tokens.d.ts.map +1 -1
- package/common/types/auth/session.types.d.ts +4 -0
- package/common/types/auth/session.types.d.ts.map +1 -1
- package/common/types/options/clients/index.d.ts +4 -0
- package/common/types/options/clients/index.d.ts.map +1 -0
- package/common/types/options/clients/interfaces.d.ts +47 -0
- package/common/types/options/clients/interfaces.d.ts.map +1 -0
- package/common/types/options/clients/schema.d.ts +20 -0
- package/common/types/options/clients/schema.d.ts.map +1 -0
- package/common/types/options/devtools/index.d.ts +3 -0
- package/common/types/options/devtools/index.d.ts.map +1 -0
- package/common/types/options/devtools/schema.d.ts +16 -0
- package/common/types/options/devtools/schema.d.ts.map +1 -0
- package/common/types/options/elicitation/index.d.ts +1 -1
- package/common/types/options/elicitation/index.d.ts.map +1 -1
- package/common/types/options/elicitation/interfaces.d.ts +38 -0
- package/common/types/options/elicitation/interfaces.d.ts.map +1 -1
- package/common/types/options/elicitation/schema.d.ts +3 -1
- package/common/types/options/elicitation/schema.d.ts.map +1 -1
- package/common/types/options/ext-apps/schema.d.ts +1 -1
- package/common/types/options/ext-apps/schema.d.ts.map +1 -1
- package/common/types/options/health/schema.d.ts +1 -1
- package/common/types/options/health/schema.d.ts.map +1 -1
- package/common/types/options/http/index.d.ts +1 -1
- package/common/types/options/http/index.d.ts.map +1 -1
- package/common/types/options/http/interfaces.d.ts +29 -0
- package/common/types/options/http/interfaces.d.ts.map +1 -1
- package/common/types/options/http/schema.d.ts +6 -1
- package/common/types/options/http/schema.d.ts.map +1 -1
- package/common/types/options/index.d.ts +5 -0
- package/common/types/options/index.d.ts.map +1 -1
- package/common/types/options/instructions-budget/index.d.ts +3 -0
- package/common/types/options/instructions-budget/index.d.ts.map +1 -0
- package/common/types/options/instructions-budget/schema.d.ts +29 -0
- package/common/types/options/instructions-budget/schema.d.ts.map +1 -0
- package/common/types/options/lifecycle/index.d.ts +3 -0
- package/common/types/options/lifecycle/index.d.ts.map +1 -0
- package/common/types/options/lifecycle/schema.d.ts +20 -0
- package/common/types/options/lifecycle/schema.d.ts.map +1 -0
- package/common/types/options/logging/schema.d.ts +1 -1
- package/common/types/options/logging/schema.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/types/options/observability/interfaces.d.ts +29 -0
- package/common/types/options/observability/interfaces.d.ts.map +1 -1
- package/common/types/options/observability/schema.d.ts +3 -1
- package/common/types/options/observability/schema.d.ts.map +1 -1
- package/common/types/options/offload/index.d.ts +3 -0
- package/common/types/options/offload/index.d.ts.map +1 -0
- package/common/types/options/offload/schema.d.ts +34 -0
- package/common/types/options/offload/schema.d.ts.map +1 -0
- package/common/types/options/outbound-fetch/schema.d.ts +1 -1
- package/common/types/options/outbound-fetch/schema.d.ts.map +1 -1
- package/common/types/options/pagination/schema.d.ts +1 -1
- package/common/types/options/pagination/schema.d.ts.map +1 -1
- package/common/types/options/redis/schema.d.ts +4 -2
- package/common/types/options/redis/schema.d.ts.map +1 -1
- package/common/types/options/registry/schema.d.ts +1 -1
- package/common/types/options/registry/schema.d.ts.map +1 -1
- package/common/types/options/server-info/schema.d.ts +1 -1
- package/common/types/options/server-info/schema.d.ts.map +1 -1
- package/common/types/options/session/schema.d.ts +9 -1
- package/common/types/options/session/schema.d.ts.map +1 -1
- package/common/types/options/skills-http/schema.d.ts +5 -5
- package/common/types/options/skills-http/schema.d.ts.map +1 -1
- package/common/types/options/sqlite/resolve.d.ts +2 -0
- package/common/types/options/sqlite/resolve.d.ts.map +1 -1
- package/common/types/options/sqlite/schema.d.ts +1 -1
- package/common/types/options/sqlite/schema.d.ts.map +1 -1
- package/common/types/options/transport/schema.d.ts +3 -1
- package/common/types/options/transport/schema.d.ts.map +1 -1
- package/common/utils/caller-dir.utils.d.ts +2 -0
- package/common/utils/caller-dir.utils.d.ts.map +1 -1
- package/common/utils/forward-headers.utils.d.ts +12 -0
- package/common/utils/forward-headers.utils.d.ts.map +1 -0
- package/common/utils/tool-lookup.utils.d.ts +13 -3
- package/common/utils/tool-lookup.utils.d.ts.map +1 -1
- package/completion/flows/complete.flow.d.ts +9 -2
- package/completion/flows/complete.flow.d.ts.map +1 -1
- package/context/frontmcp-context-storage.d.ts +7 -4
- package/context/frontmcp-context-storage.d.ts.map +1 -1
- package/context/metadata.utils.d.ts +11 -5
- package/context/metadata.utils.d.ts.map +1 -1
- package/direct/connect.d.ts +4 -2
- package/direct/connect.d.ts.map +1 -1
- package/duty/duty.lifecycle.d.ts +27 -0
- package/duty/duty.lifecycle.d.ts.map +1 -0
- package/duty/duty.runner.d.ts +61 -0
- package/duty/duty.runner.d.ts.map +1 -0
- package/elicitation/elicitation.types.d.ts +13 -0
- package/elicitation/elicitation.types.d.ts.map +1 -1
- package/elicitation/flows/elicitation-request.flow.d.ts +1 -1
- package/elicitation/flows/elicitation-request.flow.d.ts.map +1 -1
- package/elicitation/flows/elicitation-result.flow.d.ts +1 -1
- package/elicitation/flows/elicitation-result.flow.d.ts.map +1 -1
- package/elicitation/helpers/elicit.helper.d.ts +8 -0
- package/elicitation/helpers/elicit.helper.d.ts.map +1 -1
- package/elicitation/index.d.ts +1 -0
- package/elicitation/index.d.ts.map +1 -1
- package/elicitation/questions/ask-question.d.ts +29 -0
- package/elicitation/questions/ask-question.d.ts.map +1 -0
- package/elicitation/questions/index.d.ts +7 -0
- package/elicitation/questions/index.d.ts.map +1 -0
- package/elicitation/questions/question-inbox.routes.d.ts +17 -0
- package/elicitation/questions/question-inbox.routes.d.ts.map +1 -0
- package/elicitation/questions/question-scope.helper.d.ts +41 -0
- package/elicitation/questions/question-scope.helper.d.ts.map +1 -0
- package/elicitation/questions/question-store.factory.d.ts +44 -0
- package/elicitation/questions/question-store.factory.d.ts.map +1 -0
- package/elicitation/questions/question-subject.d.ts +8 -0
- package/elicitation/questions/question-subject.d.ts.map +1 -0
- package/elicitation/questions/question.errors.d.ts +30 -0
- package/elicitation/questions/question.errors.d.ts.map +1 -0
- package/elicitation/questions/question.store.d.ts +89 -0
- package/elicitation/questions/question.store.d.ts.map +1 -0
- package/elicitation/store/elicitation-store.factory.d.ts.map +1 -1
- package/errors/authorization-required.error.d.ts +1 -1
- package/errors/authorization-required.error.d.ts.map +1 -1
- package/errors/browser-entry-point.errors.d.ts +14 -0
- package/errors/browser-entry-point.errors.d.ts.map +1 -0
- package/errors/browser-store.errors.d.ts +56 -0
- package/errors/browser-store.errors.d.ts.map +1 -0
- package/errors/build-store.errors.d.ts +7 -0
- package/errors/build-store.errors.d.ts.map +1 -0
- package/errors/duty.errors.d.ts +10 -0
- package/errors/duty.errors.d.ts.map +1 -0
- package/errors/error-handler.d.ts +1 -0
- package/errors/error-handler.d.ts.map +1 -1
- package/errors/http-route.errors.d.ts +30 -0
- package/errors/http-route.errors.d.ts.map +1 -0
- package/errors/index.d.ts +12 -4
- package/errors/index.d.ts.map +1 -1
- package/errors/job.errors.d.ts +41 -1
- package/errors/job.errors.d.ts.map +1 -1
- package/errors/lazy-app.errors.d.ts +26 -0
- package/errors/lazy-app.errors.d.ts.map +1 -0
- package/errors/mcp.error.d.ts +71 -1
- package/errors/mcp.error.d.ts.map +1 -1
- package/errors/misconfiguration.d.ts.map +1 -1
- package/errors/offload.errors.d.ts +32 -0
- package/errors/offload.errors.d.ts.map +1 -0
- package/errors/provider.errors.d.ts +7 -0
- package/errors/provider.errors.d.ts.map +1 -1
- package/errors/registry.errors.d.ts +16 -0
- package/errors/registry.errors.d.ts.map +1 -1
- package/errors/sdk.errors.d.ts +6 -0
- package/errors/sdk.errors.d.ts.map +1 -1
- package/errors/shared-server.errors.d.ts +18 -0
- package/errors/shared-server.errors.d.ts.map +1 -0
- package/esm/index.mjs +179 -36
- package/esm/job/tools/index.mjs +10 -0
- package/esm/transport/index.mjs +19 -0
- package/esm/workflow/tools/index.mjs +9 -0
- package/flows/deferred-flow.d.ts +18 -0
- package/flows/deferred-flow.d.ts.map +1 -0
- package/flows/flow.instance.d.ts +9 -0
- package/flows/flow.instance.d.ts.map +1 -1
- package/flows/flow.registry.d.ts.map +1 -1
- package/flows/flow.stages.d.ts +5 -1
- package/flows/flow.stages.d.ts.map +1 -1
- package/front-mcp/detached-job.flag.d.ts +15 -0
- package/front-mcp/detached-job.flag.d.ts.map +1 -0
- package/front-mcp/front-mcp.d.ts +25 -1
- package/front-mcp/front-mcp.d.ts.map +1 -1
- package/front-mcp/manifest-mode.flag.d.ts +4 -0
- package/front-mcp/manifest-mode.flag.d.ts.map +1 -0
- package/front-mcp/shutdown-signals.d.ts +15 -3
- package/front-mcp/shutdown-signals.d.ts.map +1 -1
- package/front-mcp/stdio-console.d.ts +3 -0
- package/front-mcp/stdio-console.d.ts.map +1 -0
- package/hooks/hook-observers.d.ts +57 -0
- package/hooks/hook-observers.d.ts.map +1 -0
- package/hooks/hook-order.d.ts +24 -0
- package/hooks/hook-order.d.ts.map +1 -0
- package/hooks/hook.registry.d.ts +2 -0
- package/hooks/hook.registry.d.ts.map +1 -1
- package/http-route/flows/http.route.flow.d.ts +37 -0
- package/http-route/flows/http.route.flow.d.ts.map +1 -0
- package/http-route/http-route.table.d.ts +40 -0
- package/http-route/http-route.table.d.ts.map +1 -0
- package/http-route/people-sign-in.routes.d.ts +17 -0
- package/http-route/people-sign-in.routes.d.ts.map +1 -0
- package/http-route/sse-route.stream.d.ts +42 -0
- package/http-route/sse-route.stream.d.ts.map +1 -0
- package/index.d.ts +108 -75
- package/index.d.ts.map +1 -1
- package/index.js +179 -36
- package/job/execution/index.d.ts +2 -2
- package/job/execution/index.d.ts.map +1 -1
- package/job/execution/job-execution.manager.d.ts +120 -2
- package/job/execution/job-execution.manager.d.ts.map +1 -1
- package/job/flows/execute-job.flow.d.ts +21 -4
- package/job/flows/execute-job.flow.d.ts.map +1 -1
- package/job/index.d.ts +4 -0
- package/job/index.d.ts.map +1 -1
- package/job/job-admission.d.ts +45 -0
- package/job/job-admission.d.ts.map +1 -0
- package/job/job-attempt.d.ts +29 -5
- package/job/job-attempt.d.ts.map +1 -1
- package/job/job-run-access.d.ts +15 -0
- package/job/job-run-access.d.ts.map +1 -0
- package/job/job-scope.helper.d.ts +39 -11
- package/job/job-scope.helper.d.ts.map +1 -1
- package/job/job.instance.d.ts +2 -1
- package/job/job.instance.d.ts.map +1 -1
- package/job/resources/job-run.resource.d.ts +15 -0
- package/job/resources/job-run.resource.d.ts.map +1 -0
- package/job/runner/detached-job.worker.d.ts +16 -0
- package/job/runner/detached-job.worker.d.ts.map +1 -0
- package/job/runner/job-runner.d.ts +35 -0
- package/job/runner/job-runner.d.ts.map +1 -0
- package/job/runner/run-flusher.d.ts +42 -0
- package/job/runner/run-flusher.d.ts.map +1 -0
- package/job/store/index.d.ts +2 -0
- package/job/store/index.d.ts.map +1 -1
- package/job/store/job-definition-store.factory.d.ts +8 -5
- package/job/store/job-definition-store.factory.d.ts.map +1 -1
- package/job/store/job-state-store.factory.d.ts +10 -6
- package/job/store/job-state-store.factory.d.ts.map +1 -1
- package/job/store/job-state.interface.d.ts +42 -1
- package/job/store/job-state.interface.d.ts.map +1 -1
- package/job/store/memory-job-state.store.d.ts +8 -0
- package/job/store/memory-job-state.store.d.ts.map +1 -1
- package/job/store/redis-job-state.store.d.ts +15 -1
- package/job/store/redis-job-state.store.d.ts.map +1 -1
- package/job/store/storage-job-definition.store.d.ts +25 -0
- package/job/store/storage-job-definition.store.d.ts.map +1 -0
- package/job/store/storage-job-state.store.d.ts +34 -0
- package/job/store/storage-job-state.store.d.ts.map +1 -0
- package/job/tools/cancel-job.tool.d.ts +10 -0
- package/job/tools/cancel-job.tool.d.ts.map +1 -0
- package/job/tools/execute-job.tool.d.ts +11 -1
- package/job/tools/execute-job.tool.d.ts.map +1 -1
- package/job/tools/get-job-status.tool.d.ts +0 -12
- package/job/tools/get-job-status.tool.d.ts.map +1 -1
- package/job/tools/index.d.ts +1 -0
- package/job/tools/index.d.ts.map +1 -1
- package/job/tools/index.js +39 -0
- package/lazy-subsystems.d.ts +2 -0
- package/lazy-subsystems.d.ts.map +1 -0
- package/logger/logger.registry.d.ts.map +1 -1
- package/manifest/build-manifest.d.ts +17 -0
- package/manifest/build-manifest.d.ts.map +1 -0
- package/manifest/build-server-manifest.d.ts +28 -0
- package/manifest/build-server-manifest.d.ts.map +1 -0
- package/manifest/index.d.ts +6 -0
- package/manifest/index.d.ts.map +1 -0
- package/manifest/instructions-budget.check.d.ts +15 -0
- package/manifest/instructions-budget.check.d.ts.map +1 -0
- package/manifest/manifest-lint.d.ts +29 -0
- package/manifest/manifest-lint.d.ts.map +1 -0
- package/manifest/server-manifest.schema.d.ts +234 -0
- package/manifest/server-manifest.schema.d.ts.map +1 -0
- package/mcp-registry/flows/server-card.flow.d.ts +1 -1
- package/mcp-registry/flows/server-card.flow.d.ts.map +1 -1
- package/mcp-registry/flows/well-known.ai-catalog.flow.d.ts +1 -1
- package/mcp-registry/flows/well-known.ai-catalog.flow.d.ts.map +1 -1
- package/notification/notification.service.d.ts.map +1 -1
- package/offload/index.d.ts +3 -0
- package/offload/index.d.ts.map +1 -0
- package/offload/offload-pool.d.ts +41 -0
- package/offload/offload-pool.d.ts.map +1 -0
- package/offload/offload-worker.globals.d.ts +34 -0
- package/offload/offload-worker.globals.d.ts.map +1 -0
- package/offload/offload-worker.source.d.ts +3 -0
- package/offload/offload-worker.source.d.ts.map +1 -0
- package/offload/offload.service.d.ts +15 -0
- package/offload/offload.service.d.ts.map +1 -0
- package/offload/offload.types.d.ts +30 -0
- package/offload/offload.types.d.ts.map +1 -0
- package/offload/read-in-worker.d.ts +5 -0
- package/offload/read-in-worker.d.ts.map +1 -0
- package/offload/run-job-in-worker.d.ts +9 -0
- package/offload/run-job-in-worker.d.ts.map +1 -0
- package/offload/worker-job.runner.d.ts +5 -0
- package/offload/worker-job.runner.d.ts.map +1 -0
- package/offload/worker-jobs.d.ts +14 -0
- package/offload/worker-jobs.d.ts.map +1 -0
- package/offload/worker-resource.reader.d.ts +21 -0
- package/offload/worker-resource.reader.d.ts.map +1 -0
- package/offload/worker-resources.d.ts +24 -0
- package/offload/worker-resources.d.ts.map +1 -0
- package/package.json +23 -11
- package/plugin/enforced-metadata.check.d.ts +7 -6
- package/plugin/enforced-metadata.check.d.ts.map +1 -1
- package/plugin/plugin.registry.d.ts +2 -0
- package/plugin/plugin.registry.d.ts.map +1 -1
- package/prompt/flows/get-prompt.flow.d.ts +9 -2
- package/prompt/flows/get-prompt.flow.d.ts.map +1 -1
- package/prompt/flows/prompts-list.flow.d.ts +3 -1
- package/prompt/flows/prompts-list.flow.d.ts.map +1 -1
- package/prompt/prompt.registry.d.ts +2 -0
- package/prompt/prompt.registry.d.ts.map +1 -1
- package/provider/create-container.d.ts +31 -0
- package/provider/create-container.d.ts.map +1 -0
- package/provider/provider.lifecycle.d.ts +23 -0
- package/provider/provider.lifecycle.d.ts.map +1 -0
- package/provider/provider.registry.d.ts +27 -0
- package/provider/provider.registry.d.ts.map +1 -1
- package/provider/store.provider.d.ts +13 -0
- package/provider/store.provider.d.ts.map +1 -0
- package/remote-mcp/mcp-client.service.d.ts.map +1 -1
- package/resource/flows/read-resource.flow.d.ts +12 -3
- package/resource/flows/read-resource.flow.d.ts.map +1 -1
- package/resource/flows/resource-templates-list.flow.d.ts +3 -1
- package/resource/flows/resource-templates-list.flow.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/resource/flows/subscribe-resource.flow.d.ts +6 -2
- package/resource/flows/subscribe-resource.flow.d.ts.map +1 -1
- package/resource/materialized/index.d.ts +4 -0
- package/resource/materialized/index.d.ts.map +1 -0
- package/resource/materialized/materialized-resource.context.d.ts +13 -0
- package/resource/materialized/materialized-resource.context.d.ts.map +1 -0
- package/resource/materialized/materialized-resources.d.ts +31 -0
- package/resource/materialized/materialized-resources.d.ts.map +1 -0
- package/resource/materialized/resource-store.d.ts +72 -0
- package/resource/materialized/resource-store.d.ts.map +1 -0
- package/resource/resource.instance.d.ts.map +1 -1
- package/resource/resource.registry.d.ts +2 -0
- package/resource/resource.registry.d.ts.map +1 -1
- package/scope/browser-stores.d.ts +85 -0
- package/scope/browser-stores.d.ts.map +1 -0
- package/scope/dev-events-observability.d.ts +11 -0
- package/scope/dev-events-observability.d.ts.map +1 -0
- package/scope/flows/http.request.flow.d.ts +2 -0
- package/scope/flows/http.request.flow.d.ts.map +1 -1
- package/scope/flows/request-log.redaction.d.ts +4 -0
- package/scope/flows/request-log.redaction.d.ts.map +1 -1
- package/scope/http-scope.helper.d.ts +3 -0
- package/scope/http-scope.helper.d.ts.map +1 -1
- package/scope/observability-scope.helper.d.ts +3 -1
- package/scope/observability-scope.helper.d.ts.map +1 -1
- package/scope/scope.instance.d.ts +10 -1
- package/scope/scope.instance.d.ts.map +1 -1
- package/server/adapters/express.host.adapter.d.ts.map +1 -1
- package/server/adapters/utf8-json.parser.d.ts +3 -0
- package/server/adapters/utf8-json.parser.d.ts.map +1 -0
- package/server/security/replaceable-directory.d.ts +9 -0
- package/server/security/replaceable-directory.d.ts.map +1 -0
- package/server/security/same-origin.d.ts +12 -0
- package/server/security/same-origin.d.ts.map +1 -0
- package/server/security/unix-socket-guard.d.ts.map +1 -1
- package/server/server.validation.d.ts.map +1 -1
- package/shared/browser-shared-server.d.ts +3 -0
- package/shared/browser-shared-server.d.ts.map +1 -0
- package/shared/ensure-shared-server.d.ts +58 -0
- package/shared/ensure-shared-server.d.ts.map +1 -0
- package/shared/flows/shared.drain.flow.d.ts +49 -0
- package/shared/flows/shared.drain.flow.d.ts.map +1 -0
- package/shared/flows/shared.identify.flow.d.ts +48 -0
- package/shared/flows/shared.identify.flow.d.ts.map +1 -0
- package/shared/index.d.ts +8 -0
- package/shared/index.d.ts.map +1 -0
- package/shared/shared-attach.d.ts +35 -0
- package/shared/shared-attach.d.ts.map +1 -0
- package/shared/shared-embedded.d.ts +12 -0
- package/shared/shared-embedded.d.ts.map +1 -0
- package/shared/shared-endpoint.d.ts +44 -0
- package/shared/shared-endpoint.d.ts.map +1 -0
- package/shared/shared-files.d.ts +28 -0
- package/shared/shared-files.d.ts.map +1 -0
- package/shared/shared-serve.d.ts +34 -0
- package/shared/shared-serve.d.ts.map +1 -0
- package/shared/shared-server.identity.d.ts +15 -0
- package/shared/shared-server.identity.d.ts.map +1 -0
- package/shared/shared-server.lifecycle.d.ts +40 -0
- package/shared/shared-server.lifecycle.d.ts.map +1 -0
- package/shared/shared-server.options.d.ts +38 -0
- package/shared/shared-server.options.d.ts.map +1 -0
- package/shared/shared-version.d.ts +3 -0
- package/shared/shared-version.d.ts.map +1 -0
- package/shared/start-lock.d.ts +28 -0
- package/shared/start-lock.d.ts.map +1 -0
- package/shared/unix-socket-fetch.d.ts +6 -0
- package/shared/unix-socket-fetch.d.ts.map +1 -0
- package/skill/flows/filter-skills.flow.d.ts +1 -1
- package/skill/flows/filter-skills.flow.d.ts.map +1 -1
- package/skill/flows/load-skill.flow.d.ts +1 -1
- package/skill/flows/load-skill.flow.d.ts.map +1 -1
- package/skill/skill-instructions.helper.d.ts +2 -0
- package/skill/skill-instructions.helper.d.ts.map +1 -1
- package/skill/skill.registry.d.ts +2 -1
- package/skill/skill.registry.d.ts.map +1 -1
- package/skill/sync/skill-hash.d.ts.map +1 -1
- package/storage/sqlite-storage.provider.d.ts +14 -0
- package/storage/sqlite-storage.provider.d.ts.map +1 -0
- package/subsystems.d.ts +13 -0
- package/subsystems.d.ts.map +1 -0
- package/surface/entry-enabled.d.ts +10 -0
- package/surface/entry-enabled.d.ts.map +1 -0
- package/surface/file-signal.d.ts +27 -0
- package/surface/file-signal.d.ts.map +1 -0
- package/surface/index.d.ts +5 -0
- package/surface/index.d.ts.map +1 -0
- package/surface/live-surface.d.ts +73 -0
- package/surface/live-surface.d.ts.map +1 -0
- package/surface/unchanged-lists.d.ts +8 -0
- package/surface/unchanged-lists.d.ts.map +1 -0
- package/task/flows/tasks-cancel.flow.d.ts +1 -1
- package/task/flows/tasks-cancel.flow.d.ts.map +1 -1
- package/task/flows/tasks-get.flow.d.ts +1 -1
- package/task/flows/tasks-get.flow.d.ts.map +1 -1
- package/task/flows/tasks-list.flow.d.ts +1 -1
- package/task/flows/tasks-list.flow.d.ts.map +1 -1
- package/task/flows/tasks-result.flow.d.ts +1 -1
- package/task/flows/tasks-result.flow.d.ts.map +1 -1
- package/task/helpers/cli-task-runner.d.ts +6 -1
- package/task/helpers/cli-task-runner.d.ts.map +1 -1
- package/task/index.d.ts +1 -1
- package/task/index.d.ts.map +1 -1
- package/task/store/task-store.factory.d.ts.map +1 -1
- package/task/task-scope.runtime.d.ts +9 -0
- package/task/task-scope.runtime.d.ts.map +1 -0
- package/third-party/import-protocol-client.d.ts +3 -0
- package/third-party/import-protocol-client.d.ts.map +1 -0
- package/third-party/import-protocol-client.js +1 -0
- package/third-party/protocol-client.d.ts +4 -0
- package/third-party/protocol-client.d.ts.map +1 -0
- package/third-party/protocol-client.js +1 -0
- package/tool/flows/call-tool.flow.d.ts +41 -3
- package/tool/flows/call-tool.flow.d.ts.map +1 -1
- package/tool/flows/tools-list.flow.d.ts +6 -2
- package/tool/flows/tools-list.flow.d.ts.map +1 -1
- package/tool/tool.registry.d.ts +4 -0
- package/tool/tool.registry.d.ts.map +1 -1
- package/tool/ui/platform-adapters.d.ts +2 -1
- package/tool/ui/platform-adapters.d.ts.map +1 -1
- package/transport/adapters/transport.local.adapter.d.ts +1 -1
- package/transport/adapters/transport.local.adapter.d.ts.map +1 -1
- package/transport/event-stores/index.d.ts +2 -2
- package/transport/flows/handle.mcp-20260728.flow.d.ts +17 -0
- package/transport/flows/handle.mcp-20260728.flow.d.ts.map +1 -1
- package/transport/flows/handle.sse.flow.d.ts +3 -1
- package/transport/flows/handle.sse.flow.d.ts.map +1 -1
- package/transport/flows/handle.streamable-http.flow.d.ts +3 -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/index.js +57 -0
- package/transport/mcp-20260728/request-state.d.ts.map +1 -1
- package/transport/mcp-20260728/result-decorator.d.ts +5 -3
- package/transport/mcp-20260728/result-decorator.d.ts.map +1 -1
- package/transport/mcp-20260728/subscriptions.d.ts +5 -0
- package/transport/mcp-20260728/subscriptions.d.ts.map +1 -1
- package/transport/mcp-handlers/index.d.ts +5 -5
- package/transport/mcp-handlers/logging-set-level-request.handler.d.ts +1 -1
- package/transport/mcp-handlers/mcp-error.utils.d.ts +1 -1
- package/transport/mcp-handlers/mcp-error.utils.d.ts.map +1 -1
- package/transport/mcp-handlers/mcp-handlers.types.d.ts +1 -1
- package/transport/mcp-handlers/mcp-handlers.types.d.ts.map +1 -1
- package/transport/mcp-handlers/mcp-surface.d.ts +2 -1
- package/transport/mcp-handlers/mcp-surface.d.ts.map +1 -1
- package/transport/mcp-handlers/skills-mcp.types.d.ts +1 -1
- package/transport/mcp-handlers/skills-mcp.types.d.ts.map +1 -1
- package/transport/mcp-server.factory.d.ts +3 -0
- package/transport/mcp-server.factory.d.ts.map +1 -0
- package/transport/stdio-revision-router.d.ts +6 -1
- package/transport/stdio-revision-router.d.ts.map +1 -1
- package/transport/streamable-http-preload.d.ts +3 -0
- package/transport/streamable-http-preload.d.ts.map +1 -0
- package/transport/web-fetch-handler.d.ts +2 -2
- package/transport/web-fetch-handler.d.ts.map +1 -1
- package/transport/web-standard-mcp.d.ts.map +1 -1
- package/utils/abort.utils.d.ts +6 -0
- package/utils/abort.utils.d.ts.map +1 -0
- package/workflow/engine/workflow-step.executor.d.ts +5 -0
- package/workflow/engine/workflow-step.executor.d.ts.map +1 -1
- package/workflow/tools/get-workflow-status.tool.d.ts +0 -12
- package/workflow/tools/get-workflow-status.tool.d.ts.map +1 -1
- package/workflow/tools/index.js +37 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// libs/sdk/src/elicitation/helpers/validate-elicitation-content.ts
|
|
2
|
-
import { z } from "@frontmcp/lazy-zod";
|
|
2
|
+
import { internalZ as z } from "@frontmcp/lazy-zod";
|
|
3
3
|
function validateElicitationContent(content, jsonSchema) {
|
|
4
4
|
try {
|
|
5
5
|
const zodSchema = z.fromJSONSchema(
|
|
@@ -3,6 +3,7 @@ export { DEFAULT_ELICIT_TTL, DEFAULT_FALLBACK_WAIT_TTL } from "./elicitation.typ
|
|
|
3
3
|
import { ELICITATION_FALLBACK_JSON_SCHEMA } from "./elicitation-fallback.schema.mjs";
|
|
4
4
|
export { EncryptedElicitationStore, StorageElicitationStore, createElicitationStore, createElicitationStoreFromStorage, createMemoryElicitationStore, decryptElicitationData, deriveElicitationKey, deserializeAndDecrypt, deserializeElicitationBlob, encryptAndSerialize, encryptElicitationData, getElicitationSecret, isElicitationEncryptionAvailable, isEncryptedBlob, serializeElicitationBlob, tryDecryptStoredValue } from "./store/index.mjs";
|
|
5
5
|
export { canDeliverNotifications, extendOutputSchemaForElicitation, generateElicitationId, handleWaitingFallback, performElicit, performListRoots, performSample, sendFallbackNotification, validateElicitationContent } from "./helpers/index.mjs";
|
|
6
|
+
export { DEFAULT_QUESTION_TTL_MS, InvalidQuestionStoreError, QUESTIONS_PATH, QUESTIONS_TOPIC, QUESTION_INBOX_PATH, QuestionAlreadyAnsweredError, QuestionNotFoundError, QuestionPendingError, QuestionStore, QuestionStoreBusyError, QuestionSupersededError, createQuestionStore, printQuestionInboxLink, questionInboxRoutes, questionSubjectOf, resolveQuestionStorage } from "./questions/index.mjs";
|
|
6
7
|
export {
|
|
7
8
|
ELICITATION_FALLBACK_JSON_SCHEMA
|
|
8
9
|
};
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
// libs/sdk/src/elicitation/questions/ask-question.ts
|
|
2
|
+
import { toJSONSchema, internalZ as z } from "@frontmcp/lazy-zod";
|
|
3
|
+
import { randomUUID } from "@frontmcp/utils";
|
|
4
|
+
import { ElicitationNotSupportedError, InvalidInputError } from "../../errors/index.mjs";
|
|
5
|
+
import { DEFAULT_ELICIT_TTL } from "../elicitation.types.mjs";
|
|
6
|
+
import { questionSubjectOf } from "./question-subject.mjs";
|
|
7
|
+
import { QuestionPendingError, QuestionSupersededError } from "./question.errors.mjs";
|
|
8
|
+
import { QUESTIONS_TOPIC } from "./question.store.mjs";
|
|
9
|
+
var RECHECK_MS = 5e3;
|
|
10
|
+
var MAX_QUESTION_KEY_LENGTH = 256;
|
|
11
|
+
async function delivered(answer, schema) {
|
|
12
|
+
if (answer.status !== "accept") return { status: answer.status };
|
|
13
|
+
const parsed = await schema.safeParseAsync(answer.content);
|
|
14
|
+
if (!parsed.success) {
|
|
15
|
+
throw new InvalidInputError("The answer does not match the requested schema", parsed.error.issues);
|
|
16
|
+
}
|
|
17
|
+
return { status: "accept", content: parsed.data };
|
|
18
|
+
}
|
|
19
|
+
async function askPersistentQuestion(deps, message, schema, options) {
|
|
20
|
+
const { store, subject, signal } = deps;
|
|
21
|
+
const request = {
|
|
22
|
+
subject,
|
|
23
|
+
key: options.key,
|
|
24
|
+
message,
|
|
25
|
+
requestedSchema: toJSONSchema(schema),
|
|
26
|
+
ttlMs: options.ttlMs,
|
|
27
|
+
waiter: `call-${randomUUID()}`
|
|
28
|
+
};
|
|
29
|
+
const handOver = async (taken) => {
|
|
30
|
+
const putBack = async () => {
|
|
31
|
+
await store.restore(request, taken.answer, taken.expiresAt).catch(() => void 0);
|
|
32
|
+
return new QuestionPendingError(options.key, taken.expiresAt);
|
|
33
|
+
};
|
|
34
|
+
if (signal?.aborted) throw await putBack();
|
|
35
|
+
const result = await delivered(taken.answer, schema);
|
|
36
|
+
if (signal?.aborted) throw await putBack();
|
|
37
|
+
return result;
|
|
38
|
+
};
|
|
39
|
+
const asked = await store.ask(request);
|
|
40
|
+
if (asked.kind === "answered") return handOver(asked);
|
|
41
|
+
const { expiresAt } = asked.question;
|
|
42
|
+
const answer = await new Promise((resolve, reject) => {
|
|
43
|
+
let settled = false;
|
|
44
|
+
let queued = false;
|
|
45
|
+
let chain = Promise.resolve();
|
|
46
|
+
const finish = (settle) => {
|
|
47
|
+
if (settled) return;
|
|
48
|
+
settled = true;
|
|
49
|
+
clearTimeout(timer);
|
|
50
|
+
clearInterval(poll);
|
|
51
|
+
stop();
|
|
52
|
+
signal?.removeEventListener("abort", onAbort);
|
|
53
|
+
settle();
|
|
54
|
+
};
|
|
55
|
+
const pending = () => finish(() => reject(new QuestionPendingError(options.key, expiresAt)));
|
|
56
|
+
const handle = (outcome) => {
|
|
57
|
+
if (outcome.kind === "answered") {
|
|
58
|
+
if (settled || signal?.aborted) {
|
|
59
|
+
pending();
|
|
60
|
+
void store.restore(request, outcome.answer, outcome.expiresAt).catch(() => void 0);
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
finish(() => resolve(outcome));
|
|
64
|
+
} else if (outcome.kind === "superseded") {
|
|
65
|
+
finish(() => reject(new QuestionSupersededError(options.key)));
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
const serialized = (task) => {
|
|
69
|
+
chain = chain.then(task).catch((error) => finish(() => reject(error)));
|
|
70
|
+
};
|
|
71
|
+
const take = () => store.take(subject, options.key, request.waiter);
|
|
72
|
+
const check = () => {
|
|
73
|
+
if (settled || queued) return;
|
|
74
|
+
queued = true;
|
|
75
|
+
serialized(async () => {
|
|
76
|
+
queued = false;
|
|
77
|
+
if (!settled) handle(await take());
|
|
78
|
+
});
|
|
79
|
+
};
|
|
80
|
+
const giveUp = () => serialized(async () => {
|
|
81
|
+
if (settled) return;
|
|
82
|
+
const outcome = await take();
|
|
83
|
+
handle(outcome);
|
|
84
|
+
if (outcome.kind === "waiting") pending();
|
|
85
|
+
});
|
|
86
|
+
const onAbort = () => pending();
|
|
87
|
+
const timer = setTimeout(giveUp, options.waitMs);
|
|
88
|
+
const poll = setInterval(check, RECHECK_MS);
|
|
89
|
+
const stop = store.subscribe(QUESTIONS_TOPIC, check);
|
|
90
|
+
if (signal?.aborted) return onAbort();
|
|
91
|
+
signal?.addEventListener("abort", onAbort, { once: true });
|
|
92
|
+
check();
|
|
93
|
+
});
|
|
94
|
+
return handOver(answer);
|
|
95
|
+
}
|
|
96
|
+
async function elicitPersistent(deps, message, requestedSchema, options) {
|
|
97
|
+
const { persist } = options;
|
|
98
|
+
if (typeof persist.key !== "string" || persist.key.length === 0 || persist.key.length > MAX_QUESTION_KEY_LENGTH) {
|
|
99
|
+
throw new InvalidInputError(`persist.key must be a string of 1 to ${MAX_QUESTION_KEY_LENGTH} characters`);
|
|
100
|
+
}
|
|
101
|
+
if (options.mode === "url") throw new InvalidInputError('a persistent question is a form: drop mode "url"');
|
|
102
|
+
const waitMs = options.ttl ?? DEFAULT_ELICIT_TTL;
|
|
103
|
+
const { questions } = deps;
|
|
104
|
+
if (!questions) {
|
|
105
|
+
throw new ElicitationNotSupportedError(
|
|
106
|
+
"Persistent questions are off: enable them with @FrontMcp({ elicitation: { enabled: true, persistent: true } })"
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
const ttlMs = persist.ttlMs ?? questions.ttlMs;
|
|
110
|
+
if (!Number.isInteger(ttlMs) || ttlMs <= waitMs) {
|
|
111
|
+
throw new InvalidInputError(
|
|
112
|
+
`persist.ttlMs (${ttlMs}) must be a whole number longer than ttl (${waitMs}), the wait`
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
const subject = questionSubjectOf(deps.tryGetContext()?.authInfo);
|
|
116
|
+
if (!subject) {
|
|
117
|
+
throw new ElicitationNotSupportedError(
|
|
118
|
+
"A persistent question is kept for a signed-in user or a session, and this anonymous caller has neither"
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
const zodSchema = requestedSchema instanceof z.ZodType ? requestedSchema : z.object(requestedSchema);
|
|
122
|
+
return askPersistentQuestion({ store: questions.store, subject, signal: deps.signal }, message, zodSchema, {
|
|
123
|
+
key: persist.key,
|
|
124
|
+
ttlMs,
|
|
125
|
+
waitMs
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
export {
|
|
129
|
+
askPersistentQuestion,
|
|
130
|
+
elicitPersistent
|
|
131
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// libs/sdk/src/elicitation/questions/index.ts
|
|
2
|
+
import {
|
|
3
|
+
printQuestionInboxLink,
|
|
4
|
+
questionInboxRoutes,
|
|
5
|
+
QUESTION_INBOX_PATH,
|
|
6
|
+
QUESTIONS_PATH
|
|
7
|
+
} from "./question-inbox.routes.mjs";
|
|
8
|
+
import { questionSubjectOf } from "./question-subject.mjs";
|
|
9
|
+
import {
|
|
10
|
+
createQuestionStore,
|
|
11
|
+
resolveQuestionStorage
|
|
12
|
+
} from "./question-store.factory.mjs";
|
|
13
|
+
import {
|
|
14
|
+
QuestionStore,
|
|
15
|
+
QUESTIONS_TOPIC
|
|
16
|
+
} from "./question.store.mjs";
|
|
17
|
+
import { DEFAULT_QUESTION_TTL_MS } from "./question-scope.helper.mjs";
|
|
18
|
+
import {
|
|
19
|
+
InvalidQuestionStoreError,
|
|
20
|
+
QuestionAlreadyAnsweredError,
|
|
21
|
+
QuestionNotFoundError,
|
|
22
|
+
QuestionPendingError,
|
|
23
|
+
QuestionStoreBusyError,
|
|
24
|
+
QuestionSupersededError
|
|
25
|
+
} from "./question.errors.mjs";
|
|
26
|
+
export {
|
|
27
|
+
DEFAULT_QUESTION_TTL_MS,
|
|
28
|
+
InvalidQuestionStoreError,
|
|
29
|
+
QUESTIONS_PATH,
|
|
30
|
+
QUESTIONS_TOPIC,
|
|
31
|
+
QUESTION_INBOX_PATH,
|
|
32
|
+
QuestionAlreadyAnsweredError,
|
|
33
|
+
QuestionNotFoundError,
|
|
34
|
+
QuestionPendingError,
|
|
35
|
+
QuestionStore,
|
|
36
|
+
QuestionStoreBusyError,
|
|
37
|
+
QuestionSupersededError,
|
|
38
|
+
createQuestionStore,
|
|
39
|
+
printQuestionInboxLink,
|
|
40
|
+
questionInboxRoutes,
|
|
41
|
+
questionSubjectOf,
|
|
42
|
+
resolveQuestionStorage
|
|
43
|
+
};
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
4
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
5
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
6
|
+
if (decorator = decorators[i])
|
|
7
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
8
|
+
if (kind && result) __defProp(target, key, result);
|
|
9
|
+
return result;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
// libs/sdk/src/elicitation/questions/question-inbox.routes.ts
|
|
13
|
+
import { LoopbackTokenAuth } from "@frontmcp/auth";
|
|
14
|
+
import { internalZ as z } from "@frontmcp/lazy-zod";
|
|
15
|
+
import { base64urlEncode, randomBytes } from "@frontmcp/utils";
|
|
16
|
+
import {
|
|
17
|
+
httpRespond,
|
|
18
|
+
HttpRoute,
|
|
19
|
+
HttpRouteContext,
|
|
20
|
+
NO_STORE_HEADERS
|
|
21
|
+
} from "../../common/index.mjs";
|
|
22
|
+
import { ElicitationNotSupportedError, InvalidInputError } from "../../errors/index.mjs";
|
|
23
|
+
import { questionSubjectOf } from "./question-subject.mjs";
|
|
24
|
+
import { QuestionNotFoundError } from "./question.errors.mjs";
|
|
25
|
+
import { QUESTIONS_TOPIC } from "./question.store.mjs";
|
|
26
|
+
var QUESTION_INBOX_PATH = "/_frontmcp/inbox";
|
|
27
|
+
var QUESTIONS_PATH = "/_frontmcp/questions";
|
|
28
|
+
var PEOPLE_LOGIN_PATH = "/_frontmcp/people/login";
|
|
29
|
+
var answerBodySchema = z.object({
|
|
30
|
+
action: z.enum(["accept", "decline", "cancel"], { message: "action must be 'accept', 'decline' or 'cancel'" }),
|
|
31
|
+
content: z.record(z.string(), z.unknown()).optional()
|
|
32
|
+
}).strict();
|
|
33
|
+
function parsedBody(body) {
|
|
34
|
+
if (typeof body !== "string") return body;
|
|
35
|
+
try {
|
|
36
|
+
return JSON.parse(body);
|
|
37
|
+
} catch {
|
|
38
|
+
return void 0;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
async function inboxOf(route, store) {
|
|
42
|
+
const subject = route.person?.subject;
|
|
43
|
+
return { questions: subject ? await store.list(subject) : [] };
|
|
44
|
+
}
|
|
45
|
+
function printToStderr(message) {
|
|
46
|
+
if (typeof process !== "undefined" && typeof process.stderr?.write === "function") process.stderr.write(message);
|
|
47
|
+
else console.warn(message);
|
|
48
|
+
}
|
|
49
|
+
function stderrIsTerminal() {
|
|
50
|
+
return typeof process !== "undefined" && process.stderr?.isTTY === true;
|
|
51
|
+
}
|
|
52
|
+
function printQuestionInboxLink(context) {
|
|
53
|
+
const people = context.tryGet(LoopbackTokenAuth);
|
|
54
|
+
if (!people) throw new ElicitationNotSupportedError("The question inbox needs people auth: set http.auth.people");
|
|
55
|
+
const questions = context.scope.persistentQuestions;
|
|
56
|
+
if (!questions) throw new ElicitationNotSupportedError("The question inbox needs elicitation.persistent");
|
|
57
|
+
if (questions.inboxLinks === "off") {
|
|
58
|
+
throw new ElicitationNotSupportedError(
|
|
59
|
+
"Inbox links are off (elicitation.persistent.inboxLinks: 'off'): send createCode({ subject }) codes yourself"
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
if (questions.inboxLinks === "terminal" && !stderrIsTerminal()) {
|
|
63
|
+
throw new ElicitationNotSupportedError(
|
|
64
|
+
"The server's stderr is not a terminal, so an inbox link printed there could reach a log or the client that started the server: set elicitation.persistent.inboxLinks: 'stderr' to print it anyway"
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
const subject = questionSubjectOf(context.tryGetContext()?.authInfo);
|
|
68
|
+
if (!subject) {
|
|
69
|
+
throw new ElicitationNotSupportedError("The question inbox is for a signed-in user or a session, not this caller");
|
|
70
|
+
}
|
|
71
|
+
const { code, expiresAt } = people.createCode({ subject });
|
|
72
|
+
const link = `${PEOPLE_LOGIN_PATH}?code=${code}&next=${encodeURIComponent(QUESTION_INBOX_PATH)}`;
|
|
73
|
+
printToStderr(
|
|
74
|
+
`[frontmcp] question inbox sign-in link: ${link}
|
|
75
|
+
[frontmcp] It works once, until ${new Date(expiresAt).toISOString()}: open it on this server, or run frontmcp inbox --url <server> and paste it.
|
|
76
|
+
`
|
|
77
|
+
);
|
|
78
|
+
return { expiresAt };
|
|
79
|
+
}
|
|
80
|
+
function questionInboxRoutes(store) {
|
|
81
|
+
let QuestionListRoute = class extends HttpRouteContext {
|
|
82
|
+
async handle() {
|
|
83
|
+
return httpRespond.json(await inboxOf(this, store), { headers: { ...NO_STORE_HEADERS } });
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
QuestionListRoute = __decorateClass([
|
|
87
|
+
HttpRoute({ method: "GET", path: QUESTIONS_PATH, auth: "subject" })
|
|
88
|
+
], QuestionListRoute);
|
|
89
|
+
let QuestionEventsRoute = class extends HttpRouteContext {
|
|
90
|
+
handle() {
|
|
91
|
+
return inboxOf(this, store);
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
QuestionEventsRoute = __decorateClass([
|
|
95
|
+
HttpRoute({
|
|
96
|
+
method: "GET",
|
|
97
|
+
path: `${QUESTIONS_PATH}/events`,
|
|
98
|
+
auth: "subject",
|
|
99
|
+
sse: { store, topics: [QUESTIONS_TOPIC] }
|
|
100
|
+
})
|
|
101
|
+
], QuestionEventsRoute);
|
|
102
|
+
let QuestionAnswerRoute = class extends HttpRouteContext {
|
|
103
|
+
async handle() {
|
|
104
|
+
const parsed = answerBodySchema.safeParse(parsedBody(this.request.body));
|
|
105
|
+
if (!parsed.success) {
|
|
106
|
+
throw new InvalidInputError(
|
|
107
|
+
'The answer must be JSON: { "action": "accept", "content": { ... } }',
|
|
108
|
+
parsed.error.issues
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
const subject = this.person?.subject;
|
|
112
|
+
if (!subject) throw new QuestionNotFoundError();
|
|
113
|
+
const { action, content } = parsed.data;
|
|
114
|
+
await store.answer(subject, this.params["id"] ?? "", { status: action, content });
|
|
115
|
+
return { answered: true };
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
QuestionAnswerRoute = __decorateClass([
|
|
119
|
+
HttpRoute({ method: "POST", path: `${QUESTIONS_PATH}/:id/answer`, auth: "subject" })
|
|
120
|
+
], QuestionAnswerRoute);
|
|
121
|
+
let QuestionInboxPageRoute = class extends HttpRouteContext {
|
|
122
|
+
handle() {
|
|
123
|
+
const nonce = base64urlEncode(randomBytes(16));
|
|
124
|
+
return httpRespond.html(inboxPage(nonce), 200, {
|
|
125
|
+
...NO_STORE_HEADERS,
|
|
126
|
+
"Referrer-Policy": "no-referrer",
|
|
127
|
+
"Content-Security-Policy": `default-src 'none'; script-src 'nonce-${nonce}'; style-src 'unsafe-inline'; connect-src 'self'; base-uri 'none'; form-action 'none'; frame-ancestors 'none'`
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
QuestionInboxPageRoute = __decorateClass([
|
|
132
|
+
HttpRoute({ method: "GET", path: QUESTION_INBOX_PATH, auth: "subject" })
|
|
133
|
+
], QuestionInboxPageRoute);
|
|
134
|
+
return [QuestionListRoute, QuestionEventsRoute, QuestionAnswerRoute, QuestionInboxPageRoute];
|
|
135
|
+
}
|
|
136
|
+
function inboxPage(nonce) {
|
|
137
|
+
return `<!doctype html><html><head><meta charset="utf-8"><title>Questions</title>
|
|
138
|
+
<style>body{font:15px system-ui,sans-serif;max-width:46rem;margin:2rem auto;padding:0 1rem}li{margin:0 0 1.5rem}
|
|
139
|
+
textarea{width:100%;min-height:4rem;font:13px monospace}pre{background:#f4f4f4;padding:.5rem;overflow:auto}</style>
|
|
140
|
+
</head><body><h1>Questions</h1><p id="empty">No question is waiting for you.</p><ol id="questions"></ol>
|
|
141
|
+
<script nonce="${nonce}">
|
|
142
|
+
const list = document.getElementById('questions');
|
|
143
|
+
const empty = document.getElementById('empty');
|
|
144
|
+
function button(label, onClick) {
|
|
145
|
+
const element = document.createElement('button');
|
|
146
|
+
element.textContent = label;
|
|
147
|
+
element.addEventListener('click', onClick);
|
|
148
|
+
return element;
|
|
149
|
+
}
|
|
150
|
+
async function answer(id, action, content) {
|
|
151
|
+
const response = await fetch('${QUESTIONS_PATH}/' + encodeURIComponent(id) + '/answer', {
|
|
152
|
+
method: 'POST',
|
|
153
|
+
headers: { 'Content-Type': 'application/json' },
|
|
154
|
+
body: JSON.stringify(content === undefined ? { action } : { action, content }),
|
|
155
|
+
});
|
|
156
|
+
if (!response.ok) alert((await response.json()).error);
|
|
157
|
+
}
|
|
158
|
+
function render(view) {
|
|
159
|
+
const waiting = view.questions.filter((question) => !question.answered);
|
|
160
|
+
list.replaceChildren(...waiting.map((question) => {
|
|
161
|
+
const item = document.createElement('li');
|
|
162
|
+
const message = document.createElement('p');
|
|
163
|
+
message.textContent = question.message;
|
|
164
|
+
const schema = document.createElement('pre');
|
|
165
|
+
schema.textContent = JSON.stringify(question.requestedSchema, null, 2);
|
|
166
|
+
const content = document.createElement('textarea');
|
|
167
|
+
content.value = '{}';
|
|
168
|
+
const accept = button('Answer', () => {
|
|
169
|
+
try { answer(question.id, 'accept', JSON.parse(content.value)); } catch { alert('The answer must be JSON'); }
|
|
170
|
+
});
|
|
171
|
+
item.append(message, schema, content, accept, button('Decline', () => answer(question.id, 'decline')));
|
|
172
|
+
return item;
|
|
173
|
+
}));
|
|
174
|
+
empty.hidden = waiting.length > 0;
|
|
175
|
+
}
|
|
176
|
+
new EventSource('${QUESTIONS_PATH}/events').onmessage = (event) => render(JSON.parse(event.data));
|
|
177
|
+
</script></body></html>`;
|
|
178
|
+
}
|
|
179
|
+
export {
|
|
180
|
+
QUESTIONS_PATH,
|
|
181
|
+
QUESTION_INBOX_PATH,
|
|
182
|
+
printQuestionInboxLink,
|
|
183
|
+
questionInboxRoutes
|
|
184
|
+
};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
// libs/sdk/src/elicitation/questions/question-scope.helper.ts
|
|
2
|
+
import { internalZ as z } from "@frontmcp/lazy-zod";
|
|
3
|
+
import { sha256Hex } from "@frontmcp/utils";
|
|
4
|
+
import { createQuestionStore, resolveQuestionStorage } from "./question-store.factory.mjs";
|
|
5
|
+
import { InvalidQuestionStoreError } from "./question.errors.mjs";
|
|
6
|
+
var DEFAULT_QUESTION_TTL_MS = 864e5;
|
|
7
|
+
var persistentQuestionsOptionsSchema = z.object(
|
|
8
|
+
{
|
|
9
|
+
ttlMs: z.number({ message: "ttlMs must be a number of milliseconds" }).int("ttlMs must be a whole number of milliseconds").positive("ttlMs must be greater than 0").optional(),
|
|
10
|
+
storage: z.object({
|
|
11
|
+
type: z.enum(["memory", "redis", "sqlite"], {
|
|
12
|
+
message: "storage.type must be 'memory', 'redis' or 'sqlite'"
|
|
13
|
+
})
|
|
14
|
+
}).passthrough().optional(),
|
|
15
|
+
inboxLinks: z.enum(["terminal", "stderr", "off"], { message: "inboxLinks must be 'terminal', 'stderr' or 'off'" }).optional()
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
error: (issue) => issue.code === "invalid_type" ? "it must be true, false or an object of settings" : void 0
|
|
19
|
+
}
|
|
20
|
+
).strict();
|
|
21
|
+
function parsePersistentQuestionsOptions(persistent) {
|
|
22
|
+
const parsed = persistentQuestionsOptionsSchema.safeParse(persistent === true ? {} : persistent);
|
|
23
|
+
if (!parsed.success) {
|
|
24
|
+
throw new InvalidQuestionStoreError(parsed.error.issues.map((issue) => issue.message).join("; "));
|
|
25
|
+
}
|
|
26
|
+
return { ...parsed.data, storage: parsed.data.storage };
|
|
27
|
+
}
|
|
28
|
+
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, or turn elicitation.persistent off";
|
|
29
|
+
function persistentQuestionsSettings(persistent, onEdgeRuntime) {
|
|
30
|
+
const settings = parsePersistentQuestionsOptions(persistent);
|
|
31
|
+
if (onEdgeRuntime) throw new InvalidQuestionStoreError(NOT_ON_EDGE_RUNTIME);
|
|
32
|
+
return settings;
|
|
33
|
+
}
|
|
34
|
+
function questionsServerStore(storage, server) {
|
|
35
|
+
if (storage) return storage.type === "memory" ? void 0 : "elicitation.persistent.storage";
|
|
36
|
+
const elicitationRedis = server.elicitation?.redis;
|
|
37
|
+
const [option, redis] = elicitationRedis ? ["elicitation.redis", elicitationRedis] : ["redis", server.redis];
|
|
38
|
+
if (redis && redis.provider !== "vercel-kv") return option;
|
|
39
|
+
return server.sqlite ? "sqlite" : "the default questions.sqlite file";
|
|
40
|
+
}
|
|
41
|
+
async function openPersistentQuestions(options) {
|
|
42
|
+
const { persistent, serverName = "", logger } = options;
|
|
43
|
+
if (!persistent) return void 0;
|
|
44
|
+
const settings = persistentQuestionsSettings(persistent, options.onEdgeRuntime ?? false);
|
|
45
|
+
const storage = await resolveQuestionStorage({
|
|
46
|
+
storage: settings.storage,
|
|
47
|
+
redis: options.redis,
|
|
48
|
+
sqlite: options.sqlite
|
|
49
|
+
});
|
|
50
|
+
const keyPrefix = `mcp:questions:${sha256Hex(`server:${serverName}`).slice(0, 16)}:`;
|
|
51
|
+
const { store, type, encrypted } = await createQuestionStore({ storage, keyPrefix, logger });
|
|
52
|
+
logger.info("Persistent questions are on", { type, encrypted });
|
|
53
|
+
return {
|
|
54
|
+
store,
|
|
55
|
+
type,
|
|
56
|
+
ttlMs: settings.ttlMs ?? DEFAULT_QUESTION_TTL_MS,
|
|
57
|
+
inboxLinks: settings.inboxLinks ?? "terminal"
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
export {
|
|
61
|
+
DEFAULT_QUESTION_TTL_MS,
|
|
62
|
+
openPersistentQuestions,
|
|
63
|
+
parsePersistentQuestionsOptions,
|
|
64
|
+
persistentQuestionsSettings,
|
|
65
|
+
questionsServerStore
|
|
66
|
+
};
|
|
@@ -0,0 +1,104 @@
|
|
|
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 __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
5
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
6
|
+
}) : x)(function(x) {
|
|
7
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
8
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
// libs/sdk/src/elicitation/questions/question-store.factory.ts
|
|
12
|
+
import {
|
|
13
|
+
createChangeFeed,
|
|
14
|
+
createStorage,
|
|
15
|
+
getEnv,
|
|
16
|
+
getRuntimeContext,
|
|
17
|
+
lstat,
|
|
18
|
+
mkdir,
|
|
19
|
+
realpath,
|
|
20
|
+
writeFile
|
|
21
|
+
} from "@frontmcp/utils";
|
|
22
|
+
import { isRedisProvider, redisOptionsSchema } from "../../common/index.mjs";
|
|
23
|
+
import { findReplaceableDirectory } from "../../server/security/replaceable-directory.mjs";
|
|
24
|
+
import { getElicitationSecret } from "../store/elicitation-encryption.mjs";
|
|
25
|
+
import { InvalidQuestionStoreError } from "./question.errors.mjs";
|
|
26
|
+
import { QuestionStore } from "./question.store.mjs";
|
|
27
|
+
var OWNER_ONLY_DIRECTORY = 448;
|
|
28
|
+
var OWNER_ONLY_FILE = 384;
|
|
29
|
+
var GROUP_OR_OTHER_ACCESS = 63;
|
|
30
|
+
async function createQuestionStore(options) {
|
|
31
|
+
const { storage: config, keyPrefix = "mcp:questions:", encryption, pollIntervalMs, coalesceMs, logger } = options;
|
|
32
|
+
const enabled = encryption?.enabled ?? "auto";
|
|
33
|
+
const secret = enabled === false ? void 0 : encryption?.secret ?? getElicitationSecret() ?? void 0;
|
|
34
|
+
if (enabled === true && !secret) {
|
|
35
|
+
throw new InvalidQuestionStoreError(
|
|
36
|
+
"encryption is on but no secret is set: set MCP_ELICITATION_SECRET (or MCP_SESSION_SECRET / MCP_SERVER_SECRET)"
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
let storage;
|
|
40
|
+
try {
|
|
41
|
+
storage = await createStorage({ ...config, prefix: keyPrefix, fallback: "error" });
|
|
42
|
+
} catch (error) {
|
|
43
|
+
throw new InvalidQuestionStoreError(
|
|
44
|
+
`the ${config.type} store cannot be opened: ${error instanceof Error ? error.message : String(error)}`
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
const feed = createChangeFeed(storage, {
|
|
48
|
+
pollIntervalMs,
|
|
49
|
+
coalesceMs,
|
|
50
|
+
onError: (error) => logger?.warn("Persistent questions: a change notification failed", error)
|
|
51
|
+
});
|
|
52
|
+
return { store: new QuestionStore({ storage, feed, secret }), type: config.type, encrypted: !!secret, storage };
|
|
53
|
+
}
|
|
54
|
+
async function resolveQuestionStorage(sources) {
|
|
55
|
+
if (sources.storage) return sources.storage;
|
|
56
|
+
const redis = sources.redis === void 0 ? void 0 : redisOptionsSchema.safeParse(sources.redis);
|
|
57
|
+
if (redis?.success && isRedisProvider(redis.data)) {
|
|
58
|
+
const { host, port, password, db, tls } = redis.data;
|
|
59
|
+
return { type: "redis", redis: { config: { host, port, password, db, tls } } };
|
|
60
|
+
}
|
|
61
|
+
if (sources.sqlite) return { type: "sqlite", sqlite: sources.sqlite };
|
|
62
|
+
const { runtime, deployment } = getRuntimeContext();
|
|
63
|
+
if (runtime !== "node" || deployment === "serverless") {
|
|
64
|
+
throw new InvalidQuestionStoreError(
|
|
65
|
+
"this runtime has no default store for questions: set elicitation.persistent.storage, or the server redis"
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
const path = nodePath();
|
|
69
|
+
const home = getEnv("FRONTMCP_HOME") || path.join(nodeOs().homedir(), ".frontmcp");
|
|
70
|
+
const file = path.join(home, "questions.sqlite");
|
|
71
|
+
await mkdir(home, { recursive: true, mode: OWNER_ONLY_DIRECTORY });
|
|
72
|
+
if (process.platform !== "win32") await assertNoOtherUserCanReplace(home);
|
|
73
|
+
await writeFile(file, "", { mode: OWNER_ONLY_FILE, flag: "a" });
|
|
74
|
+
if (process.platform !== "win32") await assertOwnerOnlyFile(file);
|
|
75
|
+
return { type: "sqlite", sqlite: { path: file } };
|
|
76
|
+
}
|
|
77
|
+
async function assertNoOtherUserCanReplace(home) {
|
|
78
|
+
for (const directory of /* @__PURE__ */ new Set([home, await realpath(home)])) {
|
|
79
|
+
const replaceable = await findReplaceableDirectory(directory);
|
|
80
|
+
if (!replaceable) continue;
|
|
81
|
+
const { ownerUid } = replaceable;
|
|
82
|
+
const reason = ownerUid === void 0 ? "the group or others can write to it" : `it belongs to another user (uid ${ownerUid})`;
|
|
83
|
+
throw new InvalidQuestionStoreError(
|
|
84
|
+
`refusing the default store under ${replaceable.directory}: ${reason}. Set FRONTMCP_HOME to a folder only you can write to, or elicitation.persistent.storage`
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
async function assertOwnerOnlyFile(file) {
|
|
89
|
+
const stats = await lstat(file);
|
|
90
|
+
const reason = !stats.isFile() ? "it is not a regular file" : stats.uid !== process.getuid?.() ? `it belongs to another user (uid ${stats.uid})` : stats.mode & GROUP_OR_OTHER_ACCESS ? "the group or others can read it" : void 0;
|
|
91
|
+
if (reason) {
|
|
92
|
+
throw new InvalidQuestionStoreError(`refusing the default store ${file}: ${reason}; make it owner-only (0600)`);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
function nodeOs() {
|
|
96
|
+
return __require("os");
|
|
97
|
+
}
|
|
98
|
+
function nodePath() {
|
|
99
|
+
return __require("path");
|
|
100
|
+
}
|
|
101
|
+
export {
|
|
102
|
+
createQuestionStore,
|
|
103
|
+
resolveQuestionStorage
|
|
104
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// libs/sdk/src/elicitation/questions/question-subject.ts
|
|
2
|
+
import { isAnonymousSubject } from "@frontmcp/auth";
|
|
3
|
+
import { resolvePrincipal } from "../../common/utils/principal.utils.mjs";
|
|
4
|
+
import { resolveElicitationOwner } from "../helpers/fallback.helper.mjs";
|
|
5
|
+
function questionSubjectOf(authInfo) {
|
|
6
|
+
const { sub, claims } = resolvePrincipal(authInfo);
|
|
7
|
+
const issuer = typeof claims["iss"] === "string" ? claims["iss"] : "";
|
|
8
|
+
if (!isAnonymousSubject(sub)) return issuer ? `principal:${issuer}#${sub}` : `principal:${sub}`;
|
|
9
|
+
const owner = resolveElicitationOwner({ authInfo });
|
|
10
|
+
return owner?.startsWith("session:") ? owner : void 0;
|
|
11
|
+
}
|
|
12
|
+
export {
|
|
13
|
+
questionSubjectOf
|
|
14
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
// libs/sdk/src/elicitation/questions/question.errors.ts
|
|
2
|
+
import { InternalMcpError, MCP_ERROR_CODES, PublicMcpError } from "../../errors/mcp.error.mjs";
|
|
3
|
+
var QuestionPendingError = class extends PublicMcpError {
|
|
4
|
+
key;
|
|
5
|
+
expiresAt;
|
|
6
|
+
constructor(key, expiresAt) {
|
|
7
|
+
super(
|
|
8
|
+
`The question "${key}" has no answer yet. It waits in the inbox until ${new Date(expiresAt).toISOString()}; call again to get its answer.`,
|
|
9
|
+
"QUESTION_PENDING",
|
|
10
|
+
408
|
|
11
|
+
);
|
|
12
|
+
this.key = key;
|
|
13
|
+
this.expiresAt = expiresAt;
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
var QuestionSupersededError = class extends PublicMcpError {
|
|
17
|
+
key;
|
|
18
|
+
constructor(key) {
|
|
19
|
+
super(`A newer call asked the question "${key}" and waits for its answer instead.`, "QUESTION_SUPERSEDED", 409);
|
|
20
|
+
this.key = key;
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
var QuestionNotFoundError = class extends PublicMcpError {
|
|
24
|
+
mcpErrorCode = MCP_ERROR_CODES.RESOURCE_NOT_FOUND;
|
|
25
|
+
constructor() {
|
|
26
|
+
super("No such question.", "QUESTION_NOT_FOUND", 404);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
var QuestionAlreadyAnsweredError = class extends PublicMcpError {
|
|
30
|
+
constructor() {
|
|
31
|
+
super("This question was answered already.", "QUESTION_ALREADY_ANSWERED", 409);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
var QuestionStoreBusyError = class extends InternalMcpError {
|
|
35
|
+
constructor() {
|
|
36
|
+
super("The question changed under every attempt to update it; try again.", "QUESTION_STORE_BUSY");
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
var InvalidQuestionStoreError = class extends InternalMcpError {
|
|
40
|
+
constructor(reason) {
|
|
41
|
+
super(`elicitation.persistent: ${reason}`, "INVALID_QUESTION_STORE");
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
export {
|
|
45
|
+
InvalidQuestionStoreError,
|
|
46
|
+
QuestionAlreadyAnsweredError,
|
|
47
|
+
QuestionNotFoundError,
|
|
48
|
+
QuestionPendingError,
|
|
49
|
+
QuestionStoreBusyError,
|
|
50
|
+
QuestionSupersededError
|
|
51
|
+
};
|