hankweave 0.5.7 → 0.6.2

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 (79) hide show
  1. package/README.md +12 -11
  2. package/dist/base-process-manager.d.ts +30 -0
  3. package/dist/budget.d.ts +315 -0
  4. package/dist/checkpoint-git.d.ts +98 -0
  5. package/dist/claude-agent-sdk-manager.d.ts +144 -0
  6. package/dist/claude-log-parser.d.ts +63 -0
  7. package/dist/claude-runtime-extractor.d.ts +73 -0
  8. package/dist/codex-runtime-extractor.d.ts +107 -0
  9. package/dist/codon-runner.d.ts +278 -0
  10. package/dist/config-validation/model-validator.d.ts +16 -0
  11. package/dist/config-validation/sentinel.schema.d.ts +6967 -0
  12. package/dist/config.d.ts +40815 -0
  13. package/dist/cost-tracker.d.ts +72 -0
  14. package/dist/execution-planner.d.ts +62 -0
  15. package/dist/execution-thread.d.ts +71 -0
  16. package/dist/exports/schemas.d.ts +9 -0
  17. package/dist/exports/schemas.js +1019 -0
  18. package/dist/exports/types.d.ts +15 -0
  19. package/dist/exports/types.js +60 -0
  20. package/dist/file-resolver.d.ts +33 -0
  21. package/dist/index.js +380 -293
  22. package/dist/index.js.map +33 -29
  23. package/dist/llm/llm-provider-registry.d.ts +207 -0
  24. package/dist/llm/models-dev-schema.d.ts +679 -0
  25. package/dist/llm/provider-config.d.ts +30 -0
  26. package/dist/prompt-builder.d.ts +75 -0
  27. package/dist/prompt-frontmatter.d.ts +61 -0
  28. package/dist/replay-process-manager.d.ts +82 -0
  29. package/dist/runtime-extractor-base.d.ts +120 -0
  30. package/dist/schemas/event-schemas.d.ts +8389 -0
  31. package/dist/schemas/websocket-log-schemas.d.ts +4502 -0
  32. package/dist/shim-process-manager.d.ts +98 -0
  33. package/dist/shim-runtime-extractor.d.ts +51 -0
  34. package/dist/shims/codex/README.md +129 -0
  35. package/dist/shims/codex/THIRDPARTY.md +18 -0
  36. package/dist/shims/codex/VERSION +1 -0
  37. package/dist/shims/codex/common/package.json +24 -0
  38. package/dist/shims/codex/index.js +1154 -970
  39. package/dist/shims/codex/package.json +46 -0
  40. package/dist/shims/codex/tsup.config.ts +16 -0
  41. package/dist/shims/gemini/README.md +59 -0
  42. package/dist/shims/gemini/THIRDPARTY.md +32 -0
  43. package/dist/shims/gemini/VERSION +1 -0
  44. package/dist/shims/gemini/common/package.json +24 -0
  45. package/dist/shims/gemini/index.js +1359 -30
  46. package/dist/shims/gemini/package.json +37 -0
  47. package/dist/shims/opencode/README.md +82 -0
  48. package/dist/shims/opencode/THIRDPARTY.md +32 -0
  49. package/dist/shims/opencode/VERSION +1 -0
  50. package/dist/shims/opencode/common/package.json +24 -0
  51. package/dist/shims/opencode/index.js +1476 -0
  52. package/dist/shims/opencode/package.json +38 -0
  53. package/dist/shims/pi/README.md +87 -0
  54. package/dist/shims/pi/THIRDPARTY.md +24 -0
  55. package/dist/shims/pi/VERSION +1 -0
  56. package/dist/shims/pi/common/package.json +24 -0
  57. package/dist/shims/pi/index.js +249832 -0
  58. package/dist/shims/pi/package.json +53 -0
  59. package/dist/state-manager.d.ts +161 -0
  60. package/dist/state-transition-guards.d.ts +37 -0
  61. package/dist/telemetry/telemetry-types.d.ts +206 -0
  62. package/dist/typed-event-emitter.d.ts +57 -0
  63. package/dist/types/branded-types.d.ts +15 -0
  64. package/dist/types/budget-types.d.ts +82 -0
  65. package/dist/types/claude-session-schema.d.ts +2430 -0
  66. package/dist/types/error-types.d.ts +44 -0
  67. package/dist/types/input-ai-types.d.ts +1070 -0
  68. package/dist/types/llm-call-types.d.ts +3829 -0
  69. package/dist/types/sentinel-types.d.ts +66 -0
  70. package/dist/types/state-types.d.ts +1099 -0
  71. package/dist/types/tool-types.d.ts +86 -0
  72. package/dist/types/types.d.ts +367 -0
  73. package/dist/types/websocket-log-types.d.ts +7 -0
  74. package/dist/utils.d.ts +452 -0
  75. package/package.json +15 -2
  76. package/schemas/hank.schema.json +158 -3
  77. package/schemas/hankweave.schema.json +17 -1
  78. package/shims/codex/index.js +0 -1583
  79. package/shims/gemini/index.js +0 -31
@@ -0,0 +1,4502 @@
1
+ import { z } from "zod";
2
+ import { type ClientCommand, type ServerEvent } from "./event-schemas.js";
3
+ /**
4
+ * WebSocket log entry schema for JSONL logging.
5
+ *
6
+ * This wraps the actual WebSocket messages with minimal additional metadata.
7
+ * We avoid duplicating fields that already exist in the underlying packets
8
+ * (e.g., timestamp, id are already in ServerEvent).
9
+ */
10
+ export declare const webSocketLogEntrySchema: z.ZodObject<{
11
+ /** ISO 8601 timestamp of when the message was logged (not the message's own timestamp) */
12
+ loggedAt: z.ZodString;
13
+ /** Direction of the message flow */
14
+ direction: z.ZodEnum<["in", "out"]>;
15
+ /** The actual WebSocket message data */
16
+ message: z.ZodUnion<[z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
17
+ id: z.ZodString;
18
+ type: z.ZodLiteral<"codon.start">;
19
+ data: z.ZodObject<{
20
+ codonId: z.ZodString;
21
+ skipPreCommands: z.ZodOptional<z.ZodBoolean>;
22
+ }, "strip", z.ZodTypeAny, {
23
+ codonId: string;
24
+ skipPreCommands?: boolean | undefined;
25
+ }, {
26
+ codonId: string;
27
+ skipPreCommands?: boolean | undefined;
28
+ }>;
29
+ }, "strip", z.ZodTypeAny, {
30
+ type: "codon.start";
31
+ id: string;
32
+ data: {
33
+ codonId: string;
34
+ skipPreCommands?: boolean | undefined;
35
+ };
36
+ }, {
37
+ type: "codon.start";
38
+ id: string;
39
+ data: {
40
+ codonId: string;
41
+ skipPreCommands?: boolean | undefined;
42
+ };
43
+ }>, z.ZodObject<{
44
+ id: z.ZodString;
45
+ type: z.ZodLiteral<"codon.next">;
46
+ }, "strip", z.ZodTypeAny, {
47
+ type: "codon.next";
48
+ id: string;
49
+ }, {
50
+ type: "codon.next";
51
+ id: string;
52
+ }>, z.ZodObject<{
53
+ id: z.ZodString;
54
+ type: z.ZodLiteral<"codon.skip">;
55
+ }, "strip", z.ZodTypeAny, {
56
+ type: "codon.skip";
57
+ id: string;
58
+ }, {
59
+ type: "codon.skip";
60
+ id: string;
61
+ }>, z.ZodObject<{
62
+ id: z.ZodString;
63
+ type: z.ZodLiteral<"codon.redo">;
64
+ }, "strip", z.ZodTypeAny, {
65
+ type: "codon.redo";
66
+ id: string;
67
+ }, {
68
+ type: "codon.redo";
69
+ id: string;
70
+ }>, z.ZodObject<{
71
+ id: z.ZodString;
72
+ type: z.ZodLiteral<"server.shutdown">;
73
+ }, "strip", z.ZodTypeAny, {
74
+ type: "server.shutdown";
75
+ id: string;
76
+ }, {
77
+ type: "server.shutdown";
78
+ id: string;
79
+ }>, z.ZodObject<{
80
+ id: z.ZodString;
81
+ type: z.ZodLiteral<"codon.forceStop">;
82
+ data: z.ZodOptional<z.ZodObject<{
83
+ reason: z.ZodOptional<z.ZodString>;
84
+ }, "strip", z.ZodTypeAny, {
85
+ reason?: string | undefined;
86
+ }, {
87
+ reason?: string | undefined;
88
+ }>>;
89
+ }, "strip", z.ZodTypeAny, {
90
+ type: "codon.forceStop";
91
+ id: string;
92
+ data?: {
93
+ reason?: string | undefined;
94
+ } | undefined;
95
+ }, {
96
+ type: "codon.forceStop";
97
+ id: string;
98
+ data?: {
99
+ reason?: string | undefined;
100
+ } | undefined;
101
+ }>, z.ZodObject<{
102
+ id: z.ZodString;
103
+ type: z.ZodLiteral<"checkpoint.list">;
104
+ data: z.ZodOptional<z.ZodObject<{
105
+ runId: z.ZodOptional<z.ZodString>;
106
+ }, "strip", z.ZodTypeAny, {
107
+ runId?: string | undefined;
108
+ }, {
109
+ runId?: string | undefined;
110
+ }>>;
111
+ }, "strip", z.ZodTypeAny, {
112
+ type: "checkpoint.list";
113
+ id: string;
114
+ data?: {
115
+ runId?: string | undefined;
116
+ } | undefined;
117
+ }, {
118
+ type: "checkpoint.list";
119
+ id: string;
120
+ data?: {
121
+ runId?: string | undefined;
122
+ } | undefined;
123
+ }>, z.ZodObject<{
124
+ id: z.ZodString;
125
+ type: z.ZodLiteral<"rollback.toCheckpoint">;
126
+ data: z.ZodObject<{
127
+ checkpointSha: z.ZodString;
128
+ autoRestart: z.ZodOptional<z.ZodBoolean>;
129
+ }, "strip", z.ZodTypeAny, {
130
+ checkpointSha: string;
131
+ autoRestart?: boolean | undefined;
132
+ }, {
133
+ checkpointSha: string;
134
+ autoRestart?: boolean | undefined;
135
+ }>;
136
+ }, "strip", z.ZodTypeAny, {
137
+ type: "rollback.toCheckpoint";
138
+ id: string;
139
+ data: {
140
+ checkpointSha: string;
141
+ autoRestart?: boolean | undefined;
142
+ };
143
+ }, {
144
+ type: "rollback.toCheckpoint";
145
+ id: string;
146
+ data: {
147
+ checkpointSha: string;
148
+ autoRestart?: boolean | undefined;
149
+ };
150
+ }>, z.ZodObject<{
151
+ id: z.ZodString;
152
+ type: z.ZodLiteral<"rollback.toCodon">;
153
+ data: z.ZodObject<{
154
+ codonId: z.ZodString;
155
+ checkpointType: z.ZodEnum<["start", "end", "rig-setup", "completed", "error", "skipped"]>;
156
+ autoRestart: z.ZodOptional<z.ZodBoolean>;
157
+ }, "strip", z.ZodTypeAny, {
158
+ codonId: string;
159
+ checkpointType: "completed" | "skipped" | "error" | "rig-setup" | "start" | "end";
160
+ autoRestart?: boolean | undefined;
161
+ }, {
162
+ codonId: string;
163
+ checkpointType: "completed" | "skipped" | "error" | "rig-setup" | "start" | "end";
164
+ autoRestart?: boolean | undefined;
165
+ }>;
166
+ }, "strip", z.ZodTypeAny, {
167
+ type: "rollback.toCodon";
168
+ id: string;
169
+ data: {
170
+ codonId: string;
171
+ checkpointType: "completed" | "skipped" | "error" | "rig-setup" | "start" | "end";
172
+ autoRestart?: boolean | undefined;
173
+ };
174
+ }, {
175
+ type: "rollback.toCodon";
176
+ id: string;
177
+ data: {
178
+ codonId: string;
179
+ checkpointType: "completed" | "skipped" | "error" | "rig-setup" | "start" | "end";
180
+ autoRestart?: boolean | undefined;
181
+ };
182
+ }>, z.ZodObject<{
183
+ id: z.ZodString;
184
+ type: z.ZodLiteral<"rollback.toLastSuccess">;
185
+ data: z.ZodOptional<z.ZodObject<{
186
+ autoRestart: z.ZodOptional<z.ZodBoolean>;
187
+ }, "strip", z.ZodTypeAny, {
188
+ autoRestart?: boolean | undefined;
189
+ }, {
190
+ autoRestart?: boolean | undefined;
191
+ }>>;
192
+ }, "strip", z.ZodTypeAny, {
193
+ type: "rollback.toLastSuccess";
194
+ id: string;
195
+ data?: {
196
+ autoRestart?: boolean | undefined;
197
+ } | undefined;
198
+ }, {
199
+ type: "rollback.toLastSuccess";
200
+ id: string;
201
+ data?: {
202
+ autoRestart?: boolean | undefined;
203
+ } | undefined;
204
+ }>, z.ZodObject<{
205
+ id: z.ZodString;
206
+ type: z.ZodLiteral<"ping">;
207
+ }, "strip", z.ZodTypeAny, {
208
+ type: "ping";
209
+ id: string;
210
+ }, {
211
+ type: "ping";
212
+ id: string;
213
+ }>, z.ZodObject<{
214
+ id: z.ZodString;
215
+ type: z.ZodLiteral<"ping.broadcast">;
216
+ }, "strip", z.ZodTypeAny, {
217
+ type: "ping.broadcast";
218
+ id: string;
219
+ }, {
220
+ type: "ping.broadcast";
221
+ id: string;
222
+ }>, z.ZodObject<{
223
+ id: z.ZodString;
224
+ type: z.ZodLiteral<"history.sync">;
225
+ }, "strip", z.ZodTypeAny, {
226
+ type: "history.sync";
227
+ id: string;
228
+ }, {
229
+ type: "history.sync";
230
+ id: string;
231
+ }>]>, z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
232
+ id: z.ZodString;
233
+ timestamp: z.ZodString;
234
+ } & {
235
+ type: z.ZodLiteral<"server.ready">;
236
+ data: z.ZodObject<{
237
+ serverVersion: z.ZodString;
238
+ executionPath: z.ZodString;
239
+ agentRootPath: z.ZodString;
240
+ dataPath: z.ZodString;
241
+ port: z.ZodNumber;
242
+ proxyPort: z.ZodOptional<z.ZodNumber>;
243
+ outputDirectory: z.ZodOptional<z.ZodString>;
244
+ }, "strip", z.ZodTypeAny, {
245
+ serverVersion: string;
246
+ executionPath: string;
247
+ agentRootPath: string;
248
+ dataPath: string;
249
+ port: number;
250
+ proxyPort?: number | undefined;
251
+ outputDirectory?: string | undefined;
252
+ }, {
253
+ serverVersion: string;
254
+ executionPath: string;
255
+ agentRootPath: string;
256
+ dataPath: string;
257
+ port: number;
258
+ proxyPort?: number | undefined;
259
+ outputDirectory?: string | undefined;
260
+ }>;
261
+ }, "strip", z.ZodTypeAny, {
262
+ type: "server.ready";
263
+ id: string;
264
+ data: {
265
+ serverVersion: string;
266
+ executionPath: string;
267
+ agentRootPath: string;
268
+ dataPath: string;
269
+ port: number;
270
+ proxyPort?: number | undefined;
271
+ outputDirectory?: string | undefined;
272
+ };
273
+ timestamp: string;
274
+ }, {
275
+ type: "server.ready";
276
+ id: string;
277
+ data: {
278
+ serverVersion: string;
279
+ executionPath: string;
280
+ agentRootPath: string;
281
+ dataPath: string;
282
+ port: number;
283
+ proxyPort?: number | undefined;
284
+ outputDirectory?: string | undefined;
285
+ };
286
+ timestamp: string;
287
+ }>, z.ZodObject<{
288
+ id: z.ZodString;
289
+ timestamp: z.ZodString;
290
+ } & {
291
+ type: z.ZodLiteral<"state.snapshot">;
292
+ data: z.ZodObject<{
293
+ currentCodon: z.ZodOptional<z.ZodObject<{
294
+ codonId: z.ZodString;
295
+ codonName: z.ZodOptional<z.ZodString>;
296
+ status: z.ZodEnum<["preparing", "starting", "initializing", "running", "completing-sentinels", "completed", "failed", "skipped"]>;
297
+ startTime: z.ZodString;
298
+ endTime: z.ZodOptional<z.ZodString>;
299
+ sessionId: z.ZodOptional<z.ZodString>;
300
+ previousSessionId: z.ZodOptional<z.ZodString>;
301
+ claudeSessionId: z.ZodOptional<z.ZodString>;
302
+ tokenUsage: z.ZodOptional<z.ZodObject<{
303
+ inputTokens: z.ZodNumber;
304
+ outputTokens: z.ZodNumber;
305
+ cacheCreationTokens: z.ZodNumber;
306
+ cacheReadTokens: z.ZodNumber;
307
+ }, "strip", z.ZodTypeAny, {
308
+ outputTokens: number;
309
+ inputTokens: number;
310
+ cacheCreationTokens: number;
311
+ cacheReadTokens: number;
312
+ }, {
313
+ outputTokens: number;
314
+ inputTokens: number;
315
+ cacheCreationTokens: number;
316
+ cacheReadTokens: number;
317
+ }>>;
318
+ cost: z.ZodOptional<z.ZodNumber>;
319
+ duration: z.ZodOptional<z.ZodNumber>;
320
+ exitStatus: z.ZodOptional<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
321
+ type: z.ZodLiteral<"success">;
322
+ }, "strip", z.ZodTypeAny, {
323
+ type: "success";
324
+ }, {
325
+ type: "success";
326
+ }>, z.ZodObject<{
327
+ type: z.ZodLiteral<"error">;
328
+ code: z.ZodNumber;
329
+ }, "strip", z.ZodTypeAny, {
330
+ type: "error";
331
+ code: number;
332
+ }, {
333
+ type: "error";
334
+ code: number;
335
+ }>, z.ZodObject<{
336
+ type: z.ZodLiteral<"killed">;
337
+ signal: z.ZodString;
338
+ }, "strip", z.ZodTypeAny, {
339
+ type: "killed";
340
+ signal: string;
341
+ }, {
342
+ type: "killed";
343
+ signal: string;
344
+ }>]>>;
345
+ failureReason: z.ZodOptional<z.ZodObject<{
346
+ type: z.ZodEnum<["timeout", "rate-limit", "api-error", "sentinel-load-failure", "unknown"]>;
347
+ retriable: z.ZodBoolean;
348
+ message: z.ZodOptional<z.ZodString>;
349
+ sentinelRefs: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
350
+ }, "strip", z.ZodTypeAny, {
351
+ type: "unknown" | "timeout" | "rate-limit" | "api-error" | "sentinel-load-failure";
352
+ retriable: boolean;
353
+ message?: string | undefined;
354
+ sentinelRefs?: string[] | undefined;
355
+ }, {
356
+ type: "unknown" | "timeout" | "rate-limit" | "api-error" | "sentinel-load-failure";
357
+ retriable: boolean;
358
+ message?: string | undefined;
359
+ sentinelRefs?: string[] | undefined;
360
+ }>>;
361
+ description: z.ZodOptional<z.ZodString>;
362
+ finalCost: z.ZodOptional<z.ZodNumber>;
363
+ partialCost: z.ZodOptional<z.ZodNumber>;
364
+ currentCost: z.ZodOptional<z.ZodNumber>;
365
+ completionCheckpoint: z.ZodOptional<z.ZodString>;
366
+ rigSetupCheckpoint: z.ZodOptional<z.ZodString>;
367
+ errorCheckpoint: z.ZodOptional<z.ZodString>;
368
+ skipCheckpoint: z.ZodOptional<z.ZodString>;
369
+ }, "strip", z.ZodTypeAny, {
370
+ status: "completed" | "failed" | "skipped" | "running" | "preparing" | "starting" | "initializing" | "completing-sentinels";
371
+ codonId: string;
372
+ startTime: string;
373
+ cost?: number | undefined;
374
+ duration?: number | undefined;
375
+ description?: string | undefined;
376
+ codonName?: string | undefined;
377
+ endTime?: string | undefined;
378
+ sessionId?: string | undefined;
379
+ previousSessionId?: string | undefined;
380
+ claudeSessionId?: string | undefined;
381
+ tokenUsage?: {
382
+ outputTokens: number;
383
+ inputTokens: number;
384
+ cacheCreationTokens: number;
385
+ cacheReadTokens: number;
386
+ } | undefined;
387
+ exitStatus?: {
388
+ type: "success";
389
+ } | {
390
+ type: "error";
391
+ code: number;
392
+ } | {
393
+ type: "killed";
394
+ signal: string;
395
+ } | undefined;
396
+ failureReason?: {
397
+ type: "unknown" | "timeout" | "rate-limit" | "api-error" | "sentinel-load-failure";
398
+ retriable: boolean;
399
+ message?: string | undefined;
400
+ sentinelRefs?: string[] | undefined;
401
+ } | undefined;
402
+ finalCost?: number | undefined;
403
+ partialCost?: number | undefined;
404
+ currentCost?: number | undefined;
405
+ completionCheckpoint?: string | undefined;
406
+ rigSetupCheckpoint?: string | undefined;
407
+ errorCheckpoint?: string | undefined;
408
+ skipCheckpoint?: string | undefined;
409
+ }, {
410
+ status: "completed" | "failed" | "skipped" | "running" | "preparing" | "starting" | "initializing" | "completing-sentinels";
411
+ codonId: string;
412
+ startTime: string;
413
+ cost?: number | undefined;
414
+ duration?: number | undefined;
415
+ description?: string | undefined;
416
+ codonName?: string | undefined;
417
+ endTime?: string | undefined;
418
+ sessionId?: string | undefined;
419
+ previousSessionId?: string | undefined;
420
+ claudeSessionId?: string | undefined;
421
+ tokenUsage?: {
422
+ outputTokens: number;
423
+ inputTokens: number;
424
+ cacheCreationTokens: number;
425
+ cacheReadTokens: number;
426
+ } | undefined;
427
+ exitStatus?: {
428
+ type: "success";
429
+ } | {
430
+ type: "error";
431
+ code: number;
432
+ } | {
433
+ type: "killed";
434
+ signal: string;
435
+ } | undefined;
436
+ failureReason?: {
437
+ type: "unknown" | "timeout" | "rate-limit" | "api-error" | "sentinel-load-failure";
438
+ retriable: boolean;
439
+ message?: string | undefined;
440
+ sentinelRefs?: string[] | undefined;
441
+ } | undefined;
442
+ finalCost?: number | undefined;
443
+ partialCost?: number | undefined;
444
+ currentCost?: number | undefined;
445
+ completionCheckpoint?: string | undefined;
446
+ rigSetupCheckpoint?: string | undefined;
447
+ errorCheckpoint?: string | undefined;
448
+ skipCheckpoint?: string | undefined;
449
+ }>>;
450
+ completedCodons: z.ZodArray<z.ZodObject<{
451
+ codonId: z.ZodString;
452
+ codonName: z.ZodOptional<z.ZodString>;
453
+ status: z.ZodEnum<["preparing", "starting", "initializing", "running", "completing-sentinels", "completed", "failed", "skipped"]>;
454
+ startTime: z.ZodString;
455
+ endTime: z.ZodOptional<z.ZodString>;
456
+ sessionId: z.ZodOptional<z.ZodString>;
457
+ previousSessionId: z.ZodOptional<z.ZodString>;
458
+ claudeSessionId: z.ZodOptional<z.ZodString>;
459
+ tokenUsage: z.ZodOptional<z.ZodObject<{
460
+ inputTokens: z.ZodNumber;
461
+ outputTokens: z.ZodNumber;
462
+ cacheCreationTokens: z.ZodNumber;
463
+ cacheReadTokens: z.ZodNumber;
464
+ }, "strip", z.ZodTypeAny, {
465
+ outputTokens: number;
466
+ inputTokens: number;
467
+ cacheCreationTokens: number;
468
+ cacheReadTokens: number;
469
+ }, {
470
+ outputTokens: number;
471
+ inputTokens: number;
472
+ cacheCreationTokens: number;
473
+ cacheReadTokens: number;
474
+ }>>;
475
+ cost: z.ZodOptional<z.ZodNumber>;
476
+ duration: z.ZodOptional<z.ZodNumber>;
477
+ exitStatus: z.ZodOptional<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
478
+ type: z.ZodLiteral<"success">;
479
+ }, "strip", z.ZodTypeAny, {
480
+ type: "success";
481
+ }, {
482
+ type: "success";
483
+ }>, z.ZodObject<{
484
+ type: z.ZodLiteral<"error">;
485
+ code: z.ZodNumber;
486
+ }, "strip", z.ZodTypeAny, {
487
+ type: "error";
488
+ code: number;
489
+ }, {
490
+ type: "error";
491
+ code: number;
492
+ }>, z.ZodObject<{
493
+ type: z.ZodLiteral<"killed">;
494
+ signal: z.ZodString;
495
+ }, "strip", z.ZodTypeAny, {
496
+ type: "killed";
497
+ signal: string;
498
+ }, {
499
+ type: "killed";
500
+ signal: string;
501
+ }>]>>;
502
+ failureReason: z.ZodOptional<z.ZodObject<{
503
+ type: z.ZodEnum<["timeout", "rate-limit", "api-error", "sentinel-load-failure", "unknown"]>;
504
+ retriable: z.ZodBoolean;
505
+ message: z.ZodOptional<z.ZodString>;
506
+ sentinelRefs: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
507
+ }, "strip", z.ZodTypeAny, {
508
+ type: "unknown" | "timeout" | "rate-limit" | "api-error" | "sentinel-load-failure";
509
+ retriable: boolean;
510
+ message?: string | undefined;
511
+ sentinelRefs?: string[] | undefined;
512
+ }, {
513
+ type: "unknown" | "timeout" | "rate-limit" | "api-error" | "sentinel-load-failure";
514
+ retriable: boolean;
515
+ message?: string | undefined;
516
+ sentinelRefs?: string[] | undefined;
517
+ }>>;
518
+ description: z.ZodOptional<z.ZodString>;
519
+ finalCost: z.ZodOptional<z.ZodNumber>;
520
+ partialCost: z.ZodOptional<z.ZodNumber>;
521
+ currentCost: z.ZodOptional<z.ZodNumber>;
522
+ completionCheckpoint: z.ZodOptional<z.ZodString>;
523
+ rigSetupCheckpoint: z.ZodOptional<z.ZodString>;
524
+ errorCheckpoint: z.ZodOptional<z.ZodString>;
525
+ skipCheckpoint: z.ZodOptional<z.ZodString>;
526
+ }, "strip", z.ZodTypeAny, {
527
+ status: "completed" | "failed" | "skipped" | "running" | "preparing" | "starting" | "initializing" | "completing-sentinels";
528
+ codonId: string;
529
+ startTime: string;
530
+ cost?: number | undefined;
531
+ duration?: number | undefined;
532
+ description?: string | undefined;
533
+ codonName?: string | undefined;
534
+ endTime?: string | undefined;
535
+ sessionId?: string | undefined;
536
+ previousSessionId?: string | undefined;
537
+ claudeSessionId?: string | undefined;
538
+ tokenUsage?: {
539
+ outputTokens: number;
540
+ inputTokens: number;
541
+ cacheCreationTokens: number;
542
+ cacheReadTokens: number;
543
+ } | undefined;
544
+ exitStatus?: {
545
+ type: "success";
546
+ } | {
547
+ type: "error";
548
+ code: number;
549
+ } | {
550
+ type: "killed";
551
+ signal: string;
552
+ } | undefined;
553
+ failureReason?: {
554
+ type: "unknown" | "timeout" | "rate-limit" | "api-error" | "sentinel-load-failure";
555
+ retriable: boolean;
556
+ message?: string | undefined;
557
+ sentinelRefs?: string[] | undefined;
558
+ } | undefined;
559
+ finalCost?: number | undefined;
560
+ partialCost?: number | undefined;
561
+ currentCost?: number | undefined;
562
+ completionCheckpoint?: string | undefined;
563
+ rigSetupCheckpoint?: string | undefined;
564
+ errorCheckpoint?: string | undefined;
565
+ skipCheckpoint?: string | undefined;
566
+ }, {
567
+ status: "completed" | "failed" | "skipped" | "running" | "preparing" | "starting" | "initializing" | "completing-sentinels";
568
+ codonId: string;
569
+ startTime: string;
570
+ cost?: number | undefined;
571
+ duration?: number | undefined;
572
+ description?: string | undefined;
573
+ codonName?: string | undefined;
574
+ endTime?: string | undefined;
575
+ sessionId?: string | undefined;
576
+ previousSessionId?: string | undefined;
577
+ claudeSessionId?: string | undefined;
578
+ tokenUsage?: {
579
+ outputTokens: number;
580
+ inputTokens: number;
581
+ cacheCreationTokens: number;
582
+ cacheReadTokens: number;
583
+ } | undefined;
584
+ exitStatus?: {
585
+ type: "success";
586
+ } | {
587
+ type: "error";
588
+ code: number;
589
+ } | {
590
+ type: "killed";
591
+ signal: string;
592
+ } | undefined;
593
+ failureReason?: {
594
+ type: "unknown" | "timeout" | "rate-limit" | "api-error" | "sentinel-load-failure";
595
+ retriable: boolean;
596
+ message?: string | undefined;
597
+ sentinelRefs?: string[] | undefined;
598
+ } | undefined;
599
+ finalCost?: number | undefined;
600
+ partialCost?: number | undefined;
601
+ currentCost?: number | undefined;
602
+ completionCheckpoint?: string | undefined;
603
+ rigSetupCheckpoint?: string | undefined;
604
+ errorCheckpoint?: string | undefined;
605
+ skipCheckpoint?: string | undefined;
606
+ }>, "many">;
607
+ fileTree: z.ZodArray<z.ZodType<import("./event-schemas.js").FileNode, z.ZodTypeDef, import("./event-schemas.js").FileNode>, "many">;
608
+ totalCost: z.ZodNumber;
609
+ totalTime: z.ZodNumber;
610
+ recentFileAccess: z.ZodOptional<z.ZodObject<{
611
+ path: z.ZodString;
612
+ content: z.ZodString;
613
+ timestamp: z.ZodDate;
614
+ }, "strip", z.ZodTypeAny, {
615
+ path: string;
616
+ content: string;
617
+ timestamp: Date;
618
+ }, {
619
+ path: string;
620
+ content: string;
621
+ timestamp: Date;
622
+ }>>;
623
+ isRollingBack: z.ZodBoolean;
624
+ }, "strip", z.ZodTypeAny, {
625
+ completedCodons: {
626
+ status: "completed" | "failed" | "skipped" | "running" | "preparing" | "starting" | "initializing" | "completing-sentinels";
627
+ codonId: string;
628
+ startTime: string;
629
+ cost?: number | undefined;
630
+ duration?: number | undefined;
631
+ description?: string | undefined;
632
+ codonName?: string | undefined;
633
+ endTime?: string | undefined;
634
+ sessionId?: string | undefined;
635
+ previousSessionId?: string | undefined;
636
+ claudeSessionId?: string | undefined;
637
+ tokenUsage?: {
638
+ outputTokens: number;
639
+ inputTokens: number;
640
+ cacheCreationTokens: number;
641
+ cacheReadTokens: number;
642
+ } | undefined;
643
+ exitStatus?: {
644
+ type: "success";
645
+ } | {
646
+ type: "error";
647
+ code: number;
648
+ } | {
649
+ type: "killed";
650
+ signal: string;
651
+ } | undefined;
652
+ failureReason?: {
653
+ type: "unknown" | "timeout" | "rate-limit" | "api-error" | "sentinel-load-failure";
654
+ retriable: boolean;
655
+ message?: string | undefined;
656
+ sentinelRefs?: string[] | undefined;
657
+ } | undefined;
658
+ finalCost?: number | undefined;
659
+ partialCost?: number | undefined;
660
+ currentCost?: number | undefined;
661
+ completionCheckpoint?: string | undefined;
662
+ rigSetupCheckpoint?: string | undefined;
663
+ errorCheckpoint?: string | undefined;
664
+ skipCheckpoint?: string | undefined;
665
+ }[];
666
+ fileTree: import("./event-schemas.js").FileNode[];
667
+ totalCost: number;
668
+ totalTime: number;
669
+ isRollingBack: boolean;
670
+ currentCodon?: {
671
+ status: "completed" | "failed" | "skipped" | "running" | "preparing" | "starting" | "initializing" | "completing-sentinels";
672
+ codonId: string;
673
+ startTime: string;
674
+ cost?: number | undefined;
675
+ duration?: number | undefined;
676
+ description?: string | undefined;
677
+ codonName?: string | undefined;
678
+ endTime?: string | undefined;
679
+ sessionId?: string | undefined;
680
+ previousSessionId?: string | undefined;
681
+ claudeSessionId?: string | undefined;
682
+ tokenUsage?: {
683
+ outputTokens: number;
684
+ inputTokens: number;
685
+ cacheCreationTokens: number;
686
+ cacheReadTokens: number;
687
+ } | undefined;
688
+ exitStatus?: {
689
+ type: "success";
690
+ } | {
691
+ type: "error";
692
+ code: number;
693
+ } | {
694
+ type: "killed";
695
+ signal: string;
696
+ } | undefined;
697
+ failureReason?: {
698
+ type: "unknown" | "timeout" | "rate-limit" | "api-error" | "sentinel-load-failure";
699
+ retriable: boolean;
700
+ message?: string | undefined;
701
+ sentinelRefs?: string[] | undefined;
702
+ } | undefined;
703
+ finalCost?: number | undefined;
704
+ partialCost?: number | undefined;
705
+ currentCost?: number | undefined;
706
+ completionCheckpoint?: string | undefined;
707
+ rigSetupCheckpoint?: string | undefined;
708
+ errorCheckpoint?: string | undefined;
709
+ skipCheckpoint?: string | undefined;
710
+ } | undefined;
711
+ recentFileAccess?: {
712
+ path: string;
713
+ content: string;
714
+ timestamp: Date;
715
+ } | undefined;
716
+ }, {
717
+ completedCodons: {
718
+ status: "completed" | "failed" | "skipped" | "running" | "preparing" | "starting" | "initializing" | "completing-sentinels";
719
+ codonId: string;
720
+ startTime: string;
721
+ cost?: number | undefined;
722
+ duration?: number | undefined;
723
+ description?: string | undefined;
724
+ codonName?: string | undefined;
725
+ endTime?: string | undefined;
726
+ sessionId?: string | undefined;
727
+ previousSessionId?: string | undefined;
728
+ claudeSessionId?: string | undefined;
729
+ tokenUsage?: {
730
+ outputTokens: number;
731
+ inputTokens: number;
732
+ cacheCreationTokens: number;
733
+ cacheReadTokens: number;
734
+ } | undefined;
735
+ exitStatus?: {
736
+ type: "success";
737
+ } | {
738
+ type: "error";
739
+ code: number;
740
+ } | {
741
+ type: "killed";
742
+ signal: string;
743
+ } | undefined;
744
+ failureReason?: {
745
+ type: "unknown" | "timeout" | "rate-limit" | "api-error" | "sentinel-load-failure";
746
+ retriable: boolean;
747
+ message?: string | undefined;
748
+ sentinelRefs?: string[] | undefined;
749
+ } | undefined;
750
+ finalCost?: number | undefined;
751
+ partialCost?: number | undefined;
752
+ currentCost?: number | undefined;
753
+ completionCheckpoint?: string | undefined;
754
+ rigSetupCheckpoint?: string | undefined;
755
+ errorCheckpoint?: string | undefined;
756
+ skipCheckpoint?: string | undefined;
757
+ }[];
758
+ fileTree: import("./event-schemas.js").FileNode[];
759
+ totalCost: number;
760
+ totalTime: number;
761
+ isRollingBack: boolean;
762
+ currentCodon?: {
763
+ status: "completed" | "failed" | "skipped" | "running" | "preparing" | "starting" | "initializing" | "completing-sentinels";
764
+ codonId: string;
765
+ startTime: string;
766
+ cost?: number | undefined;
767
+ duration?: number | undefined;
768
+ description?: string | undefined;
769
+ codonName?: string | undefined;
770
+ endTime?: string | undefined;
771
+ sessionId?: string | undefined;
772
+ previousSessionId?: string | undefined;
773
+ claudeSessionId?: string | undefined;
774
+ tokenUsage?: {
775
+ outputTokens: number;
776
+ inputTokens: number;
777
+ cacheCreationTokens: number;
778
+ cacheReadTokens: number;
779
+ } | undefined;
780
+ exitStatus?: {
781
+ type: "success";
782
+ } | {
783
+ type: "error";
784
+ code: number;
785
+ } | {
786
+ type: "killed";
787
+ signal: string;
788
+ } | undefined;
789
+ failureReason?: {
790
+ type: "unknown" | "timeout" | "rate-limit" | "api-error" | "sentinel-load-failure";
791
+ retriable: boolean;
792
+ message?: string | undefined;
793
+ sentinelRefs?: string[] | undefined;
794
+ } | undefined;
795
+ finalCost?: number | undefined;
796
+ partialCost?: number | undefined;
797
+ currentCost?: number | undefined;
798
+ completionCheckpoint?: string | undefined;
799
+ rigSetupCheckpoint?: string | undefined;
800
+ errorCheckpoint?: string | undefined;
801
+ skipCheckpoint?: string | undefined;
802
+ } | undefined;
803
+ recentFileAccess?: {
804
+ path: string;
805
+ content: string;
806
+ timestamp: Date;
807
+ } | undefined;
808
+ }>;
809
+ }, "strip", z.ZodTypeAny, {
810
+ type: "state.snapshot";
811
+ id: string;
812
+ data: {
813
+ completedCodons: {
814
+ status: "completed" | "failed" | "skipped" | "running" | "preparing" | "starting" | "initializing" | "completing-sentinels";
815
+ codonId: string;
816
+ startTime: string;
817
+ cost?: number | undefined;
818
+ duration?: number | undefined;
819
+ description?: string | undefined;
820
+ codonName?: string | undefined;
821
+ endTime?: string | undefined;
822
+ sessionId?: string | undefined;
823
+ previousSessionId?: string | undefined;
824
+ claudeSessionId?: string | undefined;
825
+ tokenUsage?: {
826
+ outputTokens: number;
827
+ inputTokens: number;
828
+ cacheCreationTokens: number;
829
+ cacheReadTokens: number;
830
+ } | undefined;
831
+ exitStatus?: {
832
+ type: "success";
833
+ } | {
834
+ type: "error";
835
+ code: number;
836
+ } | {
837
+ type: "killed";
838
+ signal: string;
839
+ } | undefined;
840
+ failureReason?: {
841
+ type: "unknown" | "timeout" | "rate-limit" | "api-error" | "sentinel-load-failure";
842
+ retriable: boolean;
843
+ message?: string | undefined;
844
+ sentinelRefs?: string[] | undefined;
845
+ } | undefined;
846
+ finalCost?: number | undefined;
847
+ partialCost?: number | undefined;
848
+ currentCost?: number | undefined;
849
+ completionCheckpoint?: string | undefined;
850
+ rigSetupCheckpoint?: string | undefined;
851
+ errorCheckpoint?: string | undefined;
852
+ skipCheckpoint?: string | undefined;
853
+ }[];
854
+ fileTree: import("./event-schemas.js").FileNode[];
855
+ totalCost: number;
856
+ totalTime: number;
857
+ isRollingBack: boolean;
858
+ currentCodon?: {
859
+ status: "completed" | "failed" | "skipped" | "running" | "preparing" | "starting" | "initializing" | "completing-sentinels";
860
+ codonId: string;
861
+ startTime: string;
862
+ cost?: number | undefined;
863
+ duration?: number | undefined;
864
+ description?: string | undefined;
865
+ codonName?: string | undefined;
866
+ endTime?: string | undefined;
867
+ sessionId?: string | undefined;
868
+ previousSessionId?: string | undefined;
869
+ claudeSessionId?: string | undefined;
870
+ tokenUsage?: {
871
+ outputTokens: number;
872
+ inputTokens: number;
873
+ cacheCreationTokens: number;
874
+ cacheReadTokens: number;
875
+ } | undefined;
876
+ exitStatus?: {
877
+ type: "success";
878
+ } | {
879
+ type: "error";
880
+ code: number;
881
+ } | {
882
+ type: "killed";
883
+ signal: string;
884
+ } | undefined;
885
+ failureReason?: {
886
+ type: "unknown" | "timeout" | "rate-limit" | "api-error" | "sentinel-load-failure";
887
+ retriable: boolean;
888
+ message?: string | undefined;
889
+ sentinelRefs?: string[] | undefined;
890
+ } | undefined;
891
+ finalCost?: number | undefined;
892
+ partialCost?: number | undefined;
893
+ currentCost?: number | undefined;
894
+ completionCheckpoint?: string | undefined;
895
+ rigSetupCheckpoint?: string | undefined;
896
+ errorCheckpoint?: string | undefined;
897
+ skipCheckpoint?: string | undefined;
898
+ } | undefined;
899
+ recentFileAccess?: {
900
+ path: string;
901
+ content: string;
902
+ timestamp: Date;
903
+ } | undefined;
904
+ };
905
+ timestamp: string;
906
+ }, {
907
+ type: "state.snapshot";
908
+ id: string;
909
+ data: {
910
+ completedCodons: {
911
+ status: "completed" | "failed" | "skipped" | "running" | "preparing" | "starting" | "initializing" | "completing-sentinels";
912
+ codonId: string;
913
+ startTime: string;
914
+ cost?: number | undefined;
915
+ duration?: number | undefined;
916
+ description?: string | undefined;
917
+ codonName?: string | undefined;
918
+ endTime?: string | undefined;
919
+ sessionId?: string | undefined;
920
+ previousSessionId?: string | undefined;
921
+ claudeSessionId?: string | undefined;
922
+ tokenUsage?: {
923
+ outputTokens: number;
924
+ inputTokens: number;
925
+ cacheCreationTokens: number;
926
+ cacheReadTokens: number;
927
+ } | undefined;
928
+ exitStatus?: {
929
+ type: "success";
930
+ } | {
931
+ type: "error";
932
+ code: number;
933
+ } | {
934
+ type: "killed";
935
+ signal: string;
936
+ } | undefined;
937
+ failureReason?: {
938
+ type: "unknown" | "timeout" | "rate-limit" | "api-error" | "sentinel-load-failure";
939
+ retriable: boolean;
940
+ message?: string | undefined;
941
+ sentinelRefs?: string[] | undefined;
942
+ } | undefined;
943
+ finalCost?: number | undefined;
944
+ partialCost?: number | undefined;
945
+ currentCost?: number | undefined;
946
+ completionCheckpoint?: string | undefined;
947
+ rigSetupCheckpoint?: string | undefined;
948
+ errorCheckpoint?: string | undefined;
949
+ skipCheckpoint?: string | undefined;
950
+ }[];
951
+ fileTree: import("./event-schemas.js").FileNode[];
952
+ totalCost: number;
953
+ totalTime: number;
954
+ isRollingBack: boolean;
955
+ currentCodon?: {
956
+ status: "completed" | "failed" | "skipped" | "running" | "preparing" | "starting" | "initializing" | "completing-sentinels";
957
+ codonId: string;
958
+ startTime: string;
959
+ cost?: number | undefined;
960
+ duration?: number | undefined;
961
+ description?: string | undefined;
962
+ codonName?: string | undefined;
963
+ endTime?: string | undefined;
964
+ sessionId?: string | undefined;
965
+ previousSessionId?: string | undefined;
966
+ claudeSessionId?: string | undefined;
967
+ tokenUsage?: {
968
+ outputTokens: number;
969
+ inputTokens: number;
970
+ cacheCreationTokens: number;
971
+ cacheReadTokens: number;
972
+ } | undefined;
973
+ exitStatus?: {
974
+ type: "success";
975
+ } | {
976
+ type: "error";
977
+ code: number;
978
+ } | {
979
+ type: "killed";
980
+ signal: string;
981
+ } | undefined;
982
+ failureReason?: {
983
+ type: "unknown" | "timeout" | "rate-limit" | "api-error" | "sentinel-load-failure";
984
+ retriable: boolean;
985
+ message?: string | undefined;
986
+ sentinelRefs?: string[] | undefined;
987
+ } | undefined;
988
+ finalCost?: number | undefined;
989
+ partialCost?: number | undefined;
990
+ currentCost?: number | undefined;
991
+ completionCheckpoint?: string | undefined;
992
+ rigSetupCheckpoint?: string | undefined;
993
+ errorCheckpoint?: string | undefined;
994
+ skipCheckpoint?: string | undefined;
995
+ } | undefined;
996
+ recentFileAccess?: {
997
+ path: string;
998
+ content: string;
999
+ timestamp: Date;
1000
+ } | undefined;
1001
+ };
1002
+ timestamp: string;
1003
+ }>, z.ZodObject<{
1004
+ id: z.ZodString;
1005
+ timestamp: z.ZodString;
1006
+ } & {
1007
+ type: z.ZodLiteral<"codon.started">;
1008
+ data: z.ZodObject<{
1009
+ codonId: z.ZodString;
1010
+ codonName: z.ZodString;
1011
+ codonDescription: z.ZodOptional<z.ZodString>;
1012
+ sessionId: z.ZodString;
1013
+ previousSessionId: z.ZodOptional<z.ZodString>;
1014
+ startTime: z.ZodString;
1015
+ promptMetadata: z.ZodOptional<z.ZodObject<{
1016
+ name: z.ZodOptional<z.ZodString>;
1017
+ description: z.ZodOptional<z.ZodString>;
1018
+ tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1019
+ version: z.ZodOptional<z.ZodString>;
1020
+ author: z.ZodOptional<z.ZodString>;
1021
+ }, "strip", z.ZodTypeAny, {
1022
+ name?: string | undefined;
1023
+ description?: string | undefined;
1024
+ tags?: string[] | undefined;
1025
+ version?: string | undefined;
1026
+ author?: string | undefined;
1027
+ }, {
1028
+ name?: string | undefined;
1029
+ description?: string | undefined;
1030
+ tags?: string[] | undefined;
1031
+ version?: string | undefined;
1032
+ author?: string | undefined;
1033
+ }>>;
1034
+ }, "strip", z.ZodTypeAny, {
1035
+ codonId: string;
1036
+ codonName: string;
1037
+ startTime: string;
1038
+ sessionId: string;
1039
+ previousSessionId?: string | undefined;
1040
+ codonDescription?: string | undefined;
1041
+ promptMetadata?: {
1042
+ name?: string | undefined;
1043
+ description?: string | undefined;
1044
+ tags?: string[] | undefined;
1045
+ version?: string | undefined;
1046
+ author?: string | undefined;
1047
+ } | undefined;
1048
+ }, {
1049
+ codonId: string;
1050
+ codonName: string;
1051
+ startTime: string;
1052
+ sessionId: string;
1053
+ previousSessionId?: string | undefined;
1054
+ codonDescription?: string | undefined;
1055
+ promptMetadata?: {
1056
+ name?: string | undefined;
1057
+ description?: string | undefined;
1058
+ tags?: string[] | undefined;
1059
+ version?: string | undefined;
1060
+ author?: string | undefined;
1061
+ } | undefined;
1062
+ }>;
1063
+ }, "strip", z.ZodTypeAny, {
1064
+ type: "codon.started";
1065
+ id: string;
1066
+ data: {
1067
+ codonId: string;
1068
+ codonName: string;
1069
+ startTime: string;
1070
+ sessionId: string;
1071
+ previousSessionId?: string | undefined;
1072
+ codonDescription?: string | undefined;
1073
+ promptMetadata?: {
1074
+ name?: string | undefined;
1075
+ description?: string | undefined;
1076
+ tags?: string[] | undefined;
1077
+ version?: string | undefined;
1078
+ author?: string | undefined;
1079
+ } | undefined;
1080
+ };
1081
+ timestamp: string;
1082
+ }, {
1083
+ type: "codon.started";
1084
+ id: string;
1085
+ data: {
1086
+ codonId: string;
1087
+ codonName: string;
1088
+ startTime: string;
1089
+ sessionId: string;
1090
+ previousSessionId?: string | undefined;
1091
+ codonDescription?: string | undefined;
1092
+ promptMetadata?: {
1093
+ name?: string | undefined;
1094
+ description?: string | undefined;
1095
+ tags?: string[] | undefined;
1096
+ version?: string | undefined;
1097
+ author?: string | undefined;
1098
+ } | undefined;
1099
+ };
1100
+ timestamp: string;
1101
+ }>, z.ZodObject<{
1102
+ id: z.ZodString;
1103
+ timestamp: z.ZodString;
1104
+ } & {
1105
+ type: z.ZodLiteral<"codon.completed">;
1106
+ data: z.ZodObject<{
1107
+ codonId: z.ZodString;
1108
+ success: z.ZodBoolean;
1109
+ cost: z.ZodNumber;
1110
+ duration: z.ZodNumber;
1111
+ exitStatus: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
1112
+ type: z.ZodLiteral<"success">;
1113
+ }, "strip", z.ZodTypeAny, {
1114
+ type: "success";
1115
+ }, {
1116
+ type: "success";
1117
+ }>, z.ZodObject<{
1118
+ type: z.ZodLiteral<"error">;
1119
+ code: z.ZodNumber;
1120
+ }, "strip", z.ZodTypeAny, {
1121
+ type: "error";
1122
+ code: number;
1123
+ }, {
1124
+ type: "error";
1125
+ code: number;
1126
+ }>, z.ZodObject<{
1127
+ type: z.ZodLiteral<"killed">;
1128
+ signal: z.ZodString;
1129
+ }, "strip", z.ZodTypeAny, {
1130
+ type: "killed";
1131
+ signal: string;
1132
+ }, {
1133
+ type: "killed";
1134
+ signal: string;
1135
+ }>]>;
1136
+ failureReason: z.ZodOptional<z.ZodObject<{
1137
+ type: z.ZodEnum<["timeout", "rate-limit", "api-error", "sentinel-load-failure", "unknown"]>;
1138
+ retriable: z.ZodBoolean;
1139
+ message: z.ZodOptional<z.ZodString>;
1140
+ sentinelRefs: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1141
+ }, "strip", z.ZodTypeAny, {
1142
+ type: "unknown" | "timeout" | "rate-limit" | "api-error" | "sentinel-load-failure";
1143
+ retriable: boolean;
1144
+ message?: string | undefined;
1145
+ sentinelRefs?: string[] | undefined;
1146
+ }, {
1147
+ type: "unknown" | "timeout" | "rate-limit" | "api-error" | "sentinel-load-failure";
1148
+ retriable: boolean;
1149
+ message?: string | undefined;
1150
+ sentinelRefs?: string[] | undefined;
1151
+ }>>;
1152
+ failureIgnored: z.ZodOptional<z.ZodBoolean>;
1153
+ budgetExceeded: z.ZodOptional<z.ZodObject<{
1154
+ currency: z.ZodEnum<["cost", "duration", "outputTokens", "contextTokens"]>;
1155
+ limit: z.ZodNumber;
1156
+ used: z.ZodNumber;
1157
+ }, "strip", z.ZodTypeAny, {
1158
+ currency: "cost" | "duration" | "outputTokens" | "contextTokens";
1159
+ limit: number;
1160
+ used: number;
1161
+ }, {
1162
+ currency: "cost" | "duration" | "outputTokens" | "contextTokens";
1163
+ limit: number;
1164
+ used: number;
1165
+ }>>;
1166
+ }, "strip", z.ZodTypeAny, {
1167
+ cost: number;
1168
+ duration: number;
1169
+ success: boolean;
1170
+ codonId: string;
1171
+ exitStatus: {
1172
+ type: "success";
1173
+ } | {
1174
+ type: "error";
1175
+ code: number;
1176
+ } | {
1177
+ type: "killed";
1178
+ signal: string;
1179
+ };
1180
+ failureReason?: {
1181
+ type: "unknown" | "timeout" | "rate-limit" | "api-error" | "sentinel-load-failure";
1182
+ retriable: boolean;
1183
+ message?: string | undefined;
1184
+ sentinelRefs?: string[] | undefined;
1185
+ } | undefined;
1186
+ failureIgnored?: boolean | undefined;
1187
+ budgetExceeded?: {
1188
+ currency: "cost" | "duration" | "outputTokens" | "contextTokens";
1189
+ limit: number;
1190
+ used: number;
1191
+ } | undefined;
1192
+ }, {
1193
+ cost: number;
1194
+ duration: number;
1195
+ success: boolean;
1196
+ codonId: string;
1197
+ exitStatus: {
1198
+ type: "success";
1199
+ } | {
1200
+ type: "error";
1201
+ code: number;
1202
+ } | {
1203
+ type: "killed";
1204
+ signal: string;
1205
+ };
1206
+ failureReason?: {
1207
+ type: "unknown" | "timeout" | "rate-limit" | "api-error" | "sentinel-load-failure";
1208
+ retriable: boolean;
1209
+ message?: string | undefined;
1210
+ sentinelRefs?: string[] | undefined;
1211
+ } | undefined;
1212
+ failureIgnored?: boolean | undefined;
1213
+ budgetExceeded?: {
1214
+ currency: "cost" | "duration" | "outputTokens" | "contextTokens";
1215
+ limit: number;
1216
+ used: number;
1217
+ } | undefined;
1218
+ }>;
1219
+ }, "strip", z.ZodTypeAny, {
1220
+ type: "codon.completed";
1221
+ id: string;
1222
+ data: {
1223
+ cost: number;
1224
+ duration: number;
1225
+ success: boolean;
1226
+ codonId: string;
1227
+ exitStatus: {
1228
+ type: "success";
1229
+ } | {
1230
+ type: "error";
1231
+ code: number;
1232
+ } | {
1233
+ type: "killed";
1234
+ signal: string;
1235
+ };
1236
+ failureReason?: {
1237
+ type: "unknown" | "timeout" | "rate-limit" | "api-error" | "sentinel-load-failure";
1238
+ retriable: boolean;
1239
+ message?: string | undefined;
1240
+ sentinelRefs?: string[] | undefined;
1241
+ } | undefined;
1242
+ failureIgnored?: boolean | undefined;
1243
+ budgetExceeded?: {
1244
+ currency: "cost" | "duration" | "outputTokens" | "contextTokens";
1245
+ limit: number;
1246
+ used: number;
1247
+ } | undefined;
1248
+ };
1249
+ timestamp: string;
1250
+ }, {
1251
+ type: "codon.completed";
1252
+ id: string;
1253
+ data: {
1254
+ cost: number;
1255
+ duration: number;
1256
+ success: boolean;
1257
+ codonId: string;
1258
+ exitStatus: {
1259
+ type: "success";
1260
+ } | {
1261
+ type: "error";
1262
+ code: number;
1263
+ } | {
1264
+ type: "killed";
1265
+ signal: string;
1266
+ };
1267
+ failureReason?: {
1268
+ type: "unknown" | "timeout" | "rate-limit" | "api-error" | "sentinel-load-failure";
1269
+ retriable: boolean;
1270
+ message?: string | undefined;
1271
+ sentinelRefs?: string[] | undefined;
1272
+ } | undefined;
1273
+ failureIgnored?: boolean | undefined;
1274
+ budgetExceeded?: {
1275
+ currency: "cost" | "duration" | "outputTokens" | "contextTokens";
1276
+ limit: number;
1277
+ used: number;
1278
+ } | undefined;
1279
+ };
1280
+ timestamp: string;
1281
+ }>, z.ZodObject<{
1282
+ id: z.ZodString;
1283
+ timestamp: z.ZodString;
1284
+ } & {
1285
+ type: z.ZodLiteral<"codon.extended">;
1286
+ data: z.ZodObject<{
1287
+ codonId: z.ZodString;
1288
+ codonName: z.ZodString;
1289
+ extensionNumber: z.ZodNumber;
1290
+ exhaustWithPrompt: z.ZodString;
1291
+ cumulativeTokens: z.ZodObject<{
1292
+ inputTokens: z.ZodNumber;
1293
+ outputTokens: z.ZodNumber;
1294
+ cacheCreationTokens: z.ZodNumber;
1295
+ cacheReadTokens: z.ZodNumber;
1296
+ }, "strip", z.ZodTypeAny, {
1297
+ outputTokens: number;
1298
+ inputTokens: number;
1299
+ cacheCreationTokens: number;
1300
+ cacheReadTokens: number;
1301
+ }, {
1302
+ outputTokens: number;
1303
+ inputTokens: number;
1304
+ cacheCreationTokens: number;
1305
+ cacheReadTokens: number;
1306
+ }>;
1307
+ cumulativeCost: z.ZodNumber;
1308
+ }, "strip", z.ZodTypeAny, {
1309
+ codonId: string;
1310
+ codonName: string;
1311
+ extensionNumber: number;
1312
+ exhaustWithPrompt: string;
1313
+ cumulativeTokens: {
1314
+ outputTokens: number;
1315
+ inputTokens: number;
1316
+ cacheCreationTokens: number;
1317
+ cacheReadTokens: number;
1318
+ };
1319
+ cumulativeCost: number;
1320
+ }, {
1321
+ codonId: string;
1322
+ codonName: string;
1323
+ extensionNumber: number;
1324
+ exhaustWithPrompt: string;
1325
+ cumulativeTokens: {
1326
+ outputTokens: number;
1327
+ inputTokens: number;
1328
+ cacheCreationTokens: number;
1329
+ cacheReadTokens: number;
1330
+ };
1331
+ cumulativeCost: number;
1332
+ }>;
1333
+ }, "strip", z.ZodTypeAny, {
1334
+ type: "codon.extended";
1335
+ id: string;
1336
+ data: {
1337
+ codonId: string;
1338
+ codonName: string;
1339
+ extensionNumber: number;
1340
+ exhaustWithPrompt: string;
1341
+ cumulativeTokens: {
1342
+ outputTokens: number;
1343
+ inputTokens: number;
1344
+ cacheCreationTokens: number;
1345
+ cacheReadTokens: number;
1346
+ };
1347
+ cumulativeCost: number;
1348
+ };
1349
+ timestamp: string;
1350
+ }, {
1351
+ type: "codon.extended";
1352
+ id: string;
1353
+ data: {
1354
+ codonId: string;
1355
+ codonName: string;
1356
+ extensionNumber: number;
1357
+ exhaustWithPrompt: string;
1358
+ cumulativeTokens: {
1359
+ outputTokens: number;
1360
+ inputTokens: number;
1361
+ cacheCreationTokens: number;
1362
+ cacheReadTokens: number;
1363
+ };
1364
+ cumulativeCost: number;
1365
+ };
1366
+ timestamp: string;
1367
+ }>, z.ZodObject<{
1368
+ id: z.ZodString;
1369
+ timestamp: z.ZodString;
1370
+ } & {
1371
+ type: z.ZodLiteral<"assistant.action">;
1372
+ data: z.ZodObject<{
1373
+ codonId: z.ZodString;
1374
+ action: z.ZodEnum<["thinking", "message", "tool_use"]>;
1375
+ content: z.ZodString;
1376
+ toolName: z.ZodOptional<z.ZodString>;
1377
+ toolInput: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1378
+ }, "strip", z.ZodTypeAny, {
1379
+ content: string;
1380
+ codonId: string;
1381
+ action: "message" | "tool_use" | "thinking";
1382
+ toolName?: string | undefined;
1383
+ toolInput?: Record<string, unknown> | undefined;
1384
+ }, {
1385
+ content: string;
1386
+ codonId: string;
1387
+ action: "message" | "tool_use" | "thinking";
1388
+ toolName?: string | undefined;
1389
+ toolInput?: Record<string, unknown> | undefined;
1390
+ }>;
1391
+ }, "strip", z.ZodTypeAny, {
1392
+ type: "assistant.action";
1393
+ id: string;
1394
+ data: {
1395
+ content: string;
1396
+ codonId: string;
1397
+ action: "message" | "tool_use" | "thinking";
1398
+ toolName?: string | undefined;
1399
+ toolInput?: Record<string, unknown> | undefined;
1400
+ };
1401
+ timestamp: string;
1402
+ }, {
1403
+ type: "assistant.action";
1404
+ id: string;
1405
+ data: {
1406
+ content: string;
1407
+ codonId: string;
1408
+ action: "message" | "tool_use" | "thinking";
1409
+ toolName?: string | undefined;
1410
+ toolInput?: Record<string, unknown> | undefined;
1411
+ };
1412
+ timestamp: string;
1413
+ }>, z.ZodObject<{
1414
+ id: z.ZodString;
1415
+ timestamp: z.ZodString;
1416
+ } & {
1417
+ type: z.ZodLiteral<"token.usage">;
1418
+ data: z.ZodObject<{
1419
+ codonId: z.ZodString;
1420
+ inputTokens: z.ZodNumber;
1421
+ outputTokens: z.ZodNumber;
1422
+ cacheCreationTokens: z.ZodNumber;
1423
+ cacheReadTokens: z.ZodNumber;
1424
+ totalCost: z.ZodNumber;
1425
+ modelId: z.ZodOptional<z.ZodString>;
1426
+ modelUsage: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
1427
+ inputTokens: z.ZodNumber;
1428
+ outputTokens: z.ZodNumber;
1429
+ cacheReadInputTokens: z.ZodOptional<z.ZodNumber>;
1430
+ cacheCreationInputTokens: z.ZodOptional<z.ZodNumber>;
1431
+ costUSD: z.ZodNumber;
1432
+ }, "strip", z.ZodTypeAny, {
1433
+ outputTokens: number;
1434
+ inputTokens: number;
1435
+ costUSD: number;
1436
+ cacheReadInputTokens?: number | undefined;
1437
+ cacheCreationInputTokens?: number | undefined;
1438
+ }, {
1439
+ outputTokens: number;
1440
+ inputTokens: number;
1441
+ costUSD: number;
1442
+ cacheReadInputTokens?: number | undefined;
1443
+ cacheCreationInputTokens?: number | undefined;
1444
+ }>>>;
1445
+ }, "strip", z.ZodTypeAny, {
1446
+ outputTokens: number;
1447
+ inputTokens: number;
1448
+ codonId: string;
1449
+ cacheCreationTokens: number;
1450
+ cacheReadTokens: number;
1451
+ totalCost: number;
1452
+ modelId?: string | undefined;
1453
+ modelUsage?: Record<string, {
1454
+ outputTokens: number;
1455
+ inputTokens: number;
1456
+ costUSD: number;
1457
+ cacheReadInputTokens?: number | undefined;
1458
+ cacheCreationInputTokens?: number | undefined;
1459
+ }> | undefined;
1460
+ }, {
1461
+ outputTokens: number;
1462
+ inputTokens: number;
1463
+ codonId: string;
1464
+ cacheCreationTokens: number;
1465
+ cacheReadTokens: number;
1466
+ totalCost: number;
1467
+ modelId?: string | undefined;
1468
+ modelUsage?: Record<string, {
1469
+ outputTokens: number;
1470
+ inputTokens: number;
1471
+ costUSD: number;
1472
+ cacheReadInputTokens?: number | undefined;
1473
+ cacheCreationInputTokens?: number | undefined;
1474
+ }> | undefined;
1475
+ }>;
1476
+ }, "strip", z.ZodTypeAny, {
1477
+ type: "token.usage";
1478
+ id: string;
1479
+ data: {
1480
+ outputTokens: number;
1481
+ inputTokens: number;
1482
+ codonId: string;
1483
+ cacheCreationTokens: number;
1484
+ cacheReadTokens: number;
1485
+ totalCost: number;
1486
+ modelId?: string | undefined;
1487
+ modelUsage?: Record<string, {
1488
+ outputTokens: number;
1489
+ inputTokens: number;
1490
+ costUSD: number;
1491
+ cacheReadInputTokens?: number | undefined;
1492
+ cacheCreationInputTokens?: number | undefined;
1493
+ }> | undefined;
1494
+ };
1495
+ timestamp: string;
1496
+ }, {
1497
+ type: "token.usage";
1498
+ id: string;
1499
+ data: {
1500
+ outputTokens: number;
1501
+ inputTokens: number;
1502
+ codonId: string;
1503
+ cacheCreationTokens: number;
1504
+ cacheReadTokens: number;
1505
+ totalCost: number;
1506
+ modelId?: string | undefined;
1507
+ modelUsage?: Record<string, {
1508
+ outputTokens: number;
1509
+ inputTokens: number;
1510
+ costUSD: number;
1511
+ cacheReadInputTokens?: number | undefined;
1512
+ cacheCreationInputTokens?: number | undefined;
1513
+ }> | undefined;
1514
+ };
1515
+ timestamp: string;
1516
+ }>, z.ZodObject<{
1517
+ id: z.ZodString;
1518
+ timestamp: z.ZodString;
1519
+ } & {
1520
+ type: z.ZodLiteral<"tool.result">;
1521
+ data: z.ZodObject<{
1522
+ codonId: z.ZodString;
1523
+ toolUseId: z.ZodString;
1524
+ toolName: z.ZodString;
1525
+ result: z.ZodString;
1526
+ truncated: z.ZodBoolean;
1527
+ originalLength: z.ZodNumber;
1528
+ executionTimeMs: z.ZodNumber;
1529
+ isError: z.ZodBoolean;
1530
+ }, "strip", z.ZodTypeAny, {
1531
+ result: string;
1532
+ toolName: string;
1533
+ isError: boolean;
1534
+ codonId: string;
1535
+ toolUseId: string;
1536
+ truncated: boolean;
1537
+ originalLength: number;
1538
+ executionTimeMs: number;
1539
+ }, {
1540
+ result: string;
1541
+ toolName: string;
1542
+ isError: boolean;
1543
+ codonId: string;
1544
+ toolUseId: string;
1545
+ truncated: boolean;
1546
+ originalLength: number;
1547
+ executionTimeMs: number;
1548
+ }>;
1549
+ }, "strip", z.ZodTypeAny, {
1550
+ type: "tool.result";
1551
+ id: string;
1552
+ data: {
1553
+ result: string;
1554
+ toolName: string;
1555
+ isError: boolean;
1556
+ codonId: string;
1557
+ toolUseId: string;
1558
+ truncated: boolean;
1559
+ originalLength: number;
1560
+ executionTimeMs: number;
1561
+ };
1562
+ timestamp: string;
1563
+ }, {
1564
+ type: "tool.result";
1565
+ id: string;
1566
+ data: {
1567
+ result: string;
1568
+ toolName: string;
1569
+ isError: boolean;
1570
+ codonId: string;
1571
+ toolUseId: string;
1572
+ truncated: boolean;
1573
+ originalLength: number;
1574
+ executionTimeMs: number;
1575
+ };
1576
+ timestamp: string;
1577
+ }>, z.ZodObject<{
1578
+ id: z.ZodString;
1579
+ timestamp: z.ZodString;
1580
+ } & {
1581
+ type: z.ZodLiteral<"file.updated">;
1582
+ data: z.ZodObject<{
1583
+ path: z.ZodString;
1584
+ filename: z.ZodString;
1585
+ content: z.ZodString;
1586
+ action: z.ZodEnum<["created", "modified", "deleted"]>;
1587
+ }, "strip", z.ZodTypeAny, {
1588
+ path: string;
1589
+ content: string;
1590
+ filename: string;
1591
+ action: "created" | "modified" | "deleted";
1592
+ }, {
1593
+ path: string;
1594
+ content: string;
1595
+ filename: string;
1596
+ action: "created" | "modified" | "deleted";
1597
+ }>;
1598
+ }, "strip", z.ZodTypeAny, {
1599
+ type: "file.updated";
1600
+ id: string;
1601
+ data: {
1602
+ path: string;
1603
+ content: string;
1604
+ filename: string;
1605
+ action: "created" | "modified" | "deleted";
1606
+ };
1607
+ timestamp: string;
1608
+ }, {
1609
+ type: "file.updated";
1610
+ id: string;
1611
+ data: {
1612
+ path: string;
1613
+ content: string;
1614
+ filename: string;
1615
+ action: "created" | "modified" | "deleted";
1616
+ };
1617
+ timestamp: string;
1618
+ }>, z.ZodObject<{
1619
+ id: z.ZodString;
1620
+ timestamp: z.ZodString;
1621
+ } & {
1622
+ type: z.ZodLiteral<"filetree.updated">;
1623
+ data: z.ZodObject<{
1624
+ tree: z.ZodArray<z.ZodType<import("./event-schemas.js").FileNode, z.ZodTypeDef, import("./event-schemas.js").FileNode>, "many">;
1625
+ }, "strip", z.ZodTypeAny, {
1626
+ tree: import("./event-schemas.js").FileNode[];
1627
+ }, {
1628
+ tree: import("./event-schemas.js").FileNode[];
1629
+ }>;
1630
+ }, "strip", z.ZodTypeAny, {
1631
+ type: "filetree.updated";
1632
+ id: string;
1633
+ data: {
1634
+ tree: import("./event-schemas.js").FileNode[];
1635
+ };
1636
+ timestamp: string;
1637
+ }, {
1638
+ type: "filetree.updated";
1639
+ id: string;
1640
+ data: {
1641
+ tree: import("./event-schemas.js").FileNode[];
1642
+ };
1643
+ timestamp: string;
1644
+ }>, z.ZodObject<{
1645
+ id: z.ZodString;
1646
+ timestamp: z.ZodString;
1647
+ } & {
1648
+ type: z.ZodLiteral<"rig.setup.completed">;
1649
+ data: z.ZodObject<{
1650
+ codonId: z.ZodString;
1651
+ rigType: z.ZodEnum<["command", "commands"]>;
1652
+ commandCount: z.ZodNumber;
1653
+ durationMs: z.ZodNumber;
1654
+ createdCheckpoint: z.ZodBoolean;
1655
+ }, "strip", z.ZodTypeAny, {
1656
+ codonId: string;
1657
+ rigType: "command" | "commands";
1658
+ commandCount: number;
1659
+ durationMs: number;
1660
+ createdCheckpoint: boolean;
1661
+ }, {
1662
+ codonId: string;
1663
+ rigType: "command" | "commands";
1664
+ commandCount: number;
1665
+ durationMs: number;
1666
+ createdCheckpoint: boolean;
1667
+ }>;
1668
+ }, "strip", z.ZodTypeAny, {
1669
+ type: "rig.setup.completed";
1670
+ id: string;
1671
+ data: {
1672
+ codonId: string;
1673
+ rigType: "command" | "commands";
1674
+ commandCount: number;
1675
+ durationMs: number;
1676
+ createdCheckpoint: boolean;
1677
+ };
1678
+ timestamp: string;
1679
+ }, {
1680
+ type: "rig.setup.completed";
1681
+ id: string;
1682
+ data: {
1683
+ codonId: string;
1684
+ rigType: "command" | "commands";
1685
+ commandCount: number;
1686
+ durationMs: number;
1687
+ createdCheckpoint: boolean;
1688
+ };
1689
+ timestamp: string;
1690
+ }>, z.ZodObject<{
1691
+ id: z.ZodString;
1692
+ timestamp: z.ZodString;
1693
+ } & {
1694
+ type: z.ZodLiteral<"rig.setup.failed">;
1695
+ data: z.ZodObject<{
1696
+ codonId: z.ZodString;
1697
+ failureType: z.ZodEnum<["command_failed", "timeout", "other"]>;
1698
+ exitCode: z.ZodOptional<z.ZodNumber>;
1699
+ commandIndex: z.ZodOptional<z.ZodNumber>;
1700
+ ignored: z.ZodBoolean;
1701
+ }, "strip", z.ZodTypeAny, {
1702
+ codonId: string;
1703
+ failureType: "other" | "timeout" | "command_failed";
1704
+ ignored: boolean;
1705
+ exitCode?: number | undefined;
1706
+ commandIndex?: number | undefined;
1707
+ }, {
1708
+ codonId: string;
1709
+ failureType: "other" | "timeout" | "command_failed";
1710
+ ignored: boolean;
1711
+ exitCode?: number | undefined;
1712
+ commandIndex?: number | undefined;
1713
+ }>;
1714
+ }, "strip", z.ZodTypeAny, {
1715
+ type: "rig.setup.failed";
1716
+ id: string;
1717
+ data: {
1718
+ codonId: string;
1719
+ failureType: "other" | "timeout" | "command_failed";
1720
+ ignored: boolean;
1721
+ exitCode?: number | undefined;
1722
+ commandIndex?: number | undefined;
1723
+ };
1724
+ timestamp: string;
1725
+ }, {
1726
+ type: "rig.setup.failed";
1727
+ id: string;
1728
+ data: {
1729
+ codonId: string;
1730
+ failureType: "other" | "timeout" | "command_failed";
1731
+ ignored: boolean;
1732
+ exitCode?: number | undefined;
1733
+ commandIndex?: number | undefined;
1734
+ };
1735
+ timestamp: string;
1736
+ }>, z.ZodObject<{
1737
+ id: z.ZodString;
1738
+ timestamp: z.ZodString;
1739
+ } & {
1740
+ type: z.ZodLiteral<"rig.output">;
1741
+ data: z.ZodObject<{
1742
+ codonId: z.ZodString;
1743
+ stream: z.ZodEnum<["stdout", "stderr"]>;
1744
+ line: z.ZodString;
1745
+ commandIndex: z.ZodNumber;
1746
+ }, "strip", z.ZodTypeAny, {
1747
+ stream: "stdout" | "stderr";
1748
+ codonId: string;
1749
+ commandIndex: number;
1750
+ line: string;
1751
+ }, {
1752
+ stream: "stdout" | "stderr";
1753
+ codonId: string;
1754
+ commandIndex: number;
1755
+ line: string;
1756
+ }>;
1757
+ }, "strip", z.ZodTypeAny, {
1758
+ type: "rig.output";
1759
+ id: string;
1760
+ data: {
1761
+ stream: "stdout" | "stderr";
1762
+ codonId: string;
1763
+ commandIndex: number;
1764
+ line: string;
1765
+ };
1766
+ timestamp: string;
1767
+ }, {
1768
+ type: "rig.output";
1769
+ id: string;
1770
+ data: {
1771
+ stream: "stdout" | "stderr";
1772
+ codonId: string;
1773
+ commandIndex: number;
1774
+ line: string;
1775
+ };
1776
+ timestamp: string;
1777
+ }>, z.ZodObject<{
1778
+ id: z.ZodString;
1779
+ timestamp: z.ZodString;
1780
+ } & {
1781
+ type: z.ZodLiteral<"loop.iteration.completed">;
1782
+ data: z.ZodObject<{
1783
+ loopId: z.ZodString;
1784
+ iteration: z.ZodNumber;
1785
+ durationMs: z.ZodNumber;
1786
+ costUsd: z.ZodNumber;
1787
+ tokensUsed: z.ZodNumber;
1788
+ isFinal: z.ZodBoolean;
1789
+ terminationReason: z.ZodOptional<z.ZodEnum<["iteration_limit", "context_exceeded", "sentinel_skip", "failure"]>>;
1790
+ }, "strip", z.ZodTypeAny, {
1791
+ durationMs: number;
1792
+ loopId: string;
1793
+ iteration: number;
1794
+ costUsd: number;
1795
+ tokensUsed: number;
1796
+ isFinal: boolean;
1797
+ terminationReason?: "iteration_limit" | "context_exceeded" | "sentinel_skip" | "failure" | undefined;
1798
+ }, {
1799
+ durationMs: number;
1800
+ loopId: string;
1801
+ iteration: number;
1802
+ costUsd: number;
1803
+ tokensUsed: number;
1804
+ isFinal: boolean;
1805
+ terminationReason?: "iteration_limit" | "context_exceeded" | "sentinel_skip" | "failure" | undefined;
1806
+ }>;
1807
+ }, "strip", z.ZodTypeAny, {
1808
+ type: "loop.iteration.completed";
1809
+ id: string;
1810
+ data: {
1811
+ durationMs: number;
1812
+ loopId: string;
1813
+ iteration: number;
1814
+ costUsd: number;
1815
+ tokensUsed: number;
1816
+ isFinal: boolean;
1817
+ terminationReason?: "iteration_limit" | "context_exceeded" | "sentinel_skip" | "failure" | undefined;
1818
+ };
1819
+ timestamp: string;
1820
+ }, {
1821
+ type: "loop.iteration.completed";
1822
+ id: string;
1823
+ data: {
1824
+ durationMs: number;
1825
+ loopId: string;
1826
+ iteration: number;
1827
+ costUsd: number;
1828
+ tokensUsed: number;
1829
+ isFinal: boolean;
1830
+ terminationReason?: "iteration_limit" | "context_exceeded" | "sentinel_skip" | "failure" | undefined;
1831
+ };
1832
+ timestamp: string;
1833
+ }>, z.ZodObject<{
1834
+ id: z.ZodString;
1835
+ timestamp: z.ZodString;
1836
+ } & {
1837
+ type: z.ZodLiteral<"error">;
1838
+ data: z.ZodObject<{
1839
+ message: z.ZodString;
1840
+ codon: z.ZodOptional<z.ZodString>;
1841
+ fatal: z.ZodBoolean;
1842
+ severity: z.ZodOptional<z.ZodEnum<["fatal", "codon", "operation", "warning"]>>;
1843
+ context: z.ZodOptional<z.ZodString>;
1844
+ code: z.ZodOptional<z.ZodString>;
1845
+ }, "strip", z.ZodTypeAny, {
1846
+ message: string;
1847
+ fatal: boolean;
1848
+ code?: string | undefined;
1849
+ codon?: string | undefined;
1850
+ severity?: "codon" | "fatal" | "operation" | "warning" | undefined;
1851
+ context?: string | undefined;
1852
+ }, {
1853
+ message: string;
1854
+ fatal: boolean;
1855
+ code?: string | undefined;
1856
+ codon?: string | undefined;
1857
+ severity?: "codon" | "fatal" | "operation" | "warning" | undefined;
1858
+ context?: string | undefined;
1859
+ }>;
1860
+ }, "strip", z.ZodTypeAny, {
1861
+ type: "error";
1862
+ id: string;
1863
+ data: {
1864
+ message: string;
1865
+ fatal: boolean;
1866
+ code?: string | undefined;
1867
+ codon?: string | undefined;
1868
+ severity?: "codon" | "fatal" | "operation" | "warning" | undefined;
1869
+ context?: string | undefined;
1870
+ };
1871
+ timestamp: string;
1872
+ }, {
1873
+ type: "error";
1874
+ id: string;
1875
+ data: {
1876
+ message: string;
1877
+ fatal: boolean;
1878
+ code?: string | undefined;
1879
+ codon?: string | undefined;
1880
+ severity?: "codon" | "fatal" | "operation" | "warning" | undefined;
1881
+ context?: string | undefined;
1882
+ };
1883
+ timestamp: string;
1884
+ }>, z.ZodObject<{
1885
+ id: z.ZodString;
1886
+ timestamp: z.ZodString;
1887
+ } & {
1888
+ type: z.ZodLiteral<"incomplete.codon">;
1889
+ data: z.ZodObject<{
1890
+ codonId: z.ZodString;
1891
+ codonName: z.ZodString;
1892
+ message: z.ZodString;
1893
+ }, "strip", z.ZodTypeAny, {
1894
+ message: string;
1895
+ codonId: string;
1896
+ codonName: string;
1897
+ }, {
1898
+ message: string;
1899
+ codonId: string;
1900
+ codonName: string;
1901
+ }>;
1902
+ }, "strip", z.ZodTypeAny, {
1903
+ type: "incomplete.codon";
1904
+ id: string;
1905
+ data: {
1906
+ message: string;
1907
+ codonId: string;
1908
+ codonName: string;
1909
+ };
1910
+ timestamp: string;
1911
+ }, {
1912
+ type: "incomplete.codon";
1913
+ id: string;
1914
+ data: {
1915
+ message: string;
1916
+ codonId: string;
1917
+ codonName: string;
1918
+ };
1919
+ timestamp: string;
1920
+ }>, z.ZodObject<{
1921
+ id: z.ZodString;
1922
+ timestamp: z.ZodString;
1923
+ } & {
1924
+ type: z.ZodLiteral<"info">;
1925
+ data: z.ZodObject<{
1926
+ message: z.ZodString;
1927
+ }, "strip", z.ZodTypeAny, {
1928
+ message: string;
1929
+ }, {
1930
+ message: string;
1931
+ }>;
1932
+ }, "strip", z.ZodTypeAny, {
1933
+ type: "info";
1934
+ id: string;
1935
+ data: {
1936
+ message: string;
1937
+ };
1938
+ timestamp: string;
1939
+ }, {
1940
+ type: "info";
1941
+ id: string;
1942
+ data: {
1943
+ message: string;
1944
+ };
1945
+ timestamp: string;
1946
+ }>, z.ZodObject<{
1947
+ id: z.ZodString;
1948
+ timestamp: z.ZodString;
1949
+ } & {
1950
+ type: z.ZodLiteral<"server.idle">;
1951
+ data: z.ZodObject<{
1952
+ reason: z.ZodEnum<["startup", "codon-completed", "all-codons-completed", "rollback-completed"]>;
1953
+ message: z.ZodString;
1954
+ }, "strip", z.ZodTypeAny, {
1955
+ message: string;
1956
+ reason: "startup" | "codon-completed" | "all-codons-completed" | "rollback-completed";
1957
+ }, {
1958
+ message: string;
1959
+ reason: "startup" | "codon-completed" | "all-codons-completed" | "rollback-completed";
1960
+ }>;
1961
+ }, "strip", z.ZodTypeAny, {
1962
+ type: "server.idle";
1963
+ id: string;
1964
+ data: {
1965
+ message: string;
1966
+ reason: "startup" | "codon-completed" | "all-codons-completed" | "rollback-completed";
1967
+ };
1968
+ timestamp: string;
1969
+ }, {
1970
+ type: "server.idle";
1971
+ id: string;
1972
+ data: {
1973
+ message: string;
1974
+ reason: "startup" | "codon-completed" | "all-codons-completed" | "rollback-completed";
1975
+ };
1976
+ timestamp: string;
1977
+ }>, z.ZodObject<{
1978
+ id: z.ZodString;
1979
+ timestamp: z.ZodString;
1980
+ } & {
1981
+ type: z.ZodLiteral<"checkpoint.list">;
1982
+ data: z.ZodObject<{
1983
+ runId: z.ZodString;
1984
+ checkpoints: z.ZodArray<z.ZodObject<{
1985
+ codonId: z.ZodString;
1986
+ codonName: z.ZodString;
1987
+ checkpointType: z.ZodEnum<["rig-setup", "completed", "error", "skipped"]>;
1988
+ sha: z.ZodString;
1989
+ status: z.ZodEnum<["preparing", "starting", "initializing", "running", "completing-sentinels", "completed", "failed", "skipped"]>;
1990
+ timestamp: z.ZodString;
1991
+ }, "strip", z.ZodTypeAny, {
1992
+ status: "completed" | "failed" | "skipped" | "running" | "preparing" | "starting" | "initializing" | "completing-sentinels";
1993
+ timestamp: string;
1994
+ codonId: string;
1995
+ codonName: string;
1996
+ checkpointType: "completed" | "skipped" | "error" | "rig-setup";
1997
+ sha: string;
1998
+ }, {
1999
+ status: "completed" | "failed" | "skipped" | "running" | "preparing" | "starting" | "initializing" | "completing-sentinels";
2000
+ timestamp: string;
2001
+ codonId: string;
2002
+ codonName: string;
2003
+ checkpointType: "completed" | "skipped" | "error" | "rig-setup";
2004
+ sha: string;
2005
+ }>, "many">;
2006
+ currentBranch: z.ZodString;
2007
+ }, "strip", z.ZodTypeAny, {
2008
+ runId: string;
2009
+ checkpoints: {
2010
+ status: "completed" | "failed" | "skipped" | "running" | "preparing" | "starting" | "initializing" | "completing-sentinels";
2011
+ timestamp: string;
2012
+ codonId: string;
2013
+ codonName: string;
2014
+ checkpointType: "completed" | "skipped" | "error" | "rig-setup";
2015
+ sha: string;
2016
+ }[];
2017
+ currentBranch: string;
2018
+ }, {
2019
+ runId: string;
2020
+ checkpoints: {
2021
+ status: "completed" | "failed" | "skipped" | "running" | "preparing" | "starting" | "initializing" | "completing-sentinels";
2022
+ timestamp: string;
2023
+ codonId: string;
2024
+ codonName: string;
2025
+ checkpointType: "completed" | "skipped" | "error" | "rig-setup";
2026
+ sha: string;
2027
+ }[];
2028
+ currentBranch: string;
2029
+ }>;
2030
+ }, "strip", z.ZodTypeAny, {
2031
+ type: "checkpoint.list";
2032
+ id: string;
2033
+ data: {
2034
+ runId: string;
2035
+ checkpoints: {
2036
+ status: "completed" | "failed" | "skipped" | "running" | "preparing" | "starting" | "initializing" | "completing-sentinels";
2037
+ timestamp: string;
2038
+ codonId: string;
2039
+ codonName: string;
2040
+ checkpointType: "completed" | "skipped" | "error" | "rig-setup";
2041
+ sha: string;
2042
+ }[];
2043
+ currentBranch: string;
2044
+ };
2045
+ timestamp: string;
2046
+ }, {
2047
+ type: "checkpoint.list";
2048
+ id: string;
2049
+ data: {
2050
+ runId: string;
2051
+ checkpoints: {
2052
+ status: "completed" | "failed" | "skipped" | "running" | "preparing" | "starting" | "initializing" | "completing-sentinels";
2053
+ timestamp: string;
2054
+ codonId: string;
2055
+ codonName: string;
2056
+ checkpointType: "completed" | "skipped" | "error" | "rig-setup";
2057
+ sha: string;
2058
+ }[];
2059
+ currentBranch: string;
2060
+ };
2061
+ timestamp: string;
2062
+ }>, z.ZodObject<{
2063
+ id: z.ZodString;
2064
+ timestamp: z.ZodString;
2065
+ } & {
2066
+ type: z.ZodLiteral<"rollback.started">;
2067
+ data: z.ZodObject<{
2068
+ fromRun: z.ZodString;
2069
+ fromCodon: z.ZodString;
2070
+ toCodon: z.ZodString;
2071
+ toCheckpoint: z.ZodString;
2072
+ checkpointType: z.ZodString;
2073
+ codonsToProcess: z.ZodArray<z.ZodString, "many">;
2074
+ }, "strip", z.ZodTypeAny, {
2075
+ checkpointType: string;
2076
+ fromRun: string;
2077
+ fromCodon: string;
2078
+ toCodon: string;
2079
+ toCheckpoint: string;
2080
+ codonsToProcess: string[];
2081
+ }, {
2082
+ checkpointType: string;
2083
+ fromRun: string;
2084
+ fromCodon: string;
2085
+ toCodon: string;
2086
+ toCheckpoint: string;
2087
+ codonsToProcess: string[];
2088
+ }>;
2089
+ }, "strip", z.ZodTypeAny, {
2090
+ type: "rollback.started";
2091
+ id: string;
2092
+ data: {
2093
+ checkpointType: string;
2094
+ fromRun: string;
2095
+ fromCodon: string;
2096
+ toCodon: string;
2097
+ toCheckpoint: string;
2098
+ codonsToProcess: string[];
2099
+ };
2100
+ timestamp: string;
2101
+ }, {
2102
+ type: "rollback.started";
2103
+ id: string;
2104
+ data: {
2105
+ checkpointType: string;
2106
+ fromRun: string;
2107
+ fromCodon: string;
2108
+ toCodon: string;
2109
+ toCheckpoint: string;
2110
+ codonsToProcess: string[];
2111
+ };
2112
+ timestamp: string;
2113
+ }>, z.ZodObject<{
2114
+ id: z.ZodString;
2115
+ timestamp: z.ZodString;
2116
+ } & {
2117
+ type: z.ZodLiteral<"rollback.codonCheckpoint">;
2118
+ data: z.ZodObject<{
2119
+ codonId: z.ZodString;
2120
+ codonName: z.ZodString;
2121
+ checkpoint: z.ZodString;
2122
+ checkpointType: z.ZodString;
2123
+ message: z.ZodString;
2124
+ }, "strip", z.ZodTypeAny, {
2125
+ message: string;
2126
+ codonId: string;
2127
+ codonName: string;
2128
+ checkpointType: string;
2129
+ checkpoint: string;
2130
+ }, {
2131
+ message: string;
2132
+ codonId: string;
2133
+ codonName: string;
2134
+ checkpointType: string;
2135
+ checkpoint: string;
2136
+ }>;
2137
+ }, "strip", z.ZodTypeAny, {
2138
+ type: "rollback.codonCheckpoint";
2139
+ id: string;
2140
+ data: {
2141
+ message: string;
2142
+ codonId: string;
2143
+ codonName: string;
2144
+ checkpointType: string;
2145
+ checkpoint: string;
2146
+ };
2147
+ timestamp: string;
2148
+ }, {
2149
+ type: "rollback.codonCheckpoint";
2150
+ id: string;
2151
+ data: {
2152
+ message: string;
2153
+ codonId: string;
2154
+ codonName: string;
2155
+ checkpointType: string;
2156
+ checkpoint: string;
2157
+ };
2158
+ timestamp: string;
2159
+ }>, z.ZodObject<{
2160
+ id: z.ZodString;
2161
+ timestamp: z.ZodString;
2162
+ } & {
2163
+ type: z.ZodLiteral<"rollback.rigCleanup">;
2164
+ data: z.ZodObject<{
2165
+ codonId: z.ZodString;
2166
+ codonName: z.ZodString;
2167
+ directories: z.ZodArray<z.ZodString, "many">;
2168
+ status: z.ZodEnum<["started", "completed", "failed", "partial"]>;
2169
+ successfulCleanups: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
2170
+ failedCleanups: z.ZodOptional<z.ZodArray<z.ZodObject<{
2171
+ directory: z.ZodString;
2172
+ error: z.ZodString;
2173
+ }, "strip", z.ZodTypeAny, {
2174
+ error: string;
2175
+ directory: string;
2176
+ }, {
2177
+ error: string;
2178
+ directory: string;
2179
+ }>, "many">>;
2180
+ error: z.ZodOptional<z.ZodString>;
2181
+ }, "strip", z.ZodTypeAny, {
2182
+ status: "completed" | "failed" | "partial" | "started";
2183
+ codonId: string;
2184
+ codonName: string;
2185
+ directories: string[];
2186
+ error?: string | undefined;
2187
+ successfulCleanups?: string[] | undefined;
2188
+ failedCleanups?: {
2189
+ error: string;
2190
+ directory: string;
2191
+ }[] | undefined;
2192
+ }, {
2193
+ status: "completed" | "failed" | "partial" | "started";
2194
+ codonId: string;
2195
+ codonName: string;
2196
+ directories: string[];
2197
+ error?: string | undefined;
2198
+ successfulCleanups?: string[] | undefined;
2199
+ failedCleanups?: {
2200
+ error: string;
2201
+ directory: string;
2202
+ }[] | undefined;
2203
+ }>;
2204
+ }, "strip", z.ZodTypeAny, {
2205
+ type: "rollback.rigCleanup";
2206
+ id: string;
2207
+ data: {
2208
+ status: "completed" | "failed" | "partial" | "started";
2209
+ codonId: string;
2210
+ codonName: string;
2211
+ directories: string[];
2212
+ error?: string | undefined;
2213
+ successfulCleanups?: string[] | undefined;
2214
+ failedCleanups?: {
2215
+ error: string;
2216
+ directory: string;
2217
+ }[] | undefined;
2218
+ };
2219
+ timestamp: string;
2220
+ }, {
2221
+ type: "rollback.rigCleanup";
2222
+ id: string;
2223
+ data: {
2224
+ status: "completed" | "failed" | "partial" | "started";
2225
+ codonId: string;
2226
+ codonName: string;
2227
+ directories: string[];
2228
+ error?: string | undefined;
2229
+ successfulCleanups?: string[] | undefined;
2230
+ failedCleanups?: {
2231
+ error: string;
2232
+ directory: string;
2233
+ }[] | undefined;
2234
+ };
2235
+ timestamp: string;
2236
+ }>, z.ZodObject<{
2237
+ id: z.ZodString;
2238
+ timestamp: z.ZodString;
2239
+ } & {
2240
+ type: z.ZodLiteral<"rollback.progress">;
2241
+ data: z.ZodObject<{
2242
+ currentStep: z.ZodNumber;
2243
+ totalSteps: z.ZodNumber;
2244
+ message: z.ZodString;
2245
+ }, "strip", z.ZodTypeAny, {
2246
+ message: string;
2247
+ currentStep: number;
2248
+ totalSteps: number;
2249
+ }, {
2250
+ message: string;
2251
+ currentStep: number;
2252
+ totalSteps: number;
2253
+ }>;
2254
+ }, "strip", z.ZodTypeAny, {
2255
+ type: "rollback.progress";
2256
+ id: string;
2257
+ data: {
2258
+ message: string;
2259
+ currentStep: number;
2260
+ totalSteps: number;
2261
+ };
2262
+ timestamp: string;
2263
+ }, {
2264
+ type: "rollback.progress";
2265
+ id: string;
2266
+ data: {
2267
+ message: string;
2268
+ currentStep: number;
2269
+ totalSteps: number;
2270
+ };
2271
+ timestamp: string;
2272
+ }>, z.ZodObject<{
2273
+ id: z.ZodString;
2274
+ timestamp: z.ZodString;
2275
+ } & {
2276
+ type: z.ZodLiteral<"rollback.completed">;
2277
+ data: z.ZodObject<{
2278
+ fromRun: z.ZodString;
2279
+ toRun: z.ZodString;
2280
+ checkpoint: z.ZodString;
2281
+ codonId: z.ZodString;
2282
+ codonName: z.ZodString;
2283
+ checkpointType: z.ZodString;
2284
+ autoRestart: z.ZodBoolean;
2285
+ }, "strip", z.ZodTypeAny, {
2286
+ codonId: string;
2287
+ codonName: string;
2288
+ checkpointType: string;
2289
+ fromRun: string;
2290
+ checkpoint: string;
2291
+ toRun: string;
2292
+ autoRestart: boolean;
2293
+ }, {
2294
+ codonId: string;
2295
+ codonName: string;
2296
+ checkpointType: string;
2297
+ fromRun: string;
2298
+ checkpoint: string;
2299
+ toRun: string;
2300
+ autoRestart: boolean;
2301
+ }>;
2302
+ }, "strip", z.ZodTypeAny, {
2303
+ type: "rollback.completed";
2304
+ id: string;
2305
+ data: {
2306
+ codonId: string;
2307
+ codonName: string;
2308
+ checkpointType: string;
2309
+ fromRun: string;
2310
+ checkpoint: string;
2311
+ toRun: string;
2312
+ autoRestart: boolean;
2313
+ };
2314
+ timestamp: string;
2315
+ }, {
2316
+ type: "rollback.completed";
2317
+ id: string;
2318
+ data: {
2319
+ codonId: string;
2320
+ codonName: string;
2321
+ checkpointType: string;
2322
+ fromRun: string;
2323
+ checkpoint: string;
2324
+ toRun: string;
2325
+ autoRestart: boolean;
2326
+ };
2327
+ timestamp: string;
2328
+ }>, z.ZodObject<{
2329
+ id: z.ZodString;
2330
+ timestamp: z.ZodString;
2331
+ } & {
2332
+ type: z.ZodLiteral<"rollback.archiveRestore">;
2333
+ data: z.ZodObject<{
2334
+ codonId: z.ZodString;
2335
+ restoredPaths: z.ZodArray<z.ZodString, "many">;
2336
+ failedPaths: z.ZodOptional<z.ZodArray<z.ZodObject<{
2337
+ path: z.ZodString;
2338
+ error: z.ZodString;
2339
+ }, "strip", z.ZodTypeAny, {
2340
+ path: string;
2341
+ error: string;
2342
+ }, {
2343
+ path: string;
2344
+ error: string;
2345
+ }>, "many">>;
2346
+ status: z.ZodEnum<["completed", "partial", "failed"]>;
2347
+ }, "strip", z.ZodTypeAny, {
2348
+ status: "completed" | "failed" | "partial";
2349
+ codonId: string;
2350
+ restoredPaths: string[];
2351
+ failedPaths?: {
2352
+ path: string;
2353
+ error: string;
2354
+ }[] | undefined;
2355
+ }, {
2356
+ status: "completed" | "failed" | "partial";
2357
+ codonId: string;
2358
+ restoredPaths: string[];
2359
+ failedPaths?: {
2360
+ path: string;
2361
+ error: string;
2362
+ }[] | undefined;
2363
+ }>;
2364
+ }, "strip", z.ZodTypeAny, {
2365
+ type: "rollback.archiveRestore";
2366
+ id: string;
2367
+ data: {
2368
+ status: "completed" | "failed" | "partial";
2369
+ codonId: string;
2370
+ restoredPaths: string[];
2371
+ failedPaths?: {
2372
+ path: string;
2373
+ error: string;
2374
+ }[] | undefined;
2375
+ };
2376
+ timestamp: string;
2377
+ }, {
2378
+ type: "rollback.archiveRestore";
2379
+ id: string;
2380
+ data: {
2381
+ status: "completed" | "failed" | "partial";
2382
+ codonId: string;
2383
+ restoredPaths: string[];
2384
+ failedPaths?: {
2385
+ path: string;
2386
+ error: string;
2387
+ }[] | undefined;
2388
+ };
2389
+ timestamp: string;
2390
+ }>, z.ZodObject<{
2391
+ id: z.ZodString;
2392
+ timestamp: z.ZodString;
2393
+ } & {
2394
+ type: z.ZodLiteral<"archive.completed">;
2395
+ data: z.ZodObject<{
2396
+ codonId: z.ZodString;
2397
+ archivedPaths: z.ZodArray<z.ZodString, "many">;
2398
+ }, "strip", z.ZodTypeAny, {
2399
+ codonId: string;
2400
+ archivedPaths: string[];
2401
+ }, {
2402
+ codonId: string;
2403
+ archivedPaths: string[];
2404
+ }>;
2405
+ }, "strip", z.ZodTypeAny, {
2406
+ type: "archive.completed";
2407
+ id: string;
2408
+ data: {
2409
+ codonId: string;
2410
+ archivedPaths: string[];
2411
+ };
2412
+ timestamp: string;
2413
+ }, {
2414
+ type: "archive.completed";
2415
+ id: string;
2416
+ data: {
2417
+ codonId: string;
2418
+ archivedPaths: string[];
2419
+ };
2420
+ timestamp: string;
2421
+ }>, z.ZodObject<{
2422
+ id: z.ZodString;
2423
+ timestamp: z.ZodString;
2424
+ } & {
2425
+ type: z.ZodLiteral<"archive.partial">;
2426
+ data: z.ZodObject<{
2427
+ codonId: z.ZodString;
2428
+ archivedPaths: z.ZodArray<z.ZodString, "many">;
2429
+ failedPaths: z.ZodArray<z.ZodObject<{
2430
+ path: z.ZodString;
2431
+ error: z.ZodString;
2432
+ }, "strip", z.ZodTypeAny, {
2433
+ path: string;
2434
+ error: string;
2435
+ }, {
2436
+ path: string;
2437
+ error: string;
2438
+ }>, "many">;
2439
+ }, "strip", z.ZodTypeAny, {
2440
+ codonId: string;
2441
+ failedPaths: {
2442
+ path: string;
2443
+ error: string;
2444
+ }[];
2445
+ archivedPaths: string[];
2446
+ }, {
2447
+ codonId: string;
2448
+ failedPaths: {
2449
+ path: string;
2450
+ error: string;
2451
+ }[];
2452
+ archivedPaths: string[];
2453
+ }>;
2454
+ }, "strip", z.ZodTypeAny, {
2455
+ type: "archive.partial";
2456
+ id: string;
2457
+ data: {
2458
+ codonId: string;
2459
+ failedPaths: {
2460
+ path: string;
2461
+ error: string;
2462
+ }[];
2463
+ archivedPaths: string[];
2464
+ };
2465
+ timestamp: string;
2466
+ }, {
2467
+ type: "archive.partial";
2468
+ id: string;
2469
+ data: {
2470
+ codonId: string;
2471
+ failedPaths: {
2472
+ path: string;
2473
+ error: string;
2474
+ }[];
2475
+ archivedPaths: string[];
2476
+ };
2477
+ timestamp: string;
2478
+ }>, z.ZodObject<{
2479
+ id: z.ZodString;
2480
+ timestamp: z.ZodString;
2481
+ } & {
2482
+ type: z.ZodLiteral<"pong">;
2483
+ data: z.ZodObject<{
2484
+ message: z.ZodString;
2485
+ timestamp: z.ZodString;
2486
+ clientId: z.ZodOptional<z.ZodString>;
2487
+ }, "strip", z.ZodTypeAny, {
2488
+ message: string;
2489
+ timestamp: string;
2490
+ clientId?: string | undefined;
2491
+ }, {
2492
+ message: string;
2493
+ timestamp: string;
2494
+ clientId?: string | undefined;
2495
+ }>;
2496
+ }, "strip", z.ZodTypeAny, {
2497
+ type: "pong";
2498
+ id: string;
2499
+ data: {
2500
+ message: string;
2501
+ timestamp: string;
2502
+ clientId?: string | undefined;
2503
+ };
2504
+ timestamp: string;
2505
+ }, {
2506
+ type: "pong";
2507
+ id: string;
2508
+ data: {
2509
+ message: string;
2510
+ timestamp: string;
2511
+ clientId?: string | undefined;
2512
+ };
2513
+ timestamp: string;
2514
+ }>, z.ZodObject<{
2515
+ id: z.ZodString;
2516
+ timestamp: z.ZodString;
2517
+ } & {
2518
+ type: z.ZodLiteral<"history.batch">;
2519
+ data: z.ZodObject<{
2520
+ events: z.ZodArray<z.ZodAny, "many">;
2521
+ hasMore: z.ZodBoolean;
2522
+ }, "strip", z.ZodTypeAny, {
2523
+ events: any[];
2524
+ hasMore: boolean;
2525
+ }, {
2526
+ events: any[];
2527
+ hasMore: boolean;
2528
+ }>;
2529
+ }, "strip", z.ZodTypeAny, {
2530
+ type: "history.batch";
2531
+ id: string;
2532
+ data: {
2533
+ events: any[];
2534
+ hasMore: boolean;
2535
+ };
2536
+ timestamp: string;
2537
+ }, {
2538
+ type: "history.batch";
2539
+ id: string;
2540
+ data: {
2541
+ events: any[];
2542
+ hasMore: boolean;
2543
+ };
2544
+ timestamp: string;
2545
+ }>, z.ZodObject<{
2546
+ id: z.ZodString;
2547
+ timestamp: z.ZodString;
2548
+ } & {
2549
+ type: z.ZodLiteral<"state.transition">;
2550
+ data: z.ZodObject<{
2551
+ transitionType: z.ZodEnum<["RunStarted", "RunCompleted", "RunFailed", "RunCrashed", "CodonStarted", "CodonTransitioned", "CostsUpdated", "CostsIncremented", "AssistantMessageCountUpdated", "ExtensionCountUpdated", "CheckpointCreated", "InitialCheckpointSet", "CodonFinalCostSet", "SentinelStatesUpdated"]>;
2552
+ runId: z.ZodOptional<z.ZodString>;
2553
+ codonId: z.ZodOptional<z.ZodString>;
2554
+ transition: z.ZodObject<{
2555
+ type: z.ZodString;
2556
+ data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
2557
+ }, "strip", z.ZodTypeAny, {
2558
+ type: string;
2559
+ data: Record<string, unknown>;
2560
+ }, {
2561
+ type: string;
2562
+ data: Record<string, unknown>;
2563
+ }>;
2564
+ resultingState: z.ZodObject<{
2565
+ currentRunId: z.ZodNullable<z.ZodString>;
2566
+ runCount: z.ZodNumber;
2567
+ totalCost: z.ZodNumber;
2568
+ currentRunCost: z.ZodNumber;
2569
+ }, "strip", z.ZodTypeAny, {
2570
+ totalCost: number;
2571
+ currentRunId: string | null;
2572
+ runCount: number;
2573
+ currentRunCost: number;
2574
+ }, {
2575
+ totalCost: number;
2576
+ currentRunId: string | null;
2577
+ runCount: number;
2578
+ currentRunCost: number;
2579
+ }>;
2580
+ }, "strip", z.ZodTypeAny, {
2581
+ transitionType: "RunStarted" | "RunCompleted" | "RunFailed" | "RunCrashed" | "CodonStarted" | "CodonTransitioned" | "CostsUpdated" | "CostsIncremented" | "AssistantMessageCountUpdated" | "ExtensionCountUpdated" | "CheckpointCreated" | "InitialCheckpointSet" | "CodonFinalCostSet" | "SentinelStatesUpdated";
2582
+ transition: {
2583
+ type: string;
2584
+ data: Record<string, unknown>;
2585
+ };
2586
+ resultingState: {
2587
+ totalCost: number;
2588
+ currentRunId: string | null;
2589
+ runCount: number;
2590
+ currentRunCost: number;
2591
+ };
2592
+ codonId?: string | undefined;
2593
+ runId?: string | undefined;
2594
+ }, {
2595
+ transitionType: "RunStarted" | "RunCompleted" | "RunFailed" | "RunCrashed" | "CodonStarted" | "CodonTransitioned" | "CostsUpdated" | "CostsIncremented" | "AssistantMessageCountUpdated" | "ExtensionCountUpdated" | "CheckpointCreated" | "InitialCheckpointSet" | "CodonFinalCostSet" | "SentinelStatesUpdated";
2596
+ transition: {
2597
+ type: string;
2598
+ data: Record<string, unknown>;
2599
+ };
2600
+ resultingState: {
2601
+ totalCost: number;
2602
+ currentRunId: string | null;
2603
+ runCount: number;
2604
+ currentRunCost: number;
2605
+ };
2606
+ codonId?: string | undefined;
2607
+ runId?: string | undefined;
2608
+ }>;
2609
+ }, "strip", z.ZodTypeAny, {
2610
+ type: "state.transition";
2611
+ id: string;
2612
+ data: {
2613
+ transitionType: "RunStarted" | "RunCompleted" | "RunFailed" | "RunCrashed" | "CodonStarted" | "CodonTransitioned" | "CostsUpdated" | "CostsIncremented" | "AssistantMessageCountUpdated" | "ExtensionCountUpdated" | "CheckpointCreated" | "InitialCheckpointSet" | "CodonFinalCostSet" | "SentinelStatesUpdated";
2614
+ transition: {
2615
+ type: string;
2616
+ data: Record<string, unknown>;
2617
+ };
2618
+ resultingState: {
2619
+ totalCost: number;
2620
+ currentRunId: string | null;
2621
+ runCount: number;
2622
+ currentRunCost: number;
2623
+ };
2624
+ codonId?: string | undefined;
2625
+ runId?: string | undefined;
2626
+ };
2627
+ timestamp: string;
2628
+ }, {
2629
+ type: "state.transition";
2630
+ id: string;
2631
+ data: {
2632
+ transitionType: "RunStarted" | "RunCompleted" | "RunFailed" | "RunCrashed" | "CodonStarted" | "CodonTransitioned" | "CostsUpdated" | "CostsIncremented" | "AssistantMessageCountUpdated" | "ExtensionCountUpdated" | "CheckpointCreated" | "InitialCheckpointSet" | "CodonFinalCostSet" | "SentinelStatesUpdated";
2633
+ transition: {
2634
+ type: string;
2635
+ data: Record<string, unknown>;
2636
+ };
2637
+ resultingState: {
2638
+ totalCost: number;
2639
+ currentRunId: string | null;
2640
+ runCount: number;
2641
+ currentRunCost: number;
2642
+ };
2643
+ codonId?: string | undefined;
2644
+ runId?: string | undefined;
2645
+ };
2646
+ timestamp: string;
2647
+ }>, z.ZodObject<{
2648
+ id: z.ZodString;
2649
+ timestamp: z.ZodString;
2650
+ } & {
2651
+ type: z.ZodLiteral<"sentinel.loaded">;
2652
+ data: z.ZodObject<{
2653
+ sentinelId: z.ZodString;
2654
+ codonId: z.ZodString;
2655
+ model: z.ZodString;
2656
+ triggerType: z.ZodEnum<["event", "sequence"]>;
2657
+ executionStrategy: z.ZodEnum<["immediate", "debounce", "count", "timeWindow"]>;
2658
+ conversational: z.ZodBoolean;
2659
+ source: z.ZodEnum<["file", "inline"]>;
2660
+ sourcePath: z.ZodOptional<z.ZodString>;
2661
+ }, "strip", z.ZodTypeAny, {
2662
+ model: string;
2663
+ codonId: string;
2664
+ sentinelId: string;
2665
+ triggerType: "event" | "sequence";
2666
+ executionStrategy: "immediate" | "debounce" | "count" | "timeWindow";
2667
+ conversational: boolean;
2668
+ source: "file" | "inline";
2669
+ sourcePath?: string | undefined;
2670
+ }, {
2671
+ model: string;
2672
+ codonId: string;
2673
+ sentinelId: string;
2674
+ triggerType: "event" | "sequence";
2675
+ executionStrategy: "immediate" | "debounce" | "count" | "timeWindow";
2676
+ conversational: boolean;
2677
+ source: "file" | "inline";
2678
+ sourcePath?: string | undefined;
2679
+ }>;
2680
+ }, "strip", z.ZodTypeAny, {
2681
+ type: "sentinel.loaded";
2682
+ id: string;
2683
+ data: {
2684
+ model: string;
2685
+ codonId: string;
2686
+ sentinelId: string;
2687
+ triggerType: "event" | "sequence";
2688
+ executionStrategy: "immediate" | "debounce" | "count" | "timeWindow";
2689
+ conversational: boolean;
2690
+ source: "file" | "inline";
2691
+ sourcePath?: string | undefined;
2692
+ };
2693
+ timestamp: string;
2694
+ }, {
2695
+ type: "sentinel.loaded";
2696
+ id: string;
2697
+ data: {
2698
+ model: string;
2699
+ codonId: string;
2700
+ sentinelId: string;
2701
+ triggerType: "event" | "sequence";
2702
+ executionStrategy: "immediate" | "debounce" | "count" | "timeWindow";
2703
+ conversational: boolean;
2704
+ source: "file" | "inline";
2705
+ sourcePath?: string | undefined;
2706
+ };
2707
+ timestamp: string;
2708
+ }>, z.ZodObject<{
2709
+ id: z.ZodString;
2710
+ timestamp: z.ZodString;
2711
+ } & {
2712
+ type: z.ZodLiteral<"sentinel.unloaded">;
2713
+ data: z.ZodObject<{
2714
+ sentinelId: z.ZodString;
2715
+ codonId: z.ZodString;
2716
+ reason: z.ZodEnum<["codon-complete", "fatal-error", "consecutive-failures", "shutdown"]>;
2717
+ errorType: z.ZodOptional<z.ZodEnum<["template", "configuration", "corruption", "resource"]>>;
2718
+ finalCost: z.ZodNumber;
2719
+ llmCallCount: z.ZodNumber;
2720
+ }, "strip", z.ZodTypeAny, {
2721
+ codonId: string;
2722
+ finalCost: number;
2723
+ reason: "codon-complete" | "fatal-error" | "consecutive-failures" | "shutdown";
2724
+ sentinelId: string;
2725
+ llmCallCount: number;
2726
+ errorType?: "template" | "configuration" | "corruption" | "resource" | undefined;
2727
+ }, {
2728
+ codonId: string;
2729
+ finalCost: number;
2730
+ reason: "codon-complete" | "fatal-error" | "consecutive-failures" | "shutdown";
2731
+ sentinelId: string;
2732
+ llmCallCount: number;
2733
+ errorType?: "template" | "configuration" | "corruption" | "resource" | undefined;
2734
+ }>;
2735
+ }, "strip", z.ZodTypeAny, {
2736
+ type: "sentinel.unloaded";
2737
+ id: string;
2738
+ data: {
2739
+ codonId: string;
2740
+ finalCost: number;
2741
+ reason: "codon-complete" | "fatal-error" | "consecutive-failures" | "shutdown";
2742
+ sentinelId: string;
2743
+ llmCallCount: number;
2744
+ errorType?: "template" | "configuration" | "corruption" | "resource" | undefined;
2745
+ };
2746
+ timestamp: string;
2747
+ }, {
2748
+ type: "sentinel.unloaded";
2749
+ id: string;
2750
+ data: {
2751
+ codonId: string;
2752
+ finalCost: number;
2753
+ reason: "codon-complete" | "fatal-error" | "consecutive-failures" | "shutdown";
2754
+ sentinelId: string;
2755
+ llmCallCount: number;
2756
+ errorType?: "template" | "configuration" | "corruption" | "resource" | undefined;
2757
+ };
2758
+ timestamp: string;
2759
+ }>, z.ZodObject<{
2760
+ id: z.ZodString;
2761
+ timestamp: z.ZodString;
2762
+ } & {
2763
+ type: z.ZodLiteral<"sentinel.error">;
2764
+ data: z.ZodObject<{
2765
+ sentinelId: z.ZodString;
2766
+ codonId: z.ZodString;
2767
+ errorType: z.ZodEnum<["llm-call-failed", "template-render-failed", "file-write-failed"]>;
2768
+ message: z.ZodString;
2769
+ retriable: z.ZodBoolean;
2770
+ consecutiveFailureCount: z.ZodNumber;
2771
+ }, "strip", z.ZodTypeAny, {
2772
+ message: string;
2773
+ codonId: string;
2774
+ retriable: boolean;
2775
+ sentinelId: string;
2776
+ errorType: "llm-call-failed" | "template-render-failed" | "file-write-failed";
2777
+ consecutiveFailureCount: number;
2778
+ }, {
2779
+ message: string;
2780
+ codonId: string;
2781
+ retriable: boolean;
2782
+ sentinelId: string;
2783
+ errorType: "llm-call-failed" | "template-render-failed" | "file-write-failed";
2784
+ consecutiveFailureCount: number;
2785
+ }>;
2786
+ }, "strip", z.ZodTypeAny, {
2787
+ type: "sentinel.error";
2788
+ id: string;
2789
+ data: {
2790
+ message: string;
2791
+ codonId: string;
2792
+ retriable: boolean;
2793
+ sentinelId: string;
2794
+ errorType: "llm-call-failed" | "template-render-failed" | "file-write-failed";
2795
+ consecutiveFailureCount: number;
2796
+ };
2797
+ timestamp: string;
2798
+ }, {
2799
+ type: "sentinel.error";
2800
+ id: string;
2801
+ data: {
2802
+ message: string;
2803
+ codonId: string;
2804
+ retriable: boolean;
2805
+ sentinelId: string;
2806
+ errorType: "llm-call-failed" | "template-render-failed" | "file-write-failed";
2807
+ consecutiveFailureCount: number;
2808
+ };
2809
+ timestamp: string;
2810
+ }>, z.ZodObject<{
2811
+ id: z.ZodString;
2812
+ timestamp: z.ZodString;
2813
+ } & {
2814
+ type: z.ZodLiteral<"sentinel.output">;
2815
+ data: z.ZodObject<{
2816
+ sentinelId: z.ZodString;
2817
+ codonId: z.ZodString;
2818
+ triggerNumber: z.ZodNumber;
2819
+ outputType: z.ZodEnum<["text", "structured"]>;
2820
+ content: z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>]>;
2821
+ cost: z.ZodNumber;
2822
+ tokens: z.ZodObject<{
2823
+ input: z.ZodNumber;
2824
+ output: z.ZodNumber;
2825
+ }, "strip", z.ZodTypeAny, {
2826
+ input: number;
2827
+ output: number;
2828
+ }, {
2829
+ input: number;
2830
+ output: number;
2831
+ }>;
2832
+ eventCount: z.ZodNumber;
2833
+ }, "strip", z.ZodTypeAny, {
2834
+ cost: number;
2835
+ content: string | Record<string, unknown>;
2836
+ codonId: string;
2837
+ sentinelId: string;
2838
+ triggerNumber: number;
2839
+ outputType: "text" | "structured";
2840
+ tokens: {
2841
+ input: number;
2842
+ output: number;
2843
+ };
2844
+ eventCount: number;
2845
+ }, {
2846
+ cost: number;
2847
+ content: string | Record<string, unknown>;
2848
+ codonId: string;
2849
+ sentinelId: string;
2850
+ triggerNumber: number;
2851
+ outputType: "text" | "structured";
2852
+ tokens: {
2853
+ input: number;
2854
+ output: number;
2855
+ };
2856
+ eventCount: number;
2857
+ }>;
2858
+ }, "strip", z.ZodTypeAny, {
2859
+ type: "sentinel.output";
2860
+ id: string;
2861
+ data: {
2862
+ cost: number;
2863
+ content: string | Record<string, unknown>;
2864
+ codonId: string;
2865
+ sentinelId: string;
2866
+ triggerNumber: number;
2867
+ outputType: "text" | "structured";
2868
+ tokens: {
2869
+ input: number;
2870
+ output: number;
2871
+ };
2872
+ eventCount: number;
2873
+ };
2874
+ timestamp: string;
2875
+ }, {
2876
+ type: "sentinel.output";
2877
+ id: string;
2878
+ data: {
2879
+ cost: number;
2880
+ content: string | Record<string, unknown>;
2881
+ codonId: string;
2882
+ sentinelId: string;
2883
+ triggerNumber: number;
2884
+ outputType: "text" | "structured";
2885
+ tokens: {
2886
+ input: number;
2887
+ output: number;
2888
+ };
2889
+ eventCount: number;
2890
+ };
2891
+ timestamp: string;
2892
+ }>, z.ZodObject<{
2893
+ id: z.ZodString;
2894
+ timestamp: z.ZodString;
2895
+ } & {
2896
+ type: z.ZodLiteral<"sentinel.triggered">;
2897
+ data: z.ZodObject<{
2898
+ sentinelId: z.ZodString;
2899
+ codonId: z.ZodString;
2900
+ triggerNumber: z.ZodNumber;
2901
+ strategy: z.ZodEnum<["immediate", "debounce", "count", "timeWindow"]>;
2902
+ eventCount: z.ZodNumber;
2903
+ queueSize: z.ZodNumber;
2904
+ }, "strip", z.ZodTypeAny, {
2905
+ codonId: string;
2906
+ sentinelId: string;
2907
+ triggerNumber: number;
2908
+ eventCount: number;
2909
+ strategy: "immediate" | "debounce" | "count" | "timeWindow";
2910
+ queueSize: number;
2911
+ }, {
2912
+ codonId: string;
2913
+ sentinelId: string;
2914
+ triggerNumber: number;
2915
+ eventCount: number;
2916
+ strategy: "immediate" | "debounce" | "count" | "timeWindow";
2917
+ queueSize: number;
2918
+ }>;
2919
+ }, "strip", z.ZodTypeAny, {
2920
+ type: "sentinel.triggered";
2921
+ id: string;
2922
+ data: {
2923
+ codonId: string;
2924
+ sentinelId: string;
2925
+ triggerNumber: number;
2926
+ eventCount: number;
2927
+ strategy: "immediate" | "debounce" | "count" | "timeWindow";
2928
+ queueSize: number;
2929
+ };
2930
+ timestamp: string;
2931
+ }, {
2932
+ type: "sentinel.triggered";
2933
+ id: string;
2934
+ data: {
2935
+ codonId: string;
2936
+ sentinelId: string;
2937
+ triggerNumber: number;
2938
+ eventCount: number;
2939
+ strategy: "immediate" | "debounce" | "count" | "timeWindow";
2940
+ queueSize: number;
2941
+ };
2942
+ timestamp: string;
2943
+ }>, z.ZodObject<{
2944
+ id: z.ZodString;
2945
+ timestamp: z.ZodString;
2946
+ } & {
2947
+ type: z.ZodLiteral<"budget.summary">;
2948
+ data: z.ZodObject<{
2949
+ ceiling: z.ZodObject<{
2950
+ maxDollars: z.ZodOptional<z.ZodNumber>;
2951
+ maxTimeSeconds: z.ZodOptional<z.ZodNumber>;
2952
+ }, "strip", z.ZodTypeAny, {
2953
+ maxDollars?: number | undefined;
2954
+ maxTimeSeconds?: number | undefined;
2955
+ }, {
2956
+ maxDollars?: number | undefined;
2957
+ maxTimeSeconds?: number | undefined;
2958
+ }>;
2959
+ allocation: z.ZodEnum<["shared", "proportional", "proportional-strict"]>;
2960
+ rows: z.ZodArray<z.ZodObject<{
2961
+ codonId: z.ZodString;
2962
+ loopContext: z.ZodOptional<z.ZodObject<{
2963
+ loopId: z.ZodString;
2964
+ iteration: z.ZodNumber;
2965
+ codonIndexInLoop: z.ZodNumber;
2966
+ }, "strip", z.ZodTypeAny, {
2967
+ loopId: string;
2968
+ iteration: number;
2969
+ codonIndexInLoop: number;
2970
+ }, {
2971
+ loopId: string;
2972
+ iteration: number;
2973
+ codonIndexInLoop: number;
2974
+ }>>;
2975
+ status: z.ZodEnum<["completed", "failed", "skipped", "exceeded", "running"]>;
2976
+ budget: z.ZodObject<{
2977
+ maxDollars: z.ZodOptional<z.ZodNumber>;
2978
+ maxTimeSeconds: z.ZodOptional<z.ZodNumber>;
2979
+ maxOutputTokens: z.ZodOptional<z.ZodNumber>;
2980
+ }, "strip", z.ZodTypeAny, {
2981
+ maxOutputTokens?: number | undefined;
2982
+ maxDollars?: number | undefined;
2983
+ maxTimeSeconds?: number | undefined;
2984
+ }, {
2985
+ maxOutputTokens?: number | undefined;
2986
+ maxDollars?: number | undefined;
2987
+ maxTimeSeconds?: number | undefined;
2988
+ }>;
2989
+ actual: z.ZodObject<{
2990
+ dollars: z.ZodNumber;
2991
+ timeSeconds: z.ZodNumber;
2992
+ outputTokens: z.ZodNumber;
2993
+ }, "strip", z.ZodTypeAny, {
2994
+ outputTokens: number;
2995
+ dollars: number;
2996
+ timeSeconds: number;
2997
+ }, {
2998
+ outputTokens: number;
2999
+ dollars: number;
3000
+ timeSeconds: number;
3001
+ }>;
3002
+ }, "strip", z.ZodTypeAny, {
3003
+ status: "completed" | "failed" | "skipped" | "exceeded" | "running";
3004
+ codonId: string;
3005
+ budget: {
3006
+ maxOutputTokens?: number | undefined;
3007
+ maxDollars?: number | undefined;
3008
+ maxTimeSeconds?: number | undefined;
3009
+ };
3010
+ actual: {
3011
+ outputTokens: number;
3012
+ dollars: number;
3013
+ timeSeconds: number;
3014
+ };
3015
+ loopContext?: {
3016
+ loopId: string;
3017
+ iteration: number;
3018
+ codonIndexInLoop: number;
3019
+ } | undefined;
3020
+ }, {
3021
+ status: "completed" | "failed" | "skipped" | "exceeded" | "running";
3022
+ codonId: string;
3023
+ budget: {
3024
+ maxOutputTokens?: number | undefined;
3025
+ maxDollars?: number | undefined;
3026
+ maxTimeSeconds?: number | undefined;
3027
+ };
3028
+ actual: {
3029
+ outputTokens: number;
3030
+ dollars: number;
3031
+ timeSeconds: number;
3032
+ };
3033
+ loopContext?: {
3034
+ loopId: string;
3035
+ iteration: number;
3036
+ codonIndexInLoop: number;
3037
+ } | undefined;
3038
+ }>, "many">;
3039
+ totals: z.ZodObject<{
3040
+ budgetDollars: z.ZodOptional<z.ZodNumber>;
3041
+ actualDollars: z.ZodNumber;
3042
+ actualTimeSeconds: z.ZodNumber;
3043
+ }, "strip", z.ZodTypeAny, {
3044
+ actualDollars: number;
3045
+ actualTimeSeconds: number;
3046
+ budgetDollars?: number | undefined;
3047
+ }, {
3048
+ actualDollars: number;
3049
+ actualTimeSeconds: number;
3050
+ budgetDollars?: number | undefined;
3051
+ }>;
3052
+ }, "strip", z.ZodTypeAny, {
3053
+ ceiling: {
3054
+ maxDollars?: number | undefined;
3055
+ maxTimeSeconds?: number | undefined;
3056
+ };
3057
+ allocation: "shared" | "proportional" | "proportional-strict";
3058
+ rows: {
3059
+ status: "completed" | "failed" | "skipped" | "exceeded" | "running";
3060
+ codonId: string;
3061
+ budget: {
3062
+ maxOutputTokens?: number | undefined;
3063
+ maxDollars?: number | undefined;
3064
+ maxTimeSeconds?: number | undefined;
3065
+ };
3066
+ actual: {
3067
+ outputTokens: number;
3068
+ dollars: number;
3069
+ timeSeconds: number;
3070
+ };
3071
+ loopContext?: {
3072
+ loopId: string;
3073
+ iteration: number;
3074
+ codonIndexInLoop: number;
3075
+ } | undefined;
3076
+ }[];
3077
+ totals: {
3078
+ actualDollars: number;
3079
+ actualTimeSeconds: number;
3080
+ budgetDollars?: number | undefined;
3081
+ };
3082
+ }, {
3083
+ ceiling: {
3084
+ maxDollars?: number | undefined;
3085
+ maxTimeSeconds?: number | undefined;
3086
+ };
3087
+ allocation: "shared" | "proportional" | "proportional-strict";
3088
+ rows: {
3089
+ status: "completed" | "failed" | "skipped" | "exceeded" | "running";
3090
+ codonId: string;
3091
+ budget: {
3092
+ maxOutputTokens?: number | undefined;
3093
+ maxDollars?: number | undefined;
3094
+ maxTimeSeconds?: number | undefined;
3095
+ };
3096
+ actual: {
3097
+ outputTokens: number;
3098
+ dollars: number;
3099
+ timeSeconds: number;
3100
+ };
3101
+ loopContext?: {
3102
+ loopId: string;
3103
+ iteration: number;
3104
+ codonIndexInLoop: number;
3105
+ } | undefined;
3106
+ }[];
3107
+ totals: {
3108
+ actualDollars: number;
3109
+ actualTimeSeconds: number;
3110
+ budgetDollars?: number | undefined;
3111
+ };
3112
+ }>;
3113
+ }, "strip", z.ZodTypeAny, {
3114
+ type: "budget.summary";
3115
+ id: string;
3116
+ data: {
3117
+ ceiling: {
3118
+ maxDollars?: number | undefined;
3119
+ maxTimeSeconds?: number | undefined;
3120
+ };
3121
+ allocation: "shared" | "proportional" | "proportional-strict";
3122
+ rows: {
3123
+ status: "completed" | "failed" | "skipped" | "exceeded" | "running";
3124
+ codonId: string;
3125
+ budget: {
3126
+ maxOutputTokens?: number | undefined;
3127
+ maxDollars?: number | undefined;
3128
+ maxTimeSeconds?: number | undefined;
3129
+ };
3130
+ actual: {
3131
+ outputTokens: number;
3132
+ dollars: number;
3133
+ timeSeconds: number;
3134
+ };
3135
+ loopContext?: {
3136
+ loopId: string;
3137
+ iteration: number;
3138
+ codonIndexInLoop: number;
3139
+ } | undefined;
3140
+ }[];
3141
+ totals: {
3142
+ actualDollars: number;
3143
+ actualTimeSeconds: number;
3144
+ budgetDollars?: number | undefined;
3145
+ };
3146
+ };
3147
+ timestamp: string;
3148
+ }, {
3149
+ type: "budget.summary";
3150
+ id: string;
3151
+ data: {
3152
+ ceiling: {
3153
+ maxDollars?: number | undefined;
3154
+ maxTimeSeconds?: number | undefined;
3155
+ };
3156
+ allocation: "shared" | "proportional" | "proportional-strict";
3157
+ rows: {
3158
+ status: "completed" | "failed" | "skipped" | "exceeded" | "running";
3159
+ codonId: string;
3160
+ budget: {
3161
+ maxOutputTokens?: number | undefined;
3162
+ maxDollars?: number | undefined;
3163
+ maxTimeSeconds?: number | undefined;
3164
+ };
3165
+ actual: {
3166
+ outputTokens: number;
3167
+ dollars: number;
3168
+ timeSeconds: number;
3169
+ };
3170
+ loopContext?: {
3171
+ loopId: string;
3172
+ iteration: number;
3173
+ codonIndexInLoop: number;
3174
+ } | undefined;
3175
+ }[];
3176
+ totals: {
3177
+ actualDollars: number;
3178
+ actualTimeSeconds: number;
3179
+ budgetDollars?: number | undefined;
3180
+ };
3181
+ };
3182
+ timestamp: string;
3183
+ }>]>]>;
3184
+ /**
3185
+ * Optional metadata that isn't in the message itself.
3186
+ * We only add fields here that aren't already present in the message.
3187
+ */
3188
+ metadata: z.ZodOptional<z.ZodObject<{
3189
+ /** Size of the message in bytes */
3190
+ size: z.ZodOptional<z.ZodNumber>;
3191
+ /** Any errors that occurred during processing */
3192
+ error: z.ZodOptional<z.ZodString>;
3193
+ }, "strip", z.ZodTypeAny, {
3194
+ error?: string | undefined;
3195
+ size?: number | undefined;
3196
+ }, {
3197
+ error?: string | undefined;
3198
+ size?: number | undefined;
3199
+ }>>;
3200
+ }, "strip", z.ZodTypeAny, {
3201
+ message: {
3202
+ type: "server.ready";
3203
+ id: string;
3204
+ data: {
3205
+ serverVersion: string;
3206
+ executionPath: string;
3207
+ agentRootPath: string;
3208
+ dataPath: string;
3209
+ port: number;
3210
+ proxyPort?: number | undefined;
3211
+ outputDirectory?: string | undefined;
3212
+ };
3213
+ timestamp: string;
3214
+ } | {
3215
+ type: "state.snapshot";
3216
+ id: string;
3217
+ data: {
3218
+ completedCodons: {
3219
+ status: "completed" | "failed" | "skipped" | "running" | "preparing" | "starting" | "initializing" | "completing-sentinels";
3220
+ codonId: string;
3221
+ startTime: string;
3222
+ cost?: number | undefined;
3223
+ duration?: number | undefined;
3224
+ description?: string | undefined;
3225
+ codonName?: string | undefined;
3226
+ endTime?: string | undefined;
3227
+ sessionId?: string | undefined;
3228
+ previousSessionId?: string | undefined;
3229
+ claudeSessionId?: string | undefined;
3230
+ tokenUsage?: {
3231
+ outputTokens: number;
3232
+ inputTokens: number;
3233
+ cacheCreationTokens: number;
3234
+ cacheReadTokens: number;
3235
+ } | undefined;
3236
+ exitStatus?: {
3237
+ type: "success";
3238
+ } | {
3239
+ type: "error";
3240
+ code: number;
3241
+ } | {
3242
+ type: "killed";
3243
+ signal: string;
3244
+ } | undefined;
3245
+ failureReason?: {
3246
+ type: "unknown" | "timeout" | "rate-limit" | "api-error" | "sentinel-load-failure";
3247
+ retriable: boolean;
3248
+ message?: string | undefined;
3249
+ sentinelRefs?: string[] | undefined;
3250
+ } | undefined;
3251
+ finalCost?: number | undefined;
3252
+ partialCost?: number | undefined;
3253
+ currentCost?: number | undefined;
3254
+ completionCheckpoint?: string | undefined;
3255
+ rigSetupCheckpoint?: string | undefined;
3256
+ errorCheckpoint?: string | undefined;
3257
+ skipCheckpoint?: string | undefined;
3258
+ }[];
3259
+ fileTree: import("./event-schemas.js").FileNode[];
3260
+ totalCost: number;
3261
+ totalTime: number;
3262
+ isRollingBack: boolean;
3263
+ currentCodon?: {
3264
+ status: "completed" | "failed" | "skipped" | "running" | "preparing" | "starting" | "initializing" | "completing-sentinels";
3265
+ codonId: string;
3266
+ startTime: string;
3267
+ cost?: number | undefined;
3268
+ duration?: number | undefined;
3269
+ description?: string | undefined;
3270
+ codonName?: string | undefined;
3271
+ endTime?: string | undefined;
3272
+ sessionId?: string | undefined;
3273
+ previousSessionId?: string | undefined;
3274
+ claudeSessionId?: string | undefined;
3275
+ tokenUsage?: {
3276
+ outputTokens: number;
3277
+ inputTokens: number;
3278
+ cacheCreationTokens: number;
3279
+ cacheReadTokens: number;
3280
+ } | undefined;
3281
+ exitStatus?: {
3282
+ type: "success";
3283
+ } | {
3284
+ type: "error";
3285
+ code: number;
3286
+ } | {
3287
+ type: "killed";
3288
+ signal: string;
3289
+ } | undefined;
3290
+ failureReason?: {
3291
+ type: "unknown" | "timeout" | "rate-limit" | "api-error" | "sentinel-load-failure";
3292
+ retriable: boolean;
3293
+ message?: string | undefined;
3294
+ sentinelRefs?: string[] | undefined;
3295
+ } | undefined;
3296
+ finalCost?: number | undefined;
3297
+ partialCost?: number | undefined;
3298
+ currentCost?: number | undefined;
3299
+ completionCheckpoint?: string | undefined;
3300
+ rigSetupCheckpoint?: string | undefined;
3301
+ errorCheckpoint?: string | undefined;
3302
+ skipCheckpoint?: string | undefined;
3303
+ } | undefined;
3304
+ recentFileAccess?: {
3305
+ path: string;
3306
+ content: string;
3307
+ timestamp: Date;
3308
+ } | undefined;
3309
+ };
3310
+ timestamp: string;
3311
+ } | {
3312
+ type: "codon.started";
3313
+ id: string;
3314
+ data: {
3315
+ codonId: string;
3316
+ codonName: string;
3317
+ startTime: string;
3318
+ sessionId: string;
3319
+ previousSessionId?: string | undefined;
3320
+ codonDescription?: string | undefined;
3321
+ promptMetadata?: {
3322
+ name?: string | undefined;
3323
+ description?: string | undefined;
3324
+ tags?: string[] | undefined;
3325
+ version?: string | undefined;
3326
+ author?: string | undefined;
3327
+ } | undefined;
3328
+ };
3329
+ timestamp: string;
3330
+ } | {
3331
+ type: "codon.completed";
3332
+ id: string;
3333
+ data: {
3334
+ cost: number;
3335
+ duration: number;
3336
+ success: boolean;
3337
+ codonId: string;
3338
+ exitStatus: {
3339
+ type: "success";
3340
+ } | {
3341
+ type: "error";
3342
+ code: number;
3343
+ } | {
3344
+ type: "killed";
3345
+ signal: string;
3346
+ };
3347
+ failureReason?: {
3348
+ type: "unknown" | "timeout" | "rate-limit" | "api-error" | "sentinel-load-failure";
3349
+ retriable: boolean;
3350
+ message?: string | undefined;
3351
+ sentinelRefs?: string[] | undefined;
3352
+ } | undefined;
3353
+ failureIgnored?: boolean | undefined;
3354
+ budgetExceeded?: {
3355
+ currency: "cost" | "duration" | "outputTokens" | "contextTokens";
3356
+ limit: number;
3357
+ used: number;
3358
+ } | undefined;
3359
+ };
3360
+ timestamp: string;
3361
+ } | {
3362
+ type: "codon.extended";
3363
+ id: string;
3364
+ data: {
3365
+ codonId: string;
3366
+ codonName: string;
3367
+ extensionNumber: number;
3368
+ exhaustWithPrompt: string;
3369
+ cumulativeTokens: {
3370
+ outputTokens: number;
3371
+ inputTokens: number;
3372
+ cacheCreationTokens: number;
3373
+ cacheReadTokens: number;
3374
+ };
3375
+ cumulativeCost: number;
3376
+ };
3377
+ timestamp: string;
3378
+ } | {
3379
+ type: "assistant.action";
3380
+ id: string;
3381
+ data: {
3382
+ content: string;
3383
+ codonId: string;
3384
+ action: "message" | "tool_use" | "thinking";
3385
+ toolName?: string | undefined;
3386
+ toolInput?: Record<string, unknown> | undefined;
3387
+ };
3388
+ timestamp: string;
3389
+ } | {
3390
+ type: "token.usage";
3391
+ id: string;
3392
+ data: {
3393
+ outputTokens: number;
3394
+ inputTokens: number;
3395
+ codonId: string;
3396
+ cacheCreationTokens: number;
3397
+ cacheReadTokens: number;
3398
+ totalCost: number;
3399
+ modelId?: string | undefined;
3400
+ modelUsage?: Record<string, {
3401
+ outputTokens: number;
3402
+ inputTokens: number;
3403
+ costUSD: number;
3404
+ cacheReadInputTokens?: number | undefined;
3405
+ cacheCreationInputTokens?: number | undefined;
3406
+ }> | undefined;
3407
+ };
3408
+ timestamp: string;
3409
+ } | {
3410
+ type: "tool.result";
3411
+ id: string;
3412
+ data: {
3413
+ result: string;
3414
+ toolName: string;
3415
+ isError: boolean;
3416
+ codonId: string;
3417
+ toolUseId: string;
3418
+ truncated: boolean;
3419
+ originalLength: number;
3420
+ executionTimeMs: number;
3421
+ };
3422
+ timestamp: string;
3423
+ } | {
3424
+ type: "file.updated";
3425
+ id: string;
3426
+ data: {
3427
+ path: string;
3428
+ content: string;
3429
+ filename: string;
3430
+ action: "created" | "modified" | "deleted";
3431
+ };
3432
+ timestamp: string;
3433
+ } | {
3434
+ type: "filetree.updated";
3435
+ id: string;
3436
+ data: {
3437
+ tree: import("./event-schemas.js").FileNode[];
3438
+ };
3439
+ timestamp: string;
3440
+ } | {
3441
+ type: "rig.setup.completed";
3442
+ id: string;
3443
+ data: {
3444
+ codonId: string;
3445
+ rigType: "command" | "commands";
3446
+ commandCount: number;
3447
+ durationMs: number;
3448
+ createdCheckpoint: boolean;
3449
+ };
3450
+ timestamp: string;
3451
+ } | {
3452
+ type: "rig.setup.failed";
3453
+ id: string;
3454
+ data: {
3455
+ codonId: string;
3456
+ failureType: "other" | "timeout" | "command_failed";
3457
+ ignored: boolean;
3458
+ exitCode?: number | undefined;
3459
+ commandIndex?: number | undefined;
3460
+ };
3461
+ timestamp: string;
3462
+ } | {
3463
+ type: "rig.output";
3464
+ id: string;
3465
+ data: {
3466
+ stream: "stdout" | "stderr";
3467
+ codonId: string;
3468
+ commandIndex: number;
3469
+ line: string;
3470
+ };
3471
+ timestamp: string;
3472
+ } | {
3473
+ type: "loop.iteration.completed";
3474
+ id: string;
3475
+ data: {
3476
+ durationMs: number;
3477
+ loopId: string;
3478
+ iteration: number;
3479
+ costUsd: number;
3480
+ tokensUsed: number;
3481
+ isFinal: boolean;
3482
+ terminationReason?: "iteration_limit" | "context_exceeded" | "sentinel_skip" | "failure" | undefined;
3483
+ };
3484
+ timestamp: string;
3485
+ } | {
3486
+ type: "error";
3487
+ id: string;
3488
+ data: {
3489
+ message: string;
3490
+ fatal: boolean;
3491
+ code?: string | undefined;
3492
+ codon?: string | undefined;
3493
+ severity?: "codon" | "fatal" | "operation" | "warning" | undefined;
3494
+ context?: string | undefined;
3495
+ };
3496
+ timestamp: string;
3497
+ } | {
3498
+ type: "incomplete.codon";
3499
+ id: string;
3500
+ data: {
3501
+ message: string;
3502
+ codonId: string;
3503
+ codonName: string;
3504
+ };
3505
+ timestamp: string;
3506
+ } | {
3507
+ type: "info";
3508
+ id: string;
3509
+ data: {
3510
+ message: string;
3511
+ };
3512
+ timestamp: string;
3513
+ } | {
3514
+ type: "server.idle";
3515
+ id: string;
3516
+ data: {
3517
+ message: string;
3518
+ reason: "startup" | "codon-completed" | "all-codons-completed" | "rollback-completed";
3519
+ };
3520
+ timestamp: string;
3521
+ } | {
3522
+ type: "checkpoint.list";
3523
+ id: string;
3524
+ data: {
3525
+ runId: string;
3526
+ checkpoints: {
3527
+ status: "completed" | "failed" | "skipped" | "running" | "preparing" | "starting" | "initializing" | "completing-sentinels";
3528
+ timestamp: string;
3529
+ codonId: string;
3530
+ codonName: string;
3531
+ checkpointType: "completed" | "skipped" | "error" | "rig-setup";
3532
+ sha: string;
3533
+ }[];
3534
+ currentBranch: string;
3535
+ };
3536
+ timestamp: string;
3537
+ } | {
3538
+ type: "rollback.started";
3539
+ id: string;
3540
+ data: {
3541
+ checkpointType: string;
3542
+ fromRun: string;
3543
+ fromCodon: string;
3544
+ toCodon: string;
3545
+ toCheckpoint: string;
3546
+ codonsToProcess: string[];
3547
+ };
3548
+ timestamp: string;
3549
+ } | {
3550
+ type: "rollback.codonCheckpoint";
3551
+ id: string;
3552
+ data: {
3553
+ message: string;
3554
+ codonId: string;
3555
+ codonName: string;
3556
+ checkpointType: string;
3557
+ checkpoint: string;
3558
+ };
3559
+ timestamp: string;
3560
+ } | {
3561
+ type: "rollback.rigCleanup";
3562
+ id: string;
3563
+ data: {
3564
+ status: "completed" | "failed" | "partial" | "started";
3565
+ codonId: string;
3566
+ codonName: string;
3567
+ directories: string[];
3568
+ error?: string | undefined;
3569
+ successfulCleanups?: string[] | undefined;
3570
+ failedCleanups?: {
3571
+ error: string;
3572
+ directory: string;
3573
+ }[] | undefined;
3574
+ };
3575
+ timestamp: string;
3576
+ } | {
3577
+ type: "rollback.progress";
3578
+ id: string;
3579
+ data: {
3580
+ message: string;
3581
+ currentStep: number;
3582
+ totalSteps: number;
3583
+ };
3584
+ timestamp: string;
3585
+ } | {
3586
+ type: "rollback.completed";
3587
+ id: string;
3588
+ data: {
3589
+ codonId: string;
3590
+ codonName: string;
3591
+ checkpointType: string;
3592
+ fromRun: string;
3593
+ checkpoint: string;
3594
+ toRun: string;
3595
+ autoRestart: boolean;
3596
+ };
3597
+ timestamp: string;
3598
+ } | {
3599
+ type: "rollback.archiveRestore";
3600
+ id: string;
3601
+ data: {
3602
+ status: "completed" | "failed" | "partial";
3603
+ codonId: string;
3604
+ restoredPaths: string[];
3605
+ failedPaths?: {
3606
+ path: string;
3607
+ error: string;
3608
+ }[] | undefined;
3609
+ };
3610
+ timestamp: string;
3611
+ } | {
3612
+ type: "archive.completed";
3613
+ id: string;
3614
+ data: {
3615
+ codonId: string;
3616
+ archivedPaths: string[];
3617
+ };
3618
+ timestamp: string;
3619
+ } | {
3620
+ type: "archive.partial";
3621
+ id: string;
3622
+ data: {
3623
+ codonId: string;
3624
+ failedPaths: {
3625
+ path: string;
3626
+ error: string;
3627
+ }[];
3628
+ archivedPaths: string[];
3629
+ };
3630
+ timestamp: string;
3631
+ } | {
3632
+ type: "pong";
3633
+ id: string;
3634
+ data: {
3635
+ message: string;
3636
+ timestamp: string;
3637
+ clientId?: string | undefined;
3638
+ };
3639
+ timestamp: string;
3640
+ } | {
3641
+ type: "history.batch";
3642
+ id: string;
3643
+ data: {
3644
+ events: any[];
3645
+ hasMore: boolean;
3646
+ };
3647
+ timestamp: string;
3648
+ } | {
3649
+ type: "state.transition";
3650
+ id: string;
3651
+ data: {
3652
+ transitionType: "RunStarted" | "RunCompleted" | "RunFailed" | "RunCrashed" | "CodonStarted" | "CodonTransitioned" | "CostsUpdated" | "CostsIncremented" | "AssistantMessageCountUpdated" | "ExtensionCountUpdated" | "CheckpointCreated" | "InitialCheckpointSet" | "CodonFinalCostSet" | "SentinelStatesUpdated";
3653
+ transition: {
3654
+ type: string;
3655
+ data: Record<string, unknown>;
3656
+ };
3657
+ resultingState: {
3658
+ totalCost: number;
3659
+ currentRunId: string | null;
3660
+ runCount: number;
3661
+ currentRunCost: number;
3662
+ };
3663
+ codonId?: string | undefined;
3664
+ runId?: string | undefined;
3665
+ };
3666
+ timestamp: string;
3667
+ } | {
3668
+ type: "sentinel.loaded";
3669
+ id: string;
3670
+ data: {
3671
+ model: string;
3672
+ codonId: string;
3673
+ sentinelId: string;
3674
+ triggerType: "event" | "sequence";
3675
+ executionStrategy: "immediate" | "debounce" | "count" | "timeWindow";
3676
+ conversational: boolean;
3677
+ source: "file" | "inline";
3678
+ sourcePath?: string | undefined;
3679
+ };
3680
+ timestamp: string;
3681
+ } | {
3682
+ type: "sentinel.unloaded";
3683
+ id: string;
3684
+ data: {
3685
+ codonId: string;
3686
+ finalCost: number;
3687
+ reason: "codon-complete" | "fatal-error" | "consecutive-failures" | "shutdown";
3688
+ sentinelId: string;
3689
+ llmCallCount: number;
3690
+ errorType?: "template" | "configuration" | "corruption" | "resource" | undefined;
3691
+ };
3692
+ timestamp: string;
3693
+ } | {
3694
+ type: "sentinel.error";
3695
+ id: string;
3696
+ data: {
3697
+ message: string;
3698
+ codonId: string;
3699
+ retriable: boolean;
3700
+ sentinelId: string;
3701
+ errorType: "llm-call-failed" | "template-render-failed" | "file-write-failed";
3702
+ consecutiveFailureCount: number;
3703
+ };
3704
+ timestamp: string;
3705
+ } | {
3706
+ type: "sentinel.output";
3707
+ id: string;
3708
+ data: {
3709
+ cost: number;
3710
+ content: string | Record<string, unknown>;
3711
+ codonId: string;
3712
+ sentinelId: string;
3713
+ triggerNumber: number;
3714
+ outputType: "text" | "structured";
3715
+ tokens: {
3716
+ input: number;
3717
+ output: number;
3718
+ };
3719
+ eventCount: number;
3720
+ };
3721
+ timestamp: string;
3722
+ } | {
3723
+ type: "sentinel.triggered";
3724
+ id: string;
3725
+ data: {
3726
+ codonId: string;
3727
+ sentinelId: string;
3728
+ triggerNumber: number;
3729
+ eventCount: number;
3730
+ strategy: "immediate" | "debounce" | "count" | "timeWindow";
3731
+ queueSize: number;
3732
+ };
3733
+ timestamp: string;
3734
+ } | {
3735
+ type: "budget.summary";
3736
+ id: string;
3737
+ data: {
3738
+ ceiling: {
3739
+ maxDollars?: number | undefined;
3740
+ maxTimeSeconds?: number | undefined;
3741
+ };
3742
+ allocation: "shared" | "proportional" | "proportional-strict";
3743
+ rows: {
3744
+ status: "completed" | "failed" | "skipped" | "exceeded" | "running";
3745
+ codonId: string;
3746
+ budget: {
3747
+ maxOutputTokens?: number | undefined;
3748
+ maxDollars?: number | undefined;
3749
+ maxTimeSeconds?: number | undefined;
3750
+ };
3751
+ actual: {
3752
+ outputTokens: number;
3753
+ dollars: number;
3754
+ timeSeconds: number;
3755
+ };
3756
+ loopContext?: {
3757
+ loopId: string;
3758
+ iteration: number;
3759
+ codonIndexInLoop: number;
3760
+ } | undefined;
3761
+ }[];
3762
+ totals: {
3763
+ actualDollars: number;
3764
+ actualTimeSeconds: number;
3765
+ budgetDollars?: number | undefined;
3766
+ };
3767
+ };
3768
+ timestamp: string;
3769
+ } | {
3770
+ type: "codon.start";
3771
+ id: string;
3772
+ data: {
3773
+ codonId: string;
3774
+ skipPreCommands?: boolean | undefined;
3775
+ };
3776
+ } | {
3777
+ type: "codon.next";
3778
+ id: string;
3779
+ } | {
3780
+ type: "codon.skip";
3781
+ id: string;
3782
+ } | {
3783
+ type: "codon.redo";
3784
+ id: string;
3785
+ } | {
3786
+ type: "server.shutdown";
3787
+ id: string;
3788
+ } | {
3789
+ type: "codon.forceStop";
3790
+ id: string;
3791
+ data?: {
3792
+ reason?: string | undefined;
3793
+ } | undefined;
3794
+ } | {
3795
+ type: "checkpoint.list";
3796
+ id: string;
3797
+ data?: {
3798
+ runId?: string | undefined;
3799
+ } | undefined;
3800
+ } | {
3801
+ type: "rollback.toCheckpoint";
3802
+ id: string;
3803
+ data: {
3804
+ checkpointSha: string;
3805
+ autoRestart?: boolean | undefined;
3806
+ };
3807
+ } | {
3808
+ type: "rollback.toCodon";
3809
+ id: string;
3810
+ data: {
3811
+ codonId: string;
3812
+ checkpointType: "completed" | "skipped" | "error" | "rig-setup" | "start" | "end";
3813
+ autoRestart?: boolean | undefined;
3814
+ };
3815
+ } | {
3816
+ type: "rollback.toLastSuccess";
3817
+ id: string;
3818
+ data?: {
3819
+ autoRestart?: boolean | undefined;
3820
+ } | undefined;
3821
+ } | {
3822
+ type: "ping";
3823
+ id: string;
3824
+ } | {
3825
+ type: "ping.broadcast";
3826
+ id: string;
3827
+ } | {
3828
+ type: "history.sync";
3829
+ id: string;
3830
+ };
3831
+ loggedAt: string;
3832
+ direction: "in" | "out";
3833
+ metadata?: {
3834
+ error?: string | undefined;
3835
+ size?: number | undefined;
3836
+ } | undefined;
3837
+ }, {
3838
+ message: {
3839
+ type: "server.ready";
3840
+ id: string;
3841
+ data: {
3842
+ serverVersion: string;
3843
+ executionPath: string;
3844
+ agentRootPath: string;
3845
+ dataPath: string;
3846
+ port: number;
3847
+ proxyPort?: number | undefined;
3848
+ outputDirectory?: string | undefined;
3849
+ };
3850
+ timestamp: string;
3851
+ } | {
3852
+ type: "state.snapshot";
3853
+ id: string;
3854
+ data: {
3855
+ completedCodons: {
3856
+ status: "completed" | "failed" | "skipped" | "running" | "preparing" | "starting" | "initializing" | "completing-sentinels";
3857
+ codonId: string;
3858
+ startTime: string;
3859
+ cost?: number | undefined;
3860
+ duration?: number | undefined;
3861
+ description?: string | undefined;
3862
+ codonName?: string | undefined;
3863
+ endTime?: string | undefined;
3864
+ sessionId?: string | undefined;
3865
+ previousSessionId?: string | undefined;
3866
+ claudeSessionId?: string | undefined;
3867
+ tokenUsage?: {
3868
+ outputTokens: number;
3869
+ inputTokens: number;
3870
+ cacheCreationTokens: number;
3871
+ cacheReadTokens: number;
3872
+ } | undefined;
3873
+ exitStatus?: {
3874
+ type: "success";
3875
+ } | {
3876
+ type: "error";
3877
+ code: number;
3878
+ } | {
3879
+ type: "killed";
3880
+ signal: string;
3881
+ } | undefined;
3882
+ failureReason?: {
3883
+ type: "unknown" | "timeout" | "rate-limit" | "api-error" | "sentinel-load-failure";
3884
+ retriable: boolean;
3885
+ message?: string | undefined;
3886
+ sentinelRefs?: string[] | undefined;
3887
+ } | undefined;
3888
+ finalCost?: number | undefined;
3889
+ partialCost?: number | undefined;
3890
+ currentCost?: number | undefined;
3891
+ completionCheckpoint?: string | undefined;
3892
+ rigSetupCheckpoint?: string | undefined;
3893
+ errorCheckpoint?: string | undefined;
3894
+ skipCheckpoint?: string | undefined;
3895
+ }[];
3896
+ fileTree: import("./event-schemas.js").FileNode[];
3897
+ totalCost: number;
3898
+ totalTime: number;
3899
+ isRollingBack: boolean;
3900
+ currentCodon?: {
3901
+ status: "completed" | "failed" | "skipped" | "running" | "preparing" | "starting" | "initializing" | "completing-sentinels";
3902
+ codonId: string;
3903
+ startTime: string;
3904
+ cost?: number | undefined;
3905
+ duration?: number | undefined;
3906
+ description?: string | undefined;
3907
+ codonName?: string | undefined;
3908
+ endTime?: string | undefined;
3909
+ sessionId?: string | undefined;
3910
+ previousSessionId?: string | undefined;
3911
+ claudeSessionId?: string | undefined;
3912
+ tokenUsage?: {
3913
+ outputTokens: number;
3914
+ inputTokens: number;
3915
+ cacheCreationTokens: number;
3916
+ cacheReadTokens: number;
3917
+ } | undefined;
3918
+ exitStatus?: {
3919
+ type: "success";
3920
+ } | {
3921
+ type: "error";
3922
+ code: number;
3923
+ } | {
3924
+ type: "killed";
3925
+ signal: string;
3926
+ } | undefined;
3927
+ failureReason?: {
3928
+ type: "unknown" | "timeout" | "rate-limit" | "api-error" | "sentinel-load-failure";
3929
+ retriable: boolean;
3930
+ message?: string | undefined;
3931
+ sentinelRefs?: string[] | undefined;
3932
+ } | undefined;
3933
+ finalCost?: number | undefined;
3934
+ partialCost?: number | undefined;
3935
+ currentCost?: number | undefined;
3936
+ completionCheckpoint?: string | undefined;
3937
+ rigSetupCheckpoint?: string | undefined;
3938
+ errorCheckpoint?: string | undefined;
3939
+ skipCheckpoint?: string | undefined;
3940
+ } | undefined;
3941
+ recentFileAccess?: {
3942
+ path: string;
3943
+ content: string;
3944
+ timestamp: Date;
3945
+ } | undefined;
3946
+ };
3947
+ timestamp: string;
3948
+ } | {
3949
+ type: "codon.started";
3950
+ id: string;
3951
+ data: {
3952
+ codonId: string;
3953
+ codonName: string;
3954
+ startTime: string;
3955
+ sessionId: string;
3956
+ previousSessionId?: string | undefined;
3957
+ codonDescription?: string | undefined;
3958
+ promptMetadata?: {
3959
+ name?: string | undefined;
3960
+ description?: string | undefined;
3961
+ tags?: string[] | undefined;
3962
+ version?: string | undefined;
3963
+ author?: string | undefined;
3964
+ } | undefined;
3965
+ };
3966
+ timestamp: string;
3967
+ } | {
3968
+ type: "codon.completed";
3969
+ id: string;
3970
+ data: {
3971
+ cost: number;
3972
+ duration: number;
3973
+ success: boolean;
3974
+ codonId: string;
3975
+ exitStatus: {
3976
+ type: "success";
3977
+ } | {
3978
+ type: "error";
3979
+ code: number;
3980
+ } | {
3981
+ type: "killed";
3982
+ signal: string;
3983
+ };
3984
+ failureReason?: {
3985
+ type: "unknown" | "timeout" | "rate-limit" | "api-error" | "sentinel-load-failure";
3986
+ retriable: boolean;
3987
+ message?: string | undefined;
3988
+ sentinelRefs?: string[] | undefined;
3989
+ } | undefined;
3990
+ failureIgnored?: boolean | undefined;
3991
+ budgetExceeded?: {
3992
+ currency: "cost" | "duration" | "outputTokens" | "contextTokens";
3993
+ limit: number;
3994
+ used: number;
3995
+ } | undefined;
3996
+ };
3997
+ timestamp: string;
3998
+ } | {
3999
+ type: "codon.extended";
4000
+ id: string;
4001
+ data: {
4002
+ codonId: string;
4003
+ codonName: string;
4004
+ extensionNumber: number;
4005
+ exhaustWithPrompt: string;
4006
+ cumulativeTokens: {
4007
+ outputTokens: number;
4008
+ inputTokens: number;
4009
+ cacheCreationTokens: number;
4010
+ cacheReadTokens: number;
4011
+ };
4012
+ cumulativeCost: number;
4013
+ };
4014
+ timestamp: string;
4015
+ } | {
4016
+ type: "assistant.action";
4017
+ id: string;
4018
+ data: {
4019
+ content: string;
4020
+ codonId: string;
4021
+ action: "message" | "tool_use" | "thinking";
4022
+ toolName?: string | undefined;
4023
+ toolInput?: Record<string, unknown> | undefined;
4024
+ };
4025
+ timestamp: string;
4026
+ } | {
4027
+ type: "token.usage";
4028
+ id: string;
4029
+ data: {
4030
+ outputTokens: number;
4031
+ inputTokens: number;
4032
+ codonId: string;
4033
+ cacheCreationTokens: number;
4034
+ cacheReadTokens: number;
4035
+ totalCost: number;
4036
+ modelId?: string | undefined;
4037
+ modelUsage?: Record<string, {
4038
+ outputTokens: number;
4039
+ inputTokens: number;
4040
+ costUSD: number;
4041
+ cacheReadInputTokens?: number | undefined;
4042
+ cacheCreationInputTokens?: number | undefined;
4043
+ }> | undefined;
4044
+ };
4045
+ timestamp: string;
4046
+ } | {
4047
+ type: "tool.result";
4048
+ id: string;
4049
+ data: {
4050
+ result: string;
4051
+ toolName: string;
4052
+ isError: boolean;
4053
+ codonId: string;
4054
+ toolUseId: string;
4055
+ truncated: boolean;
4056
+ originalLength: number;
4057
+ executionTimeMs: number;
4058
+ };
4059
+ timestamp: string;
4060
+ } | {
4061
+ type: "file.updated";
4062
+ id: string;
4063
+ data: {
4064
+ path: string;
4065
+ content: string;
4066
+ filename: string;
4067
+ action: "created" | "modified" | "deleted";
4068
+ };
4069
+ timestamp: string;
4070
+ } | {
4071
+ type: "filetree.updated";
4072
+ id: string;
4073
+ data: {
4074
+ tree: import("./event-schemas.js").FileNode[];
4075
+ };
4076
+ timestamp: string;
4077
+ } | {
4078
+ type: "rig.setup.completed";
4079
+ id: string;
4080
+ data: {
4081
+ codonId: string;
4082
+ rigType: "command" | "commands";
4083
+ commandCount: number;
4084
+ durationMs: number;
4085
+ createdCheckpoint: boolean;
4086
+ };
4087
+ timestamp: string;
4088
+ } | {
4089
+ type: "rig.setup.failed";
4090
+ id: string;
4091
+ data: {
4092
+ codonId: string;
4093
+ failureType: "other" | "timeout" | "command_failed";
4094
+ ignored: boolean;
4095
+ exitCode?: number | undefined;
4096
+ commandIndex?: number | undefined;
4097
+ };
4098
+ timestamp: string;
4099
+ } | {
4100
+ type: "rig.output";
4101
+ id: string;
4102
+ data: {
4103
+ stream: "stdout" | "stderr";
4104
+ codonId: string;
4105
+ commandIndex: number;
4106
+ line: string;
4107
+ };
4108
+ timestamp: string;
4109
+ } | {
4110
+ type: "loop.iteration.completed";
4111
+ id: string;
4112
+ data: {
4113
+ durationMs: number;
4114
+ loopId: string;
4115
+ iteration: number;
4116
+ costUsd: number;
4117
+ tokensUsed: number;
4118
+ isFinal: boolean;
4119
+ terminationReason?: "iteration_limit" | "context_exceeded" | "sentinel_skip" | "failure" | undefined;
4120
+ };
4121
+ timestamp: string;
4122
+ } | {
4123
+ type: "error";
4124
+ id: string;
4125
+ data: {
4126
+ message: string;
4127
+ fatal: boolean;
4128
+ code?: string | undefined;
4129
+ codon?: string | undefined;
4130
+ severity?: "codon" | "fatal" | "operation" | "warning" | undefined;
4131
+ context?: string | undefined;
4132
+ };
4133
+ timestamp: string;
4134
+ } | {
4135
+ type: "incomplete.codon";
4136
+ id: string;
4137
+ data: {
4138
+ message: string;
4139
+ codonId: string;
4140
+ codonName: string;
4141
+ };
4142
+ timestamp: string;
4143
+ } | {
4144
+ type: "info";
4145
+ id: string;
4146
+ data: {
4147
+ message: string;
4148
+ };
4149
+ timestamp: string;
4150
+ } | {
4151
+ type: "server.idle";
4152
+ id: string;
4153
+ data: {
4154
+ message: string;
4155
+ reason: "startup" | "codon-completed" | "all-codons-completed" | "rollback-completed";
4156
+ };
4157
+ timestamp: string;
4158
+ } | {
4159
+ type: "checkpoint.list";
4160
+ id: string;
4161
+ data: {
4162
+ runId: string;
4163
+ checkpoints: {
4164
+ status: "completed" | "failed" | "skipped" | "running" | "preparing" | "starting" | "initializing" | "completing-sentinels";
4165
+ timestamp: string;
4166
+ codonId: string;
4167
+ codonName: string;
4168
+ checkpointType: "completed" | "skipped" | "error" | "rig-setup";
4169
+ sha: string;
4170
+ }[];
4171
+ currentBranch: string;
4172
+ };
4173
+ timestamp: string;
4174
+ } | {
4175
+ type: "rollback.started";
4176
+ id: string;
4177
+ data: {
4178
+ checkpointType: string;
4179
+ fromRun: string;
4180
+ fromCodon: string;
4181
+ toCodon: string;
4182
+ toCheckpoint: string;
4183
+ codonsToProcess: string[];
4184
+ };
4185
+ timestamp: string;
4186
+ } | {
4187
+ type: "rollback.codonCheckpoint";
4188
+ id: string;
4189
+ data: {
4190
+ message: string;
4191
+ codonId: string;
4192
+ codonName: string;
4193
+ checkpointType: string;
4194
+ checkpoint: string;
4195
+ };
4196
+ timestamp: string;
4197
+ } | {
4198
+ type: "rollback.rigCleanup";
4199
+ id: string;
4200
+ data: {
4201
+ status: "completed" | "failed" | "partial" | "started";
4202
+ codonId: string;
4203
+ codonName: string;
4204
+ directories: string[];
4205
+ error?: string | undefined;
4206
+ successfulCleanups?: string[] | undefined;
4207
+ failedCleanups?: {
4208
+ error: string;
4209
+ directory: string;
4210
+ }[] | undefined;
4211
+ };
4212
+ timestamp: string;
4213
+ } | {
4214
+ type: "rollback.progress";
4215
+ id: string;
4216
+ data: {
4217
+ message: string;
4218
+ currentStep: number;
4219
+ totalSteps: number;
4220
+ };
4221
+ timestamp: string;
4222
+ } | {
4223
+ type: "rollback.completed";
4224
+ id: string;
4225
+ data: {
4226
+ codonId: string;
4227
+ codonName: string;
4228
+ checkpointType: string;
4229
+ fromRun: string;
4230
+ checkpoint: string;
4231
+ toRun: string;
4232
+ autoRestart: boolean;
4233
+ };
4234
+ timestamp: string;
4235
+ } | {
4236
+ type: "rollback.archiveRestore";
4237
+ id: string;
4238
+ data: {
4239
+ status: "completed" | "failed" | "partial";
4240
+ codonId: string;
4241
+ restoredPaths: string[];
4242
+ failedPaths?: {
4243
+ path: string;
4244
+ error: string;
4245
+ }[] | undefined;
4246
+ };
4247
+ timestamp: string;
4248
+ } | {
4249
+ type: "archive.completed";
4250
+ id: string;
4251
+ data: {
4252
+ codonId: string;
4253
+ archivedPaths: string[];
4254
+ };
4255
+ timestamp: string;
4256
+ } | {
4257
+ type: "archive.partial";
4258
+ id: string;
4259
+ data: {
4260
+ codonId: string;
4261
+ failedPaths: {
4262
+ path: string;
4263
+ error: string;
4264
+ }[];
4265
+ archivedPaths: string[];
4266
+ };
4267
+ timestamp: string;
4268
+ } | {
4269
+ type: "pong";
4270
+ id: string;
4271
+ data: {
4272
+ message: string;
4273
+ timestamp: string;
4274
+ clientId?: string | undefined;
4275
+ };
4276
+ timestamp: string;
4277
+ } | {
4278
+ type: "history.batch";
4279
+ id: string;
4280
+ data: {
4281
+ events: any[];
4282
+ hasMore: boolean;
4283
+ };
4284
+ timestamp: string;
4285
+ } | {
4286
+ type: "state.transition";
4287
+ id: string;
4288
+ data: {
4289
+ transitionType: "RunStarted" | "RunCompleted" | "RunFailed" | "RunCrashed" | "CodonStarted" | "CodonTransitioned" | "CostsUpdated" | "CostsIncremented" | "AssistantMessageCountUpdated" | "ExtensionCountUpdated" | "CheckpointCreated" | "InitialCheckpointSet" | "CodonFinalCostSet" | "SentinelStatesUpdated";
4290
+ transition: {
4291
+ type: string;
4292
+ data: Record<string, unknown>;
4293
+ };
4294
+ resultingState: {
4295
+ totalCost: number;
4296
+ currentRunId: string | null;
4297
+ runCount: number;
4298
+ currentRunCost: number;
4299
+ };
4300
+ codonId?: string | undefined;
4301
+ runId?: string | undefined;
4302
+ };
4303
+ timestamp: string;
4304
+ } | {
4305
+ type: "sentinel.loaded";
4306
+ id: string;
4307
+ data: {
4308
+ model: string;
4309
+ codonId: string;
4310
+ sentinelId: string;
4311
+ triggerType: "event" | "sequence";
4312
+ executionStrategy: "immediate" | "debounce" | "count" | "timeWindow";
4313
+ conversational: boolean;
4314
+ source: "file" | "inline";
4315
+ sourcePath?: string | undefined;
4316
+ };
4317
+ timestamp: string;
4318
+ } | {
4319
+ type: "sentinel.unloaded";
4320
+ id: string;
4321
+ data: {
4322
+ codonId: string;
4323
+ finalCost: number;
4324
+ reason: "codon-complete" | "fatal-error" | "consecutive-failures" | "shutdown";
4325
+ sentinelId: string;
4326
+ llmCallCount: number;
4327
+ errorType?: "template" | "configuration" | "corruption" | "resource" | undefined;
4328
+ };
4329
+ timestamp: string;
4330
+ } | {
4331
+ type: "sentinel.error";
4332
+ id: string;
4333
+ data: {
4334
+ message: string;
4335
+ codonId: string;
4336
+ retriable: boolean;
4337
+ sentinelId: string;
4338
+ errorType: "llm-call-failed" | "template-render-failed" | "file-write-failed";
4339
+ consecutiveFailureCount: number;
4340
+ };
4341
+ timestamp: string;
4342
+ } | {
4343
+ type: "sentinel.output";
4344
+ id: string;
4345
+ data: {
4346
+ cost: number;
4347
+ content: string | Record<string, unknown>;
4348
+ codonId: string;
4349
+ sentinelId: string;
4350
+ triggerNumber: number;
4351
+ outputType: "text" | "structured";
4352
+ tokens: {
4353
+ input: number;
4354
+ output: number;
4355
+ };
4356
+ eventCount: number;
4357
+ };
4358
+ timestamp: string;
4359
+ } | {
4360
+ type: "sentinel.triggered";
4361
+ id: string;
4362
+ data: {
4363
+ codonId: string;
4364
+ sentinelId: string;
4365
+ triggerNumber: number;
4366
+ eventCount: number;
4367
+ strategy: "immediate" | "debounce" | "count" | "timeWindow";
4368
+ queueSize: number;
4369
+ };
4370
+ timestamp: string;
4371
+ } | {
4372
+ type: "budget.summary";
4373
+ id: string;
4374
+ data: {
4375
+ ceiling: {
4376
+ maxDollars?: number | undefined;
4377
+ maxTimeSeconds?: number | undefined;
4378
+ };
4379
+ allocation: "shared" | "proportional" | "proportional-strict";
4380
+ rows: {
4381
+ status: "completed" | "failed" | "skipped" | "exceeded" | "running";
4382
+ codonId: string;
4383
+ budget: {
4384
+ maxOutputTokens?: number | undefined;
4385
+ maxDollars?: number | undefined;
4386
+ maxTimeSeconds?: number | undefined;
4387
+ };
4388
+ actual: {
4389
+ outputTokens: number;
4390
+ dollars: number;
4391
+ timeSeconds: number;
4392
+ };
4393
+ loopContext?: {
4394
+ loopId: string;
4395
+ iteration: number;
4396
+ codonIndexInLoop: number;
4397
+ } | undefined;
4398
+ }[];
4399
+ totals: {
4400
+ actualDollars: number;
4401
+ actualTimeSeconds: number;
4402
+ budgetDollars?: number | undefined;
4403
+ };
4404
+ };
4405
+ timestamp: string;
4406
+ } | {
4407
+ type: "codon.start";
4408
+ id: string;
4409
+ data: {
4410
+ codonId: string;
4411
+ skipPreCommands?: boolean | undefined;
4412
+ };
4413
+ } | {
4414
+ type: "codon.next";
4415
+ id: string;
4416
+ } | {
4417
+ type: "codon.skip";
4418
+ id: string;
4419
+ } | {
4420
+ type: "codon.redo";
4421
+ id: string;
4422
+ } | {
4423
+ type: "server.shutdown";
4424
+ id: string;
4425
+ } | {
4426
+ type: "codon.forceStop";
4427
+ id: string;
4428
+ data?: {
4429
+ reason?: string | undefined;
4430
+ } | undefined;
4431
+ } | {
4432
+ type: "checkpoint.list";
4433
+ id: string;
4434
+ data?: {
4435
+ runId?: string | undefined;
4436
+ } | undefined;
4437
+ } | {
4438
+ type: "rollback.toCheckpoint";
4439
+ id: string;
4440
+ data: {
4441
+ checkpointSha: string;
4442
+ autoRestart?: boolean | undefined;
4443
+ };
4444
+ } | {
4445
+ type: "rollback.toCodon";
4446
+ id: string;
4447
+ data: {
4448
+ codonId: string;
4449
+ checkpointType: "completed" | "skipped" | "error" | "rig-setup" | "start" | "end";
4450
+ autoRestart?: boolean | undefined;
4451
+ };
4452
+ } | {
4453
+ type: "rollback.toLastSuccess";
4454
+ id: string;
4455
+ data?: {
4456
+ autoRestart?: boolean | undefined;
4457
+ } | undefined;
4458
+ } | {
4459
+ type: "ping";
4460
+ id: string;
4461
+ } | {
4462
+ type: "ping.broadcast";
4463
+ id: string;
4464
+ } | {
4465
+ type: "history.sync";
4466
+ id: string;
4467
+ };
4468
+ loggedAt: string;
4469
+ direction: "in" | "out";
4470
+ metadata?: {
4471
+ error?: string | undefined;
4472
+ size?: number | undefined;
4473
+ } | undefined;
4474
+ }>;
4475
+ /**
4476
+ * Inferred TypeScript type from the Zod schema
4477
+ */
4478
+ export type WebSocketLogEntry = z.infer<typeof webSocketLogEntrySchema>;
4479
+ /**
4480
+ * Helper type guard to check if a message is a ServerEvent
4481
+ */
4482
+ export declare function isServerEvent(message: ClientCommand | ServerEvent): message is ServerEvent;
4483
+ /**
4484
+ * Helper type guard to check if a message is a ClientCommand
4485
+ */
4486
+ export declare function isClientCommand(message: ClientCommand | ServerEvent): message is ClientCommand;
4487
+ /**
4488
+ * Extract the message type from a WebSocket message
4489
+ */
4490
+ export declare function getMessageType(message: ClientCommand | ServerEvent): string;
4491
+ /**
4492
+ * Extract relevant context from a message for quick reference
4493
+ */
4494
+ export declare function extractMessageContext(message: ClientCommand | ServerEvent): Record<string, unknown>;
4495
+ /**
4496
+ * Validate and parse a WebSocket log entry
4497
+ */
4498
+ export declare function parseWebSocketLogEntry(data: unknown): WebSocketLogEntry;
4499
+ /**
4500
+ * Safely parse a WebSocket log entry, returning undefined if invalid
4501
+ */
4502
+ export declare function safeParseWebSocketLogEntry(data: unknown): WebSocketLogEntry | undefined;