@langchain/langgraph-sdk 1.10.2 → 1.10.3-rc.1
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/runs/index.cjs +1 -0
- package/dist/client/runs/index.cjs.map +1 -1
- package/dist/client/runs/index.d.cts.map +1 -1
- package/dist/client/runs/index.d.ts.map +1 -1
- package/dist/client/runs/index.js +1 -0
- package/dist/client/runs/index.js.map +1 -1
- package/dist/stream/controller.cjs +41 -19
- 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 +41 -19
- package/dist/stream/controller.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"controller.d.cts","names":[],"sources":["../../src/stream/controller.ts"],"mappings":";;;;;;;;;;;;;;AA6KA;;cAAa,kBAAA,WAA6B,OAAA;;AAkC1C;;;;;;;;;;;;cAAa,gBAAA,4BACgB,MAAA,8EAEO,MAAA;EAAA;WAEzB,SAAA,EAAW,WAAA,CAAY,YAAA,CAAa,SAAA,EAAW,aAAA;EAAA,SAC/C,aAAA,EAAe,WAAA,CAAY,WAAA;EAAA,SAC3B,aAAA,EAAe,WAAA,CAAY,WAAA;EAAA,SAC3B,mBAAA,EAAqB,WAAA,CAAY,iBAAA;EAAA,SACjC,oBAAA,EAAsB,WAAA,CAAY,kBAAA;EAAA,SAClC,UAAA,EAAY,WAAA,CAAY,uBAAA,CAAwB,SAAA;EAAA,SAChD,QAAA,EAAU,eAAA;
|
|
1
|
+
{"version":3,"file":"controller.d.cts","names":[],"sources":["../../src/stream/controller.ts"],"mappings":";;;;;;;;;;;;;;AA6KA;;cAAa,kBAAA,WAA6B,OAAA;;AAkC1C;;;;;;;;;;;;cAAa,gBAAA,4BACgB,MAAA,8EAEO,MAAA;EAAA;WAEzB,SAAA,EAAW,WAAA,CAAY,YAAA,CAAa,SAA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AAA,CAAA,GAAa,YAAA;;;;;;;;EAWb,eAAA,CACE,QAAA,GAAW,MAAA,EAAQ,YAAA;AAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"controller.d.ts","names":[],"sources":["../../src/stream/controller.ts"],"mappings":";;;;;;;;;;;;;;;AA6KA;cAAa,kBAAA,WAA6B,OAAA;;;AAkC1C;;;;;;;;;;;cAAa,gBAAA,4BACgB,MAAA,8EAEO,MAAA;EAAA;WAEzB,SAAA,EAAW,WAAA,CAAY,YAAA,CAAa,SAAA,EAAW,aAAA;EAAA,SAC/C,aAAA,EAAe,WAAA,CAAY,WAAA;EAAA,SAC3B,aAAA,EAAe,WAAA,CAAY,WAAA;EAAA,SAC3B,mBAAA,EAAqB,WAAA,CAAY,iBAAA;EAAA,SACjC,oBAAA,EAAsB,WAAA,CAAY,kBAAA;EAAA,SAClC,UAAA,EAAY,WAAA,CAAY,uBAAA,CAAwB,SAAA;EAAA,SAChD,QAAA,EAAU,eAAA;EAAA;;;;;
|
|
1
|
+
{"version":3,"file":"controller.d.ts","names":[],"sources":["../../src/stream/controller.ts"],"mappings":";;;;;;;;;;;;;;;AA6KA;cAAa,kBAAA,WAA6B,OAAA;;;AAkC1C;;;;;;;;;;;cAAa,gBAAA,4BACgB,MAAA,8EAEO,MAAA;EAAA;WAEzB,SAAA,EAAW,WAAA,CAAY,YAAA,CAAa,SAAA,EAAW,aAAA;EAAA,SAC/C,aAAA,EAAe,WAAA,CAAY,WAAA;EAAA,SAC3B,aAAA,EAAe,WAAA,CAAY,WAAA;EAAA,SAC3B,mBAAA,EAAqB,WAAA,CAAY,iBAAA;EAAA,SACjC,oBAAA,EAAsB,WAAA,CAAY,kBAAA;EAAA,SAClC,UAAA,EAAY,WAAA,CAAY,uBAAA,CAAwB,SAAA;EAAA,SAChD,QAAA,EAAU,eAAA;EAAA;;;;;EAiKnB,WAAA,CAAY,OAAA,EAAS,uBAAA,CAAwB,SAAA;EAoyBb;;;;;;;EAAA,IAxqB5B,gBAAA,CAAA,GAAoB,OAAA;EA8wBJ;;;;;;;;EArtBd,OAAA,CAAQ,QAAA,mBAA2B,OAAA;EA0/B5B;;;;;;;;;;;;;;EAjpBP,wBAAA,CAAyB,UAAA,WAAqB,OAAA;EApsB3C;;;;;;;;EAw8BH,MAAA,CACJ,KAAA,WACA,OAAA,GAAU,mBAAA,CAAoB,SAAA,EAAW,gBAAA,IACxC,OAAA;EAx8BM;;;;;;EAk9BH,IAAA,CAAK,OAAA,GAAU,iBAAA,GAAoB,OAAA;EAh9BhC;;;;EAo+BH,UAAA,CAAA,GAAc,OAAA;EAn0BR;;;;;;;;;;;EAm4BN,YAAA,CAAa,EAAA,WAAa,OAAA;EA/FA;;;EAsG1B,UAAA,CAAA,GAAc,OAAA;EA3Fd;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwJA,OAAA,CACJ,QAAA,WACA,OAAA,GAAU,oBAAA,CAAqB,gBAAA,IAC9B,OAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiHG,UAAA,CACJ,aAAA,EAAe,MAAA,mBACf,OAAA,GAAU,uBAAA,CAAwB,gBAAA,IACjC,OAAA;;;;EA4DG,OAAA,CAAA,GAAW,OAAA;;;;;;;;;;;;;;;;EAyBjB,QAAA,CAAA;;;;;;EA4BA,SAAA,CAAA,GAAa,YAAA;;;;;;;;EAWb,eAAA,CACE,QAAA,GAAW,MAAA,EAAQ,YAAA;AAAA"}
|
|
@@ -148,11 +148,9 @@ var StreamController = class {
|
|
|
148
148
|
* Interrupt ids this controller has locally marked resolved via
|
|
149
149
|
* {@link respond} / {@link respondAll}. Used only to suppress
|
|
150
150
|
* *historical* SSE replay of those `input.requested` events (there
|
|
151
|
-
* is no `input.responded` protocol event).
|
|
152
|
-
* resume barrier
|
|
153
|
-
*
|
|
154
|
-
* still-pending server interrupt can reappear on
|
|
155
|
-
* `rootStore.interrupts`.
|
|
151
|
+
* is no `input.responded` protocol event). A live event after the
|
|
152
|
+
* resume barrier clears an id from this set so an interrupt raised
|
|
153
|
+
* again by a later run can reappear on `rootStore.interrupts`.
|
|
156
154
|
*/
|
|
157
155
|
#resolvedInterrupts = /* @__PURE__ */ new Set();
|
|
158
156
|
/**
|
|
@@ -168,13 +166,17 @@ var StreamController = class {
|
|
|
168
166
|
* than {@link #interruptReplayThroughSeq} bypass the allowlist.
|
|
169
167
|
*/
|
|
170
168
|
#hydratedActiveInterruptIds = null;
|
|
169
|
+
/** Checkpoint whose replay establishes the hydrate-time interrupt cutoff. */
|
|
170
|
+
#hydratedInterruptCheckpointId;
|
|
171
171
|
/**
|
|
172
|
-
* Highest event sequence
|
|
173
|
-
* was accepted. Interrupts outside the hydrate-time
|
|
174
|
-
* filtered through this sequence, while newer events are
|
|
175
|
-
*
|
|
172
|
+
* Highest event sequence represented by hydration or already applied when
|
|
173
|
+
* the latest run command was accepted. Interrupts outside the hydrate-time
|
|
174
|
+
* allowlist remain filtered through this sequence, while newer events are
|
|
175
|
+
* live output and must be accepted.
|
|
176
176
|
*/
|
|
177
177
|
#interruptReplayThroughSeq;
|
|
178
|
+
/** Unknown inputs waiting for replay to reach the hydrated checkpoint. */
|
|
179
|
+
#pendingHydrationInterruptEvents = [];
|
|
178
180
|
/**
|
|
179
181
|
* Unknown interrupt events received between local command dispatch and its
|
|
180
182
|
* response. The response supplies the sequence barrier needed to classify
|
|
@@ -326,7 +328,9 @@ var StreamController = class {
|
|
|
326
328
|
onSubmitStart: () => {
|
|
327
329
|
this.#submitGeneration += 1;
|
|
328
330
|
this.#interruptCommandPending = this.#hydratedActiveInterruptIds != null;
|
|
329
|
-
this.#pendingInterruptEvents =
|
|
331
|
+
this.#pendingInterruptEvents = this.#pendingHydrationInterruptEvents;
|
|
332
|
+
this.#pendingHydrationInterruptEvents = [];
|
|
333
|
+
this.#hydratedInterruptCheckpointId = void 0;
|
|
330
334
|
},
|
|
331
335
|
onRunStart: () => this.#markLocalRunStart(),
|
|
332
336
|
onRunCreated: (runId) => {
|
|
@@ -577,6 +581,7 @@ var StreamController = class {
|
|
|
577
581
|
}));
|
|
578
582
|
if (this.#submitGeneration === generationAtFetch) {
|
|
579
583
|
this.#hydratedActiveInterruptIds = activeIds;
|
|
584
|
+
this.#hydratedInterruptCheckpointId = state.checkpoint?.checkpoint_id ?? void 0;
|
|
580
585
|
this.#interruptReplayThroughSeq = void 0;
|
|
581
586
|
}
|
|
582
587
|
}
|
|
@@ -1308,7 +1313,9 @@ var StreamController = class {
|
|
|
1308
1313
|
this.#localRunDepth = 0;
|
|
1309
1314
|
this.#messageMetadata.reset();
|
|
1310
1315
|
this.#hydratedActiveInterruptIds = null;
|
|
1316
|
+
this.#hydratedInterruptCheckpointId = void 0;
|
|
1311
1317
|
this.#interruptReplayThroughSeq = void 0;
|
|
1318
|
+
this.#pendingHydrationInterruptEvents = [];
|
|
1312
1319
|
this.#discardPendingInterruptEvents();
|
|
1313
1320
|
this.queueStore.setState(() => EMPTY_QUEUE);
|
|
1314
1321
|
try {
|
|
@@ -1484,6 +1491,7 @@ var StreamController = class {
|
|
|
1484
1491
|
} catch {}
|
|
1485
1492
|
this.#subgraphs.push(event);
|
|
1486
1493
|
this.#lifecycleLoading.handle(event);
|
|
1494
|
+
this.#advanceInterruptReplayBarrierFromCheckpoint(event);
|
|
1487
1495
|
/**
|
|
1488
1496
|
* `input.requested` events (including HITL inside a subagent /
|
|
1489
1497
|
* subgraph) are not always observable via the narrow content pump.
|
|
@@ -1733,6 +1741,10 @@ var StreamController = class {
|
|
|
1733
1741
|
this.#pendingInterruptEvents.push(event);
|
|
1734
1742
|
return;
|
|
1735
1743
|
}
|
|
1744
|
+
if (isUnknownInterrupt && this.#interruptReplayThroughSeq == null && this.#hydratedInterruptCheckpointId != null) {
|
|
1745
|
+
this.#pendingHydrationInterruptEvents.push(event);
|
|
1746
|
+
return;
|
|
1747
|
+
}
|
|
1736
1748
|
if (isUnknownInterrupt && (this.#interruptReplayThroughSeq == null || eventSeq != null && eventSeq <= this.#interruptReplayThroughSeq)) return;
|
|
1737
1749
|
const namespace = Array.isArray(event.params.namespace) ? [...event.params.namespace] : [...ROOT_NAMESPACE];
|
|
1738
1750
|
const interrupt = normalizeInterruptForClient({
|
|
@@ -1750,6 +1762,16 @@ var StreamController = class {
|
|
|
1750
1762
|
};
|
|
1751
1763
|
});
|
|
1752
1764
|
}
|
|
1765
|
+
/** Establish the hydration cutoff when ordered replay reaches its checkpoint. */
|
|
1766
|
+
#advanceInterruptReplayBarrierFromCheckpoint(event) {
|
|
1767
|
+
if (event.method !== "checkpoints" || this.#hydratedInterruptCheckpointId == null || !isRootNamespace(event.params.namespace)) return;
|
|
1768
|
+
if (event.params.data?.id !== this.#hydratedInterruptCheckpointId || typeof event.seq !== "number") return;
|
|
1769
|
+
this.#interruptReplayThroughSeq = event.seq;
|
|
1770
|
+
this.#hydratedInterruptCheckpointId = void 0;
|
|
1771
|
+
const pendingEvents = this.#pendingHydrationInterruptEvents.sort((a, b) => (a.seq ?? 0) - (b.seq ?? 0));
|
|
1772
|
+
this.#pendingHydrationInterruptEvents = [];
|
|
1773
|
+
for (const pendingEvent of pendingEvents) this.#recordInterrupt(pendingEvent);
|
|
1774
|
+
}
|
|
1753
1775
|
/**
|
|
1754
1776
|
* Convert the hydrate-time allowlist into a replay barrier after a command
|
|
1755
1777
|
* is accepted. Built-in transports update `lastAppliedThroughSeq` from the
|
|
@@ -1795,8 +1817,7 @@ var StreamController = class {
|
|
|
1795
1817
|
* mirror the removal into the root snapshot the framework hooks read.
|
|
1796
1818
|
*
|
|
1797
1819
|
* Tombstones are not permanent: a live `input.requested` after the
|
|
1798
|
-
* resume barrier
|
|
1799
|
-
* clears the id when the server still reports it as pending.
|
|
1820
|
+
* resume barrier clears the id when the same interrupt is raised again.
|
|
1800
1821
|
*/
|
|
1801
1822
|
#markInterruptResolvedInRootStore(interruptId) {
|
|
1802
1823
|
this.#resolvedInterrupts.add(interruptId);
|
|
@@ -1815,10 +1836,11 @@ var StreamController = class {
|
|
|
1815
1836
|
* `state.tasks[].interrupts` after a resumed run settles.
|
|
1816
1837
|
*
|
|
1817
1838
|
* Sequential `respond()` of parallel interrupts optimistically clears
|
|
1818
|
-
* each id client-side.
|
|
1819
|
-
*
|
|
1820
|
-
*
|
|
1821
|
-
*
|
|
1839
|
+
* each targeted id client-side. The server checkpoint can continue to
|
|
1840
|
+
* list the original interrupt batch after accepting a partial response,
|
|
1841
|
+
* so locally-resolved ids remain filtered while untouched siblings are
|
|
1842
|
+
* restored. This keeps `stream.interrupts` truthful without re-exposing
|
|
1843
|
+
* an already-consumed interrupt.
|
|
1822
1844
|
*
|
|
1823
1845
|
* Uses the same transport-aware state fetch as {@link hydrate}, and
|
|
1824
1846
|
* drops the result if the thread swapped or a new submit/respond
|
|
@@ -1833,11 +1855,11 @@ var StreamController = class {
|
|
|
1833
1855
|
if (this.#disposed || this.#currentThreadId !== threadId || this.#submitGeneration !== generationAtFetch) return;
|
|
1834
1856
|
if (!Array.isArray(state?.tasks)) return;
|
|
1835
1857
|
const { activeInterrupts, activeIds } = collectActiveInterruptsFromTasks(state.tasks);
|
|
1836
|
-
|
|
1858
|
+
const pendingInterrupts = activeInterrupts.filter((interrupt) => interrupt.id == null || !this.#resolvedInterrupts.has(interrupt.id));
|
|
1837
1859
|
this.rootStore.setState((s) => ({
|
|
1838
1860
|
...s,
|
|
1839
|
-
interrupts:
|
|
1840
|
-
interrupt:
|
|
1861
|
+
interrupts: pendingInterrupts,
|
|
1862
|
+
interrupt: pendingInterrupts[0]
|
|
1841
1863
|
}));
|
|
1842
1864
|
this.#hydratedActiveInterruptIds = activeIds;
|
|
1843
1865
|
} catch {}
|