@illalabs/interfaces 0.4.0-canary-beta-e22dfc29 → 0.4.0-canary-dev-2e2c59d3

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.
@@ -1,3672 +0,0 @@
1
- import { z } from "zod";
2
- /**
3
- * Planning Agent v2 Schemas
4
- *
5
- * These schemas define the contract for the planning system that converts
6
- * user intent into executable, multi-step blockchain operations.
7
- *
8
- * NOTE: These schemas are designed for Azure OpenAI structured output compatibility.
9
- * All properties must be required (use `.nullable()` for optional values) and
10
- * `inputSource` uses arrays instead of records for strict JSON schema compliance.
11
- */
12
- /**
13
- * A single input source entry mapping a parameter name to its source.
14
- * Used for Azure OpenAI strict JSON schema compatibility instead of z.record().
15
- */
16
- export declare const InputSourceEntrySchema: z.ZodObject<{
17
- key: z.ZodString;
18
- value: z.ZodString;
19
- }, "strict", z.ZodTypeAny, {
20
- value: string;
21
- key: string;
22
- }, {
23
- value: string;
24
- key: string;
25
- }>;
26
- export type InputSourceEntry = z.infer<typeof InputSourceEntrySchema>;
27
- /**
28
- * Execution instructions for a single plan step.
29
- * Note: All properties must be required for structured output compatibility
30
- * with providers like Azure OpenAI that enforce strict JSON schemas.
31
- */
32
- export declare const PlanStepExecutionInstructionsSchema: z.ZodObject<{
33
- /** Clear objective for what this step should accomplish */
34
- objective: z.ZodString;
35
- /** Maps input names to sources as array of {key, value} entries */
36
- inputSource: z.ZodArray<z.ZodObject<{
37
- key: z.ZodString;
38
- value: z.ZodString;
39
- }, "strict", z.ZodTypeAny, {
40
- value: string;
41
- key: string;
42
- }, {
43
- value: string;
44
- key: string;
45
- }>, "many">;
46
- /** Description of what output is expected */
47
- expectedOutput: z.ZodString;
48
- /** How to handle errors for this step */
49
- errorHandling: z.ZodString;
50
- /** Additional constraints for execution (required, use empty array if none) */
51
- constraints: z.ZodArray<z.ZodString, "many">;
52
- }, "strict", z.ZodTypeAny, {
53
- objective: string;
54
- inputSource: {
55
- value: string;
56
- key: string;
57
- }[];
58
- expectedOutput: string;
59
- errorHandling: string;
60
- constraints: string[];
61
- }, {
62
- objective: string;
63
- inputSource: {
64
- value: string;
65
- key: string;
66
- }[];
67
- expectedOutput: string;
68
- errorHandling: string;
69
- constraints: string[];
70
- }>;
71
- export type PlanStepExecutionInstructions = z.infer<typeof PlanStepExecutionInstructionsSchema>;
72
- /**
73
- * Step status during execution.
74
- */
75
- export declare const PlanStepStatusSchema: z.ZodEnum<["pending", "in_progress", "completed", "failed", "skipped"]>;
76
- export type PlanStepStatus = z.infer<typeof PlanStepStatusSchema>;
77
- /**
78
- * Operation type - read operations don't require approval,
79
- * write operations do.
80
- */
81
- export declare const OperationTypeSchema: z.ZodEnum<["read", "write"]>;
82
- export type OperationType = z.infer<typeof OperationTypeSchema>;
83
- /**
84
- * Schema for plan steps used in LLM structured output.
85
- * This schema is strict and contains only fields the LLM should generate.
86
- * The result field is omitted as it's populated at execution time.
87
- */
88
- export declare const PlanStepLLMSchema: z.ZodObject<{
89
- /** Sequential step number (1-indexed) */
90
- stepNumber: z.ZodNumber;
91
- /** Human-readable description of what this step does */
92
- description: z.ZodString;
93
- /** Whether this is a read or write operation */
94
- operationType: z.ZodEnum<["read", "write"]>;
95
- /** Whether user must approve before execution */
96
- requiresUserApproval: z.ZodBoolean;
97
- /** Step numbers this step depends on (must complete first) */
98
- dependsOn: z.ZodArray<z.ZodNumber, "many">;
99
- /** Current execution status */
100
- status: z.ZodEnum<["pending", "in_progress", "completed", "failed", "skipped"]>;
101
- /** Instructions for the executor */
102
- executionInstructions: z.ZodObject<{
103
- /** Clear objective for what this step should accomplish */
104
- objective: z.ZodString;
105
- /** Maps input names to sources as array of {key, value} entries */
106
- inputSource: z.ZodArray<z.ZodObject<{
107
- key: z.ZodString;
108
- value: z.ZodString;
109
- }, "strict", z.ZodTypeAny, {
110
- value: string;
111
- key: string;
112
- }, {
113
- value: string;
114
- key: string;
115
- }>, "many">;
116
- /** Description of what output is expected */
117
- expectedOutput: z.ZodString;
118
- /** How to handle errors for this step */
119
- errorHandling: z.ZodString;
120
- /** Additional constraints for execution (required, use empty array if none) */
121
- constraints: z.ZodArray<z.ZodString, "many">;
122
- }, "strict", z.ZodTypeAny, {
123
- objective: string;
124
- inputSource: {
125
- value: string;
126
- key: string;
127
- }[];
128
- expectedOutput: string;
129
- errorHandling: string;
130
- constraints: string[];
131
- }, {
132
- objective: string;
133
- inputSource: {
134
- value: string;
135
- key: string;
136
- }[];
137
- expectedOutput: string;
138
- errorHandling: string;
139
- constraints: string[];
140
- }>;
141
- /** The tool/action to use for this step */
142
- toolName: z.ZodString;
143
- }, "strict", z.ZodTypeAny, {
144
- status: "pending" | "in_progress" | "completed" | "failed" | "skipped";
145
- description: string;
146
- toolName: string;
147
- stepNumber: number;
148
- operationType: "read" | "write";
149
- requiresUserApproval: boolean;
150
- dependsOn: number[];
151
- executionInstructions: {
152
- objective: string;
153
- inputSource: {
154
- value: string;
155
- key: string;
156
- }[];
157
- expectedOutput: string;
158
- errorHandling: string;
159
- constraints: string[];
160
- };
161
- }, {
162
- status: "pending" | "in_progress" | "completed" | "failed" | "skipped";
163
- description: string;
164
- toolName: string;
165
- stepNumber: number;
166
- operationType: "read" | "write";
167
- requiresUserApproval: boolean;
168
- dependsOn: number[];
169
- executionInstructions: {
170
- objective: string;
171
- inputSource: {
172
- value: string;
173
- key: string;
174
- }[];
175
- expectedOutput: string;
176
- errorHandling: string;
177
- constraints: string[];
178
- };
179
- }>;
180
- /**
181
- * Full plan step schema including runtime-populated fields.
182
- * Use PlanStepLLMSchema for structured output generation.
183
- */
184
- export declare const PlanStepSchema: z.ZodObject<{
185
- /** Sequential step number (1-indexed) */
186
- stepNumber: z.ZodNumber;
187
- /** Human-readable description of what this step does */
188
- description: z.ZodString;
189
- /** Whether this is a read or write operation */
190
- operationType: z.ZodEnum<["read", "write"]>;
191
- /** Whether user must approve before execution */
192
- requiresUserApproval: z.ZodBoolean;
193
- /** Step numbers this step depends on (must complete first) */
194
- dependsOn: z.ZodArray<z.ZodNumber, "many">;
195
- /** Current execution status */
196
- status: z.ZodEnum<["pending", "in_progress", "completed", "failed", "skipped"]>;
197
- /** Instructions for the executor */
198
- executionInstructions: z.ZodObject<{
199
- /** Clear objective for what this step should accomplish */
200
- objective: z.ZodString;
201
- /** Maps input names to sources as array of {key, value} entries */
202
- inputSource: z.ZodArray<z.ZodObject<{
203
- key: z.ZodString;
204
- value: z.ZodString;
205
- }, "strict", z.ZodTypeAny, {
206
- value: string;
207
- key: string;
208
- }, {
209
- value: string;
210
- key: string;
211
- }>, "many">;
212
- /** Description of what output is expected */
213
- expectedOutput: z.ZodString;
214
- /** How to handle errors for this step */
215
- errorHandling: z.ZodString;
216
- /** Additional constraints for execution (required, use empty array if none) */
217
- constraints: z.ZodArray<z.ZodString, "many">;
218
- }, "strict", z.ZodTypeAny, {
219
- objective: string;
220
- inputSource: {
221
- value: string;
222
- key: string;
223
- }[];
224
- expectedOutput: string;
225
- errorHandling: string;
226
- constraints: string[];
227
- }, {
228
- objective: string;
229
- inputSource: {
230
- value: string;
231
- key: string;
232
- }[];
233
- expectedOutput: string;
234
- errorHandling: string;
235
- constraints: string[];
236
- }>;
237
- /** The tool/action to use for this step */
238
- toolName: z.ZodString;
239
- } & {
240
- /** Result from execution (populated after completion) */
241
- result: z.ZodOptional<z.ZodUnknown>;
242
- }, "strict", z.ZodTypeAny, {
243
- status: "pending" | "in_progress" | "completed" | "failed" | "skipped";
244
- description: string;
245
- toolName: string;
246
- stepNumber: number;
247
- operationType: "read" | "write";
248
- requiresUserApproval: boolean;
249
- dependsOn: number[];
250
- executionInstructions: {
251
- objective: string;
252
- inputSource: {
253
- value: string;
254
- key: string;
255
- }[];
256
- expectedOutput: string;
257
- errorHandling: string;
258
- constraints: string[];
259
- };
260
- result?: unknown;
261
- }, {
262
- status: "pending" | "in_progress" | "completed" | "failed" | "skipped";
263
- description: string;
264
- toolName: string;
265
- stepNumber: number;
266
- operationType: "read" | "write";
267
- requiresUserApproval: boolean;
268
- dependsOn: number[];
269
- executionInstructions: {
270
- objective: string;
271
- inputSource: {
272
- value: string;
273
- key: string;
274
- }[];
275
- expectedOutput: string;
276
- errorHandling: string;
277
- constraints: string[];
278
- };
279
- result?: unknown;
280
- }>;
281
- export type PlanStep = z.infer<typeof PlanStepSchema>;
282
- /**
283
- * LLM schema for execution steps - uses PlanStepLLMSchema for strict output.
284
- */
285
- export declare const ExecutionStepsLLMSchema: z.ZodObject<{
286
- /** All steps in execution order */
287
- steps: z.ZodArray<z.ZodObject<{
288
- /** Sequential step number (1-indexed) */
289
- stepNumber: z.ZodNumber;
290
- /** Human-readable description of what this step does */
291
- description: z.ZodString;
292
- /** Whether this is a read or write operation */
293
- operationType: z.ZodEnum<["read", "write"]>;
294
- /** Whether user must approve before execution */
295
- requiresUserApproval: z.ZodBoolean;
296
- /** Step numbers this step depends on (must complete first) */
297
- dependsOn: z.ZodArray<z.ZodNumber, "many">;
298
- /** Current execution status */
299
- status: z.ZodEnum<["pending", "in_progress", "completed", "failed", "skipped"]>;
300
- /** Instructions for the executor */
301
- executionInstructions: z.ZodObject<{
302
- /** Clear objective for what this step should accomplish */
303
- objective: z.ZodString;
304
- /** Maps input names to sources as array of {key, value} entries */
305
- inputSource: z.ZodArray<z.ZodObject<{
306
- key: z.ZodString;
307
- value: z.ZodString;
308
- }, "strict", z.ZodTypeAny, {
309
- value: string;
310
- key: string;
311
- }, {
312
- value: string;
313
- key: string;
314
- }>, "many">;
315
- /** Description of what output is expected */
316
- expectedOutput: z.ZodString;
317
- /** How to handle errors for this step */
318
- errorHandling: z.ZodString;
319
- /** Additional constraints for execution (required, use empty array if none) */
320
- constraints: z.ZodArray<z.ZodString, "many">;
321
- }, "strict", z.ZodTypeAny, {
322
- objective: string;
323
- inputSource: {
324
- value: string;
325
- key: string;
326
- }[];
327
- expectedOutput: string;
328
- errorHandling: string;
329
- constraints: string[];
330
- }, {
331
- objective: string;
332
- inputSource: {
333
- value: string;
334
- key: string;
335
- }[];
336
- expectedOutput: string;
337
- errorHandling: string;
338
- constraints: string[];
339
- }>;
340
- /** The tool/action to use for this step */
341
- toolName: z.ZodString;
342
- }, "strict", z.ZodTypeAny, {
343
- status: "pending" | "in_progress" | "completed" | "failed" | "skipped";
344
- description: string;
345
- toolName: string;
346
- stepNumber: number;
347
- operationType: "read" | "write";
348
- requiresUserApproval: boolean;
349
- dependsOn: number[];
350
- executionInstructions: {
351
- objective: string;
352
- inputSource: {
353
- value: string;
354
- key: string;
355
- }[];
356
- expectedOutput: string;
357
- errorHandling: string;
358
- constraints: string[];
359
- };
360
- }, {
361
- status: "pending" | "in_progress" | "completed" | "failed" | "skipped";
362
- description: string;
363
- toolName: string;
364
- stepNumber: number;
365
- operationType: "read" | "write";
366
- requiresUserApproval: boolean;
367
- dependsOn: number[];
368
- executionInstructions: {
369
- objective: string;
370
- inputSource: {
371
- value: string;
372
- key: string;
373
- }[];
374
- expectedOutput: string;
375
- errorHandling: string;
376
- constraints: string[];
377
- };
378
- }>, "many">;
379
- /** Total number of steps */
380
- totalSteps: z.ZodNumber;
381
- /** Estimated gas cost (null if not calculable) */
382
- estimatedGas: z.ZodNullable<z.ZodString>;
383
- /** Estimated time to complete (null if not calculable) */
384
- estimatedTimeMs: z.ZodNullable<z.ZodNumber>;
385
- }, "strict", z.ZodTypeAny, {
386
- steps: {
387
- status: "pending" | "in_progress" | "completed" | "failed" | "skipped";
388
- description: string;
389
- toolName: string;
390
- stepNumber: number;
391
- operationType: "read" | "write";
392
- requiresUserApproval: boolean;
393
- dependsOn: number[];
394
- executionInstructions: {
395
- objective: string;
396
- inputSource: {
397
- value: string;
398
- key: string;
399
- }[];
400
- expectedOutput: string;
401
- errorHandling: string;
402
- constraints: string[];
403
- };
404
- }[];
405
- totalSteps: number;
406
- estimatedGas: string | null;
407
- estimatedTimeMs: number | null;
408
- }, {
409
- steps: {
410
- status: "pending" | "in_progress" | "completed" | "failed" | "skipped";
411
- description: string;
412
- toolName: string;
413
- stepNumber: number;
414
- operationType: "read" | "write";
415
- requiresUserApproval: boolean;
416
- dependsOn: number[];
417
- executionInstructions: {
418
- objective: string;
419
- inputSource: {
420
- value: string;
421
- key: string;
422
- }[];
423
- expectedOutput: string;
424
- errorHandling: string;
425
- constraints: string[];
426
- };
427
- }[];
428
- totalSteps: number;
429
- estimatedGas: string | null;
430
- estimatedTimeMs: number | null;
431
- }>;
432
- /**
433
- * Full execution steps including runtime-populated fields.
434
- */
435
- export declare const ExecutionStepsSchema: z.ZodObject<{
436
- /** All steps in execution order */
437
- steps: z.ZodArray<z.ZodObject<{
438
- /** Sequential step number (1-indexed) */
439
- stepNumber: z.ZodNumber;
440
- /** Human-readable description of what this step does */
441
- description: z.ZodString;
442
- /** Whether this is a read or write operation */
443
- operationType: z.ZodEnum<["read", "write"]>;
444
- /** Whether user must approve before execution */
445
- requiresUserApproval: z.ZodBoolean;
446
- /** Step numbers this step depends on (must complete first) */
447
- dependsOn: z.ZodArray<z.ZodNumber, "many">;
448
- /** Current execution status */
449
- status: z.ZodEnum<["pending", "in_progress", "completed", "failed", "skipped"]>;
450
- /** Instructions for the executor */
451
- executionInstructions: z.ZodObject<{
452
- /** Clear objective for what this step should accomplish */
453
- objective: z.ZodString;
454
- /** Maps input names to sources as array of {key, value} entries */
455
- inputSource: z.ZodArray<z.ZodObject<{
456
- key: z.ZodString;
457
- value: z.ZodString;
458
- }, "strict", z.ZodTypeAny, {
459
- value: string;
460
- key: string;
461
- }, {
462
- value: string;
463
- key: string;
464
- }>, "many">;
465
- /** Description of what output is expected */
466
- expectedOutput: z.ZodString;
467
- /** How to handle errors for this step */
468
- errorHandling: z.ZodString;
469
- /** Additional constraints for execution (required, use empty array if none) */
470
- constraints: z.ZodArray<z.ZodString, "many">;
471
- }, "strict", z.ZodTypeAny, {
472
- objective: string;
473
- inputSource: {
474
- value: string;
475
- key: string;
476
- }[];
477
- expectedOutput: string;
478
- errorHandling: string;
479
- constraints: string[];
480
- }, {
481
- objective: string;
482
- inputSource: {
483
- value: string;
484
- key: string;
485
- }[];
486
- expectedOutput: string;
487
- errorHandling: string;
488
- constraints: string[];
489
- }>;
490
- /** The tool/action to use for this step */
491
- toolName: z.ZodString;
492
- } & {
493
- /** Result from execution (populated after completion) */
494
- result: z.ZodOptional<z.ZodUnknown>;
495
- }, "strict", z.ZodTypeAny, {
496
- status: "pending" | "in_progress" | "completed" | "failed" | "skipped";
497
- description: string;
498
- toolName: string;
499
- stepNumber: number;
500
- operationType: "read" | "write";
501
- requiresUserApproval: boolean;
502
- dependsOn: number[];
503
- executionInstructions: {
504
- objective: string;
505
- inputSource: {
506
- value: string;
507
- key: string;
508
- }[];
509
- expectedOutput: string;
510
- errorHandling: string;
511
- constraints: string[];
512
- };
513
- result?: unknown;
514
- }, {
515
- status: "pending" | "in_progress" | "completed" | "failed" | "skipped";
516
- description: string;
517
- toolName: string;
518
- stepNumber: number;
519
- operationType: "read" | "write";
520
- requiresUserApproval: boolean;
521
- dependsOn: number[];
522
- executionInstructions: {
523
- objective: string;
524
- inputSource: {
525
- value: string;
526
- key: string;
527
- }[];
528
- expectedOutput: string;
529
- errorHandling: string;
530
- constraints: string[];
531
- };
532
- result?: unknown;
533
- }>, "many">;
534
- /** Total number of steps */
535
- totalSteps: z.ZodNumber;
536
- /** Estimated gas cost (null if not calculable) */
537
- estimatedGas: z.ZodNullable<z.ZodString>;
538
- /** Estimated time to complete (null if not calculable) */
539
- estimatedTimeMs: z.ZodNullable<z.ZodNumber>;
540
- }, "strict", z.ZodTypeAny, {
541
- steps: {
542
- status: "pending" | "in_progress" | "completed" | "failed" | "skipped";
543
- description: string;
544
- toolName: string;
545
- stepNumber: number;
546
- operationType: "read" | "write";
547
- requiresUserApproval: boolean;
548
- dependsOn: number[];
549
- executionInstructions: {
550
- objective: string;
551
- inputSource: {
552
- value: string;
553
- key: string;
554
- }[];
555
- expectedOutput: string;
556
- errorHandling: string;
557
- constraints: string[];
558
- };
559
- result?: unknown;
560
- }[];
561
- totalSteps: number;
562
- estimatedGas: string | null;
563
- estimatedTimeMs: number | null;
564
- }, {
565
- steps: {
566
- status: "pending" | "in_progress" | "completed" | "failed" | "skipped";
567
- description: string;
568
- toolName: string;
569
- stepNumber: number;
570
- operationType: "read" | "write";
571
- requiresUserApproval: boolean;
572
- dependsOn: number[];
573
- executionInstructions: {
574
- objective: string;
575
- inputSource: {
576
- value: string;
577
- key: string;
578
- }[];
579
- expectedOutput: string;
580
- errorHandling: string;
581
- constraints: string[];
582
- };
583
- result?: unknown;
584
- }[];
585
- totalSteps: number;
586
- estimatedGas: string | null;
587
- estimatedTimeMs: number | null;
588
- }>;
589
- export type ExecutionSteps = z.infer<typeof ExecutionStepsSchema>;
590
- /**
591
- * User-facing summary of the plan.
592
- * Note: All properties must be required for structured output compatibility.
593
- */
594
- export declare const PlanUserSummarySchema: z.ZodObject<{
595
- /** Short title for the plan */
596
- title: z.ZodString;
597
- /** Longer description of what the plan will do */
598
- description: z.ZodString;
599
- /** Key points to highlight to the user (required, use empty array if none) */
600
- highlights: z.ZodArray<z.ZodString, "many">;
601
- }, "strict", z.ZodTypeAny, {
602
- description: string;
603
- title: string;
604
- highlights: string[];
605
- }, {
606
- description: string;
607
- title: string;
608
- highlights: string[];
609
- }>;
610
- export type PlanUserSummary = z.infer<typeof PlanUserSummarySchema>;
611
- /**
612
- * Types of conflicts that can prevent plan execution.
613
- */
614
- export declare const PlanConflictTypeSchema: z.ZodEnum<["insufficient_balance", "missing_approval", "unsupported_chain", "unsupported_token", "hallucinated_action", "validation_error", "unknown"]>;
615
- export type PlanConflictType = z.infer<typeof PlanConflictTypeSchema>;
616
- /**
617
- * Severity level for conflicts.
618
- * - "blocking": The plan cannot be executed until this is resolved (e.g., insufficient balance)
619
- * - "warning": The plan can be executed but user should review (e.g., semantic mismatch)
620
- */
621
- export declare const PlanConflictSeveritySchema: z.ZodEnum<["blocking", "warning"]>;
622
- export type PlanConflictSeverity = z.infer<typeof PlanConflictSeveritySchema>;
623
- /**
624
- * A conflict that prevents or complicates plan execution.
625
- * Note: All properties must be required for structured output compatibility.
626
- * Use empty string for suggestion and empty array for affectedSteps when not applicable.
627
- */
628
- export declare const PlanConflictSchema: z.ZodObject<{
629
- /** Type of conflict */
630
- type: z.ZodEnum<["insufficient_balance", "missing_approval", "unsupported_chain", "unsupported_token", "hallucinated_action", "validation_error", "unknown"]>;
631
- /** Severity level - blocking conflicts prevent execution, warnings allow user override */
632
- severity: z.ZodEnum<["blocking", "warning"]>;
633
- /** Human-readable explanation */
634
- message: z.ZodString;
635
- /** Suggested resolution (use empty string when no suggestion available) */
636
- suggestion: z.ZodString;
637
- /** Which step(s) are affected (use empty array if not step-specific) */
638
- affectedSteps: z.ZodArray<z.ZodNumber, "many">;
639
- }, "strict", z.ZodTypeAny, {
640
- message: string;
641
- type: "unknown" | "insufficient_balance" | "missing_approval" | "unsupported_chain" | "unsupported_token" | "hallucinated_action" | "validation_error";
642
- severity: "blocking" | "warning";
643
- suggestion: string;
644
- affectedSteps: number[];
645
- }, {
646
- message: string;
647
- type: "unknown" | "insufficient_balance" | "missing_approval" | "unsupported_chain" | "unsupported_token" | "hallucinated_action" | "validation_error";
648
- severity: "blocking" | "warning";
649
- suggestion: string;
650
- affectedSteps: number[];
651
- }>;
652
- export type PlanConflict = z.infer<typeof PlanConflictSchema>;
653
- /**
654
- * Context when a plan is a replan of a previous failed plan.
655
- */
656
- export declare const ReplanContextSchema: z.ZodObject<{
657
- /** ID of the original plan that failed */
658
- originalPlanId: z.ZodString;
659
- /** Reason replanning was needed */
660
- replanReason: z.ZodString;
661
- /** Step numbers that were preserved from original */
662
- preservedSteps: z.ZodArray<z.ZodNumber, "many">;
663
- /** How many times we've replanned */
664
- replanAttempt: z.ZodNumber;
665
- }, "strict", z.ZodTypeAny, {
666
- originalPlanId: string;
667
- replanReason: string;
668
- preservedSteps: number[];
669
- replanAttempt: number;
670
- }, {
671
- originalPlanId: string;
672
- replanReason: string;
673
- preservedSteps: number[];
674
- replanAttempt: number;
675
- }>;
676
- export type ReplanContext = z.infer<typeof ReplanContextSchema>;
677
- /**
678
- * LLM schema for execution plan - uses ExecutionStepsLLMSchema for strict output.
679
- * Use this schema for generateObject() calls with Azure OpenAI structured output.
680
- */
681
- export declare const ExecutionPlanLLMSchema: z.ZodObject<{
682
- /** Unique identifier for this plan */
683
- planId: z.ZodString;
684
- /** Version number for plan updates */
685
- version: z.ZodNumber;
686
- /** Whether the plan can be executed (false if conflicts exist) */
687
- isExecutable: z.ZodBoolean;
688
- /** Whether the plan can auto-execute without approval (read-only, no conflicts) */
689
- autoExecutable: z.ZodBoolean;
690
- /** User-facing summary */
691
- userSummary: z.ZodObject<{
692
- /** Short title for the plan */
693
- title: z.ZodString;
694
- /** Longer description of what the plan will do */
695
- description: z.ZodString;
696
- /** Key points to highlight to the user (required, use empty array if none) */
697
- highlights: z.ZodArray<z.ZodString, "many">;
698
- }, "strict", z.ZodTypeAny, {
699
- description: string;
700
- title: string;
701
- highlights: string[];
702
- }, {
703
- description: string;
704
- title: string;
705
- highlights: string[];
706
- }>;
707
- /** Conflicts preventing execution (use empty array if none) */
708
- conflicts: z.ZodArray<z.ZodObject<{
709
- /** Type of conflict */
710
- type: z.ZodEnum<["insufficient_balance", "missing_approval", "unsupported_chain", "unsupported_token", "hallucinated_action", "validation_error", "unknown"]>;
711
- /** Severity level - blocking conflicts prevent execution, warnings allow user override */
712
- severity: z.ZodEnum<["blocking", "warning"]>;
713
- /** Human-readable explanation */
714
- message: z.ZodString;
715
- /** Suggested resolution (use empty string when no suggestion available) */
716
- suggestion: z.ZodString;
717
- /** Which step(s) are affected (use empty array if not step-specific) */
718
- affectedSteps: z.ZodArray<z.ZodNumber, "many">;
719
- }, "strict", z.ZodTypeAny, {
720
- message: string;
721
- type: "unknown" | "insufficient_balance" | "missing_approval" | "unsupported_chain" | "unsupported_token" | "hallucinated_action" | "validation_error";
722
- severity: "blocking" | "warning";
723
- suggestion: string;
724
- affectedSteps: number[];
725
- }, {
726
- message: string;
727
- type: "unknown" | "insufficient_balance" | "missing_approval" | "unsupported_chain" | "unsupported_token" | "hallucinated_action" | "validation_error";
728
- severity: "blocking" | "warning";
729
- suggestion: string;
730
- affectedSteps: number[];
731
- }>, "many">;
732
- /** The execution steps */
733
- executionSteps: z.ZodObject<{
734
- /** All steps in execution order */
735
- steps: z.ZodArray<z.ZodObject<{
736
- /** Sequential step number (1-indexed) */
737
- stepNumber: z.ZodNumber;
738
- /** Human-readable description of what this step does */
739
- description: z.ZodString;
740
- /** Whether this is a read or write operation */
741
- operationType: z.ZodEnum<["read", "write"]>;
742
- /** Whether user must approve before execution */
743
- requiresUserApproval: z.ZodBoolean;
744
- /** Step numbers this step depends on (must complete first) */
745
- dependsOn: z.ZodArray<z.ZodNumber, "many">;
746
- /** Current execution status */
747
- status: z.ZodEnum<["pending", "in_progress", "completed", "failed", "skipped"]>;
748
- /** Instructions for the executor */
749
- executionInstructions: z.ZodObject<{
750
- /** Clear objective for what this step should accomplish */
751
- objective: z.ZodString;
752
- /** Maps input names to sources as array of {key, value} entries */
753
- inputSource: z.ZodArray<z.ZodObject<{
754
- key: z.ZodString;
755
- value: z.ZodString;
756
- }, "strict", z.ZodTypeAny, {
757
- value: string;
758
- key: string;
759
- }, {
760
- value: string;
761
- key: string;
762
- }>, "many">;
763
- /** Description of what output is expected */
764
- expectedOutput: z.ZodString;
765
- /** How to handle errors for this step */
766
- errorHandling: z.ZodString;
767
- /** Additional constraints for execution (required, use empty array if none) */
768
- constraints: z.ZodArray<z.ZodString, "many">;
769
- }, "strict", z.ZodTypeAny, {
770
- objective: string;
771
- inputSource: {
772
- value: string;
773
- key: string;
774
- }[];
775
- expectedOutput: string;
776
- errorHandling: string;
777
- constraints: string[];
778
- }, {
779
- objective: string;
780
- inputSource: {
781
- value: string;
782
- key: string;
783
- }[];
784
- expectedOutput: string;
785
- errorHandling: string;
786
- constraints: string[];
787
- }>;
788
- /** The tool/action to use for this step */
789
- toolName: z.ZodString;
790
- }, "strict", z.ZodTypeAny, {
791
- status: "pending" | "in_progress" | "completed" | "failed" | "skipped";
792
- description: string;
793
- toolName: string;
794
- stepNumber: number;
795
- operationType: "read" | "write";
796
- requiresUserApproval: boolean;
797
- dependsOn: number[];
798
- executionInstructions: {
799
- objective: string;
800
- inputSource: {
801
- value: string;
802
- key: string;
803
- }[];
804
- expectedOutput: string;
805
- errorHandling: string;
806
- constraints: string[];
807
- };
808
- }, {
809
- status: "pending" | "in_progress" | "completed" | "failed" | "skipped";
810
- description: string;
811
- toolName: string;
812
- stepNumber: number;
813
- operationType: "read" | "write";
814
- requiresUserApproval: boolean;
815
- dependsOn: number[];
816
- executionInstructions: {
817
- objective: string;
818
- inputSource: {
819
- value: string;
820
- key: string;
821
- }[];
822
- expectedOutput: string;
823
- errorHandling: string;
824
- constraints: string[];
825
- };
826
- }>, "many">;
827
- /** Total number of steps */
828
- totalSteps: z.ZodNumber;
829
- /** Estimated gas cost (null if not calculable) */
830
- estimatedGas: z.ZodNullable<z.ZodString>;
831
- /** Estimated time to complete (null if not calculable) */
832
- estimatedTimeMs: z.ZodNullable<z.ZodNumber>;
833
- }, "strict", z.ZodTypeAny, {
834
- steps: {
835
- status: "pending" | "in_progress" | "completed" | "failed" | "skipped";
836
- description: string;
837
- toolName: string;
838
- stepNumber: number;
839
- operationType: "read" | "write";
840
- requiresUserApproval: boolean;
841
- dependsOn: number[];
842
- executionInstructions: {
843
- objective: string;
844
- inputSource: {
845
- value: string;
846
- key: string;
847
- }[];
848
- expectedOutput: string;
849
- errorHandling: string;
850
- constraints: string[];
851
- };
852
- }[];
853
- totalSteps: number;
854
- estimatedGas: string | null;
855
- estimatedTimeMs: number | null;
856
- }, {
857
- steps: {
858
- status: "pending" | "in_progress" | "completed" | "failed" | "skipped";
859
- description: string;
860
- toolName: string;
861
- stepNumber: number;
862
- operationType: "read" | "write";
863
- requiresUserApproval: boolean;
864
- dependsOn: number[];
865
- executionInstructions: {
866
- objective: string;
867
- inputSource: {
868
- value: string;
869
- key: string;
870
- }[];
871
- expectedOutput: string;
872
- errorHandling: string;
873
- constraints: string[];
874
- };
875
- }[];
876
- totalSteps: number;
877
- estimatedGas: string | null;
878
- estimatedTimeMs: number | null;
879
- }>;
880
- /** When the plan was created */
881
- createdAt: z.ZodString;
882
- /** If this is a replan, context about the original (null if not a replan) */
883
- replanContext: z.ZodNullable<z.ZodObject<{
884
- /** ID of the original plan that failed */
885
- originalPlanId: z.ZodString;
886
- /** Reason replanning was needed */
887
- replanReason: z.ZodString;
888
- /** Step numbers that were preserved from original */
889
- preservedSteps: z.ZodArray<z.ZodNumber, "many">;
890
- /** How many times we've replanned */
891
- replanAttempt: z.ZodNumber;
892
- }, "strict", z.ZodTypeAny, {
893
- originalPlanId: string;
894
- replanReason: string;
895
- preservedSteps: number[];
896
- replanAttempt: number;
897
- }, {
898
- originalPlanId: string;
899
- replanReason: string;
900
- preservedSteps: number[];
901
- replanAttempt: number;
902
- }>>;
903
- }, "strict", z.ZodTypeAny, {
904
- planId: string;
905
- version: number;
906
- isExecutable: boolean;
907
- autoExecutable: boolean;
908
- userSummary: {
909
- description: string;
910
- title: string;
911
- highlights: string[];
912
- };
913
- conflicts: {
914
- message: string;
915
- type: "unknown" | "insufficient_balance" | "missing_approval" | "unsupported_chain" | "unsupported_token" | "hallucinated_action" | "validation_error";
916
- severity: "blocking" | "warning";
917
- suggestion: string;
918
- affectedSteps: number[];
919
- }[];
920
- executionSteps: {
921
- steps: {
922
- status: "pending" | "in_progress" | "completed" | "failed" | "skipped";
923
- description: string;
924
- toolName: string;
925
- stepNumber: number;
926
- operationType: "read" | "write";
927
- requiresUserApproval: boolean;
928
- dependsOn: number[];
929
- executionInstructions: {
930
- objective: string;
931
- inputSource: {
932
- value: string;
933
- key: string;
934
- }[];
935
- expectedOutput: string;
936
- errorHandling: string;
937
- constraints: string[];
938
- };
939
- }[];
940
- totalSteps: number;
941
- estimatedGas: string | null;
942
- estimatedTimeMs: number | null;
943
- };
944
- createdAt: string;
945
- replanContext: {
946
- originalPlanId: string;
947
- replanReason: string;
948
- preservedSteps: number[];
949
- replanAttempt: number;
950
- } | null;
951
- }, {
952
- planId: string;
953
- version: number;
954
- isExecutable: boolean;
955
- autoExecutable: boolean;
956
- userSummary: {
957
- description: string;
958
- title: string;
959
- highlights: string[];
960
- };
961
- conflicts: {
962
- message: string;
963
- type: "unknown" | "insufficient_balance" | "missing_approval" | "unsupported_chain" | "unsupported_token" | "hallucinated_action" | "validation_error";
964
- severity: "blocking" | "warning";
965
- suggestion: string;
966
- affectedSteps: number[];
967
- }[];
968
- executionSteps: {
969
- steps: {
970
- status: "pending" | "in_progress" | "completed" | "failed" | "skipped";
971
- description: string;
972
- toolName: string;
973
- stepNumber: number;
974
- operationType: "read" | "write";
975
- requiresUserApproval: boolean;
976
- dependsOn: number[];
977
- executionInstructions: {
978
- objective: string;
979
- inputSource: {
980
- value: string;
981
- key: string;
982
- }[];
983
- expectedOutput: string;
984
- errorHandling: string;
985
- constraints: string[];
986
- };
987
- }[];
988
- totalSteps: number;
989
- estimatedGas: string | null;
990
- estimatedTimeMs: number | null;
991
- };
992
- createdAt: string;
993
- replanContext: {
994
- originalPlanId: string;
995
- replanReason: string;
996
- preservedSteps: number[];
997
- replanAttempt: number;
998
- } | null;
999
- }>;
1000
- /**
1001
- * Complete execution plan including runtime-populated fields.
1002
- * Use ExecutionPlanLLMSchema for LLM structured output generation.
1003
- */
1004
- export declare const ExecutionPlanSchema: z.ZodObject<{
1005
- /** Unique identifier for this plan */
1006
- planId: z.ZodString;
1007
- /** Version number for plan updates */
1008
- version: z.ZodNumber;
1009
- /** Whether the plan can be executed (false if conflicts exist) */
1010
- isExecutable: z.ZodBoolean;
1011
- /** Whether the plan can auto-execute without approval (read-only, no conflicts) */
1012
- autoExecutable: z.ZodBoolean;
1013
- /** User-facing summary */
1014
- userSummary: z.ZodObject<{
1015
- /** Short title for the plan */
1016
- title: z.ZodString;
1017
- /** Longer description of what the plan will do */
1018
- description: z.ZodString;
1019
- /** Key points to highlight to the user (required, use empty array if none) */
1020
- highlights: z.ZodArray<z.ZodString, "many">;
1021
- }, "strict", z.ZodTypeAny, {
1022
- description: string;
1023
- title: string;
1024
- highlights: string[];
1025
- }, {
1026
- description: string;
1027
- title: string;
1028
- highlights: string[];
1029
- }>;
1030
- /** Conflicts preventing execution (use empty array if none) */
1031
- conflicts: z.ZodArray<z.ZodObject<{
1032
- /** Type of conflict */
1033
- type: z.ZodEnum<["insufficient_balance", "missing_approval", "unsupported_chain", "unsupported_token", "hallucinated_action", "validation_error", "unknown"]>;
1034
- /** Severity level - blocking conflicts prevent execution, warnings allow user override */
1035
- severity: z.ZodEnum<["blocking", "warning"]>;
1036
- /** Human-readable explanation */
1037
- message: z.ZodString;
1038
- /** Suggested resolution (use empty string when no suggestion available) */
1039
- suggestion: z.ZodString;
1040
- /** Which step(s) are affected (use empty array if not step-specific) */
1041
- affectedSteps: z.ZodArray<z.ZodNumber, "many">;
1042
- }, "strict", z.ZodTypeAny, {
1043
- message: string;
1044
- type: "unknown" | "insufficient_balance" | "missing_approval" | "unsupported_chain" | "unsupported_token" | "hallucinated_action" | "validation_error";
1045
- severity: "blocking" | "warning";
1046
- suggestion: string;
1047
- affectedSteps: number[];
1048
- }, {
1049
- message: string;
1050
- type: "unknown" | "insufficient_balance" | "missing_approval" | "unsupported_chain" | "unsupported_token" | "hallucinated_action" | "validation_error";
1051
- severity: "blocking" | "warning";
1052
- suggestion: string;
1053
- affectedSteps: number[];
1054
- }>, "many">;
1055
- /** The execution steps */
1056
- executionSteps: z.ZodObject<{
1057
- /** All steps in execution order */
1058
- steps: z.ZodArray<z.ZodObject<{
1059
- /** Sequential step number (1-indexed) */
1060
- stepNumber: z.ZodNumber;
1061
- /** Human-readable description of what this step does */
1062
- description: z.ZodString;
1063
- /** Whether this is a read or write operation */
1064
- operationType: z.ZodEnum<["read", "write"]>;
1065
- /** Whether user must approve before execution */
1066
- requiresUserApproval: z.ZodBoolean;
1067
- /** Step numbers this step depends on (must complete first) */
1068
- dependsOn: z.ZodArray<z.ZodNumber, "many">;
1069
- /** Current execution status */
1070
- status: z.ZodEnum<["pending", "in_progress", "completed", "failed", "skipped"]>;
1071
- /** Instructions for the executor */
1072
- executionInstructions: z.ZodObject<{
1073
- /** Clear objective for what this step should accomplish */
1074
- objective: z.ZodString;
1075
- /** Maps input names to sources as array of {key, value} entries */
1076
- inputSource: z.ZodArray<z.ZodObject<{
1077
- key: z.ZodString;
1078
- value: z.ZodString;
1079
- }, "strict", z.ZodTypeAny, {
1080
- value: string;
1081
- key: string;
1082
- }, {
1083
- value: string;
1084
- key: string;
1085
- }>, "many">;
1086
- /** Description of what output is expected */
1087
- expectedOutput: z.ZodString;
1088
- /** How to handle errors for this step */
1089
- errorHandling: z.ZodString;
1090
- /** Additional constraints for execution (required, use empty array if none) */
1091
- constraints: z.ZodArray<z.ZodString, "many">;
1092
- }, "strict", z.ZodTypeAny, {
1093
- objective: string;
1094
- inputSource: {
1095
- value: string;
1096
- key: string;
1097
- }[];
1098
- expectedOutput: string;
1099
- errorHandling: string;
1100
- constraints: string[];
1101
- }, {
1102
- objective: string;
1103
- inputSource: {
1104
- value: string;
1105
- key: string;
1106
- }[];
1107
- expectedOutput: string;
1108
- errorHandling: string;
1109
- constraints: string[];
1110
- }>;
1111
- /** The tool/action to use for this step */
1112
- toolName: z.ZodString;
1113
- } & {
1114
- /** Result from execution (populated after completion) */
1115
- result: z.ZodOptional<z.ZodUnknown>;
1116
- }, "strict", z.ZodTypeAny, {
1117
- status: "pending" | "in_progress" | "completed" | "failed" | "skipped";
1118
- description: string;
1119
- toolName: string;
1120
- stepNumber: number;
1121
- operationType: "read" | "write";
1122
- requiresUserApproval: boolean;
1123
- dependsOn: number[];
1124
- executionInstructions: {
1125
- objective: string;
1126
- inputSource: {
1127
- value: string;
1128
- key: string;
1129
- }[];
1130
- expectedOutput: string;
1131
- errorHandling: string;
1132
- constraints: string[];
1133
- };
1134
- result?: unknown;
1135
- }, {
1136
- status: "pending" | "in_progress" | "completed" | "failed" | "skipped";
1137
- description: string;
1138
- toolName: string;
1139
- stepNumber: number;
1140
- operationType: "read" | "write";
1141
- requiresUserApproval: boolean;
1142
- dependsOn: number[];
1143
- executionInstructions: {
1144
- objective: string;
1145
- inputSource: {
1146
- value: string;
1147
- key: string;
1148
- }[];
1149
- expectedOutput: string;
1150
- errorHandling: string;
1151
- constraints: string[];
1152
- };
1153
- result?: unknown;
1154
- }>, "many">;
1155
- /** Total number of steps */
1156
- totalSteps: z.ZodNumber;
1157
- /** Estimated gas cost (null if not calculable) */
1158
- estimatedGas: z.ZodNullable<z.ZodString>;
1159
- /** Estimated time to complete (null if not calculable) */
1160
- estimatedTimeMs: z.ZodNullable<z.ZodNumber>;
1161
- }, "strict", z.ZodTypeAny, {
1162
- steps: {
1163
- status: "pending" | "in_progress" | "completed" | "failed" | "skipped";
1164
- description: string;
1165
- toolName: string;
1166
- stepNumber: number;
1167
- operationType: "read" | "write";
1168
- requiresUserApproval: boolean;
1169
- dependsOn: number[];
1170
- executionInstructions: {
1171
- objective: string;
1172
- inputSource: {
1173
- value: string;
1174
- key: string;
1175
- }[];
1176
- expectedOutput: string;
1177
- errorHandling: string;
1178
- constraints: string[];
1179
- };
1180
- result?: unknown;
1181
- }[];
1182
- totalSteps: number;
1183
- estimatedGas: string | null;
1184
- estimatedTimeMs: number | null;
1185
- }, {
1186
- steps: {
1187
- status: "pending" | "in_progress" | "completed" | "failed" | "skipped";
1188
- description: string;
1189
- toolName: string;
1190
- stepNumber: number;
1191
- operationType: "read" | "write";
1192
- requiresUserApproval: boolean;
1193
- dependsOn: number[];
1194
- executionInstructions: {
1195
- objective: string;
1196
- inputSource: {
1197
- value: string;
1198
- key: string;
1199
- }[];
1200
- expectedOutput: string;
1201
- errorHandling: string;
1202
- constraints: string[];
1203
- };
1204
- result?: unknown;
1205
- }[];
1206
- totalSteps: number;
1207
- estimatedGas: string | null;
1208
- estimatedTimeMs: number | null;
1209
- }>;
1210
- /** When the plan was created */
1211
- createdAt: z.ZodString;
1212
- /** If this is a replan, context about the original (null if not a replan) */
1213
- replanContext: z.ZodNullable<z.ZodObject<{
1214
- /** ID of the original plan that failed */
1215
- originalPlanId: z.ZodString;
1216
- /** Reason replanning was needed */
1217
- replanReason: z.ZodString;
1218
- /** Step numbers that were preserved from original */
1219
- preservedSteps: z.ZodArray<z.ZodNumber, "many">;
1220
- /** How many times we've replanned */
1221
- replanAttempt: z.ZodNumber;
1222
- }, "strict", z.ZodTypeAny, {
1223
- originalPlanId: string;
1224
- replanReason: string;
1225
- preservedSteps: number[];
1226
- replanAttempt: number;
1227
- }, {
1228
- originalPlanId: string;
1229
- replanReason: string;
1230
- preservedSteps: number[];
1231
- replanAttempt: number;
1232
- }>>;
1233
- }, "strict", z.ZodTypeAny, {
1234
- planId: string;
1235
- version: number;
1236
- isExecutable: boolean;
1237
- autoExecutable: boolean;
1238
- userSummary: {
1239
- description: string;
1240
- title: string;
1241
- highlights: string[];
1242
- };
1243
- conflicts: {
1244
- message: string;
1245
- type: "unknown" | "insufficient_balance" | "missing_approval" | "unsupported_chain" | "unsupported_token" | "hallucinated_action" | "validation_error";
1246
- severity: "blocking" | "warning";
1247
- suggestion: string;
1248
- affectedSteps: number[];
1249
- }[];
1250
- executionSteps: {
1251
- steps: {
1252
- status: "pending" | "in_progress" | "completed" | "failed" | "skipped";
1253
- description: string;
1254
- toolName: string;
1255
- stepNumber: number;
1256
- operationType: "read" | "write";
1257
- requiresUserApproval: boolean;
1258
- dependsOn: number[];
1259
- executionInstructions: {
1260
- objective: string;
1261
- inputSource: {
1262
- value: string;
1263
- key: string;
1264
- }[];
1265
- expectedOutput: string;
1266
- errorHandling: string;
1267
- constraints: string[];
1268
- };
1269
- result?: unknown;
1270
- }[];
1271
- totalSteps: number;
1272
- estimatedGas: string | null;
1273
- estimatedTimeMs: number | null;
1274
- };
1275
- createdAt: string;
1276
- replanContext: {
1277
- originalPlanId: string;
1278
- replanReason: string;
1279
- preservedSteps: number[];
1280
- replanAttempt: number;
1281
- } | null;
1282
- }, {
1283
- planId: string;
1284
- version: number;
1285
- isExecutable: boolean;
1286
- autoExecutable: boolean;
1287
- userSummary: {
1288
- description: string;
1289
- title: string;
1290
- highlights: string[];
1291
- };
1292
- conflicts: {
1293
- message: string;
1294
- type: "unknown" | "insufficient_balance" | "missing_approval" | "unsupported_chain" | "unsupported_token" | "hallucinated_action" | "validation_error";
1295
- severity: "blocking" | "warning";
1296
- suggestion: string;
1297
- affectedSteps: number[];
1298
- }[];
1299
- executionSteps: {
1300
- steps: {
1301
- status: "pending" | "in_progress" | "completed" | "failed" | "skipped";
1302
- description: string;
1303
- toolName: string;
1304
- stepNumber: number;
1305
- operationType: "read" | "write";
1306
- requiresUserApproval: boolean;
1307
- dependsOn: number[];
1308
- executionInstructions: {
1309
- objective: string;
1310
- inputSource: {
1311
- value: string;
1312
- key: string;
1313
- }[];
1314
- expectedOutput: string;
1315
- errorHandling: string;
1316
- constraints: string[];
1317
- };
1318
- result?: unknown;
1319
- }[];
1320
- totalSteps: number;
1321
- estimatedGas: string | null;
1322
- estimatedTimeMs: number | null;
1323
- };
1324
- createdAt: string;
1325
- replanContext: {
1326
- originalPlanId: string;
1327
- replanReason: string;
1328
- preservedSteps: number[];
1329
- replanAttempt: number;
1330
- } | null;
1331
- }>;
1332
- export type ExecutionPlan = z.infer<typeof ExecutionPlanSchema>;
1333
- /**
1334
- * Transaction data sent to client for signing.
1335
- * Supports both single transactions and batched transactions (e.g., approval + swap).
1336
- * At least one of `transaction` or `transactions` must be provided.
1337
- */
1338
- export declare const TransactionDataSchema: z.ZodEffects<z.ZodObject<{
1339
- /** Chain ID where transaction will execute */
1340
- chainId: z.ZodNumber;
1341
- /** Single transaction to sign (for simple operations) */
1342
- transaction: z.ZodOptional<z.ZodUnknown>;
1343
- /** Array of transactions to sign and execute in sequence (for batch operations like approval + swap) */
1344
- transactions: z.ZodOptional<z.ZodArray<z.ZodUnknown, "many">>;
1345
- /** Human-readable description of what's being signed */
1346
- description: z.ZodString;
1347
- /** Estimated gas for the transaction */
1348
- estimatedGas: z.ZodOptional<z.ZodString>;
1349
- /** Estimated value in USD */
1350
- estimatedValueUsd: z.ZodOptional<z.ZodString>;
1351
- }, "strict", z.ZodTypeAny, {
1352
- description: string;
1353
- chainId: number;
1354
- transaction?: unknown;
1355
- transactions?: unknown[] | undefined;
1356
- estimatedGas?: string | undefined;
1357
- estimatedValueUsd?: string | undefined;
1358
- }, {
1359
- description: string;
1360
- chainId: number;
1361
- transaction?: unknown;
1362
- transactions?: unknown[] | undefined;
1363
- estimatedGas?: string | undefined;
1364
- estimatedValueUsd?: string | undefined;
1365
- }>, {
1366
- description: string;
1367
- chainId: number;
1368
- transaction?: unknown;
1369
- transactions?: unknown[] | undefined;
1370
- estimatedGas?: string | undefined;
1371
- estimatedValueUsd?: string | undefined;
1372
- }, {
1373
- description: string;
1374
- chainId: number;
1375
- transaction?: unknown;
1376
- transactions?: unknown[] | undefined;
1377
- estimatedGas?: string | undefined;
1378
- estimatedValueUsd?: string | undefined;
1379
- }>;
1380
- export type TransactionData = z.infer<typeof TransactionDataSchema>;
1381
- /**
1382
- * Event when a step starts execution.
1383
- */
1384
- export declare const StepStartedEventSchema: z.ZodObject<{
1385
- type: z.ZodLiteral<"step_started">;
1386
- stepNumber: z.ZodNumber;
1387
- description: z.ZodString;
1388
- }, "strict", z.ZodTypeAny, {
1389
- type: "step_started";
1390
- description: string;
1391
- stepNumber: number;
1392
- }, {
1393
- type: "step_started";
1394
- description: string;
1395
- stepNumber: number;
1396
- }>;
1397
- /**
1398
- * Event when a step completes successfully.
1399
- */
1400
- export declare const StepCompletedEventSchema: z.ZodObject<{
1401
- type: z.ZodLiteral<"step_completed">;
1402
- stepNumber: z.ZodNumber;
1403
- result: z.ZodUnknown;
1404
- }, "strict", z.ZodTypeAny, {
1405
- type: "step_completed";
1406
- stepNumber: number;
1407
- result?: unknown;
1408
- }, {
1409
- type: "step_completed";
1410
- stepNumber: number;
1411
- result?: unknown;
1412
- }>;
1413
- /**
1414
- * Event when a step fails.
1415
- */
1416
- export declare const StepFailedEventSchema: z.ZodObject<{
1417
- type: z.ZodLiteral<"step_failed">;
1418
- stepNumber: z.ZodNumber;
1419
- error: z.ZodString;
1420
- canReplan: z.ZodBoolean;
1421
- }, "strict", z.ZodTypeAny, {
1422
- type: "step_failed";
1423
- error: string;
1424
- stepNumber: number;
1425
- canReplan: boolean;
1426
- }, {
1427
- type: "step_failed";
1428
- error: string;
1429
- stepNumber: number;
1430
- canReplan: boolean;
1431
- }>;
1432
- /**
1433
- * Event for progress updates during step execution.
1434
- * Used to show granular telemetry like "Getting quote...", "Building transaction...", etc.
1435
- */
1436
- export declare const StepProgressEventSchema: z.ZodObject<{
1437
- type: z.ZodLiteral<"step_progress">;
1438
- stepNumber: z.ZodNumber;
1439
- message: z.ZodString;
1440
- /** Optional progress percentage (0-100) */
1441
- progress: z.ZodOptional<z.ZodNumber>;
1442
- }, "strict", z.ZodTypeAny, {
1443
- message: string;
1444
- type: "step_progress";
1445
- stepNumber: number;
1446
- progress?: number | undefined;
1447
- }, {
1448
- message: string;
1449
- type: "step_progress";
1450
- stepNumber: number;
1451
- progress?: number | undefined;
1452
- }>;
1453
- /**
1454
- * Event when execution needs a signature from the client.
1455
- */
1456
- export declare const SignatureRequiredEventSchema: z.ZodObject<{
1457
- type: z.ZodLiteral<"signature_required">;
1458
- stepNumber: z.ZodNumber;
1459
- transaction: z.ZodEffects<z.ZodObject<{
1460
- /** Chain ID where transaction will execute */
1461
- chainId: z.ZodNumber;
1462
- /** Single transaction to sign (for simple operations) */
1463
- transaction: z.ZodOptional<z.ZodUnknown>;
1464
- /** Array of transactions to sign and execute in sequence (for batch operations like approval + swap) */
1465
- transactions: z.ZodOptional<z.ZodArray<z.ZodUnknown, "many">>;
1466
- /** Human-readable description of what's being signed */
1467
- description: z.ZodString;
1468
- /** Estimated gas for the transaction */
1469
- estimatedGas: z.ZodOptional<z.ZodString>;
1470
- /** Estimated value in USD */
1471
- estimatedValueUsd: z.ZodOptional<z.ZodString>;
1472
- }, "strict", z.ZodTypeAny, {
1473
- description: string;
1474
- chainId: number;
1475
- transaction?: unknown;
1476
- transactions?: unknown[] | undefined;
1477
- estimatedGas?: string | undefined;
1478
- estimatedValueUsd?: string | undefined;
1479
- }, {
1480
- description: string;
1481
- chainId: number;
1482
- transaction?: unknown;
1483
- transactions?: unknown[] | undefined;
1484
- estimatedGas?: string | undefined;
1485
- estimatedValueUsd?: string | undefined;
1486
- }>, {
1487
- description: string;
1488
- chainId: number;
1489
- transaction?: unknown;
1490
- transactions?: unknown[] | undefined;
1491
- estimatedGas?: string | undefined;
1492
- estimatedValueUsd?: string | undefined;
1493
- }, {
1494
- description: string;
1495
- chainId: number;
1496
- transaction?: unknown;
1497
- transactions?: unknown[] | undefined;
1498
- estimatedGas?: string | undefined;
1499
- estimatedValueUsd?: string | undefined;
1500
- }>;
1501
- }, "strict", z.ZodTypeAny, {
1502
- type: "signature_required";
1503
- transaction: {
1504
- description: string;
1505
- chainId: number;
1506
- transaction?: unknown;
1507
- transactions?: unknown[] | undefined;
1508
- estimatedGas?: string | undefined;
1509
- estimatedValueUsd?: string | undefined;
1510
- };
1511
- stepNumber: number;
1512
- }, {
1513
- type: "signature_required";
1514
- transaction: {
1515
- description: string;
1516
- chainId: number;
1517
- transaction?: unknown;
1518
- transactions?: unknown[] | undefined;
1519
- estimatedGas?: string | undefined;
1520
- estimatedValueUsd?: string | undefined;
1521
- };
1522
- stepNumber: number;
1523
- }>;
1524
- /**
1525
- * Event when replanning starts.
1526
- */
1527
- export declare const ReplanStartedEventSchema: z.ZodObject<{
1528
- type: z.ZodLiteral<"replan_started">;
1529
- reason: z.ZodString;
1530
- preservedSteps: z.ZodArray<z.ZodNumber, "many">;
1531
- }, "strict", z.ZodTypeAny, {
1532
- type: "replan_started";
1533
- preservedSteps: number[];
1534
- reason: string;
1535
- }, {
1536
- type: "replan_started";
1537
- preservedSteps: number[];
1538
- reason: string;
1539
- }>;
1540
- /**
1541
- * Event when replanning completes with a new plan.
1542
- */
1543
- export declare const ReplanCompleteEventSchema: z.ZodObject<{
1544
- type: z.ZodLiteral<"replan_complete">;
1545
- newPlan: z.ZodObject<{
1546
- /** Unique identifier for this plan */
1547
- planId: z.ZodString;
1548
- /** Version number for plan updates */
1549
- version: z.ZodNumber;
1550
- /** Whether the plan can be executed (false if conflicts exist) */
1551
- isExecutable: z.ZodBoolean;
1552
- /** Whether the plan can auto-execute without approval (read-only, no conflicts) */
1553
- autoExecutable: z.ZodBoolean;
1554
- /** User-facing summary */
1555
- userSummary: z.ZodObject<{
1556
- /** Short title for the plan */
1557
- title: z.ZodString;
1558
- /** Longer description of what the plan will do */
1559
- description: z.ZodString;
1560
- /** Key points to highlight to the user (required, use empty array if none) */
1561
- highlights: z.ZodArray<z.ZodString, "many">;
1562
- }, "strict", z.ZodTypeAny, {
1563
- description: string;
1564
- title: string;
1565
- highlights: string[];
1566
- }, {
1567
- description: string;
1568
- title: string;
1569
- highlights: string[];
1570
- }>;
1571
- /** Conflicts preventing execution (use empty array if none) */
1572
- conflicts: z.ZodArray<z.ZodObject<{
1573
- /** Type of conflict */
1574
- type: z.ZodEnum<["insufficient_balance", "missing_approval", "unsupported_chain", "unsupported_token", "hallucinated_action", "validation_error", "unknown"]>;
1575
- /** Severity level - blocking conflicts prevent execution, warnings allow user override */
1576
- severity: z.ZodEnum<["blocking", "warning"]>;
1577
- /** Human-readable explanation */
1578
- message: z.ZodString;
1579
- /** Suggested resolution (use empty string when no suggestion available) */
1580
- suggestion: z.ZodString;
1581
- /** Which step(s) are affected (use empty array if not step-specific) */
1582
- affectedSteps: z.ZodArray<z.ZodNumber, "many">;
1583
- }, "strict", z.ZodTypeAny, {
1584
- message: string;
1585
- type: "unknown" | "insufficient_balance" | "missing_approval" | "unsupported_chain" | "unsupported_token" | "hallucinated_action" | "validation_error";
1586
- severity: "blocking" | "warning";
1587
- suggestion: string;
1588
- affectedSteps: number[];
1589
- }, {
1590
- message: string;
1591
- type: "unknown" | "insufficient_balance" | "missing_approval" | "unsupported_chain" | "unsupported_token" | "hallucinated_action" | "validation_error";
1592
- severity: "blocking" | "warning";
1593
- suggestion: string;
1594
- affectedSteps: number[];
1595
- }>, "many">;
1596
- /** The execution steps */
1597
- executionSteps: z.ZodObject<{
1598
- /** All steps in execution order */
1599
- steps: z.ZodArray<z.ZodObject<{
1600
- /** Sequential step number (1-indexed) */
1601
- stepNumber: z.ZodNumber;
1602
- /** Human-readable description of what this step does */
1603
- description: z.ZodString;
1604
- /** Whether this is a read or write operation */
1605
- operationType: z.ZodEnum<["read", "write"]>;
1606
- /** Whether user must approve before execution */
1607
- requiresUserApproval: z.ZodBoolean;
1608
- /** Step numbers this step depends on (must complete first) */
1609
- dependsOn: z.ZodArray<z.ZodNumber, "many">;
1610
- /** Current execution status */
1611
- status: z.ZodEnum<["pending", "in_progress", "completed", "failed", "skipped"]>;
1612
- /** Instructions for the executor */
1613
- executionInstructions: z.ZodObject<{
1614
- /** Clear objective for what this step should accomplish */
1615
- objective: z.ZodString;
1616
- /** Maps input names to sources as array of {key, value} entries */
1617
- inputSource: z.ZodArray<z.ZodObject<{
1618
- key: z.ZodString;
1619
- value: z.ZodString;
1620
- }, "strict", z.ZodTypeAny, {
1621
- value: string;
1622
- key: string;
1623
- }, {
1624
- value: string;
1625
- key: string;
1626
- }>, "many">;
1627
- /** Description of what output is expected */
1628
- expectedOutput: z.ZodString;
1629
- /** How to handle errors for this step */
1630
- errorHandling: z.ZodString;
1631
- /** Additional constraints for execution (required, use empty array if none) */
1632
- constraints: z.ZodArray<z.ZodString, "many">;
1633
- }, "strict", z.ZodTypeAny, {
1634
- objective: string;
1635
- inputSource: {
1636
- value: string;
1637
- key: string;
1638
- }[];
1639
- expectedOutput: string;
1640
- errorHandling: string;
1641
- constraints: string[];
1642
- }, {
1643
- objective: string;
1644
- inputSource: {
1645
- value: string;
1646
- key: string;
1647
- }[];
1648
- expectedOutput: string;
1649
- errorHandling: string;
1650
- constraints: string[];
1651
- }>;
1652
- /** The tool/action to use for this step */
1653
- toolName: z.ZodString;
1654
- } & {
1655
- /** Result from execution (populated after completion) */
1656
- result: z.ZodOptional<z.ZodUnknown>;
1657
- }, "strict", z.ZodTypeAny, {
1658
- status: "pending" | "in_progress" | "completed" | "failed" | "skipped";
1659
- description: string;
1660
- toolName: string;
1661
- stepNumber: number;
1662
- operationType: "read" | "write";
1663
- requiresUserApproval: boolean;
1664
- dependsOn: number[];
1665
- executionInstructions: {
1666
- objective: string;
1667
- inputSource: {
1668
- value: string;
1669
- key: string;
1670
- }[];
1671
- expectedOutput: string;
1672
- errorHandling: string;
1673
- constraints: string[];
1674
- };
1675
- result?: unknown;
1676
- }, {
1677
- status: "pending" | "in_progress" | "completed" | "failed" | "skipped";
1678
- description: string;
1679
- toolName: string;
1680
- stepNumber: number;
1681
- operationType: "read" | "write";
1682
- requiresUserApproval: boolean;
1683
- dependsOn: number[];
1684
- executionInstructions: {
1685
- objective: string;
1686
- inputSource: {
1687
- value: string;
1688
- key: string;
1689
- }[];
1690
- expectedOutput: string;
1691
- errorHandling: string;
1692
- constraints: string[];
1693
- };
1694
- result?: unknown;
1695
- }>, "many">;
1696
- /** Total number of steps */
1697
- totalSteps: z.ZodNumber;
1698
- /** Estimated gas cost (null if not calculable) */
1699
- estimatedGas: z.ZodNullable<z.ZodString>;
1700
- /** Estimated time to complete (null if not calculable) */
1701
- estimatedTimeMs: z.ZodNullable<z.ZodNumber>;
1702
- }, "strict", z.ZodTypeAny, {
1703
- steps: {
1704
- status: "pending" | "in_progress" | "completed" | "failed" | "skipped";
1705
- description: string;
1706
- toolName: string;
1707
- stepNumber: number;
1708
- operationType: "read" | "write";
1709
- requiresUserApproval: boolean;
1710
- dependsOn: number[];
1711
- executionInstructions: {
1712
- objective: string;
1713
- inputSource: {
1714
- value: string;
1715
- key: string;
1716
- }[];
1717
- expectedOutput: string;
1718
- errorHandling: string;
1719
- constraints: string[];
1720
- };
1721
- result?: unknown;
1722
- }[];
1723
- totalSteps: number;
1724
- estimatedGas: string | null;
1725
- estimatedTimeMs: number | null;
1726
- }, {
1727
- steps: {
1728
- status: "pending" | "in_progress" | "completed" | "failed" | "skipped";
1729
- description: string;
1730
- toolName: string;
1731
- stepNumber: number;
1732
- operationType: "read" | "write";
1733
- requiresUserApproval: boolean;
1734
- dependsOn: number[];
1735
- executionInstructions: {
1736
- objective: string;
1737
- inputSource: {
1738
- value: string;
1739
- key: string;
1740
- }[];
1741
- expectedOutput: string;
1742
- errorHandling: string;
1743
- constraints: string[];
1744
- };
1745
- result?: unknown;
1746
- }[];
1747
- totalSteps: number;
1748
- estimatedGas: string | null;
1749
- estimatedTimeMs: number | null;
1750
- }>;
1751
- /** When the plan was created */
1752
- createdAt: z.ZodString;
1753
- /** If this is a replan, context about the original (null if not a replan) */
1754
- replanContext: z.ZodNullable<z.ZodObject<{
1755
- /** ID of the original plan that failed */
1756
- originalPlanId: z.ZodString;
1757
- /** Reason replanning was needed */
1758
- replanReason: z.ZodString;
1759
- /** Step numbers that were preserved from original */
1760
- preservedSteps: z.ZodArray<z.ZodNumber, "many">;
1761
- /** How many times we've replanned */
1762
- replanAttempt: z.ZodNumber;
1763
- }, "strict", z.ZodTypeAny, {
1764
- originalPlanId: string;
1765
- replanReason: string;
1766
- preservedSteps: number[];
1767
- replanAttempt: number;
1768
- }, {
1769
- originalPlanId: string;
1770
- replanReason: string;
1771
- preservedSteps: number[];
1772
- replanAttempt: number;
1773
- }>>;
1774
- }, "strict", z.ZodTypeAny, {
1775
- planId: string;
1776
- version: number;
1777
- isExecutable: boolean;
1778
- autoExecutable: boolean;
1779
- userSummary: {
1780
- description: string;
1781
- title: string;
1782
- highlights: string[];
1783
- };
1784
- conflicts: {
1785
- message: string;
1786
- type: "unknown" | "insufficient_balance" | "missing_approval" | "unsupported_chain" | "unsupported_token" | "hallucinated_action" | "validation_error";
1787
- severity: "blocking" | "warning";
1788
- suggestion: string;
1789
- affectedSteps: number[];
1790
- }[];
1791
- executionSteps: {
1792
- steps: {
1793
- status: "pending" | "in_progress" | "completed" | "failed" | "skipped";
1794
- description: string;
1795
- toolName: string;
1796
- stepNumber: number;
1797
- operationType: "read" | "write";
1798
- requiresUserApproval: boolean;
1799
- dependsOn: number[];
1800
- executionInstructions: {
1801
- objective: string;
1802
- inputSource: {
1803
- value: string;
1804
- key: string;
1805
- }[];
1806
- expectedOutput: string;
1807
- errorHandling: string;
1808
- constraints: string[];
1809
- };
1810
- result?: unknown;
1811
- }[];
1812
- totalSteps: number;
1813
- estimatedGas: string | null;
1814
- estimatedTimeMs: number | null;
1815
- };
1816
- createdAt: string;
1817
- replanContext: {
1818
- originalPlanId: string;
1819
- replanReason: string;
1820
- preservedSteps: number[];
1821
- replanAttempt: number;
1822
- } | null;
1823
- }, {
1824
- planId: string;
1825
- version: number;
1826
- isExecutable: boolean;
1827
- autoExecutable: boolean;
1828
- userSummary: {
1829
- description: string;
1830
- title: string;
1831
- highlights: string[];
1832
- };
1833
- conflicts: {
1834
- message: string;
1835
- type: "unknown" | "insufficient_balance" | "missing_approval" | "unsupported_chain" | "unsupported_token" | "hallucinated_action" | "validation_error";
1836
- severity: "blocking" | "warning";
1837
- suggestion: string;
1838
- affectedSteps: number[];
1839
- }[];
1840
- executionSteps: {
1841
- steps: {
1842
- status: "pending" | "in_progress" | "completed" | "failed" | "skipped";
1843
- description: string;
1844
- toolName: string;
1845
- stepNumber: number;
1846
- operationType: "read" | "write";
1847
- requiresUserApproval: boolean;
1848
- dependsOn: number[];
1849
- executionInstructions: {
1850
- objective: string;
1851
- inputSource: {
1852
- value: string;
1853
- key: string;
1854
- }[];
1855
- expectedOutput: string;
1856
- errorHandling: string;
1857
- constraints: string[];
1858
- };
1859
- result?: unknown;
1860
- }[];
1861
- totalSteps: number;
1862
- estimatedGas: string | null;
1863
- estimatedTimeMs: number | null;
1864
- };
1865
- createdAt: string;
1866
- replanContext: {
1867
- originalPlanId: string;
1868
- replanReason: string;
1869
- preservedSteps: number[];
1870
- replanAttempt: number;
1871
- } | null;
1872
- }>;
1873
- }, "strict", z.ZodTypeAny, {
1874
- type: "replan_complete";
1875
- newPlan: {
1876
- planId: string;
1877
- version: number;
1878
- isExecutable: boolean;
1879
- autoExecutable: boolean;
1880
- userSummary: {
1881
- description: string;
1882
- title: string;
1883
- highlights: string[];
1884
- };
1885
- conflicts: {
1886
- message: string;
1887
- type: "unknown" | "insufficient_balance" | "missing_approval" | "unsupported_chain" | "unsupported_token" | "hallucinated_action" | "validation_error";
1888
- severity: "blocking" | "warning";
1889
- suggestion: string;
1890
- affectedSteps: number[];
1891
- }[];
1892
- executionSteps: {
1893
- steps: {
1894
- status: "pending" | "in_progress" | "completed" | "failed" | "skipped";
1895
- description: string;
1896
- toolName: string;
1897
- stepNumber: number;
1898
- operationType: "read" | "write";
1899
- requiresUserApproval: boolean;
1900
- dependsOn: number[];
1901
- executionInstructions: {
1902
- objective: string;
1903
- inputSource: {
1904
- value: string;
1905
- key: string;
1906
- }[];
1907
- expectedOutput: string;
1908
- errorHandling: string;
1909
- constraints: string[];
1910
- };
1911
- result?: unknown;
1912
- }[];
1913
- totalSteps: number;
1914
- estimatedGas: string | null;
1915
- estimatedTimeMs: number | null;
1916
- };
1917
- createdAt: string;
1918
- replanContext: {
1919
- originalPlanId: string;
1920
- replanReason: string;
1921
- preservedSteps: number[];
1922
- replanAttempt: number;
1923
- } | null;
1924
- };
1925
- }, {
1926
- type: "replan_complete";
1927
- newPlan: {
1928
- planId: string;
1929
- version: number;
1930
- isExecutable: boolean;
1931
- autoExecutable: boolean;
1932
- userSummary: {
1933
- description: string;
1934
- title: string;
1935
- highlights: string[];
1936
- };
1937
- conflicts: {
1938
- message: string;
1939
- type: "unknown" | "insufficient_balance" | "missing_approval" | "unsupported_chain" | "unsupported_token" | "hallucinated_action" | "validation_error";
1940
- severity: "blocking" | "warning";
1941
- suggestion: string;
1942
- affectedSteps: number[];
1943
- }[];
1944
- executionSteps: {
1945
- steps: {
1946
- status: "pending" | "in_progress" | "completed" | "failed" | "skipped";
1947
- description: string;
1948
- toolName: string;
1949
- stepNumber: number;
1950
- operationType: "read" | "write";
1951
- requiresUserApproval: boolean;
1952
- dependsOn: number[];
1953
- executionInstructions: {
1954
- objective: string;
1955
- inputSource: {
1956
- value: string;
1957
- key: string;
1958
- }[];
1959
- expectedOutput: string;
1960
- errorHandling: string;
1961
- constraints: string[];
1962
- };
1963
- result?: unknown;
1964
- }[];
1965
- totalSteps: number;
1966
- estimatedGas: string | null;
1967
- estimatedTimeMs: number | null;
1968
- };
1969
- createdAt: string;
1970
- replanContext: {
1971
- originalPlanId: string;
1972
- replanReason: string;
1973
- preservedSteps: number[];
1974
- replanAttempt: number;
1975
- } | null;
1976
- };
1977
- }>;
1978
- /**
1979
- * Execution completion status.
1980
- * - success: All steps completed successfully
1981
- * - partial: Some steps completed, others failed
1982
- * - failed: Execution failed
1983
- * - replan_required: A new plan was generated and requires approval
1984
- */
1985
- export declare const ExecutionStatusSchema: z.ZodEnum<["success", "partial", "failed", "replan_required"]>;
1986
- export type ExecutionStatus = z.infer<typeof ExecutionStatusSchema>;
1987
- /**
1988
- * Event when execution completes (success, partial, or failed).
1989
- */
1990
- export declare const ExecutionCompleteEventSchema: z.ZodObject<{
1991
- type: z.ZodLiteral<"execution_complete">;
1992
- status: z.ZodEnum<["success", "partial", "failed", "replan_required"]>;
1993
- summary: z.ZodString;
1994
- }, "strict", z.ZodTypeAny, {
1995
- type: "execution_complete";
1996
- status: "failed" | "success" | "partial" | "replan_required";
1997
- summary: string;
1998
- }, {
1999
- type: "execution_complete";
2000
- status: "failed" | "success" | "partial" | "replan_required";
2001
- summary: string;
2002
- }>;
2003
- /**
2004
- * All valid execution event type literals.
2005
- * Used for runtime validation without needing to parse full schemas.
2006
- */
2007
- export declare const EXECUTION_EVENT_TYPES: readonly ["step_started", "step_completed", "step_failed", "step_progress", "signature_required", "replan_started", "replan_complete", "execution_complete"];
2008
- /**
2009
- * Union of all execution events streamed during plan execution.
2010
- */
2011
- export declare const ExecutionEventSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
2012
- type: z.ZodLiteral<"step_started">;
2013
- stepNumber: z.ZodNumber;
2014
- description: z.ZodString;
2015
- }, "strict", z.ZodTypeAny, {
2016
- type: "step_started";
2017
- description: string;
2018
- stepNumber: number;
2019
- }, {
2020
- type: "step_started";
2021
- description: string;
2022
- stepNumber: number;
2023
- }>, z.ZodObject<{
2024
- type: z.ZodLiteral<"step_completed">;
2025
- stepNumber: z.ZodNumber;
2026
- result: z.ZodUnknown;
2027
- }, "strict", z.ZodTypeAny, {
2028
- type: "step_completed";
2029
- stepNumber: number;
2030
- result?: unknown;
2031
- }, {
2032
- type: "step_completed";
2033
- stepNumber: number;
2034
- result?: unknown;
2035
- }>, z.ZodObject<{
2036
- type: z.ZodLiteral<"step_failed">;
2037
- stepNumber: z.ZodNumber;
2038
- error: z.ZodString;
2039
- canReplan: z.ZodBoolean;
2040
- }, "strict", z.ZodTypeAny, {
2041
- type: "step_failed";
2042
- error: string;
2043
- stepNumber: number;
2044
- canReplan: boolean;
2045
- }, {
2046
- type: "step_failed";
2047
- error: string;
2048
- stepNumber: number;
2049
- canReplan: boolean;
2050
- }>, z.ZodObject<{
2051
- type: z.ZodLiteral<"step_progress">;
2052
- stepNumber: z.ZodNumber;
2053
- message: z.ZodString;
2054
- /** Optional progress percentage (0-100) */
2055
- progress: z.ZodOptional<z.ZodNumber>;
2056
- }, "strict", z.ZodTypeAny, {
2057
- message: string;
2058
- type: "step_progress";
2059
- stepNumber: number;
2060
- progress?: number | undefined;
2061
- }, {
2062
- message: string;
2063
- type: "step_progress";
2064
- stepNumber: number;
2065
- progress?: number | undefined;
2066
- }>, z.ZodObject<{
2067
- type: z.ZodLiteral<"signature_required">;
2068
- stepNumber: z.ZodNumber;
2069
- transaction: z.ZodEffects<z.ZodObject<{
2070
- /** Chain ID where transaction will execute */
2071
- chainId: z.ZodNumber;
2072
- /** Single transaction to sign (for simple operations) */
2073
- transaction: z.ZodOptional<z.ZodUnknown>;
2074
- /** Array of transactions to sign and execute in sequence (for batch operations like approval + swap) */
2075
- transactions: z.ZodOptional<z.ZodArray<z.ZodUnknown, "many">>;
2076
- /** Human-readable description of what's being signed */
2077
- description: z.ZodString;
2078
- /** Estimated gas for the transaction */
2079
- estimatedGas: z.ZodOptional<z.ZodString>;
2080
- /** Estimated value in USD */
2081
- estimatedValueUsd: z.ZodOptional<z.ZodString>;
2082
- }, "strict", z.ZodTypeAny, {
2083
- description: string;
2084
- chainId: number;
2085
- transaction?: unknown;
2086
- transactions?: unknown[] | undefined;
2087
- estimatedGas?: string | undefined;
2088
- estimatedValueUsd?: string | undefined;
2089
- }, {
2090
- description: string;
2091
- chainId: number;
2092
- transaction?: unknown;
2093
- transactions?: unknown[] | undefined;
2094
- estimatedGas?: string | undefined;
2095
- estimatedValueUsd?: string | undefined;
2096
- }>, {
2097
- description: string;
2098
- chainId: number;
2099
- transaction?: unknown;
2100
- transactions?: unknown[] | undefined;
2101
- estimatedGas?: string | undefined;
2102
- estimatedValueUsd?: string | undefined;
2103
- }, {
2104
- description: string;
2105
- chainId: number;
2106
- transaction?: unknown;
2107
- transactions?: unknown[] | undefined;
2108
- estimatedGas?: string | undefined;
2109
- estimatedValueUsd?: string | undefined;
2110
- }>;
2111
- }, "strict", z.ZodTypeAny, {
2112
- type: "signature_required";
2113
- transaction: {
2114
- description: string;
2115
- chainId: number;
2116
- transaction?: unknown;
2117
- transactions?: unknown[] | undefined;
2118
- estimatedGas?: string | undefined;
2119
- estimatedValueUsd?: string | undefined;
2120
- };
2121
- stepNumber: number;
2122
- }, {
2123
- type: "signature_required";
2124
- transaction: {
2125
- description: string;
2126
- chainId: number;
2127
- transaction?: unknown;
2128
- transactions?: unknown[] | undefined;
2129
- estimatedGas?: string | undefined;
2130
- estimatedValueUsd?: string | undefined;
2131
- };
2132
- stepNumber: number;
2133
- }>, z.ZodObject<{
2134
- type: z.ZodLiteral<"replan_started">;
2135
- reason: z.ZodString;
2136
- preservedSteps: z.ZodArray<z.ZodNumber, "many">;
2137
- }, "strict", z.ZodTypeAny, {
2138
- type: "replan_started";
2139
- preservedSteps: number[];
2140
- reason: string;
2141
- }, {
2142
- type: "replan_started";
2143
- preservedSteps: number[];
2144
- reason: string;
2145
- }>, z.ZodObject<{
2146
- type: z.ZodLiteral<"replan_complete">;
2147
- newPlan: z.ZodObject<{
2148
- /** Unique identifier for this plan */
2149
- planId: z.ZodString;
2150
- /** Version number for plan updates */
2151
- version: z.ZodNumber;
2152
- /** Whether the plan can be executed (false if conflicts exist) */
2153
- isExecutable: z.ZodBoolean;
2154
- /** Whether the plan can auto-execute without approval (read-only, no conflicts) */
2155
- autoExecutable: z.ZodBoolean;
2156
- /** User-facing summary */
2157
- userSummary: z.ZodObject<{
2158
- /** Short title for the plan */
2159
- title: z.ZodString;
2160
- /** Longer description of what the plan will do */
2161
- description: z.ZodString;
2162
- /** Key points to highlight to the user (required, use empty array if none) */
2163
- highlights: z.ZodArray<z.ZodString, "many">;
2164
- }, "strict", z.ZodTypeAny, {
2165
- description: string;
2166
- title: string;
2167
- highlights: string[];
2168
- }, {
2169
- description: string;
2170
- title: string;
2171
- highlights: string[];
2172
- }>;
2173
- /** Conflicts preventing execution (use empty array if none) */
2174
- conflicts: z.ZodArray<z.ZodObject<{
2175
- /** Type of conflict */
2176
- type: z.ZodEnum<["insufficient_balance", "missing_approval", "unsupported_chain", "unsupported_token", "hallucinated_action", "validation_error", "unknown"]>;
2177
- /** Severity level - blocking conflicts prevent execution, warnings allow user override */
2178
- severity: z.ZodEnum<["blocking", "warning"]>;
2179
- /** Human-readable explanation */
2180
- message: z.ZodString;
2181
- /** Suggested resolution (use empty string when no suggestion available) */
2182
- suggestion: z.ZodString;
2183
- /** Which step(s) are affected (use empty array if not step-specific) */
2184
- affectedSteps: z.ZodArray<z.ZodNumber, "many">;
2185
- }, "strict", z.ZodTypeAny, {
2186
- message: string;
2187
- type: "unknown" | "insufficient_balance" | "missing_approval" | "unsupported_chain" | "unsupported_token" | "hallucinated_action" | "validation_error";
2188
- severity: "blocking" | "warning";
2189
- suggestion: string;
2190
- affectedSteps: number[];
2191
- }, {
2192
- message: string;
2193
- type: "unknown" | "insufficient_balance" | "missing_approval" | "unsupported_chain" | "unsupported_token" | "hallucinated_action" | "validation_error";
2194
- severity: "blocking" | "warning";
2195
- suggestion: string;
2196
- affectedSteps: number[];
2197
- }>, "many">;
2198
- /** The execution steps */
2199
- executionSteps: z.ZodObject<{
2200
- /** All steps in execution order */
2201
- steps: z.ZodArray<z.ZodObject<{
2202
- /** Sequential step number (1-indexed) */
2203
- stepNumber: z.ZodNumber;
2204
- /** Human-readable description of what this step does */
2205
- description: z.ZodString;
2206
- /** Whether this is a read or write operation */
2207
- operationType: z.ZodEnum<["read", "write"]>;
2208
- /** Whether user must approve before execution */
2209
- requiresUserApproval: z.ZodBoolean;
2210
- /** Step numbers this step depends on (must complete first) */
2211
- dependsOn: z.ZodArray<z.ZodNumber, "many">;
2212
- /** Current execution status */
2213
- status: z.ZodEnum<["pending", "in_progress", "completed", "failed", "skipped"]>;
2214
- /** Instructions for the executor */
2215
- executionInstructions: z.ZodObject<{
2216
- /** Clear objective for what this step should accomplish */
2217
- objective: z.ZodString;
2218
- /** Maps input names to sources as array of {key, value} entries */
2219
- inputSource: z.ZodArray<z.ZodObject<{
2220
- key: z.ZodString;
2221
- value: z.ZodString;
2222
- }, "strict", z.ZodTypeAny, {
2223
- value: string;
2224
- key: string;
2225
- }, {
2226
- value: string;
2227
- key: string;
2228
- }>, "many">;
2229
- /** Description of what output is expected */
2230
- expectedOutput: z.ZodString;
2231
- /** How to handle errors for this step */
2232
- errorHandling: z.ZodString;
2233
- /** Additional constraints for execution (required, use empty array if none) */
2234
- constraints: z.ZodArray<z.ZodString, "many">;
2235
- }, "strict", z.ZodTypeAny, {
2236
- objective: string;
2237
- inputSource: {
2238
- value: string;
2239
- key: string;
2240
- }[];
2241
- expectedOutput: string;
2242
- errorHandling: string;
2243
- constraints: string[];
2244
- }, {
2245
- objective: string;
2246
- inputSource: {
2247
- value: string;
2248
- key: string;
2249
- }[];
2250
- expectedOutput: string;
2251
- errorHandling: string;
2252
- constraints: string[];
2253
- }>;
2254
- /** The tool/action to use for this step */
2255
- toolName: z.ZodString;
2256
- } & {
2257
- /** Result from execution (populated after completion) */
2258
- result: z.ZodOptional<z.ZodUnknown>;
2259
- }, "strict", z.ZodTypeAny, {
2260
- status: "pending" | "in_progress" | "completed" | "failed" | "skipped";
2261
- description: string;
2262
- toolName: string;
2263
- stepNumber: number;
2264
- operationType: "read" | "write";
2265
- requiresUserApproval: boolean;
2266
- dependsOn: number[];
2267
- executionInstructions: {
2268
- objective: string;
2269
- inputSource: {
2270
- value: string;
2271
- key: string;
2272
- }[];
2273
- expectedOutput: string;
2274
- errorHandling: string;
2275
- constraints: string[];
2276
- };
2277
- result?: unknown;
2278
- }, {
2279
- status: "pending" | "in_progress" | "completed" | "failed" | "skipped";
2280
- description: string;
2281
- toolName: string;
2282
- stepNumber: number;
2283
- operationType: "read" | "write";
2284
- requiresUserApproval: boolean;
2285
- dependsOn: number[];
2286
- executionInstructions: {
2287
- objective: string;
2288
- inputSource: {
2289
- value: string;
2290
- key: string;
2291
- }[];
2292
- expectedOutput: string;
2293
- errorHandling: string;
2294
- constraints: string[];
2295
- };
2296
- result?: unknown;
2297
- }>, "many">;
2298
- /** Total number of steps */
2299
- totalSteps: z.ZodNumber;
2300
- /** Estimated gas cost (null if not calculable) */
2301
- estimatedGas: z.ZodNullable<z.ZodString>;
2302
- /** Estimated time to complete (null if not calculable) */
2303
- estimatedTimeMs: z.ZodNullable<z.ZodNumber>;
2304
- }, "strict", z.ZodTypeAny, {
2305
- steps: {
2306
- status: "pending" | "in_progress" | "completed" | "failed" | "skipped";
2307
- description: string;
2308
- toolName: string;
2309
- stepNumber: number;
2310
- operationType: "read" | "write";
2311
- requiresUserApproval: boolean;
2312
- dependsOn: number[];
2313
- executionInstructions: {
2314
- objective: string;
2315
- inputSource: {
2316
- value: string;
2317
- key: string;
2318
- }[];
2319
- expectedOutput: string;
2320
- errorHandling: string;
2321
- constraints: string[];
2322
- };
2323
- result?: unknown;
2324
- }[];
2325
- totalSteps: number;
2326
- estimatedGas: string | null;
2327
- estimatedTimeMs: number | null;
2328
- }, {
2329
- steps: {
2330
- status: "pending" | "in_progress" | "completed" | "failed" | "skipped";
2331
- description: string;
2332
- toolName: string;
2333
- stepNumber: number;
2334
- operationType: "read" | "write";
2335
- requiresUserApproval: boolean;
2336
- dependsOn: number[];
2337
- executionInstructions: {
2338
- objective: string;
2339
- inputSource: {
2340
- value: string;
2341
- key: string;
2342
- }[];
2343
- expectedOutput: string;
2344
- errorHandling: string;
2345
- constraints: string[];
2346
- };
2347
- result?: unknown;
2348
- }[];
2349
- totalSteps: number;
2350
- estimatedGas: string | null;
2351
- estimatedTimeMs: number | null;
2352
- }>;
2353
- /** When the plan was created */
2354
- createdAt: z.ZodString;
2355
- /** If this is a replan, context about the original (null if not a replan) */
2356
- replanContext: z.ZodNullable<z.ZodObject<{
2357
- /** ID of the original plan that failed */
2358
- originalPlanId: z.ZodString;
2359
- /** Reason replanning was needed */
2360
- replanReason: z.ZodString;
2361
- /** Step numbers that were preserved from original */
2362
- preservedSteps: z.ZodArray<z.ZodNumber, "many">;
2363
- /** How many times we've replanned */
2364
- replanAttempt: z.ZodNumber;
2365
- }, "strict", z.ZodTypeAny, {
2366
- originalPlanId: string;
2367
- replanReason: string;
2368
- preservedSteps: number[];
2369
- replanAttempt: number;
2370
- }, {
2371
- originalPlanId: string;
2372
- replanReason: string;
2373
- preservedSteps: number[];
2374
- replanAttempt: number;
2375
- }>>;
2376
- }, "strict", z.ZodTypeAny, {
2377
- planId: string;
2378
- version: number;
2379
- isExecutable: boolean;
2380
- autoExecutable: boolean;
2381
- userSummary: {
2382
- description: string;
2383
- title: string;
2384
- highlights: string[];
2385
- };
2386
- conflicts: {
2387
- message: string;
2388
- type: "unknown" | "insufficient_balance" | "missing_approval" | "unsupported_chain" | "unsupported_token" | "hallucinated_action" | "validation_error";
2389
- severity: "blocking" | "warning";
2390
- suggestion: string;
2391
- affectedSteps: number[];
2392
- }[];
2393
- executionSteps: {
2394
- steps: {
2395
- status: "pending" | "in_progress" | "completed" | "failed" | "skipped";
2396
- description: string;
2397
- toolName: string;
2398
- stepNumber: number;
2399
- operationType: "read" | "write";
2400
- requiresUserApproval: boolean;
2401
- dependsOn: number[];
2402
- executionInstructions: {
2403
- objective: string;
2404
- inputSource: {
2405
- value: string;
2406
- key: string;
2407
- }[];
2408
- expectedOutput: string;
2409
- errorHandling: string;
2410
- constraints: string[];
2411
- };
2412
- result?: unknown;
2413
- }[];
2414
- totalSteps: number;
2415
- estimatedGas: string | null;
2416
- estimatedTimeMs: number | null;
2417
- };
2418
- createdAt: string;
2419
- replanContext: {
2420
- originalPlanId: string;
2421
- replanReason: string;
2422
- preservedSteps: number[];
2423
- replanAttempt: number;
2424
- } | null;
2425
- }, {
2426
- planId: string;
2427
- version: number;
2428
- isExecutable: boolean;
2429
- autoExecutable: boolean;
2430
- userSummary: {
2431
- description: string;
2432
- title: string;
2433
- highlights: string[];
2434
- };
2435
- conflicts: {
2436
- message: string;
2437
- type: "unknown" | "insufficient_balance" | "missing_approval" | "unsupported_chain" | "unsupported_token" | "hallucinated_action" | "validation_error";
2438
- severity: "blocking" | "warning";
2439
- suggestion: string;
2440
- affectedSteps: number[];
2441
- }[];
2442
- executionSteps: {
2443
- steps: {
2444
- status: "pending" | "in_progress" | "completed" | "failed" | "skipped";
2445
- description: string;
2446
- toolName: string;
2447
- stepNumber: number;
2448
- operationType: "read" | "write";
2449
- requiresUserApproval: boolean;
2450
- dependsOn: number[];
2451
- executionInstructions: {
2452
- objective: string;
2453
- inputSource: {
2454
- value: string;
2455
- key: string;
2456
- }[];
2457
- expectedOutput: string;
2458
- errorHandling: string;
2459
- constraints: string[];
2460
- };
2461
- result?: unknown;
2462
- }[];
2463
- totalSteps: number;
2464
- estimatedGas: string | null;
2465
- estimatedTimeMs: number | null;
2466
- };
2467
- createdAt: string;
2468
- replanContext: {
2469
- originalPlanId: string;
2470
- replanReason: string;
2471
- preservedSteps: number[];
2472
- replanAttempt: number;
2473
- } | null;
2474
- }>;
2475
- }, "strict", z.ZodTypeAny, {
2476
- type: "replan_complete";
2477
- newPlan: {
2478
- planId: string;
2479
- version: number;
2480
- isExecutable: boolean;
2481
- autoExecutable: boolean;
2482
- userSummary: {
2483
- description: string;
2484
- title: string;
2485
- highlights: string[];
2486
- };
2487
- conflicts: {
2488
- message: string;
2489
- type: "unknown" | "insufficient_balance" | "missing_approval" | "unsupported_chain" | "unsupported_token" | "hallucinated_action" | "validation_error";
2490
- severity: "blocking" | "warning";
2491
- suggestion: string;
2492
- affectedSteps: number[];
2493
- }[];
2494
- executionSteps: {
2495
- steps: {
2496
- status: "pending" | "in_progress" | "completed" | "failed" | "skipped";
2497
- description: string;
2498
- toolName: string;
2499
- stepNumber: number;
2500
- operationType: "read" | "write";
2501
- requiresUserApproval: boolean;
2502
- dependsOn: number[];
2503
- executionInstructions: {
2504
- objective: string;
2505
- inputSource: {
2506
- value: string;
2507
- key: string;
2508
- }[];
2509
- expectedOutput: string;
2510
- errorHandling: string;
2511
- constraints: string[];
2512
- };
2513
- result?: unknown;
2514
- }[];
2515
- totalSteps: number;
2516
- estimatedGas: string | null;
2517
- estimatedTimeMs: number | null;
2518
- };
2519
- createdAt: string;
2520
- replanContext: {
2521
- originalPlanId: string;
2522
- replanReason: string;
2523
- preservedSteps: number[];
2524
- replanAttempt: number;
2525
- } | null;
2526
- };
2527
- }, {
2528
- type: "replan_complete";
2529
- newPlan: {
2530
- planId: string;
2531
- version: number;
2532
- isExecutable: boolean;
2533
- autoExecutable: boolean;
2534
- userSummary: {
2535
- description: string;
2536
- title: string;
2537
- highlights: string[];
2538
- };
2539
- conflicts: {
2540
- message: string;
2541
- type: "unknown" | "insufficient_balance" | "missing_approval" | "unsupported_chain" | "unsupported_token" | "hallucinated_action" | "validation_error";
2542
- severity: "blocking" | "warning";
2543
- suggestion: string;
2544
- affectedSteps: number[];
2545
- }[];
2546
- executionSteps: {
2547
- steps: {
2548
- status: "pending" | "in_progress" | "completed" | "failed" | "skipped";
2549
- description: string;
2550
- toolName: string;
2551
- stepNumber: number;
2552
- operationType: "read" | "write";
2553
- requiresUserApproval: boolean;
2554
- dependsOn: number[];
2555
- executionInstructions: {
2556
- objective: string;
2557
- inputSource: {
2558
- value: string;
2559
- key: string;
2560
- }[];
2561
- expectedOutput: string;
2562
- errorHandling: string;
2563
- constraints: string[];
2564
- };
2565
- result?: unknown;
2566
- }[];
2567
- totalSteps: number;
2568
- estimatedGas: string | null;
2569
- estimatedTimeMs: number | null;
2570
- };
2571
- createdAt: string;
2572
- replanContext: {
2573
- originalPlanId: string;
2574
- replanReason: string;
2575
- preservedSteps: number[];
2576
- replanAttempt: number;
2577
- } | null;
2578
- };
2579
- }>, z.ZodObject<{
2580
- type: z.ZodLiteral<"execution_complete">;
2581
- status: z.ZodEnum<["success", "partial", "failed", "replan_required"]>;
2582
- summary: z.ZodString;
2583
- }, "strict", z.ZodTypeAny, {
2584
- type: "execution_complete";
2585
- status: "failed" | "success" | "partial" | "replan_required";
2586
- summary: string;
2587
- }, {
2588
- type: "execution_complete";
2589
- status: "failed" | "success" | "partial" | "replan_required";
2590
- summary: string;
2591
- }>]>;
2592
- export type ExecutionEvent = z.infer<typeof ExecutionEventSchema>;
2593
- /**
2594
- * Configuration for the planning agent.
2595
- */
2596
- export declare const AgentPlanningConfigSchema: z.ZodObject<{
2597
- /** Whether planning is enabled (default: true) */
2598
- enabled: z.ZodOptional<z.ZodBoolean>;
2599
- /** Override model for planning */
2600
- planningModel: z.ZodOptional<z.ZodString>;
2601
- }, "strict", z.ZodTypeAny, {
2602
- enabled?: boolean | undefined;
2603
- planningModel?: string | undefined;
2604
- }, {
2605
- enabled?: boolean | undefined;
2606
- planningModel?: string | undefined;
2607
- }>;
2608
- export type AgentPlanningConfig = z.infer<typeof AgentPlanningConfigSchema>;
2609
- /**
2610
- * Request to generate a plan (Phase 1).
2611
- * Extends existing chat request with planning config.
2612
- */
2613
- export declare const PlanRequestSchema: z.ZodObject<{
2614
- /** Conversation history */
2615
- messages: z.ZodArray<z.ZodUnknown, "many">;
2616
- /** Current user prompt */
2617
- prompt: z.ZodUnknown;
2618
- /** User context (wallet, address, etc.) */
2619
- userContext: z.ZodUnknown;
2620
- /** Tool configuration */
2621
- toolsConfig: z.ZodUnknown;
2622
- /** Planning-specific configuration */
2623
- agentPlanningConfig: z.ZodOptional<z.ZodObject<{
2624
- /** Whether planning is enabled (default: true) */
2625
- enabled: z.ZodOptional<z.ZodBoolean>;
2626
- /** Override model for planning */
2627
- planningModel: z.ZodOptional<z.ZodString>;
2628
- }, "strict", z.ZodTypeAny, {
2629
- enabled?: boolean | undefined;
2630
- planningModel?: string | undefined;
2631
- }, {
2632
- enabled?: boolean | undefined;
2633
- planningModel?: string | undefined;
2634
- }>>;
2635
- }, "strict", z.ZodTypeAny, {
2636
- messages: unknown[];
2637
- toolsConfig?: unknown;
2638
- userContext?: unknown;
2639
- prompt?: unknown;
2640
- agentPlanningConfig?: {
2641
- enabled?: boolean | undefined;
2642
- planningModel?: string | undefined;
2643
- } | undefined;
2644
- }, {
2645
- messages: unknown[];
2646
- toolsConfig?: unknown;
2647
- userContext?: unknown;
2648
- prompt?: unknown;
2649
- agentPlanningConfig?: {
2650
- enabled?: boolean | undefined;
2651
- planningModel?: string | undefined;
2652
- } | undefined;
2653
- }>;
2654
- export type PlanRequest = z.infer<typeof PlanRequestSchema>;
2655
- /**
2656
- * Request to execute an approved plan (Phase 3).
2657
- */
2658
- export declare const ExecuteRequestSchema: z.ZodObject<{
2659
- /** The plan user approved */
2660
- acceptedPlan: z.ZodObject<{
2661
- /** Unique identifier for this plan */
2662
- planId: z.ZodString;
2663
- /** Version number for plan updates */
2664
- version: z.ZodNumber;
2665
- /** Whether the plan can be executed (false if conflicts exist) */
2666
- isExecutable: z.ZodBoolean;
2667
- /** Whether the plan can auto-execute without approval (read-only, no conflicts) */
2668
- autoExecutable: z.ZodBoolean;
2669
- /** User-facing summary */
2670
- userSummary: z.ZodObject<{
2671
- /** Short title for the plan */
2672
- title: z.ZodString;
2673
- /** Longer description of what the plan will do */
2674
- description: z.ZodString;
2675
- /** Key points to highlight to the user (required, use empty array if none) */
2676
- highlights: z.ZodArray<z.ZodString, "many">;
2677
- }, "strict", z.ZodTypeAny, {
2678
- description: string;
2679
- title: string;
2680
- highlights: string[];
2681
- }, {
2682
- description: string;
2683
- title: string;
2684
- highlights: string[];
2685
- }>;
2686
- /** Conflicts preventing execution (use empty array if none) */
2687
- conflicts: z.ZodArray<z.ZodObject<{
2688
- /** Type of conflict */
2689
- type: z.ZodEnum<["insufficient_balance", "missing_approval", "unsupported_chain", "unsupported_token", "hallucinated_action", "validation_error", "unknown"]>;
2690
- /** Severity level - blocking conflicts prevent execution, warnings allow user override */
2691
- severity: z.ZodEnum<["blocking", "warning"]>;
2692
- /** Human-readable explanation */
2693
- message: z.ZodString;
2694
- /** Suggested resolution (use empty string when no suggestion available) */
2695
- suggestion: z.ZodString;
2696
- /** Which step(s) are affected (use empty array if not step-specific) */
2697
- affectedSteps: z.ZodArray<z.ZodNumber, "many">;
2698
- }, "strict", z.ZodTypeAny, {
2699
- message: string;
2700
- type: "unknown" | "insufficient_balance" | "missing_approval" | "unsupported_chain" | "unsupported_token" | "hallucinated_action" | "validation_error";
2701
- severity: "blocking" | "warning";
2702
- suggestion: string;
2703
- affectedSteps: number[];
2704
- }, {
2705
- message: string;
2706
- type: "unknown" | "insufficient_balance" | "missing_approval" | "unsupported_chain" | "unsupported_token" | "hallucinated_action" | "validation_error";
2707
- severity: "blocking" | "warning";
2708
- suggestion: string;
2709
- affectedSteps: number[];
2710
- }>, "many">;
2711
- /** The execution steps */
2712
- executionSteps: z.ZodObject<{
2713
- /** All steps in execution order */
2714
- steps: z.ZodArray<z.ZodObject<{
2715
- /** Sequential step number (1-indexed) */
2716
- stepNumber: z.ZodNumber;
2717
- /** Human-readable description of what this step does */
2718
- description: z.ZodString;
2719
- /** Whether this is a read or write operation */
2720
- operationType: z.ZodEnum<["read", "write"]>;
2721
- /** Whether user must approve before execution */
2722
- requiresUserApproval: z.ZodBoolean;
2723
- /** Step numbers this step depends on (must complete first) */
2724
- dependsOn: z.ZodArray<z.ZodNumber, "many">;
2725
- /** Current execution status */
2726
- status: z.ZodEnum<["pending", "in_progress", "completed", "failed", "skipped"]>;
2727
- /** Instructions for the executor */
2728
- executionInstructions: z.ZodObject<{
2729
- /** Clear objective for what this step should accomplish */
2730
- objective: z.ZodString;
2731
- /** Maps input names to sources as array of {key, value} entries */
2732
- inputSource: z.ZodArray<z.ZodObject<{
2733
- key: z.ZodString;
2734
- value: z.ZodString;
2735
- }, "strict", z.ZodTypeAny, {
2736
- value: string;
2737
- key: string;
2738
- }, {
2739
- value: string;
2740
- key: string;
2741
- }>, "many">;
2742
- /** Description of what output is expected */
2743
- expectedOutput: z.ZodString;
2744
- /** How to handle errors for this step */
2745
- errorHandling: z.ZodString;
2746
- /** Additional constraints for execution (required, use empty array if none) */
2747
- constraints: z.ZodArray<z.ZodString, "many">;
2748
- }, "strict", z.ZodTypeAny, {
2749
- objective: string;
2750
- inputSource: {
2751
- value: string;
2752
- key: string;
2753
- }[];
2754
- expectedOutput: string;
2755
- errorHandling: string;
2756
- constraints: string[];
2757
- }, {
2758
- objective: string;
2759
- inputSource: {
2760
- value: string;
2761
- key: string;
2762
- }[];
2763
- expectedOutput: string;
2764
- errorHandling: string;
2765
- constraints: string[];
2766
- }>;
2767
- /** The tool/action to use for this step */
2768
- toolName: z.ZodString;
2769
- } & {
2770
- /** Result from execution (populated after completion) */
2771
- result: z.ZodOptional<z.ZodUnknown>;
2772
- }, "strict", z.ZodTypeAny, {
2773
- status: "pending" | "in_progress" | "completed" | "failed" | "skipped";
2774
- description: string;
2775
- toolName: string;
2776
- stepNumber: number;
2777
- operationType: "read" | "write";
2778
- requiresUserApproval: boolean;
2779
- dependsOn: number[];
2780
- executionInstructions: {
2781
- objective: string;
2782
- inputSource: {
2783
- value: string;
2784
- key: string;
2785
- }[];
2786
- expectedOutput: string;
2787
- errorHandling: string;
2788
- constraints: string[];
2789
- };
2790
- result?: unknown;
2791
- }, {
2792
- status: "pending" | "in_progress" | "completed" | "failed" | "skipped";
2793
- description: string;
2794
- toolName: string;
2795
- stepNumber: number;
2796
- operationType: "read" | "write";
2797
- requiresUserApproval: boolean;
2798
- dependsOn: number[];
2799
- executionInstructions: {
2800
- objective: string;
2801
- inputSource: {
2802
- value: string;
2803
- key: string;
2804
- }[];
2805
- expectedOutput: string;
2806
- errorHandling: string;
2807
- constraints: string[];
2808
- };
2809
- result?: unknown;
2810
- }>, "many">;
2811
- /** Total number of steps */
2812
- totalSteps: z.ZodNumber;
2813
- /** Estimated gas cost (null if not calculable) */
2814
- estimatedGas: z.ZodNullable<z.ZodString>;
2815
- /** Estimated time to complete (null if not calculable) */
2816
- estimatedTimeMs: z.ZodNullable<z.ZodNumber>;
2817
- }, "strict", z.ZodTypeAny, {
2818
- steps: {
2819
- status: "pending" | "in_progress" | "completed" | "failed" | "skipped";
2820
- description: string;
2821
- toolName: string;
2822
- stepNumber: number;
2823
- operationType: "read" | "write";
2824
- requiresUserApproval: boolean;
2825
- dependsOn: number[];
2826
- executionInstructions: {
2827
- objective: string;
2828
- inputSource: {
2829
- value: string;
2830
- key: string;
2831
- }[];
2832
- expectedOutput: string;
2833
- errorHandling: string;
2834
- constraints: string[];
2835
- };
2836
- result?: unknown;
2837
- }[];
2838
- totalSteps: number;
2839
- estimatedGas: string | null;
2840
- estimatedTimeMs: number | null;
2841
- }, {
2842
- steps: {
2843
- status: "pending" | "in_progress" | "completed" | "failed" | "skipped";
2844
- description: string;
2845
- toolName: string;
2846
- stepNumber: number;
2847
- operationType: "read" | "write";
2848
- requiresUserApproval: boolean;
2849
- dependsOn: number[];
2850
- executionInstructions: {
2851
- objective: string;
2852
- inputSource: {
2853
- value: string;
2854
- key: string;
2855
- }[];
2856
- expectedOutput: string;
2857
- errorHandling: string;
2858
- constraints: string[];
2859
- };
2860
- result?: unknown;
2861
- }[];
2862
- totalSteps: number;
2863
- estimatedGas: string | null;
2864
- estimatedTimeMs: number | null;
2865
- }>;
2866
- /** When the plan was created */
2867
- createdAt: z.ZodString;
2868
- /** If this is a replan, context about the original (null if not a replan) */
2869
- replanContext: z.ZodNullable<z.ZodObject<{
2870
- /** ID of the original plan that failed */
2871
- originalPlanId: z.ZodString;
2872
- /** Reason replanning was needed */
2873
- replanReason: z.ZodString;
2874
- /** Step numbers that were preserved from original */
2875
- preservedSteps: z.ZodArray<z.ZodNumber, "many">;
2876
- /** How many times we've replanned */
2877
- replanAttempt: z.ZodNumber;
2878
- }, "strict", z.ZodTypeAny, {
2879
- originalPlanId: string;
2880
- replanReason: string;
2881
- preservedSteps: number[];
2882
- replanAttempt: number;
2883
- }, {
2884
- originalPlanId: string;
2885
- replanReason: string;
2886
- preservedSteps: number[];
2887
- replanAttempt: number;
2888
- }>>;
2889
- }, "strict", z.ZodTypeAny, {
2890
- planId: string;
2891
- version: number;
2892
- isExecutable: boolean;
2893
- autoExecutable: boolean;
2894
- userSummary: {
2895
- description: string;
2896
- title: string;
2897
- highlights: string[];
2898
- };
2899
- conflicts: {
2900
- message: string;
2901
- type: "unknown" | "insufficient_balance" | "missing_approval" | "unsupported_chain" | "unsupported_token" | "hallucinated_action" | "validation_error";
2902
- severity: "blocking" | "warning";
2903
- suggestion: string;
2904
- affectedSteps: number[];
2905
- }[];
2906
- executionSteps: {
2907
- steps: {
2908
- status: "pending" | "in_progress" | "completed" | "failed" | "skipped";
2909
- description: string;
2910
- toolName: string;
2911
- stepNumber: number;
2912
- operationType: "read" | "write";
2913
- requiresUserApproval: boolean;
2914
- dependsOn: number[];
2915
- executionInstructions: {
2916
- objective: string;
2917
- inputSource: {
2918
- value: string;
2919
- key: string;
2920
- }[];
2921
- expectedOutput: string;
2922
- errorHandling: string;
2923
- constraints: string[];
2924
- };
2925
- result?: unknown;
2926
- }[];
2927
- totalSteps: number;
2928
- estimatedGas: string | null;
2929
- estimatedTimeMs: number | null;
2930
- };
2931
- createdAt: string;
2932
- replanContext: {
2933
- originalPlanId: string;
2934
- replanReason: string;
2935
- preservedSteps: number[];
2936
- replanAttempt: number;
2937
- } | null;
2938
- }, {
2939
- planId: string;
2940
- version: number;
2941
- isExecutable: boolean;
2942
- autoExecutable: boolean;
2943
- userSummary: {
2944
- description: string;
2945
- title: string;
2946
- highlights: string[];
2947
- };
2948
- conflicts: {
2949
- message: string;
2950
- type: "unknown" | "insufficient_balance" | "missing_approval" | "unsupported_chain" | "unsupported_token" | "hallucinated_action" | "validation_error";
2951
- severity: "blocking" | "warning";
2952
- suggestion: string;
2953
- affectedSteps: number[];
2954
- }[];
2955
- executionSteps: {
2956
- steps: {
2957
- status: "pending" | "in_progress" | "completed" | "failed" | "skipped";
2958
- description: string;
2959
- toolName: string;
2960
- stepNumber: number;
2961
- operationType: "read" | "write";
2962
- requiresUserApproval: boolean;
2963
- dependsOn: number[];
2964
- executionInstructions: {
2965
- objective: string;
2966
- inputSource: {
2967
- value: string;
2968
- key: string;
2969
- }[];
2970
- expectedOutput: string;
2971
- errorHandling: string;
2972
- constraints: string[];
2973
- };
2974
- result?: unknown;
2975
- }[];
2976
- totalSteps: number;
2977
- estimatedGas: string | null;
2978
- estimatedTimeMs: number | null;
2979
- };
2980
- createdAt: string;
2981
- replanContext: {
2982
- originalPlanId: string;
2983
- replanReason: string;
2984
- preservedSteps: number[];
2985
- replanAttempt: number;
2986
- } | null;
2987
- }>;
2988
- /** User context for signing */
2989
- userContext: z.ZodUnknown;
2990
- /** Tool configuration */
2991
- toolsConfig: z.ZodUnknown;
2992
- }, "strict", z.ZodTypeAny, {
2993
- acceptedPlan: {
2994
- planId: string;
2995
- version: number;
2996
- isExecutable: boolean;
2997
- autoExecutable: boolean;
2998
- userSummary: {
2999
- description: string;
3000
- title: string;
3001
- highlights: string[];
3002
- };
3003
- conflicts: {
3004
- message: string;
3005
- type: "unknown" | "insufficient_balance" | "missing_approval" | "unsupported_chain" | "unsupported_token" | "hallucinated_action" | "validation_error";
3006
- severity: "blocking" | "warning";
3007
- suggestion: string;
3008
- affectedSteps: number[];
3009
- }[];
3010
- executionSteps: {
3011
- steps: {
3012
- status: "pending" | "in_progress" | "completed" | "failed" | "skipped";
3013
- description: string;
3014
- toolName: string;
3015
- stepNumber: number;
3016
- operationType: "read" | "write";
3017
- requiresUserApproval: boolean;
3018
- dependsOn: number[];
3019
- executionInstructions: {
3020
- objective: string;
3021
- inputSource: {
3022
- value: string;
3023
- key: string;
3024
- }[];
3025
- expectedOutput: string;
3026
- errorHandling: string;
3027
- constraints: string[];
3028
- };
3029
- result?: unknown;
3030
- }[];
3031
- totalSteps: number;
3032
- estimatedGas: string | null;
3033
- estimatedTimeMs: number | null;
3034
- };
3035
- createdAt: string;
3036
- replanContext: {
3037
- originalPlanId: string;
3038
- replanReason: string;
3039
- preservedSteps: number[];
3040
- replanAttempt: number;
3041
- } | null;
3042
- };
3043
- toolsConfig?: unknown;
3044
- userContext?: unknown;
3045
- }, {
3046
- acceptedPlan: {
3047
- planId: string;
3048
- version: number;
3049
- isExecutable: boolean;
3050
- autoExecutable: boolean;
3051
- userSummary: {
3052
- description: string;
3053
- title: string;
3054
- highlights: string[];
3055
- };
3056
- conflicts: {
3057
- message: string;
3058
- type: "unknown" | "insufficient_balance" | "missing_approval" | "unsupported_chain" | "unsupported_token" | "hallucinated_action" | "validation_error";
3059
- severity: "blocking" | "warning";
3060
- suggestion: string;
3061
- affectedSteps: number[];
3062
- }[];
3063
- executionSteps: {
3064
- steps: {
3065
- status: "pending" | "in_progress" | "completed" | "failed" | "skipped";
3066
- description: string;
3067
- toolName: string;
3068
- stepNumber: number;
3069
- operationType: "read" | "write";
3070
- requiresUserApproval: boolean;
3071
- dependsOn: number[];
3072
- executionInstructions: {
3073
- objective: string;
3074
- inputSource: {
3075
- value: string;
3076
- key: string;
3077
- }[];
3078
- expectedOutput: string;
3079
- errorHandling: string;
3080
- constraints: string[];
3081
- };
3082
- result?: unknown;
3083
- }[];
3084
- totalSteps: number;
3085
- estimatedGas: string | null;
3086
- estimatedTimeMs: number | null;
3087
- };
3088
- createdAt: string;
3089
- replanContext: {
3090
- originalPlanId: string;
3091
- replanReason: string;
3092
- preservedSteps: number[];
3093
- replanAttempt: number;
3094
- } | null;
3095
- };
3096
- toolsConfig?: unknown;
3097
- userContext?: unknown;
3098
- }>;
3099
- export type ExecuteRequest = z.infer<typeof ExecuteRequestSchema>;
3100
- /**
3101
- * Signature continuation sent when client signs a transaction.
3102
- */
3103
- export declare const SignatureContinuationSchema: z.ZodObject<{
3104
- /** ID of the plan being executed */
3105
- planId: z.ZodString;
3106
- /** Step number that requested the signature */
3107
- stepNumber: z.ZodNumber;
3108
- /** The signed transaction data */
3109
- signature: z.ZodString;
3110
- }, "strict", z.ZodTypeAny, {
3111
- stepNumber: number;
3112
- planId: string;
3113
- signature: string;
3114
- }, {
3115
- stepNumber: number;
3116
- planId: string;
3117
- signature: string;
3118
- }>;
3119
- export type SignatureContinuation = z.infer<typeof SignatureContinuationSchema>;
3120
- /**
3121
- * Result from executing a single step.
3122
- */
3123
- export declare const StepResultSchema: z.ZodObject<{
3124
- /** Whether step requires a signature */
3125
- requiresSignature: z.ZodBoolean;
3126
- /** Transaction data if signature required */
3127
- transaction: z.ZodOptional<z.ZodEffects<z.ZodObject<{
3128
- /** Chain ID where transaction will execute */
3129
- chainId: z.ZodNumber;
3130
- /** Single transaction to sign (for simple operations) */
3131
- transaction: z.ZodOptional<z.ZodUnknown>;
3132
- /** Array of transactions to sign and execute in sequence (for batch operations like approval + swap) */
3133
- transactions: z.ZodOptional<z.ZodArray<z.ZodUnknown, "many">>;
3134
- /** Human-readable description of what's being signed */
3135
- description: z.ZodString;
3136
- /** Estimated gas for the transaction */
3137
- estimatedGas: z.ZodOptional<z.ZodString>;
3138
- /** Estimated value in USD */
3139
- estimatedValueUsd: z.ZodOptional<z.ZodString>;
3140
- }, "strict", z.ZodTypeAny, {
3141
- description: string;
3142
- chainId: number;
3143
- transaction?: unknown;
3144
- transactions?: unknown[] | undefined;
3145
- estimatedGas?: string | undefined;
3146
- estimatedValueUsd?: string | undefined;
3147
- }, {
3148
- description: string;
3149
- chainId: number;
3150
- transaction?: unknown;
3151
- transactions?: unknown[] | undefined;
3152
- estimatedGas?: string | undefined;
3153
- estimatedValueUsd?: string | undefined;
3154
- }>, {
3155
- description: string;
3156
- chainId: number;
3157
- transaction?: unknown;
3158
- transactions?: unknown[] | undefined;
3159
- estimatedGas?: string | undefined;
3160
- estimatedValueUsd?: string | undefined;
3161
- }, {
3162
- description: string;
3163
- chainId: number;
3164
- transaction?: unknown;
3165
- transactions?: unknown[] | undefined;
3166
- estimatedGas?: string | undefined;
3167
- estimatedValueUsd?: string | undefined;
3168
- }>>;
3169
- /** Result data from execution */
3170
- data: z.ZodOptional<z.ZodUnknown>;
3171
- /** Error message if step failed */
3172
- error: z.ZodOptional<z.ZodString>;
3173
- }, "strict", z.ZodTypeAny, {
3174
- requiresSignature: boolean;
3175
- data?: unknown;
3176
- error?: string | undefined;
3177
- transaction?: {
3178
- description: string;
3179
- chainId: number;
3180
- transaction?: unknown;
3181
- transactions?: unknown[] | undefined;
3182
- estimatedGas?: string | undefined;
3183
- estimatedValueUsd?: string | undefined;
3184
- } | undefined;
3185
- }, {
3186
- requiresSignature: boolean;
3187
- data?: unknown;
3188
- error?: string | undefined;
3189
- transaction?: {
3190
- description: string;
3191
- chainId: number;
3192
- transaction?: unknown;
3193
- transactions?: unknown[] | undefined;
3194
- estimatedGas?: string | undefined;
3195
- estimatedValueUsd?: string | undefined;
3196
- } | undefined;
3197
- }>;
3198
- export type StepResult = z.infer<typeof StepResultSchema>;
3199
- /**
3200
- * Result from plan execution.
3201
- */
3202
- export declare const ExecutionResultSchema: z.ZodObject<{
3203
- /** Execution status */
3204
- status: z.ZodEnum<["success", "partial", "failed", "replan_required"]>;
3205
- /** Final plan state with results */
3206
- plan: z.ZodObject<{
3207
- /** Unique identifier for this plan */
3208
- planId: z.ZodString;
3209
- /** Version number for plan updates */
3210
- version: z.ZodNumber;
3211
- /** Whether the plan can be executed (false if conflicts exist) */
3212
- isExecutable: z.ZodBoolean;
3213
- /** Whether the plan can auto-execute without approval (read-only, no conflicts) */
3214
- autoExecutable: z.ZodBoolean;
3215
- /** User-facing summary */
3216
- userSummary: z.ZodObject<{
3217
- /** Short title for the plan */
3218
- title: z.ZodString;
3219
- /** Longer description of what the plan will do */
3220
- description: z.ZodString;
3221
- /** Key points to highlight to the user (required, use empty array if none) */
3222
- highlights: z.ZodArray<z.ZodString, "many">;
3223
- }, "strict", z.ZodTypeAny, {
3224
- description: string;
3225
- title: string;
3226
- highlights: string[];
3227
- }, {
3228
- description: string;
3229
- title: string;
3230
- highlights: string[];
3231
- }>;
3232
- /** Conflicts preventing execution (use empty array if none) */
3233
- conflicts: z.ZodArray<z.ZodObject<{
3234
- /** Type of conflict */
3235
- type: z.ZodEnum<["insufficient_balance", "missing_approval", "unsupported_chain", "unsupported_token", "hallucinated_action", "validation_error", "unknown"]>;
3236
- /** Severity level - blocking conflicts prevent execution, warnings allow user override */
3237
- severity: z.ZodEnum<["blocking", "warning"]>;
3238
- /** Human-readable explanation */
3239
- message: z.ZodString;
3240
- /** Suggested resolution (use empty string when no suggestion available) */
3241
- suggestion: z.ZodString;
3242
- /** Which step(s) are affected (use empty array if not step-specific) */
3243
- affectedSteps: z.ZodArray<z.ZodNumber, "many">;
3244
- }, "strict", z.ZodTypeAny, {
3245
- message: string;
3246
- type: "unknown" | "insufficient_balance" | "missing_approval" | "unsupported_chain" | "unsupported_token" | "hallucinated_action" | "validation_error";
3247
- severity: "blocking" | "warning";
3248
- suggestion: string;
3249
- affectedSteps: number[];
3250
- }, {
3251
- message: string;
3252
- type: "unknown" | "insufficient_balance" | "missing_approval" | "unsupported_chain" | "unsupported_token" | "hallucinated_action" | "validation_error";
3253
- severity: "blocking" | "warning";
3254
- suggestion: string;
3255
- affectedSteps: number[];
3256
- }>, "many">;
3257
- /** The execution steps */
3258
- executionSteps: z.ZodObject<{
3259
- /** All steps in execution order */
3260
- steps: z.ZodArray<z.ZodObject<{
3261
- /** Sequential step number (1-indexed) */
3262
- stepNumber: z.ZodNumber;
3263
- /** Human-readable description of what this step does */
3264
- description: z.ZodString;
3265
- /** Whether this is a read or write operation */
3266
- operationType: z.ZodEnum<["read", "write"]>;
3267
- /** Whether user must approve before execution */
3268
- requiresUserApproval: z.ZodBoolean;
3269
- /** Step numbers this step depends on (must complete first) */
3270
- dependsOn: z.ZodArray<z.ZodNumber, "many">;
3271
- /** Current execution status */
3272
- status: z.ZodEnum<["pending", "in_progress", "completed", "failed", "skipped"]>;
3273
- /** Instructions for the executor */
3274
- executionInstructions: z.ZodObject<{
3275
- /** Clear objective for what this step should accomplish */
3276
- objective: z.ZodString;
3277
- /** Maps input names to sources as array of {key, value} entries */
3278
- inputSource: z.ZodArray<z.ZodObject<{
3279
- key: z.ZodString;
3280
- value: z.ZodString;
3281
- }, "strict", z.ZodTypeAny, {
3282
- value: string;
3283
- key: string;
3284
- }, {
3285
- value: string;
3286
- key: string;
3287
- }>, "many">;
3288
- /** Description of what output is expected */
3289
- expectedOutput: z.ZodString;
3290
- /** How to handle errors for this step */
3291
- errorHandling: z.ZodString;
3292
- /** Additional constraints for execution (required, use empty array if none) */
3293
- constraints: z.ZodArray<z.ZodString, "many">;
3294
- }, "strict", z.ZodTypeAny, {
3295
- objective: string;
3296
- inputSource: {
3297
- value: string;
3298
- key: string;
3299
- }[];
3300
- expectedOutput: string;
3301
- errorHandling: string;
3302
- constraints: string[];
3303
- }, {
3304
- objective: string;
3305
- inputSource: {
3306
- value: string;
3307
- key: string;
3308
- }[];
3309
- expectedOutput: string;
3310
- errorHandling: string;
3311
- constraints: string[];
3312
- }>;
3313
- /** The tool/action to use for this step */
3314
- toolName: z.ZodString;
3315
- } & {
3316
- /** Result from execution (populated after completion) */
3317
- result: z.ZodOptional<z.ZodUnknown>;
3318
- }, "strict", z.ZodTypeAny, {
3319
- status: "pending" | "in_progress" | "completed" | "failed" | "skipped";
3320
- description: string;
3321
- toolName: string;
3322
- stepNumber: number;
3323
- operationType: "read" | "write";
3324
- requiresUserApproval: boolean;
3325
- dependsOn: number[];
3326
- executionInstructions: {
3327
- objective: string;
3328
- inputSource: {
3329
- value: string;
3330
- key: string;
3331
- }[];
3332
- expectedOutput: string;
3333
- errorHandling: string;
3334
- constraints: string[];
3335
- };
3336
- result?: unknown;
3337
- }, {
3338
- status: "pending" | "in_progress" | "completed" | "failed" | "skipped";
3339
- description: string;
3340
- toolName: string;
3341
- stepNumber: number;
3342
- operationType: "read" | "write";
3343
- requiresUserApproval: boolean;
3344
- dependsOn: number[];
3345
- executionInstructions: {
3346
- objective: string;
3347
- inputSource: {
3348
- value: string;
3349
- key: string;
3350
- }[];
3351
- expectedOutput: string;
3352
- errorHandling: string;
3353
- constraints: string[];
3354
- };
3355
- result?: unknown;
3356
- }>, "many">;
3357
- /** Total number of steps */
3358
- totalSteps: z.ZodNumber;
3359
- /** Estimated gas cost (null if not calculable) */
3360
- estimatedGas: z.ZodNullable<z.ZodString>;
3361
- /** Estimated time to complete (null if not calculable) */
3362
- estimatedTimeMs: z.ZodNullable<z.ZodNumber>;
3363
- }, "strict", z.ZodTypeAny, {
3364
- steps: {
3365
- status: "pending" | "in_progress" | "completed" | "failed" | "skipped";
3366
- description: string;
3367
- toolName: string;
3368
- stepNumber: number;
3369
- operationType: "read" | "write";
3370
- requiresUserApproval: boolean;
3371
- dependsOn: number[];
3372
- executionInstructions: {
3373
- objective: string;
3374
- inputSource: {
3375
- value: string;
3376
- key: string;
3377
- }[];
3378
- expectedOutput: string;
3379
- errorHandling: string;
3380
- constraints: string[];
3381
- };
3382
- result?: unknown;
3383
- }[];
3384
- totalSteps: number;
3385
- estimatedGas: string | null;
3386
- estimatedTimeMs: number | null;
3387
- }, {
3388
- steps: {
3389
- status: "pending" | "in_progress" | "completed" | "failed" | "skipped";
3390
- description: string;
3391
- toolName: string;
3392
- stepNumber: number;
3393
- operationType: "read" | "write";
3394
- requiresUserApproval: boolean;
3395
- dependsOn: number[];
3396
- executionInstructions: {
3397
- objective: string;
3398
- inputSource: {
3399
- value: string;
3400
- key: string;
3401
- }[];
3402
- expectedOutput: string;
3403
- errorHandling: string;
3404
- constraints: string[];
3405
- };
3406
- result?: unknown;
3407
- }[];
3408
- totalSteps: number;
3409
- estimatedGas: string | null;
3410
- estimatedTimeMs: number | null;
3411
- }>;
3412
- /** When the plan was created */
3413
- createdAt: z.ZodString;
3414
- /** If this is a replan, context about the original (null if not a replan) */
3415
- replanContext: z.ZodNullable<z.ZodObject<{
3416
- /** ID of the original plan that failed */
3417
- originalPlanId: z.ZodString;
3418
- /** Reason replanning was needed */
3419
- replanReason: z.ZodString;
3420
- /** Step numbers that were preserved from original */
3421
- preservedSteps: z.ZodArray<z.ZodNumber, "many">;
3422
- /** How many times we've replanned */
3423
- replanAttempt: z.ZodNumber;
3424
- }, "strict", z.ZodTypeAny, {
3425
- originalPlanId: string;
3426
- replanReason: string;
3427
- preservedSteps: number[];
3428
- replanAttempt: number;
3429
- }, {
3430
- originalPlanId: string;
3431
- replanReason: string;
3432
- preservedSteps: number[];
3433
- replanAttempt: number;
3434
- }>>;
3435
- }, "strict", z.ZodTypeAny, {
3436
- planId: string;
3437
- version: number;
3438
- isExecutable: boolean;
3439
- autoExecutable: boolean;
3440
- userSummary: {
3441
- description: string;
3442
- title: string;
3443
- highlights: string[];
3444
- };
3445
- conflicts: {
3446
- message: string;
3447
- type: "unknown" | "insufficient_balance" | "missing_approval" | "unsupported_chain" | "unsupported_token" | "hallucinated_action" | "validation_error";
3448
- severity: "blocking" | "warning";
3449
- suggestion: string;
3450
- affectedSteps: number[];
3451
- }[];
3452
- executionSteps: {
3453
- steps: {
3454
- status: "pending" | "in_progress" | "completed" | "failed" | "skipped";
3455
- description: string;
3456
- toolName: string;
3457
- stepNumber: number;
3458
- operationType: "read" | "write";
3459
- requiresUserApproval: boolean;
3460
- dependsOn: number[];
3461
- executionInstructions: {
3462
- objective: string;
3463
- inputSource: {
3464
- value: string;
3465
- key: string;
3466
- }[];
3467
- expectedOutput: string;
3468
- errorHandling: string;
3469
- constraints: string[];
3470
- };
3471
- result?: unknown;
3472
- }[];
3473
- totalSteps: number;
3474
- estimatedGas: string | null;
3475
- estimatedTimeMs: number | null;
3476
- };
3477
- createdAt: string;
3478
- replanContext: {
3479
- originalPlanId: string;
3480
- replanReason: string;
3481
- preservedSteps: number[];
3482
- replanAttempt: number;
3483
- } | null;
3484
- }, {
3485
- planId: string;
3486
- version: number;
3487
- isExecutable: boolean;
3488
- autoExecutable: boolean;
3489
- userSummary: {
3490
- description: string;
3491
- title: string;
3492
- highlights: string[];
3493
- };
3494
- conflicts: {
3495
- message: string;
3496
- type: "unknown" | "insufficient_balance" | "missing_approval" | "unsupported_chain" | "unsupported_token" | "hallucinated_action" | "validation_error";
3497
- severity: "blocking" | "warning";
3498
- suggestion: string;
3499
- affectedSteps: number[];
3500
- }[];
3501
- executionSteps: {
3502
- steps: {
3503
- status: "pending" | "in_progress" | "completed" | "failed" | "skipped";
3504
- description: string;
3505
- toolName: string;
3506
- stepNumber: number;
3507
- operationType: "read" | "write";
3508
- requiresUserApproval: boolean;
3509
- dependsOn: number[];
3510
- executionInstructions: {
3511
- objective: string;
3512
- inputSource: {
3513
- value: string;
3514
- key: string;
3515
- }[];
3516
- expectedOutput: string;
3517
- errorHandling: string;
3518
- constraints: string[];
3519
- };
3520
- result?: unknown;
3521
- }[];
3522
- totalSteps: number;
3523
- estimatedGas: string | null;
3524
- estimatedTimeMs: number | null;
3525
- };
3526
- createdAt: string;
3527
- replanContext: {
3528
- originalPlanId: string;
3529
- replanReason: string;
3530
- preservedSteps: number[];
3531
- replanAttempt: number;
3532
- } | null;
3533
- }>;
3534
- /** Human-readable summary */
3535
- summary: z.ZodString;
3536
- /** Whether a new plan requires approval */
3537
- requiresApproval: z.ZodOptional<z.ZodBoolean>;
3538
- }, "strict", z.ZodTypeAny, {
3539
- status: "failed" | "success" | "partial" | "replan_required";
3540
- summary: string;
3541
- plan: {
3542
- planId: string;
3543
- version: number;
3544
- isExecutable: boolean;
3545
- autoExecutable: boolean;
3546
- userSummary: {
3547
- description: string;
3548
- title: string;
3549
- highlights: string[];
3550
- };
3551
- conflicts: {
3552
- message: string;
3553
- type: "unknown" | "insufficient_balance" | "missing_approval" | "unsupported_chain" | "unsupported_token" | "hallucinated_action" | "validation_error";
3554
- severity: "blocking" | "warning";
3555
- suggestion: string;
3556
- affectedSteps: number[];
3557
- }[];
3558
- executionSteps: {
3559
- steps: {
3560
- status: "pending" | "in_progress" | "completed" | "failed" | "skipped";
3561
- description: string;
3562
- toolName: string;
3563
- stepNumber: number;
3564
- operationType: "read" | "write";
3565
- requiresUserApproval: boolean;
3566
- dependsOn: number[];
3567
- executionInstructions: {
3568
- objective: string;
3569
- inputSource: {
3570
- value: string;
3571
- key: string;
3572
- }[];
3573
- expectedOutput: string;
3574
- errorHandling: string;
3575
- constraints: string[];
3576
- };
3577
- result?: unknown;
3578
- }[];
3579
- totalSteps: number;
3580
- estimatedGas: string | null;
3581
- estimatedTimeMs: number | null;
3582
- };
3583
- createdAt: string;
3584
- replanContext: {
3585
- originalPlanId: string;
3586
- replanReason: string;
3587
- preservedSteps: number[];
3588
- replanAttempt: number;
3589
- } | null;
3590
- };
3591
- requiresApproval?: boolean | undefined;
3592
- }, {
3593
- status: "failed" | "success" | "partial" | "replan_required";
3594
- summary: string;
3595
- plan: {
3596
- planId: string;
3597
- version: number;
3598
- isExecutable: boolean;
3599
- autoExecutable: boolean;
3600
- userSummary: {
3601
- description: string;
3602
- title: string;
3603
- highlights: string[];
3604
- };
3605
- conflicts: {
3606
- message: string;
3607
- type: "unknown" | "insufficient_balance" | "missing_approval" | "unsupported_chain" | "unsupported_token" | "hallucinated_action" | "validation_error";
3608
- severity: "blocking" | "warning";
3609
- suggestion: string;
3610
- affectedSteps: number[];
3611
- }[];
3612
- executionSteps: {
3613
- steps: {
3614
- status: "pending" | "in_progress" | "completed" | "failed" | "skipped";
3615
- description: string;
3616
- toolName: string;
3617
- stepNumber: number;
3618
- operationType: "read" | "write";
3619
- requiresUserApproval: boolean;
3620
- dependsOn: number[];
3621
- executionInstructions: {
3622
- objective: string;
3623
- inputSource: {
3624
- value: string;
3625
- key: string;
3626
- }[];
3627
- expectedOutput: string;
3628
- errorHandling: string;
3629
- constraints: string[];
3630
- };
3631
- result?: unknown;
3632
- }[];
3633
- totalSteps: number;
3634
- estimatedGas: string | null;
3635
- estimatedTimeMs: number | null;
3636
- };
3637
- createdAt: string;
3638
- replanContext: {
3639
- originalPlanId: string;
3640
- replanReason: string;
3641
- preservedSteps: number[];
3642
- replanAttempt: number;
3643
- } | null;
3644
- };
3645
- requiresApproval?: boolean | undefined;
3646
- }>;
3647
- export type ExecutionResult = z.infer<typeof ExecutionResultSchema>;
3648
- /**
3649
- * Client-side status for a step in the UI.
3650
- */
3651
- export declare const ClientStepStatusSchema: z.ZodObject<{
3652
- /** Current status */
3653
- status: z.ZodEnum<["pending", "in_progress", "completed", "failed", "skipped"]>;
3654
- /** Description (for in_progress) */
3655
- description: z.ZodOptional<z.ZodString>;
3656
- /** Result (for completed) */
3657
- result: z.ZodOptional<z.ZodUnknown>;
3658
- /** Error message (for failed) */
3659
- error: z.ZodOptional<z.ZodString>;
3660
- }, "strict", z.ZodTypeAny, {
3661
- status: "pending" | "in_progress" | "completed" | "failed" | "skipped";
3662
- result?: unknown;
3663
- error?: string | undefined;
3664
- description?: string | undefined;
3665
- }, {
3666
- status: "pending" | "in_progress" | "completed" | "failed" | "skipped";
3667
- result?: unknown;
3668
- error?: string | undefined;
3669
- description?: string | undefined;
3670
- }>;
3671
- export type ClientStepStatus = z.infer<typeof ClientStepStatusSchema>;
3672
- //# sourceMappingURL=planning.d.ts.map