@opperai/agents 0.7.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -31,161 +31,45 @@ declare const ToolCallRecordSchema: z.ZodObject<{
31
31
  input: z.ZodUnknown;
32
32
  output: z.ZodOptional<z.ZodUnknown>;
33
33
  success: z.ZodOptional<z.ZodBoolean>;
34
- error: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodObject<{
34
+ error: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
35
35
  message: z.ZodString;
36
- }, "passthrough", ZodTypeAny, z.objectOutputType<{
37
- message: z.ZodString;
38
- }, ZodTypeAny, "passthrough">, z.objectInputType<{
39
- message: z.ZodString;
40
- }, ZodTypeAny, "passthrough">>]>>;
36
+ }, z.core.$loose>]>>;
41
37
  startedAt: z.ZodDefault<z.ZodNumber>;
42
38
  finishedAt: z.ZodOptional<z.ZodNumber>;
43
39
  metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
44
- }, "strip", ZodTypeAny, {
45
- id: string;
46
- toolName: string;
47
- startedAt: number;
48
- metadata: Record<string, unknown>;
49
- input?: unknown;
50
- output?: unknown;
51
- success?: boolean | undefined;
52
- error?: string | z.objectOutputType<{
53
- message: z.ZodString;
54
- }, ZodTypeAny, "passthrough"> | undefined;
55
- finishedAt?: number | undefined;
56
- }, {
57
- toolName: string;
58
- id?: string | undefined;
59
- input?: unknown;
60
- output?: unknown;
61
- success?: boolean | undefined;
62
- error?: string | z.objectInputType<{
63
- message: z.ZodString;
64
- }, ZodTypeAny, "passthrough"> | undefined;
65
- startedAt?: number | undefined;
66
- finishedAt?: number | undefined;
67
- metadata?: Record<string, unknown> | undefined;
68
- }>;
40
+ }, z.core.$strip>;
69
41
  type ToolCallRecord = z.infer<typeof ToolCallRecordSchema>;
70
- declare const ToolResultSuccessSchema: z.ZodEffects<z.ZodObject<{
42
+ declare const ToolResultSuccessSchema: z.ZodObject<{
71
43
  toolName: z.ZodString;
72
44
  metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
73
45
  startedAt: z.ZodOptional<z.ZodNumber>;
74
46
  finishedAt: z.ZodOptional<z.ZodNumber>;
75
- } & {
76
47
  success: z.ZodLiteral<true>;
77
48
  output: z.ZodAny;
78
- }, "strip", ZodTypeAny, {
79
- toolName: string;
80
- success: true;
81
- metadata: Record<string, unknown>;
82
- output?: any;
83
- startedAt?: number | undefined;
84
- finishedAt?: number | undefined;
85
- }, {
86
- toolName: string;
87
- success: true;
88
- output?: any;
89
- startedAt?: number | undefined;
90
- finishedAt?: number | undefined;
91
- metadata?: Record<string, unknown> | undefined;
92
- }>, {
93
- toolName: string;
94
- success: true;
95
- metadata: Record<string, unknown>;
96
- output?: any;
97
- startedAt?: number | undefined;
98
- finishedAt?: number | undefined;
99
- }, {
100
- toolName: string;
101
- success: true;
102
- output?: any;
103
- startedAt?: number | undefined;
104
- finishedAt?: number | undefined;
105
- metadata?: Record<string, unknown> | undefined;
106
- }>;
49
+ }, z.core.$strip>;
107
50
  declare const ToolResultFailureSchema: z.ZodObject<{
108
51
  toolName: z.ZodString;
109
52
  metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
110
53
  startedAt: z.ZodOptional<z.ZodNumber>;
111
54
  finishedAt: z.ZodOptional<z.ZodNumber>;
112
- } & {
113
55
  success: z.ZodLiteral<false>;
114
- error: z.ZodUnion<[z.ZodString, ZodType<Error, z.ZodTypeDef, Error>]>;
115
- }, "strip", ZodTypeAny, {
116
- toolName: string;
117
- success: false;
118
- error: string | Error;
119
- metadata: Record<string, unknown>;
120
- startedAt?: number | undefined;
121
- finishedAt?: number | undefined;
122
- }, {
123
- toolName: string;
124
- success: false;
125
- error: string | Error;
126
- startedAt?: number | undefined;
127
- finishedAt?: number | undefined;
128
- metadata?: Record<string, unknown> | undefined;
129
- }>;
130
- declare const ToolResultSchema: z.ZodUnion<[z.ZodEffects<z.ZodObject<{
56
+ error: z.ZodUnion<readonly [z.ZodString, z.ZodCustom<Error, Error>]>;
57
+ }, z.core.$strip>;
58
+ declare const ToolResultSchema: z.ZodUnion<readonly [z.ZodObject<{
131
59
  toolName: z.ZodString;
132
60
  metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
133
61
  startedAt: z.ZodOptional<z.ZodNumber>;
134
62
  finishedAt: z.ZodOptional<z.ZodNumber>;
135
- } & {
136
63
  success: z.ZodLiteral<true>;
137
64
  output: z.ZodAny;
138
- }, "strip", ZodTypeAny, {
139
- toolName: string;
140
- success: true;
141
- metadata: Record<string, unknown>;
142
- output?: any;
143
- startedAt?: number | undefined;
144
- finishedAt?: number | undefined;
145
- }, {
146
- toolName: string;
147
- success: true;
148
- output?: any;
149
- startedAt?: number | undefined;
150
- finishedAt?: number | undefined;
151
- metadata?: Record<string, unknown> | undefined;
152
- }>, {
153
- toolName: string;
154
- success: true;
155
- metadata: Record<string, unknown>;
156
- output?: any;
157
- startedAt?: number | undefined;
158
- finishedAt?: number | undefined;
159
- }, {
160
- toolName: string;
161
- success: true;
162
- output?: any;
163
- startedAt?: number | undefined;
164
- finishedAt?: number | undefined;
165
- metadata?: Record<string, unknown> | undefined;
166
- }>, z.ZodObject<{
65
+ }, z.core.$strip>, z.ZodObject<{
167
66
  toolName: z.ZodString;
168
67
  metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
169
68
  startedAt: z.ZodOptional<z.ZodNumber>;
170
69
  finishedAt: z.ZodOptional<z.ZodNumber>;
171
- } & {
172
70
  success: z.ZodLiteral<false>;
173
- error: z.ZodUnion<[z.ZodString, ZodType<Error, z.ZodTypeDef, Error>]>;
174
- }, "strip", ZodTypeAny, {
175
- toolName: string;
176
- success: false;
177
- error: string | Error;
178
- metadata: Record<string, unknown>;
179
- startedAt?: number | undefined;
180
- finishedAt?: number | undefined;
181
- }, {
182
- toolName: string;
183
- success: false;
184
- error: string | Error;
185
- startedAt?: number | undefined;
186
- finishedAt?: number | undefined;
187
- metadata?: Record<string, unknown> | undefined;
188
- }>]>;
71
+ error: z.ZodUnion<readonly [z.ZodString, z.ZodCustom<Error, Error>]>;
72
+ }, z.core.$strip>]>;
189
73
  type ToolResultData = z.infer<typeof ToolResultSchema>;
190
74
  interface ToolExecutionContext {
191
75
  agentContext: AgentContext;
@@ -280,36 +164,8 @@ declare const BaseUsageSchema: z.ZodObject<{
280
164
  generation: z.ZodDefault<z.ZodNumber>;
281
165
  platform: z.ZodDefault<z.ZodNumber>;
282
166
  total: z.ZodDefault<z.ZodNumber>;
283
- }, "strip", z.ZodTypeAny, {
284
- generation: number;
285
- platform: number;
286
- total: number;
287
- }, {
288
- generation?: number | undefined;
289
- platform?: number | undefined;
290
- total?: number | undefined;
291
- }>>;
292
- }, "strip", z.ZodTypeAny, {
293
- requests: number;
294
- inputTokens: number;
295
- outputTokens: number;
296
- totalTokens: number;
297
- cost: {
298
- generation: number;
299
- platform: number;
300
- total: number;
301
- };
302
- }, {
303
- requests?: number | undefined;
304
- inputTokens?: number | undefined;
305
- outputTokens?: number | undefined;
306
- totalTokens?: number | undefined;
307
- cost?: {
308
- generation?: number | undefined;
309
- platform?: number | undefined;
310
- total?: number | undefined;
311
- } | undefined;
312
- }>;
167
+ }, z.core.$strip>>;
168
+ }, z.core.$strip>;
313
169
  /**
314
170
  * Base usage type (without breakdown) - used for breakdown entries
315
171
  */
@@ -326,20 +182,7 @@ declare const UsageSchema: z.ZodObject<{
326
182
  generation: z.ZodDefault<z.ZodNumber>;
327
183
  platform: z.ZodDefault<z.ZodNumber>;
328
184
  total: z.ZodDefault<z.ZodNumber>;
329
- }, "strip", z.ZodTypeAny, {
330
- generation: number;
331
- platform: number;
332
- total: number;
333
- }, {
334
- generation?: number | undefined;
335
- platform?: number | undefined;
336
- total?: number | undefined;
337
- }>>;
338
- } & {
339
- /**
340
- * Optional breakdown of usage by source (agent name).
341
- * Only present when nested agents are used.
342
- */
185
+ }, z.core.$strip>>;
343
186
  breakdown: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodLazy<z.ZodObject<{
344
187
  requests: z.ZodDefault<z.ZodNumber>;
345
188
  inputTokens: z.ZodDefault<z.ZodNumber>;
@@ -349,79 +192,9 @@ declare const UsageSchema: z.ZodObject<{
349
192
  generation: z.ZodDefault<z.ZodNumber>;
350
193
  platform: z.ZodDefault<z.ZodNumber>;
351
194
  total: z.ZodDefault<z.ZodNumber>;
352
- }, "strip", z.ZodTypeAny, {
353
- generation: number;
354
- platform: number;
355
- total: number;
356
- }, {
357
- generation?: number | undefined;
358
- platform?: number | undefined;
359
- total?: number | undefined;
360
- }>>;
361
- }, "strip", z.ZodTypeAny, {
362
- requests: number;
363
- inputTokens: number;
364
- outputTokens: number;
365
- totalTokens: number;
366
- cost: {
367
- generation: number;
368
- platform: number;
369
- total: number;
370
- };
371
- }, {
372
- requests?: number | undefined;
373
- inputTokens?: number | undefined;
374
- outputTokens?: number | undefined;
375
- totalTokens?: number | undefined;
376
- cost?: {
377
- generation?: number | undefined;
378
- platform?: number | undefined;
379
- total?: number | undefined;
380
- } | undefined;
381
- }>>>>;
382
- }, "strip", z.ZodTypeAny, {
383
- requests: number;
384
- inputTokens: number;
385
- outputTokens: number;
386
- totalTokens: number;
387
- cost: {
388
- generation: number;
389
- platform: number;
390
- total: number;
391
- };
392
- breakdown?: Record<string, {
393
- requests: number;
394
- inputTokens: number;
395
- outputTokens: number;
396
- totalTokens: number;
397
- cost: {
398
- generation: number;
399
- platform: number;
400
- total: number;
401
- };
402
- }> | undefined;
403
- }, {
404
- requests?: number | undefined;
405
- inputTokens?: number | undefined;
406
- outputTokens?: number | undefined;
407
- totalTokens?: number | undefined;
408
- cost?: {
409
- generation?: number | undefined;
410
- platform?: number | undefined;
411
- total?: number | undefined;
412
- } | undefined;
413
- breakdown?: Record<string, {
414
- requests?: number | undefined;
415
- inputTokens?: number | undefined;
416
- outputTokens?: number | undefined;
417
- totalTokens?: number | undefined;
418
- cost?: {
419
- generation?: number | undefined;
420
- platform?: number | undefined;
421
- total?: number | undefined;
422
- } | undefined;
423
- }> | undefined;
424
- }>;
195
+ }, z.core.$strip>>;
196
+ }, z.core.$strip>>>>;
197
+ }, z.core.$strip>;
425
198
  type Usage = z.infer<typeof UsageSchema>;
426
199
  /**
427
200
  * Create an empty usage object with all values set to 0
@@ -440,80 +213,16 @@ declare const ExecutionCycleSchema: z.ZodObject<{
440
213
  input: z.ZodUnknown;
441
214
  output: z.ZodOptional<z.ZodUnknown>;
442
215
  success: z.ZodOptional<z.ZodBoolean>;
443
- error: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodObject<{
444
- message: z.ZodString;
445
- }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
216
+ error: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
446
217
  message: z.ZodString;
447
- }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
448
- message: z.ZodString;
449
- }, z.ZodTypeAny, "passthrough">>]>>;
218
+ }, z.core.$loose>]>>;
450
219
  startedAt: z.ZodDefault<z.ZodNumber>;
451
220
  finishedAt: z.ZodOptional<z.ZodNumber>;
452
221
  metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
453
- }, "strip", z.ZodTypeAny, {
454
- id: string;
455
- toolName: string;
456
- startedAt: number;
457
- metadata: Record<string, unknown>;
458
- input?: unknown;
459
- output?: unknown;
460
- success?: boolean | undefined;
461
- error?: string | z.objectOutputType<{
462
- message: z.ZodString;
463
- }, z.ZodTypeAny, "passthrough"> | undefined;
464
- finishedAt?: number | undefined;
465
- }, {
466
- toolName: string;
467
- id?: string | undefined;
468
- input?: unknown;
469
- output?: unknown;
470
- success?: boolean | undefined;
471
- error?: string | z.objectInputType<{
472
- message: z.ZodString;
473
- }, z.ZodTypeAny, "passthrough"> | undefined;
474
- startedAt?: number | undefined;
475
- finishedAt?: number | undefined;
476
- metadata?: Record<string, unknown> | undefined;
477
- }>, "many">>;
478
- results: z.ZodDefault<z.ZodArray<z.ZodUnknown, "many">>;
222
+ }, z.core.$strip>>>;
223
+ results: z.ZodDefault<z.ZodArray<z.ZodUnknown>>;
479
224
  timestamp: z.ZodDefault<z.ZodNumber>;
480
- }, "strip", z.ZodTypeAny, {
481
- iteration: number;
482
- toolCalls: {
483
- id: string;
484
- toolName: string;
485
- startedAt: number;
486
- metadata: Record<string, unknown>;
487
- input?: unknown;
488
- output?: unknown;
489
- success?: boolean | undefined;
490
- error?: string | z.objectOutputType<{
491
- message: z.ZodString;
492
- }, z.ZodTypeAny, "passthrough"> | undefined;
493
- finishedAt?: number | undefined;
494
- }[];
495
- results: unknown[];
496
- timestamp: number;
497
- thought?: unknown;
498
- }, {
499
- iteration: number;
500
- thought?: unknown;
501
- toolCalls?: {
502
- toolName: string;
503
- id?: string | undefined;
504
- input?: unknown;
505
- output?: unknown;
506
- success?: boolean | undefined;
507
- error?: string | z.objectInputType<{
508
- message: z.ZodString;
509
- }, z.ZodTypeAny, "passthrough"> | undefined;
510
- startedAt?: number | undefined;
511
- finishedAt?: number | undefined;
512
- metadata?: Record<string, unknown> | undefined;
513
- }[] | undefined;
514
- results?: unknown[] | undefined;
515
- timestamp?: number | undefined;
516
- }>;
225
+ }, z.core.$strip>;
517
226
  /** Structured thought recorded during an execution cycle */
518
227
  interface ExecutionThought {
519
228
  reasoning: string;
@@ -1085,15 +794,7 @@ declare const MemoryEntryMetadataSchema: z.ZodObject<{
1085
794
  createdAt: z.ZodNumber;
1086
795
  updatedAt: z.ZodNumber;
1087
796
  accessCount: z.ZodDefault<z.ZodNumber>;
1088
- }, "strip", z.ZodTypeAny, {
1089
- createdAt: number;
1090
- updatedAt: number;
1091
- accessCount: number;
1092
- }, {
1093
- createdAt: number;
1094
- updatedAt: number;
1095
- accessCount?: number | undefined;
1096
- }>;
797
+ }, z.core.$strip>;
1097
798
  type MemoryEntryMetadata = z.infer<typeof MemoryEntryMetadataSchema>;
1098
799
  /**
1099
800
  * Schema for a single memory entry
@@ -1106,34 +807,8 @@ declare const MemoryEntrySchema: z.ZodObject<{
1106
807
  createdAt: z.ZodNumber;
1107
808
  updatedAt: z.ZodNumber;
1108
809
  accessCount: z.ZodDefault<z.ZodNumber>;
1109
- }, "strip", z.ZodTypeAny, {
1110
- createdAt: number;
1111
- updatedAt: number;
1112
- accessCount: number;
1113
- }, {
1114
- createdAt: number;
1115
- updatedAt: number;
1116
- accessCount?: number | undefined;
1117
- }>;
1118
- }, "strip", z.ZodTypeAny, {
1119
- metadata: {
1120
- createdAt: number;
1121
- updatedAt: number;
1122
- accessCount: number;
1123
- };
1124
- key: string;
1125
- description: string;
1126
- value?: unknown;
1127
- }, {
1128
- metadata: {
1129
- createdAt: number;
1130
- updatedAt: number;
1131
- accessCount?: number | undefined;
1132
- };
1133
- key: string;
1134
- description: string;
1135
- value?: unknown;
1136
- }>;
810
+ }, z.core.$strip>;
811
+ }, z.core.$strip>;
1137
812
  type MemoryEntry = z.infer<typeof MemoryEntrySchema>;
1138
813
  /**
1139
814
  * Catalog entry (summary without value) for LLM consumption
@@ -1309,6 +984,12 @@ interface BaseAgentConfig<TInput, TOutput> {
1309
984
  * Custom memory implementation (defaults to InMemoryStore if enableMemory is true)
1310
985
  */
1311
986
  memory?: Memory;
987
+ /**
988
+ * Execute tool calls in parallel when the LLM returns multiple tool calls
989
+ * in a single response. When false (default), tools execute sequentially.
990
+ * @default false
991
+ */
992
+ parallelToolExecution?: boolean;
1312
993
  /**
1313
994
  * Additional metadata for the agent
1314
995
  */
@@ -1379,6 +1060,10 @@ declare abstract class BaseAgent<TInput = unknown, TOutput = unknown> {
1379
1060
  * Whether streaming is enabled
1380
1061
  */
1381
1062
  readonly enableStreaming: boolean;
1063
+ /**
1064
+ * Whether to execute tool calls in parallel
1065
+ */
1066
+ readonly parallelToolExecution: boolean;
1382
1067
  /**
1383
1068
  * Memory instance for persistent storage (null if disabled or initialization failed)
1384
1069
  */
@@ -1819,6 +1504,10 @@ declare class Agent<TInput = unknown, TOutput = unknown> extends BaseAgent<TInpu
1819
1504
  * Execute all tool calls from a decision
1820
1505
  */
1821
1506
  private executeToolCalls;
1507
+ /**
1508
+ * Execute a single tool call with span tracking and error handling
1509
+ */
1510
+ private executeSingleToolCall;
1822
1511
  /**
1823
1512
  * Handle memory operations from a decision
1824
1513
  * Supports read and write operations with graceful degradation
@@ -1840,196 +1529,50 @@ declare class Agent<TInput = unknown, TOutput = unknown> extends BaseAgent<TInpu
1840
1529
  * Schema for agent's internal thought/reasoning
1841
1530
  */
1842
1531
  declare const ThoughtSchema: z.ZodObject<{
1843
- /**
1844
- * The reasoning or internal monologue of the agent
1845
- */
1846
1532
  reasoning: z.ZodString;
1847
- /**
1848
- * Planned next action(s)
1849
- */
1850
1533
  plan: z.ZodOptional<z.ZodString>;
1851
- /**
1852
- * Confidence level (0-1)
1853
- */
1854
1534
  confidence: z.ZodOptional<z.ZodNumber>;
1855
- /**
1856
- * Additional metadata (key-value pairs)
1857
- */
1858
1535
  metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1859
- }, "strip", z.ZodTypeAny, {
1860
- reasoning: string;
1861
- metadata?: Record<string, unknown> | undefined;
1862
- plan?: string | undefined;
1863
- confidence?: number | undefined;
1864
- }, {
1865
- reasoning: string;
1866
- metadata?: Record<string, unknown> | undefined;
1867
- plan?: string | undefined;
1868
- confidence?: number | undefined;
1869
- }>;
1536
+ }, z.core.$strip>;
1870
1537
  type Thought = z.infer<typeof ThoughtSchema>;
1871
1538
  /**
1872
1539
  * Schema for a tool call from the LLM
1873
1540
  */
1874
1541
  declare const ToolCallSchema: z.ZodObject<{
1875
- /**
1876
- * Unique identifier for this tool call
1877
- */
1878
1542
  id: z.ZodString;
1879
- /**
1880
- * Name of the tool to invoke
1881
- */
1882
1543
  toolName: z.ZodString;
1883
- /**
1884
- * Arguments to pass to the tool
1885
- */
1886
1544
  arguments: z.ZodUnknown;
1887
- }, "strip", z.ZodTypeAny, {
1888
- id: string;
1889
- toolName: string;
1890
- arguments?: unknown;
1891
- }, {
1892
- id: string;
1893
- toolName: string;
1894
- arguments?: unknown;
1895
- }>;
1545
+ }, z.core.$strip>;
1896
1546
  type ToolCall = z.infer<typeof ToolCallSchema>;
1897
1547
  /**
1898
1548
  * Schema for memory updates (write operations)
1899
1549
  */
1900
1550
  declare const MemoryUpdateSchema: z.ZodObject<{
1901
- /**
1902
- * Value to store for this key
1903
- */
1904
1551
  value: z.ZodUnknown;
1905
- /**
1906
- * Optional description of the memory entry
1907
- */
1908
1552
  description: z.ZodOptional<z.ZodString>;
1909
- /**
1910
- * Optional metadata for the memory entry
1911
- */
1912
1553
  metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1913
- }, "strip", z.ZodTypeAny, {
1914
- value?: unknown;
1915
- metadata?: Record<string, unknown> | undefined;
1916
- description?: string | undefined;
1917
- }, {
1918
- value?: unknown;
1919
- metadata?: Record<string, unknown> | undefined;
1920
- description?: string | undefined;
1921
- }>;
1554
+ }, z.core.$strip>;
1922
1555
  type MemoryUpdate = z.infer<typeof MemoryUpdateSchema>;
1923
1556
  /**
1924
1557
  * Schema for agent's decision output from the "think" step
1925
1558
  */
1926
1559
  declare const AgentDecisionSchema: z.ZodObject<{
1927
- /**
1928
- * Agent's internal reasoning
1929
- */
1930
1560
  reasoning: z.ZodString;
1931
- /**
1932
- * Status message for the user (e.g., "Searching for information...", "Processing results...")
1933
- */
1934
1561
  userMessage: z.ZodDefault<z.ZodString>;
1935
- /**
1936
- * Tool calls to execute (if any)
1937
- * Empty array signals task completion
1938
- */
1939
1562
  toolCalls: z.ZodDefault<z.ZodArray<z.ZodObject<{
1940
- /**
1941
- * Unique identifier for this tool call
1942
- */
1943
1563
  id: z.ZodString;
1944
- /**
1945
- * Name of the tool to invoke
1946
- */
1947
1564
  toolName: z.ZodString;
1948
- /**
1949
- * Arguments to pass to the tool
1950
- */
1951
1565
  arguments: z.ZodUnknown;
1952
- }, "strip", z.ZodTypeAny, {
1953
- id: string;
1954
- toolName: string;
1955
- arguments?: unknown;
1956
- }, {
1957
- id: string;
1958
- toolName: string;
1959
- arguments?: unknown;
1960
- }>, "many">>;
1961
- /**
1962
- * Memory keys to read during this iteration
1963
- */
1964
- memoryReads: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
1965
- /**
1966
- * Memory entries to write/update (key -> payload)
1967
- */
1566
+ }, z.core.$strip>>>;
1567
+ memoryReads: z.ZodDefault<z.ZodArray<z.ZodString>>;
1968
1568
  memoryUpdates: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
1969
- /**
1970
- * Value to store for this key
1971
- */
1972
1569
  value: z.ZodUnknown;
1973
- /**
1974
- * Optional description of the memory entry
1975
- */
1976
1570
  description: z.ZodOptional<z.ZodString>;
1977
- /**
1978
- * Optional metadata for the memory entry
1979
- */
1980
1571
  metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1981
- }, "strip", z.ZodTypeAny, {
1982
- value?: unknown;
1983
- metadata?: Record<string, unknown> | undefined;
1984
- description?: string | undefined;
1985
- }, {
1986
- value?: unknown;
1987
- metadata?: Record<string, unknown> | undefined;
1988
- description?: string | undefined;
1989
- }>>>;
1990
- /**
1991
- * Whether the task is complete and finalResult is available
1992
- * (single LLM call pattern)
1993
- */
1572
+ }, z.core.$strip>>>;
1994
1573
  isComplete: z.ZodDefault<z.ZodBoolean>;
1995
- /**
1996
- * The final result when isComplete=true
1997
- * Should match outputSchema if specified
1998
- */
1999
1574
  finalResult: z.ZodOptional<z.ZodUnknown>;
2000
- }, "strip", z.ZodTypeAny, {
2001
- toolCalls: {
2002
- id: string;
2003
- toolName: string;
2004
- arguments?: unknown;
2005
- }[];
2006
- reasoning: string;
2007
- memoryReads: string[];
2008
- memoryUpdates: Record<string, {
2009
- value?: unknown;
2010
- metadata?: Record<string, unknown> | undefined;
2011
- description?: string | undefined;
2012
- }>;
2013
- userMessage: string;
2014
- isComplete: boolean;
2015
- finalResult?: unknown;
2016
- }, {
2017
- reasoning: string;
2018
- toolCalls?: {
2019
- id: string;
2020
- toolName: string;
2021
- arguments?: unknown;
2022
- }[] | undefined;
2023
- memoryReads?: string[] | undefined;
2024
- memoryUpdates?: Record<string, {
2025
- value?: unknown;
2026
- metadata?: Record<string, unknown> | undefined;
2027
- description?: string | undefined;
2028
- }> | undefined;
2029
- userMessage?: string | undefined;
2030
- isComplete?: boolean | undefined;
2031
- finalResult?: unknown;
2032
- }>;
1575
+ }, z.core.$strip>;
2033
1576
  type AgentDecision = z.infer<typeof AgentDecisionSchema>;
2034
1577
  /**
2035
1578
  * Create an AgentDecision schema with typed finalResult field.
@@ -2046,253 +1589,75 @@ declare function createAgentDecisionWithOutputSchema<T>(outputSchema?: z.ZodType
2046
1589
  * Schema for tool execution result summary
2047
1590
  */
2048
1591
  declare const ToolExecutionSummarySchema: z.ZodObject<{
2049
- /**
2050
- * Tool name
2051
- */
2052
1592
  toolName: z.ZodString;
2053
- /**
2054
- * Whether execution succeeded
2055
- */
2056
1593
  success: z.ZodBoolean;
2057
- /**
2058
- * Output if successful
2059
- */
2060
1594
  output: z.ZodOptional<z.ZodUnknown>;
2061
- /**
2062
- * Error message if failed
2063
- */
2064
1595
  error: z.ZodOptional<z.ZodString>;
2065
- }, "strip", z.ZodTypeAny, {
2066
- toolName: string;
2067
- success: boolean;
2068
- output?: unknown;
2069
- error?: string | undefined;
2070
- }, {
2071
- toolName: string;
2072
- success: boolean;
2073
- output?: unknown;
2074
- error?: string | undefined;
2075
- }>;
1596
+ }, z.core.$strip>;
2076
1597
  type ToolExecutionSummary = z.infer<typeof ToolExecutionSummarySchema>;
2077
1598
 
2078
- declare const MCPConfigVariants: z.ZodDiscriminatedUnion<"transport", [z.ZodObject<{
1599
+ declare const MCPConfigVariants: z.ZodDiscriminatedUnion<[z.ZodObject<{
2079
1600
  name: z.ZodString;
2080
1601
  timeout: z.ZodDefault<z.ZodNumber>;
2081
1602
  metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2082
- } & {
2083
1603
  transport: z.ZodLiteral<"stdio">;
2084
1604
  command: z.ZodString;
2085
- args: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
1605
+ args: z.ZodDefault<z.ZodArray<z.ZodString>>;
2086
1606
  env: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
2087
1607
  cwd: z.ZodOptional<z.ZodString>;
2088
- stderr: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"inherit">, z.ZodLiteral<"pipe">, z.ZodLiteral<"ignore">]>>;
2089
- }, "strip", z.ZodTypeAny, {
2090
- metadata: Record<string, unknown>;
2091
- name: string;
2092
- timeout: number;
2093
- transport: "stdio";
2094
- command: string;
2095
- args: string[];
2096
- env: Record<string, string>;
2097
- cwd?: string | undefined;
2098
- stderr?: "inherit" | "pipe" | "ignore" | undefined;
2099
- }, {
2100
- name: string;
2101
- transport: "stdio";
2102
- command: string;
2103
- metadata?: Record<string, unknown> | undefined;
2104
- timeout?: number | undefined;
2105
- args?: string[] | undefined;
2106
- env?: Record<string, string> | undefined;
2107
- cwd?: string | undefined;
2108
- stderr?: "inherit" | "pipe" | "ignore" | undefined;
2109
- }>, z.ZodObject<{
1608
+ stderr: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"inherit">, z.ZodLiteral<"pipe">, z.ZodLiteral<"ignore">]>>;
1609
+ }, z.core.$strip>, z.ZodObject<{
2110
1610
  name: z.ZodString;
2111
1611
  timeout: z.ZodDefault<z.ZodNumber>;
2112
1612
  metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2113
- } & {
2114
1613
  transport: z.ZodLiteral<"http-sse">;
2115
1614
  url: z.ZodString;
2116
1615
  headers: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
2117
- method: z.ZodDefault<z.ZodEnum<["GET", "POST"]>>;
2118
- }, "strip", z.ZodTypeAny, {
2119
- metadata: Record<string, unknown>;
2120
- url: string;
2121
- name: string;
2122
- method: "GET" | "POST";
2123
- headers: Record<string, string>;
2124
- timeout: number;
2125
- transport: "http-sse";
2126
- }, {
2127
- url: string;
2128
- name: string;
2129
- transport: "http-sse";
2130
- metadata?: Record<string, unknown> | undefined;
2131
- method?: "GET" | "POST" | undefined;
2132
- headers?: Record<string, string> | undefined;
2133
- timeout?: number | undefined;
2134
- }>, z.ZodObject<{
1616
+ method: z.ZodDefault<z.ZodEnum<{
1617
+ GET: "GET";
1618
+ POST: "POST";
1619
+ }>>;
1620
+ }, z.core.$strip>, z.ZodObject<{
2135
1621
  name: z.ZodString;
2136
1622
  timeout: z.ZodDefault<z.ZodNumber>;
2137
1623
  metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2138
- } & {
2139
1624
  transport: z.ZodLiteral<"streamable-http">;
2140
1625
  url: z.ZodString;
2141
1626
  headers: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
2142
1627
  sessionId: z.ZodOptional<z.ZodString>;
2143
- }, "strip", z.ZodTypeAny, {
2144
- metadata: Record<string, unknown>;
2145
- url: string;
2146
- name: string;
2147
- headers: Record<string, string>;
2148
- timeout: number;
2149
- transport: "streamable-http";
2150
- sessionId?: string | undefined;
2151
- }, {
2152
- url: string;
2153
- name: string;
2154
- transport: "streamable-http";
2155
- metadata?: Record<string, unknown> | undefined;
2156
- headers?: Record<string, string> | undefined;
2157
- timeout?: number | undefined;
2158
- sessionId?: string | undefined;
2159
- }>]>;
1628
+ }, z.core.$strip>], "transport">;
2160
1629
  type MCPServerConfig = z.output<typeof MCPConfigVariants>;
2161
1630
  type MCPServerConfigInput = z.input<typeof MCPConfigVariants>;
2162
- declare const MCPServerConfigSchema: z.ZodEffects<z.ZodDiscriminatedUnion<"transport", [z.ZodObject<{
1631
+ declare const MCPServerConfigSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
2163
1632
  name: z.ZodString;
2164
1633
  timeout: z.ZodDefault<z.ZodNumber>;
2165
1634
  metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2166
- } & {
2167
1635
  transport: z.ZodLiteral<"stdio">;
2168
1636
  command: z.ZodString;
2169
- args: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
1637
+ args: z.ZodDefault<z.ZodArray<z.ZodString>>;
2170
1638
  env: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
2171
1639
  cwd: z.ZodOptional<z.ZodString>;
2172
- stderr: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"inherit">, z.ZodLiteral<"pipe">, z.ZodLiteral<"ignore">]>>;
2173
- }, "strip", z.ZodTypeAny, {
2174
- metadata: Record<string, unknown>;
2175
- name: string;
2176
- timeout: number;
2177
- transport: "stdio";
2178
- command: string;
2179
- args: string[];
2180
- env: Record<string, string>;
2181
- cwd?: string | undefined;
2182
- stderr?: "inherit" | "pipe" | "ignore" | undefined;
2183
- }, {
2184
- name: string;
2185
- transport: "stdio";
2186
- command: string;
2187
- metadata?: Record<string, unknown> | undefined;
2188
- timeout?: number | undefined;
2189
- args?: string[] | undefined;
2190
- env?: Record<string, string> | undefined;
2191
- cwd?: string | undefined;
2192
- stderr?: "inherit" | "pipe" | "ignore" | undefined;
2193
- }>, z.ZodObject<{
1640
+ stderr: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"inherit">, z.ZodLiteral<"pipe">, z.ZodLiteral<"ignore">]>>;
1641
+ }, z.core.$strip>, z.ZodObject<{
2194
1642
  name: z.ZodString;
2195
1643
  timeout: z.ZodDefault<z.ZodNumber>;
2196
1644
  metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2197
- } & {
2198
1645
  transport: z.ZodLiteral<"http-sse">;
2199
1646
  url: z.ZodString;
2200
1647
  headers: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
2201
- method: z.ZodDefault<z.ZodEnum<["GET", "POST"]>>;
2202
- }, "strip", z.ZodTypeAny, {
2203
- metadata: Record<string, unknown>;
2204
- url: string;
2205
- name: string;
2206
- method: "GET" | "POST";
2207
- headers: Record<string, string>;
2208
- timeout: number;
2209
- transport: "http-sse";
2210
- }, {
2211
- url: string;
2212
- name: string;
2213
- transport: "http-sse";
2214
- metadata?: Record<string, unknown> | undefined;
2215
- method?: "GET" | "POST" | undefined;
2216
- headers?: Record<string, string> | undefined;
2217
- timeout?: number | undefined;
2218
- }>, z.ZodObject<{
1648
+ method: z.ZodDefault<z.ZodEnum<{
1649
+ GET: "GET";
1650
+ POST: "POST";
1651
+ }>>;
1652
+ }, z.core.$strip>, z.ZodObject<{
2219
1653
  name: z.ZodString;
2220
1654
  timeout: z.ZodDefault<z.ZodNumber>;
2221
1655
  metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2222
- } & {
2223
1656
  transport: z.ZodLiteral<"streamable-http">;
2224
1657
  url: z.ZodString;
2225
1658
  headers: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
2226
1659
  sessionId: z.ZodOptional<z.ZodString>;
2227
- }, "strip", z.ZodTypeAny, {
2228
- metadata: Record<string, unknown>;
2229
- url: string;
2230
- name: string;
2231
- headers: Record<string, string>;
2232
- timeout: number;
2233
- transport: "streamable-http";
2234
- sessionId?: string | undefined;
2235
- }, {
2236
- url: string;
2237
- name: string;
2238
- transport: "streamable-http";
2239
- metadata?: Record<string, unknown> | undefined;
2240
- headers?: Record<string, string> | undefined;
2241
- timeout?: number | undefined;
2242
- sessionId?: string | undefined;
2243
- }>]>, {
2244
- metadata: Record<string, unknown>;
2245
- name: string;
2246
- timeout: number;
2247
- transport: "stdio";
2248
- command: string;
2249
- args: string[];
2250
- env: Record<string, string>;
2251
- cwd?: string | undefined;
2252
- stderr?: "inherit" | "pipe" | "ignore" | undefined;
2253
- } | {
2254
- metadata: Record<string, unknown>;
2255
- url: string;
2256
- name: string;
2257
- method: "GET" | "POST";
2258
- headers: Record<string, string>;
2259
- timeout: number;
2260
- transport: "http-sse";
2261
- } | {
2262
- metadata: Record<string, unknown>;
2263
- url: string;
2264
- name: string;
2265
- headers: Record<string, string>;
2266
- timeout: number;
2267
- transport: "streamable-http";
2268
- sessionId?: string | undefined;
2269
- }, {
2270
- name: string;
2271
- transport: "stdio";
2272
- command: string;
2273
- metadata?: Record<string, unknown> | undefined;
2274
- timeout?: number | undefined;
2275
- args?: string[] | undefined;
2276
- env?: Record<string, string> | undefined;
2277
- cwd?: string | undefined;
2278
- stderr?: "inherit" | "pipe" | "ignore" | undefined;
2279
- } | {
2280
- url: string;
2281
- name: string;
2282
- transport: "http-sse";
2283
- metadata?: Record<string, unknown> | undefined;
2284
- method?: "GET" | "POST" | undefined;
2285
- headers?: Record<string, string> | undefined;
2286
- timeout?: number | undefined;
2287
- } | {
2288
- url: string;
2289
- name: string;
2290
- transport: "streamable-http";
2291
- metadata?: Record<string, unknown> | undefined;
2292
- headers?: Record<string, string> | undefined;
2293
- timeout?: number | undefined;
2294
- sessionId?: string | undefined;
2295
- }>;
1660
+ }, z.core.$strip>], "transport">;
2296
1661
  declare const MCPconfig: (config: MCPServerConfigInput) => MCPServerConfig;
2297
1662
  declare const createMCPServerConfig: (config: MCPServerConfigInput) => MCPServerConfig;
2298
1663