@frontmcp/sdk 1.11.2 → 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.
Files changed (788) hide show
  1. package/README.md +9 -0
  2. package/agent/adapters/anthropic.adapter.d.ts +4 -4
  3. package/agent/adapters/anthropic.adapter.d.ts.map +1 -1
  4. package/agent/adapters/base.adapter.d.ts +12 -2
  5. package/agent/adapters/base.adapter.d.ts.map +1 -1
  6. package/agent/adapters/index.d.ts +1 -1
  7. package/agent/adapters/index.d.ts.map +1 -1
  8. package/agent/adapters/openai.adapter.d.ts +7 -7
  9. package/agent/adapters/openai.adapter.d.ts.map +1 -1
  10. package/agent/agent-execution-loop.d.ts +27 -14
  11. package/agent/agent-execution-loop.d.ts.map +1 -1
  12. package/agent/agent.registry.d.ts +9 -0
  13. package/agent/agent.registry.d.ts.map +1 -1
  14. package/agent/flows/call-agent.flow.d.ts.map +1 -1
  15. package/answer/answer-meter.d.ts +2 -0
  16. package/answer/answer-meter.d.ts.map +1 -1
  17. package/app/instances/app.esm.instance.d.ts +29 -5
  18. package/app/instances/app.esm.instance.d.ts.map +1 -1
  19. package/app/instances/app.lazy.instance.d.ts.map +1 -1
  20. package/app/instances/app.remote.instance.d.ts.map +1 -1
  21. package/app/instances/esm-normalize.utils.d.ts +3 -1
  22. package/app/instances/esm-normalize.utils.d.ts.map +1 -1
  23. package/app/instances/esm-package-version.d.ts +48 -0
  24. package/app/instances/esm-package-version.d.ts.map +1 -0
  25. package/app/lazy/lazy-app.rules.d.ts +4 -0
  26. package/app/lazy/lazy-app.rules.d.ts.map +1 -1
  27. package/auth/auth-ui/auth-ui.contract.d.ts +27 -0
  28. package/auth/auth-ui/auth-ui.contract.d.ts.map +1 -1
  29. package/auth/auth-ui/auth-ui.state.d.ts +2 -1
  30. package/auth/auth-ui/auth-ui.state.d.ts.map +1 -1
  31. package/auth/auth-ui/index.d.ts +1 -1
  32. package/auth/auth-ui/index.d.ts.map +1 -1
  33. package/auth/authorization/orchestrated.context-extension.d.ts +1 -1
  34. package/auth/authorization/orchestrated.context-extension.d.ts.map +1 -1
  35. package/auth/authorized-apps.utils.d.ts +22 -0
  36. package/auth/authorized-apps.utils.d.ts.map +1 -1
  37. package/auth/federated-steps.d.ts +66 -0
  38. package/auth/federated-steps.d.ts.map +1 -0
  39. package/auth/flows/oauth.authorize.flow.d.ts +2 -2
  40. package/auth/flows/oauth.authorize.flow.d.ts.map +1 -1
  41. package/auth/flows/oauth.callback.flow.d.ts +17 -6
  42. package/auth/flows/oauth.callback.flow.d.ts.map +1 -1
  43. package/auth/flows/oauth.provider-callback.flow.d.ts.map +1 -1
  44. package/auth/flows/oauth.register.flow.d.ts +1 -1
  45. package/auth/flows/oauth.register.flow.d.ts.map +1 -1
  46. package/auth/flows/oauth.token.flow.d.ts +9 -0
  47. package/auth/flows/oauth.token.flow.d.ts.map +1 -1
  48. package/auth/flows/oauth.userinfo.flow.d.ts +1 -1
  49. package/auth/flows/well-known.oauth-authorization-server.flow.d.ts +3 -0
  50. package/auth/flows/well-known.oauth-authorization-server.flow.d.ts.map +1 -1
  51. package/auth/flows/well-known.prm.flow.d.ts.map +1 -1
  52. package/auth/instances/instance.local-primary-auth.d.ts +38 -7
  53. package/auth/instances/instance.local-primary-auth.d.ts.map +1 -1
  54. package/auth/required-providers.utils.d.ts +19 -0
  55. package/auth/required-providers.utils.d.ts.map +1 -0
  56. package/browser/agent/adapters/anthropic.adapter.mjs +14 -10
  57. package/browser/agent/adapters/base.adapter.mjs +10 -3
  58. package/browser/agent/adapters/openai.adapter.mjs +39 -25
  59. package/browser/agent/agent-execution-loop.mjs +102 -70
  60. package/browser/agent/agent.registry.mjs +56 -20
  61. package/browser/agent/flows/call-agent.flow.mjs +2 -1
  62. package/browser/agent/index.mjs +1 -1
  63. package/browser/answer/answer-meter.mjs +1 -0
  64. package/browser/app/instances/app.esm.instance.mjs +128 -154
  65. package/browser/app/instances/app.lazy.instance.mjs +7 -3
  66. package/browser/app/instances/app.remote.instance.mjs +3 -4
  67. package/browser/app/instances/esm-normalize.utils.mjs +10 -5
  68. package/browser/app/instances/esm-package-version.mjs +118 -0
  69. package/browser/app/lazy/lazy-app.rules.mjs +4 -1
  70. package/browser/auth/auth-ui/auth-ui.state.mjs +1 -1
  71. package/browser/auth/authorization/orchestrated.context-extension.mjs +2 -2
  72. package/browser/auth/authorized-apps.utils.mjs +24 -2
  73. package/browser/auth/federated-steps.mjs +199 -0
  74. package/browser/auth/flows/oauth.authorize.flow.mjs +61 -76
  75. package/browser/auth/flows/oauth.callback.flow.mjs +112 -42
  76. package/browser/auth/flows/oauth.provider-callback.flow.mjs +14 -2
  77. package/browser/auth/flows/oauth.register.flow.mjs +3 -3
  78. package/browser/auth/flows/oauth.token.flow.mjs +33 -3
  79. package/browser/auth/flows/session.verify.flow.mjs +1 -1
  80. package/browser/auth/flows/well-known.oauth-authorization-server.flow.mjs +11 -6
  81. package/browser/auth/flows/well-known.prm.flow.mjs +2 -1
  82. package/browser/auth/instances/instance.local-primary-auth.mjs +131 -37
  83. package/browser/auth/required-providers.utils.mjs +16 -0
  84. package/browser/channel/channel-notification.service.mjs +20 -8
  85. package/browser/channel/channel-scope.helper.mjs +2 -2
  86. package/browser/channel/channel.instance.mjs +10 -1
  87. package/browser/channel/channel.utils.mjs +22 -1
  88. package/browser/channel/flows/send-channel-notification.flow.mjs +1 -1
  89. package/browser/channel/sources/app-event.source.mjs +5 -2
  90. package/browser/channel/sources/file-watcher.source.mjs +66 -0
  91. package/browser/common/decorators/duty.decorator.mjs +3 -4
  92. package/browser/common/decorators/event.decorator.mjs +49 -0
  93. package/browser/common/decorators/index.mjs +2 -0
  94. package/browser/common/decorators/worker.decorator.mjs +23 -0
  95. package/browser/common/entries/event.entry.mjs +59 -0
  96. package/browser/common/entries/index.mjs +1 -0
  97. package/browser/common/entries/tool.entry.mjs +21 -4
  98. package/browser/common/index.mjs +8 -8
  99. package/browser/common/interfaces/agent.interface.mjs +25 -4
  100. package/browser/common/interfaces/event.interface.mjs +17 -0
  101. package/browser/common/interfaces/execution-context.interface.mjs +8 -0
  102. package/browser/common/interfaces/index.mjs +2 -0
  103. package/browser/common/interfaces/tool.interface.mjs +31 -5
  104. package/browser/common/interfaces/worker.interface.mjs +0 -0
  105. package/browser/common/metadata/app.metadata.mjs +10 -2
  106. package/browser/common/metadata/duty.metadata.mjs +28 -13
  107. package/browser/common/metadata/duty.resolved.mjs +13 -0
  108. package/browser/common/metadata/event.metadata.mjs +137 -0
  109. package/browser/common/metadata/front-mcp.metadata.mjs +3 -0
  110. package/browser/common/metadata/index.mjs +6 -2
  111. package/browser/common/metadata/output-policy.mjs +4 -0
  112. package/browser/common/metadata/worker.metadata.mjs +44 -0
  113. package/browser/common/metadata/worker.resolved.mjs +13 -0
  114. package/browser/common/metadata/workflow.metadata.mjs +10 -2
  115. package/browser/common/records/event.record.mjs +9 -0
  116. package/browser/common/records/index.mjs +1 -0
  117. package/browser/common/schemas/annotated-class.schema.mjs +10 -0
  118. package/browser/common/schemas/index.mjs +1 -1
  119. package/browser/common/tokens/app.tokens.mjs +1 -0
  120. package/browser/common/tokens/event.tokens.mjs +11 -0
  121. package/browser/common/tokens/front-mcp.tokens.mjs +2 -0
  122. package/browser/common/tokens/index.mjs +1 -0
  123. package/browser/common/tokens/workflow.tokens.mjs +2 -0
  124. package/browser/common/types/options/transport/schema.mjs +3 -0
  125. package/browser/common/utils/auth-info.utils.mjs +1 -2
  126. package/browser/common/utils/index.mjs +1 -1
  127. package/browser/common/utils/offset-cursor.utils.mjs +23 -0
  128. package/browser/common/utils/principal.utils.mjs +25 -1
  129. package/browser/common/utils/time-zone.utils.mjs +12 -0
  130. package/browser/context/frontmcp-context-storage.mjs +14 -3
  131. package/browser/context/frontmcp-context.mjs +24 -2
  132. package/browser/direct/create.mjs +3 -1
  133. package/browser/direct/direct-client.mjs +16 -2
  134. package/browser/direct/direct-events-transport.mjs +47 -0
  135. package/browser/direct/direct-server.mjs +5 -1
  136. package/browser/duty/cron-schedule.mjs +62 -0
  137. package/browser/duty/describe-thrown.mjs +12 -0
  138. package/browser/duty/duty.lifecycle.mjs +102 -97
  139. package/browser/duty/duty.runner.mjs +117 -115
  140. package/browser/duty/lazy-lease-store.mjs +60 -0
  141. package/browser/duty/lease-holder.mjs +132 -0
  142. package/browser/duty/lease-store.mjs +125 -0
  143. package/browser/elicitation/helpers/checked-elicit-answer.mjs +18 -0
  144. package/browser/elicitation/helpers/elicit.helper.mjs +5 -21
  145. package/browser/elicitation/questions/question-subject.mjs +8 -2
  146. package/browser/elicitation/store/elicitation-encryption.mjs +6 -6
  147. package/browser/elicitation/store/encrypted-elicitation.store.mjs +2 -2
  148. package/browser/elicitation/store/storage-elicitation.store.mjs +1 -2
  149. package/browser/errors/auth-internal.errors.mjs +2 -0
  150. package/browser/errors/duty.errors.mjs +20 -0
  151. package/browser/errors/event.errors.mjs +128 -0
  152. package/browser/errors/index.mjs +42 -2
  153. package/browser/errors/mcp.error.mjs +22 -3
  154. package/browser/errors/misconfiguration.mjs +2 -0
  155. package/browser/errors/remote.errors.mjs +1 -1
  156. package/browser/errors/tool-ui.errors.mjs +22 -0
  157. package/browser/errors/worker.errors.mjs +14 -0
  158. package/browser/errors/workflow.errors.mjs +7 -1
  159. package/browser/esm-loader/esm-cache.mjs +2 -2
  160. package/browser/esm-loader/esm-entries.mjs +15 -1
  161. package/browser/esm-loader/esm-manifest.mjs +32 -25
  162. package/browser/esm-loader/esm-module-loader.mjs +22 -4
  163. package/browser/esm-loader/factories/esm-context-factories.mjs +3 -3
  164. package/browser/esm-loader/factories/esm-instance-factories.mjs +7 -3
  165. package/browser/esm-loader/factories/esm-record-builders.mjs +27 -2
  166. package/browser/esm-loader/semver.utils.mjs +3 -5
  167. package/browser/esm-loader/version-poller.mjs +1 -1
  168. package/browser/esm-loader/version-resolver.mjs +5 -1
  169. package/browser/event/delivery/event-metrics.mjs +37 -0
  170. package/browser/event/delivery/event-outbox.mjs +251 -0
  171. package/browser/event/event-channel.mjs +30 -0
  172. package/browser/event/event-dialect.mjs +23 -0
  173. package/browser/event/event-gates.mjs +72 -0
  174. package/browser/event/event-outbound.mjs +8 -0
  175. package/browser/event/event-publisher.mjs +55 -0
  176. package/browser/event/event-reauthorization.mjs +48 -0
  177. package/browser/event/event-scope.helper.mjs +266 -0
  178. package/browser/event/event-subscriber.mjs +31 -0
  179. package/browser/event/event.instance.mjs +44 -0
  180. package/browser/event/event.registry.mjs +145 -0
  181. package/browser/event/event.utils.mjs +31 -0
  182. package/browser/event/flows/event-deliver.flow.mjs +175 -0
  183. package/browser/event/flows/event-poll.flow.mjs +308 -0
  184. package/browser/event/flows/event-publish-http.flow.mjs +288 -0
  185. package/browser/event/flows/event-publish.flow.mjs +371 -0
  186. package/browser/event/flows/event-stream.flow.mjs +222 -0
  187. package/browser/event/flows/event-subscribe.flow.mjs +351 -0
  188. package/browser/event/flows/event-unsubscribe.flow.mjs +120 -0
  189. package/browser/event/flows/list-events.flow.mjs +145 -0
  190. package/browser/event/index.mjs +104 -0
  191. package/browser/event/poll/event-buffer.mjs +77 -0
  192. package/browser/event/poll/event-poll-leases.mjs +118 -0
  193. package/browser/event/publish-endpoint/event-publish-endpoint.mjs +75 -0
  194. package/browser/event/publish-endpoint/event-publish-idempotency.mjs +54 -0
  195. package/browser/event/replay/event-replays.mjs +298 -0
  196. package/browser/event/stream/event-stream.mjs +279 -0
  197. package/browser/event/stream/event-streams.mjs +122 -0
  198. package/browser/event/subscription/event-callback-verifier.mjs +165 -0
  199. package/browser/event/subscription/event-subscription-store.factory.mjs +59 -0
  200. package/browser/event/subscription/event-subscription-termination.mjs +34 -0
  201. package/browser/event/subscription/event-subscription.store.mjs +167 -0
  202. package/browser/event/subscription/event-subscriptions.mjs +126 -0
  203. package/browser/event-client/event-client.errors.mjs +50 -0
  204. package/browser/event-client/event-webhook-receiver.mjs +155 -0
  205. package/browser/event-client/events-client.mjs +471 -0
  206. package/browser/event-client/index.mjs +28 -0
  207. package/browser/ext-apps/ext-apps.handler.mjs +6 -1
  208. package/browser/flows/flow.http-path.mjs +5 -1
  209. package/browser/flows/flow.instance.mjs +42 -9
  210. package/browser/front-mcp/authorities-rules.check.mjs +15 -1
  211. package/browser/front-mcp/front-mcp.mjs +23 -8
  212. package/browser/front-mcp/session-secret.check.mjs +22 -0
  213. package/browser/http-route/http-route.table.mjs +23 -3
  214. package/browser/index.cjs +35274 -25258
  215. package/browser/index.mjs +43 -4
  216. package/browser/job/execution/job-execution.manager.mjs +58 -21
  217. package/browser/job/flows/execute-job.flow.mjs +5 -3
  218. package/browser/job/index.mjs +2 -2
  219. package/browser/job/job-attempt.mjs +15 -10
  220. package/browser/job/job-context-providers.mjs +2 -1
  221. package/browser/job/job-scope.helper.mjs +97 -4
  222. package/browser/job/job.registry.mjs +30 -0
  223. package/browser/job/store/memory-job-state.store.mjs +5 -0
  224. package/browser/job/store/redis-job-state.store.mjs +11 -0
  225. package/browser/job/store/storage-job-state.store.mjs +18 -2
  226. package/browser/job/tools/index.mjs +3 -1
  227. package/browser/job/tools/list-jobs.tool.mjs +7 -5
  228. package/browser/job/tools/update-job.tool.mjs +75 -0
  229. package/browser/logger/instances/instance.logger.mjs +31 -6
  230. package/browser/notification/notification.service.mjs +62 -11
  231. package/browser/prompt/flows/get-prompt.flow.mjs +3 -3
  232. package/browser/prompt/flows/prompts-list.flow.mjs +11 -4
  233. package/browser/provider/create-container.mjs +20 -9
  234. package/browser/provider/provider.lifecycle.mjs +4 -0
  235. package/browser/provider/provider.registry.mjs +56 -12
  236. package/browser/remote-mcp/factories/instance-factories.mjs +4 -4
  237. package/browser/remote-mcp/factories/record-builders.mjs +5 -0
  238. package/browser/remote-mcp/mcp-client.service.mjs +113 -68
  239. package/browser/remote-mcp/mcp-stateless-client.adapter.mjs +2 -2
  240. package/browser/remote-mcp/remote-entries.mjs +2 -1
  241. package/browser/remote-mcp/remote-oauth.mjs +102 -0
  242. package/browser/remote-mcp/remote-request-headers.mjs +42 -12
  243. package/browser/remote-mcp/resilience/circuit-breaker.mjs +3 -2
  244. package/browser/resource/flows/read-resource.flow.mjs +6 -4
  245. package/browser/resource/flows/resource-templates-list.flow.mjs +24 -9
  246. package/browser/resource/flows/resources-list.flow.mjs +11 -4
  247. package/browser/scope/event-publisher.providers.mjs +32 -0
  248. package/browser/scope/flows/http.request.flow.mjs +1 -1
  249. package/browser/scope/observability-scope.helper.mjs +6 -1
  250. package/browser/scope/scope.instance.mjs +312 -96
  251. package/browser/skill/errors/tool-not-allowed.error.mjs +2 -2
  252. package/browser/skill/flows/filter-skills.flow.mjs +1 -1
  253. package/browser/skill/flows/load-skill.flow.mjs +27 -15
  254. package/browser/skill/guards/tool-authorization.guard.mjs +1 -1
  255. package/browser/skill/hooks/skill-tool.hook.mjs +32 -24
  256. package/browser/skill/providers/external-skill.provider.mjs +4 -2
  257. package/browser/skill/session/skill-session-store.interface.mjs +10 -0
  258. package/browser/skill/session/skill-session.manager.mjs +8 -0
  259. package/browser/skill/skill-authorities.helper.mjs +9 -3
  260. package/browser/skill/skill-instructions.helper.mjs +12 -6
  261. package/browser/skill/skill-scope.helper.mjs +7 -2
  262. package/browser/skill/skill.registry.mjs +21 -2
  263. package/browser/subsystems.mjs +9 -2
  264. package/browser/surface/entry-authorized.mjs +15 -0
  265. package/browser/tool/flows/call-tool.flow.mjs +59 -13
  266. package/browser/tool/flows/tools-list.flow.mjs +14 -37
  267. package/browser/tool/tool.utils.mjs +46 -61
  268. package/browser/tool/ui/serving-mode-default.mjs +11 -2
  269. package/browser/tool/ui/template-detection.mjs +1 -1
  270. package/browser/tool/ui/ui-option-warnings.mjs +1 -28
  271. package/browser/tool/ui/ui-render.mjs +6 -0
  272. package/browser/tool/ui/ui-resource.handler.mjs +50 -6
  273. package/browser/tool/ui/ui-shared.mjs +61 -7
  274. package/browser/tool/ui/widget-routes.mjs +73 -0
  275. package/browser/tool/ui/widget-serving.mjs +112 -0
  276. package/browser/transport/adapters/transport.local.adapter.mjs +9 -2
  277. package/browser/transport/build-scoped-server-options.mjs +5 -1
  278. package/browser/transport/flows/handle.mcp-20260728.flow.mjs +77 -4
  279. package/browser/transport/flows/handle.stateless-http.flow.mjs +1 -2
  280. package/browser/transport/in-memory-server.mjs +3 -0
  281. package/browser/transport/mcp-20260728/client/index.mjs +1 -1
  282. package/browser/transport/mcp-20260728/client/mcp-stateless.client.mjs +2 -1
  283. package/browser/transport/mcp-20260728/discover.mjs +1 -0
  284. package/browser/transport/mcp-20260728/event-stream-response.mjs +44 -0
  285. package/browser/transport/mcp-20260728/index.mjs +3 -2
  286. package/browser/transport/mcp-20260728/protocol-20260728.constants.mjs +8 -1
  287. package/browser/transport/mcp-20260728/request-validation.mjs +9 -5
  288. package/browser/transport/mcp-handlers/events-list-request.handler.mjs +23 -0
  289. package/browser/transport/mcp-handlers/events-poll-request.handler.mjs +23 -0
  290. package/browser/transport/mcp-handlers/events-stream-request.handler.mjs +44 -0
  291. package/browser/transport/mcp-handlers/events-subscribe-request.handler.mjs +23 -0
  292. package/browser/transport/mcp-handlers/events-unsubscribe-request.handler.mjs +25 -0
  293. package/browser/transport/mcp-handlers/index.mjs +13 -0
  294. package/browser/transport/mcp-handlers/initialize-request.handler.mjs +3 -1
  295. package/browser/transport/stdio-revision-router.mjs +29 -2
  296. package/browser/transport/web-fetch-handler.mjs +5 -1
  297. package/browser/utils/abort.utils.mjs +7 -2
  298. package/browser/utils/content.utils.mjs +1 -1
  299. package/browser/worker/worker.lifecycle.mjs +199 -0
  300. package/browser/worker/worker.supervisor.mjs +111 -0
  301. package/browser/workflow/engine/workflow-step.executor.mjs +1 -1
  302. package/browser/workflow/engine/workflow.engine.mjs +13 -10
  303. package/browser/workflow/index.mjs +2 -2
  304. package/browser/workflow/tools/execute-workflow.tool.mjs +1 -1
  305. package/browser/workflow/tools/index.mjs +3 -1
  306. package/browser/workflow/tools/list-workflows.tool.mjs +4 -2
  307. package/browser/workflow/tools/register-workflow.tool.mjs +11 -2
  308. package/browser/workflow/tools/update-workflow.tool.mjs +80 -0
  309. package/browser/workflow/trigger/workflow-events.mjs +41 -0
  310. package/browser/workflow/trigger/workflow-schedules.mjs +173 -0
  311. package/browser/workflow/trigger/workflow-triggers.mjs +111 -0
  312. package/browser/workflow/trigger/workflow-webhook.routes.mjs +104 -0
  313. package/browser/workflow/trigger/workflow-webhook.signature.mjs +59 -0
  314. package/browser/workflow/workflow.registry.mjs +27 -0
  315. package/browser/workflow/workflow.utils.mjs +13 -2
  316. package/builtin/authorities/authorities.plugin.d.ts +1 -1
  317. package/builtin/authorities/authorities.plugin.d.ts.map +1 -1
  318. package/builtin/authorities/authorities.plugin.options.d.ts +1 -1
  319. package/builtin/authorities/authorities.plugin.options.d.ts.map +1 -1
  320. package/builtin/config/config-resolver.d.ts.map +1 -1
  321. package/channel/channel-notification.service.d.ts +5 -2
  322. package/channel/channel-notification.service.d.ts.map +1 -1
  323. package/channel/channel-scope.helper.d.ts +6 -1
  324. package/channel/channel-scope.helper.d.ts.map +1 -1
  325. package/channel/channel.instance.d.ts +7 -1
  326. package/channel/channel.instance.d.ts.map +1 -1
  327. package/channel/channel.types.d.ts +1 -1
  328. package/channel/channel.types.d.ts.map +1 -1
  329. package/channel/channel.utils.d.ts +20 -0
  330. package/channel/channel.utils.d.ts.map +1 -1
  331. package/channel/sources/agent-completion.source.d.ts +1 -1
  332. package/channel/sources/agent-completion.source.d.ts.map +1 -1
  333. package/channel/sources/app-event.source.d.ts +11 -2
  334. package/channel/sources/app-event.source.d.ts.map +1 -1
  335. package/channel/sources/file-watcher.source.d.ts +21 -0
  336. package/channel/sources/file-watcher.source.d.ts.map +1 -0
  337. package/channel/sources/index.d.ts +1 -0
  338. package/channel/sources/index.d.ts.map +1 -1
  339. package/common/decorators/app.decorator.d.ts +1 -1
  340. package/common/decorators/app.decorator.d.ts.map +1 -1
  341. package/common/decorators/duty.decorator.d.ts +3 -2
  342. package/common/decorators/duty.decorator.d.ts.map +1 -1
  343. package/common/decorators/event.decorator.d.ts +38 -0
  344. package/common/decorators/event.decorator.d.ts.map +1 -0
  345. package/common/decorators/index.d.ts +2 -0
  346. package/common/decorators/index.d.ts.map +1 -1
  347. package/common/decorators/worker.decorator.d.ts +13 -0
  348. package/common/decorators/worker.decorator.d.ts.map +1 -0
  349. package/common/entries/event.entry.d.ts +34 -0
  350. package/common/entries/event.entry.d.ts.map +1 -0
  351. package/common/entries/index.d.ts +1 -0
  352. package/common/entries/index.d.ts.map +1 -1
  353. package/common/entries/provider.entry.d.ts +2 -2
  354. package/common/entries/provider.entry.d.ts.map +1 -1
  355. package/common/entries/scope.entry.d.ts +28 -3
  356. package/common/entries/scope.entry.d.ts.map +1 -1
  357. package/common/entries/tool.entry.d.ts +5 -3
  358. package/common/entries/tool.entry.d.ts.map +1 -1
  359. package/common/interfaces/agent.interface.d.ts +4 -2
  360. package/common/interfaces/agent.interface.d.ts.map +1 -1
  361. package/common/interfaces/event.interface.d.ts +124 -0
  362. package/common/interfaces/event.interface.d.ts.map +1 -0
  363. package/common/interfaces/execution-context.interface.d.ts +3 -0
  364. package/common/interfaces/execution-context.interface.d.ts.map +1 -1
  365. package/common/interfaces/index.d.ts +2 -0
  366. package/common/interfaces/index.d.ts.map +1 -1
  367. package/common/interfaces/internal/registry.interface.d.ts +3 -1
  368. package/common/interfaces/internal/registry.interface.d.ts.map +1 -1
  369. package/common/interfaces/llm-adapter.interface.d.ts +5 -0
  370. package/common/interfaces/llm-adapter.interface.d.ts.map +1 -1
  371. package/common/interfaces/logger.interface.d.ts +2 -1
  372. package/common/interfaces/logger.interface.d.ts.map +1 -1
  373. package/common/interfaces/tool.interface.d.ts +12 -2
  374. package/common/interfaces/tool.interface.d.ts.map +1 -1
  375. package/common/interfaces/worker.interface.d.ts +13 -0
  376. package/common/interfaces/worker.interface.d.ts.map +1 -0
  377. package/common/metadata/agent.metadata.d.ts +8 -3
  378. package/common/metadata/agent.metadata.d.ts.map +1 -1
  379. package/common/metadata/app.metadata.d.ts +39 -12
  380. package/common/metadata/app.metadata.d.ts.map +1 -1
  381. package/common/metadata/channel.metadata.d.ts +40 -8
  382. package/common/metadata/channel.metadata.d.ts.map +1 -1
  383. package/common/metadata/duty.metadata.d.ts +67 -13
  384. package/common/metadata/duty.metadata.d.ts.map +1 -1
  385. package/common/metadata/duty.resolved.d.ts +4 -0
  386. package/common/metadata/duty.resolved.d.ts.map +1 -0
  387. package/common/metadata/event.metadata.d.ts +451 -0
  388. package/common/metadata/event.metadata.d.ts.map +1 -0
  389. package/common/metadata/flow.metadata.d.ts +14 -0
  390. package/common/metadata/flow.metadata.d.ts.map +1 -1
  391. package/common/metadata/front-mcp.metadata.d.ts +1654 -17
  392. package/common/metadata/front-mcp.metadata.d.ts.map +1 -1
  393. package/common/metadata/index.d.ts +4 -0
  394. package/common/metadata/index.d.ts.map +1 -1
  395. package/common/metadata/job.metadata.d.ts +12 -1
  396. package/common/metadata/job.metadata.d.ts.map +1 -1
  397. package/common/metadata/output-policy.d.ts +2 -0
  398. package/common/metadata/output-policy.d.ts.map +1 -1
  399. package/common/metadata/prompt.metadata.d.ts +1 -1
  400. package/common/metadata/remote-primitive.metadata.d.ts +6 -3
  401. package/common/metadata/remote-primitive.metadata.d.ts.map +1 -1
  402. package/common/metadata/resource.metadata.d.ts +3 -3
  403. package/common/metadata/skill.metadata.d.ts +1 -1
  404. package/common/metadata/tool.metadata.d.ts +1 -1
  405. package/common/metadata/worker.metadata.d.ts +69 -0
  406. package/common/metadata/worker.metadata.d.ts.map +1 -0
  407. package/common/metadata/worker.resolved.d.ts +4 -0
  408. package/common/metadata/worker.resolved.d.ts.map +1 -0
  409. package/common/metadata/workflow.metadata.d.ts +80 -16
  410. package/common/metadata/workflow.metadata.d.ts.map +1 -1
  411. package/common/records/event.record.d.ts +21 -0
  412. package/common/records/event.record.d.ts.map +1 -0
  413. package/common/records/index.d.ts +1 -0
  414. package/common/records/index.d.ts.map +1 -1
  415. package/common/schemas/annotated-class.schema.d.ts +1 -0
  416. package/common/schemas/annotated-class.schema.d.ts.map +1 -1
  417. package/common/tokens/app.tokens.d.ts.map +1 -1
  418. package/common/tokens/event.tokens.d.ts +9 -0
  419. package/common/tokens/event.tokens.d.ts.map +1 -0
  420. package/common/tokens/front-mcp.tokens.d.ts.map +1 -1
  421. package/common/tokens/index.d.ts +1 -0
  422. package/common/tokens/index.d.ts.map +1 -1
  423. package/common/tokens/workflow.tokens.d.ts +2 -0
  424. package/common/tokens/workflow.tokens.d.ts.map +1 -1
  425. package/common/types/options/logging/interfaces.d.ts +3 -1
  426. package/common/types/options/logging/interfaces.d.ts.map +1 -1
  427. package/common/types/options/observability/interfaces.d.ts +4 -2
  428. package/common/types/options/observability/interfaces.d.ts.map +1 -1
  429. package/common/types/options/transport/interfaces.d.ts +3 -0
  430. package/common/types/options/transport/interfaces.d.ts.map +1 -1
  431. package/common/types/options/transport/schema.d.ts.map +1 -1
  432. package/common/utils/auth-info.utils.d.ts +1 -0
  433. package/common/utils/auth-info.utils.d.ts.map +1 -1
  434. package/common/utils/global-config.utils.d.ts.map +1 -1
  435. package/common/utils/offset-cursor.utils.d.ts +5 -0
  436. package/common/utils/offset-cursor.utils.d.ts.map +1 -0
  437. package/common/utils/principal.utils.d.ts +26 -0
  438. package/common/utils/principal.utils.d.ts.map +1 -1
  439. package/common/utils/time-zone.utils.d.ts +3 -0
  440. package/common/utils/time-zone.utils.d.ts.map +1 -0
  441. package/context/frontmcp-context-storage.d.ts +3 -1
  442. package/context/frontmcp-context-storage.d.ts.map +1 -1
  443. package/context/frontmcp-context.d.ts +9 -1
  444. package/context/frontmcp-context.d.ts.map +1 -1
  445. package/direct/client.types.d.ts +8 -0
  446. package/direct/client.types.d.ts.map +1 -1
  447. package/direct/create.d.ts.map +1 -1
  448. package/direct/create.types.d.ts +3 -1
  449. package/direct/create.types.d.ts.map +1 -1
  450. package/direct/direct-events-transport.d.ts +20 -0
  451. package/direct/direct-events-transport.d.ts.map +1 -0
  452. package/direct/direct-server.d.ts +3 -0
  453. package/direct/direct-server.d.ts.map +1 -1
  454. package/direct/direct.types.d.ts +6 -0
  455. package/direct/direct.types.d.ts.map +1 -1
  456. package/duty/cron-schedule.d.ts +51 -0
  457. package/duty/cron-schedule.d.ts.map +1 -0
  458. package/duty/describe-thrown.d.ts +3 -0
  459. package/duty/describe-thrown.d.ts.map +1 -0
  460. package/duty/duty.lifecycle.d.ts +33 -4
  461. package/duty/duty.lifecycle.d.ts.map +1 -1
  462. package/duty/duty.runner.d.ts +49 -31
  463. package/duty/duty.runner.d.ts.map +1 -1
  464. package/duty/lazy-lease-store.d.ts +29 -0
  465. package/duty/lazy-lease-store.d.ts.map +1 -0
  466. package/duty/lease-holder.d.ts +73 -0
  467. package/duty/lease-holder.d.ts.map +1 -0
  468. package/duty/lease-store.d.ts +40 -0
  469. package/duty/lease-store.d.ts.map +1 -0
  470. package/elicitation/helpers/checked-elicit-answer.d.ts +10 -0
  471. package/elicitation/helpers/checked-elicit-answer.d.ts.map +1 -0
  472. package/elicitation/helpers/elicit.helper.d.ts.map +1 -1
  473. package/elicitation/hooks/elicitation.hooks.d.ts +5 -5
  474. package/elicitation/questions/question-subject.d.ts +8 -3
  475. package/elicitation/questions/question-subject.d.ts.map +1 -1
  476. package/elicitation/store/elicitation-encryption.d.ts.map +1 -1
  477. package/elicitation/store/encrypted-elicitation.store.d.ts +2 -2
  478. package/elicitation/store/encrypted-elicitation.store.d.ts.map +1 -1
  479. package/elicitation/store/storage-elicitation.store.d.ts +3 -3
  480. package/elicitation/store/storage-elicitation.store.d.ts.map +1 -1
  481. package/errors/auth-internal.errors.d.ts +1 -1
  482. package/errors/auth-internal.errors.d.ts.map +1 -1
  483. package/errors/duty.errors.d.ts +10 -0
  484. package/errors/duty.errors.d.ts.map +1 -1
  485. package/errors/error-handler.d.ts.map +1 -1
  486. package/errors/event.errors.d.ts +73 -0
  487. package/errors/event.errors.d.ts.map +1 -0
  488. package/errors/index.d.ts +7 -3
  489. package/errors/index.d.ts.map +1 -1
  490. package/errors/mcp.error.d.ts +6 -1
  491. package/errors/mcp.error.d.ts.map +1 -1
  492. package/errors/misconfiguration.d.ts.map +1 -1
  493. package/errors/remote.errors.d.ts +1 -1
  494. package/errors/remote.errors.d.ts.map +1 -1
  495. package/errors/tool-ui.errors.d.ts +13 -0
  496. package/errors/tool-ui.errors.d.ts.map +1 -0
  497. package/errors/worker.errors.d.ts +7 -0
  498. package/errors/worker.errors.d.ts.map +1 -0
  499. package/errors/workflow.errors.d.ts +4 -0
  500. package/errors/workflow.errors.d.ts.map +1 -1
  501. package/esm/index.mjs +52 -47
  502. package/esm/job/tools/index.mjs +3 -2
  503. package/esm/workflow/tools/index.mjs +3 -2
  504. package/esm-loader/app-helpers.d.ts +4 -4
  505. package/esm-loader/app-helpers.d.ts.map +1 -1
  506. package/esm-loader/esm-entries.d.ts +11 -1
  507. package/esm-loader/esm-entries.d.ts.map +1 -1
  508. package/esm-loader/esm-manifest.d.ts +11 -8
  509. package/esm-loader/esm-manifest.d.ts.map +1 -1
  510. package/esm-loader/esm-module-loader.d.ts +6 -1
  511. package/esm-loader/esm-module-loader.d.ts.map +1 -1
  512. package/esm-loader/factories/esm-context-factories.d.ts +6 -3
  513. package/esm-loader/factories/esm-context-factories.d.ts.map +1 -1
  514. package/esm-loader/factories/esm-instance-factories.d.ts +3 -3
  515. package/esm-loader/factories/esm-instance-factories.d.ts.map +1 -1
  516. package/esm-loader/factories/esm-record-builders.d.ts.map +1 -1
  517. package/esm-loader/semver.utils.d.ts +8 -0
  518. package/esm-loader/semver.utils.d.ts.map +1 -1
  519. package/esm-loader/version-resolver.d.ts.map +1 -1
  520. package/event/delivery/event-metrics.d.ts +25 -0
  521. package/event/delivery/event-metrics.d.ts.map +1 -0
  522. package/event/delivery/event-outbox.d.ts +129 -0
  523. package/event/delivery/event-outbox.d.ts.map +1 -0
  524. package/event/event-channel.d.ts +21 -0
  525. package/event/event-channel.d.ts.map +1 -0
  526. package/event/event-dialect.d.ts +20 -0
  527. package/event/event-dialect.d.ts.map +1 -0
  528. package/event/event-gates.d.ts +23 -0
  529. package/event/event-gates.d.ts.map +1 -0
  530. package/event/event-outbound.d.ts +9 -0
  531. package/event/event-outbound.d.ts.map +1 -0
  532. package/event/event-publisher.d.ts +14 -0
  533. package/event/event-publisher.d.ts.map +1 -0
  534. package/event/event-reauthorization.d.ts +35 -0
  535. package/event/event-reauthorization.d.ts.map +1 -0
  536. package/event/event-scope.helper.d.ts +23 -0
  537. package/event/event-scope.helper.d.ts.map +1 -0
  538. package/event/event-subscriber.d.ts +12 -0
  539. package/event/event-subscriber.d.ts.map +1 -0
  540. package/event/event.instance.d.ts +15 -0
  541. package/event/event.instance.d.ts.map +1 -0
  542. package/event/event.registry.d.ts +97 -0
  543. package/event/event.registry.d.ts.map +1 -0
  544. package/event/event.utils.d.ts +6 -0
  545. package/event/event.utils.d.ts.map +1 -0
  546. package/event/flows/event-deliver.flow.d.ts +73 -0
  547. package/event/flows/event-deliver.flow.d.ts.map +1 -0
  548. package/event/flows/event-poll.flow.d.ts +105 -0
  549. package/event/flows/event-poll.flow.d.ts.map +1 -0
  550. package/event/flows/event-publish-http.flow.d.ts +114 -0
  551. package/event/flows/event-publish-http.flow.d.ts.map +1 -0
  552. package/event/flows/event-publish.flow.d.ts +109 -0
  553. package/event/flows/event-publish.flow.d.ts.map +1 -0
  554. package/event/flows/event-stream.flow.d.ts +78 -0
  555. package/event/flows/event-stream.flow.d.ts.map +1 -0
  556. package/event/flows/event-subscribe.flow.d.ts +132 -0
  557. package/event/flows/event-subscribe.flow.d.ts.map +1 -0
  558. package/event/flows/event-unsubscribe.flow.d.ts +71 -0
  559. package/event/flows/event-unsubscribe.flow.d.ts.map +1 -0
  560. package/event/flows/list-events.flow.d.ts +75 -0
  561. package/event/flows/list-events.flow.d.ts.map +1 -0
  562. package/event/index.d.ts +46 -0
  563. package/event/index.d.ts.map +1 -0
  564. package/event/poll/event-buffer.d.ts +54 -0
  565. package/event/poll/event-buffer.d.ts.map +1 -0
  566. package/event/poll/event-poll-leases.d.ts +63 -0
  567. package/event/poll/event-poll-leases.d.ts.map +1 -0
  568. package/event/publish-endpoint/event-publish-endpoint.d.ts +29 -0
  569. package/event/publish-endpoint/event-publish-endpoint.d.ts.map +1 -0
  570. package/event/publish-endpoint/event-publish-idempotency.d.ts +35 -0
  571. package/event/publish-endpoint/event-publish-idempotency.d.ts.map +1 -0
  572. package/event/replay/event-replays.d.ts +116 -0
  573. package/event/replay/event-replays.d.ts.map +1 -0
  574. package/event/stream/event-stream.d.ts +116 -0
  575. package/event/stream/event-stream.d.ts.map +1 -0
  576. package/event/stream/event-streams.d.ts +52 -0
  577. package/event/stream/event-streams.d.ts.map +1 -0
  578. package/event/subscription/event-callback-verifier.d.ts +58 -0
  579. package/event/subscription/event-callback-verifier.d.ts.map +1 -0
  580. package/event/subscription/event-subscription-store.factory.d.ts +31 -0
  581. package/event/subscription/event-subscription-store.factory.d.ts.map +1 -0
  582. package/event/subscription/event-subscription-termination.d.ts +25 -0
  583. package/event/subscription/event-subscription-termination.d.ts.map +1 -0
  584. package/event/subscription/event-subscription.store.d.ts +131 -0
  585. package/event/subscription/event-subscription.store.d.ts.map +1 -0
  586. package/event/subscription/event-subscriptions.d.ts +66 -0
  587. package/event/subscription/event-subscriptions.d.ts.map +1 -0
  588. package/event-client/event-client.errors.d.ts +35 -0
  589. package/event-client/event-client.errors.d.ts.map +1 -0
  590. package/event-client/event-webhook-receiver.d.ts +75 -0
  591. package/event-client/event-webhook-receiver.d.ts.map +1 -0
  592. package/event-client/events-client.d.ts +33 -0
  593. package/event-client/events-client.d.ts.map +1 -0
  594. package/event-client/events-client.types.d.ts +74 -0
  595. package/event-client/events-client.types.d.ts.map +1 -0
  596. package/event-client/index.d.ts +6 -0
  597. package/event-client/index.d.ts.map +1 -0
  598. package/ext-apps/ext-apps.handler.d.ts +2 -1
  599. package/ext-apps/ext-apps.handler.d.ts.map +1 -1
  600. package/flows/flow.http-path.d.ts +8 -0
  601. package/flows/flow.http-path.d.ts.map +1 -1
  602. package/flows/flow.instance.d.ts +9 -0
  603. package/flows/flow.instance.d.ts.map +1 -1
  604. package/front-mcp/authorities-rules.check.d.ts +5 -0
  605. package/front-mcp/authorities-rules.check.d.ts.map +1 -1
  606. package/front-mcp/front-mcp.d.ts +2 -0
  607. package/front-mcp/front-mcp.d.ts.map +1 -1
  608. package/front-mcp/session-secret.check.d.ts +19 -0
  609. package/front-mcp/session-secret.check.d.ts.map +1 -0
  610. package/http-route/http-route.table.d.ts.map +1 -1
  611. package/index.d.ts +74 -4
  612. package/index.d.ts.map +1 -1
  613. package/index.js +59 -54
  614. package/job/execution/job-execution.manager.d.ts +16 -4
  615. package/job/execution/job-execution.manager.d.ts.map +1 -1
  616. package/job/flows/execute-job.flow.d.ts +1 -0
  617. package/job/flows/execute-job.flow.d.ts.map +1 -1
  618. package/job/job-attempt.d.ts +7 -2
  619. package/job/job-attempt.d.ts.map +1 -1
  620. package/job/job-context-providers.d.ts +2 -2
  621. package/job/job-context-providers.d.ts.map +1 -1
  622. package/job/job-scope.helper.d.ts +26 -0
  623. package/job/job-scope.helper.d.ts.map +1 -1
  624. package/job/job.registry.d.ts +11 -0
  625. package/job/job.registry.d.ts.map +1 -1
  626. package/job/store/job-state.interface.d.ts +2 -0
  627. package/job/store/job-state.interface.d.ts.map +1 -1
  628. package/job/store/memory-job-state.store.d.ts +1 -0
  629. package/job/store/memory-job-state.store.d.ts.map +1 -1
  630. package/job/store/redis-job-state.store.d.ts +3 -0
  631. package/job/store/redis-job-state.store.d.ts.map +1 -1
  632. package/job/store/storage-job-state.store.d.ts +1 -0
  633. package/job/store/storage-job-state.store.d.ts.map +1 -1
  634. package/job/tools/index.d.ts +1 -0
  635. package/job/tools/index.d.ts.map +1 -1
  636. package/job/tools/index.js +4 -2
  637. package/job/tools/list-jobs.tool.d.ts +3 -3
  638. package/job/tools/list-jobs.tool.d.ts.map +1 -1
  639. package/job/tools/update-job.tool.d.ts +16 -0
  640. package/job/tools/update-job.tool.d.ts.map +1 -0
  641. package/logger/instances/instance.logger.d.ts +1 -0
  642. package/logger/instances/instance.logger.d.ts.map +1 -1
  643. package/notification/index.d.ts +1 -1
  644. package/notification/index.d.ts.map +1 -1
  645. package/notification/notification.service.d.ts +40 -4
  646. package/notification/notification.service.d.ts.map +1 -1
  647. package/package.json +11 -10
  648. package/prompt/flows/prompts-list.flow.d.ts.map +1 -1
  649. package/provider/create-container.d.ts +14 -4
  650. package/provider/create-container.d.ts.map +1 -1
  651. package/provider/provider.lifecycle.d.ts +11 -1
  652. package/provider/provider.lifecycle.d.ts.map +1 -1
  653. package/provider/provider.registry.d.ts +18 -4
  654. package/provider/provider.registry.d.ts.map +1 -1
  655. package/remote-mcp/factories/instance-factories.d.ts +4 -4
  656. package/remote-mcp/factories/instance-factories.d.ts.map +1 -1
  657. package/remote-mcp/factories/record-builders.d.ts.map +1 -1
  658. package/remote-mcp/mcp-client.service.d.ts +11 -0
  659. package/remote-mcp/mcp-client.service.d.ts.map +1 -1
  660. package/remote-mcp/mcp-client.types.d.ts +15 -2
  661. package/remote-mcp/mcp-client.types.d.ts.map +1 -1
  662. package/remote-mcp/mcp-stateless-client.adapter.d.ts +1 -1
  663. package/remote-mcp/mcp-stateless-client.adapter.d.ts.map +1 -1
  664. package/remote-mcp/remote-entries.d.ts +2 -1
  665. package/remote-mcp/remote-entries.d.ts.map +1 -1
  666. package/remote-mcp/remote-oauth.d.ts +27 -0
  667. package/remote-mcp/remote-oauth.d.ts.map +1 -0
  668. package/remote-mcp/remote-request-headers.d.ts +8 -2
  669. package/remote-mcp/remote-request-headers.d.ts.map +1 -1
  670. package/remote-mcp/resilience/circuit-breaker.d.ts +3 -2
  671. package/remote-mcp/resilience/circuit-breaker.d.ts.map +1 -1
  672. package/resource/flows/read-resource.flow.d.ts.map +1 -1
  673. package/resource/flows/resource-templates-list.flow.d.ts.map +1 -1
  674. package/resource/flows/resources-list.flow.d.ts.map +1 -1
  675. package/scope/event-publisher.providers.d.ts +17 -0
  676. package/scope/event-publisher.providers.d.ts.map +1 -0
  677. package/scope/observability-scope.helper.d.ts.map +1 -1
  678. package/scope/scope.instance.d.ts +41 -2
  679. package/scope/scope.instance.d.ts.map +1 -1
  680. package/shared/shared-attach.d.ts +3 -1
  681. package/shared/shared-attach.d.ts.map +1 -1
  682. package/shared/shared-server.lifecycle.d.ts +14 -5
  683. package/shared/shared-server.lifecycle.d.ts.map +1 -1
  684. package/skill/errors/tool-not-allowed.error.d.ts.map +1 -1
  685. package/skill/flows/load-skill.flow.d.ts.map +1 -1
  686. package/skill/guards/tool-authorization.guard.d.ts +1 -1
  687. package/skill/guards/tool-authorization.guard.d.ts.map +1 -1
  688. package/skill/hooks/skill-tool.hook.d.ts +2 -0
  689. package/skill/hooks/skill-tool.hook.d.ts.map +1 -1
  690. package/skill/providers/external-skill.provider.d.ts +2 -2
  691. package/skill/providers/external-skill.provider.d.ts.map +1 -1
  692. package/skill/session/skill-session-store.interface.d.ts +5 -0
  693. package/skill/session/skill-session-store.interface.d.ts.map +1 -1
  694. package/skill/session/skill-session.manager.d.ts +4 -0
  695. package/skill/session/skill-session.manager.d.ts.map +1 -1
  696. package/skill/session/skill-session.types.d.ts +1 -1
  697. package/skill/skill-authorities.helper.d.ts +6 -3
  698. package/skill/skill-authorities.helper.d.ts.map +1 -1
  699. package/skill/skill-instructions.helper.d.ts +10 -4
  700. package/skill/skill-instructions.helper.d.ts.map +1 -1
  701. package/skill/skill-scope.helper.d.ts +5 -0
  702. package/skill/skill-scope.helper.d.ts.map +1 -1
  703. package/skill/skill.registry.d.ts +7 -0
  704. package/skill/skill.registry.d.ts.map +1 -1
  705. package/subsystems.d.ts +3 -2
  706. package/subsystems.d.ts.map +1 -1
  707. package/surface/entry-authorized.d.ts +5 -0
  708. package/surface/entry-authorized.d.ts.map +1 -0
  709. package/tool/flows/call-tool.flow.d.ts +6 -0
  710. package/tool/flows/call-tool.flow.d.ts.map +1 -1
  711. package/tool/flows/tools-list.flow.d.ts +1 -12
  712. package/tool/flows/tools-list.flow.d.ts.map +1 -1
  713. package/tool/tool.utils.d.ts.map +1 -1
  714. package/tool/ui/serving-mode-default.d.ts +6 -2
  715. package/tool/ui/serving-mode-default.d.ts.map +1 -1
  716. package/tool/ui/ui-option-warnings.d.ts.map +1 -1
  717. package/tool/ui/ui-render.d.ts +2 -2
  718. package/tool/ui/ui-render.d.ts.map +1 -1
  719. package/tool/ui/ui-resource.handler.d.ts +10 -2
  720. package/tool/ui/ui-resource.handler.d.ts.map +1 -1
  721. package/tool/ui/ui-shared.d.ts +31 -5
  722. package/tool/ui/ui-shared.d.ts.map +1 -1
  723. package/tool/ui/widget-routes.d.ts +38 -0
  724. package/tool/ui/widget-routes.d.ts.map +1 -0
  725. package/tool/ui/widget-serving.d.ts +37 -0
  726. package/tool/ui/widget-serving.d.ts.map +1 -0
  727. package/transport/adapters/transport.local.adapter.d.ts.map +1 -1
  728. package/transport/build-scoped-server-options.d.ts.map +1 -1
  729. package/transport/flows/handle.mcp-20260728.flow.d.ts +8 -2
  730. package/transport/flows/handle.mcp-20260728.flow.d.ts.map +1 -1
  731. package/transport/in-memory-server.d.ts.map +1 -1
  732. package/transport/mcp-20260728/client/mcp-stateless.client.d.ts +2 -0
  733. package/transport/mcp-20260728/client/mcp-stateless.client.d.ts.map +1 -1
  734. package/transport/mcp-20260728/discover.d.ts.map +1 -1
  735. package/transport/mcp-20260728/event-stream-response.d.ts +12 -0
  736. package/transport/mcp-20260728/event-stream-response.d.ts.map +1 -0
  737. package/transport/mcp-20260728/index.d.ts +1 -0
  738. package/transport/mcp-20260728/index.d.ts.map +1 -1
  739. package/transport/mcp-20260728/protocol-20260728.constants.d.ts.map +1 -1
  740. package/transport/mcp-20260728/request-validation.d.ts +2 -0
  741. package/transport/mcp-20260728/request-validation.d.ts.map +1 -1
  742. package/transport/mcp-handlers/events-list-request.handler.d.ts +5 -0
  743. package/transport/mcp-handlers/events-list-request.handler.d.ts.map +1 -0
  744. package/transport/mcp-handlers/events-poll-request.handler.d.ts +5 -0
  745. package/transport/mcp-handlers/events-poll-request.handler.d.ts.map +1 -0
  746. package/transport/mcp-handlers/events-stream-request.handler.d.ts +8 -0
  747. package/transport/mcp-handlers/events-stream-request.handler.d.ts.map +1 -0
  748. package/transport/mcp-handlers/events-subscribe-request.handler.d.ts +5 -0
  749. package/transport/mcp-handlers/events-subscribe-request.handler.d.ts.map +1 -0
  750. package/transport/mcp-handlers/events-unsubscribe-request.handler.d.ts +5 -0
  751. package/transport/mcp-handlers/events-unsubscribe-request.handler.d.ts.map +1 -0
  752. package/transport/mcp-handlers/index.d.ts +162 -3
  753. package/transport/mcp-handlers/index.d.ts.map +1 -1
  754. package/transport/mcp-handlers/initialize-request.handler.d.ts.map +1 -1
  755. package/transport/stdio-revision-router.d.ts +2 -0
  756. package/transport/stdio-revision-router.d.ts.map +1 -1
  757. package/transport/web-fetch-handler.d.ts.map +1 -1
  758. package/utils/abort.utils.d.ts +5 -0
  759. package/utils/abort.utils.d.ts.map +1 -1
  760. package/worker/worker.lifecycle.d.ts +63 -0
  761. package/worker/worker.lifecycle.d.ts.map +1 -0
  762. package/worker/worker.supervisor.d.ts +62 -0
  763. package/worker/worker.supervisor.d.ts.map +1 -0
  764. package/workflow/engine/workflow.engine.d.ts +8 -1
  765. package/workflow/engine/workflow.engine.d.ts.map +1 -1
  766. package/workflow/tools/execute-workflow.tool.d.ts.map +1 -1
  767. package/workflow/tools/index.d.ts +1 -0
  768. package/workflow/tools/index.d.ts.map +1 -1
  769. package/workflow/tools/index.js +4 -2
  770. package/workflow/tools/list-workflows.tool.d.ts.map +1 -1
  771. package/workflow/tools/register-workflow.tool.d.ts +2 -1
  772. package/workflow/tools/register-workflow.tool.d.ts.map +1 -1
  773. package/workflow/tools/update-workflow.tool.d.ts +21 -0
  774. package/workflow/tools/update-workflow.tool.d.ts.map +1 -0
  775. package/workflow/trigger/workflow-events.d.ts +22 -0
  776. package/workflow/trigger/workflow-events.d.ts.map +1 -0
  777. package/workflow/trigger/workflow-schedules.d.ts +76 -0
  778. package/workflow/trigger/workflow-schedules.d.ts.map +1 -0
  779. package/workflow/trigger/workflow-triggers.d.ts +49 -0
  780. package/workflow/trigger/workflow-triggers.d.ts.map +1 -0
  781. package/workflow/trigger/workflow-webhook.routes.d.ts +16 -0
  782. package/workflow/trigger/workflow-webhook.routes.d.ts.map +1 -0
  783. package/workflow/trigger/workflow-webhook.signature.d.ts +41 -0
  784. package/workflow/trigger/workflow-webhook.signature.d.ts.map +1 -0
  785. package/workflow/workflow.registry.d.ts +11 -0
  786. package/workflow/workflow.registry.d.ts.map +1 -1
  787. package/workflow/workflow.utils.d.ts +7 -0
  788. package/workflow/workflow.utils.d.ts.map +1 -1
@@ -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;AAED,mEAAmE;AACnE,eAAO,MAAM,iBAAiB,SAAU,CAAC;AACzC,6CAA6C;AAC7C,eAAO,MAAM,oBAAoB,IAAI,CAAC;AACtC,8CAA8C;AAC9C,eAAO,MAAM,4BAA4B,QAAS,CAAC;AACnD,wEAAwE;AACxE,eAAO,MAAM,eAAe,QAAS,CAAC;AAEtC,kGAAkG;AAClG,wBAAgB,WAAW,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAEtD;AAED;;;GAGG;AACH,qBAAa,eAAe;IASd,OAAO,CAAC,QAAQ,CAAC,OAAO;IARpC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAgC;IACvD,oHAAoH;IACpH,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAoC;IAC7D,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAiB;IACxC,OAAO,CAAC,UAAU,CAAC,CAAiC;IACpD,OAAO,CAAC,WAAW,CAAK;IAExB,gFAAgF;gBACnD,OAAO,EAAE,sBAAsB;IAI5D,iCAAiC;IACjC,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED,sHAAsH;IACtH,MAAM,CAAC,YAAY,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO;IASjD,uEAAuE;IACvE,GAAG,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO;IAIpC,iGAAiG;IAC3F,KAAK,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;IAgBrD,2DAA2D;YAC7C,SAAS;IAcvB,+CAA+C;IACzC,KAAK,CAAC,GAAG,SAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IAS5C,0EAA0E;IAC1E,KAAK,IAAI,IAAI;IAOb,0FAA0F;IAC1F,IAAI,IAAI,IAAI;IAMZ,qGAAqG;IACrG,OAAO,CAAC,UAAU;IAKlB,2DAA2D;IAC3D,OAAO,CAAC,iBAAiB;IAIzB,6EAA6E;YAC/D,GAAG;CAQlB"}
@@ -0,0 +1,29 @@
1
+ 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":"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"}
@@ -0,0 +1,116 @@
1
+ import { type EventError } from '@frontmcp/protocol';
2
+ import { type EventContext, type EventEntry, type EventSubscriptionRef, type FrontMcpLogger } from '../../common';
3
+ import { type EventReader } from '../event-gates';
4
+ import { type EventReauthorization } from '../event-reauthorization';
5
+ import { type BufferedEvent, type EventBuffer } from '../poll/event-buffer';
6
+ /** A notification of one stream, as it is sent to the client. */
7
+ export interface EventStreamNotification {
8
+ method: string;
9
+ params: Record<string, unknown>;
10
+ }
11
+ export interface EventStreamOptions {
12
+ /** The JSON-RPC id of the `events/stream` request: every notification carries it. */
13
+ requestId: string | number;
14
+ event: EventEntry;
15
+ context: EventContext;
16
+ reader: EventReader;
17
+ subscription: EventSubscriptionRef;
18
+ arguments: Record<string, unknown>;
19
+ /** The cursor of the request; `null` or none starts from now. */
20
+ cursor: string | null | undefined;
21
+ maxAgeMs: number | undefined;
22
+ /** The published occurrences a cursor replays from; none for an event with `check()`. */
23
+ buffer: EventBuffer | undefined;
24
+ /** `events.push.heartbeatMs`. */
25
+ heartbeatMs: number;
26
+ /** How often `check()` is called when it names no interval of its own. */
27
+ checkIntervalMs: number;
28
+ /** How many events one `check()` is asked for. */
29
+ checkMaxEvents: number;
30
+ /** How often the reader's access is checked again. */
31
+ reauthorizeEveryMs: number;
32
+ /** Check the reader again: its event's `authorities`, then its `authorize()`. */
33
+ reauthorize: () => Promise<EventReauthorization>;
34
+ /** The error a stream whose reader lost access ends with. */
35
+ accessRevoked: EventError;
36
+ /** Ends the stream when the client cancels the request or disconnects. */
37
+ signal: AbortSignal | undefined;
38
+ logger: FrontMcpLogger;
39
+ }
40
+ /** Notifications waiting for a slow client; past it the stream reports a gap instead of growing. */
41
+ export declare const MAX_QUEUED_NOTIFICATIONS = 1000;
42
+ /**
43
+ * One open `events/stream` request: `active` first, then an `event` for each occurrence its reader may receive, a
44
+ * `heartbeat` while it is quiet, and `terminated` when the server ends it. It is consumed as an async iterable.
45
+ */
46
+ export declare class EventStream implements AsyncIterable<EventStreamNotification> {
47
+ private readonly options;
48
+ private readonly queue;
49
+ private readonly closeListeners;
50
+ private wake?;
51
+ private closed;
52
+ private cursor;
53
+ private lastAuthorizedAt;
54
+ /** The last check of the reader's access could not be made: nothing is delivered until one is. */
55
+ private accessUnchecked;
56
+ /** Published events were held back while the access was unchecked. */
57
+ private withheld;
58
+ private heartbeatTimer?;
59
+ private checkTimer?;
60
+ /** Offers are delivered one after the other, in the order they came; behind the replay while the stream opens. */
61
+ private delivering;
62
+ private releaseDelivery;
63
+ /** The buffer sequence of the last occurrence taken: one replayed and offered live too is delivered once. */
64
+ private lastSequence;
65
+ /** Takes the request's options, holds delivery behind a buffer replay, and closes when `signal` aborts. */
66
+ constructor(options: EventStreamOptions);
67
+ /** The subscription this stream stands for. */
68
+ get subscription(): EventSubscriptionRef;
69
+ /** The name of the event the stream carries. */
70
+ get eventName(): string;
71
+ /** The owner's key; undefined for an anonymous reader. */
72
+ get principalKey(): string | undefined;
73
+ /** Whether the stream has ended. */
74
+ get isClosed(): boolean;
75
+ /** Confirm the stream, replay what the cursor asks for, and start the heartbeat and, with `check()`, its loop. */
76
+ open(): Promise<void>;
77
+ /** Deliver a published occurrence, when it is for this stream's reader and arguments, after those offered before. */
78
+ offer(buffered: BufferedEvent): Promise<void>;
79
+ /** End the stream on the server's side: the client gets `terminated` with the reason, then the final frame. */
80
+ terminate(error: EventError): void;
81
+ /** End the stream: stop its timers and let the consumer drain what is queued. */
82
+ close(): void;
83
+ /** Call `listener` once, when the stream ends. */
84
+ onClose(listener: () => void): void;
85
+ /** The notifications of the stream, in order, until it ends. A reader that stops reading ends the stream. */
86
+ [Symbol.asyncIterator](): AsyncIterator<EventStreamNotification>;
87
+ /** The next queued notification, waiting for one while the stream is open. */
88
+ private nextNotification;
89
+ /** Start a stream of published events: from now, or replaying the buffer after the request's cursor. */
90
+ private openOnBuffer;
91
+ /** Deliver one occurrence not taken yet; the cursor moves only on a stream of published events. */
92
+ private deliver;
93
+ /** Start a stream of an event with `check()`: ask it for the position or the backlog, then keep asking. */
94
+ private openOnCheck;
95
+ /** Call the event's `check()` from the stream's cursor; a failure is reported on the stream, which stays open. */
96
+ private check;
97
+ /** Call `check()` again after its interval, for as long as the stream is open. */
98
+ private scheduleCheck;
99
+ /** One turn of the `check()` loop: deliver what it found, report a gap, and schedule the next turn. */
100
+ private runCheck;
101
+ /** Deliver the items a `check()` returned, each validated against the payload schema. */
102
+ private pushChecked;
103
+ /** A published occurrence as this stream's reader receives it; undefined when it is not for it. */
104
+ private occurrenceFor;
105
+ /** The heartbeat: the cursor to persist while nothing happens, and the moment access is checked again. */
106
+ private beat;
107
+ /** Deliver again after a check that could not be made; held-back events are reported as a gap from the cursor. */
108
+ private resumeAfterCheck;
109
+ /** Queue the confirmation of the stream, or of a gap in it, with the cursor delivery continues from. */
110
+ private pushActive;
111
+ /** Queue one occurrence, with the cursor after it. */
112
+ private pushEvent;
113
+ /** Queue a notification tagged with the stream's id; a queue a slow client let fill up is replaced by a gap. */
114
+ private push;
115
+ }
116
+ //# sourceMappingURL=event-stream.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-stream.d.ts","sourceRoot":"","sources":["../../../src/event/stream/event-stream.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,52 @@
1
+ import { type NamespacedStorage } from '@frontmcp/utils';
2
+ import { type FrontMcpLogger } from '../../common';
3
+ import { type BufferedEvent, type EventBuffer } from '../poll/event-buffer';
4
+ import { type EventStream } from './event-stream';
5
+ export interface EventStreamsOptions {
6
+ buffer: EventBuffer;
7
+ /** `events.subscriptions.maxPerPrincipal`: how many streams one caller may hold open. */
8
+ maxPerPrincipal: number;
9
+ /** A storage with pub/sub carries published occurrences to the streams other processes hold. */
10
+ storage?: NamespacedStorage;
11
+ logger: FrontMcpLogger;
12
+ }
13
+ /** The pub/sub channel published occurrences are relayed on. */
14
+ export declare const EVENT_RELAY_CHANNEL = "occurrences";
15
+ /** How many streams one process holds open, for all callers together. */
16
+ export declare const MAX_OPEN_STREAMS = 10000;
17
+ /** The open `events/stream` requests of a server: what is published reaches each stream of its event. */
18
+ export declare class EventStreams {
19
+ private readonly options;
20
+ /** The streams that receive what is published, by event name. */
21
+ private readonly streams;
22
+ /** Every stream counted against the limits, including one still opening. */
23
+ private readonly held;
24
+ private readonly nodeId;
25
+ private readonly logger;
26
+ private stopRelay?;
27
+ /** Takes the buffer, the per-caller limit and the relay storage; draws the id this process relays as. */
28
+ constructor(options: EventStreamsOptions);
29
+ /** Whether occurrences reach the streams of other processes. */
30
+ get isRelayed(): boolean;
31
+ /** How many streams are open or opening. */
32
+ get size(): number;
33
+ /** Listen for the occurrences other processes publish, when the storage can carry them. */
34
+ start(): Promise<void>;
35
+ /** Stop listening and end every open stream. */
36
+ stop(): Promise<void>;
37
+ /** Whether one more stream exceeds what one owner (all anonymous readers are one), or the process, may hold. */
38
+ isFull(principalKey: string | undefined): boolean;
39
+ /** Count a stream against the limits before it opens; false, and nothing counted, when it would exceed one. */
40
+ reserve(stream: EventStream): boolean;
41
+ /** Deliver what is published to a stream, for as long as it is open. */
42
+ add(stream: EventStream): void;
43
+ /** Count a stream until it closes. */
44
+ private hold;
45
+ /** Deliver an occurrence this process published to its streams, and relay it to the other processes. */
46
+ publish(buffered: BufferedEvent): Promise<void>;
47
+ /** Offer an occurrence to every open stream of its event. */
48
+ private deliver;
49
+ /** Take an occurrence another process published: keep it in this process's buffer and deliver it here. */
50
+ private receive;
51
+ }
52
+ //# sourceMappingURL=event-streams.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-streams.d.ts","sourceRoot":"","sources":["../../../src/event/stream/event-streams.ts"],"names":[],"mappings":"AACA,OAAO,EAAc,KAAK,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAErE,OAAO,EAAsB,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AACvE,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAC5E,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,WAAW,CAAC;IACpB,yFAAyF;IACzF,eAAe,EAAE,MAAM,CAAC;IACxB,gGAAgG;IAChG,OAAO,CAAC,EAAE,iBAAiB,CAAC;IAC5B,MAAM,EAAE,cAAc,CAAC;CACxB;AAUD,gEAAgE;AAChE,eAAO,MAAM,mBAAmB,gBAAgB,CAAC;AACjD,yEAAyE;AACzE,eAAO,MAAM,gBAAgB,QAAS,CAAC;AAEvC,yGAAyG;AACzG,qBAAa,YAAY;IAUX,OAAO,CAAC,QAAQ,CAAC,OAAO;IATpC,iEAAiE;IACjE,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAuC;IAC/D,4EAA4E;IAC5E,OAAO,CAAC,QAAQ,CAAC,IAAI,CAA0B;IAC/C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAiB;IACxC,OAAO,CAAC,SAAS,CAAC,CAA6B;IAE/C,yGAAyG;gBAC5E,OAAO,EAAE,mBAAmB;IAKzD,gEAAgE;IAChE,IAAI,SAAS,IAAI,OAAO,CAEvB;IAED,4CAA4C;IAC5C,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED,2FAA2F;IACrF,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAM5B,gDAAgD;IAC1C,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAQ3B,gHAAgH;IAChH,MAAM,CAAC,YAAY,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO;IASjD,+GAA+G;IAC/G,OAAO,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO;IAOrC,wEAAwE;IACxE,GAAG,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI;IAQ9B,sCAAsC;IACtC,OAAO,CAAC,IAAI;IASZ,wGAAwG;IAClG,OAAO,CAAC,QAAQ,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IAarD,6DAA6D;YAC/C,OAAO;IAMrB,0GAA0G;IAC1G,OAAO,CAAC,OAAO;CAMhB"}
@@ -0,0 +1,58 @@
1
+ import { type EventDeliveryErrorCategory } from '@frontmcp/protocol';
2
+ import { type OutboundRequest, type OutboundResult } from '@frontmcp/utils';
3
+ export interface EventCallbackVerifierOptions {
4
+ /** `events.webhook.allowedCallbacks`: URL prefixes accepted without a request. */
5
+ allowedCallbacks: readonly string[];
6
+ /** `events.webhook.unsafeAllowLocalCallbacks`. */
7
+ allowLocal: boolean;
8
+ /** How long a verified `(principal, url)` pair stays verified. */
9
+ cacheTtlMs: number;
10
+ timeoutMs: number;
11
+ /** `events.webhook.verification.maxAttemptsPerHost`. @default VERIFICATION_ATTEMPTS_PER_HOST */
12
+ maxAttemptsPerHost?: number;
13
+ /** Sends a request: the hardened fetch, unless a test replaces it. */
14
+ send?: (request: OutboundRequest) => Promise<OutboundResult>;
15
+ }
16
+ export interface EventCallbackVerificationRequest {
17
+ principalKey: string;
18
+ url: string;
19
+ secret: string;
20
+ subscriptionId: string;
21
+ /** When the stored subscription was last verified, when there is one. */
22
+ verifiedAt?: number | null;
23
+ }
24
+ export type EventCallbackVerification = {
25
+ outcome: 'verified';
26
+ verifiedAt: number;
27
+ } | {
28
+ outcome: 'failed';
29
+ reason: EventDeliveryErrorCategory;
30
+ } | {
31
+ outcome: 'limited';
32
+ max: number;
33
+ };
34
+ /** Verification requests one destination host may receive in each window, unless configured. */
35
+ export declare const VERIFICATION_ATTEMPTS_PER_HOST = 10;
36
+ /**
37
+ * Proves a callback accepts MCP deliveries before a subscription is activated: a configured prefix, a fresh earlier
38
+ * proof for the same owner and URL, the receiver's well-known document, or a signed challenge it must echo.
39
+ */
40
+ export declare class EventCallbackVerifier {
41
+ private readonly options;
42
+ private readonly verifiedPairs;
43
+ private readonly receiversByOrigin;
44
+ private readonly attemptsByHost;
45
+ private readonly send;
46
+ private readonly maxAttemptsPerHost;
47
+ /** Takes the allowed prefixes, cache lifetime, timeout, attempt limit and sender (the hardened request by default). */
48
+ constructor(options: EventCallbackVerifierOptions);
49
+ /** Verify the callback of a subscription, sending at most one well-known request and one challenge. */
50
+ verify(request: EventCallbackVerificationRequest): Promise<EventCallbackVerification>;
51
+ /** Count a verification attempt against its destination host; false once the host's window is full. */
52
+ private takeAttempt;
53
+ /** Whether the callback's origin publishes a well-known document whose path prefixes cover the callback. */
54
+ private isDeclaredReceiver;
55
+ /** Send the signed verification envelope; the failure category, or undefined when the nonce came back. */
56
+ private challenge;
57
+ }
58
+ //# sourceMappingURL=event-callback-verifier.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-callback-verifier.d.ts","sourceRoot":"","sources":["../../../src/event/subscription/event-callback-verifier.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,0BAA0B,EAChC,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAUL,KAAK,eAAe,EACpB,KAAK,cAAc,EACpB,MAAM,iBAAiB,CAAC;AAIzB,MAAM,WAAW,4BAA4B;IAC3C,kFAAkF;IAClF,gBAAgB,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,kDAAkD;IAClD,UAAU,EAAE,OAAO,CAAC;IACpB,kEAAkE;IAClE,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,gGAAgG;IAChG,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,sEAAsE;IACtE,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,eAAe,KAAK,OAAO,CAAC,cAAc,CAAC,CAAC;CAC9D;AAED,MAAM,WAAW,gCAAgC;IAC/C,YAAY,EAAE,MAAM,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,MAAM,CAAC;IACvB,yEAAyE;IACzE,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B;AAED,MAAM,MAAM,yBAAyB,GACjC;IAAE,OAAO,EAAE,UAAU,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,GAC3C;IAAE,OAAO,EAAE,QAAQ,CAAC;IAAC,MAAM,EAAE,0BAA0B,CAAA;CAAE,GACzD;IAAE,OAAO,EAAE,SAAS,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC;AAExC,gGAAgG;AAChG,eAAO,MAAM,8BAA8B,KAAK,CAAC;AA6EjD;;;GAGG;AACH,qBAAa,qBAAqB;IAQpB,OAAO,CAAC,QAAQ,CAAC,OAAO;IAPpC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAA6B;IAC3D,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAA+B;IACjE,OAAO,CAAC,QAAQ,CAAC,cAAc,CAA6B;IAC5D,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAwD;IAC7E,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAS;IAE5C,uHAAuH;gBAC1F,OAAO,EAAE,4BAA4B;IAKlE,uGAAuG;IACjG,MAAM,CAAC,OAAO,EAAE,gCAAgC,GAAG,OAAO,CAAC,yBAAyB,CAAC;IAuB3F,uGAAuG;IACvG,OAAO,CAAC,WAAW;IAWnB,4GAA4G;YAC9F,kBAAkB;IAgBhC,0GAA0G;YAC5F,SAAS;CA2BxB"}
@@ -0,0 +1,31 @@
1
+ import { type RootStorage, type SqliteAdapterOptions } from '@frontmcp/utils';
2
+ import { type FrontMcpLogger, type RedisOptions } from '../../common';
3
+ import { type EventSubscriptionStore } from './event-subscription.store';
4
+ export type EventSubscriptionStoreType = 'memory' | 'redis' | 'sqlite';
5
+ export interface EventSubscriptionStoreOptions {
6
+ /** `events.store.redis`. */
7
+ redis?: RedisOptions;
8
+ /** `events.store.sqlite`. */
9
+ sqlite?: SqliteAdapterOptions;
10
+ /** @default 'mcp:events:' */
11
+ keyPrefix?: string;
12
+ /** Encrypts stored subscriptions. By default `MCP_EVENTS_SECRET`, else `MCP_SESSION_SECRET`, else `MCP_SERVER_SECRET`. */
13
+ secret?: string;
14
+ logger?: FrontMcpLogger;
15
+ }
16
+ export interface EventSubscriptionStoreResult {
17
+ store: EventSubscriptionStore;
18
+ type: EventSubscriptionStoreType;
19
+ /** Whether subscriptions outlive the process: Redis and SQLite do, memory does not. */
20
+ durable: boolean;
21
+ encrypted: boolean;
22
+ /** The storage the store owns; the outbox keeps its records in it too. */
23
+ storage: RootStorage;
24
+ /** The secret records are encrypted with, for the outbox to encrypt its own. Never log it. */
25
+ secret?: string;
26
+ }
27
+ /** Open the storage `events.store` names without a subscription store on it, for a server that keeps none. */
28
+ export declare function openEventStorage(options?: Pick<EventSubscriptionStoreOptions, 'redis' | 'sqlite' | 'keyPrefix'>): Promise<RootStorage>;
29
+ /** Open the subscription store: memory by default, `events.store.redis` or `events.store.sqlite` when configured. */
30
+ export declare function createEventSubscriptionStore(options?: EventSubscriptionStoreOptions): Promise<EventSubscriptionStoreResult>;
31
+ //# sourceMappingURL=event-subscription-store.factory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-subscription-store.factory.d.ts","sourceRoot":"","sources":["../../../src/event/subscription/event-subscription-store.factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,WAAW,EAChB,KAAK,oBAAoB,EAE1B,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAmB,KAAK,cAAc,EAAE,KAAK,YAAY,EAAE,MAAM,cAAc,CAAC;AAEvF,OAAO,EAAiC,KAAK,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAExG,MAAM,MAAM,0BAA0B,GAAG,QAAQ,GAAG,OAAO,GAAG,QAAQ,CAAC;AAEvE,MAAM,WAAW,6BAA6B;IAC5C,4BAA4B;IAC5B,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,6BAA6B;IAC7B,MAAM,CAAC,EAAE,oBAAoB,CAAC;IAC9B,6BAA6B;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,0HAA0H;IAC1H,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,cAAc,CAAC;CACzB;AAED,MAAM,WAAW,4BAA4B;IAC3C,KAAK,EAAE,sBAAsB,CAAC;IAC9B,IAAI,EAAE,0BAA0B,CAAC;IACjC,uFAAuF;IACvF,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,OAAO,CAAC;IACnB,0EAA0E;IAC1E,OAAO,EAAE,WAAW,CAAC;IACrB,8FAA8F;IAC9F,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAgCD,8GAA8G;AAC9G,wBAAgB,gBAAgB,CAC9B,OAAO,GAAE,IAAI,CAAC,6BAA6B,EAAE,OAAO,GAAG,QAAQ,GAAG,WAAW,CAAM,GAClF,OAAO,CAAC,WAAW,CAAC,CAEtB;AAED,qHAAqH;AACrH,wBAAsB,4BAA4B,CAChD,OAAO,GAAE,6BAAkC,GAC1C,OAAO,CAAC,4BAA4B,CAAC,CAuBvC"}
@@ -0,0 +1,25 @@
1
+ import { type FrontMcpLogger } from '../../common';
2
+ import { type EventMetrics } from '../delivery/event-metrics';
3
+ import { type EventOutbox } from '../delivery/event-outbox';
4
+ import { type EventDialect } from '../event-dialect';
5
+ import { type EventSubscriptionRecord } from './event-subscription.store';
6
+ import { type EventSubscriptions } from './event-subscriptions';
7
+ /** The error a terminated subscription's callback is told, in the `terminated` envelope. */
8
+ export interface EventTerminationError {
9
+ code: number;
10
+ message: string;
11
+ data: Record<string, unknown>;
12
+ }
13
+ export interface TerminateEventSubscriptionArgs {
14
+ subscriptions: EventSubscriptions | undefined;
15
+ outbox: Pick<EventOutbox, 'enqueue'> | undefined;
16
+ metrics: EventMetrics | undefined;
17
+ logger: FrontMcpLogger;
18
+ subscription: EventSubscriptionRecord;
19
+ error: EventTerminationError;
20
+ }
21
+ /** The error of a subscription whose owner was refused when checked again, in the codes of its dialect. */
22
+ export declare function accessRevokedError(dialect: EventDialect): EventTerminationError;
23
+ /** End a subscription the server no longer serves: remove it, tell its event, and tell its callback when the dialect does. */
24
+ export declare function terminateEventSubscription(args: TerminateEventSubscriptionArgs): Promise<void>;
25
+ //# sourceMappingURL=event-subscription-termination.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-subscription-termination.d.ts","sourceRoot":"","sources":["../../../src/event/subscription/event-subscription-termination.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAkB,KAAK,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACrE,OAAO,EAAE,KAAK,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAC1E,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAEhE,4FAA4F;AAC5F,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC/B;AAED,MAAM,WAAW,8BAA8B;IAC7C,aAAa,EAAE,kBAAkB,GAAG,SAAS,CAAC;IAC9C,MAAM,EAAE,IAAI,CAAC,WAAW,EAAE,SAAS,CAAC,GAAG,SAAS,CAAC;IACjD,OAAO,EAAE,YAAY,GAAG,SAAS,CAAC;IAClC,MAAM,EAAE,cAAc,CAAC;IACvB,YAAY,EAAE,uBAAuB,CAAC;IACtC,KAAK,EAAE,qBAAqB,CAAC;CAC9B;AAED,2GAA2G;AAC3G,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,YAAY,GAAG,qBAAqB,CAM/E;AAED,8HAA8H;AAC9H,wBAAsB,0BAA0B,CAAC,IAAI,EAAE,8BAA8B,GAAG,OAAO,CAAC,IAAI,CAAC,CAoBpG"}