@langchain/langgraph 1.4.16 → 1.4.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/callbacks.cjs +29 -0
- package/dist/callbacks.cjs.map +1 -0
- package/dist/callbacks.d.cts +46 -0
- package/dist/callbacks.d.cts.map +1 -0
- package/dist/callbacks.d.ts +46 -0
- package/dist/callbacks.d.ts.map +1 -0
- package/dist/callbacks.js +29 -0
- package/dist/callbacks.js.map +1 -0
- package/dist/index.cjs +2 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/pregel/callbacks.cjs +25 -0
- package/dist/pregel/callbacks.cjs.map +1 -0
- package/dist/pregel/callbacks.js +25 -0
- package/dist/pregel/callbacks.js.map +1 -0
- package/dist/pregel/index.cjs +8 -2
- package/dist/pregel/index.cjs.map +1 -1
- package/dist/pregel/index.d.cts.map +1 -1
- package/dist/pregel/index.d.ts.map +1 -1
- package/dist/pregel/index.js +8 -2
- package/dist/pregel/index.js.map +1 -1
- package/dist/pregel/loop.cjs +18 -1
- package/dist/pregel/loop.cjs.map +1 -1
- package/dist/pregel/loop.js +18 -1
- package/dist/pregel/loop.js.map +1 -1
- package/dist/pregel/messages-v2.cjs +1 -1
- package/dist/pregel/messages-v2.js +1 -1
- package/dist/pregel/messages.cjs +1 -1
- package/dist/pregel/messages.js +1 -1
- package/dist/pregel/runner.cjs +1 -1
- package/dist/pregel/runner.cjs.map +1 -1
- package/dist/pregel/runner.js +2 -2
- package/dist/pregel/runner.js.map +1 -1
- package/dist/pregel/stream.cjs +1 -1
- package/dist/pregel/stream.d.cts +1 -0
- package/dist/pregel/stream.d.cts.map +1 -1
- package/dist/pregel/stream.d.ts +1 -1
- package/dist/pregel/stream.js +1 -1
- package/dist/web.cjs +2 -0
- package/dist/web.d.cts +2 -1
- package/dist/web.d.ts +2 -1
- package/dist/web.js +2 -1
- package/package.json +2 -2
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
let _langchain_core_callbacks_base = require("@langchain/core/callbacks/base");
|
|
2
|
+
//#region src/callbacks.ts
|
|
3
|
+
const GRAPH_CALLBACK_HANDLER = Symbol.for("langgraph.graph_callback_handler");
|
|
4
|
+
/**
|
|
5
|
+
* Extend this class and pass an instance through `callbacks` to observe graph
|
|
6
|
+
* interrupts and resumes. Lifecycle methods are always awaited, including when
|
|
7
|
+
* other callbacks run in the background. Set `raiseError` to propagate errors.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* class Observer extends GraphCallbackHandler {
|
|
12
|
+
* handleInterrupt(event: GraphInterruptEvent) {
|
|
13
|
+
* console.log(event.runId, event.interrupts);
|
|
14
|
+
* }
|
|
15
|
+
* }
|
|
16
|
+
* const observed = graph.withConfig({ callbacks: [new Observer()] });
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
var GraphCallbackHandler = class extends _langchain_core_callbacks_base.BaseCallbackHandler {
|
|
20
|
+
name = "GraphCallbackHandler";
|
|
21
|
+
[GRAPH_CALLBACK_HANDLER] = true;
|
|
22
|
+
static isInstance(value) {
|
|
23
|
+
return typeof value === "object" && value !== null && GRAPH_CALLBACK_HANDLER in value && value[GRAPH_CALLBACK_HANDLER] === true;
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
//#endregion
|
|
27
|
+
exports.GraphCallbackHandler = GraphCallbackHandler;
|
|
28
|
+
|
|
29
|
+
//# sourceMappingURL=callbacks.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"callbacks.cjs","names":["BaseCallbackHandler"],"sources":["../src/callbacks.ts"],"sourcesContent":["import { BaseCallbackHandler } from \"@langchain/core/callbacks/base\";\nimport type { Interrupt } from \"./constants.js\";\n\nconst GRAPH_CALLBACK_HANDLER = Symbol.for(\"langgraph.graph_callback_handler\");\n\n/** Loop status at a graph lifecycle transition. */\nexport type GraphLifecycleStatus =\n | \"pending\"\n | \"done\"\n | \"interrupt_before\"\n | \"interrupt_after\"\n | \"out_of_steps\"\n | \"draining\";\n\n/** A graph execution resumed from a checkpoint. */\nexport interface GraphResumeEvent {\n readonly runId: string | undefined;\n readonly status: GraphLifecycleStatus;\n readonly checkpointId: string;\n readonly checkpointNs: readonly string[];\n}\n\n/** The root graph paused. Static interrupts can have an empty payload list. */\nexport interface GraphInterruptEvent extends GraphResumeEvent {\n readonly interrupts: readonly Interrupt[];\n}\n\nexport type GraphLifecycleEvent = GraphInterruptEvent | GraphResumeEvent;\n\n/**\n * Extend this class and pass an instance through `callbacks` to observe graph\n * interrupts and resumes. Lifecycle methods are always awaited, including when\n * other callbacks run in the background. Set `raiseError` to propagate errors.\n *\n * @example\n * ```ts\n * class Observer extends GraphCallbackHandler {\n * handleInterrupt(event: GraphInterruptEvent) {\n * console.log(event.runId, event.interrupts);\n * }\n * }\n * const observed = graph.withConfig({ callbacks: [new Observer()] });\n * ```\n */\nexport class GraphCallbackHandler extends BaseCallbackHandler {\n name = \"GraphCallbackHandler\";\n\n readonly [GRAPH_CALLBACK_HANDLER] = true;\n\n static isInstance(value: unknown): value is GraphCallbackHandler {\n return (\n typeof value === \"object\" &&\n value !== null &&\n GRAPH_CALLBACK_HANDLER in value &&\n value[GRAPH_CALLBACK_HANDLER] === true\n );\n }\n\n /** Called for root interrupts, before the terminal chain callback. */\n handleInterrupt?(event: GraphInterruptEvent): void | Promise<void>;\n\n /** Called before execution continues, including in resumed subgraphs. */\n handleResume?(event: GraphResumeEvent): void | Promise<void>;\n}\n"],"mappings":";;AAGA,MAAM,yBAAyB,OAAO,IAAI,mCAAmC;;;;;;;;;;;;;;;;AAyC7E,IAAa,uBAAb,cAA0CA,+BAAAA,oBAAoB;CAC5D,OAAO;CAEP,CAAU,0BAA0B;CAEpC,OAAO,WAAW,OAA+C;AAC/D,SACE,OAAO,UAAU,YACjB,UAAU,QACV,0BAA0B,SAC1B,MAAM,4BAA4B"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { Interrupt } from "./constants.cjs";
|
|
2
|
+
import { BaseCallbackHandler } from "@langchain/core/callbacks/base";
|
|
3
|
+
|
|
4
|
+
//#region src/callbacks.d.ts
|
|
5
|
+
declare const GRAPH_CALLBACK_HANDLER: unique symbol;
|
|
6
|
+
/** Loop status at a graph lifecycle transition. */
|
|
7
|
+
type GraphLifecycleStatus = "pending" | "done" | "interrupt_before" | "interrupt_after" | "out_of_steps" | "draining";
|
|
8
|
+
/** A graph execution resumed from a checkpoint. */
|
|
9
|
+
interface GraphResumeEvent {
|
|
10
|
+
readonly runId: string | undefined;
|
|
11
|
+
readonly status: GraphLifecycleStatus;
|
|
12
|
+
readonly checkpointId: string;
|
|
13
|
+
readonly checkpointNs: readonly string[];
|
|
14
|
+
}
|
|
15
|
+
/** The root graph paused. Static interrupts can have an empty payload list. */
|
|
16
|
+
interface GraphInterruptEvent extends GraphResumeEvent {
|
|
17
|
+
readonly interrupts: readonly Interrupt[];
|
|
18
|
+
}
|
|
19
|
+
type GraphLifecycleEvent = GraphInterruptEvent | GraphResumeEvent;
|
|
20
|
+
/**
|
|
21
|
+
* Extend this class and pass an instance through `callbacks` to observe graph
|
|
22
|
+
* interrupts and resumes. Lifecycle methods are always awaited, including when
|
|
23
|
+
* other callbacks run in the background. Set `raiseError` to propagate errors.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```ts
|
|
27
|
+
* class Observer extends GraphCallbackHandler {
|
|
28
|
+
* handleInterrupt(event: GraphInterruptEvent) {
|
|
29
|
+
* console.log(event.runId, event.interrupts);
|
|
30
|
+
* }
|
|
31
|
+
* }
|
|
32
|
+
* const observed = graph.withConfig({ callbacks: [new Observer()] });
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
declare class GraphCallbackHandler extends BaseCallbackHandler {
|
|
36
|
+
name: string;
|
|
37
|
+
readonly [GRAPH_CALLBACK_HANDLER] = true;
|
|
38
|
+
static isInstance(value: unknown): value is GraphCallbackHandler;
|
|
39
|
+
/** Called for root interrupts, before the terminal chain callback. */
|
|
40
|
+
handleInterrupt?(event: GraphInterruptEvent): void | Promise<void>;
|
|
41
|
+
/** Called before execution continues, including in resumed subgraphs. */
|
|
42
|
+
handleResume?(event: GraphResumeEvent): void | Promise<void>;
|
|
43
|
+
}
|
|
44
|
+
//#endregion
|
|
45
|
+
export { GraphCallbackHandler, GraphInterruptEvent, GraphLifecycleEvent, GraphLifecycleStatus, GraphResumeEvent };
|
|
46
|
+
//# sourceMappingURL=callbacks.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"callbacks.d.cts","names":[],"sources":["../src/callbacks.ts"],"mappings":";;;;cAGM,sBAAA;;KAGM,oBAAA;;UASK,gBAAA;EAAA,SACN,KAAA;EAAA,SACA,MAAA,EAAQ,oBAAA;EAAA,SACR,YAAA;EAAA,SACA,YAAA;AAAA;;UAIM,mBAAA,SAA4B,gBAAA;EAAA,SAClC,UAAA,WAAqB,SAAA;AAAA;AAAA,KAGpB,mBAAA,GAAsB,mBAAA,GAAsB,gBAAA;;;;;;;;;AAJxD;;;;;;;cAqBa,oBAAA,SAA6B,mBAAA;EACxC,IAAA;EAAA,UAEU,sBAAA;EAAA,OAEH,UAAA,CAAW,KAAA,YAAiB,KAAA,IAAS,oBAAA;;EAU5C,eAAA,CAAA,CAAiB,KAAA,EAAO,mBAAA,UAA6B,OAAA;EAhCiB;EAmCtE,YAAA,CAAA,CAAc,KAAA,EAAO,gBAAA,UAA0B,OAAA;AAAA"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { Interrupt } from "./constants.js";
|
|
2
|
+
import { BaseCallbackHandler } from "@langchain/core/callbacks/base";
|
|
3
|
+
|
|
4
|
+
//#region src/callbacks.d.ts
|
|
5
|
+
declare const GRAPH_CALLBACK_HANDLER: unique symbol;
|
|
6
|
+
/** Loop status at a graph lifecycle transition. */
|
|
7
|
+
type GraphLifecycleStatus = "pending" | "done" | "interrupt_before" | "interrupt_after" | "out_of_steps" | "draining";
|
|
8
|
+
/** A graph execution resumed from a checkpoint. */
|
|
9
|
+
interface GraphResumeEvent {
|
|
10
|
+
readonly runId: string | undefined;
|
|
11
|
+
readonly status: GraphLifecycleStatus;
|
|
12
|
+
readonly checkpointId: string;
|
|
13
|
+
readonly checkpointNs: readonly string[];
|
|
14
|
+
}
|
|
15
|
+
/** The root graph paused. Static interrupts can have an empty payload list. */
|
|
16
|
+
interface GraphInterruptEvent extends GraphResumeEvent {
|
|
17
|
+
readonly interrupts: readonly Interrupt[];
|
|
18
|
+
}
|
|
19
|
+
type GraphLifecycleEvent = GraphInterruptEvent | GraphResumeEvent;
|
|
20
|
+
/**
|
|
21
|
+
* Extend this class and pass an instance through `callbacks` to observe graph
|
|
22
|
+
* interrupts and resumes. Lifecycle methods are always awaited, including when
|
|
23
|
+
* other callbacks run in the background. Set `raiseError` to propagate errors.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```ts
|
|
27
|
+
* class Observer extends GraphCallbackHandler {
|
|
28
|
+
* handleInterrupt(event: GraphInterruptEvent) {
|
|
29
|
+
* console.log(event.runId, event.interrupts);
|
|
30
|
+
* }
|
|
31
|
+
* }
|
|
32
|
+
* const observed = graph.withConfig({ callbacks: [new Observer()] });
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
declare class GraphCallbackHandler extends BaseCallbackHandler {
|
|
36
|
+
name: string;
|
|
37
|
+
readonly [GRAPH_CALLBACK_HANDLER] = true;
|
|
38
|
+
static isInstance(value: unknown): value is GraphCallbackHandler;
|
|
39
|
+
/** Called for root interrupts, before the terminal chain callback. */
|
|
40
|
+
handleInterrupt?(event: GraphInterruptEvent): void | Promise<void>;
|
|
41
|
+
/** Called before execution continues, including in resumed subgraphs. */
|
|
42
|
+
handleResume?(event: GraphResumeEvent): void | Promise<void>;
|
|
43
|
+
}
|
|
44
|
+
//#endregion
|
|
45
|
+
export { GraphCallbackHandler, GraphInterruptEvent, GraphLifecycleEvent, GraphLifecycleStatus, GraphResumeEvent };
|
|
46
|
+
//# sourceMappingURL=callbacks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"callbacks.d.ts","names":[],"sources":["../src/callbacks.ts"],"mappings":";;;;cAGM,sBAAA;;KAGM,oBAAA;;UASK,gBAAA;EAAA,SACN,KAAA;EAAA,SACA,MAAA,EAAQ,oBAAA;EAAA,SACR,YAAA;EAAA,SACA,YAAA;AAAA;;UAIM,mBAAA,SAA4B,gBAAA;EAAA,SAClC,UAAA,WAAqB,SAAA;AAAA;AAAA,KAGpB,mBAAA,GAAsB,mBAAA,GAAsB,gBAAA;;;;;;;;;AAJxD;;;;;;;cAqBa,oBAAA,SAA6B,mBAAA;EACxC,IAAA;EAAA,UAEU,sBAAA;EAAA,OAEH,UAAA,CAAW,KAAA,YAAiB,KAAA,IAAS,oBAAA;;EAU5C,eAAA,CAAA,CAAiB,KAAA,EAAO,mBAAA,UAA6B,OAAA;EAhCiB;EAmCtE,YAAA,CAAA,CAAc,KAAA,EAAO,gBAAA,UAA0B,OAAA;AAAA"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { BaseCallbackHandler } from "@langchain/core/callbacks/base";
|
|
2
|
+
//#region src/callbacks.ts
|
|
3
|
+
const GRAPH_CALLBACK_HANDLER = Symbol.for("langgraph.graph_callback_handler");
|
|
4
|
+
/**
|
|
5
|
+
* Extend this class and pass an instance through `callbacks` to observe graph
|
|
6
|
+
* interrupts and resumes. Lifecycle methods are always awaited, including when
|
|
7
|
+
* other callbacks run in the background. Set `raiseError` to propagate errors.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* class Observer extends GraphCallbackHandler {
|
|
12
|
+
* handleInterrupt(event: GraphInterruptEvent) {
|
|
13
|
+
* console.log(event.runId, event.interrupts);
|
|
14
|
+
* }
|
|
15
|
+
* }
|
|
16
|
+
* const observed = graph.withConfig({ callbacks: [new Observer()] });
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
var GraphCallbackHandler = class extends BaseCallbackHandler {
|
|
20
|
+
name = "GraphCallbackHandler";
|
|
21
|
+
[GRAPH_CALLBACK_HANDLER] = true;
|
|
22
|
+
static isInstance(value) {
|
|
23
|
+
return typeof value === "object" && value !== null && GRAPH_CALLBACK_HANDLER in value && value[GRAPH_CALLBACK_HANDLER] === true;
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
//#endregion
|
|
27
|
+
export { GraphCallbackHandler };
|
|
28
|
+
|
|
29
|
+
//# sourceMappingURL=callbacks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"callbacks.js","names":[],"sources":["../src/callbacks.ts"],"sourcesContent":["import { BaseCallbackHandler } from \"@langchain/core/callbacks/base\";\nimport type { Interrupt } from \"./constants.js\";\n\nconst GRAPH_CALLBACK_HANDLER = Symbol.for(\"langgraph.graph_callback_handler\");\n\n/** Loop status at a graph lifecycle transition. */\nexport type GraphLifecycleStatus =\n | \"pending\"\n | \"done\"\n | \"interrupt_before\"\n | \"interrupt_after\"\n | \"out_of_steps\"\n | \"draining\";\n\n/** A graph execution resumed from a checkpoint. */\nexport interface GraphResumeEvent {\n readonly runId: string | undefined;\n readonly status: GraphLifecycleStatus;\n readonly checkpointId: string;\n readonly checkpointNs: readonly string[];\n}\n\n/** The root graph paused. Static interrupts can have an empty payload list. */\nexport interface GraphInterruptEvent extends GraphResumeEvent {\n readonly interrupts: readonly Interrupt[];\n}\n\nexport type GraphLifecycleEvent = GraphInterruptEvent | GraphResumeEvent;\n\n/**\n * Extend this class and pass an instance through `callbacks` to observe graph\n * interrupts and resumes. Lifecycle methods are always awaited, including when\n * other callbacks run in the background. Set `raiseError` to propagate errors.\n *\n * @example\n * ```ts\n * class Observer extends GraphCallbackHandler {\n * handleInterrupt(event: GraphInterruptEvent) {\n * console.log(event.runId, event.interrupts);\n * }\n * }\n * const observed = graph.withConfig({ callbacks: [new Observer()] });\n * ```\n */\nexport class GraphCallbackHandler extends BaseCallbackHandler {\n name = \"GraphCallbackHandler\";\n\n readonly [GRAPH_CALLBACK_HANDLER] = true;\n\n static isInstance(value: unknown): value is GraphCallbackHandler {\n return (\n typeof value === \"object\" &&\n value !== null &&\n GRAPH_CALLBACK_HANDLER in value &&\n value[GRAPH_CALLBACK_HANDLER] === true\n );\n }\n\n /** Called for root interrupts, before the terminal chain callback. */\n handleInterrupt?(event: GraphInterruptEvent): void | Promise<void>;\n\n /** Called before execution continues, including in resumed subgraphs. */\n handleResume?(event: GraphResumeEvent): void | Promise<void>;\n}\n"],"mappings":";;AAGA,MAAM,yBAAyB,OAAO,IAAI,mCAAmC;;;;;;;;;;;;;;;;AAyC7E,IAAa,uBAAb,cAA0C,oBAAoB;CAC5D,OAAO;CAEP,CAAU,0BAA0B;CAEpC,OAAO,WAAW,OAA+C;AAC/D,SACE,OAAO,UAAU,YACjB,UAAU,QACV,0BAA0B,SAC1B,MAAM,4BAA4B"}
|
package/dist/index.cjs
CHANGED
|
@@ -6,6 +6,7 @@ const require_base = require("./channels/base.cjs");
|
|
|
6
6
|
const require_binop = require("./channels/binop.cjs");
|
|
7
7
|
const require_annotation = require("./graph/annotation.cjs");
|
|
8
8
|
const require_config = require("./pregel/utils/config.cjs");
|
|
9
|
+
const require_callbacks = require("./callbacks.cjs");
|
|
9
10
|
const require_runtime = require("./pregel/runtime.cjs");
|
|
10
11
|
const require_convert = require("./stream/convert.cjs");
|
|
11
12
|
const require_stream_channel = require("./stream/stream-channel.cjs");
|
|
@@ -78,6 +79,7 @@ exports.EmptyInputError = require_errors.EmptyInputError;
|
|
|
78
79
|
exports.EventLog = require_stream_channel.StreamChannel;
|
|
79
80
|
exports.Graph = require_graph.Graph;
|
|
80
81
|
exports.GraphBubbleUp = require_errors.GraphBubbleUp;
|
|
82
|
+
exports.GraphCallbackHandler = require_callbacks.GraphCallbackHandler;
|
|
81
83
|
exports.GraphDrained = require_errors.GraphDrained;
|
|
82
84
|
exports.GraphInterrupt = require_errors.GraphInterrupt;
|
|
83
85
|
exports.GraphRecursionError = require_errors.GraphRecursionError;
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["initializeAsyncLocalStorageSingleton"],"sources":["../src/index.ts"],"sourcesContent":["/* __LC_ALLOW_ENTRYPOINT_SIDE_EFFECTS__ */\n\nimport { initializeAsyncLocalStorageSingleton } from \"./node.js\";\n\n// Initialize global async local storage instance for tracing\ninitializeAsyncLocalStorageSingleton();\n\nexport * from \"./web.js\";\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["initializeAsyncLocalStorageSingleton"],"sources":["../src/index.ts"],"sourcesContent":["/* __LC_ALLOW_ENTRYPOINT_SIDE_EFFECTS__ */\n\nimport { initializeAsyncLocalStorageSingleton } from \"./node.js\";\n\n// Initialize global async local storage instance for tracing\ninitializeAsyncLocalStorageSingleton();\n\nexport * from \"./web.js\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKAA,aAAAA,sCAAsC"}
|
package/dist/index.d.cts
CHANGED
|
@@ -45,5 +45,6 @@ import { MessagesAnnotation, MessagesZodMeta, MessagesZodState } from "./graph/m
|
|
|
45
45
|
import { getJsonSchemaFromSchema, getSchemaDefaultGetter } from "./state/adapter.cjs";
|
|
46
46
|
import { MessagesDeltaValue, MessagesValue } from "./state/prebuilt/messages.cjs";
|
|
47
47
|
import { getConfig, getCurrentTaskInput, getStore, getWriter } from "./pregel/utils/config.cjs";
|
|
48
|
+
import { GraphCallbackHandler, GraphInterruptEvent, GraphLifecycleEvent, GraphLifecycleStatus, GraphResumeEvent } from "./callbacks.cjs";
|
|
48
49
|
import { AsyncBatchedStore, BaseCheckpointSaver, BaseStore, Checkpoint, CheckpointMetadata, CheckpointTuple, GetOperation, InMemoryStore, Item, ListNamespacesOperation, MatchCondition, MemorySaver, NameSpacePath, NamespaceMatchType, Operation, OperationResults, PutOperation, SearchOperation, copyCheckpoint, emptyCheckpoint } from "./web.cjs";
|
|
49
|
-
export { AddNodeOptions, AgentStatus, Annotation, AnnotationRoot, AnyStateSchema, AnyValue, AsyncBatchedStore, BaseChannel, BaseCheckpointSaver, BaseLangGraphError, BaseLangGraphErrorFields, BaseStore, BinaryOperator, BinaryOperatorAggregate, COMMAND_SYMBOL, CachePolicy, ChatModelStream, ChatModelStreamImpl, Checkpoint, CheckpointMetadata, CheckpointTuple, Command, CommandInstance, CommandParams, CompiledGraph, CompiledGraphType, CompiledStateGraph, ConditionalEdgeRouter, ConditionalEdgeRouterTypes, ContextSchemaInit, ConvertToProtocolEventOptions, CreateGraphRunStreamOptions, DeltaChannel, DeltaReducer, DeltaValue, DeltaValueInit, DynamicBarrierValue, END, EmptyChannelError, EmptyInputError, EntrypointOptions, EphemeralValue, StreamChannel as EventLog, ExecutionInfo, ExtractStateType, ExtractUpdateType, GetOperation, GetStateOptions, Graph, GraphBubbleUp, GraphDrained, GraphInterrupt, GraphNode, GraphNodeReturnValue, GraphNodeTypes, GraphRecursionError, GraphRunStream, GraphValueError, INTERRUPT, InMemoryStore, InferExtensions, InferInterruptInputType, InferInterruptResumeType, InferStateSchemaUpdate, InferStateSchemaValue, InferWriterType, Interrupt, InterruptOptions, InterruptPayload, InvalidUpdateError, Item, LangGraphRunnableConfig, LastValue, LifecycleCause, LifecycleData, LifecycleEntry, LifecycleProjection, LifecycleTransformerOptions, ListNamespacesOperation, MatchCondition, MemorySaver, MessageGraph, Messages, MessagesAnnotation, MessagesDeltaValue, MessagesEventData, MessagesValue, MessagesZodMeta, MessagesZodState, MultipleChannelSubscriptionOptions, MultipleSubgraphsError, NameSpacePath, NamedBarrierValue, Namespace, NamespaceMatchType, NativeStreamTransformer, NodeError, NodeInterrupt, NodePolicyOptions, NodeSpec, NodeTimeoutError, NodeType, Operation, OperationResults, Overwrite, OverwriteValue, ParentCommand, Pregel, PregelNode, PregelOptions, PregelParams, ProtocolEvent, PutOperation, REMOVE_ALL_MESSAGES, ReducedValue, ReducedValueInit, RemoteException, RetryPolicy, RunControl, Runtime, START, STREAM_EVENTS_V3_MODES, SearchOperation, Send, SendOptions, ServerInfo, SingleChannelSubscriptionOptions, SingleReducer, StateDefinition, StateDefinitionInit, StateGraph, StateGraphAddNodeOptions, StateGraphArgs, StateGraphArgsWithInputOutputSchemas, StateGraphArgsWithStateSchema, StateGraphInit, StateGraphInputError, StateGraphNodeSpec, StateGraphOptions, StateSchema, StateSchemaField, StateSchemaFieldToChannel, StateSchemaFields, StateSchemaFieldsToStateDefinition, StateSnapshot, StateType, StreamChannel, StreamEmitter, StreamMode, StreamOutputMap, StreamTransformer, SubgraphDiscoveryProjection, SubgraphDiscoveryTransformerOptions, SubgraphRunStream, TaskOptions, TimeoutPolicy, ToStateDefinition, ToolCallStatus, ToolCallStream, ToolsEventData, Topic, UnreachableNodeError, UntrackedValue, UntrackedValueChannel, UntrackedValueInit, UpdateType, UpdatesEventData, UsageInfo, WaitForNames, messagesStateReducer as addMessages, convertToProtocolEvent, copyCheckpoint, createGraphRunStream, createLifecycleTransformer, createMessagesTransformer, createSubgraphDiscoveryTransformer, createValuesTransformer, emptyCheckpoint, entrypoint, filterLifecycleEntries, filterSubgraphHandles, getConfig, getCurrentTaskInput, getJsonSchemaFromSchema, getPreviousState, getSchemaDefaultGetter, getStore, getSubgraphsSeenSet, getWriter, interrupt, isCheckpointEnvelope, isCommand, isGraphBubbleUp, isGraphDrained, isGraphInterrupt, isInterrupted, isNativeTransformer, isNodeError, isNodeTimeoutError, isParentCommand, isSerializableSchema, isStandardSchema, messagesDeltaReducer, messagesStateReducer, pushMessage, task, writer };
|
|
50
|
+
export { AddNodeOptions, AgentStatus, Annotation, AnnotationRoot, AnyStateSchema, AnyValue, AsyncBatchedStore, BaseChannel, BaseCheckpointSaver, BaseLangGraphError, BaseLangGraphErrorFields, BaseStore, BinaryOperator, BinaryOperatorAggregate, COMMAND_SYMBOL, CachePolicy, ChatModelStream, ChatModelStreamImpl, Checkpoint, CheckpointMetadata, CheckpointTuple, Command, CommandInstance, CommandParams, CompiledGraph, CompiledGraphType, CompiledStateGraph, ConditionalEdgeRouter, ConditionalEdgeRouterTypes, ContextSchemaInit, ConvertToProtocolEventOptions, CreateGraphRunStreamOptions, DeltaChannel, DeltaReducer, DeltaValue, DeltaValueInit, DynamicBarrierValue, END, EmptyChannelError, EmptyInputError, EntrypointOptions, EphemeralValue, StreamChannel as EventLog, ExecutionInfo, ExtractStateType, ExtractUpdateType, GetOperation, GetStateOptions, Graph, GraphBubbleUp, GraphCallbackHandler, GraphDrained, GraphInterrupt, GraphInterruptEvent, GraphLifecycleEvent, GraphLifecycleStatus, GraphNode, GraphNodeReturnValue, GraphNodeTypes, GraphRecursionError, GraphResumeEvent, GraphRunStream, GraphValueError, INTERRUPT, InMemoryStore, InferExtensions, InferInterruptInputType, InferInterruptResumeType, InferStateSchemaUpdate, InferStateSchemaValue, InferWriterType, Interrupt, InterruptOptions, InterruptPayload, InvalidUpdateError, Item, LangGraphRunnableConfig, LastValue, LifecycleCause, LifecycleData, LifecycleEntry, LifecycleProjection, LifecycleTransformerOptions, ListNamespacesOperation, MatchCondition, MemorySaver, MessageGraph, Messages, MessagesAnnotation, MessagesDeltaValue, MessagesEventData, MessagesValue, MessagesZodMeta, MessagesZodState, MultipleChannelSubscriptionOptions, MultipleSubgraphsError, NameSpacePath, NamedBarrierValue, Namespace, NamespaceMatchType, NativeStreamTransformer, NodeError, NodeInterrupt, NodePolicyOptions, NodeSpec, NodeTimeoutError, NodeType, Operation, OperationResults, Overwrite, OverwriteValue, ParentCommand, Pregel, PregelNode, PregelOptions, PregelParams, ProtocolEvent, PutOperation, REMOVE_ALL_MESSAGES, ReducedValue, ReducedValueInit, RemoteException, RetryPolicy, RunControl, Runtime, START, STREAM_EVENTS_V3_MODES, SearchOperation, Send, SendOptions, ServerInfo, SingleChannelSubscriptionOptions, SingleReducer, StateDefinition, StateDefinitionInit, StateGraph, StateGraphAddNodeOptions, StateGraphArgs, StateGraphArgsWithInputOutputSchemas, StateGraphArgsWithStateSchema, StateGraphInit, StateGraphInputError, StateGraphNodeSpec, StateGraphOptions, StateSchema, StateSchemaField, StateSchemaFieldToChannel, StateSchemaFields, StateSchemaFieldsToStateDefinition, StateSnapshot, StateType, StreamChannel, StreamEmitter, StreamMode, StreamOutputMap, StreamTransformer, SubgraphDiscoveryProjection, SubgraphDiscoveryTransformerOptions, SubgraphRunStream, TaskOptions, TimeoutPolicy, ToStateDefinition, ToolCallStatus, ToolCallStream, ToolsEventData, Topic, UnreachableNodeError, UntrackedValue, UntrackedValueChannel, UntrackedValueInit, UpdateType, UpdatesEventData, UsageInfo, WaitForNames, messagesStateReducer as addMessages, convertToProtocolEvent, copyCheckpoint, createGraphRunStream, createLifecycleTransformer, createMessagesTransformer, createSubgraphDiscoveryTransformer, createValuesTransformer, emptyCheckpoint, entrypoint, filterLifecycleEntries, filterSubgraphHandles, getConfig, getCurrentTaskInput, getJsonSchemaFromSchema, getPreviousState, getSchemaDefaultGetter, getStore, getSubgraphsSeenSet, getWriter, interrupt, isCheckpointEnvelope, isCommand, isGraphBubbleUp, isGraphDrained, isGraphInterrupt, isInterrupted, isNativeTransformer, isNodeError, isNodeTimeoutError, isParentCommand, isSerializableSchema, isStandardSchema, messagesDeltaReducer, messagesStateReducer, pushMessage, task, writer };
|
package/dist/index.d.ts
CHANGED
|
@@ -45,5 +45,6 @@ import { MessagesAnnotation, MessagesZodMeta, MessagesZodState } from "./graph/m
|
|
|
45
45
|
import { getJsonSchemaFromSchema, getSchemaDefaultGetter } from "./state/adapter.js";
|
|
46
46
|
import { MessagesDeltaValue, MessagesValue } from "./state/prebuilt/messages.js";
|
|
47
47
|
import { getConfig, getCurrentTaskInput, getStore, getWriter } from "./pregel/utils/config.js";
|
|
48
|
+
import { GraphCallbackHandler, GraphInterruptEvent, GraphLifecycleEvent, GraphLifecycleStatus, GraphResumeEvent } from "./callbacks.js";
|
|
48
49
|
import { AsyncBatchedStore, BaseCheckpointSaver, BaseStore, Checkpoint, CheckpointMetadata, CheckpointTuple, GetOperation, InMemoryStore, Item, ListNamespacesOperation, MatchCondition, MemorySaver, NameSpacePath, NamespaceMatchType, Operation, OperationResults, PutOperation, SearchOperation, copyCheckpoint, emptyCheckpoint } from "./web.js";
|
|
49
|
-
export { AddNodeOptions, AgentStatus, Annotation, AnnotationRoot, AnyStateSchema, AnyValue, AsyncBatchedStore, BaseChannel, BaseCheckpointSaver, BaseLangGraphError, BaseLangGraphErrorFields, BaseStore, BinaryOperator, BinaryOperatorAggregate, COMMAND_SYMBOL, CachePolicy, ChatModelStream, ChatModelStreamImpl, Checkpoint, CheckpointMetadata, CheckpointTuple, Command, CommandInstance, CommandParams, CompiledGraph, CompiledGraphType, CompiledStateGraph, ConditionalEdgeRouter, ConditionalEdgeRouterTypes, ContextSchemaInit, ConvertToProtocolEventOptions, CreateGraphRunStreamOptions, DeltaChannel, DeltaReducer, DeltaValue, DeltaValueInit, DynamicBarrierValue, END, EmptyChannelError, EmptyInputError, EntrypointOptions, EphemeralValue, StreamChannel as EventLog, ExecutionInfo, ExtractStateType, ExtractUpdateType, GetOperation, GetStateOptions, Graph, GraphBubbleUp, GraphDrained, GraphInterrupt, GraphNode, GraphNodeReturnValue, GraphNodeTypes, GraphRecursionError, GraphRunStream, GraphValueError, INTERRUPT, InMemoryStore, InferExtensions, InferInterruptInputType, InferInterruptResumeType, InferStateSchemaUpdate, InferStateSchemaValue, InferWriterType, Interrupt, InterruptOptions, InterruptPayload, InvalidUpdateError, Item, LangGraphRunnableConfig, LastValue, LifecycleCause, LifecycleData, LifecycleEntry, LifecycleProjection, LifecycleTransformerOptions, ListNamespacesOperation, MatchCondition, MemorySaver, MessageGraph, Messages, MessagesAnnotation, MessagesDeltaValue, MessagesEventData, MessagesValue, MessagesZodMeta, MessagesZodState, MultipleChannelSubscriptionOptions, MultipleSubgraphsError, NameSpacePath, NamedBarrierValue, Namespace, NamespaceMatchType, NativeStreamTransformer, NodeError, NodeInterrupt, NodePolicyOptions, NodeSpec, NodeTimeoutError, NodeType, Operation, OperationResults, Overwrite, OverwriteValue, ParentCommand, Pregel, PregelNode, PregelOptions, PregelParams, ProtocolEvent, PutOperation, REMOVE_ALL_MESSAGES, ReducedValue, ReducedValueInit, RemoteException, RetryPolicy, RunControl, Runtime, START, STREAM_EVENTS_V3_MODES, SearchOperation, Send, SendOptions, ServerInfo, SingleChannelSubscriptionOptions, SingleReducer, StateDefinition, StateDefinitionInit, StateGraph, StateGraphAddNodeOptions, StateGraphArgs, StateGraphArgsWithInputOutputSchemas, StateGraphArgsWithStateSchema, StateGraphInit, StateGraphInputError, StateGraphNodeSpec, StateGraphOptions, StateSchema, StateSchemaField, StateSchemaFieldToChannel, StateSchemaFields, StateSchemaFieldsToStateDefinition, StateSnapshot, StateType, StreamChannel, StreamEmitter, StreamMode, StreamOutputMap, StreamTransformer, SubgraphDiscoveryProjection, SubgraphDiscoveryTransformerOptions, SubgraphRunStream, TaskOptions, TimeoutPolicy, ToStateDefinition, ToolCallStatus, ToolCallStream, ToolsEventData, Topic, UnreachableNodeError, UntrackedValue, UntrackedValueChannel, UntrackedValueInit, UpdateType, UpdatesEventData, UsageInfo, WaitForNames, messagesStateReducer as addMessages, convertToProtocolEvent, copyCheckpoint, createGraphRunStream, createLifecycleTransformer, createMessagesTransformer, createSubgraphDiscoveryTransformer, createValuesTransformer, emptyCheckpoint, entrypoint, filterLifecycleEntries, filterSubgraphHandles, getConfig, getCurrentTaskInput, getJsonSchemaFromSchema, getPreviousState, getSchemaDefaultGetter, getStore, getSubgraphsSeenSet, getWriter, interrupt, isCheckpointEnvelope, isCommand, isGraphBubbleUp, isGraphDrained, isGraphInterrupt, isInterrupted, isNativeTransformer, isNodeError, isNodeTimeoutError, isParentCommand, isSerializableSchema, isStandardSchema, messagesDeltaReducer, messagesStateReducer, pushMessage, task, writer };
|
|
50
|
+
export { AddNodeOptions, AgentStatus, Annotation, AnnotationRoot, AnyStateSchema, AnyValue, AsyncBatchedStore, BaseChannel, BaseCheckpointSaver, BaseLangGraphError, BaseLangGraphErrorFields, BaseStore, BinaryOperator, BinaryOperatorAggregate, COMMAND_SYMBOL, CachePolicy, ChatModelStream, ChatModelStreamImpl, Checkpoint, CheckpointMetadata, CheckpointTuple, Command, CommandInstance, CommandParams, CompiledGraph, CompiledGraphType, CompiledStateGraph, ConditionalEdgeRouter, ConditionalEdgeRouterTypes, ContextSchemaInit, ConvertToProtocolEventOptions, CreateGraphRunStreamOptions, DeltaChannel, DeltaReducer, DeltaValue, DeltaValueInit, DynamicBarrierValue, END, EmptyChannelError, EmptyInputError, EntrypointOptions, EphemeralValue, StreamChannel as EventLog, ExecutionInfo, ExtractStateType, ExtractUpdateType, GetOperation, GetStateOptions, Graph, GraphBubbleUp, GraphCallbackHandler, GraphDrained, GraphInterrupt, GraphInterruptEvent, GraphLifecycleEvent, GraphLifecycleStatus, GraphNode, GraphNodeReturnValue, GraphNodeTypes, GraphRecursionError, GraphResumeEvent, GraphRunStream, GraphValueError, INTERRUPT, InMemoryStore, InferExtensions, InferInterruptInputType, InferInterruptResumeType, InferStateSchemaUpdate, InferStateSchemaValue, InferWriterType, Interrupt, InterruptOptions, InterruptPayload, InvalidUpdateError, Item, LangGraphRunnableConfig, LastValue, LifecycleCause, LifecycleData, LifecycleEntry, LifecycleProjection, LifecycleTransformerOptions, ListNamespacesOperation, MatchCondition, MemorySaver, MessageGraph, Messages, MessagesAnnotation, MessagesDeltaValue, MessagesEventData, MessagesValue, MessagesZodMeta, MessagesZodState, MultipleChannelSubscriptionOptions, MultipleSubgraphsError, NameSpacePath, NamedBarrierValue, Namespace, NamespaceMatchType, NativeStreamTransformer, NodeError, NodeInterrupt, NodePolicyOptions, NodeSpec, NodeTimeoutError, NodeType, Operation, OperationResults, Overwrite, OverwriteValue, ParentCommand, Pregel, PregelNode, PregelOptions, PregelParams, ProtocolEvent, PutOperation, REMOVE_ALL_MESSAGES, ReducedValue, ReducedValueInit, RemoteException, RetryPolicy, RunControl, Runtime, START, STREAM_EVENTS_V3_MODES, SearchOperation, Send, SendOptions, ServerInfo, SingleChannelSubscriptionOptions, SingleReducer, StateDefinition, StateDefinitionInit, StateGraph, StateGraphAddNodeOptions, StateGraphArgs, StateGraphArgsWithInputOutputSchemas, StateGraphArgsWithStateSchema, StateGraphInit, StateGraphInputError, StateGraphNodeSpec, StateGraphOptions, StateSchema, StateSchemaField, StateSchemaFieldToChannel, StateSchemaFields, StateSchemaFieldsToStateDefinition, StateSnapshot, StateType, StreamChannel, StreamEmitter, StreamMode, StreamOutputMap, StreamTransformer, SubgraphDiscoveryProjection, SubgraphDiscoveryTransformerOptions, SubgraphRunStream, TaskOptions, TimeoutPolicy, ToStateDefinition, ToolCallStatus, ToolCallStream, ToolsEventData, Topic, UnreachableNodeError, UntrackedValue, UntrackedValueChannel, UntrackedValueInit, UpdateType, UpdatesEventData, UsageInfo, WaitForNames, messagesStateReducer as addMessages, convertToProtocolEvent, copyCheckpoint, createGraphRunStream, createLifecycleTransformer, createMessagesTransformer, createSubgraphDiscoveryTransformer, createValuesTransformer, emptyCheckpoint, entrypoint, filterLifecycleEntries, filterSubgraphHandles, getConfig, getCurrentTaskInput, getJsonSchemaFromSchema, getPreviousState, getSchemaDefaultGetter, getStore, getSubgraphsSeenSet, getWriter, interrupt, isCheckpointEnvelope, isCommand, isGraphBubbleUp, isGraphDrained, isGraphInterrupt, isInterrupted, isNativeTransformer, isNodeError, isNodeTimeoutError, isParentCommand, isSerializableSchema, isStandardSchema, messagesDeltaReducer, messagesStateReducer, pushMessage, task, writer };
|
package/dist/index.js
CHANGED
|
@@ -5,6 +5,7 @@ import { BaseChannel } from "./channels/base.js";
|
|
|
5
5
|
import { BinaryOperatorAggregate } from "./channels/binop.js";
|
|
6
6
|
import { Annotation } from "./graph/annotation.js";
|
|
7
7
|
import { getConfig, getCurrentTaskInput, getStore, getWriter } from "./pregel/utils/config.js";
|
|
8
|
+
import { GraphCallbackHandler } from "./callbacks.js";
|
|
8
9
|
import { RunControl } from "./pregel/runtime.js";
|
|
9
10
|
import { STREAM_EVENTS_V3_MODES, convertToProtocolEvent, isCheckpointEnvelope } from "./stream/convert.js";
|
|
10
11
|
import { StreamChannel } from "./stream/stream-channel.js";
|
|
@@ -36,6 +37,6 @@ import { AsyncBatchedStore, BaseCheckpointSaver, BaseStore, InMemoryStore, Memor
|
|
|
36
37
|
//#region src/index.ts
|
|
37
38
|
initializeAsyncLocalStorageSingleton();
|
|
38
39
|
//#endregion
|
|
39
|
-
export { Annotation, AsyncBatchedStore, BaseChannel, BaseCheckpointSaver, BaseLangGraphError, BaseStore, BinaryOperatorAggregate, COMMAND_SYMBOL, ChatModelStreamImpl, Command, CommandInstance, CompiledStateGraph, DeltaChannel, DeltaValue, END, EmptyChannelError, EmptyInputError, StreamChannel as EventLog, Graph, GraphBubbleUp, GraphDrained, GraphInterrupt, GraphRecursionError, GraphRunStream, GraphValueError, INTERRUPT, InMemoryStore, InvalidUpdateError, MemorySaver, MessageGraph, MessagesAnnotation, MessagesDeltaValue, MessagesValue, MessagesZodMeta, MessagesZodState, MultipleSubgraphsError, NodeError, NodeInterrupt, NodeTimeoutError, Overwrite, ParentCommand, REMOVE_ALL_MESSAGES, ReducedValue, RemoteException, RunControl, START, STREAM_EVENTS_V3_MODES, Send, StateGraph, StateGraphInputError, StateSchema, StreamChannel, SubgraphRunStream, UnreachableNodeError, UntrackedValue, UntrackedValueChannel, messagesStateReducer as addMessages, convertToProtocolEvent, copyCheckpoint, createGraphRunStream, createLifecycleTransformer, createMessagesTransformer, createSubgraphDiscoveryTransformer, createValuesTransformer, emptyCheckpoint, entrypoint, filterLifecycleEntries, filterSubgraphHandles, getConfig, getCurrentTaskInput, getJsonSchemaFromSchema, getPreviousState, getSchemaDefaultGetter, getStore, getSubgraphsSeenSet, getWriter, interrupt, isCheckpointEnvelope, isCommand, isGraphBubbleUp, isGraphDrained, isGraphInterrupt, isInterrupted, isNativeTransformer, isNodeError, isNodeTimeoutError, isParentCommand, isSerializableSchema, isStandardSchema, messagesDeltaReducer, messagesStateReducer, pushMessage, task, writer };
|
|
40
|
+
export { Annotation, AsyncBatchedStore, BaseChannel, BaseCheckpointSaver, BaseLangGraphError, BaseStore, BinaryOperatorAggregate, COMMAND_SYMBOL, ChatModelStreamImpl, Command, CommandInstance, CompiledStateGraph, DeltaChannel, DeltaValue, END, EmptyChannelError, EmptyInputError, StreamChannel as EventLog, Graph, GraphBubbleUp, GraphCallbackHandler, GraphDrained, GraphInterrupt, GraphRecursionError, GraphRunStream, GraphValueError, INTERRUPT, InMemoryStore, InvalidUpdateError, MemorySaver, MessageGraph, MessagesAnnotation, MessagesDeltaValue, MessagesValue, MessagesZodMeta, MessagesZodState, MultipleSubgraphsError, NodeError, NodeInterrupt, NodeTimeoutError, Overwrite, ParentCommand, REMOVE_ALL_MESSAGES, ReducedValue, RemoteException, RunControl, START, STREAM_EVENTS_V3_MODES, Send, StateGraph, StateGraphInputError, StateSchema, StreamChannel, SubgraphRunStream, UnreachableNodeError, UntrackedValue, UntrackedValueChannel, messagesStateReducer as addMessages, convertToProtocolEvent, copyCheckpoint, createGraphRunStream, createLifecycleTransformer, createMessagesTransformer, createSubgraphDiscoveryTransformer, createValuesTransformer, emptyCheckpoint, entrypoint, filterLifecycleEntries, filterSubgraphHandles, getConfig, getCurrentTaskInput, getJsonSchemaFromSchema, getPreviousState, getSchemaDefaultGetter, getStore, getSubgraphsSeenSet, getWriter, interrupt, isCheckpointEnvelope, isCommand, isGraphBubbleUp, isGraphDrained, isGraphInterrupt, isInterrupted, isNativeTransformer, isNodeError, isNodeTimeoutError, isParentCommand, isSerializableSchema, isStandardSchema, messagesDeltaReducer, messagesStateReducer, pushMessage, task, writer };
|
|
40
41
|
|
|
41
42
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["/* __LC_ALLOW_ENTRYPOINT_SIDE_EFFECTS__ */\n\nimport { initializeAsyncLocalStorageSingleton } from \"./node.js\";\n\n// Initialize global async local storage instance for tracing\ninitializeAsyncLocalStorageSingleton();\n\nexport * from \"./web.js\";\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["/* __LC_ALLOW_ENTRYPOINT_SIDE_EFFECTS__ */\n\nimport { initializeAsyncLocalStorageSingleton } from \"./node.js\";\n\n// Initialize global async local storage instance for tracing\ninitializeAsyncLocalStorageSingleton();\n\nexport * from \"./web.js\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,sCAAsC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
const require_callbacks = require("../callbacks.cjs");
|
|
2
|
+
//#region src/pregel/callbacks.ts
|
|
3
|
+
function getGraphCallbackDispatcher(manager) {
|
|
4
|
+
const handlers = manager?.handlers.filter(require_callbacks.GraphCallbackHandler.isInstance);
|
|
5
|
+
if (!handlers?.length) return void 0;
|
|
6
|
+
return async (events) => {
|
|
7
|
+
while (events?.length) {
|
|
8
|
+
const event = events.shift();
|
|
9
|
+
for (const handler of handlers) {
|
|
10
|
+
const method = "interrupts" in event ? "handleInterrupt" : "handleResume";
|
|
11
|
+
try {
|
|
12
|
+
if ("interrupts" in event) await handler.handleInterrupt?.(event);
|
|
13
|
+
else await handler.handleResume?.(event);
|
|
14
|
+
} catch (error) {
|
|
15
|
+
(handler.raiseError ? console.error : console.warn)(`Error in handler ${handler.constructor.name}, ${method}: ${error}`);
|
|
16
|
+
if (handler.raiseError) throw error;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
//#endregion
|
|
23
|
+
exports.getGraphCallbackDispatcher = getGraphCallbackDispatcher;
|
|
24
|
+
|
|
25
|
+
//# sourceMappingURL=callbacks.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"callbacks.cjs","names":["GraphCallbackHandler"],"sources":["../../src/pregel/callbacks.ts"],"sourcesContent":["import type { CallbackManagerForChainRun } from \"@langchain/core/callbacks/manager\";\nimport {\n GraphCallbackHandler,\n type GraphLifecycleEvent,\n} from \"../callbacks.js\";\n\nexport function getGraphCallbackDispatcher(\n manager: CallbackManagerForChainRun | undefined\n) {\n const handlers = manager?.handlers.filter(GraphCallbackHandler.isInstance);\n if (!handlers?.length) return undefined;\n\n return async (events: GraphLifecycleEvent[] | undefined) => {\n while (events?.length) {\n const event = events.shift()!;\n for (const handler of handlers) {\n const method =\n \"interrupts\" in event ? \"handleInterrupt\" : \"handleResume\";\n try {\n if (\"interrupts\" in event) {\n await handler.handleInterrupt?.(event);\n } else {\n await handler.handleResume?.(event);\n }\n } catch (error) {\n (handler.raiseError ? console.error : console.warn)(\n `Error in handler ${handler.constructor.name}, ${method}: ${error}`\n );\n if (handler.raiseError) throw error;\n }\n }\n }\n };\n}\n"],"mappings":";;AAMA,SAAgB,2BACd,SACA;CACA,MAAM,WAAW,SAAS,SAAS,OAAOA,kBAAAA,qBAAqB,WAAW;AAC1E,KAAI,CAAC,UAAU,OAAQ,QAAO,KAAA;AAE9B,QAAO,OAAO,WAA8C;AAC1D,SAAO,QAAQ,QAAQ;GACrB,MAAM,QAAQ,OAAO,OAAO;AAC5B,QAAK,MAAM,WAAW,UAAU;IAC9B,MAAM,SACJ,gBAAgB,QAAQ,oBAAoB;AAC9C,QAAI;AACF,SAAI,gBAAgB,MAClB,OAAM,QAAQ,kBAAkB,MAAM;SAEtC,OAAM,QAAQ,eAAe,MAAM;aAE9B,OAAO;AACd,MAAC,QAAQ,aAAa,QAAQ,QAAQ,QAAQ,MAC5C,oBAAoB,QAAQ,YAAY,KAAK,IAAI,OAAO,IAAI,QAC7D;AACD,SAAI,QAAQ,WAAY,OAAM"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { GraphCallbackHandler } from "../callbacks.js";
|
|
2
|
+
//#region src/pregel/callbacks.ts
|
|
3
|
+
function getGraphCallbackDispatcher(manager) {
|
|
4
|
+
const handlers = manager?.handlers.filter(GraphCallbackHandler.isInstance);
|
|
5
|
+
if (!handlers?.length) return void 0;
|
|
6
|
+
return async (events) => {
|
|
7
|
+
while (events?.length) {
|
|
8
|
+
const event = events.shift();
|
|
9
|
+
for (const handler of handlers) {
|
|
10
|
+
const method = "interrupts" in event ? "handleInterrupt" : "handleResume";
|
|
11
|
+
try {
|
|
12
|
+
if ("interrupts" in event) await handler.handleInterrupt?.(event);
|
|
13
|
+
else await handler.handleResume?.(event);
|
|
14
|
+
} catch (error) {
|
|
15
|
+
(handler.raiseError ? console.error : console.warn)(`Error in handler ${handler.constructor.name}, ${method}: ${error}`);
|
|
16
|
+
if (handler.raiseError) throw error;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
//#endregion
|
|
23
|
+
export { getGraphCallbackDispatcher };
|
|
24
|
+
|
|
25
|
+
//# sourceMappingURL=callbacks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"callbacks.js","names":[],"sources":["../../src/pregel/callbacks.ts"],"sourcesContent":["import type { CallbackManagerForChainRun } from \"@langchain/core/callbacks/manager\";\nimport {\n GraphCallbackHandler,\n type GraphLifecycleEvent,\n} from \"../callbacks.js\";\n\nexport function getGraphCallbackDispatcher(\n manager: CallbackManagerForChainRun | undefined\n) {\n const handlers = manager?.handlers.filter(GraphCallbackHandler.isInstance);\n if (!handlers?.length) return undefined;\n\n return async (events: GraphLifecycleEvent[] | undefined) => {\n while (events?.length) {\n const event = events.shift()!;\n for (const handler of handlers) {\n const method =\n \"interrupts\" in event ? \"handleInterrupt\" : \"handleResume\";\n try {\n if (\"interrupts\" in event) {\n await handler.handleInterrupt?.(event);\n } else {\n await handler.handleResume?.(event);\n }\n } catch (error) {\n (handler.raiseError ? console.error : console.warn)(\n `Error in handler ${handler.constructor.name}, ${method}: ${error}`\n );\n if (handler.raiseError) throw error;\n }\n }\n }\n };\n}\n"],"mappings":";;AAMA,SAAgB,2BACd,SACA;CACA,MAAM,WAAW,SAAS,SAAS,OAAO,qBAAqB,WAAW;AAC1E,KAAI,CAAC,UAAU,OAAQ,QAAO,KAAA;AAE9B,QAAO,OAAO,WAA8C;AAC1D,SAAO,QAAQ,QAAQ;GACrB,MAAM,QAAQ,OAAO,OAAO;AAC5B,QAAK,MAAM,WAAW,UAAU;IAC9B,MAAM,SACJ,gBAAgB,QAAQ,oBAAoB;AAC9C,QAAI;AACF,SAAI,gBAAgB,MAClB,OAAM,QAAQ,kBAAkB,MAAM;SAEtC,OAAM,QAAQ,eAAe,MAAM;aAE9B,OAAO;AACd,MAAC,QAAQ,aAAa,QAAQ,QAAQ,QAAQ,MAC5C,oBAAoB,QAAQ,YAAY,KAAK,IAAI,OAAO,IAAI,QAC7D;AACD,SAAI,QAAQ,WAAY,OAAM"}
|
package/dist/pregel/index.cjs
CHANGED
|
@@ -6,6 +6,7 @@ const require_config = require("./utils/config.cjs");
|
|
|
6
6
|
const require_utils = require("../utils.cjs");
|
|
7
7
|
const require_write = require("./write.cjs");
|
|
8
8
|
const require_read = require("./read.cjs");
|
|
9
|
+
const require_callbacks = require("./callbacks.cjs");
|
|
9
10
|
const require_runtime = require("./runtime.cjs");
|
|
10
11
|
const require_io = require("./io.cjs");
|
|
11
12
|
const require_index = require("./utils/index.cjs");
|
|
@@ -1061,6 +1062,7 @@ var Pregel = class extends PartialRunnable {
|
|
|
1061
1062
|
config.control ??= new require_runtime.RunControl();
|
|
1062
1063
|
const callbackManagerOptions = { tracerInheritableMetadata: _getTracingMetadataDefaults(config) };
|
|
1063
1064
|
const runManager = await (await _langchain_core_callbacks_manager.CallbackManager._configureSync(config?.callbacks, void 0, config?.tags, void 0, config?.metadata, void 0, callbackManagerOptions))?.handleChainStart(this.toJSON(), require_index._coerceToDict(input, "input"), runId, void 0, void 0, void 0, config?.runName ?? this.getName());
|
|
1065
|
+
const dispatchGraphCallbacks = require_callbacks.getGraphCallbackDispatcher(runManager);
|
|
1064
1066
|
const channelSpecs = require_base.getOnlyChannels(this.channels);
|
|
1065
1067
|
let loop;
|
|
1066
1068
|
let loopError;
|
|
@@ -1088,6 +1090,7 @@ var Pregel = class extends PartialRunnable {
|
|
|
1088
1090
|
interruptAfter,
|
|
1089
1091
|
interruptBefore,
|
|
1090
1092
|
manager: runManager,
|
|
1093
|
+
hasGraphCallbacks: dispatchGraphCallbacks !== void 0,
|
|
1091
1094
|
debug: this.debug,
|
|
1092
1095
|
triggerToNodes: this.triggerToNodes,
|
|
1093
1096
|
durability
|
|
@@ -1104,7 +1107,8 @@ var Pregel = class extends PartialRunnable {
|
|
|
1104
1107
|
loop,
|
|
1105
1108
|
runner,
|
|
1106
1109
|
debug,
|
|
1107
|
-
config
|
|
1110
|
+
config,
|
|
1111
|
+
emitLifecycleEvents: dispatchGraphCallbacks
|
|
1108
1112
|
});
|
|
1109
1113
|
if (durability === "sync") await Promise.all(loop?.checkpointerPromises ?? []);
|
|
1110
1114
|
} catch (e) {
|
|
@@ -1199,10 +1203,11 @@ var Pregel = class extends PartialRunnable {
|
|
|
1199
1203
|
return chunks;
|
|
1200
1204
|
}
|
|
1201
1205
|
async _runLoop(params) {
|
|
1202
|
-
const { loop, runner, debug, config } = params;
|
|
1206
|
+
const { loop, runner, debug, config, emitLifecycleEvents } = params;
|
|
1203
1207
|
let tickError;
|
|
1204
1208
|
try {
|
|
1205
1209
|
while (await loop.tick({ inputKeys: this.inputChannels })) {
|
|
1210
|
+
if (emitLifecycleEvents) await emitLifecycleEvents(loop.lifecycleEvents);
|
|
1206
1211
|
for (const { task } of await loop._matchCachedWrites()) loop._outputWrites(task.id, task.writes, true);
|
|
1207
1212
|
if (debug) require_debug.printStepCheckpoint(loop.checkpointMetadata.step, loop.channels, this.streamChannelsList);
|
|
1208
1213
|
if (debug) require_debug.printStepTasks(loop.step, Object.values(loop.tasks));
|
|
@@ -1230,6 +1235,7 @@ var Pregel = class extends PartialRunnable {
|
|
|
1230
1235
|
if (!await loop.finishAndHandleError(tickError)) throw e;
|
|
1231
1236
|
} finally {
|
|
1232
1237
|
if (tickError === void 0) await loop.finishAndHandleError();
|
|
1238
|
+
if (emitLifecycleEvents) await emitLifecycleEvents(loop.lifecycleEvents);
|
|
1233
1239
|
}
|
|
1234
1240
|
}
|
|
1235
1241
|
async clearCache() {
|