@langchain/langgraph-sdk 1.10.3-rc.0 → 1.10.3-rc.2
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/stream/index.cjs +23 -1
- package/dist/client/stream/index.cjs.map +1 -1
- package/dist/client/stream/index.d.cts +6 -0
- package/dist/client/stream/index.d.cts.map +1 -1
- package/dist/client/stream/index.d.ts +6 -0
- package/dist/client/stream/index.d.ts.map +1 -1
- package/dist/client/stream/index.js +23 -1
- package/dist/client/stream/index.js.map +1 -1
- package/dist/client/stream/transport/http.cjs +14 -3
- package/dist/client/stream/transport/http.cjs.map +1 -1
- package/dist/client/stream/transport/http.d.cts.map +1 -1
- package/dist/client/stream/transport/http.d.ts.map +1 -1
- package/dist/client/stream/transport/http.js +14 -3
- package/dist/client/stream/transport/http.js.map +1 -1
- package/dist/stream/controller.cjs +94 -20
- 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 +94 -20
- package/dist/stream/controller.js.map +1 -1
- package/package.json +1 -1
|
@@ -357,6 +357,7 @@ var ThreadStream = class {
|
|
|
357
357
|
#lifecycleWatcherHandle = null;
|
|
358
358
|
#lifecycleWatcherStartPromise;
|
|
359
359
|
#onEventListeners = /* @__PURE__ */ new Set();
|
|
360
|
+
#onErrorListeners = /* @__PURE__ */ new Set();
|
|
360
361
|
#messagesIterable;
|
|
361
362
|
#valuesProjection;
|
|
362
363
|
#toolCallsIterable;
|
|
@@ -895,6 +896,17 @@ var ThreadStream = class {
|
|
|
895
896
|
};
|
|
896
897
|
}
|
|
897
898
|
/**
|
|
899
|
+
* Register a listener for stream-level failures: an unsolicited server
|
|
900
|
+
* error frame, or the transport giving up on reconnecting. Returns an
|
|
901
|
+
* unsubscribe function.
|
|
902
|
+
*/
|
|
903
|
+
onError(listener) {
|
|
904
|
+
this.#onErrorListeners.add(listener);
|
|
905
|
+
return () => {
|
|
906
|
+
this.#onErrorListeners.delete(listener);
|
|
907
|
+
};
|
|
908
|
+
}
|
|
909
|
+
/**
|
|
898
910
|
* Lazily open the wildcard discovery watcher stream.
|
|
899
911
|
*
|
|
900
912
|
* Idempotent. Used by both transports, but through different
|
|
@@ -1046,6 +1058,11 @@ var ThreadStream = class {
|
|
|
1046
1058
|
listener(event);
|
|
1047
1059
|
} catch {}
|
|
1048
1060
|
}
|
|
1061
|
+
#fireOnError(error) {
|
|
1062
|
+
for (const listener of this.#onErrorListeners) try {
|
|
1063
|
+
listener(error);
|
|
1064
|
+
} catch {}
|
|
1065
|
+
}
|
|
1049
1066
|
async close() {
|
|
1050
1067
|
if (this.#closed) return;
|
|
1051
1068
|
this.#closed = true;
|
|
@@ -1072,6 +1089,7 @@ var ThreadStream = class {
|
|
|
1072
1089
|
const lifecycleWatcherStartPromise = this.#lifecycleWatcherStartPromise;
|
|
1073
1090
|
this.#lifecycleWatcherStartPromise = void 0;
|
|
1074
1091
|
this.#onEventListeners.clear();
|
|
1092
|
+
this.#onErrorListeners.clear();
|
|
1075
1093
|
for (const subscription of this.#subscriptions.values()) subscription.close();
|
|
1076
1094
|
this.#subscriptions.clear();
|
|
1077
1095
|
try {
|
|
@@ -1338,6 +1356,7 @@ var ThreadStream = class {
|
|
|
1338
1356
|
for (const pending of this.#pendingSubResolves) pending.reject(normalized);
|
|
1339
1357
|
this.#pendingSubResolves.length = 0;
|
|
1340
1358
|
for (const subscription of this.#subscriptions.values()) subscription.close();
|
|
1359
|
+
this.#fireOnError(normalized);
|
|
1341
1360
|
}
|
|
1342
1361
|
/**
|
|
1343
1362
|
* Command-based subscription (WebSocket fallback). The server replays
|
|
@@ -1480,7 +1499,10 @@ var ThreadStream = class {
|
|
|
1480
1499
|
}
|
|
1481
1500
|
const messageId = typeof message.id === "number" ? message.id : void 0;
|
|
1482
1501
|
const pending = messageId === void 0 ? void 0 : this.#pending.get(messageId);
|
|
1483
|
-
if (!pending)
|
|
1502
|
+
if (!pending) {
|
|
1503
|
+
if (message.type === "error" && message.id == null) this.#fireOnError(new require_error.ProtocolError(message));
|
|
1504
|
+
return;
|
|
1505
|
+
}
|
|
1484
1506
|
if (messageId !== void 0) this.#pending.delete(messageId);
|
|
1485
1507
|
if (message.type === "error") {
|
|
1486
1508
|
pending.reject(new require_error.ProtocolError(message));
|