@opperai/agents 0.6.0 → 0.7.1

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;
@@ -561,6 +270,15 @@ interface IterationSummary {
561
270
  }>;
562
271
  results: unknown[];
563
272
  }
273
+ interface PendingSpanUpdate {
274
+ spanId: string;
275
+ output?: unknown;
276
+ error?: string;
277
+ startTime?: Date;
278
+ endTime?: Date;
279
+ meta?: Record<string, unknown>;
280
+ name?: string;
281
+ }
564
282
  declare class AgentContext {
565
283
  readonly agentName: string;
566
284
  readonly sessionId: string;
@@ -573,6 +291,7 @@ declare class AgentContext {
573
291
  metadata: Record<string, unknown>;
574
292
  readonly startedAt: number;
575
293
  updatedAt: number;
294
+ pendingSpanUpdates: PendingSpanUpdate[];
576
295
  constructor(options: AgentContextOptions);
577
296
  updateUsage(delta: Usage): void;
578
297
  /**
@@ -1075,15 +794,7 @@ declare const MemoryEntryMetadataSchema: z.ZodObject<{
1075
794
  createdAt: z.ZodNumber;
1076
795
  updatedAt: z.ZodNumber;
1077
796
  accessCount: z.ZodDefault<z.ZodNumber>;
1078
- }, "strip", z.ZodTypeAny, {
1079
- createdAt: number;
1080
- updatedAt: number;
1081
- accessCount: number;
1082
- }, {
1083
- createdAt: number;
1084
- updatedAt: number;
1085
- accessCount?: number | undefined;
1086
- }>;
797
+ }, z.core.$strip>;
1087
798
  type MemoryEntryMetadata = z.infer<typeof MemoryEntryMetadataSchema>;
1088
799
  /**
1089
800
  * Schema for a single memory entry
@@ -1096,34 +807,8 @@ declare const MemoryEntrySchema: z.ZodObject<{
1096
807
  createdAt: z.ZodNumber;
1097
808
  updatedAt: z.ZodNumber;
1098
809
  accessCount: z.ZodDefault<z.ZodNumber>;
1099
- }, "strip", z.ZodTypeAny, {
1100
- createdAt: number;
1101
- updatedAt: number;
1102
- accessCount: number;
1103
- }, {
1104
- createdAt: number;
1105
- updatedAt: number;
1106
- accessCount?: number | undefined;
1107
- }>;
1108
- }, "strip", z.ZodTypeAny, {
1109
- metadata: {
1110
- createdAt: number;
1111
- updatedAt: number;
1112
- accessCount: number;
1113
- };
1114
- key: string;
1115
- description: string;
1116
- value?: unknown;
1117
- }, {
1118
- metadata: {
1119
- createdAt: number;
1120
- updatedAt: number;
1121
- accessCount?: number | undefined;
1122
- };
1123
- key: string;
1124
- description: string;
1125
- value?: unknown;
1126
- }>;
810
+ }, z.core.$strip>;
811
+ }, z.core.$strip>;
1127
812
  type MemoryEntry = z.infer<typeof MemoryEntrySchema>;
1128
813
  /**
1129
814
  * Catalog entry (summary without value) for LLM consumption
@@ -1786,6 +1471,8 @@ declare class Agent<TInput = unknown, TOutput = unknown> extends BaseAgent<TInpu
1786
1471
  * Serialize input for passing to LLM or spans
1787
1472
  */
1788
1473
  private serializeInput;
1474
+ private queueSpanUpdate;
1475
+ private flushPendingSpanUpdates;
1789
1476
  /**
1790
1477
  * Main agent loop: think → tool execution → memory handling → repeat until complete
1791
1478
  */
@@ -1828,196 +1515,50 @@ declare class Agent<TInput = unknown, TOutput = unknown> extends BaseAgent<TInpu
1828
1515
  * Schema for agent's internal thought/reasoning
1829
1516
  */
1830
1517
  declare const ThoughtSchema: z.ZodObject<{
1831
- /**
1832
- * The reasoning or internal monologue of the agent
1833
- */
1834
1518
  reasoning: z.ZodString;
1835
- /**
1836
- * Planned next action(s)
1837
- */
1838
1519
  plan: z.ZodOptional<z.ZodString>;
1839
- /**
1840
- * Confidence level (0-1)
1841
- */
1842
1520
  confidence: z.ZodOptional<z.ZodNumber>;
1843
- /**
1844
- * Additional metadata (key-value pairs)
1845
- */
1846
1521
  metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1847
- }, "strip", z.ZodTypeAny, {
1848
- reasoning: string;
1849
- metadata?: Record<string, unknown> | undefined;
1850
- plan?: string | undefined;
1851
- confidence?: number | undefined;
1852
- }, {
1853
- reasoning: string;
1854
- metadata?: Record<string, unknown> | undefined;
1855
- plan?: string | undefined;
1856
- confidence?: number | undefined;
1857
- }>;
1522
+ }, z.core.$strip>;
1858
1523
  type Thought = z.infer<typeof ThoughtSchema>;
1859
1524
  /**
1860
1525
  * Schema for a tool call from the LLM
1861
1526
  */
1862
1527
  declare const ToolCallSchema: z.ZodObject<{
1863
- /**
1864
- * Unique identifier for this tool call
1865
- */
1866
1528
  id: z.ZodString;
1867
- /**
1868
- * Name of the tool to invoke
1869
- */
1870
1529
  toolName: z.ZodString;
1871
- /**
1872
- * Arguments to pass to the tool
1873
- */
1874
1530
  arguments: z.ZodUnknown;
1875
- }, "strip", z.ZodTypeAny, {
1876
- id: string;
1877
- toolName: string;
1878
- arguments?: unknown;
1879
- }, {
1880
- id: string;
1881
- toolName: string;
1882
- arguments?: unknown;
1883
- }>;
1531
+ }, z.core.$strip>;
1884
1532
  type ToolCall = z.infer<typeof ToolCallSchema>;
1885
1533
  /**
1886
1534
  * Schema for memory updates (write operations)
1887
1535
  */
1888
1536
  declare const MemoryUpdateSchema: z.ZodObject<{
1889
- /**
1890
- * Value to store for this key
1891
- */
1892
1537
  value: z.ZodUnknown;
1893
- /**
1894
- * Optional description of the memory entry
1895
- */
1896
1538
  description: z.ZodOptional<z.ZodString>;
1897
- /**
1898
- * Optional metadata for the memory entry
1899
- */
1900
1539
  metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1901
- }, "strip", z.ZodTypeAny, {
1902
- value?: unknown;
1903
- metadata?: Record<string, unknown> | undefined;
1904
- description?: string | undefined;
1905
- }, {
1906
- value?: unknown;
1907
- metadata?: Record<string, unknown> | undefined;
1908
- description?: string | undefined;
1909
- }>;
1540
+ }, z.core.$strip>;
1910
1541
  type MemoryUpdate = z.infer<typeof MemoryUpdateSchema>;
1911
1542
  /**
1912
1543
  * Schema for agent's decision output from the "think" step
1913
1544
  */
1914
1545
  declare const AgentDecisionSchema: z.ZodObject<{
1915
- /**
1916
- * Agent's internal reasoning
1917
- */
1918
1546
  reasoning: z.ZodString;
1919
- /**
1920
- * Status message for the user (e.g., "Searching for information...", "Processing results...")
1921
- */
1922
1547
  userMessage: z.ZodDefault<z.ZodString>;
1923
- /**
1924
- * Tool calls to execute (if any)
1925
- * Empty array signals task completion
1926
- */
1927
1548
  toolCalls: z.ZodDefault<z.ZodArray<z.ZodObject<{
1928
- /**
1929
- * Unique identifier for this tool call
1930
- */
1931
1549
  id: z.ZodString;
1932
- /**
1933
- * Name of the tool to invoke
1934
- */
1935
1550
  toolName: z.ZodString;
1936
- /**
1937
- * Arguments to pass to the tool
1938
- */
1939
1551
  arguments: z.ZodUnknown;
1940
- }, "strip", z.ZodTypeAny, {
1941
- id: string;
1942
- toolName: string;
1943
- arguments?: unknown;
1944
- }, {
1945
- id: string;
1946
- toolName: string;
1947
- arguments?: unknown;
1948
- }>, "many">>;
1949
- /**
1950
- * Memory keys to read during this iteration
1951
- */
1952
- memoryReads: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
1953
- /**
1954
- * Memory entries to write/update (key -> payload)
1955
- */
1552
+ }, z.core.$strip>>>;
1553
+ memoryReads: z.ZodDefault<z.ZodArray<z.ZodString>>;
1956
1554
  memoryUpdates: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
1957
- /**
1958
- * Value to store for this key
1959
- */
1960
1555
  value: z.ZodUnknown;
1961
- /**
1962
- * Optional description of the memory entry
1963
- */
1964
1556
  description: z.ZodOptional<z.ZodString>;
1965
- /**
1966
- * Optional metadata for the memory entry
1967
- */
1968
1557
  metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1969
- }, "strip", z.ZodTypeAny, {
1970
- value?: unknown;
1971
- metadata?: Record<string, unknown> | undefined;
1972
- description?: string | undefined;
1973
- }, {
1974
- value?: unknown;
1975
- metadata?: Record<string, unknown> | undefined;
1976
- description?: string | undefined;
1977
- }>>>;
1978
- /**
1979
- * Whether the task is complete and finalResult is available
1980
- * (single LLM call pattern)
1981
- */
1558
+ }, z.core.$strip>>>;
1982
1559
  isComplete: z.ZodDefault<z.ZodBoolean>;
1983
- /**
1984
- * The final result when isComplete=true
1985
- * Should match outputSchema if specified
1986
- */
1987
1560
  finalResult: z.ZodOptional<z.ZodUnknown>;
1988
- }, "strip", z.ZodTypeAny, {
1989
- toolCalls: {
1990
- id: string;
1991
- toolName: string;
1992
- arguments?: unknown;
1993
- }[];
1994
- reasoning: string;
1995
- memoryReads: string[];
1996
- memoryUpdates: Record<string, {
1997
- value?: unknown;
1998
- metadata?: Record<string, unknown> | undefined;
1999
- description?: string | undefined;
2000
- }>;
2001
- userMessage: string;
2002
- isComplete: boolean;
2003
- finalResult?: unknown;
2004
- }, {
2005
- reasoning: string;
2006
- toolCalls?: {
2007
- id: string;
2008
- toolName: string;
2009
- arguments?: unknown;
2010
- }[] | undefined;
2011
- memoryReads?: string[] | undefined;
2012
- memoryUpdates?: Record<string, {
2013
- value?: unknown;
2014
- metadata?: Record<string, unknown> | undefined;
2015
- description?: string | undefined;
2016
- }> | undefined;
2017
- userMessage?: string | undefined;
2018
- isComplete?: boolean | undefined;
2019
- finalResult?: unknown;
2020
- }>;
1561
+ }, z.core.$strip>;
2021
1562
  type AgentDecision = z.infer<typeof AgentDecisionSchema>;
2022
1563
  /**
2023
1564
  * Create an AgentDecision schema with typed finalResult field.
@@ -2034,253 +1575,75 @@ declare function createAgentDecisionWithOutputSchema<T>(outputSchema?: z.ZodType
2034
1575
  * Schema for tool execution result summary
2035
1576
  */
2036
1577
  declare const ToolExecutionSummarySchema: z.ZodObject<{
2037
- /**
2038
- * Tool name
2039
- */
2040
1578
  toolName: z.ZodString;
2041
- /**
2042
- * Whether execution succeeded
2043
- */
2044
1579
  success: z.ZodBoolean;
2045
- /**
2046
- * Output if successful
2047
- */
2048
1580
  output: z.ZodOptional<z.ZodUnknown>;
2049
- /**
2050
- * Error message if failed
2051
- */
2052
1581
  error: z.ZodOptional<z.ZodString>;
2053
- }, "strip", z.ZodTypeAny, {
2054
- toolName: string;
2055
- success: boolean;
2056
- output?: unknown;
2057
- error?: string | undefined;
2058
- }, {
2059
- toolName: string;
2060
- success: boolean;
2061
- output?: unknown;
2062
- error?: string | undefined;
2063
- }>;
1582
+ }, z.core.$strip>;
2064
1583
  type ToolExecutionSummary = z.infer<typeof ToolExecutionSummarySchema>;
2065
1584
 
2066
- declare const MCPConfigVariants: z.ZodDiscriminatedUnion<"transport", [z.ZodObject<{
1585
+ declare const MCPConfigVariants: z.ZodDiscriminatedUnion<[z.ZodObject<{
2067
1586
  name: z.ZodString;
2068
1587
  timeout: z.ZodDefault<z.ZodNumber>;
2069
1588
  metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2070
- } & {
2071
1589
  transport: z.ZodLiteral<"stdio">;
2072
1590
  command: z.ZodString;
2073
- args: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
1591
+ args: z.ZodDefault<z.ZodArray<z.ZodString>>;
2074
1592
  env: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
2075
1593
  cwd: z.ZodOptional<z.ZodString>;
2076
- stderr: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"inherit">, z.ZodLiteral<"pipe">, z.ZodLiteral<"ignore">]>>;
2077
- }, "strip", z.ZodTypeAny, {
2078
- metadata: Record<string, unknown>;
2079
- name: string;
2080
- timeout: number;
2081
- transport: "stdio";
2082
- command: string;
2083
- args: string[];
2084
- env: Record<string, string>;
2085
- cwd?: string | undefined;
2086
- stderr?: "inherit" | "pipe" | "ignore" | undefined;
2087
- }, {
2088
- name: string;
2089
- transport: "stdio";
2090
- command: string;
2091
- metadata?: Record<string, unknown> | undefined;
2092
- timeout?: number | undefined;
2093
- args?: string[] | undefined;
2094
- env?: Record<string, string> | undefined;
2095
- cwd?: string | undefined;
2096
- stderr?: "inherit" | "pipe" | "ignore" | undefined;
2097
- }>, z.ZodObject<{
1594
+ stderr: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"inherit">, z.ZodLiteral<"pipe">, z.ZodLiteral<"ignore">]>>;
1595
+ }, z.core.$strip>, z.ZodObject<{
2098
1596
  name: z.ZodString;
2099
1597
  timeout: z.ZodDefault<z.ZodNumber>;
2100
1598
  metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2101
- } & {
2102
1599
  transport: z.ZodLiteral<"http-sse">;
2103
1600
  url: z.ZodString;
2104
1601
  headers: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
2105
- method: z.ZodDefault<z.ZodEnum<["GET", "POST"]>>;
2106
- }, "strip", z.ZodTypeAny, {
2107
- metadata: Record<string, unknown>;
2108
- url: string;
2109
- name: string;
2110
- method: "GET" | "POST";
2111
- headers: Record<string, string>;
2112
- timeout: number;
2113
- transport: "http-sse";
2114
- }, {
2115
- url: string;
2116
- name: string;
2117
- transport: "http-sse";
2118
- metadata?: Record<string, unknown> | undefined;
2119
- method?: "GET" | "POST" | undefined;
2120
- headers?: Record<string, string> | undefined;
2121
- timeout?: number | undefined;
2122
- }>, z.ZodObject<{
1602
+ method: z.ZodDefault<z.ZodEnum<{
1603
+ GET: "GET";
1604
+ POST: "POST";
1605
+ }>>;
1606
+ }, z.core.$strip>, z.ZodObject<{
2123
1607
  name: z.ZodString;
2124
1608
  timeout: z.ZodDefault<z.ZodNumber>;
2125
1609
  metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2126
- } & {
2127
1610
  transport: z.ZodLiteral<"streamable-http">;
2128
1611
  url: z.ZodString;
2129
1612
  headers: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
2130
1613
  sessionId: z.ZodOptional<z.ZodString>;
2131
- }, "strip", z.ZodTypeAny, {
2132
- metadata: Record<string, unknown>;
2133
- url: string;
2134
- name: string;
2135
- headers: Record<string, string>;
2136
- timeout: number;
2137
- transport: "streamable-http";
2138
- sessionId?: string | undefined;
2139
- }, {
2140
- url: string;
2141
- name: string;
2142
- transport: "streamable-http";
2143
- metadata?: Record<string, unknown> | undefined;
2144
- headers?: Record<string, string> | undefined;
2145
- timeout?: number | undefined;
2146
- sessionId?: string | undefined;
2147
- }>]>;
1614
+ }, z.core.$strip>], "transport">;
2148
1615
  type MCPServerConfig = z.output<typeof MCPConfigVariants>;
2149
1616
  type MCPServerConfigInput = z.input<typeof MCPConfigVariants>;
2150
- declare const MCPServerConfigSchema: z.ZodEffects<z.ZodDiscriminatedUnion<"transport", [z.ZodObject<{
1617
+ declare const MCPServerConfigSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
2151
1618
  name: z.ZodString;
2152
1619
  timeout: z.ZodDefault<z.ZodNumber>;
2153
1620
  metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2154
- } & {
2155
1621
  transport: z.ZodLiteral<"stdio">;
2156
1622
  command: z.ZodString;
2157
- args: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
1623
+ args: z.ZodDefault<z.ZodArray<z.ZodString>>;
2158
1624
  env: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
2159
1625
  cwd: z.ZodOptional<z.ZodString>;
2160
- stderr: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"inherit">, z.ZodLiteral<"pipe">, z.ZodLiteral<"ignore">]>>;
2161
- }, "strip", z.ZodTypeAny, {
2162
- metadata: Record<string, unknown>;
2163
- name: string;
2164
- timeout: number;
2165
- transport: "stdio";
2166
- command: string;
2167
- args: string[];
2168
- env: Record<string, string>;
2169
- cwd?: string | undefined;
2170
- stderr?: "inherit" | "pipe" | "ignore" | undefined;
2171
- }, {
2172
- name: string;
2173
- transport: "stdio";
2174
- command: string;
2175
- metadata?: Record<string, unknown> | undefined;
2176
- timeout?: number | undefined;
2177
- args?: string[] | undefined;
2178
- env?: Record<string, string> | undefined;
2179
- cwd?: string | undefined;
2180
- stderr?: "inherit" | "pipe" | "ignore" | undefined;
2181
- }>, z.ZodObject<{
1626
+ stderr: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"inherit">, z.ZodLiteral<"pipe">, z.ZodLiteral<"ignore">]>>;
1627
+ }, z.core.$strip>, z.ZodObject<{
2182
1628
  name: z.ZodString;
2183
1629
  timeout: z.ZodDefault<z.ZodNumber>;
2184
1630
  metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2185
- } & {
2186
1631
  transport: z.ZodLiteral<"http-sse">;
2187
1632
  url: z.ZodString;
2188
1633
  headers: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
2189
- method: z.ZodDefault<z.ZodEnum<["GET", "POST"]>>;
2190
- }, "strip", z.ZodTypeAny, {
2191
- metadata: Record<string, unknown>;
2192
- url: string;
2193
- name: string;
2194
- method: "GET" | "POST";
2195
- headers: Record<string, string>;
2196
- timeout: number;
2197
- transport: "http-sse";
2198
- }, {
2199
- url: string;
2200
- name: string;
2201
- transport: "http-sse";
2202
- metadata?: Record<string, unknown> | undefined;
2203
- method?: "GET" | "POST" | undefined;
2204
- headers?: Record<string, string> | undefined;
2205
- timeout?: number | undefined;
2206
- }>, z.ZodObject<{
1634
+ method: z.ZodDefault<z.ZodEnum<{
1635
+ GET: "GET";
1636
+ POST: "POST";
1637
+ }>>;
1638
+ }, z.core.$strip>, z.ZodObject<{
2207
1639
  name: z.ZodString;
2208
1640
  timeout: z.ZodDefault<z.ZodNumber>;
2209
1641
  metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2210
- } & {
2211
1642
  transport: z.ZodLiteral<"streamable-http">;
2212
1643
  url: z.ZodString;
2213
1644
  headers: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
2214
1645
  sessionId: z.ZodOptional<z.ZodString>;
2215
- }, "strip", z.ZodTypeAny, {
2216
- metadata: Record<string, unknown>;
2217
- url: string;
2218
- name: string;
2219
- headers: Record<string, string>;
2220
- timeout: number;
2221
- transport: "streamable-http";
2222
- sessionId?: string | undefined;
2223
- }, {
2224
- url: string;
2225
- name: string;
2226
- transport: "streamable-http";
2227
- metadata?: Record<string, unknown> | undefined;
2228
- headers?: Record<string, string> | undefined;
2229
- timeout?: number | undefined;
2230
- sessionId?: string | undefined;
2231
- }>]>, {
2232
- metadata: Record<string, unknown>;
2233
- name: string;
2234
- timeout: number;
2235
- transport: "stdio";
2236
- command: string;
2237
- args: string[];
2238
- env: Record<string, string>;
2239
- cwd?: string | undefined;
2240
- stderr?: "inherit" | "pipe" | "ignore" | undefined;
2241
- } | {
2242
- metadata: Record<string, unknown>;
2243
- url: string;
2244
- name: string;
2245
- method: "GET" | "POST";
2246
- headers: Record<string, string>;
2247
- timeout: number;
2248
- transport: "http-sse";
2249
- } | {
2250
- metadata: Record<string, unknown>;
2251
- url: string;
2252
- name: string;
2253
- headers: Record<string, string>;
2254
- timeout: number;
2255
- transport: "streamable-http";
2256
- sessionId?: string | undefined;
2257
- }, {
2258
- name: string;
2259
- transport: "stdio";
2260
- command: string;
2261
- metadata?: Record<string, unknown> | undefined;
2262
- timeout?: number | undefined;
2263
- args?: string[] | undefined;
2264
- env?: Record<string, string> | undefined;
2265
- cwd?: string | undefined;
2266
- stderr?: "inherit" | "pipe" | "ignore" | undefined;
2267
- } | {
2268
- url: string;
2269
- name: string;
2270
- transport: "http-sse";
2271
- metadata?: Record<string, unknown> | undefined;
2272
- method?: "GET" | "POST" | undefined;
2273
- headers?: Record<string, string> | undefined;
2274
- timeout?: number | undefined;
2275
- } | {
2276
- url: string;
2277
- name: string;
2278
- transport: "streamable-http";
2279
- metadata?: Record<string, unknown> | undefined;
2280
- headers?: Record<string, string> | undefined;
2281
- timeout?: number | undefined;
2282
- sessionId?: string | undefined;
2283
- }>;
1646
+ }, z.core.$strip>], "transport">;
2284
1647
  declare const MCPconfig: (config: MCPServerConfigInput) => MCPServerConfig;
2285
1648
  declare const createMCPServerConfig: (config: MCPServerConfigInput) => MCPServerConfig;
2286
1649
 
@@ -2587,4 +1950,4 @@ declare class ToolRunner {
2587
1950
  };
2588
1951
  }
2589
1952
 
2590
- export { type AfterToolPayload, Agent, type AgentConfig, AgentContext, type AgentContextOptions, type AgentContextSnapshot, type AgentDecision, AgentDecisionSchema, type AgentEndPayload, type AgentEventListener, type AgentEventName, type AgentEventPayload, type AgentEventPayloadMap, AgentEvents, type AgentLogger, type AgentStartPayload, type AgentThought, BaseAgent, type BaseAgentConfig, type BaseUsage, BaseUsageSchema, type BeforeToolPayload, ConsoleLogger, type CreateSpanOptions, DEFAULT_MODEL, DEFAULT_RETRY_CONFIG, type ExecutionCycle, ExecutionCycleSchema, type ExecutionThought, type Failure, type HookEventName, HookEvents, type HookHandler, HookManager, type HookPayload, type HookPayloadMap, type HookRegistration, InMemoryStore, type IterationSummary, type JsonSchemaOptions, type LlmCallPayload, type LlmCallType, type LlmResponsePayload, LogLevel, type LoopEndPayload, type LoopStartPayload, MCPClient, type MCPClientOptions, type MCPServerConfig, type MCPServerConfigInput, MCPServerConfigSchema, type MCPTool, MCPToolProvider, type MCPToolProviderOptions, MCPconfig, type MaybePromise, type Memory, type MemoryCatalogEntry, type MemoryEntry, type MemoryEntryMetadata, MemoryEntryMetadataSchema, MemoryEntrySchema, type MemoryErrorPayload, type MemoryReadPayload, type MemoryUpdate, MemoryUpdateSchema, type MemoryWritePayload, type OpperCallOptions, type OpperCallResponse, OpperClient, type OpperClientConfig, type OpperSpan, type OpperStreamChunk, type OpperStreamEvent, type OpperStreamResponse, Result, type RetryConfig, STREAM_ROOT_PATH, type Schema, SchemaValidationError, type SchemaValidationOptions, SilentLogger, StreamAssembler, type StreamAssemblerOptions, type StreamChunkPayload, type StreamEndPayload, type StreamErrorPayload, type StreamFeedResult, type StreamFinalizeResult, type StreamStartPayload, type Success, type ThinkEndPayload, type Thought, ThoughtSchema, type Tool, type ToolCall, type ToolCallRecord, ToolCallRecordSchema, ToolCallSchema, type ToolDefinition, type ToolErrorPayload, type ToolExample, type ToolExecutionContext, type ToolExecutionSummary, ToolExecutionSummarySchema, type ToolFailure, type ToolFunction, ToolMetadataSchema, type ToolOptions, type ToolProvider, type ToolResult, type ToolResultData, ToolResultFactory, ToolResultFailureSchema, type ToolResultInit, ToolResultSchema, ToolResultSuccessSchema, type ToolRunOptions, ToolRunner, type ToolSuccess, type UnregisterHook, type Usage, UsageSchema, type VisualizationOptions, addUsage, coerceToolDefinition, createAgentDecisionWithOutputSchema, createEmptyUsage, createFunctionTool, createHookManager, createInMemoryStore, createMCPServerConfig, createOpperClient, createStreamAssembler, createToolCallRecord, err, extractTools, generateAgentFlowDiagram, getDefaultLogger, getSchemaDefault, isSchemaValid, isToolProvider, mcp, mergeSchemaDefaults, normalizeToolEntries, ok, schemaToJson, setDefaultLogger, tool, validateSchema, validateToolInput, zodSchemaToJsonSchema };
1953
+ export { type AfterToolPayload, Agent, type AgentConfig, AgentContext, type AgentContextOptions, type AgentContextSnapshot, type AgentDecision, AgentDecisionSchema, type AgentEndPayload, type AgentEventListener, type AgentEventName, type AgentEventPayload, type AgentEventPayloadMap, AgentEvents, type AgentLogger, type AgentStartPayload, type AgentThought, BaseAgent, type BaseAgentConfig, type BaseUsage, BaseUsageSchema, type BeforeToolPayload, ConsoleLogger, type CreateSpanOptions, DEFAULT_MODEL, DEFAULT_RETRY_CONFIG, type ExecutionCycle, ExecutionCycleSchema, type ExecutionThought, type Failure, type HookEventName, HookEvents, type HookHandler, HookManager, type HookPayload, type HookPayloadMap, type HookRegistration, InMemoryStore, type IterationSummary, type JsonSchemaOptions, type LlmCallPayload, type LlmCallType, type LlmResponsePayload, LogLevel, type LoopEndPayload, type LoopStartPayload, MCPClient, type MCPClientOptions, type MCPServerConfig, type MCPServerConfigInput, MCPServerConfigSchema, type MCPTool, MCPToolProvider, type MCPToolProviderOptions, MCPconfig, type MaybePromise, type Memory, type MemoryCatalogEntry, type MemoryEntry, type MemoryEntryMetadata, MemoryEntryMetadataSchema, MemoryEntrySchema, type MemoryErrorPayload, type MemoryReadPayload, type MemoryUpdate, MemoryUpdateSchema, type MemoryWritePayload, type OpperCallOptions, type OpperCallResponse, OpperClient, type OpperClientConfig, type OpperSpan, type OpperStreamChunk, type OpperStreamEvent, type OpperStreamResponse, type PendingSpanUpdate, Result, type RetryConfig, STREAM_ROOT_PATH, type Schema, SchemaValidationError, type SchemaValidationOptions, SilentLogger, StreamAssembler, type StreamAssemblerOptions, type StreamChunkPayload, type StreamEndPayload, type StreamErrorPayload, type StreamFeedResult, type StreamFinalizeResult, type StreamStartPayload, type Success, type ThinkEndPayload, type Thought, ThoughtSchema, type Tool, type ToolCall, type ToolCallRecord, ToolCallRecordSchema, ToolCallSchema, type ToolDefinition, type ToolErrorPayload, type ToolExample, type ToolExecutionContext, type ToolExecutionSummary, ToolExecutionSummarySchema, type ToolFailure, type ToolFunction, ToolMetadataSchema, type ToolOptions, type ToolProvider, type ToolResult, type ToolResultData, ToolResultFactory, ToolResultFailureSchema, type ToolResultInit, ToolResultSchema, ToolResultSuccessSchema, type ToolRunOptions, ToolRunner, type ToolSuccess, type UnregisterHook, type Usage, UsageSchema, type VisualizationOptions, addUsage, coerceToolDefinition, createAgentDecisionWithOutputSchema, createEmptyUsage, createFunctionTool, createHookManager, createInMemoryStore, createMCPServerConfig, createOpperClient, createStreamAssembler, createToolCallRecord, err, extractTools, generateAgentFlowDiagram, getDefaultLogger, getSchemaDefault, isSchemaValid, isToolProvider, mcp, mergeSchemaDefaults, normalizeToolEntries, ok, schemaToJson, setDefaultLogger, tool, validateSchema, validateToolInput, zodSchemaToJsonSchema };