@h-rig/contracts 0.0.6-alpha.78 → 0.0.6-alpha.79

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.
@@ -0,0 +1,763 @@
1
+ import { Schema } from "effect";
2
+ import { RunStatus } from "./runtime";
3
+ /** Who caused a journal event. Operator ids come from the authenticated WS/HTTP principal. */
4
+ export declare const RunActor: Schema.Struct<{
5
+ readonly kind: Schema.Literals<readonly ["operator", "agent", "server", "system"]>;
6
+ readonly id: Schema.optional<Schema.NullOr<Schema.Trim>>;
7
+ }>;
8
+ export type RunActor = typeof RunActor.Type;
9
+ export declare const RunCloseoutPhase: Schema.Literals<readonly ["queued", "commit", "push", "pr-review-merge", "pr-opened", "merge", "close-source", "completed"]>;
10
+ export type RunCloseoutPhase = typeof RunCloseoutPhase.Type;
11
+ export declare const RunCloseoutPhaseOutcome: Schema.Literals<readonly ["started", "completed", "failed"]>;
12
+ export type RunCloseoutPhaseOutcome = typeof RunCloseoutPhaseOutcome.Type;
13
+ export declare const RunCloseoutStatus: Schema.Literals<readonly ["pending", "running", "completed", "needs-attention", "failed"]>;
14
+ export type RunCloseoutStatus = typeof RunCloseoutStatus.Type;
15
+ /**
16
+ * Persisted state of the server-owned PR closeout machine. Lives on the run
17
+ * record (`serverCloseout`) so a restarted server resumes the machine at the
18
+ * recorded phase instead of re-running completed work.
19
+ */
20
+ export declare const RunCloseoutState: Schema.Struct<{
21
+ readonly phase: Schema.Literals<readonly ["queued", "commit", "push", "pr-review-merge", "pr-opened", "merge", "close-source", "completed"]>;
22
+ readonly status: Schema.Literals<readonly ["pending", "running", "completed", "needs-attention", "failed"]>;
23
+ readonly updatedAt: Schema.String;
24
+ readonly taskId: Schema.optional<Schema.NullOr<Schema.Trim>>;
25
+ readonly runtimeWorkspace: Schema.optional<Schema.NullOr<Schema.Trim>>;
26
+ readonly branch: Schema.optional<Schema.NullOr<Schema.Trim>>;
27
+ readonly prUrl: Schema.optional<Schema.NullOr<Schema.Trim>>;
28
+ readonly artifactRoot: Schema.optional<Schema.NullOr<Schema.Trim>>;
29
+ readonly iterations: Schema.optional<Schema.NullOr<Schema.Int>>;
30
+ readonly feedback: Schema.optional<Schema.$Array<Schema.String>>;
31
+ readonly error: Schema.optional<Schema.NullOr<Schema.String>>;
32
+ readonly reason: Schema.optional<Schema.NullOr<Schema.String>>;
33
+ readonly merged: Schema.optional<Schema.Boolean>;
34
+ readonly resumedAt: Schema.optional<Schema.NullOr<Schema.String>>;
35
+ readonly completedAt: Schema.optional<Schema.NullOr<Schema.String>>;
36
+ }>;
37
+ export type RunCloseoutState = typeof RunCloseoutState.Type;
38
+ export declare const ApprovalDecision: Schema.Literals<readonly ["approve", "reject"]>;
39
+ export type ApprovalDecision = typeof ApprovalDecision.Type;
40
+ export declare const RunJournalRecord: Schema.Struct<{
41
+ readonly status: Schema.Literals<readonly ["created", "queued", "preparing", "running", "waiting-approval", "waiting-user-input", "paused", "validating", "reviewing", "closing-out", "needs-attention", "completed", "failed", "stopped"]>;
42
+ readonly runId: Schema.Trim;
43
+ readonly workspaceId: Schema.Trim;
44
+ readonly taskId: Schema.NullOr<Schema.Trim>;
45
+ readonly threadId: Schema.NullOr<Schema.Trim>;
46
+ readonly mode: Schema.Literals<readonly ["local", "remote"]>;
47
+ readonly runtimeAdapter: Schema.Trim;
48
+ readonly createdAt: Schema.String;
49
+ readonly startedAt: Schema.NullOr<Schema.String>;
50
+ readonly completedAt: Schema.NullOr<Schema.String>;
51
+ readonly endpointId: Schema.NullOr<Schema.Trim>;
52
+ readonly hostId: Schema.NullOr<Schema.Trim>;
53
+ readonly worktreePath: Schema.NullOr<Schema.Trim>;
54
+ readonly artifactRoot: Schema.NullOr<Schema.Trim>;
55
+ readonly logRoot: Schema.NullOr<Schema.Trim>;
56
+ readonly sessionPath: Schema.NullOr<Schema.Trim>;
57
+ readonly sessionLogPath: Schema.NullOr<Schema.Trim>;
58
+ readonly pid: Schema.optional<Schema.NullOr<Schema.Int>>;
59
+ readonly piSession: Schema.optional<Schema.Unknown>;
60
+ readonly piSessionPrivate: Schema.optional<Schema.Unknown>;
61
+ readonly updatedAt: Schema.String;
62
+ readonly title: Schema.Trim;
63
+ readonly projectRoot: Schema.optional<Schema.NullOr<Schema.Trim>>;
64
+ readonly errorText: Schema.optional<Schema.NullOr<Schema.String>>;
65
+ readonly latestMessageId: Schema.optional<Schema.NullOr<Schema.Trim>>;
66
+ readonly prUrl: Schema.optional<Schema.NullOr<Schema.Trim>>;
67
+ readonly leaseId: Schema.optional<Schema.NullOr<Schema.Trim>>;
68
+ readonly serverCloseout: Schema.optional<Schema.NullOr<Schema.Struct<{
69
+ readonly phase: Schema.Literals<readonly ["queued", "commit", "push", "pr-review-merge", "pr-opened", "merge", "close-source", "completed"]>;
70
+ readonly status: Schema.Literals<readonly ["pending", "running", "completed", "needs-attention", "failed"]>;
71
+ readonly updatedAt: Schema.String;
72
+ readonly taskId: Schema.optional<Schema.NullOr<Schema.Trim>>;
73
+ readonly runtimeWorkspace: Schema.optional<Schema.NullOr<Schema.Trim>>;
74
+ readonly branch: Schema.optional<Schema.NullOr<Schema.Trim>>;
75
+ readonly prUrl: Schema.optional<Schema.NullOr<Schema.Trim>>;
76
+ readonly artifactRoot: Schema.optional<Schema.NullOr<Schema.Trim>>;
77
+ readonly iterations: Schema.optional<Schema.NullOr<Schema.Int>>;
78
+ readonly feedback: Schema.optional<Schema.$Array<Schema.String>>;
79
+ readonly error: Schema.optional<Schema.NullOr<Schema.String>>;
80
+ readonly reason: Schema.optional<Schema.NullOr<Schema.String>>;
81
+ readonly merged: Schema.optional<Schema.Boolean>;
82
+ readonly resumedAt: Schema.optional<Schema.NullOr<Schema.String>>;
83
+ readonly completedAt: Schema.optional<Schema.NullOr<Schema.String>>;
84
+ }>>>;
85
+ readonly model: Schema.optional<Schema.NullOr<Schema.Trim>>;
86
+ readonly runtimeMode: Schema.optional<Schema.NullOr<Schema.Trim>>;
87
+ readonly interactionMode: Schema.optional<Schema.NullOr<Schema.Trim>>;
88
+ readonly runMode: Schema.optional<Schema.NullOr<Schema.Trim>>;
89
+ readonly initialPrompt: Schema.optional<Schema.NullOr<Schema.String>>;
90
+ readonly baselineMode: Schema.optional<Schema.NullOr<Schema.Trim>>;
91
+ readonly prMode: Schema.optional<Schema.NullOr<Schema.Literals<readonly ["auto", "ask", "off"]>>>;
92
+ readonly initiatedBy: Schema.optional<Schema.NullOr<Schema.Trim>>;
93
+ readonly sourceTask: Schema.optional<Schema.Unknown>;
94
+ readonly serverPid: Schema.optional<Schema.NullOr<Schema.Int>>;
95
+ readonly latestSteeringAt: Schema.optional<Schema.NullOr<Schema.String>>;
96
+ readonly latestSteeringDeliveredAt: Schema.optional<Schema.NullOr<Schema.String>>;
97
+ readonly statusDetail: Schema.optional<Schema.NullOr<Schema.String>>;
98
+ readonly planning: Schema.optional<Schema.Unknown>;
99
+ readonly branch: Schema.optional<Schema.NullOr<Schema.Trim>>;
100
+ }>;
101
+ export type RunJournalRecord = typeof RunJournalRecord.Type;
102
+ export declare const RunRecordPatch: Schema.Struct<{
103
+ readonly runId: Schema.optional<Schema.Trim>;
104
+ readonly workspaceId: Schema.optional<Schema.Trim>;
105
+ readonly taskId: Schema.optional<Schema.NullOr<Schema.Trim>>;
106
+ readonly threadId: Schema.optional<Schema.NullOr<Schema.Trim>>;
107
+ readonly mode: Schema.optional<Schema.Literals<readonly ["local", "remote"]>>;
108
+ readonly runtimeAdapter: Schema.optional<Schema.Trim>;
109
+ readonly createdAt: Schema.optional<Schema.String>;
110
+ readonly startedAt: Schema.optional<Schema.NullOr<Schema.String>>;
111
+ readonly completedAt: Schema.optional<Schema.NullOr<Schema.String>>;
112
+ readonly endpointId: Schema.optional<Schema.NullOr<Schema.Trim>>;
113
+ readonly hostId: Schema.optional<Schema.NullOr<Schema.Trim>>;
114
+ readonly worktreePath: Schema.optional<Schema.NullOr<Schema.Trim>>;
115
+ readonly artifactRoot: Schema.optional<Schema.NullOr<Schema.Trim>>;
116
+ readonly logRoot: Schema.optional<Schema.NullOr<Schema.Trim>>;
117
+ readonly sessionPath: Schema.optional<Schema.NullOr<Schema.Trim>>;
118
+ readonly sessionLogPath: Schema.optional<Schema.NullOr<Schema.Trim>>;
119
+ readonly pid: Schema.optional<Schema.NullOr<Schema.Int>>;
120
+ readonly piSession: Schema.optional<Schema.Unknown>;
121
+ readonly piSessionPrivate: Schema.optional<Schema.Unknown>;
122
+ readonly updatedAt: Schema.optional<Schema.String>;
123
+ readonly title: Schema.optional<Schema.Trim>;
124
+ readonly projectRoot: Schema.optional<Schema.NullOr<Schema.Trim>>;
125
+ readonly errorText: Schema.optional<Schema.NullOr<Schema.String>>;
126
+ readonly latestMessageId: Schema.optional<Schema.NullOr<Schema.Trim>>;
127
+ readonly prUrl: Schema.optional<Schema.NullOr<Schema.Trim>>;
128
+ readonly leaseId: Schema.optional<Schema.NullOr<Schema.Trim>>;
129
+ readonly serverCloseout: Schema.optional<Schema.NullOr<Schema.Struct<{
130
+ readonly phase: Schema.Literals<readonly ["queued", "commit", "push", "pr-review-merge", "pr-opened", "merge", "close-source", "completed"]>;
131
+ readonly status: Schema.Literals<readonly ["pending", "running", "completed", "needs-attention", "failed"]>;
132
+ readonly updatedAt: Schema.String;
133
+ readonly taskId: Schema.optional<Schema.NullOr<Schema.Trim>>;
134
+ readonly runtimeWorkspace: Schema.optional<Schema.NullOr<Schema.Trim>>;
135
+ readonly branch: Schema.optional<Schema.NullOr<Schema.Trim>>;
136
+ readonly prUrl: Schema.optional<Schema.NullOr<Schema.Trim>>;
137
+ readonly artifactRoot: Schema.optional<Schema.NullOr<Schema.Trim>>;
138
+ readonly iterations: Schema.optional<Schema.NullOr<Schema.Int>>;
139
+ readonly feedback: Schema.optional<Schema.$Array<Schema.String>>;
140
+ readonly error: Schema.optional<Schema.NullOr<Schema.String>>;
141
+ readonly reason: Schema.optional<Schema.NullOr<Schema.String>>;
142
+ readonly merged: Schema.optional<Schema.Boolean>;
143
+ readonly resumedAt: Schema.optional<Schema.NullOr<Schema.String>>;
144
+ readonly completedAt: Schema.optional<Schema.NullOr<Schema.String>>;
145
+ }>>>;
146
+ readonly model: Schema.optional<Schema.NullOr<Schema.Trim>>;
147
+ readonly runtimeMode: Schema.optional<Schema.NullOr<Schema.Trim>>;
148
+ readonly interactionMode: Schema.optional<Schema.NullOr<Schema.Trim>>;
149
+ readonly runMode: Schema.optional<Schema.NullOr<Schema.Trim>>;
150
+ readonly initialPrompt: Schema.optional<Schema.NullOr<Schema.String>>;
151
+ readonly baselineMode: Schema.optional<Schema.NullOr<Schema.Trim>>;
152
+ readonly prMode: Schema.optional<Schema.NullOr<Schema.Literals<readonly ["auto", "ask", "off"]>>>;
153
+ readonly initiatedBy: Schema.optional<Schema.NullOr<Schema.Trim>>;
154
+ readonly sourceTask: Schema.optional<Schema.Unknown>;
155
+ readonly serverPid: Schema.optional<Schema.NullOr<Schema.Int>>;
156
+ readonly latestSteeringAt: Schema.optional<Schema.NullOr<Schema.String>>;
157
+ readonly latestSteeringDeliveredAt: Schema.optional<Schema.NullOr<Schema.String>>;
158
+ readonly statusDetail: Schema.optional<Schema.NullOr<Schema.String>>;
159
+ readonly planning: Schema.optional<Schema.Unknown>;
160
+ readonly branch: Schema.optional<Schema.NullOr<Schema.Trim>>;
161
+ }>;
162
+ export type RunRecordPatch = typeof RunRecordPatch.Type;
163
+ export declare const RunStatusChangedEvent: Schema.Struct<{
164
+ readonly type: Schema.Literal<"status-changed">;
165
+ readonly from: Schema.NullOr<Schema.Literals<readonly ["created", "queued", "preparing", "running", "waiting-approval", "waiting-user-input", "paused", "validating", "reviewing", "closing-out", "needs-attention", "completed", "failed", "stopped"]>>;
166
+ readonly to: Schema.Literals<readonly ["created", "queued", "preparing", "running", "waiting-approval", "waiting-user-input", "paused", "validating", "reviewing", "closing-out", "needs-attention", "completed", "failed", "stopped"]>;
167
+ readonly reason: Schema.optional<Schema.NullOr<Schema.String>>;
168
+ readonly actor: Schema.optional<Schema.Struct<{
169
+ readonly kind: Schema.Literals<readonly ["operator", "agent", "server", "system"]>;
170
+ readonly id: Schema.optional<Schema.NullOr<Schema.Trim>>;
171
+ }>>;
172
+ readonly v: Schema.Literal<1>;
173
+ readonly seq: Schema.Int;
174
+ readonly at: Schema.String;
175
+ readonly runId: Schema.brand<Schema.Trim, "RunId">;
176
+ }>;
177
+ export type RunStatusChangedEvent = typeof RunStatusChangedEvent.Type;
178
+ export declare const RunRecordPatchEvent: Schema.Struct<{
179
+ readonly type: Schema.Literal<"record-patch">;
180
+ readonly patch: Schema.Struct<{
181
+ readonly runId: Schema.optional<Schema.Trim>;
182
+ readonly workspaceId: Schema.optional<Schema.Trim>;
183
+ readonly taskId: Schema.optional<Schema.NullOr<Schema.Trim>>;
184
+ readonly threadId: Schema.optional<Schema.NullOr<Schema.Trim>>;
185
+ readonly mode: Schema.optional<Schema.Literals<readonly ["local", "remote"]>>;
186
+ readonly runtimeAdapter: Schema.optional<Schema.Trim>;
187
+ readonly createdAt: Schema.optional<Schema.String>;
188
+ readonly startedAt: Schema.optional<Schema.NullOr<Schema.String>>;
189
+ readonly completedAt: Schema.optional<Schema.NullOr<Schema.String>>;
190
+ readonly endpointId: Schema.optional<Schema.NullOr<Schema.Trim>>;
191
+ readonly hostId: Schema.optional<Schema.NullOr<Schema.Trim>>;
192
+ readonly worktreePath: Schema.optional<Schema.NullOr<Schema.Trim>>;
193
+ readonly artifactRoot: Schema.optional<Schema.NullOr<Schema.Trim>>;
194
+ readonly logRoot: Schema.optional<Schema.NullOr<Schema.Trim>>;
195
+ readonly sessionPath: Schema.optional<Schema.NullOr<Schema.Trim>>;
196
+ readonly sessionLogPath: Schema.optional<Schema.NullOr<Schema.Trim>>;
197
+ readonly pid: Schema.optional<Schema.NullOr<Schema.Int>>;
198
+ readonly piSession: Schema.optional<Schema.Unknown>;
199
+ readonly piSessionPrivate: Schema.optional<Schema.Unknown>;
200
+ readonly updatedAt: Schema.optional<Schema.String>;
201
+ readonly title: Schema.optional<Schema.Trim>;
202
+ readonly projectRoot: Schema.optional<Schema.NullOr<Schema.Trim>>;
203
+ readonly errorText: Schema.optional<Schema.NullOr<Schema.String>>;
204
+ readonly latestMessageId: Schema.optional<Schema.NullOr<Schema.Trim>>;
205
+ readonly prUrl: Schema.optional<Schema.NullOr<Schema.Trim>>;
206
+ readonly leaseId: Schema.optional<Schema.NullOr<Schema.Trim>>;
207
+ readonly serverCloseout: Schema.optional<Schema.NullOr<Schema.Struct<{
208
+ readonly phase: Schema.Literals<readonly ["queued", "commit", "push", "pr-review-merge", "pr-opened", "merge", "close-source", "completed"]>;
209
+ readonly status: Schema.Literals<readonly ["pending", "running", "completed", "needs-attention", "failed"]>;
210
+ readonly updatedAt: Schema.String;
211
+ readonly taskId: Schema.optional<Schema.NullOr<Schema.Trim>>;
212
+ readonly runtimeWorkspace: Schema.optional<Schema.NullOr<Schema.Trim>>;
213
+ readonly branch: Schema.optional<Schema.NullOr<Schema.Trim>>;
214
+ readonly prUrl: Schema.optional<Schema.NullOr<Schema.Trim>>;
215
+ readonly artifactRoot: Schema.optional<Schema.NullOr<Schema.Trim>>;
216
+ readonly iterations: Schema.optional<Schema.NullOr<Schema.Int>>;
217
+ readonly feedback: Schema.optional<Schema.$Array<Schema.String>>;
218
+ readonly error: Schema.optional<Schema.NullOr<Schema.String>>;
219
+ readonly reason: Schema.optional<Schema.NullOr<Schema.String>>;
220
+ readonly merged: Schema.optional<Schema.Boolean>;
221
+ readonly resumedAt: Schema.optional<Schema.NullOr<Schema.String>>;
222
+ readonly completedAt: Schema.optional<Schema.NullOr<Schema.String>>;
223
+ }>>>;
224
+ readonly model: Schema.optional<Schema.NullOr<Schema.Trim>>;
225
+ readonly runtimeMode: Schema.optional<Schema.NullOr<Schema.Trim>>;
226
+ readonly interactionMode: Schema.optional<Schema.NullOr<Schema.Trim>>;
227
+ readonly runMode: Schema.optional<Schema.NullOr<Schema.Trim>>;
228
+ readonly initialPrompt: Schema.optional<Schema.NullOr<Schema.String>>;
229
+ readonly baselineMode: Schema.optional<Schema.NullOr<Schema.Trim>>;
230
+ readonly prMode: Schema.optional<Schema.NullOr<Schema.Literals<readonly ["auto", "ask", "off"]>>>;
231
+ readonly initiatedBy: Schema.optional<Schema.NullOr<Schema.Trim>>;
232
+ readonly sourceTask: Schema.optional<Schema.Unknown>;
233
+ readonly serverPid: Schema.optional<Schema.NullOr<Schema.Int>>;
234
+ readonly latestSteeringAt: Schema.optional<Schema.NullOr<Schema.String>>;
235
+ readonly latestSteeringDeliveredAt: Schema.optional<Schema.NullOr<Schema.String>>;
236
+ readonly statusDetail: Schema.optional<Schema.NullOr<Schema.String>>;
237
+ readonly planning: Schema.optional<Schema.Unknown>;
238
+ readonly branch: Schema.optional<Schema.NullOr<Schema.Trim>>;
239
+ }>;
240
+ readonly v: Schema.Literal<1>;
241
+ readonly seq: Schema.Int;
242
+ readonly at: Schema.String;
243
+ readonly runId: Schema.brand<Schema.Trim, "RunId">;
244
+ }>;
245
+ export type RunRecordPatchEvent = typeof RunRecordPatchEvent.Type;
246
+ export declare const RunTimelineEntryEvent: Schema.Struct<{
247
+ readonly type: Schema.Literal<"timeline-entry">;
248
+ readonly payload: Schema.Unknown;
249
+ readonly v: Schema.Literal<1>;
250
+ readonly seq: Schema.Int;
251
+ readonly at: Schema.String;
252
+ readonly runId: Schema.brand<Schema.Trim, "RunId">;
253
+ }>;
254
+ export type RunTimelineEntryEvent = typeof RunTimelineEntryEvent.Type;
255
+ export declare const RunLogEntryEvent: Schema.Struct<{
256
+ readonly type: Schema.Literal<"log-entry">;
257
+ readonly payload: Schema.Unknown;
258
+ readonly v: Schema.Literal<1>;
259
+ readonly seq: Schema.Int;
260
+ readonly at: Schema.String;
261
+ readonly runId: Schema.brand<Schema.Trim, "RunId">;
262
+ }>;
263
+ export type RunLogEntryEvent = typeof RunLogEntryEvent.Type;
264
+ export declare const RunApprovalRequestedEvent: Schema.Struct<{
265
+ readonly type: Schema.Literal<"approval-requested">;
266
+ readonly requestId: Schema.Trim;
267
+ readonly requestKind: Schema.Trim;
268
+ readonly actionId: Schema.optional<Schema.NullOr<Schema.Trim>>;
269
+ readonly payload: Schema.Unknown;
270
+ readonly v: Schema.Literal<1>;
271
+ readonly seq: Schema.Int;
272
+ readonly at: Schema.String;
273
+ readonly runId: Schema.brand<Schema.Trim, "RunId">;
274
+ }>;
275
+ export type RunApprovalRequestedEvent = typeof RunApprovalRequestedEvent.Type;
276
+ export declare const RunApprovalResolvedEvent: Schema.Struct<{
277
+ readonly type: Schema.Literal<"approval-resolved">;
278
+ readonly requestId: Schema.Trim;
279
+ readonly decision: Schema.Literals<readonly ["approve", "reject"]>;
280
+ readonly note: Schema.optional<Schema.NullOr<Schema.String>>;
281
+ readonly actor: Schema.Struct<{
282
+ readonly kind: Schema.Literals<readonly ["operator", "agent", "server", "system"]>;
283
+ readonly id: Schema.optional<Schema.NullOr<Schema.Trim>>;
284
+ }>;
285
+ readonly v: Schema.Literal<1>;
286
+ readonly seq: Schema.Int;
287
+ readonly at: Schema.String;
288
+ readonly runId: Schema.brand<Schema.Trim, "RunId">;
289
+ }>;
290
+ export type RunApprovalResolvedEvent = typeof RunApprovalResolvedEvent.Type;
291
+ export declare const RunInputRequestedEvent: Schema.Struct<{
292
+ readonly type: Schema.Literal<"input-requested">;
293
+ readonly requestId: Schema.Trim;
294
+ readonly payload: Schema.Unknown;
295
+ readonly v: Schema.Literal<1>;
296
+ readonly seq: Schema.Int;
297
+ readonly at: Schema.String;
298
+ readonly runId: Schema.brand<Schema.Trim, "RunId">;
299
+ }>;
300
+ export type RunInputRequestedEvent = typeof RunInputRequestedEvent.Type;
301
+ export declare const RunInputResolvedEvent: Schema.Struct<{
302
+ readonly type: Schema.Literal<"input-resolved">;
303
+ readonly requestId: Schema.Trim;
304
+ readonly answers: Schema.$Record<Schema.String, Schema.String>;
305
+ readonly actor: Schema.Struct<{
306
+ readonly kind: Schema.Literals<readonly ["operator", "agent", "server", "system"]>;
307
+ readonly id: Schema.optional<Schema.NullOr<Schema.Trim>>;
308
+ }>;
309
+ readonly v: Schema.Literal<1>;
310
+ readonly seq: Schema.Int;
311
+ readonly at: Schema.String;
312
+ readonly runId: Schema.brand<Schema.Trim, "RunId">;
313
+ }>;
314
+ export type RunInputResolvedEvent = typeof RunInputResolvedEvent.Type;
315
+ export declare const RunSteeringEvent: Schema.Struct<{
316
+ readonly type: Schema.Literal<"steering">;
317
+ readonly actor: Schema.Struct<{
318
+ readonly kind: Schema.Literals<readonly ["operator", "agent", "server", "system"]>;
319
+ readonly id: Schema.optional<Schema.NullOr<Schema.Trim>>;
320
+ }>;
321
+ readonly text: Schema.String;
322
+ readonly v: Schema.Literal<1>;
323
+ readonly seq: Schema.Int;
324
+ readonly at: Schema.String;
325
+ readonly runId: Schema.brand<Schema.Trim, "RunId">;
326
+ }>;
327
+ export type RunSteeringEvent = typeof RunSteeringEvent.Type;
328
+ export declare const RunAdoptedEvent: Schema.Struct<{
329
+ readonly type: Schema.Literal<"adopted">;
330
+ readonly pid: Schema.NullOr<Schema.Int>;
331
+ readonly serverPid: Schema.Int;
332
+ readonly v: Schema.Literal<1>;
333
+ readonly seq: Schema.Int;
334
+ readonly at: Schema.String;
335
+ readonly runId: Schema.brand<Schema.Trim, "RunId">;
336
+ }>;
337
+ export type RunAdoptedEvent = typeof RunAdoptedEvent.Type;
338
+ export declare const RunStallDetectedEvent: Schema.Struct<{
339
+ readonly type: Schema.Literal<"stall-detected">;
340
+ readonly detail: Schema.String;
341
+ readonly v: Schema.Literal<1>;
342
+ readonly seq: Schema.Int;
343
+ readonly at: Schema.String;
344
+ readonly runId: Schema.brand<Schema.Trim, "RunId">;
345
+ }>;
346
+ export type RunStallDetectedEvent = typeof RunStallDetectedEvent.Type;
347
+ export declare const RunCloseoutPhaseEvent: Schema.Struct<{
348
+ readonly type: Schema.Literal<"closeout-phase">;
349
+ readonly phase: Schema.Literals<readonly ["queued", "commit", "push", "pr-review-merge", "pr-opened", "merge", "close-source", "completed"]>;
350
+ readonly outcome: Schema.Literals<readonly ["started", "completed", "failed"]>;
351
+ readonly detail: Schema.optional<Schema.NullOr<Schema.String>>;
352
+ readonly v: Schema.Literal<1>;
353
+ readonly seq: Schema.Int;
354
+ readonly at: Schema.String;
355
+ readonly runId: Schema.brand<Schema.Trim, "RunId">;
356
+ }>;
357
+ export type RunCloseoutPhaseEvent = typeof RunCloseoutPhaseEvent.Type;
358
+ export declare const RunJournalEvent: Schema.Union<readonly [Schema.Struct<{
359
+ readonly type: Schema.Literal<"status-changed">;
360
+ readonly from: Schema.NullOr<Schema.Literals<readonly ["created", "queued", "preparing", "running", "waiting-approval", "waiting-user-input", "paused", "validating", "reviewing", "closing-out", "needs-attention", "completed", "failed", "stopped"]>>;
361
+ readonly to: Schema.Literals<readonly ["created", "queued", "preparing", "running", "waiting-approval", "waiting-user-input", "paused", "validating", "reviewing", "closing-out", "needs-attention", "completed", "failed", "stopped"]>;
362
+ readonly reason: Schema.optional<Schema.NullOr<Schema.String>>;
363
+ readonly actor: Schema.optional<Schema.Struct<{
364
+ readonly kind: Schema.Literals<readonly ["operator", "agent", "server", "system"]>;
365
+ readonly id: Schema.optional<Schema.NullOr<Schema.Trim>>;
366
+ }>>;
367
+ readonly v: Schema.Literal<1>;
368
+ readonly seq: Schema.Int;
369
+ readonly at: Schema.String;
370
+ readonly runId: Schema.brand<Schema.Trim, "RunId">;
371
+ }>, Schema.Struct<{
372
+ readonly type: Schema.Literal<"record-patch">;
373
+ readonly patch: Schema.Struct<{
374
+ readonly runId: Schema.optional<Schema.Trim>;
375
+ readonly workspaceId: Schema.optional<Schema.Trim>;
376
+ readonly taskId: Schema.optional<Schema.NullOr<Schema.Trim>>;
377
+ readonly threadId: Schema.optional<Schema.NullOr<Schema.Trim>>;
378
+ readonly mode: Schema.optional<Schema.Literals<readonly ["local", "remote"]>>;
379
+ readonly runtimeAdapter: Schema.optional<Schema.Trim>;
380
+ readonly createdAt: Schema.optional<Schema.String>;
381
+ readonly startedAt: Schema.optional<Schema.NullOr<Schema.String>>;
382
+ readonly completedAt: Schema.optional<Schema.NullOr<Schema.String>>;
383
+ readonly endpointId: Schema.optional<Schema.NullOr<Schema.Trim>>;
384
+ readonly hostId: Schema.optional<Schema.NullOr<Schema.Trim>>;
385
+ readonly worktreePath: Schema.optional<Schema.NullOr<Schema.Trim>>;
386
+ readonly artifactRoot: Schema.optional<Schema.NullOr<Schema.Trim>>;
387
+ readonly logRoot: Schema.optional<Schema.NullOr<Schema.Trim>>;
388
+ readonly sessionPath: Schema.optional<Schema.NullOr<Schema.Trim>>;
389
+ readonly sessionLogPath: Schema.optional<Schema.NullOr<Schema.Trim>>;
390
+ readonly pid: Schema.optional<Schema.NullOr<Schema.Int>>;
391
+ readonly piSession: Schema.optional<Schema.Unknown>;
392
+ readonly piSessionPrivate: Schema.optional<Schema.Unknown>;
393
+ readonly updatedAt: Schema.optional<Schema.String>;
394
+ readonly title: Schema.optional<Schema.Trim>;
395
+ readonly projectRoot: Schema.optional<Schema.NullOr<Schema.Trim>>;
396
+ readonly errorText: Schema.optional<Schema.NullOr<Schema.String>>;
397
+ readonly latestMessageId: Schema.optional<Schema.NullOr<Schema.Trim>>;
398
+ readonly prUrl: Schema.optional<Schema.NullOr<Schema.Trim>>;
399
+ readonly leaseId: Schema.optional<Schema.NullOr<Schema.Trim>>;
400
+ readonly serverCloseout: Schema.optional<Schema.NullOr<Schema.Struct<{
401
+ readonly phase: Schema.Literals<readonly ["queued", "commit", "push", "pr-review-merge", "pr-opened", "merge", "close-source", "completed"]>;
402
+ readonly status: Schema.Literals<readonly ["pending", "running", "completed", "needs-attention", "failed"]>;
403
+ readonly updatedAt: Schema.String;
404
+ readonly taskId: Schema.optional<Schema.NullOr<Schema.Trim>>;
405
+ readonly runtimeWorkspace: Schema.optional<Schema.NullOr<Schema.Trim>>;
406
+ readonly branch: Schema.optional<Schema.NullOr<Schema.Trim>>;
407
+ readonly prUrl: Schema.optional<Schema.NullOr<Schema.Trim>>;
408
+ readonly artifactRoot: Schema.optional<Schema.NullOr<Schema.Trim>>;
409
+ readonly iterations: Schema.optional<Schema.NullOr<Schema.Int>>;
410
+ readonly feedback: Schema.optional<Schema.$Array<Schema.String>>;
411
+ readonly error: Schema.optional<Schema.NullOr<Schema.String>>;
412
+ readonly reason: Schema.optional<Schema.NullOr<Schema.String>>;
413
+ readonly merged: Schema.optional<Schema.Boolean>;
414
+ readonly resumedAt: Schema.optional<Schema.NullOr<Schema.String>>;
415
+ readonly completedAt: Schema.optional<Schema.NullOr<Schema.String>>;
416
+ }>>>;
417
+ readonly model: Schema.optional<Schema.NullOr<Schema.Trim>>;
418
+ readonly runtimeMode: Schema.optional<Schema.NullOr<Schema.Trim>>;
419
+ readonly interactionMode: Schema.optional<Schema.NullOr<Schema.Trim>>;
420
+ readonly runMode: Schema.optional<Schema.NullOr<Schema.Trim>>;
421
+ readonly initialPrompt: Schema.optional<Schema.NullOr<Schema.String>>;
422
+ readonly baselineMode: Schema.optional<Schema.NullOr<Schema.Trim>>;
423
+ readonly prMode: Schema.optional<Schema.NullOr<Schema.Literals<readonly ["auto", "ask", "off"]>>>;
424
+ readonly initiatedBy: Schema.optional<Schema.NullOr<Schema.Trim>>;
425
+ readonly sourceTask: Schema.optional<Schema.Unknown>;
426
+ readonly serverPid: Schema.optional<Schema.NullOr<Schema.Int>>;
427
+ readonly latestSteeringAt: Schema.optional<Schema.NullOr<Schema.String>>;
428
+ readonly latestSteeringDeliveredAt: Schema.optional<Schema.NullOr<Schema.String>>;
429
+ readonly statusDetail: Schema.optional<Schema.NullOr<Schema.String>>;
430
+ readonly planning: Schema.optional<Schema.Unknown>;
431
+ readonly branch: Schema.optional<Schema.NullOr<Schema.Trim>>;
432
+ }>;
433
+ readonly v: Schema.Literal<1>;
434
+ readonly seq: Schema.Int;
435
+ readonly at: Schema.String;
436
+ readonly runId: Schema.brand<Schema.Trim, "RunId">;
437
+ }>, Schema.Struct<{
438
+ readonly type: Schema.Literal<"timeline-entry">;
439
+ readonly payload: Schema.Unknown;
440
+ readonly v: Schema.Literal<1>;
441
+ readonly seq: Schema.Int;
442
+ readonly at: Schema.String;
443
+ readonly runId: Schema.brand<Schema.Trim, "RunId">;
444
+ }>, Schema.Struct<{
445
+ readonly type: Schema.Literal<"log-entry">;
446
+ readonly payload: Schema.Unknown;
447
+ readonly v: Schema.Literal<1>;
448
+ readonly seq: Schema.Int;
449
+ readonly at: Schema.String;
450
+ readonly runId: Schema.brand<Schema.Trim, "RunId">;
451
+ }>, Schema.Struct<{
452
+ readonly type: Schema.Literal<"approval-requested">;
453
+ readonly requestId: Schema.Trim;
454
+ readonly requestKind: Schema.Trim;
455
+ readonly actionId: Schema.optional<Schema.NullOr<Schema.Trim>>;
456
+ readonly payload: Schema.Unknown;
457
+ readonly v: Schema.Literal<1>;
458
+ readonly seq: Schema.Int;
459
+ readonly at: Schema.String;
460
+ readonly runId: Schema.brand<Schema.Trim, "RunId">;
461
+ }>, Schema.Struct<{
462
+ readonly type: Schema.Literal<"approval-resolved">;
463
+ readonly requestId: Schema.Trim;
464
+ readonly decision: Schema.Literals<readonly ["approve", "reject"]>;
465
+ readonly note: Schema.optional<Schema.NullOr<Schema.String>>;
466
+ readonly actor: Schema.Struct<{
467
+ readonly kind: Schema.Literals<readonly ["operator", "agent", "server", "system"]>;
468
+ readonly id: Schema.optional<Schema.NullOr<Schema.Trim>>;
469
+ }>;
470
+ readonly v: Schema.Literal<1>;
471
+ readonly seq: Schema.Int;
472
+ readonly at: Schema.String;
473
+ readonly runId: Schema.brand<Schema.Trim, "RunId">;
474
+ }>, Schema.Struct<{
475
+ readonly type: Schema.Literal<"input-requested">;
476
+ readonly requestId: Schema.Trim;
477
+ readonly payload: Schema.Unknown;
478
+ readonly v: Schema.Literal<1>;
479
+ readonly seq: Schema.Int;
480
+ readonly at: Schema.String;
481
+ readonly runId: Schema.brand<Schema.Trim, "RunId">;
482
+ }>, Schema.Struct<{
483
+ readonly type: Schema.Literal<"input-resolved">;
484
+ readonly requestId: Schema.Trim;
485
+ readonly answers: Schema.$Record<Schema.String, Schema.String>;
486
+ readonly actor: Schema.Struct<{
487
+ readonly kind: Schema.Literals<readonly ["operator", "agent", "server", "system"]>;
488
+ readonly id: Schema.optional<Schema.NullOr<Schema.Trim>>;
489
+ }>;
490
+ readonly v: Schema.Literal<1>;
491
+ readonly seq: Schema.Int;
492
+ readonly at: Schema.String;
493
+ readonly runId: Schema.brand<Schema.Trim, "RunId">;
494
+ }>, Schema.Struct<{
495
+ readonly type: Schema.Literal<"steering">;
496
+ readonly actor: Schema.Struct<{
497
+ readonly kind: Schema.Literals<readonly ["operator", "agent", "server", "system"]>;
498
+ readonly id: Schema.optional<Schema.NullOr<Schema.Trim>>;
499
+ }>;
500
+ readonly text: Schema.String;
501
+ readonly v: Schema.Literal<1>;
502
+ readonly seq: Schema.Int;
503
+ readonly at: Schema.String;
504
+ readonly runId: Schema.brand<Schema.Trim, "RunId">;
505
+ }>, Schema.Struct<{
506
+ readonly type: Schema.Literal<"adopted">;
507
+ readonly pid: Schema.NullOr<Schema.Int>;
508
+ readonly serverPid: Schema.Int;
509
+ readonly v: Schema.Literal<1>;
510
+ readonly seq: Schema.Int;
511
+ readonly at: Schema.String;
512
+ readonly runId: Schema.brand<Schema.Trim, "RunId">;
513
+ }>, Schema.Struct<{
514
+ readonly type: Schema.Literal<"stall-detected">;
515
+ readonly detail: Schema.String;
516
+ readonly v: Schema.Literal<1>;
517
+ readonly seq: Schema.Int;
518
+ readonly at: Schema.String;
519
+ readonly runId: Schema.brand<Schema.Trim, "RunId">;
520
+ }>, Schema.Struct<{
521
+ readonly type: Schema.Literal<"closeout-phase">;
522
+ readonly phase: Schema.Literals<readonly ["queued", "commit", "push", "pr-review-merge", "pr-opened", "merge", "close-source", "completed"]>;
523
+ readonly outcome: Schema.Literals<readonly ["started", "completed", "failed"]>;
524
+ readonly detail: Schema.optional<Schema.NullOr<Schema.String>>;
525
+ readonly v: Schema.Literal<1>;
526
+ readonly seq: Schema.Int;
527
+ readonly at: Schema.String;
528
+ readonly runId: Schema.brand<Schema.Trim, "RunId">;
529
+ }>]>;
530
+ export type RunJournalEvent = typeof RunJournalEvent.Type;
531
+ export declare const decodeRunJournalEvent: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => {
532
+ readonly at: string;
533
+ readonly runId: string & import("effect/Brand").Brand<"RunId">;
534
+ readonly v: 1;
535
+ readonly type: "status-changed";
536
+ readonly from: "running" | "completed" | "queued" | "failed" | "stopped" | "created" | "preparing" | "waiting-approval" | "waiting-user-input" | "paused" | "validating" | "reviewing" | "closing-out" | "needs-attention" | null;
537
+ readonly to: "running" | "completed" | "queued" | "failed" | "stopped" | "created" | "preparing" | "waiting-approval" | "waiting-user-input" | "paused" | "validating" | "reviewing" | "closing-out" | "needs-attention";
538
+ readonly seq: number;
539
+ readonly reason?: string | null | undefined;
540
+ readonly actor?: {
541
+ readonly kind: "server" | "system" | "operator" | "agent";
542
+ readonly id?: string | null | undefined;
543
+ } | undefined;
544
+ } | {
545
+ readonly at: string;
546
+ readonly runId: string & import("effect/Brand").Brand<"RunId">;
547
+ readonly v: 1;
548
+ readonly type: "record-patch";
549
+ readonly seq: number;
550
+ readonly patch: {
551
+ readonly taskId?: string | null | undefined;
552
+ readonly runId?: string | undefined;
553
+ readonly createdAt?: string | undefined;
554
+ readonly title?: string | undefined;
555
+ readonly mode?: "local" | "remote" | undefined;
556
+ readonly model?: string | null | undefined;
557
+ readonly planning?: unknown;
558
+ readonly updatedAt?: string | undefined;
559
+ readonly completedAt?: string | null | undefined;
560
+ readonly startedAt?: string | null | undefined;
561
+ readonly workspaceId?: string | undefined;
562
+ readonly runtimeMode?: string | null | undefined;
563
+ readonly threadId?: string | null | undefined;
564
+ readonly interactionMode?: string | null | undefined;
565
+ readonly branch?: string | null | undefined;
566
+ readonly worktreePath?: string | null | undefined;
567
+ readonly initialPrompt?: string | null | undefined;
568
+ readonly latestMessageId?: string | null | undefined;
569
+ readonly errorText?: string | null | undefined;
570
+ readonly runtimeAdapter?: string | undefined;
571
+ readonly sessionLogPath?: string | null | undefined;
572
+ readonly pid?: number | null | undefined;
573
+ readonly endpointId?: string | null | undefined;
574
+ readonly hostId?: string | null | undefined;
575
+ readonly leaseId?: string | null | undefined;
576
+ readonly runMode?: string | null | undefined;
577
+ readonly prUrl?: string | null | undefined;
578
+ readonly artifactRoot?: string | null | undefined;
579
+ readonly logRoot?: string | null | undefined;
580
+ readonly sessionPath?: string | null | undefined;
581
+ readonly piSession?: unknown;
582
+ readonly piSessionPrivate?: unknown;
583
+ readonly projectRoot?: string | null | undefined;
584
+ readonly serverCloseout?: {
585
+ readonly status: "running" | "completed" | "failed" | "pending" | "needs-attention";
586
+ readonly updatedAt: string;
587
+ readonly phase: "push" | "merge" | "completed" | "queued" | "commit" | "pr-review-merge" | "pr-opened" | "close-source";
588
+ readonly taskId?: string | null | undefined;
589
+ readonly completedAt?: string | null | undefined;
590
+ readonly error?: string | null | undefined;
591
+ readonly reason?: string | null | undefined;
592
+ readonly branch?: string | null | undefined;
593
+ readonly merged?: boolean | undefined;
594
+ readonly runtimeWorkspace?: string | null | undefined;
595
+ readonly prUrl?: string | null | undefined;
596
+ readonly artifactRoot?: string | null | undefined;
597
+ readonly iterations?: number | null | undefined;
598
+ readonly feedback?: readonly string[] | undefined;
599
+ readonly resumedAt?: string | null | undefined;
600
+ } | null | undefined;
601
+ readonly baselineMode?: string | null | undefined;
602
+ readonly prMode?: "auto" | "off" | "ask" | null | undefined;
603
+ readonly initiatedBy?: string | null | undefined;
604
+ readonly sourceTask?: unknown;
605
+ readonly serverPid?: number | null | undefined;
606
+ readonly latestSteeringAt?: string | null | undefined;
607
+ readonly latestSteeringDeliveredAt?: string | null | undefined;
608
+ readonly statusDetail?: string | null | undefined;
609
+ };
610
+ } | {
611
+ readonly at: string;
612
+ readonly runId: string & import("effect/Brand").Brand<"RunId">;
613
+ readonly v: 1;
614
+ readonly payload: unknown;
615
+ readonly type: "timeline-entry";
616
+ readonly seq: number;
617
+ } | {
618
+ readonly at: string;
619
+ readonly runId: string & import("effect/Brand").Brand<"RunId">;
620
+ readonly v: 1;
621
+ readonly payload: unknown;
622
+ readonly type: "log-entry";
623
+ readonly seq: number;
624
+ } | {
625
+ readonly at: string;
626
+ readonly runId: string & import("effect/Brand").Brand<"RunId">;
627
+ readonly v: 1;
628
+ readonly payload: unknown;
629
+ readonly type: "approval-requested";
630
+ readonly requestId: string;
631
+ readonly requestKind: string;
632
+ readonly seq: number;
633
+ readonly actionId?: string | null | undefined;
634
+ } | {
635
+ readonly at: string;
636
+ readonly runId: string & import("effect/Brand").Brand<"RunId">;
637
+ readonly v: 1;
638
+ readonly decision: "approve" | "reject";
639
+ readonly type: "approval-resolved";
640
+ readonly requestId: string;
641
+ readonly actor: {
642
+ readonly kind: "server" | "system" | "operator" | "agent";
643
+ readonly id?: string | null | undefined;
644
+ };
645
+ readonly seq: number;
646
+ readonly note?: string | null | undefined;
647
+ } | {
648
+ readonly at: string;
649
+ readonly runId: string & import("effect/Brand").Brand<"RunId">;
650
+ readonly v: 1;
651
+ readonly payload: unknown;
652
+ readonly type: "input-requested";
653
+ readonly requestId: string;
654
+ readonly seq: number;
655
+ } | {
656
+ readonly at: string;
657
+ readonly runId: string & import("effect/Brand").Brand<"RunId">;
658
+ readonly v: 1;
659
+ readonly type: "input-resolved";
660
+ readonly requestId: string;
661
+ readonly answers: {
662
+ readonly [x: string]: string;
663
+ };
664
+ readonly actor: {
665
+ readonly kind: "server" | "system" | "operator" | "agent";
666
+ readonly id?: string | null | undefined;
667
+ };
668
+ readonly seq: number;
669
+ } | {
670
+ readonly at: string;
671
+ readonly runId: string & import("effect/Brand").Brand<"RunId">;
672
+ readonly v: 1;
673
+ readonly text: string;
674
+ readonly type: "steering";
675
+ readonly actor: {
676
+ readonly kind: "server" | "system" | "operator" | "agent";
677
+ readonly id?: string | null | undefined;
678
+ };
679
+ readonly seq: number;
680
+ } | {
681
+ readonly at: string;
682
+ readonly runId: string & import("effect/Brand").Brand<"RunId">;
683
+ readonly v: 1;
684
+ readonly type: "adopted";
685
+ readonly pid: number | null;
686
+ readonly serverPid: number;
687
+ readonly seq: number;
688
+ } | {
689
+ readonly at: string;
690
+ readonly runId: string & import("effect/Brand").Brand<"RunId">;
691
+ readonly v: 1;
692
+ readonly detail: string;
693
+ readonly type: "stall-detected";
694
+ readonly seq: number;
695
+ } | {
696
+ readonly at: string;
697
+ readonly runId: string & import("effect/Brand").Brand<"RunId">;
698
+ readonly v: 1;
699
+ readonly type: "closeout-phase";
700
+ readonly phase: "push" | "merge" | "completed" | "queued" | "commit" | "pr-review-merge" | "pr-opened" | "close-source";
701
+ readonly seq: number;
702
+ readonly outcome: "completed" | "failed" | "started";
703
+ readonly detail?: string | null | undefined;
704
+ };
705
+ export declare const RUN_STATUS_TRANSITIONS: Readonly<Record<RunStatus, readonly RunStatus[]>>;
706
+ export declare const TERMINAL_RUN_STATUSES: readonly RunStatus[];
707
+ export declare const ACTIVE_RUN_STATUSES: readonly RunStatus[];
708
+ export declare function isTerminalRunStatus(status: RunStatus): boolean;
709
+ export declare function isActiveRunStatus(status: RunStatus): boolean;
710
+ export declare function canTransitionRunStatus(from: RunStatus | null, to: RunStatus): boolean;
711
+ /** Writer-side guard: throws on an illegal transition so bugs fail loudly at the source. */
712
+ export declare function assertRunStatusTransition(from: RunStatus | null, to: RunStatus): void;
713
+ export type RunJournalAnomaly = {
714
+ seq: number;
715
+ kind: "illegal-transition" | "duplicate-resolution" | "unknown-request";
716
+ detail: string;
717
+ };
718
+ export type RunJournalPendingRequest = {
719
+ requestId: string;
720
+ requestKind: string;
721
+ actionId: string | null;
722
+ payload: unknown;
723
+ requestedAt: string;
724
+ };
725
+ export type RunJournalResolvedApproval = RunJournalPendingRequest & {
726
+ decision: ApprovalDecision;
727
+ note: string | null;
728
+ actor: RunActor;
729
+ resolvedAt: string;
730
+ };
731
+ export type RunJournalResolvedInput = RunJournalPendingRequest & {
732
+ answers: Readonly<Record<string, string>>;
733
+ actor: RunActor;
734
+ resolvedAt: string;
735
+ };
736
+ export type RunJournalProjection = {
737
+ record: Partial<RunJournalRecord>;
738
+ status: RunStatus | null;
739
+ statusHistory: ReadonlyArray<{
740
+ seq: number;
741
+ at: string;
742
+ from: RunStatus | null;
743
+ to: RunStatus;
744
+ reason: string | null;
745
+ }>;
746
+ pendingApprovals: ReadonlyArray<RunJournalPendingRequest>;
747
+ resolvedApprovals: ReadonlyArray<RunJournalResolvedApproval>;
748
+ pendingUserInputs: ReadonlyArray<RunJournalPendingRequest>;
749
+ resolvedUserInputs: ReadonlyArray<RunJournalResolvedInput>;
750
+ steeringCount: number;
751
+ stallCount: number;
752
+ closeoutPhases: ReadonlyArray<{
753
+ seq: number;
754
+ at: string;
755
+ phase: RunCloseoutPhase;
756
+ outcome: RunCloseoutPhaseOutcome;
757
+ detail: string | null;
758
+ }>;
759
+ lastSeq: number;
760
+ lastEventAt: string | null;
761
+ anomalies: ReadonlyArray<RunJournalAnomaly>;
762
+ };
763
+ export declare function reduceRunJournal(events: ReadonlyArray<RunJournalEvent>): RunJournalProjection;