@langchain/langgraph 1.0.0-alpha.0 → 1.0.0-alpha.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/CHANGELOG.md +38 -0
- package/dist/channels/any_value.cjs +46 -0
- package/dist/channels/any_value.cjs.map +1 -0
- package/dist/channels/any_value.d.cts +0 -2
- package/dist/channels/any_value.d.cts.map +1 -1
- package/dist/channels/any_value.d.ts +0 -2
- package/dist/channels/any_value.d.ts.map +1 -1
- package/dist/channels/any_value.js +46 -0
- package/dist/channels/any_value.js.map +1 -0
- package/dist/channels/base.cjs +3 -7
- package/dist/channels/base.cjs.map +1 -1
- package/dist/channels/base.d.cts +8 -2
- package/dist/channels/base.d.cts.map +1 -1
- package/dist/channels/base.d.ts +7 -2
- package/dist/channels/base.d.ts.map +1 -1
- package/dist/channels/base.js +3 -7
- package/dist/channels/base.js.map +1 -1
- package/dist/channels/dynamic_barrier_value.cjs +76 -0
- package/dist/channels/dynamic_barrier_value.cjs.map +1 -0
- package/dist/channels/dynamic_barrier_value.d.cts +0 -1
- package/dist/channels/dynamic_barrier_value.d.cts.map +1 -1
- package/dist/channels/dynamic_barrier_value.d.ts +0 -1
- package/dist/channels/dynamic_barrier_value.d.ts.map +1 -1
- package/dist/channels/dynamic_barrier_value.js +76 -0
- package/dist/channels/dynamic_barrier_value.js.map +1 -0
- package/dist/channels/ephemeral_value.cjs +0 -2
- package/dist/channels/ephemeral_value.cjs.map +1 -1
- package/dist/channels/ephemeral_value.d.cts +0 -1
- package/dist/channels/ephemeral_value.d.cts.map +1 -1
- package/dist/channels/ephemeral_value.d.ts +0 -1
- package/dist/channels/ephemeral_value.d.ts.map +1 -1
- package/dist/channels/ephemeral_value.js +0 -2
- package/dist/channels/ephemeral_value.js.map +1 -1
- package/dist/channels/index.cjs +19 -0
- package/dist/channels/index.d.cts +9 -0
- package/dist/channels/index.d.ts +9 -0
- package/dist/channels/index.js +7 -1
- package/dist/channels/last_value.cjs +0 -1
- package/dist/channels/last_value.cjs.map +1 -1
- package/dist/channels/last_value.d.cts +14 -2
- package/dist/channels/last_value.d.cts.map +1 -1
- package/dist/channels/last_value.d.ts +14 -2
- package/dist/channels/last_value.d.ts.map +1 -1
- package/dist/channels/last_value.js +0 -1
- package/dist/channels/last_value.js.map +1 -1
- package/dist/channels/named_barrier_value.cjs +1 -1
- package/dist/channels/named_barrier_value.cjs.map +1 -1
- package/dist/channels/named_barrier_value.d.cts +15 -2
- package/dist/channels/named_barrier_value.d.cts.map +1 -1
- package/dist/channels/named_barrier_value.d.ts +15 -2
- package/dist/channels/named_barrier_value.d.ts.map +1 -1
- package/dist/channels/named_barrier_value.js +1 -2
- package/dist/channels/named_barrier_value.js.map +1 -1
- package/dist/channels/topic.cjs +1 -1
- package/dist/channels/topic.cjs.map +1 -1
- package/dist/channels/topic.d.cts +7 -1
- package/dist/channels/topic.d.cts.map +1 -1
- package/dist/channels/topic.d.ts +7 -1
- package/dist/channels/topic.d.ts.map +1 -1
- package/dist/channels/topic.js +1 -1
- package/dist/channels/topic.js.map +1 -1
- package/dist/constants.cjs +4 -1
- package/dist/constants.cjs.map +1 -1
- package/dist/constants.d.cts +5 -4
- package/dist/constants.d.cts.map +1 -1
- package/dist/constants.d.ts +5 -4
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +4 -1
- package/dist/constants.js.map +1 -1
- package/dist/errors.cjs +2 -1
- package/dist/errors.cjs.map +1 -1
- package/dist/errors.d.cts +2 -1
- package/dist/errors.d.cts.map +1 -1
- package/dist/errors.d.ts +2 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +2 -1
- package/dist/errors.js.map +1 -1
- package/dist/func/index.cjs +3 -0
- package/dist/func/index.cjs.map +1 -1
- package/dist/func/index.d.cts +5 -1
- package/dist/func/index.d.cts.map +1 -1
- package/dist/func/index.d.ts +5 -1
- package/dist/func/index.d.ts.map +1 -1
- package/dist/func/index.js +3 -0
- package/dist/func/index.js.map +1 -1
- package/dist/graph/annotation.d.cts +1 -1
- package/dist/graph/annotation.d.ts +1 -1
- package/dist/graph/graph.cjs +5 -5
- package/dist/graph/graph.cjs.map +1 -1
- package/dist/graph/graph.d.cts +4 -2
- package/dist/graph/graph.d.cts.map +1 -1
- package/dist/graph/graph.d.ts +4 -2
- package/dist/graph/graph.d.ts.map +1 -1
- package/dist/graph/graph.js +1 -1
- package/dist/graph/graph.js.map +1 -1
- package/dist/graph/index.js +2 -2
- package/dist/graph/message.cjs +36 -0
- package/dist/graph/message.cjs.map +1 -1
- package/dist/graph/message.d.cts +21 -1
- package/dist/graph/message.d.cts.map +1 -1
- package/dist/graph/message.d.ts +21 -1
- package/dist/graph/message.d.ts.map +1 -1
- package/dist/graph/message.js +36 -1
- package/dist/graph/message.js.map +1 -1
- package/dist/graph/messages_annotation.d.cts +1 -1
- package/dist/graph/messages_annotation.d.ts +1 -1
- package/dist/graph/state.cjs +15 -18
- package/dist/graph/state.cjs.map +1 -1
- package/dist/graph/state.d.cts +48 -25
- package/dist/graph/state.d.cts.map +1 -1
- package/dist/graph/state.d.ts +47 -24
- package/dist/graph/state.d.ts.map +1 -1
- package/dist/graph/state.js +17 -19
- package/dist/graph/state.js.map +1 -1
- package/dist/graph/zod/plugin.cjs +1 -1
- package/dist/graph/zod/plugin.js +3 -3
- package/dist/graph/zod/plugin.js.map +1 -1
- package/dist/graph/zod/zod-registry.d.cts.map +1 -1
- package/dist/index.cjs +4 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11 -10
- package/dist/index.d.ts +11 -10
- package/dist/index.js +5 -4
- package/dist/index.js.map +1 -1
- package/dist/interrupt.cjs +1 -1
- package/dist/interrupt.cjs.map +1 -1
- package/dist/interrupt.js +1 -1
- package/dist/interrupt.js.map +1 -1
- package/dist/prebuilt/agent_executor.d.cts +1 -1
- package/dist/prebuilt/agent_executor.d.cts.map +1 -1
- package/dist/prebuilt/agent_executor.d.ts +1 -1
- package/dist/prebuilt/agent_executor.d.ts.map +1 -1
- package/dist/prebuilt/react_agent_executor.cjs +1 -1
- package/dist/prebuilt/react_agent_executor.cjs.map +1 -1
- package/dist/prebuilt/react_agent_executor.d.cts +5 -5
- package/dist/prebuilt/react_agent_executor.d.cts.map +1 -1
- package/dist/prebuilt/react_agent_executor.d.ts +4 -4
- package/dist/prebuilt/react_agent_executor.d.ts.map +1 -1
- package/dist/prebuilt/react_agent_executor.js +1 -1
- package/dist/prebuilt/react_agent_executor.js.map +1 -1
- package/dist/pregel/algo.cjs +36 -6
- package/dist/pregel/algo.cjs.map +1 -1
- package/dist/pregel/algo.d.cts +1 -1
- package/dist/pregel/algo.d.cts.map +1 -1
- package/dist/pregel/algo.d.ts +1 -1
- package/dist/pregel/algo.d.ts.map +1 -1
- package/dist/pregel/algo.js +37 -7
- package/dist/pregel/algo.js.map +1 -1
- package/dist/pregel/index.cjs +8 -4
- package/dist/pregel/index.cjs.map +1 -1
- package/dist/pregel/index.d.cts +8 -6
- package/dist/pregel/index.d.cts.map +1 -1
- package/dist/pregel/index.d.ts +8 -6
- package/dist/pregel/index.d.ts.map +1 -1
- package/dist/pregel/index.js +8 -4
- package/dist/pregel/index.js.map +1 -1
- package/dist/pregel/loop.cjs +7 -4
- package/dist/pregel/loop.cjs.map +1 -1
- package/dist/pregel/loop.js +7 -4
- package/dist/pregel/loop.js.map +1 -1
- package/dist/pregel/remote.d.cts +2 -2
- package/dist/pregel/remote.d.cts.map +1 -1
- package/dist/pregel/remote.d.ts +2 -2
- package/dist/pregel/remote.d.ts.map +1 -1
- package/dist/pregel/runnable_types.d.cts +34 -10
- package/dist/pregel/runnable_types.d.cts.map +1 -1
- package/dist/pregel/runnable_types.d.ts +34 -10
- package/dist/pregel/runnable_types.d.ts.map +1 -1
- package/dist/pregel/stream.cjs +3 -3
- package/dist/pregel/stream.cjs.map +1 -1
- package/dist/pregel/stream.js +3 -3
- package/dist/pregel/stream.js.map +1 -1
- package/dist/pregel/types.cjs.map +1 -1
- package/dist/pregel/types.d.cts +10 -7
- package/dist/pregel/types.d.cts.map +1 -1
- package/dist/pregel/types.d.ts +10 -7
- package/dist/pregel/types.d.ts.map +1 -1
- package/dist/pregel/types.js.map +1 -1
- package/dist/pregel/utils/config.cjs +1 -0
- package/dist/pregel/utils/config.cjs.map +1 -1
- package/dist/pregel/utils/config.js +1 -0
- package/dist/pregel/utils/config.js.map +1 -1
- package/dist/ui/stream.cjs.map +1 -1
- package/dist/ui/stream.js.map +1 -1
- package/dist/web.cjs +4 -5
- package/dist/web.d.cts +8 -8
- package/dist/web.d.ts +8 -8
- package/dist/web.js +3 -3
- package/dist/writer.cjs +15 -0
- package/dist/writer.cjs.map +1 -0
- package/dist/writer.d.cts +5 -0
- package/dist/writer.d.cts.map +1 -0
- package/dist/writer.d.ts +5 -0
- package/dist/writer.d.ts.map +1 -0
- package/dist/writer.js +14 -0
- package/dist/writer.js.map +1 -0
- package/package.json +18 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"topic.cjs","names":["BaseChannel","EmptyChannelError"],"sources":["../../src/channels/topic.ts"],"sourcesContent":["import { EmptyChannelError } from \"../errors.js\";\nimport { BaseChannel } from \"./base.js\";\n\n/**\n *
|
|
1
|
+
{"version":3,"file":"topic.cjs","names":["BaseChannel","EmptyChannelError"],"sources":["../../src/channels/topic.ts"],"sourcesContent":["import { EmptyChannelError } from \"../errors.js\";\nimport { BaseChannel } from \"./base.js\";\n\n/**\n * A configurable PubSub Topic.\n */\nexport class Topic<Value> extends BaseChannel<\n Array<Value>,\n Value | Value[],\n [Value[], Value[]]\n> {\n lc_graph_name = \"Topic\";\n\n unique = false;\n\n accumulate = false;\n\n seen: Set<Value>;\n\n values: Value[];\n\n constructor(fields?: {\n /**\n * Whether to only add unique values to the topic. If `true`, only unique values (using reference equality) will be added to the topic.\n */\n unique?: boolean;\n /**\n * Whether to accumulate values across steps. If `false`, the channel will be emptied after each step.\n */\n accumulate?: boolean;\n }) {\n super();\n\n this.unique = fields?.unique ?? this.unique;\n this.accumulate = fields?.accumulate ?? this.accumulate;\n // State\n this.seen = new Set<Value>();\n this.values = [];\n }\n\n public fromCheckpoint(checkpoint?: [Value[], Value[]]) {\n const empty = new Topic<Value>({\n unique: this.unique,\n accumulate: this.accumulate,\n });\n if (typeof checkpoint !== \"undefined\") {\n empty.seen = new Set(checkpoint[0]);\n // eslint-disable-next-line prefer-destructuring\n empty.values = checkpoint[1];\n }\n return empty as this;\n }\n\n public update(values: Array<Value | Value[]>): boolean {\n let updated = false;\n if (!this.accumulate) {\n updated = this.values.length > 0;\n this.values = [];\n }\n const flatValues = values.flat() as Value[];\n if (flatValues.length > 0) {\n if (this.unique) {\n for (const value of flatValues) {\n if (!this.seen.has(value)) {\n updated = true;\n this.seen.add(value);\n this.values.push(value);\n }\n }\n } else {\n updated = true;\n this.values.push(...flatValues);\n }\n }\n return updated;\n }\n\n public get(): Array<Value> {\n if (this.values.length === 0) {\n throw new EmptyChannelError();\n }\n return this.values;\n }\n\n public checkpoint(): [Value[], Value[]] {\n return [[...this.seen], this.values];\n }\n\n isAvailable(): boolean {\n return this.values.length !== 0;\n }\n}\n"],"mappings":";;;;;;;AAMA,IAAa,QAAb,MAAa,cAAqBA,yBAIhC;CACA,gBAAgB;CAEhB,SAAS;CAET,aAAa;CAEb;CAEA;CAEA,YAAY,QAST;AACD;AAEA,OAAK,SAAS,QAAQ,UAAU,KAAK;AACrC,OAAK,aAAa,QAAQ,cAAc,KAAK;AAE7C,OAAK,uBAAO,IAAI;AAChB,OAAK,SAAS;;CAGhB,AAAO,eAAe,YAAiC;EACrD,MAAM,QAAQ,IAAI,MAAa;GAC7B,QAAQ,KAAK;GACb,YAAY,KAAK;;AAEnB,MAAI,OAAO,eAAe,aAAa;AACrC,SAAM,OAAO,IAAI,IAAI,WAAW;AAEhC,SAAM,SAAS,WAAW;;AAE5B,SAAO;;CAGT,AAAO,OAAO,QAAyC;EACrD,IAAI,UAAU;AACd,MAAI,CAAC,KAAK,YAAY;AACpB,aAAU,KAAK,OAAO,SAAS;AAC/B,QAAK,SAAS;;EAEhB,MAAM,aAAa,OAAO;AAC1B,MAAI,WAAW,SAAS,EACtB,KAAI,KAAK,QACP;QAAK,MAAM,SAAS,WAClB,KAAI,CAAC,KAAK,KAAK,IAAI,QAAQ;AACzB,cAAU;AACV,SAAK,KAAK,IAAI;AACd,SAAK,OAAO,KAAK;;SAGhB;AACL,aAAU;AACV,QAAK,OAAO,KAAK,GAAG;;AAGxB,SAAO;;CAGT,AAAO,MAAoB;AACzB,MAAI,KAAK,OAAO,WAAW,EACzB,OAAM,IAAIC;AAEZ,SAAO,KAAK;;CAGd,AAAO,aAAiC;AACtC,SAAO,CAAC,CAAC,GAAG,KAAK,OAAO,KAAK;;CAG/B,cAAuB;AACrB,SAAO,KAAK,OAAO,WAAW"}
|
|
@@ -3,7 +3,7 @@ import { BaseChannel } from "./base.cjs";
|
|
|
3
3
|
//#region src/channels/topic.d.ts
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* A configurable PubSub Topic.
|
|
7
7
|
*/
|
|
8
8
|
declare class Topic<Value> extends BaseChannel<Array<Value>, Value | Value[], [Value[], Value[]]> {
|
|
9
9
|
lc_graph_name: string;
|
|
@@ -12,7 +12,13 @@ declare class Topic<Value> extends BaseChannel<Array<Value>, Value | Value[], [V
|
|
|
12
12
|
seen: Set<Value>;
|
|
13
13
|
values: Value[];
|
|
14
14
|
constructor(fields?: {
|
|
15
|
+
/**
|
|
16
|
+
* Whether to only add unique values to the topic. If `true`, only unique values (using reference equality) will be added to the topic.
|
|
17
|
+
*/
|
|
15
18
|
unique?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Whether to accumulate values across steps. If `false`, the channel will be emptied after each step.
|
|
21
|
+
*/
|
|
16
22
|
accumulate?: boolean;
|
|
17
23
|
});
|
|
18
24
|
fromCheckpoint(checkpoint?: [Value[], Value[]]): this;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"topic.d.cts","names":["BaseChannel","Topic","Value","Array","Set"],"sources":["../../src/channels/topic.d.ts"],"sourcesContent":["import { BaseChannel } from \"./base.js\";\n/**\n *
|
|
1
|
+
{"version":3,"file":"topic.d.cts","names":["BaseChannel","Topic","Value","Array","Set"],"sources":["../../src/channels/topic.d.ts"],"sourcesContent":["import { BaseChannel } from \"./base.js\";\n/**\n * A configurable PubSub Topic.\n */\nexport declare class Topic<Value> extends BaseChannel<Array<Value>, Value | Value[], [\n Value[],\n Value[]\n]> {\n lc_graph_name: string;\n unique: boolean;\n accumulate: boolean;\n seen: Set<Value>;\n values: Value[];\n constructor(fields?: {\n /**\n * Whether to only add unique values to the topic. If `true`, only unique values (using reference equality) will be added to the topic.\n */\n unique?: boolean;\n /**\n * Whether to accumulate values across steps. If `false`, the channel will be emptied after each step.\n */\n accumulate?: boolean;\n });\n fromCheckpoint(checkpoint?: [Value[], Value[]]): this;\n update(values: Array<Value | Value[]>): boolean;\n get(): Array<Value>;\n checkpoint(): [Value[], Value[]];\n isAvailable(): boolean;\n}\n"],"mappings":";;;;;;AAIA;AAA0B,cAALC,KAAK,CAAA,KAAA,CAAA,SAAgBD,WAAhB,CAA4BG,KAA5B,CAAkCD,KAAlC,CAAA,EAA0CA,KAA1C,GAAkDA,KAAlD,EAAA,EAAA,CACtBA,KADwDA,EAAAA,EAExDA,KAFkDC,EAAAA;eAAsBD,EAAAA,MAAAA;QACxEA,EAAAA,OAAAA;YACAA,EAAAA,OAAAA;MAKUA,EAAJE,GAAIF,CAAAA,KAAAA,CAAAA;QAAJE,EACEF,KADFE,EAAAA;aACEF,CAAAA,OAAAA,EAAAA;IAWqBA;;;IACAA,MAAAA,CAAAA,EAAAA,OAAAA;IAAdC;;;IAEAD,UAAAA,CAAAA,EAAAA,OAAAA;;gBAtBuBF,CAAAA,UAAAA,CAAAA,EAAAA,CAmBTE,KAnBSF,EAAAA,EAmBAE,KAnBAF,EAAAA,CAAAA,CAAAA,EAAAA,IAAAA;iBAoBvBG,MAAMD,QAAQA;SACtBC,MAAMD;iBACEA,SAASA"}
|
package/dist/channels/topic.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { BaseChannel } from "./base.js";
|
|
|
3
3
|
//#region src/channels/topic.d.ts
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* A configurable PubSub Topic.
|
|
7
7
|
*/
|
|
8
8
|
declare class Topic<Value> extends BaseChannel<Array<Value>, Value | Value[], [Value[], Value[]]> {
|
|
9
9
|
lc_graph_name: string;
|
|
@@ -12,7 +12,13 @@ declare class Topic<Value> extends BaseChannel<Array<Value>, Value | Value[], [V
|
|
|
12
12
|
seen: Set<Value>;
|
|
13
13
|
values: Value[];
|
|
14
14
|
constructor(fields?: {
|
|
15
|
+
/**
|
|
16
|
+
* Whether to only add unique values to the topic. If `true`, only unique values (using reference equality) will be added to the topic.
|
|
17
|
+
*/
|
|
15
18
|
unique?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Whether to accumulate values across steps. If `false`, the channel will be emptied after each step.
|
|
21
|
+
*/
|
|
16
22
|
accumulate?: boolean;
|
|
17
23
|
});
|
|
18
24
|
fromCheckpoint(checkpoint?: [Value[], Value[]]): this;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"topic.d.ts","names":["BaseChannel","Topic","Value","Array","Set"],"sources":["../../src/channels/topic.d.ts"],"sourcesContent":["import { BaseChannel } from \"./base.js\";\n/**\n *
|
|
1
|
+
{"version":3,"file":"topic.d.ts","names":["BaseChannel","Topic","Value","Array","Set"],"sources":["../../src/channels/topic.d.ts"],"sourcesContent":["import { BaseChannel } from \"./base.js\";\n/**\n * A configurable PubSub Topic.\n */\nexport declare class Topic<Value> extends BaseChannel<Array<Value>, Value | Value[], [\n Value[],\n Value[]\n]> {\n lc_graph_name: string;\n unique: boolean;\n accumulate: boolean;\n seen: Set<Value>;\n values: Value[];\n constructor(fields?: {\n /**\n * Whether to only add unique values to the topic. If `true`, only unique values (using reference equality) will be added to the topic.\n */\n unique?: boolean;\n /**\n * Whether to accumulate values across steps. If `false`, the channel will be emptied after each step.\n */\n accumulate?: boolean;\n });\n fromCheckpoint(checkpoint?: [Value[], Value[]]): this;\n update(values: Array<Value | Value[]>): boolean;\n get(): Array<Value>;\n checkpoint(): [Value[], Value[]];\n isAvailable(): boolean;\n}\n"],"mappings":";;;;;;AAIA;AAA0B,cAALC,KAAK,CAAA,KAAA,CAAA,SAAgBD,WAAhB,CAA4BG,KAA5B,CAAkCD,KAAlC,CAAA,EAA0CA,KAA1C,GAAkDA,KAAlD,EAAA,EAAA,CACtBA,KADwDA,EAAAA,EAExDA,KAFkDC,EAAAA;eAAsBD,EAAAA,MAAAA;QACxEA,EAAAA,OAAAA;YACAA,EAAAA,OAAAA;MAKUA,EAAJE,GAAIF,CAAAA,KAAAA,CAAAA;QAAJE,EACEF,KADFE,EAAAA;aACEF,CAAAA,OAAAA,EAAAA;IAWqBA;;;IACAA,MAAAA,CAAAA,EAAAA,OAAAA;IAAdC;;;IAEAD,UAAAA,CAAAA,EAAAA,OAAAA;;gBAtBuBF,CAAAA,UAAAA,CAAAA,EAAAA,CAmBTE,KAnBSF,EAAAA,EAmBAE,KAnBAF,EAAAA,CAAAA,CAAAA,EAAAA,IAAAA;iBAoBvBG,MAAMD,QAAQA;SACtBC,MAAMD;iBACEA,SAASA"}
|
package/dist/channels/topic.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"topic.js","names":[],"sources":["../../src/channels/topic.ts"],"sourcesContent":["import { EmptyChannelError } from \"../errors.js\";\nimport { BaseChannel } from \"./base.js\";\n\n/**\n *
|
|
1
|
+
{"version":3,"file":"topic.js","names":[],"sources":["../../src/channels/topic.ts"],"sourcesContent":["import { EmptyChannelError } from \"../errors.js\";\nimport { BaseChannel } from \"./base.js\";\n\n/**\n * A configurable PubSub Topic.\n */\nexport class Topic<Value> extends BaseChannel<\n Array<Value>,\n Value | Value[],\n [Value[], Value[]]\n> {\n lc_graph_name = \"Topic\";\n\n unique = false;\n\n accumulate = false;\n\n seen: Set<Value>;\n\n values: Value[];\n\n constructor(fields?: {\n /**\n * Whether to only add unique values to the topic. If `true`, only unique values (using reference equality) will be added to the topic.\n */\n unique?: boolean;\n /**\n * Whether to accumulate values across steps. If `false`, the channel will be emptied after each step.\n */\n accumulate?: boolean;\n }) {\n super();\n\n this.unique = fields?.unique ?? this.unique;\n this.accumulate = fields?.accumulate ?? this.accumulate;\n // State\n this.seen = new Set<Value>();\n this.values = [];\n }\n\n public fromCheckpoint(checkpoint?: [Value[], Value[]]) {\n const empty = new Topic<Value>({\n unique: this.unique,\n accumulate: this.accumulate,\n });\n if (typeof checkpoint !== \"undefined\") {\n empty.seen = new Set(checkpoint[0]);\n // eslint-disable-next-line prefer-destructuring\n empty.values = checkpoint[1];\n }\n return empty as this;\n }\n\n public update(values: Array<Value | Value[]>): boolean {\n let updated = false;\n if (!this.accumulate) {\n updated = this.values.length > 0;\n this.values = [];\n }\n const flatValues = values.flat() as Value[];\n if (flatValues.length > 0) {\n if (this.unique) {\n for (const value of flatValues) {\n if (!this.seen.has(value)) {\n updated = true;\n this.seen.add(value);\n this.values.push(value);\n }\n }\n } else {\n updated = true;\n this.values.push(...flatValues);\n }\n }\n return updated;\n }\n\n public get(): Array<Value> {\n if (this.values.length === 0) {\n throw new EmptyChannelError();\n }\n return this.values;\n }\n\n public checkpoint(): [Value[], Value[]] {\n return [[...this.seen], this.values];\n }\n\n isAvailable(): boolean {\n return this.values.length !== 0;\n }\n}\n"],"mappings":";;;;;;;AAMA,IAAa,QAAb,MAAa,cAAqB,YAIhC;CACA,gBAAgB;CAEhB,SAAS;CAET,aAAa;CAEb;CAEA;CAEA,YAAY,QAST;AACD;AAEA,OAAK,SAAS,QAAQ,UAAU,KAAK;AACrC,OAAK,aAAa,QAAQ,cAAc,KAAK;AAE7C,OAAK,uBAAO,IAAI;AAChB,OAAK,SAAS;;CAGhB,AAAO,eAAe,YAAiC;EACrD,MAAM,QAAQ,IAAI,MAAa;GAC7B,QAAQ,KAAK;GACb,YAAY,KAAK;;AAEnB,MAAI,OAAO,eAAe,aAAa;AACrC,SAAM,OAAO,IAAI,IAAI,WAAW;AAEhC,SAAM,SAAS,WAAW;;AAE5B,SAAO;;CAGT,AAAO,OAAO,QAAyC;EACrD,IAAI,UAAU;AACd,MAAI,CAAC,KAAK,YAAY;AACpB,aAAU,KAAK,OAAO,SAAS;AAC/B,QAAK,SAAS;;EAEhB,MAAM,aAAa,OAAO;AAC1B,MAAI,WAAW,SAAS,EACtB,KAAI,KAAK,QACP;QAAK,MAAM,SAAS,WAClB,KAAI,CAAC,KAAK,KAAK,IAAI,QAAQ;AACzB,cAAU;AACV,SAAK,KAAK,IAAI;AACd,SAAK,OAAO,KAAK;;SAGhB;AACL,aAAU;AACV,QAAK,OAAO,KAAK,GAAG;;AAGxB,SAAO;;CAGT,AAAO,MAAoB;AACzB,MAAI,KAAK,OAAO,WAAW,EACzB,OAAM,IAAI;AAEZ,SAAO,KAAK;;CAGd,AAAO,aAAiC;AACtC,SAAO,CAAC,CAAC,GAAG,KAAK,OAAO,KAAK;;CAG/B,cAAuB;AACrB,SAAO,KAAK,OAAO,WAAW"}
|
package/dist/constants.cjs
CHANGED
|
@@ -82,6 +82,9 @@ const COMMAND_SYMBOL = Symbol.for("langgraph.command");
|
|
|
82
82
|
*/
|
|
83
83
|
var CommandInstance = class {
|
|
84
84
|
[COMMAND_SYMBOL];
|
|
85
|
+
constructor(args) {
|
|
86
|
+
this[COMMAND_SYMBOL] = args;
|
|
87
|
+
}
|
|
85
88
|
};
|
|
86
89
|
function _isSendInterface(x) {
|
|
87
90
|
const operation = x;
|
|
@@ -264,7 +267,7 @@ var Command = class extends CommandInstance {
|
|
|
264
267
|
goto = [];
|
|
265
268
|
static PARENT = "__parent__";
|
|
266
269
|
constructor(args) {
|
|
267
|
-
super();
|
|
270
|
+
super(args);
|
|
268
271
|
this.resume = args.resume;
|
|
269
272
|
this.graph = args.graph;
|
|
270
273
|
this.update = args.update;
|
package/dist/constants.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.cjs","names":["result: unknown"],"sources":["../src/constants.ts"],"sourcesContent":["import { PendingWrite } from \"@langchain/langgraph-checkpoint\";\n\n/** Special reserved node name denoting the start of a graph. */\nexport const START = \"__start__\";\n/** Special reserved node name denoting the end of a graph. */\nexport const END = \"__end__\";\nexport const INPUT = \"__input__\";\nexport const COPY = \"__copy__\";\nexport const ERROR = \"__error__\";\n\n/** Special reserved cache namespaces */\nexport const CACHE_NS_WRITES = \"__pregel_ns_writes\";\n\nexport const CONFIG_KEY_SEND = \"__pregel_send\";\n/** config key containing function used to call a node (push task) */\nexport const CONFIG_KEY_CALL = \"__pregel_call\";\nexport const CONFIG_KEY_READ = \"__pregel_read\";\nexport const CONFIG_KEY_CHECKPOINTER = \"__pregel_checkpointer\";\nexport const CONFIG_KEY_RESUMING = \"__pregel_resuming\";\nexport const CONFIG_KEY_TASK_ID = \"__pregel_task_id\";\nexport const CONFIG_KEY_STREAM = \"__pregel_stream\";\nexport const CONFIG_KEY_RESUME_VALUE = \"__pregel_resume_value\";\nexport const CONFIG_KEY_RESUME_MAP = \"__pregel_resume_map\";\nexport const CONFIG_KEY_SCRATCHPAD = \"__pregel_scratchpad\";\n/** config key containing state from previous invocation of graph for the given thread */\nexport const CONFIG_KEY_PREVIOUS_STATE = \"__pregel_previous\";\nexport const CONFIG_KEY_DURABILITY = \"__pregel_durability\";\nexport const CONFIG_KEY_CHECKPOINT_ID = \"checkpoint_id\";\nexport const CONFIG_KEY_CHECKPOINT_NS = \"checkpoint_ns\";\n\nexport const CONFIG_KEY_NODE_FINISHED = \"__pregel_node_finished\";\n\n// this one is part of public API\nexport const CONFIG_KEY_CHECKPOINT_MAP = \"checkpoint_map\";\n\nexport const CONFIG_KEY_ABORT_SIGNALS = \"__pregel_abort_signals\";\n\n/** Special channel reserved for graph interrupts */\nexport const INTERRUPT = \"__interrupt__\";\n/** Special channel reserved for graph resume */\nexport const RESUME = \"__resume__\";\n/** Special channel reserved for cases when a task exits without any writes */\nexport const NO_WRITES = \"__no_writes__\";\n/** Special channel reserved for graph return */\nexport const RETURN = \"__return__\";\n/** Special channel reserved for graph previous state */\nexport const PREVIOUS = \"__previous__\";\nexport const RUNTIME_PLACEHOLDER = \"__pregel_runtime_placeholder__\";\nexport const RECURSION_LIMIT_DEFAULT = 25;\n\nexport const TAG_HIDDEN = \"langsmith:hidden\";\nexport const TAG_NOSTREAM = \"langsmith:nostream\";\nexport const SELF = \"__self__\";\n\nexport const TASKS = \"__pregel_tasks\";\nexport const PUSH = \"__pregel_push\";\nexport const PULL = \"__pregel_pull\";\n\nexport const TASK_NAMESPACE = \"6ba7b831-9dad-11d1-80b4-00c04fd430c8\";\nexport const NULL_TASK_ID = \"00000000-0000-0000-0000-000000000000\";\n\nexport const RESERVED = [\n TAG_HIDDEN,\n INPUT,\n INTERRUPT,\n RESUME,\n ERROR,\n NO_WRITES,\n\n // reserved config.configurable keys\n CONFIG_KEY_SEND,\n CONFIG_KEY_READ,\n CONFIG_KEY_CHECKPOINTER,\n CONFIG_KEY_DURABILITY,\n CONFIG_KEY_STREAM,\n CONFIG_KEY_RESUMING,\n CONFIG_KEY_TASK_ID,\n CONFIG_KEY_CALL,\n CONFIG_KEY_RESUME_VALUE,\n CONFIG_KEY_SCRATCHPAD,\n CONFIG_KEY_PREVIOUS_STATE,\n CONFIG_KEY_CHECKPOINT_MAP,\n CONFIG_KEY_CHECKPOINT_NS,\n CONFIG_KEY_CHECKPOINT_ID,\n];\n\nexport const CHECKPOINT_NAMESPACE_SEPARATOR = \"|\";\nexport const CHECKPOINT_NAMESPACE_END = \":\";\n\n/** @internal */\nconst COMMAND_SYMBOL = Symbol.for(\"langgraph.command\");\n\n/**\n * Instance of a {@link Command} class.\n *\n * This is used to avoid IntelliSense suggesting public fields\n * of {@link Command} class when a plain object is expected.\n *\n * @see {@link Command}\n * @internal\n */\nexport class CommandInstance {\n [COMMAND_SYMBOL]: true;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport interface SendInterface<Node extends string = string, Args = any> {\n node: Node;\n args: Args;\n}\n\nexport function _isSendInterface(x: unknown): x is SendInterface {\n const operation = x as SendInterface;\n return (\n operation !== null &&\n operation !== undefined &&\n typeof operation.node === \"string\" &&\n operation.args !== undefined\n );\n}\n\n/**\n *\n * A message or packet to send to a specific node in the graph.\n *\n * The `Send` class is used within a `StateGraph`'s conditional edges to\n * dynamically invoke a node with a custom state at the next step.\n *\n * Importantly, the sent state can differ from the core graph's state,\n * allowing for flexible and dynamic workflow management.\n *\n * One such example is a \"map-reduce\" workflow where your graph invokes\n * the same node multiple times in parallel with different states,\n * before aggregating the results back into the main graph's state.\n *\n * @example\n * ```typescript\n * import { Annotation, Send, StateGraph } from \"@langchain/langgraph\";\n *\n * const ChainState = Annotation.Root({\n * subjects: Annotation<string[]>,\n * jokes: Annotation<string[]>({\n * reducer: (a, b) => a.concat(b),\n * }),\n * });\n *\n * const continueToJokes = async (state: typeof ChainState.State) => {\n * return state.subjects.map((subject) => {\n * return new Send(\"generate_joke\", { subjects: [subject] });\n * });\n * };\n *\n * const graph = new StateGraph(ChainState)\n * .addNode(\"generate_joke\", (state) => ({\n * jokes: [`Joke about ${state.subjects}`],\n * }))\n * .addConditionalEdges(\"__start__\", continueToJokes)\n * .addEdge(\"generate_joke\", \"__end__\")\n * .compile();\n *\n * const res = await graph.invoke({ subjects: [\"cats\", \"dogs\"] });\n * console.log(res);\n *\n * // Invoking with two subjects results in a generated joke for each\n * // { subjects: [\"cats\", \"dogs\"], jokes: [`Joke about cats`, `Joke about dogs`] }\n * ```\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport class Send<Node extends string = string, Args = any>\n implements SendInterface<Node, Args>\n{\n lg_name = \"Send\";\n\n public node: Node;\n\n public args: Args;\n\n constructor(node: Node, args: Args) {\n this.node = node;\n this.args = _deserializeCommandSendObjectGraph(args) as Args;\n }\n\n toJSON() {\n return { lg_name: this.lg_name, node: this.node, args: this.args };\n }\n}\n\nexport function _isSend(x: unknown): x is Send {\n // eslint-disable-next-line no-instanceof/no-instanceof\n return x instanceof Send;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type Interrupt<Value = any> = {\n id?: string;\n value?: Value;\n};\n\n/**\n * Checks if the given graph invoke / stream chunk contains interrupt.\n *\n * @example\n * ```ts\n * import { INTERRUPT, isInterrupted } from \"@langchain/langgraph\";\n *\n * const values = await graph.invoke({ foo: \"bar\" });\n * if (isInterrupted<string>(values)) {\n * const interrupt = values[INTERRUPT][0].value;\n * }\n * ```\n *\n * @param values - The values to check.\n * @returns `true` if the values contain an interrupt, `false` otherwise.\n */\nexport function isInterrupted<Value = unknown>(\n values: unknown\n): values is { [INTERRUPT]: Interrupt<Value>[] } {\n if (!values || typeof values !== \"object\") return false;\n if (!(INTERRUPT in values)) return false;\n return Array.isArray(values[INTERRUPT]);\n}\n\nexport type CommandParams<\n Resume = unknown,\n Update extends Record<string, unknown> = Record<string, unknown>,\n Nodes extends string = string\n> = {\n /**\n * A discriminator field used to identify the type of object. Must be populated when serializing.\n *\n * Optional because it's not required to specify this when directly constructing a {@link Command}\n * object.\n */\n lg_name?: \"Command\";\n\n /**\n * Value to resume execution with. To be used together with {@link interrupt}.\n */\n resume?: Resume;\n /**\n * Graph to send the command to. Supported values are:\n * - None: the current graph (default)\n * - The specific name of the graph to send the command to\n * - {@link Command.PARENT}: closest parent graph (only supported when returned from a node in a subgraph)\n */\n graph?: string;\n\n /**\n * Update to apply to the graph's state.\n */\n update?: Update | [string, unknown][];\n\n /**\n * Can be one of the following:\n * - name of the node to navigate to next (any node that belongs to the specified `graph`)\n * - sequence of node names to navigate to next\n * - `Send` object (to execute a node with the input provided)\n * - sequence of `Send` objects\n */\n goto?:\n | Nodes\n | SendInterface<Nodes> // eslint-disable-line @typescript-eslint/no-explicit-any\n | (Nodes | SendInterface<Nodes>)[]; // eslint-disable-line @typescript-eslint/no-explicit-any\n};\n\n/**\n * One or more commands to update the graph's state and send messages to nodes.\n * Can be used to combine routing logic with state updates in lieu of conditional edges\n *\n * @example\n * ```ts\n * import { Annotation, Command } from \"@langchain/langgraph\";\n *\n * // Define graph state\n * const StateAnnotation = Annotation.Root({\n * foo: Annotation<string>,\n * });\n *\n * // Define the nodes\n * const nodeA = async (_state: typeof StateAnnotation.State) => {\n * console.log(\"Called A\");\n * // this is a replacement for a real conditional edge function\n * const goto = Math.random() > .5 ? \"nodeB\" : \"nodeC\";\n * // note how Command allows you to BOTH update the graph state AND route to the next node\n * return new Command({\n * // this is the state update\n * update: {\n * foo: \"a\",\n * },\n * // this is a replacement for an edge\n * goto,\n * });\n * };\n *\n * // Nodes B and C are unchanged\n * const nodeB = async (state: typeof StateAnnotation.State) => {\n * console.log(\"Called B\");\n * return {\n * foo: state.foo + \"|b\",\n * };\n * }\n *\n * const nodeC = async (state: typeof StateAnnotation.State) => {\n * console.log(\"Called C\");\n * return {\n * foo: state.foo + \"|c\",\n * };\n * }\n * \n * import { StateGraph } from \"@langchain/langgraph\";\n\n * // NOTE: there are no edges between nodes A, B and C!\n * const graph = new StateGraph(StateAnnotation)\n * .addNode(\"nodeA\", nodeA, {\n * ends: [\"nodeB\", \"nodeC\"],\n * })\n * .addNode(\"nodeB\", nodeB)\n * .addNode(\"nodeC\", nodeC)\n * .addEdge(\"__start__\", \"nodeA\")\n * .compile();\n * \n * await graph.invoke({ foo: \"\" });\n *\n * // Randomly oscillates between\n * // { foo: 'a|c' } and { foo: 'a|b' }\n * ```\n */\nexport class Command<\n Resume = unknown,\n Update extends Record<string, unknown> = Record<string, unknown>,\n Nodes extends string = string\n> extends CommandInstance {\n readonly lg_name = \"Command\";\n\n lc_direct_tool_output = true;\n\n /**\n * Graph to send the command to. Supported values are:\n * - None: the current graph (default)\n * - The specific name of the graph to send the command to\n * - {@link Command.PARENT}: closest parent graph (only supported when returned from a node in a subgraph)\n */\n graph?: string;\n\n /**\n * Update to apply to the graph's state as a result of executing the node that is returning the command.\n * Written to the state as if the node had simply returned this value instead of the Command object.\n */\n update?: Update | [string, unknown][];\n\n /**\n * Value to resume execution with. To be used together with {@link interrupt}.\n */\n resume?: Resume;\n\n /**\n * Can be one of the following:\n * - name of the node to navigate to next (any node that belongs to the specified `graph`)\n * - sequence of node names to navigate to next\n * - {@link Send} object (to execute a node with the exact input provided in the {@link Send} object)\n * - sequence of {@link Send} objects\n */\n goto?: Nodes | Send<Nodes> | (Nodes | Send<Nodes>)[] = [];\n\n static PARENT = \"__parent__\";\n\n constructor(args: CommandParams<Resume, Update, Nodes>) {\n super();\n this.resume = args.resume;\n this.graph = args.graph;\n this.update = args.update;\n if (args.goto) {\n type ValidArg = Nodes | Send<Nodes, Update>;\n\n this.goto = Array.isArray(args.goto)\n ? (_deserializeCommandSendObjectGraph(args.goto) as ValidArg[])\n : [_deserializeCommandSendObjectGraph(args.goto) as ValidArg];\n }\n }\n\n /**\n * Convert the update field to a list of {@link PendingWrite} tuples\n * @returns List of {@link PendingWrite} tuples of the form `[channelKey, value]`.\n * @internal\n */\n _updateAsTuples(): PendingWrite[] {\n if (\n this.update &&\n typeof this.update === \"object\" &&\n !Array.isArray(this.update)\n ) {\n return Object.entries(this.update);\n } else if (\n Array.isArray(this.update) &&\n this.update.every(\n (t): t is [string, unknown] =>\n Array.isArray(t) && t.length === 2 && typeof t[0] === \"string\"\n )\n ) {\n return this.update;\n } else {\n return [[\"__root__\", this.update]];\n }\n }\n\n toJSON() {\n let serializedGoto;\n if (typeof this.goto === \"string\") {\n serializedGoto = this.goto;\n } else if (_isSend(this.goto)) {\n serializedGoto = this.goto.toJSON();\n } else {\n serializedGoto = this.goto?.map((innerGoto) => {\n if (typeof innerGoto === \"string\") {\n return innerGoto;\n } else {\n return innerGoto.toJSON();\n }\n });\n }\n return {\n lg_name: this.lg_name,\n update: this.update,\n resume: this.resume,\n goto: serializedGoto,\n };\n }\n}\n\n/**\n * A type guard to check if the given value is a {@link Command}.\n *\n * Useful for type narrowing when working with the {@link Command} object.\n *\n * @param x - The value to check.\n * @returns `true` if the value is a {@link Command}, `false` otherwise.\n */\nexport function isCommand(x: unknown): x is Command {\n if (typeof x !== \"object\") {\n return false;\n }\n\n if (x === null || x === undefined) {\n return false;\n }\n\n if (\"lg_name\" in x && x.lg_name === \"Command\") {\n return true;\n }\n\n return false;\n}\n\n/**\n * Reconstructs Command and Send objects from a deeply nested tree of anonymous objects\n * matching their interfaces.\n *\n * This is only exported for testing purposes. It is NOT intended to be used outside of\n * the Command and Send classes.\n *\n * @internal\n *\n * @param x - The command send tree to convert.\n * @param seen - A map of seen objects to avoid infinite loops.\n * @returns The converted command send tree.\n */\nexport function _deserializeCommandSendObjectGraph(\n x: unknown,\n seen: Map<object, unknown> = new Map()\n): unknown {\n if (x !== undefined && x !== null && typeof x === \"object\") {\n // If we've already processed this object, return the transformed version\n if (seen.has(x)) {\n return seen.get(x);\n }\n\n let result: unknown;\n\n if (Array.isArray(x)) {\n // Create the array first, then populate it\n result = [];\n // Add to seen map before processing elements to handle self-references\n seen.set(x, result);\n\n // Now populate the array\n x.forEach((item, index) => {\n (result as unknown[])[index] = _deserializeCommandSendObjectGraph(\n item,\n seen\n );\n });\n // eslint-disable-next-line no-instanceof/no-instanceof\n } else if (isCommand(x) && !(x instanceof Command)) {\n result = new Command(x);\n seen.set(x, result);\n // eslint-disable-next-line no-instanceof/no-instanceof\n } else if (_isSendInterface(x) && !(x instanceof Send)) {\n result = new Send(x.node, x.args);\n seen.set(x, result);\n } else if (isCommand(x) || _isSend(x)) {\n result = x;\n seen.set(x, result);\n } else if (\"lc_serializable\" in x && x.lc_serializable) {\n result = x;\n seen.set(x, result);\n } else {\n // Create empty object first\n result = {};\n // Add to seen map before processing properties to handle self-references\n seen.set(x, result);\n\n // Now populate the object\n for (const [key, value] of Object.entries(x)) {\n (result as Record<string, unknown>)[key] =\n _deserializeCommandSendObjectGraph(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AAM,KAAK,cAAc;AAC7C,OAAI,OAAO,cAAc,SACvB,QAAO;OAEP,QAAO,UAAU;;AAIvB,SAAO;GACL,SAAS,KAAK;GACd,QAAQ,KAAK;GACb,QAAQ,KAAK;GACb,MAAM;;;;;;;;;;;;AAaZ,SAAgB,UAAU,GAA0B;AAClD,KAAI,OAAO,MAAM,SACf,QAAO;AAGT,KAAI,MAAM,QAAQ,MAAM,OACtB,QAAO;AAGT,KAAI,aAAa,KAAK,EAAE,YAAY,UAClC,QAAO;AAGT,QAAO;;;;;;;;;;;;;;;AAgBT,SAAgB,mCACd,GACA,uBAA6B,IAAI,OACxB;AACT,KAAI,MAAM,UAAa,MAAM,QAAQ,OAAO,MAAM,UAAU;AAE1D,MAAI,KAAK,IAAI,GACX,QAAO,KAAK,IAAI;EAGlB,IAAIA;AAEJ,MAAI,MAAM,QAAQ,IAAI;AAEpB,YAAS;AAET,QAAK,IAAI,GAAG;AAGZ,KAAE,SAAS,MAAM,UAAU;AACzB,IAAC,OAAqB,SAAS,mCAC7B,MACA;;aAIK,UAAU,MAAM,EAAE,aAAa,UAAU;AAClD,YAAS,IAAI,QAAQ;AACrB,QAAK,IAAI,GAAG;aAEH,iBAAiB,MAAM,EAAE,aAAa,OAAO;AACtD,YAAS,IAAI,KAAK,EAAE,MAAM,EAAE;AAC5B,QAAK,IAAI,GAAG;aACH,UAAU,MAAM,QAAQ,IAAI;AACrC,YAAS;AACT,QAAK,IAAI,GAAG;aACH,qBAAqB,KAAK,EAAE,iBAAiB;AACtD,YAAS;AACT,QAAK,IAAI,GAAG;SACP;AAEL,YAAS;AAET,QAAK,IAAI,GAAG;AAGZ,QAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,GACxC,CAAC,OAAmC,OAClC,mCAAmC,OAAO;;AAIhD,SAAO;;AAET,QAAO"}
|
|
1
|
+
{"version":3,"file":"constants.cjs","names":["result: unknown"],"sources":["../src/constants.ts"],"sourcesContent":["import { PendingWrite } from \"@langchain/langgraph-checkpoint\";\n\n/** Special reserved node name denoting the start of a graph. */\nexport const START = \"__start__\";\n/** Special reserved node name denoting the end of a graph. */\nexport const END = \"__end__\";\nexport const INPUT = \"__input__\";\nexport const COPY = \"__copy__\";\nexport const ERROR = \"__error__\";\n\n/** Special reserved cache namespaces */\nexport const CACHE_NS_WRITES = \"__pregel_ns_writes\";\n\nexport const CONFIG_KEY_SEND = \"__pregel_send\";\n/** config key containing function used to call a node (push task) */\nexport const CONFIG_KEY_CALL = \"__pregel_call\";\nexport const CONFIG_KEY_READ = \"__pregel_read\";\nexport const CONFIG_KEY_CHECKPOINTER = \"__pregel_checkpointer\";\nexport const CONFIG_KEY_RESUMING = \"__pregel_resuming\";\nexport const CONFIG_KEY_TASK_ID = \"__pregel_task_id\";\nexport const CONFIG_KEY_STREAM = \"__pregel_stream\";\nexport const CONFIG_KEY_RESUME_VALUE = \"__pregel_resume_value\";\nexport const CONFIG_KEY_RESUME_MAP = \"__pregel_resume_map\";\nexport const CONFIG_KEY_SCRATCHPAD = \"__pregel_scratchpad\";\n/** config key containing state from previous invocation of graph for the given thread */\nexport const CONFIG_KEY_PREVIOUS_STATE = \"__pregel_previous\";\nexport const CONFIG_KEY_DURABILITY = \"__pregel_durability\";\nexport const CONFIG_KEY_CHECKPOINT_ID = \"checkpoint_id\";\nexport const CONFIG_KEY_CHECKPOINT_NS = \"checkpoint_ns\";\n\nexport const CONFIG_KEY_NODE_FINISHED = \"__pregel_node_finished\";\n\n// this one is part of public API\nexport const CONFIG_KEY_CHECKPOINT_MAP = \"checkpoint_map\";\n\nexport const CONFIG_KEY_ABORT_SIGNALS = \"__pregel_abort_signals\";\n\n/** Special channel reserved for graph interrupts */\nexport const INTERRUPT = \"__interrupt__\";\n/** Special channel reserved for graph resume */\nexport const RESUME = \"__resume__\";\n/** Special channel reserved for cases when a task exits without any writes */\nexport const NO_WRITES = \"__no_writes__\";\n/** Special channel reserved for graph return */\nexport const RETURN = \"__return__\";\n/** Special channel reserved for graph previous state */\nexport const PREVIOUS = \"__previous__\";\nexport const RUNTIME_PLACEHOLDER = \"__pregel_runtime_placeholder__\";\nexport const RECURSION_LIMIT_DEFAULT = 25;\n\nexport const TAG_HIDDEN = \"langsmith:hidden\";\nexport const TAG_NOSTREAM = \"langsmith:nostream\";\nexport const SELF = \"__self__\";\n\nexport const TASKS = \"__pregel_tasks\";\nexport const PUSH = \"__pregel_push\";\nexport const PULL = \"__pregel_pull\";\n\nexport const TASK_NAMESPACE = \"6ba7b831-9dad-11d1-80b4-00c04fd430c8\";\nexport const NULL_TASK_ID = \"00000000-0000-0000-0000-000000000000\";\n\nexport const RESERVED = [\n TAG_HIDDEN,\n INPUT,\n INTERRUPT,\n RESUME,\n ERROR,\n NO_WRITES,\n\n // reserved config.configurable keys\n CONFIG_KEY_SEND,\n CONFIG_KEY_READ,\n CONFIG_KEY_CHECKPOINTER,\n CONFIG_KEY_DURABILITY,\n CONFIG_KEY_STREAM,\n CONFIG_KEY_RESUMING,\n CONFIG_KEY_TASK_ID,\n CONFIG_KEY_CALL,\n CONFIG_KEY_RESUME_VALUE,\n CONFIG_KEY_SCRATCHPAD,\n CONFIG_KEY_PREVIOUS_STATE,\n CONFIG_KEY_CHECKPOINT_MAP,\n CONFIG_KEY_CHECKPOINT_NS,\n CONFIG_KEY_CHECKPOINT_ID,\n];\n\nexport const CHECKPOINT_NAMESPACE_SEPARATOR = \"|\";\nexport const CHECKPOINT_NAMESPACE_END = \":\";\n\n/** @internal */\nconst COMMAND_SYMBOL = Symbol.for(\"langgraph.command\");\n\n/**\n * Instance of a {@link Command} class.\n *\n * This is used to avoid IntelliSense suggesting public fields\n * of {@link Command} class when a plain object is expected.\n *\n * @see {@link Command}\n * @internal\n */\nexport class CommandInstance<\n Resume = unknown,\n Update extends Record<string, unknown> = Record<string, unknown>,\n Nodes extends string = string\n> {\n [COMMAND_SYMBOL]: CommandParams<Resume, Update, Nodes>;\n\n constructor(args: CommandParams<Resume, Update, Nodes>) {\n this[COMMAND_SYMBOL] = args;\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport interface SendInterface<Node extends string = string, Args = any> {\n node: Node;\n args: Args;\n}\n\nexport function _isSendInterface(x: unknown): x is SendInterface {\n const operation = x as SendInterface;\n return (\n operation !== null &&\n operation !== undefined &&\n typeof operation.node === \"string\" &&\n operation.args !== undefined\n );\n}\n\n/**\n *\n * A message or packet to send to a specific node in the graph.\n *\n * The `Send` class is used within a `StateGraph`'s conditional edges to\n * dynamically invoke a node with a custom state at the next step.\n *\n * Importantly, the sent state can differ from the core graph's state,\n * allowing for flexible and dynamic workflow management.\n *\n * One such example is a \"map-reduce\" workflow where your graph invokes\n * the same node multiple times in parallel with different states,\n * before aggregating the results back into the main graph's state.\n *\n * @example\n * ```typescript\n * import { Annotation, Send, StateGraph } from \"@langchain/langgraph\";\n *\n * const ChainState = Annotation.Root({\n * subjects: Annotation<string[]>,\n * jokes: Annotation<string[]>({\n * reducer: (a, b) => a.concat(b),\n * }),\n * });\n *\n * const continueToJokes = async (state: typeof ChainState.State) => {\n * return state.subjects.map((subject) => {\n * return new Send(\"generate_joke\", { subjects: [subject] });\n * });\n * };\n *\n * const graph = new StateGraph(ChainState)\n * .addNode(\"generate_joke\", (state) => ({\n * jokes: [`Joke about ${state.subjects}`],\n * }))\n * .addConditionalEdges(\"__start__\", continueToJokes)\n * .addEdge(\"generate_joke\", \"__end__\")\n * .compile();\n *\n * const res = await graph.invoke({ subjects: [\"cats\", \"dogs\"] });\n * console.log(res);\n *\n * // Invoking with two subjects results in a generated joke for each\n * // { subjects: [\"cats\", \"dogs\"], jokes: [`Joke about cats`, `Joke about dogs`] }\n * ```\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport class Send<Node extends string = string, Args = any>\n implements SendInterface<Node, Args>\n{\n lg_name = \"Send\";\n\n public node: Node;\n\n public args: Args;\n\n constructor(node: Node, args: Args) {\n this.node = node;\n this.args = _deserializeCommandSendObjectGraph(args) as Args;\n }\n\n toJSON() {\n return { lg_name: this.lg_name, node: this.node, args: this.args };\n }\n}\n\nexport function _isSend(x: unknown): x is Send {\n // eslint-disable-next-line no-instanceof/no-instanceof\n return x instanceof Send;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type Interrupt<Value = any> = {\n id?: string;\n value?: Value;\n};\n\n/**\n * Checks if the given graph invoke / stream chunk contains interrupt.\n *\n * @example\n * ```ts\n * import { INTERRUPT, isInterrupted } from \"@langchain/langgraph\";\n *\n * const values = await graph.invoke({ foo: \"bar\" });\n * if (isInterrupted<string>(values)) {\n * const interrupt = values[INTERRUPT][0].value;\n * }\n * ```\n *\n * @param values - The values to check.\n * @returns `true` if the values contain an interrupt, `false` otherwise.\n */\nexport function isInterrupted<Value = unknown>(\n values: unknown\n): values is { [INTERRUPT]: Interrupt<Value>[] } {\n if (!values || typeof values !== \"object\") return false;\n if (!(INTERRUPT in values)) return false;\n return Array.isArray(values[INTERRUPT]);\n}\n\nexport type CommandParams<\n Resume = unknown,\n Update extends Record<string, unknown> = Record<string, unknown>,\n Nodes extends string = string\n> = {\n /**\n * A discriminator field used to identify the type of object. Must be populated when serializing.\n *\n * Optional because it's not required to specify this when directly constructing a {@link Command}\n * object.\n */\n lg_name?: \"Command\";\n\n /**\n * Value to resume execution with. To be used together with {@link interrupt}.\n */\n resume?: Resume;\n /**\n * Graph to send the command to. Supported values are:\n * - None: the current graph (default)\n * - The specific name of the graph to send the command to\n * - {@link Command.PARENT}: closest parent graph (only supported when returned from a node in a subgraph)\n */\n graph?: string;\n\n /**\n * Update to apply to the graph's state.\n */\n update?: Update | [string, unknown][];\n\n /**\n * Can be one of the following:\n * - name of the node to navigate to next (any node that belongs to the specified `graph`)\n * - sequence of node names to navigate to next\n * - `Send` object (to execute a node with the input provided)\n * - sequence of `Send` objects\n */\n goto?:\n | Nodes\n | SendInterface<Nodes> // eslint-disable-line @typescript-eslint/no-explicit-any\n | (Nodes | SendInterface<Nodes>)[]; // eslint-disable-line @typescript-eslint/no-explicit-any\n};\n\n/**\n * One or more commands to update the graph's state and send messages to nodes.\n * Can be used to combine routing logic with state updates in lieu of conditional edges\n *\n * @example\n * ```ts\n * import { Annotation, Command } from \"@langchain/langgraph\";\n *\n * // Define graph state\n * const StateAnnotation = Annotation.Root({\n * foo: Annotation<string>,\n * });\n *\n * // Define the nodes\n * const nodeA = async (_state: typeof StateAnnotation.State) => {\n * console.log(\"Called A\");\n * // this is a replacement for a real conditional edge function\n * const goto = Math.random() > .5 ? \"nodeB\" : \"nodeC\";\n * // note how Command allows you to BOTH update the graph state AND route to the next node\n * return new Command({\n * // this is the state update\n * update: {\n * foo: \"a\",\n * },\n * // this is a replacement for an edge\n * goto,\n * });\n * };\n *\n * // Nodes B and C are unchanged\n * const nodeB = async (state: typeof StateAnnotation.State) => {\n * console.log(\"Called B\");\n * return {\n * foo: state.foo + \"|b\",\n * };\n * }\n *\n * const nodeC = async (state: typeof StateAnnotation.State) => {\n * console.log(\"Called C\");\n * return {\n * foo: state.foo + \"|c\",\n * };\n * }\n * \n * import { StateGraph } from \"@langchain/langgraph\";\n\n * // NOTE: there are no edges between nodes A, B and C!\n * const graph = new StateGraph(StateAnnotation)\n * .addNode(\"nodeA\", nodeA, {\n * ends: [\"nodeB\", \"nodeC\"],\n * })\n * .addNode(\"nodeB\", nodeB)\n * .addNode(\"nodeC\", nodeC)\n * .addEdge(\"__start__\", \"nodeA\")\n * .compile();\n * \n * await graph.invoke({ foo: \"\" });\n *\n * // Randomly oscillates between\n * // { foo: 'a|c' } and { foo: 'a|b' }\n * ```\n */\nexport class Command<\n Resume = unknown,\n Update extends Record<string, unknown> = Record<string, unknown>,\n Nodes extends string = string\n> extends CommandInstance<Resume, Update, Nodes> {\n readonly lg_name = \"Command\";\n\n lc_direct_tool_output = true;\n\n /**\n * Graph to send the command to. Supported values are:\n * - None: the current graph (default)\n * - The specific name of the graph to send the command to\n * - {@link Command.PARENT}: closest parent graph (only supported when returned from a node in a subgraph)\n */\n graph?: string;\n\n /**\n * Update to apply to the graph's state as a result of executing the node that is returning the command.\n * Written to the state as if the node had simply returned this value instead of the Command object.\n */\n update?: Update | [string, unknown][];\n\n /**\n * Value to resume execution with. To be used together with {@link interrupt}.\n */\n resume?: Resume;\n\n /**\n * Can be one of the following:\n * - name of the node to navigate to next (any node that belongs to the specified `graph`)\n * - sequence of node names to navigate to next\n * - {@link Send} object (to execute a node with the exact input provided in the {@link Send} object)\n * - sequence of {@link Send} objects\n */\n goto?: Nodes | Send<Nodes> | (Nodes | Send<Nodes>)[] = [];\n\n static PARENT = \"__parent__\";\n\n constructor(args: Omit<CommandParams<Resume, Update, Nodes>, \"lg_name\">) {\n super(args);\n this.resume = args.resume;\n this.graph = args.graph;\n this.update = args.update;\n if (args.goto) {\n type ValidArg = Nodes | Send<Nodes, Update>;\n\n this.goto = Array.isArray(args.goto)\n ? (_deserializeCommandSendObjectGraph(args.goto) as ValidArg[])\n : [_deserializeCommandSendObjectGraph(args.goto) as ValidArg];\n }\n }\n\n /**\n * Convert the update field to a list of {@link PendingWrite} tuples\n * @returns List of {@link PendingWrite} tuples of the form `[channelKey, value]`.\n * @internal\n */\n _updateAsTuples(): PendingWrite[] {\n if (\n this.update &&\n typeof this.update === \"object\" &&\n !Array.isArray(this.update)\n ) {\n return Object.entries(this.update);\n } else if (\n Array.isArray(this.update) &&\n this.update.every(\n (t): t is [string, unknown] =>\n Array.isArray(t) && t.length === 2 && typeof t[0] === \"string\"\n )\n ) {\n return this.update;\n } else {\n return [[\"__root__\", this.update]];\n }\n }\n\n toJSON() {\n let serializedGoto;\n if (typeof this.goto === \"string\") {\n serializedGoto = this.goto;\n } else if (_isSend(this.goto)) {\n serializedGoto = this.goto.toJSON();\n } else {\n serializedGoto = this.goto?.map((innerGoto) => {\n if (typeof innerGoto === \"string\") {\n return innerGoto;\n } else {\n return innerGoto.toJSON();\n }\n });\n }\n return {\n lg_name: this.lg_name,\n update: this.update,\n resume: this.resume,\n goto: serializedGoto,\n };\n }\n}\n\n/**\n * A type guard to check if the given value is a {@link Command}.\n *\n * Useful for type narrowing when working with the {@link Command} object.\n *\n * @param x - The value to check.\n * @returns `true` if the value is a {@link Command}, `false` otherwise.\n */\nexport function isCommand(x: unknown): x is Command {\n if (typeof x !== \"object\") {\n return false;\n }\n\n if (x === null || x === undefined) {\n return false;\n }\n\n if (\"lg_name\" in x && x.lg_name === \"Command\") {\n return true;\n }\n\n return false;\n}\n\n/**\n * Reconstructs Command and Send objects from a deeply nested tree of anonymous objects\n * matching their interfaces.\n *\n * This is only exported for testing purposes. It is NOT intended to be used outside of\n * the Command and Send classes.\n *\n * @internal\n *\n * @param x - The command send tree to convert.\n * @param seen - A map of seen objects to avoid infinite loops.\n * @returns The converted command send tree.\n */\nexport function _deserializeCommandSendObjectGraph(\n x: unknown,\n seen: Map<object, unknown> = new Map()\n): unknown {\n if (x !== undefined && x !== null && typeof x === \"object\") {\n // If we've already processed this object, return the transformed version\n if (seen.has(x)) {\n return seen.get(x);\n }\n\n let result: unknown;\n\n if (Array.isArray(x)) {\n // Create the array first, then populate it\n result = [];\n // Add to seen map before processing elements to handle self-references\n seen.set(x, result);\n\n // Now populate the array\n x.forEach((item, index) => {\n (result as unknown[])[index] = _deserializeCommandSendObjectGraph(\n item,\n seen\n );\n });\n // eslint-disable-next-line no-instanceof/no-instanceof\n } else if (isCommand(x) && !(x instanceof Command)) {\n result = new Command(x);\n seen.set(x, result);\n // eslint-disable-next-line no-instanceof/no-instanceof\n } else if (_isSendInterface(x) && !(x instanceof Send)) {\n result = new Send(x.node, x.args);\n seen.set(x, result);\n } else if (isCommand(x) || _isSend(x)) {\n result = x;\n seen.set(x, result);\n } else if (\"lc_serializable\" in x && x.lc_serializable) {\n result = x;\n seen.set(x, result);\n } else {\n // Create empty object first\n result = {};\n // Add to seen map before processing properties to handle self-references\n seen.set(x, result);\n\n // Now populate the object\n for (const [key, value] of Object.entries(x)) {\n (result as Record<string, unknown>)[key] =\n _deserializeCommandSendObjectGraph(value, seen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YMBOL: unique symbol;
|
|
|
22
22
|
* @see {@link Command}
|
|
23
23
|
* @internal
|
|
24
24
|
*/
|
|
25
|
-
declare class CommandInstance {
|
|
26
|
-
[COMMAND_SYMBOL]:
|
|
25
|
+
declare class CommandInstance<Resume = unknown, Update extends Record<string, unknown> = Record<string, unknown>, Nodes extends string = string> {
|
|
26
|
+
[COMMAND_SYMBOL]: CommandParams<Resume, Update, Nodes>;
|
|
27
|
+
constructor(args: CommandParams<Resume, Update, Nodes>);
|
|
27
28
|
}
|
|
28
29
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
29
30
|
interface SendInterface<Node extends string = string, Args = any> {
|
|
@@ -207,7 +208,7 @@ type CommandParams<Resume = unknown, Update extends Record<string, unknown> = Re
|
|
|
207
208
|
* // { foo: 'a|c' } and { foo: 'a|b' }
|
|
208
209
|
* ```
|
|
209
210
|
*/
|
|
210
|
-
declare class Command<Resume = unknown, Update extends Record<string, unknown> = Record<string, unknown>, Nodes extends string = string> extends CommandInstance {
|
|
211
|
+
declare class Command<Resume = unknown, Update extends Record<string, unknown> = Record<string, unknown>, Nodes extends string = string> extends CommandInstance<Resume, Update, Nodes> {
|
|
211
212
|
readonly lg_name: string;
|
|
212
213
|
lc_direct_tool_output: boolean;
|
|
213
214
|
/**
|
|
@@ -235,7 +236,7 @@ declare class Command<Resume = unknown, Update extends Record<string, unknown> =
|
|
|
235
236
|
*/
|
|
236
237
|
goto?: Nodes | Send<Nodes> | (Nodes | Send<Nodes>)[];
|
|
237
238
|
static PARENT: string;
|
|
238
|
-
constructor(args: CommandParams<Resume, Update, Nodes>);
|
|
239
|
+
constructor(args: Omit<CommandParams<Resume, Update, Nodes>, "lg_name">);
|
|
239
240
|
/**
|
|
240
241
|
* Convert the update field to a list of {@link PendingWrite} tuples
|
|
241
242
|
* @returns List of {@link PendingWrite} tuples of the form `[channelKey, value]`.
|
package/dist/constants.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.cts","names":["PendingWrite","START","END","INPUT","COPY","ERROR","CACHE_NS_WRITES","CONFIG_KEY_SEND","CONFIG_KEY_CALL","CONFIG_KEY_READ","CONFIG_KEY_CHECKPOINTER","CONFIG_KEY_RESUMING","CONFIG_KEY_TASK_ID","CONFIG_KEY_STREAM","CONFIG_KEY_RESUME_VALUE","CONFIG_KEY_RESUME_MAP","CONFIG_KEY_SCRATCHPAD","CONFIG_KEY_PREVIOUS_STATE","CONFIG_KEY_DURABILITY","CONFIG_KEY_CHECKPOINT_ID","CONFIG_KEY_CHECKPOINT_NS","CONFIG_KEY_NODE_FINISHED","CONFIG_KEY_CHECKPOINT_MAP","CONFIG_KEY_ABORT_SIGNALS","INTERRUPT","RESUME","NO_WRITES","RETURN","PREVIOUS","RUNTIME_PLACEHOLDER","RECURSION_LIMIT_DEFAULT","TAG_HIDDEN","TAG_NOSTREAM","SELF","TASKS","PUSH","PULL","TASK_NAMESPACE","NULL_TASK_ID","RESERVED","CHECKPOINT_NAMESPACE_SEPARATOR","CHECKPOINT_NAMESPACE_END","COMMAND_SYMBOL","CommandInstance","SendInterface","Node","Args","_isSendInterface","Send","_isSend","Interrupt","Value","isInterrupted","CommandParams","Record","Resume","Update","Nodes","Command","isCommand","_deserializeCommandSendObjectGraph","Map"],"sources":["../src/constants.d.ts"],"sourcesContent":["import { PendingWrite } from \"@langchain/langgraph-checkpoint\";\n/** Special reserved node name denoting the start of a graph. */\nexport declare const START = \"__start__\";\n/** Special reserved node name denoting the end of a graph. */\nexport declare const END = \"__end__\";\nexport declare const INPUT = \"__input__\";\nexport declare const COPY = \"__copy__\";\nexport declare const ERROR = \"__error__\";\n/** Special reserved cache namespaces */\nexport declare const CACHE_NS_WRITES = \"__pregel_ns_writes\";\nexport declare const CONFIG_KEY_SEND = \"__pregel_send\";\n/** config key containing function used to call a node (push task) */\nexport declare const CONFIG_KEY_CALL = \"__pregel_call\";\nexport declare const CONFIG_KEY_READ = \"__pregel_read\";\nexport declare const CONFIG_KEY_CHECKPOINTER = \"__pregel_checkpointer\";\nexport declare const CONFIG_KEY_RESUMING = \"__pregel_resuming\";\nexport declare const CONFIG_KEY_TASK_ID = \"__pregel_task_id\";\nexport declare const CONFIG_KEY_STREAM = \"__pregel_stream\";\nexport declare const CONFIG_KEY_RESUME_VALUE = \"__pregel_resume_value\";\nexport declare const CONFIG_KEY_RESUME_MAP = \"__pregel_resume_map\";\nexport declare const CONFIG_KEY_SCRATCHPAD = \"__pregel_scratchpad\";\n/** config key containing state from previous invocation of graph for the given thread */\nexport declare const CONFIG_KEY_PREVIOUS_STATE = \"__pregel_previous\";\nexport declare const CONFIG_KEY_DURABILITY = \"__pregel_durability\";\nexport declare const CONFIG_KEY_CHECKPOINT_ID = \"checkpoint_id\";\nexport declare const CONFIG_KEY_CHECKPOINT_NS = \"checkpoint_ns\";\nexport declare const CONFIG_KEY_NODE_FINISHED = \"__pregel_node_finished\";\n// this one is part of public API\nexport declare const CONFIG_KEY_CHECKPOINT_MAP = \"checkpoint_map\";\nexport declare const CONFIG_KEY_ABORT_SIGNALS = \"__pregel_abort_signals\";\n/** Special channel reserved for graph interrupts */\nexport declare const INTERRUPT = \"__interrupt__\";\n/** Special channel reserved for graph resume */\nexport declare const RESUME = \"__resume__\";\n/** Special channel reserved for cases when a task exits without any writes */\nexport declare const NO_WRITES = \"__no_writes__\";\n/** Special channel reserved for graph return */\nexport declare const RETURN = \"__return__\";\n/** Special channel reserved for graph previous state */\nexport declare const PREVIOUS = \"__previous__\";\nexport declare const RUNTIME_PLACEHOLDER = \"__pregel_runtime_placeholder__\";\nexport declare const RECURSION_LIMIT_DEFAULT = 25;\nexport declare const TAG_HIDDEN = \"langsmith:hidden\";\nexport declare const TAG_NOSTREAM = \"langsmith:nostream\";\nexport declare const SELF = \"__self__\";\nexport declare const TASKS = \"__pregel_tasks\";\nexport declare const PUSH = \"__pregel_push\";\nexport declare const PULL = \"__pregel_pull\";\nexport declare const TASK_NAMESPACE = \"6ba7b831-9dad-11d1-80b4-00c04fd430c8\";\nexport declare const NULL_TASK_ID = \"00000000-0000-0000-0000-000000000000\";\nexport declare const RESERVED: string[];\nexport declare const CHECKPOINT_NAMESPACE_SEPARATOR = \"|\";\nexport declare const CHECKPOINT_NAMESPACE_END = \":\";\n/** @internal */\ndeclare const COMMAND_SYMBOL: unique symbol;\n/**\n * Instance of a {@link Command} class.\n *\n * This is used to avoid IntelliSense suggesting public fields\n * of {@link Command} class when a plain object is expected.\n *\n * @see {@link Command}\n * @internal\n */\nexport declare class CommandInstance {\n [COMMAND_SYMBOL]: true;\n}\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport interface SendInterface<Node extends string = string, Args = any> {\n node: Node;\n args: Args;\n}\nexport declare function _isSendInterface(x: unknown): x is SendInterface;\n/**\n *\n * A message or packet to send to a specific node in the graph.\n *\n * The `Send` class is used within a `StateGraph`'s conditional edges to\n * dynamically invoke a node with a custom state at the next step.\n *\n * Importantly, the sent state can differ from the core graph's state,\n * allowing for flexible and dynamic workflow management.\n *\n * One such example is a \"map-reduce\" workflow where your graph invokes\n * the same node multiple times in parallel with different states,\n * before aggregating the results back into the main graph's state.\n *\n * @example\n * ```typescript\n * import { Annotation, Send, StateGraph } from \"@langchain/langgraph\";\n *\n * const ChainState = Annotation.Root({\n * subjects: Annotation<string[]>,\n * jokes: Annotation<string[]>({\n * reducer: (a, b) => a.concat(b),\n * }),\n * });\n *\n * const continueToJokes = async (state: typeof ChainState.State) => {\n * return state.subjects.map((subject) => {\n * return new Send(\"generate_joke\", { subjects: [subject] });\n * });\n * };\n *\n * const graph = new StateGraph(ChainState)\n * .addNode(\"generate_joke\", (state) => ({\n * jokes: [`Joke about ${state.subjects}`],\n * }))\n * .addConditionalEdges(\"__start__\", continueToJokes)\n * .addEdge(\"generate_joke\", \"__end__\")\n * .compile();\n *\n * const res = await graph.invoke({ subjects: [\"cats\", \"dogs\"] });\n * console.log(res);\n *\n * // Invoking with two subjects results in a generated joke for each\n * // { subjects: [\"cats\", \"dogs\"], jokes: [`Joke about cats`, `Joke about dogs`] }\n * ```\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport declare class Send<Node extends string = string, Args = any> implements SendInterface<Node, Args> {\n lg_name: string;\n node: Node;\n args: Args;\n constructor(node: Node, args: Args);\n toJSON(): {\n lg_name: string;\n node: Node;\n args: Args;\n };\n}\nexport declare function _isSend(x: unknown): x is Send;\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type Interrupt<Value = any> = {\n id?: string;\n value?: Value;\n};\n/**\n * Checks if the given graph invoke / stream chunk contains interrupt.\n *\n * @example\n * ```ts\n * import { INTERRUPT, isInterrupted } from \"@langchain/langgraph\";\n *\n * const values = await graph.invoke({ foo: \"bar\" });\n * if (isInterrupted<string>(values)) {\n * const interrupt = values[INTERRUPT][0].value;\n * }\n * ```\n *\n * @param values - The values to check.\n * @returns `true` if the values contain an interrupt, `false` otherwise.\n */\nexport declare function isInterrupted<Value = unknown>(values: unknown): values is {\n [INTERRUPT]: Interrupt<Value>[];\n};\nexport type CommandParams<Resume = unknown, Update extends Record<string, unknown> = Record<string, unknown>, Nodes extends string = string> = {\n /**\n * A discriminator field used to identify the type of object. Must be populated when serializing.\n *\n * Optional because it's not required to specify this when directly constructing a {@link Command}\n * object.\n */\n lg_name?: \"Command\";\n /**\n * Value to resume execution with. To be used together with {@link interrupt}.\n */\n resume?: Resume;\n /**\n * Graph to send the command to. Supported values are:\n * - None: the current graph (default)\n * - The specific name of the graph to send the command to\n * - {@link Command.PARENT}: closest parent graph (only supported when returned from a node in a subgraph)\n */\n graph?: string;\n /**\n * Update to apply to the graph's state.\n */\n update?: Update | [string, unknown][];\n /**\n * Can be one of the following:\n * - name of the node to navigate to next (any node that belongs to the specified `graph`)\n * - sequence of node names to navigate to next\n * - `Send` object (to execute a node with the input provided)\n * - sequence of `Send` objects\n */\n goto?: Nodes | SendInterface<Nodes> // eslint-disable-line @typescript-eslint/no-explicit-any\n | (Nodes | SendInterface<Nodes>)[]; // eslint-disable-line @typescript-eslint/no-explicit-any\n};\n/**\n * One or more commands to update the graph's state and send messages to nodes.\n * Can be used to combine routing logic with state updates in lieu of conditional edges\n *\n * @example\n * ```ts\n * import { Annotation, Command } from \"@langchain/langgraph\";\n *\n * // Define graph state\n * const StateAnnotation = Annotation.Root({\n * foo: Annotation<string>,\n * });\n *\n * // Define the nodes\n * const nodeA = async (_state: typeof StateAnnotation.State) => {\n * console.log(\"Called A\");\n * // this is a replacement for a real conditional edge function\n * const goto = Math.random() > .5 ? \"nodeB\" : \"nodeC\";\n * // note how Command allows you to BOTH update the graph state AND route to the next node\n * return new Command({\n * // this is the state update\n * update: {\n * foo: \"a\",\n * },\n * // this is a replacement for an edge\n * goto,\n * });\n * };\n *\n * // Nodes B and C are unchanged\n * const nodeB = async (state: typeof StateAnnotation.State) => {\n * console.log(\"Called B\");\n * return {\n * foo: state.foo + \"|b\",\n * };\n * }\n *\n * const nodeC = async (state: typeof StateAnnotation.State) => {\n * console.log(\"Called C\");\n * return {\n * foo: state.foo + \"|c\",\n * };\n * }\n *\n * import { StateGraph } from \"@langchain/langgraph\";\n\n * // NOTE: there are no edges between nodes A, B and C!\n * const graph = new StateGraph(StateAnnotation)\n * .addNode(\"nodeA\", nodeA, {\n * ends: [\"nodeB\", \"nodeC\"],\n * })\n * .addNode(\"nodeB\", nodeB)\n * .addNode(\"nodeC\", nodeC)\n * .addEdge(\"__start__\", \"nodeA\")\n * .compile();\n *\n * await graph.invoke({ foo: \"\" });\n *\n * // Randomly oscillates between\n * // { foo: 'a|c' } and { foo: 'a|b' }\n * ```\n */\nexport declare class Command<Resume = unknown, Update extends Record<string, unknown> = Record<string, unknown>, Nodes extends string = string> extends CommandInstance {\n readonly lg_name: string;\n lc_direct_tool_output: boolean;\n /**\n * Graph to send the command to. Supported values are:\n * - None: the current graph (default)\n * - The specific name of the graph to send the command to\n * - {@link Command.PARENT}: closest parent graph (only supported when returned from a node in a subgraph)\n */\n graph?: string;\n /**\n * Update to apply to the graph's state as a result of executing the node that is returning the command.\n * Written to the state as if the node had simply returned this value instead of the Command object.\n */\n update?: Update | [string, unknown][];\n /**\n * Value to resume execution with. To be used together with {@link interrupt}.\n */\n resume?: Resume;\n /**\n * Can be one of the following:\n * - name of the node to navigate to next (any node that belongs to the specified `graph`)\n * - sequence of node names to navigate to next\n * - {@link Send} object (to execute a node with the exact input provided in the {@link Send} object)\n * - sequence of {@link Send} objects\n */\n goto?: Nodes | Send<Nodes> | (Nodes | Send<Nodes>)[];\n static PARENT: string;\n constructor(args: CommandParams<Resume, Update, Nodes>);\n /**\n * Convert the update field to a list of {@link PendingWrite} tuples\n * @returns List of {@link PendingWrite} tuples of the form `[channelKey, value]`.\n * @internal\n */\n _updateAsTuples(): PendingWrite[];\n toJSON(): {\n lg_name: string;\n update: Update | [string, unknown][] | undefined;\n resume: Resume | undefined;\n goto: Nodes | (Nodes | {\n lg_name: string;\n node: Nodes;\n args: any;\n })[] | {\n lg_name: string;\n node: Nodes;\n args: any;\n } | undefined;\n };\n}\n/**\n * A type guard to check if the given value is a {@link Command}.\n *\n * Useful for type narrowing when working with the {@link Command} object.\n *\n * @param x - The value to check.\n * @returns `true` if the value is a {@link Command}, `false` otherwise.\n */\nexport declare function isCommand(x: unknown): x is Command;\n/**\n * Reconstructs Command and Send objects from a deeply nested tree of anonymous objects\n * matching their interfaces.\n *\n * This is only exported for testing purposes. It is NOT intended to be used outside of\n * the Command and Send classes.\n *\n * @internal\n *\n * @param x - The command send tree to convert.\n * @param seen - A map of seen objects to avoid infinite loops.\n * @returns The converted command send tree.\n */\nexport declare function _deserializeCommandSendObjectGraph(x: unknown, seen?: Map<object, unknown>): unknown;\nexport {};\n"],"mappings":";;;;cAEqBC,KAAAA;AAArB;AAEqBC,cAAAA,GAAAA,GAAG,SAAA;;AAsJnBsB,cA3HgBA,SAAAA,GA2HhBA,eAAAA;;;;AAgCMiC,cAnJU7B,QAAAA,GAmJV6B,cAAAA;;cApIGf,cA+NKM,EAAAA,OAAAA,MAAAA;;;;;;;;;;AAYHO,cAjOKZ,eAAAA,CAiOLY;GAhOXb,cAAAA,CAiOSe,EAAAA,IAAAA;;;AAMIA,UApODb,aAoOCa,CAAAA,aAAAA,MAAAA,GAAAA,MAAAA,EAAAA,OAAAA,GAAAA,CAAAA,CAAAA;MA7CsId,EAtL9IE,IAsL8IF;QArL9IG;AA+OV;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA7LqBE,0DAA0DJ,cAAcC,MAAMC;;QAEzFD;QACAC;oBACYD,YAAYC;;;UAGpBD;UACAC;;;;KAKFI;;UAEAC;;;;;;;;;;;;;;;;;;iBAkBYC;GACnB5B,SAAAA,GAAY0B,UAAUC;;KAEfE,+CAA+CC,0BAA0BA;;;;;;;;;;;WAWxEC;;;;;;;;;;;WAWAC;;;;;;;;SAQFC,QAAQb,cAAca;KACzBA,QAAQb,cAAca;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAgETC,yCAAyCJ,0BAA0BA,gEAAgEX,eAAAA;;;;;;;;;;;;;;WAc3Ia;;;;WAIAD;;;;;;;;SAQFE,QAAQT,KAAKS,UAAUA,QAAQT,KAAKS;;oBAEzBJ,cAAcE,QAAQC,QAAQC;;;;;;qBAM7BzD;;;YAGPwD;YACAD;UACFE,SAASA;;YAELA;;;;YAIAA;;;;;;;;;;;;;iBAaME,SAAAA,mBAA4BD"}
|
|
1
|
+
{"version":3,"file":"constants.d.cts","names":["PendingWrite","START","END","INPUT","COPY","ERROR","CACHE_NS_WRITES","CONFIG_KEY_SEND","CONFIG_KEY_CALL","CONFIG_KEY_READ","CONFIG_KEY_CHECKPOINTER","CONFIG_KEY_RESUMING","CONFIG_KEY_TASK_ID","CONFIG_KEY_STREAM","CONFIG_KEY_RESUME_VALUE","CONFIG_KEY_RESUME_MAP","CONFIG_KEY_SCRATCHPAD","CONFIG_KEY_PREVIOUS_STATE","CONFIG_KEY_DURABILITY","CONFIG_KEY_CHECKPOINT_ID","CONFIG_KEY_CHECKPOINT_NS","CONFIG_KEY_NODE_FINISHED","CONFIG_KEY_CHECKPOINT_MAP","CONFIG_KEY_ABORT_SIGNALS","INTERRUPT","RESUME","NO_WRITES","RETURN","PREVIOUS","RUNTIME_PLACEHOLDER","RECURSION_LIMIT_DEFAULT","TAG_HIDDEN","TAG_NOSTREAM","SELF","TASKS","PUSH","PULL","TASK_NAMESPACE","NULL_TASK_ID","RESERVED","CHECKPOINT_NAMESPACE_SEPARATOR","CHECKPOINT_NAMESPACE_END","COMMAND_SYMBOL","CommandInstance","Record","Resume","Update","Nodes","CommandParams","SendInterface","Node","Args","_isSendInterface","Send","_isSend","Interrupt","Value","isInterrupted","Command","Omit","isCommand","_deserializeCommandSendObjectGraph","Map"],"sources":["../src/constants.d.ts"],"sourcesContent":["import { PendingWrite } from \"@langchain/langgraph-checkpoint\";\n/** Special reserved node name denoting the start of a graph. */\nexport declare const START = \"__start__\";\n/** Special reserved node name denoting the end of a graph. */\nexport declare const END = \"__end__\";\nexport declare const INPUT = \"__input__\";\nexport declare const COPY = \"__copy__\";\nexport declare const ERROR = \"__error__\";\n/** Special reserved cache namespaces */\nexport declare const CACHE_NS_WRITES = \"__pregel_ns_writes\";\nexport declare const CONFIG_KEY_SEND = \"__pregel_send\";\n/** config key containing function used to call a node (push task) */\nexport declare const CONFIG_KEY_CALL = \"__pregel_call\";\nexport declare const CONFIG_KEY_READ = \"__pregel_read\";\nexport declare const CONFIG_KEY_CHECKPOINTER = \"__pregel_checkpointer\";\nexport declare const CONFIG_KEY_RESUMING = \"__pregel_resuming\";\nexport declare const CONFIG_KEY_TASK_ID = \"__pregel_task_id\";\nexport declare const CONFIG_KEY_STREAM = \"__pregel_stream\";\nexport declare const CONFIG_KEY_RESUME_VALUE = \"__pregel_resume_value\";\nexport declare const CONFIG_KEY_RESUME_MAP = \"__pregel_resume_map\";\nexport declare const CONFIG_KEY_SCRATCHPAD = \"__pregel_scratchpad\";\n/** config key containing state from previous invocation of graph for the given thread */\nexport declare const CONFIG_KEY_PREVIOUS_STATE = \"__pregel_previous\";\nexport declare const CONFIG_KEY_DURABILITY = \"__pregel_durability\";\nexport declare const CONFIG_KEY_CHECKPOINT_ID = \"checkpoint_id\";\nexport declare const CONFIG_KEY_CHECKPOINT_NS = \"checkpoint_ns\";\nexport declare const CONFIG_KEY_NODE_FINISHED = \"__pregel_node_finished\";\n// this one is part of public API\nexport declare const CONFIG_KEY_CHECKPOINT_MAP = \"checkpoint_map\";\nexport declare const CONFIG_KEY_ABORT_SIGNALS = \"__pregel_abort_signals\";\n/** Special channel reserved for graph interrupts */\nexport declare const INTERRUPT = \"__interrupt__\";\n/** Special channel reserved for graph resume */\nexport declare const RESUME = \"__resume__\";\n/** Special channel reserved for cases when a task exits without any writes */\nexport declare const NO_WRITES = \"__no_writes__\";\n/** Special channel reserved for graph return */\nexport declare const RETURN = \"__return__\";\n/** Special channel reserved for graph previous state */\nexport declare const PREVIOUS = \"__previous__\";\nexport declare const RUNTIME_PLACEHOLDER = \"__pregel_runtime_placeholder__\";\nexport declare const RECURSION_LIMIT_DEFAULT = 25;\nexport declare const TAG_HIDDEN = \"langsmith:hidden\";\nexport declare const TAG_NOSTREAM = \"langsmith:nostream\";\nexport declare const SELF = \"__self__\";\nexport declare const TASKS = \"__pregel_tasks\";\nexport declare const PUSH = \"__pregel_push\";\nexport declare const PULL = \"__pregel_pull\";\nexport declare const TASK_NAMESPACE = \"6ba7b831-9dad-11d1-80b4-00c04fd430c8\";\nexport declare const NULL_TASK_ID = \"00000000-0000-0000-0000-000000000000\";\nexport declare const RESERVED: string[];\nexport declare const CHECKPOINT_NAMESPACE_SEPARATOR = \"|\";\nexport declare const CHECKPOINT_NAMESPACE_END = \":\";\n/** @internal */\ndeclare const COMMAND_SYMBOL: unique symbol;\n/**\n * Instance of a {@link Command} class.\n *\n * This is used to avoid IntelliSense suggesting public fields\n * of {@link Command} class when a plain object is expected.\n *\n * @see {@link Command}\n * @internal\n */\nexport declare class CommandInstance<Resume = unknown, Update extends Record<string, unknown> = Record<string, unknown>, Nodes extends string = string> {\n [COMMAND_SYMBOL]: CommandParams<Resume, Update, Nodes>;\n constructor(args: CommandParams<Resume, Update, Nodes>);\n}\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport interface SendInterface<Node extends string = string, Args = any> {\n node: Node;\n args: Args;\n}\nexport declare function _isSendInterface(x: unknown): x is SendInterface;\n/**\n *\n * A message or packet to send to a specific node in the graph.\n *\n * The `Send` class is used within a `StateGraph`'s conditional edges to\n * dynamically invoke a node with a custom state at the next step.\n *\n * Importantly, the sent state can differ from the core graph's state,\n * allowing for flexible and dynamic workflow management.\n *\n * One such example is a \"map-reduce\" workflow where your graph invokes\n * the same node multiple times in parallel with different states,\n * before aggregating the results back into the main graph's state.\n *\n * @example\n * ```typescript\n * import { Annotation, Send, StateGraph } from \"@langchain/langgraph\";\n *\n * const ChainState = Annotation.Root({\n * subjects: Annotation<string[]>,\n * jokes: Annotation<string[]>({\n * reducer: (a, b) => a.concat(b),\n * }),\n * });\n *\n * const continueToJokes = async (state: typeof ChainState.State) => {\n * return state.subjects.map((subject) => {\n * return new Send(\"generate_joke\", { subjects: [subject] });\n * });\n * };\n *\n * const graph = new StateGraph(ChainState)\n * .addNode(\"generate_joke\", (state) => ({\n * jokes: [`Joke about ${state.subjects}`],\n * }))\n * .addConditionalEdges(\"__start__\", continueToJokes)\n * .addEdge(\"generate_joke\", \"__end__\")\n * .compile();\n *\n * const res = await graph.invoke({ subjects: [\"cats\", \"dogs\"] });\n * console.log(res);\n *\n * // Invoking with two subjects results in a generated joke for each\n * // { subjects: [\"cats\", \"dogs\"], jokes: [`Joke about cats`, `Joke about dogs`] }\n * ```\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport declare class Send<Node extends string = string, Args = any> implements SendInterface<Node, Args> {\n lg_name: string;\n node: Node;\n args: Args;\n constructor(node: Node, args: Args);\n toJSON(): {\n lg_name: string;\n node: Node;\n args: Args;\n };\n}\nexport declare function _isSend(x: unknown): x is Send;\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type Interrupt<Value = any> = {\n id?: string;\n value?: Value;\n};\n/**\n * Checks if the given graph invoke / stream chunk contains interrupt.\n *\n * @example\n * ```ts\n * import { INTERRUPT, isInterrupted } from \"@langchain/langgraph\";\n *\n * const values = await graph.invoke({ foo: \"bar\" });\n * if (isInterrupted<string>(values)) {\n * const interrupt = values[INTERRUPT][0].value;\n * }\n * ```\n *\n * @param values - The values to check.\n * @returns `true` if the values contain an interrupt, `false` otherwise.\n */\nexport declare function isInterrupted<Value = unknown>(values: unknown): values is {\n [INTERRUPT]: Interrupt<Value>[];\n};\nexport type CommandParams<Resume = unknown, Update extends Record<string, unknown> = Record<string, unknown>, Nodes extends string = string> = {\n /**\n * A discriminator field used to identify the type of object. Must be populated when serializing.\n *\n * Optional because it's not required to specify this when directly constructing a {@link Command}\n * object.\n */\n lg_name?: \"Command\";\n /**\n * Value to resume execution with. To be used together with {@link interrupt}.\n */\n resume?: Resume;\n /**\n * Graph to send the command to. Supported values are:\n * - None: the current graph (default)\n * - The specific name of the graph to send the command to\n * - {@link Command.PARENT}: closest parent graph (only supported when returned from a node in a subgraph)\n */\n graph?: string;\n /**\n * Update to apply to the graph's state.\n */\n update?: Update | [string, unknown][];\n /**\n * Can be one of the following:\n * - name of the node to navigate to next (any node that belongs to the specified `graph`)\n * - sequence of node names to navigate to next\n * - `Send` object (to execute a node with the input provided)\n * - sequence of `Send` objects\n */\n goto?: Nodes | SendInterface<Nodes> // eslint-disable-line @typescript-eslint/no-explicit-any\n | (Nodes | SendInterface<Nodes>)[]; // eslint-disable-line @typescript-eslint/no-explicit-any\n};\n/**\n * One or more commands to update the graph's state and send messages to nodes.\n * Can be used to combine routing logic with state updates in lieu of conditional edges\n *\n * @example\n * ```ts\n * import { Annotation, Command } from \"@langchain/langgraph\";\n *\n * // Define graph state\n * const StateAnnotation = Annotation.Root({\n * foo: Annotation<string>,\n * });\n *\n * // Define the nodes\n * const nodeA = async (_state: typeof StateAnnotation.State) => {\n * console.log(\"Called A\");\n * // this is a replacement for a real conditional edge function\n * const goto = Math.random() > .5 ? \"nodeB\" : \"nodeC\";\n * // note how Command allows you to BOTH update the graph state AND route to the next node\n * return new Command({\n * // this is the state update\n * update: {\n * foo: \"a\",\n * },\n * // this is a replacement for an edge\n * goto,\n * });\n * };\n *\n * // Nodes B and C are unchanged\n * const nodeB = async (state: typeof StateAnnotation.State) => {\n * console.log(\"Called B\");\n * return {\n * foo: state.foo + \"|b\",\n * };\n * }\n *\n * const nodeC = async (state: typeof StateAnnotation.State) => {\n * console.log(\"Called C\");\n * return {\n * foo: state.foo + \"|c\",\n * };\n * }\n *\n * import { StateGraph } from \"@langchain/langgraph\";\n\n * // NOTE: there are no edges between nodes A, B and C!\n * const graph = new StateGraph(StateAnnotation)\n * .addNode(\"nodeA\", nodeA, {\n * ends: [\"nodeB\", \"nodeC\"],\n * })\n * .addNode(\"nodeB\", nodeB)\n * .addNode(\"nodeC\", nodeC)\n * .addEdge(\"__start__\", \"nodeA\")\n * .compile();\n *\n * await graph.invoke({ foo: \"\" });\n *\n * // Randomly oscillates between\n * // { foo: 'a|c' } and { foo: 'a|b' }\n * ```\n */\nexport declare class Command<Resume = unknown, Update extends Record<string, unknown> = Record<string, unknown>, Nodes extends string = string> extends CommandInstance<Resume, Update, Nodes> {\n readonly lg_name: string;\n lc_direct_tool_output: boolean;\n /**\n * Graph to send the command to. Supported values are:\n * - None: the current graph (default)\n * - The specific name of the graph to send the command to\n * - {@link Command.PARENT}: closest parent graph (only supported when returned from a node in a subgraph)\n */\n graph?: string;\n /**\n * Update to apply to the graph's state as a result of executing the node that is returning the command.\n * Written to the state as if the node had simply returned this value instead of the Command object.\n */\n update?: Update | [string, unknown][];\n /**\n * Value to resume execution with. To be used together with {@link interrupt}.\n */\n resume?: Resume;\n /**\n * Can be one of the following:\n * - name of the node to navigate to next (any node that belongs to the specified `graph`)\n * - sequence of node names to navigate to next\n * - {@link Send} object (to execute a node with the exact input provided in the {@link Send} object)\n * - sequence of {@link Send} objects\n */\n goto?: Nodes | Send<Nodes> | (Nodes | Send<Nodes>)[];\n static PARENT: string;\n constructor(args: Omit<CommandParams<Resume, Update, Nodes>, \"lg_name\">);\n /**\n * Convert the update field to a list of {@link PendingWrite} tuples\n * @returns List of {@link PendingWrite} tuples of the form `[channelKey, value]`.\n * @internal\n */\n _updateAsTuples(): PendingWrite[];\n toJSON(): {\n lg_name: string;\n update: Update | [string, unknown][] | undefined;\n resume: Resume | undefined;\n goto: Nodes | (Nodes | {\n lg_name: string;\n node: Nodes;\n args: any;\n })[] | {\n lg_name: string;\n node: Nodes;\n args: any;\n } | undefined;\n };\n}\n/**\n * A type guard to check if the given value is a {@link Command}.\n *\n * Useful for type narrowing when working with the {@link Command} object.\n *\n * @param x - The value to check.\n * @returns `true` if the value is a {@link Command}, `false` otherwise.\n */\nexport declare function isCommand(x: unknown): x is Command;\n/**\n * Reconstructs Command and Send objects from a deeply nested tree of anonymous objects\n * matching their interfaces.\n *\n * This is only exported for testing purposes. It is NOT intended to be used outside of\n * the Command and Send classes.\n *\n * @internal\n *\n * @param x - The command send tree to convert.\n * @param seen - A map of seen objects to avoid infinite loops.\n * @returns The converted command send tree.\n */\nexport declare function _deserializeCommandSendObjectGraph(x: unknown, seen?: Map<object, unknown>): unknown;\nexport {};\n"],"mappings":";;;;cAEqBC,KAAAA;AAArB;AAEqBC,cAAAA,GAAAA,GAAG,SAAA;;AAuHdgD,cA5FW1B,SAAAA,GA4FX0B,eAAAA;;;;AAWEK,cA/FS3B,QAAAA,GAiGT4B,cAAAA;;cAlFEd,cAqIKO,EAAAA,OAAAA,MAAAA;;;;;AAiEnB;;;;;AAAgLH,cA5L3JH,eA4L2JG,CAAAA,SAAAA,OAAAA,EAAAA,eA5L1GF,MA4L0GE,CAAAA,MAAAA,EAAAA,OAAAA,C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9 @@ declare const COMMAND_SYMBOL: unique symbol;
|
|
|
22
22
|
* @see {@link Command}
|
|
23
23
|
* @internal
|
|
24
24
|
*/
|
|
25
|
-
declare class CommandInstance {
|
|
26
|
-
[COMMAND_SYMBOL]:
|
|
25
|
+
declare class CommandInstance<Resume = unknown, Update extends Record<string, unknown> = Record<string, unknown>, Nodes extends string = string> {
|
|
26
|
+
[COMMAND_SYMBOL]: CommandParams<Resume, Update, Nodes>;
|
|
27
|
+
constructor(args: CommandParams<Resume, Update, Nodes>);
|
|
27
28
|
}
|
|
28
29
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
29
30
|
interface SendInterface<Node extends string = string, Args = any> {
|
|
@@ -207,7 +208,7 @@ type CommandParams<Resume = unknown, Update extends Record<string, unknown> = Re
|
|
|
207
208
|
* // { foo: 'a|c' } and { foo: 'a|b' }
|
|
208
209
|
* ```
|
|
209
210
|
*/
|
|
210
|
-
declare class Command<Resume = unknown, Update extends Record<string, unknown> = Record<string, unknown>, Nodes extends string = string> extends CommandInstance {
|
|
211
|
+
declare class Command<Resume = unknown, Update extends Record<string, unknown> = Record<string, unknown>, Nodes extends string = string> extends CommandInstance<Resume, Update, Nodes> {
|
|
211
212
|
readonly lg_name: string;
|
|
212
213
|
lc_direct_tool_output: boolean;
|
|
213
214
|
/**
|
|
@@ -235,7 +236,7 @@ declare class Command<Resume = unknown, Update extends Record<string, unknown> =
|
|
|
235
236
|
*/
|
|
236
237
|
goto?: Nodes | Send<Nodes> | (Nodes | Send<Nodes>)[];
|
|
237
238
|
static PARENT: string;
|
|
238
|
-
constructor(args: CommandParams<Resume, Update, Nodes>);
|
|
239
|
+
constructor(args: Omit<CommandParams<Resume, Update, Nodes>, "lg_name">);
|
|
239
240
|
/**
|
|
240
241
|
* Convert the update field to a list of {@link PendingWrite} tuples
|
|
241
242
|
* @returns List of {@link PendingWrite} tuples of the form `[channelKey, value]`.
|
package/dist/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","names":["PendingWrite","START","END","INPUT","COPY","ERROR","CACHE_NS_WRITES","CONFIG_KEY_SEND","CONFIG_KEY_CALL","CONFIG_KEY_READ","CONFIG_KEY_CHECKPOINTER","CONFIG_KEY_RESUMING","CONFIG_KEY_TASK_ID","CONFIG_KEY_STREAM","CONFIG_KEY_RESUME_VALUE","CONFIG_KEY_RESUME_MAP","CONFIG_KEY_SCRATCHPAD","CONFIG_KEY_PREVIOUS_STATE","CONFIG_KEY_DURABILITY","CONFIG_KEY_CHECKPOINT_ID","CONFIG_KEY_CHECKPOINT_NS","CONFIG_KEY_NODE_FINISHED","CONFIG_KEY_CHECKPOINT_MAP","CONFIG_KEY_ABORT_SIGNALS","INTERRUPT","RESUME","NO_WRITES","RETURN","PREVIOUS","RUNTIME_PLACEHOLDER","RECURSION_LIMIT_DEFAULT","TAG_HIDDEN","TAG_NOSTREAM","SELF","TASKS","PUSH","PULL","TASK_NAMESPACE","NULL_TASK_ID","RESERVED","CHECKPOINT_NAMESPACE_SEPARATOR","CHECKPOINT_NAMESPACE_END","COMMAND_SYMBOL","CommandInstance","SendInterface","Node","Args","_isSendInterface","Send","_isSend","Interrupt","Value","isInterrupted","CommandParams","Record","Resume","Update","Nodes","Command","isCommand","_deserializeCommandSendObjectGraph","Map"],"sources":["../src/constants.d.ts"],"sourcesContent":["import { PendingWrite } from \"@langchain/langgraph-checkpoint\";\n/** Special reserved node name denoting the start of a graph. */\nexport declare const START = \"__start__\";\n/** Special reserved node name denoting the end of a graph. */\nexport declare const END = \"__end__\";\nexport declare const INPUT = \"__input__\";\nexport declare const COPY = \"__copy__\";\nexport declare const ERROR = \"__error__\";\n/** Special reserved cache namespaces */\nexport declare const CACHE_NS_WRITES = \"__pregel_ns_writes\";\nexport declare const CONFIG_KEY_SEND = \"__pregel_send\";\n/** config key containing function used to call a node (push task) */\nexport declare const CONFIG_KEY_CALL = \"__pregel_call\";\nexport declare const CONFIG_KEY_READ = \"__pregel_read\";\nexport declare const CONFIG_KEY_CHECKPOINTER = \"__pregel_checkpointer\";\nexport declare const CONFIG_KEY_RESUMING = \"__pregel_resuming\";\nexport declare const CONFIG_KEY_TASK_ID = \"__pregel_task_id\";\nexport declare const CONFIG_KEY_STREAM = \"__pregel_stream\";\nexport declare const CONFIG_KEY_RESUME_VALUE = \"__pregel_resume_value\";\nexport declare const CONFIG_KEY_RESUME_MAP = \"__pregel_resume_map\";\nexport declare const CONFIG_KEY_SCRATCHPAD = \"__pregel_scratchpad\";\n/** config key containing state from previous invocation of graph for the given thread */\nexport declare const CONFIG_KEY_PREVIOUS_STATE = \"__pregel_previous\";\nexport declare const CONFIG_KEY_DURABILITY = \"__pregel_durability\";\nexport declare const CONFIG_KEY_CHECKPOINT_ID = \"checkpoint_id\";\nexport declare const CONFIG_KEY_CHECKPOINT_NS = \"checkpoint_ns\";\nexport declare const CONFIG_KEY_NODE_FINISHED = \"__pregel_node_finished\";\n// this one is part of public API\nexport declare const CONFIG_KEY_CHECKPOINT_MAP = \"checkpoint_map\";\nexport declare const CONFIG_KEY_ABORT_SIGNALS = \"__pregel_abort_signals\";\n/** Special channel reserved for graph interrupts */\nexport declare const INTERRUPT = \"__interrupt__\";\n/** Special channel reserved for graph resume */\nexport declare const RESUME = \"__resume__\";\n/** Special channel reserved for cases when a task exits without any writes */\nexport declare const NO_WRITES = \"__no_writes__\";\n/** Special channel reserved for graph return */\nexport declare const RETURN = \"__return__\";\n/** Special channel reserved for graph previous state */\nexport declare const PREVIOUS = \"__previous__\";\nexport declare const RUNTIME_PLACEHOLDER = \"__pregel_runtime_placeholder__\";\nexport declare const RECURSION_LIMIT_DEFAULT = 25;\nexport declare const TAG_HIDDEN = \"langsmith:hidden\";\nexport declare const TAG_NOSTREAM = \"langsmith:nostream\";\nexport declare const SELF = \"__self__\";\nexport declare const TASKS = \"__pregel_tasks\";\nexport declare const PUSH = \"__pregel_push\";\nexport declare const PULL = \"__pregel_pull\";\nexport declare const TASK_NAMESPACE = \"6ba7b831-9dad-11d1-80b4-00c04fd430c8\";\nexport declare const NULL_TASK_ID = \"00000000-0000-0000-0000-000000000000\";\nexport declare const RESERVED: string[];\nexport declare const CHECKPOINT_NAMESPACE_SEPARATOR = \"|\";\nexport declare const CHECKPOINT_NAMESPACE_END = \":\";\n/** @internal */\ndeclare const COMMAND_SYMBOL: unique symbol;\n/**\n * Instance of a {@link Command} class.\n *\n * This is used to avoid IntelliSense suggesting public fields\n * of {@link Command} class when a plain object is expected.\n *\n * @see {@link Command}\n * @internal\n */\nexport declare class CommandInstance {\n [COMMAND_SYMBOL]: true;\n}\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport interface SendInterface<Node extends string = string, Args = any> {\n node: Node;\n args: Args;\n}\nexport declare function _isSendInterface(x: unknown): x is SendInterface;\n/**\n *\n * A message or packet to send to a specific node in the graph.\n *\n * The `Send` class is used within a `StateGraph`'s conditional edges to\n * dynamically invoke a node with a custom state at the next step.\n *\n * Importantly, the sent state can differ from the core graph's state,\n * allowing for flexible and dynamic workflow management.\n *\n * One such example is a \"map-reduce\" workflow where your graph invokes\n * the same node multiple times in parallel with different states,\n * before aggregating the results back into the main graph's state.\n *\n * @example\n * ```typescript\n * import { Annotation, Send, StateGraph } from \"@langchain/langgraph\";\n *\n * const ChainState = Annotation.Root({\n * subjects: Annotation<string[]>,\n * jokes: Annotation<string[]>({\n * reducer: (a, b) => a.concat(b),\n * }),\n * });\n *\n * const continueToJokes = async (state: typeof ChainState.State) => {\n * return state.subjects.map((subject) => {\n * return new Send(\"generate_joke\", { subjects: [subject] });\n * });\n * };\n *\n * const graph = new StateGraph(ChainState)\n * .addNode(\"generate_joke\", (state) => ({\n * jokes: [`Joke about ${state.subjects}`],\n * }))\n * .addConditionalEdges(\"__start__\", continueToJokes)\n * .addEdge(\"generate_joke\", \"__end__\")\n * .compile();\n *\n * const res = await graph.invoke({ subjects: [\"cats\", \"dogs\"] });\n * console.log(res);\n *\n * // Invoking with two subjects results in a generated joke for each\n * // { subjects: [\"cats\", \"dogs\"], jokes: [`Joke about cats`, `Joke about dogs`] }\n * ```\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport declare class Send<Node extends string = string, Args = any> implements SendInterface<Node, Args> {\n lg_name: string;\n node: Node;\n args: Args;\n constructor(node: Node, args: Args);\n toJSON(): {\n lg_name: string;\n node: Node;\n args: Args;\n };\n}\nexport declare function _isSend(x: unknown): x is Send;\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type Interrupt<Value = any> = {\n id?: string;\n value?: Value;\n};\n/**\n * Checks if the given graph invoke / stream chunk contains interrupt.\n *\n * @example\n * ```ts\n * import { INTERRUPT, isInterrupted } from \"@langchain/langgraph\";\n *\n * const values = await graph.invoke({ foo: \"bar\" });\n * if (isInterrupted<string>(values)) {\n * const interrupt = values[INTERRUPT][0].value;\n * }\n * ```\n *\n * @param values - The values to check.\n * @returns `true` if the values contain an interrupt, `false` otherwise.\n */\nexport declare function isInterrupted<Value = unknown>(values: unknown): values is {\n [INTERRUPT]: Interrupt<Value>[];\n};\nexport type CommandParams<Resume = unknown, Update extends Record<string, unknown> = Record<string, unknown>, Nodes extends string = string> = {\n /**\n * A discriminator field used to identify the type of object. Must be populated when serializing.\n *\n * Optional because it's not required to specify this when directly constructing a {@link Command}\n * object.\n */\n lg_name?: \"Command\";\n /**\n * Value to resume execution with. To be used together with {@link interrupt}.\n */\n resume?: Resume;\n /**\n * Graph to send the command to. Supported values are:\n * - None: the current graph (default)\n * - The specific name of the graph to send the command to\n * - {@link Command.PARENT}: closest parent graph (only supported when returned from a node in a subgraph)\n */\n graph?: string;\n /**\n * Update to apply to the graph's state.\n */\n update?: Update | [string, unknown][];\n /**\n * Can be one of the following:\n * - name of the node to navigate to next (any node that belongs to the specified `graph`)\n * - sequence of node names to navigate to next\n * - `Send` object (to execute a node with the input provided)\n * - sequence of `Send` objects\n */\n goto?: Nodes | SendInterface<Nodes> // eslint-disable-line @typescript-eslint/no-explicit-any\n | (Nodes | SendInterface<Nodes>)[]; // eslint-disable-line @typescript-eslint/no-explicit-any\n};\n/**\n * One or more commands to update the graph's state and send messages to nodes.\n * Can be used to combine routing logic with state updates in lieu of conditional edges\n *\n * @example\n * ```ts\n * import { Annotation, Command } from \"@langchain/langgraph\";\n *\n * // Define graph state\n * const StateAnnotation = Annotation.Root({\n * foo: Annotation<string>,\n * });\n *\n * // Define the nodes\n * const nodeA = async (_state: typeof StateAnnotation.State) => {\n * console.log(\"Called A\");\n * // this is a replacement for a real conditional edge function\n * const goto = Math.random() > .5 ? \"nodeB\" : \"nodeC\";\n * // note how Command allows you to BOTH update the graph state AND route to the next node\n * return new Command({\n * // this is the state update\n * update: {\n * foo: \"a\",\n * },\n * // this is a replacement for an edge\n * goto,\n * });\n * };\n *\n * // Nodes B and C are unchanged\n * const nodeB = async (state: typeof StateAnnotation.State) => {\n * console.log(\"Called B\");\n * return {\n * foo: state.foo + \"|b\",\n * };\n * }\n *\n * const nodeC = async (state: typeof StateAnnotation.State) => {\n * console.log(\"Called C\");\n * return {\n * foo: state.foo + \"|c\",\n * };\n * }\n *\n * import { StateGraph } from \"@langchain/langgraph\";\n\n * // NOTE: there are no edges between nodes A, B and C!\n * const graph = new StateGraph(StateAnnotation)\n * .addNode(\"nodeA\", nodeA, {\n * ends: [\"nodeB\", \"nodeC\"],\n * })\n * .addNode(\"nodeB\", nodeB)\n * .addNode(\"nodeC\", nodeC)\n * .addEdge(\"__start__\", \"nodeA\")\n * .compile();\n *\n * await graph.invoke({ foo: \"\" });\n *\n * // Randomly oscillates between\n * // { foo: 'a|c' } and { foo: 'a|b' }\n * ```\n */\nexport declare class Command<Resume = unknown, Update extends Record<string, unknown> = Record<string, unknown>, Nodes extends string = string> extends CommandInstance {\n readonly lg_name: string;\n lc_direct_tool_output: boolean;\n /**\n * Graph to send the command to. Supported values are:\n * - None: the current graph (default)\n * - The specific name of the graph to send the command to\n * - {@link Command.PARENT}: closest parent graph (only supported when returned from a node in a subgraph)\n */\n graph?: string;\n /**\n * Update to apply to the graph's state as a result of executing the node that is returning the command.\n * Written to the state as if the node had simply returned this value instead of the Command object.\n */\n update?: Update | [string, unknown][];\n /**\n * Value to resume execution with. To be used together with {@link interrupt}.\n */\n resume?: Resume;\n /**\n * Can be one of the following:\n * - name of the node to navigate to next (any node that belongs to the specified `graph`)\n * - sequence of node names to navigate to next\n * - {@link Send} object (to execute a node with the exact input provided in the {@link Send} object)\n * - sequence of {@link Send} objects\n */\n goto?: Nodes | Send<Nodes> | (Nodes | Send<Nodes>)[];\n static PARENT: string;\n constructor(args: CommandParams<Resume, Update, Nodes>);\n /**\n * Convert the update field to a list of {@link PendingWrite} tuples\n * @returns List of {@link PendingWrite} tuples of the form `[channelKey, value]`.\n * @internal\n */\n _updateAsTuples(): PendingWrite[];\n toJSON(): {\n lg_name: string;\n update: Update | [string, unknown][] | undefined;\n resume: Resume | undefined;\n goto: Nodes | (Nodes | {\n lg_name: string;\n node: Nodes;\n args: any;\n })[] | {\n lg_name: string;\n node: Nodes;\n args: any;\n } | undefined;\n };\n}\n/**\n * A type guard to check if the given value is a {@link Command}.\n *\n * Useful for type narrowing when working with the {@link Command} object.\n *\n * @param x - The value to check.\n * @returns `true` if the value is a {@link Command}, `false` otherwise.\n */\nexport declare function isCommand(x: unknown): x is Command;\n/**\n * Reconstructs Command and Send objects from a deeply nested tree of anonymous objects\n * matching their interfaces.\n *\n * This is only exported for testing purposes. It is NOT intended to be used outside of\n * the Command and Send classes.\n *\n * @internal\n *\n * @param x - The command send tree to convert.\n * @param seen - A map of seen objects to avoid infinite loops.\n * @returns The converted command send tree.\n */\nexport declare function _deserializeCommandSendObjectGraph(x: unknown, seen?: Map<object, unknown>): unknown;\nexport {};\n"],"mappings":";;;;cAEqBC,KAAAA;AAArB;AAEqBC,cAAAA,GAAAA,GAAG,SAAA;;AAsJnBsB,cA3HgBA,SAAAA,GA2HhBA,eAAAA;;;;AAgCMiC,cAnJU7B,QAAAA,GAmJV6B,cAAAA;;cApIGf,cA+NKM,EAAAA,OAAAA,MAAAA;;;;;;;;;;AAYHO,cAjOKZ,eAAAA,CAiOLY;GAhOXb,cAAAA,CAiOSe,EAAAA,IAAAA;;;AAMIA,UApODb,aAoOCa,CAAAA,aAAAA,MAAAA,GAAAA,MAAAA,EAAAA,OAAAA,GAAAA,CAAAA,CAAAA;MA7CsId,EAtL9IE,IAsL8IF;QArL9IG;AA+OV;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA7LqBE,0DAA0DJ,cAAcC,MAAMC;;QAEzFD;QACAC;oBACYD,YAAYC;;;UAGpBD;UACAC;;;;KAKFI;;UAEAC;;;;;;;;;;;;;;;;;;iBAkBYC;GACnB5B,SAAAA,GAAY0B,UAAUC;;KAEfE,+CAA+CC,0BAA0BA;;;;;;;;;;;WAWxEC;;;;;;;;;;;WAWAC;;;;;;;;SAQFC,QAAQb,cAAca;KACzBA,QAAQb,cAAca;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAgETC,yCAAyCJ,0BAA0BA,gEAAgEX,eAAAA;;;;;;;;;;;;;;WAc3Ia;;;;WAIAD;;;;;;;;SAQFE,QAAQT,KAAKS,UAAUA,QAAQT,KAAKS;;oBAEzBJ,cAAcE,QAAQC,QAAQC;;;;;;qBAM7BzD;;;YAGPwD;YACAD;UACFE,SAASA;;YAELA;;;;YAIAA;;;;;;;;;;;;;iBAaME,SAAAA,mBAA4BD"}
|
|
1
|
+
{"version":3,"file":"constants.d.ts","names":["PendingWrite","START","END","INPUT","COPY","ERROR","CACHE_NS_WRITES","CONFIG_KEY_SEND","CONFIG_KEY_CALL","CONFIG_KEY_READ","CONFIG_KEY_CHECKPOINTER","CONFIG_KEY_RESUMING","CONFIG_KEY_TASK_ID","CONFIG_KEY_STREAM","CONFIG_KEY_RESUME_VALUE","CONFIG_KEY_RESUME_MAP","CONFIG_KEY_SCRATCHPAD","CONFIG_KEY_PREVIOUS_STATE","CONFIG_KEY_DURABILITY","CONFIG_KEY_CHECKPOINT_ID","CONFIG_KEY_CHECKPOINT_NS","CONFIG_KEY_NODE_FINISHED","CONFIG_KEY_CHECKPOINT_MAP","CONFIG_KEY_ABORT_SIGNALS","INTERRUPT","RESUME","NO_WRITES","RETURN","PREVIOUS","RUNTIME_PLACEHOLDER","RECURSION_LIMIT_DEFAULT","TAG_HIDDEN","TAG_NOSTREAM","SELF","TASKS","PUSH","PULL","TASK_NAMESPACE","NULL_TASK_ID","RESERVED","CHECKPOINT_NAMESPACE_SEPARATOR","CHECKPOINT_NAMESPACE_END","COMMAND_SYMBOL","CommandInstance","Record","Resume","Update","Nodes","CommandParams","SendInterface","Node","Args","_isSendInterface","Send","_isSend","Interrupt","Value","isInterrupted","Command","Omit","isCommand","_deserializeCommandSendObjectGraph","Map"],"sources":["../src/constants.d.ts"],"sourcesContent":["import { PendingWrite } from \"@langchain/langgraph-checkpoint\";\n/** Special reserved node name denoting the start of a graph. */\nexport declare const START = \"__start__\";\n/** Special reserved node name denoting the end of a graph. */\nexport declare const END = \"__end__\";\nexport declare const INPUT = \"__input__\";\nexport declare const COPY = \"__copy__\";\nexport declare const ERROR = \"__error__\";\n/** Special reserved cache namespaces */\nexport declare const CACHE_NS_WRITES = \"__pregel_ns_writes\";\nexport declare const CONFIG_KEY_SEND = \"__pregel_send\";\n/** config key containing function used to call a node (push task) */\nexport declare const CONFIG_KEY_CALL = \"__pregel_call\";\nexport declare const CONFIG_KEY_READ = \"__pregel_read\";\nexport declare const CONFIG_KEY_CHECKPOINTER = \"__pregel_checkpointer\";\nexport declare const CONFIG_KEY_RESUMING = \"__pregel_resuming\";\nexport declare const CONFIG_KEY_TASK_ID = \"__pregel_task_id\";\nexport declare const CONFIG_KEY_STREAM = \"__pregel_stream\";\nexport declare const CONFIG_KEY_RESUME_VALUE = \"__pregel_resume_value\";\nexport declare const CONFIG_KEY_RESUME_MAP = \"__pregel_resume_map\";\nexport declare const CONFIG_KEY_SCRATCHPAD = \"__pregel_scratchpad\";\n/** config key containing state from previous invocation of graph for the given thread */\nexport declare const CONFIG_KEY_PREVIOUS_STATE = \"__pregel_previous\";\nexport declare const CONFIG_KEY_DURABILITY = \"__pregel_durability\";\nexport declare const CONFIG_KEY_CHECKPOINT_ID = \"checkpoint_id\";\nexport declare const CONFIG_KEY_CHECKPOINT_NS = \"checkpoint_ns\";\nexport declare const CONFIG_KEY_NODE_FINISHED = \"__pregel_node_finished\";\n// this one is part of public API\nexport declare const CONFIG_KEY_CHECKPOINT_MAP = \"checkpoint_map\";\nexport declare const CONFIG_KEY_ABORT_SIGNALS = \"__pregel_abort_signals\";\n/** Special channel reserved for graph interrupts */\nexport declare const INTERRUPT = \"__interrupt__\";\n/** Special channel reserved for graph resume */\nexport declare const RESUME = \"__resume__\";\n/** Special channel reserved for cases when a task exits without any writes */\nexport declare const NO_WRITES = \"__no_writes__\";\n/** Special channel reserved for graph return */\nexport declare const RETURN = \"__return__\";\n/** Special channel reserved for graph previous state */\nexport declare const PREVIOUS = \"__previous__\";\nexport declare const RUNTIME_PLACEHOLDER = \"__pregel_runtime_placeholder__\";\nexport declare const RECURSION_LIMIT_DEFAULT = 25;\nexport declare const TAG_HIDDEN = \"langsmith:hidden\";\nexport declare const TAG_NOSTREAM = \"langsmith:nostream\";\nexport declare const SELF = \"__self__\";\nexport declare const TASKS = \"__pregel_tasks\";\nexport declare const PUSH = \"__pregel_push\";\nexport declare const PULL = \"__pregel_pull\";\nexport declare const TASK_NAMESPACE = \"6ba7b831-9dad-11d1-80b4-00c04fd430c8\";\nexport declare const NULL_TASK_ID = \"00000000-0000-0000-0000-000000000000\";\nexport declare const RESERVED: string[];\nexport declare const CHECKPOINT_NAMESPACE_SEPARATOR = \"|\";\nexport declare const CHECKPOINT_NAMESPACE_END = \":\";\n/** @internal */\ndeclare const COMMAND_SYMBOL: unique symbol;\n/**\n * Instance of a {@link Command} class.\n *\n * This is used to avoid IntelliSense suggesting public fields\n * of {@link Command} class when a plain object is expected.\n *\n * @see {@link Command}\n * @internal\n */\nexport declare class CommandInstance<Resume = unknown, Update extends Record<string, unknown> = Record<string, unknown>, Nodes extends string = string> {\n [COMMAND_SYMBOL]: CommandParams<Resume, Update, Nodes>;\n constructor(args: CommandParams<Resume, Update, Nodes>);\n}\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport interface SendInterface<Node extends string = string, Args = any> {\n node: Node;\n args: Args;\n}\nexport declare function _isSendInterface(x: unknown): x is SendInterface;\n/**\n *\n * A message or packet to send to a specific node in the graph.\n *\n * The `Send` class is used within a `StateGraph`'s conditional edges to\n * dynamically invoke a node with a custom state at the next step.\n *\n * Importantly, the sent state can differ from the core graph's state,\n * allowing for flexible and dynamic workflow management.\n *\n * One such example is a \"map-reduce\" workflow where your graph invokes\n * the same node multiple times in parallel with different states,\n * before aggregating the results back into the main graph's state.\n *\n * @example\n * ```typescript\n * import { Annotation, Send, StateGraph } from \"@langchain/langgraph\";\n *\n * const ChainState = Annotation.Root({\n * subjects: Annotation<string[]>,\n * jokes: Annotation<string[]>({\n * reducer: (a, b) => a.concat(b),\n * }),\n * });\n *\n * const continueToJokes = async (state: typeof ChainState.State) => {\n * return state.subjects.map((subject) => {\n * return new Send(\"generate_joke\", { subjects: [subject] });\n * });\n * };\n *\n * const graph = new StateGraph(ChainState)\n * .addNode(\"generate_joke\", (state) => ({\n * jokes: [`Joke about ${state.subjects}`],\n * }))\n * .addConditionalEdges(\"__start__\", continueToJokes)\n * .addEdge(\"generate_joke\", \"__end__\")\n * .compile();\n *\n * const res = await graph.invoke({ subjects: [\"cats\", \"dogs\"] });\n * console.log(res);\n *\n * // Invoking with two subjects results in a generated joke for each\n * // { subjects: [\"cats\", \"dogs\"], jokes: [`Joke about cats`, `Joke about dogs`] }\n * ```\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport declare class Send<Node extends string = string, Args = any> implements SendInterface<Node, Args> {\n lg_name: string;\n node: Node;\n args: Args;\n constructor(node: Node, args: Args);\n toJSON(): {\n lg_name: string;\n node: Node;\n args: Args;\n };\n}\nexport declare function _isSend(x: unknown): x is Send;\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type Interrupt<Value = any> = {\n id?: string;\n value?: Value;\n};\n/**\n * Checks if the given graph invoke / stream chunk contains interrupt.\n *\n * @example\n * ```ts\n * import { INTERRUPT, isInterrupted } from \"@langchain/langgraph\";\n *\n * const values = await graph.invoke({ foo: \"bar\" });\n * if (isInterrupted<string>(values)) {\n * const interrupt = values[INTERRUPT][0].value;\n * }\n * ```\n *\n * @param values - The values to check.\n * @returns `true` if the values contain an interrupt, `false` otherwise.\n */\nexport declare function isInterrupted<Value = unknown>(values: unknown): values is {\n [INTERRUPT]: Interrupt<Value>[];\n};\nexport type CommandParams<Resume = unknown, Update extends Record<string, unknown> = Record<string, unknown>, Nodes extends string = string> = {\n /**\n * A discriminator field used to identify the type of object. Must be populated when serializing.\n *\n * Optional because it's not required to specify this when directly constructing a {@link Command}\n * object.\n */\n lg_name?: \"Command\";\n /**\n * Value to resume execution with. To be used together with {@link interrupt}.\n */\n resume?: Resume;\n /**\n * Graph to send the command to. Supported values are:\n * - None: the current graph (default)\n * - The specific name of the graph to send the command to\n * - {@link Command.PARENT}: closest parent graph (only supported when returned from a node in a subgraph)\n */\n graph?: string;\n /**\n * Update to apply to the graph's state.\n */\n update?: Update | [string, unknown][];\n /**\n * Can be one of the following:\n * - name of the node to navigate to next (any node that belongs to the specified `graph`)\n * - sequence of node names to navigate to next\n * - `Send` object (to execute a node with the input provided)\n * - sequence of `Send` objects\n */\n goto?: Nodes | SendInterface<Nodes> // eslint-disable-line @typescript-eslint/no-explicit-any\n | (Nodes | SendInterface<Nodes>)[]; // eslint-disable-line @typescript-eslint/no-explicit-any\n};\n/**\n * One or more commands to update the graph's state and send messages to nodes.\n * Can be used to combine routing logic with state updates in lieu of conditional edges\n *\n * @example\n * ```ts\n * import { Annotation, Command } from \"@langchain/langgraph\";\n *\n * // Define graph state\n * const StateAnnotation = Annotation.Root({\n * foo: Annotation<string>,\n * });\n *\n * // Define the nodes\n * const nodeA = async (_state: typeof StateAnnotation.State) => {\n * console.log(\"Called A\");\n * // this is a replacement for a real conditional edge function\n * const goto = Math.random() > .5 ? \"nodeB\" : \"nodeC\";\n * // note how Command allows you to BOTH update the graph state AND route to the next node\n * return new Command({\n * // this is the state update\n * update: {\n * foo: \"a\",\n * },\n * // this is a replacement for an edge\n * goto,\n * });\n * };\n *\n * // Nodes B and C are unchanged\n * const nodeB = async (state: typeof StateAnnotation.State) => {\n * console.log(\"Called B\");\n * return {\n * foo: state.foo + \"|b\",\n * };\n * }\n *\n * const nodeC = async (state: typeof StateAnnotation.State) => {\n * console.log(\"Called C\");\n * return {\n * foo: state.foo + \"|c\",\n * };\n * }\n *\n * import { StateGraph } from \"@langchain/langgraph\";\n\n * // NOTE: there are no edges between nodes A, B and C!\n * const graph = new StateGraph(StateAnnotation)\n * .addNode(\"nodeA\", nodeA, {\n * ends: [\"nodeB\", \"nodeC\"],\n * })\n * .addNode(\"nodeB\", nodeB)\n * .addNode(\"nodeC\", nodeC)\n * .addEdge(\"__start__\", \"nodeA\")\n * .compile();\n *\n * await graph.invoke({ foo: \"\" });\n *\n * // Randomly oscillates between\n * // { foo: 'a|c' } and { foo: 'a|b' }\n * ```\n */\nexport declare class Command<Resume = unknown, Update extends Record<string, unknown> = Record<string, unknown>, Nodes extends string = string> extends CommandInstance<Resume, Update, Nodes> {\n readonly lg_name: string;\n lc_direct_tool_output: boolean;\n /**\n * Graph to send the command to. Supported values are:\n * - None: the current graph (default)\n * - The specific name of the graph to send the command to\n * - {@link Command.PARENT}: closest parent graph (only supported when returned from a node in a subgraph)\n */\n graph?: string;\n /**\n * Update to apply to the graph's state as a result of executing the node that is returning the command.\n * Written to the state as if the node had simply returned this value instead of the Command object.\n */\n update?: Update | [string, unknown][];\n /**\n * Value to resume execution with. To be used together with {@link interrupt}.\n */\n resume?: Resume;\n /**\n * Can be one of the following:\n * - name of the node to navigate to next (any node that belongs to the specified `graph`)\n * - sequence of node names to navigate to next\n * - {@link Send} object (to execute a node with the exact input provided in the {@link Send} object)\n * - sequence of {@link Send} objects\n */\n goto?: Nodes | Send<Nodes> | (Nodes | Send<Nodes>)[];\n static PARENT: string;\n constructor(args: Omit<CommandParams<Resume, Update, Nodes>, \"lg_name\">);\n /**\n * Convert the update field to a list of {@link PendingWrite} tuples\n * @returns List of {@link PendingWrite} tuples of the form `[channelKey, value]`.\n * @internal\n */\n _updateAsTuples(): PendingWrite[];\n toJSON(): {\n lg_name: string;\n update: Update | [string, unknown][] | undefined;\n resume: Resume | undefined;\n goto: Nodes | (Nodes | {\n lg_name: string;\n node: Nodes;\n args: any;\n })[] | {\n lg_name: string;\n node: Nodes;\n args: any;\n } | undefined;\n };\n}\n/**\n * A type guard to check if the given value is a {@link Command}.\n *\n * Useful for type narrowing when working with the {@link Command} object.\n *\n * @param x - The value to check.\n * @returns `true` if the value is a {@link Command}, `false` otherwise.\n */\nexport declare function isCommand(x: unknown): x is Command;\n/**\n * Reconstructs Command and Send objects from a deeply nested tree of anonymous objects\n * matching their interfaces.\n *\n * This is only exported for testing purposes. It is NOT intended to be used outside of\n * the Command and Send classes.\n *\n * @internal\n *\n * @param x - The command send tree to convert.\n * @param seen - A map of seen objects to avoid infinite loops.\n * @returns The converted command send tree.\n */\nexport declare function _deserializeCommandSendObjectGraph(x: unknown, seen?: Map<object, unknown>): unknown;\nexport {};\n"],"mappings":";;;;cAEqBC,KAAAA;AAArB;AAEqBC,cAAAA,GAAAA,GAAG,SAAA;;AAuHdgD,cA5FW1B,SAAAA,GA4FX0B,eAAAA;;;;AAWEK,cA/FS3B,QAAAA,GAiGT4B,cAAAA;;cAlFEd,cAqIKO,EAAAA,OAAAA,MAAAA;;;;;AAiEnB;;;;;AAAgLH,cA5L3JH,eA4L2JG,CAAAA,SAAAA,OAAAA,EAAAA,eA5L1GF,MA4L0GE,CAAAA,MAAA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
@@ -81,6 +81,9 @@ const COMMAND_SYMBOL = Symbol.for("langgraph.command");
|
|
|
81
81
|
*/
|
|
82
82
|
var CommandInstance = class {
|
|
83
83
|
[COMMAND_SYMBOL];
|
|
84
|
+
constructor(args) {
|
|
85
|
+
this[COMMAND_SYMBOL] = args;
|
|
86
|
+
}
|
|
84
87
|
};
|
|
85
88
|
function _isSendInterface(x) {
|
|
86
89
|
const operation = x;
|
|
@@ -263,7 +266,7 @@ var Command = class extends CommandInstance {
|
|
|
263
266
|
goto = [];
|
|
264
267
|
static PARENT = "__parent__";
|
|
265
268
|
constructor(args) {
|
|
266
|
-
super();
|
|
269
|
+
super(args);
|
|
267
270
|
this.resume = args.resume;
|
|
268
271
|
this.graph = args.graph;
|
|
269
272
|
this.update = args.update;
|
package/dist/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","names":["result: unknown"],"sources":["../src/constants.ts"],"sourcesContent":["import { PendingWrite } from \"@langchain/langgraph-checkpoint\";\n\n/** Special reserved node name denoting the start of a graph. */\nexport const START = \"__start__\";\n/** Special reserved node name denoting the end of a graph. */\nexport const END = \"__end__\";\nexport const INPUT = \"__input__\";\nexport const COPY = \"__copy__\";\nexport const ERROR = \"__error__\";\n\n/** Special reserved cache namespaces */\nexport const CACHE_NS_WRITES = \"__pregel_ns_writes\";\n\nexport const CONFIG_KEY_SEND = \"__pregel_send\";\n/** config key containing function used to call a node (push task) */\nexport const CONFIG_KEY_CALL = \"__pregel_call\";\nexport const CONFIG_KEY_READ = \"__pregel_read\";\nexport const CONFIG_KEY_CHECKPOINTER = \"__pregel_checkpointer\";\nexport const CONFIG_KEY_RESUMING = \"__pregel_resuming\";\nexport const CONFIG_KEY_TASK_ID = \"__pregel_task_id\";\nexport const CONFIG_KEY_STREAM = \"__pregel_stream\";\nexport const CONFIG_KEY_RESUME_VALUE = \"__pregel_resume_value\";\nexport const CONFIG_KEY_RESUME_MAP = \"__pregel_resume_map\";\nexport const CONFIG_KEY_SCRATCHPAD = \"__pregel_scratchpad\";\n/** config key containing state from previous invocation of graph for the given thread */\nexport const CONFIG_KEY_PREVIOUS_STATE = \"__pregel_previous\";\nexport const CONFIG_KEY_DURABILITY = \"__pregel_durability\";\nexport const CONFIG_KEY_CHECKPOINT_ID = \"checkpoint_id\";\nexport const CONFIG_KEY_CHECKPOINT_NS = \"checkpoint_ns\";\n\nexport const CONFIG_KEY_NODE_FINISHED = \"__pregel_node_finished\";\n\n// this one is part of public API\nexport const CONFIG_KEY_CHECKPOINT_MAP = \"checkpoint_map\";\n\nexport const CONFIG_KEY_ABORT_SIGNALS = \"__pregel_abort_signals\";\n\n/** Special channel reserved for graph interrupts */\nexport const INTERRUPT = \"__interrupt__\";\n/** Special channel reserved for graph resume */\nexport const RESUME = \"__resume__\";\n/** Special channel reserved for cases when a task exits without any writes */\nexport const NO_WRITES = \"__no_writes__\";\n/** Special channel reserved for graph return */\nexport const RETURN = \"__return__\";\n/** Special channel reserved for graph previous state */\nexport const PREVIOUS = \"__previous__\";\nexport const RUNTIME_PLACEHOLDER = \"__pregel_runtime_placeholder__\";\nexport const RECURSION_LIMIT_DEFAULT = 25;\n\nexport const TAG_HIDDEN = \"langsmith:hidden\";\nexport const TAG_NOSTREAM = \"langsmith:nostream\";\nexport const SELF = \"__self__\";\n\nexport const TASKS = \"__pregel_tasks\";\nexport const PUSH = \"__pregel_push\";\nexport const PULL = \"__pregel_pull\";\n\nexport const TASK_NAMESPACE = \"6ba7b831-9dad-11d1-80b4-00c04fd430c8\";\nexport const NULL_TASK_ID = \"00000000-0000-0000-0000-000000000000\";\n\nexport const RESERVED = [\n TAG_HIDDEN,\n INPUT,\n INTERRUPT,\n RESUME,\n ERROR,\n NO_WRITES,\n\n // reserved config.configurable keys\n CONFIG_KEY_SEND,\n CONFIG_KEY_READ,\n CONFIG_KEY_CHECKPOINTER,\n CONFIG_KEY_DURABILITY,\n CONFIG_KEY_STREAM,\n CONFIG_KEY_RESUMING,\n CONFIG_KEY_TASK_ID,\n CONFIG_KEY_CALL,\n CONFIG_KEY_RESUME_VALUE,\n CONFIG_KEY_SCRATCHPAD,\n CONFIG_KEY_PREVIOUS_STATE,\n CONFIG_KEY_CHECKPOINT_MAP,\n CONFIG_KEY_CHECKPOINT_NS,\n CONFIG_KEY_CHECKPOINT_ID,\n];\n\nexport const CHECKPOINT_NAMESPACE_SEPARATOR = \"|\";\nexport const CHECKPOINT_NAMESPACE_END = \":\";\n\n/** @internal */\nconst COMMAND_SYMBOL = Symbol.for(\"langgraph.command\");\n\n/**\n * Instance of a {@link Command} class.\n *\n * This is used to avoid IntelliSense suggesting public fields\n * of {@link Command} class when a plain object is expected.\n *\n * @see {@link Command}\n * @internal\n */\nexport class CommandInstance {\n [COMMAND_SYMBOL]: true;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport interface SendInterface<Node extends string = string, Args = any> {\n node: Node;\n args: Args;\n}\n\nexport function _isSendInterface(x: unknown): x is SendInterface {\n const operation = x as SendInterface;\n return (\n operation !== null &&\n operation !== undefined &&\n typeof operation.node === \"string\" &&\n operation.args !== undefined\n );\n}\n\n/**\n *\n * A message or packet to send to a specific node in the graph.\n *\n * The `Send` class is used within a `StateGraph`'s conditional edges to\n * dynamically invoke a node with a custom state at the next step.\n *\n * Importantly, the sent state can differ from the core graph's state,\n * allowing for flexible and dynamic workflow management.\n *\n * One such example is a \"map-reduce\" workflow where your graph invokes\n * the same node multiple times in parallel with different states,\n * before aggregating the results back into the main graph's state.\n *\n * @example\n * ```typescript\n * import { Annotation, Send, StateGraph } from \"@langchain/langgraph\";\n *\n * const ChainState = Annotation.Root({\n * subjects: Annotation<string[]>,\n * jokes: Annotation<string[]>({\n * reducer: (a, b) => a.concat(b),\n * }),\n * });\n *\n * const continueToJokes = async (state: typeof ChainState.State) => {\n * return state.subjects.map((subject) => {\n * return new Send(\"generate_joke\", { subjects: [subject] });\n * });\n * };\n *\n * const graph = new StateGraph(ChainState)\n * .addNode(\"generate_joke\", (state) => ({\n * jokes: [`Joke about ${state.subjects}`],\n * }))\n * .addConditionalEdges(\"__start__\", continueToJokes)\n * .addEdge(\"generate_joke\", \"__end__\")\n * .compile();\n *\n * const res = await graph.invoke({ subjects: [\"cats\", \"dogs\"] });\n * console.log(res);\n *\n * // Invoking with two subjects results in a generated joke for each\n * // { subjects: [\"cats\", \"dogs\"], jokes: [`Joke about cats`, `Joke about dogs`] }\n * ```\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport class Send<Node extends string = string, Args = any>\n implements SendInterface<Node, Args>\n{\n lg_name = \"Send\";\n\n public node: Node;\n\n public args: Args;\n\n constructor(node: Node, args: Args) {\n this.node = node;\n this.args = _deserializeCommandSendObjectGraph(args) as Args;\n }\n\n toJSON() {\n return { lg_name: this.lg_name, node: this.node, args: this.args };\n }\n}\n\nexport function _isSend(x: unknown): x is Send {\n // eslint-disable-next-line no-instanceof/no-instanceof\n return x instanceof Send;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type Interrupt<Value = any> = {\n id?: string;\n value?: Value;\n};\n\n/**\n * Checks if the given graph invoke / stream chunk contains interrupt.\n *\n * @example\n * ```ts\n * import { INTERRUPT, isInterrupted } from \"@langchain/langgraph\";\n *\n * const values = await graph.invoke({ foo: \"bar\" });\n * if (isInterrupted<string>(values)) {\n * const interrupt = values[INTERRUPT][0].value;\n * }\n * ```\n *\n * @param values - The values to check.\n * @returns `true` if the values contain an interrupt, `false` otherwise.\n */\nexport function isInterrupted<Value = unknown>(\n values: unknown\n): values is { [INTERRUPT]: Interrupt<Value>[] } {\n if (!values || typeof values !== \"object\") return false;\n if (!(INTERRUPT in values)) return false;\n return Array.isArray(values[INTERRUPT]);\n}\n\nexport type CommandParams<\n Resume = unknown,\n Update extends Record<string, unknown> = Record<string, unknown>,\n Nodes extends string = string\n> = {\n /**\n * A discriminator field used to identify the type of object. Must be populated when serializing.\n *\n * Optional because it's not required to specify this when directly constructing a {@link Command}\n * object.\n */\n lg_name?: \"Command\";\n\n /**\n * Value to resume execution with. To be used together with {@link interrupt}.\n */\n resume?: Resume;\n /**\n * Graph to send the command to. Supported values are:\n * - None: the current graph (default)\n * - The specific name of the graph to send the command to\n * - {@link Command.PARENT}: closest parent graph (only supported when returned from a node in a subgraph)\n */\n graph?: string;\n\n /**\n * Update to apply to the graph's state.\n */\n update?: Update | [string, unknown][];\n\n /**\n * Can be one of the following:\n * - name of the node to navigate to next (any node that belongs to the specified `graph`)\n * - sequence of node names to navigate to next\n * - `Send` object (to execute a node with the input provided)\n * - sequence of `Send` objects\n */\n goto?:\n | Nodes\n | SendInterface<Nodes> // eslint-disable-line @typescript-eslint/no-explicit-any\n | (Nodes | SendInterface<Nodes>)[]; // eslint-disable-line @typescript-eslint/no-explicit-any\n};\n\n/**\n * One or more commands to update the graph's state and send messages to nodes.\n * Can be used to combine routing logic with state updates in lieu of conditional edges\n *\n * @example\n * ```ts\n * import { Annotation, Command } from \"@langchain/langgraph\";\n *\n * // Define graph state\n * const StateAnnotation = Annotation.Root({\n * foo: Annotation<string>,\n * });\n *\n * // Define the nodes\n * const nodeA = async (_state: typeof StateAnnotation.State) => {\n * console.log(\"Called A\");\n * // this is a replacement for a real conditional edge function\n * const goto = Math.random() > .5 ? \"nodeB\" : \"nodeC\";\n * // note how Command allows you to BOTH update the graph state AND route to the next node\n * return new Command({\n * // this is the state update\n * update: {\n * foo: \"a\",\n * },\n * // this is a replacement for an edge\n * goto,\n * });\n * };\n *\n * // Nodes B and C are unchanged\n * const nodeB = async (state: typeof StateAnnotation.State) => {\n * console.log(\"Called B\");\n * return {\n * foo: state.foo + \"|b\",\n * };\n * }\n *\n * const nodeC = async (state: typeof StateAnnotation.State) => {\n * console.log(\"Called C\");\n * return {\n * foo: state.foo + \"|c\",\n * };\n * }\n * \n * import { StateGraph } from \"@langchain/langgraph\";\n\n * // NOTE: there are no edges between nodes A, B and C!\n * const graph = new StateGraph(StateAnnotation)\n * .addNode(\"nodeA\", nodeA, {\n * ends: [\"nodeB\", \"nodeC\"],\n * })\n * .addNode(\"nodeB\", nodeB)\n * .addNode(\"nodeC\", nodeC)\n * .addEdge(\"__start__\", \"nodeA\")\n * .compile();\n * \n * await graph.invoke({ foo: \"\" });\n *\n * // Randomly oscillates between\n * // { foo: 'a|c' } and { foo: 'a|b' }\n * ```\n */\nexport class Command<\n Resume = unknown,\n Update extends Record<string, unknown> = Record<string, unknown>,\n Nodes extends string = string\n> extends CommandInstance {\n readonly lg_name = \"Command\";\n\n lc_direct_tool_output = true;\n\n /**\n * Graph to send the command to. Supported values are:\n * - None: the current graph (default)\n * - The specific name of the graph to send the command to\n * - {@link Command.PARENT}: closest parent graph (only supported when returned from a node in a subgraph)\n */\n graph?: string;\n\n /**\n * Update to apply to the graph's state as a result of executing the node that is returning the command.\n * Written to the state as if the node had simply returned this value instead of the Command object.\n */\n update?: Update | [string, unknown][];\n\n /**\n * Value to resume execution with. To be used together with {@link interrupt}.\n */\n resume?: Resume;\n\n /**\n * Can be one of the following:\n * - name of the node to navigate to next (any node that belongs to the specified `graph`)\n * - sequence of node names to navigate to next\n * - {@link Send} object (to execute a node with the exact input provided in the {@link Send} object)\n * - sequence of {@link Send} objects\n */\n goto?: Nodes | Send<Nodes> | (Nodes | Send<Nodes>)[] = [];\n\n static PARENT = \"__parent__\";\n\n constructor(args: CommandParams<Resume, Update, Nodes>) {\n super();\n this.resume = args.resume;\n this.graph = args.graph;\n this.update = args.update;\n if (args.goto) {\n type ValidArg = Nodes | Send<Nodes, Update>;\n\n this.goto = Array.isArray(args.goto)\n ? (_deserializeCommandSendObjectGraph(args.goto) as ValidArg[])\n : [_deserializeCommandSendObjectGraph(args.goto) as ValidArg];\n }\n }\n\n /**\n * Convert the update field to a list of {@link PendingWrite} tuples\n * @returns List of {@link PendingWrite} tuples of the form `[channelKey, value]`.\n * @internal\n */\n _updateAsTuples(): PendingWrite[] {\n if (\n this.update &&\n typeof this.update === \"object\" &&\n !Array.isArray(this.update)\n ) {\n return Object.entries(this.update);\n } else if (\n Array.isArray(this.update) &&\n this.update.every(\n (t): t is [string, unknown] =>\n Array.isArray(t) && t.length === 2 && typeof t[0] === \"string\"\n )\n ) {\n return this.update;\n } else {\n return [[\"__root__\", this.update]];\n }\n }\n\n toJSON() {\n let serializedGoto;\n if (typeof this.goto === \"string\") {\n serializedGoto = this.goto;\n } else if (_isSend(this.goto)) {\n serializedGoto = this.goto.toJSON();\n } else {\n serializedGoto = this.goto?.map((innerGoto) => {\n if (typeof innerGoto === \"string\") {\n return innerGoto;\n } else {\n return innerGoto.toJSON();\n }\n });\n }\n return {\n lg_name: this.lg_name,\n update: this.update,\n resume: this.resume,\n goto: serializedGoto,\n };\n }\n}\n\n/**\n * A type guard to check if the given value is a {@link Command}.\n *\n * Useful for type narrowing when working with the {@link Command} object.\n *\n * @param x - The value to check.\n * @returns `true` if the value is a {@link Command}, `false` otherwise.\n */\nexport function isCommand(x: unknown): x is Command {\n if (typeof x !== \"object\") {\n return false;\n }\n\n if (x === null || x === undefined) {\n return false;\n }\n\n if (\"lg_name\" in x && x.lg_name === \"Command\") {\n return true;\n }\n\n return false;\n}\n\n/**\n * Reconstructs Command and Send objects from a deeply nested tree of anonymous objects\n * matching their interfaces.\n *\n * This is only exported for testing purposes. It is NOT intended to be used outside of\n * the Command and Send classes.\n *\n * @internal\n *\n * @param x - The command send tree to convert.\n * @param seen - A map of seen objects to avoid infinite loops.\n * @returns The converted command send tree.\n */\nexport function _deserializeCommandSendObjectGraph(\n x: unknown,\n seen: Map<object, unknown> = new Map()\n): unknown {\n if (x !== undefined && x !== null && typeof x === \"object\") {\n // If we've already processed this object, return the transformed version\n if (seen.has(x)) {\n return seen.get(x);\n }\n\n let result: unknown;\n\n if (Array.isArray(x)) {\n // Create the array first, then populate it\n result = [];\n // Add to seen map before processing elements to handle self-references\n seen.set(x, result);\n\n // Now populate the array\n x.forEach((item, index) => {\n (result as unknown[])[index] = _deserializeCommandSendObjectGraph(\n item,\n seen\n );\n });\n // eslint-disable-next-line no-instanceof/no-instanceof\n } else if (isCommand(x) && !(x instanceof Command)) {\n result = new Command(x);\n seen.set(x, result);\n // eslint-disable-next-line no-instanceof/no-instanceof\n } else if (_isSendInterface(x) && !(x instanceof Send)) {\n result = new Send(x.node, x.args);\n seen.set(x, result);\n } else if (isCommand(x) || _isSend(x)) {\n result = x;\n seen.set(x, result);\n } else if (\"lc_serializable\" in x && x.lc_serializable) {\n result = x;\n seen.set(x, result);\n } else {\n // Create empty object first\n result = {};\n // Add to seen map before processing properties to handle self-references\n seen.set(x, result);\n\n // Now populate the object\n for (const [key, value] of Object.entries(x)) {\n (result as Record<string, unknown>)[key] =\n _deserializeCommandSendObjectGraph(value, seen);\n }\n }\n\n return result;\n }\n return x;\n}\n"],"mappings":";;AAGA,MAAa,QAAQ;;AAErB,MAAa,MAAM;AACnB,MAAa,QAAQ;AACrB,MAAa,OAAO;AACpB,MAAa,QAAQ;;AAGrB,MAAa,kBAAkB;AAE/B,MAAa,kBAAkB;;AAE/B,MAAa,kBAAkB;AAC/B,MAAa,kBAAkB;AAC/B,MAAa,0BAA0B;AACvC,MAAa,sBAAsB;AACnC,MAAa,qBAAqB;AAClC,MAAa,oBAAoB;AACjC,MAAa,0BAA0B;AACvC,MAAa,wBAAwB;AACrC,MAAa,wBAAwB;;AAErC,MAAa,4BAA4B;AACzC,MAAa,wBAAwB;AACrC,MAAa,2BAA2B;AACxC,MAAa,2BAA2B;AAExC,MAAa,2BAA2B;AAGxC,MAAa,4BAA4B;AAEzC,MAAa,2BAA2B;;AAGxC,MAAa,YAAY;;AAEzB,MAAa,SAAS;;AAEtB,MAAa,YAAY;;AAEzB,MAAa,SAAS;;AAEtB,MAAa,WAAW;AAIxB,MAAa,aAAa;AAC1B,MAAa,eAAe;AAC5B,MAAa,OAAO;AAEpB,MAAa,QAAQ;AACrB,MAAa,OAAO;AACpB,MAAa,OAAO;AAGpB,MAAa,eAAe;AAE5B,MAAa,WAAW;CACtB;CACA;CACA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K,EAAE,MAAM,EAAE;AAC5B,QAAK,IAAI,GAAG;aACH,UAAU,MAAM,QAAQ,IAAI;AACrC,YAAS;AACT,QAAK,IAAI,GAAG;aACH,qBAAqB,KAAK,EAAE,iBAAiB;AACtD,YAAS;AACT,QAAK,IAAI,GAAG;SACP;AAEL,YAAS;AAET,QAAK,IAAI,GAAG;AAGZ,QAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,GACxC,CAAC,OAAmC,OAClC,mCAAmC,OAAO;;AAIhD,SAAO;;AAET,QAAO"}
|
|
1
|
+
{"version":3,"file":"constants.js","names":["result: unknown"],"sources":["../src/constants.ts"],"sourcesContent":["import { PendingWrite } from \"@langchain/langgraph-checkpoint\";\n\n/** Special reserved node name denoting the start of a graph. */\nexport const START = \"__start__\";\n/** Special reserved node name denoting the end of a graph. */\nexport const END = \"__end__\";\nexport const INPUT = \"__input__\";\nexport const COPY = \"__copy__\";\nexport const ERROR = \"__error__\";\n\n/** Special reserved cache namespaces */\nexport const CACHE_NS_WRITES = \"__pregel_ns_writes\";\n\nexport const CONFIG_KEY_SEND = \"__pregel_send\";\n/** config key containing function used to call a node (push task) */\nexport const CONFIG_KEY_CALL = \"__pregel_call\";\nexport const CONFIG_KEY_READ = \"__pregel_read\";\nexport const CONFIG_KEY_CHECKPOINTER = \"__pregel_checkpointer\";\nexport const CONFIG_KEY_RESUMING = \"__pregel_resuming\";\nexport const CONFIG_KEY_TASK_ID = \"__pregel_task_id\";\nexport const CONFIG_KEY_STREAM = \"__pregel_stream\";\nexport const CONFIG_KEY_RESUME_VALUE = \"__pregel_resume_value\";\nexport const CONFIG_KEY_RESUME_MAP = \"__pregel_resume_map\";\nexport const CONFIG_KEY_SCRATCHPAD = \"__pregel_scratchpad\";\n/** config key containing state from previous invocation of graph for the given thread */\nexport const CONFIG_KEY_PREVIOUS_STATE = \"__pregel_previous\";\nexport const CONFIG_KEY_DURABILITY = \"__pregel_durability\";\nexport const CONFIG_KEY_CHECKPOINT_ID = \"checkpoint_id\";\nexport const CONFIG_KEY_CHECKPOINT_NS = \"checkpoint_ns\";\n\nexport const CONFIG_KEY_NODE_FINISHED = \"__pregel_node_finished\";\n\n// this one is part of public API\nexport const CONFIG_KEY_CHECKPOINT_MAP = \"checkpoint_map\";\n\nexport const CONFIG_KEY_ABORT_SIGNALS = \"__pregel_abort_signals\";\n\n/** Special channel reserved for graph interrupts */\nexport const INTERRUPT = \"__interrupt__\";\n/** Special channel reserved for graph resume */\nexport const RESUME = \"__resume__\";\n/** Special channel reserved for cases when a task exits without any writes */\nexport const NO_WRITES = \"__no_writes__\";\n/** Special channel reserved for graph return */\nexport const RETURN = \"__return__\";\n/** Special channel reserved for graph previous state */\nexport const PREVIOUS = \"__previous__\";\nexport const RUNTIME_PLACEHOLDER = \"__pregel_runtime_placeholder__\";\nexport const RECURSION_LIMIT_DEFAULT = 25;\n\nexport const TAG_HIDDEN = \"langsmith:hidden\";\nexport const TAG_NOSTREAM = \"langsmith:nostream\";\nexport const SELF = \"__self__\";\n\nexport const TASKS = \"__pregel_tasks\";\nexport const PUSH = \"__pregel_push\";\nexport const PULL = \"__pregel_pull\";\n\nexport const TASK_NAMESPACE = \"6ba7b831-9dad-11d1-80b4-00c04fd430c8\";\nexport const NULL_TASK_ID = \"00000000-0000-0000-0000-000000000000\";\n\nexport const RESERVED = [\n TAG_HIDDEN,\n INPUT,\n INTERRUPT,\n RESUME,\n ERROR,\n NO_WRITES,\n\n // reserved config.configurable keys\n CONFIG_KEY_SEND,\n CONFIG_KEY_READ,\n CONFIG_KEY_CHECKPOINTER,\n CONFIG_KEY_DURABILITY,\n CONFIG_KEY_STREAM,\n CONFIG_KEY_RESUMING,\n CONFIG_KEY_TASK_ID,\n CONFIG_KEY_CALL,\n CONFIG_KEY_RESUME_VALUE,\n CONFIG_KEY_SCRATCHPAD,\n CONFIG_KEY_PREVIOUS_STATE,\n CONFIG_KEY_CHECKPOINT_MAP,\n CONFIG_KEY_CHECKPOINT_NS,\n CONFIG_KEY_CHECKPOINT_ID,\n];\n\nexport const CHECKPOINT_NAMESPACE_SEPARATOR = \"|\";\nexport const CHECKPOINT_NAMESPACE_END = \":\";\n\n/** @internal */\nconst COMMAND_SYMBOL = Symbol.for(\"langgraph.command\");\n\n/**\n * Instance of a {@link Command} class.\n *\n * This is used to avoid IntelliSense suggesting public fields\n * of {@link Command} class when a plain object is expected.\n *\n * @see {@link Command}\n * @internal\n */\nexport class CommandInstance<\n Resume = unknown,\n Update extends Record<string, unknown> = Record<string, unknown>,\n Nodes extends string = string\n> {\n [COMMAND_SYMBOL]: CommandParams<Resume, Update, Nodes>;\n\n constructor(args: CommandParams<Resume, Update, Nodes>) {\n this[COMMAND_SYMBOL] = args;\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport interface SendInterface<Node extends string = string, Args = any> {\n node: Node;\n args: Args;\n}\n\nexport function _isSendInterface(x: unknown): x is SendInterface {\n const operation = x as SendInterface;\n return (\n operation !== null &&\n operation !== undefined &&\n typeof operation.node === \"string\" &&\n operation.args !== undefined\n );\n}\n\n/**\n *\n * A message or packet to send to a specific node in the graph.\n *\n * The `Send` class is used within a `StateGraph`'s conditional edges to\n * dynamically invoke a node with a custom state at the next step.\n *\n * Importantly, the sent state can differ from the core graph's state,\n * allowing for flexible and dynamic workflow management.\n *\n * One such example is a \"map-reduce\" workflow where your graph invokes\n * the same node multiple times in parallel with different states,\n * before aggregating the results back into the main graph's state.\n *\n * @example\n * ```typescript\n * import { Annotation, Send, StateGraph } from \"@langchain/langgraph\";\n *\n * const ChainState = Annotation.Root({\n * subjects: Annotation<string[]>,\n * jokes: Annotation<string[]>({\n * reducer: (a, b) => a.concat(b),\n * }),\n * });\n *\n * const continueToJokes = async (state: typeof ChainState.State) => {\n * return state.subjects.map((subject) => {\n * return new Send(\"generate_joke\", { subjects: [subject] });\n * });\n * };\n *\n * const graph = new StateGraph(ChainState)\n * .addNode(\"generate_joke\", (state) => ({\n * jokes: [`Joke about ${state.subjects}`],\n * }))\n * .addConditionalEdges(\"__start__\", continueToJokes)\n * .addEdge(\"generate_joke\", \"__end__\")\n * .compile();\n *\n * const res = await graph.invoke({ subjects: [\"cats\", \"dogs\"] });\n * console.log(res);\n *\n * // Invoking with two subjects results in a generated joke for each\n * // { subjects: [\"cats\", \"dogs\"], jokes: [`Joke about cats`, `Joke about dogs`] }\n * ```\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport class Send<Node extends string = string, Args = any>\n implements SendInterface<Node, Args>\n{\n lg_name = \"Send\";\n\n public node: Node;\n\n public args: Args;\n\n constructor(node: Node, args: Args) {\n this.node = node;\n this.args = _deserializeCommandSendObjectGraph(args) as Args;\n }\n\n toJSON() {\n return { lg_name: this.lg_name, node: this.node, args: this.args };\n }\n}\n\nexport function _isSend(x: unknown): x is Send {\n // eslint-disable-next-line no-instanceof/no-instanceof\n return x instanceof Send;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type Interrupt<Value = any> = {\n id?: string;\n value?: Value;\n};\n\n/**\n * Checks if the given graph invoke / stream chunk contains interrupt.\n *\n * @example\n * ```ts\n * import { INTERRUPT, isInterrupted } from \"@langchain/langgraph\";\n *\n * const values = await graph.invoke({ foo: \"bar\" });\n * if (isInterrupted<string>(values)) {\n * const interrupt = values[INTERRUPT][0].value;\n * }\n * ```\n *\n * @param values - The values to check.\n * @returns `true` if the values contain an interrupt, `false` otherwise.\n */\nexport function isInterrupted<Value = unknown>(\n values: unknown\n): values is { [INTERRUPT]: Interrupt<Value>[] } {\n if (!values || typeof values !== \"object\") return false;\n if (!(INTERRUPT in values)) return false;\n return Array.isArray(values[INTERRUPT]);\n}\n\nexport type CommandParams<\n Resume = unknown,\n Update extends Record<string, unknown> = Record<string, unknown>,\n Nodes extends string = string\n> = {\n /**\n * A discriminator field used to identify the type of object. Must be populated when serializing.\n *\n * Optional because it's not required to specify this when directly constructing a {@link Command}\n * object.\n */\n lg_name?: \"Command\";\n\n /**\n * Value to resume execution with. To be used together with {@link interrupt}.\n */\n resume?: Resume;\n /**\n * Graph to send the command to. Supported values are:\n * - None: the current graph (default)\n * - The specific name of the graph to send the command to\n * - {@link Command.PARENT}: closest parent graph (only supported when returned from a node in a subgraph)\n */\n graph?: string;\n\n /**\n * Update to apply to the graph's state.\n */\n update?: Update | [string, unknown][];\n\n /**\n * Can be one of the following:\n * - name of the node to navigate to next (any node that belongs to the specified `graph`)\n * - sequence of node names to navigate to next\n * - `Send` object (to execute a node with the input provided)\n * - sequence of `Send` objects\n */\n goto?:\n | Nodes\n | SendInterface<Nodes> // eslint-disable-line @typescript-eslint/no-explicit-any\n | (Nodes | SendInterface<Nodes>)[]; // eslint-disable-line @typescript-eslint/no-explicit-any\n};\n\n/**\n * One or more commands to update the graph's state and send messages to nodes.\n * Can be used to combine routing logic with state updates in lieu of conditional edges\n *\n * @example\n * ```ts\n * import { Annotation, Command } from \"@langchain/langgraph\";\n *\n * // Define graph state\n * const StateAnnotation = Annotation.Root({\n * foo: Annotation<string>,\n * });\n *\n * // Define the nodes\n * const nodeA = async (_state: typeof StateAnnotation.State) => {\n * console.log(\"Called A\");\n * // this is a replacement for a real conditional edge function\n * const goto = Math.random() > .5 ? \"nodeB\" : \"nodeC\";\n * // note how Command allows you to BOTH update the graph state AND route to the next node\n * return new Command({\n * // this is the state update\n * update: {\n * foo: \"a\",\n * },\n * // this is a replacement for an edge\n * goto,\n * });\n * };\n *\n * // Nodes B and C are unchanged\n * const nodeB = async (state: typeof StateAnnotation.State) => {\n * console.log(\"Called B\");\n * return {\n * foo: state.foo + \"|b\",\n * };\n * }\n *\n * const nodeC = async (state: typeof StateAnnotation.State) => {\n * console.log(\"Called C\");\n * return {\n * foo: state.foo + \"|c\",\n * };\n * }\n * \n * import { StateGraph } from \"@langchain/langgraph\";\n\n * // NOTE: there are no edges between nodes A, B and C!\n * const graph = new StateGraph(StateAnnotation)\n * .addNode(\"nodeA\", nodeA, {\n * ends: [\"nodeB\", \"nodeC\"],\n * })\n * .addNode(\"nodeB\", nodeB)\n * .addNode(\"nodeC\", nodeC)\n * .addEdge(\"__start__\", \"nodeA\")\n * .compile();\n * \n * await graph.invoke({ foo: \"\" });\n *\n * // Randomly oscillates between\n * // { foo: 'a|c' } and { foo: 'a|b' }\n * ```\n */\nexport class Command<\n Resume = unknown,\n Update extends Record<string, unknown> = Record<string, unknown>,\n Nodes extends string = string\n> extends CommandInstance<Resume, Update, Nodes> {\n readonly lg_name = \"Command\";\n\n lc_direct_tool_output = true;\n\n /**\n * Graph to send the command to. Supported values are:\n * - None: the current graph (default)\n * - The specific name of the graph to send the command to\n * - {@link Command.PARENT}: closest parent graph (only supported when returned from a node in a subgraph)\n */\n graph?: string;\n\n /**\n * Update to apply to the graph's state as a result of executing the node that is returning the command.\n * Written to the state as if the node had simply returned this value instead of the Command object.\n */\n update?: Update | [string, unknown][];\n\n /**\n * Value to resume execution with. To be used together with {@link interrupt}.\n */\n resume?: Resume;\n\n /**\n * Can be one of the following:\n * - name of the node to navigate to next (any node that belongs to the specified `graph`)\n * - sequence of node names to navigate to next\n * - {@link Send} object (to execute a node with the exact input provided in the {@link Send} object)\n * - sequence of {@link Send} objects\n */\n goto?: Nodes | Send<Nodes> | (Nodes | Send<Nodes>)[] = [];\n\n static PARENT = \"__parent__\";\n\n constructor(args: Omit<CommandParams<Resume, Update, Nodes>, \"lg_name\">) {\n super(args);\n this.resume = args.resume;\n this.graph = args.graph;\n this.update = args.update;\n if (args.goto) {\n type ValidArg = Nodes | Send<Nodes, Update>;\n\n this.goto = Array.isArray(args.goto)\n ? (_deserializeCommandSendObjectGraph(args.goto) as ValidArg[])\n : [_deserializeCommandSendObjectGraph(args.goto) as ValidArg];\n }\n }\n\n /**\n * Convert the update field to a list of {@link PendingWrite} tuples\n * @returns List of {@link PendingWrite} tuples of the form `[channelKey, value]`.\n * @internal\n */\n _updateAsTuples(): PendingWrite[] {\n if (\n this.update &&\n typeof this.update === \"object\" &&\n !Array.isArray(this.update)\n ) {\n return Object.entries(this.update);\n } else if (\n Array.isArray(this.update) &&\n this.update.every(\n (t): t is [string, unknown] =>\n Array.isArray(t) && t.length === 2 && typeof t[0] === \"string\"\n )\n ) {\n return this.update;\n } else {\n return [[\"__root__\", this.update]];\n }\n }\n\n toJSON() {\n let serializedGoto;\n if (typeof this.goto === \"string\") {\n serializedGoto = this.goto;\n } else if (_isSend(this.goto)) {\n serializedGoto = this.goto.toJSON();\n } else {\n serializedGoto = this.goto?.map((innerGoto) => {\n if (typeof innerGoto === \"string\") {\n return innerGoto;\n } else {\n return innerGoto.toJSON();\n }\n });\n }\n return {\n lg_name: this.lg_name,\n update: this.update,\n resume: this.resume,\n goto: serializedGoto,\n };\n }\n}\n\n/**\n * A type guard to check if the given value is a {@link Command}.\n *\n * Useful for type narrowing when working with the {@link Command} object.\n *\n * @param x - The value to check.\n * @returns `true` if the value is a {@link Command}, `false` otherwise.\n */\nexport function isCommand(x: unknown): x is Command {\n if (typeof x !== \"object\") {\n return false;\n }\n\n if (x === null || x === undefined) {\n return false;\n }\n\n if (\"lg_name\" in x && x.lg_name === \"Command\") {\n return true;\n }\n\n return false;\n}\n\n/**\n * Reconstructs Command and Send objects from a deeply nested tree of anonymous objects\n * matching their interfaces.\n *\n * This is only exported for testing purposes. It is NOT intended to be used outside of\n * the Command and Send classes.\n *\n * @internal\n *\n * @param x - The command send tree to convert.\n * @param seen - A map of seen objects to avoid infinite loops.\n * @returns The converted command send tree.\n */\nexport function _deserializeCommandSendObjectGraph(\n x: unknown,\n seen: Map<object, unknown> = new Map()\n): unknown {\n if (x !== undefined && x !== null && typeof x === \"object\") {\n // If we've already processed this object, return the transformed version\n if (seen.has(x)) {\n return seen.get(x);\n }\n\n let result: unknown;\n\n if (Array.isArray(x)) {\n // Create the array first, then populate it\n result = [];\n // Add to seen map before processing elements to handle self-references\n seen.set(x, result);\n\n // Now populate the array\n x.forEach((item, index) => {\n (result as unknown[])[index] = _deserializeCommandSendObjectGraph(\n item,\n seen\n );\n });\n // eslint-disable-next-line no-instanceof/no-instanceof\n } else if (isCommand(x) && !(x instanceof Command)) {\n result = new Command(x);\n seen.set(x, result);\n // eslint-disable-next-line no-instanceof/no-instanceof\n } else if (_isSendInterface(x) && !(x instanceof Send)) {\n result = new Send(x.node, x.args);\n seen.set(x, result);\n } else if (isCommand(x) || _isSend(x)) {\n result = x;\n seen.set(x, result);\n } else if (\"lc_serializable\" in x && x.lc_serializable) {\n result = x;\n seen.set(x, result);\n } else {\n // Create empty object first\n result = {};\n // Add to seen map before processing properties to handle self-references\n seen.set(x, result);\n\n // Now populate the object\n for (const [key, value] of Object.entries(x)) {\n (result as Record<string, unknown>)[key] =\n _deserializeCommandSendObjectGraph(value, seen);\n }\n }\n\n return result;\n }\n return x;\n}\n"],"mappings":";;AAGA,MAAa,QAAQ;;AAErB,MAAa,MAAM;AACnB,MAAa,QAAQ;AACrB,MAAa,OAAO;AACpB,MAAa,QAAQ;;AAGrB,MAAa,kBAAkB;AAE/B,MAAa,kBAAkB;;AAE/B,MAAa,kBAAkB;AAC/B,MAAa,kBAAkB;AAC/B,MAAa,0BAA0B;AACvC,MAAa,sBAAsB;AACnC,MAAa,qBAAqB;AAClC,MAAa,oBAAoB;AACjC,MAAa,0BAA0B;AACvC,MAAa,wBAAwB;AACrC,MAAa,wBAAwB;;AAErC,MAAa,4BAA4B;AACzC,MAAa,wBAAwB;AACrC,MAAa,2BAA2B;AACxC,MAAa,2BAA2B;AAExC,MAAa,2BAA2B;AAGxC,MAAa,4BAA4B;AAEzC,MAAa,2BAA2B;;AAGxC,MAAa,YAAY;;AAEzB,MAAa,SAAS;;AAEtB,MAAa,YAAY;;AAEzB,MAAa,SAAS;;AAEtB,MAAa,WAAW;AAIxB,MAAa,aAAa;AAC1B,MAAa,eAAe;AAC5B,MAAa,OAAO;AAEpB,MAAa,QAAQ;AACrB,MAAa,OAAO;AACpB,MAAa,OAAO;AAGpB,MAAa,eAAe;AAE5B,MAAa,WAAW;CACtB;CACA;CACA;CACA;CAC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