@frontmcp/sdk 1.11.3 → 1.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (423) hide show
  1. package/answer/answer-meter.d.ts +2 -0
  2. package/answer/answer-meter.d.ts.map +1 -1
  3. package/app/instances/app.esm.instance.d.ts +4 -2
  4. package/app/instances/app.esm.instance.d.ts.map +1 -1
  5. package/app/instances/app.lazy.instance.d.ts.map +1 -1
  6. package/app/lazy/lazy-app.rules.d.ts +4 -0
  7. package/app/lazy/lazy-app.rules.d.ts.map +1 -1
  8. package/browser/answer/answer-meter.mjs +1 -0
  9. package/browser/app/instances/app.esm.instance.mjs +11 -3
  10. package/browser/app/instances/app.lazy.instance.mjs +7 -3
  11. package/browser/app/lazy/lazy-app.rules.mjs +4 -1
  12. package/browser/channel/channel-notification.service.mjs +20 -8
  13. package/browser/channel/channel.instance.mjs +10 -1
  14. package/browser/channel/channel.utils.mjs +22 -1
  15. package/browser/channel/sources/app-event.source.mjs +5 -2
  16. package/browser/channel/sources/file-watcher.source.mjs +66 -0
  17. package/browser/common/decorators/duty.decorator.mjs +3 -4
  18. package/browser/common/decorators/event.decorator.mjs +49 -0
  19. package/browser/common/decorators/index.mjs +2 -0
  20. package/browser/common/decorators/worker.decorator.mjs +23 -0
  21. package/browser/common/entries/event.entry.mjs +59 -0
  22. package/browser/common/entries/index.mjs +1 -0
  23. package/browser/common/index.mjs +7 -7
  24. package/browser/common/interfaces/event.interface.mjs +17 -0
  25. package/browser/common/interfaces/execution-context.interface.mjs +8 -0
  26. package/browser/common/interfaces/index.mjs +2 -0
  27. package/browser/common/interfaces/worker.interface.mjs +0 -0
  28. package/browser/common/metadata/app.metadata.mjs +2 -0
  29. package/browser/common/metadata/duty.metadata.mjs +28 -13
  30. package/browser/common/metadata/duty.resolved.mjs +13 -0
  31. package/browser/common/metadata/event.metadata.mjs +137 -0
  32. package/browser/common/metadata/front-mcp.metadata.mjs +3 -0
  33. package/browser/common/metadata/index.mjs +5 -1
  34. package/browser/common/metadata/worker.metadata.mjs +44 -0
  35. package/browser/common/metadata/worker.resolved.mjs +13 -0
  36. package/browser/common/metadata/workflow.metadata.mjs +7 -1
  37. package/browser/common/records/event.record.mjs +9 -0
  38. package/browser/common/records/index.mjs +1 -0
  39. package/browser/common/schemas/annotated-class.schema.mjs +10 -0
  40. package/browser/common/schemas/index.mjs +1 -1
  41. package/browser/common/tokens/app.tokens.mjs +1 -0
  42. package/browser/common/tokens/event.tokens.mjs +11 -0
  43. package/browser/common/tokens/front-mcp.tokens.mjs +2 -0
  44. package/browser/common/tokens/index.mjs +1 -0
  45. package/browser/common/tokens/workflow.tokens.mjs +1 -0
  46. package/browser/common/utils/offset-cursor.utils.mjs +23 -0
  47. package/browser/common/utils/principal.utils.mjs +1 -1
  48. package/browser/common/utils/time-zone.utils.mjs +12 -0
  49. package/browser/direct/create.mjs +3 -1
  50. package/browser/direct/direct-client.mjs +16 -2
  51. package/browser/direct/direct-events-transport.mjs +47 -0
  52. package/browser/direct/direct-server.mjs +5 -1
  53. package/browser/duty/cron-schedule.mjs +62 -0
  54. package/browser/duty/describe-thrown.mjs +12 -0
  55. package/browser/duty/duty.lifecycle.mjs +102 -97
  56. package/browser/duty/duty.runner.mjs +117 -115
  57. package/browser/duty/lazy-lease-store.mjs +60 -0
  58. package/browser/duty/lease-holder.mjs +132 -0
  59. package/browser/duty/lease-store.mjs +125 -0
  60. package/browser/elicitation/questions/question-subject.mjs +8 -2
  61. package/browser/errors/duty.errors.mjs +20 -0
  62. package/browser/errors/event.errors.mjs +128 -0
  63. package/browser/errors/index.mjs +36 -1
  64. package/browser/errors/worker.errors.mjs +14 -0
  65. package/browser/event/delivery/event-metrics.mjs +37 -0
  66. package/browser/event/delivery/event-outbox.mjs +251 -0
  67. package/browser/event/event-channel.mjs +30 -0
  68. package/browser/event/event-dialect.mjs +23 -0
  69. package/browser/event/event-gates.mjs +72 -0
  70. package/browser/event/event-outbound.mjs +8 -0
  71. package/browser/event/event-publisher.mjs +55 -0
  72. package/browser/event/event-reauthorization.mjs +48 -0
  73. package/browser/event/event-scope.helper.mjs +266 -0
  74. package/browser/event/event-subscriber.mjs +31 -0
  75. package/browser/event/event.instance.mjs +44 -0
  76. package/browser/event/event.registry.mjs +145 -0
  77. package/browser/event/event.utils.mjs +31 -0
  78. package/browser/event/flows/event-deliver.flow.mjs +175 -0
  79. package/browser/event/flows/event-poll.flow.mjs +308 -0
  80. package/browser/event/flows/event-publish-http.flow.mjs +288 -0
  81. package/browser/event/flows/event-publish.flow.mjs +371 -0
  82. package/browser/event/flows/event-stream.flow.mjs +222 -0
  83. package/browser/event/flows/event-subscribe.flow.mjs +351 -0
  84. package/browser/event/flows/event-unsubscribe.flow.mjs +120 -0
  85. package/browser/event/flows/list-events.flow.mjs +145 -0
  86. package/browser/event/index.mjs +104 -0
  87. package/browser/event/poll/event-buffer.mjs +77 -0
  88. package/browser/event/poll/event-poll-leases.mjs +118 -0
  89. package/browser/event/publish-endpoint/event-publish-endpoint.mjs +75 -0
  90. package/browser/event/publish-endpoint/event-publish-idempotency.mjs +54 -0
  91. package/browser/event/replay/event-replays.mjs +298 -0
  92. package/browser/event/stream/event-stream.mjs +279 -0
  93. package/browser/event/stream/event-streams.mjs +122 -0
  94. package/browser/event/subscription/event-callback-verifier.mjs +165 -0
  95. package/browser/event/subscription/event-subscription-store.factory.mjs +59 -0
  96. package/browser/event/subscription/event-subscription-termination.mjs +34 -0
  97. package/browser/event/subscription/event-subscription.store.mjs +167 -0
  98. package/browser/event/subscription/event-subscriptions.mjs +126 -0
  99. package/browser/event-client/event-client.errors.mjs +50 -0
  100. package/browser/event-client/event-webhook-receiver.mjs +155 -0
  101. package/browser/event-client/events-client.mjs +471 -0
  102. package/browser/event-client/index.mjs +28 -0
  103. package/browser/front-mcp/authorities-rules.check.mjs +15 -1
  104. package/browser/front-mcp/front-mcp.mjs +4 -6
  105. package/browser/index.cjs +23640 -16042
  106. package/browser/index.mjs +37 -2
  107. package/browser/job/execution/job-execution.manager.mjs +39 -5
  108. package/browser/job/job-scope.helper.mjs +21 -0
  109. package/browser/job/store/memory-job-state.store.mjs +5 -0
  110. package/browser/job/store/redis-job-state.store.mjs +11 -0
  111. package/browser/job/store/storage-job-state.store.mjs +18 -2
  112. package/browser/notification/notification.service.mjs +36 -6
  113. package/browser/provider/create-container.mjs +20 -9
  114. package/browser/provider/provider.lifecycle.mjs +4 -0
  115. package/browser/provider/provider.registry.mjs +55 -11
  116. package/browser/scope/event-publisher.providers.mjs +32 -0
  117. package/browser/scope/scope.instance.mjs +34 -21
  118. package/browser/skill/skill-instructions.helper.mjs +12 -6
  119. package/browser/subsystems.mjs +3 -0
  120. package/browser/tool/flows/tools-list.flow.mjs +3 -33
  121. package/browser/transport/adapters/transport.local.adapter.mjs +9 -2
  122. package/browser/transport/build-scoped-server-options.mjs +5 -1
  123. package/browser/transport/flows/handle.mcp-20260728.flow.mjs +76 -3
  124. package/browser/transport/in-memory-server.mjs +3 -0
  125. package/browser/transport/mcp-20260728/discover.mjs +1 -0
  126. package/browser/transport/mcp-20260728/event-stream-response.mjs +44 -0
  127. package/browser/transport/mcp-20260728/index.mjs +2 -1
  128. package/browser/transport/mcp-20260728/protocol-20260728.constants.mjs +8 -1
  129. package/browser/transport/mcp-20260728/request-validation.mjs +9 -5
  130. package/browser/transport/mcp-handlers/events-list-request.handler.mjs +23 -0
  131. package/browser/transport/mcp-handlers/events-poll-request.handler.mjs +23 -0
  132. package/browser/transport/mcp-handlers/events-stream-request.handler.mjs +44 -0
  133. package/browser/transport/mcp-handlers/events-subscribe-request.handler.mjs +23 -0
  134. package/browser/transport/mcp-handlers/events-unsubscribe-request.handler.mjs +25 -0
  135. package/browser/transport/mcp-handlers/index.mjs +13 -0
  136. package/browser/transport/mcp-handlers/initialize-request.handler.mjs +3 -1
  137. package/browser/transport/stdio-revision-router.mjs +29 -2
  138. package/browser/worker/worker.lifecycle.mjs +199 -0
  139. package/browser/worker/worker.supervisor.mjs +111 -0
  140. package/browser/workflow/tools/register-workflow.tool.mjs +3 -3
  141. package/browser/workflow/trigger/workflow-events.mjs +3 -1
  142. package/browser/workflow/trigger/workflow-schedules.mjs +173 -0
  143. package/browser/workflow/trigger/workflow-triggers.mjs +31 -0
  144. package/channel/channel-notification.service.d.ts +5 -2
  145. package/channel/channel-notification.service.d.ts.map +1 -1
  146. package/channel/channel-scope.helper.d.ts +4 -1
  147. package/channel/channel-scope.helper.d.ts.map +1 -1
  148. package/channel/channel.instance.d.ts +7 -1
  149. package/channel/channel.instance.d.ts.map +1 -1
  150. package/channel/channel.utils.d.ts +20 -0
  151. package/channel/channel.utils.d.ts.map +1 -1
  152. package/channel/sources/app-event.source.d.ts +11 -2
  153. package/channel/sources/app-event.source.d.ts.map +1 -1
  154. package/channel/sources/file-watcher.source.d.ts +21 -0
  155. package/channel/sources/file-watcher.source.d.ts.map +1 -0
  156. package/channel/sources/index.d.ts +1 -0
  157. package/channel/sources/index.d.ts.map +1 -1
  158. package/common/decorators/duty.decorator.d.ts +3 -2
  159. package/common/decorators/duty.decorator.d.ts.map +1 -1
  160. package/common/decorators/event.decorator.d.ts +38 -0
  161. package/common/decorators/event.decorator.d.ts.map +1 -0
  162. package/common/decorators/index.d.ts +2 -0
  163. package/common/decorators/index.d.ts.map +1 -1
  164. package/common/decorators/worker.decorator.d.ts +13 -0
  165. package/common/decorators/worker.decorator.d.ts.map +1 -0
  166. package/common/entries/event.entry.d.ts +34 -0
  167. package/common/entries/event.entry.d.ts.map +1 -0
  168. package/common/entries/index.d.ts +1 -0
  169. package/common/entries/index.d.ts.map +1 -1
  170. package/common/entries/scope.entry.d.ts +3 -0
  171. package/common/entries/scope.entry.d.ts.map +1 -1
  172. package/common/interfaces/event.interface.d.ts +124 -0
  173. package/common/interfaces/event.interface.d.ts.map +1 -0
  174. package/common/interfaces/execution-context.interface.d.ts +3 -0
  175. package/common/interfaces/execution-context.interface.d.ts.map +1 -1
  176. package/common/interfaces/index.d.ts +2 -0
  177. package/common/interfaces/index.d.ts.map +1 -1
  178. package/common/interfaces/internal/registry.interface.d.ts +3 -1
  179. package/common/interfaces/internal/registry.interface.d.ts.map +1 -1
  180. package/common/interfaces/worker.interface.d.ts +13 -0
  181. package/common/interfaces/worker.interface.d.ts.map +1 -0
  182. package/common/metadata/agent.metadata.d.ts +1 -1
  183. package/common/metadata/app.metadata.d.ts +4 -1
  184. package/common/metadata/app.metadata.d.ts.map +1 -1
  185. package/common/metadata/channel.metadata.d.ts +40 -8
  186. package/common/metadata/channel.metadata.d.ts.map +1 -1
  187. package/common/metadata/duty.metadata.d.ts +67 -13
  188. package/common/metadata/duty.metadata.d.ts.map +1 -1
  189. package/common/metadata/duty.resolved.d.ts +4 -0
  190. package/common/metadata/duty.resolved.d.ts.map +1 -0
  191. package/common/metadata/event.metadata.d.ts +451 -0
  192. package/common/metadata/event.metadata.d.ts.map +1 -0
  193. package/common/metadata/front-mcp.metadata.d.ts +1652 -16
  194. package/common/metadata/front-mcp.metadata.d.ts.map +1 -1
  195. package/common/metadata/index.d.ts +4 -0
  196. package/common/metadata/index.d.ts.map +1 -1
  197. package/common/metadata/job.metadata.d.ts +1 -1
  198. package/common/metadata/prompt.metadata.d.ts +1 -1
  199. package/common/metadata/resource.metadata.d.ts +2 -2
  200. package/common/metadata/skill.metadata.d.ts +1 -1
  201. package/common/metadata/tool.metadata.d.ts +1 -1
  202. package/common/metadata/worker.metadata.d.ts +69 -0
  203. package/common/metadata/worker.metadata.d.ts.map +1 -0
  204. package/common/metadata/worker.resolved.d.ts +4 -0
  205. package/common/metadata/worker.resolved.d.ts.map +1 -0
  206. package/common/metadata/workflow.metadata.d.ts +31 -3
  207. package/common/metadata/workflow.metadata.d.ts.map +1 -1
  208. package/common/records/event.record.d.ts +21 -0
  209. package/common/records/event.record.d.ts.map +1 -0
  210. package/common/records/index.d.ts +1 -0
  211. package/common/records/index.d.ts.map +1 -1
  212. package/common/schemas/annotated-class.schema.d.ts +1 -0
  213. package/common/schemas/annotated-class.schema.d.ts.map +1 -1
  214. package/common/tokens/app.tokens.d.ts.map +1 -1
  215. package/common/tokens/event.tokens.d.ts +9 -0
  216. package/common/tokens/event.tokens.d.ts.map +1 -0
  217. package/common/tokens/front-mcp.tokens.d.ts.map +1 -1
  218. package/common/tokens/index.d.ts +1 -0
  219. package/common/tokens/index.d.ts.map +1 -1
  220. package/common/tokens/workflow.tokens.d.ts +1 -0
  221. package/common/tokens/workflow.tokens.d.ts.map +1 -1
  222. package/common/utils/offset-cursor.utils.d.ts +5 -0
  223. package/common/utils/offset-cursor.utils.d.ts.map +1 -0
  224. package/common/utils/principal.utils.d.ts +11 -9
  225. package/common/utils/principal.utils.d.ts.map +1 -1
  226. package/common/utils/time-zone.utils.d.ts +3 -0
  227. package/common/utils/time-zone.utils.d.ts.map +1 -0
  228. package/direct/client.types.d.ts +8 -0
  229. package/direct/client.types.d.ts.map +1 -1
  230. package/direct/create.d.ts.map +1 -1
  231. package/direct/create.types.d.ts +3 -1
  232. package/direct/create.types.d.ts.map +1 -1
  233. package/direct/direct-events-transport.d.ts +20 -0
  234. package/direct/direct-events-transport.d.ts.map +1 -0
  235. package/direct/direct-server.d.ts +3 -0
  236. package/direct/direct-server.d.ts.map +1 -1
  237. package/direct/direct.types.d.ts +6 -0
  238. package/direct/direct.types.d.ts.map +1 -1
  239. package/duty/cron-schedule.d.ts +51 -0
  240. package/duty/cron-schedule.d.ts.map +1 -0
  241. package/duty/describe-thrown.d.ts +3 -0
  242. package/duty/describe-thrown.d.ts.map +1 -0
  243. package/duty/duty.lifecycle.d.ts +33 -4
  244. package/duty/duty.lifecycle.d.ts.map +1 -1
  245. package/duty/duty.runner.d.ts +49 -31
  246. package/duty/duty.runner.d.ts.map +1 -1
  247. package/duty/lazy-lease-store.d.ts +29 -0
  248. package/duty/lazy-lease-store.d.ts.map +1 -0
  249. package/duty/lease-holder.d.ts +73 -0
  250. package/duty/lease-holder.d.ts.map +1 -0
  251. package/duty/lease-store.d.ts +40 -0
  252. package/duty/lease-store.d.ts.map +1 -0
  253. package/elicitation/hooks/elicitation.hooks.d.ts +5 -5
  254. package/elicitation/questions/question-subject.d.ts +8 -3
  255. package/elicitation/questions/question-subject.d.ts.map +1 -1
  256. package/errors/duty.errors.d.ts +10 -0
  257. package/errors/duty.errors.d.ts.map +1 -1
  258. package/errors/event.errors.d.ts +73 -0
  259. package/errors/event.errors.d.ts.map +1 -0
  260. package/errors/index.d.ts +4 -1
  261. package/errors/index.d.ts.map +1 -1
  262. package/errors/worker.errors.d.ts +7 -0
  263. package/errors/worker.errors.d.ts.map +1 -0
  264. package/esm/index.mjs +38 -34
  265. package/event/delivery/event-metrics.d.ts +25 -0
  266. package/event/delivery/event-metrics.d.ts.map +1 -0
  267. package/event/delivery/event-outbox.d.ts +129 -0
  268. package/event/delivery/event-outbox.d.ts.map +1 -0
  269. package/event/event-channel.d.ts +21 -0
  270. package/event/event-channel.d.ts.map +1 -0
  271. package/event/event-dialect.d.ts +20 -0
  272. package/event/event-dialect.d.ts.map +1 -0
  273. package/event/event-gates.d.ts +23 -0
  274. package/event/event-gates.d.ts.map +1 -0
  275. package/event/event-outbound.d.ts +9 -0
  276. package/event/event-outbound.d.ts.map +1 -0
  277. package/event/event-publisher.d.ts +14 -0
  278. package/event/event-publisher.d.ts.map +1 -0
  279. package/event/event-reauthorization.d.ts +35 -0
  280. package/event/event-reauthorization.d.ts.map +1 -0
  281. package/event/event-scope.helper.d.ts +23 -0
  282. package/event/event-scope.helper.d.ts.map +1 -0
  283. package/event/event-subscriber.d.ts +12 -0
  284. package/event/event-subscriber.d.ts.map +1 -0
  285. package/event/event.instance.d.ts +15 -0
  286. package/event/event.instance.d.ts.map +1 -0
  287. package/event/event.registry.d.ts +97 -0
  288. package/event/event.registry.d.ts.map +1 -0
  289. package/event/event.utils.d.ts +6 -0
  290. package/event/event.utils.d.ts.map +1 -0
  291. package/event/flows/event-deliver.flow.d.ts +73 -0
  292. package/event/flows/event-deliver.flow.d.ts.map +1 -0
  293. package/event/flows/event-poll.flow.d.ts +105 -0
  294. package/event/flows/event-poll.flow.d.ts.map +1 -0
  295. package/event/flows/event-publish-http.flow.d.ts +114 -0
  296. package/event/flows/event-publish-http.flow.d.ts.map +1 -0
  297. package/event/flows/event-publish.flow.d.ts +109 -0
  298. package/event/flows/event-publish.flow.d.ts.map +1 -0
  299. package/event/flows/event-stream.flow.d.ts +78 -0
  300. package/event/flows/event-stream.flow.d.ts.map +1 -0
  301. package/event/flows/event-subscribe.flow.d.ts +132 -0
  302. package/event/flows/event-subscribe.flow.d.ts.map +1 -0
  303. package/event/flows/event-unsubscribe.flow.d.ts +71 -0
  304. package/event/flows/event-unsubscribe.flow.d.ts.map +1 -0
  305. package/event/flows/list-events.flow.d.ts +75 -0
  306. package/event/flows/list-events.flow.d.ts.map +1 -0
  307. package/event/index.d.ts +46 -0
  308. package/event/index.d.ts.map +1 -0
  309. package/event/poll/event-buffer.d.ts +54 -0
  310. package/event/poll/event-buffer.d.ts.map +1 -0
  311. package/event/poll/event-poll-leases.d.ts +63 -0
  312. package/event/poll/event-poll-leases.d.ts.map +1 -0
  313. package/event/publish-endpoint/event-publish-endpoint.d.ts +29 -0
  314. package/event/publish-endpoint/event-publish-endpoint.d.ts.map +1 -0
  315. package/event/publish-endpoint/event-publish-idempotency.d.ts +35 -0
  316. package/event/publish-endpoint/event-publish-idempotency.d.ts.map +1 -0
  317. package/event/replay/event-replays.d.ts +116 -0
  318. package/event/replay/event-replays.d.ts.map +1 -0
  319. package/event/stream/event-stream.d.ts +116 -0
  320. package/event/stream/event-stream.d.ts.map +1 -0
  321. package/event/stream/event-streams.d.ts +52 -0
  322. package/event/stream/event-streams.d.ts.map +1 -0
  323. package/event/subscription/event-callback-verifier.d.ts +58 -0
  324. package/event/subscription/event-callback-verifier.d.ts.map +1 -0
  325. package/event/subscription/event-subscription-store.factory.d.ts +31 -0
  326. package/event/subscription/event-subscription-store.factory.d.ts.map +1 -0
  327. package/event/subscription/event-subscription-termination.d.ts +25 -0
  328. package/event/subscription/event-subscription-termination.d.ts.map +1 -0
  329. package/event/subscription/event-subscription.store.d.ts +131 -0
  330. package/event/subscription/event-subscription.store.d.ts.map +1 -0
  331. package/event/subscription/event-subscriptions.d.ts +66 -0
  332. package/event/subscription/event-subscriptions.d.ts.map +1 -0
  333. package/event-client/event-client.errors.d.ts +35 -0
  334. package/event-client/event-client.errors.d.ts.map +1 -0
  335. package/event-client/event-webhook-receiver.d.ts +75 -0
  336. package/event-client/event-webhook-receiver.d.ts.map +1 -0
  337. package/event-client/events-client.d.ts +33 -0
  338. package/event-client/events-client.d.ts.map +1 -0
  339. package/event-client/events-client.types.d.ts +74 -0
  340. package/event-client/events-client.types.d.ts.map +1 -0
  341. package/event-client/index.d.ts +6 -0
  342. package/event-client/index.d.ts.map +1 -0
  343. package/front-mcp/authorities-rules.check.d.ts +5 -0
  344. package/front-mcp/authorities-rules.check.d.ts.map +1 -1
  345. package/front-mcp/front-mcp.d.ts.map +1 -1
  346. package/index.d.ts +70 -0
  347. package/index.d.ts.map +1 -1
  348. package/index.js +46 -42
  349. package/job/execution/job-execution.manager.d.ts +7 -0
  350. package/job/execution/job-execution.manager.d.ts.map +1 -1
  351. package/job/job-scope.helper.d.ts.map +1 -1
  352. package/job/store/job-state.interface.d.ts +2 -0
  353. package/job/store/job-state.interface.d.ts.map +1 -1
  354. package/job/store/memory-job-state.store.d.ts +1 -0
  355. package/job/store/memory-job-state.store.d.ts.map +1 -1
  356. package/job/store/redis-job-state.store.d.ts +3 -0
  357. package/job/store/redis-job-state.store.d.ts.map +1 -1
  358. package/job/store/storage-job-state.store.d.ts +1 -0
  359. package/job/store/storage-job-state.store.d.ts.map +1 -1
  360. package/notification/index.d.ts +1 -1
  361. package/notification/index.d.ts.map +1 -1
  362. package/notification/notification.service.d.ts +31 -2
  363. package/notification/notification.service.d.ts.map +1 -1
  364. package/package.json +11 -10
  365. package/provider/create-container.d.ts +14 -4
  366. package/provider/create-container.d.ts.map +1 -1
  367. package/provider/provider.lifecycle.d.ts +11 -1
  368. package/provider/provider.lifecycle.d.ts.map +1 -1
  369. package/provider/provider.registry.d.ts +18 -4
  370. package/provider/provider.registry.d.ts.map +1 -1
  371. package/scope/event-publisher.providers.d.ts +17 -0
  372. package/scope/event-publisher.providers.d.ts.map +1 -0
  373. package/scope/scope.instance.d.ts +6 -1
  374. package/scope/scope.instance.d.ts.map +1 -1
  375. package/shared/shared-attach.d.ts +3 -1
  376. package/shared/shared-attach.d.ts.map +1 -1
  377. package/shared/shared-server.lifecycle.d.ts +14 -5
  378. package/shared/shared-server.lifecycle.d.ts.map +1 -1
  379. package/skill/skill-instructions.helper.d.ts +10 -4
  380. package/skill/skill-instructions.helper.d.ts.map +1 -1
  381. package/subsystems.d.ts +1 -0
  382. package/subsystems.d.ts.map +1 -1
  383. package/tool/flows/tools-list.flow.d.ts +0 -11
  384. package/tool/flows/tools-list.flow.d.ts.map +1 -1
  385. package/transport/adapters/transport.local.adapter.d.ts.map +1 -1
  386. package/transport/build-scoped-server-options.d.ts.map +1 -1
  387. package/transport/flows/handle.mcp-20260728.flow.d.ts +8 -2
  388. package/transport/flows/handle.mcp-20260728.flow.d.ts.map +1 -1
  389. package/transport/in-memory-server.d.ts.map +1 -1
  390. package/transport/mcp-20260728/discover.d.ts.map +1 -1
  391. package/transport/mcp-20260728/event-stream-response.d.ts +12 -0
  392. package/transport/mcp-20260728/event-stream-response.d.ts.map +1 -0
  393. package/transport/mcp-20260728/index.d.ts +1 -0
  394. package/transport/mcp-20260728/index.d.ts.map +1 -1
  395. package/transport/mcp-20260728/protocol-20260728.constants.d.ts.map +1 -1
  396. package/transport/mcp-20260728/request-validation.d.ts +2 -0
  397. package/transport/mcp-20260728/request-validation.d.ts.map +1 -1
  398. package/transport/mcp-handlers/events-list-request.handler.d.ts +5 -0
  399. package/transport/mcp-handlers/events-list-request.handler.d.ts.map +1 -0
  400. package/transport/mcp-handlers/events-poll-request.handler.d.ts +5 -0
  401. package/transport/mcp-handlers/events-poll-request.handler.d.ts.map +1 -0
  402. package/transport/mcp-handlers/events-stream-request.handler.d.ts +8 -0
  403. package/transport/mcp-handlers/events-stream-request.handler.d.ts.map +1 -0
  404. package/transport/mcp-handlers/events-subscribe-request.handler.d.ts +5 -0
  405. package/transport/mcp-handlers/events-subscribe-request.handler.d.ts.map +1 -0
  406. package/transport/mcp-handlers/events-unsubscribe-request.handler.d.ts +5 -0
  407. package/transport/mcp-handlers/events-unsubscribe-request.handler.d.ts.map +1 -0
  408. package/transport/mcp-handlers/index.d.ts +162 -3
  409. package/transport/mcp-handlers/index.d.ts.map +1 -1
  410. package/transport/mcp-handlers/initialize-request.handler.d.ts.map +1 -1
  411. package/transport/stdio-revision-router.d.ts +2 -0
  412. package/transport/stdio-revision-router.d.ts.map +1 -1
  413. package/worker/worker.lifecycle.d.ts +63 -0
  414. package/worker/worker.lifecycle.d.ts.map +1 -0
  415. package/worker/worker.supervisor.d.ts +62 -0
  416. package/worker/worker.supervisor.d.ts.map +1 -0
  417. package/workflow/tools/register-workflow.tool.d.ts +2 -1
  418. package/workflow/tools/register-workflow.tool.d.ts.map +1 -1
  419. package/workflow/trigger/workflow-events.d.ts.map +1 -1
  420. package/workflow/trigger/workflow-schedules.d.ts +76 -0
  421. package/workflow/trigger/workflow-schedules.d.ts.map +1 -0
  422. package/workflow/trigger/workflow-triggers.d.ts +16 -1
  423. package/workflow/trigger/workflow-triggers.d.ts.map +1 -1
@@ -0,0 +1,25 @@
1
+ import type { MetricsOptionsInterface } from '../../common/types/options/metrics';
2
+ /** The `/metrics` counters of event publishing and delivery, labelled `event`. */
3
+ export declare const EVENT_COUNTERS: {
4
+ readonly published: "frontmcp_events_published_total";
5
+ readonly matched: "frontmcp_events_matched_total";
6
+ readonly delivered: "frontmcp_events_delivered_total";
7
+ readonly retried: "frontmcp_events_retried_total";
8
+ readonly abandoned: "frontmcp_events_abandoned_total";
9
+ readonly dropped: "frontmcp_events_dropped_total";
10
+ readonly suspended: "frontmcp_events_suspended_total";
11
+ readonly terminated: "frontmcp_events_terminated_total";
12
+ readonly notified: "frontmcp_events_channel_notified_total";
13
+ };
14
+ export type EventCounter = keyof typeof EVENT_COUNTERS;
15
+ type CounterFactory = (name: string, description?: string) => {
16
+ inc(by?: number, attributes?: Record<string, string>): void;
17
+ };
18
+ /** Counts what happens to published events. */
19
+ export interface EventMetrics {
20
+ count(counter: EventCounter, eventName: string, by?: number): void;
21
+ }
22
+ /** The event counters of a server: recorded when `/metrics` is on, otherwise ignored. */
23
+ export declare function createEventMetrics(metrics: Pick<MetricsOptionsInterface, 'enabled'> | undefined, loadFactory?: () => CounterFactory): EventMetrics;
24
+ export {};
25
+ //# sourceMappingURL=event-metrics.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-metrics.d.ts","sourceRoot":"","sources":["../../../src/event/delivery/event-metrics.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAElF,kFAAkF;AAClF,eAAO,MAAM,cAAc;;;;;;;;;;CAUjB,CAAC;AAEX,MAAM,MAAM,YAAY,GAAG,MAAM,OAAO,cAAc,CAAC;AAevD,KAAK,cAAc,GAAG,CACpB,IAAI,EAAE,MAAM,EACZ,WAAW,CAAC,EAAE,MAAM,KACjB;IAAE,GAAG,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAAA;CAAE,CAAC;AAErE,+CAA+C;AAC/C,MAAM,WAAW,YAAY;IAC3B,KAAK,CAAC,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACpE;AAED,yFAAyF;AACzF,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,IAAI,CAAC,uBAAuB,EAAE,SAAS,CAAC,GAAG,SAAS,EAC7D,WAAW,GAAE,MAAM,cAAmC,GACrD,YAAY,CAQd"}
@@ -0,0 +1,129 @@
1
+ import type { EventDeliveryErrorCategory } from '@frontmcp/protocol';
2
+ import { type NamespacedStorage } from '@frontmcp/utils';
3
+ import { type FrontMcpLogger } from '../../common';
4
+ import { type EventsConfig } from '../../common/metadata/event.metadata';
5
+ import { type EventMetrics } from './event-metrics';
6
+ /** What a delivery carries: an occurrence of an event, or an envelope: the subscription ended, or events were skipped. */
7
+ export type EventDeliveryKind = 'event' | 'terminated' | 'gap';
8
+ /** The callback and secrets of a delivery whose subscription is no longer stored. */
9
+ export interface EventDeliveryTarget {
10
+ url: string;
11
+ secret: string;
12
+ previousSecret?: string;
13
+ previousSecretUntil?: number;
14
+ }
15
+ export interface EventDeliveryRecord {
16
+ id: string;
17
+ kind: EventDeliveryKind;
18
+ subscriptionId: string;
19
+ eventName: string;
20
+ /** The body, serialized once: these exact bytes are signed and sent on every attempt. */
21
+ body: string;
22
+ /** The `webhook-id`, the same on every attempt. */
23
+ webhookId: string;
24
+ /** How many attempts were made. */
25
+ attempt: number;
26
+ nextAttemptAt: number;
27
+ firstAttemptAt: number;
28
+ /** The process that holds the delivery until `leaseUntil`. */
29
+ leaseOwner: string;
30
+ leaseUntil: number;
31
+ /** Set for a `terminated` envelope, whose subscription was removed before it is sent. */
32
+ target?: EventDeliveryTarget;
33
+ }
34
+ /** What `enqueue` takes: the outbox adds the id, the attempt count, the times and the lease. */
35
+ export type NewEventDelivery = Pick<EventDeliveryRecord, 'kind' | 'subscriptionId' | 'eventName' | 'body' | 'webhookId' | 'target'>;
36
+ export type EventDeliveryOutcome = {
37
+ result: 'delivered';
38
+ } | {
39
+ result: 'dropped';
40
+ reason: 'gone' | 'refused';
41
+ } | {
42
+ result: 'failed';
43
+ category: EventDeliveryErrorCategory;
44
+ } | {
45
+ result: 'waiting';
46
+ };
47
+ export interface EventOutboxOptions {
48
+ /** The storage of the subscription store: the outbox keeps its records under `outbox:`. */
49
+ storage: NamespacedStorage;
50
+ /** Encrypts each record, as the subscription store does. */
51
+ secret?: string;
52
+ /** Whether the storage outlives the process: only then can another process finish a delivery. */
53
+ durable: boolean;
54
+ settings: EventsConfig['webhook']['delivery'];
55
+ /** Makes one attempt of a delivery. */
56
+ attempt: (delivery: EventDeliveryRecord) => Promise<EventDeliveryOutcome>;
57
+ metrics: EventMetrics;
58
+ logger: FrontMcpLogger;
59
+ /** @default Math.random */
60
+ random?: () => number;
61
+ }
62
+ /** How often deliveries another process left behind are looked for. */
63
+ export declare const OUTBOX_SWEEP_INTERVAL_MS = 30000;
64
+ /**
65
+ * The handoff from publishing to delivery, at least once: each pending delivery is a stored record that the process
66
+ * holding its lease attempts until it completes or is abandoned, and that another process takes over when the lease
67
+ * expires.
68
+ */
69
+ export declare class EventOutbox {
70
+ private readonly options;
71
+ private readonly ownerId;
72
+ private readonly logger;
73
+ private readonly random;
74
+ private readonly usesTimers;
75
+ private readonly timers;
76
+ private readonly inFlight;
77
+ private readonly waitingForSlot;
78
+ private activeAttempts;
79
+ private sweepTimer?;
80
+ private lastSweepAt;
81
+ private stopped;
82
+ /** Takes the storage, the delivery settings and the function that makes one attempt. */
83
+ constructor(options: EventOutboxOptions);
84
+ /** Store a delivery and attempt it: on a timer in a long-lived process, before returning elsewhere. Gives its id. */
85
+ enqueue(delivery: NewEventDelivery): Promise<string>;
86
+ /** Whether a delivery is still stored: neither acknowledged, dropped nor abandoned yet. */
87
+ isPending(deliveryId: string): Promise<boolean>;
88
+ /** Look for deliveries on a timer, where the process is long-lived and the storage is shared. */
89
+ start(): void;
90
+ /** Sweep when the last sweep is old enough: how retries and left-behind deliveries run without timers. */
91
+ sweepIfDue(now?: number): Promise<void>;
92
+ /** Take the deliveries nobody holds: those whose lease expired, and this process's own that no timer runs. */
93
+ sweep(now?: number): Promise<void>;
94
+ /** How many deliveries are stored, waiting for an attempt. */
95
+ depth(): Promise<number>;
96
+ /** Stop the timers, wait for the attempts in flight, and leave unfinished deliveries for the next process to take. */
97
+ stop(): Promise<void>;
98
+ /** Give up the leases this process holds, so another process takes its deliveries without waiting for them to expire. */
99
+ private releaseLeases;
100
+ /** Run a delivery after `delayMs`, on a timer that does not keep the process alive. */
101
+ private schedule;
102
+ /** Make one attempt of a delivery, within the concurrency limit; a failure of the outbox itself is logged. */
103
+ private run;
104
+ /** Take a slot or wait to be handed one, make the attempt, then hand the slot to the next waiter or free it. */
105
+ private attemptWithinLimit;
106
+ /** Renew the lease, attempt the delivery and act on its outcome. */
107
+ private attemptOnce;
108
+ /** The outcome of one attempt; an attempt that throws counts as a failed one, so the delivery is not left behind. */
109
+ private outcomeOf;
110
+ /** Keep a delivery for a later attempt, or give it up when its attempts or its retry window are used. */
111
+ private retryOrAbandon;
112
+ /** The wait before the next attempt: it doubles with each attempt up to the maximum, less a random part of half. */
113
+ private backoffMs;
114
+ /** When a lease taken for an attempt at `attemptAt` ends: after the attempt can no longer be running. */
115
+ private leaseEnd;
116
+ /** Take a delivery whose lease expired, or that this process already holds; undefined when another holds it. */
117
+ private claim;
118
+ /** Replace a stored delivery only when it is still the one that was read. */
119
+ private replace;
120
+ /** The stored delivery with the exact value a compare-and-set needs; undefined when it is gone or unreadable. */
121
+ private read;
122
+ /** The record as stored: encrypted when the outbox has a secret. */
123
+ private encode;
124
+ /** The record a stored value holds; undefined for one that cannot be read or belongs to another id. */
125
+ private decode;
126
+ /** Run a sweep nobody waits for; its failure is logged. */
127
+ private sweepInBackground;
128
+ }
129
+ //# sourceMappingURL=event-outbox.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-outbox.d.ts","sourceRoot":"","sources":["../../../src/event/delivery/event-outbox.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AACrE,OAAO,EAA+C,KAAK,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEtG,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,KAAK,YAAY,EAAE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AAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAIrD,iGAAiG;IACjG,KAAK,IAAI,IAAI;IAOb,0GAA0G;IACpG,UAAU,CAAC,GAAG,SAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IAKjD,8GAA8G;IACxG,KAAK,CAAC,GAAG,SAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IAmB5C,8DAA8D;IACxD,KAAK,IAAI,OAAO,CAAC,MAAM,CAAC;IAI9B,sHAAsH;IAChH,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAY3B,yHAAyH;YAC3G,aAAa;IAU3B,uFAAuF;IACvF,OAAO,CAAC,QAAQ;IAUhB,8GAA8G;IAC9G,OAAO,CAAC,GAAG;IAUX,gHAAgH;YAClG,kBAAkB;IAehC,oEAAoE;YACtD,WAAW;IAgBzB,qHAAqH;YACvG,SAAS;IASvB,yGAAyG;YAC3F,cAAc;IAyB5B,oHAAoH;IACpH,OAAO,CAAC,SAAS;IAMjB,yGAAyG;IACzG,OAAO,CAAC,QAAQ;IAIhB,gHAAgH;YAClG,KAAK;IASnB,6EAA6E;YAC/D,OAAO;IAMrB,iHAAiH;YACnG,IAAI;IAOlB,oEAAoE;YACtD,MAAM;IAMpB,uGAAuG;YACzF,MAAM;IAapB,2DAA2D;IAC3D,OAAO,CAAC,iBAAiB;CAG1B"}
@@ -0,0 +1,21 @@
1
+ import { type EventOccurrence } from '@frontmcp/protocol';
2
+ import { type EventEntry, type ScopeEntry } from '../common';
3
+ import { type RegisteredServer } from '../notification/notification.service';
4
+ import { type EventReader } from './event-gates';
5
+ /** One occurrence as a Claude Code session gets it: the text and the attributes of a `<channel>` tag. */
6
+ export type EventChannelMessage = {
7
+ content: string;
8
+ meta: Record<string, string>;
9
+ };
10
+ /**
11
+ * The channel message of an occurrence of an event with `channel`: the event's `content`, or the payload as JSON,
12
+ * and the event's `meta` under `event` (its name) and `event_id`.
13
+ */
14
+ export declare function eventChannelMessage(event: EventEntry, occurrence: EventOccurrence): EventChannelMessage;
15
+ /**
16
+ * Who a channel capable session reads an event as: the caller of its latest request, or an anonymous one. Undefined
17
+ * when that caller's credentials have expired, the event is not offered to MCP clients, or the server lets no
18
+ * anonymous caller read events.
19
+ */
20
+ export declare function channelSessionReader(scope: ScopeEntry, event: EventEntry, session: Pick<RegisteredServer, 'caller'>): EventReader | undefined;
21
+ //# sourceMappingURL=event-channel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-channel.d.ts","sourceRoot":"","sources":["../../src/event/event-channel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAG1D,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,UAAU,EAAE,MAAM,WAAW,CAAC;AAG7D,OAAO,EAAoB,KAAK,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAG/F,OAAO,EAAiB,KAAK,WAAW,EAAE,MAAM,eAAe,CAAC;AAEhE,yGAAyG;AACzG,MAAM,MAAM,mBAAmB,GAAG;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC9B,CAAC;AAEF;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,eAAe,GAAG,mBAAmB,CAOvG;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,UAAU,EACjB,KAAK,EAAE,UAAU,EACjB,OAAO,EAAE,IAAI,CAAC,gBAAgB,EAAE,QAAQ,CAAC,GACxC,WAAW,GAAG,SAAS,CASzB"}
@@ -0,0 +1,20 @@
1
+ import type { AIPlatformType } from '@frontmcp/auth';
2
+ import { type AuthInfo } from '@frontmcp/protocol';
3
+ import { type ScopeEntry } from '../common';
4
+ import { type EventsCompat } from '../common/metadata/event.metadata';
5
+ import { type EventErrorCodes } from '../errors';
6
+ /** The revision of the events protocol a caller speaks: SEP-3415, or the design sketch ChatGPT implements. */
7
+ export type EventDialect = 'sep-3415' | 'sketch';
8
+ export interface EventDialectRules {
9
+ errorCodes: EventErrorCodes;
10
+ /** The `webhook-id` of an event delivery: the event's id, or an id the server makes for each message. */
11
+ webhookId: 'eventId' | 'message';
12
+ /** Whether `gap` and `terminated` envelopes are sent. The `verification` envelope always is. */
13
+ sendsControlEnvelopes: boolean;
14
+ }
15
+ export declare const EVENT_DIALECTS: Readonly<Record<EventDialect, EventDialectRules>>;
16
+ /** The caller's detected platform: from its session id, else this request, else its `initialize` client info. */
17
+ export declare function callerPlatformOf(scope: ScopeEntry, authInfo: Partial<AuthInfo>, requestPlatform: AIPlatformType | undefined): AIPlatformType;
18
+ /** The dialect a caller is answered in: `events.compat`, or under `auto` the sketch for OpenAI and SEP-3415 otherwise. */
19
+ export declare function resolveEventDialect(compat: EventsCompat, platform: AIPlatformType): EventDialect;
20
+ //# sourceMappingURL=event-dialect.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-dialect.d.ts","sourceRoot":"","sources":["../../src/event/event-dialect.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAiD,KAAK,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAElG,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,WAAW,CAAC;AAEjD,8GAA8G;AAC9G,MAAM,MAAM,YAAY,GAAG,UAAU,GAAG,QAAQ,CAAC;AAEjD,MAAM,WAAW,iBAAiB;IAChC,UAAU,EAAE,eAAe,CAAC;IAC5B,yGAAyG;IACzG,SAAS,EAAE,SAAS,GAAG,SAAS,CAAC;IACjC,gGAAgG;IAChG,qBAAqB,EAAE,OAAO,CAAC;CAChC;AAED,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,MAAM,CAAC,YAAY,EAAE,iBAAiB,CAAC,CAG5E,CAAC;AAOF,iHAAiH;AACjH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,UAAU,EACjB,QAAQ,EAAE,OAAO,CAAC,QAAQ,CAAC,EAC3B,eAAe,EAAE,cAAc,GAAG,SAAS,GAC1C,cAAc,CAIhB;AAED,0HAA0H;AAC1H,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,YAAY,EAAE,QAAQ,EAAE,cAAc,GAAG,YAAY,CAGhG"}
@@ -0,0 +1,23 @@
1
+ import type { AuthInfo, EventDeliveryMode } from '@frontmcp/protocol';
2
+ import { type EventContext, type EventEntry, type EventSubscriber, type EventSubscriptionRef, type ScopeEntry } from '../common';
3
+ import { type EventErrorCodes } from '../errors';
4
+ import type EventRegistry from './event.registry';
5
+ /** Who polls or streams an event: a signed-in caller, or the anonymous callers of a public server together. */
6
+ export interface EventReader {
7
+ /** The owner's key; undefined for anonymous callers, who share one subscription per event and arguments. */
8
+ principalKey: string | undefined;
9
+ subscriber: EventSubscriber;
10
+ }
11
+ /** The event a request names, when the caller's surface is offered it in `mode`. */
12
+ export declare function offeredEventOf(events: EventRegistry, eventName: string, mode: EventDeliveryMode, requestContext: unknown, codes: EventErrorCodes): EventEntry;
13
+ /** The reader of a poll or a stream: anonymous callers are readers on a server in public auth mode only. */
14
+ export declare function eventReaderOf(scope: ScopeEntry, authInfo: Partial<AuthInfo>, eventName: string, codes: EventErrorCodes): EventReader;
15
+ /** Refuse a caller the event's `authorities` do not allow, with the arguments as the rule's input. */
16
+ export declare function assertEventAuthorities(scope: ScopeEntry, event: EventEntry, authInfo: Partial<AuthInfo>, args: Record<string, unknown>, codes: EventErrorCodes): Promise<void>;
17
+ /** The arguments of a request as the event's `inputSchema` parses them. */
18
+ export declare function parsedEventArguments(event: EventEntry, args: Record<string, unknown> | undefined): Record<string, unknown>;
19
+ /** Run the event's own `authorize()`: whatever it throws refuses the reader. */
20
+ export declare function assertEventAuthorizes(context: EventContext, eventName: string, args: Record<string, unknown>, subscriber: EventSubscriber, codes: EventErrorCodes): Promise<void>;
21
+ /** The subscription a poll or a stream stands for: one per reader, mode, event and arguments. */
22
+ export declare function readerSubscriptionOf(reader: EventReader, mode: 'poll' | 'push', eventName: string, args: Record<string, unknown>): EventSubscriptionRef;
23
+ //# sourceMappingURL=event-gates.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-gates.d.ts","sourceRoot":"","sources":["../../src/event/event-gates.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAGtE,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,UAAU,EACf,KAAK,eAAe,EACpB,KAAK,oBAAoB,EACzB,KAAK,UAAU,EAChB,MAAM,WAAW,CAAC;AAEnB,OAAO,EAOL,KAAK,eAAe,EACrB,MAAM,WAAW,CAAC;AAEnB,OAAO,KAAK,aAAa,MAAM,kBAAkB,CAAC;AAElD,+GAA+G;AAC/G,MAAM,WAAW,WAAW;IAC1B,4GAA4G;IAC5G,YAAY,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,UAAU,EAAE,eAAe,CAAC;CAC7B;AAID,oFAAoF;AACpF,wBAAgB,cAAc,CAC5B,MAAM,EAAE,aAAa,EACrB,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,iBAAiB,EACvB,cAAc,EAAE,OAAO,EACvB,KAAK,EAAE,eAAe,GACrB,UAAU,CAQZ;AAED,4GAA4G;AAC5G,wBAAgB,aAAa,CAC3B,KAAK,EAAE,UAAU,EACjB,QAAQ,EAAE,OAAO,CAAC,QAAQ,CAAC,EAC3B,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,eAAe,GACrB,WAAW,CAQb;AAED,sGAAsG;AACtG,wBAAsB,sBAAsB,CAC1C,KAAK,EAAE,UAAU,EACjB,KAAK,EAAE,UAAU,EACjB,QAAQ,EAAE,OAAO,CAAC,QAAQ,CAAC,EAC3B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,KAAK,EAAE,eAAe,GACrB,OAAO,CAAC,IAAI,CAAC,CAOf;AAED,2EAA2E;AAC3E,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,UAAU,EACjB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,GACxC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CASzB;AAED,gFAAgF;AAChF,wBAAsB,qBAAqB,CACzC,OAAO,EAAE,YAAY,EACrB,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,UAAU,EAAE,eAAe,EAC3B,KAAK,EAAE,eAAe,GACrB,OAAO,CAAC,IAAI,CAAC,CAQf;AAED,iGAAiG;AACjG,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,WAAW,EACnB,IAAI,EAAE,MAAM,GAAG,MAAM,EACrB,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC5B,oBAAoB,CAGtB"}
@@ -0,0 +1,9 @@
1
+ import { type OutboundTargetOptions } from '@frontmcp/utils';
2
+ /** What the events feature tells the hardened fetch about a callback target. */
3
+ export interface EventOutboundTargetOptions extends OutboundTargetOptions {
4
+ /** Lets the platform resolve the host where the runtime cannot pin DNS. Set on edge runtimes only. */
5
+ allowPlatformDns?: boolean;
6
+ }
7
+ /** The target options of every request to a callback: local targets when configured, platform DNS on edge only. */
8
+ export declare function eventOutboundTargetOptions(allowLocal: boolean): EventOutboundTargetOptions;
9
+ //# sourceMappingURL=event-outbound.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-outbound.d.ts","sourceRoot":"","sources":["../../src/event/event-outbound.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAE5E,gFAAgF;AAChF,MAAM,WAAW,0BAA2B,SAAQ,qBAAqB;IACvE,sGAAsG;IACtG,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,mHAAmH;AACnH,wBAAgB,0BAA0B,CAAC,UAAU,EAAE,OAAO,GAAG,0BAA0B,CAE1F"}
@@ -0,0 +1,14 @@
1
+ import { type EventPublisher, type EventPublishOptions, type EventPublishResult, type EventReference, type ScopeEntry } from '../common';
2
+ import type EventRegistry from './event.registry';
3
+ /** A new event id: `evt_` and 24 random URL-safe characters. */
4
+ export declare function newEventId(): string;
5
+ /** Publishes the events of one scope through its `events:publish` flow. */
6
+ export declare class ScopeEventPublisher implements EventPublisher {
7
+ private readonly scope;
8
+ private readonly events;
9
+ /** Takes the scope whose flow publishes and the registry its events are found in. */
10
+ constructor(scope: ScopeEntry, events: EventRegistry);
11
+ /** Check the event and its data, give the occurrence an id and a time, and queue its deliveries. */
12
+ publish(event: string | EventReference<unknown>, data: unknown, options?: EventPublishOptions): Promise<EventPublishResult>;
13
+ }
14
+ //# sourceMappingURL=event-publisher.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-publisher.d.ts","sourceRoot":"","sources":["../../src/event/event-publisher.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,KAAK,cAAc,EAEnB,KAAK,UAAU,EAChB,MAAM,WAAW,CAAC;AAEnB,OAAO,KAAK,aAAa,MAAM,kBAAkB,CAAC;AAKlD,gEAAgE;AAChE,wBAAgB,UAAU,IAAI,MAAM,CAEnC;AAgBD,2EAA2E;AAC3E,qBAAa,mBAAoB,YAAW,cAAc;IAGtD,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,MAAM;IAHzB,qFAAqF;gBAElE,KAAK,EAAE,UAAU,EACjB,MAAM,EAAE,aAAa;IAGxC,oGAAoG;IAC9F,OAAO,CACX,KAAK,EAAE,MAAM,GAAG,cAAc,CAAC,OAAO,CAAC,EACvC,IAAI,EAAE,OAAO,EACb,OAAO,GAAE,mBAAwB,GAChC,OAAO,CAAC,kBAAkB,CAAC;CAyB/B"}
@@ -0,0 +1,35 @@
1
+ import { type AuthInfo } from '@frontmcp/protocol';
2
+ import { type EventEntry, type EventSubscriber, type ScopeEntry } from '../common';
3
+ /** What checking a subscriber again found: still allowed, refused, or not known because the check could not be made. */
4
+ export type EventReauthorization = {
5
+ outcome: 'granted';
6
+ } | {
7
+ outcome: 'refused';
8
+ reason: string;
9
+ } | {
10
+ outcome: 'failed';
11
+ error: unknown;
12
+ };
13
+ export interface ReauthorizeSubscriberArgs {
14
+ scope: Pick<ScopeEntry, 'authoritiesEngine' | 'authoritiesContextBuilder'>;
15
+ event: EventEntry;
16
+ /** The owner as stored when the subscription was created or last refreshed. */
17
+ subscriber: EventSubscriber;
18
+ /** The subscription's arguments, as its event's input schema parsed them. */
19
+ arguments: Record<string, unknown>;
20
+ /** The auth the event's context is created with. @default the one {@link subscriberAuthInfo} rebuilds */
21
+ authInfo?: Partial<AuthInfo>;
22
+ }
23
+ /**
24
+ * Whether what an event's `authorize()` threw refuses the subscriber: a public error (an `EventForbiddenError`, any
25
+ * `PublicMcpError`) is the event's answer, as the subscribe flow passes it on. Anything else (an upstream error, a
26
+ * timeout) means the check could not be made.
27
+ */
28
+ export declare function isAuthorizeRefusal(error: unknown): boolean;
29
+ /** The auth of a stored subscriber, for a context its event's methods run on: its claims, subject and scopes, no token. */
30
+ export declare function subscriberAuthInfo(subscriber: EventSubscriber): Partial<AuthInfo>;
31
+ /** Check a subscriber of an event again: its `authorities` first, then its `authorize()`; the first that is not granted answers. */
32
+ export declare function reauthorizeSubscriber(args: ReauthorizeSubscriberArgs): Promise<EventReauthorization>;
33
+ /** Whether an event has anything to check a subscriber against again. */
34
+ export declare function hasReauthorization(scope: ReauthorizeSubscriberArgs['scope'], event: EventEntry, hasAuthorize: boolean): boolean;
35
+ //# sourceMappingURL=event-reauthorization.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-reauthorization.d.ts","sourceRoot":"","sources":["../../src/event/event-reauthorization.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAEnD,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,eAAe,EAAE,KAAK,UAAU,EAAE,MAAM,WAAW,CAAC;AAGnF,wHAAwH;AACxH,MAAM,MAAM,oBAAoB,GAC5B;IAAE,OAAO,EAAE,SAAS,CAAA;CAAE,GACtB;IAAE,OAAO,EAAE,SAAS,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GACtC;IAAE,OAAO,EAAE,QAAQ,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,CAAC;AAE1C,MAAM,WAAW,yBAAyB;IACxC,KAAK,EAAE,IAAI,CAAC,UAAU,EAAE,mBAAmB,GAAG,2BAA2B,CAAC,CAAC;IAC3E,KAAK,EAAE,UAAU,CAAC;IAClB,+EAA+E;IAC/E,UAAU,EAAE,eAAe,CAAC;IAC5B,6EAA6E;IAC7E,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,yGAAyG;IACzG,QAAQ,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;CAC9B;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAE1D;AAED,2HAA2H;AAC3H,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,eAAe,GAAG,OAAO,CAAC,QAAQ,CAAC,CAGjF;AA+BD,oIAAoI;AACpI,wBAAsB,qBAAqB,CAAC,IAAI,EAAE,yBAAyB,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAI1G;AAED,yEAAyE;AACzE,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,yBAAyB,CAAC,OAAO,CAAC,EACzC,KAAK,EAAE,UAAU,EACjB,YAAY,EAAE,OAAO,WAGtB"}
@@ -0,0 +1,23 @@
1
+ import { type Token } from '@frontmcp/di';
2
+ import { type EntryOwnerRef, type EventType, type FrontMcpLogger } from '../common';
3
+ import { type EventsConfigOptions } from '../common/metadata/event.metadata';
4
+ import type ProviderRegistry from '../provider/provider.registry';
5
+ import EventRegistry from './event.registry';
6
+ export interface RegisterEventCapabilitiesArgs {
7
+ providers: ProviderRegistry;
8
+ owner: EntryOwnerRef;
9
+ eventsList: EventType[];
10
+ /** The provider registry of each event declared on an app, by its token. */
11
+ eventProviders: ReadonlyMap<Token, ProviderRegistry>;
12
+ /** `@FrontMcp({ events })`. */
13
+ eventsConfig?: EventsConfigOptions;
14
+ /** `@FrontMcp({ channels: { enabled } })`: `false` turns the `channel` option of events off. */
15
+ channelsEnabled?: boolean;
16
+ logger: FrontMcpLogger;
17
+ }
18
+ export interface EventCapabilitiesResult {
19
+ eventRegistry: EventRegistry;
20
+ }
21
+ /** Register the scope's events and their flows. Resolves to `undefined` with `events.enabled: false`. */
22
+ export declare function registerEventCapabilities(args: RegisterEventCapabilitiesArgs): Promise<EventCapabilitiesResult | undefined>;
23
+ //# sourceMappingURL=event-scope.helper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-scope.helper.d.ts","sourceRoot":"","sources":["../../src/event/event-scope.helper.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,cAAc,CAAC;AAG1C,OAAO,EAEL,KAAK,aAAa,EAElB,KAAK,SAAS,EACd,KAAK,cAAc,EAEpB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAyC,KAAK,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AAKpH,OAAO,KAAK,gBAAgB,MAAM,+BAA+B,CAAC;AAKlE,OAAO,aAAa,MAAM,kBAAkB,CAAC;AAkB7C,MAAM,WAAW,6BAA6B;IAC5C,SAAS,EAAE,gBAAgB,CAAC;IAC5B,KAAK,EAAE,aAAa,CAAC;IACrB,UAAU,EAAE,SAAS,EAAE,CAAC;IACxB,4EAA4E;IAC5E,cAAc,EAAE,WAAW,CAAC,KAAK,EAAE,gBAAgB,CAAC,CAAC;IACrD,+BAA+B;IAC/B,YAAY,CAAC,EAAE,mBAAmB,CAAC;IACnC,gGAAgG;IAChG,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,MAAM,EAAE,cAAc,CAAC;CACxB;AAED,MAAM,WAAW,uBAAuB;IACtC,aAAa,EAAE,aAAa,CAAC;CAC9B;AA8OD,yGAAyG;AACzG,wBAAsB,yBAAyB,CAC7C,IAAI,EAAE,6BAA6B,GAClC,OAAO,CAAC,uBAAuB,GAAG,SAAS,CAAC,CA8D9C"}
@@ -0,0 +1,12 @@
1
+ import type { AuthoritiesContextBuilder } from '@frontmcp/auth';
2
+ import { type AuthInfo } from '@frontmcp/protocol';
3
+ import { type EventSubscriber } from '../common';
4
+ /** Who owns a subscription: the key its identity is derived from, and the caller as the server knows them now. */
5
+ export interface EventSubscriberIdentity {
6
+ /** `principal:<iss>#<sub>`, or `principal:<sub>` when the token names no issuer. */
7
+ principalKey: string;
8
+ subscriber: EventSubscriber;
9
+ }
10
+ /** The owner a signed-in caller's subscription gets; undefined for an anonymous caller, who cannot own one. */
11
+ export declare function eventSubscriberOf(authInfo: Partial<AuthInfo>, contextBuilder?: AuthoritiesContextBuilder): EventSubscriberIdentity | undefined;
12
+ //# sourceMappingURL=event-subscriber.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-subscriber.d.ts","sourceRoot":"","sources":["../../src/event/event-subscriber.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AAChE,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAEnD,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,WAAW,CAAC;AAIjD,kHAAkH;AAClH,MAAM,WAAW,uBAAuB;IACtC,oFAAoF;IACpF,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,eAAe,CAAC;CAC7B;AAQD,+GAA+G;AAC/G,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,OAAO,CAAC,QAAQ,CAAC,EAC3B,cAAc,CAAC,EAAE,yBAAyB,GACzC,uBAAuB,GAAG,SAAS,CAsBrC"}
@@ -0,0 +1,15 @@
1
+ import type { AuthInfo } from '@frontmcp/protocol';
2
+ import { EventContext, EventEntry, type EntryOwnerRef, type EventRecord } from '../common';
3
+ import type ProviderRegistry from '../provider/provider.registry';
4
+ /** A registered event, bound to the providers of the app that declares it. */
5
+ export declare class EventInstance extends EventEntry {
6
+ private readonly entryProviders;
7
+ /** Takes the event's record, its app's providers and its owner, and names it `<owner id>:<event name>`. */
8
+ constructor(record: EventRecord, providers: ProviderRegistry, owner: EntryOwnerRef);
9
+ /** The providers of the app that declares the event. */
10
+ get providers(): ProviderRegistry;
11
+ protected initialize(): Promise<void>;
12
+ /** Builds the context the event's methods run on, for one caller. */
13
+ create(authInfo: Partial<AuthInfo>): EventContext;
14
+ }
15
+ //# sourceMappingURL=event.instance.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event.instance.d.ts","sourceRoot":"","sources":["../../src/event/event.instance.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAEnD,OAAO,EACL,YAAY,EACZ,UAAU,EAGV,KAAK,aAAa,EAElB,KAAK,WAAW,EACjB,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,gBAAgB,MAAM,+BAA+B,CAAC;AAKlE,8EAA8E;AAC9E,qBAAa,aAAc,SAAQ,UAAU;IAC3C,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAmB;IAElD,2GAA2G;gBAC/F,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,gBAAgB,EAAE,KAAK,EAAE,aAAa;IASlF,wDAAwD;IACxD,IAAI,SAAS,IAAI,gBAAgB,CAEhC;cAEe,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAE3C,qEAAqE;IACrE,MAAM,CAAC,QAAQ,EAAE,OAAO,CAAC,QAAQ,CAAC,GAAG,YAAY;CAalD"}
@@ -0,0 +1,97 @@
1
+ import { type Token } from '@frontmcp/di';
2
+ import { type EventDeliveryMode, type EventsExtensionSettings } from '@frontmcp/protocol';
3
+ import { type RootStorage } from '@frontmcp/utils';
4
+ import { type EntryOwnerRef, type EventEntry, type EventPublisher, type EventRecord, type EventType } from '../common';
5
+ import { type EventsConfig } from '../common/metadata/event.metadata';
6
+ import type ProviderRegistry from '../provider/provider.registry';
7
+ import { RegistryAbstract, type RegistryBuildMapResult } from '../regsitry';
8
+ import { type EventMetrics } from './delivery/event-metrics';
9
+ import { type EventOutbox } from './delivery/event-outbox';
10
+ import { EventInstance } from './event.instance';
11
+ import { type EventBuffer } from './poll/event-buffer';
12
+ import { type EventPollLeases } from './poll/event-poll-leases';
13
+ import { type EventPublishEndpoint } from './publish-endpoint/event-publish-endpoint';
14
+ import { type EventReplays } from './replay/event-replays';
15
+ import { type EventStreams } from './stream/event-streams';
16
+ import { type EventSubscriptions } from './subscription/event-subscriptions';
17
+ export interface EventRegistryInterface {
18
+ getEvents(): EventEntry[];
19
+ hasAny(): boolean;
20
+ }
21
+ /** The events capability in both places clients read it: top-level (the design sketch) and as the SEP-3415 extension. */
22
+ export type EventCapabilities = {
23
+ events?: EventsExtensionSettings;
24
+ extensions?: Record<string, EventsExtensionSettings>;
25
+ };
26
+ /** An event with the delivery modes it is offered in. */
27
+ export interface ServedEvent {
28
+ event: EventEntry;
29
+ delivery: EventDeliveryMode[];
30
+ }
31
+ /** The events of a scope, and the parts that deliver them: subscriptions, outbox, buffer and streams. */
32
+ export default class EventRegistry extends RegistryAbstract<EventInstance, EventRecord, EventType[]> implements EventRegistryInterface {
33
+ owner: EntryOwnerRef;
34
+ /** The server's `events` configuration, with its defaults applied. */
35
+ readonly config: EventsConfig;
36
+ /** The stored subscriptions, on a server that delivers by webhook. */
37
+ subscriptions?: EventSubscriptions;
38
+ /** Publishes the server's events; set once the registry is ready. */
39
+ publisher?: EventPublisher;
40
+ /** The pending deliveries, on a server that delivers by webhook. */
41
+ outbox?: EventOutbox;
42
+ /** Counts what happens to published events; set once the registry is ready. */
43
+ metrics?: EventMetrics;
44
+ /** The storage of the server's event records, once a part that keeps some opened it. */
45
+ storage?: RootStorage;
46
+ /** The HTTP publish endpoint, on a server that serves one (`events.publishEndpoint.enabled`). */
47
+ publishEndpoint?: EventPublishEndpoint;
48
+ /** The recent occurrences `events/poll` reads, on a server that performs the poll mode. */
49
+ buffer?: EventBuffer;
50
+ /** The leases of poll subscriptions, on a server that performs the poll mode. */
51
+ pollLeases?: EventPollLeases;
52
+ /** The open `events/stream` requests, on a server that performs the push mode. */
53
+ streams?: EventStreams;
54
+ /** The loops that feed the webhook subscriptions of events with `check()`, on a server that delivers by webhook. */
55
+ replays?: EventReplays;
56
+ /** Whether events with the `channel` option are sent to Claude Code sessions; `channels.enabled: false` turns it off. */
57
+ channelDelivery: boolean;
58
+ /** Events that are not offered by webhook here: their `check()` needs a loop this runtime cannot run. */
59
+ private readonly withoutWebhook;
60
+ private readonly eventsByName;
61
+ private readonly enabledDeliveryModes;
62
+ private readonly logger;
63
+ /** The provider registry of each event declared on an app (its app's); other events use the registry's. */
64
+ private readonly entryProviders;
65
+ /** Takes the listed events, the `events` config and each app event's providers, and registers them. */
66
+ constructor(providers: ProviderRegistry, list: EventType[], owner: EntryOwnerRef, config: EventsConfig, entryProviders: ReadonlyMap<Token, ProviderRegistry>);
67
+ /** Turns the listed events into records keyed by their token. */
68
+ protected buildMap(list: EventType[]): RegistryBuildMapResult<EventRecord>;
69
+ protected buildGraph(): void;
70
+ /** Creates an instance per available event and refuses a name declared twice. */
71
+ protected initialize(): Promise<void>;
72
+ /** Every registered event, whether or not a delivery mode serves it. */
73
+ getEvents(): EventInstance[];
74
+ /** The event registered under a name. */
75
+ findByName(name: string): EventInstance | undefined;
76
+ /** Whether any event is registered. */
77
+ hasAny(): boolean;
78
+ /** Record that this server can deliver events in `mode`. The part that implements a mode calls it at startup. */
79
+ enableDeliveryMode(mode: EventDeliveryMode): void;
80
+ /** Keep an event off the webhook mode: it is still offered in the other modes the server performs. */
81
+ withholdWebhookFrom(eventName: string): void;
82
+ /** Whether this server delivers events in `mode`. */
83
+ performs(mode: EventDeliveryMode): boolean;
84
+ /** The modes an event is offered in: those the server can perform, within the event's own `delivery`. */
85
+ deliveryModesOf(event: EventEntry): EventDeliveryMode[];
86
+ /** The events a client can subscribe to: those offered in at least one delivery mode. */
87
+ getServedEvents(): ServedEvent[];
88
+ /** Whether a client can subscribe to at least one event. */
89
+ servesEvents(): boolean;
90
+ /** Whether each occurrence of an event is also sent to Claude Code sessions as a channel notification. */
91
+ sendsToChannelSessions(event: EventEntry): boolean;
92
+ /** The events whose occurrences are sent to Claude Code sessions as channel notifications. */
93
+ getChannelEvents(): EventInstance[];
94
+ /** The capability to advertise: both forms once an event is served, nothing otherwise. */
95
+ getCapabilities(): EventCapabilities;
96
+ }
97
+ //# sourceMappingURL=event.registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event.registry.d.ts","sourceRoot":"","sources":["../../src/event/event.registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAGL,KAAK,iBAAiB,EACtB,KAAK,uBAAuB,EAC7B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAuC,KAAK,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAExF,OAAO,EAEL,KAAK,aAAa,EAClB,KAAK,UAAU,EACf,KAAK,cAAc,EACnB,KAAK,WAAW,EAChB,KAAK,SAAS,EACf,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,mCAAmC,CAAC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AI5B,yCAAyC;IACzC,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS;IAInD,uCAAuC;IACvC,MAAM,IAAI,OAAO;IAIjB,iHAAiH;IACjH,kBAAkB,CAAC,IAAI,EAAE,iBAAiB,GAAG,IAAI;IAIjD,sGAAsG;IACtG,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IAI5C,qDAAqD;IACrD,QAAQ,CAAC,IAAI,EAAE,iBAAiB,GAAG,OAAO;IAI1C,yGAAyG;IACzG,eAAe,CAAC,KAAK,EAAE,UAAU,GAAG,iBAAiB,EAAE;IAUvD,yFAAyF;IACzF,eAAe,IAAI,WAAW,EAAE;IAMhC,4DAA4D;IAC5D,YAAY,IAAI,OAAO;IAIvB,0GAA0G;IAC1G,sBAAsB,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO;IAIlD,8FAA8F;IAC9F,gBAAgB,IAAI,aAAa,EAAE;IAInC,0FAA0F;IAC1F,eAAe,IAAI,iBAAiB;CAIrC"}
@@ -0,0 +1,6 @@
1
+ import 'reflect-metadata';
2
+ import { type EventType } from '../common/interfaces/event.interface';
3
+ import { type EventRecord } from '../common/records';
4
+ /** The record of an `@Event` class or an `event()` function, which the registry builds its instance from. */
5
+ export declare function normalizeEvent(item: EventType | EventRecord): EventRecord;
6
+ //# sourceMappingURL=event.utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event.utils.d.ts","sourceRoot":"","sources":["../../src/event/event.utils.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAK1B,OAAO,EAAyC,KAAK,SAAS,EAAE,MAAM,sCAAsC,CAAC;AAE7G,OAAO,EAAa,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAShE,6GAA6G;AAC7G,wBAAgB,cAAc,CAAC,IAAI,EAAE,SAAS,GAAG,WAAW,GAAG,WAAW,CAqBzE"}
@@ -0,0 +1,73 @@
1
+ import { internalZ as z } from '@frontmcp/lazy-zod';
2
+ import { type OutboundResult } from '@frontmcp/utils';
3
+ import { FlowBase, type FlowRunOptions } from '../../common';
4
+ import { type EventDeliveryOutcome, type EventDeliveryRecord, type EventDeliveryTarget } from '../delivery/event-outbox';
5
+ import { type EventSubscriptionRecord } from '../subscription/event-subscription.store';
6
+ declare const inputSchema: import("@frontmcp/lazy-zod").ZodObject<{
7
+ delivery: z.ZodType<EventDeliveryRecord>;
8
+ }, import("zod/v4/core").$strip>;
9
+ declare const outputSchema: import("@frontmcp/lazy-zod").ZodDiscriminatedUnion<[import("@frontmcp/lazy-zod").ZodObject<{
10
+ result: import("@frontmcp/lazy-zod").ZodLiteral<"delivered">;
11
+ }, import("zod/v4/core").$strip>, import("@frontmcp/lazy-zod").ZodObject<{
12
+ result: import("@frontmcp/lazy-zod").ZodLiteral<"dropped">;
13
+ reason: import("@frontmcp/lazy-zod").ZodEnum<{
14
+ gone: "gone";
15
+ refused: "refused";
16
+ }>;
17
+ }, import("zod/v4/core").$strip>, import("@frontmcp/lazy-zod").ZodObject<{
18
+ result: import("@frontmcp/lazy-zod").ZodLiteral<"failed">;
19
+ category: import("@frontmcp/lazy-zod").ZodEnum<{
20
+ connection_refused: "connection_refused";
21
+ timeout: "timeout";
22
+ tls_error: "tls_error";
23
+ http_4xx: "http_4xx";
24
+ http_5xx: "http_5xx";
25
+ challenge_failed: "challenge_failed";
26
+ }>;
27
+ }, import("zod/v4/core").$strip>, import("@frontmcp/lazy-zod").ZodObject<{
28
+ result: import("@frontmcp/lazy-zod").ZodLiteral<"waiting">;
29
+ }, import("zod/v4/core").$strip>], "result">;
30
+ declare const stateSchema: import("@frontmcp/lazy-zod").ZodObject<{
31
+ target: z.ZodType<EventDeliveryTarget>;
32
+ subscription: z.ZodType<EventSubscriptionRecord | undefined>;
33
+ headers: import("@frontmcp/lazy-zod").ZodRecord<import("@frontmcp/lazy-zod").ZodString, import("@frontmcp/lazy-zod").ZodString>;
34
+ answer: z.ZodType<OutboundResult>;
35
+ outcome: z.ZodType<EventDeliveryOutcome>;
36
+ }, import("zod/v4/core").$strip>;
37
+ declare const plan: {
38
+ readonly pre: ["loadSubscription", "buildHeaders"];
39
+ readonly execute: ["send", "classify"];
40
+ readonly post: ["buildResult"];
41
+ };
42
+ declare global {
43
+ interface ExtendFlows {
44
+ 'events:deliver': FlowRunOptions<EventDeliverFlow, typeof plan, typeof inputSchema, typeof outputSchema, typeof stateSchema>;
45
+ }
46
+ }
47
+ declare const name: "events:deliver";
48
+ /** Failed attempts in a row after which a subscription is suspended until its next `events/subscribe`. */
49
+ export declare const SUSPEND_AFTER_FAILURES = 20;
50
+ /** `events:deliver`: one attempt of one delivery, signed and sent to the subscription's callback. */
51
+ export default class EventDeliverFlow extends FlowBase<typeof name> {
52
+ logger: import("../../common").FrontMcpLogger;
53
+ /** The event registry of a scope that delivers by webhook. */
54
+ private get events();
55
+ /** The subscriptions of the scope; the flow is registered only when it has them. */
56
+ private get subscriptions();
57
+ /** Find where the delivery goes: its subscription, or the target a `terminated` envelope carries; else nothing is sent. */
58
+ loadSubscription(): Promise<void>;
59
+ /** Sign the stored body for this attempt: the same `webhook-id`, a fresh timestamp, every secret in use. */
60
+ buildHeaders(): Promise<void>;
61
+ /** POST the stored body, unchanged, through the hardened request. */
62
+ send(): Promise<void>;
63
+ /** Decide what the answer means, and record it on the subscription. */
64
+ classify(): Promise<void>;
65
+ /** Answer with the outcome of the attempt. */
66
+ buildResult(): Promise<void>;
67
+ /** Count a failed attempt, and suspend the subscription once too many failed in a row. */
68
+ private recordFailure;
69
+ /** Change the status of the delivery's subscription; a `terminated` envelope has none to change. */
70
+ private recordStatus;
71
+ }
72
+ export {};
73
+ //# sourceMappingURL=event-deliver.flow.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-deliver.flow.d.ts","sourceRoot":"","sources":["../../../src/event/flows/event-deliver.flow.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,IAAI,CAAC,EAAE,MAAM,oBAAoB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