@langchain/langgraph-cli 0.0.3 → 0.0.4

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/api/runs.mjs CHANGED
@@ -102,7 +102,7 @@ api.post("/threads/:thread_id/runs/crons", zValidator("param", z.object({ thread
102
102
  throw new HTTPException(500, { message: "Not implemented" });
103
103
  });
104
104
  api.post("/runs/stream", zValidator("json", schemas.RunCreate), async (c) => {
105
- // Stream Run
105
+ // Stream Stateless Run
106
106
  const payload = c.req.valid("json");
107
107
  const run = await createValidRun(undefined, payload);
108
108
  return streamSSE(c, async (stream) => {
@@ -110,7 +110,7 @@ api.post("/runs/stream", zValidator("json", schemas.RunCreate), async (c) => {
110
110
  ? getDisconnectAbortSignal(c, stream)
111
111
  : undefined;
112
112
  try {
113
- for await (const { event, data } of Runs.Stream.join(run.run_id, undefined, { cancelOnDisconnect })) {
113
+ for await (const { event, data } of Runs.Stream.join(run.run_id, undefined, { cancelOnDisconnect, ignore404: true })) {
114
114
  await stream.writeSSE({ data: serialiseAsDict(data), event });
115
115
  }
116
116
  }
@@ -120,7 +120,7 @@ api.post("/runs/stream", zValidator("json", schemas.RunCreate), async (c) => {
120
120
  });
121
121
  });
122
122
  api.post("/runs/wait", zValidator("json", schemas.RunCreate), async (c) => {
123
- // Wait Run
123
+ // Wait Stateless Run
124
124
  const payload = c.req.valid("json");
125
125
  const run = await createValidRun(undefined, payload);
126
126
  return waitKeepAlive(c, Runs.wait(run.run_id, undefined));
package/dist/server.mjs CHANGED
@@ -14,6 +14,17 @@ import { logger, requestLogger } from "./logging.mjs";
14
14
  import { checkpointer } from "./storage/checkpoint.mjs";
15
15
  import { store as graphStore } from "./storage/store.mjs";
16
16
  const app = new Hono();
17
+ // This is used to match the behavior of the original LangGraph API
18
+ // where the content-type is not being validated. Might be nice
19
+ // to warn about this in the future and throw an error instead.
20
+ app.use(async (c, next) => {
21
+ if (c.req.header("content-type")?.startsWith("text/plain") &&
22
+ c.req.method !== "GET" &&
23
+ c.req.method !== "OPTIONS") {
24
+ c.req.raw.headers.set("content-type", "application/json");
25
+ }
26
+ await next();
27
+ });
17
28
  app.use(cors());
18
29
  app.use(requestLogger());
19
30
  app.route("/", assistants);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@langchain/langgraph-cli",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "type": "module",
5
5
  "engines": {
6
6
  "node": ">=18"