@langchain/langgraph-sdk 1.9.23 → 1.9.25
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/_virtual/_rolldown/runtime.cjs +2 -0
- package/dist/_virtual/_rolldown/runtime.js +24 -0
- package/dist/node_modules/.pnpm/eventemitter3@5.0.4/node_modules/eventemitter3/index.cjs +244 -0
- package/dist/node_modules/.pnpm/eventemitter3@5.0.4/node_modules/eventemitter3/index.cjs.map +1 -0
- package/dist/node_modules/.pnpm/eventemitter3@5.0.4/node_modules/eventemitter3/index.js +240 -0
- package/dist/node_modules/.pnpm/eventemitter3@5.0.4/node_modules/eventemitter3/index.js.map +1 -0
- package/dist/node_modules/.pnpm/eventemitter3@5.0.4/node_modules/eventemitter3/index2.cjs +13 -0
- package/dist/node_modules/.pnpm/eventemitter3@5.0.4/node_modules/eventemitter3/index2.cjs.map +1 -0
- package/dist/node_modules/.pnpm/eventemitter3@5.0.4/node_modules/eventemitter3/index2.js +8 -0
- package/dist/node_modules/.pnpm/eventemitter3@5.0.4/node_modules/eventemitter3/index2.js.map +1 -0
- package/dist/node_modules/.pnpm/is-network-error@1.3.1/node_modules/is-network-error/index.cjs +25 -0
- package/dist/node_modules/.pnpm/is-network-error@1.3.1/node_modules/is-network-error/index.cjs.map +1 -0
- package/dist/node_modules/.pnpm/is-network-error@1.3.1/node_modules/is-network-error/index.js +25 -0
- package/dist/node_modules/.pnpm/is-network-error@1.3.1/node_modules/is-network-error/index.js.map +1 -0
- package/dist/node_modules/.pnpm/p-queue@9.1.0/node_modules/p-queue/dist/index.cjs +596 -0
- package/dist/node_modules/.pnpm/p-queue@9.1.0/node_modules/p-queue/dist/index.cjs.map +1 -0
- package/dist/node_modules/.pnpm/p-queue@9.1.0/node_modules/p-queue/dist/index.js +596 -0
- package/dist/node_modules/.pnpm/p-queue@9.1.0/node_modules/p-queue/dist/index.js.map +1 -0
- package/dist/node_modules/.pnpm/p-queue@9.1.0/node_modules/p-queue/dist/lower-bound.cjs +18 -0
- package/dist/node_modules/.pnpm/p-queue@9.1.0/node_modules/p-queue/dist/lower-bound.cjs.map +1 -0
- package/dist/node_modules/.pnpm/p-queue@9.1.0/node_modules/p-queue/dist/lower-bound.js +18 -0
- package/dist/node_modules/.pnpm/p-queue@9.1.0/node_modules/p-queue/dist/lower-bound.js.map +1 -0
- package/dist/node_modules/.pnpm/p-queue@9.1.0/node_modules/p-queue/dist/priority-queue.cjs +41 -0
- package/dist/node_modules/.pnpm/p-queue@9.1.0/node_modules/p-queue/dist/priority-queue.cjs.map +1 -0
- package/dist/node_modules/.pnpm/p-queue@9.1.0/node_modules/p-queue/dist/priority-queue.js +41 -0
- package/dist/node_modules/.pnpm/p-queue@9.1.0/node_modules/p-queue/dist/priority-queue.js.map +1 -0
- package/dist/node_modules/.pnpm/p-retry@7.1.1/node_modules/p-retry/index.cjs +141 -0
- package/dist/node_modules/.pnpm/p-retry@7.1.1/node_modules/p-retry/index.cjs.map +1 -0
- package/dist/node_modules/.pnpm/p-retry@7.1.1/node_modules/p-retry/index.js +141 -0
- package/dist/node_modules/.pnpm/p-retry@7.1.1/node_modules/p-retry/index.js.map +1 -0
- package/dist/node_modules/.pnpm/p-timeout@7.0.1/node_modules/p-timeout/index.cjs +63 -0
- package/dist/node_modules/.pnpm/p-timeout@7.0.1/node_modules/p-timeout/index.cjs.map +1 -0
- package/dist/node_modules/.pnpm/p-timeout@7.0.1/node_modules/p-timeout/index.js +62 -0
- package/dist/node_modules/.pnpm/p-timeout@7.0.1/node_modules/p-timeout/index.js.map +1 -0
- package/dist/stream/controller.cjs +29 -3
- 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 +30 -4
- package/dist/stream/controller.js.map +1 -1
- package/dist/stream/optimistic-input.cjs +32 -0
- package/dist/stream/optimistic-input.cjs.map +1 -1
- package/dist/stream/optimistic-input.js +32 -1
- package/dist/stream/optimistic-input.js.map +1 -1
- package/dist/stream/root-message-projection.cjs +14 -2
- package/dist/stream/root-message-projection.cjs.map +1 -1
- package/dist/stream/root-message-projection.js +14 -2
- package/dist/stream/root-message-projection.js.map +1 -1
- package/dist/stream/submit-coordinator.cjs +14 -1
- package/dist/stream/submit-coordinator.cjs.map +1 -1
- package/dist/stream/submit-coordinator.js +14 -1
- package/dist/stream/submit-coordinator.js.map +1 -1
- package/dist/stream/types.d.cts +27 -1
- package/dist/stream/types.d.cts.map +1 -1
- package/dist/stream/types.d.ts +27 -1
- package/dist/stream/types.d.ts.map +1 -1
- package/dist/ui/types.d.cts +13 -1
- package/dist/ui/types.d.cts.map +1 -1
- package/dist/ui/types.d.ts +13 -1
- package/dist/ui/types.d.ts.map +1 -1
- package/dist/utils/async_caller.cjs +14 -8
- package/dist/utils/async_caller.cjs.map +1 -1
- package/dist/utils/async_caller.d.cts.map +1 -1
- package/dist/utils/async_caller.d.ts.map +1 -1
- package/dist/utils/async_caller.js +13 -4
- package/dist/utils/async_caller.js.map +1 -1
- package/package.json +7 -6
|
@@ -14,7 +14,7 @@ import { collectSubgraphHostNamespaces, getHistoryPage, mapSubagentNamespaces, r
|
|
|
14
14
|
import { MessageMetadataTracker } from "./message-metadata-tracker.js";
|
|
15
15
|
import { LifecycleLoadingTracker } from "./lifecycle-loading-tracker.js";
|
|
16
16
|
import { RootMessageProjection } from "./root-message-projection.js";
|
|
17
|
-
import { prepareOptimisticInput } from "./optimistic-input.js";
|
|
17
|
+
import { prepareOptimisticInput, serializeUpdateMessages } from "./optimistic-input.js";
|
|
18
18
|
import { EMPTY_QUEUE, SubmitCoordinator } from "./submit-coordinator.js";
|
|
19
19
|
import { reconcileToolCallsFromMessages, seedToolCallsFromMessages, upsertToolCall } from "./tool-calls.js";
|
|
20
20
|
import { v7 } from "@langchain/core/utils/uuid";
|
|
@@ -961,17 +961,21 @@ var StreamController = class {
|
|
|
961
961
|
} : this.#resolveInterruptForResume();
|
|
962
962
|
if (resolved == null) throw new Error("No pending interrupt to respond to.");
|
|
963
963
|
const thread = this.#thread;
|
|
964
|
+
const prepared = options?.update != null ? this.#beginOptimistic(options.update) : void 0;
|
|
965
|
+
const dispatchUpdate = this.#resolveDispatchUpdate(options?.update, prepared);
|
|
964
966
|
try {
|
|
965
967
|
await this.#submitter.dispatchResume(async () => {
|
|
966
968
|
await thread.respondInput({
|
|
967
969
|
namespace: resolved.namespace,
|
|
968
970
|
interrupt_id: resolved.interruptId,
|
|
969
971
|
response: normalizeHitlResponseForServer(response),
|
|
972
|
+
...dispatchUpdate != null ? { update: dispatchUpdate } : {},
|
|
973
|
+
...options?.goto != null ? { goto: options.goto } : {},
|
|
970
974
|
config: options?.config,
|
|
971
975
|
metadata: options?.metadata
|
|
972
976
|
});
|
|
973
977
|
this.#markInterruptResolvedInRootStore(resolved.interruptId);
|
|
974
|
-
});
|
|
978
|
+
}, prepared?.handle);
|
|
975
979
|
} catch (error) {
|
|
976
980
|
if (this.#disposed && isAbortLikeError(error)) return;
|
|
977
981
|
throw error;
|
|
@@ -1029,15 +1033,19 @@ var StreamController = class {
|
|
|
1029
1033
|
response: normalizeHitlResponseForServer(response),
|
|
1030
1034
|
namespace: pending.find((entry) => entry.interruptId === interruptId)?.namespace ?? [...ROOT_NAMESPACE]
|
|
1031
1035
|
}));
|
|
1036
|
+
const prepared = options?.update != null ? this.#beginOptimistic(options.update) : void 0;
|
|
1037
|
+
const dispatchUpdate = this.#resolveDispatchUpdate(options?.update, prepared);
|
|
1032
1038
|
try {
|
|
1033
1039
|
await this.#submitter.dispatchResume(async () => {
|
|
1034
1040
|
await thread.respondInput({
|
|
1035
1041
|
responses,
|
|
1042
|
+
...dispatchUpdate != null ? { update: dispatchUpdate } : {},
|
|
1043
|
+
...options?.goto != null ? { goto: options.goto } : {},
|
|
1036
1044
|
config: options?.config,
|
|
1037
1045
|
metadata: options?.metadata
|
|
1038
1046
|
});
|
|
1039
1047
|
for (const { interrupt_id: interruptId } of responses) this.#markInterruptResolvedInRootStore(interruptId);
|
|
1040
|
-
});
|
|
1048
|
+
}, prepared?.handle);
|
|
1041
1049
|
} catch (error) {
|
|
1042
1050
|
if (this.#disposed && isAbortLikeError(error)) return;
|
|
1043
1051
|
throw error;
|
|
@@ -1538,7 +1546,7 @@ var StreamController = class {
|
|
|
1538
1546
|
prevValue: currentValues[key]
|
|
1539
1547
|
}));
|
|
1540
1548
|
this.#sawValuesForRun = false;
|
|
1541
|
-
this.#rootMessages.appendOptimistic(prepared.optimisticMessages, prepared.extraValues);
|
|
1549
|
+
this.#rootMessages.appendOptimistic(prepared.optimisticMessages, prepared.extraValues, { sync: true });
|
|
1542
1550
|
if (prepared.echoedIds.length > 0) this.#messageMetadata.markPending(prepared.echoedIds);
|
|
1543
1551
|
return {
|
|
1544
1552
|
dispatchInput: prepared.dispatchInput,
|
|
@@ -1549,6 +1557,24 @@ var StreamController = class {
|
|
|
1549
1557
|
};
|
|
1550
1558
|
}
|
|
1551
1559
|
/**
|
|
1560
|
+
* Pick the `update` payload to dispatch on a resume (`respond` /
|
|
1561
|
+
* `respondAll`).
|
|
1562
|
+
*
|
|
1563
|
+
* When the optimistic path ran ({@link #beginOptimistic} returned a handle),
|
|
1564
|
+
* its `dispatchInput` already carries the minted message ids the server must
|
|
1565
|
+
* echo back, so dispatch that — the echo reconciles the optimistic messages
|
|
1566
|
+
* by id (no duplicate). Otherwise (optimistic UI disabled, or an `update`
|
|
1567
|
+
* with no echoable messages — e.g. the tuple-entry form) fall back to
|
|
1568
|
+
* serializing `BaseMessage` instances to dicts, exactly as before. Returns
|
|
1569
|
+
* `undefined` when there is no `update`, so the server still sees a plain
|
|
1570
|
+
* resume.
|
|
1571
|
+
*/
|
|
1572
|
+
#resolveDispatchUpdate(update, prepared) {
|
|
1573
|
+
if (prepared != null) return prepared.dispatchInput;
|
|
1574
|
+
if (update == null) return void 0;
|
|
1575
|
+
return serializeUpdateMessages(update, this.#messagesKey);
|
|
1576
|
+
}
|
|
1577
|
+
/**
|
|
1552
1578
|
* Reconcile optimistic state when a run terminates.
|
|
1553
1579
|
*
|
|
1554
1580
|
* - Messages: any echoed id still `"pending"` (never echoed by the
|