@adonis-agora/durable 0.49.1 → 0.50.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 (324) hide show
  1. package/CHANGELOG.md +251 -0
  2. package/README.md +53 -22
  3. package/dist/assets/spa/assets/index-DupjrK7N.js +16 -0
  4. package/dist/assets/spa/assets/index-DupjrK7N.js.map +1 -0
  5. package/dist/assets/spa/index.html +1 -1
  6. package/dist/commands/durable_worker.d.ts.map +1 -1
  7. package/dist/commands/durable_worker.js +9 -8
  8. package/dist/commands/durable_worker.js.map +1 -1
  9. package/dist/configure.d.ts.map +1 -1
  10. package/dist/configure.js +1 -0
  11. package/dist/configure.js.map +1 -1
  12. package/dist/providers/dashboard_provider.d.ts +2 -0
  13. package/dist/providers/dashboard_provider.d.ts.map +1 -1
  14. package/dist/providers/dashboard_provider.js +50 -6
  15. package/dist/providers/dashboard_provider.js.map +1 -1
  16. package/dist/providers/durable_provider.d.ts.map +1 -1
  17. package/dist/providers/durable_provider.js +143 -34
  18. package/dist/providers/durable_provider.js.map +1 -1
  19. package/dist/src/admission-redis/redis-admission-backend.d.ts.map +1 -1
  20. package/dist/src/admission-redis/redis-admission-backend.js +3 -1
  21. package/dist/src/admission-redis/redis-admission-backend.js.map +1 -1
  22. package/dist/src/ambient-step.d.ts +24 -0
  23. package/dist/src/ambient-step.d.ts.map +1 -0
  24. package/dist/src/ambient-step.js +42 -0
  25. package/dist/src/ambient-step.js.map +1 -0
  26. package/dist/src/base-workflow.d.ts +10 -1
  27. package/dist/src/base-workflow.d.ts.map +1 -1
  28. package/dist/src/base-workflow.js.map +1 -1
  29. package/dist/src/codec-state-store.d.ts +28 -2
  30. package/dist/src/codec-state-store.d.ts.map +1 -1
  31. package/dist/src/codec-state-store.js +61 -3
  32. package/dist/src/codec-state-store.js.map +1 -1
  33. package/dist/src/commands/worker.d.ts +4 -1
  34. package/dist/src/commands/worker.d.ts.map +1 -1
  35. package/dist/src/commands/worker.js +27 -3
  36. package/dist/src/commands/worker.js.map +1 -1
  37. package/dist/src/config_types.d.ts +6 -0
  38. package/dist/src/config_types.d.ts.map +1 -1
  39. package/dist/src/control-plane-redis/redis-control-plane.d.ts.map +1 -1
  40. package/dist/src/control-plane-redis/redis-control-plane.js +22 -6
  41. package/dist/src/control-plane-redis/redis-control-plane.js.map +1 -1
  42. package/dist/src/control-planes/factory.d.ts +6 -0
  43. package/dist/src/control-planes/factory.d.ts.map +1 -1
  44. package/dist/src/control-planes/factory.js +1 -0
  45. package/dist/src/control-planes/factory.js.map +1 -1
  46. package/dist/src/dashboard/gateway-adapter.d.ts +15 -5
  47. package/dist/src/dashboard/gateway-adapter.d.ts.map +1 -1
  48. package/dist/src/dashboard/gateway-adapter.js +71 -7
  49. package/dist/src/dashboard/gateway-adapter.js.map +1 -1
  50. package/dist/src/dashboard/handlers.d.ts +53 -1
  51. package/dist/src/dashboard/handlers.d.ts.map +1 -1
  52. package/dist/src/dashboard/handlers.js +200 -20
  53. package/dist/src/dashboard/handlers.js.map +1 -1
  54. package/dist/src/dashboard/index.d.ts +2 -2
  55. package/dist/src/dashboard/index.d.ts.map +1 -1
  56. package/dist/src/dashboard/index.js +2 -2
  57. package/dist/src/dashboard/index.js.map +1 -1
  58. package/dist/src/dashboard/openapi.d.ts.map +1 -1
  59. package/dist/src/dashboard/openapi.js +71 -1
  60. package/dist/src/dashboard/openapi.js.map +1 -1
  61. package/dist/src/define_config.d.ts +122 -8
  62. package/dist/src/define_config.d.ts.map +1 -1
  63. package/dist/src/define_config.js.map +1 -1
  64. package/dist/src/diagnostics-bridge.d.ts +16 -3
  65. package/dist/src/diagnostics-bridge.d.ts.map +1 -1
  66. package/dist/src/diagnostics-bridge.js +9 -3
  67. package/dist/src/diagnostics-bridge.js.map +1 -1
  68. package/dist/src/discovery-roots.d.ts +92 -0
  69. package/dist/src/discovery-roots.d.ts.map +1 -0
  70. package/dist/src/discovery-roots.js +150 -0
  71. package/dist/src/discovery-roots.js.map +1 -0
  72. package/dist/src/engine.d.ts +418 -20
  73. package/dist/src/engine.d.ts.map +1 -1
  74. package/dist/src/engine.js +1523 -159
  75. package/dist/src/engine.js.map +1 -1
  76. package/dist/src/entities.d.ts +36 -1
  77. package/dist/src/entities.d.ts.map +1 -1
  78. package/dist/src/entities.js +65 -4
  79. package/dist/src/entities.js.map +1 -1
  80. package/dist/src/errors.d.ts +36 -0
  81. package/dist/src/errors.d.ts.map +1 -1
  82. package/dist/src/errors.js +44 -0
  83. package/dist/src/errors.js.map +1 -1
  84. package/dist/src/event-trigger-bridge.d.ts +8 -0
  85. package/dist/src/event-trigger-bridge.d.ts.map +1 -1
  86. package/dist/src/event-trigger-bridge.js +24 -3
  87. package/dist/src/event-trigger-bridge.js.map +1 -1
  88. package/dist/src/handshake/announced.d.ts +27 -0
  89. package/dist/src/handshake/announced.d.ts.map +1 -1
  90. package/dist/src/handshake/announced.js +62 -0
  91. package/dist/src/handshake/announced.js.map +1 -1
  92. package/dist/src/handshake/directory.d.ts +92 -0
  93. package/dist/src/handshake/directory.d.ts.map +1 -0
  94. package/dist/src/handshake/directory.js +139 -0
  95. package/dist/src/handshake/directory.js.map +1 -0
  96. package/dist/src/hooks/barrel-sources.d.ts +28 -0
  97. package/dist/src/hooks/barrel-sources.d.ts.map +1 -0
  98. package/dist/src/hooks/barrel-sources.js +92 -0
  99. package/dist/src/hooks/barrel-sources.js.map +1 -0
  100. package/dist/src/hooks/steps.d.ts +12 -3
  101. package/dist/src/hooks/steps.d.ts.map +1 -1
  102. package/dist/src/hooks/steps.js +7 -11
  103. package/dist/src/hooks/steps.js.map +1 -1
  104. package/dist/src/hooks/workflows.d.ts +12 -3
  105. package/dist/src/hooks/workflows.d.ts.map +1 -1
  106. package/dist/src/hooks/workflows.js +7 -13
  107. package/dist/src/hooks/workflows.js.map +1 -1
  108. package/dist/src/index.d.ts +12 -3
  109. package/dist/src/index.d.ts.map +1 -1
  110. package/dist/src/index.js +12 -3
  111. package/dist/src/index.js.map +1 -1
  112. package/dist/src/interfaces.d.ts +309 -21
  113. package/dist/src/interfaces.d.ts.map +1 -1
  114. package/dist/src/interfaces.js +10 -0
  115. package/dist/src/interfaces.js.map +1 -1
  116. package/dist/src/metrics.d.ts.map +1 -1
  117. package/dist/src/metrics.js +5 -0
  118. package/dist/src/metrics.js.map +1 -1
  119. package/dist/src/namespaces.d.ts +17 -0
  120. package/dist/src/namespaces.d.ts.map +1 -0
  121. package/dist/src/namespaces.js +24 -0
  122. package/dist/src/namespaces.js.map +1 -0
  123. package/dist/src/otel/durable-metrics.d.ts.map +1 -1
  124. package/dist/src/otel/durable-metrics.js +5 -0
  125. package/dist/src/otel/durable-metrics.js.map +1 -1
  126. package/dist/src/otel/durable-otel.d.ts.map +1 -1
  127. package/dist/src/otel/durable-otel.js +5 -0
  128. package/dist/src/otel/durable-otel.js.map +1 -1
  129. package/dist/src/pollers.d.ts +10 -1
  130. package/dist/src/pollers.d.ts.map +1 -1
  131. package/dist/src/pollers.js +15 -5
  132. package/dist/src/pollers.js.map +1 -1
  133. package/dist/src/protocol.d.ts +12 -0
  134. package/dist/src/protocol.d.ts.map +1 -1
  135. package/dist/src/protocol.js +27 -1
  136. package/dist/src/protocol.js.map +1 -1
  137. package/dist/src/remote-event.d.ts +6 -0
  138. package/dist/src/remote-event.d.ts.map +1 -0
  139. package/dist/src/remote-event.js +19 -0
  140. package/dist/src/remote-event.js.map +1 -0
  141. package/dist/src/remote-workflow-executor.d.ts +34 -12
  142. package/dist/src/remote-workflow-executor.d.ts.map +1 -1
  143. package/dist/src/remote-workflow-executor.js +42 -40
  144. package/dist/src/remote-workflow-executor.js.map +1 -1
  145. package/dist/src/run-detail-summary.d.ts +90 -3
  146. package/dist/src/run-detail-summary.d.ts.map +1 -1
  147. package/dist/src/run-detail-summary.js +360 -2
  148. package/dist/src/run-detail-summary.js.map +1 -1
  149. package/dist/src/run-facets.d.ts +48 -0
  150. package/dist/src/run-facets.d.ts.map +1 -0
  151. package/dist/src/run-facets.js +100 -0
  152. package/dist/src/run-facets.js.map +1 -0
  153. package/dist/src/run-gateway/interface.d.ts +27 -1
  154. package/dist/src/run-gateway/interface.d.ts.map +1 -1
  155. package/dist/src/run-gateway/proxy-run-gateway.d.ts +32 -4
  156. package/dist/src/run-gateway/proxy-run-gateway.d.ts.map +1 -1
  157. package/dist/src/run-gateway/proxy-run-gateway.js +101 -5
  158. package/dist/src/run-gateway/proxy-run-gateway.js.map +1 -1
  159. package/dist/src/run-gateway/run-request-responder.d.ts +18 -5
  160. package/dist/src/run-gateway/run-request-responder.d.ts.map +1 -1
  161. package/dist/src/run-gateway/run-request-responder.js +155 -32
  162. package/dist/src/run-gateway/run-request-responder.js.map +1 -1
  163. package/dist/src/run-gateway/store-run-gateway.d.ts +23 -1
  164. package/dist/src/run-gateway/store-run-gateway.d.ts.map +1 -1
  165. package/dist/src/run-gateway/store-run-gateway.js +38 -0
  166. package/dist/src/run-gateway/store-run-gateway.js.map +1 -1
  167. package/dist/src/search-attributes-schema.d.ts +44 -0
  168. package/dist/src/search-attributes-schema.d.ts.map +1 -0
  169. package/dist/src/search-attributes-schema.js +51 -0
  170. package/dist/src/search-attributes-schema.js.map +1 -0
  171. package/dist/src/singleton-admission.d.ts +75 -0
  172. package/dist/src/singleton-admission.d.ts.map +1 -0
  173. package/dist/src/singleton-admission.js +156 -0
  174. package/dist/src/singleton-admission.js.map +1 -0
  175. package/dist/src/singleton-gate.d.ts +23 -8
  176. package/dist/src/singleton-gate.d.ts.map +1 -1
  177. package/dist/src/singleton-gate.js +59 -12
  178. package/dist/src/singleton-gate.js.map +1 -1
  179. package/dist/src/standard-schema.d.ts +83 -0
  180. package/dist/src/standard-schema.d.ts.map +1 -0
  181. package/dist/src/standard-schema.js +31 -0
  182. package/dist/src/standard-schema.js.map +1 -0
  183. package/dist/src/step-discovery.d.ts +21 -11
  184. package/dist/src/step-discovery.d.ts.map +1 -1
  185. package/dist/src/step-discovery.js +86 -45
  186. package/dist/src/step-discovery.js.map +1 -1
  187. package/dist/src/step-ref.d.ts +38 -12
  188. package/dist/src/step-ref.d.ts.map +1 -1
  189. package/dist/src/step-ref.js +5 -13
  190. package/dist/src/step-ref.js.map +1 -1
  191. package/dist/src/stores/factory.d.ts +6 -0
  192. package/dist/src/stores/factory.d.ts.map +1 -1
  193. package/dist/src/stores/factory.js +4 -1
  194. package/dist/src/stores/factory.js.map +1 -1
  195. package/dist/src/stores/lucid-helpers.d.ts +2 -0
  196. package/dist/src/stores/lucid-helpers.d.ts.map +1 -1
  197. package/dist/src/stores/lucid-helpers.js +7 -0
  198. package/dist/src/stores/lucid-helpers.js.map +1 -1
  199. package/dist/src/stores/lucid-mappers.d.ts +25 -0
  200. package/dist/src/stores/lucid-mappers.d.ts.map +1 -1
  201. package/dist/src/stores/lucid-mappers.js +81 -18
  202. package/dist/src/stores/lucid-mappers.js.map +1 -1
  203. package/dist/src/stores/lucid-schema.d.ts +59 -1
  204. package/dist/src/stores/lucid-schema.d.ts.map +1 -1
  205. package/dist/src/stores/lucid-schema.js +271 -25
  206. package/dist/src/stores/lucid-schema.js.map +1 -1
  207. package/dist/src/stores/lucid.d.ts +61 -2
  208. package/dist/src/stores/lucid.d.ts.map +1 -1
  209. package/dist/src/stores/lucid.js +346 -41
  210. package/dist/src/stores/lucid.js.map +1 -1
  211. package/dist/src/telescope/dashboard.d.ts.map +1 -1
  212. package/dist/src/telescope/dashboard.js +30 -1
  213. package/dist/src/telescope/dashboard.js.map +1 -1
  214. package/dist/src/telescope/data-providers.d.ts +19 -1
  215. package/dist/src/telescope/data-providers.d.ts.map +1 -1
  216. package/dist/src/telescope/data-providers.js +119 -3
  217. package/dist/src/telescope/data-providers.js.map +1 -1
  218. package/dist/src/telescope/extension.d.ts.map +1 -1
  219. package/dist/src/telescope/extension.js +2 -1
  220. package/dist/src/telescope/extension.js.map +1 -1
  221. package/dist/src/telescope/index.d.ts +1 -1
  222. package/dist/src/telescope/index.d.ts.map +1 -1
  223. package/dist/src/telescope/index.js +1 -1
  224. package/dist/src/telescope/index.js.map +1 -1
  225. package/dist/src/testing/in-memory-state-store.d.ts +44 -15
  226. package/dist/src/testing/in-memory-state-store.d.ts.map +1 -1
  227. package/dist/src/testing/in-memory-state-store.js +204 -41
  228. package/dist/src/testing/in-memory-state-store.js.map +1 -1
  229. package/dist/src/testing-kit/checkpoint-aggregation-contract.d.ts +16 -0
  230. package/dist/src/testing-kit/checkpoint-aggregation-contract.d.ts.map +1 -0
  231. package/dist/src/testing-kit/checkpoint-aggregation-contract.js +228 -0
  232. package/dist/src/testing-kit/checkpoint-aggregation-contract.js.map +1 -0
  233. package/dist/src/testing-kit/state-store-conformance.d.ts.map +1 -1
  234. package/dist/src/testing-kit/state-store-conformance.js +355 -3
  235. package/dist/src/testing-kit/state-store-conformance.js.map +1 -1
  236. package/dist/src/transport-pool.d.ts +15 -1
  237. package/dist/src/transport-pool.d.ts.map +1 -1
  238. package/dist/src/transport-pool.js +50 -4
  239. package/dist/src/transport-pool.js.map +1 -1
  240. package/dist/src/transports/adaptive-concurrency.d.ts +168 -0
  241. package/dist/src/transports/adaptive-concurrency.d.ts.map +1 -0
  242. package/dist/src/transports/adaptive-concurrency.js +353 -0
  243. package/dist/src/transports/adaptive-concurrency.js.map +1 -0
  244. package/dist/src/transports/bullmq/adaptive-concurrency.d.ts +1 -165
  245. package/dist/src/transports/bullmq/adaptive-concurrency.d.ts.map +1 -1
  246. package/dist/src/transports/bullmq/adaptive-concurrency.js +3 -351
  247. package/dist/src/transports/bullmq/adaptive-concurrency.js.map +1 -1
  248. package/dist/src/transports/bullmq/bullmq-transport.d.ts +49 -1
  249. package/dist/src/transports/bullmq/bullmq-transport.d.ts.map +1 -1
  250. package/dist/src/transports/bullmq/bullmq-transport.js +330 -38
  251. package/dist/src/transports/bullmq/bullmq-transport.js.map +1 -1
  252. package/dist/src/transports/bullmq/deps.d.ts +18 -2
  253. package/dist/src/transports/bullmq/deps.d.ts.map +1 -1
  254. package/dist/src/transports/bullmq/deps.js +44 -2
  255. package/dist/src/transports/bullmq/deps.js.map +1 -1
  256. package/dist/src/transports/db-helpers.d.ts +39 -0
  257. package/dist/src/transports/db-helpers.d.ts.map +1 -1
  258. package/dist/src/transports/db-helpers.js +73 -0
  259. package/dist/src/transports/db-helpers.js.map +1 -1
  260. package/dist/src/transports/db-remote.d.ts +53 -0
  261. package/dist/src/transports/db-remote.d.ts.map +1 -0
  262. package/dist/src/transports/db-remote.js +147 -0
  263. package/dist/src/transports/db-remote.js.map +1 -0
  264. package/dist/src/transports/db-schema.d.ts +44 -1
  265. package/dist/src/transports/db-schema.d.ts.map +1 -1
  266. package/dist/src/transports/db-schema.js +227 -88
  267. package/dist/src/transports/db-schema.js.map +1 -1
  268. package/dist/src/transports/db.d.ts +189 -6
  269. package/dist/src/transports/db.d.ts.map +1 -1
  270. package/dist/src/transports/db.js +1291 -137
  271. package/dist/src/transports/db.js.map +1 -1
  272. package/dist/src/transports/event-emitter.d.ts +8 -0
  273. package/dist/src/transports/event-emitter.d.ts.map +1 -1
  274. package/dist/src/transports/event-emitter.js +36 -3
  275. package/dist/src/transports/event-emitter.js.map +1 -1
  276. package/dist/src/transports/factory.d.ts +110 -5
  277. package/dist/src/transports/factory.d.ts.map +1 -1
  278. package/dist/src/transports/factory.js +56 -9
  279. package/dist/src/transports/factory.js.map +1 -1
  280. package/dist/src/transports/queue-mock-adapter.d.ts +7 -2
  281. package/dist/src/transports/queue-mock-adapter.d.ts.map +1 -1
  282. package/dist/src/transports/queue-mock-adapter.js +18 -2
  283. package/dist/src/transports/queue-mock-adapter.js.map +1 -1
  284. package/dist/src/transports/queue-remote.d.ts +146 -0
  285. package/dist/src/transports/queue-remote.d.ts.map +1 -0
  286. package/dist/src/transports/queue-remote.js +398 -0
  287. package/dist/src/transports/queue-remote.js.map +1 -0
  288. package/dist/src/transports/queue.d.ts +159 -6
  289. package/dist/src/transports/queue.d.ts.map +1 -1
  290. package/dist/src/transports/queue.js +747 -37
  291. package/dist/src/transports/queue.js.map +1 -1
  292. package/dist/src/transports/task-failure.d.ts +31 -0
  293. package/dist/src/transports/task-failure.d.ts.map +1 -0
  294. package/dist/src/transports/task-failure.js +50 -0
  295. package/dist/src/transports/task-failure.js.map +1 -0
  296. package/dist/src/workflow-als.d.ts +1 -1
  297. package/dist/src/workflow-als.d.ts.map +1 -1
  298. package/dist/src/workflow-ctx.d.ts +10 -0
  299. package/dist/src/workflow-ctx.d.ts.map +1 -1
  300. package/dist/src/workflow-ctx.js +97 -15
  301. package/dist/src/workflow-ctx.js.map +1 -1
  302. package/dist/src/workflow-discovery.d.ts +32 -41
  303. package/dist/src/workflow-discovery.d.ts.map +1 -1
  304. package/dist/src/workflow-discovery.js +65 -88
  305. package/dist/src/workflow-discovery.js.map +1 -1
  306. package/dist/src/workflow-ref.d.ts +24 -0
  307. package/dist/src/workflow-ref.d.ts.map +1 -1
  308. package/dist/src/workflow-ref.js.map +1 -1
  309. package/dist/stubs/config/durable.stub +6 -0
  310. package/dist/stubs/config/durable_dashboard.stub +7 -3
  311. package/dist/stubs/database/migrations/create_durable_tables.stub +2 -1
  312. package/dist/stubs/database/migrations/create_durable_transport_messages.stub +43 -0
  313. package/dist/stubs/database/migrations/create_durable_transport_tables.stub +12 -9
  314. package/dist/stubs/database/migrations/create_durable_transport_worker_keys.stub +1 -1
  315. package/dist/stubs/make/workflow/main.stub +1 -1
  316. package/package.json +6 -4
  317. package/skills/durable-cluster/SKILL.md +80 -11
  318. package/skills/durable-determinism/SKILL.md +11 -5
  319. package/skills/durable-reliability/SKILL.md +77 -37
  320. package/skills/durable-setup/SKILL.md +51 -22
  321. package/skills/durable-transports-stores/SKILL.md +128 -18
  322. package/skills/durable-workflows/SKILL.md +71 -18
  323. package/dist/assets/spa/assets/index-DdB9zxuX.js +0 -16
  324. package/dist/assets/spa/assets/index-DdB9zxuX.js.map +0 -1
@@ -3,8 +3,19 @@ import type { EngineEvent } from './interfaces.js';
3
3
  export interface DurableEventSource {
4
4
  subscribe(listener: (event: EngineEvent) => void): () => void;
5
5
  }
6
+ /** Options for {@link attachDurableDiagnostics}. */
7
+ export interface DurableDiagnosticsOptions {
8
+ /**
9
+ * Also forward the events this instance only HEARD from other instances over the control plane.
10
+ * Default `false`: with a control plane configured, every pod receives every other pod's lifecycle
11
+ * events, so forwarding them made each pod's Telescope record each event once per pod (a
12
+ * three-pod fleet counted every `run.completed` three times). Set it on a pod that should mirror
13
+ * the whole fleet into a recorder of its own, and nowhere else.
14
+ */
15
+ includeRemote?: boolean | undefined;
16
+ }
6
17
  /**
7
- * Bridge every engine lifecycle event onto the `@adonis-agora/diagnostics` bus as `agora:durable:<type>`
18
+ * Bridge engine lifecycle events onto the `@adonis-agora/diagnostics` bus as `agora:durable:<type>`
8
19
  * (e.g. `agora:durable:run.failed`); the whole {@link EngineEvent} is the payload. The emit
9
20
  * capability is read STRUCTURALLY from its global slot per event — durable never imports or depends
10
21
  * on `@adonis-agora/diagnostics`, and when diagnostics isn't installed the slot is empty and this is an
@@ -14,12 +25,14 @@ export interface DurableEventSource {
14
25
  * subscribers, the Telescope generic watcher (which auto-captures every channel), the cross-process
15
26
  * relays, and the OTel bridge (each event recorded on the active span). `emit` short-circuits on
16
27
  * `hasSubscribers`, so an unsubscribed channel costs nothing, and it never throws back into the
17
- * engine. All event types are forwarded — filtering is the subscriber's job. An event of a child run
28
+ * engine. Only the events THIS instance produced are forwarded by default (see
29
+ * {@link DurableDiagnosticsOptions.includeRemote}), so a fleet records each event once; all event
30
+ * types are forwarded — filtering is the subscriber's job. An event of a child run
18
31
  * the engine started (`ctx.all`, `ctx.child`, `ctx.startChild` without a caller-chosen id) also
19
32
  * carries `parentRunId`: each child is its own run, so that field is how a subscriber (a Telescope
20
33
  * search, say) finds every child of one parent, a whole `ctx.all` fan included.
21
34
  *
22
35
  * @returns an unsubscribe function that detaches the bridge from the engine.
23
36
  */
24
- export declare function attachDurableDiagnostics(engine: DurableEventSource): () => void;
37
+ export declare function attachDurableDiagnostics(engine: DurableEventSource, options?: DurableDiagnosticsOptions): () => void;
25
38
  //# sourceMappingURL=diagnostics-bridge.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"diagnostics-bridge.d.ts","sourceRoot":"","sources":["../../src/diagnostics-bridge.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEnD,mFAAmF;AACnF,MAAM,WAAW,kBAAkB;IACjC,SAAS,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;CAC/D;AAMD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,kBAAkB,GAAG,MAAM,IAAI,CAO/E"}
1
+ {"version":3,"file":"diagnostics-bridge.d.ts","sourceRoot":"","sources":["../../src/diagnostics-bridge.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAGnD,mFAAmF;AACnF,MAAM,WAAW,kBAAkB;IACjC,SAAS,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;CAC/D;AAMD,oDAAoD;AACpD,MAAM,WAAW,yBAAyB;IACxC;;;;;;OAMG;IACH,aAAa,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CACrC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,kBAAkB,EAC1B,OAAO,GAAE,yBAA8B,GACtC,MAAM,IAAI,CASZ"}
@@ -1,8 +1,9 @@
1
1
  import { parentRunIdOf } from './fan-join.js';
2
+ import { isRemoteEvent } from './remote-event.js';
2
3
  /** The `@adonis-agora/diagnostics` emit capability, published on this slot at that package's module load. */
3
4
  const EMIT_SLOT = Symbol.for('@agora/diagnostics:emit');
4
5
  /**
5
- * Bridge every engine lifecycle event onto the `@adonis-agora/diagnostics` bus as `agora:durable:<type>`
6
+ * Bridge engine lifecycle events onto the `@adonis-agora/diagnostics` bus as `agora:durable:<type>`
6
7
  * (e.g. `agora:durable:run.failed`); the whole {@link EngineEvent} is the payload. The emit
7
8
  * capability is read STRUCTURALLY from its global slot per event — durable never imports or depends
8
9
  * on `@adonis-agora/diagnostics`, and when diagnostics isn't installed the slot is empty and this is an
@@ -12,15 +13,20 @@ const EMIT_SLOT = Symbol.for('@agora/diagnostics:emit');
12
13
  * subscribers, the Telescope generic watcher (which auto-captures every channel), the cross-process
13
14
  * relays, and the OTel bridge (each event recorded on the active span). `emit` short-circuits on
14
15
  * `hasSubscribers`, so an unsubscribed channel costs nothing, and it never throws back into the
15
- * engine. All event types are forwarded — filtering is the subscriber's job. An event of a child run
16
+ * engine. Only the events THIS instance produced are forwarded by default (see
17
+ * {@link DurableDiagnosticsOptions.includeRemote}), so a fleet records each event once; all event
18
+ * types are forwarded — filtering is the subscriber's job. An event of a child run
16
19
  * the engine started (`ctx.all`, `ctx.child`, `ctx.startChild` without a caller-chosen id) also
17
20
  * carries `parentRunId`: each child is its own run, so that field is how a subscriber (a Telescope
18
21
  * search, say) finds every child of one parent, a whole `ctx.all` fan included.
19
22
  *
20
23
  * @returns an unsubscribe function that detaches the bridge from the engine.
21
24
  */
22
- export function attachDurableDiagnostics(engine) {
25
+ export function attachDurableDiagnostics(engine, options = {}) {
26
+ const includeRemote = options.includeRemote === true;
23
27
  return engine.subscribe((event) => {
28
+ if (!includeRemote && isRemoteEvent(event))
29
+ return;
24
30
  const emit = globalThis[EMIT_SLOT];
25
31
  if (typeof emit !== 'function')
26
32
  return;
@@ -1 +1 @@
1
- {"version":3,"file":"diagnostics-bridge.js","sourceRoot":"","sources":["../../src/diagnostics-bridge.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAQ9C,6GAA6G;AAC7G,MAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAC;A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AI,CAAC,SAAS,EAAE,KAAK,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC,CAAC,EAAE,GAAG,KAAK,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IAC/E,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,92 @@
1
+ /**
2
+ * Shared plumbing for multi-root discovery: `workflowsPath` / `stepsPath` (and the assembler hooks'
3
+ * `source`) accept one directory or several, and both the runtime directory scan and the generated
4
+ * barrels walk every root the same way.
5
+ */
6
+ /** A lazy module import, as written by the generated barrels: `() => import('#workflows/charge')`. */
7
+ export type BarrelModuleLoader = () => Promise<Record<string, unknown>>;
8
+ /**
9
+ * A single-root generated barrel: stable key → lazy module import. The Assembler `IndexGenerator`
10
+ * nests modules that live in sub-directories (`app/workflows/billing/refund_workflow.ts` becomes
11
+ * `{ billing: { Refund: () => import(...) } }`), so a value is either a loader or another level.
12
+ */
13
+ export interface BarrelTree {
14
+ [key: string]: BarrelModuleLoader | BarrelTree;
15
+ }
16
+ /**
17
+ * One root of a multi-root generated barrel. The hooks write an ARRAY of these when their `source`
18
+ * names several directories: `root` is the directory (relative to the app root) and `modules` maps
19
+ * each module's app-relative file path to its lazy import. The file path keys are what the
20
+ * cross-root duplicate check quotes in its error.
21
+ */
22
+ export interface RootedBarrel {
23
+ root: string;
24
+ modules: Record<string, BarrelModuleLoader>;
25
+ }
26
+ /** One importable module discovery will visit, tagged with the root it was found under. */
27
+ export interface DiscoveryModule {
28
+ /** The discovery root (directory or barrel root) the module belongs to. */
29
+ root: string;
30
+ /** Where the module lives: an absolute path for a directory scan, the barrel key for a barrel. */
31
+ file: string;
32
+ load: BarrelModuleLoader;
33
+ }
34
+ /**
35
+ * Normalise a `workflowsPath` / `stepsPath` value into the list of roots to scan. `undefined` falls
36
+ * back to `fallback`; `false` and an empty array both mean "discovery off" and return `[]`. Repeated
37
+ * entries are dropped so the same directory is never scanned twice.
38
+ */
39
+ export declare function discoveryRoots(value: string | readonly string[] | false | undefined, fallback: string): string[];
40
+ /**
41
+ * Pick the module extension a directory scan should import, from the `readdir` entries already in
42
+ * hand — NOT from this library's own compiled file. A consuming app resolves this library as built
43
+ * `.js` from `node_modules`, but its own `app/workflows` / `app/steps` are `.ts` in dev; deriving the
44
+ * extension from `import.meta.url` (the old bug) always picked `.js` in that setup and silently
45
+ * discovered nothing, because every entry was then skipped.
46
+ *
47
+ * Rules, in order:
48
+ * 1. `.d.ts` entries are never importable modules — ignored entirely.
49
+ * 2. If any remaining entry ends in `.ts`, the scan imports `.ts` files.
50
+ * 3. Otherwise, if any entry ends in `.js`, the scan imports `.js` files.
51
+ * 4. If neither is present, returns `null` (the scan registers nothing).
52
+ *
53
+ * This preserves the original de-duplication intent: a directory containing both a built `foo.js`
54
+ * and its source `foo.ts` resolves to `.ts` only, so the same module is never registered twice.
55
+ * Shared by the workflow and step scanners so the two can't drift apart again.
56
+ */
57
+ export declare function pickModuleExt(entries: readonly string[]): '.ts' | '.js' | null;
58
+ /**
59
+ * List the importable modules under `dir` RECURSIVELY (sorted, one extension — see
60
+ * {@link pickModuleExt}), tagged with `root`. Missing directory → `[]` (the convention is opt-in).
61
+ */
62
+ export declare function scanDirModules(dir: string, root?: string): Promise<DiscoveryModule[]>;
63
+ /** Scan every directory in `dirs` (in order) — {@link scanDirModules} per root. */
64
+ export declare function scanDirsModules(dirs: readonly string[]): Promise<DiscoveryModule[]>;
65
+ /** Human-readable form of a roots list for log lines: `app/steps` or `app/a, app/b`. */
66
+ export declare function describeRoots(roots: readonly string[]): string;
67
+ /** True when `barrel` is the multi-root array shape rather than a single-root key → loader tree. */
68
+ export declare function isRootedBarrels(barrel: BarrelTree | readonly RootedBarrel[]): barrel is readonly RootedBarrel[];
69
+ /**
70
+ * Flatten a generated barrel into the modules discovery visits, in the barrel's own order. A
71
+ * single-root tree is walked depth-first (nested sub-directory levels included) and every module is
72
+ * tagged with the same root, so no cross-root check can fire; a multi-root array keeps each root.
73
+ */
74
+ export declare function barrelModules(barrel: BarrelTree | readonly RootedBarrel[]): DiscoveryModule[];
75
+ /**
76
+ * The error thrown when two discovery roots define the same workflow (name + version) or step name
77
+ * with different classes / handlers. Within ONE root the historical behaviour is kept (last
78
+ * registration wins), so this only fires across roots — e.g. two bounded contexts that both declared
79
+ * a `charge` workflow.
80
+ */
81
+ export declare class DuplicateDiscoveryError extends Error {
82
+ readonly kind: 'workflow' | 'step';
83
+ readonly id: string;
84
+ readonly files: readonly [string, string];
85
+ /**
86
+ * @param kind what clashed.
87
+ * @param id the clashing identity: the step name, or `name@version` for a workflow.
88
+ * @param files the two modules defining it (first registered, then the clashing one).
89
+ */
90
+ constructor(kind: 'workflow' | 'step', id: string, files: readonly [string, string]);
91
+ }
92
+ //# sourceMappingURL=discovery-roots.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"discovery-roots.d.ts","sourceRoot":"","sources":["../../src/discovery-roots.ts"],"names":[],"mappings":"AAIA;;;;GAIG;AAEH,sGAAsG;AACtG,MAAM,MAAM,kBAAkB,GAAG,MAAM,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;AAExE;;;;GAIG;AACH,MAAM,WAAW,UAAU;IACzB,CAAC,GAAG,EAAE,MAAM,GAAG,kBAAkB,GAAG,UAAU,CAAC;CAChD;AAED;;;;;GAKG;AACH,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;CAC7C;AAED,2FAA2F;AAC3F,MAAM,WAAW,eAAe;IAC9B,2EAA2E;IAC3E,IAAI,EAAE,MAAM,CAAC;IACb,kGAAkG;IAClG,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,kBAAkB,CAAC;CAC1B;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,GAAG,KAAK,GAAG,SAAS,EACrD,QAAQ,EAAE,MAAM,GACf,MAAM,EAAE,CAIV;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,GAAG,KAAK,GAAG,KAAK,GAAG,IAAI,CAY9E;AAED;;;GAGG;AACH,wBAAsB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,GAAE,MAAY,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC,CAqBhG;AAED,mFAAmF;AACnF,wBAAsB,eAAe,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC,CAIzF;AAED,wFAAwF;AACxF,wBAAgB,aAAa,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAE9D;AAED,oGAAoG;AACpG,wBAAgB,eAAe,CAC7B,MAAM,EAAE,UAAU,GAAG,SAAS,YAAY,EAAE,GAC3C,MAAM,IAAI,SAAS,YAAY,EAAE,CAEnC;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,UAAU,GAAG,SAAS,YAAY,EAAE,GAAG,eAAe,EAAE,CAiB7F;AAED;;;;;GAKG;AACH,qBAAa,uBAAwB,SAAQ,KAAK;IAO9C,QAAQ,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM;IAClC,QAAQ,CAAC,EAAE,EAAE,MAAM;IACnB,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC;IAR3C;;;;OAIG;IACH,YACW,IAAI,EAAE,UAAU,GAAG,MAAM,EACzB,EAAE,EAAE,MAAM,EACV,KAAK,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,EAa1C;CACF"}
@@ -0,0 +1,150 @@
1
+ import { readdir } from 'node:fs/promises';
2
+ import { extname, join } from 'node:path';
3
+ import { pathToFileURL } from 'node:url';
4
+ /**
5
+ * Normalise a `workflowsPath` / `stepsPath` value into the list of roots to scan. `undefined` falls
6
+ * back to `fallback`; `false` and an empty array both mean "discovery off" and return `[]`. Repeated
7
+ * entries are dropped so the same directory is never scanned twice.
8
+ */
9
+ export function discoveryRoots(value, fallback) {
10
+ if (value === false)
11
+ return [];
12
+ const list = value === undefined ? [fallback] : typeof value === 'string' ? [value] : value;
13
+ return [...new Set(list)];
14
+ }
15
+ /**
16
+ * Pick the module extension a directory scan should import, from the `readdir` entries already in
17
+ * hand — NOT from this library's own compiled file. A consuming app resolves this library as built
18
+ * `.js` from `node_modules`, but its own `app/workflows` / `app/steps` are `.ts` in dev; deriving the
19
+ * extension from `import.meta.url` (the old bug) always picked `.js` in that setup and silently
20
+ * discovered nothing, because every entry was then skipped.
21
+ *
22
+ * Rules, in order:
23
+ * 1. `.d.ts` entries are never importable modules — ignored entirely.
24
+ * 2. If any remaining entry ends in `.ts`, the scan imports `.ts` files.
25
+ * 3. Otherwise, if any entry ends in `.js`, the scan imports `.js` files.
26
+ * 4. If neither is present, returns `null` (the scan registers nothing).
27
+ *
28
+ * This preserves the original de-duplication intent: a directory containing both a built `foo.js`
29
+ * and its source `foo.ts` resolves to `.ts` only, so the same module is never registered twice.
30
+ * Shared by the workflow and step scanners so the two can't drift apart again.
31
+ */
32
+ export function pickModuleExt(entries) {
33
+ let hasTs = false;
34
+ let hasJs = false;
35
+ for (const entry of entries) {
36
+ if (entry.endsWith('.d.ts'))
37
+ continue;
38
+ const ext = extname(entry);
39
+ if (ext === '.ts')
40
+ hasTs = true;
41
+ else if (ext === '.js')
42
+ hasJs = true;
43
+ }
44
+ if (hasTs)
45
+ return '.ts';
46
+ if (hasJs)
47
+ return '.js';
48
+ return null;
49
+ }
50
+ /**
51
+ * List the importable modules under `dir` RECURSIVELY (sorted, one extension — see
52
+ * {@link pickModuleExt}), tagged with `root`. Missing directory → `[]` (the convention is opt-in).
53
+ */
54
+ export async function scanDirModules(dir, root = dir) {
55
+ let entries;
56
+ try {
57
+ entries = await readdir(dir, { recursive: true });
58
+ }
59
+ catch (err) {
60
+ if (err.code === 'ENOENT')
61
+ return [];
62
+ throw err;
63
+ }
64
+ const moduleExt = pickModuleExt(entries);
65
+ if (moduleExt === null)
66
+ return [];
67
+ const modules = [];
68
+ for (const entry of entries.sort()) {
69
+ if (extname(entry) !== moduleExt || entry.endsWith(`.d${moduleExt}`))
70
+ continue;
71
+ const file = join(dir, entry);
72
+ modules.push({
73
+ root,
74
+ file,
75
+ load: async () => (await import(pathToFileURL(file).href)),
76
+ });
77
+ }
78
+ return modules;
79
+ }
80
+ /** Scan every directory in `dirs` (in order) — {@link scanDirModules} per root. */
81
+ export async function scanDirsModules(dirs) {
82
+ const modules = [];
83
+ for (const dir of dirs)
84
+ modules.push(...(await scanDirModules(dir)));
85
+ return modules;
86
+ }
87
+ /** Human-readable form of a roots list for log lines: `app/steps` or `app/a, app/b`. */
88
+ export function describeRoots(roots) {
89
+ return roots.join(', ');
90
+ }
91
+ /** True when `barrel` is the multi-root array shape rather than a single-root key → loader tree. */
92
+ export function isRootedBarrels(barrel) {
93
+ return Array.isArray(barrel);
94
+ }
95
+ /**
96
+ * Flatten a generated barrel into the modules discovery visits, in the barrel's own order. A
97
+ * single-root tree is walked depth-first (nested sub-directory levels included) and every module is
98
+ * tagged with the same root, so no cross-root check can fire; a multi-root array keeps each root.
99
+ */
100
+ export function barrelModules(barrel) {
101
+ const modules = [];
102
+ if (isRootedBarrels(barrel)) {
103
+ for (const { root, modules: entries } of barrel) {
104
+ for (const [file, load] of Object.entries(entries))
105
+ modules.push({ root, file, load });
106
+ }
107
+ return modules;
108
+ }
109
+ const walk = (tree, prefix) => {
110
+ for (const [key, value] of Object.entries(tree)) {
111
+ const path = prefix ? `${prefix}/${key}` : key;
112
+ if (typeof value === 'function')
113
+ modules.push({ root: '', file: path, load: value });
114
+ else if (value && typeof value === 'object')
115
+ walk(value, path);
116
+ }
117
+ };
118
+ walk(barrel, '');
119
+ return modules;
120
+ }
121
+ /**
122
+ * The error thrown when two discovery roots define the same workflow (name + version) or step name
123
+ * with different classes / handlers. Within ONE root the historical behaviour is kept (last
124
+ * registration wins), so this only fires across roots — e.g. two bounded contexts that both declared
125
+ * a `charge` workflow.
126
+ */
127
+ export class DuplicateDiscoveryError extends Error {
128
+ kind;
129
+ id;
130
+ files;
131
+ /**
132
+ * @param kind what clashed.
133
+ * @param id the clashing identity: the step name, or `name@version` for a workflow.
134
+ * @param files the two modules defining it (first registered, then the clashing one).
135
+ */
136
+ constructor(kind, id, files) {
137
+ const at = id.lastIndexOf('@');
138
+ const label = kind === 'workflow' && at > 0
139
+ ? `workflow "${id.slice(0, at)}" (version ${id.slice(at + 1)})`
140
+ : `${kind} "${id}"`;
141
+ super(`@agora/durable: ${label} is defined in two discovery roots: ${files[0]} and ${files[1]}. ` +
142
+ `${kind === 'workflow' ? 'Workflow names (per version)' : 'Step names'} must be unique across ` +
143
+ `every ${kind === 'workflow' ? 'workflowsPath' : 'stepsPath'} directory; rename one of them.`);
144
+ this.kind = kind;
145
+ this.id = id;
146
+ this.files = files;
147
+ this.name = 'DuplicateDiscoveryError';
148
+ }
149
+ }
150
+ //# sourceMappingURL=discovery-roots.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"discovery-roots.js","sourceRoot":"","sources":["../../src/discovery-roots.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAwCzC;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAC5B,KAAqD,EACrD,QAAgB;IAEhB,IAAI,KAAK,KAAK,KAAK;QAAE,OAAO,EAAE,CAAC;IAC/B,MAAM,IAAI,GAAG,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,OAAO,KAAK,KAAK,QAAQ,CAAC,CAA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