@langchain/langgraph 0.2.57 → 0.2.58

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 (54) hide show
  1. package/dist/constants.cjs +98 -12
  2. package/dist/constants.d.ts +51 -6
  3. package/dist/constants.js +96 -11
  4. package/dist/constants.js.map +1 -1
  5. package/dist/graph/graph.d.ts +1 -1
  6. package/dist/graph/state.cjs +90 -11
  7. package/dist/graph/state.d.ts +23 -5
  8. package/dist/graph/state.js +90 -11
  9. package/dist/graph/state.js.map +1 -1
  10. package/dist/graph/zod/index.cjs +7 -0
  11. package/dist/graph/zod/index.d.ts +2 -0
  12. package/dist/graph/zod/index.js +3 -0
  13. package/dist/graph/zod/index.js.map +1 -0
  14. package/dist/graph/zod/plugin.cjs +41 -0
  15. package/dist/graph/zod/plugin.d.ts +15 -0
  16. package/dist/graph/zod/plugin.js +39 -0
  17. package/dist/graph/zod/plugin.js.map +1 -0
  18. package/dist/graph/zod/schema.cjs +79 -0
  19. package/dist/graph/zod/schema.d.ts +9 -0
  20. package/dist/graph/zod/schema.js +73 -0
  21. package/dist/graph/zod/schema.js.map +1 -0
  22. package/dist/graph/zod/state.cjs +73 -0
  23. package/dist/graph/zod/state.d.ts +30 -0
  24. package/dist/graph/zod/state.js +64 -0
  25. package/dist/graph/zod/state.js.map +1 -0
  26. package/dist/pregel/algo.cjs +26 -3
  27. package/dist/pregel/algo.js +27 -4
  28. package/dist/pregel/algo.js.map +1 -1
  29. package/dist/pregel/debug.cjs +2 -1
  30. package/dist/pregel/debug.d.ts +1 -1
  31. package/dist/pregel/debug.js +2 -1
  32. package/dist/pregel/debug.js.map +1 -1
  33. package/dist/pregel/index.cjs +101 -25
  34. package/dist/pregel/index.d.ts +17 -1
  35. package/dist/pregel/index.js +102 -26
  36. package/dist/pregel/index.js.map +1 -1
  37. package/dist/pregel/loop.cjs +48 -24
  38. package/dist/pregel/loop.d.ts +1 -0
  39. package/dist/pregel/loop.js +48 -24
  40. package/dist/pregel/loop.js.map +1 -1
  41. package/dist/pregel/retry.cjs +3 -1
  42. package/dist/pregel/retry.js +3 -1
  43. package/dist/pregel/retry.js.map +1 -1
  44. package/dist/pregel/runner.cjs +26 -17
  45. package/dist/pregel/runner.d.ts +4 -0
  46. package/dist/pregel/runner.js +26 -17
  47. package/dist/pregel/runner.js.map +1 -1
  48. package/dist/pregel/utils/index.d.ts +2 -0
  49. package/dist/pregel/utils/index.js.map +1 -1
  50. package/package.json +22 -3
  51. package/zod.cjs +1 -0
  52. package/zod.d.cts +1 -0
  53. package/zod.d.ts +1 -0
  54. package/zod.js +1 -0
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isCommand = exports.Command = exports._isSend = exports.Send = exports._isSendInterface = exports.CHECKPOINT_NAMESPACE_END = exports.CHECKPOINT_NAMESPACE_SEPARATOR = exports.RESERVED = exports.NULL_TASK_ID = exports.TASK_NAMESPACE = exports.PULL = exports.PUSH = exports.TASKS = exports.SELF = exports.TAG_NOSTREAM = exports.TAG_HIDDEN = exports.RECURSION_LIMIT_DEFAULT = exports.RUNTIME_PLACEHOLDER = exports.PREVIOUS = exports.RETURN = exports.NO_WRITES = exports.RESUME = exports.INTERRUPT = exports.CONFIG_KEY_CHECKPOINT_MAP = exports.CONFIG_KEY_CHECKPOINT_NS = exports.CONFIG_KEY_CHECKPOINT_ID = exports.CONFIG_KEY_PREVIOUS_STATE = exports.CONFIG_KEY_SCRATCHPAD = exports.CONFIG_KEY_RESUME_VALUE = exports.CONFIG_KEY_STREAM = exports.CONFIG_KEY_TASK_ID = exports.CONFIG_KEY_RESUMING = exports.CONFIG_KEY_CHECKPOINTER = exports.CONFIG_KEY_READ = exports.CONFIG_KEY_CALL = exports.CONFIG_KEY_SEND = exports.ERROR = exports.COPY = exports.INPUT = exports.END = exports.START = void 0;
3
+ exports.isCommandParams = exports.isCommand = exports.Command = exports._isSend = exports.Send = exports._isSendInterface = exports.CHECKPOINT_NAMESPACE_END = exports.CHECKPOINT_NAMESPACE_SEPARATOR = exports.RESERVED = exports.NULL_TASK_ID = exports.TASK_NAMESPACE = exports.PULL = exports.PUSH = exports.TASKS = exports.SELF = exports.TAG_NOSTREAM = exports.TAG_HIDDEN = exports.RECURSION_LIMIT_DEFAULT = exports.RUNTIME_PLACEHOLDER = exports.PREVIOUS = exports.RETURN = exports.NO_WRITES = exports.RESUME = exports.INTERRUPT = exports.CONFIG_KEY_CHECKPOINT_MAP = exports.CONFIG_KEY_NODE_FINISHED = exports.CONFIG_KEY_CHECKPOINT_NS = exports.CONFIG_KEY_CHECKPOINT_ID = exports.CONFIG_KEY_PREVIOUS_STATE = exports.CONFIG_KEY_SCRATCHPAD = exports.CONFIG_KEY_RESUME_VALUE = exports.CONFIG_KEY_STREAM = exports.CONFIG_KEY_TASK_ID = exports.CONFIG_KEY_RESUMING = exports.CONFIG_KEY_CHECKPOINTER = exports.CONFIG_KEY_READ = exports.CONFIG_KEY_CALL = exports.CONFIG_KEY_SEND = exports.ERROR = exports.COPY = exports.INPUT = exports.END = exports.START = void 0;
4
4
  /** Special reserved node name denoting the start of a graph. */
5
5
  exports.START = "__start__";
6
6
  /** Special reserved node name denoting the end of a graph. */
@@ -22,6 +22,7 @@ exports.CONFIG_KEY_SCRATCHPAD = "__pregel_scratchpad";
22
22
  exports.CONFIG_KEY_PREVIOUS_STATE = "__pregel_previous";
23
23
  exports.CONFIG_KEY_CHECKPOINT_ID = "checkpoint_id";
24
24
  exports.CONFIG_KEY_CHECKPOINT_NS = "checkpoint_ns";
25
+ exports.CONFIG_KEY_NODE_FINISHED = "__pregel_node_finished";
25
26
  // this one is part of public API
26
27
  exports.CONFIG_KEY_CHECKPOINT_MAP = "checkpoint_map";
27
28
  /** Special channel reserved for graph interrupts */
@@ -126,24 +127,27 @@ exports._isSendInterface = _isSendInterface;
126
127
  class Send {
127
128
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
128
129
  constructor(node, args) {
129
- Object.defineProperty(this, "node", {
130
+ Object.defineProperty(this, "lg_name", {
130
131
  enumerable: true,
131
132
  configurable: true,
132
133
  writable: true,
133
- value: node
134
+ value: "Send"
134
135
  });
135
- Object.defineProperty(this, "args", {
136
+ Object.defineProperty(this, "node", {
136
137
  enumerable: true,
137
138
  configurable: true,
138
139
  writable: true,
139
- value: args
140
+ value: void 0
140
141
  });
141
- Object.defineProperty(this, "lg_name", {
142
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
143
+ Object.defineProperty(this, "args", {
142
144
  enumerable: true,
143
145
  configurable: true,
144
146
  writable: true,
145
- value: "Send"
147
+ value: void 0
146
148
  });
149
+ this.node = node;
150
+ this.args = _convertCommandSendTree(args);
147
151
  }
148
152
  toJSON() {
149
153
  return {
@@ -154,8 +158,8 @@ class Send {
154
158
  }
155
159
  exports.Send = Send;
156
160
  function _isSend(x) {
157
- const operation = x;
158
- return operation !== undefined && operation.lg_name === "Send";
161
+ // eslint-disable-next-line no-instanceof/no-instanceof
162
+ return x instanceof Send;
159
163
  }
160
164
  exports._isSend = _isSend;
161
165
  /**
@@ -234,24 +238,44 @@ class Command {
234
238
  writable: true,
235
239
  value: true
236
240
  });
241
+ /**
242
+ * Graph to send the command to. Supported values are:
243
+ * - None: the current graph (default)
244
+ * - The specific name of the graph to send the command to
245
+ * - {@link Command.PARENT}: closest parent graph (only supported when returned from a node in a subgraph)
246
+ */
237
247
  Object.defineProperty(this, "graph", {
238
248
  enumerable: true,
239
249
  configurable: true,
240
250
  writable: true,
241
251
  value: void 0
242
252
  });
253
+ /**
254
+ * Update to apply to the graph's state as a result of executing the node that is returning the command.
255
+ * Written to the state as if the node had simply returned this value instead of the Command object.
256
+ */
243
257
  Object.defineProperty(this, "update", {
244
258
  enumerable: true,
245
259
  configurable: true,
246
260
  writable: true,
247
261
  value: void 0
248
262
  });
263
+ /**
264
+ * Value to resume execution with. To be used together with {@link interrupt}.
265
+ */
249
266
  Object.defineProperty(this, "resume", {
250
267
  enumerable: true,
251
268
  configurable: true,
252
269
  writable: true,
253
270
  value: void 0
254
271
  });
272
+ /**
273
+ * Can be one of the following:
274
+ * - name of the node to navigate to next (any node that belongs to the specified `graph`)
275
+ * - sequence of node names to navigate to next
276
+ * - {@link Send} object (to execute a node with the exact input provided in the {@link Send} object)
277
+ * - sequence of {@link Send} objects
278
+ */
255
279
  Object.defineProperty(this, "goto", {
256
280
  enumerable: true,
257
281
  configurable: true,
@@ -262,9 +286,16 @@ class Command {
262
286
  this.graph = args.graph;
263
287
  this.update = args.update;
264
288
  if (args.goto) {
265
- this.goto = Array.isArray(args.goto) ? args.goto : [args.goto];
289
+ this.goto = Array.isArray(args.goto)
290
+ ? _convertCommandSendTree(args.goto)
291
+ : [_convertCommandSendTree(args.goto)];
266
292
  }
267
293
  }
294
+ /**
295
+ * Convert the update field to a list of {@link PendingWrite} tuples
296
+ * @returns List of {@link PendingWrite} tuples of the form `[channelKey, value]`.
297
+ * @internal
298
+ */
268
299
  _updateAsTuples() {
269
300
  if (this.update &&
270
301
  typeof this.update === "object" &&
@@ -288,7 +319,7 @@ class Command {
288
319
  serializedGoto = this.goto.toJSON();
289
320
  }
290
321
  else {
291
- serializedGoto = this.goto.map((innerGoto) => {
322
+ serializedGoto = this.goto?.map((innerGoto) => {
292
323
  if (typeof innerGoto === "string") {
293
324
  return innerGoto;
294
325
  }
@@ -311,8 +342,63 @@ Object.defineProperty(Command, "PARENT", {
311
342
  writable: true,
312
343
  value: "__parent__"
313
344
  });
345
+ /**
346
+ * A type guard to check if the given value is a {@link Command}.
347
+ *
348
+ * Useful for type narrowing when working with the {@link Command} object.
349
+ *
350
+ * @param x - The value to check.
351
+ * @returns `true` if the value is a {@link Command}, `false` otherwise.
352
+ */
314
353
  function isCommand(x) {
315
- return typeof x === "object" && !!x && x.lg_name === "Command";
354
+ // eslint-disable-next-line no-instanceof/no-instanceof
355
+ return x instanceof Command;
316
356
  }
317
357
  exports.isCommand = isCommand;
358
+ /**
359
+ * A type guard to check if the given value is a {@link CommandParams}.
360
+ *
361
+ * Useful for type narrowing when working with the {@link CommandParams} object.
362
+ *
363
+ * @param x - The value to check.
364
+ * @returns `true` if the value is a {@link CommandParams}, `false` otherwise.
365
+ */
366
+ function isCommandParams(x) {
367
+ if (typeof x !== "object") {
368
+ return false;
369
+ }
370
+ if (x === null || x === undefined) {
371
+ return false;
372
+ }
373
+ if ("update" in x && "resume" in x && "goto" in x) {
374
+ return true;
375
+ }
376
+ return false;
377
+ }
378
+ exports.isCommandParams = isCommandParams;
379
+ function _convertCommandSendTree(x, seen = new Set()) {
380
+ if (x !== undefined && x !== null && typeof x === "object") {
381
+ if (seen.has(x)) {
382
+ throw new Error("Command send tree contains a cycle");
383
+ }
384
+ seen.add(x);
385
+ if (Array.isArray(x)) {
386
+ return x.map((innerX) => _convertCommandSendTree(innerX, new Set(seen)));
387
+ }
388
+ if (isCommand(x) || _isSend(x)) {
389
+ return x;
390
+ }
391
+ if (isCommandParams(x)) {
392
+ return new Command(x);
393
+ }
394
+ if (_isSendInterface(x)) {
395
+ return new Send(x.node, x.args);
396
+ }
397
+ return Object.fromEntries(Object.entries(x).map(([key, value]) => [
398
+ key,
399
+ _convertCommandSendTree(value, seen),
400
+ ]));
401
+ }
402
+ return x;
403
+ }
318
404
  //# sourceMappingURL=constants.js.map
@@ -1,3 +1,4 @@
1
+ import { PendingWrite } from "@langchain/langgraph-checkpoint";
1
2
  /** Special reserved node name denoting the start of a graph. */
2
3
  export declare const START = "__start__";
3
4
  /** Special reserved node name denoting the end of a graph. */
@@ -19,6 +20,7 @@ export declare const CONFIG_KEY_SCRATCHPAD = "__pregel_scratchpad";
19
20
  export declare const CONFIG_KEY_PREVIOUS_STATE = "__pregel_previous";
20
21
  export declare const CONFIG_KEY_CHECKPOINT_ID = "checkpoint_id";
21
22
  export declare const CONFIG_KEY_CHECKPOINT_NS = "checkpoint_ns";
23
+ export declare const CONFIG_KEY_NODE_FINISHED = "__pregel_node_finished";
22
24
  export declare const CONFIG_KEY_CHECKPOINT_MAP = "checkpoint_map";
23
25
  /** Special channel reserved for graph interrupts */
24
26
  export declare const INTERRUPT = "__interrupt__";
@@ -95,9 +97,9 @@ export declare function _isSendInterface(x: unknown): x is SendInterface;
95
97
  * ```
96
98
  */
97
99
  export declare class Send implements SendInterface {
100
+ lg_name: string;
98
101
  node: string;
99
102
  args: any;
100
- lg_name: string;
101
103
  constructor(node: string, args: any);
102
104
  toJSON(): {
103
105
  node: string;
@@ -119,7 +121,8 @@ export type CommandParams<R> = {
119
121
  /**
120
122
  * Graph to send the command to. Supported values are:
121
123
  * - None: the current graph (default)
122
- * - GraphCommand.PARENT: closest parent graph
124
+ * - The specific name of the graph to send the command to
125
+ * - {@link Command.PARENT}: closest parent graph (only supported when returned from a node in a subgraph)
123
126
  */
124
127
  graph?: string;
125
128
  /**
@@ -133,7 +136,7 @@ export type CommandParams<R> = {
133
136
  * - `Send` object (to execute a node with the input provided)
134
137
  * - sequence of `Send` objects
135
138
  */
136
- goto?: string | Send | (string | Send)[];
139
+ goto?: string | SendInterface | (string | SendInterface)[];
137
140
  };
138
141
  /**
139
142
  * One or more commands to update the graph's state and send messages to nodes.
@@ -200,13 +203,38 @@ export type CommandParams<R> = {
200
203
  export declare class Command<R = unknown> {
201
204
  lg_name: string;
202
205
  lc_direct_tool_output: boolean;
206
+ /**
207
+ * Graph to send the command to. Supported values are:
208
+ * - None: the current graph (default)
209
+ * - The specific name of the graph to send the command to
210
+ * - {@link Command.PARENT}: closest parent graph (only supported when returned from a node in a subgraph)
211
+ */
203
212
  graph?: string;
213
+ /**
214
+ * Update to apply to the graph's state as a result of executing the node that is returning the command.
215
+ * Written to the state as if the node had simply returned this value instead of the Command object.
216
+ */
204
217
  update?: Record<string, unknown> | [string, unknown][];
218
+ /**
219
+ * Value to resume execution with. To be used together with {@link interrupt}.
220
+ */
205
221
  resume?: R;
206
- goto: string | Send | (string | Send)[];
222
+ /**
223
+ * Can be one of the following:
224
+ * - name of the node to navigate to next (any node that belongs to the specified `graph`)
225
+ * - sequence of node names to navigate to next
226
+ * - {@link Send} object (to execute a node with the exact input provided in the {@link Send} object)
227
+ * - sequence of {@link Send} objects
228
+ */
229
+ goto?: string | Send | (string | Send)[];
207
230
  static PARENT: string;
208
231
  constructor(args: CommandParams<R>);
209
- _updateAsTuples(): [string, unknown][];
232
+ /**
233
+ * Convert the update field to a list of {@link PendingWrite} tuples
234
+ * @returns List of {@link PendingWrite} tuples of the form `[channelKey, value]`.
235
+ * @internal
236
+ */
237
+ _updateAsTuples(): PendingWrite[];
210
238
  toJSON(): {
211
239
  update: Record<string, unknown> | [string, unknown][] | undefined;
212
240
  resume: R | undefined;
@@ -216,7 +244,24 @@ export declare class Command<R = unknown> {
216
244
  } | (string | {
217
245
  node: string;
218
246
  args: any;
219
- })[];
247
+ })[] | undefined;
220
248
  };
221
249
  }
250
+ /**
251
+ * A type guard to check if the given value is a {@link Command}.
252
+ *
253
+ * Useful for type narrowing when working with the {@link Command} object.
254
+ *
255
+ * @param x - The value to check.
256
+ * @returns `true` if the value is a {@link Command}, `false` otherwise.
257
+ */
222
258
  export declare function isCommand(x: unknown): x is Command;
259
+ /**
260
+ * A type guard to check if the given value is a {@link CommandParams}.
261
+ *
262
+ * Useful for type narrowing when working with the {@link CommandParams} object.
263
+ *
264
+ * @param x - The value to check.
265
+ * @returns `true` if the value is a {@link CommandParams}, `false` otherwise.
266
+ */
267
+ export declare function isCommandParams<R = unknown>(x: unknown): x is CommandParams<R>;
package/dist/constants.js CHANGED
@@ -19,6 +19,7 @@ export const CONFIG_KEY_SCRATCHPAD = "__pregel_scratchpad";
19
19
  export const CONFIG_KEY_PREVIOUS_STATE = "__pregel_previous";
20
20
  export const CONFIG_KEY_CHECKPOINT_ID = "checkpoint_id";
21
21
  export const CONFIG_KEY_CHECKPOINT_NS = "checkpoint_ns";
22
+ export const CONFIG_KEY_NODE_FINISHED = "__pregel_node_finished";
22
23
  // this one is part of public API
23
24
  export const CONFIG_KEY_CHECKPOINT_MAP = "checkpoint_map";
24
25
  /** Special channel reserved for graph interrupts */
@@ -122,24 +123,27 @@ export function _isSendInterface(x) {
122
123
  export class Send {
123
124
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
124
125
  constructor(node, args) {
125
- Object.defineProperty(this, "node", {
126
+ Object.defineProperty(this, "lg_name", {
126
127
  enumerable: true,
127
128
  configurable: true,
128
129
  writable: true,
129
- value: node
130
+ value: "Send"
130
131
  });
131
- Object.defineProperty(this, "args", {
132
+ Object.defineProperty(this, "node", {
132
133
  enumerable: true,
133
134
  configurable: true,
134
135
  writable: true,
135
- value: args
136
+ value: void 0
136
137
  });
137
- Object.defineProperty(this, "lg_name", {
138
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
139
+ Object.defineProperty(this, "args", {
138
140
  enumerable: true,
139
141
  configurable: true,
140
142
  writable: true,
141
- value: "Send"
143
+ value: void 0
142
144
  });
145
+ this.node = node;
146
+ this.args = _convertCommandSendTree(args);
143
147
  }
144
148
  toJSON() {
145
149
  return {
@@ -149,8 +153,8 @@ export class Send {
149
153
  }
150
154
  }
151
155
  export function _isSend(x) {
152
- const operation = x;
153
- return operation !== undefined && operation.lg_name === "Send";
156
+ // eslint-disable-next-line no-instanceof/no-instanceof
157
+ return x instanceof Send;
154
158
  }
155
159
  /**
156
160
  * One or more commands to update the graph's state and send messages to nodes.
@@ -228,24 +232,44 @@ export class Command {
228
232
  writable: true,
229
233
  value: true
230
234
  });
235
+ /**
236
+ * Graph to send the command to. Supported values are:
237
+ * - None: the current graph (default)
238
+ * - The specific name of the graph to send the command to
239
+ * - {@link Command.PARENT}: closest parent graph (only supported when returned from a node in a subgraph)
240
+ */
231
241
  Object.defineProperty(this, "graph", {
232
242
  enumerable: true,
233
243
  configurable: true,
234
244
  writable: true,
235
245
  value: void 0
236
246
  });
247
+ /**
248
+ * Update to apply to the graph's state as a result of executing the node that is returning the command.
249
+ * Written to the state as if the node had simply returned this value instead of the Command object.
250
+ */
237
251
  Object.defineProperty(this, "update", {
238
252
  enumerable: true,
239
253
  configurable: true,
240
254
  writable: true,
241
255
  value: void 0
242
256
  });
257
+ /**
258
+ * Value to resume execution with. To be used together with {@link interrupt}.
259
+ */
243
260
  Object.defineProperty(this, "resume", {
244
261
  enumerable: true,
245
262
  configurable: true,
246
263
  writable: true,
247
264
  value: void 0
248
265
  });
266
+ /**
267
+ * Can be one of the following:
268
+ * - name of the node to navigate to next (any node that belongs to the specified `graph`)
269
+ * - sequence of node names to navigate to next
270
+ * - {@link Send} object (to execute a node with the exact input provided in the {@link Send} object)
271
+ * - sequence of {@link Send} objects
272
+ */
249
273
  Object.defineProperty(this, "goto", {
250
274
  enumerable: true,
251
275
  configurable: true,
@@ -256,9 +280,16 @@ export class Command {
256
280
  this.graph = args.graph;
257
281
  this.update = args.update;
258
282
  if (args.goto) {
259
- this.goto = Array.isArray(args.goto) ? args.goto : [args.goto];
283
+ this.goto = Array.isArray(args.goto)
284
+ ? _convertCommandSendTree(args.goto)
285
+ : [_convertCommandSendTree(args.goto)];
260
286
  }
261
287
  }
288
+ /**
289
+ * Convert the update field to a list of {@link PendingWrite} tuples
290
+ * @returns List of {@link PendingWrite} tuples of the form `[channelKey, value]`.
291
+ * @internal
292
+ */
262
293
  _updateAsTuples() {
263
294
  if (this.update &&
264
295
  typeof this.update === "object" &&
@@ -282,7 +313,7 @@ export class Command {
282
313
  serializedGoto = this.goto.toJSON();
283
314
  }
284
315
  else {
285
- serializedGoto = this.goto.map((innerGoto) => {
316
+ serializedGoto = this.goto?.map((innerGoto) => {
286
317
  if (typeof innerGoto === "string") {
287
318
  return innerGoto;
288
319
  }
@@ -304,7 +335,61 @@ Object.defineProperty(Command, "PARENT", {
304
335
  writable: true,
305
336
  value: "__parent__"
306
337
  });
338
+ /**
339
+ * A type guard to check if the given value is a {@link Command}.
340
+ *
341
+ * Useful for type narrowing when working with the {@link Command} object.
342
+ *
343
+ * @param x - The value to check.
344
+ * @returns `true` if the value is a {@link Command}, `false` otherwise.
345
+ */
307
346
  export function isCommand(x) {
308
- return typeof x === "object" && !!x && x.lg_name === "Command";
347
+ // eslint-disable-next-line no-instanceof/no-instanceof
348
+ return x instanceof Command;
349
+ }
350
+ /**
351
+ * A type guard to check if the given value is a {@link CommandParams}.
352
+ *
353
+ * Useful for type narrowing when working with the {@link CommandParams} object.
354
+ *
355
+ * @param x - The value to check.
356
+ * @returns `true` if the value is a {@link CommandParams}, `false` otherwise.
357
+ */
358
+ export function isCommandParams(x) {
359
+ if (typeof x !== "object") {
360
+ return false;
361
+ }
362
+ if (x === null || x === undefined) {
363
+ return false;
364
+ }
365
+ if ("update" in x && "resume" in x && "goto" in x) {
366
+ return true;
367
+ }
368
+ return false;
369
+ }
370
+ function _convertCommandSendTree(x, seen = new Set()) {
371
+ if (x !== undefined && x !== null && typeof x === "object") {
372
+ if (seen.has(x)) {
373
+ throw new Error("Command send tree contains a cycle");
374
+ }
375
+ seen.add(x);
376
+ if (Array.isArray(x)) {
377
+ return x.map((innerX) => _convertCommandSendTree(innerX, new Set(seen)));
378
+ }
379
+ if (isCommand(x) || _isSend(x)) {
380
+ return x;
381
+ }
382
+ if (isCommandParams(x)) {
383
+ return new Command(x);
384
+ }
385
+ if (_isSendInterface(x)) {
386
+ return new Send(x.node, x.args);
387
+ }
388
+ return Object.fromEntries(Object.entries(x).map(([key, value]) => [
389
+ key,
390
+ _convertCommandSendTree(value, seen),
391
+ ]));
392
+ }
393
+ return x;
309
394
  }
310
395
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAChE,MAAM,CAAC,MAAM,KAAK,GAAG,WAAW,CAAC;AACjC,8DAA8D;AAC9D,MAAM,CAAC,MAAM,GAAG,GAAG,SAAS,CAAC;AAC7B,MAAM,CAAC,MAAM,KAAK,GAAG,WAAW,CAAC;AACjC,MAAM,CAAC,MAAM,IAAI,GAAG,UA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SAAS,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE;YAC9B,OAAO,CAAC,CAAC;SACV;QAED,IAAI,eAAe,CAAC,CAAC,CAAC,EAAE;YACtB,OAAO,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC;SACvB;QAED,IAAI,gBAAgB,CAAC,CAAC,CAAC,EAAE;YACvB,OAAO,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;SACjC;QAED,OAAO,MAAM,CAAC,WAAW,CACvB,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC;YACtC,GAAG;YACH,uBAAuB,CAAC,KAAK,EAAE,IAAI,CAAC;SACrC,CAAC,CACH,CAAC;KACH;IACD,OAAO,CAAC,CAAC;AACX,CAAC"}
@@ -33,7 +33,7 @@ export type AddNodeOptions = {
33
33
  subgraphs?: Pregel<any, any>[];
34
34
  ends?: string[];
35
35
  };
36
- export declare class Graph<N extends string = typeof END, RunInput = any, RunOutput = any, NodeSpecType extends NodeSpec<RunInput, RunOutput> = NodeSpec<RunInput, RunOutput>, C extends StateDefinition = StateDefinition> {
36
+ export declare class Graph<N extends string = typeof START | typeof END, RunInput = any, RunOutput = any, NodeSpecType extends NodeSpec<RunInput, RunOutput> = NodeSpec<RunInput, RunOutput>, C extends StateDefinition = StateDefinition> {
37
37
  nodes: Record<N, NodeSpecType>;
38
38
  edges: Set<[N | typeof START, N | typeof END]>;
39
39
  branches: Record<string, Record<string, Branch<RunInput, N, any>>>;