@wundr.io/langgraph-orchestrator 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/README.md +842 -0
  2. package/dist/checkpointing.d.ts +265 -0
  3. package/dist/checkpointing.d.ts.map +1 -0
  4. package/dist/checkpointing.js +577 -0
  5. package/dist/checkpointing.js.map +1 -0
  6. package/dist/edges/conditional-edge.d.ts +230 -0
  7. package/dist/edges/conditional-edge.d.ts.map +1 -0
  8. package/dist/edges/conditional-edge.js +439 -0
  9. package/dist/edges/conditional-edge.js.map +1 -0
  10. package/dist/edges/loop-edge.d.ts +290 -0
  11. package/dist/edges/loop-edge.d.ts.map +1 -0
  12. package/dist/edges/loop-edge.js +503 -0
  13. package/dist/edges/loop-edge.js.map +1 -0
  14. package/dist/index.d.ts +125 -0
  15. package/dist/index.d.ts.map +1 -0
  16. package/dist/index.js +269 -0
  17. package/dist/index.js.map +1 -0
  18. package/dist/nodes/decision-node.d.ts +276 -0
  19. package/dist/nodes/decision-node.d.ts.map +1 -0
  20. package/dist/nodes/decision-node.js +403 -0
  21. package/dist/nodes/decision-node.js.map +1 -0
  22. package/dist/nodes/human-node.d.ts +272 -0
  23. package/dist/nodes/human-node.d.ts.map +1 -0
  24. package/dist/nodes/human-node.js +394 -0
  25. package/dist/nodes/human-node.js.map +1 -0
  26. package/dist/nodes/llm-node.d.ts +173 -0
  27. package/dist/nodes/llm-node.d.ts.map +1 -0
  28. package/dist/nodes/llm-node.js +325 -0
  29. package/dist/nodes/llm-node.js.map +1 -0
  30. package/dist/nodes/tool-node.d.ts +151 -0
  31. package/dist/nodes/tool-node.d.ts.map +1 -0
  32. package/dist/nodes/tool-node.js +373 -0
  33. package/dist/nodes/tool-node.js.map +1 -0
  34. package/dist/prebuilt-graphs/plan-execute-refine.d.ts +149 -0
  35. package/dist/prebuilt-graphs/plan-execute-refine.d.ts.map +1 -0
  36. package/dist/prebuilt-graphs/plan-execute-refine.js +600 -0
  37. package/dist/prebuilt-graphs/plan-execute-refine.js.map +1 -0
  38. package/dist/state-graph.d.ts +158 -0
  39. package/dist/state-graph.d.ts.map +1 -0
  40. package/dist/state-graph.js +756 -0
  41. package/dist/state-graph.js.map +1 -0
  42. package/dist/types.d.ts +762 -0
  43. package/dist/types.d.ts.map +1 -0
  44. package/dist/types.js +73 -0
  45. package/dist/types.js.map +1 -0
  46. package/package.json +57 -0
  47. package/src/checkpointing.ts +702 -0
  48. package/src/edges/conditional-edge.ts +518 -0
  49. package/src/edges/loop-edge.ts +623 -0
  50. package/src/index.ts +416 -0
  51. package/src/nodes/decision-node.ts +538 -0
  52. package/src/nodes/human-node.ts +572 -0
  53. package/src/nodes/llm-node.ts +448 -0
  54. package/src/nodes/tool-node.ts +525 -0
  55. package/src/prebuilt-graphs/plan-execute-refine.ts +769 -0
  56. package/src/state-graph.ts +990 -0
  57. package/src/types.ts +729 -0
@@ -0,0 +1,762 @@
1
+ /**
2
+ * Type definitions for LangGraph-style workflow orchestration
3
+ * @module @wundr.io/langgraph-orchestrator
4
+ */
5
+ import { z } from 'zod';
6
+ /**
7
+ * Generic agent state that can be extended for specific workflows
8
+ */
9
+ export interface AgentState {
10
+ /** Unique identifier for this state instance */
11
+ readonly id: string;
12
+ /** Current messages in the conversation/workflow */
13
+ readonly messages: Message[];
14
+ /** Arbitrary key-value data store */
15
+ readonly data: Record<string, unknown>;
16
+ /** Current step in the workflow */
17
+ readonly currentStep: string;
18
+ /** Previous steps for backtracking */
19
+ readonly history: StateHistoryEntry[];
20
+ /** Error information if workflow failed */
21
+ readonly error?: WorkflowError;
22
+ /** Timestamp of state creation */
23
+ readonly createdAt: Date;
24
+ /** Timestamp of last state update */
25
+ readonly updatedAt: Date;
26
+ /** Metadata for tracking and debugging */
27
+ readonly metadata: StateMetadata;
28
+ }
29
+ /**
30
+ * Message in the agent conversation
31
+ */
32
+ export interface Message {
33
+ /** Unique message identifier */
34
+ readonly id: string;
35
+ /** Role of the message sender */
36
+ readonly role: MessageRole;
37
+ /** Content of the message */
38
+ readonly content: string;
39
+ /** Tool calls if any */
40
+ readonly toolCalls?: ToolCall[];
41
+ /** Tool response if this is a tool result */
42
+ readonly toolResult?: ToolResult;
43
+ /** Timestamp of message creation */
44
+ readonly timestamp: Date;
45
+ /** Additional message metadata */
46
+ readonly metadata?: Record<string, unknown>;
47
+ }
48
+ /**
49
+ * Role of a message sender
50
+ */
51
+ export type MessageRole = 'system' | 'user' | 'assistant' | 'tool';
52
+ /**
53
+ * Tool call request from LLM
54
+ */
55
+ export interface ToolCall {
56
+ /** Unique identifier for this tool call */
57
+ readonly id: string;
58
+ /** Name of the tool to call */
59
+ readonly name: string;
60
+ /** Arguments to pass to the tool */
61
+ readonly arguments: Record<string, unknown>;
62
+ }
63
+ /**
64
+ * Result from a tool execution
65
+ */
66
+ export interface ToolResult {
67
+ /** ID of the tool call this is responding to */
68
+ readonly toolCallId: string;
69
+ /** Result content */
70
+ readonly content: string;
71
+ /** Whether the tool execution was successful */
72
+ readonly success: boolean;
73
+ /** Error message if failed */
74
+ readonly error?: string;
75
+ }
76
+ /**
77
+ * Entry in state history for time-travel debugging
78
+ */
79
+ export interface StateHistoryEntry {
80
+ /** Step name that produced this state */
81
+ readonly step: string;
82
+ /** Timestamp when this state was created */
83
+ readonly timestamp: Date;
84
+ /** Snapshot of the state at this point */
85
+ readonly snapshot: Partial<AgentState>;
86
+ /** Changes made in this step */
87
+ readonly changes: StateChange[];
88
+ }
89
+ /**
90
+ * Individual state change record
91
+ */
92
+ export interface StateChange {
93
+ /** Path to the changed property */
94
+ readonly path: string;
95
+ /** Previous value */
96
+ readonly previousValue: unknown;
97
+ /** New value */
98
+ readonly newValue: unknown;
99
+ }
100
+ /**
101
+ * Error information for failed workflows
102
+ */
103
+ export interface WorkflowError {
104
+ /** Error code */
105
+ readonly code: string;
106
+ /** Human-readable error message */
107
+ readonly message: string;
108
+ /** Stack trace if available */
109
+ readonly stack?: string;
110
+ /** Node where error occurred */
111
+ readonly node?: string;
112
+ /** Whether the error is recoverable */
113
+ readonly recoverable: boolean;
114
+ /** Suggested recovery actions */
115
+ readonly recoveryHints?: string[];
116
+ }
117
+ /**
118
+ * Metadata for state tracking
119
+ */
120
+ export interface StateMetadata {
121
+ /** Session ID for cross-session tracking */
122
+ readonly sessionId: string;
123
+ /** User ID if applicable */
124
+ readonly userId?: string;
125
+ /** Workflow execution ID */
126
+ readonly executionId: string;
127
+ /** Total number of steps executed */
128
+ readonly stepCount: number;
129
+ /** Total tokens consumed (if LLM involved) */
130
+ readonly tokensUsed?: number;
131
+ /** Custom tags for filtering */
132
+ readonly tags: string[];
133
+ }
134
+ /**
135
+ * Configuration for a workflow graph
136
+ */
137
+ export interface GraphConfig {
138
+ /** Unique identifier for the graph */
139
+ readonly id: string;
140
+ /** Human-readable name */
141
+ readonly name: string;
142
+ /** Description of what this graph does */
143
+ readonly description?: string;
144
+ /** Entry point node name */
145
+ readonly entryPoint: string;
146
+ /** Node definitions */
147
+ readonly nodes: Map<string, NodeDefinition>;
148
+ /** Edge definitions */
149
+ readonly edges: Map<string, EdgeDefinition[]>;
150
+ /** Global graph configuration */
151
+ readonly config: GraphGlobalConfig;
152
+ }
153
+ /**
154
+ * Global configuration options for graph execution
155
+ */
156
+ export interface GraphGlobalConfig {
157
+ /** Maximum number of iterations (cycle protection) */
158
+ readonly maxIterations: number;
159
+ /** Timeout in milliseconds */
160
+ readonly timeout: number;
161
+ /** Whether to enable checkpointing */
162
+ readonly checkpointEnabled: boolean;
163
+ /** Checkpoint interval (every N steps) */
164
+ readonly checkpointInterval: number;
165
+ /** Whether to enable parallel execution where possible */
166
+ readonly parallelExecution: boolean;
167
+ /** Retry configuration */
168
+ readonly retry: RetryConfig;
169
+ /** Logging level */
170
+ readonly logLevel: LogLevel;
171
+ }
172
+ /**
173
+ * Retry configuration for failed nodes
174
+ */
175
+ export interface RetryConfig {
176
+ /** Maximum number of retries */
177
+ readonly maxRetries: number;
178
+ /** Initial delay in milliseconds */
179
+ readonly initialDelay: number;
180
+ /** Backoff multiplier */
181
+ readonly backoffMultiplier: number;
182
+ /** Maximum delay in milliseconds */
183
+ readonly maxDelay: number;
184
+ /** Error codes that should trigger retry */
185
+ readonly retryableErrors: string[];
186
+ }
187
+ /**
188
+ * Logging level for graph execution
189
+ */
190
+ export type LogLevel = 'debug' | 'info' | 'warn' | 'error' | 'silent';
191
+ /**
192
+ * Definition of a node in the workflow graph
193
+ */
194
+ export interface NodeDefinition<TState extends AgentState = AgentState> {
195
+ /** Unique identifier for this node */
196
+ readonly id: string;
197
+ /** Human-readable name */
198
+ readonly name: string;
199
+ /** Node type */
200
+ readonly type: NodeType;
201
+ /** Node-specific configuration */
202
+ readonly config: NodeConfig;
203
+ /** The function to execute for this node */
204
+ readonly execute: NodeExecutor<TState>;
205
+ /** Pre-execution hooks */
206
+ readonly preHooks?: NodeHook<TState>[];
207
+ /** Post-execution hooks */
208
+ readonly postHooks?: NodeHook<TState>[];
209
+ /** Validation schema for node output */
210
+ readonly outputSchema?: z.ZodSchema;
211
+ }
212
+ /**
213
+ * Types of nodes in the workflow
214
+ */
215
+ export type NodeType = 'llm' | 'tool' | 'decision' | 'human' | 'aggregate' | 'transform' | 'start' | 'end';
216
+ /**
217
+ * Node configuration options
218
+ */
219
+ export interface NodeConfig {
220
+ /** Whether this node can run in parallel with others */
221
+ readonly parallel?: boolean;
222
+ /** Timeout for this specific node */
223
+ readonly timeout?: number;
224
+ /** Retry configuration override */
225
+ readonly retry?: Partial<RetryConfig>;
226
+ /** Custom metadata */
227
+ readonly metadata?: Record<string, unknown>;
228
+ }
229
+ /**
230
+ * Function signature for node execution
231
+ */
232
+ export type NodeExecutor<TState extends AgentState = AgentState> = (state: TState, context: NodeContext) => Promise<NodeResult<TState>>;
233
+ /**
234
+ * Context provided to node executors
235
+ */
236
+ export interface NodeContext {
237
+ /** Node definition */
238
+ readonly node: NodeDefinition;
239
+ /** Graph configuration */
240
+ readonly graph: GraphConfig;
241
+ /** Execution ID */
242
+ readonly executionId: string;
243
+ /** Current iteration count */
244
+ readonly iterationCount: number;
245
+ /** Shared services */
246
+ readonly services: NodeServices;
247
+ /** Abort signal for cancellation */
248
+ readonly signal?: AbortSignal;
249
+ }
250
+ /**
251
+ * Services available to nodes
252
+ */
253
+ export interface NodeServices {
254
+ /** Logger instance */
255
+ readonly logger: Logger;
256
+ /** Checkpointing service */
257
+ readonly checkpointer?: GraphCheckpointer;
258
+ /** Tool registry */
259
+ readonly toolRegistry?: ToolRegistry;
260
+ /** LLM provider */
261
+ readonly llmProvider?: LLMProvider;
262
+ }
263
+ /**
264
+ * Logger interface
265
+ */
266
+ export interface Logger {
267
+ debug(message: string, data?: Record<string, unknown>): void;
268
+ info(message: string, data?: Record<string, unknown>): void;
269
+ warn(message: string, data?: Record<string, unknown>): void;
270
+ error(message: string, data?: Record<string, unknown>): void;
271
+ }
272
+ /**
273
+ * Tool registry interface
274
+ */
275
+ export interface ToolRegistry {
276
+ get(name: string): Tool | undefined;
277
+ list(): Tool[];
278
+ register(tool: Tool): void;
279
+ unregister(name: string): void;
280
+ }
281
+ /**
282
+ * Tool definition
283
+ */
284
+ export interface Tool {
285
+ /** Unique tool name */
286
+ readonly name: string;
287
+ /** Tool description for LLM */
288
+ readonly description: string;
289
+ /** Input schema */
290
+ readonly inputSchema: z.ZodSchema;
291
+ /** Output schema */
292
+ readonly outputSchema?: z.ZodSchema;
293
+ /** Tool execution function */
294
+ execute(input: unknown): Promise<unknown>;
295
+ }
296
+ /**
297
+ * LLM provider interface
298
+ */
299
+ export interface LLMProvider {
300
+ /** Generate a response */
301
+ generate(request: LLMRequest): Promise<LLMResponse>;
302
+ /** Stream a response */
303
+ stream?(request: LLMRequest): AsyncIterable<LLMStreamChunk>;
304
+ }
305
+ /**
306
+ * LLM request
307
+ */
308
+ export interface LLMRequest {
309
+ /** Messages to send */
310
+ readonly messages: Message[];
311
+ /** Model to use */
312
+ readonly model?: string;
313
+ /** Temperature */
314
+ readonly temperature?: number;
315
+ /** Maximum tokens */
316
+ readonly maxTokens?: number;
317
+ /** Available tools */
318
+ readonly tools?: Tool[];
319
+ /** Stop sequences */
320
+ readonly stop?: string[];
321
+ }
322
+ /**
323
+ * LLM response
324
+ */
325
+ export interface LLMResponse {
326
+ /** Generated message */
327
+ readonly message: Message;
328
+ /** Token usage */
329
+ readonly usage: TokenUsage;
330
+ /** Model used */
331
+ readonly model: string;
332
+ /** Finish reason */
333
+ readonly finishReason: FinishReason;
334
+ }
335
+ /**
336
+ * Token usage information
337
+ */
338
+ export interface TokenUsage {
339
+ /** Prompt tokens */
340
+ readonly promptTokens: number;
341
+ /** Completion tokens */
342
+ readonly completionTokens: number;
343
+ /** Total tokens */
344
+ readonly totalTokens: number;
345
+ }
346
+ /**
347
+ * Reason for LLM completion
348
+ */
349
+ export type FinishReason = 'stop' | 'length' | 'tool_calls' | 'content_filter' | 'error';
350
+ /**
351
+ * Streaming chunk from LLM
352
+ */
353
+ export interface LLMStreamChunk {
354
+ /** Delta content */
355
+ readonly delta: string;
356
+ /** Whether this is the final chunk */
357
+ readonly done: boolean;
358
+ /** Finish reason if done */
359
+ readonly finishReason?: FinishReason;
360
+ }
361
+ /**
362
+ * Result from node execution
363
+ */
364
+ export interface NodeResult<TState extends AgentState = AgentState> {
365
+ /** Updated state */
366
+ readonly state: TState;
367
+ /** Next node(s) to execute */
368
+ readonly next?: string | string[];
369
+ /** Whether to terminate the workflow */
370
+ readonly terminate?: boolean;
371
+ /** Execution metadata */
372
+ readonly metadata?: NodeExecutionMetadata;
373
+ }
374
+ /**
375
+ * Metadata from node execution
376
+ */
377
+ export interface NodeExecutionMetadata {
378
+ /** Duration in milliseconds */
379
+ readonly duration: number;
380
+ /** Tokens used if LLM node */
381
+ readonly tokensUsed?: number;
382
+ /** Tool calls made */
383
+ readonly toolCalls?: ToolCall[];
384
+ /** Retry count if retried */
385
+ readonly retryCount?: number;
386
+ }
387
+ /**
388
+ * Hook function signature
389
+ */
390
+ export type NodeHook<TState extends AgentState = AgentState> = (state: TState, context: NodeContext) => Promise<TState>;
391
+ /**
392
+ * Definition of an edge in the workflow graph
393
+ */
394
+ export interface EdgeDefinition {
395
+ /** Source node */
396
+ readonly from: string;
397
+ /** Target node */
398
+ readonly to: string;
399
+ /** Edge type */
400
+ readonly type: EdgeType;
401
+ /** Condition for conditional edges */
402
+ readonly condition?: EdgeCondition;
403
+ /** Edge metadata */
404
+ readonly metadata?: Record<string, unknown>;
405
+ }
406
+ /**
407
+ * Types of edges
408
+ */
409
+ export type EdgeType = 'direct' | 'conditional' | 'loop' | 'parallel';
410
+ /**
411
+ * Condition for edge traversal
412
+ */
413
+ export interface EdgeCondition {
414
+ /** Condition type */
415
+ readonly type: ConditionType;
416
+ /** Field to check in state */
417
+ readonly field?: string;
418
+ /** Value to compare against */
419
+ readonly value?: unknown;
420
+ /** Custom condition function */
421
+ readonly evaluate?: EdgeConditionEvaluator;
422
+ }
423
+ /**
424
+ * Types of conditions
425
+ */
426
+ export type ConditionType = 'equals' | 'not_equals' | 'contains' | 'greater_than' | 'less_than' | 'exists' | 'not_exists' | 'custom';
427
+ /**
428
+ * Custom condition evaluator
429
+ */
430
+ export type EdgeConditionEvaluator<TState extends AgentState = AgentState> = (state: TState, context: EdgeContext) => Promise<boolean>;
431
+ /**
432
+ * Context provided to edge evaluators
433
+ */
434
+ export interface EdgeContext {
435
+ /** Edge definition */
436
+ readonly edge: EdgeDefinition;
437
+ /** Source node result */
438
+ readonly sourceResult: NodeResult;
439
+ /** Graph configuration */
440
+ readonly graph: GraphConfig;
441
+ }
442
+ /**
443
+ * Interface for checkpoint persistence
444
+ */
445
+ export interface GraphCheckpointer {
446
+ /** Save a checkpoint */
447
+ save(checkpoint: Checkpoint): Promise<void>;
448
+ /** Load a checkpoint by ID */
449
+ load(checkpointId: string): Promise<Checkpoint | null>;
450
+ /** List checkpoints for an execution */
451
+ list(executionId: string): Promise<CheckpointSummary[]>;
452
+ /** Delete a checkpoint */
453
+ delete(checkpointId: string): Promise<void>;
454
+ /** Get the latest checkpoint for an execution */
455
+ getLatest(executionId: string): Promise<Checkpoint | null>;
456
+ }
457
+ /**
458
+ * Checkpoint data structure
459
+ */
460
+ export interface Checkpoint {
461
+ /** Unique checkpoint identifier */
462
+ readonly id: string;
463
+ /** Execution ID this checkpoint belongs to */
464
+ readonly executionId: string;
465
+ /** Step number */
466
+ readonly stepNumber: number;
467
+ /** Node that created this checkpoint */
468
+ readonly nodeName: string;
469
+ /** Full state snapshot */
470
+ readonly state: AgentState;
471
+ /** Timestamp of checkpoint creation */
472
+ readonly timestamp: Date;
473
+ /** Parent checkpoint ID for branching */
474
+ readonly parentId?: string;
475
+ /** Custom metadata */
476
+ readonly metadata?: Record<string, unknown>;
477
+ }
478
+ /**
479
+ * Summary of a checkpoint for listing
480
+ */
481
+ export interface CheckpointSummary {
482
+ /** Checkpoint ID */
483
+ readonly id: string;
484
+ /** Execution ID */
485
+ readonly executionId: string;
486
+ /** Step number */
487
+ readonly stepNumber: number;
488
+ /** Node name */
489
+ readonly nodeName: string;
490
+ /** Timestamp */
491
+ readonly timestamp: Date;
492
+ }
493
+ /**
494
+ * Options for graph execution
495
+ */
496
+ export interface ExecutionOptions {
497
+ /** Initial state */
498
+ readonly initialState?: Partial<AgentState>;
499
+ /** Checkpoint ID to resume from */
500
+ readonly resumeFrom?: string;
501
+ /** Override graph config */
502
+ readonly configOverrides?: Partial<GraphGlobalConfig>;
503
+ /** Abort signal */
504
+ readonly signal?: AbortSignal;
505
+ /** Event handlers */
506
+ readonly handlers?: ExecutionHandlers;
507
+ }
508
+ /**
509
+ * Event handlers for execution lifecycle
510
+ */
511
+ export interface ExecutionHandlers {
512
+ /** Called when execution starts */
513
+ onStart?: (state: AgentState) => void;
514
+ /** Called when entering a node */
515
+ onNodeEnter?: (nodeName: string, state: AgentState) => void;
516
+ /** Called when exiting a node */
517
+ onNodeExit?: (nodeName: string, result: NodeResult) => void;
518
+ /** Called on checkpoint creation */
519
+ onCheckpoint?: (checkpoint: Checkpoint) => void;
520
+ /** Called on error */
521
+ onError?: (error: WorkflowError) => void;
522
+ /** Called when execution completes */
523
+ onComplete?: (state: AgentState) => void;
524
+ }
525
+ /**
526
+ * Result of graph execution
527
+ */
528
+ export interface ExecutionResult {
529
+ /** Final state */
530
+ readonly state: AgentState;
531
+ /** Whether execution was successful */
532
+ readonly success: boolean;
533
+ /** Error if failed */
534
+ readonly error?: WorkflowError;
535
+ /** Execution statistics */
536
+ readonly stats: ExecutionStats;
537
+ /** Path through the graph */
538
+ readonly path: string[];
539
+ }
540
+ /**
541
+ * Statistics from graph execution
542
+ */
543
+ export interface ExecutionStats {
544
+ /** Total execution time in milliseconds */
545
+ readonly duration: number;
546
+ /** Number of nodes executed */
547
+ readonly nodesExecuted: number;
548
+ /** Number of iterations */
549
+ readonly iterations: number;
550
+ /** Total tokens used */
551
+ readonly tokensUsed: number;
552
+ /** Checkpoints created */
553
+ readonly checkpointsCreated: number;
554
+ /** Retries performed */
555
+ readonly retries: number;
556
+ }
557
+ /**
558
+ * Schema for validating message structure
559
+ */
560
+ export declare const MessageSchema: z.ZodObject<{
561
+ id: z.ZodString;
562
+ role: z.ZodEnum<["system", "user", "assistant", "tool"]>;
563
+ content: z.ZodString;
564
+ toolCalls: z.ZodOptional<z.ZodArray<z.ZodObject<{
565
+ id: z.ZodString;
566
+ name: z.ZodString;
567
+ arguments: z.ZodRecord<z.ZodString, z.ZodUnknown>;
568
+ }, "strip", z.ZodTypeAny, {
569
+ id: string;
570
+ name: string;
571
+ arguments: Record<string, unknown>;
572
+ }, {
573
+ id: string;
574
+ name: string;
575
+ arguments: Record<string, unknown>;
576
+ }>, "many">>;
577
+ toolResult: z.ZodOptional<z.ZodObject<{
578
+ toolCallId: z.ZodString;
579
+ content: z.ZodString;
580
+ success: z.ZodBoolean;
581
+ error: z.ZodOptional<z.ZodString>;
582
+ }, "strip", z.ZodTypeAny, {
583
+ content: string;
584
+ toolCallId: string;
585
+ success: boolean;
586
+ error?: string | undefined;
587
+ }, {
588
+ content: string;
589
+ toolCallId: string;
590
+ success: boolean;
591
+ error?: string | undefined;
592
+ }>>;
593
+ timestamp: z.ZodDate;
594
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
595
+ }, "strip", z.ZodTypeAny, {
596
+ id: string;
597
+ role: "system" | "user" | "assistant" | "tool";
598
+ content: string;
599
+ timestamp: Date;
600
+ toolCalls?: {
601
+ id: string;
602
+ name: string;
603
+ arguments: Record<string, unknown>;
604
+ }[] | undefined;
605
+ toolResult?: {
606
+ content: string;
607
+ toolCallId: string;
608
+ success: boolean;
609
+ error?: string | undefined;
610
+ } | undefined;
611
+ metadata?: Record<string, unknown> | undefined;
612
+ }, {
613
+ id: string;
614
+ role: "system" | "user" | "assistant" | "tool";
615
+ content: string;
616
+ timestamp: Date;
617
+ toolCalls?: {
618
+ id: string;
619
+ name: string;
620
+ arguments: Record<string, unknown>;
621
+ }[] | undefined;
622
+ toolResult?: {
623
+ content: string;
624
+ toolCallId: string;
625
+ success: boolean;
626
+ error?: string | undefined;
627
+ } | undefined;
628
+ metadata?: Record<string, unknown> | undefined;
629
+ }>;
630
+ /**
631
+ * Schema for validating graph configuration
632
+ */
633
+ export declare const GraphConfigSchema: z.ZodObject<{
634
+ id: z.ZodString;
635
+ name: z.ZodString;
636
+ description: z.ZodOptional<z.ZodString>;
637
+ entryPoint: z.ZodString;
638
+ config: z.ZodObject<{
639
+ maxIterations: z.ZodNumber;
640
+ timeout: z.ZodNumber;
641
+ checkpointEnabled: z.ZodBoolean;
642
+ checkpointInterval: z.ZodNumber;
643
+ parallelExecution: z.ZodBoolean;
644
+ retry: z.ZodObject<{
645
+ maxRetries: z.ZodNumber;
646
+ initialDelay: z.ZodNumber;
647
+ backoffMultiplier: z.ZodNumber;
648
+ maxDelay: z.ZodNumber;
649
+ retryableErrors: z.ZodArray<z.ZodString, "many">;
650
+ }, "strip", z.ZodTypeAny, {
651
+ maxRetries: number;
652
+ initialDelay: number;
653
+ backoffMultiplier: number;
654
+ maxDelay: number;
655
+ retryableErrors: string[];
656
+ }, {
657
+ maxRetries: number;
658
+ initialDelay: number;
659
+ backoffMultiplier: number;
660
+ maxDelay: number;
661
+ retryableErrors: string[];
662
+ }>;
663
+ logLevel: z.ZodEnum<["debug", "info", "warn", "error", "silent"]>;
664
+ }, "strip", z.ZodTypeAny, {
665
+ maxIterations: number;
666
+ timeout: number;
667
+ checkpointEnabled: boolean;
668
+ checkpointInterval: number;
669
+ parallelExecution: boolean;
670
+ retry: {
671
+ maxRetries: number;
672
+ initialDelay: number;
673
+ backoffMultiplier: number;
674
+ maxDelay: number;
675
+ retryableErrors: string[];
676
+ };
677
+ logLevel: "debug" | "info" | "warn" | "error" | "silent";
678
+ }, {
679
+ maxIterations: number;
680
+ timeout: number;
681
+ checkpointEnabled: boolean;
682
+ checkpointInterval: number;
683
+ parallelExecution: boolean;
684
+ retry: {
685
+ maxRetries: number;
686
+ initialDelay: number;
687
+ backoffMultiplier: number;
688
+ maxDelay: number;
689
+ retryableErrors: string[];
690
+ };
691
+ logLevel: "debug" | "info" | "warn" | "error" | "silent";
692
+ }>;
693
+ }, "strip", z.ZodTypeAny, {
694
+ id: string;
695
+ name: string;
696
+ entryPoint: string;
697
+ config: {
698
+ maxIterations: number;
699
+ timeout: number;
700
+ checkpointEnabled: boolean;
701
+ checkpointInterval: number;
702
+ parallelExecution: boolean;
703
+ retry: {
704
+ maxRetries: number;
705
+ initialDelay: number;
706
+ backoffMultiplier: number;
707
+ maxDelay: number;
708
+ retryableErrors: string[];
709
+ };
710
+ logLevel: "debug" | "info" | "warn" | "error" | "silent";
711
+ };
712
+ description?: string | undefined;
713
+ }, {
714
+ id: string;
715
+ name: string;
716
+ entryPoint: string;
717
+ config: {
718
+ maxIterations: number;
719
+ timeout: number;
720
+ checkpointEnabled: boolean;
721
+ checkpointInterval: number;
722
+ parallelExecution: boolean;
723
+ retry: {
724
+ maxRetries: number;
725
+ initialDelay: number;
726
+ backoffMultiplier: number;
727
+ maxDelay: number;
728
+ retryableErrors: string[];
729
+ };
730
+ logLevel: "debug" | "info" | "warn" | "error" | "silent";
731
+ };
732
+ description?: string | undefined;
733
+ }>;
734
+ /**
735
+ * Schema for validating checkpoint data
736
+ */
737
+ export declare const CheckpointSchema: z.ZodObject<{
738
+ id: z.ZodString;
739
+ executionId: z.ZodString;
740
+ stepNumber: z.ZodNumber;
741
+ nodeName: z.ZodString;
742
+ timestamp: z.ZodDate;
743
+ parentId: z.ZodOptional<z.ZodString>;
744
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
745
+ }, "strip", z.ZodTypeAny, {
746
+ id: string;
747
+ timestamp: Date;
748
+ executionId: string;
749
+ stepNumber: number;
750
+ nodeName: string;
751
+ metadata?: Record<string, unknown> | undefined;
752
+ parentId?: string | undefined;
753
+ }, {
754
+ id: string;
755
+ timestamp: Date;
756
+ executionId: string;
757
+ stepNumber: number;
758
+ nodeName: string;
759
+ metadata?: Record<string, unknown> | undefined;
760
+ parentId?: string | undefined;
761
+ }>;
762
+ //# sourceMappingURL=types.d.ts.map