@langchain/langgraph 0.3.0 → 0.3.2
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/func/index.cjs +10 -5
- package/dist/func/index.d.ts +3 -3
- package/dist/func/index.js +10 -5
- package/dist/func/index.js.map +1 -1
- package/dist/graph/messages_annotation.cjs +2 -2
- package/dist/graph/messages_annotation.d.ts +2 -2
- package/dist/graph/messages_annotation.js +1 -1
- package/dist/graph/messages_annotation.js.map +1 -1
- package/dist/graph/state.cjs +46 -21
- package/dist/graph/state.d.ts +22 -15
- package/dist/graph/state.js +46 -21
- package/dist/graph/state.js.map +1 -1
- package/dist/graph/zod/index.cjs +5 -3
- package/dist/graph/zod/index.d.ts +2 -1
- package/dist/graph/zod/index.js +2 -1
- package/dist/graph/zod/index.js.map +1 -1
- package/dist/graph/zod/meta.cjs +180 -0
- package/dist/graph/zod/meta.d.ts +110 -0
- package/dist/graph/zod/meta.js +175 -0
- package/dist/graph/zod/meta.js.map +1 -0
- package/dist/graph/zod/plugin.cjs +30 -27
- package/dist/graph/zod/plugin.d.ts +16 -3
- package/dist/graph/zod/plugin.js +31 -28
- package/dist/graph/zod/plugin.js.map +1 -1
- package/dist/graph/zod/schema.cjs +45 -19
- package/dist/graph/zod/schema.d.ts +7 -8
- package/dist/graph/zod/schema.js +45 -19
- package/dist/graph/zod/schema.js.map +1 -1
- package/dist/graph/zod/zod-registry.cjs +49 -0
- package/dist/graph/zod/zod-registry.d.ts +24 -0
- package/dist/graph/zod/zod-registry.js +45 -0
- package/dist/graph/zod/zod-registry.js.map +1 -0
- package/dist/prebuilt/react_agent_executor.d.ts +3 -3
- package/dist/pregel/types.d.ts +1 -1
- package/dist/web.d.ts +1 -1
- package/dist/web.js.map +1 -1
- package/package.json +7 -7
- package/dist/graph/zod/state.cjs +0 -135
- package/dist/graph/zod/state.d.ts +0 -39
- package/dist/graph/zod/state.js +0 -125
- package/dist/graph/zod/state.js.map +0 -1
package/dist/func/index.cjs
CHANGED
|
@@ -59,18 +59,23 @@ const write_js_1 = require("../pregel/write.cjs");
|
|
|
59
59
|
* ```
|
|
60
60
|
*/
|
|
61
61
|
function task(optionsOrName, func) {
|
|
62
|
-
const
|
|
63
|
-
? { name: optionsOrName, retry: undefined,
|
|
62
|
+
const options = typeof optionsOrName === "string"
|
|
63
|
+
? { name: optionsOrName, retry: undefined, cachePolicy: undefined }
|
|
64
64
|
: optionsOrName;
|
|
65
|
+
const { name, retry } = options;
|
|
65
66
|
if ((0, utils_js_1.isAsyncGeneratorFunction)(func) || (0, utils_js_1.isGeneratorFunction)(func)) {
|
|
66
67
|
throw new Error("Generators are disallowed as tasks. For streaming responses, use config.write.");
|
|
67
68
|
}
|
|
69
|
+
const cachePolicy = options.cachePolicy ??
|
|
70
|
+
// `cache` was mistakingly used as an alias for `cachePolicy` in v0.3.x,
|
|
71
|
+
// TODO: remove in 1.x
|
|
72
|
+
("cache" in options ? options.cache : undefined);
|
|
68
73
|
let cache;
|
|
69
|
-
if (typeof
|
|
70
|
-
cache =
|
|
74
|
+
if (typeof cachePolicy === "boolean") {
|
|
75
|
+
cache = cachePolicy ? {} : undefined;
|
|
71
76
|
}
|
|
72
77
|
else {
|
|
73
|
-
cache =
|
|
78
|
+
cache = cachePolicy;
|
|
74
79
|
}
|
|
75
80
|
return (...args) => {
|
|
76
81
|
return (0, call_js_1.call)({ func, name, retry, cache }, ...args);
|
package/dist/func/index.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ import { EntrypointFinal, EntrypointReturnT, EntrypointFinalSaveT, EntrypointFun
|
|
|
9
9
|
/**
|
|
10
10
|
* Options for the {@link task} function
|
|
11
11
|
*/
|
|
12
|
-
export
|
|
12
|
+
export interface TaskOptions {
|
|
13
13
|
/**
|
|
14
14
|
* The name of the task, analogous to the node name in {@link StateGraph}.
|
|
15
15
|
*/
|
|
@@ -22,8 +22,8 @@ export type TaskOptions = {
|
|
|
22
22
|
/**
|
|
23
23
|
* The cache policy for the task. Configures how the task should be cached.
|
|
24
24
|
*/
|
|
25
|
-
|
|
26
|
-
}
|
|
25
|
+
cachePolicy?: CachePolicy;
|
|
26
|
+
}
|
|
27
27
|
/**
|
|
28
28
|
* Define a LangGraph task using the `task` function.
|
|
29
29
|
*
|
package/dist/func/index.js
CHANGED
|
@@ -54,18 +54,23 @@ import { ChannelWrite, PASSTHROUGH } from "../pregel/write.js";
|
|
|
54
54
|
* ```
|
|
55
55
|
*/
|
|
56
56
|
export function task(optionsOrName, func) {
|
|
57
|
-
const
|
|
58
|
-
? { name: optionsOrName, retry: undefined,
|
|
57
|
+
const options = typeof optionsOrName === "string"
|
|
58
|
+
? { name: optionsOrName, retry: undefined, cachePolicy: undefined }
|
|
59
59
|
: optionsOrName;
|
|
60
|
+
const { name, retry } = options;
|
|
60
61
|
if (isAsyncGeneratorFunction(func) || isGeneratorFunction(func)) {
|
|
61
62
|
throw new Error("Generators are disallowed as tasks. For streaming responses, use config.write.");
|
|
62
63
|
}
|
|
64
|
+
const cachePolicy = options.cachePolicy ??
|
|
65
|
+
// `cache` was mistakingly used as an alias for `cachePolicy` in v0.3.x,
|
|
66
|
+
// TODO: remove in 1.x
|
|
67
|
+
("cache" in options ? options.cache : undefined);
|
|
63
68
|
let cache;
|
|
64
|
-
if (typeof
|
|
65
|
-
cache =
|
|
69
|
+
if (typeof cachePolicy === "boolean") {
|
|
70
|
+
cache = cachePolicy ? {} : undefined;
|
|
66
71
|
}
|
|
67
72
|
else {
|
|
68
|
-
cache =
|
|
73
|
+
cache = cachePolicy;
|
|
69
74
|
}
|
|
70
75
|
return (...args) => {
|
|
71
76
|
return call({ func, name, retry, cache }, ...args);
|
package/dist/func/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/func/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,kCAAkC,EAAE,MAAM,4BAA4B,CAAC;AAChF,OAAO,EAAE,MAAM,EA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yB,CAAW,CAAC;AACpE,CAAC"}
|
|
@@ -5,7 +5,7 @@ exports.MessagesZodState = exports.MessagesAnnotation = void 0;
|
|
|
5
5
|
const zod_1 = require("zod");
|
|
6
6
|
const annotation_js_1 = require("./annotation.cjs");
|
|
7
7
|
const message_js_1 = require("./message.cjs");
|
|
8
|
-
const
|
|
8
|
+
const meta_js_1 = require("./zod/meta.cjs");
|
|
9
9
|
/**
|
|
10
10
|
* Prebuilt state annotation that combines returned messages.
|
|
11
11
|
* Can handle standard messages and special modifiers like {@link RemoveMessage}
|
|
@@ -87,7 +87,7 @@ exports.MessagesAnnotation = annotation_js_1.Annotation.Root({
|
|
|
87
87
|
* ```
|
|
88
88
|
*/
|
|
89
89
|
exports.MessagesZodState = zod_1.z.object({
|
|
90
|
-
messages: (0,
|
|
90
|
+
messages: (0, meta_js_1.withLangGraph)(zod_1.z.custom(), {
|
|
91
91
|
reducer: {
|
|
92
92
|
schema: zod_1.z.custom(),
|
|
93
93
|
fn: message_js_1.messagesStateReducer,
|
|
@@ -79,9 +79,9 @@ export declare const MessagesAnnotation: import("./annotation.js").AnnotationRoo
|
|
|
79
79
|
* ```
|
|
80
80
|
*/
|
|
81
81
|
export declare const MessagesZodState: z.ZodObject<{
|
|
82
|
-
messages: z.ZodType<BaseMessage[], z.ZodTypeDef, Messages
|
|
82
|
+
messages: import("./zod/meta.js").ReducedZodChannel<z.ZodType<BaseMessage[], z.ZodTypeDef, BaseMessage[]>, import("@langchain/core/utils/types").InteropZodType<Messages>>;
|
|
83
83
|
}, "strip", z.ZodTypeAny, {
|
|
84
84
|
messages: BaseMessage[];
|
|
85
85
|
}, {
|
|
86
|
-
messages:
|
|
86
|
+
messages: BaseMessage[];
|
|
87
87
|
}>;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import { Annotation } from "./annotation.js";
|
|
4
4
|
import { messagesStateReducer } from "./message.js";
|
|
5
|
-
import { withLangGraph } from "./zod/
|
|
5
|
+
import { withLangGraph } from "./zod/meta.js";
|
|
6
6
|
/**
|
|
7
7
|
* Prebuilt state annotation that combines returned messages.
|
|
8
8
|
* Can handle standard messages and special modifiers like {@link RemoveMessage}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messages_annotation.js","sourceRoot":"","sources":["../../src/graph/messages_annotation.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAG1C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAY,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"messages_annotation.js","sourceRoot":"","sources":["../../src/graph/messages_annotation.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAG1C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAY,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAE9C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,UAAU,CAAC,IAAI,CAAC;IAChD,QAAQ,EAAE,UAAU,CAA0B;QAC5C,OAAO,EAAE,oBAAoB;QAC7B,OAAO,EAAE,GAAG,EAAE,CAAC,EAAE;KAClB,CAAC;CACH,CAAC,CAAC;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IACvC,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC,MAAM,EAAiB,EAAE;QACjD,OAAO,EAAE;YACP,MAAM,EAAE,CAAC,CAAC,MAAM,EAAY;YAC5B,EAAE,EAAE,oBAAoB;SACzB;QACD,eAAe,EAAE;YACf,cAAc,EAAE,UAAU;SAC3B;QACD,OAAO,EAAE,GAAG,EAAE,CAAC,EAAE;KAClB,CAAC;CACH,CAAC,CAAC"}
|
package/dist/graph/state.cjs
CHANGED
|
@@ -4,6 +4,7 @@ exports.CompiledStateGraph = exports.StateGraph = void 0;
|
|
|
4
4
|
exports.typedNode = typedNode;
|
|
5
5
|
/* eslint-disable @typescript-eslint/no-use-before-define */
|
|
6
6
|
const runnables_1 = require("@langchain/core/runnables");
|
|
7
|
+
const types_1 = require("@langchain/core/utils/types");
|
|
7
8
|
const base_js_1 = require("../channels/base.cjs");
|
|
8
9
|
const graph_js_1 = require("./graph.cjs");
|
|
9
10
|
const write_js_1 = require("../pregel/write.cjs");
|
|
@@ -16,8 +17,8 @@ const errors_js_1 = require("../errors.cjs");
|
|
|
16
17
|
const annotation_js_1 = require("./annotation.cjs");
|
|
17
18
|
const base_js_2 = require("../managed/base.cjs");
|
|
18
19
|
const subgraph_js_1 = require("../pregel/utils/subgraph.cjs");
|
|
19
|
-
const state_js_1 = require("./zod/state.cjs");
|
|
20
20
|
const last_value_js_1 = require("../channels/last_value.cjs");
|
|
21
|
+
const meta_js_1 = require("./zod/meta.cjs");
|
|
21
22
|
const ROOT = "__root__";
|
|
22
23
|
const PartialStateSchema = Symbol.for("langgraph.state.partial");
|
|
23
24
|
/**
|
|
@@ -150,6 +151,13 @@ class StateGraph extends graph_js_1.Graph {
|
|
|
150
151
|
writable: true,
|
|
151
152
|
value: new Map()
|
|
152
153
|
});
|
|
154
|
+
/** @internal */
|
|
155
|
+
Object.defineProperty(this, "_metaRegistry", {
|
|
156
|
+
enumerable: true,
|
|
157
|
+
configurable: true,
|
|
158
|
+
writable: true,
|
|
159
|
+
value: meta_js_1.schemaMetaRegistry
|
|
160
|
+
});
|
|
153
161
|
/** @internal Used only for typing. */
|
|
154
162
|
Object.defineProperty(this, "_configSchema", {
|
|
155
163
|
enumerable: true,
|
|
@@ -165,9 +173,13 @@ class StateGraph extends graph_js_1.Graph {
|
|
|
165
173
|
value: void 0
|
|
166
174
|
});
|
|
167
175
|
if (isZodStateGraphArgsWithStateSchema(fields)) {
|
|
168
|
-
const stateDef =
|
|
169
|
-
const inputDef = fields.input != null
|
|
170
|
-
|
|
176
|
+
const stateDef = this._metaRegistry.getChannelsForSchema(fields.state);
|
|
177
|
+
const inputDef = fields.input != null
|
|
178
|
+
? this._metaRegistry.getChannelsForSchema(fields.input)
|
|
179
|
+
: stateDef;
|
|
180
|
+
const outputDef = fields.output != null
|
|
181
|
+
? this._metaRegistry.getChannelsForSchema(fields.output)
|
|
182
|
+
: stateDef;
|
|
171
183
|
this._schemaDefinition = stateDef;
|
|
172
184
|
this._schemaRuntimeDefinition = fields.state;
|
|
173
185
|
this._inputDefinition = inputDef;
|
|
@@ -175,8 +187,8 @@ class StateGraph extends graph_js_1.Graph {
|
|
|
175
187
|
this._outputDefinition = outputDef;
|
|
176
188
|
this._outputRuntimeDefinition = fields.output ?? fields.state;
|
|
177
189
|
}
|
|
178
|
-
else if ((0,
|
|
179
|
-
const stateDef =
|
|
190
|
+
else if ((0, types_1.isInteropZodObject)(fields)) {
|
|
191
|
+
const stateDef = this._metaRegistry.getChannelsForSchema(fields);
|
|
180
192
|
this._schemaDefinition = stateDef;
|
|
181
193
|
this._schemaRuntimeDefinition = fields;
|
|
182
194
|
this._inputDefinition = stateDef;
|
|
@@ -212,8 +224,8 @@ class StateGraph extends graph_js_1.Graph {
|
|
|
212
224
|
this._addSchema(this._schemaDefinition);
|
|
213
225
|
this._addSchema(this._inputDefinition);
|
|
214
226
|
this._addSchema(this._outputDefinition);
|
|
215
|
-
if ((0,
|
|
216
|
-
this._configRuntimeSchema = configSchema
|
|
227
|
+
if ((0, types_1.isInteropZodObject)(configSchema)) {
|
|
228
|
+
this._configRuntimeSchema = configSchema;
|
|
217
229
|
}
|
|
218
230
|
}
|
|
219
231
|
get allEdges() {
|
|
@@ -287,8 +299,8 @@ class StateGraph extends graph_js_1.Graph {
|
|
|
287
299
|
}
|
|
288
300
|
let inputSpec = this._schemaDefinition;
|
|
289
301
|
if (options?.input !== undefined) {
|
|
290
|
-
if ((0,
|
|
291
|
-
inputSpec =
|
|
302
|
+
if ((0, types_1.isInteropZodObject)(options.input)) {
|
|
303
|
+
inputSpec = this._metaRegistry.getChannelsForSchema(options.input);
|
|
292
304
|
}
|
|
293
305
|
else if (options.input.spec !== undefined) {
|
|
294
306
|
inputSpec = options.input.spec;
|
|
@@ -461,6 +473,16 @@ function _getChannels(schema) {
|
|
|
461
473
|
* instance method.
|
|
462
474
|
*/
|
|
463
475
|
class CompiledStateGraph extends graph_js_1.CompiledGraph {
|
|
476
|
+
constructor() {
|
|
477
|
+
super(...arguments);
|
|
478
|
+
/** @internal */
|
|
479
|
+
Object.defineProperty(this, "_metaRegistry", {
|
|
480
|
+
enumerable: true,
|
|
481
|
+
configurable: true,
|
|
482
|
+
writable: true,
|
|
483
|
+
value: meta_js_1.schemaMetaRegistry
|
|
484
|
+
});
|
|
485
|
+
}
|
|
464
486
|
attachNode(key, node) {
|
|
465
487
|
let outputKeys;
|
|
466
488
|
if (key === constants_js_1.START) {
|
|
@@ -643,28 +665,31 @@ class CompiledStateGraph extends graph_js_1.CompiledGraph {
|
|
|
643
665
|
const apply = (schema) => {
|
|
644
666
|
if (schema == null)
|
|
645
667
|
return undefined;
|
|
646
|
-
return
|
|
668
|
+
return this._metaRegistry.getExtendedChannelSchemas(schema, {
|
|
669
|
+
withReducerSchema: true,
|
|
670
|
+
});
|
|
647
671
|
};
|
|
648
|
-
if ((0,
|
|
672
|
+
if ((0, types_1.isInteropZodObject)(input))
|
|
649
673
|
return apply(input);
|
|
650
|
-
if (input === PartialStateSchema)
|
|
651
|
-
return apply(schema)
|
|
674
|
+
if (input === PartialStateSchema) {
|
|
675
|
+
return (0, types_1.interopZodObjectPartial)(apply(schema));
|
|
676
|
+
}
|
|
652
677
|
return undefined;
|
|
653
678
|
})();
|
|
654
679
|
if ((0, constants_js_1.isCommand)(input)) {
|
|
655
680
|
const parsedInput = input;
|
|
656
681
|
if (input.update && schema != null)
|
|
657
|
-
parsedInput.update =
|
|
682
|
+
parsedInput.update = (0, types_1.interopParse)(schema, input.update);
|
|
658
683
|
return parsedInput;
|
|
659
684
|
}
|
|
660
685
|
if (schema != null)
|
|
661
|
-
return
|
|
686
|
+
return (0, types_1.interopParse)(schema, input);
|
|
662
687
|
return input;
|
|
663
688
|
}
|
|
664
689
|
async _validateConfigurable(config) {
|
|
665
690
|
const configSchema = this.builder._configRuntimeSchema;
|
|
666
|
-
if ((0,
|
|
667
|
-
|
|
691
|
+
if ((0, types_1.isInteropZodObject)(configSchema))
|
|
692
|
+
(0, types_1.interopParse)(configSchema, config);
|
|
668
693
|
return config;
|
|
669
694
|
}
|
|
670
695
|
}
|
|
@@ -704,13 +729,13 @@ function isZodStateGraphArgsWithStateSchema(value) {
|
|
|
704
729
|
if (typeof value !== "object" || value == null) {
|
|
705
730
|
return false;
|
|
706
731
|
}
|
|
707
|
-
if (!("state" in value) || !(0,
|
|
732
|
+
if (!("state" in value) || !(0, types_1.isInteropZodObject)(value.state)) {
|
|
708
733
|
return false;
|
|
709
734
|
}
|
|
710
|
-
if ("input" in value && !(0,
|
|
735
|
+
if ("input" in value && !(0, types_1.isInteropZodObject)(value.input)) {
|
|
711
736
|
return false;
|
|
712
737
|
}
|
|
713
|
-
if ("output" in value && !(0,
|
|
738
|
+
if ("output" in value && !(0, types_1.isInteropZodObject)(value.output)) {
|
|
714
739
|
return false;
|
|
715
740
|
}
|
|
716
741
|
return true;
|
package/dist/graph/state.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { RunnableLike } from "@langchain/core/runnables";
|
|
2
2
|
import { All, type BaseCache, BaseCheckpointSaver, BaseStore } from "@langchain/langgraph-checkpoint";
|
|
3
|
+
import { type InteropZodObject } from "@langchain/core/utils/types";
|
|
3
4
|
import { BaseChannel } from "../channels/base.js";
|
|
4
5
|
import { CompiledGraph, Graph, Branch, AddNodeOptions, NodeSpec } from "./graph.js";
|
|
5
6
|
import { Command, END, START } from "../constants.js";
|
|
@@ -7,7 +8,7 @@ import { AnnotationRoot, SingleReducer, StateDefinition, StateType, UpdateType }
|
|
|
7
8
|
import type { CachePolicy, RetryPolicy } from "../pregel/utils/index.js";
|
|
8
9
|
import { ManagedValueSpec } from "../managed/base.js";
|
|
9
10
|
import type { LangGraphRunnableConfig } from "../pregel/runnable_types.js";
|
|
10
|
-
import {
|
|
11
|
+
import { type SchemaMetaRegistry, InteropZodToStateDefinition } from "./zod/meta.js";
|
|
11
12
|
export type ChannelReducers<Channels extends object> = {
|
|
12
13
|
[K in keyof Channels]: SingleReducer<Channels[K], any>;
|
|
13
14
|
};
|
|
@@ -26,7 +27,7 @@ export type StateGraphNodeSpec<RunInput, RunOutput> = NodeSpec<RunInput, RunOutp
|
|
|
26
27
|
export type StateGraphAddNodeOptions<Nodes extends string = string> = {
|
|
27
28
|
retryPolicy?: RetryPolicy;
|
|
28
29
|
cachePolicy?: CachePolicy | boolean;
|
|
29
|
-
input?: AnnotationRoot<any> |
|
|
30
|
+
input?: AnnotationRoot<any> | InteropZodObject;
|
|
30
31
|
} & AddNodeOptions<Nodes>;
|
|
31
32
|
export type StateGraphArgsWithStateSchema<SD extends StateDefinition, I extends StateDefinition, O extends StateDefinition> = {
|
|
32
33
|
stateSchema: AnnotationRoot<SD>;
|
|
@@ -37,13 +38,13 @@ export type StateGraphArgsWithInputOutputSchemas<SD extends StateDefinition, O e
|
|
|
37
38
|
input: AnnotationRoot<SD>;
|
|
38
39
|
output: AnnotationRoot<O>;
|
|
39
40
|
};
|
|
40
|
-
type ZodStateGraphArgsWithStateSchema<SD extends
|
|
41
|
+
type ZodStateGraphArgsWithStateSchema<SD extends InteropZodObject, I extends SDZod, O extends SDZod> = {
|
|
41
42
|
state: SD;
|
|
42
43
|
input?: I;
|
|
43
44
|
output?: O;
|
|
44
45
|
};
|
|
45
|
-
type SDZod = StateDefinition |
|
|
46
|
-
type ToStateDefinition<T> = T extends
|
|
46
|
+
type SDZod = StateDefinition | InteropZodObject;
|
|
47
|
+
type ToStateDefinition<T> = T extends InteropZodObject ? InteropZodToStateDefinition<T> : T extends StateDefinition ? T : never;
|
|
47
48
|
type NodeAction<S, U, C extends SDZod> = RunnableLike<S, U extends object ? U & Record<string, any> : U, // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
48
49
|
LangGraphRunnableConfig<StateType<ToStateDefinition<C>>>>;
|
|
49
50
|
declare const PartialStateSchema: unique symbol;
|
|
@@ -116,27 +117,29 @@ export declare class StateGraph<SD extends SDZod | unknown, S = SD extends SDZod
|
|
|
116
117
|
/** @internal */
|
|
117
118
|
_schemaDefinition: StateDefinition;
|
|
118
119
|
/** @internal */
|
|
119
|
-
_schemaRuntimeDefinition:
|
|
120
|
+
_schemaRuntimeDefinition: InteropZodObject | undefined;
|
|
120
121
|
/** @internal */
|
|
121
122
|
_inputDefinition: I;
|
|
122
123
|
/** @internal */
|
|
123
|
-
_inputRuntimeDefinition:
|
|
124
|
+
_inputRuntimeDefinition: InteropZodObject | PartialStateSchema | undefined;
|
|
124
125
|
/** @internal */
|
|
125
126
|
_outputDefinition: O;
|
|
126
127
|
/** @internal */
|
|
127
|
-
_outputRuntimeDefinition:
|
|
128
|
+
_outputRuntimeDefinition: InteropZodObject | undefined;
|
|
128
129
|
/**
|
|
129
130
|
* Map schemas to managed values
|
|
130
131
|
* @internal
|
|
131
132
|
*/
|
|
132
133
|
_schemaDefinitions: Map<any, any>;
|
|
134
|
+
/** @internal */
|
|
135
|
+
_metaRegistry: SchemaMetaRegistry;
|
|
133
136
|
/** @internal Used only for typing. */
|
|
134
137
|
_configSchema: ToStateDefinition<C> | undefined;
|
|
135
138
|
/** @internal */
|
|
136
|
-
_configRuntimeSchema:
|
|
139
|
+
_configRuntimeSchema: InteropZodObject | undefined;
|
|
137
140
|
constructor(fields: SD extends StateDefinition ? StateGraphArgsWithInputOutputSchemas<SD, ToStateDefinition<O>> : never, configSchema?: C | AnnotationRoot<ToStateDefinition<C>>);
|
|
138
141
|
constructor(fields: SD extends StateDefinition ? SD | AnnotationRoot<SD> | StateGraphArgs<S> | StateGraphArgsWithStateSchema<SD, ToStateDefinition<I>, ToStateDefinition<O>> : StateGraphArgs<S>, configSchema?: C | AnnotationRoot<ToStateDefinition<C>>);
|
|
139
|
-
constructor(fields: SD extends
|
|
142
|
+
constructor(fields: SD extends InteropZodObject ? SD | ZodStateGraphArgsWithStateSchema<SD, I, O> : never, configSchema?: C | AnnotationRoot<ToStateDefinition<C>>);
|
|
140
143
|
get allEdges(): Set<[string, string]>;
|
|
141
144
|
_addSchema(stateDefinition: SDZod): void;
|
|
142
145
|
addNode<K extends string>(nodes: Record<K, NodeAction<S, U, C>> | [
|
|
@@ -168,6 +171,8 @@ export declare class StateGraph<SD extends SDZod | unknown, S = SD extends SDZod
|
|
|
168
171
|
*/
|
|
169
172
|
export declare class CompiledStateGraph<S, U, N extends string = typeof START, I extends SDZod = StateDefinition, O extends SDZod = StateDefinition, C extends SDZod = StateDefinition> extends CompiledGraph<N, S, U, StateType<ToStateDefinition<C>>, UpdateType<ToStateDefinition<I>>, StateType<ToStateDefinition<O>>> {
|
|
170
173
|
builder: StateGraph<unknown, S, U, N, I, O, C>;
|
|
174
|
+
/** @internal */
|
|
175
|
+
_metaRegistry: SchemaMetaRegistry;
|
|
171
176
|
attachNode(key: typeof START, node?: never): void;
|
|
172
177
|
attachNode(key: N, node: StateGraphNodeSpec<S, U>): void;
|
|
173
178
|
attachEdge(starts: N | N[] | "__start__", end: N | "__end__"): void;
|
|
@@ -177,11 +182,13 @@ export declare class CompiledStateGraph<S, U, N extends string = typeof START, I
|
|
|
177
182
|
protected _validateInput(input: UpdateType<ToStateDefinition<I>>): Promise<UpdateType<ToStateDefinition<I>>>;
|
|
178
183
|
protected _validateConfigurable(config: Partial<LangGraphRunnableConfig["configurable"]>): Promise<LangGraphRunnableConfig["configurable"]>;
|
|
179
184
|
}
|
|
180
|
-
type TypedNodeAction<SD extends StateDefinition, Nodes extends string> =
|
|
181
|
-
export declare function typedNode<SD extends SDZod, Nodes extends string>(_state: SD extends StateDefinition ? AnnotationRoot<SD> : never, _options?: {
|
|
185
|
+
type TypedNodeAction<SD extends StateDefinition, Nodes extends string, C extends StateDefinition = StateDefinition> = RunnableLike<StateType<SD>, UpdateType<SD> | Command<unknown, UpdateType<SD>, Nodes>, LangGraphRunnableConfig<StateType<C>>>;
|
|
186
|
+
export declare function typedNode<SD extends SDZod, Nodes extends string, C extends SDZod = StateDefinition>(_state: SD extends StateDefinition ? AnnotationRoot<SD> : never, _options?: {
|
|
182
187
|
nodes?: Nodes[];
|
|
183
|
-
|
|
184
|
-
|
|
188
|
+
config?: C extends StateDefinition ? AnnotationRoot<C> : never;
|
|
189
|
+
}): (func: TypedNodeAction<ToStateDefinition<SD>, Nodes, ToStateDefinition<C>>, options?: StateGraphAddNodeOptions<Nodes>) => TypedNodeAction<ToStateDefinition<SD>, Nodes, ToStateDefinition<C>>;
|
|
190
|
+
export declare function typedNode<SD extends SDZod, Nodes extends string, C extends SDZod = StateDefinition>(_state: SD extends InteropZodObject ? SD : never, _options?: {
|
|
185
191
|
nodes?: Nodes[];
|
|
186
|
-
|
|
192
|
+
config?: C extends InteropZodObject ? C : never;
|
|
193
|
+
}): (func: TypedNodeAction<ToStateDefinition<SD>, Nodes, ToStateDefinition<C>>, options?: StateGraphAddNodeOptions<Nodes>) => TypedNodeAction<ToStateDefinition<SD>, Nodes, ToStateDefinition<C>>;
|
|
187
194
|
export {};
|
package/dist/graph/state.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-use-before-define */
|
|
2
2
|
import { _coerceToRunnable, Runnable, } from "@langchain/core/runnables";
|
|
3
|
+
import { interopParse, interopZodObjectPartial, isInteropZodObject, } from "@langchain/core/utils/types";
|
|
3
4
|
import { isBaseChannel } from "../channels/base.js";
|
|
4
5
|
import { CompiledGraph, Graph, Branch, } from "./graph.js";
|
|
5
6
|
import { ChannelWrite, PASSTHROUGH, } from "../pregel/write.js";
|
|
@@ -12,8 +13,8 @@ import { InvalidUpdateError, ParentCommand } from "../errors.js";
|
|
|
12
13
|
import { getChannel, } from "./annotation.js";
|
|
13
14
|
import { isConfiguredManagedValue } from "../managed/base.js";
|
|
14
15
|
import { isPregelLike } from "../pregel/utils/subgraph.js";
|
|
15
|
-
import { getChannelsFromZod, applyZodPlugin, isAnyZodObject, } from "./zod/state.js";
|
|
16
16
|
import { LastValueAfterFinish } from "../channels/last_value.js";
|
|
17
|
+
import { schemaMetaRegistry, } from "./zod/meta.js";
|
|
17
18
|
const ROOT = "__root__";
|
|
18
19
|
const PartialStateSchema = Symbol.for("langgraph.state.partial");
|
|
19
20
|
/**
|
|
@@ -146,6 +147,13 @@ export class StateGraph extends Graph {
|
|
|
146
147
|
writable: true,
|
|
147
148
|
value: new Map()
|
|
148
149
|
});
|
|
150
|
+
/** @internal */
|
|
151
|
+
Object.defineProperty(this, "_metaRegistry", {
|
|
152
|
+
enumerable: true,
|
|
153
|
+
configurable: true,
|
|
154
|
+
writable: true,
|
|
155
|
+
value: schemaMetaRegistry
|
|
156
|
+
});
|
|
149
157
|
/** @internal Used only for typing. */
|
|
150
158
|
Object.defineProperty(this, "_configSchema", {
|
|
151
159
|
enumerable: true,
|
|
@@ -161,9 +169,13 @@ export class StateGraph extends Graph {
|
|
|
161
169
|
value: void 0
|
|
162
170
|
});
|
|
163
171
|
if (isZodStateGraphArgsWithStateSchema(fields)) {
|
|
164
|
-
const stateDef =
|
|
165
|
-
const inputDef = fields.input != null
|
|
166
|
-
|
|
172
|
+
const stateDef = this._metaRegistry.getChannelsForSchema(fields.state);
|
|
173
|
+
const inputDef = fields.input != null
|
|
174
|
+
? this._metaRegistry.getChannelsForSchema(fields.input)
|
|
175
|
+
: stateDef;
|
|
176
|
+
const outputDef = fields.output != null
|
|
177
|
+
? this._metaRegistry.getChannelsForSchema(fields.output)
|
|
178
|
+
: stateDef;
|
|
167
179
|
this._schemaDefinition = stateDef;
|
|
168
180
|
this._schemaRuntimeDefinition = fields.state;
|
|
169
181
|
this._inputDefinition = inputDef;
|
|
@@ -171,8 +183,8 @@ export class StateGraph extends Graph {
|
|
|
171
183
|
this._outputDefinition = outputDef;
|
|
172
184
|
this._outputRuntimeDefinition = fields.output ?? fields.state;
|
|
173
185
|
}
|
|
174
|
-
else if (
|
|
175
|
-
const stateDef =
|
|
186
|
+
else if (isInteropZodObject(fields)) {
|
|
187
|
+
const stateDef = this._metaRegistry.getChannelsForSchema(fields);
|
|
176
188
|
this._schemaDefinition = stateDef;
|
|
177
189
|
this._schemaRuntimeDefinition = fields;
|
|
178
190
|
this._inputDefinition = stateDef;
|
|
@@ -208,8 +220,8 @@ export class StateGraph extends Graph {
|
|
|
208
220
|
this._addSchema(this._schemaDefinition);
|
|
209
221
|
this._addSchema(this._inputDefinition);
|
|
210
222
|
this._addSchema(this._outputDefinition);
|
|
211
|
-
if (
|
|
212
|
-
this._configRuntimeSchema = configSchema
|
|
223
|
+
if (isInteropZodObject(configSchema)) {
|
|
224
|
+
this._configRuntimeSchema = configSchema;
|
|
213
225
|
}
|
|
214
226
|
}
|
|
215
227
|
get allEdges() {
|
|
@@ -283,8 +295,8 @@ export class StateGraph extends Graph {
|
|
|
283
295
|
}
|
|
284
296
|
let inputSpec = this._schemaDefinition;
|
|
285
297
|
if (options?.input !== undefined) {
|
|
286
|
-
if (
|
|
287
|
-
inputSpec =
|
|
298
|
+
if (isInteropZodObject(options.input)) {
|
|
299
|
+
inputSpec = this._metaRegistry.getChannelsForSchema(options.input);
|
|
288
300
|
}
|
|
289
301
|
else if (options.input.spec !== undefined) {
|
|
290
302
|
inputSpec = options.input.spec;
|
|
@@ -456,6 +468,16 @@ function _getChannels(schema) {
|
|
|
456
468
|
* instance method.
|
|
457
469
|
*/
|
|
458
470
|
export class CompiledStateGraph extends CompiledGraph {
|
|
471
|
+
constructor() {
|
|
472
|
+
super(...arguments);
|
|
473
|
+
/** @internal */
|
|
474
|
+
Object.defineProperty(this, "_metaRegistry", {
|
|
475
|
+
enumerable: true,
|
|
476
|
+
configurable: true,
|
|
477
|
+
writable: true,
|
|
478
|
+
value: schemaMetaRegistry
|
|
479
|
+
});
|
|
480
|
+
}
|
|
459
481
|
attachNode(key, node) {
|
|
460
482
|
let outputKeys;
|
|
461
483
|
if (key === START) {
|
|
@@ -638,28 +660,31 @@ export class CompiledStateGraph extends CompiledGraph {
|
|
|
638
660
|
const apply = (schema) => {
|
|
639
661
|
if (schema == null)
|
|
640
662
|
return undefined;
|
|
641
|
-
return
|
|
663
|
+
return this._metaRegistry.getExtendedChannelSchemas(schema, {
|
|
664
|
+
withReducerSchema: true,
|
|
665
|
+
});
|
|
642
666
|
};
|
|
643
|
-
if (
|
|
667
|
+
if (isInteropZodObject(input))
|
|
644
668
|
return apply(input);
|
|
645
|
-
if (input === PartialStateSchema)
|
|
646
|
-
return apply(schema)
|
|
669
|
+
if (input === PartialStateSchema) {
|
|
670
|
+
return interopZodObjectPartial(apply(schema));
|
|
671
|
+
}
|
|
647
672
|
return undefined;
|
|
648
673
|
})();
|
|
649
674
|
if (isCommand(input)) {
|
|
650
675
|
const parsedInput = input;
|
|
651
676
|
if (input.update && schema != null)
|
|
652
|
-
parsedInput.update = schema
|
|
677
|
+
parsedInput.update = interopParse(schema, input.update);
|
|
653
678
|
return parsedInput;
|
|
654
679
|
}
|
|
655
680
|
if (schema != null)
|
|
656
|
-
return schema
|
|
681
|
+
return interopParse(schema, input);
|
|
657
682
|
return input;
|
|
658
683
|
}
|
|
659
684
|
async _validateConfigurable(config) {
|
|
660
685
|
const configSchema = this.builder._configRuntimeSchema;
|
|
661
|
-
if (
|
|
662
|
-
configSchema
|
|
686
|
+
if (isInteropZodObject(configSchema))
|
|
687
|
+
interopParse(configSchema, config);
|
|
663
688
|
return config;
|
|
664
689
|
}
|
|
665
690
|
}
|
|
@@ -698,13 +723,13 @@ function isZodStateGraphArgsWithStateSchema(value) {
|
|
|
698
723
|
if (typeof value !== "object" || value == null) {
|
|
699
724
|
return false;
|
|
700
725
|
}
|
|
701
|
-
if (!("state" in value) || !
|
|
726
|
+
if (!("state" in value) || !isInteropZodObject(value.state)) {
|
|
702
727
|
return false;
|
|
703
728
|
}
|
|
704
|
-
if ("input" in value && !
|
|
729
|
+
if ("input" in value && !isInteropZodObject(value.input)) {
|
|
705
730
|
return false;
|
|
706
731
|
}
|
|
707
|
-
if ("output" in value && !
|
|
732
|
+
if ("output" in value && !isInteropZodObject(value.output)) {
|
|
708
733
|
return false;
|
|
709
734
|
}
|
|
710
735
|
return true;
|