@usine/orchestrator 0.2.1 → 0.4.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 (222) hide show
  1. package/LICENSE +661 -21
  2. package/README.md +174 -52
  3. package/dist/board/items.d.ts +22 -3
  4. package/dist/board/items.d.ts.map +1 -1
  5. package/dist/board/items.js +44 -4
  6. package/dist/board/items.js.map +1 -1
  7. package/dist/board/projection.d.ts +8 -1
  8. package/dist/board/projection.d.ts.map +1 -1
  9. package/dist/board/projection.js +63 -14
  10. package/dist/board/projection.js.map +1 -1
  11. package/dist/board/tasks.d.ts +15 -3
  12. package/dist/board/tasks.d.ts.map +1 -1
  13. package/dist/board/tasks.js +28 -9
  14. package/dist/board/tasks.js.map +1 -1
  15. package/dist/cloudflare.d.ts +32 -0
  16. package/dist/cloudflare.d.ts.map +1 -0
  17. package/dist/cloudflare.js +68 -0
  18. package/dist/cloudflare.js.map +1 -0
  19. package/dist/credentials.d.ts +5 -6
  20. package/dist/credentials.d.ts.map +1 -1
  21. package/dist/credentials.js +22 -15
  22. package/dist/credentials.js.map +1 -1
  23. package/dist/current-instance/changes.d.ts +87 -0
  24. package/dist/current-instance/changes.d.ts.map +1 -0
  25. package/dist/current-instance/changes.js +141 -0
  26. package/dist/current-instance/changes.js.map +1 -0
  27. package/dist/current-instance/current-instance.d.ts +89 -0
  28. package/dist/current-instance/current-instance.d.ts.map +1 -0
  29. package/dist/current-instance/current-instance.js +163 -0
  30. package/dist/current-instance/current-instance.js.map +1 -0
  31. package/dist/exe-dev.d.ts +6 -2
  32. package/dist/exe-dev.d.ts.map +1 -1
  33. package/dist/exe-dev.js +10 -9
  34. package/dist/exe-dev.js.map +1 -1
  35. package/dist/http-client.d.ts +8 -0
  36. package/dist/http-client.d.ts.map +1 -0
  37. package/dist/http-client.js +8 -0
  38. package/dist/http-client.js.map +1 -0
  39. package/dist/idle-triggers.d.ts +1 -1
  40. package/dist/idle-triggers.d.ts.map +1 -1
  41. package/dist/idle-triggers.js +1 -1
  42. package/dist/idle-triggers.js.map +1 -1
  43. package/dist/label-reconciler.d.ts +5 -2
  44. package/dist/label-reconciler.d.ts.map +1 -1
  45. package/dist/label-reconciler.js.map +1 -1
  46. package/dist/lease-order.d.ts +60 -0
  47. package/dist/lease-order.d.ts.map +1 -0
  48. package/dist/lease-order.js +76 -0
  49. package/dist/lease-order.js.map +1 -0
  50. package/dist/local.d.ts +4 -18
  51. package/dist/local.d.ts.map +1 -1
  52. package/dist/local.js +9 -45
  53. package/dist/local.js.map +1 -1
  54. package/dist/loop-matches.d.ts +28 -0
  55. package/dist/loop-matches.d.ts.map +1 -0
  56. package/dist/loop-matches.js +74 -0
  57. package/dist/loop-matches.js.map +1 -0
  58. package/dist/operator/attempt.d.ts +76 -10
  59. package/dist/operator/attempt.d.ts.map +1 -1
  60. package/dist/operator/attempt.js +69 -11
  61. package/dist/operator/attempt.js.map +1 -1
  62. package/dist/operator/board.d.ts +48 -16
  63. package/dist/operator/board.d.ts.map +1 -1
  64. package/dist/operator/board.js +48 -17
  65. package/dist/operator/board.js.map +1 -1
  66. package/dist/operator/configuration.d.ts +314 -0
  67. package/dist/operator/configuration.d.ts.map +1 -0
  68. package/dist/operator/configuration.js +490 -0
  69. package/dist/operator/configuration.js.map +1 -0
  70. package/dist/operator/desk.d.ts +206 -0
  71. package/dist/operator/desk.d.ts.map +1 -0
  72. package/dist/operator/desk.js +525 -0
  73. package/dist/operator/desk.js.map +1 -0
  74. package/dist/operator/github-changes.d.ts +88 -0
  75. package/dist/operator/github-changes.d.ts.map +1 -0
  76. package/dist/operator/github-changes.js +266 -0
  77. package/dist/operator/github-changes.js.map +1 -0
  78. package/dist/operator/http.d.ts +135 -105
  79. package/dist/operator/http.d.ts.map +1 -1
  80. package/dist/operator/http.js +155 -30
  81. package/dist/operator/http.js.map +1 -1
  82. package/dist/operator/machines.d.ts +71 -0
  83. package/dist/operator/machines.d.ts.map +1 -0
  84. package/dist/operator/machines.js +103 -0
  85. package/dist/operator/machines.js.map +1 -0
  86. package/dist/operator/need.d.ts +58 -11
  87. package/dist/operator/need.d.ts.map +1 -1
  88. package/dist/operator/need.js +61 -9
  89. package/dist/operator/need.js.map +1 -1
  90. package/dist/operator/operator.d.ts +135 -29
  91. package/dist/operator/operator.d.ts.map +1 -1
  92. package/dist/operator/operator.js +370 -63
  93. package/dist/operator/operator.js.map +1 -1
  94. package/dist/operator/overview.d.ts +7 -7
  95. package/dist/operator/overview.d.ts.map +1 -1
  96. package/dist/operator/overview.js +5 -5
  97. package/dist/operator/overview.js.map +1 -1
  98. package/dist/operator/projection.d.ts +56 -5
  99. package/dist/operator/projection.d.ts.map +1 -1
  100. package/dist/operator/projection.js +108 -9
  101. package/dist/operator/projection.js.map +1 -1
  102. package/dist/operator/run.d.ts +101 -6
  103. package/dist/operator/run.d.ts.map +1 -1
  104. package/dist/operator/run.js +100 -7
  105. package/dist/operator/run.js.map +1 -1
  106. package/dist/operator/statistics/cache.d.ts +7 -0
  107. package/dist/operator/statistics/cache.d.ts.map +1 -0
  108. package/dist/operator/statistics/cache.js +40 -0
  109. package/dist/operator/statistics/cache.js.map +1 -0
  110. package/dist/operator/statistics/runs.d.ts +36 -0
  111. package/dist/operator/statistics/runs.d.ts.map +1 -0
  112. package/dist/operator/statistics/runs.js +284 -0
  113. package/dist/operator/statistics/runs.js.map +1 -0
  114. package/dist/operator/statistics/statistics.d.ts +20 -0
  115. package/dist/operator/statistics/statistics.d.ts.map +1 -0
  116. package/dist/operator/statistics/statistics.js +138 -0
  117. package/dist/operator/statistics/statistics.js.map +1 -0
  118. package/dist/operator/statistics/tasks.d.ts +30 -0
  119. package/dist/operator/statistics/tasks.d.ts.map +1 -0
  120. package/dist/operator/statistics/tasks.js +244 -0
  121. package/dist/operator/statistics/tasks.js.map +1 -0
  122. package/dist/operator/statistics/view.d.ts +302 -0
  123. package/dist/operator/statistics/view.d.ts.map +1 -0
  124. package/dist/operator/statistics/view.js +243 -0
  125. package/dist/operator/statistics/view.js.map +1 -0
  126. package/dist/operator/statistics/window.d.ts +24 -0
  127. package/dist/operator/statistics/window.d.ts.map +1 -0
  128. package/dist/operator/statistics/window.js +47 -0
  129. package/dist/operator/statistics/window.js.map +1 -0
  130. package/dist/operator/task.d.ts +94 -0
  131. package/dist/operator/task.d.ts.map +1 -0
  132. package/dist/operator/task.js +204 -0
  133. package/dist/operator/task.js.map +1 -0
  134. package/dist/operator/transcript.d.ts +12 -12
  135. package/dist/operator/transcript.d.ts.map +1 -1
  136. package/dist/operator/transcript.js +11 -9
  137. package/dist/operator/transcript.js.map +1 -1
  138. package/dist/operator/usage.d.ts +103 -0
  139. package/dist/operator/usage.d.ts.map +1 -0
  140. package/dist/operator/usage.js +234 -0
  141. package/dist/operator/usage.js.map +1 -0
  142. package/dist/orchestrator.d.ts +8 -5
  143. package/dist/orchestrator.d.ts.map +1 -1
  144. package/dist/orchestrator.js +4 -2
  145. package/dist/orchestrator.js.map +1 -1
  146. package/dist/polling/closed-item-asks.d.ts +8 -0
  147. package/dist/polling/closed-item-asks.d.ts.map +1 -0
  148. package/dist/polling/closed-item-asks.js +28 -0
  149. package/dist/polling/closed-item-asks.js.map +1 -0
  150. package/dist/polling/cycle.d.ts +28 -10
  151. package/dist/polling/cycle.d.ts.map +1 -1
  152. package/dist/polling/cycle.js +20 -6
  153. package/dist/polling/cycle.js.map +1 -1
  154. package/dist/polling/evaluation-failures.d.ts +42 -0
  155. package/dist/polling/evaluation-failures.d.ts.map +1 -0
  156. package/dist/polling/evaluation-failures.js +103 -0
  157. package/dist/polling/evaluation-failures.js.map +1 -0
  158. package/dist/polling/hints.d.ts +2 -2
  159. package/dist/polling/hints.d.ts.map +1 -1
  160. package/dist/polling/hints.js +2 -2
  161. package/dist/polling/hints.js.map +1 -1
  162. package/dist/polling/loop-evaluation.d.ts +21 -11
  163. package/dist/polling/loop-evaluation.d.ts.map +1 -1
  164. package/dist/polling/loop-evaluation.js +70 -27
  165. package/dist/polling/loop-evaluation.js.map +1 -1
  166. package/dist/polling/open-issues.d.ts +23 -0
  167. package/dist/polling/open-issues.d.ts.map +1 -0
  168. package/dist/polling/open-issues.js +77 -0
  169. package/dist/polling/open-issues.js.map +1 -0
  170. package/dist/polling/open-pull-requests.d.ts +28 -0
  171. package/dist/polling/open-pull-requests.d.ts.map +1 -0
  172. package/dist/polling/open-pull-requests.js +131 -0
  173. package/dist/polling/open-pull-requests.js.map +1 -0
  174. package/dist/polling/polling.d.ts +20 -11
  175. package/dist/polling/polling.d.ts.map +1 -1
  176. package/dist/polling/polling.js +215 -52
  177. package/dist/polling/polling.js.map +1 -1
  178. package/dist/polling/repository-sync.d.ts +21 -14
  179. package/dist/polling/repository-sync.d.ts.map +1 -1
  180. package/dist/polling/repository-sync.js +35 -28
  181. package/dist/polling/repository-sync.js.map +1 -1
  182. package/dist/polling-triggers.d.ts +1 -1
  183. package/dist/polling-triggers.d.ts.map +1 -1
  184. package/dist/polling-triggers.js +1 -1
  185. package/dist/polling-triggers.js.map +1 -1
  186. package/dist/reloads.d.ts +14 -0
  187. package/dist/reloads.d.ts.map +1 -0
  188. package/dist/reloads.js +7 -0
  189. package/dist/reloads.js.map +1 -0
  190. package/dist/runtime.d.ts +24 -0
  191. package/dist/runtime.d.ts.map +1 -0
  192. package/dist/runtime.js +58 -0
  193. package/dist/runtime.js.map +1 -0
  194. package/dist/schedule-triggers.d.ts +14 -10
  195. package/dist/schedule-triggers.d.ts.map +1 -1
  196. package/dist/schedule-triggers.js +36 -31
  197. package/dist/schedule-triggers.js.map +1 -1
  198. package/dist/scheduler.d.ts +45 -5
  199. package/dist/scheduler.d.ts.map +1 -1
  200. package/dist/scheduler.js +587 -44
  201. package/dist/scheduler.js.map +1 -1
  202. package/dist/ssh.d.ts +103 -0
  203. package/dist/ssh.d.ts.map +1 -0
  204. package/dist/ssh.js +144 -0
  205. package/dist/ssh.js.map +1 -0
  206. package/dist/trigger-condition.d.ts +12 -0
  207. package/dist/trigger-condition.d.ts.map +1 -0
  208. package/dist/trigger-condition.js +88 -0
  209. package/dist/trigger-condition.js.map +1 -0
  210. package/dist/trigger-submission.d.ts +16 -13
  211. package/dist/trigger-submission.d.ts.map +1 -1
  212. package/dist/trigger-submission.js +19 -14
  213. package/dist/trigger-submission.js.map +1 -1
  214. package/dist/worker-engine.d.ts +13 -0
  215. package/dist/worker-engine.d.ts.map +1 -0
  216. package/dist/worker-engine.js +56 -0
  217. package/dist/worker-engine.js.map +1 -0
  218. package/dist/worker-status.d.ts +140 -0
  219. package/dist/worker-status.d.ts.map +1 -0
  220. package/dist/worker-status.js +76 -0
  221. package/dist/worker-status.js.map +1 -0
  222. package/package.json +47 -22
@@ -9,16 +9,23 @@ import { DateTime, Effect, Option, Result, Schema } from "effect";
9
9
  import { LabelReconciler } from "../label-reconciler.js";
10
10
  import { latestPollAt, RepositoryPollFailure, repositoryFailureLogFields, } from "./cycle.js";
11
11
  /**
12
- * Identifies one GitHub issue or pull request across its changing snapshots.
13
- * Encoding uses the canonical repository name and Item number; decoding lets
14
- * Board consumers locate the Item associated with a Run. Schedule Runs identify
15
- * the repository alone and do not decode as an Item.
12
+ * The stable key of a GitHub issue or pull request: the canonical repository name and Item number.
13
+ * Schedule Run keys contain only the repository and don't decode as an Item.
16
14
  */
17
15
  export const GitHubItemKey = Schema.toType(ItemKey).pipe(Schema.decodeTo(Schema.fromJsonString(Schema.Tuple([Schema.Literal("github"), RepositoryName, ItemNumber]))));
18
- // `toType` preserves the ItemKey brand on the encoded side, so the encoder
19
- // produces the identity accepted by both the Board projection and Run engine.
16
+ // `toType` keeps the ItemKey brand on the encoded side, so the encoder produces the key used by
17
+ // both the Board projection and the Run engine.
20
18
  const encodeGitHubItemKey = Schema.encodeSync(GitHubItemKey);
21
- /** The reconciliation result when the cycle had no confirmed catalog to compare against. */
19
+ /**
20
+ * Returns the key of Item `number` of `repository`, as used by the Board projection and the Run
21
+ * engine.
22
+ */
23
+ export const gitHubItemKey = (repository, number) => encodeGitHubItemKey([
24
+ "github",
25
+ RepositoryName.make(canonicalRepositoryName(repository)),
26
+ ItemNumber.make(number),
27
+ ]);
28
+ /** The reconciliation result when the cycle has no confirmed catalog. */
22
29
  const DEFERRED_RECONCILIATION = {
23
30
  labels: [],
24
31
  findings: [],
@@ -26,9 +33,8 @@ const DEFERRED_RECONCILIATION = {
26
33
  nextPollAt: Option.none(),
27
34
  };
28
35
  /**
29
- * Refreshes the stored label catalog that the Board and the label
30
- * preflight read. A failed request keeps the stored catalog and ETag and
31
- * defers provisioning; trigger evaluation runs from the change poll alone.
36
+ * Refreshes the stored label catalog used by the Board and label preflight. On a failed request,
37
+ * keeps the stored catalog and ETag and defers provisioning.
32
38
  */
33
39
  const applyLabelCatalog = Effect.fn("PollingTriggers.applyLabelCatalog")(function* (repository, labelEntityTag, result) {
34
40
  yield* Effect.annotateCurrentSpan({ repository });
@@ -70,8 +76,8 @@ const applyLabelCatalog = Effect.fn("PollingTriggers.applyLabelCatalog")(functio
70
76
  if (!(detection instanceof RepositoryLabelCatalog)) {
71
77
  const projection = yield* repositoryLabelReader.get(repository);
72
78
  if (Option.isNone(projection)) {
73
- // The ETag vouches for a projection that is no longer stored, so drop
74
- // it and fetch the catalog in full next cycle.
79
+ // The ETag refers to a projection that is no longer stored, so drop it and fetch the full
80
+ // catalog next cycle.
75
81
  yield* Effect.logWarning("Repository label catalog unchanged (304) but its projection is missing; refetching next cycle and deferring label provisioning", { repository });
76
82
  return { ...unchanged, labelEntityTag: Option.none(), entityTagChanged: true };
77
83
  }
@@ -90,11 +96,8 @@ const applyLabelCatalog = Effect.fn("PollingTriggers.applyLabelCatalog")(functio
90
96
  };
91
97
  });
92
98
  /**
93
- * Refreshes and reconciles one repository's Board label catalog before change
94
- * detection. Pass the catalog ETag from its stored poll cursor; the result gives
95
- * the ETag to persist after Item processing, plus preflight findings and backoff.
96
- * Failed catalog requests retain the stored projection and defer provisioning;
97
- * persistence failures stop the repository for retry.
99
+ * Refreshes and reconciles one repository's Board label catalog before change detection, and
100
+ * returns the ETag to persist after Item processing. Fails on persistence errors.
98
101
  */
99
102
  export const synchronizeLabels = Effect.fn("PollingTriggers.synchronizeLabels")(function* (repository, declared, entityTag) {
100
103
  yield* Effect.annotateCurrentSpan({ repository });
@@ -120,8 +123,8 @@ export const synchronizeLabels = Effect.fn("PollingTriggers.synchronizeLabels")(
120
123
  yield* repositoryLabelWriter
121
124
  .replace(new RepositoryLabelProjection({ repository, labels: reconciliation.labels }))
122
125
  .pipe(
123
- // Provisioning may have reported failures before projection storage
124
- // fails. Preserve those findings just as for a later Item failure.
126
+ // Provisioning may have reported failures before projection storage fails. Keep those
127
+ // findings, as for a later Item failure.
125
128
  Effect.mapError((error) => ({
126
129
  _tag: "InterruptedRepositoryCycle",
127
130
  error,
@@ -133,20 +136,15 @@ export const synchronizeLabels = Effect.fn("PollingTriggers.synchronizeLabels")(
133
136
  return preflight;
134
137
  });
135
138
  /**
136
- * Fetches a detected Item and durably updates its Board projection regardless of
137
- * whether any Loop applies. Evaluation uses the returned projection's snapshot,
138
- * identity and content hash, so Board observation and Run decisions agree.
139
+ * Fetches a detected Item and updates its Board projection whether or not any Loop applies.
140
+ * Evaluation uses the returned projection, so Board observation and Run decisions agree.
139
141
  */
140
142
  export const observeItem = Effect.fn("PollingTriggers.observeItem")(function* (repository, changed) {
141
143
  yield* Effect.annotateCurrentSpan({ repository, item: changed.number });
142
144
  const github = yield* GitHubPolling;
143
145
  const items = yield* ItemProjectionWriter;
144
146
  const budgets = yield* CycleBudgets;
145
- const itemKey = encodeGitHubItemKey([
146
- "github",
147
- RepositoryName.make(canonicalRepositoryName(repository)),
148
- ItemNumber.make(changed.number),
149
- ]);
147
+ const itemKey = gitHubItemKey(repository, changed.number);
150
148
  const cycleGeneration = yield* budgets.generation(itemKey);
151
149
  const snapshot = yield* github.snapshot(repository, changed);
152
150
  const projection = new ItemProjection({
@@ -164,6 +162,15 @@ export const observeItem = Effect.fn("PollingTriggers.observeItem")(function* (r
164
162
  stream: projection.source,
165
163
  contentHash: projection.contentHash,
166
164
  });
167
- return { projection, cycleGeneration };
165
+ return { snapshot, projection, cycleGeneration };
166
+ });
167
+ /**
168
+ * Marks Item `number`'s Board projection as gone from GitHub, which removes its card from the open
169
+ * lanes. Returns true if a stored projection was marked.
170
+ */
171
+ export const markItemGone = Effect.fn("PollingTriggers.markItemGone")(function* (repository, number) {
172
+ yield* Effect.annotateCurrentSpan({ repository, item: number });
173
+ const items = yield* ItemProjectionWriter;
174
+ return yield* items.markGone(gitHubItemKey(repository, number), yield* DateTime.now);
168
175
  });
169
176
  //# sourceMappingURL=repository-sync.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"repository-sync.js","sourceRoot":"","sources":["../../src/polling/repository-sync.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACjF,OAAO,EACL,eAAe,EACf,cAAc,EACd,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,eAAe,EACf,yBAAyB,EACzB,+BAA+B,EAC/B,+BAA+B,GAChC,MAAM,2CAA2C,CAAC;AAEnD,OAAO,EAEL,SAAS,EACT,aAAa,EACb,sBAAsB,GAEvB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAClE,OAAO,EAA4B,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACnF,OAAO,EAEL,YAAY,EACZ,qBAAqB,EACrB,0BAA0B,GAC3B,MAAM,YAAY,CAAC;AAEpB;;;;;GAKG;AACH,MAAM,CAAC,MAAM,a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,OAAO;KAC1B,CAAC,CAAC;IACH,KAAK,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;IAChC,KAAK,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,+BAA+B,EAAE;QACtD,UAAU;QACV,IAAI,EAAE,UAAU,CAAC,MAAM;QACvB,MAAM,EAAE,UAAU,CAAC,MAAM;QACzB,WAAW,EAAE,UAAU,CAAC,WAAW;KACpC,CAAC,CAAC;IACH,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,eAAe,EAE7C,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH;;;GAGG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAC,EAAE,CAAC,8BAA8B,CAAC,CAAC,QAAQ,CAAC,EAC7E,UAA0B,EAC1B,MAAc;IAEd,KAAK,CAAC,CAAC,MAAM,CAAC,mBAAmB,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;IAChE,MAAM,KAAK,GAAG,KAAK,CAAC,CAAC,oBAAoB,CAAC;IAC1C,OAAO,KAAK,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,aAAa,CAAC,UAAU,EAAE,MAAM,CAAC,EAAE,KAAK,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;AACvF,CAAC,CAAC,CAAC"}
@@ -1,4 +1,4 @@
1
1
  export { PollingTriggers } from "./polling/polling.ts";
2
- export { PollCycle, RepositoryPollFailure } from "./polling/cycle.ts";
2
+ export { PollCycle, RepositoryPoll, RepositoryPollFailure } from "./polling/cycle.ts";
3
3
  export { GitHubItemKey } from "./polling/repository-sync.ts";
4
4
  //# sourceMappingURL=polling-triggers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"polling-triggers.d.ts","sourceRoot":"","sources":["../src/polling-triggers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC"}
1
+ {"version":3,"file":"polling-triggers.d.ts","sourceRoot":"","sources":["../src/polling-triggers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AACtF,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC"}
@@ -1,4 +1,4 @@
1
1
  export { PollingTriggers } from "./polling/polling.js";
2
- export { PollCycle, RepositoryPollFailure } from "./polling/cycle.js";
2
+ export { PollCycle, RepositoryPoll, RepositoryPollFailure } from "./polling/cycle.js";
3
3
  export { GitHubItemKey } from "./polling/repository-sync.js";
4
4
  //# sourceMappingURL=polling-triggers.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"polling-triggers.js","sourceRoot":"","sources":["../src/polling-triggers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC"}
1
+ {"version":3,"file":"polling-triggers.js","sourceRoot":"","sources":["../src/polling-triggers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AACtF,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC"}
@@ -0,0 +1,14 @@
1
+ import type { LoadedInstance } from "@usine/config/instance";
2
+ import { Effect } from "effect";
3
+ import type { CurrentInstance } from "./current-instance/current-instance.ts";
4
+ /**
5
+ * The current instance as a trigger stream reads it: each cycle's snapshot, and the reloads that
6
+ * end a wait.
7
+ */
8
+ export type WatchedInstance = Pick<CurrentInstance["Service"], "get" | "changes">;
9
+ /**
10
+ * Completes with the first snapshot other than `seen`. Never completes if the stream ends without
11
+ * one.
12
+ */
13
+ export declare const reloadedFrom: (instances: WatchedInstance, seen: LoadedInstance) => Effect.Effect<LoadedInstance>;
14
+ //# sourceMappingURL=reloads.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reloads.d.ts","sourceRoot":"","sources":["../src/reloads.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAkB,MAAM,QAAQ,CAAC;AAChD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAC;AAE9E;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG,IAAI,CAAC,eAAe,CAAC,SAAS,CAAC,EAAE,KAAK,GAAG,SAAS,CAAC,CAAC;AAElF;;;GAGG;AACH,eAAO,MAAM,YAAY,cACZ,eAAe,QACpB,cAAc,KACnB,MAAM,CAAC,MAAM,CAAC,cAAc,CAO5B,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { Effect, Option, Stream } from "effect";
2
+ /**
3
+ * Completes with the first snapshot other than `seen`. Never completes if the stream ends without
4
+ * one.
5
+ */
6
+ export const reloadedFrom = (instances, seen) => instances.changes.pipe(Stream.filter((instance) => instance !== seen), Stream.runHead, Effect.flatMap(Option.match({ onNone: () => Effect.never, onSome: (instance) => Effect.succeed(instance) })));
7
+ //# sourceMappingURL=reloads.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reloads.js","sourceRoot":"","sources":["../src/reloads.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAShD;;;GAGG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAC1B,SAA0B,EAC1B,IAAoB,EACW,EAAE,CACjC,SAAS,CAAC,OAAO,CAAC,IAAI,CACpB,MAAM,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,KAAK,IAAI,CAAC,EAC9C,MAAM,CAAC,OAAO,EACd,MAAM,CAAC,OAAO,CACZ,MAAM,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,CAC7F,CACF,CAAC"}
@@ -0,0 +1,24 @@
1
+ import { ConfigParser } from "@usine/config/parser";
2
+ import type { InstanceDirectory, InstanceId } from "@usine/core/instance";
3
+ import { GitHubItemWriter } from "@usine/github/item-writer";
4
+ import { GitHubPolling } from "@usine/github/polling";
5
+ import { Layer } from "effect";
6
+ import { CurrentInstance } from "./current-instance/current-instance.ts";
7
+ import { LabelReconciler } from "./label-reconciler.ts";
8
+ import { OperatorConfiguration } from "./operator/configuration.ts";
9
+ import { Operator, OperatorObservation } from "./operator/operator.ts";
10
+ import { Orchestrator } from "./orchestrator.ts";
11
+ import { PollingTriggers } from "./polling-triggers.ts";
12
+ import { ScheduleTriggers } from "./schedule-triggers.ts";
13
+ import { WorkerStatus } from "./worker-status.ts";
14
+ /**
15
+ * Provides the read-only operator surface (observation, desk, and configuration) for when trigger
16
+ * credentials aren't available yet. No Worker runs Attempts.
17
+ */
18
+ export declare const operatorObservationLayer: (instanceDirectory: InstanceDirectory) => Layer.Layer<OperatorConfiguration | OperatorObservation, import("@usine/engine/engine").AttemptCancellationError | import("@usine/engine/engine").EnginePersistenceError | import("@usine/engine/engine").RunInterventionRejectedError | import("@usine/engine/engine").RunNotFoundError | import("@usine/engine/engine").RunOperationRejectedError | import("@usine/engine/engine").RunRetryBlockedError, never>;
19
+ /**
20
+ * Provides the full Node composition for one factory: trigger streams, the durable engine, Worker
21
+ * execution, and the operator surface. Requires the GitHub credentials and `CurrentInstance`.
22
+ */
23
+ export declare const runtimeLayer: (instanceDirectory: InstanceDirectory, instanceId: InstanceId) => Layer.Layer<import("@usine/engine/board-moves").BoardMoves | ConfigParser | import("@usine/engine/cursor").CursorStore | import("@usine/engine/cycle-budget").CycleBudgets | import("@usine/expression/expression-engine").ExpressionEngine | GitHubItemWriter | GitHubPolling | import("@usine/engine/item-projection").ItemProjectionReader | import("@usine/engine/item-projection").ItemProjectionWriter | LabelReconciler | import("@usine/engine/loop-control").LoopControl | Operator | OperatorConfiguration | Orchestrator | PollingTriggers | import("@usine/engine/repository-label-projection").RepositoryLabelProjectionReader | import("@usine/engine/repository-label-projection").RepositoryLabelProjectionWriter | import("@usine/engine/engine").RunEngine | import("@usine/engine/run-reader").RunReader | ScheduleTriggers | import("@usine/engine/step-executor").StepExecutor | import("@usine/engine/engine").UnconfirmedStops | WorkerStatus, import("@usine/github/github-app").AppAuthenticationError | import("@usine/engine/engine").AttemptCancellationError | import("@usine/executor").CredentialUnavailableError | import("@usine/durable/harness").DurableHarnessError | import("@usine/engine/engine").EnginePersistenceError | import("@usine/executor").ExecutorOperationError | import("@usine/engine/engine").RunInterventionRejectedError | import("@usine/engine/engine").RunNotFoundError | import("@usine/engine/engine").RunOperationRejectedError | import("@usine/engine/engine").RunRetryBlockedError | import("./scheduler.ts").UnsupportedWorkerError | import("@usine/executor").WorkerCapabilityError, CurrentInstance | import("@usine/github/github-app").GitHubCredentials>;
24
+ //# sourceMappingURL=runtime.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,KAAK,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAO1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAE7D,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAU,KAAK,EAAE,MAAM,QAAQ,CAAC;AAEvC,OAAO,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAC;AAGzE,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,EAAE,QAAQ,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AACvE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAG1D,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD;;;GAGG;AACH,eAAO,MAAM,wBAAwB,sBAAuB,iBAAiB,sZAU1E,CAAC;AAEJ;;;GAGG;AACH,eAAO,MAAM,YAAY,sBAAuB,iBAAiB,cAAc,UAAU,qoDAsExF,CAAC"}
@@ -0,0 +1,58 @@
1
+ import { BrainSpec } from "@usine/core/agent/brain";
2
+ import { NodeServices } from "@effect/platform-node";
3
+ import { ConfigParser } from "@usine/config/parser";
4
+ import { layer as durableAttemptRuntimeLayer } from "@usine/durable/live";
5
+ import { observationLayer as localObservationLayer } from "@usine/engine/local-sqlite";
6
+ import { claudeLoginLockLayer } from "@usine/executor";
7
+ import { MarcbachmannCelLayer } from "@usine/expression/marcbachmann-cel";
8
+ import { GitHubApp } from "@usine/github/github-app";
9
+ import { GitHubItemHistory } from "@usine/github/item-history";
10
+ import { GitHubItemWriter } from "@usine/github/item-writer";
11
+ import { GitHubLabelWriter } from "@usine/github/label-writer";
12
+ import { GitHubPolling } from "@usine/github/polling";
13
+ import { Effect, Layer } from "effect";
14
+ import { gitHubCredentialLayer } from "./credentials.js";
15
+ import { CurrentInstance } from "./current-instance/current-instance.js";
16
+ import { externalHttpClientLayer } from "./http-client.js";
17
+ import { idleTriggersLayer } from "./idle-triggers.js";
18
+ import { LabelReconciler } from "./label-reconciler.js";
19
+ import { OperatorConfiguration } from "./operator/configuration.js";
20
+ import { Operator, OperatorObservation } from "./operator/operator.js";
21
+ import { Orchestrator } from "./orchestrator.js";
22
+ import { PollingTriggers } from "./polling-triggers.js";
23
+ import { ScheduleTriggers } from "./schedule-triggers.js";
24
+ import { triggerConditionLayer } from "./trigger-condition.js";
25
+ import { workerEngineLayer } from "./worker-engine.js";
26
+ import { WorkerStatus } from "./worker-status.js";
27
+ /**
28
+ * Provides the read-only operator surface (observation, desk, and configuration) for when trigger
29
+ * credentials aren't available yet. No Worker runs Attempts.
30
+ */
31
+ export const operatorObservationLayer = (instanceDirectory) => Layer.mergeAll(OperatorObservation.layer, OperatorConfiguration.layer).pipe(Layer.provide(Layer.mergeAll(localObservationLayer(instanceDirectory), idleTriggersLayer, MarcbachmannCelLayer, WorkerStatus.idle)));
32
+ /**
33
+ * Provides the full Node composition for one factory: trigger streams, the durable engine, Worker
34
+ * execution, and the operator surface. Requires the GitHub credentials and `CurrentInstance`.
35
+ */
36
+ export const runtimeLayer = (instanceDirectory, instanceId) => {
37
+ const app = GitHubApp.layer.pipe(Layer.provide(externalHttpClientLayer), Layer.provide(NodeServices.layer));
38
+ const credentials = gitHubCredentialLayer.pipe(Layer.provide(app));
39
+ const polling = GitHubPolling.layer.pipe(Layer.provide(app), Layer.provide(externalHttpClientLayer), Layer.provide(NodeServices.layer));
40
+ const triggerCondition = triggerConditionLayer.pipe(Layer.provide(polling), Layer.provide(MarcbachmannCelLayer));
41
+ // One Claude login lock per Worker, or per machine of a provisioned Worker, shared by the
42
+ // executor's preflight and the Attempts' Claude children.
43
+ const attemptRuntime = durableAttemptRuntimeLayer(instanceDirectory).pipe(Layer.provideMerge(claudeLoginLockLayer), Layer.provide(NodeServices.layer));
44
+ const engine = Layer.unwrap(Effect.gen(function* () {
45
+ const startup = yield* (yield* CurrentInstance).get;
46
+ return workerEngineLayer(instanceDirectory, instanceId, startup.config, startup.agents.map(({ harness, model, effort }) => new BrainSpec({ harness, model, effort })));
47
+ })).pipe(Layer.provide(credentials), Layer.provide(app), Layer.provide(triggerCondition), Layer.provide(attemptRuntime));
48
+ const itemWriter = GitHubItemWriter.layer.pipe(Layer.provide(app), Layer.provide(externalHttpClientLayer));
49
+ const itemHistory = GitHubItemHistory.layer.pipe(Layer.provide(app), Layer.provide(externalHttpClientLayer));
50
+ const labelWriter = GitHubLabelWriter.layer.pipe(Layer.provide(app), Layer.provide(externalHttpClientLayer));
51
+ const labelReconciler = LabelReconciler.layer.pipe(Layer.provide(labelWriter));
52
+ const parser = ConfigParser.layer.pipe(Layer.provide(MarcbachmannCelLayer));
53
+ const dependencies = Layer.mergeAll(engine, itemWriter, labelReconciler, MarcbachmannCelLayer, parser, polling);
54
+ const triggers = Layer.mergeAll(PollingTriggers.layer, ScheduleTriggers.layer).pipe(Layer.provide(dependencies));
55
+ const services = Layer.mergeAll(Operator.layer, OperatorConfiguration.layer, Orchestrator.layer).pipe(Layer.provide(Layer.mergeAll(dependencies, triggers, itemHistory)));
56
+ return Layer.mergeAll(dependencies, triggers, services);
57
+ };
58
+ //# sourceMappingURL=runtime.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime.js","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEpD,OAAO,EAAE,KAAK,IAAI,0BAA0B,EAAE,MAAM,qBAAqB,CAAC;AAC1E,OAAO,EAAE,gBAAgB,IAAI,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACvF,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,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V,eAAe,EACf,oBAAoB,EACpB,MAAM,EACN,OAAO,CACR,CAAC;IACF,MAAM,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC,eAAe,CAAC,KAAK,EAAE,gBAAgB,CAAC,KAAK,CAAC,CAAC,IAAI,CACjF,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,CAC5B,CAAC;IACF,MAAM,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAC7B,QAAQ,CAAC,KAAK,EACd,qBAAqB,CAAC,KAAK,EAC3B,YAAY,CAAC,KAAK,CACnB,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,YAAY,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC;IAC3E,OAAO,KAAK,CAAC,QAAQ,CAAC,YAAY,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;AAC1D,CAAC,CAAC"}
@@ -4,12 +4,13 @@ import { RunEngine, type EnginePersistenceError } from "@usine/engine/engine";
4
4
  import { LoopControl } from "@usine/engine/loop-control";
5
5
  import { ExpressionEngine } from "@usine/expression/expression-engine";
6
6
  import { Context, Effect, Layer, Option, Schema } from "effect";
7
+ import { type WatchedInstance } from "./reloads.ts";
7
8
  declare const ScheduleAgentFailure_base: Schema.Class<ScheduleAgentFailure, Schema.TaggedStruct<"ScheduleAgentFailure", {
8
9
  readonly loop: Schema.brand<Schema.NonEmptyString, "LoopName">;
9
10
  readonly agent: Schema.brand<Schema.String, "AgentName">;
10
11
  readonly message: Schema.String;
11
12
  }>, {}>;
12
- /** A schedule loop whose agent is no longer in the loaded roster. */
13
+ /** A schedule Loop whose Agent is no longer in the loaded roster. */
13
14
  export declare class ScheduleAgentFailure extends ScheduleAgentFailure_base {
14
15
  }
15
16
  declare const ScheduleTickFailure_base: Schema.Class<ScheduleTickFailure, Schema.TaggedStruct<"ScheduleTickFailure", {
@@ -19,7 +20,7 @@ declare const ScheduleTickFailure_base: Schema.Class<ScheduleTickFailure, Schema
19
20
  readonly errorTag: Schema.NonEmptyString;
20
21
  readonly message: Schema.String;
21
22
  }>, {}>;
22
- /** A selected repository whose Tick could not be evaluated or submitted. */
23
+ /** A selected repository whose Tick couldn't be evaluated or submitted. */
23
24
  export declare class ScheduleTickFailure extends ScheduleTickFailure_base {
24
25
  }
25
26
  declare const ScheduleCronFailure_base: Schema.Class<ScheduleCronFailure, Schema.TaggedStruct<"ScheduleCronFailure", {
@@ -29,9 +30,8 @@ declare const ScheduleCronFailure_base: Schema.Class<ScheduleCronFailure, Schema
29
30
  readonly message: Schema.String;
30
31
  }>, {}>;
31
32
  /**
32
- * A schedule whose cron boundaries could not be computed at this instant.
33
- * Cron.prev and Cron.next fail inside a DST spring-forward gap even for a cron
34
- * that parsed; the schedule retries next cycle and its siblings run.
33
+ * A schedule whose cron boundaries couldn't be computed at this instant. `Cron.prev` and
34
+ * `Cron.next` fail inside a DST spring-forward gap; the schedule retries next cycle.
35
35
  */
36
36
  export declare class ScheduleCronFailure extends ScheduleCronFailure_base {
37
37
  }
@@ -40,7 +40,7 @@ export type ScheduleFailure = typeof ScheduleFailure.Type;
40
40
  declare const ScheduleCycle_base: Schema.Class<ScheduleCycle, Schema.Struct<{
41
41
  readonly loops: Schema.Int;
42
42
  readonly fanout: Schema.Int;
43
- readonly submissions: Schema.$Array<Schema.Union<readonly [typeof import("@usine/engine/engine").Claimed, typeof import("@usine/engine/engine").Queued, typeof import("@usine/engine/engine").Ignored, typeof import("@usine/engine/engine").CycleBlocked]>>;
43
+ readonly submissions: Schema.$Array<Schema.Union<readonly [typeof import("@usine/engine/engine").Claimed, typeof import("@usine/engine/engine").Queued, typeof import("@usine/engine/engine").Suppressed, typeof import("@usine/engine/engine").Ignored, typeof import("@usine/engine/engine").CycleBlocked]>>;
44
44
  readonly skipped: Schema.Int;
45
45
  readonly alreadyFired: Schema.Int;
46
46
  readonly failures: Schema.$Array<Schema.Union<readonly [typeof ScheduleAgentFailure, typeof ScheduleCronFailure, typeof ScheduleTickFailure]>>;
@@ -51,12 +51,16 @@ export declare class ScheduleCycle extends ScheduleCycle_base {
51
51
  }
52
52
  declare const ScheduleTriggers_base: Context.ServiceClass<ScheduleTriggers, "@usine/orchestrator/ScheduleTriggers", {
53
53
  /**
54
- * Evaluates the latest due Tick of every schedule. A repository's failure is
55
- * logged and reported without stopping its siblings; a cron failure in a
56
- * DST gap fails only its own schedule.
54
+ * Evaluates the latest due Tick of every schedule. Reports a repository or cron failure without
55
+ * stopping the other schedules, and forgets fired Ticks when the instance differs from the
56
+ * previous tick's.
57
57
  */
58
58
  readonly tick: (instance: LoadedInstance) => Effect.Effect<ScheduleCycle, EnginePersistenceError>;
59
- readonly run: (instance: LoadedInstance) => Effect.Effect<never>;
59
+ /**
60
+ * Runs ticks until interrupted, sleeping until the earliest next Tick for at most a minute. An
61
+ * accepted reload ends the sleep so the next tick evaluates the reloaded Loops.
62
+ */
63
+ readonly run: (instances: WatchedInstance) => Effect.Effect<never>;
60
64
  readonly latest: Effect.Effect<Option.Option<ScheduleCycle>>;
61
65
  }>;
62
66
  /** Turns due schedule ticks into one Event per selected repository. */
@@ -1 +1 @@
1
- {"version":3,"file":"schedule-triggers.d.ts","sourceRoot":"","sources":["../src/schedule-triggers.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAI7D,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AASpD,OAAO,EACL,SAAS,EACT,KAAK,sBAAsB,EAG5B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAwB,MAAM,qCAAqC,CAAC;AAC7F,OAAO,EAEL,OAAO,EAIP,MAAM,EACN,KAAK,EACL,MAAM,EAGN,MAAM,EACP,MAAM,QAAQ,CAAC;;;;;;AAgDhB,qEAAqE;AACrE,qBAAa,oBAAqB,SAAQ,yBAMx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,yBAMxC;CAAG;;;;;;;;AAEL,2EAA2E;AAC3E,qBAAa,mBAAoB,SAAQ,wBAQvC;CAAG;;;;;;;AAEL;;;GAGG;AACH,qBAAa,mBAAoB,SAAQ,wBAOvC;CAAG;AAEL,eAAO,MAAM,eAAe,8GAI1B,CAAC;AACH,MAAM,MAAM,eAAe,GAAG,OAAO,eAAe,CAAC,IAAI,CAAC;;;;;;;;;;AAE1D,mEAAmE;AACnE,qBAAa,aAAc,SAAQ,kBAUlC;CAAG;;IAoEA;;;;OAIG;mBACY,CACb,QAAQ,EAAE,cAAc,KACrB,MAAM,CAAC,MAAM,CAAC,aAAa,EAAE,sBAAsB,CAAC;IACzD;;;OAGG;kBACW,CAAC,SAAS,EAAE,eAAe,KAAK,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC;qBACjD,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;;AAjBhE,uEAAuE;AACvE,qBAAa,gBAAiB,SAAQ,qBAkBK;IACzC,MAAM,CAAC,QAAQ,CAAC,KAAK,kGA2UnB;CACH"}
@@ -12,10 +12,11 @@ import { RunEngine, SubmissionResult, } from "@usine/engine/engine";
12
12
  import { LoopControl } from "@usine/engine/loop-control";
13
13
  import { ExpressionEngine } from "@usine/expression/expression-engine";
14
14
  import { Clock, Context, Cron, DateTime, Duration, Effect, Layer, Option, Ref, Result, Schema, } from "effect";
15
+ import { reloadedFrom } from "./reloads.js";
15
16
  import { configFileErrorLogFields, DEFAULT_BRANCH_REVISION, resolveTriggerLoop, submissionLogFields, triggerSubmission, } from "./trigger-submission.js";
16
- /** Fanout submits into local SQLite, so it stays small to keep write transactions from piling up. */
17
+ /** The maximum concurrent submissions, kept small to avoid piling up SQLite write transactions. */
17
18
  const FANOUT_CONCURRENCY = 4;
18
- /** How often the loop wakes when no schedule can name its next boundary. */
19
+ /** The wake interval when no schedule has a next boundary. */
19
20
  const IDLE_WAKE_MILLIS = 60_000;
20
21
  const scheduleFailureLogFields = (error) => {
21
22
  const common = { errorTag: error._tag, message: error.message };
@@ -27,14 +28,14 @@ const scheduleFailureLogFields = (error) => {
27
28
  }
28
29
  return common;
29
30
  };
30
- /** A schedule loop whose agent is no longer in the loaded roster. */
31
+ /** A schedule Loop whose Agent is no longer in the loaded roster. */
31
32
  export class ScheduleAgentFailure extends Schema.TaggedClass("@usine/orchestrator/ScheduleAgentFailure")("ScheduleAgentFailure", {
32
33
  loop: LoopName,
33
34
  agent: AgentName,
34
35
  message: Schema.String,
35
36
  }) {
36
37
  }
37
- /** A selected repository whose Tick could not be evaluated or submitted. */
38
+ /** A selected repository whose Tick couldn't be evaluated or submitted. */
38
39
  export class ScheduleTickFailure extends Schema.TaggedClass("@usine/orchestrator/ScheduleTickFailure")("ScheduleTickFailure", {
39
40
  loop: LoopName,
40
41
  repository: RepositoryName,
@@ -44,9 +45,8 @@ export class ScheduleTickFailure extends Schema.TaggedClass("@usine/orchestrator
44
45
  }) {
45
46
  }
46
47
  /**
47
- * A schedule whose cron boundaries could not be computed at this instant.
48
- * Cron.prev and Cron.next fail inside a DST spring-forward gap even for a cron
49
- * that parsed; the schedule retries next cycle and its siblings run.
48
+ * A schedule whose cron boundaries couldn't be computed at this instant. `Cron.prev` and
49
+ * `Cron.next` fail inside a DST spring-forward gap; the schedule retries next cycle.
50
50
  */
51
51
  export class ScheduleCronFailure extends Schema.TaggedClass("@usine/orchestrator/ScheduleCronFailure")("ScheduleCronFailure", {
52
52
  loop: LoopName,
@@ -84,10 +84,8 @@ const watchedSchedules = (instance) => instance.loops.flatMap((loop) => {
84
84
  ];
85
85
  });
86
86
  /**
87
- * The latest occurrence at or before `now`; Cron.prev alone excludes an exact
88
- * match. Across a DST fall-back one local time maps to two UTC instants and
89
- * both are boundaries: the payload's zone-local time tells them apart in logs
90
- * and the dedup ledger keeps each a single fact.
87
+ * Returns the latest occurrence at or before `now`, since `Cron.prev` alone excludes an exact
88
+ * match. Across a DST fall-back, both UTC instants of the repeated local time are boundaries.
91
89
  */
92
90
  const latestScheduledAt = (cron, now) => {
93
91
  const minuteBoundary = DateTime.toDateUtc(now);
@@ -126,12 +124,14 @@ export class ScheduleTriggers extends Context.Service()("@usine/orchestrator/Sch
126
124
  const runs = yield* RunEngine;
127
125
  const loops = yield* LoopControl;
128
126
  const latestCycle = yield* Ref.make(Option.none());
129
- // Remembers fired ticks to skip repeat work. An empty map after a restart
130
- // fires the latest missed tick (ADR 0007); the dedup ledger stays the
131
- // correctness guarantee.
132
- const lastFired = yield* Ref.make(new Map());
133
- // Cron sources were validated at the config boundary, so parseUnsafe is
134
- // safe and the result is cached instead of re-parsed each cycle.
127
+ // Remembers fired Ticks to skip repeat work. After a restart or reload, the empty map fires
128
+ // the latest missed Tick (ADR 0007); the dedup ledger guarantees correctness.
129
+ const lastFired = yield* Ref.make({
130
+ instance: Option.none(),
131
+ ticks: new Map(),
132
+ });
133
+ // Cron sources were validated at the config boundary, so `parseUnsafe` is safe; results are
134
+ // cached per trigger.
135
135
  const parsedCrons = new WeakMap();
136
136
  const cronFor = (trigger) => {
137
137
  const cached = parsedCrons.get(trigger);
@@ -197,7 +197,12 @@ export class ScheduleTriggers extends Context.Service()("@usine/orchestrator/Sch
197
197
  }
198
198
  }
199
199
  const schedules = watchedSchedules(instance).filter(({ loop }) => !paused.has(loop.name));
200
- const fired = yield* Ref.get(lastFired);
200
+ const fired = yield* Ref.modify(lastFired, (memory) => {
201
+ const current = Option.contains(memory.instance, instance)
202
+ ? memory
203
+ : { instance: Option.some(instance), ticks: new Map() };
204
+ return [current.ticks, current];
205
+ });
201
206
  const due = [];
202
207
  const agentFailures = [];
203
208
  const cronFailures = [];
@@ -210,9 +215,8 @@ export class ScheduleTriggers extends Context.Service()("@usine/orchestrator/Sch
210
215
  loop: schedule.loop.name,
211
216
  });
212
217
  }
213
- // Cron evaluation throws inside a DST spring-forward gap even though
214
- // the expression parsed; one schedule's bad instant must not stop the
215
- // stream.
218
+ // Cron evaluation throws inside a DST spring-forward gap even for a valid expression, and
219
+ // one schedule's bad instant must not stop the others.
216
220
  const computed = yield* Effect.try({
217
221
  try: () => {
218
222
  const cron = cronFor(schedule.trigger);
@@ -327,18 +331,17 @@ export class ScheduleTriggers extends Context.Service()("@usine/orchestrator/Sch
327
331
  message: error.message,
328
332
  }));
329
333
  }
330
- // Only loops that submitted without a failure advance the fired-tick
331
- // memory: an all-unmatched tick keeps re-evaluating so a fixed `if:`
332
- // still fires it, a failed loop retries every repository next cycle, and
333
- // the dedup ledger absorbs the submissions that already landed.
334
- yield* Ref.update(lastFired, (current) => {
335
- const next = new Map(current);
334
+ // Only Loops that submitted without a failure advance the fired-Tick memory, so unmatched
335
+ // Ticks and failed Loops are retried next cycle. The dedup ledger absorbs duplicate
336
+ // submissions.
337
+ yield* Ref.update(lastFired, (memory) => {
338
+ const next = new Map(memory.ticks);
336
339
  for (const [loop, latestEpoch] of boundariesByLoop) {
337
340
  if (submittedLoops.has(loop) && !failedLoops.has(loop)) {
338
341
  next.set(loop, latestEpoch);
339
342
  }
340
343
  }
341
- return next;
344
+ return { ...memory, ticks: next };
342
345
  });
343
346
  const cycle = new ScheduleCycle({
344
347
  loops: schedules.length,
@@ -352,9 +355,11 @@ export class ScheduleTriggers extends Context.Service()("@usine/orchestrator/Sch
352
355
  yield* Ref.set(latestCycle, Option.some(cycle));
353
356
  return cycle;
354
357
  });
358
+ const waitForNextTick = (instances, evaluated, sleepMs) => Effect.raceFirst(Effect.sleep(Duration.millis(sleepMs)), reloadedFrom(instances, evaluated).pipe(Effect.andThen(Effect.logInfo("Instance reloaded; evaluating schedules now instead of after the sleep"))));
355
359
  // `run` never returns, so wrapping it in Effect.fn would open a span that
356
360
  // never closes; `tick` opens the span for each cycle.
357
- const run = (instance) => Effect.gen(function* () {
361
+ const run = (instances) => Effect.gen(function* () {
362
+ const instance = yield* instances.get;
358
363
  const result = yield* Effect.result(tick(instance));
359
364
  if (Result.isFailure(result)) {
360
365
  yield* Effect.logError("Schedule cycle could not read Loop runtime state; retrying", {
@@ -363,7 +368,7 @@ export class ScheduleTriggers extends Context.Service()("@usine/orchestrator/Sch
363
368
  operation: result.failure.operation,
364
369
  sleepMs: IDLE_WAKE_MILLIS,
365
370
  });
366
- yield* Effect.sleep(Duration.millis(IDLE_WAKE_MILLIS));
371
+ yield* waitForNextTick(instances, instance, IDLE_WAKE_MILLIS);
367
372
  return;
368
373
  }
369
374
  const cycle = result.success;
@@ -393,7 +398,7 @@ export class ScheduleTriggers extends Context.Service()("@usine/orchestrator/Sch
393
398
  else {
394
399
  yield* Effect.logInfo("Schedule cycle complete", summary);
395
400
  }
396
- yield* Effect.sleep(Duration.millis(sleepMs));
401
+ yield* waitForNextTick(instances, instance, sleepMs);
397
402
  }).pipe(Effect.forever);
398
403
  return { latest: Ref.get(latestCycle), run, tick };
399
404
  }));