@frontmcp/sdk 1.11.3 → 1.12.0
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/answer/answer-meter.d.ts +2 -0
- package/answer/answer-meter.d.ts.map +1 -1
- package/app/instances/app.esm.instance.d.ts +4 -2
- package/app/instances/app.esm.instance.d.ts.map +1 -1
- package/app/instances/app.lazy.instance.d.ts.map +1 -1
- package/app/lazy/lazy-app.rules.d.ts +4 -0
- package/app/lazy/lazy-app.rules.d.ts.map +1 -1
- package/browser/answer/answer-meter.mjs +1 -0
- package/browser/app/instances/app.esm.instance.mjs +11 -3
- package/browser/app/instances/app.lazy.instance.mjs +7 -3
- package/browser/app/lazy/lazy-app.rules.mjs +4 -1
- package/browser/channel/channel-notification.service.mjs +20 -8
- package/browser/channel/channel.instance.mjs +10 -1
- package/browser/channel/channel.utils.mjs +22 -1
- package/browser/channel/sources/app-event.source.mjs +5 -2
- package/browser/channel/sources/file-watcher.source.mjs +66 -0
- package/browser/common/decorators/duty.decorator.mjs +3 -4
- package/browser/common/decorators/event.decorator.mjs +49 -0
- package/browser/common/decorators/index.mjs +2 -0
- package/browser/common/decorators/worker.decorator.mjs +23 -0
- package/browser/common/entries/event.entry.mjs +59 -0
- package/browser/common/entries/index.mjs +1 -0
- package/browser/common/index.mjs +7 -7
- package/browser/common/interfaces/event.interface.mjs +17 -0
- package/browser/common/interfaces/execution-context.interface.mjs +8 -0
- package/browser/common/interfaces/index.mjs +2 -0
- package/browser/common/interfaces/worker.interface.mjs +0 -0
- package/browser/common/metadata/app.metadata.mjs +2 -0
- package/browser/common/metadata/duty.metadata.mjs +28 -13
- package/browser/common/metadata/duty.resolved.mjs +13 -0
- package/browser/common/metadata/event.metadata.mjs +137 -0
- package/browser/common/metadata/front-mcp.metadata.mjs +3 -0
- package/browser/common/metadata/index.mjs +5 -1
- package/browser/common/metadata/worker.metadata.mjs +44 -0
- package/browser/common/metadata/worker.resolved.mjs +13 -0
- package/browser/common/metadata/workflow.metadata.mjs +7 -1
- package/browser/common/records/event.record.mjs +9 -0
- package/browser/common/records/index.mjs +1 -0
- package/browser/common/schemas/annotated-class.schema.mjs +10 -0
- package/browser/common/schemas/index.mjs +1 -1
- package/browser/common/tokens/app.tokens.mjs +1 -0
- package/browser/common/tokens/event.tokens.mjs +11 -0
- package/browser/common/tokens/front-mcp.tokens.mjs +2 -0
- package/browser/common/tokens/index.mjs +1 -0
- package/browser/common/tokens/workflow.tokens.mjs +1 -0
- package/browser/common/utils/offset-cursor.utils.mjs +23 -0
- package/browser/common/utils/principal.utils.mjs +1 -1
- package/browser/common/utils/time-zone.utils.mjs +12 -0
- package/browser/direct/create.mjs +3 -1
- package/browser/direct/direct-client.mjs +16 -2
- package/browser/direct/direct-events-transport.mjs +47 -0
- package/browser/direct/direct-server.mjs +5 -1
- package/browser/duty/cron-schedule.mjs +62 -0
- package/browser/duty/describe-thrown.mjs +12 -0
- package/browser/duty/duty.lifecycle.mjs +102 -97
- package/browser/duty/duty.runner.mjs +117 -115
- package/browser/duty/lazy-lease-store.mjs +60 -0
- package/browser/duty/lease-holder.mjs +132 -0
- package/browser/duty/lease-store.mjs +125 -0
- package/browser/elicitation/questions/question-subject.mjs +8 -2
- package/browser/errors/duty.errors.mjs +20 -0
- package/browser/errors/event.errors.mjs +128 -0
- package/browser/errors/index.mjs +36 -1
- package/browser/errors/worker.errors.mjs +14 -0
- package/browser/event/delivery/event-metrics.mjs +37 -0
- package/browser/event/delivery/event-outbox.mjs +251 -0
- package/browser/event/event-channel.mjs +30 -0
- package/browser/event/event-dialect.mjs +23 -0
- package/browser/event/event-gates.mjs +72 -0
- package/browser/event/event-outbound.mjs +8 -0
- package/browser/event/event-publisher.mjs +55 -0
- package/browser/event/event-reauthorization.mjs +48 -0
- package/browser/event/event-scope.helper.mjs +266 -0
- package/browser/event/event-subscriber.mjs +31 -0
- package/browser/event/event.instance.mjs +44 -0
- package/browser/event/event.registry.mjs +145 -0
- package/browser/event/event.utils.mjs +31 -0
- package/browser/event/flows/event-deliver.flow.mjs +175 -0
- package/browser/event/flows/event-poll.flow.mjs +308 -0
- package/browser/event/flows/event-publish-http.flow.mjs +288 -0
- package/browser/event/flows/event-publish.flow.mjs +371 -0
- package/browser/event/flows/event-stream.flow.mjs +222 -0
- package/browser/event/flows/event-subscribe.flow.mjs +351 -0
- package/browser/event/flows/event-unsubscribe.flow.mjs +120 -0
- package/browser/event/flows/list-events.flow.mjs +145 -0
- package/browser/event/index.mjs +104 -0
- package/browser/event/poll/event-buffer.mjs +77 -0
- package/browser/event/poll/event-poll-leases.mjs +118 -0
- package/browser/event/publish-endpoint/event-publish-endpoint.mjs +75 -0
- package/browser/event/publish-endpoint/event-publish-idempotency.mjs +54 -0
- package/browser/event/replay/event-replays.mjs +298 -0
- package/browser/event/stream/event-stream.mjs +279 -0
- package/browser/event/stream/event-streams.mjs +122 -0
- package/browser/event/subscription/event-callback-verifier.mjs +165 -0
- package/browser/event/subscription/event-subscription-store.factory.mjs +59 -0
- package/browser/event/subscription/event-subscription-termination.mjs +34 -0
- package/browser/event/subscription/event-subscription.store.mjs +167 -0
- package/browser/event/subscription/event-subscriptions.mjs +126 -0
- package/browser/event-client/event-client.errors.mjs +50 -0
- package/browser/event-client/event-webhook-receiver.mjs +155 -0
- package/browser/event-client/events-client.mjs +471 -0
- package/browser/event-client/index.mjs +28 -0
- package/browser/front-mcp/authorities-rules.check.mjs +15 -1
- package/browser/front-mcp/front-mcp.mjs +4 -6
- package/browser/index.cjs +23640 -16042
- package/browser/index.mjs +37 -2
- package/browser/job/execution/job-execution.manager.mjs +39 -5
- package/browser/job/job-scope.helper.mjs +21 -0
- package/browser/job/store/memory-job-state.store.mjs +5 -0
- package/browser/job/store/redis-job-state.store.mjs +11 -0
- package/browser/job/store/storage-job-state.store.mjs +18 -2
- package/browser/notification/notification.service.mjs +36 -6
- package/browser/provider/create-container.mjs +20 -9
- package/browser/provider/provider.lifecycle.mjs +4 -0
- package/browser/provider/provider.registry.mjs +55 -11
- package/browser/scope/event-publisher.providers.mjs +32 -0
- package/browser/scope/scope.instance.mjs +34 -21
- package/browser/skill/skill-instructions.helper.mjs +12 -6
- package/browser/subsystems.mjs +3 -0
- package/browser/tool/flows/tools-list.flow.mjs +3 -33
- package/browser/transport/adapters/transport.local.adapter.mjs +9 -2
- package/browser/transport/build-scoped-server-options.mjs +5 -1
- package/browser/transport/flows/handle.mcp-20260728.flow.mjs +76 -3
- package/browser/transport/in-memory-server.mjs +3 -0
- package/browser/transport/mcp-20260728/discover.mjs +1 -0
- package/browser/transport/mcp-20260728/event-stream-response.mjs +44 -0
- package/browser/transport/mcp-20260728/index.mjs +2 -1
- package/browser/transport/mcp-20260728/protocol-20260728.constants.mjs +8 -1
- package/browser/transport/mcp-20260728/request-validation.mjs +9 -5
- package/browser/transport/mcp-handlers/events-list-request.handler.mjs +23 -0
- package/browser/transport/mcp-handlers/events-poll-request.handler.mjs +23 -0
- package/browser/transport/mcp-handlers/events-stream-request.handler.mjs +44 -0
- package/browser/transport/mcp-handlers/events-subscribe-request.handler.mjs +23 -0
- package/browser/transport/mcp-handlers/events-unsubscribe-request.handler.mjs +25 -0
- package/browser/transport/mcp-handlers/index.mjs +13 -0
- package/browser/transport/mcp-handlers/initialize-request.handler.mjs +3 -1
- package/browser/transport/stdio-revision-router.mjs +29 -2
- package/browser/worker/worker.lifecycle.mjs +199 -0
- package/browser/worker/worker.supervisor.mjs +111 -0
- package/browser/workflow/tools/register-workflow.tool.mjs +3 -3
- package/browser/workflow/trigger/workflow-events.mjs +3 -1
- package/browser/workflow/trigger/workflow-schedules.mjs +173 -0
- package/browser/workflow/trigger/workflow-triggers.mjs +31 -0
- package/channel/channel-notification.service.d.ts +5 -2
- package/channel/channel-notification.service.d.ts.map +1 -1
- package/channel/channel-scope.helper.d.ts +4 -1
- package/channel/channel-scope.helper.d.ts.map +1 -1
- package/channel/channel.instance.d.ts +7 -1
- package/channel/channel.instance.d.ts.map +1 -1
- package/channel/channel.utils.d.ts +20 -0
- package/channel/channel.utils.d.ts.map +1 -1
- package/channel/sources/app-event.source.d.ts +11 -2
- package/channel/sources/app-event.source.d.ts.map +1 -1
- package/channel/sources/file-watcher.source.d.ts +21 -0
- package/channel/sources/file-watcher.source.d.ts.map +1 -0
- package/channel/sources/index.d.ts +1 -0
- package/channel/sources/index.d.ts.map +1 -1
- package/common/decorators/duty.decorator.d.ts +3 -2
- package/common/decorators/duty.decorator.d.ts.map +1 -1
- package/common/decorators/event.decorator.d.ts +38 -0
- package/common/decorators/event.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/worker.decorator.d.ts +13 -0
- package/common/decorators/worker.decorator.d.ts.map +1 -0
- package/common/entries/event.entry.d.ts +34 -0
- package/common/entries/event.entry.d.ts.map +1 -0
- package/common/entries/index.d.ts +1 -0
- package/common/entries/index.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/event.interface.d.ts +124 -0
- package/common/interfaces/event.interface.d.ts.map +1 -0
- package/common/interfaces/execution-context.interface.d.ts +3 -0
- package/common/interfaces/execution-context.interface.d.ts.map +1 -1
- package/common/interfaces/index.d.ts +2 -0
- package/common/interfaces/index.d.ts.map +1 -1
- package/common/interfaces/internal/registry.interface.d.ts +3 -1
- package/common/interfaces/internal/registry.interface.d.ts.map +1 -1
- package/common/interfaces/worker.interface.d.ts +13 -0
- package/common/interfaces/worker.interface.d.ts.map +1 -0
- package/common/metadata/agent.metadata.d.ts +1 -1
- package/common/metadata/app.metadata.d.ts +4 -1
- package/common/metadata/app.metadata.d.ts.map +1 -1
- package/common/metadata/channel.metadata.d.ts +40 -8
- package/common/metadata/channel.metadata.d.ts.map +1 -1
- package/common/metadata/duty.metadata.d.ts +67 -13
- package/common/metadata/duty.metadata.d.ts.map +1 -1
- package/common/metadata/duty.resolved.d.ts +4 -0
- package/common/metadata/duty.resolved.d.ts.map +1 -0
- package/common/metadata/event.metadata.d.ts +451 -0
- package/common/metadata/event.metadata.d.ts.map +1 -0
- package/common/metadata/front-mcp.metadata.d.ts +1652 -16
- package/common/metadata/front-mcp.metadata.d.ts.map +1 -1
- package/common/metadata/index.d.ts +4 -0
- package/common/metadata/index.d.ts.map +1 -1
- package/common/metadata/job.metadata.d.ts +1 -1
- package/common/metadata/prompt.metadata.d.ts +1 -1
- package/common/metadata/resource.metadata.d.ts +2 -2
- package/common/metadata/skill.metadata.d.ts +1 -1
- package/common/metadata/tool.metadata.d.ts +1 -1
- package/common/metadata/worker.metadata.d.ts +69 -0
- package/common/metadata/worker.metadata.d.ts.map +1 -0
- package/common/metadata/worker.resolved.d.ts +4 -0
- package/common/metadata/worker.resolved.d.ts.map +1 -0
- package/common/metadata/workflow.metadata.d.ts +31 -3
- package/common/metadata/workflow.metadata.d.ts.map +1 -1
- package/common/records/event.record.d.ts +21 -0
- package/common/records/event.record.d.ts.map +1 -0
- package/common/records/index.d.ts +1 -0
- package/common/records/index.d.ts.map +1 -1
- package/common/schemas/annotated-class.schema.d.ts +1 -0
- package/common/schemas/annotated-class.schema.d.ts.map +1 -1
- package/common/tokens/app.tokens.d.ts.map +1 -1
- package/common/tokens/event.tokens.d.ts +9 -0
- package/common/tokens/event.tokens.d.ts.map +1 -0
- package/common/tokens/front-mcp.tokens.d.ts.map +1 -1
- package/common/tokens/index.d.ts +1 -0
- package/common/tokens/index.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/utils/offset-cursor.utils.d.ts +5 -0
- package/common/utils/offset-cursor.utils.d.ts.map +1 -0
- package/common/utils/principal.utils.d.ts +11 -9
- package/common/utils/principal.utils.d.ts.map +1 -1
- package/common/utils/time-zone.utils.d.ts +3 -0
- package/common/utils/time-zone.utils.d.ts.map +1 -0
- package/direct/client.types.d.ts +8 -0
- package/direct/client.types.d.ts.map +1 -1
- package/direct/create.d.ts.map +1 -1
- package/direct/create.types.d.ts +3 -1
- package/direct/create.types.d.ts.map +1 -1
- package/direct/direct-events-transport.d.ts +20 -0
- package/direct/direct-events-transport.d.ts.map +1 -0
- package/direct/direct-server.d.ts +3 -0
- package/direct/direct-server.d.ts.map +1 -1
- package/direct/direct.types.d.ts +6 -0
- package/direct/direct.types.d.ts.map +1 -1
- package/duty/cron-schedule.d.ts +51 -0
- package/duty/cron-schedule.d.ts.map +1 -0
- package/duty/describe-thrown.d.ts +3 -0
- package/duty/describe-thrown.d.ts.map +1 -0
- package/duty/duty.lifecycle.d.ts +33 -4
- package/duty/duty.lifecycle.d.ts.map +1 -1
- package/duty/duty.runner.d.ts +49 -31
- package/duty/duty.runner.d.ts.map +1 -1
- package/duty/lazy-lease-store.d.ts +29 -0
- package/duty/lazy-lease-store.d.ts.map +1 -0
- package/duty/lease-holder.d.ts +73 -0
- package/duty/lease-holder.d.ts.map +1 -0
- package/duty/lease-store.d.ts +40 -0
- package/duty/lease-store.d.ts.map +1 -0
- package/elicitation/hooks/elicitation.hooks.d.ts +5 -5
- package/elicitation/questions/question-subject.d.ts +8 -3
- package/elicitation/questions/question-subject.d.ts.map +1 -1
- package/errors/duty.errors.d.ts +10 -0
- package/errors/duty.errors.d.ts.map +1 -1
- package/errors/event.errors.d.ts +73 -0
- package/errors/event.errors.d.ts.map +1 -0
- package/errors/index.d.ts +4 -1
- package/errors/index.d.ts.map +1 -1
- package/errors/worker.errors.d.ts +7 -0
- package/errors/worker.errors.d.ts.map +1 -0
- package/esm/index.mjs +38 -34
- package/event/delivery/event-metrics.d.ts +25 -0
- package/event/delivery/event-metrics.d.ts.map +1 -0
- package/event/delivery/event-outbox.d.ts +129 -0
- package/event/delivery/event-outbox.d.ts.map +1 -0
- package/event/event-channel.d.ts +21 -0
- package/event/event-channel.d.ts.map +1 -0
- package/event/event-dialect.d.ts +20 -0
- package/event/event-dialect.d.ts.map +1 -0
- package/event/event-gates.d.ts +23 -0
- package/event/event-gates.d.ts.map +1 -0
- package/event/event-outbound.d.ts +9 -0
- package/event/event-outbound.d.ts.map +1 -0
- package/event/event-publisher.d.ts +14 -0
- package/event/event-publisher.d.ts.map +1 -0
- package/event/event-reauthorization.d.ts +35 -0
- package/event/event-reauthorization.d.ts.map +1 -0
- package/event/event-scope.helper.d.ts +23 -0
- package/event/event-scope.helper.d.ts.map +1 -0
- package/event/event-subscriber.d.ts +12 -0
- package/event/event-subscriber.d.ts.map +1 -0
- package/event/event.instance.d.ts +15 -0
- package/event/event.instance.d.ts.map +1 -0
- package/event/event.registry.d.ts +97 -0
- package/event/event.registry.d.ts.map +1 -0
- package/event/event.utils.d.ts +6 -0
- package/event/event.utils.d.ts.map +1 -0
- package/event/flows/event-deliver.flow.d.ts +73 -0
- package/event/flows/event-deliver.flow.d.ts.map +1 -0
- package/event/flows/event-poll.flow.d.ts +105 -0
- package/event/flows/event-poll.flow.d.ts.map +1 -0
- package/event/flows/event-publish-http.flow.d.ts +114 -0
- package/event/flows/event-publish-http.flow.d.ts.map +1 -0
- package/event/flows/event-publish.flow.d.ts +109 -0
- package/event/flows/event-publish.flow.d.ts.map +1 -0
- package/event/flows/event-stream.flow.d.ts +78 -0
- package/event/flows/event-stream.flow.d.ts.map +1 -0
- package/event/flows/event-subscribe.flow.d.ts +132 -0
- package/event/flows/event-subscribe.flow.d.ts.map +1 -0
- package/event/flows/event-unsubscribe.flow.d.ts +71 -0
- package/event/flows/event-unsubscribe.flow.d.ts.map +1 -0
- package/event/flows/list-events.flow.d.ts +75 -0
- package/event/flows/list-events.flow.d.ts.map +1 -0
- package/event/index.d.ts +46 -0
- package/event/index.d.ts.map +1 -0
- package/event/poll/event-buffer.d.ts +54 -0
- package/event/poll/event-buffer.d.ts.map +1 -0
- package/event/poll/event-poll-leases.d.ts +63 -0
- package/event/poll/event-poll-leases.d.ts.map +1 -0
- package/event/publish-endpoint/event-publish-endpoint.d.ts +29 -0
- package/event/publish-endpoint/event-publish-endpoint.d.ts.map +1 -0
- package/event/publish-endpoint/event-publish-idempotency.d.ts +35 -0
- package/event/publish-endpoint/event-publish-idempotency.d.ts.map +1 -0
- package/event/replay/event-replays.d.ts +116 -0
- package/event/replay/event-replays.d.ts.map +1 -0
- package/event/stream/event-stream.d.ts +116 -0
- package/event/stream/event-stream.d.ts.map +1 -0
- package/event/stream/event-streams.d.ts +52 -0
- package/event/stream/event-streams.d.ts.map +1 -0
- package/event/subscription/event-callback-verifier.d.ts +58 -0
- package/event/subscription/event-callback-verifier.d.ts.map +1 -0
- package/event/subscription/event-subscription-store.factory.d.ts +31 -0
- package/event/subscription/event-subscription-store.factory.d.ts.map +1 -0
- package/event/subscription/event-subscription-termination.d.ts +25 -0
- package/event/subscription/event-subscription-termination.d.ts.map +1 -0
- package/event/subscription/event-subscription.store.d.ts +131 -0
- package/event/subscription/event-subscription.store.d.ts.map +1 -0
- package/event/subscription/event-subscriptions.d.ts +66 -0
- package/event/subscription/event-subscriptions.d.ts.map +1 -0
- package/event-client/event-client.errors.d.ts +35 -0
- package/event-client/event-client.errors.d.ts.map +1 -0
- package/event-client/event-webhook-receiver.d.ts +75 -0
- package/event-client/event-webhook-receiver.d.ts.map +1 -0
- package/event-client/events-client.d.ts +33 -0
- package/event-client/events-client.d.ts.map +1 -0
- package/event-client/events-client.types.d.ts +74 -0
- package/event-client/events-client.types.d.ts.map +1 -0
- package/event-client/index.d.ts +6 -0
- package/event-client/index.d.ts.map +1 -0
- package/front-mcp/authorities-rules.check.d.ts +5 -0
- package/front-mcp/authorities-rules.check.d.ts.map +1 -1
- package/front-mcp/front-mcp.d.ts.map +1 -1
- package/index.d.ts +70 -0
- package/index.d.ts.map +1 -1
- package/index.js +46 -42
- package/job/execution/job-execution.manager.d.ts +7 -0
- package/job/execution/job-execution.manager.d.ts.map +1 -1
- package/job/job-scope.helper.d.ts.map +1 -1
- package/job/store/job-state.interface.d.ts +2 -0
- package/job/store/job-state.interface.d.ts.map +1 -1
- package/job/store/memory-job-state.store.d.ts +1 -0
- package/job/store/memory-job-state.store.d.ts.map +1 -1
- package/job/store/redis-job-state.store.d.ts +3 -0
- package/job/store/redis-job-state.store.d.ts.map +1 -1
- package/job/store/storage-job-state.store.d.ts +1 -0
- package/job/store/storage-job-state.store.d.ts.map +1 -1
- package/notification/index.d.ts +1 -1
- package/notification/index.d.ts.map +1 -1
- package/notification/notification.service.d.ts +31 -2
- package/notification/notification.service.d.ts.map +1 -1
- package/package.json +11 -10
- package/provider/create-container.d.ts +14 -4
- package/provider/create-container.d.ts.map +1 -1
- package/provider/provider.lifecycle.d.ts +11 -1
- package/provider/provider.lifecycle.d.ts.map +1 -1
- package/provider/provider.registry.d.ts +18 -4
- package/provider/provider.registry.d.ts.map +1 -1
- package/scope/event-publisher.providers.d.ts +17 -0
- package/scope/event-publisher.providers.d.ts.map +1 -0
- package/scope/scope.instance.d.ts +6 -1
- package/scope/scope.instance.d.ts.map +1 -1
- package/shared/shared-attach.d.ts +3 -1
- package/shared/shared-attach.d.ts.map +1 -1
- package/shared/shared-server.lifecycle.d.ts +14 -5
- package/shared/shared-server.lifecycle.d.ts.map +1 -1
- package/skill/skill-instructions.helper.d.ts +10 -4
- package/skill/skill-instructions.helper.d.ts.map +1 -1
- package/subsystems.d.ts +1 -0
- package/subsystems.d.ts.map +1 -1
- package/tool/flows/tools-list.flow.d.ts +0 -11
- package/tool/flows/tools-list.flow.d.ts.map +1 -1
- package/transport/adapters/transport.local.adapter.d.ts.map +1 -1
- package/transport/build-scoped-server-options.d.ts.map +1 -1
- package/transport/flows/handle.mcp-20260728.flow.d.ts +8 -2
- package/transport/flows/handle.mcp-20260728.flow.d.ts.map +1 -1
- package/transport/in-memory-server.d.ts.map +1 -1
- package/transport/mcp-20260728/discover.d.ts.map +1 -1
- package/transport/mcp-20260728/event-stream-response.d.ts +12 -0
- package/transport/mcp-20260728/event-stream-response.d.ts.map +1 -0
- package/transport/mcp-20260728/index.d.ts +1 -0
- package/transport/mcp-20260728/index.d.ts.map +1 -1
- package/transport/mcp-20260728/protocol-20260728.constants.d.ts.map +1 -1
- package/transport/mcp-20260728/request-validation.d.ts +2 -0
- package/transport/mcp-20260728/request-validation.d.ts.map +1 -1
- package/transport/mcp-handlers/events-list-request.handler.d.ts +5 -0
- package/transport/mcp-handlers/events-list-request.handler.d.ts.map +1 -0
- package/transport/mcp-handlers/events-poll-request.handler.d.ts +5 -0
- package/transport/mcp-handlers/events-poll-request.handler.d.ts.map +1 -0
- package/transport/mcp-handlers/events-stream-request.handler.d.ts +8 -0
- package/transport/mcp-handlers/events-stream-request.handler.d.ts.map +1 -0
- package/transport/mcp-handlers/events-subscribe-request.handler.d.ts +5 -0
- package/transport/mcp-handlers/events-subscribe-request.handler.d.ts.map +1 -0
- package/transport/mcp-handlers/events-unsubscribe-request.handler.d.ts +5 -0
- package/transport/mcp-handlers/events-unsubscribe-request.handler.d.ts.map +1 -0
- package/transport/mcp-handlers/index.d.ts +162 -3
- package/transport/mcp-handlers/index.d.ts.map +1 -1
- package/transport/mcp-handlers/initialize-request.handler.d.ts.map +1 -1
- package/transport/stdio-revision-router.d.ts +2 -0
- package/transport/stdio-revision-router.d.ts.map +1 -1
- package/worker/worker.lifecycle.d.ts +63 -0
- package/worker/worker.lifecycle.d.ts.map +1 -0
- package/worker/worker.supervisor.d.ts +62 -0
- package/worker/worker.supervisor.d.ts.map +1 -0
- package/workflow/tools/register-workflow.tool.d.ts +2 -1
- package/workflow/tools/register-workflow.tool.d.ts.map +1 -1
- package/workflow/trigger/workflow-events.d.ts.map +1 -1
- package/workflow/trigger/workflow-schedules.d.ts +76 -0
- package/workflow/trigger/workflow-schedules.d.ts.map +1 -0
- package/workflow/trigger/workflow-triggers.d.ts +16 -1
- package/workflow/trigger/workflow-triggers.d.ts.map +1 -1
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// libs/sdk/src/scope/event-publisher.providers.ts
|
|
2
|
+
import {
|
|
3
|
+
EventPublisher,
|
|
4
|
+
ProviderScope
|
|
5
|
+
} from "../common/index.mjs";
|
|
6
|
+
import { EVENT_PUBLISHER } from "../common/tokens/event.tokens.mjs";
|
|
7
|
+
import { EventsNotEnabledError } from "../errors/index.mjs";
|
|
8
|
+
var DeferredEventPublisher = class extends EventPublisher {
|
|
9
|
+
/** Takes the scope whose event registry it reads at each publish. */
|
|
10
|
+
constructor(scope) {
|
|
11
|
+
super();
|
|
12
|
+
this.scope = scope;
|
|
13
|
+
}
|
|
14
|
+
scope;
|
|
15
|
+
/** Publish through the scope's publisher; on a server without events, refuse as `this.events` does. */
|
|
16
|
+
publish(event, data, options) {
|
|
17
|
+
const publisher = this.scope.events?.publisher;
|
|
18
|
+
if (!publisher) return Promise.reject(new EventsNotEnabledError());
|
|
19
|
+
return publisher.publish(event, data, options);
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
function eventPublisherProviders(scope) {
|
|
23
|
+
const publisher = new DeferredEventPublisher(scope);
|
|
24
|
+
return [
|
|
25
|
+
{ scope: ProviderScope.GLOBAL, name: "EventPublisher", provide: EventPublisher, useValue: publisher },
|
|
26
|
+
{ scope: ProviderScope.GLOBAL, name: "EVENT_PUBLISHER", provide: EVENT_PUBLISHER, useValue: publisher }
|
|
27
|
+
];
|
|
28
|
+
}
|
|
29
|
+
export {
|
|
30
|
+
DeferredEventPublisher,
|
|
31
|
+
eventPublisherProviders
|
|
32
|
+
};
|
|
@@ -30,15 +30,11 @@ import { resolveEntryPath } from "../common/utils/path.utils.mjs";
|
|
|
30
30
|
import CompleteFlow from "../completion/flows/complete.flow.mjs";
|
|
31
31
|
import { FrontMcpContextProvider, FrontMcpContextStorage } from "../context/index.mjs";
|
|
32
32
|
import { proxyTrustOf } from "../context/metadata.utils.mjs";
|
|
33
|
-
import {
|
|
34
|
-
AuthConfigurationError,
|
|
35
|
-
FlowExitedWithoutOutputError,
|
|
36
|
-
InternalMcpError,
|
|
37
|
-
InvalidToolUiConfigError
|
|
38
|
-
} from "../errors/index.mjs";
|
|
33
|
+
import { FlowExitedWithoutOutputError, InternalMcpError, InvalidToolUiConfigError } from "../errors/index.mjs";
|
|
39
34
|
import { PluginConfiguredTwiceError, UnenforcedMetadataError } from "../errors/plugin.errors.mjs";
|
|
35
|
+
import { normalizeEvent } from "../event/event.utils.mjs";
|
|
40
36
|
import FlowRegistry from "../flows/flow.registry.mjs";
|
|
41
|
-
import {
|
|
37
|
+
import { assertEntryAuthorities } from "../front-mcp/authorities-rules.check.mjs";
|
|
42
38
|
import { isEntryServer, isJobWorker } from "../front-mcp/detached-job.flag.mjs";
|
|
43
39
|
import { isDirectOnly } from "../front-mcp/direct-only.flag.mjs";
|
|
44
40
|
import { checkHookOrder, hookRunsOf } from "../hooks/hook-order.mjs";
|
|
@@ -74,6 +70,7 @@ import { warnIfRequestStateKeyNotShared } from "../transport/mcp-20260728/reques
|
|
|
74
70
|
import { warnIfSessionModeIgnored } from "../transport/session-mode.check.mjs";
|
|
75
71
|
import { guardStorageInBrowser, refuseServerStoresInBrowser, refuseStoresInBrowser } from "./browser-stores.mjs";
|
|
76
72
|
import { devEventsObservabilityConfig, listsObservabilityPlugin } from "./dev-events-observability.mjs";
|
|
73
|
+
import { eventPublisherProviders } from "./event-publisher.providers.mjs";
|
|
77
74
|
import { registerServerEntries } from "./server-entries.helper.mjs";
|
|
78
75
|
import { reportStartup } from "./startup-report.helper.mjs";
|
|
79
76
|
var SCOPE_NON_DISPATCHABLE_FLOWS = /* @__PURE__ */ new Set(["http:request"]);
|
|
@@ -176,6 +173,8 @@ var Scope = class _Scope extends ScopeEntry {
|
|
|
176
173
|
_channelEventBus;
|
|
177
174
|
_workflowEvents;
|
|
178
175
|
_channelTeardown;
|
|
176
|
+
/** Event system (optional) */
|
|
177
|
+
_scopeEvents;
|
|
179
178
|
/** Health service for liveness and readiness probes (optional) */
|
|
180
179
|
_healthService;
|
|
181
180
|
/** CLI mode flag \u2014 skips non-essential initialization for faster startup */
|
|
@@ -765,6 +764,20 @@ var Scope = class _Scope extends ScopeEntry {
|
|
|
765
764
|
this.onDispose(() => this.teardownChannels());
|
|
766
765
|
if (!isJobWorker(this.metadata)) await channelResult.connectServices();
|
|
767
766
|
}
|
|
767
|
+
const { items: appEvents, providers: eventProviders } = this.appEntryProviders("events", normalizeEvent);
|
|
768
|
+
if (appEvents.length > 0 || this.metadata.events?.enabled === true) {
|
|
769
|
+
const { registerEventCapabilities } = await import("../event/event-scope.helper.mjs");
|
|
770
|
+
const eventsResult = await registerEventCapabilities({
|
|
771
|
+
providers: this.scopeProviders,
|
|
772
|
+
owner: scopeRef,
|
|
773
|
+
eventsList: appEvents,
|
|
774
|
+
eventProviders,
|
|
775
|
+
eventsConfig: this.metadata.events,
|
|
776
|
+
channelsEnabled: channelsConfig?.enabled,
|
|
777
|
+
logger: this.logger
|
|
778
|
+
});
|
|
779
|
+
this._scopeEvents = eventsResult?.eventRegistry;
|
|
780
|
+
}
|
|
768
781
|
await this.registerWidgetRoutes(httpServing);
|
|
769
782
|
if (httpServing && this.metadata.health?.enabled !== false) {
|
|
770
783
|
this._healthService = new httpServing.HealthService(this.metadata.health ?? {}, this.metadata.info);
|
|
@@ -1082,6 +1095,7 @@ var Scope = class _Scope extends ScopeEntry {
|
|
|
1082
1095
|
if (this._scopeJobs) add(this._scopeJobs.getJobs().length, "job");
|
|
1083
1096
|
if (this._scopeWorkflows) add(this._scopeWorkflows.getWorkflows().length, "workflow");
|
|
1084
1097
|
if (this._scopeChannels) add(this._scopeChannels.size, "channel");
|
|
1098
|
+
if (this._scopeEvents) add(this._scopeEvents.getEvents().length, "event");
|
|
1085
1099
|
return entries.length > 0 ? entries.join(", ") : "empty";
|
|
1086
1100
|
}
|
|
1087
1101
|
get defaultScopeProviders() {
|
|
@@ -1122,7 +1136,9 @@ var Scope = class _Scope extends ScopeEntry {
|
|
|
1122
1136
|
name: "OffloadService",
|
|
1123
1137
|
provide: OffloadService,
|
|
1124
1138
|
useValue: new OffloadService(this.metadata.offload, this.logger)
|
|
1125
|
-
}
|
|
1139
|
+
},
|
|
1140
|
+
// Providers, duties and workers are built before events are registered: they take this publisher
|
|
1141
|
+
...eventPublisherProviders(this)
|
|
1126
1142
|
];
|
|
1127
1143
|
}
|
|
1128
1144
|
get auth() {
|
|
@@ -1173,6 +1189,10 @@ var Scope = class _Scope extends ScopeEntry {
|
|
|
1173
1189
|
get channelNotifications() {
|
|
1174
1190
|
return this._channelNotificationService;
|
|
1175
1191
|
}
|
|
1192
|
+
/** The scope's event registry; undefined while events are off. */
|
|
1193
|
+
get events() {
|
|
1194
|
+
return this._scopeEvents;
|
|
1195
|
+
}
|
|
1176
1196
|
get channelEventBus() {
|
|
1177
1197
|
return this._channelEventBus ?? this._workflowEvents?.bus;
|
|
1178
1198
|
}
|
|
@@ -1522,7 +1542,7 @@ var Scope = class _Scope extends ScopeEntry {
|
|
|
1522
1542
|
}
|
|
1523
1543
|
}
|
|
1524
1544
|
/**
|
|
1525
|
-
* The entries the apps declare under `key` (`jobs`, `channels`), and the provider registry of the
|
|
1545
|
+
* The entries the apps declare under `key` (`jobs`, `channels`, `events`), and the provider registry of the
|
|
1526
1546
|
* app that declares each one, by its token. They are served by one scope-level registry, and each
|
|
1527
1547
|
* runs with its app's providers, as the app's tools do.
|
|
1528
1548
|
*/
|
|
@@ -1621,18 +1641,11 @@ var Scope = class _Scope extends ScopeEntry {
|
|
|
1621
1641
|
* @internal
|
|
1622
1642
|
*/
|
|
1623
1643
|
validateAuthoritiesConfig() {
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
const suffix = entries.length > 5 ? ` and ${entries.length - 5} more` : "";
|
|
1630
|
-
throw new AuthConfigurationError(
|
|
1631
|
-
`Authorities configuration required: ${names}${suffix} declare 'authorities' metadata but authorities enforcement is not fully configured (engine/context builder missing). Add 'authorities: { claimsMapping: {...}, profiles: {...} }' to your @FrontMcp() decorator to enable enforcement, or remove 'authorities' from entry metadata.`,
|
|
1632
|
-
{ suggestion: "Add authorities config to @FrontMcp() or remove authorities from entry metadata" }
|
|
1633
|
-
);
|
|
1634
|
-
}
|
|
1635
|
-
assertAuthoritiesRules(engine, entries);
|
|
1644
|
+
assertEntryAuthorities(
|
|
1645
|
+
this._authoritiesEngine,
|
|
1646
|
+
this._authoritiesContextBuilder,
|
|
1647
|
+
this.collectEntriesWithAuthorities()
|
|
1648
|
+
);
|
|
1636
1649
|
}
|
|
1637
1650
|
async checkLateApp(app) {
|
|
1638
1651
|
const { tools, resources, prompts, agents, skills } = app;
|
|
@@ -107,11 +107,17 @@ function composeInitializeInstructions(options) {
|
|
|
107
107
|
}
|
|
108
108
|
return joinSections([user, channel, catalog]);
|
|
109
109
|
}
|
|
110
|
-
function buildChannelInstructions(channels) {
|
|
111
|
-
|
|
112
|
-
const
|
|
113
|
-
|
|
114
|
-
|
|
110
|
+
function buildChannelInstructions(channels, events) {
|
|
111
|
+
const hasChannels = channels?.hasAny() === true;
|
|
112
|
+
const tellsEvents = (events?.getChannelEvents().length ?? 0) > 0;
|
|
113
|
+
if (!hasChannels && !tellsEvents) return "";
|
|
114
|
+
const sentences = ["Events arrive as <channel> tags."];
|
|
115
|
+
if (channels?.getChannelInstances().some((ch) => ch.twoWay)) sentences.push(CHANNEL_REPLY_HINT);
|
|
116
|
+
if (tellsEvents) sentences.push(CHANNEL_EVENT_HINT);
|
|
117
|
+
return sentences.join(" ");
|
|
118
|
+
}
|
|
119
|
+
var CHANNEL_REPLY_HINT = "Reply with the channel-reply tool.";
|
|
120
|
+
var CHANNEL_EVENT_HINT = "A tag with event and event_id attributes is an event this server published: event is its name, event_id its id.";
|
|
115
121
|
function instructionsPolicyFor(scope, clientName) {
|
|
116
122
|
const profiled = resolveClientProfile(scope.metadata.clients, clientName)?.instructions;
|
|
117
123
|
if (profiled === "full") return "append";
|
|
@@ -122,7 +128,7 @@ async function composeCallerInstructions(scope, options = {}) {
|
|
|
122
128
|
const { source, notLoadedReason } = await readySkillCatalog(scope);
|
|
123
129
|
const composeOptions = {
|
|
124
130
|
userInstructions: scope.metadata.instructions,
|
|
125
|
-
channelInstructions: buildChannelInstructions(scope.channels),
|
|
131
|
+
channelInstructions: buildChannelInstructions(scope.channels, scope.events),
|
|
126
132
|
skillRegistry: scope.skills,
|
|
127
133
|
policy: instructionsPolicyFor(scope, options.clientName),
|
|
128
134
|
mcpResources: skillsConfig?.mcpResources,
|
package/browser/subsystems.mjs
CHANGED
|
@@ -43,6 +43,7 @@ import {
|
|
|
43
43
|
ChannelEventBus,
|
|
44
44
|
ChannelReplyTool
|
|
45
45
|
} from "./channel/index.mjs";
|
|
46
|
+
import { EventInstance, EventRegistry } from "./event/index.mjs";
|
|
46
47
|
export {
|
|
47
48
|
CancelJobTool,
|
|
48
49
|
ChannelEmitter,
|
|
@@ -51,6 +52,8 @@ export {
|
|
|
51
52
|
ChannelNotificationService,
|
|
52
53
|
ChannelRegistry,
|
|
53
54
|
ChannelReplyTool,
|
|
55
|
+
EventInstance,
|
|
56
|
+
EventRegistry,
|
|
54
57
|
ExecuteJobTool,
|
|
55
58
|
ExecuteWorkflowTool,
|
|
56
59
|
GetJobStatusTool,
|
|
@@ -26,11 +26,11 @@ import "reflect-metadata";
|
|
|
26
26
|
import { internalZ as z } from "@frontmcp/lazy-zod";
|
|
27
27
|
import { ListToolsRequestSchema, ListToolsResultSchema } from "@frontmcp/protocol";
|
|
28
28
|
import { isUIType } from "@frontmcp/uipack/types";
|
|
29
|
-
import { base64Decode, base64Encode } from "@frontmcp/utils";
|
|
30
29
|
import { callerClientProfile } from "../../answer/index.mjs";
|
|
31
30
|
import { isPubliclyListed, publicAccessFor } from "../../auth/public-access.utils.mjs";
|
|
32
31
|
import { callSurfaceOf, isOfferedOnSurface } from "../../common/availability/index.mjs";
|
|
33
32
|
import { DEFAULT_TOOL_PAGINATION } from "../../common/types/options/pagination/index.mjs";
|
|
33
|
+
import { encodeOffsetCursor, parseOffsetCursor } from "../../common/utils/offset-cursor.utils.mjs";
|
|
34
34
|
import { InternalMcpError, InvalidInputError, InvalidMethodError } from "../../errors/index.mjs";
|
|
35
35
|
import { isSkillsOnlyRequest } from "../../skill/skill-mode.utils.mjs";
|
|
36
36
|
import { enabledItems, SURFACE_META_KEY, surfaceHash } from "../../surface/index.mjs";
|
|
@@ -94,33 +94,6 @@ var ToolsListFlow = class extends FlowBase {
|
|
|
94
94
|
const threshold = config.autoThreshold ?? DEFAULT_TOOL_PAGINATION.autoThreshold;
|
|
95
95
|
return toolCount > threshold;
|
|
96
96
|
}
|
|
97
|
-
/**
|
|
98
|
-
* Parse a cursor string to extract the offset.
|
|
99
|
-
* Cursor format: Base64-encoded JSON { offset: number }
|
|
100
|
-
*
|
|
101
|
-
* @throws InvalidInputError if cursor is malformed or contains invalid offset
|
|
102
|
-
*/
|
|
103
|
-
parseCursor(cursor) {
|
|
104
|
-
try {
|
|
105
|
-
const decoded = new TextDecoder().decode(base64Decode(cursor));
|
|
106
|
-
const parsed = JSON.parse(decoded);
|
|
107
|
-
const offset = parsed?.offset;
|
|
108
|
-
if (typeof offset !== "number" || offset < 0 || !Number.isInteger(offset)) {
|
|
109
|
-
throw new InvalidInputError(
|
|
110
|
-
`Invalid pagination cursor: offset must be a non-negative integer, got ${typeof offset === "number" ? offset : typeof offset}`
|
|
111
|
-
);
|
|
112
|
-
}
|
|
113
|
-
return offset;
|
|
114
|
-
} catch (e) {
|
|
115
|
-
if (e instanceof InvalidInputError) throw e;
|
|
116
|
-
throw new InvalidInputError(
|
|
117
|
-
`Invalid pagination cursor format. Expected base64-encoded JSON with 'offset' field.`
|
|
118
|
-
);
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
/**
|
|
122
|
-
* Encode an offset into a cursor string.
|
|
123
|
-
*/
|
|
124
97
|
/** The UI machinery the listing of a tool with a UI uses, loaded only when one is listed. */
|
|
125
98
|
async loadToolUIRenderer() {
|
|
126
99
|
await this.scope.toolUI?.load();
|
|
@@ -132,9 +105,6 @@ var ToolsListFlow = class extends FlowBase {
|
|
|
132
105
|
const sessionId = internal ? void 0 : this.state.authInfo?.sessionId;
|
|
133
106
|
return this.scope.surface?.recordToolList(sessionId, names) ?? surfaceHash(names);
|
|
134
107
|
}
|
|
135
|
-
encodeCursor(offset) {
|
|
136
|
-
return base64Encode(new TextEncoder().encode(JSON.stringify({ offset })));
|
|
137
|
-
}
|
|
138
108
|
async parseInput() {
|
|
139
109
|
this.logger.verbose("parseInput:start");
|
|
140
110
|
let method;
|
|
@@ -325,7 +295,7 @@ var ToolsListFlow = class extends FlowBase {
|
|
|
325
295
|
let nextCursor;
|
|
326
296
|
if (usePagination) {
|
|
327
297
|
const cursor = this.state.cursor;
|
|
328
|
-
const offset = cursor ?
|
|
298
|
+
const offset = cursor ? parseOffsetCursor(cursor) : 0;
|
|
329
299
|
const pageSize = paginationConfig?.pageSize ?? DEFAULT_TOOL_PAGINATION.pageSize;
|
|
330
300
|
if (offset > sortedResolved.length) {
|
|
331
301
|
throw new InvalidInputError(
|
|
@@ -335,7 +305,7 @@ var ToolsListFlow = class extends FlowBase {
|
|
|
335
305
|
resolved = sortedResolved.slice(offset, offset + pageSize);
|
|
336
306
|
const nextOffset = offset + pageSize;
|
|
337
307
|
if (nextOffset < sortedResolved.length) {
|
|
338
|
-
nextCursor =
|
|
308
|
+
nextCursor = encodeOffsetCursor(nextOffset);
|
|
339
309
|
}
|
|
340
310
|
this.logger.verbose(
|
|
341
311
|
`parseTools: pagination active - offset=${offset}, pageSize=${pageSize}, returning ${resolved.length}/${sortedResolved.length} tools` + (nextCursor ? `, nextCursor=${nextCursor}` : "")
|
|
@@ -3,8 +3,10 @@ import {
|
|
|
3
3
|
ElicitResultSchema,
|
|
4
4
|
EmptyResultSchema
|
|
5
5
|
} from "@frontmcp/protocol";
|
|
6
|
+
import { channelCapabilitiesOf } from "../../channel/channel.utils.mjs";
|
|
6
7
|
import { ServerRequestTokens } from "../../common/index.mjs";
|
|
7
8
|
import { ElicitationNotSupportedError, UnauthorizedError } from "../../errors/index.mjs";
|
|
9
|
+
import { sessionCallerOf } from "../../notification/notification.service.mjs";
|
|
8
10
|
import { composeCallerInstructions } from "../../skill/skill-instructions.helper.mjs";
|
|
9
11
|
import { computeTaskCapabilities } from "../../task/task-scope.helper.mjs";
|
|
10
12
|
import { createMcpHandlers } from "../mcp-handlers/index.mjs";
|
|
@@ -109,7 +111,7 @@ var LocalTransportAdapter = class {
|
|
|
109
111
|
const completionsCapability = hasPrompts || hasResources ? { completions: {} } : {};
|
|
110
112
|
const remoteCapabilities = hasRemoteApps ? this.buildRemoteCapabilities() : {};
|
|
111
113
|
const elicitationCapability = this.scope.metadata.elicitation?.enabled ? { elicitation: {} } : {};
|
|
112
|
-
const channelCapabilities = this.scope
|
|
114
|
+
const channelCapabilities = channelCapabilitiesOf(this.scope);
|
|
113
115
|
const skillsCapabilities = this.scope.skills?.getCapabilities() ?? {};
|
|
114
116
|
const composeInstructions = (caller, clientName) => composeCallerInstructions(this.scope, { ctx: caller, clientName, skillUriHints: true });
|
|
115
117
|
const instructions = "";
|
|
@@ -123,6 +125,8 @@ var LocalTransportAdapter = class {
|
|
|
123
125
|
// Include agent capabilities (agents as tools)
|
|
124
126
|
channelCapabilities,
|
|
125
127
|
// Channel capabilities (claude/channel extension)
|
|
128
|
+
this.scope.events?.getCapabilities() ?? {},
|
|
129
|
+
// MCP Events: top-level `events` and the SEP-3415 extension
|
|
126
130
|
skillsCapabilities,
|
|
127
131
|
// SEP-2640 extension declaration
|
|
128
132
|
completionsCapability,
|
|
@@ -221,6 +225,7 @@ var LocalTransportAdapter = class {
|
|
|
221
225
|
sessionPayload.clientVersion = init.clientVersion;
|
|
222
226
|
}
|
|
223
227
|
}
|
|
228
|
+
const verifiedScopes = Array.isArray(scopes) ? scopes : [];
|
|
224
229
|
const authInfo = {
|
|
225
230
|
token,
|
|
226
231
|
user,
|
|
@@ -234,12 +239,14 @@ var LocalTransportAdapter = class {
|
|
|
234
239
|
// nested mutation (`authInfo.claims.roles.push('admin')`) on a shared
|
|
235
240
|
// reference would rewrite the request's own verified authorization \u2014 which
|
|
236
241
|
// the job/workflow permission guard then reads.
|
|
237
|
-
scopes:
|
|
242
|
+
scopes: [...verifiedScopes],
|
|
238
243
|
...claims ? { claims: structuredClone(claims) } : {},
|
|
239
244
|
clientId: user.sub ?? "",
|
|
240
245
|
transport
|
|
241
246
|
};
|
|
242
247
|
req.auth = authInfo;
|
|
248
|
+
const verifiedCaller = sessionCallerOf({ clientId: authInfo.clientId, scopes: verifiedScopes, user, claims });
|
|
249
|
+
this.scope.notifications.setCaller(this.key.sessionId, verifiedCaller);
|
|
243
250
|
return req.auth;
|
|
244
251
|
}
|
|
245
252
|
/**
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// libs/sdk/src/transport/build-scoped-server-options.ts
|
|
2
|
+
import { channelCapabilitiesOf } from "../channel/channel.utils.mjs";
|
|
2
3
|
import { computeTaskCapabilities } from "../task/task-scope.helper.mjs";
|
|
3
4
|
function buildScopedServerOptions(scope, instructions = "") {
|
|
4
5
|
const hasRemoteApps = scope.apps?.getApps().some((app) => app.isRemote) ?? false;
|
|
@@ -15,7 +16,8 @@ function buildScopedServerOptions(scope, instructions = "") {
|
|
|
15
16
|
const resourcesCapabilities = scope.resources.getCapabilities();
|
|
16
17
|
const promptsCapabilities = scope.prompts.getCapabilities();
|
|
17
18
|
const agentsCapabilities = scope.agents.getCapabilities();
|
|
18
|
-
const channelCapabilities = scope
|
|
19
|
+
const channelCapabilities = channelCapabilitiesOf(scope);
|
|
20
|
+
const eventCapabilities = scope.events?.getCapabilities() ?? {};
|
|
19
21
|
const taskCapabilities = computeTaskCapabilities(scope);
|
|
20
22
|
const fragments = [
|
|
21
23
|
remoteCapabilities,
|
|
@@ -24,6 +26,7 @@ function buildScopedServerOptions(scope, instructions = "") {
|
|
|
24
26
|
promptsCapabilities,
|
|
25
27
|
agentsCapabilities,
|
|
26
28
|
channelCapabilities,
|
|
29
|
+
eventCapabilities,
|
|
27
30
|
skillsCapabilities,
|
|
28
31
|
completionsCapability,
|
|
29
32
|
taskCapabilities
|
|
@@ -44,6 +47,7 @@ function buildScopedServerOptions(scope, instructions = "") {
|
|
|
44
47
|
...resourcesCapabilities,
|
|
45
48
|
...promptsCapabilities,
|
|
46
49
|
...agentsCapabilities,
|
|
50
|
+
...eventCapabilities,
|
|
47
51
|
...completionsCapability,
|
|
48
52
|
...taskCapabilities,
|
|
49
53
|
logging: {}
|
|
@@ -12,7 +12,10 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
12
12
|
// libs/sdk/src/transport/flows/handle.mcp-20260728.flow.ts
|
|
13
13
|
import { isAnonymousSubject } from "@frontmcp/auth";
|
|
14
14
|
import { internalZ as z } from "@frontmcp/lazy-zod";
|
|
15
|
-
import {
|
|
15
|
+
import {
|
|
16
|
+
MCP_20260728_META,
|
|
17
|
+
StreamEventsRequestSchema
|
|
18
|
+
} from "@frontmcp/protocol";
|
|
16
19
|
import { runRequestExclusive } from "@frontmcp/utils";
|
|
17
20
|
import {
|
|
18
21
|
authInfoFromAuthorization,
|
|
@@ -32,6 +35,7 @@ import {
|
|
|
32
35
|
createSubscriptionStream,
|
|
33
36
|
declaresProtocol20260728,
|
|
34
37
|
dispatch20260728,
|
|
38
|
+
eventStreamFrames,
|
|
35
39
|
isProtocol20260728Request,
|
|
36
40
|
MCP_HEADERS,
|
|
37
41
|
readHeader,
|
|
@@ -42,7 +46,7 @@ import {
|
|
|
42
46
|
import { mcpRequestSurface } from "../mcp-handlers/mcp-surface.mjs";
|
|
43
47
|
var plan = {
|
|
44
48
|
pre: ["parseInput", "validate", "router"],
|
|
45
|
-
execute: ["handleNotification", "handleSubscriptions", "handleMessage"],
|
|
49
|
+
execute: ["handleNotification", "handleSubscriptions", "handleEventStream", "handleMessage"],
|
|
46
50
|
post: [],
|
|
47
51
|
finalize: ["cleanup"]
|
|
48
52
|
};
|
|
@@ -61,7 +65,7 @@ var requestIdSchema = z.union([z.string(), z.number()]);
|
|
|
61
65
|
var stateSchema = z.object({
|
|
62
66
|
/** Negotiated protocol version for this request. */
|
|
63
67
|
version: z.string().optional(),
|
|
64
|
-
requestType: z.enum(["notification", "subscriptions", "message"]).optional(),
|
|
68
|
+
requestType: z.enum(["notification", "subscriptions", "eventStream", "message"]).optional(),
|
|
65
69
|
isAnonymous: z.boolean().default(true),
|
|
66
70
|
/** Whether the client declared this revision itself (not served under it by default). */
|
|
67
71
|
clientDeclaredRevision: z.boolean().optional()
|
|
@@ -212,6 +216,10 @@ var HandleMcp20260728Flow = class extends FlowBase {
|
|
|
212
216
|
this.state.set("requestType", "notification");
|
|
213
217
|
return;
|
|
214
218
|
}
|
|
219
|
+
if (body["method"] === "events/stream" && this.scope.events?.performs("push")) {
|
|
220
|
+
this.state.set("requestType", "eventStream");
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
215
223
|
this.state.set("requestType", body["method"] === "subscriptions/listen" ? "subscriptions" : "message");
|
|
216
224
|
}
|
|
217
225
|
async handleNotification() {
|
|
@@ -280,6 +288,66 @@ var HandleMcp20260728Flow = class extends FlowBase {
|
|
|
280
288
|
}
|
|
281
289
|
});
|
|
282
290
|
}
|
|
291
|
+
async handleEventStream() {
|
|
292
|
+
const { request, response } = this.rawInput;
|
|
293
|
+
const body = request.body ?? {};
|
|
294
|
+
const requestId = requestIdSchema.safeParse(body["id"]);
|
|
295
|
+
if (!requestId.success) {
|
|
296
|
+
this.respond(errorResponse(400, { code: -32602, message: "events/stream requires a string or number id" }, null));
|
|
297
|
+
return;
|
|
298
|
+
}
|
|
299
|
+
const streamRequest = StreamEventsRequestSchema.safeParse({ method: "events/stream", params: body["params"] });
|
|
300
|
+
if (!streamRequest.success) {
|
|
301
|
+
const problem = streamRequest.error.issues[0]?.message ?? "not an object";
|
|
302
|
+
const error = { code: -32602, message: `Invalid events/stream params: ${problem}` };
|
|
303
|
+
this.respond(errorResponse(400, error, requestId.data));
|
|
304
|
+
return;
|
|
305
|
+
}
|
|
306
|
+
const meta = body["params"]?._meta ?? {};
|
|
307
|
+
const clientInfo = toClientInfo(meta[MCP_20260728_META.clientInfo]);
|
|
308
|
+
if (clientInfo) {
|
|
309
|
+
const clientCapabilities = meta[MCP_20260728_META.clientCapabilities] ?? {};
|
|
310
|
+
const platformDetection = this.scope.metadata.transport?.platformDetection;
|
|
311
|
+
this.tryGetContext()?.setClientInfo(
|
|
312
|
+
clientInfo,
|
|
313
|
+
resolvePlatformType(clientInfo, clientCapabilities, platformDetection)
|
|
314
|
+
);
|
|
315
|
+
}
|
|
316
|
+
const auth = request[ServerRequestTokens.auth];
|
|
317
|
+
const authInfo = auth ? { ...authInfoFromAuthorization(auth), sessionId: auth.session?.id ?? this.tryGetContext()?.sessionId } : {};
|
|
318
|
+
const controller = new AbortController();
|
|
319
|
+
const abort = () => controller.abort();
|
|
320
|
+
response?.on?.("close", abort);
|
|
321
|
+
const stdioSignal = this.stdioOrigin?.signal;
|
|
322
|
+
if (stdioSignal?.aborted) abort();
|
|
323
|
+
else stdioSignal?.addEventListener("abort", abort, { once: true });
|
|
324
|
+
let opened;
|
|
325
|
+
try {
|
|
326
|
+
opened = await this.scope.runFlowForOutput("events:stream", {
|
|
327
|
+
request: streamRequest.data,
|
|
328
|
+
ctx: { authInfo, surface: mcpRequestSurface(this.scope) },
|
|
329
|
+
requestId: requestId.data,
|
|
330
|
+
signal: controller.signal
|
|
331
|
+
});
|
|
332
|
+
} catch (failure) {
|
|
333
|
+
const mapped = toJsonRpcError(failure);
|
|
334
|
+
this.respond(errorResponse(mapped.status, mapped.error, requestId.data));
|
|
335
|
+
return;
|
|
336
|
+
}
|
|
337
|
+
this.log.info("handleEventStream: stream opened", { subscriptionId: requestId.data });
|
|
338
|
+
this.respond({
|
|
339
|
+
kind: "sse",
|
|
340
|
+
status: 200,
|
|
341
|
+
stream: eventStreamFrames(opened.stream, requestId.data),
|
|
342
|
+
contentType: "text/event-stream",
|
|
343
|
+
disposition: "inline",
|
|
344
|
+
headers: {
|
|
345
|
+
"X-Accel-Buffering": "no",
|
|
346
|
+
"Cache-Control": "no-cache, no-transform",
|
|
347
|
+
Connection: "keep-alive"
|
|
348
|
+
}
|
|
349
|
+
});
|
|
350
|
+
}
|
|
283
351
|
/**
|
|
284
352
|
* Whether the caller of this request may subscribe to `uri`: the `resources:subscribe` flow's checks (availability,
|
|
285
353
|
* `enabled`, authorities), run in this request's context whenever it is called, as `resources/read` would run them.
|
|
@@ -424,6 +492,11 @@ __decorateClass([
|
|
|
424
492
|
filter: ({ state }) => state.required.requestType === "subscriptions"
|
|
425
493
|
})
|
|
426
494
|
], HandleMcp20260728Flow.prototype, "handleSubscriptions", 1);
|
|
495
|
+
__decorateClass([
|
|
496
|
+
Stage("handleEventStream", {
|
|
497
|
+
filter: ({ state }) => state.required.requestType === "eventStream"
|
|
498
|
+
})
|
|
499
|
+
], HandleMcp20260728Flow.prototype, "handleEventStream", 1);
|
|
427
500
|
__decorateClass([
|
|
428
501
|
Stage("handleMessage", {
|
|
429
502
|
filter: ({ state }) => state.required.requestType === "message"
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
import { randomUUID, runRequestExclusive } from "@frontmcp/utils";
|
|
10
10
|
import { ELICITATION_META_KEY } from "../elicitation/elicitation-meta.mjs";
|
|
11
11
|
import { ElicitationTimeoutError } from "../errors/index.mjs";
|
|
12
|
+
import { sessionCallerOf } from "../notification/notification.service.mjs";
|
|
12
13
|
import { composeCallerInstructions } from "../skill/skill-instructions.helper.mjs";
|
|
13
14
|
import { buildScopedServerOptions } from "./build-scoped-server-options.mjs";
|
|
14
15
|
import { createMcpServer } from "./mcp-server.factory.mjs";
|
|
@@ -71,11 +72,13 @@ async function createInMemoryServer(scope, options) {
|
|
|
71
72
|
mcpServer.setRequestHandler(handler.requestSchema, wrappedHandler);
|
|
72
73
|
}
|
|
73
74
|
scope.notifications.registerServer(sessionId, mcpServer);
|
|
75
|
+
scope.notifications.setCaller(sessionId, sessionCallerOf(currentAuthInfo));
|
|
74
76
|
await mcpServer.connect(serverTransport);
|
|
75
77
|
return {
|
|
76
78
|
clientTransport,
|
|
77
79
|
setAuthInfo: (authInfo) => {
|
|
78
80
|
currentAuthInfo = authInfo;
|
|
81
|
+
scope.notifications.setCaller(sessionId, sessionCallerOf(authInfo));
|
|
79
82
|
},
|
|
80
83
|
close: async () => {
|
|
81
84
|
scope.notifications.unregisterServer(sessionId);
|
|
@@ -15,6 +15,7 @@ function buildDiscoverCapabilities(scope) {
|
|
|
15
15
|
if (source["prompts"]) result.prompts = source["prompts"];
|
|
16
16
|
if (source["resources"]) result.resources = source["resources"];
|
|
17
17
|
if (source["tools"]) result.tools = source["tools"];
|
|
18
|
+
if (source["events"]) result.events = source["events"];
|
|
18
19
|
return result;
|
|
19
20
|
}
|
|
20
21
|
function buildDiscoverResult(scope, instructions) {
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// libs/sdk/src/transport/mcp-20260728/event-stream-response.ts
|
|
2
|
+
import { MCP_20260728_META } from "@frontmcp/protocol";
|
|
3
|
+
var encoder = new TextEncoder();
|
|
4
|
+
function frame(message) {
|
|
5
|
+
return encoder.encode(`event: message
|
|
6
|
+
data: ${JSON.stringify(message)}
|
|
7
|
+
|
|
8
|
+
`);
|
|
9
|
+
}
|
|
10
|
+
function eventStreamFrames(notifications, requestId) {
|
|
11
|
+
const finalFrame = frame({
|
|
12
|
+
jsonrpc: "2.0",
|
|
13
|
+
id: requestId,
|
|
14
|
+
result: { resultType: "complete", _meta: { [MCP_20260728_META.subscriptionId]: requestId } }
|
|
15
|
+
});
|
|
16
|
+
return {
|
|
17
|
+
/** Frame each notification, then the final result; returning early ends the source stream too. */
|
|
18
|
+
[Symbol.asyncIterator]() {
|
|
19
|
+
const source = notifications[Symbol.asyncIterator]();
|
|
20
|
+
let finished = false;
|
|
21
|
+
return {
|
|
22
|
+
next: async () => {
|
|
23
|
+
if (finished) return { value: void 0, done: true };
|
|
24
|
+
const step = await source.next();
|
|
25
|
+
if (finished) return { value: void 0, done: true };
|
|
26
|
+
if (!step.done) {
|
|
27
|
+
const { method, params } = step.value;
|
|
28
|
+
return { value: frame({ jsonrpc: "2.0", method, params }), done: false };
|
|
29
|
+
}
|
|
30
|
+
finished = true;
|
|
31
|
+
return { value: finalFrame, done: false };
|
|
32
|
+
},
|
|
33
|
+
return: async () => {
|
|
34
|
+
finished = true;
|
|
35
|
+
await source.return?.();
|
|
36
|
+
return { value: void 0, done: true };
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
export {
|
|
43
|
+
eventStreamFrames
|
|
44
|
+
};
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
// libs/sdk/src/transport/mcp-20260728/index.ts
|
|
2
2
|
export { ADVERTISED_EXTENSIONS, CACHEABLE_METHODS, DEFAULT_CACHE_TTL_MS, FRONTMCP_SUPPORTED_PROTOCOL_VERSIONS, INITIALIZE_PROTOCOL_VERSIONS, LEGACY_PROTOCOL_VERSIONS, MCP_HEADERS, NAME_FROM_PARAMS_NAME, NAME_FROM_PARAMS_URI, PROTOCOL_20260728_ONLY_METHODS } from "./protocol-20260728.constants.mjs";
|
|
3
3
|
export { decodeHeaderValue, encodeHeaderValue, hasInvalidHeaderChars, headerMatchesBodyValue, isSentinelEncoded } from "./header-codec.mjs";
|
|
4
|
-
export { IMPLEMENTED_PROTOCOL_VERSION, collectHeaderParams, declaresProtocol20260728, isProtocol20260728Request, readHeader, readParamHeaders, validate20260728Request } from "./request-validation.mjs";
|
|
4
|
+
export { IMPLEMENTED_PROTOCOL_VERSION, collectHeaderParams, declaresProtocol20260728, isProtocol20260728Request, readHeader, readParamHeaders, unsupportedProtocolVersionError, validate20260728Request } from "./request-validation.mjs";
|
|
5
5
|
export { DEFAULT_REQUEST_STATE_TTL_MS, MAX_REQUEST_STATE_BYTES, computeRequestBinding, decodeRequestState, encodeRequestState, getRequestStateKey, getRequestStateKeySource, resetRequestStateKey, warnIfRequestStateKeyNotShared } from "./request-state.mjs";
|
|
6
6
|
export { RequestNotificationSink, meetsLogLevel } from "./request-notifications.mjs";
|
|
7
7
|
export { decorateResult, isShapedPerCaller, orderListResult, resolveCacheScope } from "./result-decorator.mjs";
|
|
8
8
|
export { buildDiscoverCapabilities, buildDiscoverResult } from "./discover.mjs";
|
|
9
9
|
export { MrtrExchange, buildInputRequiredResult } from "./mrtr.mjs";
|
|
10
10
|
export { createSubscriptionStream, resolveAcknowledgedFilter } from "./subscriptions.mjs";
|
|
11
|
+
export { eventStreamFrames } from "./event-stream-response.mjs";
|
|
11
12
|
export { TASKS_EXTENSION_ID, TASKS_EXTENSION_METHODS, TERMINAL_TASK_STATUSES, buildCreateTaskResult, clientSupportsTasks, dispatchTasksMethod, resolveTaskOwner, taskToWire20260728 } from "./tasks-extension.mjs";
|
|
12
13
|
export { MRTR_CAPABLE_METHODS, dispatch20260728, resolvePrincipal, resolveTaskPrincipal, toJsonRpcError } from "./dispatcher.mjs";
|
|
13
14
|
export { buildParamHeaders, validateHeaderParams, McpStatelessClient, McpStatelessError, TASKS_CLIENT_CAPABILITY, retryAfterMsOf } from "./client/index.mjs";
|
|
@@ -19,7 +19,14 @@ var MCP_HEADERS = {
|
|
|
19
19
|
/** Prefix for `x-mcp-header`-derived parameter headers. */
|
|
20
20
|
paramPrefix: "mcp-param-"
|
|
21
21
|
};
|
|
22
|
-
var NAME_FROM_PARAMS_NAME = [
|
|
22
|
+
var NAME_FROM_PARAMS_NAME = [
|
|
23
|
+
"tools/call",
|
|
24
|
+
"prompts/get",
|
|
25
|
+
"events/subscribe",
|
|
26
|
+
"events/unsubscribe",
|
|
27
|
+
"events/poll",
|
|
28
|
+
"events/stream"
|
|
29
|
+
];
|
|
23
30
|
var NAME_FROM_PARAMS_URI = ["resources/read"];
|
|
24
31
|
var DEFAULT_CACHE_TTL_MS = {
|
|
25
32
|
"server/discover": 3e5,
|
|
@@ -151,16 +151,19 @@ function validate20260728Request(options) {
|
|
|
151
151
|
}
|
|
152
152
|
return { ok: true, version: declaredVersion ?? IMPLEMENTED_PROTOCOL_VERSION };
|
|
153
153
|
}
|
|
154
|
+
function unsupportedProtocolVersionError(requested, supported) {
|
|
155
|
+
return {
|
|
156
|
+
code: MCP_20260728_ERROR_CODES.unsupportedProtocolVersion,
|
|
157
|
+
message: `Unsupported protocol version: ${requested}`,
|
|
158
|
+
data: { supported: [...supported], requested }
|
|
159
|
+
};
|
|
160
|
+
}
|
|
154
161
|
function versionSupported(version) {
|
|
155
162
|
if (FRONTMCP_SUPPORTED_PROTOCOL_VERSIONS.includes(version)) return void 0;
|
|
156
163
|
return {
|
|
157
164
|
ok: false,
|
|
158
165
|
status: 400,
|
|
159
|
-
error:
|
|
160
|
-
code: MCP_20260728_ERROR_CODES.unsupportedProtocolVersion,
|
|
161
|
-
message: `Unsupported protocol version: ${version}`,
|
|
162
|
-
data: { supported: [...FRONTMCP_SUPPORTED_PROTOCOL_VERSIONS], requested: version }
|
|
163
|
-
}
|
|
166
|
+
error: unsupportedProtocolVersionError(version, FRONTMCP_SUPPORTED_PROTOCOL_VERSIONS)
|
|
164
167
|
};
|
|
165
168
|
}
|
|
166
169
|
function validateParamHeaders(headers, params, lookupToolSchema, strictHeaders) {
|
|
@@ -208,5 +211,6 @@ export {
|
|
|
208
211
|
isProtocol20260728Request,
|
|
209
212
|
readHeader,
|
|
210
213
|
readParamHeaders,
|
|
214
|
+
unsupportedProtocolVersionError,
|
|
211
215
|
validate20260728Request
|
|
212
216
|
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// libs/sdk/src/transport/mcp-handlers/events-list-request.handler.ts
|
|
2
|
+
import { ListEventsRequestSchema } from "@frontmcp/protocol";
|
|
3
|
+
import { toSdkMcpError } from "./mcp-error.utils.mjs";
|
|
4
|
+
import { withMcpSurface } from "./mcp-surface.mjs";
|
|
5
|
+
function eventsListRequestHandler({
|
|
6
|
+
scope
|
|
7
|
+
}) {
|
|
8
|
+
const logger = scope.logger.child("events-list-request-handler");
|
|
9
|
+
return {
|
|
10
|
+
requestSchema: ListEventsRequestSchema,
|
|
11
|
+
handler: async (request, ctx) => {
|
|
12
|
+
logger.verbose("events/list requested");
|
|
13
|
+
try {
|
|
14
|
+
return await scope.runFlowForOutput("events:list", { request, ctx: withMcpSurface(scope, ctx) });
|
|
15
|
+
} catch (error) {
|
|
16
|
+
throw toSdkMcpError(error);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export {
|
|
22
|
+
eventsListRequestHandler as default
|
|
23
|
+
};
|