@langchain/langgraph-sdk 1.9.19 → 1.9.21
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/client/index.cjs +2 -1
- package/dist/client/index.cjs.map +1 -1
- package/dist/client/index.d.cts +1 -0
- package/dist/client/index.d.cts.map +1 -1
- package/dist/client/index.d.ts +1 -0
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +2 -1
- package/dist/client/index.js.map +1 -1
- package/dist/client/stream/error.cjs +21 -0
- package/dist/client/stream/error.cjs.map +1 -1
- package/dist/client/stream/error.js +21 -1
- package/dist/client/stream/error.js.map +1 -1
- package/dist/client/stream/index.cjs +24 -1
- package/dist/client/stream/index.cjs.map +1 -1
- package/dist/client/stream/index.d.cts.map +1 -1
- package/dist/client/stream/index.d.ts.map +1 -1
- package/dist/client/stream/index.js +24 -1
- package/dist/client/stream/index.js.map +1 -1
- package/dist/client/stream/resolve-client-api-url.cjs +20 -0
- package/dist/client/stream/resolve-client-api-url.cjs.map +1 -0
- package/dist/client/stream/resolve-client-api-url.d.cts +17 -0
- package/dist/client/stream/resolve-client-api-url.d.cts.map +1 -0
- package/dist/client/stream/resolve-client-api-url.d.ts +17 -0
- package/dist/client/stream/resolve-client-api-url.d.ts.map +1 -0
- package/dist/client/stream/resolve-client-api-url.js +20 -0
- package/dist/client/stream/resolve-client-api-url.js.map +1 -0
- package/dist/client/stream/transport/agent-server.cjs +13 -1
- package/dist/client/stream/transport/agent-server.cjs.map +1 -1
- package/dist/client/stream/transport/agent-server.d.cts +13 -0
- package/dist/client/stream/transport/agent-server.d.cts.map +1 -1
- package/dist/client/stream/transport/agent-server.d.ts +13 -0
- package/dist/client/stream/transport/agent-server.d.ts.map +1 -1
- package/dist/client/stream/transport/agent-server.js +13 -1
- package/dist/client/stream/transport/agent-server.js.map +1 -1
- package/dist/client/stream/transport/http.cjs +74 -10
- package/dist/client/stream/transport/http.cjs.map +1 -1
- package/dist/client/stream/transport/http.d.cts +25 -1
- package/dist/client/stream/transport/http.d.cts.map +1 -1
- package/dist/client/stream/transport/http.d.ts +25 -1
- package/dist/client/stream/transport/http.d.ts.map +1 -1
- package/dist/client/stream/transport/http.js +74 -10
- package/dist/client/stream/transport/http.js.map +1 -1
- package/dist/client/stream/transport/index.cjs +2 -1
- package/dist/client/stream/transport/index.js +2 -1
- package/dist/client/stream/transport/types.d.cts +46 -0
- package/dist/client/stream/transport/types.d.cts.map +1 -1
- package/dist/client/stream/transport/types.d.ts +46 -0
- package/dist/client/stream/transport/types.d.ts.map +1 -1
- package/dist/client/stream/transport/websocket.cjs +105 -16
- package/dist/client/stream/transport/websocket.cjs.map +1 -1
- package/dist/client/stream/transport/websocket.d.cts +19 -0
- package/dist/client/stream/transport/websocket.d.cts.map +1 -1
- package/dist/client/stream/transport/websocket.d.ts +19 -0
- package/dist/client/stream/transport/websocket.d.ts.map +1 -1
- package/dist/client/stream/transport/websocket.js +105 -17
- package/dist/client/stream/transport/websocket.js.map +1 -1
- package/dist/client/stream/transport.d.cts +10 -4
- package/dist/client/stream/transport.d.cts.map +1 -1
- package/dist/client/stream/transport.d.ts +10 -4
- package/dist/client/stream/transport.d.ts.map +1 -1
- package/dist/client/stream/types.d.cts +17 -0
- package/dist/client/stream/types.d.cts.map +1 -1
- package/dist/client/stream/types.d.ts +17 -0
- package/dist/client/stream/types.d.ts.map +1 -1
- package/dist/client/threads/index.cjs +30 -14
- package/dist/client/threads/index.cjs.map +1 -1
- package/dist/client/threads/index.js +30 -14
- package/dist/client/threads/index.js.map +1 -1
- package/dist/client.cjs +3 -1
- package/dist/client.d.cts +2 -1
- package/dist/client.d.ts +2 -1
- package/dist/client.js +3 -2
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/stream/controller.cjs +31 -2
- package/dist/stream/controller.cjs.map +1 -1
- package/dist/stream/controller.d.cts.map +1 -1
- package/dist/stream/controller.d.ts.map +1 -1
- package/dist/stream/controller.js +31 -2
- package/dist/stream/controller.js.map +1 -1
- package/dist/stream/index.cjs +2 -0
- package/dist/stream/index.d.cts +2 -1
- package/dist/stream/index.d.ts +2 -1
- package/dist/stream/index.js +2 -1
- package/dist/stream/projections/channel-effect.cjs +52 -0
- package/dist/stream/projections/channel-effect.cjs.map +1 -0
- package/dist/stream/projections/channel-effect.d.cts +35 -0
- package/dist/stream/projections/channel-effect.d.cts.map +1 -0
- package/dist/stream/projections/channel-effect.d.ts +35 -0
- package/dist/stream/projections/channel-effect.d.ts.map +1 -0
- package/dist/stream/projections/channel-effect.js +52 -0
- package/dist/stream/projections/channel-effect.js.map +1 -0
- package/dist/stream/projections/index.cjs +1 -0
- package/dist/stream/projections/index.d.ts +1 -0
- package/dist/stream/projections/index.js +1 -0
- package/dist/stream/root-message-projection.cjs +55 -0
- package/dist/stream/root-message-projection.cjs.map +1 -1
- package/dist/stream/root-message-projection.js +55 -0
- package/dist/stream/root-message-projection.js.map +1 -1
- package/dist/ui/branching.d.cts +1 -1
- package/dist/ui/branching.d.ts +1 -1
- package/dist/ui/orchestrator.d.cts +1 -1
- package/dist/ui/orchestrator.d.cts.map +1 -1
- package/dist/ui/orchestrator.d.ts +1 -1
- package/dist/ui/orchestrator.d.ts.map +1 -1
- package/dist/utils/stream.d.cts +1 -1
- package/dist/utils/stream.d.cts.map +1 -1
- package/dist/utils/stream.d.ts +1 -1
- package/dist/utils/stream.d.ts.map +1 -1
- package/package.json +5 -2
|
@@ -344,6 +344,17 @@ var StreamController = class {
|
|
|
344
344
|
this.#hydrationPromise = this.#createHydrationPromise();
|
|
345
345
|
}
|
|
346
346
|
/**
|
|
347
|
+
* Load thread state for hydration, preferring the active custom
|
|
348
|
+
* adapter's `getState()` when present.
|
|
349
|
+
*/
|
|
350
|
+
async #fetchHydrationState() {
|
|
351
|
+
const threadId = this.#currentThreadId;
|
|
352
|
+
if (threadId == null) return null;
|
|
353
|
+
const transport = this.#options.transport;
|
|
354
|
+
if (transport != null && typeof transport === "object" && typeof transport.getState === "function") return await transport.getState();
|
|
355
|
+
return this.#options.client.threads.getState(threadId);
|
|
356
|
+
}
|
|
357
|
+
/**
|
|
347
358
|
* Fetch the checkpointed thread state and seed the root snapshot.
|
|
348
359
|
* Re-calling with a different `threadId` swaps the underlying
|
|
349
360
|
* {@link ThreadStream}, rewires the registry to the new thread, and
|
|
@@ -416,7 +427,7 @@ var StreamController = class {
|
|
|
416
427
|
let threadExists = false;
|
|
417
428
|
let threadActive = true;
|
|
418
429
|
try {
|
|
419
|
-
const state = await this.#
|
|
430
|
+
const state = await this.#fetchHydrationState();
|
|
420
431
|
threadExists = state != null;
|
|
421
432
|
threadActive = isThreadStateActive(state);
|
|
422
433
|
if (state?.values != null) {
|
|
@@ -454,7 +465,25 @@ var StreamController = class {
|
|
|
454
465
|
* idempotent, so this is safe on re-hydrate.
|
|
455
466
|
*/
|
|
456
467
|
const seedMessages = state.values[this.#messagesKey];
|
|
457
|
-
if (Array.isArray(seedMessages))
|
|
468
|
+
if (Array.isArray(seedMessages)) {
|
|
469
|
+
this.#subagents.seedFromCheckpointMessages(seedMessages);
|
|
470
|
+
/**
|
|
471
|
+
* An idle (finished) thread defers its root SSE pump; the first
|
|
472
|
+
* `submit()` brings it up and the transport replays the finished
|
|
473
|
+
* run from `seq=0`. Seal the seeded message ids so that replay's
|
|
474
|
+
* `messages` channel deltas can't downgrade the already-complete
|
|
475
|
+
* tail to empty partials (a visible "messages replay"). Only safe
|
|
476
|
+
* for idle threads, where every seeded message is final — an
|
|
477
|
+
* active thread's tail may still be streaming and must keep
|
|
478
|
+
* receiving deltas. New ids from the next run are never sealed,
|
|
479
|
+
* and the seal lifts once a newer checkpoint advances the
|
|
480
|
+
* timeline.
|
|
481
|
+
*/
|
|
482
|
+
if (!threadActive) {
|
|
483
|
+
const sealedIds = seedMessages.map((message) => message?.id).filter((id) => typeof id === "string");
|
|
484
|
+
if (sealedIds.length > 0) this.#rootMessages.sealMessageIds(sealedIds);
|
|
485
|
+
}
|
|
486
|
+
}
|
|
458
487
|
}
|
|
459
488
|
/**
|
|
460
489
|
* Converge to server truth: drop any optimistic messages the
|