@ellyco/agentic 0.1.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.
Files changed (103) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +560 -0
  3. package/dist/graphs/graph.d.ts +218 -0
  4. package/dist/graphs/graph.d.ts.map +1 -0
  5. package/dist/graphs/graph.js +334 -0
  6. package/dist/graphs/graph.js.map +1 -0
  7. package/dist/graphs/index.d.ts +7 -0
  8. package/dist/graphs/index.d.ts.map +1 -0
  9. package/dist/graphs/index.js +15 -0
  10. package/dist/graphs/index.js.map +1 -0
  11. package/dist/graphs/iterator.d.ts +138 -0
  12. package/dist/graphs/iterator.d.ts.map +1 -0
  13. package/dist/graphs/iterator.js +184 -0
  14. package/dist/graphs/iterator.js.map +1 -0
  15. package/dist/graphs/merge-state.d.ts +22 -0
  16. package/dist/graphs/merge-state.d.ts.map +1 -0
  17. package/dist/graphs/merge-state.js +56 -0
  18. package/dist/graphs/merge-state.js.map +1 -0
  19. package/dist/graphs/node-sequence.d.ts +63 -0
  20. package/dist/graphs/node-sequence.d.ts.map +1 -0
  21. package/dist/graphs/node-sequence.js +84 -0
  22. package/dist/graphs/node-sequence.js.map +1 -0
  23. package/dist/graphs/registry.d.ts +5 -0
  24. package/dist/graphs/registry.d.ts.map +1 -0
  25. package/dist/graphs/registry.js +6 -0
  26. package/dist/graphs/registry.js.map +1 -0
  27. package/dist/graphs/runtime-context.d.ts +189 -0
  28. package/dist/graphs/runtime-context.d.ts.map +1 -0
  29. package/dist/graphs/runtime-context.js +254 -0
  30. package/dist/graphs/runtime-context.js.map +1 -0
  31. package/dist/graphs/state-machine.d.ts +105 -0
  32. package/dist/graphs/state-machine.d.ts.map +1 -0
  33. package/dist/graphs/state-machine.js +130 -0
  34. package/dist/graphs/state-machine.js.map +1 -0
  35. package/dist/graphs/store/base-store.d.ts +90 -0
  36. package/dist/graphs/store/base-store.d.ts.map +1 -0
  37. package/dist/graphs/store/base-store.js +50 -0
  38. package/dist/graphs/store/base-store.js.map +1 -0
  39. package/dist/graphs/store/sqlite-store.d.ts +88 -0
  40. package/dist/graphs/store/sqlite-store.d.ts.map +1 -0
  41. package/dist/graphs/store/sqlite-store.js +109 -0
  42. package/dist/graphs/store/sqlite-store.js.map +1 -0
  43. package/dist/graphs/store/stored-run.d.ts +77 -0
  44. package/dist/graphs/store/stored-run.d.ts.map +1 -0
  45. package/dist/graphs/store/stored-run.js +88 -0
  46. package/dist/graphs/store/stored-run.js.map +1 -0
  47. package/dist/graphs/types.d.ts +15 -0
  48. package/dist/graphs/types.d.ts.map +1 -0
  49. package/dist/graphs/types.js +3 -0
  50. package/dist/graphs/types.js.map +1 -0
  51. package/dist/messages/index.d.ts +6 -0
  52. package/dist/messages/index.d.ts.map +1 -0
  53. package/dist/messages/index.js +19 -0
  54. package/dist/messages/index.js.map +1 -0
  55. package/dist/messages/message.d.ts +143 -0
  56. package/dist/messages/message.d.ts.map +1 -0
  57. package/dist/messages/message.js +172 -0
  58. package/dist/messages/message.js.map +1 -0
  59. package/dist/messages/tool.d.ts +160 -0
  60. package/dist/messages/tool.d.ts.map +1 -0
  61. package/dist/messages/tool.js +173 -0
  62. package/dist/messages/tool.js.map +1 -0
  63. package/dist/models/BaseModel.d.ts +232 -0
  64. package/dist/models/BaseModel.d.ts.map +1 -0
  65. package/dist/models/BaseModel.js +247 -0
  66. package/dist/models/BaseModel.js.map +1 -0
  67. package/dist/models/BedrockModel.d.ts +112 -0
  68. package/dist/models/BedrockModel.d.ts.map +1 -0
  69. package/dist/models/BedrockModel.js +315 -0
  70. package/dist/models/BedrockModel.js.map +1 -0
  71. package/dist/models/TestModel.d.ts +135 -0
  72. package/dist/models/TestModel.d.ts.map +1 -0
  73. package/dist/models/TestModel.js +191 -0
  74. package/dist/models/TestModel.js.map +1 -0
  75. package/dist/nodes/function-node.d.ts +59 -0
  76. package/dist/nodes/function-node.d.ts.map +1 -0
  77. package/dist/nodes/function-node.js +72 -0
  78. package/dist/nodes/function-node.js.map +1 -0
  79. package/dist/nodes/index.d.ts +4 -0
  80. package/dist/nodes/index.d.ts.map +1 -0
  81. package/dist/nodes/index.js +9 -0
  82. package/dist/nodes/index.js.map +1 -0
  83. package/dist/nodes/interrupt-node.d.ts +51 -0
  84. package/dist/nodes/interrupt-node.d.ts.map +1 -0
  85. package/dist/nodes/interrupt-node.js +65 -0
  86. package/dist/nodes/interrupt-node.js.map +1 -0
  87. package/dist/nodes/model-node.d.ts +72 -0
  88. package/dist/nodes/model-node.d.ts.map +1 -0
  89. package/dist/nodes/model-node.js +80 -0
  90. package/dist/nodes/model-node.js.map +1 -0
  91. package/dist/nodes/types.d.ts +5 -0
  92. package/dist/nodes/types.d.ts.map +1 -0
  93. package/dist/nodes/types.js +3 -0
  94. package/dist/nodes/types.js.map +1 -0
  95. package/dist/tools.d.ts +65 -0
  96. package/dist/tools.d.ts.map +1 -0
  97. package/dist/tools.js +56 -0
  98. package/dist/tools.js.map +1 -0
  99. package/dist/types.d.ts +17 -0
  100. package/dist/types.d.ts.map +1 -0
  101. package/dist/types.js +3 -0
  102. package/dist/types.js.map +1 -0
  103. package/package.json +32 -0
@@ -0,0 +1,218 @@
1
+ import { type NodeLike } from "../nodes/types";
2
+ import { type GraphResult } from "./types";
3
+ import { ContextLayer, RuntimeContext } from "./runtime-context";
4
+ import { BaseStore } from "./store/base-store";
5
+ import { z } from "zod";
6
+ /**
7
+ * Utility type to get all but the first element of a tuple.
8
+ */
9
+ export type Tail<T extends unknown[]> = T extends [unknown, ...infer R] ? R : [];
10
+ /**
11
+ * Special node name indicating the start of graph execution
12
+ */
13
+ export declare const START = "start";
14
+ /**
15
+ * Special node name indicating the end of graph execution
16
+ */
17
+ export declare const END = "end";
18
+ /**
19
+ * Configuration for invoking a graph without persistence.
20
+ *
21
+ * @interface RunConfig
22
+ * @property {string} [resumeFrom] - Cursor to resume from a previous interruption
23
+ * @property {string} [runId] - Custom run ID (generated if not provided)
24
+ */
25
+ export interface RunConfig {
26
+ resumeFrom?: string;
27
+ runId?: string;
28
+ }
29
+ /**
30
+ * Configuration for invoking a graph with persistence to a store.
31
+ *
32
+ * @interface StoredRunConfig
33
+ * @property {BaseStore} store - Store to persist run state to
34
+ * @property {string} [runId] - Custom run ID (generated if not provided)
35
+ * @property {boolean} [deleteAfterEnd] - If true, delete the run from store when graph completes
36
+ */
37
+ export interface StoredRunConfig {
38
+ store: BaseStore;
39
+ runId?: string;
40
+ deleteAfterEnd?: boolean;
41
+ }
42
+ /**
43
+ * Type for a constructor that derives schema from a base schema.
44
+ * Used to mark constructors that can generate derived schemas for specific purposes.
45
+ */
46
+ export type DerivedSchemaConstructorType<T> = ((schema: z.ZodObject) => T) & {
47
+ derives: true;
48
+ };
49
+ /**
50
+ * Marks a constructor function as deriving a schema from a base schema.
51
+ *
52
+ * @template T - The type returned by the constructor
53
+ * @param {(schema: z.ZodObject) => T} constructor - The constructor function
54
+ * @returns {DerivedSchemaConstructorType<T>} The marked constructor
55
+ *
56
+ * @example
57
+ * ```typescript
58
+ * const myConstructor = DerivedSchemaConstructor((schema) => {
59
+ * return new MyClass(schema);
60
+ * });
61
+ * ```
62
+ */
63
+ export declare const DerivedSchemaConstructor: <T>(constructor: (schema: z.ZodObject) => T) => DerivedSchemaConstructorType<T>;
64
+ /**
65
+ * Abstract base class for stateful graphs consisting of nodes and edges.
66
+ * Graphs orchestrate execution flow through nodes, managing state transformations.
67
+ * Supports conditional edges, nesting of graphs, and checkpointing via interrupts.
68
+ *
69
+ * @abstract
70
+ * @template Z - The Zod schema for graph state
71
+ * @template S - The inferred state type from Z (defaults to z.infer<Z>)
72
+ * @template NS - The node-state type for internal node operations (defaults to S)
73
+ *
74
+ * @property {boolean} isGraph - Always true, used to identify graph instances
75
+ *
76
+ * @example
77
+ * ```typescript
78
+ * const schema = z.object({
79
+ * input: z.string(),
80
+ * output: z.string().optional()
81
+ * });
82
+ *
83
+ * class MyGraph extends Graph<typeof schema> {
84
+ * protected stateToNodeState(state) { return state; }
85
+ * protected nodeStateToState(nodeState) { return nodeState; }
86
+ *
87
+ * constructor() {
88
+ * super(schema);
89
+ * this.addNode("process", new FunctionNode(...));
90
+ * this.addEdge("start", "process");
91
+ * this.addEdge("process", "end");
92
+ * }
93
+ * }
94
+ * ```
95
+ */
96
+ export declare abstract class Graph<Z extends z.ZodObject, S extends Record<string, unknown> = z.infer<Z>, NS extends Record<string, unknown> = S> implements NodeLike<S> {
97
+ protected readonly schema: Z;
98
+ /**
99
+ * Marker property to identify Graph instances
100
+ */
101
+ readonly isGraph = true;
102
+ /**
103
+ * Mapping of node names to node implementations
104
+ */
105
+ protected nodes: Record<string, NodeLike<NS>>;
106
+ /**
107
+ * Mapping of source nodes to destination nodes for simple edges
108
+ */
109
+ protected edges: Record<string, string>;
110
+ /**
111
+ * Mapping of source nodes to possible destination nodes for conditional edges
112
+ */
113
+ protected conditionalEdges: Record<string, string[]>;
114
+ /**
115
+ * Mapping of source nodes to functions that determine the destination for conditional edges
116
+ */
117
+ protected conditionalFuncs: Record<string, (state: NS, context: ContextLayer) => string>;
118
+ /**
119
+ * Converts graph state to node state before passing to nodes.
120
+ * Useful for normalizing state across graph boundaries.
121
+ *
122
+ * @protected
123
+ * @abstract
124
+ * @param {S} state - The graph state
125
+ * @param {ContextLayer} context - The execution context
126
+ * @returns {NS} The node state
127
+ */
128
+ protected abstract stateToNodeState(state: S, context: ContextLayer): NS;
129
+ /**
130
+ * Converts node state back to graph state after node execution.
131
+ *
132
+ * @protected
133
+ * @abstract
134
+ * @param {Partial<NS>} nodeState - The partial node state from a node
135
+ * @param {ContextLayer} context - The execution context
136
+ * @returns {Partial<S>} The partial graph state
137
+ */
138
+ protected abstract nodeStateToState(nodeState: Partial<NS>, context: ContextLayer): Partial<S>;
139
+ /**
140
+ * Creates a new graph instance.
141
+ *
142
+ * @param {Z} schema - Zod schema for validating and typing the graph state
143
+ */
144
+ constructor(schema: Z);
145
+ /**
146
+ * Determines the next node based on current node and state.
147
+ * Handles both simple edges and conditional edges.
148
+ *
149
+ * @protected
150
+ * @param {S} state - Current state
151
+ * @param {ContextLayer} context - Execution context
152
+ * @throws {Error} If no edge is found from current node
153
+ */
154
+ protected transition(state: S, context: ContextLayer): void;
155
+ /**
156
+ * Executes a single node and merges its output into the state.
157
+ *
158
+ * @protected
159
+ * @param {S} state - Current state
160
+ * @param {ContextLayer} context - Execution context
161
+ * @returns {Promise<S>} Updated state
162
+ * @throws {Error} If node is not found
163
+ */
164
+ protected step(state: S, context: ContextLayer): Promise<S>;
165
+ /**
166
+ * Validates the graph structure.
167
+ * Ensures START and END nodes have proper connections.
168
+ *
169
+ * @throws {Error} If graph structure is invalid
170
+ */
171
+ validate(): void;
172
+ /**
173
+ * Internal execution loop for the graph.
174
+ * Runs nodes in sequence following edges until END is reached or interrupted.
175
+ *
176
+ * @protected
177
+ * @param {S} input - Initial state
178
+ * @param {ContextLayer} context - Execution context
179
+ * @returns {Promise<Partial<S>>} Final state changes
180
+ */
181
+ protected runInternal(input: S, context: ContextLayer): Promise<Partial<S>>;
182
+ /**
183
+ * Merges partial state into the base state using the schema.
184
+ *
185
+ * @protected
186
+ * @param {S} state - Base state
187
+ * @param {Partial<S>} partial - Partial updates
188
+ * @returns {S} Merged state
189
+ */
190
+ protected mergeState(state: S, partial: Partial<S>): S;
191
+ /**
192
+ * Runs the graph with the provided context.
193
+ * Sets up initial node if not already set, runs internal loop, and cleans up.
194
+ *
195
+ * @param {S} input - Initial state
196
+ * @param {ContextLayer | RuntimeContext} contextOrRuntime - Execution context or runtime
197
+ * @returns {Promise<Partial<S>>} Final state changes
198
+ */
199
+ run(input: S, contextOrRuntime: ContextLayer | RuntimeContext): Promise<Partial<S>>;
200
+ /**
201
+ * Invokes the graph and returns the final result.
202
+ * Supports both in-memory and stored (persistent) execution.
203
+ *
204
+ * @overload
205
+ * @param {S} input - Initial state
206
+ * @param {RunConfig} [config] - Run configuration
207
+ * @returns {Promise<GraphResult<S>>} Result with final state and exit reason
208
+ */
209
+ invoke(input: S, config?: RunConfig): Promise<GraphResult<S>>;
210
+ /**
211
+ * @overload
212
+ * @param {Partial<S>} input - Partial initial state (for stored runs)
213
+ * @param {StoredRunConfig} config - Configuration with store for persistence
214
+ * @returns {Promise<GraphResult<S>>} Result with final state and exit reason
215
+ */
216
+ invoke(input: Partial<S>, config?: StoredRunConfig): Promise<GraphResult<S>>;
217
+ }
218
+ //# sourceMappingURL=graph.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graph.d.ts","sourceRoot":"","sources":["../../src/graphs/graph.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACjE,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB;;GAEG;AACH,MAAM,MAAM,IAAI,CAAC,CAAC,SAAS,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,GAAG,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC;AAEjF;;GAEG;AACH,eAAO,MAAM,KAAK,UAAU,CAAC;AAE7B;;GAEG;AACH,eAAO,MAAM,GAAG,QAAQ,CAAC;AAEzB;;;;;;GAMG;AACH,MAAM,WAAW,SAAS;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,eAAe;IAC5B,KAAK,EAAE,SAAS,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,cAAc,CAAC,EAAE,OAAO,CAAC;CAC5B;AAWD;;;GAGG;AACH,MAAM,MAAM,4BAA4B,CAAC,CAAC,IAAI,CAA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ACH,SAAS,CAAC,QAAQ,CAAC,gBAAgB,CAAC,SAAS,EAAE,OAAO,CAAC,EAAE,CAAC,EAAE,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,CAAC,CAAC;IAE9F;;;;OAIG;gBAC4B,MAAM,EAAE,CAAC;IAExC;;;;;;;;OAQG;IACH,SAAS,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,YAAY,GAAG,IAAI;IAwB3D;;;;;;;;OAQG;cACa,IAAI,CAAC,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,CAAC,CAAC;IAiBjE;;;;;OAKG;IACH,QAAQ,IAAI,IAAI;IAwBhB;;;;;;;;OAQG;cACa,WAAW,CAAC,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IA4BjF;;;;;;;OAOG;IACH,SAAS,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC;IAItD;;;;;;;OAOG;IACG,GAAG,CAAC,KAAK,EAAE,CAAC,EAAE,gBAAgB,EAAE,YAAY,GAAG,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAUzF;;;;;;;;OAQG;IACG,MAAM,CAAC,KAAK,EAAE,CAAC,EAAE,MAAM,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;IAEnE;;;;;OAKG;IACG,MAAM,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;CAmGrF"}
@@ -0,0 +1,334 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Graph = exports.DerivedSchemaConstructor = exports.END = exports.START = void 0;
4
+ const runtime_context_1 = require("./runtime-context");
5
+ const cuid2_1 = require("@paralleldrive/cuid2");
6
+ const merge_state_1 = require("./merge-state");
7
+ /**
8
+ * Special node name indicating the start of graph execution
9
+ */
10
+ exports.START = "start";
11
+ /**
12
+ * Special node name indicating the end of graph execution
13
+ */
14
+ exports.END = "end";
15
+ /**
16
+ * Type guard to check if config is StoredRunConfig
17
+ *
18
+ * @private
19
+ */
20
+ function isStoredRunConfig(config) {
21
+ return "store" in config;
22
+ }
23
+ /**
24
+ * Marks a constructor function as deriving a schema from a base schema.
25
+ *
26
+ * @template T - The type returned by the constructor
27
+ * @param {(schema: z.ZodObject) => T} constructor - The constructor function
28
+ * @returns {DerivedSchemaConstructorType<T>} The marked constructor
29
+ *
30
+ * @example
31
+ * ```typescript
32
+ * const myConstructor = DerivedSchemaConstructor((schema) => {
33
+ * return new MyClass(schema);
34
+ * });
35
+ * ```
36
+ */
37
+ const DerivedSchemaConstructor = (constructor) => {
38
+ Object.defineProperty(constructor, "derives", { value: true });
39
+ return constructor;
40
+ };
41
+ exports.DerivedSchemaConstructor = DerivedSchemaConstructor;
42
+ /**
43
+ * Abstract base class for stateful graphs consisting of nodes and edges.
44
+ * Graphs orchestrate execution flow through nodes, managing state transformations.
45
+ * Supports conditional edges, nesting of graphs, and checkpointing via interrupts.
46
+ *
47
+ * @abstract
48
+ * @template Z - The Zod schema for graph state
49
+ * @template S - The inferred state type from Z (defaults to z.infer<Z>)
50
+ * @template NS - The node-state type for internal node operations (defaults to S)
51
+ *
52
+ * @property {boolean} isGraph - Always true, used to identify graph instances
53
+ *
54
+ * @example
55
+ * ```typescript
56
+ * const schema = z.object({
57
+ * input: z.string(),
58
+ * output: z.string().optional()
59
+ * });
60
+ *
61
+ * class MyGraph extends Graph<typeof schema> {
62
+ * protected stateToNodeState(state) { return state; }
63
+ * protected nodeStateToState(nodeState) { return nodeState; }
64
+ *
65
+ * constructor() {
66
+ * super(schema);
67
+ * this.addNode("process", new FunctionNode(...));
68
+ * this.addEdge("start", "process");
69
+ * this.addEdge("process", "end");
70
+ * }
71
+ * }
72
+ * ```
73
+ */
74
+ class Graph {
75
+ schema;
76
+ /**
77
+ * Marker property to identify Graph instances
78
+ */
79
+ isGraph = true;
80
+ /**
81
+ * Mapping of node names to node implementations
82
+ */
83
+ nodes = {};
84
+ /**
85
+ * Mapping of source nodes to destination nodes for simple edges
86
+ */
87
+ edges = {};
88
+ /**
89
+ * Mapping of source nodes to possible destination nodes for conditional edges
90
+ */
91
+ conditionalEdges = {};
92
+ /**
93
+ * Mapping of source nodes to functions that determine the destination for conditional edges
94
+ */
95
+ conditionalFuncs = {};
96
+ /**
97
+ * Creates a new graph instance.
98
+ *
99
+ * @param {Z} schema - Zod schema for validating and typing the graph state
100
+ */
101
+ constructor(schema) {
102
+ this.schema = schema;
103
+ }
104
+ /**
105
+ * Determines the next node based on current node and state.
106
+ * Handles both simple edges and conditional edges.
107
+ *
108
+ * @protected
109
+ * @param {S} state - Current state
110
+ * @param {ContextLayer} context - Execution context
111
+ * @throws {Error} If no edge is found from current node
112
+ */
113
+ transition(state, context) {
114
+ const currentNode = context.currentNode;
115
+ if (currentNode in this.edges) {
116
+ context.currentNode = this.edges[currentNode];
117
+ }
118
+ else if (currentNode in this.conditionalEdges) {
119
+ const conditionalEdges = this.conditionalEdges[currentNode];
120
+ const condition = this.conditionalFuncs[currentNode](this.stateToNodeState(state, context), context);
121
+ if (conditionalEdges.includes(condition)) {
122
+ context.currentNode = condition;
123
+ }
124
+ else {
125
+ throw new Error(`No edge found for after node ${currentNode} with condition ${condition}`);
126
+ }
127
+ }
128
+ else {
129
+ throw new Error(`No edge or conditional edge found for after node ${currentNode}`);
130
+ }
131
+ }
132
+ /**
133
+ * Executes a single node and merges its output into the state.
134
+ *
135
+ * @protected
136
+ * @param {S} state - Current state
137
+ * @param {ContextLayer} context - Execution context
138
+ * @returns {Promise<S>} Updated state
139
+ * @throws {Error} If node is not found
140
+ */
141
+ async step(state, context) {
142
+ const currentNode = context.currentNode;
143
+ const node = this.nodes[currentNode];
144
+ if (node === undefined) {
145
+ throw new Error(`Node ${currentNode} not found`);
146
+ }
147
+ const inputNodeState = this.stateToNodeState(structuredClone(state), context);
148
+ const result = await node.run(structuredClone(inputNodeState), context);
149
+ if (Object.keys(result).length === 0) {
150
+ return state;
151
+ }
152
+ return this.mergeState(state, this.nodeStateToState(result, context));
153
+ }
154
+ /**
155
+ * Validates the graph structure.
156
+ * Ensures START and END nodes have proper connections.
157
+ *
158
+ * @throws {Error} If graph structure is invalid
159
+ */
160
+ validate() {
161
+ if (!(exports.START in this.edges) && !(exports.START in this.conditionalEdges)) {
162
+ throw new Error(`No edge or conditional edge found for starting node ${exports.START}`);
163
+ }
164
+ let endIsSet = false;
165
+ for (const to of Object.values(this.edges)) {
166
+ if (to === exports.END) {
167
+ endIsSet = true;
168
+ }
169
+ }
170
+ for (const to of Object.values(this.conditionalEdges).flat()) {
171
+ if (to.includes(exports.END)) {
172
+ endIsSet = true;
173
+ }
174
+ }
175
+ if (!endIsSet) {
176
+ throw new Error(`No edge or conditional edge found for ending node ${exports.END}`);
177
+ }
178
+ }
179
+ /**
180
+ * Internal execution loop for the graph.
181
+ * Runs nodes in sequence following edges until END is reached or interrupted.
182
+ *
183
+ * @protected
184
+ * @param {S} input - Initial state
185
+ * @param {ContextLayer} context - Execution context
186
+ * @returns {Promise<Partial<S>>} Final state changes
187
+ */
188
+ async runInternal(input, context) {
189
+ let state = structuredClone(input);
190
+ let shouldContinue = true;
191
+ while (shouldContinue) {
192
+ const currentNode = context.currentNode;
193
+ // End is not a real node, it's just a way to stop the state machine.
194
+ if (currentNode === exports.END) {
195
+ shouldContinue = false;
196
+ break;
197
+ }
198
+ // Start is not a real node, it's just a way to start the state machine.
199
+ if (currentNode === exports.START) {
200
+ this.transition(input, context);
201
+ continue;
202
+ }
203
+ state = { ...state, ...(await this.step(structuredClone(state), context)) };
204
+ if (context.runtime.interrupted) {
205
+ shouldContinue = false;
206
+ break;
207
+ }
208
+ this.transition(state, context);
209
+ }
210
+ return state;
211
+ }
212
+ /**
213
+ * Merges partial state into the base state using the schema.
214
+ *
215
+ * @protected
216
+ * @param {S} state - Base state
217
+ * @param {Partial<S>} partial - Partial updates
218
+ * @returns {S} Merged state
219
+ */
220
+ mergeState(state, partial) {
221
+ return (0, merge_state_1.mergeState)(state, partial, this.schema);
222
+ }
223
+ /**
224
+ * Runs the graph with the provided context.
225
+ * Sets up initial node if not already set, runs internal loop, and cleans up.
226
+ *
227
+ * @param {S} input - Initial state
228
+ * @param {ContextLayer | RuntimeContext} contextOrRuntime - Execution context or runtime
229
+ * @returns {Promise<Partial<S>>} Final state changes
230
+ */
231
+ async run(input, contextOrRuntime) {
232
+ const context = contextOrRuntime.nextLayer();
233
+ if (context.currentNode === undefined) {
234
+ context.currentNode = exports.START;
235
+ }
236
+ const result = await this.runInternal(input, context);
237
+ context.done();
238
+ return result;
239
+ }
240
+ /**
241
+ * Invokes the graph with the given input and optional configuration.
242
+ * Handles both in-memory and stored (persistent) execution modes.
243
+ *
244
+ * For in-memory mode (RunConfig): State is not persisted between invocations.
245
+ * Can be resumed using a cursor from a previous interruption.
246
+ *
247
+ * For stored mode (StoredRunConfig): State is persisted to the provided store.
248
+ * Allows resuming execution from checkpoints across different invocations.
249
+ *
250
+ * @param {S | Partial<S>} input - Initial or partial state
251
+ * @param {RunConfig | StoredRunConfig} [config] - Configuration
252
+ * @returns {Promise<GraphResult<S>>} Result object containing final state and exit reason
253
+ * @throws {Error} If graph structure validation fails
254
+ *
255
+ * @example
256
+ * ```typescript
257
+ * // In-memory execution
258
+ * const result = await graph.invoke(initialState);
259
+ *
260
+ * // With resumption
261
+ * if (result.exitReason === "interrupt") {
262
+ * const result2 = await graph.invoke(result.state, { resumeFrom: result.cursor });
263
+ * }
264
+ *
265
+ * // With persistence
266
+ * const result = await graph.invoke(state, { store: myStore });
267
+ * ```
268
+ */
269
+ async invoke(input, config) {
270
+ const runId = (config && "runId" in config ? config.runId : (0, cuid2_1.createId)());
271
+ if (config && isStoredRunConfig(config)) {
272
+ const partialInput = input;
273
+ const storedRun = config.store.getStoredRun(runId);
274
+ const runtime = new runtime_context_1.RuntimeContext(runId, storedRun);
275
+ let mergedState = partialInput;
276
+ const stateExists = await storedRun.exists();
277
+ if (stateExists) {
278
+ const load = await storedRun.load();
279
+ mergedState = this.mergeState(mergedState, load.state);
280
+ runtime.unwrapCursor(load.cursor);
281
+ }
282
+ const state = this.schema.parse(mergedState);
283
+ const result = await this.run(state, runtime);
284
+ const finalState = { ...state, ...result };
285
+ if (runtime.interrupted) {
286
+ await storedRun.save(runtime.wrapCursor(), finalState);
287
+ return {
288
+ runId,
289
+ state: finalState,
290
+ exitReason: "interrupt",
291
+ exitMessage: runtime.exitMessage,
292
+ cursor: runtime.wrapCursor(),
293
+ };
294
+ }
295
+ if (config?.deleteAfterEnd) {
296
+ await storedRun.delete();
297
+ }
298
+ else {
299
+ await storedRun.save(exports.END, finalState);
300
+ }
301
+ return {
302
+ runId,
303
+ state: finalState,
304
+ exitReason: "end",
305
+ };
306
+ }
307
+ else {
308
+ const fullInput = input;
309
+ const runtime = new runtime_context_1.RuntimeContext(runId);
310
+ if (config?.resumeFrom) {
311
+ runtime.unwrapCursor(config.resumeFrom);
312
+ }
313
+ const state = this.schema.parse(fullInput);
314
+ const result = await this.run(state, runtime);
315
+ const finalState = { ...state, ...result };
316
+ if (runtime.interrupted) {
317
+ return {
318
+ runId,
319
+ state: finalState,
320
+ exitReason: "interrupt",
321
+ exitMessage: runtime.exitMessage,
322
+ cursor: runtime.wrapCursor(),
323
+ };
324
+ }
325
+ return {
326
+ runId,
327
+ state: finalState,
328
+ exitReason: "end",
329
+ };
330
+ }
331
+ }
332
+ }
333
+ exports.Graph = Graph;
334
+ //# sourceMappingURL=graph.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graph.js","sourceRoot":"","sources":["../../src/graphs/graph.ts"],"names":[],"mappings":";;;AAEA,uDAAiE;A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C,IAAI,CAAC,WAAG,EAAE,UAAU,CAAC,CAAC;YAC1C,CAAC;YACD,OAAO;gBACH,KAAK;gBACL,KAAK,EAAE,UAAU;gBACjB,UAAU,EAAE,KAAK;aACpB,CAAC;QACN,CAAC;aAAM,CAAC;YACJ,MAAM,SAAS,GAAG,KAAU,CAAC;YAC7B,MAAM,OAAO,GAAG,IAAI,gCAAc,CAAC,KAAK,CAAC,CAAC;YAC1C,IAAI,MAAM,EAAE,UAAU,EAAE,CAAC;gBACrB,OAAO,CAAC,YAAY,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;YAC5C,CAAC;YACD,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAM,CAAC;YAEhD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;YAE9C,MAAM,UAAU,GAAG,EAAE,GAAG,KAAK,EAAE,GAAG,MAAM,EAAE,CAAA;YAC1C,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC;gBACtB,OAAO;oBACH,KAAK;oBACL,KAAK,EAAE,UAAU;oBACjB,UAAU,EAAE,WAAW;oBACvB,WAAW,EAAE,OAAO,CAAC,WAAW;oBAChC,MAAM,EAAE,OAAO,CAAC,UAAU,EAAE;iBAC/B,CAAC;YACN,CAAC;YACD,OAAO;gBACH,KAAK;gBACL,KAAK,EAAE,UAAU;gBACjB,UAAU,EAAE,KAAK;aACpB,CAAC;QACN,CAAC;IAEL,CAAC;CACJ;AA5UD,sBA4UC"}
@@ -0,0 +1,7 @@
1
+ export { StateMachine } from "./state-machine";
2
+ export { type GraphResult } from "./types";
3
+ export { NodeSequence } from "./node-sequence";
4
+ export { Iterator } from "./iterator";
5
+ export { RuntimeContext, ContextLayer } from "./runtime-context";
6
+ export { STATE_MERGE } from "./registry";
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/graphs/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC"}
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.STATE_MERGE = exports.ContextLayer = exports.RuntimeContext = exports.Iterator = exports.NodeSequence = exports.StateMachine = void 0;
4
+ var state_machine_1 = require("./state-machine");
5
+ Object.defineProperty(exports, "StateMachine", { enumerable: true, get: function () { return state_machine_1.StateMachine; } });
6
+ var node_sequence_1 = require("./node-sequence");
7
+ Object.defineProperty(exports, "NodeSequence", { enumerable: true, get: function () { return node_sequence_1.NodeSequence; } });
8
+ var iterator_1 = require("./iterator");
9
+ Object.defineProperty(exports, "Iterator", { enumerable: true, get: function () { return iterator_1.Iterator; } });
10
+ var runtime_context_1 = require("./runtime-context");
11
+ Object.defineProperty(exports, "RuntimeContext", { enumerable: true, get: function () { return runtime_context_1.RuntimeContext; } });
12
+ Object.defineProperty(exports, "ContextLayer", { enumerable: true, get: function () { return runtime_context_1.ContextLayer; } });
13
+ var registry_1 = require("./registry");
14
+ Object.defineProperty(exports, "STATE_MERGE", { enumerable: true, get: function () { return registry_1.STATE_MERGE; } });
15
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/graphs/index.ts"],"names":[],"mappings":";;;AAAA,iDAA+C;AAAtC,6GAAA,YAAY,OAAA;AAErB,iDAA+C;AAAtC,6GAAA,YAAY,OAAA;AACrB,uCAAsC;AAA7B,oGAAA,QAAQ,OAAA;AACjB,qDAAiE;AAAxD,iHAAA,cAAc,OAAA;AAAE,+GAAA,YAAY,OAAA;AACrC,uCAAyC;AAAhC,uGAAA,WAAW,OAAA"}