@atolis-hq/wake 0.4.1 → 0.4.7

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 (706) hide show
  1. package/README.md +9 -0
  2. package/dist/src/activities/agent/agent-activity-definition.d.ts +9 -0
  3. package/dist/src/activities/agent/agent-activity.d.ts +51 -0
  4. package/dist/src/activities/agent/agent-result.d.ts +43 -0
  5. package/dist/src/activities/contracts/activity.d.ts +184 -0
  6. package/dist/src/activities/contracts/config.d.ts +3 -0
  7. package/dist/src/activities/contracts/decision-claim-schema.d.ts +35 -0
  8. package/dist/src/activities/contracts/decision-claim-schema.js +42 -0
  9. package/dist/src/activities/contracts/event-factory.d.ts +6 -0
  10. package/dist/src/activities/contracts/event-factory.js +40 -0
  11. package/dist/src/activities/contracts/event-integrity.d.ts +61 -0
  12. package/dist/src/activities/contracts/event-integrity.js +50 -0
  13. package/dist/src/activities/contracts/event-schema.d.ts +2803 -0
  14. package/dist/src/activities/contracts/event-schema.js +67 -121
  15. package/dist/src/activities/contracts/events.d.ts +153 -0
  16. package/dist/src/activities/contracts/events.js +4 -4
  17. package/dist/src/activities/contracts/identifiers.d.ts +5 -0
  18. package/dist/src/activities/contracts/registry.d.ts +19 -0
  19. package/dist/src/activities/contracts/streams.d.ts +13 -0
  20. package/dist/src/activities/contracts/vocabulary.d.ts +69 -0
  21. package/dist/src/activities/index.d.ts +23 -0
  22. package/dist/src/activities/index.js +1 -0
  23. package/dist/src/activities/issue/complete.d.ts +26 -0
  24. package/dist/src/activities/issue/complete.js +5 -5
  25. package/dist/src/activities/pr/activity-support.d.ts +38 -0
  26. package/dist/src/activities/pr/activity-support.js +1 -1
  27. package/dist/src/activities/pr/application.d.ts +17 -0
  28. package/dist/src/activities/pr/application.js +6 -6
  29. package/dist/src/activities/pr/approve.d.ts +7 -0
  30. package/dist/src/activities/pr/approve.js +8 -3
  31. package/dist/src/activities/pr/capability.d.ts +2 -0
  32. package/dist/src/activities/pr/contracts.d.ts +133 -0
  33. package/dist/src/activities/pr/decision-claim.d.ts +26 -0
  34. package/dist/src/activities/pr/decision-claim.js +50 -30
  35. package/dist/src/activities/pr/event-data.d.ts +21 -0
  36. package/dist/src/activities/pr/event-data.js +101 -0
  37. package/dist/src/activities/pr/intent.d.ts +12 -0
  38. package/dist/src/activities/pr/intent.js +5 -5
  39. package/dist/src/activities/pr/merge-authority-gate.d.ts +13 -0
  40. package/dist/src/activities/pr/merge-authority-gate.js +1 -1
  41. package/dist/src/activities/pr/merge.d.ts +7 -0
  42. package/dist/src/activities/pr/merge.js +8 -3
  43. package/dist/src/activities/pr/policy.d.ts +13 -0
  44. package/dist/src/activities/pr/projection.d.ts +5 -0
  45. package/dist/src/activities/pr/projection.js +18 -17
  46. package/dist/src/activities/pr/vocabulary.d.ts +34 -0
  47. package/dist/src/activities/review/authorization.d.ts +9 -0
  48. package/dist/src/activities/review/contracts.d.ts +46 -0
  49. package/dist/src/activities/review/signals.d.ts +2 -0
  50. package/dist/src/bootstrap/activation-scheduler-serialiser.d.ts +3 -0
  51. package/dist/src/bootstrap/activation-scheduler-serialiser.js +8 -0
  52. package/dist/src/bootstrap/activity-registry.d.ts +4 -0
  53. package/dist/src/bootstrap/analytics-projection.d.ts +12 -0
  54. package/dist/src/bootstrap/analytics-projection.js +3 -3
  55. package/dist/src/bootstrap/board-projection.d.ts +56 -0
  56. package/dist/src/bootstrap/board-projection.js +156 -71
  57. package/dist/src/bootstrap/composition-root.d.ts +76 -0
  58. package/dist/src/bootstrap/composition-root.js +20 -13
  59. package/dist/src/bootstrap/config/load-config.d.ts +6 -0
  60. package/dist/src/bootstrap/config/root-schema.d.ts +443 -0
  61. package/dist/src/bootstrap/event-processor-runtime.d.ts +22 -0
  62. package/dist/src/bootstrap/event-processor-runtime.js +88 -0
  63. package/dist/src/bootstrap/external-ref.d.ts +3 -0
  64. package/dist/src/bootstrap/fake-provider-files.d.ts +3 -0
  65. package/dist/src/bootstrap/fake-scenarios.d.ts +3 -0
  66. package/dist/src/bootstrap/index.d.ts +27 -0
  67. package/dist/src/bootstrap/index.js +2 -28
  68. package/dist/src/bootstrap/initialise.d.ts +4 -0
  69. package/dist/src/bootstrap/initialise.js +8 -16
  70. package/dist/src/bootstrap/integration-runtime.d.ts +48 -0
  71. package/dist/src/bootstrap/integration-runtime.js +36 -54
  72. package/dist/src/bootstrap/paths.d.ts +12 -0
  73. package/dist/src/bootstrap/persistence-composition.d.ts +21 -0
  74. package/dist/src/bootstrap/persistence-composition.js +12 -4
  75. package/dist/src/bootstrap/projection-runtime.d.ts +16 -0
  76. package/dist/src/bootstrap/projection-runtime.js +50 -23
  77. package/dist/src/bootstrap/resource-transition-evidence.d.ts +11 -0
  78. package/dist/src/bootstrap/runner-quota-reporter.d.ts +6 -0
  79. package/dist/src/bootstrap/runner-quota-reporter.js +16 -11
  80. package/dist/src/bootstrap/runner-registry.d.ts +3 -0
  81. package/dist/src/bootstrap/runner-tick-adapter.d.ts +16 -0
  82. package/dist/src/bootstrap/runner-tick-adapter.js +57 -0
  83. package/dist/src/bootstrap/schedule-checkpoint-store.d.ts +9 -0
  84. package/dist/src/bootstrap/self-update-application.d.ts +54 -0
  85. package/dist/src/bootstrap/self-update-failure-log.d.ts +17 -0
  86. package/dist/src/bootstrap/source-update-port.d.ts +8 -0
  87. package/dist/src/bootstrap/status-publish-activity.d.ts +7 -0
  88. package/dist/src/bootstrap/status-publish-activity.js +4 -5
  89. package/dist/src/bootstrap/surface-api-applications.d.ts +18 -0
  90. package/dist/src/bootstrap/surface-api-applications.js +104 -57
  91. package/dist/src/bootstrap/surface-api-execution-applications.d.ts +3 -0
  92. package/dist/src/bootstrap/surface-api-execution-applications.js +3 -3
  93. package/dist/src/bootstrap/surface-api-metadata.d.ts +4 -0
  94. package/dist/src/bootstrap/surface-api-metadata.js +1 -1
  95. package/dist/src/bootstrap/surface-api-projection-pages.d.ts +12 -0
  96. package/dist/src/bootstrap/surface-api-run-context.d.ts +12 -0
  97. package/dist/src/bootstrap/surface-api-transcripts.d.ts +10 -0
  98. package/dist/src/bootstrap/surface-api-work-applications.d.ts +3 -0
  99. package/dist/src/bootstrap/surface-api-work-applications.js +3 -3
  100. package/dist/src/bootstrap/surface-api-workflow-diagrams.d.ts +11 -0
  101. package/dist/src/bootstrap/surface-api-workflow-diagrams.js +2 -2
  102. package/dist/src/bootstrap/surface-applications.d.ts +10 -0
  103. package/dist/src/bootstrap/surface-cli-applications.d.ts +33 -0
  104. package/dist/src/bootstrap/surface-cli-applications.js +151 -65
  105. package/dist/src/bootstrap/transcript-retention.d.ts +11 -0
  106. package/dist/src/bootstrap/update-ledger.d.ts +9 -0
  107. package/dist/src/bootstrap/update-maintenance-lease.d.ts +24 -0
  108. package/dist/src/bootstrap/update-maintenance-lease.js +1 -1
  109. package/dist/src/bootstrap/version.d.ts +13 -0
  110. package/dist/src/bootstrap/version.js +1 -1
  111. package/dist/src/control-plane/application/activation-scheduler-ports.d.ts +71 -0
  112. package/dist/src/control-plane/application/activation-scheduler-subscriber.d.ts +42 -0
  113. package/dist/src/control-plane/application/activation-scheduler-subscriber.js +111 -0
  114. package/dist/src/control-plane/application/activation-scheduler.d.ts +8 -0
  115. package/dist/src/control-plane/application/activation-scheduler.js +165 -0
  116. package/dist/src/control-plane/application/advance-once-dispatch.d.ts +46 -0
  117. package/dist/src/control-plane/application/advance-once-dispatch.js +10 -8
  118. package/dist/src/control-plane/application/advance-once.d.ts +5 -0
  119. package/dist/src/control-plane/application/advance-once.js +4 -158
  120. package/dist/src/control-plane/application/control-plane-projection.d.ts +21 -0
  121. package/dist/src/control-plane/application/control-plane-projection.js +27 -5
  122. package/dist/src/control-plane/application/control-plane-service.d.ts +12 -0
  123. package/dist/src/control-plane/application/control-plane-service.js +28 -9
  124. package/dist/src/control-plane/application/execution-reconciliation.d.ts +21 -0
  125. package/dist/src/control-plane/application/intake-pipeline.d.ts +18 -0
  126. package/dist/src/control-plane/application/intake-pipeline.js +8 -18
  127. package/dist/src/control-plane/application/runner-control-service.d.ts +12 -0
  128. package/dist/src/control-plane/application/runner-control-service.js +35 -13
  129. package/dist/src/control-plane/application/runner-pipeline.d.ts +24 -0
  130. package/dist/src/control-plane/application/runner-pipeline.js +23 -41
  131. package/dist/src/control-plane/application/schedule-service.d.ts +31 -0
  132. package/dist/src/control-plane/application/schedule-service.js +1 -1
  133. package/dist/src/control-plane/application/work-cancellation-policy.d.ts +20 -0
  134. package/dist/src/control-plane/application/work-cancellation-policy.js +1 -1
  135. package/dist/src/control-plane/contracts/commands.d.ts +20 -0
  136. package/dist/src/control-plane/contracts/config.d.ts +30 -0
  137. package/dist/src/control-plane/contracts/config.js +7 -1
  138. package/dist/src/control-plane/contracts/event-factory.d.ts +6 -0
  139. package/dist/src/control-plane/contracts/event-factory.js +14 -0
  140. package/dist/src/control-plane/contracts/events.d.ts +36 -0
  141. package/dist/src/control-plane/contracts/events.js +42 -47
  142. package/dist/src/control-plane/contracts/streams.d.ts +6 -0
  143. package/dist/src/control-plane/contracts/views.d.ts +28 -0
  144. package/dist/src/control-plane/domain/dispatch-policy.d.ts +18 -0
  145. package/dist/src/control-plane/domain/quota-policy.d.ts +21 -0
  146. package/dist/src/control-plane/domain/runner-quota.d.ts +2 -0
  147. package/dist/src/control-plane/domain/schedule-policy.d.ts +8 -0
  148. package/dist/src/control-plane/index.d.ts +24 -0
  149. package/dist/src/control-plane/index.js +3 -0
  150. package/dist/src/control-plane/infrastructure/intake-host.d.ts +19 -0
  151. package/dist/src/control-plane/infrastructure/intake-host.js +2 -3
  152. package/dist/src/control-plane/infrastructure/resident-host.d.ts +16 -0
  153. package/dist/src/control-plane/infrastructure/resident-host.js +3 -1
  154. package/dist/src/control-plane/infrastructure/tick-host.d.ts +6 -0
  155. package/dist/src/control-plane/infrastructure/tick-host.js +2 -2
  156. package/dist/src/conversations/application/conversation-projection.d.ts +3 -0
  157. package/dist/src/conversations/application/conversation-repository.d.ts +13 -0
  158. package/dist/src/conversations/application/conversation-repository.js +1 -1
  159. package/dist/src/conversations/application/conversation-service.d.ts +16 -0
  160. package/dist/src/conversations/application/conversation-service.js +32 -27
  161. package/dist/src/conversations/contracts/commands.d.ts +33 -0
  162. package/dist/src/conversations/contracts/event-factory.d.ts +6 -0
  163. package/dist/src/conversations/contracts/event-factory.js +18 -0
  164. package/dist/src/conversations/contracts/events.d.ts +42 -0
  165. package/dist/src/conversations/contracts/events.js +37 -24
  166. package/dist/src/conversations/contracts/identifiers.d.ts +5 -0
  167. package/dist/src/conversations/contracts/streams.d.ts +7 -0
  168. package/dist/src/conversations/contracts/views.d.ts +49 -0
  169. package/dist/src/conversations/contracts/vocabulary.d.ts +5 -0
  170. package/dist/src/conversations/domain/conversation.d.ts +4 -0
  171. package/dist/src/conversations/domain/conversation.js +8 -7
  172. package/dist/src/conversations/index.d.ts +9 -0
  173. package/dist/src/conversations/index.js +1 -0
  174. package/dist/src/execution/application/activation-claim.d.ts +23 -0
  175. package/dist/src/execution/application/activation-claim.js +8 -9
  176. package/dist/src/execution/application/active-run-cancellation.d.ts +4 -0
  177. package/dist/src/execution/application/active-run-cancellation.js +2 -2
  178. package/dist/src/execution/application/execution-activity.d.ts +61 -0
  179. package/dist/src/execution/application/execution-activity.js +4 -1
  180. package/dist/src/execution/application/execution-projection.d.ts +11 -0
  181. package/dist/src/execution/application/execution-projection.js +8 -4
  182. package/dist/src/execution/application/execution-service.d.ts +33 -0
  183. package/dist/src/execution/application/execution-service.js +288 -59
  184. package/dist/src/execution/application/execution-validation.d.ts +8 -0
  185. package/dist/src/execution/application/execution-validation.js +3 -2
  186. package/dist/src/execution/application/recovery-service.d.ts +52 -0
  187. package/dist/src/execution/application/recovery-service.js +32 -17
  188. package/dist/src/execution/application/run-lifecycle.d.ts +75 -0
  189. package/dist/src/execution/application/run-lifecycle.js +130 -62
  190. package/dist/src/execution/application/run-liveness-service.d.ts +14 -0
  191. package/dist/src/execution/application/run-liveness-service.js +68 -30
  192. package/dist/src/execution/application/run-repository.d.ts +18 -0
  193. package/dist/src/execution/application/run-repository.js +2 -2
  194. package/dist/src/execution/contracts/commands.d.ts +30 -0
  195. package/dist/src/execution/contracts/config.d.ts +94 -0
  196. package/dist/src/execution/contracts/control-plane.d.ts +10 -0
  197. package/dist/src/execution/contracts/event-factory.d.ts +10 -0
  198. package/dist/src/execution/contracts/event-factory.js +20 -31
  199. package/dist/src/execution/contracts/events.d.ts +198 -0
  200. package/dist/src/execution/contracts/events.js +152 -129
  201. package/dist/src/execution/contracts/identifiers.d.ts +3 -0
  202. package/dist/src/execution/contracts/liveness.d.ts +17 -0
  203. package/dist/src/execution/contracts/results.d.ts +23 -0
  204. package/dist/src/execution/contracts/runner.d.ts +78 -0
  205. package/dist/src/execution/contracts/streams.d.ts +12 -0
  206. package/dist/src/execution/contracts/views.d.ts +42 -0
  207. package/dist/src/execution/contracts/vocabulary.d.ts +50 -0
  208. package/dist/src/execution/contracts/vocabulary.js +4 -0
  209. package/dist/src/execution/contracts/workspace.d.ts +48 -0
  210. package/dist/src/execution/domain/run-result.d.ts +2 -0
  211. package/dist/src/execution/domain/run.d.ts +3 -0
  212. package/dist/src/execution/domain/run.js +72 -22
  213. package/dist/src/execution/index.d.ts +34 -0
  214. package/dist/src/execution/infrastructure/agent-runner-adapter.d.ts +2 -0
  215. package/dist/src/execution/infrastructure/codex-stop-hook.d.ts +13 -0
  216. package/dist/src/execution/infrastructure/process-execution.d.ts +23 -0
  217. package/dist/src/execution/infrastructure/prompt-templates.d.ts +15 -0
  218. package/dist/src/execution/infrastructure/runner-memory-profile.d.ts +11 -0
  219. package/dist/src/execution/infrastructure/runners/claude.d.ts +34 -0
  220. package/dist/src/execution/infrastructure/runners/codex.d.ts +13 -0
  221. package/dist/src/execution/infrastructure/runners/command.d.ts +3 -0
  222. package/dist/src/execution/infrastructure/runners/cursor.d.ts +12 -0
  223. package/dist/src/execution/infrastructure/runners/fake-scenarios.d.ts +35 -0
  224. package/dist/src/execution/infrastructure/runners/fake.d.ts +8 -0
  225. package/dist/src/execution/infrastructure/runners/registry.d.ts +14 -0
  226. package/dist/src/execution/infrastructure/transcript-store.d.ts +48 -0
  227. package/dist/src/execution/infrastructure/transcripts.d.ts +1 -0
  228. package/dist/src/execution/infrastructure/workspace/fake-workspace.d.ts +36 -0
  229. package/dist/src/execution/infrastructure/workspace/fake-workspace.js +2 -0
  230. package/dist/src/execution/infrastructure/workspace/git-workspace.d.ts +29 -0
  231. package/dist/src/execution/infrastructure/workspace/git-workspace.js +21 -11
  232. package/dist/src/execution/infrastructure/workspace/prepare-workspace.d.ts +3 -0
  233. package/dist/src/execution/infrastructure/workspace/prepare-workspace.js +4 -2
  234. package/dist/src/integrations/application/adapter-health-tracker.d.ts +17 -0
  235. package/dist/src/integrations/application/agent-run-publication-reactor.d.ts +25 -0
  236. package/dist/src/integrations/application/agent-run-publication-reactor.js +36 -20
  237. package/dist/src/integrations/application/artifact-registration-reactor.d.ts +32 -0
  238. package/dist/src/integrations/application/artifact-registration-reactor.js +43 -35
  239. package/dist/src/integrations/application/poll-service.d.ts +13 -0
  240. package/dist/src/integrations/application/poll-service.js +2 -2
  241. package/dist/src/integrations/application/terminal-agent-run-report.d.ts +33 -0
  242. package/dist/src/integrations/application/work-admission.d.ts +30 -0
  243. package/dist/src/integrations/application/work-conclusion.d.ts +13 -0
  244. package/dist/src/integrations/contracts/artifact-event-factory.d.ts +6 -0
  245. package/dist/src/integrations/contracts/artifact-event-factory.js +8 -0
  246. package/dist/src/integrations/contracts/artifact-events.d.ts +31 -0
  247. package/dist/src/integrations/contracts/artifact-events.js +24 -24
  248. package/dist/src/integrations/contracts/artifact-vocabulary.d.ts +11 -0
  249. package/dist/src/integrations/contracts/config.d.ts +13 -0
  250. package/dist/src/integrations/contracts/identifiers.d.ts +3 -0
  251. package/dist/src/integrations/contracts/intake-rules.d.ts +15 -0
  252. package/dist/src/integrations/contracts/intake.d.ts +15 -0
  253. package/dist/src/integrations/contracts/outcome-vocabulary.d.ts +6 -0
  254. package/dist/src/integrations/contracts/provider.d.ts +105 -0
  255. package/dist/src/integrations/contracts/reply-routing.d.ts +31 -0
  256. package/dist/src/integrations/contracts/streams.d.ts +12 -0
  257. package/dist/src/integrations/delivery/application/delivery-outcome-reactor.d.ts +24 -0
  258. package/dist/src/integrations/delivery/application/delivery-outcome-reactor.js +151 -73
  259. package/dist/src/integrations/delivery/application/delivery-projector.d.ts +5 -0
  260. package/dist/src/integrations/delivery/application/delivery-projector.js +52 -52
  261. package/dist/src/integrations/delivery/application/delivery-service.d.ts +40 -0
  262. package/dist/src/integrations/delivery/application/delivery-service.js +15 -16
  263. package/dist/src/integrations/delivery/contracts/commands.d.ts +7 -0
  264. package/dist/src/integrations/delivery/contracts/config.d.ts +25 -0
  265. package/dist/src/integrations/delivery/contracts/event-factory.d.ts +11 -0
  266. package/dist/src/integrations/delivery/contracts/event-factory.js +20 -9
  267. package/dist/src/integrations/delivery/contracts/events.d.ts +46 -0
  268. package/dist/src/integrations/delivery/contracts/events.js +33 -18
  269. package/dist/src/integrations/delivery/contracts/intents.d.ts +54 -0
  270. package/dist/src/integrations/delivery/contracts/intents.js +21 -14
  271. package/dist/src/integrations/delivery/contracts/views.d.ts +47 -0
  272. package/dist/src/integrations/delivery/contracts/vocabulary.d.ts +25 -0
  273. package/dist/src/integrations/fake/durable-delivery-provider.d.ts +29 -0
  274. package/dist/src/integrations/fake/external-sink.d.ts +5 -0
  275. package/dist/src/integrations/fake/external-source.d.ts +30 -0
  276. package/dist/src/integrations/fake/external-source.js +1 -3
  277. package/dist/src/integrations/fake/inbound-translator.d.ts +16 -0
  278. package/dist/src/integrations/fake/inbound-translator.js +22 -10
  279. package/dist/src/integrations/fake/provider.d.ts +38 -0
  280. package/dist/src/integrations/fake/provider.js +3 -1
  281. package/dist/src/integrations/github/application/agent-context-reader.d.ts +6 -0
  282. package/dist/src/integrations/github/application/agent-context-reader.js +10 -7
  283. package/dist/src/integrations/github/application/agent-run-comment.d.ts +22 -0
  284. package/dist/src/integrations/github/application/comment-history-reader.d.ts +25 -0
  285. package/dist/src/integrations/github/application/comment-history-reader.js +36 -32
  286. package/dist/src/integrations/github/application/delivery-marker.d.ts +2 -0
  287. package/dist/src/integrations/github/application/inbound-comment-syntax.d.ts +8 -0
  288. package/dist/src/integrations/github/application/inbound-comment-syntax.js +2 -0
  289. package/dist/src/integrations/github/application/inbound-context.d.ts +3 -0
  290. package/dist/src/integrations/github/application/inbound-context.js +4 -4
  291. package/dist/src/integrations/github/application/inbound-review-signals.d.ts +21 -0
  292. package/dist/src/integrations/github/application/inbound-review-signals.js +53 -23
  293. package/dist/src/integrations/github/application/inbound-translator.d.ts +103 -0
  294. package/dist/src/integrations/github/application/inbound-translator.js +149 -160
  295. package/dist/src/integrations/github/application/inbound-watch-gate-signals.d.ts +10 -0
  296. package/dist/src/integrations/github/application/inbound-watch-gate-signals.js +4 -4
  297. package/dist/src/integrations/github/application/intake-policy.d.ts +7 -0
  298. package/dist/src/integrations/github/application/operator-retry-command.d.ts +1 -0
  299. package/dist/src/integrations/github/application/outbound-translator.d.ts +19 -0
  300. package/dist/src/integrations/github/application/poll-service.d.ts +11 -0
  301. package/dist/src/integrations/github/application/poll-service.js +11 -2
  302. package/dist/src/integrations/github/application/pull-request-translation.d.ts +5 -0
  303. package/dist/src/integrations/github/application/reply-target-selector.d.ts +8 -0
  304. package/dist/src/integrations/github/application/resource-links.d.ts +2 -0
  305. package/dist/src/integrations/github/application/review-command-translator.d.ts +14 -0
  306. package/dist/src/integrations/github/application/wake-labels.d.ts +29 -0
  307. package/dist/src/integrations/github/contracts/check-evidence.d.ts +1 -0
  308. package/dist/src/integrations/github/contracts/config.d.ts +81 -0
  309. package/dist/src/integrations/github/contracts/event-factory.d.ts +6 -0
  310. package/dist/src/integrations/github/contracts/event-factory.js +26 -0
  311. package/dist/src/integrations/github/contracts/events.d.ts +135 -0
  312. package/dist/src/integrations/github/contracts/events.js +118 -132
  313. package/dist/src/integrations/github/contracts/external-key.d.ts +8 -0
  314. package/dist/src/integrations/github/contracts/issue-query.d.ts +5 -0
  315. package/dist/src/integrations/github/contracts/payloads.d.ts +74 -0
  316. package/dist/src/integrations/github/contracts/vocabulary.d.ts +64 -0
  317. package/dist/src/integrations/github/contracts/vocabulary.js +3 -1
  318. package/dist/src/integrations/github/index.d.ts +34 -0
  319. package/dist/src/integrations/github/index.js +1 -0
  320. package/dist/src/integrations/github/infrastructure/adapter-health-registry.d.ts +11 -0
  321. package/dist/src/integrations/github/infrastructure/bounded-fetch.d.ts +10 -0
  322. package/dist/src/integrations/github/infrastructure/client-reads.d.ts +255 -0
  323. package/dist/src/integrations/github/infrastructure/client.d.ts +263 -0
  324. package/dist/src/integrations/github/infrastructure/comment-source.d.ts +7 -0
  325. package/dist/src/integrations/github/infrastructure/comment-source.js +2 -1
  326. package/dist/src/integrations/github/infrastructure/content-fingerprint.d.ts +2 -0
  327. package/dist/src/integrations/github/infrastructure/delivery.d.ts +6 -0
  328. package/dist/src/integrations/github/infrastructure/etag-cache.d.ts +29 -0
  329. package/dist/src/integrations/github/infrastructure/gh-auth.d.ts +4 -0
  330. package/dist/src/integrations/github/infrastructure/issue-source.d.ts +20 -0
  331. package/dist/src/integrations/github/infrastructure/issue-source.js +10 -6
  332. package/dist/src/integrations/github/infrastructure/poll-watermark.d.ts +12 -0
  333. package/dist/src/integrations/github/infrastructure/pr-source.d.ts +16 -0
  334. package/dist/src/integrations/github/infrastructure/pr-source.js +6 -4
  335. package/dist/src/integrations/github/infrastructure/request-coordinator.d.ts +13 -0
  336. package/dist/src/integrations/github/infrastructure/review-source.d.ts +10 -0
  337. package/dist/src/integrations/github/infrastructure/review-source.js +29 -25
  338. package/dist/src/integrations/github/infrastructure/source-contracts.d.ts +22 -0
  339. package/dist/src/integrations/github/infrastructure/source.d.ts +12 -0
  340. package/dist/src/integrations/github/infrastructure/source.js +3 -5
  341. package/dist/src/integrations/github/provider.d.ts +3 -0
  342. package/dist/src/integrations/github/provider.js +14 -12
  343. package/dist/src/integrations/index.d.ts +32 -0
  344. package/dist/src/integrations/index.js +1 -0
  345. package/dist/src/kernel/contracts/clock.d.ts +3 -0
  346. package/dist/src/kernel/contracts/id-generator.d.ts +3 -0
  347. package/dist/src/kernel/contracts/identifiers.d.ts +7 -0
  348. package/dist/src/kernel/contracts/identifiers.js +1 -8
  349. package/dist/src/kernel/contracts/relations.d.ts +14 -0
  350. package/dist/src/kernel/contracts/schema.d.ts +3 -0
  351. package/dist/src/kernel/contracts/vocabulary.d.ts +7 -0
  352. package/dist/src/kernel/domain/match-mode.d.ts +2 -0
  353. package/dist/src/kernel/domain/relation.d.ts +9 -0
  354. package/dist/src/kernel/index.d.ts +10 -0
  355. package/dist/src/kernel/index.js +0 -11
  356. package/dist/src/kernel/infrastructure/system-clock.d.ts +4 -0
  357. package/dist/src/kernel/infrastructure/ulid-id-generator.d.ts +4 -0
  358. package/dist/src/main.d.ts +14 -0
  359. package/dist/src/node_modules/@atolis-hq/eventing/LICENSE +201 -0
  360. package/dist/src/node_modules/@atolis-hq/eventing/README.md +41 -0
  361. package/dist/src/node_modules/@atolis-hq/eventing/dist/contracts/commands.d.ts +9 -0
  362. package/dist/src/node_modules/@atolis-hq/eventing/dist/contracts/commands.d.ts.map +1 -0
  363. package/dist/src/node_modules/@atolis-hq/eventing/dist/contracts/event-envelope.d.ts +13 -0
  364. package/dist/src/node_modules/@atolis-hq/eventing/dist/contracts/event-envelope.d.ts.map +1 -0
  365. package/dist/src/{kernel/domain → node_modules/@atolis-hq/eventing/dist/contracts}/event-envelope.js +4 -4
  366. package/dist/src/node_modules/@atolis-hq/eventing/dist/contracts/event-schema.d.ts +83 -0
  367. package/dist/src/node_modules/@atolis-hq/eventing/dist/contracts/event-schema.d.ts.map +1 -0
  368. package/dist/src/{kernel → node_modules/@atolis-hq/eventing/dist}/contracts/event-schema.js +21 -5
  369. package/dist/src/node_modules/@atolis-hq/eventing/dist/contracts/events.d.ts +46 -0
  370. package/dist/src/node_modules/@atolis-hq/eventing/dist/contracts/events.d.ts.map +1 -0
  371. package/dist/src/node_modules/@atolis-hq/eventing/dist/contracts/events.js +10 -0
  372. package/dist/src/node_modules/@atolis-hq/eventing/dist/contracts/identifiers.d.ts +11 -0
  373. package/dist/src/node_modules/@atolis-hq/eventing/dist/contracts/identifiers.d.ts.map +1 -0
  374. package/dist/src/node_modules/@atolis-hq/eventing/dist/contracts/identifiers.js +8 -0
  375. package/dist/src/node_modules/@atolis-hq/eventing/dist/contracts/processor-state-store.d.ts +11 -0
  376. package/dist/src/node_modules/@atolis-hq/eventing/dist/contracts/processor-state-store.d.ts.map +1 -0
  377. package/dist/src/node_modules/@atolis-hq/eventing/dist/index.d.ts +19 -0
  378. package/dist/src/node_modules/@atolis-hq/eventing/dist/index.d.ts.map +1 -0
  379. package/dist/src/node_modules/@atolis-hq/eventing/dist/index.js +17 -0
  380. package/dist/src/node_modules/@atolis-hq/eventing/dist/memory/in-memory-checkpoint-store.d.ts +8 -0
  381. package/dist/src/node_modules/@atolis-hq/eventing/dist/memory/in-memory-checkpoint-store.d.ts.map +1 -0
  382. package/dist/src/node_modules/@atolis-hq/eventing/dist/memory/in-memory-event-journal.d.ts +19 -0
  383. package/dist/src/node_modules/@atolis-hq/eventing/dist/memory/in-memory-event-journal.d.ts.map +1 -0
  384. package/dist/src/node_modules/@atolis-hq/eventing/dist/memory/in-memory-event-journal.js +82 -0
  385. package/dist/src/node_modules/@atolis-hq/eventing/dist/memory/in-memory-processor-run-serialiser.d.ts +6 -0
  386. package/dist/src/node_modules/@atolis-hq/eventing/dist/memory/in-memory-processor-run-serialiser.d.ts.map +1 -0
  387. package/dist/src/node_modules/@atolis-hq/eventing/dist/memory/in-memory-processor-run-serialiser.js +26 -0
  388. package/dist/src/node_modules/@atolis-hq/eventing/dist/memory/in-memory-processor-state-store.d.ts +8 -0
  389. package/dist/src/node_modules/@atolis-hq/eventing/dist/memory/in-memory-processor-state-store.d.ts.map +1 -0
  390. package/dist/src/node_modules/@atolis-hq/eventing/dist/memory/in-memory-processor-state-store.js +20 -0
  391. package/dist/src/node_modules/@atolis-hq/eventing/dist/memory/in-memory-projection-store.d.ts +9 -0
  392. package/dist/src/node_modules/@atolis-hq/eventing/dist/memory/in-memory-projection-store.d.ts.map +1 -0
  393. package/dist/src/{persistence → node_modules/@atolis-hq/eventing/dist}/memory/in-memory-projection-store.js +2 -1
  394. package/dist/src/node_modules/@atolis-hq/eventing/dist/memory/in-process-journal-change-signal.d.ts +10 -0
  395. package/dist/src/node_modules/@atolis-hq/eventing/dist/memory/in-process-journal-change-signal.d.ts.map +1 -0
  396. package/dist/src/{kernel/infrastructure/journal-change-signal.js → node_modules/@atolis-hq/eventing/dist/memory/in-process-journal-change-signal.js} +5 -2
  397. package/dist/src/node_modules/@atolis-hq/eventing/dist/memory.d.ts +7 -0
  398. package/dist/src/node_modules/@atolis-hq/eventing/dist/memory.d.ts.map +1 -0
  399. package/dist/src/node_modules/@atolis-hq/eventing/dist/memory.js +6 -0
  400. package/dist/src/node_modules/@atolis-hq/eventing/dist/projections/projection-processor.d.ts +20 -0
  401. package/dist/src/node_modules/@atolis-hq/eventing/dist/projections/projection-processor.d.ts.map +1 -0
  402. package/dist/src/node_modules/@atolis-hq/eventing/dist/projections/projection-processor.js +83 -0
  403. package/dist/src/node_modules/@atolis-hq/eventing/dist/projections/projection-store.d.ts +22 -0
  404. package/dist/src/node_modules/@atolis-hq/eventing/dist/projections/projection-store.d.ts.map +1 -0
  405. package/dist/src/node_modules/@atolis-hq/eventing/dist/runtime/cached-journal-view.d.ts +8 -0
  406. package/dist/src/node_modules/@atolis-hq/eventing/dist/runtime/cached-journal-view.d.ts.map +1 -0
  407. package/dist/src/node_modules/@atolis-hq/eventing/dist/runtime/cached-journal-view.js +24 -0
  408. package/dist/src/node_modules/@atolis-hq/eventing/dist/runtime/clock.d.ts +4 -0
  409. package/dist/src/node_modules/@atolis-hq/eventing/dist/runtime/clock.d.ts.map +1 -0
  410. package/dist/src/node_modules/@atolis-hq/eventing/dist/runtime/event-processor-host.d.ts +39 -0
  411. package/dist/src/node_modules/@atolis-hq/eventing/dist/runtime/event-processor-host.d.ts.map +1 -0
  412. package/dist/src/node_modules/@atolis-hq/eventing/dist/runtime/event-processor-host.js +168 -0
  413. package/dist/src/node_modules/@atolis-hq/eventing/dist/runtime/processor-health.d.ts +43 -0
  414. package/dist/src/node_modules/@atolis-hq/eventing/dist/runtime/processor-health.d.ts.map +1 -0
  415. package/dist/src/node_modules/@atolis-hq/eventing/dist/runtime/processor-health.js +66 -0
  416. package/dist/src/node_modules/@atolis-hq/eventing/dist/runtime/processor-run-serialiser.d.ts +2 -0
  417. package/dist/src/node_modules/@atolis-hq/eventing/dist/runtime/processor-run-serialiser.d.ts.map +1 -0
  418. package/dist/src/node_modules/@atolis-hq/eventing/dist/runtime/processor-run-serialiser.js +1 -0
  419. package/dist/src/node_modules/@atolis-hq/eventing/dist/runtime/processor-validation.d.ts +7 -0
  420. package/dist/src/node_modules/@atolis-hq/eventing/dist/runtime/processor-validation.d.ts.map +1 -0
  421. package/dist/src/node_modules/@atolis-hq/eventing/dist/runtime/processor-validation.js +43 -0
  422. package/dist/src/node_modules/@atolis-hq/eventing/dist/store/checkpoint-store.d.ts +6 -0
  423. package/dist/src/node_modules/@atolis-hq/eventing/dist/store/checkpoint-store.d.ts.map +1 -0
  424. package/dist/src/node_modules/@atolis-hq/eventing/dist/store/checkpoint-store.js +1 -0
  425. package/dist/src/node_modules/@atolis-hq/eventing/dist/store/event-journal.d.ts +14 -0
  426. package/dist/src/node_modules/@atolis-hq/eventing/dist/store/event-journal.d.ts.map +1 -0
  427. package/dist/src/node_modules/@atolis-hq/eventing/dist/subscriptions/event-processor.d.ts +49 -0
  428. package/dist/src/node_modules/@atolis-hq/eventing/dist/subscriptions/event-processor.d.ts.map +1 -0
  429. package/dist/src/node_modules/@atolis-hq/eventing/dist/subscriptions/event-processor.js +17 -0
  430. package/dist/src/node_modules/@atolis-hq/eventing/dist/subscriptions/journal-change-signal.d.ts +6 -0
  431. package/dist/src/node_modules/@atolis-hq/eventing/dist/subscriptions/journal-change-signal.d.ts.map +1 -0
  432. package/dist/src/node_modules/@atolis-hq/eventing/dist/subscriptions/journal-change-signal.js +1 -0
  433. package/dist/src/node_modules/@atolis-hq/eventing/package.json +42 -0
  434. package/dist/src/node_modules/@atolis-hq/eventing-filesystem/LICENSE +201 -0
  435. package/dist/src/node_modules/@atolis-hq/eventing-filesystem/README.md +40 -0
  436. package/dist/src/node_modules/@atolis-hq/eventing-filesystem/dist/atomic-write.d.ts +23 -0
  437. package/dist/src/node_modules/@atolis-hq/eventing-filesystem/dist/atomic-write.d.ts.map +1 -0
  438. package/dist/src/node_modules/@atolis-hq/eventing-filesystem/dist/atomic-write.js +54 -0
  439. package/dist/src/node_modules/@atolis-hq/eventing-filesystem/dist/event-record-codec.d.ts +4 -0
  440. package/dist/src/node_modules/@atolis-hq/eventing-filesystem/dist/event-record-codec.d.ts.map +1 -0
  441. package/dist/src/node_modules/@atolis-hq/eventing-filesystem/dist/event-record-codec.js +50 -0
  442. package/dist/src/node_modules/@atolis-hq/eventing-filesystem/dist/file-checkpoint-store.d.ts +17 -0
  443. package/dist/src/node_modules/@atolis-hq/eventing-filesystem/dist/file-checkpoint-store.d.ts.map +1 -0
  444. package/dist/src/node_modules/@atolis-hq/eventing-filesystem/dist/file-checkpoint-store.js +99 -0
  445. package/dist/src/node_modules/@atolis-hq/eventing-filesystem/dist/file-event-journal.d.ts +51 -0
  446. package/dist/src/node_modules/@atolis-hq/eventing-filesystem/dist/file-event-journal.d.ts.map +1 -0
  447. package/dist/src/{persistence/filesystem → node_modules/@atolis-hq/eventing-filesystem/dist}/file-event-journal.js +185 -103
  448. package/dist/src/node_modules/@atolis-hq/eventing-filesystem/dist/file-lock.d.ts +34 -0
  449. package/dist/src/node_modules/@atolis-hq/eventing-filesystem/dist/file-lock.d.ts.map +1 -0
  450. package/dist/src/{persistence/filesystem → node_modules/@atolis-hq/eventing-filesystem/dist}/file-lock.js +10 -1
  451. package/dist/src/node_modules/@atolis-hq/eventing-filesystem/dist/file-processor-run-serialiser.d.ts +9 -0
  452. package/dist/src/node_modules/@atolis-hq/eventing-filesystem/dist/file-processor-run-serialiser.d.ts.map +1 -0
  453. package/dist/src/node_modules/@atolis-hq/eventing-filesystem/dist/file-processor-run-serialiser.js +82 -0
  454. package/dist/src/node_modules/@atolis-hq/eventing-filesystem/dist/file-processor-state-store.d.ts +12 -0
  455. package/dist/src/node_modules/@atolis-hq/eventing-filesystem/dist/file-processor-state-store.d.ts.map +1 -0
  456. package/dist/src/node_modules/@atolis-hq/eventing-filesystem/dist/file-processor-state-store.js +127 -0
  457. package/dist/src/node_modules/@atolis-hq/eventing-filesystem/dist/file-projection-store.d.ts +19 -0
  458. package/dist/src/node_modules/@atolis-hq/eventing-filesystem/dist/file-projection-store.d.ts.map +1 -0
  459. package/dist/src/node_modules/@atolis-hq/eventing-filesystem/dist/file-projection-store.js +219 -0
  460. package/dist/src/node_modules/@atolis-hq/eventing-filesystem/dist/index.d.ts +7 -0
  461. package/dist/src/node_modules/@atolis-hq/eventing-filesystem/dist/index.d.ts.map +1 -0
  462. package/dist/src/node_modules/@atolis-hq/eventing-filesystem/dist/index.js +6 -0
  463. package/dist/src/node_modules/@atolis-hq/eventing-filesystem/dist/processor-state-paths.d.ts +10 -0
  464. package/dist/src/node_modules/@atolis-hq/eventing-filesystem/dist/processor-state-paths.d.ts.map +1 -0
  465. package/dist/src/node_modules/@atolis-hq/eventing-filesystem/dist/processor-state-paths.js +27 -0
  466. package/dist/src/node_modules/@atolis-hq/eventing-filesystem/dist/processor-state-record.d.ts +8 -0
  467. package/dist/src/node_modules/@atolis-hq/eventing-filesystem/dist/processor-state-record.d.ts.map +1 -0
  468. package/dist/src/node_modules/@atolis-hq/eventing-filesystem/dist/processor-state-record.js +28 -0
  469. package/dist/src/node_modules/@atolis-hq/eventing-filesystem/dist/storage-name.d.ts +6 -0
  470. package/dist/src/node_modules/@atolis-hq/eventing-filesystem/dist/storage-name.d.ts.map +1 -0
  471. package/dist/src/node_modules/@atolis-hq/eventing-filesystem/dist/storage-name.js +34 -0
  472. package/dist/src/node_modules/@atolis-hq/eventing-filesystem/package.json +38 -0
  473. package/dist/src/orchestration/application/accept-activity-outcome.d.ts +18 -0
  474. package/dist/src/orchestration/application/accept-signal.d.ts +14 -0
  475. package/dist/src/orchestration/application/advance-workflow.d.ts +50 -0
  476. package/dist/src/orchestration/application/advance-workflow.js +15 -14
  477. package/dist/src/orchestration/application/coordination-claims.d.ts +17 -0
  478. package/dist/src/orchestration/application/coordination-claims.js +17 -20
  479. package/dist/src/orchestration/application/durable-append.d.ts +17 -0
  480. package/dist/src/orchestration/application/durable-append.js +1 -1
  481. package/dist/src/orchestration/application/group-budget-recorder.d.ts +9 -0
  482. package/dist/src/orchestration/application/group-budget-recorder.js +9 -6
  483. package/dist/src/orchestration/application/orchestration-projection.d.ts +6 -0
  484. package/dist/src/orchestration/application/orchestration-projection.js +6 -7
  485. package/dist/src/orchestration/application/orchestration-repository.d.ts +23 -0
  486. package/dist/src/orchestration/application/orchestration-repository.js +2 -2
  487. package/dist/src/orchestration/application/orchestration-service.d.ts +93 -0
  488. package/dist/src/orchestration/application/orchestration-service.js +13 -1
  489. package/dist/src/orchestration/application/pull-request-transition-evidence.d.ts +3 -0
  490. package/dist/src/orchestration/application/pull-request-transition-evidence.js +10 -10
  491. package/dist/src/orchestration/application/reactor-command-context.d.ts +5 -0
  492. package/dist/src/orchestration/application/reactor-command-context.js +9 -0
  493. package/dist/src/orchestration/application/request-child.d.ts +29 -0
  494. package/dist/src/orchestration/application/request-child.js +26 -10
  495. package/dist/src/orchestration/application/resource-transition-evidence.d.ts +18 -0
  496. package/dist/src/orchestration/application/resource-transition-matching.d.ts +19 -0
  497. package/dist/src/orchestration/application/resource-transition-matching.js +9 -3
  498. package/dist/src/orchestration/application/resource-transition-reactor.d.ts +16 -0
  499. package/dist/src/orchestration/application/resource-transition-reactor.js +21 -42
  500. package/dist/src/orchestration/application/signal-reactor.d.ts +11 -0
  501. package/dist/src/orchestration/application/start-workflow.d.ts +18 -0
  502. package/dist/src/orchestration/application/start-workflow.js +3 -4
  503. package/dist/src/orchestration/application/trigger-workflow-instance.d.ts +12 -0
  504. package/dist/src/orchestration/application/trigger-workflow-instance.js +1 -1
  505. package/dist/src/orchestration/application/watch-child-transitions.d.ts +2 -0
  506. package/dist/src/orchestration/application/watch-matching.d.ts +13 -0
  507. package/dist/src/orchestration/application/watch-matching.js +3 -3
  508. package/dist/src/orchestration/application/watch-reactor.d.ts +42 -0
  509. package/dist/src/orchestration/application/watch-reactor.js +36 -35
  510. package/dist/src/orchestration/application/workflow-definition-registry.d.ts +32 -0
  511. package/dist/src/orchestration/application/workflow-definition-registry.js +13 -11
  512. package/dist/src/orchestration/contracts/activity-outcome.d.ts +15 -0
  513. package/dist/src/orchestration/contracts/commands.d.ts +30 -0
  514. package/dist/src/orchestration/contracts/config.d.ts +356 -0
  515. package/dist/src/orchestration/contracts/event-decoder.d.ts +262 -0
  516. package/dist/src/orchestration/contracts/event-decoder.js +88 -64
  517. package/dist/src/orchestration/contracts/event-factory.d.ts +6 -0
  518. package/dist/src/orchestration/contracts/event-factory.js +64 -0
  519. package/dist/src/orchestration/contracts/events.d.ts +233 -0
  520. package/dist/src/orchestration/contracts/identifiers.d.ts +15 -0
  521. package/dist/src/orchestration/contracts/streams.d.ts +28 -0
  522. package/dist/src/orchestration/contracts/views.d.ts +68 -0
  523. package/dist/src/orchestration/contracts/vocabulary.d.ts +34 -0
  524. package/dist/src/orchestration/domain/activation-policy.d.ts +60 -0
  525. package/dist/src/orchestration/domain/activation-policy.js +34 -19
  526. package/dist/src/orchestration/domain/approval-defaults.d.ts +8 -0
  527. package/dist/src/orchestration/domain/child-policy.d.ts +20 -0
  528. package/dist/src/orchestration/domain/compiler.d.ts +3 -0
  529. package/dist/src/orchestration/domain/coordination-events.d.ts +18 -0
  530. package/dist/src/orchestration/domain/coordination-events.js +25 -11
  531. package/dist/src/orchestration/domain/decision-events.d.ts +33 -0
  532. package/dist/src/orchestration/domain/decision-events.js +27 -15
  533. package/dist/src/orchestration/domain/interpreter.d.ts +14 -0
  534. package/dist/src/orchestration/domain/interpreter.js +5 -2
  535. package/dist/src/orchestration/domain/operator-retry-policy.d.ts +14 -0
  536. package/dist/src/orchestration/domain/operator-retry-policy.js +36 -10
  537. package/dist/src/orchestration/domain/resource-transition-compiler.d.ts +8 -0
  538. package/dist/src/orchestration/domain/retry-policy.d.ts +7 -0
  539. package/dist/src/orchestration/domain/retry-policy.js +7 -4
  540. package/dist/src/orchestration/domain/runner-quota-retry-policy.d.ts +10 -0
  541. package/dist/src/orchestration/domain/runner-quota-retry-policy.js +21 -15
  542. package/dist/src/orchestration/domain/signal-policy.d.ts +11 -0
  543. package/dist/src/orchestration/domain/signal-policy.js +18 -7
  544. package/dist/src/orchestration/domain/supplemental-policy.d.ts +11 -0
  545. package/dist/src/orchestration/domain/supplemental-policy.js +29 -14
  546. package/dist/src/orchestration/domain/transition.d.ts +16 -0
  547. package/dist/src/orchestration/domain/transition.js +46 -28
  548. package/dist/src/orchestration/domain/workflow-graph.d.ts +4 -0
  549. package/dist/src/orchestration/domain/workflow-instance-events.d.ts +44 -0
  550. package/dist/src/orchestration/domain/workflow-instance-events.js +1 -0
  551. package/dist/src/orchestration/domain/workflow-instance.d.ts +7 -0
  552. package/dist/src/orchestration/domain/workflow-instance.js +29 -9
  553. package/dist/src/orchestration/domain/workflow-selector.d.ts +15 -0
  554. package/dist/src/orchestration/index.d.ts +27 -0
  555. package/dist/src/orchestration/index.js +1 -0
  556. package/dist/src/resources/application/lookup-projections.d.ts +6 -0
  557. package/dist/src/resources/application/lookup-projections.js +15 -15
  558. package/dist/src/resources/application/resource-correlation-retry.d.ts +16 -0
  559. package/dist/src/resources/application/resource-correlation-retry.js +39 -44
  560. package/dist/src/resources/application/resource-event-support.d.ts +12 -0
  561. package/dist/src/resources/application/resource-event-support.js +17 -0
  562. package/dist/src/resources/application/resource-lookup.d.ts +17 -0
  563. package/dist/src/resources/application/resource-lookup.js +9 -9
  564. package/dist/src/resources/application/resource-projections.d.ts +4 -0
  565. package/dist/src/resources/application/resource-projections.js +32 -24
  566. package/dist/src/resources/application/resource-repository.d.ts +16 -0
  567. package/dist/src/resources/application/resource-repository.js +3 -3
  568. package/dist/src/resources/application/resource-service.d.ts +34 -0
  569. package/dist/src/resources/application/resource-service.js +73 -52
  570. package/dist/src/resources/contracts/commands.d.ts +23 -0
  571. package/dist/src/resources/contracts/config.d.ts +3 -0
  572. package/dist/src/resources/contracts/event-factory.d.ts +6 -0
  573. package/dist/src/resources/contracts/event-factory.js +32 -0
  574. package/dist/src/resources/contracts/events.d.ts +79 -0
  575. package/dist/src/resources/contracts/events.js +94 -102
  576. package/dist/src/resources/contracts/identifiers.d.ts +7 -0
  577. package/dist/src/resources/contracts/streams.d.ts +8 -0
  578. package/dist/src/resources/contracts/views.d.ts +35 -0
  579. package/dist/src/resources/contracts/vocabulary.d.ts +50 -0
  580. package/dist/src/resources/domain/correlation.d.ts +6 -0
  581. package/dist/src/resources/domain/resource.d.ts +8 -0
  582. package/dist/src/resources/domain/resource.js +24 -21
  583. package/dist/src/resources/index.d.ts +15 -0
  584. package/dist/src/resources/index.js +1 -0
  585. package/dist/src/surfaces/api/contracts/activities.d.ts +1 -0
  586. package/dist/src/surfaces/api/contracts/board.d.ts +46 -0
  587. package/dist/src/surfaces/api/contracts/board.js +1 -1
  588. package/dist/src/surfaces/api/contracts/common.d.ts +43 -0
  589. package/dist/src/surfaces/api/contracts/control-plane.d.ts +37 -0
  590. package/dist/src/surfaces/api/contracts/events.d.ts +13 -0
  591. package/dist/src/surfaces/api/contracts/execution.d.ts +67 -0
  592. package/dist/src/surfaces/api/contracts/index.d.ts +14 -0
  593. package/dist/src/surfaces/api/contracts/observability.d.ts +10 -0
  594. package/dist/src/surfaces/api/contracts/orchestration.d.ts +16 -0
  595. package/dist/src/surfaces/api/contracts/resources.d.ts +10 -0
  596. package/dist/src/surfaces/api/contracts/status.d.ts +4 -0
  597. package/dist/src/surfaces/api/contracts/system.d.ts +32 -0
  598. package/dist/src/surfaces/api/contracts/transport-values.d.ts +50 -0
  599. package/dist/src/surfaces/api/contracts/transport-values.js +6 -0
  600. package/dist/src/surfaces/api/contracts/work.d.ts +74 -0
  601. package/dist/src/surfaces/api/contracts/workflow-diagram.d.ts +64 -0
  602. package/dist/src/surfaces/api/http-server.d.ts +33 -0
  603. package/dist/src/surfaces/api/http-server.js +2 -2
  604. package/dist/src/surfaces/api/presenters/activities.d.ts +1 -0
  605. package/dist/src/surfaces/api/presenters/board.d.ts +2 -0
  606. package/dist/src/surfaces/api/presenters/control-plane.d.ts +1 -0
  607. package/dist/src/surfaces/api/presenters/events.d.ts +1 -0
  608. package/dist/src/surfaces/api/presenters/execution.d.ts +3 -0
  609. package/dist/src/surfaces/api/presenters/execution.js +5 -2
  610. package/dist/src/surfaces/api/presenters/observability.d.ts +1 -0
  611. package/dist/src/surfaces/api/presenters/orchestration.d.ts +3 -0
  612. package/dist/src/surfaces/api/presenters/resources.d.ts +3 -0
  613. package/dist/src/surfaces/api/presenters/status.d.ts +2 -0
  614. package/dist/src/surfaces/api/presenters/system.d.ts +2 -0
  615. package/dist/src/surfaces/api/presenters/work.d.ts +4 -0
  616. package/dist/src/surfaces/api/problem-details.d.ts +2 -0
  617. package/dist/src/surfaces/api/router.d.ts +8 -0
  618. package/dist/src/surfaces/api/routes/activities.d.ts +1 -0
  619. package/dist/src/surfaces/api/routes/applications.d.ts +88 -0
  620. package/dist/src/surfaces/api/routes/commands.d.ts +3 -0
  621. package/dist/src/surfaces/api/routes/commands.js +1 -3
  622. package/dist/src/surfaces/api/routes/control-plane.d.ts +1 -0
  623. package/dist/src/surfaces/api/routes/control-plane.js +0 -1
  624. package/dist/src/surfaces/api/routes/events.d.ts +1 -0
  625. package/dist/src/surfaces/api/routes/execution.d.ts +1 -0
  626. package/dist/src/surfaces/api/routes/index.d.ts +4 -0
  627. package/dist/src/surfaces/api/routes/observability.d.ts +1 -0
  628. package/dist/src/surfaces/api/routes/orchestration.d.ts +1 -0
  629. package/dist/src/surfaces/api/routes/pagination.d.ts +5 -0
  630. package/dist/src/surfaces/api/routes/read.d.ts +3 -0
  631. package/dist/src/surfaces/api/routes/resources.d.ts +1 -0
  632. package/dist/src/surfaces/api/routes/responses.d.ts +15 -0
  633. package/dist/src/surfaces/api/routes/system.d.ts +1 -0
  634. package/dist/src/surfaces/api/routes/work.d.ts +1 -0
  635. package/dist/src/surfaces/auth/credentials.d.ts +22 -0
  636. package/dist/src/surfaces/auth/credentials.js +8 -12
  637. package/dist/src/surfaces/auth/vocabulary.d.ts +9 -0
  638. package/dist/src/surfaces/cli/commands/api.d.ts +4 -0
  639. package/dist/src/surfaces/cli/commands/audit.d.ts +16 -0
  640. package/dist/src/surfaces/cli/commands/audit.js +11 -2
  641. package/dist/src/surfaces/cli/commands/correlate.d.ts +7 -0
  642. package/dist/src/surfaces/cli/commands/doctor.d.ts +24 -0
  643. package/dist/src/surfaces/cli/commands/init.d.ts +2 -0
  644. package/dist/src/surfaces/cli/commands/sandbox-entrypoint.d.ts +43 -0
  645. package/dist/src/surfaces/cli/commands/sandbox-setup.d.ts +9 -0
  646. package/dist/src/surfaces/cli/commands/sandbox.d.ts +16 -0
  647. package/dist/src/surfaces/cli/commands/self-update.d.ts +15 -0
  648. package/dist/src/surfaces/cli/commands/smoke.d.ts +14 -0
  649. package/dist/src/surfaces/cli/commands/start.d.ts +5 -0
  650. package/dist/src/surfaces/cli/commands/stop.d.ts +11 -0
  651. package/dist/src/surfaces/cli/commands/tick.d.ts +5 -0
  652. package/dist/src/surfaces/cli/commands/ui.d.ts +5 -0
  653. package/dist/src/surfaces/cli/commands/validate-state.d.ts +13 -0
  654. package/dist/src/surfaces/cli/infrastructure/docker-cli.d.ts +66 -0
  655. package/dist/src/surfaces/cli/infrastructure/docker-invocation.d.ts +14 -0
  656. package/dist/src/surfaces/cli/infrastructure/process-log.d.ts +35 -0
  657. package/dist/src/surfaces/cli/infrastructure/resident-start.d.ts +10 -0
  658. package/dist/src/surfaces/cli/main.d.ts +115 -0
  659. package/dist/src/surfaces/cli/usage.d.ts +1 -0
  660. package/dist/src/surfaces/contracts/config.d.ts +51 -0
  661. package/dist/src/surfaces/index.d.ts +49 -0
  662. package/dist/src/surfaces/web-assets/assets/index-D9xGa5tD.css +1 -0
  663. package/dist/src/surfaces/web-assets/assets/index-qai1Ymhv.js +1179 -0
  664. package/dist/src/surfaces/web-assets/index.html +2 -2
  665. package/dist/src/surfaces/web-host/asset-source.d.ts +9 -0
  666. package/dist/src/surfaces/web-host/packaged-assets.d.ts +8 -0
  667. package/dist/src/work/application/work-projection.d.ts +3 -0
  668. package/dist/src/work/application/work-projection.js +4 -4
  669. package/dist/src/work/application/work-repository.d.ts +15 -0
  670. package/dist/src/work/application/work-repository.js +2 -2
  671. package/dist/src/work/application/work-service.d.ts +18 -0
  672. package/dist/src/work/application/work-service.js +70 -31
  673. package/dist/src/work/contracts/commands.d.ts +15 -0
  674. package/dist/src/work/contracts/config.d.ts +3 -0
  675. package/dist/src/work/contracts/event-factory.d.ts +6 -0
  676. package/dist/src/work/contracts/event-factory.js +26 -0
  677. package/dist/src/work/contracts/events.d.ts +46 -0
  678. package/dist/src/work/contracts/events.js +54 -60
  679. package/dist/src/work/contracts/identifiers.d.ts +3 -0
  680. package/dist/src/work/contracts/streams.d.ts +8 -0
  681. package/dist/src/work/contracts/views.d.ts +18 -0
  682. package/dist/src/work/contracts/vocabulary.d.ts +7 -0
  683. package/dist/src/work/domain/work-item.d.ts +3 -0
  684. package/dist/src/work/domain/work-item.js +10 -7
  685. package/dist/src/work/index.d.ts +12 -0
  686. package/dist/src/work/index.js +1 -0
  687. package/docker/Dockerfile +9 -7
  688. package/docker/Dockerfile.packaged +4 -6
  689. package/package.json +24 -24
  690. package/dist/src/activities/pr/event-drafts.js +0 -66
  691. package/dist/src/kernel/contracts/events.js +0 -11
  692. package/dist/src/kernel/infrastructure/cached-journal-view.js +0 -27
  693. package/dist/src/persistence/application/projection-runner.js +0 -128
  694. package/dist/src/persistence/filesystem/file-checkpoint-store.js +0 -50
  695. package/dist/src/persistence/filesystem/file-projection-store.js +0 -137
  696. package/dist/src/persistence/index.js +0 -8
  697. package/dist/src/persistence/memory/in-memory-event-journal.js +0 -99
  698. package/dist/src/surfaces/web-assets/assets/index-B0ofn_L5.css +0 -1
  699. package/dist/src/surfaces/web-assets/assets/index-DFBhpSSX.js +0 -1179
  700. /package/dist/src/control-plane/application/{advance-once-ports.js → activation-scheduler-ports.js} +0 -0
  701. /package/dist/src/{kernel → node_modules/@atolis-hq/eventing/dist}/contracts/commands.js +0 -0
  702. /package/dist/src/{kernel/contracts/checkpoint-store.js → node_modules/@atolis-hq/eventing/dist/contracts/processor-state-store.js} +0 -0
  703. /package/dist/src/{persistence → node_modules/@atolis-hq/eventing/dist}/memory/in-memory-checkpoint-store.js +0 -0
  704. /package/dist/src/{kernel/contracts → node_modules/@atolis-hq/eventing/dist/projections}/projection-store.js +0 -0
  705. /package/dist/src/{kernel/contracts/journal-change-signal.js → node_modules/@atolis-hq/eventing/dist/runtime/clock.js} +0 -0
  706. /package/dist/src/{kernel/contracts → node_modules/@atolis-hq/eventing/dist/store}/event-journal.js +0 -0
@@ -0,0 +1,127 @@
1
+ import { createHash } from 'node:crypto';
2
+ import { readFile, rm } from 'node:fs/promises';
3
+ import { join } from 'node:path';
4
+ import { withFileLock } from './file-lock.js';
5
+ import { atomicJson } from './file-projection-store.js';
6
+ import { processorStatePaths } from './processor-state-paths.js';
7
+ import { isCompatibleProcessorStateRecord, } from './processor-state-record.js';
8
+ import { encodeLegacyStorageName } from './storage-name.js';
9
+ export class FileProcessorStateStore {
10
+ root;
11
+ constructor(root) {
12
+ this.root = root;
13
+ }
14
+ async read(consumer, key) {
15
+ const paths = this.paths(consumer, key);
16
+ const candidates = await this.readCandidates(paths);
17
+ const stored = candidates.find(({ state }) => matchesStateIdentity(state, paths.namespace, key))?.state;
18
+ if (stored !== undefined && stored !== null)
19
+ return { consumer, key, value: stored.value };
20
+ return null;
21
+ }
22
+ async write(state) {
23
+ const paths = this.paths(state.consumer, state.key);
24
+ await this.withStateLocks(candidatePaths(paths), async () => {
25
+ const candidates = await this.readCandidates(paths);
26
+ const current = candidateState(candidates, paths.current);
27
+ if (matchesStateIdentity(current, paths.namespace, state.key))
28
+ return atomicJson(paths.current, compatibleRecord(paths.namespace, state));
29
+ const isolated = candidateState(candidates, paths.isolated);
30
+ if (matchesStateIdentity(isolated, paths.namespace, state.key))
31
+ return atomicJson(paths.isolated, compatibleRecord(paths.namespace, state));
32
+ if (current === null)
33
+ return atomicJson(paths.current, compatibleRecord(paths.namespace, state));
34
+ if (isolated === null)
35
+ return atomicJson(paths.isolated, compatibleRecord(paths.namespace, state));
36
+ throw new Error(`Processor state paths are occupied for ${state.consumer}:${state.key}`);
37
+ });
38
+ }
39
+ async delete(consumer, key) {
40
+ const paths = this.paths(consumer, key);
41
+ await this.withStateLocks(candidatePaths(paths), async () => {
42
+ const candidates = await this.readCandidates(paths);
43
+ for (const { path, state } of candidates) {
44
+ if (matchesStateIdentity(state, paths.namespace, key))
45
+ await rm(path, { force: true });
46
+ }
47
+ });
48
+ }
49
+ paths(consumer, key) {
50
+ return processorStatePaths(this.root, consumer, key);
51
+ }
52
+ async withStateLocks(paths, operation) {
53
+ const locks = uniquePaths(paths)
54
+ .map((path) => processorStateLockPath(this.root, path))
55
+ .sort();
56
+ return withLocks(locks, operation);
57
+ }
58
+ async readCandidates(paths) {
59
+ const candidates = await Promise.all(candidatePaths(paths).map(async (path) => ({ path, state: await readCompatibleState(path) })));
60
+ for (const { path, state } of candidates) {
61
+ if (state !== null)
62
+ assertCandidateProvenance(this.root, path, state, paths.namespace, paths.key);
63
+ }
64
+ return candidates;
65
+ }
66
+ }
67
+ function legacyProcessorStatePath(root, namespace, key) {
68
+ return join(root, 'projections', encodeLegacyStorageName(namespace), `${encodeLegacyStorageName(key)}.json`);
69
+ }
70
+ function processorStateLockPath(root, path) {
71
+ return join(root, 'locks', 'processor-state', `${createHash('sha256').update(path).digest('hex')}.lock`);
72
+ }
73
+ async function withLocks(paths, operation) {
74
+ const [path, ...rest] = paths;
75
+ if (path === undefined)
76
+ return operation();
77
+ return withFileLock(path, () => withLocks(rest, operation), { waitMs: 5_000 });
78
+ }
79
+ async function readCompatibleState(path) {
80
+ let raw;
81
+ try {
82
+ raw = await readFile(path, 'utf8');
83
+ }
84
+ catch (error) {
85
+ if (error.code === 'ENOENT')
86
+ return null;
87
+ throw error;
88
+ }
89
+ let stored;
90
+ try {
91
+ stored = JSON.parse(raw);
92
+ }
93
+ catch (error) {
94
+ throw invalidProcessorStateRecord(path, error);
95
+ }
96
+ if (!isCompatibleProcessorStateRecord(stored))
97
+ throw invalidProcessorStateRecord(path);
98
+ return stored;
99
+ }
100
+ function invalidProcessorStateRecord(path, cause) {
101
+ return new Error(`Invalid processor state record at ${path}`, { cause });
102
+ }
103
+ function matchesStateIdentity(stored, namespace, key) {
104
+ return stored?.namespace === namespace && stored.key === key;
105
+ }
106
+ function assertCandidateProvenance(root, path, stored, namespace, key) {
107
+ if (matchesStateIdentity(stored, namespace, key))
108
+ return;
109
+ if (legacyProcessorStatePath(root, stored.namespace, stored.key) === path)
110
+ return;
111
+ throw invalidProcessorStateRecord(path);
112
+ }
113
+ function compatibleRecord(namespace, state) {
114
+ return { namespace, key: state.key, lastGlobalPosition: 0, value: state.value };
115
+ }
116
+ function uniquePaths(paths) {
117
+ return [...new Set(paths)];
118
+ }
119
+ function candidatePaths(paths) {
120
+ return uniquePaths([paths.current, paths.isolated, paths.legacy]);
121
+ }
122
+ function candidateState(candidates, path) {
123
+ const candidate = candidates.find((value) => value.path === path);
124
+ if (candidate === undefined)
125
+ throw new Error(`Missing processor state candidate for ${path}`);
126
+ return candidate.state;
127
+ }
@@ -0,0 +1,19 @@
1
+ import type { ProjectionStore, StoredProjection } from '@atolis-hq/eventing';
2
+ export interface FileProjectionStoreOptions {
3
+ readonly protectedProcessorStateConsumers?: readonly string[];
4
+ }
5
+ export declare class FileProjectionStore implements ProjectionStore {
6
+ private readonly root;
7
+ private readonly protectedDirectories;
8
+ constructor(root: string, options?: FileProjectionStoreOptions);
9
+ private readonly listCache;
10
+ read<Value>(namespace: string, key: string): Promise<StoredProjection<Value> | null>;
11
+ write<Value>(projection: StoredProjection<Value>): Promise<void>;
12
+ list<Value>(namespace: string): Promise<readonly StoredProjection<Value>[]>;
13
+ clear(namespace?: string): Promise<void>;
14
+ private clearProjectionNamespace;
15
+ private clearAllProjectionDirectories;
16
+ }
17
+ export declare function encode(value: string): string;
18
+ export declare function atomicJson(path: string, value: unknown): Promise<void>;
19
+ //# sourceMappingURL=file-projection-store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-projection-store.d.ts","sourceRoot":"","sources":["../src/file-projection-store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAQ7E,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,gCAAgC,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC/D;AAED,qBAAa,mBAAoB,YAAW,eAAe;IAIvD,OAAO,CAAC,QAAQ,CAAC,IAAI;IAHvB,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAAsB;gBAGxC,IAAI,EAAE,MAAM,EAC7B,OAAO,GAAE,0BAA+B;IAO1C,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAgD;IAEpE,IAAI,CAAC,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC;IAapF,KAAK,CAAC,KAAK,EAAE,UAAU,EAAE,gBAAgB,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IA2ChE,IAAI,CAAC,KAAK,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,gBAAgB,CAAC,KAAK,CAAC,EAAE,CAAC;IAoB3E,KAAK,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;YAOhC,wBAAwB;YAaxB,6BAA6B;CAiB5C;AAwJD,wBAAgB,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE5C;AAED,wBAAsB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAE5E"}
@@ -0,0 +1,219 @@
1
+ import { readFile, readdir, rm, stat } from 'node:fs/promises';
2
+ import { basename, dirname, join } from 'node:path';
3
+ import { writeFileAtomically } from './atomic-write.js';
4
+ import { processorStateDirectoryNames } from './processor-state-paths.js';
5
+ import { encodeLegacyStorageName, encodeStorageName } from './storage-name.js';
6
+ export class FileProjectionStore {
7
+ root;
8
+ protectedDirectories;
9
+ constructor(root, options = {}) {
10
+ this.root = root;
11
+ this.protectedDirectories = new Set((options.protectedProcessorStateConsumers ?? []).flatMap(processorStateDirectoryNames));
12
+ }
13
+ listCache = new Map();
14
+ async read(namespace, key) {
15
+ for (const path of projectionPaths(this.root, namespace, key).candidates) {
16
+ const projection = await readProjection(path);
17
+ if (matchesProjection(projection, namespace, key))
18
+ return projection;
19
+ }
20
+ return null;
21
+ }
22
+ // Patches the cached entry in place rather than invalidating the whole
23
+ // namespace, so a self-caused write doesn't force the next list() to
24
+ // re-read every other unchanged projection file in the namespace. Falls
25
+ // back to a full list() re-read for a namespace nothing has cached yet.
26
+ async write(projection) {
27
+ const paths = projectionPaths(this.root, projection.namespace, projection.key);
28
+ const cached = this.listCache.get(projection.namespace);
29
+ const path = paths.current;
30
+ const existing = cached === undefined
31
+ ? await readProjection(path)
32
+ : (cached.files.find((entry) => entry.path === path)?.value ?? null);
33
+ if (existing !== null && !matchesProjection(existing, projection.namespace, projection.key))
34
+ throw new Error(`Projection path is occupied for ${projection.namespace}:${projection.key}`);
35
+ await atomicJson(path, projection);
36
+ if (cached === undefined)
37
+ return;
38
+ const [info, directoryInfo] = await Promise.all([stat(path), stat(dirname(path))]);
39
+ const updatedEntry = {
40
+ path,
41
+ size: info.size,
42
+ mtimeMs: info.mtimeMs,
43
+ value: projection,
44
+ };
45
+ this.listCache.set(projection.namespace, {
46
+ files: [
47
+ ...cached.files.filter((entry) => entry.path !== path &&
48
+ !matchesProjection(entry.value, projection.namespace, projection.key)),
49
+ updatedEntry,
50
+ ].sort(compareCachedProjectionFiles),
51
+ revisions: cached.revisions.map((revision) => revision.directory === dirname(path)
52
+ ? { ...revision, value: directoryRevision(directoryInfo) }
53
+ : revision),
54
+ });
55
+ }
56
+ // Callers (advance-once, orchestration-service, DeliveryService, ...) list()
57
+ // an entire namespace unconditionally on every control-plane tick, even when
58
+ // fully idle. Without a cache that's a readdir+open+read+JSON.parse of every
59
+ // projection file in the namespace every tick forever, mirroring the same
60
+ // cost FileEventJournal.scan() already avoids for the event journal via a
61
+ // fingerprint cache. Same fix here: only re-read files whose directory
62
+ // listing (name:size:mtimeMs) actually changed since the last list().
63
+ async list(namespace) {
64
+ const directories = projectionDirectories(this.root, namespace);
65
+ const revisions = await directoryRevisions(directories);
66
+ const cached = this.listCache.get(namespace);
67
+ if (cached !== undefined && sameDirectoryRevisions(cached.revisions, revisions))
68
+ return cached.files.map((entry) => entry.value);
69
+ const entries = await Promise.all(directories.map(readProjectionDirectory));
70
+ const selected = new Map();
71
+ for (const entry of entries.flat()) {
72
+ if (!matchesProjection(entry.value, namespace))
73
+ continue;
74
+ if (!selected.has(entry.value.key))
75
+ selected.set(entry.value.key, entry);
76
+ }
77
+ const files = [...selected.values()].sort(compareCachedProjectionFiles);
78
+ this.listCache.set(namespace, {
79
+ files,
80
+ revisions,
81
+ });
82
+ return files.map((entry) => entry.value);
83
+ }
84
+ async clear(namespace) {
85
+ if (namespace === undefined)
86
+ await this.clearAllProjectionDirectories();
87
+ else
88
+ await this.clearProjectionNamespace(namespace);
89
+ if (namespace === undefined)
90
+ this.listCache.clear();
91
+ else
92
+ this.listCache.delete(namespace);
93
+ }
94
+ async clearProjectionNamespace(namespace) {
95
+ const [currentDirectory, ...legacyDirectories] = projectionDirectories(this.root, namespace);
96
+ // The versioned directory belongs exclusively to this namespace, unlike a
97
+ // legacy directory that can collide with another namespace's spelling.
98
+ await rm(currentDirectory, { recursive: true, force: true });
99
+ await Promise.all(legacyDirectories.map(async (directory) => {
100
+ if (this.protectedDirectories.has(directoryName(directory)))
101
+ return;
102
+ await clearProjectionDirectory(directory, namespace);
103
+ }));
104
+ }
105
+ async clearAllProjectionDirectories() {
106
+ const root = join(this.root, 'projections');
107
+ let namespaces;
108
+ try {
109
+ namespaces = await readdir(root);
110
+ }
111
+ catch (error) {
112
+ if (error.code === 'ENOENT')
113
+ return;
114
+ throw error;
115
+ }
116
+ await Promise.all(namespaces.map(async (namespace) => {
117
+ const directory = join(root, namespace);
118
+ if (this.protectedDirectories.has(namespace))
119
+ return;
120
+ await rm(directory, { recursive: true, force: true });
121
+ }));
122
+ }
123
+ }
124
+ function directoryRevision(info) {
125
+ return `${info.mtimeMs}:${info.ctimeMs}`;
126
+ }
127
+ function projectionPaths(root, namespace, key) {
128
+ const currentNamespace = encode(namespace);
129
+ const currentKey = encode(key);
130
+ const legacyNamespace = encodeLegacyStorageName(namespace);
131
+ const legacyKey = encodeLegacyStorageName(key);
132
+ const current = projectionPath(root, `%projection-${currentNamespace}`, `%projection-${currentKey}`);
133
+ const legacy = projectionPath(root, legacyNamespace, legacyKey);
134
+ return {
135
+ current,
136
+ legacy,
137
+ candidates: uniquePaths([current, legacy]),
138
+ };
139
+ }
140
+ function projectionDirectories(root, namespace) {
141
+ const currentNamespace = encode(namespace);
142
+ return uniquePaths([
143
+ join(root, 'projections', `%projection-${currentNamespace}`),
144
+ join(root, 'projections', encodeLegacyStorageName(namespace)),
145
+ ]);
146
+ }
147
+ function projectionPath(root, namespace, key) {
148
+ return join(root, 'projections', namespace, `${key}.json`);
149
+ }
150
+ async function readProjection(path) {
151
+ try {
152
+ return JSON.parse(await readFile(path, 'utf8'));
153
+ }
154
+ catch (error) {
155
+ if (error.code === 'ENOENT')
156
+ return null;
157
+ throw error;
158
+ }
159
+ }
160
+ function matchesProjection(projection, namespace, key) {
161
+ return (projection !== null &&
162
+ projection.namespace === namespace &&
163
+ (key === undefined || projection.key === key));
164
+ }
165
+ async function readProjectionDirectory(directory) {
166
+ let files;
167
+ try {
168
+ files = (await readdir(directory)).filter((file) => file.endsWith('.json')).sort();
169
+ }
170
+ catch (error) {
171
+ if (error.code === 'ENOENT')
172
+ return [];
173
+ throw error;
174
+ }
175
+ return Promise.all(files.map(async (file) => {
176
+ const path = join(directory, file);
177
+ const [info, value] = await Promise.all([stat(path), readProjection(path)]);
178
+ if (value === null)
179
+ throw new Error(`Projection disappeared while listing: ${path}`);
180
+ return { path, size: info.size, mtimeMs: info.mtimeMs, value };
181
+ }));
182
+ }
183
+ async function directoryRevisions(directories) {
184
+ return Promise.all(directories.map(async (directory) => {
185
+ try {
186
+ return { directory, value: directoryRevision(await stat(directory)) };
187
+ }
188
+ catch (error) {
189
+ if (error.code === 'ENOENT')
190
+ return { directory, value: null };
191
+ throw error;
192
+ }
193
+ }));
194
+ }
195
+ function sameDirectoryRevisions(left, right) {
196
+ return (left.length === right.length &&
197
+ left.every((entry, index) => entry.directory === right[index].directory && entry.value === right[index].value));
198
+ }
199
+ function compareCachedProjectionFiles(left, right) {
200
+ return left.path < right.path ? -1 : left.path > right.path ? 1 : 0;
201
+ }
202
+ async function clearProjectionDirectory(directory, namespace) {
203
+ const entries = await readProjectionDirectory(directory);
204
+ await Promise.all(entries
205
+ .filter((entry) => matchesProjection(entry.value, namespace))
206
+ .map((entry) => rm(entry.path, { force: true })));
207
+ }
208
+ function uniquePaths(paths) {
209
+ return [...new Set(paths)];
210
+ }
211
+ function directoryName(path) {
212
+ return basename(path);
213
+ }
214
+ export function encode(value) {
215
+ return encodeStorageName(value);
216
+ }
217
+ export async function atomicJson(path, value) {
218
+ await writeFileAtomically(path, `${JSON.stringify(value)}\n`);
219
+ }
@@ -0,0 +1,7 @@
1
+ export { FileCheckpointStore } from './file-checkpoint-store.js';
2
+ export { FileEventJournal, type FileEventJournalOptions, type FileEventJournalWatcher, type FileEventJournalWatcherFactory, } from './file-event-journal.js';
3
+ export { acquireFileLock, withFileLock, type FileLockMetadata, type FileLockOptions, type WithFileLockOptions, } from './file-lock.js';
4
+ export { createFileProcessorRunSerialiser } from './file-processor-run-serialiser.js';
5
+ export { FileProcessorStateStore } from './file-processor-state-store.js';
6
+ export { FileProjectionStore, type FileProjectionStoreOptions } from './file-projection-store.js';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAEjE,OAAO,EACL,gBAAgB,EAChB,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,EAC5B,KAAK,8BAA8B,GACpC,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EACL,eAAe,EACf,YAAY,EACZ,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,mBAAmB,GACzB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,gCAAgC,EAAE,MAAM,oCAAoC,CAAC;AAEtF,OAAO,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAE1E,OAAO,EAAE,mBAAmB,EAAE,KAAK,0BAA0B,EAAE,MAAM,4BAA4B,CAAC"}
@@ -0,0 +1,6 @@
1
+ export { FileCheckpointStore } from './file-checkpoint-store.js';
2
+ export { FileEventJournal, } from './file-event-journal.js';
3
+ export { acquireFileLock, withFileLock, } from './file-lock.js';
4
+ export { createFileProcessorRunSerialiser } from './file-processor-run-serialiser.js';
5
+ export { FileProcessorStateStore } from './file-processor-state-store.js';
6
+ export { FileProjectionStore } from './file-projection-store.js';
@@ -0,0 +1,10 @@
1
+ export interface ProcessorStatePaths {
2
+ readonly key: string;
3
+ readonly namespace: string;
4
+ readonly current: string;
5
+ readonly isolated: string;
6
+ readonly legacy: string;
7
+ }
8
+ export declare function processorStatePaths(root: string, consumer: string, key: string): ProcessorStatePaths;
9
+ export declare function processorStateDirectoryNames(consumer: string): readonly string[];
10
+ //# sourceMappingURL=processor-state-paths.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"processor-state-paths.d.ts","sourceRoot":"","sources":["../src/processor-state-paths.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,EAChB,GAAG,EAAE,MAAM,GACV,mBAAmB,CAmBrB;AAED,wBAAgB,4BAA4B,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAIhF"}
@@ -0,0 +1,27 @@
1
+ import { join } from 'node:path';
2
+ import { assertStorageName, encodeLegacyStorageName, encodeStorageName } from './storage-name.js';
3
+ const pendingNamespaceSuffix = ':pending';
4
+ export function processorStatePaths(root, consumer, key) {
5
+ const namespace = processorStateNamespace(consumer);
6
+ const currentNamespace = encodeStorageName(namespace);
7
+ const currentKey = encodeStorageName(key);
8
+ return {
9
+ key,
10
+ namespace,
11
+ current: processorStatePath(root, currentNamespace, currentKey),
12
+ isolated: processorStatePath(root, `%processor-state-${currentNamespace}`, `%processor-state-${currentKey}`),
13
+ legacy: processorStatePath(root, encodeLegacyStorageName(namespace), encodeLegacyStorageName(key)),
14
+ };
15
+ }
16
+ export function processorStateDirectoryNames(consumer) {
17
+ const namespace = processorStateNamespace(consumer);
18
+ const current = encodeStorageName(namespace);
19
+ return [...new Set([current, `%processor-state-${current}`, encodeLegacyStorageName(namespace)])];
20
+ }
21
+ function processorStateNamespace(consumer) {
22
+ assertStorageName(consumer);
23
+ return `${consumer}${pendingNamespaceSuffix}`;
24
+ }
25
+ function processorStatePath(root, namespace, key) {
26
+ return join(root, 'projections', namespace, `${key}.json`);
27
+ }
@@ -0,0 +1,8 @@
1
+ export interface CompatibleProcessorStateRecord {
2
+ readonly namespace: string;
3
+ readonly key: string;
4
+ readonly lastGlobalPosition: number;
5
+ readonly value: unknown;
6
+ }
7
+ export declare function isCompatibleProcessorStateRecord(value: unknown): value is CompatibleProcessorStateRecord;
8
+ //# sourceMappingURL=processor-state-record.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"processor-state-record.d.ts","sourceRoot":"","sources":["../src/processor-state-record.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,8BAA8B;IAC7C,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAAC;IACpC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;CACzB;AAID,wBAAgB,gCAAgC,CAC9C,KAAK,EAAE,OAAO,GACb,KAAK,IAAI,8BAA8B,CAYzC"}
@@ -0,0 +1,28 @@
1
+ import { assertStorageName } from './storage-name.js';
2
+ const pendingNamespaceSuffix = ':pending';
3
+ export function isCompatibleProcessorStateRecord(value) {
4
+ if (value === null || typeof value !== 'object' || Array.isArray(value))
5
+ return false;
6
+ const record = value;
7
+ return (typeof record.namespace === 'string' &&
8
+ typeof record.key === 'string' &&
9
+ isProcessorStateNamespace(record.namespace) &&
10
+ isStorageName(record.key) &&
11
+ Number.isInteger(record.lastGlobalPosition) &&
12
+ record.lastGlobalPosition === 0 &&
13
+ Object.hasOwn(record, 'value'));
14
+ }
15
+ function isProcessorStateNamespace(namespace) {
16
+ if (!namespace.endsWith(pendingNamespaceSuffix))
17
+ return false;
18
+ return isStorageName(namespace.slice(0, -pendingNamespaceSuffix.length));
19
+ }
20
+ function isStorageName(value) {
21
+ try {
22
+ assertStorageName(value);
23
+ return true;
24
+ }
25
+ catch {
26
+ return false;
27
+ }
28
+ }
@@ -0,0 +1,6 @@
1
+ export declare function assertWellFormedUtf16(value: string, label: string): void;
2
+ export declare function assertStorageName(value: string): void;
3
+ export declare function encodeStorageName(value: string): string;
4
+ export declare function encodeLegacyStorageName(value: string): string;
5
+ export declare function encodeCheckpointStorageName(consumer: string): string;
6
+ //# sourceMappingURL=storage-name.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage-name.d.ts","sourceRoot":"","sources":["../src/storage-name.ts"],"names":[],"mappings":"AAAA,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAYxE;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAIrD;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAMvD;AAED,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAG7D;AAED,wBAAgB,2BAA2B,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAGpE"}
@@ -0,0 +1,34 @@
1
+ export function assertWellFormedUtf16(value, label) {
2
+ for (let index = 0; index < value.length; index += 1) {
3
+ const codeUnit = value.charCodeAt(index);
4
+ if (codeUnit >= 0xd800 && codeUnit <= 0xdbff) {
5
+ const next = value.charCodeAt(index + 1);
6
+ if (!(next >= 0xdc00 && next <= 0xdfff))
7
+ throw new Error(`${label} must use well-formed UTF-16`);
8
+ index += 1;
9
+ }
10
+ else if (codeUnit >= 0xdc00 && codeUnit <= 0xdfff) {
11
+ throw new Error(`${label} must use well-formed UTF-16`);
12
+ }
13
+ }
14
+ }
15
+ export function assertStorageName(value) {
16
+ assertWellFormedUtf16(value, 'Storage name');
17
+ if (value.length === 0 || /[\\/]/.test(value))
18
+ throw new Error('Storage name must not contain path separators');
19
+ }
20
+ export function encodeStorageName(value) {
21
+ assertStorageName(value);
22
+ return encodeURIComponent(value)
23
+ .replace(/~/g, '%7E')
24
+ .replace(/%(?!7E)/g, '~')
25
+ .replace(/\./g, '~2E');
26
+ }
27
+ export function encodeLegacyStorageName(value) {
28
+ assertStorageName(value);
29
+ return encodeURIComponent(value).replace(/%/g, '~').replace(/\./g, '~2E');
30
+ }
31
+ export function encodeCheckpointStorageName(consumer) {
32
+ assertStorageName(consumer);
33
+ return Buffer.from(consumer, 'utf8').toString('base64url');
34
+ }
@@ -0,0 +1,38 @@
1
+ {
2
+ "name": "@atolis-hq/eventing-filesystem",
3
+ "version": "0.1.0",
4
+ "description": "Filesystem-backed event journal for Wake",
5
+ "license": "Apache-2.0",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/atolis-hq/wake.git"
9
+ },
10
+ "type": "module",
11
+ "private": true,
12
+ "main": "./dist/index.js",
13
+ "types": "./dist/index.d.ts",
14
+ "exports": {
15
+ ".": {
16
+ "types": "./dist/index.d.ts",
17
+ "default": "./dist/index.js"
18
+ }
19
+ },
20
+ "files": [
21
+ "dist",
22
+ "README.md",
23
+ "LICENSE"
24
+ ],
25
+ "engines": {
26
+ "node": ">=24"
27
+ },
28
+ "scripts": {
29
+ "clean": "node scripts/clean-dist.mjs",
30
+ "build": "npm run clean && tsc --build --force tsconfig.json",
31
+ "prepack": "npm run build",
32
+ "typecheck:test": "tsc --noEmit --project tsconfig.test.json",
33
+ "test": "npm run typecheck:test && vitest run --config vitest.config.ts"
34
+ },
35
+ "dependencies": {
36
+ "@atolis-hq/eventing": "0.1.0"
37
+ }
38
+ }
@@ -0,0 +1,18 @@
1
+ import type { CommandContext } from '@atolis-hq/eventing';
2
+ import type { ActivationId, ActivityOutcome } from '../../activities/index.js';
3
+ import type { WorkflowInstanceId } from '../contracts/identifiers.js';
4
+ import type { OrchestrationRepository } from './orchestration-repository.js';
5
+ import type { StartWorkflow } from './start-workflow.js';
6
+ interface AcceptActivityOutcomeCommand {
7
+ readonly workflowInstanceId: WorkflowInstanceId;
8
+ readonly activationId: ActivationId;
9
+ readonly outcome: ActivityOutcome;
10
+ }
11
+ export declare class AcceptActivityOutcome {
12
+ private readonly repository;
13
+ private readonly workflows;
14
+ private readonly reconcileChildCompletions;
15
+ constructor(repository: OrchestrationRepository, workflows: StartWorkflow, reconcileChildCompletions: (context: CommandContext) => Promise<void>);
16
+ execute(command: AcceptActivityOutcomeCommand, context: CommandContext): Promise<import("../index.js").WorkflowInstanceView>;
17
+ }
18
+ export {};
@@ -0,0 +1,14 @@
1
+ import type { CommandContext } from '@atolis-hq/eventing';
2
+ import type { WorkService } from '../../work/index.js';
3
+ import type { OrchestrationSignal, SignalExpectation } from '../contracts/events.js';
4
+ import type { WorkflowInstanceId } from '../contracts/identifiers.js';
5
+ import type { OrchestrationRepository } from './orchestration-repository.js';
6
+ import type { StartWorkflow } from './start-workflow.js';
7
+ export declare class AcceptSignal {
8
+ private readonly repository;
9
+ private readonly workflows;
10
+ private readonly work;
11
+ constructor(repository: OrchestrationRepository, workflows: StartWorkflow, work: WorkService);
12
+ wait(workflowInstanceId: WorkflowInstanceId, expectation: SignalExpectation, context: CommandContext): Promise<import("../index.js").WorkflowInstanceView>;
13
+ execute(workflowInstanceId: WorkflowInstanceId, signal: OrchestrationSignal, context: CommandContext): Promise<import("../index.js").WorkflowInstanceView>;
14
+ }
@@ -0,0 +1,50 @@
1
+ import { type CommandContext } from '@atolis-hq/eventing';
2
+ import type { ActivationId, selectActivityEvent } from '../../activities/index.js';
3
+ import type { TransitionTarget } from '../contracts/config.js';
4
+ import type { SupplementalActivityRequest } from '../contracts/events.js';
5
+ import { type SignalName, type WorkflowInstanceId } from '../contracts/identifiers.js';
6
+ import type { OrchestrationRepository } from './orchestration-repository.js';
7
+ import type { StartWorkflow } from './start-workflow.js';
8
+ export declare class OperatorRetryIneligibleError extends Error {
9
+ constructor(detail: string);
10
+ }
11
+ type PersistedEvent = Parameters<typeof selectActivityEvent>[0];
12
+ export declare class AdvanceWorkflow {
13
+ private readonly repository;
14
+ private readonly workflows;
15
+ constructor(repository: OrchestrationRepository, workflows: StartWorkflow);
16
+ requestSupplementalActivity(id: WorkflowInstanceId, request: SupplementalActivityRequest, context: CommandContext): Promise<import("../index.js").WorkflowInstanceView>;
17
+ markActivationStarted(id: WorkflowInstanceId, activationId: ActivationId, context: CommandContext): Promise<import("../index.js").WorkflowInstanceView | null>;
18
+ block(id: WorkflowInstanceId, reason: string, context: CommandContext): Promise<import("../index.js").WorkflowInstanceView | null>;
19
+ resolveExecutionFailure(id: WorkflowInstanceId, input: {
20
+ readonly activationId: ActivationId;
21
+ readonly runId: string;
22
+ readonly reason: string;
23
+ }, context: CommandContext): Promise<import("../index.js").WorkflowInstanceView | null>;
24
+ retryRunnerQuotaFailure(id: WorkflowInstanceId, input: {
25
+ readonly activationId: ActivationId;
26
+ readonly runId: string;
27
+ readonly runnerName: string;
28
+ readonly message: string;
29
+ }, context: CommandContext): Promise<import("../index.js").WorkflowInstanceView | null>;
30
+ retryBlockedFailedStage(id: WorkflowInstanceId, context: CommandContext): Promise<import("../index.js").WorkflowInstanceView>;
31
+ restartBlockedFailedStage(id: WorkflowInstanceId, context: CommandContext): Promise<import("../index.js").WorkflowInstanceView>;
32
+ private retryBlockedFailedStageWith;
33
+ resumeBlockedStageForChanges(id: WorkflowInstanceId, context: CommandContext): Promise<import("../index.js").WorkflowInstanceView | null>;
34
+ get(id: WorkflowInstanceId): Promise<import("../index.js").WorkflowInstanceView | null>;
35
+ listPendingActivations(workItemId?: string): Promise<{
36
+ workflow: import("../index.js").WorkflowInstanceView;
37
+ activation: import("../index.js").ActivityActivationView;
38
+ }[]>;
39
+ listWaiting(signalKind?: SignalName): Promise<import("../index.js").WorkflowInstanceView[]>;
40
+ listAll(): Promise<import("../index.js").WorkflowInstanceView[]>;
41
+ listResourceTransitionMatches(event: PersistedEvent): Promise<readonly import("./resource-transition-matching.js").ResourceTransitionMatch[]>;
42
+ applyResourceTransition(id: WorkflowInstanceId, target: TransitionTarget, evidenceId: string, context: CommandContext): Promise<import("../index.js").WorkflowInstanceView | null>;
43
+ private listAllLoaded;
44
+ listWatchMatches(event: PersistedEvent, context?: CommandContext): Promise<{
45
+ parent: import("../index.js").WorkflowInstanceView;
46
+ watch: Readonly<import("../contracts/config.js").CompiledWatch>;
47
+ }[]>;
48
+ }
49
+ export declare function isAmbiguityResolutionBlock(reason: string | undefined): boolean;
50
+ export {};