@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
@@ -4,13 +4,15 @@ import { Attempt } 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<{
@@ -53,38 +63,64 @@ export declare const AttemptRow: Schema.Struct<{
53
63
  readonly worker: Schema.brand<Schema.String, "WorkerName">;
54
64
  readonly number: Schema.brand<Schema.Int, "AttemptNumber">;
55
65
  readonly brain: typeof BrainSpec;
66
+ readonly task: Schema.brand<Schema.String, "AttemptTask">;
67
+ readonly agent: Schema.brand<Schema.String, "AgentName">;
68
+ readonly operatorIntervened: Schema.Boolean;
56
69
  readonly parentModel: Schema.NullOr<Schema.brand<Schema.String, "ModelId">>;
57
70
  readonly startedAt: Schema.DateTimeUtcFromString;
58
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").SalvageRetained]>>;
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 reattachedAt: Schema.NullOr<Schema.DateTimeUtcFromString>;
76
+ readonly comments: Schema.NullOr<Schema.$Array<typeof Comment>>;
59
77
  }>;
60
78
  export type AttemptRow = typeof AttemptRow.Type;
61
79
  export declare const TranscriptRow: Schema.Struct<{
62
80
  readonly sequence: Schema.brand<Schema.Int, "TranscriptSequence">;
63
81
  readonly attemptId: Schema.brand<Schema.NonEmptyString, "AttemptId">;
64
82
  readonly direction: Schema.Literals<readonly ["inbound", "outbound"]>;
65
- readonly envelope: Schema.Union<readonly [Schema.Union<readonly [typeof AttemptChannel.OutboundEnvelope, typeof AttemptChannel.InboundEnvelope]>, Schema.Union<readonly [Schema.Struct<{
83
+ readonly envelope: Schema.Union<readonly [Schema.Union<readonly [typeof AttemptChannel.OutboundEnvelope, typeof AttemptChannel.InboundEnvelope]>, Schema.Struct<{
66
84
  readonly _tag: Schema.tag<"OutboundEnvelope">;
67
85
  readonly attemptId: Schema.brand<Schema.NonEmptyString, "AttemptId">;
68
86
  readonly sequence: Schema.brand<Schema.Int, "AttemptChannelSequence">;
69
87
  readonly sentAt: Schema.DateTimeUtcFromString;
70
- readonly payload: Schema.Union<readonly [typeof AttemptChannel.Started, typeof AttemptChannel.SessionEvent, typeof AttemptChannel.Final, typeof AttemptChannel.Failed, typeof AttemptChannel.Interrupted]>;
71
- readonly version: Schema.Literal<3>;
88
+ 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]>;
89
+ readonly version: Schema.Literals<readonly [5, 6]>;
72
90
  }>, Schema.Struct<{
73
91
  readonly _tag: Schema.tag<"InboundEnvelope">;
74
92
  readonly attemptId: Schema.brand<Schema.NonEmptyString, "AttemptId">;
75
93
  readonly sequence: Schema.brand<Schema.Int, "AttemptChannelSequence">;
76
94
  readonly sentAt: Schema.DateTimeUtcFromString;
95
+ readonly target: Schema.withDecodingDefaultKey<Schema.Union<readonly [typeof AttemptChannel.ParentTarget, typeof AttemptChannel.ChildTarget]>, never>;
96
+ readonly operator: Schema.NonEmptyString;
97
+ readonly payload: Schema.Union<readonly [Schema.Union<readonly [typeof AttemptChannel.Steer, typeof AttemptChannel.Interrupt, typeof AttemptChannel.OperatorMessage, typeof AttemptChannel.Release]>, typeof AttemptChannel.Cancel]>;
98
+ readonly version: Schema.Literals<readonly [5, 6]>;
99
+ }>, Schema.Struct<{
100
+ readonly _tag: Schema.tag<"OutboundEnvelope">;
101
+ readonly attemptId: Schema.brand<Schema.NonEmptyString, "AttemptId">;
102
+ readonly sequence: Schema.brand<Schema.Int, "AttemptChannelSequence">;
103
+ readonly sentAt: Schema.DateTimeUtcFromString;
104
+ 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]>;
105
+ readonly version: Schema.Literals<readonly [3, 4]>;
106
+ }>, Schema.Struct<{
107
+ readonly _tag: Schema.Literal<"InboundEnvelope">;
108
+ readonly version: Schema.Literals<readonly [3, 4]>;
109
+ readonly attemptId: Schema.brand<Schema.NonEmptyString, "AttemptId">;
110
+ readonly sequence: Schema.brand<Schema.Int, "AttemptChannelSequence">;
111
+ readonly sentAt: Schema.DateTimeUtcFromString;
77
112
  readonly payload: Schema.Union<readonly [typeof AttemptChannel.Steer, typeof AttemptChannel.Interrupt]>;
78
- readonly version: Schema.Literal<3>;
79
- }>]>]>;
113
+ }>]>;
80
114
  readonly receivedAt: Schema.DateTimeUtcFromString;
81
115
  }>;
82
116
  export type TranscriptRow = typeof TranscriptRow.Type;
83
- export declare const WorkflowCommandRow: Schema.Struct<{
117
+ declare const RunEventRow: Schema.Struct<{
84
118
  readonly runId: Schema.brand<Schema.NonEmptyString, "RunId">;
85
- readonly command: Schema.Literals<readonly ["Approve", "Continue", "Interrupt", "Resume"]>;
119
+ readonly eventId: Schema.brand<Schema.NonEmptyString, "EventId">;
120
+ readonly dedupKey: Schema.brand<Schema.NonEmptyString, "DedupKey">;
121
+ readonly payload: Schema.Codec<Schema.Json, Schema.Json, never, never>;
122
+ readonly receivedAt: Schema.DateTimeUtcFromString;
86
123
  }>;
87
- export type WorkflowCommandRow = typeof WorkflowCommandRow.Type;
88
124
  export declare const decodeEventRoutes: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => Effect.Effect<readonly {
89
125
  readonly eventId: string & import("effect/Brand").Brand<"EventId">;
90
126
  readonly dedupKey: string & import("effect/Brand").Brand<"DedupKey">;
@@ -94,6 +130,25 @@ export declare const decodeEventRoutes: (input: unknown, options?: import("effec
94
130
  readonly loop: string & import("effect/Brand").Brand<"LoopName">;
95
131
  readonly step: string & import("effect/Brand").Brand<"StepName">;
96
132
  readonly approval: "none" | "required";
133
+ readonly permissions: "read" | "write";
134
+ readonly cycleLimit: (number & import("effect/Brand").Brand<"CycleLimit">) | null;
135
+ readonly cycleGeneration: number & import("effect/Brand").Brand<"CycleGeneration">;
136
+ readonly repository: string & import("effect/Brand").Brand<"RepositoryName">;
137
+ readonly revision: string & import("effect/Brand").Brand<"RepositoryRevision">;
138
+ readonly task: string & import("effect/Brand").Brand<"AttemptTask">;
139
+ readonly agent: Agent;
140
+ readonly parentModel: (string & import("effect/Brand").Brand<"ModelId">) | null;
141
+ }[], Schema.SchemaError, never>;
142
+ export declare const decodeReopenings: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => Effect.Effect<readonly {
143
+ readonly eventId: string & import("effect/Brand").Brand<"EventId">;
144
+ readonly dedupKey: string & import("effect/Brand").Brand<"DedupKey">;
145
+ readonly payload: Schema.Json;
146
+ readonly receivedAt: import("effect/DateTime").Utc;
147
+ readonly itemKey: string & import("effect/Brand").Brand<"ItemKey">;
148
+ readonly loop: string & import("effect/Brand").Brand<"LoopName">;
149
+ readonly step: string & import("effect/Brand").Brand<"StepName">;
150
+ readonly approval: "none" | "required";
151
+ readonly permissions: "read" | "write";
97
152
  readonly cycleLimit: (number & import("effect/Brand").Brand<"CycleLimit">) | null;
98
153
  readonly cycleGeneration: number & import("effect/Brand").Brand<"CycleGeneration">;
99
154
  readonly repository: string & import("effect/Brand").Brand<"RepositoryName">;
@@ -101,6 +156,11 @@ export declare const decodeEventRoutes: (input: unknown, options?: import("effec
101
156
  readonly task: string & import("effect/Brand").Brand<"AttemptTask">;
102
157
  readonly agent: Agent;
103
158
  readonly parentModel: (string & import("effect/Brand").Brand<"ModelId">) | null;
159
+ readonly reopening: number;
160
+ }[], Schema.SchemaError, never>;
161
+ export declare const decodeReopenedEvents: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => Effect.Effect<readonly {
162
+ readonly eventId: string & import("effect/Brand").Brand<"EventId">;
163
+ readonly dedupKey: string & import("effect/Brand").Brand<"DedupKey">;
104
164
  }[], Schema.SchemaError, never>;
105
165
  export declare const decodeRunRows: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => Effect.Effect<readonly {
106
166
  readonly itemKey: string & import("effect/Brand").Brand<"ItemKey">;
@@ -113,9 +173,23 @@ export declare const decodeRunRows: (input: unknown, options?: import("effect/Sc
113
173
  readonly eventId: string & import("effect/Brand").Brand<"EventId">;
114
174
  readonly loop: string & import("effect/Brand").Brand<"LoopName">;
115
175
  readonly state: RunState.Canceled | RunState.Failed | RunState.Pending | RunState.Queued | RunState.Running | RunState.Succeeded | RunState.Waiting;
176
+ readonly resolvedFailureAttemptId: (string & import("effect/Brand").Brand<"AttemptId">) | null;
116
177
  readonly openedAt: import("effect/DateTime").Utc;
178
+ readonly closedAt: import("effect/DateTime").Utc | null;
117
179
  readonly stepName: string & import("effect/Brand").Brand<"StepName">;
118
180
  readonly result: StepResult | null;
181
+ readonly approvedAt: import("effect/DateTime").Utc | null;
182
+ readonly approvalChannel: "github-ask" | "ui" | null;
183
+ readonly approver: (string & import("effect/Brand").Brand<"OperatorLogin">) | null;
184
+ readonly againFrom: (string & import("effect/Brand").Brand<"RunId">) | null;
185
+ readonly againRequestedBy: (string & import("effect/Brand").Brand<"OperatorLogin">) | null;
186
+ }[], Schema.SchemaError, never>;
187
+ export declare const decodeRunEventRows: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => Effect.Effect<readonly {
188
+ readonly runId: string & import("effect/Brand").Brand<"RunId">;
189
+ readonly eventId: string & import("effect/Brand").Brand<"EventId">;
190
+ readonly dedupKey: string & import("effect/Brand").Brand<"DedupKey">;
191
+ readonly payload: Schema.Json;
192
+ readonly receivedAt: import("effect/DateTime").Utc;
119
193
  }[], Schema.SchemaError, never>;
120
194
  export declare const decodeAttemptRows: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => Effect.Effect<readonly {
121
195
  readonly attemptId: string & import("effect/Brand").Brand<"AttemptId">;
@@ -124,28 +198,17 @@ export declare const decodeAttemptRows: (input: unknown, options?: import("effec
124
198
  readonly worker: string & import("effect/Brand").Brand<"WorkerName">;
125
199
  readonly number: number & import("effect/Brand").Brand<"AttemptNumber">;
126
200
  readonly brain: BrainSpec;
201
+ readonly task: string & import("effect/Brand").Brand<"AttemptTask">;
202
+ readonly agent: string & import("effect/Brand").Brand<"AgentName">;
203
+ readonly operatorIntervened: boolean;
127
204
  readonly parentModel: (string & import("effect/Brand").Brand<"ModelId">) | null;
128
205
  readonly startedAt: import("effect/DateTime").Utc;
129
206
  readonly outcome: import("@usine/core/attempt/outcome").AttemptCanceled | import("@usine/core/attempt/outcome").AttemptFailed | import("@usine/core/attempt/outcome").AttemptSucceeded | null;
130
- }[], Schema.SchemaError, never>;
131
- export declare const decodeRecoverableRuns: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => Effect.Effect<readonly {
132
- readonly eventId: string & import("effect/Brand").Brand<"EventId">;
133
- readonly dedupKey: string & import("effect/Brand").Brand<"DedupKey">;
134
- readonly payload: Schema.Json;
135
- readonly receivedAt: import("effect/DateTime").Utc;
136
- readonly itemKey: string & import("effect/Brand").Brand<"ItemKey">;
137
- readonly loop: string & import("effect/Brand").Brand<"LoopName">;
138
- readonly step: string & import("effect/Brand").Brand<"StepName">;
139
- readonly approval: "none" | "required";
140
- readonly cycleLimit: (number & import("effect/Brand").Brand<"CycleLimit">) | null;
141
- readonly cycleGeneration: number & import("effect/Brand").Brand<"CycleGeneration">;
142
- readonly repository: string & import("effect/Brand").Brand<"RepositoryName">;
143
- readonly revision: string & import("effect/Brand").Brand<"RepositoryRevision">;
144
- readonly task: string & import("effect/Brand").Brand<"AttemptTask">;
145
- readonly agent: Agent;
146
- readonly parentModel: (string & import("effect/Brand").Brand<"ModelId">) | null;
147
- readonly runId: string & import("effect/Brand").Brand<"RunId">;
148
- readonly state: RunState.Canceled | RunState.Failed | RunState.Pending | RunState.Queued | RunState.Running | RunState.Succeeded | RunState.Waiting;
207
+ readonly endedAt: import("effect/DateTime").Utc | null;
208
+ readonly salvage: import("@usine/core/attempt/salvage").SalvagePushed | import("@usine/core/attempt/salvage").SalvageRetained | null;
209
+ 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;
210
+ readonly reattachedAt: import("effect/DateTime").Utc | null;
211
+ readonly comments: readonly Comment[] | null;
149
212
  }[], Schema.SchemaError, never>;
150
213
  export declare const decodeRunIds: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => Effect.Effect<readonly {
151
214
  readonly runId: string & import("effect/Brand").Brand<"RunId">;
@@ -153,10 +216,6 @@ export declare const decodeRunIds: (input: unknown, options?: import("effect/Sch
153
216
  export declare const decodeDiscards: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => Effect.Effect<readonly {
154
217
  readonly reason: "revoked" | "superseded";
155
218
  }[], Schema.SchemaError, never>;
156
- export declare const decodeWorkflowCommands: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => Effect.Effect<readonly {
157
- readonly runId: string & import("effect/Brand").Brand<"RunId">;
158
- readonly command: "Approve" | "Continue" | "Interrupt" | "Resume";
159
- }[], Schema.SchemaError, never>;
160
219
  export declare const decodeProjectionRevision: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => Effect.Effect<readonly {
161
220
  readonly revision: number & import("effect/Brand").Brand<"ProjectionRevision">;
162
221
  }[], Schema.SchemaError, never>;
@@ -169,23 +228,37 @@ export declare const decodeTranscriptRows: (input: unknown, options?: import("ef
169
228
  readonly attemptId: string & import("effect/Brand").Brand<"AttemptId">;
170
229
  readonly sequence: number & import("effect/Brand").Brand<"AttemptChannelSequence">;
171
230
  readonly sentAt: import("effect/DateTime").Utc;
172
- readonly payload: AttemptChannel.Failed | AttemptChannel.Final | AttemptChannel.Interrupted | AttemptChannel.SessionEvent | AttemptChannel.Started;
173
- readonly version: 3;
231
+ readonly payload: AttemptChannel.Failed | AttemptChannel.Final | AttemptChannel.Interrupted | AttemptChannel.InterventionApplied | AttemptChannel.InterventionRejected | AttemptChannel.SessionEvent | AttemptChannel.Started | AttemptChannel.WorkerResponsive | AttemptChannel.WorkerUnresponsive;
232
+ readonly version: 5 | 6;
233
+ } | {
234
+ readonly _tag: "InboundEnvelope";
235
+ readonly attemptId: string & import("effect/Brand").Brand<"AttemptId">;
236
+ readonly sequence: number & import("effect/Brand").Brand<"AttemptChannelSequence">;
237
+ readonly sentAt: import("effect/DateTime").Utc;
238
+ readonly target: AttemptChannel.ChildTarget | AttemptChannel.ParentTarget;
239
+ readonly operator: string;
240
+ readonly payload: AttemptChannel.Cancel | AttemptChannel.Interrupt | AttemptChannel.OperatorMessage | AttemptChannel.Release | AttemptChannel.Steer;
241
+ readonly version: 5 | 6;
242
+ } | {
243
+ readonly _tag: "OutboundEnvelope";
244
+ readonly attemptId: string & import("effect/Brand").Brand<"AttemptId">;
245
+ readonly sequence: number & import("effect/Brand").Brand<"AttemptChannelSequence">;
246
+ readonly sentAt: import("effect/DateTime").Utc;
247
+ readonly payload: AttemptChannel.Failed | AttemptChannel.Final | AttemptChannel.Interrupted | AttemptChannel.InterventionApplied | AttemptChannel.InterventionRejected | AttemptChannel.SessionEvent | AttemptChannel.Started | AttemptChannel.WorkerResponsive | AttemptChannel.WorkerUnresponsive;
248
+ readonly version: 3 | 4;
174
249
  } | {
175
250
  readonly _tag: "InboundEnvelope";
251
+ readonly version: 3 | 4;
176
252
  readonly attemptId: string & import("effect/Brand").Brand<"AttemptId">;
177
253
  readonly sequence: number & import("effect/Brand").Brand<"AttemptChannelSequence">;
178
254
  readonly sentAt: import("effect/DateTime").Utc;
179
255
  readonly payload: AttemptChannel.Interrupt | AttemptChannel.Steer;
180
- readonly version: 3;
181
256
  };
182
257
  readonly receivedAt: import("effect/DateTime").Utc;
183
258
  }[], Schema.SchemaError, never>;
184
259
  export declare const encodePayload: (input: Schema.Json, options?: import("effect/SchemaAST").ParseOptions) => Schema.Json;
185
260
  export declare const encodeDateTime: (input: import("effect/DateTime").Utc, options?: import("effect/SchemaAST").ParseOptions) => string;
186
261
  export declare const encodeRunState: (input: RunState.Canceled | RunState.Failed | RunState.Pending | RunState.Queued | RunState.Running | RunState.Succeeded | RunState.Waiting, options?: import("effect/SchemaAST").ParseOptions) => {
187
- readonly _tag: "Succeeded";
188
- } | {
189
262
  readonly _tag: "Pending";
190
263
  } | {
191
264
  readonly _tag: "Waiting";
@@ -193,6 +266,8 @@ export declare const encodeRunState: (input: RunState.Canceled | RunState.Failed
193
266
  readonly _tag: "Queued";
194
267
  } | {
195
268
  readonly _tag: "Running";
269
+ } | {
270
+ readonly _tag: "Succeeded";
196
271
  } | {
197
272
  readonly _tag: "Failed";
198
273
  } | {
@@ -221,6 +296,12 @@ export declare const encodeOutcome: (input: import("@usine/core/attempt/outcome"
221
296
  } | {
222
297
  readonly _tag: "AgentFailure";
223
298
  readonly message: string;
299
+ } | {
300
+ readonly _tag: "BlockedFailure";
301
+ readonly message: string;
302
+ } | {
303
+ readonly _tag: "QuestionFailure";
304
+ readonly question: string;
224
305
  } | {
225
306
  readonly _tag: "RunawayFailure";
226
307
  readonly ceiling: "tokens" | "wall-clock";
@@ -232,6 +313,38 @@ export declare const encodeOutcome: (input: import("@usine/core/attempt/outcome"
232
313
  } | {
233
314
  readonly _tag: "Canceled";
234
315
  };
316
+ export declare const encodeSalvage: (input: import("@usine/core/attempt/salvage").SalvagePushed | import("@usine/core/attempt/salvage").SalvageRetained, options?: import("effect/SchemaAST").ParseOptions) => {
317
+ readonly _tag: "Pushed";
318
+ readonly ref: string;
319
+ readonly commit: string;
320
+ } | {
321
+ readonly _tag: "Retained";
322
+ readonly path: string;
323
+ readonly commit: string | null;
324
+ readonly message: string;
325
+ };
326
+ export declare const encodeComments: (input: readonly Comment[], options?: import("effect/SchemaAST").ParseOptions) => readonly {
327
+ readonly _tag: "Comment";
328
+ readonly url: string;
329
+ readonly kind: "issue-comment" | "review" | "review-comment";
330
+ readonly at?: string;
331
+ }[];
332
+ 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) => {
333
+ readonly _tag: "Event";
334
+ } | {
335
+ readonly _tag: "OperatorRetry";
336
+ readonly operator: string | null;
337
+ } | {
338
+ readonly _tag: "EditAndRetry";
339
+ readonly operator: string | null;
340
+ } | {
341
+ readonly _tag: "InfraRetry";
342
+ } | {
343
+ readonly _tag: "AfterRestart";
344
+ };
345
+ export declare const decodeNextStarts: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => Effect.Effect<readonly {
346
+ readonly nextStart: import("@usine/core/attempt/start").StartedByEditAndRetry | import("@usine/core/attempt/start").StartedByRetry | null;
347
+ }[], Schema.SchemaError, never>;
235
348
  export declare const encodeStepResult: (input: StepResult, options?: import("effect/SchemaAST").ParseOptions) => {
236
349
  readonly message: string;
237
350
  readonly facts: readonly ({
@@ -245,17 +358,24 @@ export declare const encodeStepResult: (input: StepResult, options?: import("eff
245
358
  } | {
246
359
  readonly _tag: "Comment";
247
360
  readonly url: string;
361
+ readonly kind: "issue-comment" | "review" | "review-comment";
362
+ readonly at?: string;
248
363
  })[];
249
364
  };
250
365
  export declare const encodeEnvelope: (input: AttemptChannel.InboundEnvelope | AttemptChannel.OutboundEnvelope, options?: import("effect/SchemaAST").ParseOptions) => {
251
366
  readonly _tag: "OutboundEnvelope";
252
- readonly version: 4;
367
+ readonly version: 7;
253
368
  readonly attemptId: string;
254
369
  readonly sequence: number;
255
370
  readonly sentAt: string;
256
371
  readonly payload: {
257
372
  readonly _tag: "Started";
258
373
  readonly parentModel: string;
374
+ readonly conflictingSalvage?: {
375
+ readonly _tag: "Pushed";
376
+ readonly ref: string;
377
+ readonly commit: string;
378
+ } | null;
259
379
  } | {
260
380
  readonly _tag: "SessionEvent";
261
381
  readonly event: {
@@ -279,6 +399,11 @@ export declare const encodeEnvelope: (input: AttemptChannel.InboundEnvelope | At
279
399
  readonly model: string;
280
400
  readonly effort: "high" | "low" | "max" | "medium" | "minimal" | "off" | "xhigh";
281
401
  };
402
+ readonly gatewayCredential?: "api-key" | "subscription";
403
+ };
404
+ readonly harnessSession?: {
405
+ readonly id: string;
406
+ readonly cwd: string;
282
407
  };
283
408
  } | {
284
409
  readonly _tag: "TextOutput";
@@ -301,6 +426,7 @@ export declare const encodeEnvelope: (input: AttemptChannel.InboundEnvelope | At
301
426
  readonly model: string;
302
427
  readonly effort: "high" | "low" | "max" | "medium" | "minimal" | "off" | "xhigh";
303
428
  };
429
+ readonly gatewayCredential?: "api-key" | "subscription";
304
430
  };
305
431
  readonly text: string;
306
432
  } | {
@@ -324,6 +450,7 @@ export declare const encodeEnvelope: (input: AttemptChannel.InboundEnvelope | At
324
450
  readonly model: string;
325
451
  readonly effort: "high" | "low" | "max" | "medium" | "minimal" | "off" | "xhigh";
326
452
  };
453
+ readonly gatewayCredential?: "api-key" | "subscription";
327
454
  };
328
455
  readonly callId: string;
329
456
  readonly tool: string;
@@ -349,6 +476,7 @@ export declare const encodeEnvelope: (input: AttemptChannel.InboundEnvelope | At
349
476
  readonly model: string;
350
477
  readonly effort: "high" | "low" | "max" | "medium" | "minimal" | "off" | "xhigh";
351
478
  };
479
+ readonly gatewayCredential?: "api-key" | "subscription";
352
480
  };
353
481
  readonly callId: string;
354
482
  readonly tool: string;
@@ -375,6 +503,7 @@ export declare const encodeEnvelope: (input: AttemptChannel.InboundEnvelope | At
375
503
  readonly model: string;
376
504
  readonly effort: "high" | "low" | "max" | "medium" | "minimal" | "off" | "xhigh";
377
505
  };
506
+ readonly gatewayCredential?: "api-key" | "subscription";
378
507
  };
379
508
  readonly pool: "apiKeys" | "chatgptPlan" | "claudePlan";
380
509
  readonly rateLimits: {
@@ -412,7 +541,128 @@ export declare const encodeEnvelope: (input: AttemptChannel.InboundEnvelope | At
412
541
  readonly model: string;
413
542
  readonly effort: "high" | "low" | "max" | "medium" | "minimal" | "off" | "xhigh";
414
543
  };
544
+ readonly gatewayCredential?: "api-key" | "subscription";
545
+ };
546
+ } | {
547
+ readonly _tag: "SessionIdle";
548
+ readonly session: {
549
+ readonly _tag: "ParentSession";
550
+ readonly id: string;
551
+ readonly agent: string;
552
+ readonly brain: {
553
+ readonly harness: "claude" | "codex" | "pi";
554
+ readonly model: string;
555
+ readonly effort: "high" | "low" | "max" | "medium" | "minimal" | "off" | "xhigh";
556
+ };
557
+ } | {
558
+ readonly _tag: "ChildSession";
559
+ readonly id: string;
560
+ readonly parentId: string;
561
+ readonly agent: string;
562
+ readonly brain: {
563
+ readonly harness: "claude" | "codex" | "pi";
564
+ readonly model: string;
565
+ readonly effort: "high" | "low" | "max" | "medium" | "minimal" | "off" | "xhigh";
566
+ };
567
+ readonly gatewayCredential?: "api-key" | "subscription";
415
568
  };
569
+ } | {
570
+ readonly _tag: "SessionResumed";
571
+ readonly session: {
572
+ readonly _tag: "ParentSession";
573
+ readonly id: string;
574
+ readonly agent: string;
575
+ readonly brain: {
576
+ readonly harness: "claude" | "codex" | "pi";
577
+ readonly model: string;
578
+ readonly effort: "high" | "low" | "max" | "medium" | "minimal" | "off" | "xhigh";
579
+ };
580
+ } | {
581
+ readonly _tag: "ChildSession";
582
+ readonly id: string;
583
+ readonly parentId: string;
584
+ readonly agent: string;
585
+ readonly brain: {
586
+ readonly harness: "claude" | "codex" | "pi";
587
+ readonly model: string;
588
+ readonly effort: "high" | "low" | "max" | "medium" | "minimal" | "off" | "xhigh";
589
+ };
590
+ readonly gatewayCredential?: "api-key" | "subscription";
591
+ };
592
+ } | {
593
+ readonly _tag: "SessionTokensUpdated";
594
+ readonly session: {
595
+ readonly _tag: "ParentSession";
596
+ readonly id: string;
597
+ readonly agent: string;
598
+ readonly brain: {
599
+ readonly harness: "claude" | "codex" | "pi";
600
+ readonly model: string;
601
+ readonly effort: "high" | "low" | "max" | "medium" | "minimal" | "off" | "xhigh";
602
+ };
603
+ } | {
604
+ readonly _tag: "ChildSession";
605
+ readonly id: string;
606
+ readonly parentId: string;
607
+ readonly agent: string;
608
+ readonly brain: {
609
+ readonly harness: "claude" | "codex" | "pi";
610
+ readonly model: string;
611
+ readonly effort: "high" | "low" | "max" | "medium" | "minimal" | "off" | "xhigh";
612
+ };
613
+ readonly gatewayCredential?: "api-key" | "subscription";
614
+ };
615
+ readonly totalTokens: number;
616
+ readonly costUsd?: number;
617
+ } | {
618
+ readonly _tag: "ProviderRetrying";
619
+ readonly session: {
620
+ readonly _tag: "ParentSession";
621
+ readonly id: string;
622
+ readonly agent: string;
623
+ readonly brain: {
624
+ readonly harness: "claude" | "codex" | "pi";
625
+ readonly model: string;
626
+ readonly effort: "high" | "low" | "max" | "medium" | "minimal" | "off" | "xhigh";
627
+ };
628
+ } | {
629
+ readonly _tag: "ChildSession";
630
+ readonly id: string;
631
+ readonly parentId: string;
632
+ readonly agent: string;
633
+ readonly brain: {
634
+ readonly harness: "claude" | "codex" | "pi";
635
+ readonly model: string;
636
+ readonly effort: "high" | "low" | "max" | "medium" | "minimal" | "off" | "xhigh";
637
+ };
638
+ readonly gatewayCredential?: "api-key" | "subscription";
639
+ };
640
+ readonly message: string;
641
+ readonly retries: number;
642
+ } | {
643
+ readonly _tag: "ProviderRecovered";
644
+ readonly session: {
645
+ readonly _tag: "ParentSession";
646
+ readonly id: string;
647
+ readonly agent: string;
648
+ readonly brain: {
649
+ readonly harness: "claude" | "codex" | "pi";
650
+ readonly model: string;
651
+ readonly effort: "high" | "low" | "max" | "medium" | "minimal" | "off" | "xhigh";
652
+ };
653
+ } | {
654
+ readonly _tag: "ChildSession";
655
+ readonly id: string;
656
+ readonly parentId: string;
657
+ readonly agent: string;
658
+ readonly brain: {
659
+ readonly harness: "claude" | "codex" | "pi";
660
+ readonly model: string;
661
+ readonly effort: "high" | "low" | "max" | "medium" | "minimal" | "off" | "xhigh";
662
+ };
663
+ readonly gatewayCredential?: "api-key" | "subscription";
664
+ };
665
+ readonly retries: number;
416
666
  };
417
667
  } | {
418
668
  readonly _tag: "Final";
@@ -429,6 +679,8 @@ export declare const encodeEnvelope: (input: AttemptChannel.InboundEnvelope | At
429
679
  } | {
430
680
  readonly _tag: "Comment";
431
681
  readonly url: string;
682
+ readonly kind: "issue-comment" | "review" | "review-comment";
683
+ readonly at?: string;
432
684
  })[];
433
685
  };
434
686
  } | {
@@ -444,6 +696,12 @@ export declare const encodeEnvelope: (input: AttemptChannel.InboundEnvelope | At
444
696
  } | {
445
697
  readonly _tag: "AgentFailure";
446
698
  readonly message: string;
699
+ } | {
700
+ readonly _tag: "BlockedFailure";
701
+ readonly message: string;
702
+ } | {
703
+ readonly _tag: "QuestionFailure";
704
+ readonly question: string;
447
705
  } | {
448
706
  readonly _tag: "RunawayFailure";
449
707
  readonly ceiling: "tokens" | "wall-clock";
@@ -454,18 +712,93 @@ export declare const encodeEnvelope: (input: AttemptChannel.InboundEnvelope | At
454
712
  };
455
713
  } | {
456
714
  readonly _tag: "Interrupted";
715
+ } | {
716
+ readonly _tag: "InterventionApplied";
717
+ readonly inputSequence: number;
718
+ readonly intervention: {
719
+ readonly operator: string;
720
+ readonly target: {
721
+ readonly _tag: "Parent";
722
+ } | {
723
+ readonly _tag: "Child";
724
+ readonly sessionId: string;
725
+ };
726
+ readonly action: {
727
+ readonly _tag: "Steer";
728
+ readonly message: string;
729
+ } | {
730
+ readonly _tag: "Interrupt";
731
+ } | {
732
+ readonly _tag: "OperatorMessage";
733
+ readonly message: string;
734
+ } | {
735
+ readonly _tag: "Release";
736
+ };
737
+ };
738
+ readonly state: {
739
+ readonly held: boolean;
740
+ readonly paused: boolean;
741
+ readonly queued?: boolean;
742
+ };
743
+ } | {
744
+ readonly _tag: "InterventionRejected";
745
+ readonly inputSequence: number;
746
+ readonly intervention: {
747
+ readonly operator: string;
748
+ readonly target: {
749
+ readonly _tag: "Parent";
750
+ } | {
751
+ readonly _tag: "Child";
752
+ readonly sessionId: string;
753
+ };
754
+ readonly action: {
755
+ readonly _tag: "Steer";
756
+ readonly message: string;
757
+ } | {
758
+ readonly _tag: "Interrupt";
759
+ } | {
760
+ readonly _tag: "OperatorMessage";
761
+ readonly message: string;
762
+ } | {
763
+ readonly _tag: "Release";
764
+ };
765
+ };
766
+ readonly message: string;
767
+ } | {
768
+ readonly _tag: "WorkerUnresponsive";
769
+ readonly worker: string;
770
+ readonly lastAnsweredAt: string;
771
+ readonly reason: string;
772
+ } | {
773
+ readonly _tag: "WorkerResponsive";
774
+ readonly worker: string;
775
+ readonly lastAnsweredAt: string;
457
776
  };
458
777
  } | {
459
778
  readonly _tag: "InboundEnvelope";
460
- readonly version: 4;
779
+ readonly version: 7;
461
780
  readonly attemptId: string;
462
781
  readonly sequence: number;
463
782
  readonly sentAt: string;
783
+ readonly target?: {
784
+ readonly _tag: "Parent";
785
+ } | {
786
+ readonly _tag: "Child";
787
+ readonly sessionId: string;
788
+ };
789
+ readonly operator: string;
464
790
  readonly payload: {
465
791
  readonly _tag: "Steer";
466
792
  readonly message: string;
467
793
  } | {
468
794
  readonly _tag: "Interrupt";
795
+ } | {
796
+ readonly _tag: "OperatorMessage";
797
+ readonly message: string;
798
+ } | {
799
+ readonly _tag: "Release";
800
+ } | {
801
+ readonly _tag: "Cancel";
469
802
  };
470
803
  };
471
804
  export declare const encodeAgent: (input: Agent, options?: import("effect/SchemaAST").ParseOptions) => {
@@ -485,11 +818,17 @@ export declare const encodeBrainSpec: (input: BrainSpec, options?: import("effec
485
818
  readonly effort: "high" | "low" | "max" | "medium" | "minimal" | "off" | "xhigh";
486
819
  };
487
820
  export declare const persistence: (operation: string) => <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, RunStoreError, R>;
488
- export declare const eventFromRow: (row: EventRouteRow) => Event;
821
+ /** The Event columns shared by route rows and Run Event rows. */
822
+ type EventColumns = Pick<EventRouteRow, "eventId" | "dedupKey" | "payload" | "receivedAt">;
823
+ export declare const eventFromRow: (row: EventColumns) => Event;
824
+ export declare const runEventFromRow: (row: typeof RunEventRow.Type) => RunEvent;
489
825
  export declare const submissionFromRow: (row: EventRouteRow) => Submission;
490
826
  export declare const runFromRow: (row: RunRow) => Run;
827
+ export declare const approvalFromRow: (row: RunRow) => Option.Option<RunApproval>;
828
+ export declare const runAgainFromRow: (row: RunRow) => Option.Option<RunAgain>;
491
829
  export declare const stepFromRow: (row: RunRow) => Step;
492
830
  export declare const attemptFromRow: (row: AttemptRow) => Attempt;
493
831
  export declare const runSummaryFromRow: (row: RunRow, storedAttempts: ReadonlyArray<AttemptRow>) => RunSummary;
494
832
  export declare const transcriptEntryFromRow: (row: TranscriptRow) => TranscriptEntry;
833
+ export {};
495
834
  //# sourceMappingURL=codec.d.ts.map