@langchain/langgraph-api 0.0.29 → 0.0.30
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/semver/index.mjs +11 -1
- package/dist/storage/ops.mjs +14 -20
- package/dist/stream.mjs +7 -2
- package/package.json +2 -2
package/dist/semver/index.mjs
CHANGED
|
@@ -18,7 +18,17 @@ export async function checkLangGraphSemver() {
|
|
|
18
18
|
let version = "0.0.0";
|
|
19
19
|
try {
|
|
20
20
|
const pkgJson = await import(`${name}/package.json`);
|
|
21
|
-
|
|
21
|
+
if (pkgJson == null || typeof pkgJson !== "object") {
|
|
22
|
+
return { name, version };
|
|
23
|
+
}
|
|
24
|
+
if ("default" in pkgJson &&
|
|
25
|
+
typeof pkgJson.default === "object" &&
|
|
26
|
+
pkgJson.default != null) {
|
|
27
|
+
version = pkgJson.default.version || version;
|
|
28
|
+
}
|
|
29
|
+
else if ("version" in pkgJson) {
|
|
30
|
+
version = pkgJson.version || version;
|
|
31
|
+
}
|
|
22
32
|
}
|
|
23
33
|
catch {
|
|
24
34
|
// pass
|
package/dist/storage/ops.mjs
CHANGED
|
@@ -32,27 +32,21 @@ class Queue {
|
|
|
32
32
|
if (this.buffer.length > 0) {
|
|
33
33
|
return this.buffer.shift();
|
|
34
34
|
}
|
|
35
|
+
let timeout = undefined;
|
|
36
|
+
let resolver = undefined;
|
|
37
|
+
const clean = new AbortController();
|
|
35
38
|
return await new Promise((resolve, reject) => {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
if (options.signal != null) {
|
|
48
|
-
options.signal.addEventListener("abort", () => {
|
|
49
|
-
this.listeners = this.listeners.filter((l) => l !== listener);
|
|
50
|
-
clearTimeout(timer);
|
|
51
|
-
reject(new AbortError());
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
this.listeners.push(listener);
|
|
55
|
-
}).then(() => this.buffer.shift());
|
|
39
|
+
timeout = setTimeout(() => reject(new TimeoutError()), options.timeout);
|
|
40
|
+
resolver = resolve;
|
|
41
|
+
options.signal?.addEventListener("abort", () => reject(new AbortError()), { signal: clean.signal });
|
|
42
|
+
this.listeners.push(resolver);
|
|
43
|
+
})
|
|
44
|
+
.then(() => this.buffer.shift())
|
|
45
|
+
.finally(() => {
|
|
46
|
+
this.listeners = this.listeners.filter((l) => l !== resolver);
|
|
47
|
+
clearTimeout(timeout);
|
|
48
|
+
clean.abort();
|
|
49
|
+
});
|
|
56
50
|
}
|
|
57
51
|
}
|
|
58
52
|
class CancellationAbortController extends AbortController {
|
package/dist/stream.mjs
CHANGED
|
@@ -3,6 +3,7 @@ import { Client as LangSmithClient } from "langsmith";
|
|
|
3
3
|
import { runnableConfigToCheckpoint, taskRunnableConfigToCheckpoint, } from "./utils/runnableConfig.mjs";
|
|
4
4
|
import { isBaseMessage } from "@langchain/core/messages";
|
|
5
5
|
import { getLangGraphCommand } from "./command.mjs";
|
|
6
|
+
import { checkLangGraphSemver } from "./semver/index.mjs";
|
|
6
7
|
const isRunnableConfig = (config) => {
|
|
7
8
|
if (typeof config !== "object" || config == null)
|
|
8
9
|
return false;
|
|
@@ -51,6 +52,7 @@ function preprocessDebugCheckpoint(payload) {
|
|
|
51
52
|
result.parent_config = deleteInternalConfigurableFields(result.parent_config);
|
|
52
53
|
return result;
|
|
53
54
|
}
|
|
55
|
+
let LANGGRAPH_VERSION;
|
|
54
56
|
export async function* streamState(run, attempt = 1, options) {
|
|
55
57
|
const kwargs = run.kwargs;
|
|
56
58
|
const graphId = kwargs.config?.configurable?.graph_id;
|
|
@@ -74,11 +76,14 @@ export async function* streamState(run, attempt = 1, options) {
|
|
|
74
76
|
event: "metadata",
|
|
75
77
|
data: { run_id: run.run_id, attempt },
|
|
76
78
|
};
|
|
79
|
+
if (!LANGGRAPH_VERSION) {
|
|
80
|
+
const version = await checkLangGraphSemver();
|
|
81
|
+
LANGGRAPH_VERSION = version.find((v) => v.name === "@langchain/langgraph");
|
|
82
|
+
}
|
|
77
83
|
const metadata = {
|
|
78
84
|
...kwargs.config?.metadata,
|
|
79
85
|
run_attempt: attempt,
|
|
80
|
-
|
|
81
|
-
langgraph_version: "0.2.35",
|
|
86
|
+
langgraph_version: LANGGRAPH_VERSION?.version ?? "0.0.0",
|
|
82
87
|
langgraph_plan: "developer",
|
|
83
88
|
langgraph_host: "self-hosted",
|
|
84
89
|
langgraph_api_url: process.env.LANGGRAPH_API_URL ?? undefined,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@langchain/langgraph-api",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.30",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": "^18.19.0 || >=20.16.0"
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"winston": "^3.17.0",
|
|
50
50
|
"winston-console-format": "^1.0.8",
|
|
51
51
|
"zod": "^3.23.8",
|
|
52
|
-
"@langchain/langgraph-ui": "0.0.
|
|
52
|
+
"@langchain/langgraph-ui": "0.0.30"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
55
|
"@langchain/core": "^0.3.42",
|