@frontmcp/sdk 1.13.2 → 1.14.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 +4 -0
- 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.map +1 -1
- package/app/instances/app.local.instance.d.ts.map +1 -1
- package/app/lazy/lazy-placeholders.d.ts +6 -9
- package/app/lazy/lazy-placeholders.d.ts.map +1 -1
- package/auth/auth-ui/auth-ui.contract.d.ts +4 -1
- package/auth/auth-ui/auth-ui.contract.d.ts.map +1 -1
- package/auth/authorized-apps.utils.d.ts +2 -0
- package/auth/authorized-apps.utils.d.ts.map +1 -1
- package/auth/client-display-name.d.ts +52 -0
- package/auth/client-display-name.d.ts.map +1 -0
- package/auth/federated-steps.d.ts.map +1 -1
- package/auth/flows/oauth.auth-ui.flow.d.ts +1 -1
- package/auth/flows/oauth.authorize.flow.d.ts +6 -3
- package/auth/flows/oauth.authorize.flow.d.ts.map +1 -1
- package/auth/flows/oauth.callback.flow.d.ts +3 -8
- 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.provider-callback.flow.d.ts +9 -2
- package/auth/flows/oauth.provider-callback.flow.d.ts.map +1 -1
- package/auth/flows/oauth.register.flow.d.ts +6 -4
- 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.userinfo.flow.d.ts +1 -1
- package/auth/flows/session.verify.flow.d.ts +20 -4
- package/auth/flows/session.verify.flow.d.ts.map +1 -1
- package/auth/flows/well-known.jwks.flow.d.ts +3 -3
- package/auth/flows/well-known.oauth-authorization-server.flow.d.ts +2 -2
- package/auth/flows/well-known.prm.flow.d.ts +1 -1
- package/auth/instances/instance.local-primary-auth.d.ts +8 -0
- package/auth/instances/instance.local-primary-auth.d.ts.map +1 -1
- package/auth/instances/instance.remote-primary-auth.d.ts +2 -0
- package/auth/instances/instance.remote-primary-auth.d.ts.map +1 -1
- package/auth/session/session-store.factory.d.ts.map +1 -1
- package/browser/agent/agent.instance.mjs +16 -0
- package/browser/agent/agent.scope.mjs +9 -0
- package/browser/agent/flows/call-agent.flow.mjs +3 -1
- package/browser/app/instances/app.local.instance.mjs +6 -1
- package/browser/app/lazy/lazy-placeholders.mjs +3 -3
- package/browser/auth/authorized-apps.utils.mjs +15 -0
- package/browser/auth/client-display-name.mjs +62 -0
- package/browser/auth/federated-steps.mjs +2 -0
- package/browser/auth/flows/oauth.authorize.flow.mjs +25 -10
- package/browser/auth/flows/oauth.callback.flow.mjs +29 -31
- package/browser/auth/flows/oauth.provider-callback.flow.mjs +83 -14
- package/browser/auth/flows/oauth.register.flow.mjs +5 -24
- package/browser/auth/flows/session.verify.flow.mjs +31 -12
- package/browser/auth/instances/instance.local-primary-auth.mjs +43 -10
- package/browser/auth/instances/instance.remote-primary-auth.mjs +15 -0
- package/browser/auth/session/session-store.factory.mjs +15 -36
- package/browser/builtin/authorities/authorities-input.mjs +12 -0
- package/browser/common/decorators/front-mcp.decorator.mjs +2 -1
- package/browser/common/decorators/http-route.decorator.mjs +4 -0
- package/browser/common/index.mjs +2 -2
- package/browser/common/interfaces/server.interface.mjs +4 -0
- package/browser/common/metadata/duty.metadata.mjs +29 -6
- package/browser/common/metadata/event.metadata.mjs +2 -1
- package/browser/common/metadata/front-mcp.metadata.mjs +18 -1
- package/browser/common/metadata/workflow.metadata.mjs +1 -0
- package/browser/common/tokens/front-mcp.tokens.mjs +3 -0
- package/browser/common/tokens/workflow.tokens.mjs +1 -0
- package/browser/common/types/auth/session.types.mjs +2 -0
- package/browser/common/types/index.mjs +1 -1
- package/browser/common/types/options/http/schema.mjs +14 -6
- package/browser/common/types/options/index.mjs +1 -1
- package/browser/common/types/options/redis/connection.mjs +19 -0
- package/browser/common/types/options/redis/index.mjs +12 -0
- package/browser/common/types/options/redis/schema.mjs +145 -12
- package/browser/common/types/options/skills-http/schema.mjs +18 -0
- package/browser/common/types/options/transport/schema.mjs +10 -0
- package/browser/common/utils/auth-info.utils.mjs +17 -3
- package/browser/common/utils/guard.utils.mjs +3 -2
- package/browser/common/utils/index.mjs +2 -1
- package/browser/completion/flows/complete.flow.mjs +13 -7
- package/browser/duty/duty.lifecycle.mjs +32 -5
- package/browser/duty/duty.runner.mjs +3 -1
- package/browser/duty/lease-holder.mjs +50 -3
- package/browser/duty/lease-store.mjs +9 -6
- package/browser/elicitation/flows/elicitation-request.flow.mjs +7 -1
- package/browser/elicitation/flows/elicitation-result.flow.mjs +8 -2
- package/browser/elicitation/questions/question-store.factory.mjs +2 -5
- package/browser/elicitation/store/elicitation-store.factory.mjs +11 -4
- package/browser/errors/browser-entry-point.errors.mjs +1 -0
- package/browser/errors/duty.errors.mjs +9 -0
- package/browser/errors/index.mjs +11 -1
- package/browser/errors/job.errors.mjs +29 -4
- package/browser/errors/mcp.error.mjs +54 -8
- package/browser/errors/provider.errors.mjs +18 -0
- package/browser/errors/transport.errors.mjs +31 -0
- package/browser/event/delivery/event-outbox.mjs +43 -9
- package/browser/event/event-gates.mjs +11 -2
- package/browser/event/event-scope.helper.mjs +5 -1
- package/browser/event/flows/event-ended.flow.mjs +9 -3
- package/browser/event/flows/event-poll.flow.mjs +3 -1
- package/browser/event/flows/event-publish.flow.mjs +1 -0
- package/browser/event/flows/event-subscribe.flow.mjs +2 -9
- package/browser/event/flows/event-unsubscribe.flow.mjs +5 -2
- package/browser/event/poll/event-poll-leases.mjs +4 -3
- package/browser/event/replay/event-replays.mjs +2 -0
- package/browser/event/stream/event-stream.mjs +4 -0
- package/browser/event/stream/event-streams.mjs +9 -6
- package/browser/event/subscription/event-subscription-store.factory.mjs +3 -4
- package/browser/event/subscription/event-subscription-termination.mjs +1 -0
- package/browser/event/subscription/event-subscription.store.mjs +11 -1
- package/browser/event/subscription/event-subscriptions.mjs +4 -1
- package/browser/front-mcp/front-mcp.mjs +38 -4
- package/browser/ha/ha-manager.mjs +2 -1
- package/browser/ha/ha-redis-client.mjs +22 -0
- package/browser/ha/heartbeat.service.mjs +2 -1
- package/browser/ha/index.mjs +2 -0
- package/browser/ha/notification-relay.mjs +11 -3
- package/browser/http-route/flows/http.route.flow.mjs +78 -7
- package/browser/http-route/http-route.table.mjs +38 -11
- package/browser/http-route/people-session-store.mjs +7 -6
- package/browser/http-route/people-sign-in.routes.mjs +44 -3
- package/browser/index.cjs +21327 -17821
- package/browser/index.mjs +10 -3
- package/browser/job/execution/job-execution.manager.mjs +293 -84
- package/browser/job/flows/execute-job.flow.mjs +6 -4
- package/browser/job/index.mjs +3 -1
- package/browser/job/job-admission.mjs +284 -2
- package/browser/job/job-attempt.mjs +2 -1
- package/browser/job/job-run-access.mjs +20 -0
- package/browser/job/job-scope.helper.mjs +37 -10
- package/browser/job/runner/detached-job.worker.mjs +71 -10
- package/browser/job/runner/job-runner.mjs +27 -1
- package/browser/job/store/job-definition-store.factory.mjs +13 -12
- package/browser/job/store/job-state-store.factory.mjs +14 -5
- package/browser/job/store/memory-job-state.store.mjs +91 -7
- package/browser/job/store/redis-job-state.store.mjs +39 -6
- package/browser/job/store/storage-job-state.store.mjs +35 -2
- package/browser/job/tools/cancel-job.tool.mjs +2 -2
- package/browser/job/tools/register-job.tool.mjs +5 -2
- package/browser/job/tools/remove-job.tool.mjs +9 -0
- package/browser/job/tools/update-job.tool.mjs +8 -0
- package/browser/notification/notification.service.mjs +14 -3
- package/browser/prompt/flows/get-prompt.flow.mjs +10 -3
- package/browser/prompt/flows/prompts-list.flow.mjs +7 -2
- package/browser/provider/borrow-providers.mjs +40 -0
- package/browser/provider/container-handle.mjs +10 -0
- package/browser/provider/create-container.mjs +25 -3
- package/browser/provider/provider.registry.mjs +43 -6
- package/browser/remote-mcp/remote-oauth.mjs +43 -13
- package/browser/resource/flows/read-resource.flow.mjs +15 -4
- package/browser/resource/flows/resource-templates-list.flow.mjs +7 -2
- package/browser/resource/flows/resources-list.flow.mjs +7 -2
- package/browser/resource/flows/subscribe-resource.flow.mjs +21 -5
- package/browser/resource/materialized/materialized-resources.mjs +53 -23
- package/browser/resource/materialized/resource-store.mjs +97 -26
- package/browser/resource/resource.events.mjs +12 -1
- package/browser/resource/resource.registry.mjs +66 -8
- package/browser/scope/flows/http.request.flow.mjs +52 -3
- package/browser/scope/scope.instance.mjs +12 -14
- package/browser/server/custom-routes.helper.mjs +57 -6
- package/browser/server/security/resolve-allowed-hosts.mjs +26 -2
- package/browser/server/security/same-origin.mjs +5 -5
- package/browser/server/server.instance.mjs +56 -3
- package/browser/skill/cache/skill-http-cache.catalog.mjs +7 -6
- package/browser/skill/cache/skill-http-cache.factory.mjs +16 -19
- package/browser/skill/cache/skill-http-cache.mjs +14 -4
- package/browser/skill/flows/http/llm-full-txt.flow.mjs +16 -5
- package/browser/skill/flows/http/llm-txt.flow.mjs +1 -0
- package/browser/skill/flows/http/skills-api.flow.mjs +6 -5
- package/browser/skill/flows/load-skill.flow.mjs +9 -4
- package/browser/skill/skill-filter.helper.mjs +41 -4
- package/browser/skill/skill-http.utils.mjs +8 -8
- package/browser/surface/entry-enabled.mjs +22 -6
- package/browser/surface/index.mjs +8 -2
- package/browser/surface/live-surface.mjs +63 -3
- package/browser/task/helpers/task-run-context.mjs +12 -0
- package/browser/task/helpers/task-runner.mjs +2 -0
- package/browser/task/store/storage-task.store.mjs +1 -4
- package/browser/task/store/task-store.factory.mjs +2 -3
- package/browser/task/task.types.mjs +2 -0
- package/browser/tool/flows/call-tool.flow.mjs +56 -17
- package/browser/tool/flows/tools-list.flow.mjs +2 -2
- package/browser/tool/ui/ui-shared.mjs +5 -1
- package/browser/tool/ui/widget-enabled.mjs +11 -0
- package/browser/tool/undeclared-arguments-message.mjs +7 -5
- package/browser/tool/undeclared-arguments.mjs +8 -1
- package/browser/transport/adapters/streamable-http-transport.mjs +4 -0
- package/browser/transport/adapters/transport.local.adapter.mjs +26 -21
- package/browser/transport/adapters/transport.sse.adapter.mjs +15 -2
- package/browser/transport/adapters/transport.streamable-http.adapter.mjs +7 -1
- package/browser/transport/bus/redis-transport-bus.mjs +83 -28
- package/browser/transport/channel-signature.mjs +40 -0
- package/browser/transport/event-stores/redis.event-store.mjs +14 -27
- package/browser/transport/flows/handle.mcp-20260728.flow.mjs +4 -3
- package/browser/transport/flows/handle.streamable-http.flow.mjs +17 -10
- package/browser/transport/mcp-20260728/client/index.mjs +1 -1
- package/browser/transport/mcp-20260728/client/mcp-stateless.client.mjs +77 -15
- package/browser/transport/mcp-20260728/index.mjs +1 -1
- package/browser/transport/mcp-20260728/result-decorator.mjs +14 -7
- package/browser/transport/mcp-20260728/subscriptions.mjs +27 -7
- package/browser/transport/mcp-handlers/index.mjs +11 -2
- package/browser/transport/relay/relay-scope.helper.mjs +34 -6
- package/browser/transport/session-end-channel.mjs +199 -0
- package/browser/transport/transport.local.mjs +3 -0
- package/browser/transport/transport.registry.mjs +352 -21
- package/browser/transport/web-fetch-handler.mjs +64 -4
- package/browser/utils/same-origin-fetch.utils.mjs +33 -0
- package/browser/work/index.mjs +13 -0
- package/browser/work/work-spans.mjs +55 -0
- package/browser/worker/worker.lifecycle.mjs +3 -1
- package/browser/workflow/engine/workflow-step.executor.mjs +32 -12
- package/browser/workflow/engine/workflow.engine.mjs +5 -0
- package/browser/workflow/tools/register-workflow.tool.mjs +5 -2
- package/browser/workflow/tools/remove-workflow.tool.mjs +9 -0
- package/browser/workflow/tools/update-workflow.tool.mjs +8 -0
- package/builtin/authorities/authorities-input.d.ts +3 -0
- package/builtin/authorities/authorities-input.d.ts.map +1 -0
- package/common/decorators/front-mcp.decorator.d.ts.map +1 -1
- package/common/decorators/http-route.decorator.d.ts.map +1 -1
- package/common/entries/scope.entry.d.ts +3 -0
- package/common/entries/scope.entry.d.ts.map +1 -1
- package/common/interfaces/server.interface.d.ts +2 -0
- package/common/interfaces/server.interface.d.ts.map +1 -1
- package/common/metadata/agent.metadata.d.ts +2 -2
- package/common/metadata/app.metadata.d.ts +500 -52
- package/common/metadata/app.metadata.d.ts.map +1 -1
- package/common/metadata/duty.metadata.d.ts +41 -11
- package/common/metadata/duty.metadata.d.ts.map +1 -1
- package/common/metadata/enabled.metadata.d.ts +32 -0
- package/common/metadata/enabled.metadata.d.ts.map +1 -1
- package/common/metadata/event.metadata.d.ts +146 -0
- package/common/metadata/event.metadata.d.ts.map +1 -1
- package/common/metadata/front-mcp.metadata.d.ts +9457 -348
- package/common/metadata/front-mcp.metadata.d.ts.map +1 -1
- package/common/metadata/http-route.metadata.d.ts +7 -0
- package/common/metadata/http-route.metadata.d.ts.map +1 -1
- package/common/metadata/job.metadata.d.ts +1 -1
- package/common/metadata/output-policy.d.ts +1 -1
- package/common/metadata/plugin.metadata.d.ts +2 -2
- package/common/metadata/tool.metadata.d.ts +1 -1
- package/common/metadata/worker.metadata.d.ts +4 -4
- package/common/metadata/workflow.metadata.d.ts +15 -1
- package/common/metadata/workflow.metadata.d.ts.map +1 -1
- package/common/records/job.record.d.ts +6 -0
- package/common/records/job.record.d.ts.map +1 -1
- package/common/records/workflow.record.d.ts +6 -0
- package/common/records/workflow.record.d.ts.map +1 -1
- package/common/schemas/annotated-class.schema.d.ts +1 -1
- package/common/schemas/http-output.schema.d.ts +24 -24
- package/common/tokens/front-mcp.tokens.d.ts.map +1 -1
- package/common/tokens/workflow.tokens.d.ts +1 -0
- package/common/tokens/workflow.tokens.d.ts.map +1 -1
- package/common/types/auth/session.types.d.ts +12 -1
- package/common/types/auth/session.types.d.ts.map +1 -1
- package/common/types/options/elicitation/schema.d.ts +137 -0
- package/common/types/options/elicitation/schema.d.ts.map +1 -1
- package/common/types/options/http/interfaces.d.ts +41 -4
- package/common/types/options/http/interfaces.d.ts.map +1 -1
- package/common/types/options/http/schema.d.ts +5 -2
- package/common/types/options/http/schema.d.ts.map +1 -1
- package/common/types/options/redis/connection.d.ts +18 -0
- package/common/types/options/redis/connection.d.ts.map +1 -0
- package/common/types/options/redis/index.d.ts +7 -3
- package/common/types/options/redis/index.d.ts.map +1 -1
- package/common/types/options/redis/interfaces.d.ts +54 -2
- package/common/types/options/redis/interfaces.d.ts.map +1 -1
- package/common/types/options/redis/schema.d.ts +412 -2
- package/common/types/options/redis/schema.d.ts.map +1 -1
- package/common/types/options/skills-http/interfaces.d.ts +7 -0
- package/common/types/options/skills-http/interfaces.d.ts.map +1 -1
- package/common/types/options/skills-http/schema.d.ts +19 -0
- package/common/types/options/skills-http/schema.d.ts.map +1 -1
- package/common/types/options/transport/index.d.ts +1 -1
- package/common/types/options/transport/index.d.ts.map +1 -1
- package/common/types/options/transport/interfaces.d.ts +32 -0
- package/common/types/options/transport/interfaces.d.ts.map +1 -1
- package/common/types/options/transport/schema.d.ts +548 -0
- package/common/types/options/transport/schema.d.ts.map +1 -1
- package/common/utils/auth-info.utils.d.ts +29 -1
- package/common/utils/auth-info.utils.d.ts.map +1 -1
- package/common/utils/guard.utils.d.ts +6 -3
- package/common/utils/guard.utils.d.ts.map +1 -1
- package/common/utils/index.d.ts +1 -0
- package/common/utils/index.d.ts.map +1 -1
- package/completion/flows/complete.flow.d.ts +5 -1
- package/completion/flows/complete.flow.d.ts.map +1 -1
- package/context/frontmcp-context.provider.d.ts +1 -1
- package/direct/direct.types.d.ts +4 -4
- package/direct/direct.types.d.ts.map +1 -1
- package/duty/duty.lifecycle.d.ts +1 -1
- package/duty/duty.lifecycle.d.ts.map +1 -1
- package/duty/duty.runner.d.ts +6 -1
- package/duty/duty.runner.d.ts.map +1 -1
- package/duty/lease-holder.d.ts +26 -3
- package/duty/lease-holder.d.ts.map +1 -1
- package/duty/lease-store.d.ts +2 -0
- package/duty/lease-store.d.ts.map +1 -1
- package/elicitation/elicitation.types.d.ts +2 -0
- package/elicitation/elicitation.types.d.ts.map +1 -1
- package/elicitation/flows/elicitation-request.flow.d.ts +2 -0
- package/elicitation/flows/elicitation-request.flow.d.ts.map +1 -1
- package/elicitation/flows/elicitation-result.flow.d.ts +3 -1
- package/elicitation/flows/elicitation-result.flow.d.ts.map +1 -1
- package/elicitation/questions/question-store.factory.d.ts.map +1 -1
- package/elicitation/store/elicitation-store.factory.d.ts.map +1 -1
- package/elicitation/store/elicitation.store.d.ts +2 -0
- package/elicitation/store/elicitation.store.d.ts.map +1 -1
- package/errors/browser-entry-point.errors.d.ts +1 -0
- package/errors/browser-entry-point.errors.d.ts.map +1 -1
- package/errors/duty.errors.d.ts +4 -0
- package/errors/duty.errors.d.ts.map +1 -1
- package/errors/index.d.ts +3 -3
- package/errors/index.d.ts.map +1 -1
- package/errors/job.errors.d.ts +22 -4
- package/errors/job.errors.d.ts.map +1 -1
- package/errors/mcp.error.d.ts +11 -1
- package/errors/mcp.error.d.ts.map +1 -1
- package/errors/provider.errors.d.ts +11 -0
- package/errors/provider.errors.d.ts.map +1 -1
- package/errors/transport.errors.d.ts +29 -0
- package/errors/transport.errors.d.ts.map +1 -1
- package/esm/index.mjs +56 -51
- package/event/delivery/event-outbox.d.ts +15 -2
- package/event/delivery/event-outbox.d.ts.map +1 -1
- package/event/event-gates.d.ts +7 -1
- package/event/event-gates.d.ts.map +1 -1
- package/event/event-scope.helper.d.ts.map +1 -1
- package/event/flows/event-ended.flow.d.ts +4 -3
- package/event/flows/event-ended.flow.d.ts.map +1 -1
- package/event/flows/event-poll.flow.d.ts.map +1 -1
- package/event/flows/event-publish-http.flow.d.ts +1 -1
- package/event/flows/event-publish.flow.d.ts.map +1 -1
- package/event/flows/event-subscribe.flow.d.ts.map +1 -1
- package/event/flows/event-unsubscribe.flow.d.ts +2 -2
- package/event/flows/event-unsubscribe.flow.d.ts.map +1 -1
- package/event/index.d.ts +1 -1
- package/event/index.d.ts.map +1 -1
- package/event/poll/event-poll-leases.d.ts +4 -2
- package/event/poll/event-poll-leases.d.ts.map +1 -1
- package/event/replay/event-replays.d.ts.map +1 -1
- package/event/stream/event-stream.d.ts +2 -0
- package/event/stream/event-stream.d.ts.map +1 -1
- package/event/stream/event-streams.d.ts +5 -2
- package/event/stream/event-streams.d.ts.map +1 -1
- package/event/subscription/event-subscription-store.factory.d.ts.map +1 -1
- package/event/subscription/event-subscription-termination.d.ts.map +1 -1
- package/event/subscription/event-subscription.store.d.ts +6 -0
- package/event/subscription/event-subscription.store.d.ts.map +1 -1
- package/event/subscription/event-subscriptions.d.ts +4 -4
- package/event/subscription/event-subscriptions.d.ts.map +1 -1
- package/front-mcp/front-mcp.d.ts +7 -2
- package/front-mcp/front-mcp.d.ts.map +1 -1
- package/ha/ha-manager.d.ts.map +1 -1
- package/ha/ha-redis-client.d.ts +16 -0
- package/ha/ha-redis-client.d.ts.map +1 -0
- package/ha/heartbeat.service.d.ts +4 -2
- package/ha/heartbeat.service.d.ts.map +1 -1
- package/ha/index.d.ts +2 -1
- package/ha/index.d.ts.map +1 -1
- package/ha/notification-relay.d.ts +8 -3
- package/ha/notification-relay.d.ts.map +1 -1
- package/ha/relay-messages.d.ts +23 -4
- package/ha/relay-messages.d.ts.map +1 -1
- package/http-route/flows/http.route.flow.d.ts +15 -4
- package/http-route/flows/http.route.flow.d.ts.map +1 -1
- package/http-route/http-route.table.d.ts +5 -1
- package/http-route/http-route.table.d.ts.map +1 -1
- package/http-route/people-session-store.d.ts +4 -2
- package/http-route/people-session-store.d.ts.map +1 -1
- package/http-route/people-sign-in.routes.d.ts +10 -0
- package/http-route/people-sign-in.routes.d.ts.map +1 -1
- package/index.d.ts +15 -14
- package/index.d.ts.map +1 -1
- package/index.js +62 -57
- package/job/execution/job-execution.manager.d.ts +73 -7
- package/job/execution/job-execution.manager.d.ts.map +1 -1
- package/job/flows/execute-job.flow.d.ts.map +1 -1
- package/job/index.d.ts +2 -2
- package/job/index.d.ts.map +1 -1
- package/job/job-admission.d.ts +81 -2
- package/job/job-admission.d.ts.map +1 -1
- package/job/job-attempt.d.ts +2 -2
- package/job/job-attempt.d.ts.map +1 -1
- package/job/job-run-access.d.ts +14 -0
- package/job/job-run-access.d.ts.map +1 -1
- package/job/job-scope.helper.d.ts +20 -0
- package/job/job-scope.helper.d.ts.map +1 -1
- package/job/runner/detached-job.worker.d.ts +9 -0
- package/job/runner/detached-job.worker.d.ts.map +1 -1
- package/job/runner/job-runner.d.ts +18 -0
- package/job/runner/job-runner.d.ts.map +1 -1
- package/job/store/job-definition-store.factory.d.ts +5 -1
- package/job/store/job-definition-store.factory.d.ts.map +1 -1
- package/job/store/job-state-store.factory.d.ts +5 -1
- package/job/store/job-state-store.factory.d.ts.map +1 -1
- package/job/store/job-state.interface.d.ts +16 -0
- package/job/store/job-state.interface.d.ts.map +1 -1
- package/job/store/memory-job-state.store.d.ts +33 -2
- package/job/store/memory-job-state.store.d.ts.map +1 -1
- package/job/store/redis-job-state.store.d.ts +13 -3
- package/job/store/redis-job-state.store.d.ts.map +1 -1
- package/job/store/storage-job-state.store.d.ts +4 -0
- package/job/store/storage-job-state.store.d.ts.map +1 -1
- package/job/tools/cancel-job.tool.d.ts.map +1 -1
- package/job/tools/register-job.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/mcp-registry/flows/server-card.flow.d.ts +3 -3
- package/mcp-registry/flows/well-known.ai-catalog.flow.d.ts +2 -2
- package/mcp-registry/flows/well-known.mcp-registry-auth.flow.d.ts +1 -1
- package/notification/notification.service.d.ts +5 -1
- package/notification/notification.service.d.ts.map +1 -1
- package/package.json +10 -10
- package/prompt/flows/get-prompt.flow.d.ts.map +1 -1
- package/prompt/flows/prompts-list.flow.d.ts +1 -1
- package/prompt/flows/prompts-list.flow.d.ts.map +1 -1
- package/provider/borrow-providers.d.ts +15 -0
- package/provider/borrow-providers.d.ts.map +1 -0
- package/provider/container-handle.d.ts +31 -0
- package/provider/container-handle.d.ts.map +1 -0
- package/provider/create-container.d.ts +8 -2
- package/provider/create-container.d.ts.map +1 -1
- package/provider/provider.registry.d.ts +23 -4
- package/provider/provider.registry.d.ts.map +1 -1
- package/remote-mcp/remote-oauth.d.ts +3 -1
- package/remote-mcp/remote-oauth.d.ts.map +1 -1
- package/resource/flows/read-resource.flow.d.ts.map +1 -1
- package/resource/flows/resource-templates-list.flow.d.ts +1 -1
- package/resource/flows/resource-templates-list.flow.d.ts.map +1 -1
- package/resource/flows/resources-list.flow.d.ts +1 -1
- package/resource/flows/resources-list.flow.d.ts.map +1 -1
- package/resource/flows/subscribe-resource.flow.d.ts +1 -0
- package/resource/flows/subscribe-resource.flow.d.ts.map +1 -1
- package/resource/materialized/materialized-resources.d.ts +15 -3
- package/resource/materialized/materialized-resources.d.ts.map +1 -1
- package/resource/materialized/resource-store.d.ts +6 -2
- package/resource/materialized/resource-store.d.ts.map +1 -1
- package/resource/resource.events.d.ts +3 -0
- package/resource/resource.events.d.ts.map +1 -1
- package/resource/resource.registry.d.ts +8 -3
- package/resource/resource.registry.d.ts.map +1 -1
- package/scope/flows/http.request.flow.d.ts +8 -1
- package/scope/flows/http.request.flow.d.ts.map +1 -1
- package/scope/scope.instance.d.ts +2 -2
- package/scope/scope.instance.d.ts.map +1 -1
- package/server/adapters/express.host.adapter.d.ts +26 -0
- package/server/adapters/express.host.adapter.d.ts.map +1 -1
- package/server/adapters/user-content.listener.d.ts +5 -1
- package/server/adapters/user-content.listener.d.ts.map +1 -1
- package/server/custom-routes.helper.d.ts +19 -2
- package/server/custom-routes.helper.d.ts.map +1 -1
- package/server/security/resolve-allowed-hosts.d.ts +16 -0
- package/server/security/resolve-allowed-hosts.d.ts.map +1 -1
- package/server/security/same-origin.d.ts +2 -1
- package/server/security/same-origin.d.ts.map +1 -1
- package/server/server.instance.d.ts +10 -0
- package/server/server.instance.d.ts.map +1 -1
- package/shared/ensure-shared-server.d.ts +9 -2
- package/shared/ensure-shared-server.d.ts.map +1 -1
- package/shared/flows/shared.drain.flow.d.ts +1 -1
- package/shared/flows/shared.identify.flow.d.ts +6 -2
- package/shared/flows/shared.identify.flow.d.ts.map +1 -1
- package/shared/index.d.ts.map +1 -1
- package/shared/shared-attach.d.ts +15 -6
- package/shared/shared-attach.d.ts.map +1 -1
- package/shared/shared-embedded.d.ts +12 -2
- package/shared/shared-embedded.d.ts.map +1 -1
- package/shared/shared-endpoint.d.ts +3 -1
- package/shared/shared-endpoint.d.ts.map +1 -1
- package/shared/shared-files.d.ts +2 -0
- package/shared/shared-files.d.ts.map +1 -1
- package/shared/shared-serve.d.ts +20 -1
- package/shared/shared-serve.d.ts.map +1 -1
- package/shared/shared-server.lifecycle.d.ts +40 -10
- package/shared/shared-server.lifecycle.d.ts.map +1 -1
- package/shared/shared-server.options.d.ts +43 -6
- package/shared/shared-server.options.d.ts.map +1 -1
- package/skill/cache/skill-http-cache.catalog.d.ts +4 -4
- package/skill/cache/skill-http-cache.catalog.d.ts.map +1 -1
- package/skill/cache/skill-http-cache.d.ts +15 -2
- package/skill/cache/skill-http-cache.d.ts.map +1 -1
- package/skill/cache/skill-http-cache.factory.d.ts +12 -0
- package/skill/cache/skill-http-cache.factory.d.ts.map +1 -1
- package/skill/flows/http/llm-full-txt.flow.d.ts +1 -1
- package/skill/flows/http/llm-full-txt.flow.d.ts.map +1 -1
- package/skill/flows/http/llm-txt.flow.d.ts +1 -1
- package/skill/flows/http/llm-txt.flow.d.ts.map +1 -1
- package/skill/flows/http/skills-api.flow.d.ts +1 -1
- package/skill/flows/http/skills-api.flow.d.ts.map +1 -1
- package/skill/flows/load-skill.flow.d.ts.map +1 -1
- package/skill/skill-filter.helper.d.ts +16 -0
- package/skill/skill-filter.helper.d.ts.map +1 -1
- package/skill/skill-http.utils.d.ts +7 -1
- package/skill/skill-http.utils.d.ts.map +1 -1
- package/surface/entry-enabled.d.ts +23 -6
- package/surface/entry-enabled.d.ts.map +1 -1
- package/surface/index.d.ts +2 -2
- package/surface/index.d.ts.map +1 -1
- package/surface/live-surface.d.ts +32 -7
- package/surface/live-surface.d.ts.map +1 -1
- package/task/helpers/task-run-context.d.ts +5 -0
- package/task/helpers/task-run-context.d.ts.map +1 -0
- package/task/helpers/task-runner.d.ts.map +1 -1
- package/task/store/storage-task.store.d.ts.map +1 -1
- package/task/store/task-store.factory.d.ts.map +1 -1
- package/task/store/task.store.d.ts +1 -1
- package/task/store/task.store.d.ts.map +1 -1
- package/task/task.types.d.ts +1 -0
- package/task/task.types.d.ts.map +1 -1
- package/tool/flows/call-tool.flow.d.ts +10 -3
- package/tool/flows/call-tool.flow.d.ts.map +1 -1
- package/tool/flows/tools-list.flow.d.ts +1 -1
- package/tool/flows/tools-list.flow.d.ts.map +1 -1
- package/tool/ui/ui-shared.d.ts +2 -0
- package/tool/ui/ui-shared.d.ts.map +1 -1
- package/tool/ui/widget-enabled.d.ts +8 -0
- package/tool/ui/widget-enabled.d.ts.map +1 -0
- package/tool/undeclared-arguments-message.d.ts.map +1 -1
- package/tool/undeclared-arguments.d.ts +4 -0
- package/tool/undeclared-arguments.d.ts.map +1 -1
- package/transport/adapters/streamable-http-transport.d.ts +2 -0
- package/transport/adapters/streamable-http-transport.d.ts.map +1 -1
- package/transport/adapters/transport.local.adapter.d.ts +3 -0
- package/transport/adapters/transport.local.adapter.d.ts.map +1 -1
- package/transport/adapters/transport.sse.adapter.d.ts +3 -0
- package/transport/adapters/transport.sse.adapter.d.ts.map +1 -1
- package/transport/adapters/transport.streamable-http.adapter.d.ts +1 -0
- package/transport/adapters/transport.streamable-http.adapter.d.ts.map +1 -1
- package/transport/bus/redis-transport-bus.d.ts +25 -4
- package/transport/bus/redis-transport-bus.d.ts.map +1 -1
- package/transport/channel-signature.d.ts +16 -0
- package/transport/channel-signature.d.ts.map +1 -0
- package/transport/event-stores/redis.event-store.d.ts +1 -1
- package/transport/event-stores/redis.event-store.d.ts.map +1 -1
- package/transport/flows/handle.mcp-20260728.flow.d.ts +2 -1
- package/transport/flows/handle.mcp-20260728.flow.d.ts.map +1 -1
- package/transport/flows/handle.streamable-http.flow.d.ts +1 -1
- package/transport/flows/handle.streamable-http.flow.d.ts.map +1 -1
- package/transport/mcp-20260728/client/mcp-stateless.client.d.ts +8 -0
- package/transport/mcp-20260728/client/mcp-stateless.client.d.ts.map +1 -1
- package/transport/mcp-20260728/result-decorator.d.ts +4 -2
- package/transport/mcp-20260728/result-decorator.d.ts.map +1 -1
- package/transport/mcp-20260728/subscriptions.d.ts +2 -0
- package/transport/mcp-20260728/subscriptions.d.ts.map +1 -1
- package/transport/mcp-handlers/index.d.ts +5 -3
- package/transport/mcp-handlers/index.d.ts.map +1 -1
- package/transport/relay/relay-scope.helper.d.ts +2 -2
- package/transport/relay/relay-scope.helper.d.ts.map +1 -1
- package/transport/session-end-channel.d.ts +81 -0
- package/transport/session-end-channel.d.ts.map +1 -0
- package/transport/transport.local.d.ts +2 -1
- package/transport/transport.local.d.ts.map +1 -1
- package/transport/transport.registry.d.ts +73 -2
- package/transport/transport.registry.d.ts.map +1 -1
- package/transport/transport.types.d.ts +6 -1
- package/transport/transport.types.d.ts.map +1 -1
- package/transport/web-fetch-handler.d.ts.map +1 -1
- package/utils/same-origin-fetch.utils.d.ts +5 -0
- package/utils/same-origin-fetch.utils.d.ts.map +1 -0
- package/work/index.d.ts +2 -0
- package/work/index.d.ts.map +1 -0
- package/work/work-spans.d.ts +42 -0
- package/work/work-spans.d.ts.map +1 -0
- package/worker/worker.lifecycle.d.ts.map +1 -1
- package/workflow/engine/workflow-step.executor.d.ts +10 -3
- package/workflow/engine/workflow-step.executor.d.ts.map +1 -1
- package/workflow/engine/workflow.engine.d.ts +2 -0
- package/workflow/engine/workflow.engine.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/update-workflow.tool.d.ts.map +1 -1
|
@@ -13,6 +13,8 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
13
13
|
import { PEOPLE_SESSION_COOKIE } from "@frontmcp/auth";
|
|
14
14
|
import { internalZ as z } from "@frontmcp/lazy-zod";
|
|
15
15
|
import { getCookie } from "@frontmcp/utils";
|
|
16
|
+
import { mayReachApp } from "../../auth/authorized-apps.utils.mjs";
|
|
17
|
+
import { getConsentedToolIds, isToolConsented } from "../../auth/consent.utils.mjs";
|
|
16
18
|
import {
|
|
17
19
|
authInfoFromAuthorization,
|
|
18
20
|
challengeHeaders,
|
|
@@ -25,12 +27,16 @@ import {
|
|
|
25
27
|
httpInputSchema,
|
|
26
28
|
httpOutputSchema,
|
|
27
29
|
httpRespond,
|
|
28
|
-
isProxyTrusted
|
|
30
|
+
isProxyTrusted,
|
|
31
|
+
partitionsByIdentity
|
|
29
32
|
} from "../../common/index.mjs";
|
|
30
33
|
import { CrossOriginRequestError, InvalidHttpRouteResponseError, PersonNotSignedInError } from "../../errors/index.mjs";
|
|
31
34
|
import { FlowContextProviders } from "../../provider/flow-context-providers.mjs";
|
|
35
|
+
import { anonymousCallerRefusal, isAnonymousAuthorization } from "../../server/custom-routes.helper.mjs";
|
|
32
36
|
import { corsAllowedOrigins } from "../../server/security/resolve-allowed-hosts.mjs";
|
|
33
37
|
import { isSameOriginRequest } from "../../server/security/same-origin.mjs";
|
|
38
|
+
import { appOwnerIdOf, isServerEntryOwner } from "../../utils/lineage.utils.mjs";
|
|
39
|
+
import { withWorkSpan } from "../../work/work-spans.mjs";
|
|
34
40
|
import { SseRouteStream } from "../sse-route.stream.mjs";
|
|
35
41
|
var plan = {
|
|
36
42
|
pre: [
|
|
@@ -40,6 +46,8 @@ var plan = {
|
|
|
40
46
|
"checkSameOrigin",
|
|
41
47
|
"authenticatePerson",
|
|
42
48
|
"authenticateBearer",
|
|
49
|
+
"acquireIdentityQuota",
|
|
50
|
+
"checkAppGrant",
|
|
43
51
|
"checkAuthorities"
|
|
44
52
|
],
|
|
45
53
|
execute: ["handle"]
|
|
@@ -86,6 +94,7 @@ var HttpRouteFlow = class extends FlowBase {
|
|
|
86
94
|
this.state.set("route", match.route);
|
|
87
95
|
}
|
|
88
96
|
async acquireQuota() {
|
|
97
|
+
if (this.countsUnderVerifiedCaller()) return;
|
|
89
98
|
await enforceGlobalRateLimit(this.scope, this.tryGetContext());
|
|
90
99
|
}
|
|
91
100
|
async checkSameOrigin() {
|
|
@@ -95,7 +104,10 @@ var HttpRouteFlow = class extends FlowBase {
|
|
|
95
104
|
...corsAllowedOrigins(http?.cors) ?? [],
|
|
96
105
|
...http?.security?.dnsRebindingProtection?.allowedOrigins ?? []
|
|
97
106
|
];
|
|
98
|
-
|
|
107
|
+
const loopbackNames = this.scope.server?.loopbackNames?.();
|
|
108
|
+
if (!isSameOriginRequest(this.httpRequest.headers, allowed, isProxyTrusted(), loopbackNames)) {
|
|
109
|
+
throw new CrossOriginRequestError();
|
|
110
|
+
}
|
|
99
111
|
}
|
|
100
112
|
async authenticatePerson() {
|
|
101
113
|
const { auth } = this.state.required.route;
|
|
@@ -105,22 +117,46 @@ var HttpRouteFlow = class extends FlowBase {
|
|
|
105
117
|
this.state.set("person", person);
|
|
106
118
|
}
|
|
107
119
|
async authenticateBearer() {
|
|
108
|
-
|
|
120
|
+
const { route } = this.state.required;
|
|
121
|
+
if (route.auth !== "bearer") return;
|
|
109
122
|
const verified = await this.scope.runFlow("session:verify", {
|
|
110
123
|
request: this.httpRequest,
|
|
111
124
|
sessionless: true
|
|
112
125
|
});
|
|
113
126
|
if (verified?.kind !== "authorized") {
|
|
127
|
+
await this.countRefusedBearerRequest();
|
|
114
128
|
const headers = challengeHeaders(verified?.prmMetadataHeader);
|
|
115
129
|
this.respond(
|
|
116
130
|
verified?.kind === "forbidden" ? httpRespond.forbidden({ headers }) : httpRespond.unauthorized({ headers })
|
|
117
131
|
);
|
|
118
132
|
return;
|
|
119
133
|
}
|
|
134
|
+
if (!route.allowAnonymous && isAnonymousAuthorization(verified.authorization)) {
|
|
135
|
+
await this.countRefusedBearerRequest();
|
|
136
|
+
this.respond(anonymousCallerRefusal(this.httpRequest, this.scope.entryPath, this.scope.routeBase));
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
120
139
|
const caller = authInfoFromAuthorization(verified.authorization);
|
|
121
140
|
this.tryGetContext()?.recordAuthorization(caller);
|
|
122
141
|
this.state.set("caller", caller);
|
|
123
142
|
}
|
|
143
|
+
async acquireIdentityQuota() {
|
|
144
|
+
if (!this.countsUnderVerifiedCaller()) return;
|
|
145
|
+
await enforceGlobalRateLimit(this.scope, this.tryGetContext(), { callerVerified: true });
|
|
146
|
+
}
|
|
147
|
+
async checkAppGrant() {
|
|
148
|
+
const { route } = this.state.required;
|
|
149
|
+
const { caller } = this.state;
|
|
150
|
+
if (route.auth !== "bearer" || !route.app || !caller) return;
|
|
151
|
+
const consented = getConsentedToolIds(caller);
|
|
152
|
+
if (mayReachApp(this.scope.auth?.options, caller, route.app) && (!consented || this.consentReachesApp(consented, route.app.id))) {
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
this.scope.logger.verbose(
|
|
156
|
+
`HTTP route ${route.method} ${route.path} refused a caller whose token is not granted app "${route.app.id}"`
|
|
157
|
+
);
|
|
158
|
+
this.respond(httpRespond.forbidden());
|
|
159
|
+
}
|
|
124
160
|
async checkAuthorities() {
|
|
125
161
|
const { route } = this.state.required;
|
|
126
162
|
if (route.authorities === void 0) return;
|
|
@@ -149,9 +185,12 @@ var HttpRouteFlow = class extends FlowBase {
|
|
|
149
185
|
person
|
|
150
186
|
});
|
|
151
187
|
if (route.auth === "bearer") await context.loadAuthContext?.();
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
188
|
+
if (route.sse) {
|
|
189
|
+
this.respond(this.openStream(route, route.sse, context));
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
const result = await withWorkSpan("http", routeSpanName(route), () => context.handle());
|
|
193
|
+
this.respond(this.toHttpOutput(route, result));
|
|
155
194
|
}
|
|
156
195
|
/**
|
|
157
196
|
* What `handle()` returned, as the response. A value with a response `kind` that is valid for that kind is a
|
|
@@ -179,6 +218,29 @@ var HttpRouteFlow = class extends FlowBase {
|
|
|
179
218
|
contentType: "application/json; charset=utf-8"
|
|
180
219
|
};
|
|
181
220
|
}
|
|
221
|
+
/** Whether this request's `throttle.global` is keyed on the caller, which a bearer route knows once verified. */
|
|
222
|
+
countsUnderVerifiedCaller() {
|
|
223
|
+
const partitionBy = this.scope.rateLimitManager?.config?.global?.partitionBy;
|
|
224
|
+
return this.state.required.route.auth === "bearer" && partitionsByIdentity(partitionBy);
|
|
225
|
+
}
|
|
226
|
+
/** Count a bearer request its verification refused against a `throttle.global` keyed by a function, without a caller. */
|
|
227
|
+
async countRefusedBearerRequest() {
|
|
228
|
+
if (typeof this.scope.rateLimitManager?.config?.global?.partitionBy !== "function") return;
|
|
229
|
+
await enforceGlobalRateLimit(this.scope, this.tryGetContext());
|
|
230
|
+
}
|
|
231
|
+
/** Whether consent selected a tool of the app, by the names `checkToolAuthorization` accepts for it. */
|
|
232
|
+
consentReachesApp(consented, appId) {
|
|
233
|
+
const tools = this.scope.tools.getTools(true);
|
|
234
|
+
const nameCounts = /* @__PURE__ */ new Map();
|
|
235
|
+
for (const tool of tools) nameCounts.set(tool.name, (nameCounts.get(tool.name) ?? 0) + 1);
|
|
236
|
+
return tools.some((tool) => {
|
|
237
|
+
const { owner } = tool;
|
|
238
|
+
if (!owner || isServerEntryOwner(owner)) return false;
|
|
239
|
+
const toolAppId = owner.kind === "plugin" || owner.kind === "adapter" ? appOwnerIdOf(this.scope.tools.lineageOf(tool) ?? [], owner) : owner.id;
|
|
240
|
+
if (toolAppId !== appId) return false;
|
|
241
|
+
return (nameCounts.get(tool.name) ?? 0) > 1 ? isToolConsented(consented, tool.fullName) : isToolConsented(consented, tool.name, tool.fullName);
|
|
242
|
+
});
|
|
243
|
+
}
|
|
182
244
|
/** The person signed in for routes of `auth`: a session for a subject opens `'subject'` routes only. */
|
|
183
245
|
async verifyPerson(auth) {
|
|
184
246
|
const cookie = getCookie(this.httpRequest.headers["cookie"], PEOPLE_SESSION_COOKIE);
|
|
@@ -195,7 +257,7 @@ var HttpRouteFlow = class extends FlowBase {
|
|
|
195
257
|
openStream(route, sse, context) {
|
|
196
258
|
const table = this.scope.httpRouteTable;
|
|
197
259
|
const stream = new SseRouteStream({
|
|
198
|
-
produce: async () => context.handle(),
|
|
260
|
+
produce: async () => withWorkSpan("http", routeSpanName(route), () => context.handle()),
|
|
199
261
|
subscribe: (listener) => {
|
|
200
262
|
const stops = sse.topics.map((topic) => sse.store.subscribe(topic, listener));
|
|
201
263
|
return () => stops.forEach((stop) => stop());
|
|
@@ -235,6 +297,12 @@ __decorateClass([
|
|
|
235
297
|
__decorateClass([
|
|
236
298
|
Stage("authenticateBearer")
|
|
237
299
|
], HttpRouteFlow.prototype, "authenticateBearer", 1);
|
|
300
|
+
__decorateClass([
|
|
301
|
+
Stage("acquireIdentityQuota")
|
|
302
|
+
], HttpRouteFlow.prototype, "acquireIdentityQuota", 1);
|
|
303
|
+
__decorateClass([
|
|
304
|
+
Stage("checkAppGrant")
|
|
305
|
+
], HttpRouteFlow.prototype, "checkAppGrant", 1);
|
|
238
306
|
__decorateClass([
|
|
239
307
|
Stage("checkAuthorities")
|
|
240
308
|
], HttpRouteFlow.prototype, "checkAuthorities", 1);
|
|
@@ -251,6 +319,9 @@ HttpRouteFlow = __decorateClass([
|
|
|
251
319
|
middleware: {}
|
|
252
320
|
})
|
|
253
321
|
], HttpRouteFlow);
|
|
322
|
+
function routeSpanName(route) {
|
|
323
|
+
return `${route.method} ${route.path}`;
|
|
324
|
+
}
|
|
254
325
|
function authoritiesInput(request) {
|
|
255
326
|
const { body } = request;
|
|
256
327
|
const fields = typeof body === "object" && body !== null && !Array.isArray(body) ? body : {};
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
// libs/sdk/src/http-route/http-route.table.ts
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
LoopbackTokenAuth,
|
|
4
|
+
peopleAuthOptionsSchema
|
|
5
|
+
} from "@frontmcp/auth";
|
|
3
6
|
import { ProviderScope } from "@frontmcp/di";
|
|
4
7
|
import {
|
|
8
|
+
allowsPublicAccess,
|
|
5
9
|
HTTP_ROUTE_PATH_MESSAGE,
|
|
6
10
|
httpRouteMetadataOf,
|
|
7
11
|
isHttpRoutePath,
|
|
@@ -15,7 +19,7 @@ import { servedHealthPaths } from "../health/health.routes.mjs";
|
|
|
15
19
|
import { assertNotReserved, computeReservedPaths } from "../server/custom-routes.helper.mjs";
|
|
16
20
|
import { workflowWebhookRoutes } from "../workflow/trigger/workflow-webhook.routes.mjs";
|
|
17
21
|
import { openPeopleSessionStore, peopleStoreBackend } from "./people-session-store.mjs";
|
|
18
|
-
import { PEOPLE_SIGN_IN_ROUTES } from "./people-sign-in.routes.mjs";
|
|
22
|
+
import { PEOPLE_SIGN_IN_ROUTES, peopleLogoutRoute } from "./people-sign-in.routes.mjs";
|
|
19
23
|
function header(request, name) {
|
|
20
24
|
const value = request.headers[name];
|
|
21
25
|
return (Array.isArray(value) ? value.join(",") : value) ?? "";
|
|
@@ -52,7 +56,17 @@ var HttpRouteTable = class {
|
|
|
52
56
|
}
|
|
53
57
|
};
|
|
54
58
|
var peopleAuthByServer = /* @__PURE__ */ new WeakMap();
|
|
55
|
-
function
|
|
59
|
+
function stderrIsTerminal() {
|
|
60
|
+
return typeof process !== "undefined" && process.stderr?.isTTY === true;
|
|
61
|
+
}
|
|
62
|
+
function printSignInToken(token, startupToken, logger) {
|
|
63
|
+
if (startupToken === "off") return;
|
|
64
|
+
if (startupToken !== "stderr" && !stderrIsTerminal()) {
|
|
65
|
+
logger.info(
|
|
66
|
+
"The people sign-in token is not printed, since stderr is not a terminal: make sign-in codes with createCode(), or set http.auth.people.startupToken: 'stderr'"
|
|
67
|
+
);
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
56
70
|
const message = `[frontmcp] people sign-in token: ${token}
|
|
57
71
|
[frontmcp] It is shown only once. Exchange it for a one-time sign-in link: POST /_frontmcp/people/code with "Authorization: Bearer <token>".
|
|
58
72
|
`;
|
|
@@ -80,7 +94,7 @@ async function createPeopleAuth(scope, option, sqlite) {
|
|
|
80
94
|
});
|
|
81
95
|
}
|
|
82
96
|
const token = auth.takeToken();
|
|
83
|
-
if (token) printSignInToken(token);
|
|
97
|
+
if (token) printSignInToken(token, parsed.data.startupToken, logger);
|
|
84
98
|
return auth;
|
|
85
99
|
}
|
|
86
100
|
async function peopleAuthFor(scope, server, option, sqlite) {
|
|
@@ -113,7 +127,7 @@ function withoutTrailingSlash(path) {
|
|
|
113
127
|
async function attachHttpRoutes(scope, server, stores = {}) {
|
|
114
128
|
const declared = scope.apps.getApps().flatMap((app) => {
|
|
115
129
|
const routes2 = app.metadata.routes ?? [];
|
|
116
|
-
return routes2.map((target) => ({ target, providers: app.providers }));
|
|
130
|
+
return routes2.map((target) => ({ target, providers: app.providers, app }));
|
|
117
131
|
});
|
|
118
132
|
const webhooks = workflowWebhookRoutes(scope.workflows?.getWorkflows(true) ?? []);
|
|
119
133
|
const peopleOption = scope.metadata.http?.auth?.people;
|
|
@@ -125,14 +139,19 @@ async function attachHttpRoutes(scope, server, stores = {}) {
|
|
|
125
139
|
}
|
|
126
140
|
if (declared.length === 0 && webhooks.length === 0 && peopleOption === void 0) return;
|
|
127
141
|
const people = peopleOption === void 0 ? void 0 : await peopleAuthFor(scope, server, peopleOption, stores.sqlite);
|
|
128
|
-
const builtInRoutes = [
|
|
142
|
+
const builtInRoutes = [
|
|
143
|
+
...PEOPLE_SIGN_IN_ROUTES,
|
|
144
|
+
...people ? [peopleLogoutRoute(people.options.cookiePath ?? "/")] : [],
|
|
145
|
+
...questions ? questionInboxRoutes(questions.store) : []
|
|
146
|
+
];
|
|
129
147
|
const builtIn = people ? builtInRoutes.map((target) => ({ target, providers: scope.providers })) : [];
|
|
130
148
|
const reserved = computeReservedPaths(scope.entryPath, scope.routeBase, servedHealthPaths(scope.metadata.health));
|
|
131
149
|
const mcpPath = scope.fullPath || "/";
|
|
132
150
|
const served = /* @__PURE__ */ new Set();
|
|
133
151
|
const toEntry = ({
|
|
134
152
|
target,
|
|
135
|
-
providers
|
|
153
|
+
providers,
|
|
154
|
+
app
|
|
136
155
|
}) => {
|
|
137
156
|
const metadata = httpRouteMetadataOf(target);
|
|
138
157
|
if (!metadata) {
|
|
@@ -163,15 +182,18 @@ async function attachHttpRoutes(scope, server, stores = {}) {
|
|
|
163
182
|
throw new InvalidHttpRouteError(method, path, "another route already serves this method and path");
|
|
164
183
|
}
|
|
165
184
|
served.add(key);
|
|
166
|
-
|
|
185
|
+
const allowAnonymous = auth === "bearer" && metadata.allowAnonymous === true;
|
|
186
|
+
if (auth === "bearer") checkBearerRoute(scope, `${method} ${path}`, metadata.authorities, allowAnonymous);
|
|
167
187
|
return {
|
|
168
188
|
method,
|
|
169
189
|
path,
|
|
170
190
|
auth,
|
|
171
191
|
authorities: metadata.authorities,
|
|
192
|
+
allowAnonymous,
|
|
172
193
|
sse: metadata.sse,
|
|
173
194
|
target,
|
|
174
195
|
providers,
|
|
196
|
+
app,
|
|
175
197
|
sharesMcpPath
|
|
176
198
|
};
|
|
177
199
|
};
|
|
@@ -184,16 +206,21 @@ async function attachHttpRoutes(scope, server, stores = {}) {
|
|
|
184
206
|
scope.httpRouteTable = table;
|
|
185
207
|
scope.onDispose(() => table.closeStreams());
|
|
186
208
|
}
|
|
187
|
-
function checkBearerRoute(scope, route, authorities) {
|
|
209
|
+
function checkBearerRoute(scope, route, authorities, allowAnonymous) {
|
|
188
210
|
if (authorities !== void 0) {
|
|
189
211
|
assertEntryAuthorities(scope.authoritiesEngine, scope.authoritiesContextBuilder, [
|
|
190
212
|
{ label: `HTTP route "${route}"`, authorities }
|
|
191
213
|
]);
|
|
192
214
|
}
|
|
193
215
|
const authOptions = scope.auth?.options;
|
|
194
|
-
|
|
216
|
+
const publicMode = !authOptions || isPublicMode(authOptions);
|
|
217
|
+
if (allowAnonymous && (!authOptions || allowsPublicAccess(authOptions))) {
|
|
218
|
+
scope.logger.warn(
|
|
219
|
+
`HTTP route ${route} has allowAnonymous: true, so it serves the callers the server's auth admits without signing in, and publicAccess does not limit them there.`
|
|
220
|
+
);
|
|
221
|
+
} else if (publicMode) {
|
|
195
222
|
scope.logger.warn(
|
|
196
|
-
`HTTP route ${route} has auth: 'bearer', but the server's auth is in public mode, so
|
|
223
|
+
`HTTP route ${route} has auth: 'bearer', but the server's auth is in public mode, so a caller without a token this server issued is anonymous and gets 401: set auth to the mode that verifies your tokens, or give the route auth: 'public'.`
|
|
197
224
|
);
|
|
198
225
|
}
|
|
199
226
|
}
|
|
@@ -3,12 +3,12 @@ import {
|
|
|
3
3
|
createNamespacedStorage,
|
|
4
4
|
createStorage
|
|
5
5
|
} from "@frontmcp/utils";
|
|
6
|
-
import {
|
|
6
|
+
import { isRedisConnectionOptions, redisOptionsSchema, redisStorageConfigOf } from "../common/index.mjs";
|
|
7
|
+
var DEFAULT_KEY_PREFIX = "mcp:";
|
|
7
8
|
function serverRedis(redis) {
|
|
8
9
|
const parsed = redis === void 0 ? void 0 : redisOptionsSchema.safeParse(redis);
|
|
9
|
-
if (!parsed?.success || !
|
|
10
|
-
|
|
11
|
-
return { type: "redis", redis: { config: { host, port, password, db, tls } } };
|
|
10
|
+
if (!parsed?.success || !isRedisConnectionOptions(parsed.data)) return void 0;
|
|
11
|
+
return { config: redisStorageConfigOf(parsed.data), keyPrefix: parsed.data.keyPrefix || DEFAULT_KEY_PREFIX };
|
|
12
12
|
}
|
|
13
13
|
function peopleStoreBackend(options, sources) {
|
|
14
14
|
if (options.store === false) return void 0;
|
|
@@ -18,7 +18,8 @@ function peopleStoreBackend(options, sources) {
|
|
|
18
18
|
}
|
|
19
19
|
async function openPeopleSessionStore(options, sources, serverName, logger) {
|
|
20
20
|
const backend = peopleStoreBackend(options, sources);
|
|
21
|
-
const
|
|
21
|
+
const redis = backend === "redis" ? serverRedis(sources.redis) : void 0;
|
|
22
|
+
const prefix = `${redis?.keyPrefix ?? DEFAULT_KEY_PREFIX}people:${serverName}:`;
|
|
22
23
|
if (backend === void 0) {
|
|
23
24
|
if (options.store !== false) {
|
|
24
25
|
logger.warn(
|
|
@@ -30,7 +31,7 @@ async function openPeopleSessionStore(options, sources, serverName, logger) {
|
|
|
30
31
|
if (backend === "auth.tokenStorage" && sources.tokenStorage) {
|
|
31
32
|
return { store: createNamespacedStorage(sources.tokenStorage, prefix), backend, close: async () => void 0 };
|
|
32
33
|
}
|
|
33
|
-
const config =
|
|
34
|
+
const config = redis ? redis.config : { type: "sqlite", sqlite: sources.sqlite };
|
|
34
35
|
try {
|
|
35
36
|
const storage = await createStorage({ ...config, prefix, fallback: "error" });
|
|
36
37
|
return { store: storage, backend, close: () => storage.disconnect() };
|
|
@@ -10,7 +10,13 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
10
10
|
};
|
|
11
11
|
|
|
12
12
|
// libs/sdk/src/http-route/people-sign-in.routes.ts
|
|
13
|
-
import {
|
|
13
|
+
import {
|
|
14
|
+
escapeHtml,
|
|
15
|
+
LoopbackTokenAuth,
|
|
16
|
+
PEOPLE_SESSION_COOKIE,
|
|
17
|
+
peopleSessionCookie
|
|
18
|
+
} from "@frontmcp/auth";
|
|
19
|
+
import { getCookie } from "@frontmcp/utils";
|
|
14
20
|
import { parseFormBody } from "../auth/flows/form-body.utils.mjs";
|
|
15
21
|
import {
|
|
16
22
|
getRequestBaseUrl,
|
|
@@ -22,6 +28,7 @@ import {
|
|
|
22
28
|
import { SignInLockedError, SignInRefusedError } from "../errors/index.mjs";
|
|
23
29
|
var PEOPLE_CODE_PATH = "/_frontmcp/people/code";
|
|
24
30
|
var PEOPLE_LOGIN_PATH = "/_frontmcp/people/login";
|
|
31
|
+
var PEOPLE_LOGOUT_PATH = "/_frontmcp/people/logout";
|
|
25
32
|
var CODE = /^[A-Za-z0-9_-]{1,128}$/;
|
|
26
33
|
var SAME_SITE_PATH = /^\/(?![/\\])[^\s]*$/;
|
|
27
34
|
var PAGE_HEADERS = { ...NO_STORE_HEADERS, "Referrer-Policy": "same-origin" };
|
|
@@ -40,6 +47,9 @@ function bearerToken(request) {
|
|
|
40
47
|
function clientOf(route) {
|
|
41
48
|
return route.tryGetContext()?.metadata.clientIp ?? "unknown";
|
|
42
49
|
}
|
|
50
|
+
function isBrowserOnHttps(request) {
|
|
51
|
+
return getRequestBaseUrl(request).startsWith("https:") || first(request.headers["origin"])?.startsWith("https://") === true;
|
|
52
|
+
}
|
|
43
53
|
function refusal(result) {
|
|
44
54
|
return result.reason === "locked" ? new SignInLockedError() : new SignInRefusedError();
|
|
45
55
|
}
|
|
@@ -88,7 +98,7 @@ var PeopleLoginRoute = class extends HttpRouteContext {
|
|
|
88
98
|
const next = escapeHtml(nextPath(fields["next"]));
|
|
89
99
|
const cookie = peopleSessionCookie(session.cookieValue, {
|
|
90
100
|
path: auth.options.cookiePath,
|
|
91
|
-
secure:
|
|
101
|
+
secure: auth.options.cookieSecure === true || isBrowserOnHttps(this.request),
|
|
92
102
|
maxAgeMs: auth.options.sessionTtlMs
|
|
93
103
|
});
|
|
94
104
|
const signedIn = page(
|
|
@@ -102,12 +112,43 @@ var PeopleLoginRoute = class extends HttpRouteContext {
|
|
|
102
112
|
PeopleLoginRoute = __decorateClass([
|
|
103
113
|
HttpRoute({ method: "POST", path: PEOPLE_LOGIN_PATH, auth: "public" })
|
|
104
114
|
], PeopleLoginRoute);
|
|
115
|
+
function peopleLogoutPath(cookiePath) {
|
|
116
|
+
let end = cookiePath.length;
|
|
117
|
+
while (end > 0 && cookiePath[end - 1] === "/") end--;
|
|
118
|
+
return `${cookiePath.slice(0, end)}${PEOPLE_LOGOUT_PATH}`;
|
|
119
|
+
}
|
|
120
|
+
var PeopleLogoutHandler = class extends HttpRouteContext {
|
|
121
|
+
async handle() {
|
|
122
|
+
const auth = this.get(LoopbackTokenAuth);
|
|
123
|
+
auth.endSession(getCookie(this.request.headers["cookie"], PEOPLE_SESSION_COOKIE));
|
|
124
|
+
await auth.flush();
|
|
125
|
+
const next = escapeHtml(nextPath(parseFormBody(this.request.body)["next"]));
|
|
126
|
+
const cleared = peopleSessionCookie("", {
|
|
127
|
+
path: auth.options.cookiePath,
|
|
128
|
+
secure: auth.options.cookieSecure === true || isBrowserOnHttps(this.request),
|
|
129
|
+
maxAgeMs: 0
|
|
130
|
+
});
|
|
131
|
+
const signedOut = page("Signed out", `<p>Signed out.</p><a href="${next}">Continue</a>`);
|
|
132
|
+
return { ...httpRespond.html(signedOut, 200, PAGE_HEADERS), cookies: [cleared] };
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
function peopleLogoutRoute(cookiePath) {
|
|
136
|
+
let PeopleLogoutRoute = class extends PeopleLogoutHandler {
|
|
137
|
+
};
|
|
138
|
+
PeopleLogoutRoute = __decorateClass([
|
|
139
|
+
HttpRoute({ method: "POST", path: peopleLogoutPath(cookiePath), auth: "public" })
|
|
140
|
+
], PeopleLogoutRoute);
|
|
141
|
+
return PeopleLogoutRoute;
|
|
142
|
+
}
|
|
105
143
|
var PEOPLE_SIGN_IN_ROUTES = [PeopleCodeRoute, PeopleLoginPageRoute, PeopleLoginRoute];
|
|
106
144
|
export {
|
|
107
145
|
PEOPLE_CODE_PATH,
|
|
108
146
|
PEOPLE_LOGIN_PATH,
|
|
147
|
+
PEOPLE_LOGOUT_PATH,
|
|
109
148
|
PEOPLE_SIGN_IN_ROUTES,
|
|
110
149
|
PeopleCodeRoute,
|
|
111
150
|
PeopleLoginPageRoute,
|
|
112
|
-
PeopleLoginRoute
|
|
151
|
+
PeopleLoginRoute,
|
|
152
|
+
peopleLogoutPath,
|
|
153
|
+
peopleLogoutRoute
|
|
113
154
|
};
|