@usine/engine 0.2.0 → 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 (192) hide show
  1. package/README.md +109 -36
  2. package/dist/board-moves/board-moves.d.ts +20 -0
  3. package/dist/board-moves/board-moves.d.ts.map +1 -0
  4. package/dist/board-moves/board-moves.js +74 -0
  5. package/dist/board-moves/board-moves.js.map +1 -0
  6. package/dist/board-moves/model.d.ts +21 -0
  7. package/dist/board-moves/model.d.ts.map +1 -0
  8. package/dist/board-moves/model.js +22 -0
  9. package/dist/board-moves/model.js.map +1 -0
  10. package/dist/cursor/cursor.d.ts +2 -6
  11. package/dist/cursor/cursor.d.ts.map +1 -1
  12. package/dist/cursor/cursor.js +2 -6
  13. package/dist/cursor/cursor.js.map +1 -1
  14. package/dist/cycle-budget/cycle-budget.d.ts +6 -6
  15. package/dist/cycle-budget/cycle-budget.d.ts.map +1 -1
  16. package/dist/cycle-budget/cycle-budget.js +5 -5
  17. package/dist/cycle-budget/cycle-budget.js.map +1 -1
  18. package/dist/cycle-budget/model.d.ts +2 -2
  19. package/dist/cycle-budget/model.d.ts.map +1 -1
  20. package/dist/cycle-budget/model.js +2 -2
  21. package/dist/cycle-budget/model.js.map +1 -1
  22. package/dist/cycle-budget/queries.d.ts +1 -1
  23. package/dist/cycle-budget/queries.d.ts.map +1 -1
  24. package/dist/cycle-budget/queries.js +3 -3
  25. package/dist/cycle-budget/queries.js.map +1 -1
  26. package/dist/database/database.d.ts +1 -1
  27. package/dist/database/database.d.ts.map +1 -1
  28. package/dist/database/local-sqlite.d.ts +10 -8
  29. package/dist/database/local-sqlite.d.ts.map +1 -1
  30. package/dist/database/local-sqlite.js +16 -9
  31. package/dist/database/local-sqlite.js.map +1 -1
  32. package/dist/database/schema.d.ts +581 -22
  33. package/dist/database/schema.d.ts.map +1 -1
  34. package/dist/database/schema.js +104 -23
  35. package/dist/database/schema.js.map +1 -1
  36. package/dist/{workflow → engine}/admission.d.ts +2 -2
  37. package/dist/engine/admission.d.ts.map +1 -0
  38. package/dist/{workflow → engine}/admission.js +4 -4
  39. package/dist/engine/admission.js.map +1 -0
  40. package/dist/engine/checkout-recovery.d.ts +69 -0
  41. package/dist/engine/checkout-recovery.d.ts.map +1 -0
  42. package/dist/engine/checkout-recovery.js +181 -0
  43. package/dist/engine/checkout-recovery.js.map +1 -0
  44. package/dist/engine/engine.d.ts +57 -24
  45. package/dist/engine/engine.d.ts.map +1 -1
  46. package/dist/engine/engine.js +144 -120
  47. package/dist/engine/engine.js.map +1 -1
  48. package/dist/engine/error.d.ts +36 -9
  49. package/dist/engine/error.d.ts.map +1 -1
  50. package/dist/engine/error.js +35 -7
  51. package/dist/engine/error.js.map +1 -1
  52. package/dist/engine/lifecycle.d.ts +81 -28
  53. package/dist/engine/lifecycle.d.ts.map +1 -1
  54. package/dist/engine/lifecycle.js +83 -44
  55. package/dist/engine/lifecycle.js.map +1 -1
  56. package/dist/engine/retry.d.ts +16 -0
  57. package/dist/engine/retry.d.ts.map +1 -0
  58. package/dist/engine/retry.js +18 -0
  59. package/dist/engine/retry.js.map +1 -0
  60. package/dist/engine/run-again.d.ts +45 -0
  61. package/dist/engine/run-again.d.ts.map +1 -0
  62. package/dist/engine/run-again.js +56 -0
  63. package/dist/engine/run-again.js.map +1 -0
  64. package/dist/engine/run-driver.d.ts +54 -0
  65. package/dist/engine/run-driver.d.ts.map +1 -0
  66. package/dist/engine/run-driver.js +362 -0
  67. package/dist/engine/run-driver.js.map +1 -0
  68. package/dist/engine/shutdown.d.ts +3 -4
  69. package/dist/engine/shutdown.d.ts.map +1 -1
  70. package/dist/engine/shutdown.js +3 -4
  71. package/dist/engine/shutdown.js.map +1 -1
  72. package/dist/engine/submission.d.ts +31 -11
  73. package/dist/engine/submission.d.ts.map +1 -1
  74. package/dist/engine/submission.js +42 -12
  75. package/dist/engine/submission.js.map +1 -1
  76. package/dist/item-projection/item-projection.d.ts +12 -4
  77. package/dist/item-projection/item-projection.d.ts.map +1 -1
  78. package/dist/item-projection/item-projection.js +41 -6
  79. package/dist/item-projection/item-projection.js.map +1 -1
  80. package/dist/item-projection/model.d.ts +5 -1
  81. package/dist/item-projection/model.d.ts.map +1 -1
  82. package/dist/item-projection/model.js +6 -2
  83. package/dist/item-projection/model.js.map +1 -1
  84. package/dist/loop-control/loop-control.d.ts +5 -5
  85. package/dist/loop-control/loop-control.d.ts.map +1 -1
  86. package/dist/loop-control/loop-control.js +4 -4
  87. package/dist/loop-control/loop-control.js.map +1 -1
  88. package/dist/loop-control/model.d.ts +1 -1
  89. package/dist/loop-control/model.d.ts.map +1 -1
  90. package/dist/loop-control/model.js +1 -1
  91. package/dist/loop-control/model.js.map +1 -1
  92. package/dist/repository-label-projection/model.d.ts +2 -2
  93. package/dist/repository-label-projection/model.d.ts.map +1 -1
  94. package/dist/repository-label-projection/model.js +2 -2
  95. package/dist/repository-label-projection/model.js.map +1 -1
  96. package/dist/repository-label-projection/repository-label-projection.d.ts +1 -1
  97. package/dist/repository-label-projection/repository-label-projection.d.ts.map +1 -1
  98. package/dist/repository-label-projection/repository-label-projection.js +1 -1
  99. package/dist/repository-label-projection/repository-label-projection.js.map +1 -1
  100. package/dist/run-reader/model.d.ts +62 -4
  101. package/dist/run-reader/model.d.ts.map +1 -1
  102. package/dist/run-reader/model.js +66 -7
  103. package/dist/run-reader/model.js.map +1 -1
  104. package/dist/run-reader/run-reader.d.ts +19 -9
  105. package/dist/run-reader/run-reader.d.ts.map +1 -1
  106. package/dist/run-reader/run-reader.js +23 -7
  107. package/dist/run-reader/run-reader.js.map +1 -1
  108. package/dist/step-executor.d.ts +65 -9
  109. package/dist/step-executor.d.ts.map +1 -1
  110. package/dist/step-executor.js +10 -2
  111. package/dist/step-executor.js.map +1 -1
  112. package/dist/store/attempt-windows.d.ts +8 -0
  113. package/dist/store/attempt-windows.d.ts.map +1 -0
  114. package/dist/store/attempt-windows.js +53 -0
  115. package/dist/store/attempt-windows.js.map +1 -0
  116. package/dist/store/codec.d.ts +381 -42
  117. package/dist/store/codec.d.ts.map +1 -1
  118. package/dist/store/codec.js +59 -15
  119. package/dist/store/codec.js.map +1 -1
  120. package/dist/store/leftovers.d.ts +10 -0
  121. package/dist/store/leftovers.d.ts.map +1 -0
  122. package/dist/store/leftovers.js +43 -0
  123. package/dist/store/leftovers.js.map +1 -0
  124. package/dist/store/loop-items.d.ts +16 -0
  125. package/dist/store/loop-items.d.ts.map +1 -0
  126. package/dist/store/loop-items.js +185 -0
  127. package/dist/store/loop-items.js.map +1 -0
  128. package/dist/store/queries.d.ts +345 -37
  129. package/dist/store/queries.d.ts.map +1 -1
  130. package/dist/store/queries.js +333 -160
  131. package/dist/store/queries.js.map +1 -1
  132. package/dist/store/store.d.ts +91 -54
  133. package/dist/store/store.d.ts.map +1 -1
  134. package/dist/store/store.js +481 -190
  135. package/dist/store/store.js.map +1 -1
  136. package/dist/store/transcript.d.ts +9 -0
  137. package/dist/store/transcript.d.ts.map +1 -0
  138. package/dist/store/transcript.js +90 -0
  139. package/dist/store/transcript.js.map +1 -0
  140. package/dist/transcript.d.ts +41 -20
  141. package/dist/transcript.d.ts.map +1 -1
  142. package/dist/transcript.js +45 -25
  143. package/dist/transcript.js.map +1 -1
  144. package/dist/trigger-condition.d.ts +23 -0
  145. package/dist/trigger-condition.d.ts.map +1 -0
  146. package/dist/trigger-condition.js +8 -0
  147. package/dist/trigger-condition.js.map +1 -0
  148. package/drizzle/20260912111855_operator_intervention/migration.sql +42 -0
  149. package/drizzle/20260912111855_operator_intervention/snapshot.json +1461 -0
  150. package/drizzle/20260917071139_resolve_run_failure/migration.sql +1 -0
  151. package/drizzle/20260917071139_resolve_run_failure/snapshot.json +1471 -0
  152. package/drizzle/20260918032643_attempt_salvage/migration.sql +1 -0
  153. package/drizzle/20260918032643_attempt_salvage/snapshot.json +1481 -0
  154. package/drizzle/20261011153856_drop_workflow_tables/migration.sql +4 -0
  155. package/drizzle/20261011153856_drop_workflow_tables/snapshot.json +1433 -0
  156. package/drizzle/20261017155043_attempt_salvage_check/migration.sql +41 -0
  157. package/drizzle/20261017155043_attempt_salvage_check/snapshot.json +1421 -0
  158. package/drizzle/20261018162700_discard_attempt_leftovers/migration.sql +1 -0
  159. package/drizzle/20261018162700_discard_attempt_leftovers/snapshot.json +1431 -0
  160. package/drizzle/20261018172605_loop_items_and_reopenings/migration.sql +15 -0
  161. package/drizzle/20261018172605_loop_items_and_reopenings/snapshot.json +1574 -0
  162. package/drizzle/20261018180339_attempt_ended_at/migration.sql +1 -0
  163. package/drizzle/20261018180339_attempt_ended_at/snapshot.json +1584 -0
  164. package/drizzle/20261019104043_run_approval_source/migration.sql +15 -0
  165. package/drizzle/20261019104043_run_approval_source/snapshot.json +1610 -0
  166. package/drizzle/20261019133538_board_moves/migration.sql +14 -0
  167. package/drizzle/20261019133538_board_moves/snapshot.json +1731 -0
  168. package/drizzle/20261019170538_item_projection_gone/migration.sql +1 -0
  169. package/drizzle/20261019170538_item_projection_gone/snapshot.json +1741 -0
  170. package/drizzle/20261019180649_run_again_events/migration.sql +7 -0
  171. package/drizzle/20261019180649_run_again_events/snapshot.json +1804 -0
  172. package/drizzle/20261019185008_trigger_event_permissions/migration.sql +1 -0
  173. package/drizzle/20261019185008_trigger_event_permissions/snapshot.json +1814 -0
  174. package/drizzle/20261020103746_attempt_start/migration.sql +5 -0
  175. package/drizzle/20261020103746_attempt_start/snapshot.json +1844 -0
  176. package/drizzle/20261020125211_attempt_comments/migration.sql +1 -0
  177. package/drizzle/20261020125211_attempt_comments/snapshot.json +1854 -0
  178. package/drizzle/20261020191320_run_closed_at/migration.sql +6 -0
  179. package/drizzle/20261020191320_run_closed_at/snapshot.json +1864 -0
  180. package/drizzle/20261023091428_rename_loop_item_hold_to_suppression/migration.sql +2 -0
  181. package/drizzle/20261023091428_rename_loop_item_hold_to_suppression/snapshot.json +1867 -0
  182. package/package.json +15 -5
  183. package/dist/workflow/admission.d.ts.map +0 -1
  184. package/dist/workflow/admission.js.map +0 -1
  185. package/dist/workflow/command.d.ts +0 -13
  186. package/dist/workflow/command.d.ts.map +0 -1
  187. package/dist/workflow/command.js +0 -17
  188. package/dist/workflow/command.js.map +0 -1
  189. package/dist/workflow/workflow.d.ts +0 -18
  190. package/dist/workflow/workflow.d.ts.map +0 -1
  191. package/dist/workflow/workflow.js +0 -108
  192. package/dist/workflow/workflow.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkout-recovery.js","sourceRoot":"","sources":["../../src/engine/checkout-recovery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEhD,OAAO,EAAE,KAAK,IAAI,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAInF;;;GAGG;AACH,MAAM,0BAA2B,SAAQ,MAAM,CAAC,WAAW,CACzD,mDAAmD,CACpD,CAAC,4BAA4B,EAAE;IAC9B,SAAS,EAAE,SAAS;IACpB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE;CACvB,CAAC;CAAG;AAEL,MAAM,OAAO,GAAG,CACd,MAA2C,EAC3C,SAAoB,EACiB,EAAE;IACvC,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC;IAClC,SAAS,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IAC5B,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AAEF;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,MAAM,CAAC,EAAE,CAAC,sBAAsB,CAAC,CAAC,QAAQ,CAAC,EAC5E,KAA0B,EAC1B,QAAiC;IAEjC,wEAAwE;IACxE,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,GAAG,CAAC,IAAI,CAAsC,IAAI,GAAG,EAAE,CAAC,CAAC;IAE7E,wGAAwG;IACxG,MAAM,OAAO,GAAG,CAAC,OAAwB,EAA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,SAAS,EAAE,MAAM,EAAE,QAAQ,CAAC,MAAM,EAAE,CACvC,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,QAAQ,EAAE,SAAS,EAAW,CAAC;AACnE,CAAC,CAAC,CAAC"}
@@ -1,55 +1,88 @@
1
1
  import { Event } from "@usine/core/event";
2
+ import { AttemptId } from "@usine/core/attempt";
3
+ import { Intervention } from "@usine/core/attempt/channel";
2
4
  import { ItemKey } from "@usine/core/item";
3
5
  import { LoopName } from "@usine/core/loop";
4
6
  import { RunId } from "@usine/core/run";
5
- import { Context, Crypto, Effect, Layer } from "effect";
6
- import { SqlClient } from "effect/unstable/sql";
7
+ import { ApprovalSource } from "@usine/core/run/approval";
8
+ import type { WorkerName } from "@usine/core/worker";
9
+ import { Context, Crypto, type Duration, Effect, Layer } from "effect";
7
10
  import { RunDatabase } from "../database/database.ts";
8
- import { type RunEngineError } from "./error.ts";
11
+ import { LeftoversDiscardRejectedError, type RunEngineError } from "./error.ts";
9
12
  import type { RunSnapshot } from "../run-reader/model.ts";
10
- import type { Submission, SubmissionResult } from "./submission.ts";
13
+ import { type Submission, type SubmissionResult } from "./submission.ts";
14
+ import type { RunAgainRequest, RunAgainResult } from "./run-again.ts";
15
+ import { type RetryRequest } from "./retry.ts";
11
16
  import type { TranscriptEntry, TranscriptQuery } from "../transcript.ts";
12
17
  import { RunReader } from "../run-reader/run-reader.ts";
13
18
  import { ItemProjectionReader, ItemProjectionWriter } from "../item-projection/item-projection.ts";
14
19
  import { RepositoryLabelProjectionReader, RepositoryLabelProjectionWriter } from "../repository-label-projection/repository-label-projection.ts";
15
20
  import { StepExecutor } from "../step-executor.ts";
21
+ import { TriggerCondition } from "../trigger-condition.ts";
16
22
  import { CursorStore } from "../cursor/cursor.ts";
17
23
  import { LoopControl } from "../loop-control/loop-control.ts";
18
24
  import { CycleBudgets } from "../cycle-budget/cycle-budget.ts";
25
+ import { BoardMoves } from "../board-moves/board-moves.ts";
26
+ /** The interval between periodic reconciles, which restart open Runs whose fiber stopped. */
27
+ export declare const ReconcileInterval: Context.Reference<Duration.Input>;
19
28
  declare const RunEngine_base: Context.ServiceClass<RunEngine, "@usine/engine/RunEngine", {
20
- /** Stops admitting Attempts, including retries, and waits for admitted work to settle. Interrupting this wait keeps admission closed until restart. */
29
+ /** Stops admitting Attempts, including retries, and waits for admitted Attempts to finish. Admission stays closed until restart. */
21
30
  readonly drain: () => Effect.Effect<void>;
22
- /** Records the operator's approval Event and opens the Run's gate; execution still waits for a Worker slot. */
23
- readonly approve: (runId: RunId, approval: Event) => Effect.Effect<void, RunEngineError>;
24
- /** Cancels an open Run and interrupts its active Attempt. An already closed Run is unchanged. */
31
+ /** Records the approval Event and its source, and opens the Run's approval gate. A repeated approval keeps the first source. */
32
+ readonly approve: (runId: RunId, approval: Event, source: ApprovalSource) => Effect.Effect<void, RunEngineError>;
33
+ /** Cancels an open Run and interrupts its active Attempt; does nothing for a closed Run. */
25
34
  readonly cancel: (runId: RunId) => Effect.Effect<void, RunEngineError>;
26
- /** Reads the Run's current state, effective task and Agent, Step result, and Attempt history. */
35
+ /**
36
+ * Stops reconciling the Attempts recorded on `worker`, leaving their files in place, and
37
+ * returns the number of Attempts marked. Fails with `LeftoversDiscardRejectedError` if
38
+ * `worker` is in `StepExecutor.workers`.
39
+ */
40
+ readonly discardLeftovers: (worker: WorkerName) => Effect.Effect<number, RunEngineError | LeftoversDiscardRejectedError>;
41
+ /** Returns the Run's state, effective task and Agent, Step result, and Attempt history. */
27
42
  readonly inspect: (runId: RunId) => Effect.Effect<RunSnapshot, RunEngineError>;
28
- /** Recovers unfinished Runs and outstanding actions from stored state; also runs when the engine starts. */
43
+ /** Sends operator input to `attemptId`. Fails with `RunInterventionRejectedError` if it isn't the Run's running Attempt. */
44
+ readonly intervene: (runId: RunId, attemptId: AttemptId, intervention: Intervention) => Effect.Effect<void, RunEngineError>;
45
+ /**
46
+ * Starts a fiber for every open Run without one, except Runs waiting for approval, and opens the
47
+ * queued Events that no closed Run continued. Runs at startup and every `ReconcileInterval`.
48
+ */
29
49
  readonly reconcile: () => Effect.Effect<void, RunEngineError>;
30
- /** Requests another Attempt for a failed Run using its existing Event and effective task and Agent. */
31
- readonly retry: (runId: RunId) => Effect.Effect<void, RunEngineError>;
32
- /** Cancels unstarted Runs and discards queued Events for a Loop's Item when it stops matching; running Attempts continue. */
50
+ /**
51
+ * Marks the current failed Attempt as resolved without changing its outcome. If the Attempt
52
+ * stopped with a question or blocker, the Loop evaluates the Item's queued Events again.
53
+ */
54
+ readonly resolveFailure: (runId: RunId, attemptId: AttemptId) => Effect.Effect<void, RunEngineError>;
55
+ /**
56
+ * Requests another Attempt for a failed Run with its existing Event, applying the request's
57
+ * task and Agent if set. The Attempt records the request as its start reason.
58
+ */
59
+ readonly retry: (runId: RunId, request?: RetryRequest) => Effect.Effect<void, RunEngineError>;
60
+ /**
61
+ * Opens a new Run for the Item state of a succeeded or canceled Run, with the request's task
62
+ * and Agent, as an operator Event. The Item's cycle budget and the Loop's approval gate apply.
63
+ */
64
+ readonly runAgain: (runId: RunId, request: RunAgainRequest) => Effect.Effect<RunAgainResult, RunEngineError>;
65
+ /** Cancels unstarted Runs and discards queued Events for a Loop's Item that stopped matching; running Attempts continue. */
33
66
  readonly revoke: (loop: LoopName, itemKey: ItemKey) => Effect.Effect<ReadonlyArray<RunId>, RunEngineError>;
34
67
  /**
35
- * Records a matching Event and claims its Run, or queues it behind the Item's
36
- * running Attempt. Repeated Events are deduplicated; execution continues separately.
68
+ * Records a matching Event and claims its Run, or queues it behind the Item's running Attempt.
69
+ * Deduplicates repeated Events.
37
70
  */
38
71
  readonly submit: (submission: Submission) => Effect.Effect<SubmissionResult, RunEngineError>;
39
- /** Reads the requested portion of an Attempt's persisted transcript in append order. */
72
+ /** Returns the requested part of an Attempt's transcript, in append order. */
40
73
  readonly transcript: (query: TranscriptQuery) => Effect.Effect<ReadonlyArray<TranscriptEntry>, RunEngineError>;
41
74
  }>;
42
- /** Records Events and manages their Runs through approval, execution, retry, and cancellation. */
75
+ /** The service that records Events and drives their Runs through approval, execution, retry, and cancellation. */
43
76
  export declare class RunEngine extends RunEngine_base {
44
77
  }
45
78
  /**
46
- * Provides Run execution and recovery on the supplied database.
47
- * `database` must supply Drizzle and Effect SQL clients for the same database,
48
- * so Run records and pending execution remain together across restarts.
49
- * The deployment supplies `Crypto` and the Worker implementation through `StepExecutor`.
79
+ * Returns the engine layers on `database`, which stores all durable Run state. Requires `Crypto`
80
+ * for Run IDs, `StepExecutor` for Workers, and `TriggerCondition` to re-check queued Events.
50
81
  */
51
- export declare const layerWithDatabase: <DatabaseError, DatabaseRequirements>(database: Layer.Layer<RunDatabase | SqlClient.SqlClient, DatabaseError, DatabaseRequirements>) => Layer.Layer<CursorStore | CycleBudgets | ItemProjectionReader | ItemProjectionWriter | LoopControl | RepositoryLabelProjectionReader | RepositoryLabelProjectionWriter | RunEngine | RunReader, RunEngineError | DatabaseError, Crypto.Crypto | StepExecutor | DatabaseRequirements>;
52
- export { Submission, Claimed, Queued, Ignored, CycleBlocked, IgnoreReason, SubmissionResult, } from "./submission.ts";
82
+ export declare const layerWithDatabase: <DatabaseError, DatabaseRequirements>(database: Layer.Layer<RunDatabase, DatabaseError, DatabaseRequirements>) => Layer.Layer<BoardMoves | CursorStore | CycleBudgets | ItemProjectionReader | ItemProjectionWriter | LoopControl | RepositoryLabelProjectionReader | RepositoryLabelProjectionWriter | RunEngine | RunReader, RunEngineError | DatabaseError, Crypto.Crypto | StepExecutor | TriggerCondition | DatabaseRequirements>;
83
+ export { Submission, Claimed, Queued, Suppressed, Ignored, CycleBlocked, IgnoreReason, SubmissionResult, } from "./submission.ts";
84
+ export { RunAgainRequest, RunAgainResult } from "./run-again.ts";
85
+ export { RetryRequest } from "./retry.ts";
53
86
  export { RunEngineShutdown } from "./shutdown.ts";
54
- export { RunNotFoundError, RunOperationRejectedError, EnginePersistenceError, AttemptCancellationError, RunStoreError, RunEngineError, } from "./error.ts";
87
+ export { RunNotFoundError, RunOperationRejectedError, RunRetryBlockedError, EnginePersistenceError, AttemptCancellationError, RunInterventionRejectedError, LeftoversDiscardRejectedError, RunStoreError, RunEngineError, } from "./error.ts";
55
88
  //# sourceMappingURL=engine.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../../src/engine/engine.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAkB,MAAM,QAAQ,CAAC;AAExE,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEhD,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAA4B,KAAK,cAAc,EAAE,MAAM,YAAY,CAAC;AAC3E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACpE,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEzE,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AACnG,OAAO,EACL,+BAA+B,EAC/B,+BAA+B,EAChC,MAAM,+DAA+D,CAAC;AAQvE,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE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BAAiB,GAAI,aAAa,EAAE,oBAAoB,YACzD,KAAK,CAAC,KAAK,CAAC,WAAW,EAAE,aAAa,EAAE,oBAAoB,CAAC,KACtE,KAAK,CAAC,KAAK,CACV,UAAU,GACV,WAAW,GACX,YAAY,GACZ,oBAAoB,GACpB,oBAAoB,GACpB,WAAW,GACX,+BAA+B,GAC/B,+BAA+B,GAC/B,SAAS,GACT,SAAS,EACX,cAAc,GAAG,aAAa,EAC9B,MAAM,CAAC,MAAM,GAAG,YAAY,GAAG,gBAAgB,GAAG,oBAAoB,CAsBvE,CAAC;AAEF,OAAO,EACL,UAAU,EACV,OAAO,EACP,MAAM,EACN,UAAU,EACV,OAAO,EACP,YAAY,EACZ,YAAY,EACZ,gBAAgB,GACjB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EACL,gBAAgB,EAChB,yBAAyB,EACzB,oBAAoB,EACpB,sBAAsB,EACtB,wBAAwB,EACxB,4BAA4B,EAC5B,6BAA6B,EAC7B,aAAa,EACb,cAAc,GACf,MAAM,YAAY,CAAC"}
@@ -1,100 +1,83 @@
1
1
  import { Event } from "@usine/core/event";
2
+ import { AttemptId } from "@usine/core/attempt";
3
+ import { Intervention } from "@usine/core/attempt/channel";
2
4
  import { ItemKey } from "@usine/core/item";
3
5
  import { LoopName } from "@usine/core/loop";
4
6
  import { RunId } from "@usine/core/run";
5
- import { Context, Crypto, Effect, Layer, Option, Result } from "effect";
6
- import { ClusterWorkflowEngine, SingleRunner } from "effect/unstable/cluster";
7
- import { SqlClient } from "effect/unstable/sql";
8
- import { DurableDeferred, WorkflowEngine } from "effect/unstable/workflow";
7
+ import { ApprovalSource } from "@usine/core/run/approval";
8
+ import { Context, Crypto, Effect, Layer, Match, Option, Result } from "effect";
9
9
  import { RunDatabase } from "../database/database.js";
10
- import { AttemptCancellationError } from "./error.js";
10
+ import { AttemptCancellationError, LeftoversDiscardRejectedError, RunInterventionRejectedError, } from "./error.js";
11
+ import { runIdFor } from "./submission.js";
12
+ import { plainRetry } from "./retry.js";
11
13
  import { RunStore } from "../store/store.js";
12
14
  import { RunReader } from "../run-reader/run-reader.js";
13
15
  import { ItemProjectionReader, ItemProjectionWriter } from "../item-projection/item-projection.js";
14
16
  import { RepositoryLabelProjectionReader, RepositoryLabelProjectionWriter, } from "../repository-label-projection/repository-label-projection.js";
15
- import { ApprovalGate, DurableRun, continueWithNewest, durableRunLayer, runIdFor, } from "../workflow/workflow.js";
16
17
  import { StepExecutor } from "../step-executor.js";
18
+ import { TriggerCondition } from "../trigger-condition.js";
17
19
  import { CursorStore } from "../cursor/cursor.js";
18
20
  import { LoopControl } from "../loop-control/loop-control.js";
19
21
  import { CycleBudgets } from "../cycle-budget/cycle-budget.js";
20
- import { AttemptAdmission } from "../workflow/admission.js";
21
- const MAX_SETTLEMENT_POLLS = 500;
22
+ import { BoardMoves } from "../board-moves/board-moves.js";
23
+ import { AttemptAdmission } from "./admission.js";
24
+ import { RunDriver } from "./run-driver.js";
25
+ /** The interval between periodic reconciles, which restart open Runs whose fiber stopped. */
26
+ export const ReconcileInterval = Context.Reference("@usine/engine/ReconcileInterval", { defaultValue: () => "3 minutes" });
27
+ // Operations that commit a Run transition also hand it to the Run's fiber, uninterruptibly, so an
28
+ // interrupted caller can't leave a committed transition undriven.
22
29
  const makeRunEngine = Effect.gen(function* () {
23
30
  const store = yield* RunStore;
31
+ const driver = yield* RunDriver;
24
32
  const admission = yield* AttemptAdmission;
25
33
  const stepExecutor = yield* StepExecutor;
26
- const workflowEngine = yield* WorkflowEngine.WorkflowEngine;
27
- const provideWorkflowEngine = (effect) => Effect.provideService(effect, WorkflowEngine.WorkflowEngine, workflowEngine);
28
- const launch = Effect.fn("RunEngine.launch")(function* (submission) {
29
- yield* DurableRun.execute({ submission }, { discard: true }).pipe(provideWorkflowEngine);
30
- });
31
- const deliverInterrupt = Effect.fn("RunEngine.deliverInterrupt")(function* (runId) {
32
- yield* DurableRun.interrupt(runId).pipe(provideWorkflowEngine);
33
- yield* store.completeWorkflowCommand(runId, "Interrupt");
34
- });
35
- const deliverApproval = Effect.fn("RunEngine.deliverApproval")(function* (runId) {
36
- const token = DurableDeferred.tokenFromExecutionId(ApprovalGate, {
37
- workflow: DurableRun,
38
- executionId: runId,
39
- });
40
- yield* DurableDeferred.succeed(ApprovalGate, { token, value: undefined }).pipe(provideWorkflowEngine);
41
- yield* store.completeWorkflowCommand(runId, "Approve");
42
- });
43
- const deliverContinuation = Effect.fn("RunEngine.deliverContinuation")(function* (runId) {
44
- yield* continueWithNewest(store, runId).pipe(provideWorkflowEngine);
45
- });
46
- const awaitWorkflowSettlement = Effect.fn("RunEngine.awaitWorkflowSettlement")(function* (runId) {
47
- // A Failed projection commits before the workflow finishes suspending, so
48
- // poll across that handover or an immediate operator retry is lost. A
49
- // workflow still absent at the deadline means a corrupted instance
50
- // database, so fail loudly instead of hanging.
51
- for (let poll = 0; poll < MAX_SETTLEMENT_POLLS; poll += 1) {
52
- const status = yield* DurableRun.poll(runId).pipe(provideWorkflowEngine);
53
- if (Option.isSome(status))
54
- return status.value;
55
- yield* Effect.sleep("10 millis");
56
- }
57
- return yield* Effect.die(new Error(`Run ${runId} has no durable workflow execution to settle`));
58
- });
59
- const deliverResume = Effect.fn("RunEngine.deliverResume")(function* (runId) {
60
- const status = yield* awaitWorkflowSettlement(runId);
61
- if (status._tag === "Complete") {
62
- yield* store.reconcileCompletion(runId, status);
63
- yield* store.completeWorkflowCommand(runId, "Resume");
64
- yield* deliverContinuation(runId);
65
- return;
66
- }
67
- yield* DurableRun.resume(runId).pipe(provideWorkflowEngine);
68
- yield* store.completeWorkflowCommand(runId, "Resume");
69
- });
70
- const commandHandlers = {
71
- Approve: deliverApproval,
72
- Continue: deliverContinuation,
73
- Interrupt: deliverInterrupt,
74
- Resume: deliverResume,
75
- };
34
+ const crypto = yield* Crypto.Crypto;
76
35
  const submit = Effect.fn("RunEngine.submit")(function* (submission) {
77
- const requestedRunId = yield* runIdFor(submission);
36
+ const requestedRunId = yield* runIdFor(submission).pipe(Effect.provideService(Crypto.Crypto, crypto));
78
37
  const claim = yield* store.recordAndClaim(submission, requestedRunId);
38
+ // Stop the superseded Run's fiber before starting the new one, so the Item never has two
39
+ // fibers reserving Workers.
79
40
  if (Option.isSome(claim.supersededRun)) {
80
- yield* deliverInterrupt(claim.supersededRun.value);
41
+ yield* driver.stop(claim.supersededRun.value);
81
42
  }
82
- if (claim.result._tag === "Claimed") {
83
- yield* launch(claim.submission);
43
+ if (Option.isSome(claim.openedRun)) {
44
+ yield* driver.launch(claim.openedRun.value);
84
45
  }
85
46
  return claim.result;
86
- });
87
- const approve = Effect.fn("RunEngine.approve")(function* (runId, approval) {
88
- yield* store.approve(runId, approval);
89
- yield* deliverApproval(runId);
90
- });
91
- const retry = Effect.fn("RunEngine.retry")(function* (runId) {
92
- yield* store.retry(runId);
93
- yield* deliverResume(runId);
94
- });
47
+ }, Effect.uninterruptible);
48
+ const approve = Effect.fn("RunEngine.approve")(function* (runId, approval, source) {
49
+ if (yield* store.approve(runId, approval, source)) {
50
+ yield* Effect.logInfo("Run approved", {
51
+ runId,
52
+ eventId: approval.id,
53
+ channel: source.channel,
54
+ approver: Option.getOrElse(source.approver, () => "none"),
55
+ });
56
+ yield* driver.resume(runId);
57
+ return;
58
+ }
59
+ yield* Effect.logDebug("Approval was already recorded; the Run is unchanged", {
60
+ runId,
61
+ eventId: approval.id,
62
+ });
63
+ }, Effect.uninterruptible);
64
+ const retry = Effect.fn("RunEngine.retry")(function* (runId, request = plainRetry) {
65
+ if (yield* store.retry(runId, request)) {
66
+ yield* driver.resume(runId);
67
+ return;
68
+ }
69
+ yield* Effect.logDebug("Retry changed nothing; the Run already waits for its next Attempt", {
70
+ runId,
71
+ });
72
+ }, Effect.uninterruptible);
73
+ const runAgain = Effect.fn("RunEngine.runAgain")(function* (runId, request) {
74
+ const result = yield* store.runAgain(runId, request);
75
+ if (result._tag === "Claimed")
76
+ yield* driver.launch(result.runId);
77
+ return result;
78
+ }, Effect.uninterruptible);
95
79
  const cancel = Effect.fn("RunEngine.cancel")(function* (runId) {
96
- // The closing transaction decides both facts at once: whether the run was
97
- // still open, and which attempt was in flight when it closed.
80
+ // One transaction determines whether the Run was open and which Attempt was running.
98
81
  const outcome = yield* store.cancel(runId);
99
82
  if (outcome._tag === "AlreadyClosed") {
100
83
  yield* Effect.logDebug("Cancel was a no-op; the run was already closed", { runId });
@@ -104,90 +87,131 @@ const makeRunEngine = Effect.gen(function* () {
104
87
  runId,
105
88
  openAttempt: Option.getOrElse(outcome.openAttempt, () => "none"),
106
89
  });
90
+ // Stop the Attempt before interrupting its fiber; otherwise its parent task stays live
91
+ // waiting for a reattach.
107
92
  const handshake = Option.isSome(outcome.openAttempt)
108
93
  ? yield* stepExecutor.interrupt(outcome.openAttempt.value).pipe(Effect.result)
109
94
  : Result.succeed(undefined);
110
- yield* deliverInterrupt(runId);
111
- yield* deliverContinuation(runId);
95
+ yield* driver.stop(runId);
96
+ // Release a checkout and slot that startup kept for a reattach; they stay kept until the
97
+ // parent task is confirmed stopped.
98
+ if (Option.isSome(outcome.openAttempt))
99
+ yield* driver.releaseKept(outcome.openAttempt.value);
100
+ yield* driver.continueWithNewest(runId);
112
101
  if (Option.isSome(outcome.openAttempt) && Result.isFailure(handshake)) {
113
102
  return yield* new AttemptCancellationError({
114
103
  attemptId: outcome.openAttempt.value,
115
104
  cause: handshake.failure,
116
105
  });
117
106
  }
107
+ }, Effect.uninterruptible);
108
+ const intervene = Effect.fn("RunEngine.intervene")(function* (runId, attemptId, intervention) {
109
+ yield* Effect.annotateCurrentSpan({ runId, attemptId, action: intervention.action._tag });
110
+ const current = yield* store.snapshot(runId);
111
+ const active = current.attempts.at(-1);
112
+ if (current.run.state._tag !== "Running" ||
113
+ active?.id !== attemptId ||
114
+ Option.isSome(active.outcome)) {
115
+ yield* Effect.logInfo("Operator input rejected for an inactive Attempt", {
116
+ runId,
117
+ attemptId,
118
+ });
119
+ return yield* new RunInterventionRejectedError({
120
+ runId,
121
+ attemptId,
122
+ message: "This attempt is no longer running",
123
+ });
124
+ }
125
+ yield* stepExecutor.intervene(attemptId, intervention).pipe(Effect.mapError((error) => new RunInterventionRejectedError({
126
+ runId,
127
+ attemptId,
128
+ message: Match.valueTags(error, {
129
+ RunawayFailure: () => "The attempt reached its runaway limit",
130
+ ChildSessionBudgetFailure: () => "The attempt reached its child-session budget",
131
+ QuestionFailure: () => "The attempt ended with a question for the operator",
132
+ BlockedFailure: ({ message }) => message,
133
+ InfraFailure: ({ message }) => message,
134
+ DefectFailure: ({ message }) => message,
135
+ AgentFailure: ({ message }) => message,
136
+ }),
137
+ })), Effect.tapError((error) => Effect.logWarning("Operator input delivery failed", {
138
+ runId,
139
+ attemptId,
140
+ message: error.message,
141
+ })));
118
142
  });
143
+ const resolveFailure = Effect.fn("RunEngine.resolveFailure")(function* (runId, attemptId) {
144
+ if (!(yield* store.resolveFailure(runId, attemptId)))
145
+ return;
146
+ yield* Effect.logInfo("The operator resolved the Agent's question or blocker; the Item's queued Events get their turn", {
147
+ runId,
148
+ attemptId,
149
+ });
150
+ yield* driver.continueWithNewest(runId);
151
+ }, Effect.uninterruptible);
119
152
  const revoke = Effect.fn("RunEngine.revoke")(function* (loop, itemKey) {
120
153
  const revoked = yield* store.revoke(loop, itemKey);
121
- yield* Effect.forEach(revoked, deliverInterrupt, {
122
- concurrency: "unbounded",
123
- discard: true,
124
- });
154
+ yield* Effect.forEach(revoked, driver.stop, { concurrency: "unbounded", discard: true });
125
155
  return revoked;
126
- });
156
+ }, Effect.uninterruptible);
127
157
  const inspect = Effect.fn("RunEngine.inspect")(function* (runId) {
128
158
  return yield* store.snapshot(runId);
129
159
  });
130
160
  const transcript = Effect.fn("RunEngine.transcript")(function* (query) {
131
161
  return yield* store.transcript(query);
132
162
  });
133
- const reconcile = Effect.fn("RunEngine.reconcile")(function* () {
134
- yield* Effect.forEach(yield* store.pendingWorkflowCommands, ({ command, runId }) => commandHandlers[command](runId), { discard: true });
135
- const recoverable = yield* store.recoverable;
136
- yield* Effect.forEach(recoverable, ({ runId, state, submission }) => Effect.gen(function* () {
137
- const status = yield* DurableRun.poll(runId).pipe(provideWorkflowEngine);
138
- if (Option.isSome(status) && status.value._tag === "Complete") {
139
- yield* store.reconcileCompletion(runId, status.value);
140
- yield* deliverContinuation(runId);
141
- return;
142
- }
143
- if (Option.isSome(status) && status.value._tag === "Suspended") {
144
- if (state._tag === "Running") {
145
- yield* deliverResume(runId);
146
- }
147
- return;
148
- }
149
- yield* launch(submission);
150
- }), { concurrency: "unbounded", discard: true });
163
+ const discardLeftovers = Effect.fn("RunEngine.discardLeftovers")(function* (worker) {
164
+ yield* Effect.annotateCurrentSpan({ worker });
165
+ if ((yield* stepExecutor.workers).includes(worker)) {
166
+ const running = yield* store.openAttempts(worker);
167
+ yield* Effect.logInfo("Leftovers kept; the Worker is configured or still runs Attempts, so its Attempts stay tracked", { worker, running });
168
+ return yield* new LeftoversDiscardRejectedError({ worker, running });
169
+ }
170
+ const attempts = yield* store.discardLeftovers(worker);
171
+ yield* Effect.logInfo("Discarded the leftovers of the Attempts on a Worker that is not configured; startup no longer reconciles them", { worker, attempts });
172
+ return attempts;
151
173
  });
152
- yield* reconcile();
174
+ // Startup reconciliation runs here because this layer is memoized; `Layer.tap` would run it
175
+ // once per service the engine is provided to.
176
+ yield* driver.recoverWorkspaces();
177
+ yield* driver.reconcile();
178
+ const interval = yield* ReconcileInterval;
179
+ yield* Effect.sleep(interval).pipe(Effect.andThen(driver.reconcile()), Effect.tapError((error) => Effect.logError("Periodic Run reconcile failed; the next one tries again", {
180
+ errorTag: error._tag,
181
+ })), Effect.ignore, Effect.forever, Effect.forkScoped);
153
182
  return {
154
183
  approve,
155
184
  cancel,
185
+ discardLeftovers,
156
186
  drain: admission.drain,
157
187
  inspect,
158
- reconcile,
188
+ intervene,
189
+ reconcile: driver.reconcile,
159
190
  retry,
191
+ resolveFailure,
160
192
  revoke,
193
+ runAgain,
161
194
  submit,
162
195
  transcript,
163
196
  };
164
197
  });
165
- /** Records Events and manages their Runs through approval, execution, retry, and cancellation. */
198
+ /** The service that records Events and drives their Runs through approval, execution, retry, and cancellation. */
166
199
  export class RunEngine extends Context.Service()("@usine/engine/RunEngine") {
167
200
  }
168
201
  /**
169
- * Provides Run execution and recovery on the supplied database.
170
- * `database` must supply Drizzle and Effect SQL clients for the same database,
171
- * so Run records and pending execution remain together across restarts.
172
- * The deployment supplies `Crypto` and the Worker implementation through `StepExecutor`.
202
+ * Returns the engine layers on `database`, which stores all durable Run state. Requires `Crypto`
203
+ * for Run IDs, `StepExecutor` for Workers, and `TriggerCondition` to re-check queued Events.
173
204
  */
174
205
  export const layerWithDatabase = (database) => {
175
206
  const store = RunStore.layer.pipe(Layer.provide(database));
176
- const cluster = SingleRunner.layer({
177
- runnerStorage: "memory",
178
- shardingConfig: {
179
- availableShardGroups: ["default", "workflow"],
180
- assignedShardGroups: ["default", "workflow"],
181
- entityTerminationTimeout: 0,
182
- },
183
- }).pipe(Layer.provide(database), Layer.orDie);
184
- const workflowEngine = ClusterWorkflowEngine.layer.pipe(Layer.provide(cluster));
185
- const admission = AttemptAdmission.layer;
186
- const runtime = durableRunLayer.pipe(Layer.provideMerge(workflowEngine), Layer.provideMerge(store), Layer.provideMerge(admission));
187
- const runEngine = Layer.effect(RunEngine, makeRunEngine).pipe(Layer.provide(runtime));
188
- return Layer.mergeAll(runEngine, CycleBudgets.layer.pipe(Layer.provide(database)), RunReader.layer.pipe(Layer.provide(database)), CursorStore.layer.pipe(Layer.provide(database)), ItemProjectionReader.layer.pipe(Layer.provide(database)), ItemProjectionWriter.layer.pipe(Layer.provide(database)), RepositoryLabelProjectionReader.layer.pipe(Layer.provide(database)), RepositoryLabelProjectionWriter.layer.pipe(Layer.provide(database)), LoopControl.layer.pipe(Layer.provide(database)));
207
+ const itemWriter = ItemProjectionWriter.layer.pipe(Layer.provide(database));
208
+ const driver = RunDriver.layer.pipe(Layer.provideMerge(store), Layer.provideMerge(AttemptAdmission.layer), Layer.provide(itemWriter));
209
+ const runEngine = Layer.effect(RunEngine, makeRunEngine).pipe(Layer.provide(driver));
210
+ return Layer.mergeAll(runEngine, BoardMoves.layer.pipe(Layer.provide(database)), CycleBudgets.layer.pipe(Layer.provide(database)), RunReader.layer.pipe(Layer.provide(database)), CursorStore.layer.pipe(Layer.provide(database)), ItemProjectionReader.layer.pipe(Layer.provide(database)), itemWriter, RepositoryLabelProjectionReader.layer.pipe(Layer.provide(database)), RepositoryLabelProjectionWriter.layer.pipe(Layer.provide(database)), LoopControl.layer.pipe(Layer.provide(database)));
189
211
  };
190
- export { Submission, Claimed, Queued, Ignored, CycleBlocked, IgnoreReason, SubmissionResult, } from "./submission.js";
212
+ export { Submission, Claimed, Queued, Suppressed, Ignored, CycleBlocked, IgnoreReason, SubmissionResult, } from "./submission.js";
213
+ export { RunAgainRequest, RunAgainResult } from "./run-again.js";
214
+ export { RetryRequest } from "./retry.js";
191
215
  export { RunEngineShutdown } from "./shutdown.js";
192
- export { RunNotFoundError, RunOperationRejectedError, EnginePersistenceError, AttemptCancellationError, RunStoreError, RunEngineError, } from "./error.js";
216
+ export { RunNotFoundError, RunOperationRejectedError, RunRetryBlockedError, EnginePersistenceError, AttemptCancellationError, RunInterventionRejectedError, LeftoversDiscardRejectedError, RunStoreError, RunEngineError, } from "./error.js";
193
217
  //# sourceMappingURL=engine.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"engine.js","sourceRoot":"","sources":["../../src/engine/engine.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAA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O,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EACL,gBAAgB,EAChB,yBAAyB,EACzB,oBAAoB,EACpB,sBAAsB,EACtB,wBAAwB,EACxB,4BAA4B,EAC5B,6BAA6B,EAC7B,aAAa,EACb,cAAc,GACf,MAAM,YAAY,CAAC"}
@@ -2,36 +2,63 @@ import { Schema } from "effect";
2
2
  declare const RunNotFoundError_base: Schema.Class<RunNotFoundError, Schema.TaggedStruct<"RunNotFoundError", {
3
3
  readonly runId: Schema.brand<Schema.NonEmptyString, "RunId">;
4
4
  }>, import("effect/Cause").YieldableError>;
5
- /** No Run with the requested identity exists in this instance's records. */
5
+ /** An error for a Run ID that doesn't exist. */
6
6
  export declare class RunNotFoundError extends RunNotFoundError_base {
7
7
  }
8
8
  declare const RunOperationRejectedError_base: Schema.Class<RunOperationRejectedError, Schema.TaggedStruct<"RunOperationRejectedError", {
9
9
  readonly runId: Schema.brand<Schema.NonEmptyString, "RunId">;
10
- readonly operation: Schema.Literals<readonly ["approve", "retry"]>;
10
+ readonly operation: Schema.Literals<readonly ["approve", "retry", "resolveFailure", "runAgain"]>;
11
11
  readonly state: Schema.String;
12
12
  }>, import("effect/Cause").YieldableError>;
13
- /** The Run's current state does not allow the requested approval or retry. */
13
+ /** An error for an operator action that the Run's state doesn't allow. */
14
14
  export declare class RunOperationRejectedError extends RunOperationRejectedError_base {
15
15
  }
16
+ declare const RunRetryBlockedError_base: Schema.Class<RunRetryBlockedError, Schema.TaggedStruct<"RunRetryBlockedError", {
17
+ readonly runId: Schema.brand<Schema.NonEmptyString, "RunId">;
18
+ readonly openRunId: Schema.brand<Schema.NonEmptyString, "RunId">;
19
+ readonly message: Schema.NonEmptyString;
20
+ }>, import("effect/Cause").YieldableError>;
21
+ /** An error for a retry or run again while `openRunId`, another Run of the same Loop and Item, is open. */
22
+ export declare class RunRetryBlockedError extends RunRetryBlockedError_base {
23
+ }
16
24
  declare const EnginePersistenceError_base: Schema.Class<EnginePersistenceError, Schema.TaggedStruct<"EnginePersistenceError", {
17
25
  readonly operation: Schema.String;
18
26
  readonly cause: Schema.Defect;
19
27
  }>, import("effect/Cause").YieldableError>;
20
- /** An operation could not read or update the instance's durable records. */
28
+ /** An error reading or writing the instance's durable records. */
21
29
  export declare class EnginePersistenceError extends EnginePersistenceError_base {
22
30
  }
23
31
  declare const AttemptCancellationError_base: Schema.Class<AttemptCancellationError, Schema.TaggedStruct<"AttemptCancellationError", {
24
32
  readonly attemptId: Schema.brand<Schema.NonEmptyString, "AttemptId">;
25
33
  readonly cause: Schema.Defect;
26
34
  }>, import("effect/Cause").YieldableError>;
27
- /** The Run is canceled, but interrupting its active Attempt failed. */
35
+ /** An error for a canceled Run whose active Attempt couldn't be interrupted. */
28
36
  export declare class AttemptCancellationError extends AttemptCancellationError_base {
29
37
  }
30
- /** Everything the store itself can fail with. */
31
- export declare const RunStoreError: Schema.Union<readonly [typeof RunNotFoundError, typeof RunOperationRejectedError, typeof EnginePersistenceError]>;
38
+ /** The errors that the Run store can fail with. */
39
+ export declare const RunStoreError: Schema.Union<readonly [typeof RunNotFoundError, typeof RunOperationRejectedError, typeof RunRetryBlockedError, typeof EnginePersistenceError]>;
32
40
  export type RunStoreError = typeof RunStoreError.Type;
33
- /** The store's failures plus the cancellation handshake failure only the engine raises. */
34
- export declare const RunEngineError: Schema.Union<readonly [typeof RunNotFoundError, typeof RunOperationRejectedError, typeof EnginePersistenceError, typeof AttemptCancellationError]>;
41
+ declare const RunInterventionRejectedError_base: Schema.Class<RunInterventionRejectedError, Schema.TaggedStruct<"RunInterventionRejectedError", {
42
+ readonly runId: Schema.brand<Schema.NonEmptyString, "RunId">;
43
+ readonly attemptId: Schema.brand<Schema.NonEmptyString, "AttemptId">;
44
+ readonly message: Schema.NonEmptyString;
45
+ }>, import("effect/Cause").YieldableError>;
46
+ /** An error for an Attempt that is no longer live or whose channel rejected operator input. */
47
+ export declare class RunInterventionRejectedError extends RunInterventionRejectedError_base {
48
+ }
49
+ declare const LeftoversDiscardRejectedError_base: Schema.Class<LeftoversDiscardRejectedError, Schema.TaggedStruct<"LeftoversDiscardRejectedError", {
50
+ readonly worker: Schema.brand<Schema.String, "WorkerName">;
51
+ /** The number of open Attempts on `worker`. */
52
+ readonly running: Schema.Int;
53
+ }>, import("effect/Cause").YieldableError>;
54
+ /**
55
+ * An error for discarding the leftovers of a Worker that is still in `usine.yaml` or still has
56
+ * open Attempts. Nothing is discarded.
57
+ */
58
+ export declare class LeftoversDiscardRejectedError extends LeftoversDiscardRejectedError_base {
59
+ }
60
+ /** The Run store errors plus `AttemptCancellationError`. */
61
+ export declare const RunEngineError: Schema.Union<readonly [typeof RunNotFoundError, typeof RunOperationRejectedError, typeof RunRetryBlockedError, typeof EnginePersistenceError, typeof AttemptCancellationError, typeof RunInterventionRejectedError]>;
35
62
  export type RunEngineError = typeof RunEngineError.Type;
36
63
  export {};
37
64
  //# sourceMappingURL=error.d.ts.map