@langchain/langgraph 1.2.8 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (166) hide show
  1. package/dist/graph/graph.cjs +6 -2
  2. package/dist/graph/graph.cjs.map +1 -1
  3. package/dist/graph/graph.d.cts +58 -7
  4. package/dist/graph/graph.d.cts.map +1 -1
  5. package/dist/graph/graph.d.ts +58 -7
  6. package/dist/graph/graph.d.ts.map +1 -1
  7. package/dist/graph/graph.js +6 -2
  8. package/dist/graph/graph.js.map +1 -1
  9. package/dist/graph/index.d.ts +3 -3
  10. package/dist/graph/state.cjs +3 -2
  11. package/dist/graph/state.cjs.map +1 -1
  12. package/dist/graph/state.d.cts +14 -6
  13. package/dist/graph/state.d.cts.map +1 -1
  14. package/dist/graph/state.d.ts +14 -6
  15. package/dist/graph/state.d.ts.map +1 -1
  16. package/dist/graph/state.js +3 -2
  17. package/dist/graph/state.js.map +1 -1
  18. package/dist/index.cjs +34 -5
  19. package/dist/index.cjs.map +1 -1
  20. package/dist/index.d.cts +16 -6
  21. package/dist/index.d.ts +16 -6
  22. package/dist/index.js +10 -1
  23. package/dist/index.js.map +1 -1
  24. package/dist/prebuilt/agent_executor.d.cts +1 -1
  25. package/dist/prebuilt/agent_executor.d.ts +1 -1
  26. package/dist/pregel/algo.cjs +6 -3
  27. package/dist/pregel/algo.cjs.map +1 -1
  28. package/dist/pregel/algo.js +6 -3
  29. package/dist/pregel/algo.js.map +1 -1
  30. package/dist/pregel/index.cjs +96 -25
  31. package/dist/pregel/index.cjs.map +1 -1
  32. package/dist/pregel/index.d.cts +25 -3
  33. package/dist/pregel/index.d.cts.map +1 -1
  34. package/dist/pregel/index.d.ts +25 -3
  35. package/dist/pregel/index.d.ts.map +1 -1
  36. package/dist/pregel/index.js +97 -26
  37. package/dist/pregel/index.js.map +1 -1
  38. package/dist/pregel/loop.cjs +51 -10
  39. package/dist/pregel/loop.cjs.map +1 -1
  40. package/dist/pregel/loop.js +51 -10
  41. package/dist/pregel/loop.js.map +1 -1
  42. package/dist/pregel/messages-v2.cjs +231 -0
  43. package/dist/pregel/messages-v2.cjs.map +1 -0
  44. package/dist/pregel/messages-v2.js +231 -0
  45. package/dist/pregel/messages-v2.js.map +1 -0
  46. package/dist/pregel/messages.cjs +14 -10
  47. package/dist/pregel/messages.cjs.map +1 -1
  48. package/dist/pregel/messages.js +14 -10
  49. package/dist/pregel/messages.js.map +1 -1
  50. package/dist/pregel/remote.cjs +15 -0
  51. package/dist/pregel/remote.cjs.map +1 -1
  52. package/dist/pregel/remote.d.cts.map +1 -1
  53. package/dist/pregel/remote.d.ts.map +1 -1
  54. package/dist/pregel/remote.js +15 -0
  55. package/dist/pregel/remote.js.map +1 -1
  56. package/dist/pregel/stream.cjs.map +1 -1
  57. package/dist/pregel/stream.d.cts +30 -0
  58. package/dist/pregel/stream.d.cts.map +1 -0
  59. package/dist/pregel/stream.d.ts +30 -1
  60. package/dist/pregel/stream.d.ts.map +1 -0
  61. package/dist/pregel/stream.js.map +1 -1
  62. package/dist/pregel/types.cjs.map +1 -1
  63. package/dist/pregel/types.d.cts +8 -1
  64. package/dist/pregel/types.d.cts.map +1 -1
  65. package/dist/pregel/types.d.ts +8 -1
  66. package/dist/pregel/types.d.ts.map +1 -1
  67. package/dist/pregel/types.js.map +1 -1
  68. package/dist/pregel/utils/config.cjs +21 -4
  69. package/dist/pregel/utils/config.cjs.map +1 -1
  70. package/dist/pregel/utils/config.d.cts.map +1 -1
  71. package/dist/pregel/utils/config.d.ts.map +1 -1
  72. package/dist/pregel/utils/config.js +21 -5
  73. package/dist/pregel/utils/config.js.map +1 -1
  74. package/dist/pregel/utils/index.d.ts +0 -1
  75. package/dist/pregel/utils/index.d.ts.map +1 -1
  76. package/dist/state/index.d.ts +1 -1
  77. package/dist/state/schema.d.cts +1 -1
  78. package/dist/state/schema.d.ts +1 -1
  79. package/dist/stream/convert.cjs +207 -0
  80. package/dist/stream/convert.cjs.map +1 -0
  81. package/dist/stream/convert.d.cts +69 -0
  82. package/dist/stream/convert.d.cts.map +1 -0
  83. package/dist/stream/convert.d.ts +69 -0
  84. package/dist/stream/convert.d.ts.map +1 -0
  85. package/dist/stream/convert.js +206 -0
  86. package/dist/stream/convert.js.map +1 -0
  87. package/dist/stream/index.cjs +11 -0
  88. package/dist/stream/index.d.cts +12 -0
  89. package/dist/stream/index.d.ts +12 -0
  90. package/dist/stream/index.js +12 -0
  91. package/dist/stream/mux.cjs +350 -0
  92. package/dist/stream/mux.cjs.map +1 -0
  93. package/dist/stream/mux.d.cts +160 -0
  94. package/dist/stream/mux.d.cts.map +1 -0
  95. package/dist/stream/mux.d.ts +160 -0
  96. package/dist/stream/mux.d.ts.map +1 -0
  97. package/dist/stream/mux.js +345 -0
  98. package/dist/stream/mux.js.map +1 -0
  99. package/dist/stream/run-stream.cjs +439 -0
  100. package/dist/stream/run-stream.cjs.map +1 -0
  101. package/dist/stream/run-stream.d.cts +286 -0
  102. package/dist/stream/run-stream.d.cts.map +1 -0
  103. package/dist/stream/run-stream.d.ts +285 -0
  104. package/dist/stream/run-stream.d.ts.map +1 -0
  105. package/dist/stream/run-stream.js +434 -0
  106. package/dist/stream/run-stream.js.map +1 -0
  107. package/dist/stream/stream-channel.cjs +208 -0
  108. package/dist/stream/stream-channel.cjs.map +1 -0
  109. package/dist/stream/stream-channel.d.cts +129 -0
  110. package/dist/stream/stream-channel.d.cts.map +1 -0
  111. package/dist/stream/stream-channel.d.ts +129 -0
  112. package/dist/stream/stream-channel.d.ts.map +1 -0
  113. package/dist/stream/stream-channel.js +207 -0
  114. package/dist/stream/stream-channel.js.map +1 -0
  115. package/dist/stream/transformers/index.cjs +4 -0
  116. package/dist/stream/transformers/index.d.ts +5 -0
  117. package/dist/stream/transformers/index.js +5 -0
  118. package/dist/stream/transformers/lifecycle.cjs +326 -0
  119. package/dist/stream/transformers/lifecycle.cjs.map +1 -0
  120. package/dist/stream/transformers/lifecycle.d.cts +53 -0
  121. package/dist/stream/transformers/lifecycle.d.cts.map +1 -0
  122. package/dist/stream/transformers/lifecycle.d.ts +53 -0
  123. package/dist/stream/transformers/lifecycle.d.ts.map +1 -0
  124. package/dist/stream/transformers/lifecycle.js +325 -0
  125. package/dist/stream/transformers/lifecycle.js.map +1 -0
  126. package/dist/stream/transformers/messages.cjs +94 -0
  127. package/dist/stream/transformers/messages.cjs.map +1 -0
  128. package/dist/stream/transformers/messages.d.cts +23 -0
  129. package/dist/stream/transformers/messages.d.cts.map +1 -0
  130. package/dist/stream/transformers/messages.d.ts +23 -0
  131. package/dist/stream/transformers/messages.d.ts.map +1 -0
  132. package/dist/stream/transformers/messages.js +94 -0
  133. package/dist/stream/transformers/messages.js.map +1 -0
  134. package/dist/stream/transformers/subgraphs.cjs +125 -0
  135. package/dist/stream/transformers/subgraphs.cjs.map +1 -0
  136. package/dist/stream/transformers/subgraphs.d.cts +95 -0
  137. package/dist/stream/transformers/subgraphs.d.cts.map +1 -0
  138. package/dist/stream/transformers/subgraphs.d.ts +95 -0
  139. package/dist/stream/transformers/subgraphs.d.ts.map +1 -0
  140. package/dist/stream/transformers/subgraphs.js +124 -0
  141. package/dist/stream/transformers/subgraphs.js.map +1 -0
  142. package/dist/stream/transformers/types.d.cts +89 -0
  143. package/dist/stream/transformers/types.d.cts.map +1 -0
  144. package/dist/stream/transformers/types.d.ts +89 -0
  145. package/dist/stream/transformers/types.d.ts.map +1 -0
  146. package/dist/stream/transformers/values.cjs +39 -0
  147. package/dist/stream/transformers/values.cjs.map +1 -0
  148. package/dist/stream/transformers/values.d.cts +21 -0
  149. package/dist/stream/transformers/values.d.cts.map +1 -0
  150. package/dist/stream/transformers/values.d.ts +21 -0
  151. package/dist/stream/transformers/values.d.ts.map +1 -0
  152. package/dist/stream/transformers/values.js +39 -0
  153. package/dist/stream/transformers/values.js.map +1 -0
  154. package/dist/stream/types.cjs +11 -0
  155. package/dist/stream/types.cjs.map +1 -0
  156. package/dist/stream/types.d.cts +255 -0
  157. package/dist/stream/types.d.cts.map +1 -0
  158. package/dist/stream/types.d.ts +255 -0
  159. package/dist/stream/types.d.ts.map +1 -0
  160. package/dist/stream/types.js +11 -0
  161. package/dist/stream/types.js.map +1 -0
  162. package/dist/web.cjs +39 -9
  163. package/dist/web.d.cts +16 -6
  164. package/dist/web.d.ts +16 -6
  165. package/dist/web.js +10 -1
  166. package/package.json +9 -8
@@ -0,0 +1,255 @@
1
+ import { StreamMode } from "../pregel/types.js";
2
+ import { ChatModelStream } from "@langchain/core/language_models/stream";
3
+ import { ChatModelStreamEvent } from "@langchain/core/language_models/event";
4
+ import { AgentStatus as AgentStatus$1, Checkpoint, LifecycleCause, LifecycleData as LifecycleData$1, MessagesData as MessagesEventData, ToolsData as ToolsEventData, UpdatesData as UpdatesEventData, UsageInfo } from "@langchain/protocol";
5
+
6
+ //#region src/stream/types.d.ts
7
+ /**
8
+ * Hierarchical path identifying a position in the agent tree.
9
+ *
10
+ * Each element is one segment; longer arrays mean deeper nesting (e.g.
11
+ * subgraph or multi-agent scopes).
12
+ */
13
+ type Namespace = string[];
14
+ /**
15
+ * Channels that can appear on a protocol event. Beyond the raw
16
+ * {@link StreamMode} channels emitted by the Pregel stream, the v2
17
+ * protocol layer synthesizes additional channels (e.g. `lifecycle`,
18
+ * `input`) via built-in {@link StreamTransformer}s and exposes
19
+ * user-defined channels created with {@link StreamChannel}.
20
+ */
21
+ type ProtocolMethod = StreamMode | "lifecycle" | "input" | (string & {});
22
+ /**
23
+ * Single envelope for a streaming protocol emission: sequence, channel
24
+ * (`method`), and payload (`params`).
25
+ */
26
+ interface ProtocolEvent {
27
+ /** Discriminator; always `"event"` for this shape. */
28
+ readonly type: "event";
29
+ /** Monotonic sequence number for ordering and deduplication within a run. */
30
+ readonly seq: number;
31
+ /**
32
+ * Logical stream channel. Built-in channels match {@link StreamMode}
33
+ * (e.g. `messages`, `updates`); transformer-synthesized channels
34
+ * include `lifecycle` and `input`; user-defined channels carry their
35
+ * {@link StreamChannel.channelName}.
36
+ */
37
+ readonly method: ProtocolMethod;
38
+ /** Channel-specific payload and routing metadata. */
39
+ readonly params: {
40
+ /** Namespace of the node or scope that emitted this event. */readonly namespace: Namespace; /** Wall-clock or logical timestamp for the emission (milliseconds). */
41
+ readonly timestamp: number;
42
+ /**
43
+ * Graph node id when the engine can attribute the event to a single node;
44
+ * omitted for run-level or ambiguous emissions.
45
+ */
46
+ readonly node?: string; /** Opaque channel payload; shape depends on `method`. */
47
+ readonly data: unknown;
48
+ };
49
+ }
50
+ /**
51
+ * Infers the merged extensions type from a tuple of transformer factory functions.
52
+ *
53
+ * Given `[() => StreamTransformer<{ a: number }>, () => StreamTransformer<{ b: string }>]`,
54
+ * produces `{ a: number } & { b: string }`.
55
+ */
56
+ type InferExtensions<T extends ReadonlyArray<() => StreamTransformer<any>>> = T extends readonly [] ? Record<string, never> : T extends readonly [() => StreamTransformer<infer P>, ...infer Rest extends ReadonlyArray<() => StreamTransformer<any>>] ? P & InferExtensions<Rest> : Record<string, unknown>;
57
+ /**
58
+ * Observes {@link ProtocolEvent}s during a graph run and builds typed derived
59
+ * projections (secondary event logs, promises, etc.).
60
+ *
61
+ * Data is surfaced to consumers through **projections** returned from
62
+ * `init()`. Projections are merged into `GraphRunStream.extensions` for
63
+ * in-process consumers. Use {@link StreamChannel.local} for local streaming
64
+ * values, {@link StreamChannel.remote} for values that should also be visible
65
+ * to remote clients, or `Promise<T>` for final values.
66
+ *
67
+ * To make projection data available to **remote** clients (SDK consumers
68
+ * over WebSocket / SSE), create a named channel with
69
+ * `StreamChannel.remote(name)`. The {@link StreamMux} detects named
70
+ * `StreamChannel` instances in the `init()` return and auto-forwards every
71
+ * `push()` as a {@link ProtocolEvent} on the channel's named method. Remote
72
+ * clients subscribe via `session.subscribe("custom:<name>")`.
73
+ *
74
+ * `finalize` and `fail` are optional. When a transformer uses
75
+ * `StreamChannel`, the mux auto-closes/fails the channels on run
76
+ * completion — no manual lifecycle management needed. Implement
77
+ * `finalize`/`fail` only for non-channel teardown (e.g. resolving a
78
+ * `Promise`).
79
+ *
80
+ * @typeParam TProjection - Shape returned by {@link init}, merged into
81
+ * `GraphRunStream.extensions`.
82
+ */
83
+ interface StreamTransformer<TProjection = unknown> {
84
+ /**
85
+ * Called once before the run starts.
86
+ *
87
+ * @returns Initial projection merged into `GraphRunStream.extensions`.
88
+ * Any named {@link StreamChannel} instances in the return value are
89
+ * automatically wired to the protocol event stream by the mux. Unnamed
90
+ * channels stay in-process-only.
91
+ */
92
+ init(): TProjection;
93
+ /**
94
+ * Optional hook invoked by {@link StreamMux.addTransformer} immediately
95
+ * after the transformer is attached to the mux. Receives a limited
96
+ * handle that exposes only {@link StreamEmitter.push} — enough for
97
+ * the transformer to emit synthesized {@link ProtocolEvent}s on any
98
+ * namespace it chooses (e.g. a deepagents `SubagentTransformer`
99
+ * fabricating `lifecycle`/`messages`/`values` events under a
100
+ * `["tools:<tool_call_id>"]` namespace when a `task` tool starts).
101
+ *
102
+ * Transformers that do not synthesize events can omit this hook.
103
+ *
104
+ * The {@link StreamEmitter} handle is only safe to call *from within*
105
+ * {@link StreamTransformer.process}. Emitting from an unrelated async
106
+ * context (e.g. after `process` has returned, from a `setTimeout`,
107
+ * etc.) races with the mux's close/fail cycle and may land events in
108
+ * an already-closed log.
109
+ */
110
+ onRegister?(emitter: StreamEmitter): void;
111
+ /**
112
+ * Called for each {@link ProtocolEvent} before it is appended to the main log.
113
+ *
114
+ * @param event - Next protocol envelope for this run.
115
+ * @returns `false` to drop the original event from the main log (use
116
+ * sparingly; prefer keeping events visible and adding derived data
117
+ * alongside).
118
+ */
119
+ process(event: ProtocolEvent): boolean;
120
+ /**
121
+ * Called once when the underlying Pregel run completes without throwing.
122
+ * Optional — only needed for non-channel teardown (e.g. resolving promises).
123
+ *
124
+ * May return a `PromiseLike<void>` to defer the main event log close
125
+ * until the async work (e.g. emitting terminal lifecycle events) has
126
+ * completed. The mux awaits all returned promises before closing its
127
+ * event log.
128
+ */
129
+ finalize?(): void | PromiseLike<void>;
130
+ /**
131
+ * Called once when the run fails; `err` is the rejection or error value.
132
+ * Optional — only needed for non-channel teardown (e.g. rejecting promises).
133
+ *
134
+ * @param err - Failure reason from the engine or user code.
135
+ */
136
+ fail?(err: unknown): void;
137
+ }
138
+ /**
139
+ * Narrow capability handle passed to
140
+ * {@link StreamTransformer.onRegister}. Exposes only the minimal mux
141
+ * surface required for synthetic event emission — intentionally does
142
+ * not expose close/fail/register/etc. to keep the transformer contract
143
+ * small and tamper-resistant.
144
+ */
145
+ interface StreamEmitter {
146
+ /**
147
+ * Injects a new {@link ProtocolEvent} into the mux pipeline. The
148
+ * event is routed through every registered transformer (including
149
+ * the emitting transformer — implementers must guard against
150
+ * re-entrant self-processing) and, if not suppressed, appended to
151
+ * the main event log.
152
+ *
153
+ * @param ns - Target namespace for the synthetic event.
154
+ * @param event - The event envelope to inject. ``event.seq`` is
155
+ * overwritten by the mux; callers can pass any placeholder.
156
+ */
157
+ push(ns: Namespace, event: ProtocolEvent): void;
158
+ }
159
+ type ChatModelStream$1 = Omit<ChatModelStream, typeof Symbol.asyncIterator> & {
160
+ /** Namespace of the graph node that produced this stream. */readonly namespace: Namespace; /** Graph node id for this stream, if the runtime attributed it. */
161
+ readonly node: string | undefined;
162
+ /**
163
+ * Low-level async iteration over message lifecycle events.
164
+ *
165
+ * @returns Iterator yielding Core-compatible chat model stream events.
166
+ */
167
+ [Symbol.asyncIterator](): AsyncIterator<ChatModelStreamEvent>;
168
+ };
169
+ /**
170
+ * Public view yielded by `run.messages`.
171
+ *
172
+ * `ChatModelStream` is PromiseLike to mirror Core, but TypeScript applies
173
+ * `Awaited<T>` to values produced by `for await`. Exposing a non-thenable view
174
+ * keeps loop variables typed as the streaming handle instead of `AIMessage`.
175
+ */
176
+ type ChatModelStreamHandle = Omit<ChatModelStream$1, "then">;
177
+ /**
178
+ * High-level outcome of a single tool call for UI or aggregators.
179
+ */
180
+ type ToolCallStatus = /** Invocation in flight or output still streaming. */"running" /** Completed without error. */ | "finished" /** Failed or aborted; see {@link ToolCallStream.error}. */ | "error";
181
+ /**
182
+ * Stable handle for one tool call: name, arguments, and async results.
183
+ *
184
+ * Emitted when `content-block-finish` delivers a finalized `tool_call` block.
185
+ *
186
+ * @typeParam TName - Registered tool name.
187
+ * @typeParam TInput - Parsed or raw input type for the call.
188
+ * @typeParam TOutput - Successful result type after the tool returns.
189
+ */
190
+ interface ToolCallStream<TName extends string = string, TInput = unknown, TOutput = unknown> {
191
+ /** Tool identifier as registered on the graph or model schema. */
192
+ readonly name: TName;
193
+ /** Correlates with protocol `toolCallId` when the runtime provides one. */
194
+ readonly callId: string;
195
+ /** Arguments passed to the tool (finalized when the call is observable). */
196
+ readonly input: TInput;
197
+ /**
198
+ * Resolves to the tool return value on success.
199
+ *
200
+ * @remarks
201
+ * Rejection or hang semantics depend on the runner; pairing with
202
+ * {@link ToolCallStream.status} and {@link ToolCallStream.error} is recommended.
203
+ */
204
+ readonly output: Promise<TOutput>;
205
+ /**
206
+ * Resolves to {@link ToolCallStatus} when the call leaves the running state.
207
+ */
208
+ readonly status: Promise<ToolCallStatus>;
209
+ /**
210
+ * Resolves to an error message string if {@link ToolCallStream.status} is
211
+ * `"error"`, otherwise `undefined`.
212
+ */
213
+ readonly error: Promise<string | undefined>;
214
+ }
215
+ /**
216
+ * Marker interface for transformers provided by internal LangChain products
217
+ * (e.g. ReactAgent's ToolCallTransformer, DeepAgent's SubagentTransformer).
218
+ *
219
+ * Native transformers differ from user-defined extension transformers in
220
+ * where their projection lands on the run stream:
221
+ *
222
+ * - **Native** — projections become direct getters on a
223
+ * `GraphRunStream` subclass (e.g. `run.toolCalls`, `run.subagents`).
224
+ * They emit events on protocol-defined channels (`tools`, `lifecycle`,
225
+ * `tasks`, etc.).
226
+ *
227
+ * - **Extension** (user-defined) — projections are merged into
228
+ * `run.extensions`. Events emitted via `emit()` use an
229
+ * application-chosen method name (e.g. `emit("a2a", data)`) and are
230
+ * accessible to remote clients via `session.subscribe("custom:<name>")`.
231
+ *
232
+ * The `__native` brand is used by downstream stream factory functions
233
+ * to distinguish native transformers from extension transformers at
234
+ * registration time. See `docs/native-stream-transformers.md` for the
235
+ * full pattern.
236
+ */
237
+ interface NativeStreamTransformer<TProjection = unknown> extends StreamTransformer<TProjection> {
238
+ readonly __native: true;
239
+ }
240
+ /**
241
+ * Type guard that tests whether a transformer is a {@link NativeStreamTransformer}.
242
+ */
243
+ declare function isNativeTransformer(t: StreamTransformer<unknown>): t is NativeStreamTransformer;
244
+ /**
245
+ * Human-in-the-loop interrupt: stable id plus opaque payload for resume UIs.
246
+ */
247
+ interface InterruptPayload<TPayload = unknown> {
248
+ /** Idempotent key for this interrupt instance within the run. */
249
+ interruptId: string;
250
+ /** Arbitrary data supplied by the graph (e.g. questions, draft state). */
251
+ payload: TPayload;
252
+ }
253
+ //#endregion
254
+ export { type AgentStatus$1 as AgentStatus, ChatModelStream$1 as ChatModelStream, ChatModelStreamHandle, type Checkpoint, InferExtensions, InterruptPayload, type LifecycleCause, type LifecycleData$1 as LifecycleData, type MessagesEventData, Namespace, NativeStreamTransformer, ProtocolEvent, StreamEmitter, StreamTransformer, ToolCallStatus, ToolCallStream, type ToolsEventData, type UpdatesEventData, type UsageInfo, isNativeTransformer };
255
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","names":[],"sources":["../../src/stream/types.ts"],"mappings":";;;;;;;;;;;;KAkDY,SAAA;;;;;AAuDZ;;;KA9CY,cAAA,GAAiB,UAAA;;;;;UAMZ,aAAA;EAgDiC;EAAA,SA9CvC,IAAA;EAgDL;EAAA,SA7CK,GAAA;EA6CD;;;;;;EAAA,SArCC,MAAA,EAAQ,cAAA;EA8Bf;EAAA,SA3BO,MAAA;IA6BP,uEA3BS,SAAA,EAAW,SAAA,EA4Bc;IAAA,SAzBzB,SAAA;IA2BiB;;;;IAAA,SArBjB,IAAA,WAwBP;IAAA,SArBO,IAAA;EAAA;AAAA;;;;;;;KAUD,eAAA,WAEA,aAAA,OAAoB,iBAAA,UAC5B,CAAA,uBACA,MAAA,kBACA,CAAA,yBACU,iBAAA,iCAEgB,aAAA,OAAoB,iBAAA,UAE5C,CAAA,GAAI,eAAA,CAAgB,IAAA,IACpB,MAAA;;;;;;;;;;;;;;AA+FN;;;;;;;;;;;AAeA;;UAlFiB,iBAAA;EAmFf;;;;;;;;EA1EA,IAAA,IAAQ,WAAA;EA0ER;;;;;;;;;;;;;AAwBF;;;;EA/EE,UAAA,EAAY,OAAA,EAAS,aAAA;EAoFX;;;;;AAiBZ;;;EA3FE,OAAA,CAAQ,KAAA,EAAO,aAAA;EAuGC;;;;;;;;;EA5FhB,QAAA,YAAoB,WAAA;EAmFpB;;;;;;EA3EA,IAAA,EAAM,GAAA;AAAA;;;;;;;;UAUS,aAAA;EAuHA;;;;;;;;;;AASjB;EApHE,IAAA,CAAK,EAAA,EAAI,SAAA,EAAW,KAAA,EAAO,aAAA;AAAA;AAAA,KAGjB,iBAAA,GAAkB,IAAA,CAC5B,eAAA,SACO,MAAA,CAAO,aAAA;EAgHX,sEA7GM,SAAA,EAAW,SAAA,EA8GnB;EAAA,SA3GQ,IAAA;EA2GoB;;AAO/B;;;EAP+B,CApG5B,MAAA,CAAO,aAAP,KAAyB,aAAA,CAAc,oBAAA;AAAA;;;;;;;;KAU9B,qBAAA,GAAwB,IAAA,CAAK,iBAAA;;;;KAK7B,cAAA;;;;;;;;;;UAiBK,cAAA;;WAMN,IAAA,EAAM,KAAA;;WAGN,MAAA;;WAGA,KAAA,EAAO,MAAA;;;;;;;;WASP,MAAA,EAAQ,OAAA,CAAQ,OAAA;;;;WAKhB,MAAA,EAAQ,OAAA,CAAQ,cAAA;;;;;WAMhB,KAAA,EAAO,OAAA;AAAA;;;;;;;;;;;;;;;;;;;;;;;UAyBD,uBAAA,gCAEP,iBAAA,CAAkB,WAAA;EAAA,SACjB,QAAA;AAAA;;;;iBAMK,mBAAA,CACd,CAAA,EAAG,iBAAA,YACF,CAAA,IAAK,uBAAA;;;;UAOS,gBAAA;;EAEf,WAAA;;EAGA,OAAA,EAAS,QAAA;AAAA"}
@@ -0,0 +1,11 @@
1
+ //#region src/stream/types.ts
2
+ /**
3
+ * Type guard that tests whether a transformer is a {@link NativeStreamTransformer}.
4
+ */
5
+ function isNativeTransformer(t) {
6
+ return "__native" in t && t.__native === true;
7
+ }
8
+ //#endregion
9
+ export { isNativeTransformer };
10
+
11
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../src/stream/types.ts"],"sourcesContent":["/**\n * Core type definitions for the v2 streaming interface.\n *\n * Channel event data types (`MessagesEventData`, `ToolsEventData`,\n * `UpdatesEventData`, `UsageInfo`, `Checkpoint`, `CheckpointSource`) are\n * re-exported from `@langchain/protocol` — the generated TypeScript\n * bindings for the canonical CDDL schema. Stream-specific types\n * (`StreamTransformer`, `ChatModelStream`, `ToolCallStream`,\n * `InterruptPayload`) are defined here.\n */\n\nimport type { ChatModelStream as CoreChatModelStream } from \"@langchain/core/language_models/stream\";\nimport type { ChatModelStreamEvent as CoreChatModelStreamEvent } from \"@langchain/core/language_models/event\";\nimport type { StreamMode } from \"../pregel/types.js\";\n\n/**\n * Re-exports from `@langchain/protocol`.\n *\n * These are the canonical wire-format types generated from `protocol.cddl`.\n * They are re-exported with local aliases so that consumers of this module\n * do not need a direct dependency on `@langchain/protocol`.\n */\nexport type {\n MessagesData as MessagesEventData,\n ToolsData as ToolsEventData,\n UpdatesData as UpdatesEventData,\n UsageInfo,\n MessageStartData,\n ContentBlockStartData,\n ContentBlockDeltaData,\n ContentBlockFinishData,\n MessageFinishData,\n MessageErrorData,\n ToolStartedData,\n ToolOutputDeltaData,\n ToolFinishedData,\n ToolErrorData,\n Checkpoint,\n CheckpointSource,\n AgentStatus,\n LifecycleData,\n LifecycleCause,\n} from \"@langchain/protocol\";\n\n/**\n * Hierarchical path identifying a position in the agent tree.\n *\n * Each element is one segment; longer arrays mean deeper nesting (e.g.\n * subgraph or multi-agent scopes).\n */\nexport type Namespace = string[];\n\n/**\n * Channels that can appear on a protocol event. Beyond the raw\n * {@link StreamMode} channels emitted by the Pregel stream, the v2\n * protocol layer synthesizes additional channels (e.g. `lifecycle`,\n * `input`) via built-in {@link StreamTransformer}s and exposes\n * user-defined channels created with {@link StreamChannel}.\n */\nexport type ProtocolMethod = StreamMode | \"lifecycle\" | \"input\" | (string & {});\n\n/**\n * Single envelope for a streaming protocol emission: sequence, channel\n * (`method`), and payload (`params`).\n */\nexport interface ProtocolEvent {\n /** Discriminator; always `\"event\"` for this shape. */\n readonly type: \"event\";\n\n /** Monotonic sequence number for ordering and deduplication within a run. */\n readonly seq: number;\n\n /**\n * Logical stream channel. Built-in channels match {@link StreamMode}\n * (e.g. `messages`, `updates`); transformer-synthesized channels\n * include `lifecycle` and `input`; user-defined channels carry their\n * {@link StreamChannel.channelName}.\n */\n readonly method: ProtocolMethod;\n\n /** Channel-specific payload and routing metadata. */\n readonly params: {\n /** Namespace of the node or scope that emitted this event. */\n readonly namespace: Namespace;\n\n /** Wall-clock or logical timestamp for the emission (milliseconds). */\n readonly timestamp: number;\n\n /**\n * Graph node id when the engine can attribute the event to a single node;\n * omitted for run-level or ambiguous emissions.\n */\n readonly node?: string;\n\n /** Opaque channel payload; shape depends on `method`. */\n readonly data: unknown;\n };\n}\n\n/**\n * Infers the merged extensions type from a tuple of transformer factory functions.\n *\n * Given `[() => StreamTransformer<{ a: number }>, () => StreamTransformer<{ b: string }>]`,\n * produces `{ a: number } & { b: string }`.\n */\nexport type InferExtensions<\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n T extends ReadonlyArray<() => StreamTransformer<any>>,\n> = T extends readonly []\n ? Record<string, never>\n : T extends readonly [\n () => StreamTransformer<infer P>,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ...infer Rest extends ReadonlyArray<() => StreamTransformer<any>>,\n ]\n ? P & InferExtensions<Rest>\n : Record<string, unknown>;\n\n/**\n * Observes {@link ProtocolEvent}s during a graph run and builds typed derived\n * projections (secondary event logs, promises, etc.).\n *\n * Data is surfaced to consumers through **projections** returned from\n * `init()`. Projections are merged into `GraphRunStream.extensions` for\n * in-process consumers. Use {@link StreamChannel.local} for local streaming\n * values, {@link StreamChannel.remote} for values that should also be visible\n * to remote clients, or `Promise<T>` for final values.\n *\n * To make projection data available to **remote** clients (SDK consumers\n * over WebSocket / SSE), create a named channel with\n * `StreamChannel.remote(name)`. The {@link StreamMux} detects named\n * `StreamChannel` instances in the `init()` return and auto-forwards every\n * `push()` as a {@link ProtocolEvent} on the channel's named method. Remote\n * clients subscribe via `session.subscribe(\"custom:<name>\")`.\n *\n * `finalize` and `fail` are optional. When a transformer uses\n * `StreamChannel`, the mux auto-closes/fails the channels on run\n * completion — no manual lifecycle management needed. Implement\n * `finalize`/`fail` only for non-channel teardown (e.g. resolving a\n * `Promise`).\n *\n * @typeParam TProjection - Shape returned by {@link init}, merged into\n * `GraphRunStream.extensions`.\n */\nexport interface StreamTransformer<TProjection = unknown> {\n /**\n * Called once before the run starts.\n *\n * @returns Initial projection merged into `GraphRunStream.extensions`.\n * Any named {@link StreamChannel} instances in the return value are\n * automatically wired to the protocol event stream by the mux. Unnamed\n * channels stay in-process-only.\n */\n init(): TProjection;\n\n /**\n * Optional hook invoked by {@link StreamMux.addTransformer} immediately\n * after the transformer is attached to the mux. Receives a limited\n * handle that exposes only {@link StreamEmitter.push} — enough for\n * the transformer to emit synthesized {@link ProtocolEvent}s on any\n * namespace it chooses (e.g. a deepagents `SubagentTransformer`\n * fabricating `lifecycle`/`messages`/`values` events under a\n * `[\"tools:<tool_call_id>\"]` namespace when a `task` tool starts).\n *\n * Transformers that do not synthesize events can omit this hook.\n *\n * The {@link StreamEmitter} handle is only safe to call *from within*\n * {@link StreamTransformer.process}. Emitting from an unrelated async\n * context (e.g. after `process` has returned, from a `setTimeout`,\n * etc.) races with the mux's close/fail cycle and may land events in\n * an already-closed log.\n */\n onRegister?(emitter: StreamEmitter): void;\n\n /**\n * Called for each {@link ProtocolEvent} before it is appended to the main log.\n *\n * @param event - Next protocol envelope for this run.\n * @returns `false` to drop the original event from the main log (use\n * sparingly; prefer keeping events visible and adding derived data\n * alongside).\n */\n process(event: ProtocolEvent): boolean;\n\n /**\n * Called once when the underlying Pregel run completes without throwing.\n * Optional — only needed for non-channel teardown (e.g. resolving promises).\n *\n * May return a `PromiseLike<void>` to defer the main event log close\n * until the async work (e.g. emitting terminal lifecycle events) has\n * completed. The mux awaits all returned promises before closing its\n * event log.\n */\n finalize?(): void | PromiseLike<void>;\n\n /**\n * Called once when the run fails; `err` is the rejection or error value.\n * Optional — only needed for non-channel teardown (e.g. rejecting promises).\n *\n * @param err - Failure reason from the engine or user code.\n */\n fail?(err: unknown): void;\n}\n\n/**\n * Narrow capability handle passed to\n * {@link StreamTransformer.onRegister}. Exposes only the minimal mux\n * surface required for synthetic event emission — intentionally does\n * not expose close/fail/register/etc. to keep the transformer contract\n * small and tamper-resistant.\n */\nexport interface StreamEmitter {\n /**\n * Injects a new {@link ProtocolEvent} into the mux pipeline. The\n * event is routed through every registered transformer (including\n * the emitting transformer — implementers must guard against\n * re-entrant self-processing) and, if not suppressed, appended to\n * the main event log.\n *\n * @param ns - Target namespace for the synthetic event.\n * @param event - The event envelope to inject. ``event.seq`` is\n * overwritten by the mux; callers can pass any placeholder.\n */\n push(ns: Namespace, event: ProtocolEvent): void;\n}\n\nexport type ChatModelStream = Omit<\n CoreChatModelStream,\n typeof Symbol.asyncIterator\n> & {\n /** Namespace of the graph node that produced this stream. */\n readonly namespace: Namespace;\n\n /** Graph node id for this stream, if the runtime attributed it. */\n readonly node: string | undefined;\n\n /**\n * Low-level async iteration over message lifecycle events.\n *\n * @returns Iterator yielding Core-compatible chat model stream events.\n */\n [Symbol.asyncIterator](): AsyncIterator<CoreChatModelStreamEvent>;\n};\n\n/**\n * Public view yielded by `run.messages`.\n *\n * `ChatModelStream` is PromiseLike to mirror Core, but TypeScript applies\n * `Awaited<T>` to values produced by `for await`. Exposing a non-thenable view\n * keeps loop variables typed as the streaming handle instead of `AIMessage`.\n */\nexport type ChatModelStreamHandle = Omit<ChatModelStream, \"then\">;\n\n/**\n * High-level outcome of a single tool call for UI or aggregators.\n */\nexport type ToolCallStatus =\n /** Invocation in flight or output still streaming. */\n | \"running\"\n /** Completed without error. */\n | \"finished\"\n /** Failed or aborted; see {@link ToolCallStream.error}. */\n | \"error\";\n\n/**\n * Stable handle for one tool call: name, arguments, and async results.\n *\n * Emitted when `content-block-finish` delivers a finalized `tool_call` block.\n *\n * @typeParam TName - Registered tool name.\n * @typeParam TInput - Parsed or raw input type for the call.\n * @typeParam TOutput - Successful result type after the tool returns.\n */\nexport interface ToolCallStream<\n TName extends string = string,\n TInput = unknown,\n TOutput = unknown,\n> {\n /** Tool identifier as registered on the graph or model schema. */\n readonly name: TName;\n\n /** Correlates with protocol `toolCallId` when the runtime provides one. */\n readonly callId: string;\n\n /** Arguments passed to the tool (finalized when the call is observable). */\n readonly input: TInput;\n\n /**\n * Resolves to the tool return value on success.\n *\n * @remarks\n * Rejection or hang semantics depend on the runner; pairing with\n * {@link ToolCallStream.status} and {@link ToolCallStream.error} is recommended.\n */\n readonly output: Promise<TOutput>;\n\n /**\n * Resolves to {@link ToolCallStatus} when the call leaves the running state.\n */\n readonly status: Promise<ToolCallStatus>;\n\n /**\n * Resolves to an error message string if {@link ToolCallStream.status} is\n * `\"error\"`, otherwise `undefined`.\n */\n readonly error: Promise<string | undefined>;\n}\n\n/**\n * Marker interface for transformers provided by internal LangChain products\n * (e.g. ReactAgent's ToolCallTransformer, DeepAgent's SubagentTransformer).\n *\n * Native transformers differ from user-defined extension transformers in\n * where their projection lands on the run stream:\n *\n * - **Native** — projections become direct getters on a\n * `GraphRunStream` subclass (e.g. `run.toolCalls`, `run.subagents`).\n * They emit events on protocol-defined channels (`tools`, `lifecycle`,\n * `tasks`, etc.).\n *\n * - **Extension** (user-defined) — projections are merged into\n * `run.extensions`. Events emitted via `emit()` use an\n * application-chosen method name (e.g. `emit(\"a2a\", data)`) and are\n * accessible to remote clients via `session.subscribe(\"custom:<name>\")`.\n *\n * The `__native` brand is used by downstream stream factory functions\n * to distinguish native transformers from extension transformers at\n * registration time. See `docs/native-stream-transformers.md` for the\n * full pattern.\n */\nexport interface NativeStreamTransformer<\n TProjection = unknown,\n> extends StreamTransformer<TProjection> {\n readonly __native: true;\n}\n\n/**\n * Type guard that tests whether a transformer is a {@link NativeStreamTransformer}.\n */\nexport function isNativeTransformer(\n t: StreamTransformer<unknown>\n): t is NativeStreamTransformer {\n return \"__native\" in t && (t as NativeStreamTransformer).__native === true;\n}\n\n/**\n * Human-in-the-loop interrupt: stable id plus opaque payload for resume UIs.\n */\nexport interface InterruptPayload<TPayload = unknown> {\n /** Idempotent key for this interrupt instance within the run. */\n interruptId: string;\n\n /** Arbitrary data supplied by the graph (e.g. questions, draft state). */\n payload: TPayload;\n}\n"],"mappings":";;;;AAmVA,SAAgB,oBACd,GAC8B;AAC9B,QAAO,cAAc,KAAM,EAA8B,aAAa"}
package/dist/web.cjs CHANGED
@@ -5,9 +5,18 @@ const require_base = require("./channels/base.cjs");
5
5
  const require_binop = require("./channels/binop.cjs");
6
6
  const require_annotation = require("./graph/annotation.cjs");
7
7
  const require_config = require("./pregel/utils/config.cjs");
8
+ const require_stream_channel = require("./stream/stream-channel.cjs");
9
+ const require_convert = require("./stream/convert.cjs");
10
+ const require_lifecycle = require("./stream/transformers/lifecycle.cjs");
11
+ const require_messages = require("./stream/transformers/messages.cjs");
12
+ const require_subgraphs = require("./stream/transformers/subgraphs.cjs");
13
+ const require_values = require("./stream/transformers/values.cjs");
14
+ const require_types = require("./stream/types.cjs");
15
+ const require_run_stream = require("./stream/run-stream.cjs");
16
+ require("./stream/index.cjs");
8
17
  const require_interrupt = require("./interrupt.cjs");
9
18
  const require_graph = require("./graph/graph.cjs");
10
- const require_types = require("./state/types.cjs");
19
+ const require_types$1 = require("./state/types.cjs");
11
20
  const require_adapter = require("./state/adapter.cjs");
12
21
  const require_untracked_value = require("./channels/untracked_value.cjs");
13
22
  require("./channels/index.cjs");
@@ -15,15 +24,16 @@ const require_reduced = require("./state/values/reduced.cjs");
15
24
  const require_untracked = require("./state/values/untracked.cjs");
16
25
  const require_schema = require("./state/schema.cjs");
17
26
  const require_messages_reducer = require("./graph/messages_reducer.cjs");
18
- const require_messages = require("./state/prebuilt/messages.cjs");
27
+ const require_messages$1 = require("./state/prebuilt/messages.cjs");
19
28
  require("./state/index.cjs");
20
29
  const require_state = require("./graph/state.cjs");
21
30
  const require_message = require("./graph/message.cjs");
22
31
  require("./graph/index.cjs");
23
- const require_index$2 = require("./func/index.cjs");
32
+ const require_index$3 = require("./func/index.cjs");
24
33
  const require_messages_annotation = require("./graph/messages_annotation.cjs");
25
34
  const require_writer = require("./writer.cjs");
26
35
  let _langchain_langgraph_checkpoint = require("@langchain/langgraph-checkpoint");
36
+ let _langchain_core_language_models_stream = require("@langchain/core/language_models/stream");
27
37
  exports.Annotation = require_annotation.Annotation;
28
38
  Object.defineProperty(exports, "AsyncBatchedStore", {
29
39
  enumerable: true,
@@ -47,16 +57,24 @@ Object.defineProperty(exports, "BaseStore", {
47
57
  });
48
58
  exports.BinaryOperatorAggregate = require_binop.BinaryOperatorAggregate;
49
59
  exports.COMMAND_SYMBOL = require_constants.COMMAND_SYMBOL;
60
+ Object.defineProperty(exports, "ChatModelStreamImpl", {
61
+ enumerable: true,
62
+ get: function() {
63
+ return _langchain_core_language_models_stream.ChatModelStream;
64
+ }
65
+ });
50
66
  exports.Command = require_constants.Command;
51
67
  exports.CommandInstance = require_constants.CommandInstance;
52
68
  exports.CompiledStateGraph = require_state.CompiledStateGraph;
53
69
  exports.END = require_constants.END;
54
70
  exports.EmptyChannelError = require_errors.EmptyChannelError;
55
71
  exports.EmptyInputError = require_errors.EmptyInputError;
72
+ exports.EventLog = require_stream_channel.StreamChannel;
56
73
  exports.Graph = require_graph.Graph;
57
74
  exports.GraphBubbleUp = require_errors.GraphBubbleUp;
58
75
  exports.GraphInterrupt = require_errors.GraphInterrupt;
59
76
  exports.GraphRecursionError = require_errors.GraphRecursionError;
77
+ exports.GraphRunStream = require_run_stream.GraphRunStream;
60
78
  exports.GraphValueError = require_errors.GraphValueError;
61
79
  exports.INTERRUPT = require_constants.INTERRUPT;
62
80
  Object.defineProperty(exports, "InMemoryStore", {
@@ -74,7 +92,7 @@ Object.defineProperty(exports, "MemorySaver", {
74
92
  });
75
93
  exports.MessageGraph = require_message.MessageGraph;
76
94
  exports.MessagesAnnotation = require_messages_annotation.MessagesAnnotation;
77
- exports.MessagesValue = require_messages.MessagesValue;
95
+ exports.MessagesValue = require_messages$1.MessagesValue;
78
96
  exports.MessagesZodMeta = require_messages_annotation.MessagesZodMeta;
79
97
  exports.MessagesZodState = require_messages_annotation.MessagesZodState;
80
98
  exports.MultipleSubgraphsError = require_errors.MultipleSubgraphsError;
@@ -85,31 +103,42 @@ exports.REMOVE_ALL_MESSAGES = require_messages_reducer.REMOVE_ALL_MESSAGES;
85
103
  exports.ReducedValue = require_reduced.ReducedValue;
86
104
  exports.RemoteException = require_errors.RemoteException;
87
105
  exports.START = require_constants.START;
106
+ exports.STREAM_EVENTS_V3_MODES = require_convert.STREAM_EVENTS_V3_MODES;
88
107
  exports.Send = require_constants.Send;
89
108
  exports.StateGraph = require_state.StateGraph;
90
109
  exports.StateGraphInputError = require_errors.StateGraphInputError;
91
110
  exports.StateSchema = require_schema.StateSchema;
111
+ exports.StreamChannel = require_stream_channel.StreamChannel;
112
+ exports.SubgraphRunStream = require_run_stream.SubgraphRunStream;
92
113
  exports.UnreachableNodeError = require_errors.UnreachableNodeError;
93
114
  exports.UntrackedValue = require_untracked.UntrackedValue;
94
115
  exports.UntrackedValueChannel = require_untracked_value.UntrackedValueChannel;
95
116
  exports.addMessages = require_messages_reducer.messagesStateReducer;
117
+ exports.convertToProtocolEvent = require_convert.convertToProtocolEvent;
96
118
  Object.defineProperty(exports, "copyCheckpoint", {
97
119
  enumerable: true,
98
120
  get: function() {
99
121
  return _langchain_langgraph_checkpoint.copyCheckpoint;
100
122
  }
101
123
  });
124
+ exports.createGraphRunStream = require_run_stream.createGraphRunStream;
125
+ exports.createLifecycleTransformer = require_lifecycle.createLifecycleTransformer;
126
+ exports.createMessagesTransformer = require_messages.createMessagesTransformer;
127
+ exports.createSubgraphDiscoveryTransformer = require_subgraphs.createSubgraphDiscoveryTransformer;
128
+ exports.createValuesTransformer = require_values.createValuesTransformer;
102
129
  Object.defineProperty(exports, "emptyCheckpoint", {
103
130
  enumerable: true,
104
131
  get: function() {
105
132
  return _langchain_langgraph_checkpoint.emptyCheckpoint;
106
133
  }
107
134
  });
108
- exports.entrypoint = require_index$2.entrypoint;
135
+ exports.entrypoint = require_index$3.entrypoint;
136
+ exports.filterLifecycleEntries = require_lifecycle.filterLifecycleEntries;
137
+ exports.filterSubgraphHandles = require_subgraphs.filterSubgraphHandles;
109
138
  exports.getConfig = require_config.getConfig;
110
139
  exports.getCurrentTaskInput = require_config.getCurrentTaskInput;
111
140
  exports.getJsonSchemaFromSchema = require_adapter.getJsonSchemaFromSchema;
112
- exports.getPreviousState = require_index$2.getPreviousState;
141
+ exports.getPreviousState = require_index$3.getPreviousState;
113
142
  exports.getSchemaDefaultGetter = require_adapter.getSchemaDefaultGetter;
114
143
  exports.getStore = require_config.getStore;
115
144
  exports.getSubgraphsSeenSet = require_errors.getSubgraphsSeenSet;
@@ -119,10 +148,11 @@ exports.isCommand = require_constants.isCommand;
119
148
  exports.isGraphBubbleUp = require_errors.isGraphBubbleUp;
120
149
  exports.isGraphInterrupt = require_errors.isGraphInterrupt;
121
150
  exports.isInterrupted = require_constants.isInterrupted;
151
+ exports.isNativeTransformer = require_types.isNativeTransformer;
122
152
  exports.isParentCommand = require_errors.isParentCommand;
123
- exports.isSerializableSchema = require_types.isSerializableSchema;
124
- exports.isStandardSchema = require_types.isStandardSchema;
153
+ exports.isSerializableSchema = require_types$1.isSerializableSchema;
154
+ exports.isStandardSchema = require_types$1.isStandardSchema;
125
155
  exports.messagesStateReducer = require_messages_reducer.messagesStateReducer;
126
156
  exports.pushMessage = require_message.pushMessage;
127
- exports.task = require_index$2.task;
157
+ exports.task = require_index$3.task;
128
158
  exports.writer = require_writer.writer;
package/dist/web.d.cts CHANGED
@@ -10,19 +10,29 @@ import { Topic } from "./channels/topic.cjs";
10
10
  import { UntrackedValueChannel } from "./channels/untracked_value.cjs";
11
11
  import { ExecutionInfo, LangGraphRunnableConfig, Runtime, ServerInfo } from "./pregel/runnable_types.cjs";
12
12
  import { Annotation, AnnotationRoot, NodeType, SingleReducer, StateDefinition, StateType, UpdateType } from "./graph/annotation.cjs";
13
- import { RetryPolicy } from "./pregel/utils/index.cjs";
13
+ import { CachePolicy, RetryPolicy } from "./pregel/utils/index.cjs";
14
14
  import { PregelNode } from "./pregel/read.cjs";
15
+ import { AgentStatus, ChatModelStream, InferExtensions, InterruptPayload, LifecycleCause, LifecycleData, MessagesEventData, Namespace, NativeStreamTransformer, ProtocolEvent, StreamEmitter, StreamTransformer, ToolCallStatus, ToolCallStream, ToolsEventData, UpdatesEventData, UsageInfo, isNativeTransformer } from "./stream/types.cjs";
15
16
  import { GetStateOptions, MultipleChannelSubscriptionOptions, PregelOptions, PregelParams, SingleChannelSubscriptionOptions, StateSnapshot, StreamMode, StreamOutputMap } from "./pregel/types.cjs";
17
+ import { StreamChannel } from "./stream/stream-channel.cjs";
18
+ import { ConvertToProtocolEventOptions, STREAM_EVENTS_V3_MODES, convertToProtocolEvent } from "./stream/convert.cjs";
19
+ import { LifecycleEntry, LifecycleTransformerOptions } from "./stream/transformers/types.cjs";
20
+ import { LifecycleProjection, createLifecycleTransformer, filterLifecycleEntries } from "./stream/transformers/lifecycle.cjs";
21
+ import { createMessagesTransformer } from "./stream/transformers/messages.cjs";
22
+ import { SubgraphDiscoveryProjection, SubgraphDiscoveryTransformerOptions, createSubgraphDiscoveryTransformer, filterSubgraphHandles } from "./stream/transformers/subgraphs.cjs";
23
+ import { createValuesTransformer } from "./stream/transformers/values.cjs";
24
+ import { CreateGraphRunStreamOptions, GraphRunStream, SubgraphRunStream, createGraphRunStream } from "./stream/run-stream.cjs";
25
+ import { ChatModelStreamImpl } from "./stream/index.cjs";
16
26
  import { Pregel } from "./pregel/index.cjs";
17
- import { CompiledGraph, Graph } from "./graph/graph.cjs";
27
+ import { AddNodeOptions, CompiledGraph, CompiledGraphType, Graph, NodeSpec } from "./graph/graph.cjs";
18
28
  import { InferInterruptInputType, InferInterruptResumeType, interrupt } from "./interrupt.cjs";
19
29
  import { InferWriterType, writer } from "./writer.cjs";
20
30
  import { isSerializableSchema, isStandardSchema } from "./state/types.cjs";
21
31
  import { ReducedValue, ReducedValueInit } from "./state/values/reduced.cjs";
22
32
  import { UntrackedValue, UntrackedValueInit } from "./state/values/untracked.cjs";
23
- import { InferStateSchemaUpdate, InferStateSchemaValue, StateSchema, StateSchemaField, StateSchemaFields } from "./state/schema.cjs";
24
- import { ConditionalEdgeRouter, ConditionalEdgeRouterTypes, ContextSchemaInit, ExtractStateType, ExtractUpdateType, GraphNode, GraphNodeReturnValue, GraphNodeTypes, StateDefinitionInit, StateGraphInit, StateGraphOptions } from "./graph/types.cjs";
25
- import { CompiledStateGraph, StateGraph, StateGraphArgs } from "./graph/state.cjs";
33
+ import { AnyStateSchema, InferStateSchemaUpdate, InferStateSchemaValue, StateSchema, StateSchemaField, StateSchemaFieldToChannel, StateSchemaFields, StateSchemaFieldsToStateDefinition } from "./state/schema.cjs";
34
+ import { ConditionalEdgeRouter, ConditionalEdgeRouterTypes, ContextSchemaInit, ExtractStateType, ExtractUpdateType, GraphNode, GraphNodeReturnValue, GraphNodeTypes, StateDefinitionInit, StateGraphInit, StateGraphOptions, ToStateDefinition } from "./graph/types.cjs";
35
+ import { CompiledStateGraph, StateGraph, StateGraphAddNodeOptions, StateGraphArgs, StateGraphArgsWithInputOutputSchemas, StateGraphArgsWithStateSchema, StateGraphNodeSpec } from "./graph/state.cjs";
26
36
  import { Messages, REMOVE_ALL_MESSAGES, messagesStateReducer } from "./graph/messages_reducer.cjs";
27
37
  import { MessageGraph, pushMessage } from "./graph/message.cjs";
28
38
  import { BaseLangGraphError, BaseLangGraphErrorFields, EmptyChannelError, EmptyInputError, GraphBubbleUp, GraphInterrupt, GraphRecursionError, GraphValueError, InvalidUpdateError, MultipleSubgraphsError, NodeInterrupt, ParentCommand, RemoteException, StateGraphInputError, UnreachableNodeError, getSubgraphsSeenSet, isGraphBubbleUp, isGraphInterrupt, isParentCommand } from "./errors.cjs";
@@ -32,4 +42,4 @@ import { getJsonSchemaFromSchema, getSchemaDefaultGetter } from "./state/adapter
32
42
  import { MessagesValue } from "./state/prebuilt/messages.cjs";
33
43
  import { getConfig, getCurrentTaskInput, getStore, getWriter } from "./pregel/utils/config.cjs";
34
44
  import { AsyncBatchedStore, BaseCheckpointSaver, BaseStore, Checkpoint, CheckpointMetadata, CheckpointTuple, GetOperation, InMemoryStore, Item, ListNamespacesOperation, MatchCondition, MemorySaver, NameSpacePath, NamespaceMatchType, Operation, OperationResults, PutOperation, SearchOperation, copyCheckpoint, emptyCheckpoint } from "@langchain/langgraph-checkpoint";
35
- export { Annotation, type AnnotationRoot, type AnyValue, AsyncBatchedStore, BaseChannel, BaseCheckpointSaver, BaseLangGraphError, BaseLangGraphErrorFields, BaseStore, type BinaryOperator, BinaryOperatorAggregate, COMMAND_SYMBOL, type Checkpoint, type CheckpointMetadata, type CheckpointTuple, Command, CommandInstance, type CommandParams, type CompiledGraph, CompiledStateGraph, type ConditionalEdgeRouter, type ConditionalEdgeRouterTypes, type ContextSchemaInit, type DynamicBarrierValue, END, EmptyChannelError, EmptyInputError, type EntrypointOptions, type EphemeralValue, type ExecutionInfo, type ExtractStateType, type ExtractUpdateType, type GetOperation, type GetStateOptions, Graph, GraphBubbleUp, GraphInterrupt, type GraphNode, type GraphNodeReturnValue, type GraphNodeTypes, GraphRecursionError, GraphValueError, INTERRUPT, InMemoryStore, type InferInterruptInputType, type InferInterruptResumeType, InferStateSchemaUpdate, InferStateSchemaValue, type InferWriterType, type Interrupt, InvalidUpdateError, type Item, type LangGraphRunnableConfig, type LastValue, type ListNamespacesOperation, type MatchCondition, MemorySaver, MessageGraph, type Messages, MessagesAnnotation, MessagesValue, MessagesZodMeta, MessagesZodState, type MultipleChannelSubscriptionOptions, MultipleSubgraphsError, type NameSpacePath, type NamedBarrierValue, type NamespaceMatchType, NodeInterrupt, type NodeType, type Operation, type OperationResults, Overwrite, type OverwriteValue, ParentCommand, type Pregel, type PregelNode, type PregelOptions, type PregelParams, type PutOperation, REMOVE_ALL_MESSAGES, ReducedValue, ReducedValueInit, RemoteException, type RetryPolicy, type Runtime, START, type SearchOperation, Send, type ServerInfo, type SingleChannelSubscriptionOptions, type SingleReducer, type StateDefinition, type StateDefinitionInit, StateGraph, type StateGraphArgs, type StateGraphInit, StateGraphInputError, type StateGraphOptions, StateSchema, StateSchemaField, StateSchemaFields, type StateSnapshot, type StateType, type StreamMode, type StreamOutputMap, type TaskOptions, type Topic, UnreachableNodeError, UntrackedValue, UntrackedValueChannel, UntrackedValueInit, type UpdateType, type WaitForNames, messagesStateReducer as addMessages, copyCheckpoint, emptyCheckpoint, entrypoint, getConfig, getCurrentTaskInput, getJsonSchemaFromSchema, getPreviousState, getSchemaDefaultGetter, getStore, getSubgraphsSeenSet, getWriter, interrupt, isCommand, isGraphBubbleUp, isGraphInterrupt, isInterrupted, isParentCommand, isSerializableSchema, isStandardSchema, messagesStateReducer, pushMessage, task, writer };
45
+ export { type AddNodeOptions, type AgentStatus, Annotation, type AnnotationRoot, AnyStateSchema, type AnyValue, AsyncBatchedStore, BaseChannel, BaseCheckpointSaver, BaseLangGraphError, BaseLangGraphErrorFields, BaseStore, type BinaryOperator, BinaryOperatorAggregate, COMMAND_SYMBOL, type CachePolicy, type ChatModelStream, ChatModelStreamImpl, type Checkpoint, type CheckpointMetadata, type CheckpointTuple, Command, CommandInstance, type CommandParams, type CompiledGraph, type CompiledGraphType, CompiledStateGraph, type ConditionalEdgeRouter, type ConditionalEdgeRouterTypes, type ContextSchemaInit, type ConvertToProtocolEventOptions, type CreateGraphRunStreamOptions, type DynamicBarrierValue, END, EmptyChannelError, EmptyInputError, type EntrypointOptions, type EphemeralValue, StreamChannel as EventLog, type ExecutionInfo, type ExtractStateType, type ExtractUpdateType, type GetOperation, type GetStateOptions, Graph, GraphBubbleUp, GraphInterrupt, type GraphNode, type GraphNodeReturnValue, type GraphNodeTypes, GraphRecursionError, GraphRunStream, GraphValueError, INTERRUPT, InMemoryStore, type InferExtensions, type InferInterruptInputType, type InferInterruptResumeType, InferStateSchemaUpdate, InferStateSchemaValue, type InferWriterType, type Interrupt, type InterruptPayload, InvalidUpdateError, type Item, type LangGraphRunnableConfig, type LastValue, type LifecycleCause, type LifecycleData, type LifecycleEntry, type LifecycleProjection, type LifecycleTransformerOptions, type ListNamespacesOperation, type MatchCondition, MemorySaver, MessageGraph, type Messages, MessagesAnnotation, type MessagesEventData, MessagesValue, MessagesZodMeta, MessagesZodState, type MultipleChannelSubscriptionOptions, MultipleSubgraphsError, type NameSpacePath, type NamedBarrierValue, type Namespace, type NamespaceMatchType, type NativeStreamTransformer, NodeInterrupt, type NodeSpec, type NodeType, type Operation, type OperationResults, Overwrite, type OverwriteValue, ParentCommand, type Pregel, type PregelNode, type PregelOptions, type PregelParams, type ProtocolEvent, type PutOperation, REMOVE_ALL_MESSAGES, ReducedValue, ReducedValueInit, RemoteException, type RetryPolicy, type Runtime, START, STREAM_EVENTS_V3_MODES, type SearchOperation, Send, type ServerInfo, type SingleChannelSubscriptionOptions, type SingleReducer, type StateDefinition, type StateDefinitionInit, StateGraph, type StateGraphAddNodeOptions, type StateGraphArgs, type StateGraphArgsWithInputOutputSchemas, type StateGraphArgsWithStateSchema, type StateGraphInit, StateGraphInputError, type StateGraphNodeSpec, type StateGraphOptions, StateSchema, StateSchemaField, StateSchemaFieldToChannel, StateSchemaFields, StateSchemaFieldsToStateDefinition, type StateSnapshot, type StateType, StreamChannel, type StreamEmitter, type StreamMode, type StreamOutputMap, type StreamTransformer, type SubgraphDiscoveryProjection, type SubgraphDiscoveryTransformerOptions, SubgraphRunStream, type TaskOptions, type ToStateDefinition, type ToolCallStatus, type ToolCallStream, type ToolsEventData, type Topic, UnreachableNodeError, UntrackedValue, UntrackedValueChannel, UntrackedValueInit, type UpdateType, type UpdatesEventData, type UsageInfo, type WaitForNames, messagesStateReducer as addMessages, convertToProtocolEvent, copyCheckpoint, createGraphRunStream, createLifecycleTransformer, createMessagesTransformer, createSubgraphDiscoveryTransformer, createValuesTransformer, emptyCheckpoint, entrypoint, filterLifecycleEntries, filterSubgraphHandles, getConfig, getCurrentTaskInput, getJsonSchemaFromSchema, getPreviousState, getSchemaDefaultGetter, getStore, getSubgraphsSeenSet, getWriter, interrupt, isCommand, isGraphBubbleUp, isGraphInterrupt, isInterrupted, isNativeTransformer, isParentCommand, isSerializableSchema, isStandardSchema, messagesStateReducer, pushMessage, task, writer };
package/dist/web.d.ts CHANGED
@@ -10,19 +10,29 @@ import { Topic } from "./channels/topic.js";
10
10
  import { UntrackedValueChannel } from "./channels/untracked_value.js";
11
11
  import { ExecutionInfo, LangGraphRunnableConfig, Runtime, ServerInfo } from "./pregel/runnable_types.js";
12
12
  import { Annotation, AnnotationRoot, NodeType, SingleReducer, StateDefinition, StateType, UpdateType } from "./graph/annotation.js";
13
- import { RetryPolicy } from "./pregel/utils/index.js";
13
+ import { CachePolicy, RetryPolicy } from "./pregel/utils/index.js";
14
14
  import { PregelNode } from "./pregel/read.js";
15
+ import { AgentStatus, ChatModelStream, InferExtensions, InterruptPayload, LifecycleCause, LifecycleData, MessagesEventData, Namespace, NativeStreamTransformer, ProtocolEvent, StreamEmitter, StreamTransformer, ToolCallStatus, ToolCallStream, ToolsEventData, UpdatesEventData, UsageInfo, isNativeTransformer } from "./stream/types.js";
15
16
  import { GetStateOptions, MultipleChannelSubscriptionOptions, PregelOptions, PregelParams, SingleChannelSubscriptionOptions, StateSnapshot, StreamMode, StreamOutputMap } from "./pregel/types.js";
17
+ import { StreamChannel } from "./stream/stream-channel.js";
18
+ import { ConvertToProtocolEventOptions, STREAM_EVENTS_V3_MODES, convertToProtocolEvent } from "./stream/convert.js";
19
+ import { LifecycleEntry, LifecycleTransformerOptions } from "./stream/transformers/types.js";
20
+ import { LifecycleProjection, createLifecycleTransformer, filterLifecycleEntries } from "./stream/transformers/lifecycle.js";
21
+ import { createMessagesTransformer } from "./stream/transformers/messages.js";
22
+ import { SubgraphDiscoveryProjection, SubgraphDiscoveryTransformerOptions, createSubgraphDiscoveryTransformer, filterSubgraphHandles } from "./stream/transformers/subgraphs.js";
23
+ import { createValuesTransformer } from "./stream/transformers/values.js";
24
+ import { CreateGraphRunStreamOptions, GraphRunStream, SubgraphRunStream, createGraphRunStream } from "./stream/run-stream.js";
25
+ import { ChatModelStreamImpl } from "./stream/index.js";
16
26
  import { Pregel } from "./pregel/index.js";
17
- import { CompiledGraph, Graph } from "./graph/graph.js";
27
+ import { AddNodeOptions, CompiledGraph, CompiledGraphType, Graph, NodeSpec } from "./graph/graph.js";
18
28
  import { InferInterruptInputType, InferInterruptResumeType, interrupt } from "./interrupt.js";
19
29
  import { InferWriterType, writer } from "./writer.js";
20
30
  import { isSerializableSchema, isStandardSchema } from "./state/types.js";
21
31
  import { ReducedValue, ReducedValueInit } from "./state/values/reduced.js";
22
32
  import { UntrackedValue, UntrackedValueInit } from "./state/values/untracked.js";
23
- import { InferStateSchemaUpdate, InferStateSchemaValue, StateSchema, StateSchemaField, StateSchemaFields } from "./state/schema.js";
24
- import { ConditionalEdgeRouter, ConditionalEdgeRouterTypes, ContextSchemaInit, ExtractStateType, ExtractUpdateType, GraphNode, GraphNodeReturnValue, GraphNodeTypes, StateDefinitionInit, StateGraphInit, StateGraphOptions } from "./graph/types.js";
25
- import { CompiledStateGraph, StateGraph, StateGraphArgs } from "./graph/state.js";
33
+ import { AnyStateSchema, InferStateSchemaUpdate, InferStateSchemaValue, StateSchema, StateSchemaField, StateSchemaFieldToChannel, StateSchemaFields, StateSchemaFieldsToStateDefinition } from "./state/schema.js";
34
+ import { ConditionalEdgeRouter, ConditionalEdgeRouterTypes, ContextSchemaInit, ExtractStateType, ExtractUpdateType, GraphNode, GraphNodeReturnValue, GraphNodeTypes, StateDefinitionInit, StateGraphInit, StateGraphOptions, ToStateDefinition } from "./graph/types.js";
35
+ import { CompiledStateGraph, StateGraph, StateGraphAddNodeOptions, StateGraphArgs, StateGraphArgsWithInputOutputSchemas, StateGraphArgsWithStateSchema, StateGraphNodeSpec } from "./graph/state.js";
26
36
  import { Messages, REMOVE_ALL_MESSAGES, messagesStateReducer } from "./graph/messages_reducer.js";
27
37
  import { MessageGraph, pushMessage } from "./graph/message.js";
28
38
  import { BaseLangGraphError, BaseLangGraphErrorFields, EmptyChannelError, EmptyInputError, GraphBubbleUp, GraphInterrupt, GraphRecursionError, GraphValueError, InvalidUpdateError, MultipleSubgraphsError, NodeInterrupt, ParentCommand, RemoteException, StateGraphInputError, UnreachableNodeError, getSubgraphsSeenSet, isGraphBubbleUp, isGraphInterrupt, isParentCommand } from "./errors.js";
@@ -32,4 +42,4 @@ import { getJsonSchemaFromSchema, getSchemaDefaultGetter } from "./state/adapter
32
42
  import { MessagesValue } from "./state/prebuilt/messages.js";
33
43
  import { getConfig, getCurrentTaskInput, getStore, getWriter } from "./pregel/utils/config.js";
34
44
  import { AsyncBatchedStore, BaseCheckpointSaver, BaseStore, Checkpoint, CheckpointMetadata, CheckpointTuple, GetOperation, InMemoryStore, Item, ListNamespacesOperation, MatchCondition, MemorySaver, NameSpacePath, NamespaceMatchType, Operation, OperationResults, PutOperation, SearchOperation, copyCheckpoint, emptyCheckpoint } from "@langchain/langgraph-checkpoint";
35
- export { Annotation, type AnnotationRoot, type AnyValue, AsyncBatchedStore, BaseChannel, BaseCheckpointSaver, BaseLangGraphError, BaseLangGraphErrorFields, BaseStore, type BinaryOperator, BinaryOperatorAggregate, COMMAND_SYMBOL, type Checkpoint, type CheckpointMetadata, type CheckpointTuple, Command, CommandInstance, type CommandParams, type CompiledGraph, CompiledStateGraph, type ConditionalEdgeRouter, type ConditionalEdgeRouterTypes, type ContextSchemaInit, type DynamicBarrierValue, END, EmptyChannelError, EmptyInputError, type EntrypointOptions, type EphemeralValue, type ExecutionInfo, type ExtractStateType, type ExtractUpdateType, type GetOperation, type GetStateOptions, Graph, GraphBubbleUp, GraphInterrupt, type GraphNode, type GraphNodeReturnValue, type GraphNodeTypes, GraphRecursionError, GraphValueError, INTERRUPT, InMemoryStore, type InferInterruptInputType, type InferInterruptResumeType, InferStateSchemaUpdate, InferStateSchemaValue, type InferWriterType, type Interrupt, InvalidUpdateError, type Item, type LangGraphRunnableConfig, type LastValue, type ListNamespacesOperation, type MatchCondition, MemorySaver, MessageGraph, type Messages, MessagesAnnotation, MessagesValue, MessagesZodMeta, MessagesZodState, type MultipleChannelSubscriptionOptions, MultipleSubgraphsError, type NameSpacePath, type NamedBarrierValue, type NamespaceMatchType, NodeInterrupt, type NodeType, type Operation, type OperationResults, Overwrite, type OverwriteValue, ParentCommand, type Pregel, type PregelNode, type PregelOptions, type PregelParams, type PutOperation, REMOVE_ALL_MESSAGES, ReducedValue, ReducedValueInit, RemoteException, type RetryPolicy, type Runtime, START, type SearchOperation, Send, type ServerInfo, type SingleChannelSubscriptionOptions, type SingleReducer, type StateDefinition, type StateDefinitionInit, StateGraph, type StateGraphArgs, type StateGraphInit, StateGraphInputError, type StateGraphOptions, StateSchema, StateSchemaField, StateSchemaFields, type StateSnapshot, type StateType, type StreamMode, type StreamOutputMap, type TaskOptions, type Topic, UnreachableNodeError, UntrackedValue, UntrackedValueChannel, UntrackedValueInit, type UpdateType, type WaitForNames, messagesStateReducer as addMessages, copyCheckpoint, emptyCheckpoint, entrypoint, getConfig, getCurrentTaskInput, getJsonSchemaFromSchema, getPreviousState, getSchemaDefaultGetter, getStore, getSubgraphsSeenSet, getWriter, interrupt, isCommand, isGraphBubbleUp, isGraphInterrupt, isInterrupted, isParentCommand, isSerializableSchema, isStandardSchema, messagesStateReducer, pushMessage, task, writer };
45
+ export { type AddNodeOptions, type AgentStatus, Annotation, type AnnotationRoot, AnyStateSchema, type AnyValue, AsyncBatchedStore, BaseChannel, BaseCheckpointSaver, BaseLangGraphError, BaseLangGraphErrorFields, BaseStore, type BinaryOperator, BinaryOperatorAggregate, COMMAND_SYMBOL, type CachePolicy, type ChatModelStream, ChatModelStreamImpl, type Checkpoint, type CheckpointMetadata, type CheckpointTuple, Command, CommandInstance, type CommandParams, type CompiledGraph, type CompiledGraphType, CompiledStateGraph, type ConditionalEdgeRouter, type ConditionalEdgeRouterTypes, type ContextSchemaInit, type ConvertToProtocolEventOptions, type CreateGraphRunStreamOptions, type DynamicBarrierValue, END, EmptyChannelError, EmptyInputError, type EntrypointOptions, type EphemeralValue, StreamChannel as EventLog, type ExecutionInfo, type ExtractStateType, type ExtractUpdateType, type GetOperation, type GetStateOptions, Graph, GraphBubbleUp, GraphInterrupt, type GraphNode, type GraphNodeReturnValue, type GraphNodeTypes, GraphRecursionError, GraphRunStream, GraphValueError, INTERRUPT, InMemoryStore, type InferExtensions, type InferInterruptInputType, type InferInterruptResumeType, InferStateSchemaUpdate, InferStateSchemaValue, type InferWriterType, type Interrupt, type InterruptPayload, InvalidUpdateError, type Item, type LangGraphRunnableConfig, type LastValue, type LifecycleCause, type LifecycleData, type LifecycleEntry, type LifecycleProjection, type LifecycleTransformerOptions, type ListNamespacesOperation, type MatchCondition, MemorySaver, MessageGraph, type Messages, MessagesAnnotation, type MessagesEventData, MessagesValue, MessagesZodMeta, MessagesZodState, type MultipleChannelSubscriptionOptions, MultipleSubgraphsError, type NameSpacePath, type NamedBarrierValue, type Namespace, type NamespaceMatchType, type NativeStreamTransformer, NodeInterrupt, type NodeSpec, type NodeType, type Operation, type OperationResults, Overwrite, type OverwriteValue, ParentCommand, type Pregel, type PregelNode, type PregelOptions, type PregelParams, type ProtocolEvent, type PutOperation, REMOVE_ALL_MESSAGES, ReducedValue, ReducedValueInit, RemoteException, type RetryPolicy, type Runtime, START, STREAM_EVENTS_V3_MODES, type SearchOperation, Send, type ServerInfo, type SingleChannelSubscriptionOptions, type SingleReducer, type StateDefinition, type StateDefinitionInit, StateGraph, type StateGraphAddNodeOptions, type StateGraphArgs, type StateGraphArgsWithInputOutputSchemas, type StateGraphArgsWithStateSchema, type StateGraphInit, StateGraphInputError, type StateGraphNodeSpec, type StateGraphOptions, StateSchema, StateSchemaField, StateSchemaFieldToChannel, StateSchemaFields, StateSchemaFieldsToStateDefinition, type StateSnapshot, type StateType, StreamChannel, type StreamEmitter, type StreamMode, type StreamOutputMap, type StreamTransformer, type SubgraphDiscoveryProjection, type SubgraphDiscoveryTransformerOptions, SubgraphRunStream, type TaskOptions, type ToStateDefinition, type ToolCallStatus, type ToolCallStream, type ToolsEventData, type Topic, UnreachableNodeError, UntrackedValue, UntrackedValueChannel, UntrackedValueInit, type UpdateType, type UpdatesEventData, type UsageInfo, type WaitForNames, messagesStateReducer as addMessages, convertToProtocolEvent, copyCheckpoint, createGraphRunStream, createLifecycleTransformer, createMessagesTransformer, createSubgraphDiscoveryTransformer, createValuesTransformer, emptyCheckpoint, entrypoint, filterLifecycleEntries, filterSubgraphHandles, getConfig, getCurrentTaskInput, getJsonSchemaFromSchema, getPreviousState, getSchemaDefaultGetter, getStore, getSubgraphsSeenSet, getWriter, interrupt, isCommand, isGraphBubbleUp, isGraphInterrupt, isInterrupted, isNativeTransformer, isParentCommand, isSerializableSchema, isStandardSchema, messagesStateReducer, pushMessage, task, writer };
package/dist/web.js CHANGED
@@ -4,6 +4,15 @@ import { BaseChannel } from "./channels/base.js";
4
4
  import { BinaryOperatorAggregate } from "./channels/binop.js";
5
5
  import { Annotation } from "./graph/annotation.js";
6
6
  import { getConfig, getCurrentTaskInput, getStore, getWriter } from "./pregel/utils/config.js";
7
+ import { StreamChannel } from "./stream/stream-channel.js";
8
+ import { STREAM_EVENTS_V3_MODES, convertToProtocolEvent } from "./stream/convert.js";
9
+ import { createLifecycleTransformer, filterLifecycleEntries } from "./stream/transformers/lifecycle.js";
10
+ import { createMessagesTransformer } from "./stream/transformers/messages.js";
11
+ import { createSubgraphDiscoveryTransformer, filterSubgraphHandles } from "./stream/transformers/subgraphs.js";
12
+ import { createValuesTransformer } from "./stream/transformers/values.js";
13
+ import { isNativeTransformer } from "./stream/types.js";
14
+ import { GraphRunStream, SubgraphRunStream, createGraphRunStream } from "./stream/run-stream.js";
15
+ import { ChatModelStreamImpl } from "./stream/index.js";
7
16
  import { interrupt } from "./interrupt.js";
8
17
  import { Graph } from "./graph/graph.js";
9
18
  import { isSerializableSchema, isStandardSchema } from "./state/types.js";
@@ -23,4 +32,4 @@ import { entrypoint, getPreviousState, task } from "./func/index.js";
23
32
  import { MessagesAnnotation, MessagesZodMeta, MessagesZodState } from "./graph/messages_annotation.js";
24
33
  import { writer } from "./writer.js";
25
34
  import { AsyncBatchedStore, BaseCheckpointSaver, BaseStore, InMemoryStore, MemorySaver, copyCheckpoint, emptyCheckpoint } from "@langchain/langgraph-checkpoint";
26
- export { Annotation, AsyncBatchedStore, BaseChannel, BaseCheckpointSaver, BaseLangGraphError, BaseStore, BinaryOperatorAggregate, COMMAND_SYMBOL, Command, CommandInstance, CompiledStateGraph, END, EmptyChannelError, EmptyInputError, Graph, GraphBubbleUp, GraphInterrupt, GraphRecursionError, GraphValueError, INTERRUPT, InMemoryStore, InvalidUpdateError, MemorySaver, MessageGraph, MessagesAnnotation, MessagesValue, MessagesZodMeta, MessagesZodState, MultipleSubgraphsError, NodeInterrupt, Overwrite, ParentCommand, REMOVE_ALL_MESSAGES, ReducedValue, RemoteException, START, Send, StateGraph, StateGraphInputError, StateSchema, UnreachableNodeError, UntrackedValue, UntrackedValueChannel, messagesStateReducer as addMessages, copyCheckpoint, emptyCheckpoint, entrypoint, getConfig, getCurrentTaskInput, getJsonSchemaFromSchema, getPreviousState, getSchemaDefaultGetter, getStore, getSubgraphsSeenSet, getWriter, interrupt, isCommand, isGraphBubbleUp, isGraphInterrupt, isInterrupted, isParentCommand, isSerializableSchema, isStandardSchema, messagesStateReducer, pushMessage, task, writer };
35
+ export { Annotation, AsyncBatchedStore, BaseChannel, BaseCheckpointSaver, BaseLangGraphError, BaseStore, BinaryOperatorAggregate, COMMAND_SYMBOL, ChatModelStreamImpl, Command, CommandInstance, CompiledStateGraph, END, EmptyChannelError, EmptyInputError, StreamChannel as EventLog, Graph, GraphBubbleUp, GraphInterrupt, GraphRecursionError, GraphRunStream, GraphValueError, INTERRUPT, InMemoryStore, InvalidUpdateError, MemorySaver, MessageGraph, MessagesAnnotation, MessagesValue, MessagesZodMeta, MessagesZodState, MultipleSubgraphsError, NodeInterrupt, Overwrite, ParentCommand, REMOVE_ALL_MESSAGES, ReducedValue, RemoteException, 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, isCommand, isGraphBubbleUp, isGraphInterrupt, isInterrupted, isNativeTransformer, isParentCommand, isSerializableSchema, isStandardSchema, messagesStateReducer, pushMessage, task, writer };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@langchain/langgraph",
3
- "version": "1.2.8",
3
+ "version": "1.3.0",
4
4
  "description": "LangGraph",
5
5
  "type": "module",
6
6
  "engines": {
@@ -16,13 +16,14 @@
16
16
  "author": "LangChain",
17
17
  "license": "MIT",
18
18
  "dependencies": {
19
+ "@langchain/protocol": "^0.0.15",
19
20
  "@standard-schema/spec": "1.1.0",
20
21
  "uuid": "^10.0.0",
21
- "@langchain/langgraph-checkpoint": "^1.0.1",
22
- "@langchain/langgraph-sdk": "~1.8.8"
22
+ "@langchain/langgraph-checkpoint": "^1.0.2",
23
+ "@langchain/langgraph-sdk": "~1.9.0"
23
24
  },
24
25
  "peerDependencies": {
25
- "@langchain/core": "^1.1.16",
26
+ "@langchain/core": "^1.1.44",
26
27
  "zod": "^3.25.32 || ^4.2.0",
27
28
  "zod-to-json-schema": "^3.x"
28
29
  },
@@ -32,9 +33,9 @@
32
33
  }
33
34
  },
34
35
  "devDependencies": {
35
- "@langchain/anthropic": "^1.3.26",
36
- "@langchain/core": "^1.1.38",
37
- "@langchain/openai": "^1.4.1",
36
+ "@langchain/anthropic": "^1.3.28",
37
+ "@langchain/core": "^1.1.44",
38
+ "@langchain/openai": "^1.4.5",
38
39
  "@langchain/scripts": ">=0.1.3 <0.2.0",
39
40
  "@langchain/tavily": "^1.0.0",
40
41
  "@swc/core": "^1.3.90",
@@ -47,7 +48,7 @@
47
48
  "cheerio": "1.0.0-rc.12",
48
49
  "dotenv": "^16.3.1",
49
50
  "dpdm": "^3.12.0",
50
- "langchain": "^1.3.0",
51
+ "langchain": "^1.3.5",
51
52
  "pg": "^8.13.0",
52
53
  "playwright": "^1.55.1",
53
54
  "rollup": "^4.37.0",