@frontmcp/sdk 1.11.3 → 1.12.0-rc.1
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,71 @@
|
|
|
1
|
+
import { internalZ as z } from '@frontmcp/lazy-zod';
|
|
2
|
+
import { type AuthInfo } from '@frontmcp/protocol';
|
|
3
|
+
import { FlowBase, type FlowRunOptions } from '../../common';
|
|
4
|
+
import { type EventSubscriberIdentity } from '../event-subscriber';
|
|
5
|
+
declare const inputSchema: import("@frontmcp/lazy-zod").ZodObject<{
|
|
6
|
+
request: import("@frontmcp/lazy-zod").ZodObject<{
|
|
7
|
+
method: import("@frontmcp/lazy-zod").ZodLiteral<"events/unsubscribe">;
|
|
8
|
+
params: import("@frontmcp/lazy-zod").ZodObject<{
|
|
9
|
+
delivery: import("@frontmcp/lazy-zod").ZodObject<{
|
|
10
|
+
mode: import("@frontmcp/lazy-zod").ZodOptional<import("@frontmcp/lazy-zod").ZodEnum<{
|
|
11
|
+
poll: "poll";
|
|
12
|
+
push: "push";
|
|
13
|
+
webhook: "webhook";
|
|
14
|
+
}>>;
|
|
15
|
+
url: import("@frontmcp/lazy-zod").ZodString;
|
|
16
|
+
}, import("zod/v4/core").$strip>;
|
|
17
|
+
_meta: import("@frontmcp/lazy-zod").ZodOptional<import("@frontmcp/lazy-zod").ZodRecord<import("@frontmcp/lazy-zod").ZodString, import("@frontmcp/lazy-zod").ZodUnknown>>;
|
|
18
|
+
name: import("@frontmcp/lazy-zod").ZodString;
|
|
19
|
+
arguments: import("@frontmcp/lazy-zod").ZodOptional<import("@frontmcp/lazy-zod").ZodRecord<import("@frontmcp/lazy-zod").ZodString, import("@frontmcp/lazy-zod").ZodUnknown>>;
|
|
20
|
+
}, import("zod/v4/core").$strip>;
|
|
21
|
+
}, import("zod/v4/core").$strip>;
|
|
22
|
+
ctx: import("@frontmcp/lazy-zod").ZodUnknown;
|
|
23
|
+
}, import("zod/v4/core").$strip>;
|
|
24
|
+
declare const outputSchema: import("@frontmcp/lazy-zod").ZodObject<{
|
|
25
|
+
_meta: import("@frontmcp/lazy-zod").ZodOptional<import("@frontmcp/lazy-zod").ZodRecord<import("@frontmcp/lazy-zod").ZodString, import("@frontmcp/lazy-zod").ZodUnknown>>;
|
|
26
|
+
resultType: import("@frontmcp/lazy-zod").ZodOptional<import("@frontmcp/lazy-zod").ZodString>;
|
|
27
|
+
}, import("zod/v4/core").$strip>;
|
|
28
|
+
declare const stateSchema: import("@frontmcp/lazy-zod").ZodObject<{
|
|
29
|
+
authInfo: z.ZodType<Partial<AuthInfo>>;
|
|
30
|
+
dialect: import("@frontmcp/lazy-zod").ZodEnum<{
|
|
31
|
+
"sep-3415": "sep-3415";
|
|
32
|
+
sketch: "sketch";
|
|
33
|
+
}>;
|
|
34
|
+
owner: z.ZodType<EventSubscriberIdentity>;
|
|
35
|
+
}, import("zod/v4/core").$strip>;
|
|
36
|
+
declare const plan: {
|
|
37
|
+
readonly pre: ["parseInput", "resolveDialect", "requireSubscriber"];
|
|
38
|
+
readonly execute: ["removeSubscription"];
|
|
39
|
+
readonly post: ["buildResult"];
|
|
40
|
+
readonly finalize: ["finalize"];
|
|
41
|
+
};
|
|
42
|
+
declare global {
|
|
43
|
+
interface ExtendFlows {
|
|
44
|
+
'events:unsubscribe': FlowRunOptions<EventUnsubscribeFlow, typeof plan, typeof inputSchema, typeof outputSchema, typeof stateSchema>;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
declare const name: "events:unsubscribe";
|
|
48
|
+
/** `events/unsubscribe`: remove the caller's subscription. Removing one that does not exist succeeds too. */
|
|
49
|
+
export default class EventUnsubscribeFlow extends FlowBase<typeof name> {
|
|
50
|
+
logger: import("../../common").FrontMcpLogger;
|
|
51
|
+
/** The event registry of a scope that serves webhook subscriptions. */
|
|
52
|
+
private get events();
|
|
53
|
+
/** The subscriptions of the scope; the flow is registered only when it has them. */
|
|
54
|
+
private get subscriptions();
|
|
55
|
+
/** Read the caller's auth from the request context. */
|
|
56
|
+
parseInput(): Promise<void>;
|
|
57
|
+
/** Pick the dialect a refusal is answered in. */
|
|
58
|
+
resolveDialect(): Promise<void>;
|
|
59
|
+
/** Only its owner can name a subscription, so an anonymous caller has none to remove. */
|
|
60
|
+
requireSubscriber(): Promise<void>;
|
|
61
|
+
/** Remove the subscription the caller's key names and tell its event, once. */
|
|
62
|
+
removeSubscription(): Promise<void>;
|
|
63
|
+
/** Answer with an empty result, whether or not a subscription was removed. */
|
|
64
|
+
buildResult(): Promise<void>;
|
|
65
|
+
/** Runs after a success or a failure, so hooks that must see both attach here. */
|
|
66
|
+
finalize(): Promise<void>;
|
|
67
|
+
/** The arguments as `events/subscribe` stored them: parsed by the event's schema, or as sent when that fails. */
|
|
68
|
+
private storedArguments;
|
|
69
|
+
}
|
|
70
|
+
export {};
|
|
71
|
+
//# sourceMappingURL=event-unsubscribe.flow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event-unsubscribe.flow.d.ts","sourceRoot":"","sources":["../../../src/event/flows/event-unsubscribe.flow.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,IAAI,CAAC,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAA+D,KAAK,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAEhH,OAAO,EAAQ,QAAQ,EAA8B,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AAG/F,OAAO,EAAqB,KAAK,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAItF,QAAA,MAAM,WAAW;;;;;;;;;;;;;;;;;;gCAGf,CAAC;AAEH,QAAA,MAAM,YAAY;;;gCAA+B,CAAC;AAElD,QAAA,MAAM,WAAW;cACM,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;;;;;WAE/B,CAAC,CAAC,OAAO,CAAC,uBAAuB,CAAC;gCACpD,CAAC;AAEH,QAAA,MAAM,IAAI;;;;;CAK2B,CAAC;AAEtC,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,WAAW;QACnB,oBAAoB,EAAE,cAAc,CAClC,oBAAoB,EACpB,OAAO,IAAI,EACX,OAAO,WAAW,EAClB,OAAO,YAAY,EACnB,OAAO,WAAW,CACnB,CAAC;KACH;CACF;AAED,QAAA,MAAM,IAAI,EAAG,oBAA6B,CAAC;AAG3C,6GAA6G;AAQ7G,MAAM,CAAC,OAAO,OAAO,oBAAqB,SAAQ,QAAQ,CAAC,OAAO,IAAI,CAAC;IACrE,MAAM,wCAAkD;IAExD,uEAAuE;IACvE,OAAO,KAAK,MAAM,GAEjB;IAED,oFAAoF;IACpF,OAAO,KAAK,aAAa,GAExB;IAED,uDAAuD;IAEjD,UAAU;IAKhB,iDAAiD;IAE3C,cAAc;IAKpB,yFAAyF;IAEnF,iBAAiB;IAWvB,+EAA+E;IAEzE,kBAAkB;IAYxB,8EAA8E;IAExE,WAAW;IAIjB,kFAAkF;IAE5E,QAAQ;IAId,iHAAiH;IACjH,OAAO,CAAC,eAAe;CAQxB"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { internalZ as z } from '@frontmcp/lazy-zod';
|
|
2
|
+
import { EventEntry, FlowBase, type FlowRunOptions } from '../../common';
|
|
3
|
+
/** `events/list` answers in pages of this many events, as `tools/list` does by default. */
|
|
4
|
+
export declare const EVENTS_LIST_PAGE_SIZE = 40;
|
|
5
|
+
declare const inputSchema: import("@frontmcp/lazy-zod").ZodObject<{
|
|
6
|
+
request: import("@frontmcp/lazy-zod").ZodObject<{
|
|
7
|
+
method: import("@frontmcp/lazy-zod").ZodLiteral<"events/list">;
|
|
8
|
+
params: import("@frontmcp/lazy-zod").ZodOptional<import("@frontmcp/lazy-zod").ZodObject<{
|
|
9
|
+
cursor: import("@frontmcp/lazy-zod").ZodOptional<import("@frontmcp/lazy-zod").ZodNullable<import("@frontmcp/lazy-zod").ZodString>>;
|
|
10
|
+
_meta: import("@frontmcp/lazy-zod").ZodOptional<import("@frontmcp/lazy-zod").ZodRecord<import("@frontmcp/lazy-zod").ZodString, import("@frontmcp/lazy-zod").ZodUnknown>>;
|
|
11
|
+
}, import("zod/v4/core").$strip>>;
|
|
12
|
+
}, import("zod/v4/core").$strip>;
|
|
13
|
+
ctx: import("@frontmcp/lazy-zod").ZodUnknown;
|
|
14
|
+
}, import("zod/v4/core").$strip>;
|
|
15
|
+
declare const outputSchema: import("@frontmcp/lazy-zod").ZodObject<{
|
|
16
|
+
events: import("@frontmcp/lazy-zod").ZodArray<import("@frontmcp/lazy-zod").ZodObject<{
|
|
17
|
+
name: import("@frontmcp/lazy-zod").ZodString;
|
|
18
|
+
description: import("@frontmcp/lazy-zod").ZodOptional<import("@frontmcp/lazy-zod").ZodString>;
|
|
19
|
+
delivery: import("@frontmcp/lazy-zod").ZodArray<import("@frontmcp/lazy-zod").ZodEnum<{
|
|
20
|
+
poll: "poll";
|
|
21
|
+
push: "push";
|
|
22
|
+
webhook: "webhook";
|
|
23
|
+
}>>;
|
|
24
|
+
inputSchema: import("@frontmcp/lazy-zod").ZodRecord<import("@frontmcp/lazy-zod").ZodString, import("@frontmcp/lazy-zod").ZodUnknown>;
|
|
25
|
+
payloadSchema: import("@frontmcp/lazy-zod").ZodRecord<import("@frontmcp/lazy-zod").ZodString, import("@frontmcp/lazy-zod").ZodUnknown>;
|
|
26
|
+
_meta: import("@frontmcp/lazy-zod").ZodOptional<import("@frontmcp/lazy-zod").ZodRecord<import("@frontmcp/lazy-zod").ZodString, import("@frontmcp/lazy-zod").ZodUnknown>>;
|
|
27
|
+
}, import("zod/v4/core").$strip>>;
|
|
28
|
+
nextCursor: import("@frontmcp/lazy-zod").ZodOptional<import("@frontmcp/lazy-zod").ZodString>;
|
|
29
|
+
_meta: import("@frontmcp/lazy-zod").ZodOptional<import("@frontmcp/lazy-zod").ZodRecord<import("@frontmcp/lazy-zod").ZodString, import("@frontmcp/lazy-zod").ZodUnknown>>;
|
|
30
|
+
resultType: import("@frontmcp/lazy-zod").ZodOptional<import("@frontmcp/lazy-zod").ZodString>;
|
|
31
|
+
}, import("zod/v4/core").$strip>;
|
|
32
|
+
declare const stateSchema: import("@frontmcp/lazy-zod").ZodObject<{
|
|
33
|
+
cursor: import("@frontmcp/lazy-zod").ZodOptional<import("@frontmcp/lazy-zod").ZodString>;
|
|
34
|
+
authInfo: z.ZodType<Record<string, unknown>>;
|
|
35
|
+
events: import("@frontmcp/lazy-zod").ZodArray<import("@frontmcp/lazy-zod").ZodObject<{
|
|
36
|
+
event: import("zod").ZodInstanceOf<EventEntry>;
|
|
37
|
+
delivery: import("@frontmcp/lazy-zod").ZodArray<import("@frontmcp/lazy-zod").ZodEnum<{
|
|
38
|
+
poll: "poll";
|
|
39
|
+
push: "push";
|
|
40
|
+
webhook: "webhook";
|
|
41
|
+
}>>;
|
|
42
|
+
}, import("zod/v4/core").$strip>>;
|
|
43
|
+
}, import("zod/v4/core").$strip>;
|
|
44
|
+
declare const plan: {
|
|
45
|
+
readonly pre: ["parseInput"];
|
|
46
|
+
readonly execute: ["findEvents", "filterByAvailability", "filterByAuthorities", "filterByDiscovery"];
|
|
47
|
+
readonly post: ["parseEvents"];
|
|
48
|
+
readonly finalize: ["finalize"];
|
|
49
|
+
};
|
|
50
|
+
declare global {
|
|
51
|
+
interface ExtendFlows {
|
|
52
|
+
'events:list': FlowRunOptions<ListEventsFlow, typeof plan, typeof inputSchema, typeof outputSchema, typeof stateSchema>;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
declare const name: "events:list";
|
|
56
|
+
/** Answers `events/list`: the discoverable events offered to the caller and their delivery modes, by page. */
|
|
57
|
+
export default class ListEventsFlow extends FlowBase<typeof name> {
|
|
58
|
+
logger: import("../../common").FrontMcpLogger;
|
|
59
|
+
/** Reads the cursor and the caller the listing is for. */
|
|
60
|
+
parseInput(): Promise<void>;
|
|
61
|
+
/** The events offered in at least one delivery mode this server performs. */
|
|
62
|
+
findEvents(): Promise<void>;
|
|
63
|
+
/** Leave out the events `availableWhen.surface` does not offer to the surface this listing is for. */
|
|
64
|
+
filterByAvailability(): Promise<void>;
|
|
65
|
+
/** Leave out the events the caller's `authorities` do not allow, and an event whose policy throws. */
|
|
66
|
+
filterByAuthorities(): Promise<void>;
|
|
67
|
+
/** Leave out the events declared with `hideFromDiscovery`: a client that knows their name can still subscribe. */
|
|
68
|
+
filterByDiscovery(): Promise<void>;
|
|
69
|
+
/** Answers one page of definitions, ordered by name, with the cursor of the next page. */
|
|
70
|
+
parseEvents(): Promise<void>;
|
|
71
|
+
/** Runs after a success or a failure, so hooks that must see both attach here. */
|
|
72
|
+
finalize(): Promise<void>;
|
|
73
|
+
}
|
|
74
|
+
export {};
|
|
75
|
+
//# sourceMappingURL=list-events.flow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-events.flow.d.ts","sourceRoot":"","sources":["../../../src/event/flows/list-events.flow.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,IAAI,CAAC,EAAE,MAAM,oBAAoB,CAAC;AAQpD,OAAO,EAAE,UAAU,EAAQ,QAAQ,EAA8B,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AAM3G,2FAA2F;AAC3F,eAAO,MAAM,qBAAqB,KAAK,CAAC;AAExC,QAAA,MAAM,WAAW;;;;;;;;;gCAGf,CAAC;AAEH,QAAA,MAAM,YAAY;;;;;;;;;;;;;;;;gCAAyB,CAAC;AAE5C,QAAA,MAAM,WAAW;;cAEM,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;;;;;;;;;gCAOvD,CAAC;AAEH,QAAA,MAAM,IAAI;;;;;CAK2B,CAAC;AAEtC,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,WAAW;QACnB,aAAa,EAAE,cAAc,CAC3B,cAAc,EACd,OAAO,IAAI,EACX,OAAO,WAAW,EAClB,OAAO,YAAY,EACnB,OAAO,WAAW,CACnB,CAAC;KACH;CACF;AAED,QAAA,MAAM,IAAI,EAAG,aAAsB,CAAC;AASpC,8GAA8G;AAQ9G,MAAM,CAAC,OAAO,OAAO,cAAe,SAAQ,QAAQ,CAAC,OAAO,IAAI,CAAC;IAC/D,MAAM,wCAA4C;IAElD,0DAA0D;IAEpD,UAAU;IAMhB,6EAA6E;IAEvE,UAAU;IAIhB,sGAAsG;IAEhG,oBAAoB;IAQ1B,sGAAsG;IAEhG,mBAAmB;IAmBzB,kHAAkH;IAE5G,iBAAiB;IAKvB,0FAA0F;IAEpF,WAAW;IAuBjB,kFAAkF;IAE5E,QAAQ;CAGf"}
|
package/event/index.d.ts
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export { EventInstance } from './event.instance';
|
|
2
|
+
export { default as EventRegistry } from './event.registry';
|
|
3
|
+
export type { EventCapabilities, EventRegistryInterface, ServedEvent } from './event.registry';
|
|
4
|
+
export { normalizeEvent } from './event.utils';
|
|
5
|
+
export { registerEventCapabilities } from './event-scope.helper';
|
|
6
|
+
export type { RegisterEventCapabilitiesArgs, EventCapabilitiesResult } from './event-scope.helper';
|
|
7
|
+
export { EVENT_DIALECTS, callerPlatformOf, resolveEventDialect } from './event-dialect';
|
|
8
|
+
export type { EventDialect, EventDialectRules } from './event-dialect';
|
|
9
|
+
export { eventOutboundTargetOptions } from './event-outbound';
|
|
10
|
+
export type { EventOutboundTargetOptions } from './event-outbound';
|
|
11
|
+
export { eventSubscriberOf } from './event-subscriber';
|
|
12
|
+
export type { EventSubscriberIdentity } from './event-subscriber';
|
|
13
|
+
export { EventCallbackVerifier, VERIFICATION_ATTEMPTS_PER_HOST } from './subscription/event-callback-verifier';
|
|
14
|
+
export type { EventCallbackVerification, EventCallbackVerificationRequest, EventCallbackVerifierOptions, } from './subscription/event-callback-verifier';
|
|
15
|
+
export { createEventSubscriptionStore, openEventStorage } from './subscription/event-subscription-store.factory';
|
|
16
|
+
export type { EventSubscriptionStoreOptions, EventSubscriptionStoreResult, EventSubscriptionStoreType, } from './subscription/event-subscription-store.factory';
|
|
17
|
+
export { StorageEventSubscriptionStore } from './subscription/event-subscription.store';
|
|
18
|
+
export type { EventSubscriptionChanges, EventSubscriptionPatch, EventReplayBatch, EventReplayState, EventSubscriptionRecord, EventSubscriptionStatus, EventSubscriptionStore, EventWebhookDelivery, StorageEventSubscriptionStoreOptions, } from './subscription/event-subscription.store';
|
|
19
|
+
export { EventSubscriptions, SUBSCRIPTION_SWEEP_INTERVAL_MS, deliveryStatusOf, subscriptionRefOf, } from './subscription/event-subscriptions';
|
|
20
|
+
export type { EventSubscriptionIdentity, EventSubscriptionsOptions } from './subscription/event-subscriptions';
|
|
21
|
+
export { EVENT_COUNTERS, createEventMetrics } from './delivery/event-metrics';
|
|
22
|
+
export type { EventCounter, EventMetrics } from './delivery/event-metrics';
|
|
23
|
+
export { EventOutbox, OUTBOX_SWEEP_INTERVAL_MS } from './delivery/event-outbox';
|
|
24
|
+
export type { EventDeliveryKind, EventDeliveryOutcome, EventDeliveryRecord, EventDeliveryTarget, EventOutboxOptions, NewEventDelivery, } from './delivery/event-outbox';
|
|
25
|
+
export { ScopeEventPublisher, newEventId } from './event-publisher';
|
|
26
|
+
export { assertEventAuthorities, assertEventAuthorizes, eventReaderOf, offeredEventOf, parsedEventArguments, readerSubscriptionOf, } from './event-gates';
|
|
27
|
+
export type { EventReader } from './event-gates';
|
|
28
|
+
export { EventBuffer } from './poll/event-buffer';
|
|
29
|
+
export type { BufferedEvent, EventBufferOptions, EventBufferRead } from './poll/event-buffer';
|
|
30
|
+
export { EventPollLeases, MAX_POLL_LEASES, POLL_LEASE_INTERVALS, POLL_LEASE_MIN_MS, POLL_LEASE_SWEEP_INTERVAL_MS, pollLeaseMs, } from './poll/event-poll-leases';
|
|
31
|
+
export type { EventPollLeasesOptions, PollLeaseRequest } from './poll/event-poll-leases';
|
|
32
|
+
export { EventReplays, MAX_PENDING_BATCHES, REPLAY_LEASE_MS } from './replay/event-replays';
|
|
33
|
+
export type { EventReplaysOptions, EventReplayStep } from './replay/event-replays';
|
|
34
|
+
export { EventStream, MAX_QUEUED_NOTIFICATIONS } from './stream/event-stream';
|
|
35
|
+
export type { EventStreamNotification, EventStreamOptions } from './stream/event-stream';
|
|
36
|
+
export { EVENT_RELAY_CHANNEL, EventStreams, MAX_OPEN_STREAMS } from './stream/event-streams';
|
|
37
|
+
export type { EventStreamsOptions } from './stream/event-streams';
|
|
38
|
+
export { SUSPEND_AFTER_FAILURES } from './flows/event-deliver.flow';
|
|
39
|
+
export { EVENT_DELIVERY_MAX_BYTES, isInAudience } from './flows/event-publish.flow';
|
|
40
|
+
export type { EventDeliveryPlan } from './flows/event-publish.flow';
|
|
41
|
+
export { EVENT_PUBLISH_MAX_BODY_BYTES } from './flows/event-publish-http.flow';
|
|
42
|
+
export { enablePublishEndpoint } from './publish-endpoint/event-publish-endpoint';
|
|
43
|
+
export type { EnablePublishEndpointArgs, EventPublishEndpoint } from './publish-endpoint/event-publish-endpoint';
|
|
44
|
+
export { EventPublishIdempotency, PUBLISH_CLAIM_SECONDS, PUBLISH_IDEMPOTENCY_WINDOW_SECONDS, } from './publish-endpoint/event-publish-idempotency';
|
|
45
|
+
export type { EventPublishClaim } from './publish-endpoint/event-publish-idempotency';
|
|
46
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/event/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAC5D,YAAY,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/F,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AACjE,YAAY,EAAE,6BAA6B,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AACnG,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACxF,YAAY,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACvE,OAAO,EAAE,0BAA0B,EAAE,MAAM,kBAAkB,CA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;AACjH,OAAO,EACL,uBAAuB,EACvB,qBAAqB,EACrB,kCAAkC,GACnC,MAAM,8CAA8C,CAAC;AACtD,YAAY,EAAE,iBAAiB,EAAE,MAAM,8CAA8C,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { EventOccurrence } from '@frontmcp/protocol';
|
|
2
|
+
import { type EventAudience } from '../../common';
|
|
3
|
+
/** A published occurrence as the buffer keeps it, with what decides who may read it. */
|
|
4
|
+
export interface BufferedEvent {
|
|
5
|
+
/** Its position: every occurrence the server publishes gets the next one. */
|
|
6
|
+
sequence: number;
|
|
7
|
+
/** When it was published, in Unix milliseconds. */
|
|
8
|
+
publishedAt: number;
|
|
9
|
+
occurrence: EventOccurrence;
|
|
10
|
+
audience?: EventAudience;
|
|
11
|
+
/** Set by a targeted publish: only that subscription reads it. */
|
|
12
|
+
subscriptionId?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface EventBufferOptions {
|
|
15
|
+
/** `events.buffer.maxAgeMs`. */
|
|
16
|
+
maxAgeMs: number;
|
|
17
|
+
/** `events.buffer.maxEvents`, per event. */
|
|
18
|
+
maxEvents: number;
|
|
19
|
+
}
|
|
20
|
+
/** What a read from a cursor gives: the occurrences after it that are still kept, in order. */
|
|
21
|
+
export interface EventBufferRead {
|
|
22
|
+
events: BufferedEvent[];
|
|
23
|
+
/** True when occurrences after the cursor are gone, or the cursor is not one of this process. */
|
|
24
|
+
truncated: boolean;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* The recent occurrences of each event, kept in memory for `events/poll`. A cursor is `<bootId>.<sequence>`: it names
|
|
28
|
+
* a position in this process only, so after a restart every cursor reads as a gap.
|
|
29
|
+
*/
|
|
30
|
+
export declare class EventBuffer {
|
|
31
|
+
private readonly options;
|
|
32
|
+
private readonly bootId;
|
|
33
|
+
private readonly rings;
|
|
34
|
+
private sequence;
|
|
35
|
+
/** Takes the age and count limits, and draws the boot id that this process's cursors carry. */
|
|
36
|
+
constructor(options: EventBufferOptions);
|
|
37
|
+
/** Keep a published occurrence, and drop what its event's ring no longer holds. */
|
|
38
|
+
append(occurrence: EventOccurrence, audience?: EventAudience, subscriptionId?: string): BufferedEvent;
|
|
39
|
+
/** The cursor of the current position: a later read from it gives what is published from now on. */
|
|
40
|
+
currentCursor(): string;
|
|
41
|
+
/** The sequence of the last occurrence appended, of any event; 0 before the first. */
|
|
42
|
+
currentSequence(): number;
|
|
43
|
+
/** The cursor of a position: a read from it gives the occurrences after that position. */
|
|
44
|
+
cursorAt(sequence: number): string;
|
|
45
|
+
/** The occurrences of an event after a cursor. A cursor this process cannot place reads as a gap, from now. */
|
|
46
|
+
read(eventName: string, cursor: string): EventBufferRead;
|
|
47
|
+
/** The position a cursor names, when this process issued a cursor of that shape and has reached it. */
|
|
48
|
+
private positionOf;
|
|
49
|
+
/** The ring of an event, made on first use. */
|
|
50
|
+
private ringOf;
|
|
51
|
+
/** Drop the occurrences that are too old or too many, remembering how far the ring was cut. */
|
|
52
|
+
private prune;
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=event-buffer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event-buffer.d.ts","sourceRoot":"","sources":["../../../src/event/poll/event-buffer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAG1D,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AAElD,wFAAwF;AACxF,MAAM,WAAW,aAAa;IAC5B,6EAA6E;IAC7E,QAAQ,EAAE,MAAM,CAAC;IACjB,mDAAmD;IACnD,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,eAAe,CAAC;IAC5B,QAAQ,CAAC,EAAE,aAAa,CAAC;IACzB,kEAAkE;IAClE,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,kBAAkB;IACjC,gCAAgC;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,4CAA4C;IAC5C,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,+FAA+F;AAC/F,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,aAAa,EAAE,CAAC;IACxB,iGAAiG;IACjG,SAAS,EAAE,OAAO,CAAC;CACpB;AAUD;;;GAGG;AACH,qBAAa,WAAW;IAMV,OAAO,CAAC,QAAQ,CAAC,OAAO;IALpC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAgC;IACtD,OAAO,CAAC,QAAQ,CAAK;IAErB,+FAA+F;gBAClE,OAAO,EAAE,kBAAkB;IAIxD,mFAAmF;IACnF,MAAM,CAAC,UAAU,EAAE,eAAe,EAAE,QAAQ,CAAC,EAAE,aAAa,EAAE,cAAc,CAAC,EAAE,MAAM,GAAG,aAAa;IAUrG,oGAAoG;IACpG,aAAa,IAAI,MAAM;IAIvB,sFAAsF;IACtF,eAAe,IAAI,MAAM;IAIzB,0FAA0F;IAC1F,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;IAIlC,+GAA+G;IAC/G,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,eAAe;IAWxD,uGAAuG;IACvG,OAAO,CAAC,UAAU;IAQlB,+CAA+C;IAC/C,OAAO,CAAC,MAAM;IASd,+FAA+F;IAC/F,OAAO,CAAC,KAAK;CASd"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { type EventContext, type EventSubscriptionRef, type FrontMcpLogger } from '../../common';
|
|
2
|
+
export interface PollLeaseRequest {
|
|
3
|
+
subscription: EventSubscriptionRef;
|
|
4
|
+
arguments: Record<string, unknown>;
|
|
5
|
+
principalKey: string | undefined;
|
|
6
|
+
/** How long the lease lasts without another poll. */
|
|
7
|
+
leaseMs: number;
|
|
8
|
+
/** The event's context, whose `onSubscribe` and `onUnsubscribe` the lease calls. */
|
|
9
|
+
context: EventContext;
|
|
10
|
+
}
|
|
11
|
+
export interface EventPollLeasesOptions {
|
|
12
|
+
/** `events.subscriptions.maxPerPrincipal`. */
|
|
13
|
+
maxPerPrincipal: number;
|
|
14
|
+
logger: FrontMcpLogger;
|
|
15
|
+
}
|
|
16
|
+
/** The shortest a poll lease lasts, whatever the poll interval. */
|
|
17
|
+
export declare const POLL_LEASE_MIN_MS = 300000;
|
|
18
|
+
/** How many poll intervals a lease lasts. */
|
|
19
|
+
export declare const POLL_LEASE_INTERVALS = 5;
|
|
20
|
+
/** How often lapsed leases are looked for. */
|
|
21
|
+
export declare const POLL_LEASE_SWEEP_INTERVAL_MS = 60000;
|
|
22
|
+
/** How many poll leases one process keeps, for all callers together. */
|
|
23
|
+
export declare const MAX_POLL_LEASES = 10000;
|
|
24
|
+
/** How long a poll lease lasts for a poll interval: five intervals, and at least five minutes. */
|
|
25
|
+
export declare function pollLeaseMs(nextPollMs: number): number;
|
|
26
|
+
/**
|
|
27
|
+
* The lifecycle of poll subscriptions. Poll has no goodbye, so a subscription is a lease its polls renew: `onSubscribe`
|
|
28
|
+
* runs at the first poll of a key, `onUnsubscribe(..., 'expired')` when no poll renewed it in time. In memory only.
|
|
29
|
+
*/
|
|
30
|
+
export declare class EventPollLeases {
|
|
31
|
+
private readonly options;
|
|
32
|
+
private readonly leases;
|
|
33
|
+
/** The leases whose `onSubscribe` is running, so concurrent first polls wait for it instead of calling it again. */
|
|
34
|
+
private readonly starting;
|
|
35
|
+
private readonly logger;
|
|
36
|
+
private sweepTimer?;
|
|
37
|
+
private lastSweepAt;
|
|
38
|
+
/** Takes the per-owner lease limit and the logger to report lease ends with. */
|
|
39
|
+
constructor(options: EventPollLeasesOptions);
|
|
40
|
+
/** How many leases are alive. */
|
|
41
|
+
get size(): number;
|
|
42
|
+
/** Whether a new lease would exceed what one owner (the anonymous callers count as one), or the process, may hold. */
|
|
43
|
+
isFull(principalKey: string | undefined): boolean;
|
|
44
|
+
/** Whether the subscription already has a lease, or is getting one. */
|
|
45
|
+
has(subscriptionId: string): boolean;
|
|
46
|
+
/** Renew the lease of a poll, or start it: a new lease calls the event's `onSubscribe` first. */
|
|
47
|
+
renew(request: PollLeaseRequest): Promise<void>;
|
|
48
|
+
/** Call the event's `onSubscribe`, then keep the lease. */
|
|
49
|
+
private subscribe;
|
|
50
|
+
/** End every lease no poll renewed in time. */
|
|
51
|
+
sweep(now?: number): Promise<void>;
|
|
52
|
+
/** Look for lapsed leases on a timer, where the process is long-lived. */
|
|
53
|
+
start(): void;
|
|
54
|
+
/** Stop the timer and forget the leases: a restart starts them again at the next poll. */
|
|
55
|
+
stop(): void;
|
|
56
|
+
/** Sweep in the background when the last sweep is old enough: the only sweep where no timer runs. */
|
|
57
|
+
private sweepIfDue;
|
|
58
|
+
/** Run a sweep nobody waits for; its failure is logged. */
|
|
59
|
+
private sweepInBackground;
|
|
60
|
+
/** Tell the event a lease ended; a failure there is logged, never thrown. */
|
|
61
|
+
private end;
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=event-poll-leases.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event-poll-leases.d.ts","sourceRoot":"","sources":["../../../src/event/poll/event-poll-leases.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,oBAAoB,EAEzB,KAAK,cAAc,EACpB,MAAM,cAAc,CAAC;AAatB,MAAM,WAAW,gBAAgB;IAC/B,YAAY,EAAE,oBAAoB,CAAC;IACnC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,YAAY,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,qDAAqD;IACrD,OAAO,EAAE,MAAM,CAAC;IAChB,oFAAoF;IACpF,OAAO,EAAE,YAAY,CAAC;CACvB;AAED,MAAM,WAAW,sBAAsB;IACrC,8CAA8C;IAC9C,eAAe,EAAE,MAAM,CAAC;IACxB,MAAM,EAAE,cAAc,CAAC;CACxB;A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|
+
import type { AuthoritiesMetadata } from '@frontmcp/auth';
|
|
2
|
+
import { type FrontMcpLogger, type ScopeEntry } from '../../common';
|
|
3
|
+
import { WorkflowWebhookReplayGuard } from '../../workflow/trigger/workflow-webhook.signature';
|
|
4
|
+
import type EventRegistry from '../event.registry';
|
|
5
|
+
import { EventPublishIdempotency } from './event-publish-idempotency';
|
|
6
|
+
/** The HTTP publish endpoint a server serves: where, how it knows its callers, and what it already published. */
|
|
7
|
+
export interface EventPublishEndpoint {
|
|
8
|
+
/** The path requests are answered on, with the scope's route base. */
|
|
9
|
+
path: string;
|
|
10
|
+
/** Requests are signed with it. Without it, a caller presents the bearer credentials of the MCP endpoint. */
|
|
11
|
+
secret?: string;
|
|
12
|
+
/** The rule a bearer caller must satisfy, with the request body as its input. */
|
|
13
|
+
authorities?: AuthoritiesMetadata;
|
|
14
|
+
/** The signatures accepted within their window: a signed request is taken once. */
|
|
15
|
+
replays: WorkflowWebhookReplayGuard;
|
|
16
|
+
idempotency: EventPublishIdempotency;
|
|
17
|
+
}
|
|
18
|
+
export interface EnablePublishEndpointArgs {
|
|
19
|
+
scope: ScopeEntry;
|
|
20
|
+
eventRegistry: EventRegistry;
|
|
21
|
+
/** Whether the server's auth names its callers; a public server cannot tell them apart. */
|
|
22
|
+
identifiesCallers: boolean;
|
|
23
|
+
/** The key prefix of the server's event records, for a storage this endpoint opens itself. */
|
|
24
|
+
keyPrefix: string;
|
|
25
|
+
logger: FrontMcpLogger;
|
|
26
|
+
}
|
|
27
|
+
/** Serve the HTTP publish endpoint of a scope; the server does not start when it could not tell who publishes. */
|
|
28
|
+
export declare function enablePublishEndpoint(args: EnablePublishEndpointArgs): Promise<void>;
|
|
29
|
+
//# sourceMappingURL=event-publish-endpoint.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event-publish-endpoint.d.ts","sourceRoot":"","sources":["../../../src/event/publish-endpoint/event-publish-endpoint.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAE1D,OAAO,EAAsB,KAAK,cAAc,EAAE,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AAUxF,OAAO,EAAE,0BAA0B,EAAE,MAAM,mDAAmD,CAAC;AAC/F,OAAO,KAAK,aAAa,MAAM,mBAAmB,CAAC;AAGnD,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAEtE,iHAAiH;AACjH,MAAM,WAAW,oBAAoB;IACnC,sEAAsE;IACtE,IAAI,EAAE,MAAM,CAAC;IACb,6GAA6G;IAC7G,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,iFAAiF;IACjF,WAAW,CAAC,EAAE,mBAAmB,CAAC;IAClC,mFAAmF;IACnF,OAAO,EAAE,0BAA0B,CAAC;IACpC,WAAW,EAAE,uBAAuB,CAAC;CACtC;AAED,MAAM,WAAW,yBAAyB;IACxC,KAAK,EAAE,UAAU,CAAC;IAClB,aAAa,EAAE,aAAa,CAAC;IAC7B,2FAA2F;IAC3F,iBAAiB,EAAE,OAAO,CAAC;IAC3B,8FAA8F;IAC9F,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,cAAc,CAAC;CACxB;AAwBD,kHAAkH;AAClH,wBAAsB,qBAAqB,CAAC,IAAI,EAAE,yBAAyB,GAAG,OAAO,CAAC,IAAI,CAAC,CAyC1F"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type NamespacedStorage } from '@frontmcp/utils';
|
|
2
|
+
import { type EventPublishResult } from '../../common';
|
|
3
|
+
/** How long the answer to a published `eventId` is kept, in seconds: a repeat within it is answered, not published. */
|
|
4
|
+
export declare const PUBLISH_IDEMPOTENCY_WINDOW_SECONDS = 600;
|
|
5
|
+
/** How long a publish may take before a repeat of its `eventId` is let through, in seconds. */
|
|
6
|
+
export declare const PUBLISH_CLAIM_SECONDS = 60;
|
|
7
|
+
/** What a request that names an `eventId` should do: publish it, answer what an earlier one got, or wait. */
|
|
8
|
+
export type EventPublishClaim = {
|
|
9
|
+
state: 'claimed';
|
|
10
|
+
token: string;
|
|
11
|
+
} | {
|
|
12
|
+
state: 'published';
|
|
13
|
+
result: EventPublishResult;
|
|
14
|
+
} | {
|
|
15
|
+
state: 'in-flight';
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* The answers to the events published over HTTP with an `eventId`, kept in the events storage for
|
|
19
|
+
* {@link PUBLISH_IDEMPOTENCY_WINDOW_SECONDS}: every process of the server sees them when the storage is shared.
|
|
20
|
+
*/
|
|
21
|
+
export declare class EventPublishIdempotency {
|
|
22
|
+
private readonly storage;
|
|
23
|
+
private readonly scopeId;
|
|
24
|
+
/** Takes the events storage the claims and answers are kept in, and the scope whose endpoint publishes. */
|
|
25
|
+
constructor(storage: NamespacedStorage, scopeId: string);
|
|
26
|
+
/** Claim an `eventId` of an event for this request, or learn what became of the request that claimed it. */
|
|
27
|
+
claim(eventName: string, eventId: string): Promise<EventPublishClaim>;
|
|
28
|
+
/** Keep the answer of a publish for the window, unless its claim expired and another request holds the eventId. */
|
|
29
|
+
complete(eventName: string, eventId: string, token: string, result: EventPublishResult): Promise<void>;
|
|
30
|
+
/** Give a claim back after its publish failed, so the sender's retry publishes; a newer claim is left alone. */
|
|
31
|
+
release(eventName: string, eventId: string, token: string): Promise<void>;
|
|
32
|
+
/** The storage key of one `eventId` of one event of one scope; hashed, so no id can shape a key. */
|
|
33
|
+
private keyOf;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=event-publish-idempotency.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event-publish-idempotency.d.ts","sourceRoot":"","sources":["../../../src/event/publish-endpoint/event-publish-idempotency.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyB,KAAK,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEhF,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAEvD,uHAAuH;AACvH,eAAO,MAAM,kCAAkC,MAAM,CAAC;AAEtD,+FAA+F;AAC/F,eAAO,MAAM,qBAAqB,KAAK,CAAC;AAIxC,6GAA6G;AAC7G,MAAM,MAAM,iBAAiB,GACzB;IAAE,KAAK,EAAE,SAAS,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GACnC;IAAE,KAAK,EAAE,WAAW,CAAC;IAAC,MAAM,EAAE,kBAAkB,CAAA;CAAE,GAClD;IAAE,KAAK,EAAE,WAAW,CAAA;CAAE,CAAC;AAgB3B;;;GAGG;AACH,qBAAa,uBAAuB;IAGhC,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,OAAO;IAH1B,2GAA2G;gBAExF,OAAO,EAAE,iBAAiB,EAC1B,OAAO,EAAE,MAAM;IAGlC,4GAA4G;IACtG,KAAK,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAc3E,mHAAmH;IAC7G,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;IAO5G,gHAAgH;IAC1G,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAI/E,oGAAoG;IACpG,OAAO,CAAC,KAAK;CAGd"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { type EventEntry, type FrontMcpLogger } from '../../common';
|
|
2
|
+
import { type LeaseStorage } from '../../duty/lease-holder';
|
|
3
|
+
import { type EventOutbox } from '../delivery/event-outbox';
|
|
4
|
+
import { type EventReauthorization } from '../event-reauthorization';
|
|
5
|
+
import { type EventReplayState, type EventSubscriptionRecord, type EventSubscriptionStore } from '../subscription/event-subscription.store';
|
|
6
|
+
export interface EventReplaysOptions {
|
|
7
|
+
store: Pick<EventSubscriptionStore, 'listByEvent' | 'update'>;
|
|
8
|
+
outbox: Pick<EventOutbox, 'enqueue' | 'isPending'>;
|
|
9
|
+
/** Holds the lease of each event's loop: the storage of the subscription store. */
|
|
10
|
+
storage: LeaseStorage;
|
|
11
|
+
/** How often `check()` is called when it names no interval of its own: `events.poll.nextPollMs`. */
|
|
12
|
+
intervalMs: number;
|
|
13
|
+
/** How many events one `check()` is asked for: `events.poll.maxEvents`. */
|
|
14
|
+
maxEvents: number;
|
|
15
|
+
/** The largest body of one delivery, in bytes. */
|
|
16
|
+
maxBodyBytes: number;
|
|
17
|
+
/** How long a check of a subscription's owner holds: `events.subscriptions.reauthorizeEveryMs`. */
|
|
18
|
+
reauthorizeEveryMs: number;
|
|
19
|
+
/** Check a subscription's owner again: the event's `authorities`, then its `authorize()`. */
|
|
20
|
+
reauthorize: (event: EventEntry, record: EventSubscriptionRecord) => Promise<EventReauthorization>;
|
|
21
|
+
/** End a subscription whose owner was refused, as a publish does. */
|
|
22
|
+
terminate: (record: EventSubscriptionRecord) => Promise<void>;
|
|
23
|
+
logger: FrontMcpLogger;
|
|
24
|
+
}
|
|
25
|
+
/** What one `check()` did to a subscription. */
|
|
26
|
+
export interface EventReplayStep {
|
|
27
|
+
replay: EventReplayState;
|
|
28
|
+
/** Whether events were skipped: the upstream cut the cursor, or `maxAgeMs` left some out. */
|
|
29
|
+
truncated: boolean;
|
|
30
|
+
hasMore: boolean;
|
|
31
|
+
nextPollMs?: number;
|
|
32
|
+
/** Why queuing stopped part-way; `replay` then keeps what was queued. */
|
|
33
|
+
failure?: unknown;
|
|
34
|
+
}
|
|
35
|
+
/** How long one process holds the loop of an event before another may take it over. */
|
|
36
|
+
export declare const REPLAY_LEASE_MS = 30000;
|
|
37
|
+
/** How long `stop()` waits for the read in flight of a loop: the default `lifecycle.shutdownHookTimeoutMs`. */
|
|
38
|
+
export declare const REPLAY_STOP_GRACE_MS = 3000;
|
|
39
|
+
/** Batches with unfinished deliveries after which `check()` waits for the callback to catch up. */
|
|
40
|
+
export declare const MAX_PENDING_BATCHES = 50;
|
|
41
|
+
/**
|
|
42
|
+
* Webhook delivery for events with `check()`: one loop per event, held by one process through a lease, reads the
|
|
43
|
+
* upstream for each webhook subscription and queues what it finds as deliveries. It keeps, per subscription, the
|
|
44
|
+
* position it read to and the watermark a client may persist.
|
|
45
|
+
*/
|
|
46
|
+
export declare class EventReplays {
|
|
47
|
+
private readonly options;
|
|
48
|
+
private readonly holders;
|
|
49
|
+
private readonly timers;
|
|
50
|
+
private readonly ticks;
|
|
51
|
+
private readonly nextCheckAt;
|
|
52
|
+
private readonly logger;
|
|
53
|
+
/** Keep the options and name the logger. */
|
|
54
|
+
constructor(options: EventReplaysOptions);
|
|
55
|
+
/** Whether an event reads an upstream that can replay: it defines `check()`. */
|
|
56
|
+
isReplayable(event: EventEntry): boolean;
|
|
57
|
+
/** Contend for the loop of each of these events; the process that holds an event's lease runs its loop. */
|
|
58
|
+
start(events: readonly EventEntry[]): Promise<void>;
|
|
59
|
+
/**
|
|
60
|
+
* Stop every loop, wait for the reads in flight, and release the leases for another process to take. The lease of a
|
|
61
|
+
* loop whose read did not end within `REPLAY_STOP_GRACE_MS` is left to expire instead.
|
|
62
|
+
*/
|
|
63
|
+
stop(): Promise<void>;
|
|
64
|
+
/** Read the upstream for a new subscription, from the cursor of its request: `null` starts from now. */
|
|
65
|
+
begin(event: EventEntry, record: EventSubscriptionRecord, cursor: string | null, maxAgeMs: number | undefined): Promise<EventReplayStep>;
|
|
66
|
+
/**
|
|
67
|
+
* The state a refresh answers with: the watermark as deliveries stand now, and a gap not yet told. It is stored only
|
|
68
|
+
* while the loop has not moved the subscription on meanwhile: the loop's newer position wins.
|
|
69
|
+
*/
|
|
70
|
+
refresh(record: EventSubscriptionRecord, replay: EventReplayState): Promise<EventReplayStep>;
|
|
71
|
+
/** Run the loop of an event after `delayMs`, on a timer that does not keep the process alive; one turn at a time. */
|
|
72
|
+
private schedule;
|
|
73
|
+
/** Whether the turn in flight of an event's loop, if any, ended within `REPLAY_STOP_GRACE_MS`; logged when not. */
|
|
74
|
+
private turnEnded;
|
|
75
|
+
/** Whether this process still runs the loop of an event: it holds the lease, and is not stopping. */
|
|
76
|
+
private isRunning;
|
|
77
|
+
/** Stop the timer of an event's loop. */
|
|
78
|
+
private unschedule;
|
|
79
|
+
/**
|
|
80
|
+
* One turn of an event's loop: read the upstream for each of its webhook subscriptions that is due, while this
|
|
81
|
+
* process still runs the loop. A subscription that fails is logged and the turn goes on with the next one.
|
|
82
|
+
*/
|
|
83
|
+
private tick;
|
|
84
|
+
/**
|
|
85
|
+
* Whether the owner of a subscription may still be read for: checked again once `reauthorizeEveryMs` passed. A
|
|
86
|
+
* refusal ends the subscription; a check that could not be made skips it this turn, its cursor where it was.
|
|
87
|
+
*/
|
|
88
|
+
private isStillAuthorized;
|
|
89
|
+
/**
|
|
90
|
+
* Read the upstream for one subscription until it has no more, report a gap, and store where it stands, also what
|
|
91
|
+
* was queued before a failure, so the next turn does not queue it again.
|
|
92
|
+
*/
|
|
93
|
+
private readFor;
|
|
94
|
+
/**
|
|
95
|
+
* Store where a subscription stands, only while this process holds the lease of the event's loop (renewed now, so
|
|
96
|
+
* no other process can take it before the write) and while no other holder moved the subscription on since this
|
|
97
|
+
* turn read it.
|
|
98
|
+
*/
|
|
99
|
+
private storeReplay;
|
|
100
|
+
/** Tell a gap found between refreshes: an envelope for a dialect that has one, else at the next refresh. */
|
|
101
|
+
private reportGap;
|
|
102
|
+
/** Call `check()` once from the subscription's position and queue what it returned as deliveries. */
|
|
103
|
+
private advance;
|
|
104
|
+
/**
|
|
105
|
+
* Where a subscription stands when queuing failed at item `index` of a `check()`: still at its cursor, with what it
|
|
106
|
+
* queued kept as a batch and counted, so reading from the same cursor again skips it.
|
|
107
|
+
*/
|
|
108
|
+
private partlyQueued;
|
|
109
|
+
/** The answer of the event's `check()`; undefined, and logged, when it throws: the loop asks again later. */
|
|
110
|
+
private check;
|
|
111
|
+
/** Queue one item of a `check()` as a delivery whose body carries the watermark; undefined when it cannot be sent. */
|
|
112
|
+
private enqueue;
|
|
113
|
+
/** Move the watermark past each leading batch whose deliveries are all acknowledged, dropped or abandoned. */
|
|
114
|
+
private settled;
|
|
115
|
+
}
|
|
116
|
+
//# sourceMappingURL=event-replays.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event-replays.d.ts","sourceRoot":"","sources":["../../../src/event/replay/event-replays.ts"],"names":[],"mappings":"AAEA,OAAO,EAIL,KAAK,UAAU,EACf,KAAK,cAAc,EACpB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAe,KAAK,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEzE,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAG5D,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AACrE,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,uBAAuB,EAC5B,KAAK,sBAAsB,EAC5B,MAAM,0CAA0C,CAAC;AAElD,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,IAAI,CAAC,sBAAsB,EAAE,aAAa,GAAG,QAAQ,CAAC,CAAC;IAC9D,MAAM,EAAE,IAAI,CAAC,WAAW,EAAE,SAAS,GAAG,WAAW,CAAC,CAAC;IACnD,mFAAmF;IACnF,OAAO,EAAE,YAAY,CAAC;IACtB,oGAAoG;IACpG,UAAU,EAAE,MAAM,CAAC;IACnB,2EAA2E;IAC3E,SAAS,EAAE,MAAM,CAAC;IAClB,kDAAkD;IAClD,YAAY,EAAE,MAAM,CAAC;IACrB,mGAAmG;IACnG,kBAAkB,EAAE,MAAM,CAAC;IAC3B,6FAA6F;IAC7F,WAAW,EAAE,CAAC,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,uBAAuB,KAAK,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAC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