@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
@@ -1 +1 @@
1
- {"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../src/engine/error.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;;;;AAEhC,4EAA4E;AAC5E,qBAAa,gBAAiB,SAAQ,qBAIpC;CAAG;;;;;;AAEL,8EAA8E;AAC9E,qBAAa,yBAA0B,SAAQ,8BAM7C;CAAG;;;;;AAEL,4EAA4E;AAC5E,qBAAa,sBAAuB,SAAQ,2BAK1C;CAAG;;;;;AAEL,uEAAuE;AACvE,qBAAa,wBAAyB,SAAQ,6BAK5C;CAAG;AAEL,iDAAiD;AACjD,eAAO,MAAM,aAAa,mHAIxB,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,OAAO,aAAa,CAAC,IAAI,CAAC;AAEtD,2FAA2F;AAC3F,eAAO,MAAM,cAAc,oJAKzB,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,OAAO,cAAc,CAAC,IAAI,CAAC"}
1
+ {"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../src/engine/error.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;;;;AAEhC,gDAAgD;AAChD,qBAAa,gBAAiB,SAAQ,qBAIpC;CAAG;;;;;;AAEL,0EAA0E;AAC1E,qBAAa,yBAA0B,SAAQ,8BAM7C;CAAG;;;;;;AAEL,2GAA2G;AAC3G,qBAAa,oBAAqB,SAAQ,yBAMxC;CAAG;;;;;AAEL,kEAAkE;AAClE,qBAAa,sBAAuB,SAAQ,2BAK1C;CAAG;;;;;AAEL,gFAAgF;AAChF,qBAAa,wBAAyB,SAAQ,6BAK5C;CAAG;AAEL,mDAAmD;AACnD,eAAO,MAAM,aAAa,gJAKxB,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,OAAO,aAAa,CAAC,IAAI,CAAC;;;;;;AAEtD,+FAA+F;AAC/F,qBAAa,4BAA6B,SAAQ,iCAMhD;CAAG;;;IAUH,+CAA+C;;;AARjD;;;GAGG;AACH,qBAAa,6BAA8B,SAAQ,kCAMjD;CAAG;AAEL,4DAA4D;AAC5D,eAAO,MAAM,cAAc,sNAOzB,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,OAAO,cAAc,CAAC,IAAI,CAAC"}
@@ -1,41 +1,69 @@
1
1
  import { AttemptId } from "@usine/core/attempt";
2
2
  import { RunId } from "@usine/core/run";
3
+ import { WorkerName } from "@usine/core/worker";
3
4
  import { Schema } from "effect";
4
- /** No Run with the requested identity exists in this instance's records. */
5
+ /** An error for a Run ID that doesn't exist. */
5
6
  export class RunNotFoundError extends Schema.TaggedError("@usine/engine/RunNotFoundError")("RunNotFoundError", {
6
7
  runId: RunId,
7
8
  }) {
8
9
  }
9
- /** The Run's current state does not allow the requested approval or retry. */
10
+ /** An error for an operator action that the Run's state doesn't allow. */
10
11
  export class RunOperationRejectedError extends Schema.TaggedError("@usine/engine/RunOperationRejectedError")("RunOperationRejectedError", {
11
12
  runId: RunId,
12
- operation: Schema.Literals(["approve", "retry"]),
13
+ operation: Schema.Literals(["approve", "retry", "resolveFailure", "runAgain"]),
13
14
  state: Schema.String,
14
15
  }) {
15
16
  }
16
- /** An operation could not read or update the instance's durable records. */
17
+ /** An error for a retry or run again while `openRunId`, another Run of the same Loop and Item, is open. */
18
+ export class RunRetryBlockedError extends Schema.TaggedError("@usine/engine/RunRetryBlockedError")("RunRetryBlockedError", {
19
+ runId: RunId,
20
+ openRunId: RunId,
21
+ message: Schema.NonEmptyString,
22
+ }) {
23
+ }
24
+ /** An error reading or writing the instance's durable records. */
17
25
  export class EnginePersistenceError extends Schema.TaggedError("@usine/engine/EnginePersistenceError")("EnginePersistenceError", {
18
26
  operation: Schema.String,
19
27
  cause: Schema.Defect(),
20
28
  }) {
21
29
  }
22
- /** The Run is canceled, but interrupting its active Attempt failed. */
30
+ /** An error for a canceled Run whose active Attempt couldn't be interrupted. */
23
31
  export class AttemptCancellationError extends Schema.TaggedError("@usine/engine/AttemptCancellationError")("AttemptCancellationError", {
24
32
  attemptId: AttemptId,
25
33
  cause: Schema.Defect(),
26
34
  }) {
27
35
  }
28
- /** Everything the store itself can fail with. */
36
+ /** The errors that the Run store can fail with. */
29
37
  export const RunStoreError = Schema.Union([
30
38
  RunNotFoundError,
31
39
  RunOperationRejectedError,
40
+ RunRetryBlockedError,
32
41
  EnginePersistenceError,
33
42
  ]);
34
- /** The store's failures plus the cancellation handshake failure only the engine raises. */
43
+ /** An error for an Attempt that is no longer live or whose channel rejected operator input. */
44
+ export class RunInterventionRejectedError extends Schema.TaggedError("@usine/engine/RunInterventionRejectedError")("RunInterventionRejectedError", {
45
+ runId: RunId,
46
+ attemptId: AttemptId,
47
+ message: Schema.NonEmptyString,
48
+ }) {
49
+ }
50
+ /**
51
+ * An error for discarding the leftovers of a Worker that is still in `usine.yaml` or still has
52
+ * open Attempts. Nothing is discarded.
53
+ */
54
+ export class LeftoversDiscardRejectedError extends Schema.TaggedError("@usine/engine/LeftoversDiscardRejectedError")("LeftoversDiscardRejectedError", {
55
+ worker: WorkerName,
56
+ /** The number of open Attempts on `worker`. */
57
+ running: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),
58
+ }) {
59
+ }
60
+ /** The Run store errors plus `AttemptCancellationError`. */
35
61
  export const RunEngineError = Schema.Union([
36
62
  RunNotFoundError,
37
63
  RunOperationRejectedError,
64
+ RunRetryBlockedError,
38
65
  EnginePersistenceError,
39
66
  AttemptCancellationError,
67
+ RunInterventionRejectedError,
40
68
  ]);
41
69
  //# sourceMappingURL=error.js.map
@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;CAAG;AAEL,gFAAgF;AAChF,MAAM,OAAO,wBAAyB,SAAQ,MAAM,CAAC,WAAW,CAC9D,wCAAwC,CACzC,CAAC,0BAA0B,EAAE;IAC5B,SAAS,EAAE,SAAS;IACpB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE;CACvB,CAAC;CAAG;AAEL,mDAAmD;AACnD,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,KAAK,CAAC;IACxC,gBAAgB;IAChB,yBAAyB;IACzB,oBAAoB;IACpB,sBAAsB;CACvB,CAAC,CAAC;AAIH,+FAA+F;AAC/F,MAAM,OAAO,4BAA6B,SAAQ,MAAM,CAAC,WAAW,CAClE,4CAA4C,CAC7C,CAAC,8BAA8B,EAAE;IAChC,KAAK,EAAE,KAAK;IACZ,SAAS,EAAE,SAAS;IACpB,OAAO,EAAE,MAAM,CAAC,cAAc;CAC/B,CAAC;CAAG;AAEL;;;GAGG;AACH,MAAM,OAAO,6BAA8B,SAAQ,MAAM,CAAC,WAAW,CACnE,6CAA6C,CAC9C,CAAC,+BAA+B,EAAE;IACjC,MAAM,EAAE,UAAU;IAClB,+CAA+C;IAC/C,OAAO,EAAE,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC;CAC5D,CAAC;CAAG;AAEL,4DAA4D;AAC5D,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,KAAK,CAAC;IACzC,gBAAgB;IAChB,yBAAyB;IACzB,oBAAoB;IACpB,sBAAsB;IACtB,wBAAwB;IACxB,4BAA4B;CAC7B,CAAC,CAAC"}
@@ -1,13 +1,15 @@
1
1
  import { Attempt, AttemptId, AttemptNumber } from "@usine/core/attempt";
2
2
  import { AttemptFailure, InfraFailure } from "@usine/core/attempt/failure";
3
3
  import { AttemptCanceled, AttemptFailed, AttemptSucceeded } from "@usine/core/attempt/outcome";
4
+ import type { SalvagePushed } from "@usine/core/attempt/salvage";
5
+ import { type AttemptStart, type OperatorRetryStart } from "@usine/core/attempt/start";
4
6
  import { EventId } from "@usine/core/event";
5
7
  import { Run, RunId } from "@usine/core/run";
6
8
  import * as RunState from "@usine/core/run/state";
7
9
  import { StepResult } from "@usine/core/step/result";
8
10
  import { Option, Result } from "effect";
9
- import type { WorkflowCommand } from "../workflow/command.ts";
10
- /** A Run and its Attempts in ascending attempt-number order, read together. */
11
+ import type { IgnoreReason } from "./submission.ts";
12
+ /** A Run and its Attempts, ordered by Attempt number. */
11
13
  interface RunProgress {
12
14
  readonly run: Run;
13
15
  readonly attempts: ReadonlyArray<Attempt>;
@@ -34,36 +36,35 @@ type RunSucceeded = {
34
36
  readonly state: RunState.Succeeded;
35
37
  readonly result: StepResult;
36
38
  };
37
- /** Changes that must commit together when an Attempt finishes. Only success stores a Step result. */
39
+ /** The changes committed together when an Attempt finishes. */
38
40
  export type FinishDecision = RetryAttempt | RunFailed | RunSucceeded | Unchanged;
39
41
  /**
40
- * Settles the current Attempt from its executor result. Infrastructure failure
41
- * can retry up to three total Attempts; a late or repeated completion changes nothing.
42
+ * Returns the changes for the executor result of `attemptId`. An infrastructure failure is
43
+ * retried up to 3 Attempts in total; a late or repeated result returns `Unchanged`.
42
44
  */
43
45
  export declare const finishAttempt: (current: RunProgress, attemptId: AttemptId, result: Result.Result<StepResult, AttemptFailure>) => FinishDecision;
44
- /**
45
- * Repairs an open Attempt from a final durable result. The workflow has already
46
- * ended, so even an infrastructure failure closes the Run without auto-retry.
47
- * The runtime must first translate its completion into a typed result; defects
48
- * and suspension are not Attempt outcomes here (ADRs 0003 and 0010).
49
- */
50
- export declare const reconcileAttempt: (current: RunProgress, result: Result.Result<StepResult, AttemptFailure>) => FinishDecision;
51
46
  type StartDecision = {
52
47
  readonly _tag: "StartAttempt";
53
48
  readonly state: RunState.Running;
54
49
  readonly number: AttemptNumber;
50
+ readonly start: AttemptStart;
55
51
  readonly interrupted: Option.Option<RetryAttempt>;
52
+ readonly resume: Option.Option<SalvagePushed>;
53
+ } | {
54
+ readonly _tag: "ReattachAttempt";
55
+ readonly state: RunState.Running;
56
+ readonly attempt: Attempt;
57
+ readonly resume: Option.Option<SalvagePushed>;
56
58
  } | RunFailed | {
57
59
  readonly _tag: "RunClosed";
58
60
  readonly state: RunState.RunState;
59
61
  };
60
62
  /**
61
- * Admits the next Attempt after a Worker reservation. An unfinished previous
62
- * Attempt indicates a restart and counts against the same retry cap as ordinary
63
- * infrastructure failure. `interruption` records the runtime's explanation.
64
- * The caller creates the new Attempt's identity and timestamp only when admitted.
63
+ * Returns how the next Attempt starts after a Worker reservation. If an open Attempt's parent
64
+ * task is `live`, reattaches it without using a retry; otherwise fails it with `interruption`,
65
+ * counted against the retry cap. `requested` is the operator retry that reopened the Run, if any.
65
66
  */
66
- export declare const beginAttempt: (current: RunProgress, interruption: InfraFailure) => StartDecision;
67
+ export declare const beginAttempt: (current: RunProgress, interruption: InfraFailure, live: Option.Option<AttemptId>, requested: Option.Option<OperatorRetryStart>) => StartDecision;
67
68
  type CancelDecision = {
68
69
  readonly _tag: "AlreadyClosed";
69
70
  } | {
@@ -74,10 +75,7 @@ type CancelDecision = {
74
75
  readonly outcome: AttemptCanceled;
75
76
  }>;
76
77
  };
77
- /**
78
- * Cancels open work and, if executing, its unfinished Attempt. A Run awaiting
79
- * capacity may have no Attempt, or only the closed Attempt preceding a retry.
80
- */
78
+ /** Returns the cancel decision for an open Run and its open Attempt, if any. */
81
79
  export declare const cancelRun: (current: RunProgress) => CancelDecision;
82
80
  type RetryDecision = {
83
81
  readonly _tag: "Resume";
@@ -88,11 +86,67 @@ type RetryDecision = {
88
86
  readonly _tag: "RetryRejected";
89
87
  };
90
88
  /**
91
- * Reopens a failed Run for operator retry regardless of its Attempt count.
92
- * Repeating the request is accepted while its Resume command remains pending;
93
- * after delivery, retrying a Running Run is rejected.
89
+ * Returns the operator retry decision, regardless of the Attempt count. A retry of a running Run
90
+ * with no open Attempt changes nothing; a retry of a running Attempt is rejected.
91
+ */
92
+ export declare const retryRun: (current: RunProgress) => RetryDecision;
93
+ /**
94
+ * The Loop's previous sighting of an Item: `None` if never seen, `Some(None)` after a
95
+ * non-matching sighting, and `Some(Some(event))` for the last submitted Event.
96
+ */
97
+ export type PreviousSighting = Option.Option<Option.Option<EventId>>;
98
+ /**
99
+ * Returns whether the previous sighting was a non-match or another Event than `eventId`. Returns
100
+ * `false` if the Loop never saw the Item.
101
+ */
102
+ export declare const cameBack: (previous: PreviousSighting, eventId: EventId) => boolean;
103
+ /** The state of a recorded Event that has a Run or was ignored. */
104
+ export type Settlement = {
105
+ readonly _tag: "Owned";
106
+ readonly run: Run;
107
+ } | {
108
+ readonly _tag: "Ignored";
109
+ readonly reason: IgnoreReason;
110
+ };
111
+ type SightingDecision = {
112
+ readonly _tag: "JoinRun";
113
+ readonly run: Run;
114
+ } | {
115
+ readonly _tag: "StayIgnored";
116
+ readonly reason: IgnoreReason;
117
+ } | {
118
+ readonly _tag: "ReopenEvent";
119
+ };
120
+ /**
121
+ * Returns what a new sighting of the `settled` Event does. The Event reopens only if the Item
122
+ * came back (#267) and its Run was canceled or the queued Event was revoked.
123
+ */
124
+ export declare const resightEvent: (settled: Settlement, itemCameBack: boolean) => SightingDecision;
125
+ /**
126
+ * The state that keeps a Loop from opening Runs for an Item after an Attempt stopped for the
127
+ * operator: the stopped Run, and the Item's state after the stop once seen (#241, #341).
128
+ */
129
+ export interface Suppression {
130
+ readonly runId: RunId;
131
+ readonly suppressedEventId: Option.Option<EventId>;
132
+ }
133
+ /** The kind of operator stop: a question or a blocker. */
134
+ export type OperatorStop = "question" | "blocker";
135
+ /** Returns the kind of operator stop that fails the Run in `decision`, or `None` (ADR 0017). */
136
+ export declare const operatorStop: (decision: FinishDecision) => Option.Option<OperatorStop>;
137
+ type SuppressionDecision = {
138
+ readonly _tag: "Suppress";
139
+ } | {
140
+ readonly _tag: "SuppressFrom";
141
+ } | {
142
+ readonly _tag: "Lift";
143
+ };
144
+ /**
145
+ * Returns what an unclaimed Event does during a suppression. The first Event after the stop,
146
+ * which usually contains the Agent's own comment, becomes the suppressed state (`SuppressFrom`);
147
+ * a different later Event lifts the suppression.
94
148
  */
95
- export declare const retryRun: (state: RunState.RunState, pendingCommands: ReadonlyArray<WorkflowCommand>) => RetryDecision;
149
+ export declare const suppressionDecision: (suppression: Suppression, eventId: EventId) => SuppressionDecision;
96
150
  type ClaimDecision = {
97
151
  readonly _tag: "OpenRun";
98
152
  } | {
@@ -103,9 +157,8 @@ type ClaimDecision = {
103
157
  readonly state: RunState.Canceled;
104
158
  };
105
159
  /**
106
- * Places a previously unclaimed Event behind its Item's running work, or
107
- * replaces unstarted work. The ledger must resolve permanent deduplication and
108
- * ignored Events before this decision; running Attempts always finish (ADR 0007).
160
+ * Returns what an unclaimed Event does: open a Run, queue behind the Item's running Run, or
161
+ * supersede the Item's unstarted Run (ADR 0007).
109
162
  */
110
163
  export declare const claimRun: (blocking: Option.Option<Run>, eventId: EventId) => ClaimDecision;
111
164
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"lifecycle.d.ts","sourceRoot":"","sources":["../../src/engine/lifecycle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,aAAa,EAAmB,MAAM,qBAAqB,CAAC;AACzF,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3E,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/F,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,KAAK,QAAQ,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,KAAK,EAAE,eAAe,EAA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EF;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;IACtB,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;CACpD;AAED,0DAA0D;AAC1D,MAAM,MAAM,YAAY,GAAG,UAAU,GAAG,SAAS,CAAC;AAElD,gGAAgG;AAChG,eAAO,MAAM,YAAY,aAAc,cAAc,KAAG,MAAM,CAAC,MAAM,CAAC,YAAY,CAUjF,CAAC;AAEF,KAAK,mBAAmB,GACpB;IAAE,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAA;CAAE,GAC7B;IAAE,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAA;CAAE,GACjC;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAE9B;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,gBACjB,WAAW,WACf,OAAO,KACf,mBAKC,CAAC;AAEL,KAAK,aAAa,GACd;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAA;CAAE,GAC5B;IAAE,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAA;CAAE,GAC/B;IAAE,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,QAAQ,CAAA;CAAE,CAAC;AAEhG;;;GAGG;AACH,eAAO,MAAM,QAAQ,aAAc,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,WAAW,OAAO,KAAG,aAQzE,CAAC"}
@@ -1,35 +1,37 @@
1
1
  import { Attempt, AttemptId, AttemptNumber, shouldAutoRetry } from "@usine/core/attempt";
2
2
  import { AttemptFailure, InfraFailure } from "@usine/core/attempt/failure";
3
3
  import { AttemptCanceled, AttemptFailed, AttemptSucceeded } from "@usine/core/attempt/outcome";
4
+ import { StartedAfterRestart, StartedByEvent, StartedByInfraRetry, } from "@usine/core/attempt/start";
4
5
  import { EventId } from "@usine/core/event";
5
6
  import { Run, RunId } from "@usine/core/run";
6
7
  import * as RunState from "@usine/core/run/state";
7
8
  import { StepResult } from "@usine/core/step/result";
8
- import { Option, Result } from "effect";
9
- // Engine policy, not a limit imposed on consumers of the core Attempt model.
9
+ import { Array as EffectArray, Option, Result } from "effect";
10
10
  const MAX_AUTO_ATTEMPTS = AttemptNumber.make(3);
11
11
  const openAttempt = (current) => Option.fromNullishOr(current.attempts.at(-1)).pipe(Option.filter((attempt) => Option.isNone(attempt.outcome)));
12
- const failRunningAttempt = (state, attempt, failure, policy) => {
12
+ const failRunningAttempt = (state, attempt, failure) => {
13
13
  const outcome = new AttemptFailed({ failure });
14
- if (policy === "Execution" &&
15
- shouldAutoRetry({ failure, number: attempt.number, maxAutoAttempts: MAX_AUTO_ATTEMPTS })) {
14
+ if (shouldAutoRetry({ failure, number: attempt.number, maxAutoAttempts: MAX_AUTO_ATTEMPTS })) {
16
15
  return { _tag: "RetryAttempt", attempt, outcome };
17
16
  }
18
17
  return { _tag: "RunFailed", attempt, outcome, state: RunState.fail(state) };
19
18
  };
20
- const finish = (current, attemptId, result, policy) => {
19
+ /**
20
+ * Returns the changes for the executor result of `attemptId`. An infrastructure failure is
21
+ * retried up to 3 Attempts in total; a late or repeated result returns `Unchanged`.
22
+ */
23
+ export const finishAttempt = (current, attemptId, result) => {
21
24
  if (current.run.state._tag !== "Running") {
22
25
  return { _tag: "Unchanged", reason: "RunNotRunning" };
23
26
  }
24
27
  const attempt = openAttempt(current);
25
28
  if (Option.isNone(attempt))
26
29
  return { _tag: "Unchanged", reason: "NoOpenAttempt" };
27
- // A completion from before restart or operator retry cannot settle the
28
- // replacement Attempt, even though the Run is Running again.
30
+ // A result from before a restart or retry doesn't apply to the replacement Attempt.
29
31
  if (attempt.value.id !== attemptId)
30
32
  return { _tag: "Unchanged", reason: "AttemptReplaced" };
31
33
  if (Result.isFailure(result)) {
32
- return failRunningAttempt(current.run.state, attempt.value, result.failure, policy);
34
+ return failRunningAttempt(current.run.state, attempt.value, result.failure);
33
35
  }
34
36
  return {
35
37
  _tag: "RunSucceeded",
@@ -39,30 +41,14 @@ const finish = (current, attemptId, result, policy) => {
39
41
  result: result.success,
40
42
  };
41
43
  };
44
+ // Only a pushed salvage can be fetched on another Worker, so a retry resumes from the newest one.
45
+ const newestPushedSalvage = (attempts) => EffectArray.findLast(attempts, (attempt) => Option.filter(attempt.salvage, (salvage) => salvage._tag === "Pushed"));
42
46
  /**
43
- * Settles the current Attempt from its executor result. Infrastructure failure
44
- * can retry up to three total Attempts; a late or repeated completion changes nothing.
45
- */
46
- export const finishAttempt = (current, attemptId, result) => finish(current, attemptId, result, "Execution");
47
- /**
48
- * Repairs an open Attempt from a final durable result. The workflow has already
49
- * ended, so even an infrastructure failure closes the Run without auto-retry.
50
- * The runtime must first translate its completion into a typed result; defects
51
- * and suspension are not Attempt outcomes here (ADRs 0003 and 0010).
47
+ * Returns how the next Attempt starts after a Worker reservation. If an open Attempt's parent
48
+ * task is `live`, reattaches it without using a retry; otherwise fails it with `interruption`,
49
+ * counted against the retry cap. `requested` is the operator retry that reopened the Run, if any.
52
50
  */
53
- export const reconcileAttempt = (current, result) => {
54
- const attempt = openAttempt(current);
55
- return Option.isNone(attempt)
56
- ? { _tag: "Unchanged", reason: "NoOpenAttempt" }
57
- : finish(current, attempt.value.id, result, "FinalReconciliation");
58
- };
59
- /**
60
- * Admits the next Attempt after a Worker reservation. An unfinished previous
61
- * Attempt indicates a restart and counts against the same retry cap as ordinary
62
- * infrastructure failure. `interruption` records the runtime's explanation.
63
- * The caller creates the new Attempt's identity and timestamp only when admitted.
64
- */
65
- export const beginAttempt = (current, interruption) => {
51
+ export const beginAttempt = (current, interruption, live, requested) => {
66
52
  const state = current.run.state;
67
53
  if (!RunState.isStartable(state) && state._tag !== "Running") {
68
54
  return { _tag: "RunClosed", state };
@@ -70,22 +56,32 @@ export const beginAttempt = (current, interruption) => {
70
56
  let interrupted = Option.none();
71
57
  const attempt = openAttempt(current);
72
58
  if (state._tag === "Running" && Option.isSome(attempt)) {
73
- const recovery = failRunningAttempt(state, attempt.value, interruption, "Execution");
59
+ if (Option.contains(live, attempt.value.id)) {
60
+ return {
61
+ _tag: "ReattachAttempt",
62
+ state,
63
+ attempt: attempt.value,
64
+ resume: newestPushedSalvage(current.attempts),
65
+ };
66
+ }
67
+ const recovery = failRunningAttempt(state, attempt.value, interruption);
74
68
  if (recovery._tag === "RunFailed")
75
69
  return recovery;
76
70
  interrupted = Option.some(recovery);
77
71
  }
72
+ const start = Option.isSome(interrupted)
73
+ ? new StartedAfterRestart()
74
+ : Option.getOrElse(requested, () => current.attempts.length === 0 ? new StartedByEvent() : new StartedByInfraRetry());
78
75
  return {
79
76
  _tag: "StartAttempt",
80
77
  state: state._tag === "Running" ? state : RunState.start(state),
81
78
  number: AttemptNumber.make((current.attempts.at(-1)?.number ?? 0) + 1),
79
+ start,
82
80
  interrupted,
81
+ resume: newestPushedSalvage(current.attempts),
83
82
  };
84
83
  };
85
- /**
86
- * Cancels open work and, if executing, its unfinished Attempt. A Run awaiting
87
- * capacity may have no Attempt, or only the closed Attempt preceding a retry.
88
- */
84
+ /** Returns the cancel decision for an open Run and its open Attempt, if any. */
89
85
  export const cancelRun = (current) => {
90
86
  if (!RunState.isOpen(current.run.state))
91
87
  return { _tag: "AlreadyClosed" };
@@ -101,22 +97,65 @@ export const cancelRun = (current) => {
101
97
  };
102
98
  };
103
99
  /**
104
- * Reopens a failed Run for operator retry regardless of its Attempt count.
105
- * Repeating the request is accepted while its Resume command remains pending;
106
- * after delivery, retrying a Running Run is rejected.
100
+ * Returns the operator retry decision, regardless of the Attempt count. A retry of a running Run
101
+ * with no open Attempt changes nothing; a retry of a running Attempt is rejected.
107
102
  */
108
- export const retryRun = (state, pendingCommands) => {
103
+ export const retryRun = (current) => {
104
+ const state = current.run.state;
109
105
  if (state._tag === "Failed")
110
106
  return { _tag: "Resume", state: RunState.retry(state) };
111
- if (state._tag === "Running" && pendingCommands.includes("Resume")) {
107
+ if (state._tag === "Running" && Option.isNone(openAttempt(current))) {
112
108
  return { _tag: "ResumePending" };
113
109
  }
114
110
  return { _tag: "RetryRejected" };
115
111
  };
116
112
  /**
117
- * Places a previously unclaimed Event behind its Item's running work, or
118
- * replaces unstarted work. The ledger must resolve permanent deduplication and
119
- * ignored Events before this decision; running Attempts always finish (ADR 0007).
113
+ * Returns whether the previous sighting was a non-match or another Event than `eventId`. Returns
114
+ * `false` if the Loop never saw the Item.
115
+ */
116
+ export const cameBack = (previous, eventId) => Option.match(previous, {
117
+ onNone: () => false,
118
+ onSome: (observed) => !Option.contains(observed, eventId),
119
+ });
120
+ /**
121
+ * Returns what a new sighting of the `settled` Event does. The Event reopens only if the Item
122
+ * came back (#267) and its Run was canceled or the queued Event was revoked.
123
+ */
124
+ export const resightEvent = (settled, itemCameBack) => {
125
+ if (settled._tag === "Owned") {
126
+ return settled.run.state._tag === "Canceled" && itemCameBack
127
+ ? { _tag: "ReopenEvent" }
128
+ : { _tag: "JoinRun", run: settled.run };
129
+ }
130
+ return settled.reason === "revoked" && itemCameBack
131
+ ? { _tag: "ReopenEvent" }
132
+ : { _tag: "StayIgnored", reason: settled.reason };
133
+ };
134
+ /** Returns the kind of operator stop that fails the Run in `decision`, or `None` (ADR 0017). */
135
+ export const operatorStop = (decision) => {
136
+ if (decision._tag !== "RunFailed")
137
+ return Option.none();
138
+ switch (decision.outcome.failure._tag) {
139
+ case "QuestionFailure":
140
+ return Option.some("question");
141
+ case "BlockedFailure":
142
+ return Option.some("blocker");
143
+ default:
144
+ return Option.none();
145
+ }
146
+ };
147
+ /**
148
+ * Returns what an unclaimed Event does during a suppression. The first Event after the stop,
149
+ * which usually contains the Agent's own comment, becomes the suppressed state (`SuppressFrom`);
150
+ * a different later Event lifts the suppression.
151
+ */
152
+ export const suppressionDecision = (suppression, eventId) => Option.match(suppression.suppressedEventId, {
153
+ onNone: () => ({ _tag: "SuppressFrom" }),
154
+ onSome: (suppressed) => suppressed === eventId ? { _tag: "Suppress" } : { _tag: "Lift" },
155
+ });
156
+ /**
157
+ * Returns what an unclaimed Event does: open a Run, queue behind the Item's running Run, or
158
+ * supersede the Item's unstarted Run (ADR 0007).
120
159
  */
121
160
  export const claimRun = (blocking, eventId) => {
122
161
  if (Option.isNone(blocking))
@@ -1 +1 @@
1
- {"version":3,"file":"lifecycle.js","sourceRoot":"","sources":["../../src/engine/lifecycle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACzF,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3E,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/F,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,KAAK,QAAQ,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGxC,6EAA6E;AAC7E,MAAM,iBAAiB,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAqChD,MAAM,WAAW,GAAG,CAAC,OAAoB,EAA0B,EAAE,CACnE,MAAM,CAAC,aAAa,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAChD,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAC3D,CAAC;AAEJ,MAAM,kBAAkB,GAAG,CACzB,KAAuB,E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KAAK,CAAC,WAAW,CAAC,iBAAiB,EAAE;IAC1C,MAAM,EAAE,GAAwB,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC;IAC7D,MAAM,EAAE,CAAC,UAAU,EAAuB,EAAE,CAC1C,UAAU,KAAK,OAAO,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE;CACnE,CAAC,CAAC;AAOL;;;GAGG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,QAA4B,EAAE,OAAgB,EAAiB,EAAE;IACxF,IAAI,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC;QAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;IACxD,MAAM,GAAG,GAAG,QAAQ,CAAC,KAAK,CAAC;IAC3B,IAAI,GAAG,CAAC,KAAK,CAAC,IAAI,KAAK,SAAS;QAAE,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC;IAChE,IAAI,QAAQ,CAAC,WAAW,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;QACpC,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,KAAK,EAAE,GAAG,CAAC,EAAE,EAAE,KAAK,EAAE,QAAQ,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,EAAE,OAAO,CAAC,EAAE,CAAC;IAChG,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;AAC7B,CAAC,CAAC"}
@@ -0,0 +1,16 @@
1
+ import { AttemptContext } from "@usine/core/attempt";
2
+ import { Schema } from "effect";
3
+ declare const RetryRequest_base: Schema.Class<RetryRequest, Schema.Struct<{
4
+ readonly requestedBy: Schema.Option<Schema.brand<Schema.String, "OperatorLogin">>;
5
+ readonly amendment: Schema.Option<typeof AttemptContext>;
6
+ }>, {}>;
7
+ /**
8
+ * An operator retry of a failed Run. `requestedBy` is `None` if `usine.yaml` sets no operator
9
+ * login, and `amendment` is the edit-and-retry task and Agent (ADR 0018).
10
+ */
11
+ export declare class RetryRequest extends RetryRequest_base {
12
+ }
13
+ /** A retry without a login that keeps the Run's task and Agent. */
14
+ export declare const plainRetry: RetryRequest;
15
+ export {};
16
+ //# sourceMappingURL=retry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"retry.d.ts","sourceRoot":"","sources":["../../src/engine/retry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,OAAO,EAAU,MAAM,EAAE,MAAM,QAAQ,CAAC;;;;;AAExC;;;GAGG;AACH,qBAAa,YAAa,SAAQ,iBAGhC;CAAG;AAEL,mEAAmE;AACnE,eAAO,MAAM,UAAU,cAGrB,CAAC"}
@@ -0,0 +1,18 @@
1
+ import { AttemptContext } from "@usine/core/attempt";
2
+ import { OperatorLogin } from "@usine/core/operator";
3
+ import { Option, Schema } from "effect";
4
+ /**
5
+ * An operator retry of a failed Run. `requestedBy` is `None` if `usine.yaml` sets no operator
6
+ * login, and `amendment` is the edit-and-retry task and Agent (ADR 0018).
7
+ */
8
+ export class RetryRequest extends Schema.Class("@usine/engine/RetryRequest")({
9
+ requestedBy: Schema.Option(OperatorLogin),
10
+ amendment: Schema.Option(AttemptContext),
11
+ }) {
12
+ }
13
+ /** A retry without a login that keeps the Run's task and Agent. */
14
+ export const plainRetry = new RetryRequest({
15
+ requestedBy: Option.none(),
16
+ amendment: Option.none(),
17
+ });
18
+ //# sourceMappingURL=retry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"retry.js","sourceRoot":"","sources":["../../src/engine/retry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAExC;;;GAGG;AACH,MAAM,OAAO,YAAa,SAAQ,MAAM,CAAC,KAAK,CAAe,4BAA4B,CAAC,CAAC;IACzF,WAAW,EAAE,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC;IACzC,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC;CACzC,CAAC;CAAG;AAEL,mEAAmE;AACnE,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,YAAY,CAAC;IACzC,WAAW,EAAE,MAAM,CAAC,IAAI,EAAE;IAC1B,SAAS,EAAE,MAAM,CAAC,IAAI,EAAE;CACzB,CAAC,CAAC"}
@@ -0,0 +1,45 @@
1
+ import { AttemptContext } from "@usine/core/attempt";
2
+ import { type CycleGeneration } from "@usine/core/cycle-budget";
3
+ import { DedupKey } from "@usine/core/event";
4
+ import { type DateTime, Schema } from "effect";
5
+ import type { RunSnapshot } from "../run-reader/model.ts";
6
+ import { Claimed, CycleBlocked, Submission } from "./submission.ts";
7
+ declare const RunAgainRequest_base: Schema.Class<RunAgainRequest, Schema.Struct<{
8
+ readonly step: Schema.brand<Schema.NonEmptyString, "StepName">;
9
+ readonly approval: Schema.Literals<readonly ["none", "required"]>;
10
+ /** The cycle limit, or `None` for a schedule Loop. */
11
+ readonly cycleLimit: Schema.Option<Schema.brand<Schema.Int, "CycleLimit">>;
12
+ readonly permissions: Schema.Literals<readonly ["write", "read"]>;
13
+ readonly context: typeof AttemptContext;
14
+ readonly requestedBy: Schema.Option<Schema.brand<Schema.String, "OperatorLogin">>;
15
+ }>, {}>;
16
+ /**
17
+ * An operator request to run a succeeded or canceled Run again with the Loop's current settings
18
+ * (#152). `requestedBy` is `None` if `usine.yaml` sets no operator login.
19
+ */
20
+ export declare class RunAgainRequest extends RunAgainRequest_base {
21
+ }
22
+ /**
23
+ * The result of a run again: `Claimed` with the new Run, or `CycleBlocked` with the Ask opened
24
+ * because the Item's cycle budget is used up.
25
+ */
26
+ export declare const RunAgainResult: Schema.Union<readonly [typeof Claimed, typeof CycleBlocked]>;
27
+ export type RunAgainResult = typeof RunAgainResult.Type;
28
+ /** The position of a run again among the Events opened for one trigger Event. */
29
+ export interface RunAgainIdentity {
30
+ /** The dedup key of the trigger Event that the closed Run's Event is or reopened. */
31
+ readonly trigger: DedupKey;
32
+ /** The trigger Event's next reopening number, shared with reopenings (#267). */
33
+ readonly reopening: number;
34
+ /** The Item's cycle generation at the time of the request. */
35
+ readonly generation: CycleGeneration;
36
+ readonly receivedAt: DateTime.Utc;
37
+ }
38
+ /**
39
+ * Returns the Event for a run again, with the closed Run's Item state and revision, the Loop's
40
+ * current settings, and the operator's task and Agent. Its dedup key,
41
+ * `["operator-run-again", n, <trigger key>]`, never collides with a polled Event.
42
+ */
43
+ export declare const runAgainSubmission: (ran: RunSnapshot, request: RunAgainRequest, identity: RunAgainIdentity) => Submission;
44
+ export {};
45
+ //# sourceMappingURL=run-again.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run-again.d.ts","sourceRoot":"","sources":["../../src/engine/run-again.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,KAAK,eAAe,EAAc,MAAM,0BAA0B,CAAC;AAC5E,OAAO,EAAE,QAAQ,EAAkB,MAAM,mBAAmB,CAAC;AAI7D,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC/C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;;;;IAUhE,sDAAsD;;;;;;AAR1D;;;GAGG;AACH,qBAAa,eAAgB,SAAQ,oBAUpC;CAAG;AAEJ;;;GAGG;AACH,eAAO,MAAM,cAAc,8DAAwC,CAAC;AAEpE,MAAM,MAAM,cAAc,GAAG,OAAO,cAAc,CAAC,IAAI,CAAC;AAExD,iFAAiF;AACjF,MAAM,WAAW,gBAAgB;IAC/B,qFAAqF;IACrF,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC;IAC3B,gFAAgF;IAChF,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,8DAA8D;IAC9D,QAAQ,CAAC,UAAU,EAAE,eAAe,CAAC;IACrC,QAAQ,CAAC,UAAU,EAAE,QAAQ,CAAC,GAAG,CAAC;CACnC;AAED;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,QACxB,WAAW,WACP,eAAe,YACd,gBAAgB,KACzB,UAwBF,CAAC"}