@usine/engine 0.3.0 → 0.5.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 (201) hide show
  1. package/LICENSE +661 -21
  2. package/README.md +112 -38
  3. package/dist/board-moves/board-moves.d.ts +20 -0
  4. package/dist/board-moves/board-moves.d.ts.map +1 -0
  5. package/dist/board-moves/board-moves.js +74 -0
  6. package/dist/board-moves/board-moves.js.map +1 -0
  7. package/dist/board-moves/model.d.ts +21 -0
  8. package/dist/board-moves/model.d.ts.map +1 -0
  9. package/dist/board-moves/model.js +22 -0
  10. package/dist/board-moves/model.js.map +1 -0
  11. package/dist/cursor/cursor.d.ts +2 -6
  12. package/dist/cursor/cursor.d.ts.map +1 -1
  13. package/dist/cursor/cursor.js +2 -6
  14. package/dist/cursor/cursor.js.map +1 -1
  15. package/dist/cycle-budget/cycle-budget.d.ts +14 -8
  16. package/dist/cycle-budget/cycle-budget.d.ts.map +1 -1
  17. package/dist/cycle-budget/cycle-budget.js +51 -10
  18. package/dist/cycle-budget/cycle-budget.js.map +1 -1
  19. package/dist/cycle-budget/model.d.ts +6 -2
  20. package/dist/cycle-budget/model.d.ts.map +1 -1
  21. package/dist/cycle-budget/model.js +5 -2
  22. package/dist/cycle-budget/model.js.map +1 -1
  23. package/dist/cycle-budget/queries.d.ts +1 -1
  24. package/dist/cycle-budget/queries.d.ts.map +1 -1
  25. package/dist/cycle-budget/queries.js +3 -3
  26. package/dist/cycle-budget/queries.js.map +1 -1
  27. package/dist/database/database.d.ts +1 -1
  28. package/dist/database/database.d.ts.map +1 -1
  29. package/dist/database/local-sqlite.d.ts +13 -10
  30. package/dist/database/local-sqlite.d.ts.map +1 -1
  31. package/dist/database/local-sqlite.js +22 -17
  32. package/dist/database/local-sqlite.js.map +1 -1
  33. package/dist/database/schema.d.ts +668 -36
  34. package/dist/database/schema.d.ts.map +1 -1
  35. package/dist/database/schema.js +123 -23
  36. package/dist/database/schema.js.map +1 -1
  37. package/dist/{workflow → engine}/admission.d.ts +2 -2
  38. package/dist/engine/admission.d.ts.map +1 -0
  39. package/dist/{workflow → engine}/admission.js +4 -4
  40. package/dist/engine/admission.js.map +1 -0
  41. package/dist/engine/checkout-recovery.d.ts +79 -0
  42. package/dist/engine/checkout-recovery.d.ts.map +1 -0
  43. package/dist/engine/checkout-recovery.js +238 -0
  44. package/dist/engine/checkout-recovery.js.map +1 -0
  45. package/dist/engine/engine.d.ts +67 -26
  46. package/dist/engine/engine.d.ts.map +1 -1
  47. package/dist/engine/engine.js +136 -129
  48. package/dist/engine/engine.js.map +1 -1
  49. package/dist/engine/error.d.ts +29 -10
  50. package/dist/engine/error.d.ts.map +1 -1
  51. package/dist/engine/error.js +28 -8
  52. package/dist/engine/error.js.map +1 -1
  53. package/dist/engine/lifecycle.d.ts +83 -28
  54. package/dist/engine/lifecycle.d.ts.map +1 -1
  55. package/dist/engine/lifecycle.js +94 -45
  56. package/dist/engine/lifecycle.js.map +1 -1
  57. package/dist/engine/retry.d.ts +16 -0
  58. package/dist/engine/retry.d.ts.map +1 -0
  59. package/dist/engine/retry.js +18 -0
  60. package/dist/engine/retry.js.map +1 -0
  61. package/dist/engine/run-again.d.ts +45 -0
  62. package/dist/engine/run-again.d.ts.map +1 -0
  63. package/dist/engine/run-again.js +56 -0
  64. package/dist/engine/run-again.js.map +1 -0
  65. package/dist/engine/run-driver.d.ts +68 -0
  66. package/dist/engine/run-driver.d.ts.map +1 -0
  67. package/dist/engine/run-driver.js +448 -0
  68. package/dist/engine/run-driver.js.map +1 -0
  69. package/dist/engine/shutdown.d.ts +3 -4
  70. package/dist/engine/shutdown.d.ts.map +1 -1
  71. package/dist/engine/shutdown.js +3 -4
  72. package/dist/engine/shutdown.js.map +1 -1
  73. package/dist/engine/submission.d.ts +31 -11
  74. package/dist/engine/submission.d.ts.map +1 -1
  75. package/dist/engine/submission.js +43 -12
  76. package/dist/engine/submission.js.map +1 -1
  77. package/dist/engine/unconfirmed-stops.d.ts +27 -0
  78. package/dist/engine/unconfirmed-stops.d.ts.map +1 -0
  79. package/dist/engine/unconfirmed-stops.js +26 -0
  80. package/dist/engine/unconfirmed-stops.js.map +1 -0
  81. package/dist/item-projection/item-projection.d.ts +14 -4
  82. package/dist/item-projection/item-projection.d.ts.map +1 -1
  83. package/dist/item-projection/item-projection.js +60 -14
  84. package/dist/item-projection/item-projection.js.map +1 -1
  85. package/dist/item-projection/model.d.ts +5 -1
  86. package/dist/item-projection/model.d.ts.map +1 -1
  87. package/dist/item-projection/model.js +6 -2
  88. package/dist/item-projection/model.js.map +1 -1
  89. package/dist/loop-control/loop-control.d.ts +5 -5
  90. package/dist/loop-control/loop-control.d.ts.map +1 -1
  91. package/dist/loop-control/loop-control.js +4 -4
  92. package/dist/loop-control/loop-control.js.map +1 -1
  93. package/dist/loop-control/model.d.ts +1 -1
  94. package/dist/loop-control/model.d.ts.map +1 -1
  95. package/dist/loop-control/model.js +1 -1
  96. package/dist/loop-control/model.js.map +1 -1
  97. package/dist/repository-label-projection/model.d.ts +2 -2
  98. package/dist/repository-label-projection/model.d.ts.map +1 -1
  99. package/dist/repository-label-projection/model.js +2 -2
  100. package/dist/repository-label-projection/model.js.map +1 -1
  101. package/dist/repository-label-projection/repository-label-projection.d.ts +1 -1
  102. package/dist/repository-label-projection/repository-label-projection.d.ts.map +1 -1
  103. package/dist/repository-label-projection/repository-label-projection.js +1 -1
  104. package/dist/repository-label-projection/repository-label-projection.js.map +1 -1
  105. package/dist/run-reader/model.d.ts +62 -4
  106. package/dist/run-reader/model.d.ts.map +1 -1
  107. package/dist/run-reader/model.js +66 -7
  108. package/dist/run-reader/model.js.map +1 -1
  109. package/dist/run-reader/run-reader.d.ts +25 -10
  110. package/dist/run-reader/run-reader.d.ts.map +1 -1
  111. package/dist/run-reader/run-reader.js +25 -7
  112. package/dist/run-reader/run-reader.js.map +1 -1
  113. package/dist/step-executor.d.ts +86 -13
  114. package/dist/step-executor.d.ts.map +1 -1
  115. package/dist/step-executor.js +10 -2
  116. package/dist/step-executor.js.map +1 -1
  117. package/dist/store/attempt-windows.d.ts +8 -0
  118. package/dist/store/attempt-windows.d.ts.map +1 -0
  119. package/dist/store/attempt-windows.js +53 -0
  120. package/dist/store/attempt-windows.js.map +1 -0
  121. package/dist/store/codec.d.ts +242 -43
  122. package/dist/store/codec.d.ts.map +1 -1
  123. package/dist/store/codec.js +61 -16
  124. package/dist/store/codec.js.map +1 -1
  125. package/dist/store/leftovers.d.ts +10 -0
  126. package/dist/store/leftovers.d.ts.map +1 -0
  127. package/dist/store/leftovers.js +43 -0
  128. package/dist/store/leftovers.js.map +1 -0
  129. package/dist/store/loop-items.d.ts +16 -0
  130. package/dist/store/loop-items.d.ts.map +1 -0
  131. package/dist/store/loop-items.js +185 -0
  132. package/dist/store/loop-items.js.map +1 -0
  133. package/dist/store/queries.d.ts +385 -36
  134. package/dist/store/queries.d.ts.map +1 -1
  135. package/dist/store/queries.js +355 -107
  136. package/dist/store/queries.js.map +1 -1
  137. package/dist/store/store.d.ts +106 -54
  138. package/dist/store/store.d.ts.map +1 -1
  139. package/dist/store/store.js +497 -190
  140. package/dist/store/store.js.map +1 -1
  141. package/dist/store/transcript.d.ts +3 -3
  142. package/dist/store/transcript.d.ts.map +1 -1
  143. package/dist/store/transcript.js +25 -6
  144. package/dist/store/transcript.js.map +1 -1
  145. package/dist/transcript.d.ts +19 -20
  146. package/dist/transcript.d.ts.map +1 -1
  147. package/dist/transcript.js +23 -21
  148. package/dist/transcript.js.map +1 -1
  149. package/dist/trigger-condition.d.ts +23 -0
  150. package/dist/trigger-condition.d.ts.map +1 -0
  151. package/dist/trigger-condition.js +8 -0
  152. package/dist/trigger-condition.js.map +1 -0
  153. package/drizzle/20260917071139_resolve_run_failure/migration.sql +1 -0
  154. package/drizzle/20260917071139_resolve_run_failure/snapshot.json +1471 -0
  155. package/drizzle/20260918032643_attempt_salvage/migration.sql +1 -0
  156. package/drizzle/20260918032643_attempt_salvage/snapshot.json +1481 -0
  157. package/drizzle/20261011153856_drop_workflow_tables/migration.sql +4 -0
  158. package/drizzle/20261011153856_drop_workflow_tables/snapshot.json +1433 -0
  159. package/drizzle/20261017155043_attempt_salvage_check/migration.sql +41 -0
  160. package/drizzle/20261017155043_attempt_salvage_check/snapshot.json +1421 -0
  161. package/drizzle/20261018162700_discard_attempt_leftovers/migration.sql +1 -0
  162. package/drizzle/20261018162700_discard_attempt_leftovers/snapshot.json +1431 -0
  163. package/drizzle/20261018172605_loop_items_and_reopenings/migration.sql +15 -0
  164. package/drizzle/20261018172605_loop_items_and_reopenings/snapshot.json +1574 -0
  165. package/drizzle/20261018180339_attempt_ended_at/migration.sql +1 -0
  166. package/drizzle/20261018180339_attempt_ended_at/snapshot.json +1584 -0
  167. package/drizzle/20261019104043_run_approval_source/migration.sql +15 -0
  168. package/drizzle/20261019104043_run_approval_source/snapshot.json +1610 -0
  169. package/drizzle/20261019133538_board_moves/migration.sql +14 -0
  170. package/drizzle/20261019133538_board_moves/snapshot.json +1731 -0
  171. package/drizzle/20261019170538_item_projection_gone/migration.sql +1 -0
  172. package/drizzle/20261019170538_item_projection_gone/snapshot.json +1741 -0
  173. package/drizzle/20261019180649_run_again_events/migration.sql +7 -0
  174. package/drizzle/20261019180649_run_again_events/snapshot.json +1804 -0
  175. package/drizzle/20261019185008_trigger_event_permissions/migration.sql +1 -0
  176. package/drizzle/20261019185008_trigger_event_permissions/snapshot.json +1814 -0
  177. package/drizzle/20261020103746_attempt_start/migration.sql +5 -0
  178. package/drizzle/20261020103746_attempt_start/snapshot.json +1844 -0
  179. package/drizzle/20261020125211_attempt_comments/migration.sql +1 -0
  180. package/drizzle/20261020125211_attempt_comments/snapshot.json +1854 -0
  181. package/drizzle/20261020191320_run_closed_at/migration.sql +6 -0
  182. package/drizzle/20261020191320_run_closed_at/snapshot.json +1864 -0
  183. package/drizzle/20261023091428_rename_loop_item_hold_to_suppression/migration.sql +2 -0
  184. package/drizzle/20261023091428_rename_loop_item_hold_to_suppression/snapshot.json +1867 -0
  185. package/drizzle/20261024162954_cycle_ask_closures/migration.sql +10 -0
  186. package/drizzle/20261024162954_cycle_ask_closures/snapshot.json +1948 -0
  187. package/drizzle/20261027104206_attempt_out_of_memory/migration.sql +1 -0
  188. package/drizzle/20261027104206_attempt_out_of_memory/snapshot.json +1958 -0
  189. package/drizzle/20261027191944_failure_resolution/migration.sql +1 -0
  190. package/drizzle/20261027191944_failure_resolution/snapshot.json +1968 -0
  191. package/package.json +22 -12
  192. package/dist/workflow/admission.d.ts.map +0 -1
  193. package/dist/workflow/admission.js.map +0 -1
  194. package/dist/workflow/command.d.ts +0 -13
  195. package/dist/workflow/command.d.ts.map +0 -1
  196. package/dist/workflow/command.js +0 -17
  197. package/dist/workflow/command.js.map +0 -1
  198. package/dist/workflow/workflow.d.ts +0 -18
  199. package/dist/workflow/workflow.d.ts.map +0 -1
  200. package/dist/workflow/workflow.js +0 -108
  201. package/dist/workflow/workflow.js.map +0 -1
@@ -1,16 +1,18 @@
1
1
  import { Agent } from "@usine/core/agent";
2
2
  import { BrainSpec } from "@usine/core/agent/brain";
3
- import { Attempt } from "@usine/core/attempt";
3
+ import { Attempt, FailureResolution, ContainerOutOfMemoryKills } from "@usine/core/attempt";
4
4
  import * as AttemptChannel from "@usine/core/attempt/channel";
5
5
  import { Event } from "@usine/core/event";
6
6
  import { Run } from "@usine/core/run";
7
+ import { RunAgain } from "@usine/core/run/again";
8
+ import { RunApproval } from "@usine/core/run/approval";
7
9
  import { Step } from "@usine/core/step";
8
10
  import * as RunState from "@usine/core/run/state";
9
- import { StepResult } from "@usine/core/step/result";
10
- import { Effect, Schema } from "effect";
11
+ import { Comment, StepResult } from "@usine/core/step/result";
12
+ import { Effect, Option, Schema } from "effect";
11
13
  import { RunStoreError } from "../engine/error.ts";
12
14
  import { Submission } from "../engine/submission.ts";
13
- import { RunSummary } from "../run-reader/model.ts";
15
+ import { RunEvent, RunSummary } from "../run-reader/model.ts";
14
16
  import { TranscriptEntry } from "../transcript.ts";
15
17
  export declare const EventRouteRow: Schema.Struct<{
16
18
  readonly eventId: Schema.brand<Schema.NonEmptyString, "EventId">;
@@ -21,6 +23,7 @@ export declare const EventRouteRow: Schema.Struct<{
21
23
  readonly loop: Schema.brand<Schema.NonEmptyString, "LoopName">;
22
24
  readonly step: Schema.brand<Schema.NonEmptyString, "StepName">;
23
25
  readonly approval: Schema.Literals<readonly ["none", "required"]>;
26
+ readonly permissions: Schema.Literals<readonly ["write", "read"]>;
24
27
  readonly cycleLimit: Schema.NullOr<Schema.brand<Schema.Int, "CycleLimit">>;
25
28
  readonly cycleGeneration: Schema.brand<Schema.Int, "CycleGeneration">;
26
29
  readonly repository: Schema.brand<Schema.String, "RepositoryName">;
@@ -41,9 +44,16 @@ export declare const RunRow: Schema.Struct<{
41
44
  readonly eventId: Schema.brand<Schema.NonEmptyString, "EventId">;
42
45
  readonly loop: Schema.brand<Schema.NonEmptyString, "LoopName">;
43
46
  readonly state: Schema.Union<readonly [typeof RunState.Pending, typeof RunState.Waiting, typeof RunState.Queued, typeof RunState.Running, typeof RunState.Succeeded, typeof RunState.Failed, typeof RunState.Canceled]>;
47
+ readonly resolvedFailureAttemptId: Schema.NullOr<Schema.brand<Schema.NonEmptyString, "AttemptId">>;
44
48
  readonly openedAt: Schema.DateTimeUtcFromString;
49
+ readonly closedAt: Schema.NullOr<Schema.DateTimeUtcFromString>;
45
50
  readonly stepName: Schema.brand<Schema.NonEmptyString, "StepName">;
46
51
  readonly result: Schema.NullOr<typeof StepResult>;
52
+ readonly approvedAt: Schema.NullOr<Schema.DateTimeUtcFromString>;
53
+ readonly approvalChannel: Schema.NullOr<Schema.Literals<readonly ["ui", "github-ask"]>>;
54
+ readonly approver: Schema.NullOr<Schema.brand<Schema.String, "OperatorLogin">>;
55
+ readonly againFrom: Schema.NullOr<Schema.brand<Schema.NonEmptyString, "RunId">>;
56
+ readonly againRequestedBy: Schema.NullOr<Schema.brand<Schema.String, "OperatorLogin">>;
47
57
  }>;
48
58
  export type RunRow = typeof RunRow.Type;
49
59
  export declare const AttemptRow: Schema.Struct<{
@@ -59,6 +69,13 @@ export declare const AttemptRow: Schema.Struct<{
59
69
  readonly parentModel: Schema.NullOr<Schema.brand<Schema.String, "ModelId">>;
60
70
  readonly startedAt: Schema.DateTimeUtcFromString;
61
71
  readonly outcome: Schema.NullOr<Schema.Union<readonly [typeof import("@usine/core/attempt/outcome").AttemptSucceeded, typeof import("@usine/core/attempt/outcome").AttemptFailed, typeof import("@usine/core/attempt/outcome").AttemptCanceled]>>;
72
+ readonly endedAt: Schema.NullOr<Schema.DateTimeUtcFromString>;
73
+ readonly salvage: Schema.NullOr<Schema.Union<readonly [typeof import("@usine/core/attempt/salvage").SalvagePushed, typeof import("@usine/core/attempt/salvage").SalvagePartlyPushed, typeof import("@usine/core/attempt/salvage").SalvageRetained, typeof import("@usine/core/attempt/salvage").SalvageRejected]>>;
74
+ readonly start: Schema.NullOr<Schema.Union<readonly [typeof import("@usine/core/attempt/start").StartedByEvent, typeof import("@usine/core/attempt/start").StartedByRetry, typeof import("@usine/core/attempt/start").StartedByEditAndRetry, typeof import("@usine/core/attempt/start").StartedByInfraRetry, typeof import("@usine/core/attempt/start").StartedAfterRestart]>>;
75
+ readonly failureResolution: Schema.NullOr<typeof FailureResolution>;
76
+ readonly reattachedAt: Schema.NullOr<Schema.DateTimeUtcFromString>;
77
+ readonly comments: Schema.NullOr<Schema.$Array<typeof Comment>>;
78
+ readonly outOfMemory: Schema.NullOr<Schema.$Array<typeof ContainerOutOfMemoryKills>>;
62
79
  }>;
63
80
  export type AttemptRow = typeof AttemptRow.Type;
64
81
  export declare const TranscriptRow: Schema.Struct<{
@@ -70,8 +87,8 @@ export declare const TranscriptRow: Schema.Struct<{
70
87
  readonly attemptId: Schema.brand<Schema.NonEmptyString, "AttemptId">;
71
88
  readonly sequence: Schema.brand<Schema.Int, "AttemptChannelSequence">;
72
89
  readonly sentAt: Schema.DateTimeUtcFromString;
73
- readonly payload: Schema.Union<readonly [typeof AttemptChannel.Started, typeof AttemptChannel.SessionEvent, typeof AttemptChannel.Final, typeof AttemptChannel.Failed, typeof AttemptChannel.Interrupted, typeof AttemptChannel.InterventionApplied, typeof AttemptChannel.InterventionRejected]>;
74
- readonly version: Schema.Literal<5>;
90
+ readonly payload: Schema.Union<readonly [typeof AttemptChannel.Started, typeof AttemptChannel.SessionEvent, typeof AttemptChannel.Final, typeof AttemptChannel.Failed, typeof AttemptChannel.Interrupted, typeof AttemptChannel.InterventionApplied, typeof AttemptChannel.InterventionRejected, typeof AttemptChannel.WorkerUnresponsive, typeof AttemptChannel.WorkerResponsive]>;
91
+ readonly version: Schema.Literals<readonly [5, 6]>;
75
92
  }>, Schema.Struct<{
76
93
  readonly _tag: Schema.tag<"InboundEnvelope">;
77
94
  readonly attemptId: Schema.brand<Schema.NonEmptyString, "AttemptId">;
@@ -80,13 +97,13 @@ export declare const TranscriptRow: Schema.Struct<{
80
97
  readonly target: Schema.withDecodingDefaultKey<Schema.Union<readonly [typeof AttemptChannel.ParentTarget, typeof AttemptChannel.ChildTarget]>, never>;
81
98
  readonly operator: Schema.NonEmptyString;
82
99
  readonly payload: Schema.Union<readonly [Schema.Union<readonly [typeof AttemptChannel.Steer, typeof AttemptChannel.Interrupt, typeof AttemptChannel.OperatorMessage, typeof AttemptChannel.Release]>, typeof AttemptChannel.Cancel]>;
83
- readonly version: Schema.Literal<5>;
100
+ readonly version: Schema.Literals<readonly [5, 6]>;
84
101
  }>, Schema.Struct<{
85
102
  readonly _tag: Schema.tag<"OutboundEnvelope">;
86
103
  readonly attemptId: Schema.brand<Schema.NonEmptyString, "AttemptId">;
87
104
  readonly sequence: Schema.brand<Schema.Int, "AttemptChannelSequence">;
88
105
  readonly sentAt: Schema.DateTimeUtcFromString;
89
- readonly payload: Schema.Union<readonly [typeof AttemptChannel.Started, typeof AttemptChannel.SessionEvent, typeof AttemptChannel.Final, typeof AttemptChannel.Failed, typeof AttemptChannel.Interrupted, typeof AttemptChannel.InterventionApplied, typeof AttemptChannel.InterventionRejected]>;
106
+ readonly payload: Schema.Union<readonly [typeof AttemptChannel.Started, typeof AttemptChannel.SessionEvent, typeof AttemptChannel.Final, typeof AttemptChannel.Failed, typeof AttemptChannel.Interrupted, typeof AttemptChannel.InterventionApplied, typeof AttemptChannel.InterventionRejected, typeof AttemptChannel.WorkerUnresponsive, typeof AttemptChannel.WorkerResponsive]>;
90
107
  readonly version: Schema.Literals<readonly [3, 4]>;
91
108
  }>, Schema.Struct<{
92
109
  readonly _tag: Schema.Literal<"InboundEnvelope">;
@@ -99,11 +116,13 @@ export declare const TranscriptRow: Schema.Struct<{
99
116
  readonly receivedAt: Schema.DateTimeUtcFromString;
100
117
  }>;
101
118
  export type TranscriptRow = typeof TranscriptRow.Type;
102
- export declare const WorkflowCommandRow: Schema.Struct<{
119
+ declare const RunEventRow: Schema.Struct<{
103
120
  readonly runId: Schema.brand<Schema.NonEmptyString, "RunId">;
104
- readonly command: Schema.Literals<readonly ["Approve", "Continue", "Interrupt", "Resume"]>;
121
+ readonly eventId: Schema.brand<Schema.NonEmptyString, "EventId">;
122
+ readonly dedupKey: Schema.brand<Schema.NonEmptyString, "DedupKey">;
123
+ readonly payload: Schema.Codec<Schema.Json, Schema.Json, never, never>;
124
+ readonly receivedAt: Schema.DateTimeUtcFromString;
105
125
  }>;
106
- export type WorkflowCommandRow = typeof WorkflowCommandRow.Type;
107
126
  export declare const decodeEventRoutes: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => Effect.Effect<readonly {
108
127
  readonly eventId: string & import("effect/Brand").Brand<"EventId">;
109
128
  readonly dedupKey: string & import("effect/Brand").Brand<"DedupKey">;
@@ -113,6 +132,25 @@ export declare const decodeEventRoutes: (input: unknown, options?: import("effec
113
132
  readonly loop: string & import("effect/Brand").Brand<"LoopName">;
114
133
  readonly step: string & import("effect/Brand").Brand<"StepName">;
115
134
  readonly approval: "none" | "required";
135
+ readonly permissions: "read" | "write";
136
+ readonly cycleLimit: (number & import("effect/Brand").Brand<"CycleLimit">) | null;
137
+ readonly cycleGeneration: number & import("effect/Brand").Brand<"CycleGeneration">;
138
+ readonly repository: string & import("effect/Brand").Brand<"RepositoryName">;
139
+ readonly revision: string & import("effect/Brand").Brand<"RepositoryRevision">;
140
+ readonly task: string & import("effect/Brand").Brand<"AttemptTask">;
141
+ readonly agent: Agent;
142
+ readonly parentModel: (string & import("effect/Brand").Brand<"ModelId">) | null;
143
+ }[], Schema.SchemaError, never>;
144
+ export declare const decodeReopenings: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => Effect.Effect<readonly {
145
+ readonly eventId: string & import("effect/Brand").Brand<"EventId">;
146
+ readonly dedupKey: string & import("effect/Brand").Brand<"DedupKey">;
147
+ readonly payload: Schema.Json;
148
+ readonly receivedAt: import("effect/DateTime").Utc;
149
+ readonly itemKey: string & import("effect/Brand").Brand<"ItemKey">;
150
+ readonly loop: string & import("effect/Brand").Brand<"LoopName">;
151
+ readonly step: string & import("effect/Brand").Brand<"StepName">;
152
+ readonly approval: "none" | "required";
153
+ readonly permissions: "read" | "write";
116
154
  readonly cycleLimit: (number & import("effect/Brand").Brand<"CycleLimit">) | null;
117
155
  readonly cycleGeneration: number & import("effect/Brand").Brand<"CycleGeneration">;
118
156
  readonly repository: string & import("effect/Brand").Brand<"RepositoryName">;
@@ -120,6 +158,11 @@ export declare const decodeEventRoutes: (input: unknown, options?: import("effec
120
158
  readonly task: string & import("effect/Brand").Brand<"AttemptTask">;
121
159
  readonly agent: Agent;
122
160
  readonly parentModel: (string & import("effect/Brand").Brand<"ModelId">) | null;
161
+ readonly reopening: number;
162
+ }[], Schema.SchemaError, never>;
163
+ export declare const decodeReopenedEvents: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => Effect.Effect<readonly {
164
+ readonly eventId: string & import("effect/Brand").Brand<"EventId">;
165
+ readonly dedupKey: string & import("effect/Brand").Brand<"DedupKey">;
123
166
  }[], Schema.SchemaError, never>;
124
167
  export declare const decodeRunRows: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => Effect.Effect<readonly {
125
168
  readonly itemKey: string & import("effect/Brand").Brand<"ItemKey">;
@@ -132,9 +175,23 @@ export declare const decodeRunRows: (input: unknown, options?: import("effect/Sc
132
175
  readonly eventId: string & import("effect/Brand").Brand<"EventId">;
133
176
  readonly loop: string & import("effect/Brand").Brand<"LoopName">;
134
177
  readonly state: RunState.Canceled | RunState.Failed | RunState.Pending | RunState.Queued | RunState.Running | RunState.Succeeded | RunState.Waiting;
178
+ readonly resolvedFailureAttemptId: (string & import("effect/Brand").Brand<"AttemptId">) | null;
135
179
  readonly openedAt: import("effect/DateTime").Utc;
180
+ readonly closedAt: import("effect/DateTime").Utc | null;
136
181
  readonly stepName: string & import("effect/Brand").Brand<"StepName">;
137
182
  readonly result: StepResult | null;
183
+ readonly approvedAt: import("effect/DateTime").Utc | null;
184
+ readonly approvalChannel: "github-ask" | "ui" | null;
185
+ readonly approver: (string & import("effect/Brand").Brand<"OperatorLogin">) | null;
186
+ readonly againFrom: (string & import("effect/Brand").Brand<"RunId">) | null;
187
+ readonly againRequestedBy: (string & import("effect/Brand").Brand<"OperatorLogin">) | null;
188
+ }[], Schema.SchemaError, never>;
189
+ export declare const decodeRunEventRows: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => Effect.Effect<readonly {
190
+ readonly runId: string & import("effect/Brand").Brand<"RunId">;
191
+ readonly eventId: string & import("effect/Brand").Brand<"EventId">;
192
+ readonly dedupKey: string & import("effect/Brand").Brand<"DedupKey">;
193
+ readonly payload: Schema.Json;
194
+ readonly receivedAt: import("effect/DateTime").Utc;
138
195
  }[], Schema.SchemaError, never>;
139
196
  export declare const decodeAttemptRows: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => Effect.Effect<readonly {
140
197
  readonly attemptId: string & import("effect/Brand").Brand<"AttemptId">;
@@ -149,25 +206,13 @@ export declare const decodeAttemptRows: (input: unknown, options?: import("effec
149
206
  readonly parentModel: (string & import("effect/Brand").Brand<"ModelId">) | null;
150
207
  readonly startedAt: import("effect/DateTime").Utc;
151
208
  readonly outcome: import("@usine/core/attempt/outcome").AttemptCanceled | import("@usine/core/attempt/outcome").AttemptFailed | import("@usine/core/attempt/outcome").AttemptSucceeded | null;
152
- }[], Schema.SchemaError, never>;
153
- export declare const decodeRecoverableRuns: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => Effect.Effect<readonly {
154
- readonly eventId: string & import("effect/Brand").Brand<"EventId">;
155
- readonly dedupKey: string & import("effect/Brand").Brand<"DedupKey">;
156
- readonly payload: Schema.Json;
157
- readonly receivedAt: import("effect/DateTime").Utc;
158
- readonly itemKey: string & import("effect/Brand").Brand<"ItemKey">;
159
- readonly loop: string & import("effect/Brand").Brand<"LoopName">;
160
- readonly step: string & import("effect/Brand").Brand<"StepName">;
161
- readonly approval: "none" | "required";
162
- readonly cycleLimit: (number & import("effect/Brand").Brand<"CycleLimit">) | null;
163
- readonly cycleGeneration: number & import("effect/Brand").Brand<"CycleGeneration">;
164
- readonly repository: string & import("effect/Brand").Brand<"RepositoryName">;
165
- readonly revision: string & import("effect/Brand").Brand<"RepositoryRevision">;
166
- readonly task: string & import("effect/Brand").Brand<"AttemptTask">;
167
- readonly agent: Agent;
168
- readonly parentModel: (string & import("effect/Brand").Brand<"ModelId">) | null;
169
- readonly runId: string & import("effect/Brand").Brand<"RunId">;
170
- readonly state: RunState.Canceled | RunState.Failed | RunState.Pending | RunState.Queued | RunState.Running | RunState.Succeeded | RunState.Waiting;
209
+ readonly endedAt: import("effect/DateTime").Utc | null;
210
+ readonly salvage: import("@usine/core/attempt/salvage").SalvagePartlyPushed | import("@usine/core/attempt/salvage").SalvagePushed | import("@usine/core/attempt/salvage").SalvageRejected | import("@usine/core/attempt/salvage").SalvageRetained | null;
211
+ readonly start: import("@usine/core/attempt/start").StartedAfterRestart | import("@usine/core/attempt/start").StartedByEditAndRetry | import("@usine/core/attempt/start").StartedByEvent | import("@usine/core/attempt/start").StartedByInfraRetry | import("@usine/core/attempt/start").StartedByRetry | null;
212
+ readonly failureResolution: FailureResolution | null;
213
+ readonly reattachedAt: import("effect/DateTime").Utc | null;
214
+ readonly comments: readonly Comment[] | null;
215
+ readonly outOfMemory: readonly ContainerOutOfMemoryKills[] | null;
171
216
  }[], Schema.SchemaError, never>;
172
217
  export declare const decodeRunIds: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => Effect.Effect<readonly {
173
218
  readonly runId: string & import("effect/Brand").Brand<"RunId">;
@@ -175,10 +220,6 @@ export declare const decodeRunIds: (input: unknown, options?: import("effect/Sch
175
220
  export declare const decodeDiscards: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => Effect.Effect<readonly {
176
221
  readonly reason: "revoked" | "superseded";
177
222
  }[], Schema.SchemaError, never>;
178
- export declare const decodeWorkflowCommands: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => Effect.Effect<readonly {
179
- readonly runId: string & import("effect/Brand").Brand<"RunId">;
180
- readonly command: "Approve" | "Continue" | "Interrupt" | "Resume";
181
- }[], Schema.SchemaError, never>;
182
223
  export declare const decodeProjectionRevision: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => Effect.Effect<readonly {
183
224
  readonly revision: number & import("effect/Brand").Brand<"ProjectionRevision">;
184
225
  }[], Schema.SchemaError, never>;
@@ -191,8 +232,8 @@ export declare const decodeTranscriptRows: (input: unknown, options?: import("ef
191
232
  readonly attemptId: string & import("effect/Brand").Brand<"AttemptId">;
192
233
  readonly sequence: number & import("effect/Brand").Brand<"AttemptChannelSequence">;
193
234
  readonly sentAt: import("effect/DateTime").Utc;
194
- readonly payload: AttemptChannel.Failed | AttemptChannel.Final | AttemptChannel.Interrupted | AttemptChannel.InterventionApplied | AttemptChannel.InterventionRejected | AttemptChannel.SessionEvent | AttemptChannel.Started;
195
- readonly version: 5;
235
+ readonly payload: AttemptChannel.Failed | AttemptChannel.Final | AttemptChannel.Interrupted | AttemptChannel.InterventionApplied | AttemptChannel.InterventionRejected | AttemptChannel.SessionEvent | AttemptChannel.Started | AttemptChannel.WorkerResponsive | AttemptChannel.WorkerUnresponsive;
236
+ readonly version: 5 | 6;
196
237
  } | {
197
238
  readonly _tag: "InboundEnvelope";
198
239
  readonly attemptId: string & import("effect/Brand").Brand<"AttemptId">;
@@ -201,13 +242,13 @@ export declare const decodeTranscriptRows: (input: unknown, options?: import("ef
201
242
  readonly target: AttemptChannel.ChildTarget | AttemptChannel.ParentTarget;
202
243
  readonly operator: string;
203
244
  readonly payload: AttemptChannel.Cancel | AttemptChannel.Interrupt | AttemptChannel.OperatorMessage | AttemptChannel.Release | AttemptChannel.Steer;
204
- readonly version: 5;
245
+ readonly version: 5 | 6;
205
246
  } | {
206
247
  readonly _tag: "OutboundEnvelope";
207
248
  readonly attemptId: string & import("effect/Brand").Brand<"AttemptId">;
208
249
  readonly sequence: number & import("effect/Brand").Brand<"AttemptChannelSequence">;
209
250
  readonly sentAt: import("effect/DateTime").Utc;
210
- readonly payload: AttemptChannel.Failed | AttemptChannel.Final | AttemptChannel.Interrupted | AttemptChannel.InterventionApplied | AttemptChannel.InterventionRejected | AttemptChannel.SessionEvent | AttemptChannel.Started;
251
+ readonly payload: AttemptChannel.Failed | AttemptChannel.Final | AttemptChannel.Interrupted | AttemptChannel.InterventionApplied | AttemptChannel.InterventionRejected | AttemptChannel.SessionEvent | AttemptChannel.Started | AttemptChannel.WorkerResponsive | AttemptChannel.WorkerUnresponsive;
211
252
  readonly version: 3 | 4;
212
253
  } | {
213
254
  readonly _tag: "InboundEnvelope";
@@ -222,8 +263,6 @@ export declare const decodeTranscriptRows: (input: unknown, options?: import("ef
222
263
  export declare const encodePayload: (input: Schema.Json, options?: import("effect/SchemaAST").ParseOptions) => Schema.Json;
223
264
  export declare const encodeDateTime: (input: import("effect/DateTime").Utc, options?: import("effect/SchemaAST").ParseOptions) => string;
224
265
  export declare const encodeRunState: (input: RunState.Canceled | RunState.Failed | RunState.Pending | RunState.Queued | RunState.Running | RunState.Succeeded | RunState.Waiting, options?: import("effect/SchemaAST").ParseOptions) => {
225
- readonly _tag: "Succeeded";
226
- } | {
227
266
  readonly _tag: "Pending";
228
267
  } | {
229
268
  readonly _tag: "Waiting";
@@ -231,6 +270,8 @@ export declare const encodeRunState: (input: RunState.Canceled | RunState.Failed
231
270
  readonly _tag: "Queued";
232
271
  } | {
233
272
  readonly _tag: "Running";
273
+ } | {
274
+ readonly _tag: "Succeeded";
234
275
  } | {
235
276
  readonly _tag: "Failed";
236
277
  } | {
@@ -259,6 +300,12 @@ export declare const encodeOutcome: (input: import("@usine/core/attempt/outcome"
259
300
  } | {
260
301
  readonly _tag: "AgentFailure";
261
302
  readonly message: string;
303
+ } | {
304
+ readonly _tag: "BlockedFailure";
305
+ readonly message: string;
306
+ } | {
307
+ readonly _tag: "QuestionFailure";
308
+ readonly question: string;
262
309
  } | {
263
310
  readonly _tag: "RunawayFailure";
264
311
  readonly ceiling: "tokens" | "wall-clock";
@@ -270,6 +317,61 @@ export declare const encodeOutcome: (input: import("@usine/core/attempt/outcome"
270
317
  } | {
271
318
  readonly _tag: "Canceled";
272
319
  };
320
+ export declare const encodeSalvage: (input: import("@usine/core/attempt/salvage").SalvagePartlyPushed | import("@usine/core/attempt/salvage").SalvagePushed | import("@usine/core/attempt/salvage").SalvageRejected | import("@usine/core/attempt/salvage").SalvageRetained, options?: import("effect/SchemaAST").ParseOptions) => {
321
+ readonly _tag: "Pushed";
322
+ readonly ref: string;
323
+ readonly commit: string;
324
+ } | {
325
+ readonly _tag: "PartlyPushed";
326
+ readonly ref: string;
327
+ readonly commit: string;
328
+ readonly path: string;
329
+ readonly message: string;
330
+ } | {
331
+ readonly _tag: "Retained";
332
+ readonly path: string;
333
+ readonly commit: string | null;
334
+ readonly message: string;
335
+ } | {
336
+ readonly _tag: "Rejected";
337
+ readonly path: string;
338
+ readonly commit: string;
339
+ readonly message: string;
340
+ };
341
+ export declare const encodeComments: (input: readonly Comment[], options?: import("effect/SchemaAST").ParseOptions) => readonly {
342
+ readonly _tag: "Comment";
343
+ readonly url: string;
344
+ readonly kind: "issue-comment" | "review" | "review-comment";
345
+ readonly at?: string;
346
+ }[];
347
+ export declare const encodeOutOfMemory: (input: readonly ContainerOutOfMemoryKills[], options?: import("effect/SchemaAST").ParseOptions) => readonly {
348
+ readonly container: string;
349
+ readonly kills: number;
350
+ readonly memoryMib: number;
351
+ }[];
352
+ export declare const decodeOutOfMemory: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => Effect.Effect<readonly {
353
+ readonly outOfMemory: readonly ContainerOutOfMemoryKills[] | null;
354
+ }[], Schema.SchemaError, never>;
355
+ export declare const encodeFailureResolution: (input: FailureResolution, options?: import("effect/SchemaAST").ParseOptions) => {
356
+ readonly resolvedAt: string;
357
+ readonly operator: string | null;
358
+ };
359
+ export declare const encodeAttemptStart: (input: import("@usine/core/attempt/start").StartedAfterRestart | import("@usine/core/attempt/start").StartedByEditAndRetry | import("@usine/core/attempt/start").StartedByEvent | import("@usine/core/attempt/start").StartedByInfraRetry | import("@usine/core/attempt/start").StartedByRetry, options?: import("effect/SchemaAST").ParseOptions) => {
360
+ readonly _tag: "Event";
361
+ } | {
362
+ readonly _tag: "OperatorRetry";
363
+ readonly operator: string | null;
364
+ } | {
365
+ readonly _tag: "EditAndRetry";
366
+ readonly operator: string | null;
367
+ } | {
368
+ readonly _tag: "InfraRetry";
369
+ } | {
370
+ readonly _tag: "AfterRestart";
371
+ };
372
+ export declare const decodeNextStarts: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => Effect.Effect<readonly {
373
+ readonly nextStart: import("@usine/core/attempt/start").StartedByEditAndRetry | import("@usine/core/attempt/start").StartedByRetry | null;
374
+ }[], Schema.SchemaError, never>;
273
375
  export declare const encodeStepResult: (input: StepResult, options?: import("effect/SchemaAST").ParseOptions) => {
274
376
  readonly message: string;
275
377
  readonly facts: readonly ({
@@ -283,17 +385,24 @@ export declare const encodeStepResult: (input: StepResult, options?: import("eff
283
385
  } | {
284
386
  readonly _tag: "Comment";
285
387
  readonly url: string;
388
+ readonly kind: "issue-comment" | "review" | "review-comment";
389
+ readonly at?: string;
286
390
  })[];
287
391
  };
288
392
  export declare const encodeEnvelope: (input: AttemptChannel.InboundEnvelope | AttemptChannel.OutboundEnvelope, options?: import("effect/SchemaAST").ParseOptions) => {
289
393
  readonly _tag: "OutboundEnvelope";
290
- readonly version: 6;
394
+ readonly version: 7;
291
395
  readonly attemptId: string;
292
396
  readonly sequence: number;
293
397
  readonly sentAt: string;
294
398
  readonly payload: {
295
399
  readonly _tag: "Started";
296
400
  readonly parentModel: string;
401
+ readonly conflictingSalvage?: {
402
+ readonly _tag: "Pushed";
403
+ readonly ref: string;
404
+ readonly commit: string;
405
+ } | null;
297
406
  } | {
298
407
  readonly _tag: "SessionEvent";
299
408
  readonly event: {
@@ -317,10 +426,12 @@ export declare const encodeEnvelope: (input: AttemptChannel.InboundEnvelope | At
317
426
  readonly model: string;
318
427
  readonly effort: "high" | "low" | "max" | "medium" | "minimal" | "off" | "xhigh";
319
428
  };
429
+ readonly gatewayCredential?: "api-key" | "subscription";
320
430
  };
321
431
  readonly harnessSession?: {
322
432
  readonly id: string;
323
433
  readonly cwd: string;
434
+ readonly home?: string;
324
435
  };
325
436
  } | {
326
437
  readonly _tag: "TextOutput";
@@ -343,6 +454,7 @@ export declare const encodeEnvelope: (input: AttemptChannel.InboundEnvelope | At
343
454
  readonly model: string;
344
455
  readonly effort: "high" | "low" | "max" | "medium" | "minimal" | "off" | "xhigh";
345
456
  };
457
+ readonly gatewayCredential?: "api-key" | "subscription";
346
458
  };
347
459
  readonly text: string;
348
460
  } | {
@@ -366,6 +478,7 @@ export declare const encodeEnvelope: (input: AttemptChannel.InboundEnvelope | At
366
478
  readonly model: string;
367
479
  readonly effort: "high" | "low" | "max" | "medium" | "minimal" | "off" | "xhigh";
368
480
  };
481
+ readonly gatewayCredential?: "api-key" | "subscription";
369
482
  };
370
483
  readonly callId: string;
371
484
  readonly tool: string;
@@ -391,6 +504,7 @@ export declare const encodeEnvelope: (input: AttemptChannel.InboundEnvelope | At
391
504
  readonly model: string;
392
505
  readonly effort: "high" | "low" | "max" | "medium" | "minimal" | "off" | "xhigh";
393
506
  };
507
+ readonly gatewayCredential?: "api-key" | "subscription";
394
508
  };
395
509
  readonly callId: string;
396
510
  readonly tool: string;
@@ -417,6 +531,7 @@ export declare const encodeEnvelope: (input: AttemptChannel.InboundEnvelope | At
417
531
  readonly model: string;
418
532
  readonly effort: "high" | "low" | "max" | "medium" | "minimal" | "off" | "xhigh";
419
533
  };
534
+ readonly gatewayCredential?: "api-key" | "subscription";
420
535
  };
421
536
  readonly pool: "apiKeys" | "chatgptPlan" | "claudePlan";
422
537
  readonly rateLimits: {
@@ -454,6 +569,7 @@ export declare const encodeEnvelope: (input: AttemptChannel.InboundEnvelope | At
454
569
  readonly model: string;
455
570
  readonly effort: "high" | "low" | "max" | "medium" | "minimal" | "off" | "xhigh";
456
571
  };
572
+ readonly gatewayCredential?: "api-key" | "subscription";
457
573
  };
458
574
  } | {
459
575
  readonly _tag: "SessionIdle";
@@ -476,6 +592,7 @@ export declare const encodeEnvelope: (input: AttemptChannel.InboundEnvelope | At
476
592
  readonly model: string;
477
593
  readonly effort: "high" | "low" | "max" | "medium" | "minimal" | "off" | "xhigh";
478
594
  };
595
+ readonly gatewayCredential?: "api-key" | "subscription";
479
596
  };
480
597
  } | {
481
598
  readonly _tag: "SessionResumed";
@@ -498,6 +615,7 @@ export declare const encodeEnvelope: (input: AttemptChannel.InboundEnvelope | At
498
615
  readonly model: string;
499
616
  readonly effort: "high" | "low" | "max" | "medium" | "minimal" | "off" | "xhigh";
500
617
  };
618
+ readonly gatewayCredential?: "api-key" | "subscription";
501
619
  };
502
620
  } | {
503
621
  readonly _tag: "SessionTokensUpdated";
@@ -520,8 +638,65 @@ export declare const encodeEnvelope: (input: AttemptChannel.InboundEnvelope | At
520
638
  readonly model: string;
521
639
  readonly effort: "high" | "low" | "max" | "medium" | "minimal" | "off" | "xhigh";
522
640
  };
641
+ readonly gatewayCredential?: "api-key" | "subscription";
523
642
  };
524
643
  readonly totalTokens: number;
644
+ readonly costUsd?: number;
645
+ readonly breakdown?: {
646
+ readonly input: number;
647
+ readonly cachedInput: number;
648
+ readonly cacheWrite: number;
649
+ readonly output: number;
650
+ };
651
+ } | {
652
+ readonly _tag: "ProviderRetrying";
653
+ readonly session: {
654
+ readonly _tag: "ParentSession";
655
+ readonly id: string;
656
+ readonly agent: string;
657
+ readonly brain: {
658
+ readonly harness: "claude" | "codex" | "pi";
659
+ readonly model: string;
660
+ readonly effort: "high" | "low" | "max" | "medium" | "minimal" | "off" | "xhigh";
661
+ };
662
+ } | {
663
+ readonly _tag: "ChildSession";
664
+ readonly id: string;
665
+ readonly parentId: string;
666
+ readonly agent: string;
667
+ readonly brain: {
668
+ readonly harness: "claude" | "codex" | "pi";
669
+ readonly model: string;
670
+ readonly effort: "high" | "low" | "max" | "medium" | "minimal" | "off" | "xhigh";
671
+ };
672
+ readonly gatewayCredential?: "api-key" | "subscription";
673
+ };
674
+ readonly message: string;
675
+ readonly retries: number;
676
+ } | {
677
+ readonly _tag: "ProviderRecovered";
678
+ readonly session: {
679
+ readonly _tag: "ParentSession";
680
+ readonly id: string;
681
+ readonly agent: string;
682
+ readonly brain: {
683
+ readonly harness: "claude" | "codex" | "pi";
684
+ readonly model: string;
685
+ readonly effort: "high" | "low" | "max" | "medium" | "minimal" | "off" | "xhigh";
686
+ };
687
+ } | {
688
+ readonly _tag: "ChildSession";
689
+ readonly id: string;
690
+ readonly parentId: string;
691
+ readonly agent: string;
692
+ readonly brain: {
693
+ readonly harness: "claude" | "codex" | "pi";
694
+ readonly model: string;
695
+ readonly effort: "high" | "low" | "max" | "medium" | "minimal" | "off" | "xhigh";
696
+ };
697
+ readonly gatewayCredential?: "api-key" | "subscription";
698
+ };
699
+ readonly retries: number;
525
700
  };
526
701
  } | {
527
702
  readonly _tag: "Final";
@@ -538,6 +713,8 @@ export declare const encodeEnvelope: (input: AttemptChannel.InboundEnvelope | At
538
713
  } | {
539
714
  readonly _tag: "Comment";
540
715
  readonly url: string;
716
+ readonly kind: "issue-comment" | "review" | "review-comment";
717
+ readonly at?: string;
541
718
  })[];
542
719
  };
543
720
  } | {
@@ -553,6 +730,12 @@ export declare const encodeEnvelope: (input: AttemptChannel.InboundEnvelope | At
553
730
  } | {
554
731
  readonly _tag: "AgentFailure";
555
732
  readonly message: string;
733
+ } | {
734
+ readonly _tag: "BlockedFailure";
735
+ readonly message: string;
736
+ } | {
737
+ readonly _tag: "QuestionFailure";
738
+ readonly question: string;
556
739
  } | {
557
740
  readonly _tag: "RunawayFailure";
558
741
  readonly ceiling: "tokens" | "wall-clock";
@@ -589,6 +772,7 @@ export declare const encodeEnvelope: (input: AttemptChannel.InboundEnvelope | At
589
772
  readonly state: {
590
773
  readonly held: boolean;
591
774
  readonly paused: boolean;
775
+ readonly queued?: boolean;
592
776
  };
593
777
  } | {
594
778
  readonly _tag: "InterventionRejected";
@@ -614,10 +798,19 @@ export declare const encodeEnvelope: (input: AttemptChannel.InboundEnvelope | At
614
798
  };
615
799
  };
616
800
  readonly message: string;
801
+ } | {
802
+ readonly _tag: "WorkerUnresponsive";
803
+ readonly worker: string;
804
+ readonly lastAnsweredAt: string;
805
+ readonly reason: string;
806
+ } | {
807
+ readonly _tag: "WorkerResponsive";
808
+ readonly worker: string;
809
+ readonly lastAnsweredAt: string;
617
810
  };
618
811
  } | {
619
812
  readonly _tag: "InboundEnvelope";
620
- readonly version: 6;
813
+ readonly version: 7;
621
814
  readonly attemptId: string;
622
815
  readonly sequence: number;
623
816
  readonly sentAt: string;
@@ -659,11 +852,17 @@ export declare const encodeBrainSpec: (input: BrainSpec, options?: import("effec
659
852
  readonly effort: "high" | "low" | "max" | "medium" | "minimal" | "off" | "xhigh";
660
853
  };
661
854
  export declare const persistence: (operation: string) => <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, RunStoreError, R>;
662
- export declare const eventFromRow: (row: EventRouteRow) => Event;
855
+ /** The Event columns shared by route rows and Run Event rows. */
856
+ type EventColumns = Pick<EventRouteRow, "eventId" | "dedupKey" | "payload" | "receivedAt">;
857
+ export declare const eventFromRow: (row: EventColumns) => Event;
858
+ export declare const runEventFromRow: (row: typeof RunEventRow.Type) => RunEvent;
663
859
  export declare const submissionFromRow: (row: EventRouteRow) => Submission;
664
860
  export declare const runFromRow: (row: RunRow) => Run;
861
+ export declare const approvalFromRow: (row: RunRow) => Option.Option<RunApproval>;
862
+ export declare const runAgainFromRow: (row: RunRow) => Option.Option<RunAgain>;
665
863
  export declare const stepFromRow: (row: RunRow) => Step;
666
864
  export declare const attemptFromRow: (row: AttemptRow) => Attempt;
667
865
  export declare const runSummaryFromRow: (row: RunRow, storedAttempts: ReadonlyArray<AttemptRow>) => RunSummary;
668
866
  export declare const transcriptEntryFromRow: (row: TranscriptRow) => TranscriptEntry;
867
+ export {};
669
868
  //# sourceMappingURL=codec.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"codec.d.ts","sourceRoot":"","sources":["../../src/store/codec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAa,MAAM,mBAAmB,CAAC;AAErD,OAAO,EAAE,SAAS,EAAW,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAyC,MAAM,qBAAqB,CAAC;AACrF,OAAO,KAAK,cAAc,MAAM,6BAA6B,CAAC;AAE9D,OAAO,EAAE,KAAK,EAAqB,MAAM,mBAAmB,CAAC;AAI7D,OAAO,EAAS,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAY,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAElD,OAAO,KAAK,QAAQ,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,MAAM,EAAU,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChD,OAAO,EAA0B,aAAa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