@langchain/langgraph-api 0.0.22 → 0.0.23
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/loopback.mjs +10 -0
- package/dist/server.mjs +3 -3
- package/dist/webhook.mjs +5 -5
- package/package.json +4 -4
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
const fetchSmb = Symbol.for("langgraph_api:fetch");
|
|
2
|
+
const global = globalThis;
|
|
3
|
+
export function getLoopbackFetch() {
|
|
4
|
+
if (!global[fetchSmb])
|
|
5
|
+
throw new Error("Loopback fetch is not bound");
|
|
6
|
+
return global[fetchSmb];
|
|
7
|
+
}
|
|
8
|
+
export const bindLoopbackFetch = (app) => {
|
|
9
|
+
global[fetchSmb] = async (url, init) => app.request(url, init);
|
|
10
|
+
};
|
package/dist/server.mjs
CHANGED
|
@@ -17,7 +17,7 @@ import { auth } from "./auth/custom.mjs";
|
|
|
17
17
|
import { registerAuth } from "./auth/index.mjs";
|
|
18
18
|
import { registerHttp } from "./http/custom.mjs";
|
|
19
19
|
import { cors, ensureContentType } from "./http/middleware.mjs";
|
|
20
|
-
import { bindLoopbackFetch } from "./
|
|
20
|
+
import { bindLoopbackFetch } from "./loopback.mjs";
|
|
21
21
|
export const StartServerSchema = z.object({
|
|
22
22
|
port: z.number(),
|
|
23
23
|
nWorkers: z.number(),
|
|
@@ -68,6 +68,8 @@ export async function startServer(options) {
|
|
|
68
68
|
logger.info(`Registering graphs from ${options.cwd}`);
|
|
69
69
|
await registerFromEnv(options.graphs, { cwd: options.cwd });
|
|
70
70
|
const app = new Hono();
|
|
71
|
+
// Loopback fetch used by webhooks and custom routes
|
|
72
|
+
bindLoopbackFetch(app);
|
|
71
73
|
if (options.auth?.path) {
|
|
72
74
|
logger.info(`Loading auth from ${options.auth.path}`);
|
|
73
75
|
await registerAuth(options.auth, { cwd: options.cwd });
|
|
@@ -111,8 +113,6 @@ export async function startServer(options) {
|
|
|
111
113
|
});
|
|
112
114
|
app.route("/", api);
|
|
113
115
|
}
|
|
114
|
-
// Loopback fetch used by webhooks
|
|
115
|
-
bindLoopbackFetch(app);
|
|
116
116
|
logger.info(`Starting ${options.nWorkers} workers`);
|
|
117
117
|
for (let i = 0; i < options.nWorkers; i++)
|
|
118
118
|
queue();
|
package/dist/webhook.mjs
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import { serializeError } from "./utils/serde.mjs";
|
|
2
|
-
|
|
3
|
-
export const bindLoopbackFetch = (app) => {
|
|
4
|
-
LOOPBACK_FETCH = async (url, init) => app.request(url, init);
|
|
5
|
-
};
|
|
2
|
+
import { getLoopbackFetch } from "./loopback.mjs";
|
|
6
3
|
export async function callWebhook(result) {
|
|
7
4
|
const payload = {
|
|
8
5
|
...result.run,
|
|
@@ -16,7 +13,10 @@ export async function callWebhook(result) {
|
|
|
16
13
|
: undefined),
|
|
17
14
|
};
|
|
18
15
|
if (result.webhook.startsWith("/")) {
|
|
19
|
-
|
|
16
|
+
const fetch = getLoopbackFetch();
|
|
17
|
+
if (!fetch)
|
|
18
|
+
throw new Error("Loopback fetch is not bound");
|
|
19
|
+
await fetch(result.webhook, {
|
|
20
20
|
method: "POST",
|
|
21
21
|
body: JSON.stringify(payload),
|
|
22
22
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@langchain/langgraph-api",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.23",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": "^18.19.0 || >=20.16.0"
|
|
@@ -43,13 +43,13 @@
|
|
|
43
43
|
"winston": "^3.17.0",
|
|
44
44
|
"winston-console-format": "^1.0.8",
|
|
45
45
|
"zod": "^3.23.8",
|
|
46
|
-
"@langchain/langgraph-ui": "0.0.
|
|
46
|
+
"@langchain/langgraph-ui": "0.0.23"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
49
|
"@langchain/core": "^0.3.42",
|
|
50
50
|
"@langchain/langgraph": "^0.2.57",
|
|
51
51
|
"@langchain/langgraph-checkpoint": "^0.0.16",
|
|
52
|
-
"@langchain/langgraph-sdk": "^0.0.
|
|
52
|
+
"@langchain/langgraph-sdk": "^0.0.67",
|
|
53
53
|
"typescript": "^5.5.4"
|
|
54
54
|
},
|
|
55
55
|
"peerDependenciesMeta": {
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
}
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
|
-
"@langchain/langgraph-sdk": "^0.0.
|
|
61
|
+
"@langchain/langgraph-sdk": "^0.0.67",
|
|
62
62
|
"@types/babel__code-frame": "^7.0.6",
|
|
63
63
|
"@types/react": "^19.0.8",
|
|
64
64
|
"@types/react-dom": "^19.0.3",
|