@langchain/langgraph-api 1.1.13 → 1.1.15
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/assistants.mjs +1 -1
- package/dist/api/runs.mjs +2 -2
- package/dist/api/threads.mjs +2 -2
- package/dist/experimental/embed.mjs +4 -4
- package/dist/graph/parser/schema/types.template.mts +11 -3
- package/dist/schemas.d.mts +6 -6
- package/dist/schemas.mjs +2 -0
- package/dist/storage/ops.mjs +3 -3
- package/dist/storage/types.d.mts +1 -1
- package/package.json +6 -6
package/dist/api/assistants.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { zValidator } from "@hono/zod-validator";
|
|
2
2
|
import { Hono } from "hono";
|
|
3
|
-
import {
|
|
3
|
+
import { v7 as uuid } from "uuid";
|
|
4
4
|
import { z } from "zod/v3";
|
|
5
5
|
import { getAssistantId, getCachedStaticGraphSchema, getGraph, } from "../graph/load.mjs";
|
|
6
6
|
import { getRuntimeGraphSchema } from "../graph/parser/index.mjs";
|
package/dist/api/runs.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import { zValidator } from "@hono/zod-validator";
|
|
|
2
2
|
import { Hono } from "hono";
|
|
3
3
|
import { HTTPException } from "hono/http-exception";
|
|
4
4
|
import { streamSSE } from "hono/streaming";
|
|
5
|
-
import {
|
|
5
|
+
import { v7 as uuid7 } from "uuid";
|
|
6
6
|
import { z } from "zod/v3";
|
|
7
7
|
import { getAssistantId } from "../graph/load.mjs";
|
|
8
8
|
import { logError, logger } from "../logging.mjs";
|
|
@@ -14,7 +14,7 @@ const api = new Hono();
|
|
|
14
14
|
const createValidRun = async (threadId, payload, kwargs) => {
|
|
15
15
|
const { assistant_id: assistantId, ...run } = payload;
|
|
16
16
|
const { auth, headers } = kwargs ?? {};
|
|
17
|
-
const runId =
|
|
17
|
+
const runId = uuid7();
|
|
18
18
|
const streamMode = Array.isArray(payload.stream_mode)
|
|
19
19
|
? payload.stream_mode
|
|
20
20
|
: payload.stream_mode != null
|
package/dist/api/threads.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { zValidator } from "@hono/zod-validator";
|
|
2
2
|
import { Hono } from "hono";
|
|
3
|
-
import {
|
|
3
|
+
import { v7 as uuid7 } from "uuid";
|
|
4
4
|
import { z } from "zod/v3";
|
|
5
5
|
import * as schemas from "../schemas.mjs";
|
|
6
6
|
import { stateSnapshotToThreadState } from "../state.mjs";
|
|
@@ -11,7 +11,7 @@ const api = new Hono();
|
|
|
11
11
|
api.post("/threads", zValidator("json", schemas.ThreadCreate), async (c) => {
|
|
12
12
|
// Create Thread
|
|
13
13
|
const payload = c.req.valid("json");
|
|
14
|
-
const thread = await threads().put(payload.thread_id ||
|
|
14
|
+
const thread = await threads().put(payload.thread_id || uuid7(), { metadata: payload.metadata, if_exists: payload.if_exists ?? "raise" }, c.var.auth);
|
|
15
15
|
if (payload.supersteps?.length) {
|
|
16
16
|
await threads().state.bulk({ configurable: { thread_id: thread.thread_id } }, payload.supersteps, c.var.auth);
|
|
17
17
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Hono } from "hono";
|
|
2
2
|
import { zValidator } from "@hono/zod-validator";
|
|
3
3
|
import { streamSSE } from "hono/streaming";
|
|
4
|
-
import {
|
|
4
|
+
import { v7 as uuidv7 } from "uuid";
|
|
5
5
|
import * as schemas from "../schemas.mjs";
|
|
6
6
|
import { z } from "zod/v3";
|
|
7
7
|
import { streamState } from "../stream.mjs";
|
|
@@ -11,7 +11,7 @@ import { stateSnapshotToThreadState } from "../state.mjs";
|
|
|
11
11
|
import { ensureContentType } from "../http/middleware.mjs";
|
|
12
12
|
function createStubRun(threadId, payload) {
|
|
13
13
|
const now = new Date();
|
|
14
|
-
const runId =
|
|
14
|
+
const runId = uuidv7();
|
|
15
15
|
let streamMode = Array.isArray(payload.stream_mode)
|
|
16
16
|
? payload.stream_mode
|
|
17
17
|
: payload.stream_mode
|
|
@@ -76,7 +76,7 @@ export function createEmbedServer(options) {
|
|
|
76
76
|
api.post("/threads", zValidator("json", schemas.ThreadCreate), async (c) => {
|
|
77
77
|
// create a new thread
|
|
78
78
|
const payload = c.req.valid("json");
|
|
79
|
-
const threadId = payload.thread_id ||
|
|
79
|
+
const threadId = payload.thread_id || uuidv7();
|
|
80
80
|
return jsonExtra(c, await options.threads.set(threadId, {
|
|
81
81
|
kind: "put",
|
|
82
82
|
metadata: payload.metadata,
|
|
@@ -261,7 +261,7 @@ export function createEmbedServer(options) {
|
|
|
261
261
|
return streamSSE(c, async (stream) => {
|
|
262
262
|
const payload = c.req.valid("json");
|
|
263
263
|
const signal = getDisconnectAbortSignal(c, stream);
|
|
264
|
-
const threadId =
|
|
264
|
+
const threadId = uuidv7();
|
|
265
265
|
await options.threads.set(threadId, {
|
|
266
266
|
kind: "put",
|
|
267
267
|
metadata: {
|
|
@@ -35,6 +35,8 @@ type Defactorify<T> = T extends (...args: any[]) => infer R
|
|
|
35
35
|
? Awaited<R>
|
|
36
36
|
: Awaited<T>;
|
|
37
37
|
|
|
38
|
+
type StripOverwrite<T> = Exclude<T, { __overwrite__: any }>;
|
|
39
|
+
|
|
38
40
|
// @ts-ignore
|
|
39
41
|
type Inspect<T, TDepth extends Array<0> = []> = TDepth extends [0, 0, 0]
|
|
40
42
|
? any
|
|
@@ -42,11 +44,17 @@ type Inspect<T, TDepth extends Array<0> = []> = TDepth extends [0, 0, 0]
|
|
|
42
44
|
? {
|
|
43
45
|
[K in keyof T]: 0 extends 1 & T[K]
|
|
44
46
|
? T[K]
|
|
45
|
-
: Equals<
|
|
47
|
+
: Equals<
|
|
48
|
+
MatchBaseMessageArray<StripOverwrite<T[K]>>,
|
|
49
|
+
BaseMessage[]
|
|
50
|
+
> extends true
|
|
46
51
|
? BaseMessage[]
|
|
47
|
-
: Equals<
|
|
52
|
+
: Equals<
|
|
53
|
+
MatchBaseMessage<StripOverwrite<T[K]>>,
|
|
54
|
+
BaseMessage
|
|
55
|
+
> extends true
|
|
48
56
|
? BaseMessage
|
|
49
|
-
: Inspect<T[K]
|
|
57
|
+
: Inspect<StripOverwrite<T[K]>, [0, ...TDepth]>;
|
|
50
58
|
}
|
|
51
59
|
: never;
|
|
52
60
|
|
package/dist/schemas.d.mts
CHANGED
|
@@ -711,7 +711,7 @@ export declare const RunCreate: z.ZodObject<{
|
|
|
711
711
|
interrupt_after: z.ZodOptional<z.ZodUnion<[z.ZodEnum<["*"]>, z.ZodArray<z.ZodString, "many">]>>;
|
|
712
712
|
on_disconnect: z.ZodDefault<z.ZodOptional<z.ZodEnum<["cancel", "continue"]>>>;
|
|
713
713
|
multitask_strategy: z.ZodOptional<z.ZodEnum<["reject", "rollback", "interrupt", "enqueue"]>>;
|
|
714
|
-
stream_mode: z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodEnum<["values", "messages", "messages-tuple", "updates", "events", "tasks", "checkpoints", "debug", "custom"]>, "many">, z.ZodEnum<["values", "messages", "messages-tuple", "updates", "events", "tasks", "checkpoints", "debug", "custom"]>]>>;
|
|
714
|
+
stream_mode: z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodEnum<["values", "messages", "messages-tuple", "updates", "events", "tasks", "checkpoints", "debug", "custom", "tools"]>, "many">, z.ZodEnum<["values", "messages", "messages-tuple", "updates", "events", "tasks", "checkpoints", "debug", "custom", "tools"]>]>>;
|
|
715
715
|
stream_subgraphs: z.ZodOptional<z.ZodBoolean>;
|
|
716
716
|
stream_resumable: z.ZodOptional<z.ZodBoolean>;
|
|
717
717
|
after_seconds: z.ZodOptional<z.ZodNumber>;
|
|
@@ -759,7 +759,7 @@ export declare const RunCreate: z.ZodObject<{
|
|
|
759
759
|
input?: unknown;
|
|
760
760
|
})[] | undefined;
|
|
761
761
|
} | undefined;
|
|
762
|
-
stream_mode?: "values" | "debug" | "messages" | "messages-tuple" | "custom" | "updates" | "events" | "tasks" | "checkpoints" | ("values" | "debug" | "messages" | "messages-tuple" | "custom" | "updates" | "events" | "tasks" | "checkpoints")[] | undefined;
|
|
762
|
+
stream_mode?: "values" | "debug" | "messages" | "messages-tuple" | "custom" | "updates" | "events" | "tasks" | "checkpoints" | "tools" | ("values" | "debug" | "messages" | "messages-tuple" | "custom" | "updates" | "events" | "tasks" | "checkpoints" | "tools")[] | undefined;
|
|
763
763
|
interrupt_before?: string[] | "*" | undefined;
|
|
764
764
|
interrupt_after?: string[] | "*" | undefined;
|
|
765
765
|
webhook?: string | undefined;
|
|
@@ -810,7 +810,7 @@ export declare const RunCreate: z.ZodObject<{
|
|
|
810
810
|
input?: unknown;
|
|
811
811
|
})[] | undefined;
|
|
812
812
|
} | undefined;
|
|
813
|
-
stream_mode?: "values" | "debug" | "messages" | "messages-tuple" | "custom" | "updates" | "events" | "tasks" | "checkpoints" | ("values" | "debug" | "messages" | "messages-tuple" | "custom" | "updates" | "events" | "tasks" | "checkpoints")[] | undefined;
|
|
813
|
+
stream_mode?: "values" | "debug" | "messages" | "messages-tuple" | "custom" | "updates" | "events" | "tasks" | "checkpoints" | "tools" | ("values" | "debug" | "messages" | "messages-tuple" | "custom" | "updates" | "events" | "tasks" | "checkpoints" | "tools")[] | undefined;
|
|
814
814
|
interrupt_before?: string[] | "*" | undefined;
|
|
815
815
|
interrupt_after?: string[] | "*" | undefined;
|
|
816
816
|
webhook?: string | undefined;
|
|
@@ -940,7 +940,7 @@ export declare const RunBatchCreate: z.ZodArray<z.ZodObject<{
|
|
|
940
940
|
interrupt_after: z.ZodOptional<z.ZodUnion<[z.ZodEnum<["*"]>, z.ZodArray<z.ZodString, "many">]>>;
|
|
941
941
|
on_disconnect: z.ZodDefault<z.ZodOptional<z.ZodEnum<["cancel", "continue"]>>>;
|
|
942
942
|
multitask_strategy: z.ZodOptional<z.ZodEnum<["reject", "rollback", "interrupt", "enqueue"]>>;
|
|
943
|
-
stream_mode: z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodEnum<["values", "messages", "messages-tuple", "updates", "events", "tasks", "checkpoints", "debug", "custom"]>, "many">, z.ZodEnum<["values", "messages", "messages-tuple", "updates", "events", "tasks", "checkpoints", "debug", "custom"]>]>>;
|
|
943
|
+
stream_mode: z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodEnum<["values", "messages", "messages-tuple", "updates", "events", "tasks", "checkpoints", "debug", "custom", "tools"]>, "many">, z.ZodEnum<["values", "messages", "messages-tuple", "updates", "events", "tasks", "checkpoints", "debug", "custom", "tools"]>]>>;
|
|
944
944
|
stream_subgraphs: z.ZodOptional<z.ZodBoolean>;
|
|
945
945
|
stream_resumable: z.ZodOptional<z.ZodBoolean>;
|
|
946
946
|
after_seconds: z.ZodOptional<z.ZodNumber>;
|
|
@@ -988,7 +988,7 @@ export declare const RunBatchCreate: z.ZodArray<z.ZodObject<{
|
|
|
988
988
|
input?: unknown;
|
|
989
989
|
})[] | undefined;
|
|
990
990
|
} | undefined;
|
|
991
|
-
stream_mode?: "values" | "debug" | "messages" | "messages-tuple" | "custom" | "updates" | "events" | "tasks" | "checkpoints" | ("values" | "debug" | "messages" | "messages-tuple" | "custom" | "updates" | "events" | "tasks" | "checkpoints")[] | undefined;
|
|
991
|
+
stream_mode?: "values" | "debug" | "messages" | "messages-tuple" | "custom" | "updates" | "events" | "tasks" | "checkpoints" | "tools" | ("values" | "debug" | "messages" | "messages-tuple" | "custom" | "updates" | "events" | "tasks" | "checkpoints" | "tools")[] | undefined;
|
|
992
992
|
interrupt_before?: string[] | "*" | undefined;
|
|
993
993
|
interrupt_after?: string[] | "*" | undefined;
|
|
994
994
|
webhook?: string | undefined;
|
|
@@ -1039,7 +1039,7 @@ export declare const RunBatchCreate: z.ZodArray<z.ZodObject<{
|
|
|
1039
1039
|
input?: unknown;
|
|
1040
1040
|
})[] | undefined;
|
|
1041
1041
|
} | undefined;
|
|
1042
|
-
stream_mode?: "values" | "debug" | "messages" | "messages-tuple" | "custom" | "updates" | "events" | "tasks" | "checkpoints" | ("values" | "debug" | "messages" | "messages-tuple" | "custom" | "updates" | "events" | "tasks" | "checkpoints")[] | undefined;
|
|
1042
|
+
stream_mode?: "values" | "debug" | "messages" | "messages-tuple" | "custom" | "updates" | "events" | "tasks" | "checkpoints" | "tools" | ("values" | "debug" | "messages" | "messages-tuple" | "custom" | "updates" | "events" | "tasks" | "checkpoints" | "tools")[] | undefined;
|
|
1043
1043
|
interrupt_before?: string[] | "*" | undefined;
|
|
1044
1044
|
interrupt_after?: string[] | "*" | undefined;
|
|
1045
1045
|
webhook?: string | undefined;
|
package/dist/schemas.mjs
CHANGED
|
@@ -204,6 +204,7 @@ export const RunCreate = z
|
|
|
204
204
|
"checkpoints",
|
|
205
205
|
"debug",
|
|
206
206
|
"custom",
|
|
207
|
+
"tools",
|
|
207
208
|
])),
|
|
208
209
|
z.enum([
|
|
209
210
|
"values",
|
|
@@ -215,6 +216,7 @@ export const RunCreate = z
|
|
|
215
216
|
"checkpoints",
|
|
216
217
|
"debug",
|
|
217
218
|
"custom",
|
|
219
|
+
"tools",
|
|
218
220
|
]),
|
|
219
221
|
])
|
|
220
222
|
.optional(),
|
package/dist/storage/ops.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { HTTPException } from "hono/http-exception";
|
|
2
|
-
import {
|
|
2
|
+
import { v7 as uuid7, v5 as uuid5 } from "uuid";
|
|
3
3
|
import { handleAuthEvent, isAuthMatching } from "../auth/index.mjs";
|
|
4
4
|
import { getLangGraphCommand } from "../command.mjs";
|
|
5
5
|
import { getGraph, NAMESPACE_GRAPH } from "../graph/load.mjs";
|
|
@@ -650,7 +650,7 @@ export class FileSystemThreads {
|
|
|
650
650
|
}
|
|
651
651
|
return thread;
|
|
652
652
|
});
|
|
653
|
-
const newThreadId =
|
|
653
|
+
const newThreadId = uuid7();
|
|
654
654
|
const now = new Date();
|
|
655
655
|
const newMetadata = { ...fromThread.metadata, thread_id: newThreadId };
|
|
656
656
|
await handleAuthEvent(auth, "threads:create", {
|
|
@@ -948,7 +948,7 @@ export class FileSystemRuns {
|
|
|
948
948
|
}
|
|
949
949
|
const now = new Date();
|
|
950
950
|
if (!existingThread && (threadId == null || ifNotExists === "create")) {
|
|
951
|
-
threadId ??=
|
|
951
|
+
threadId ??= uuid7();
|
|
952
952
|
const thread = {
|
|
953
953
|
thread_id: threadId,
|
|
954
954
|
status: "busy",
|
package/dist/storage/types.d.mts
CHANGED
|
@@ -12,7 +12,7 @@ export type AssistantSelectField = "assistant_id" | "graph_id" | "name" | "descr
|
|
|
12
12
|
export type ThreadSelectField = "thread_id" | "created_at" | "updated_at" | "metadata" | "config" | "context" | "status" | "values" | "interrupts";
|
|
13
13
|
export type ThreadStatus = "idle" | "busy" | "interrupted" | "error";
|
|
14
14
|
export type RunStatus = "pending" | "running" | "error" | "success" | "timeout" | "interrupted";
|
|
15
|
-
export type StreamMode = "values" | "messages" | "messages-tuple" | "custom" | "updates" | "events" | "debug" | "tasks" | "checkpoints";
|
|
15
|
+
export type StreamMode = "values" | "messages" | "messages-tuple" | "custom" | "updates" | "events" | "debug" | "tasks" | "checkpoints" | "tools";
|
|
16
16
|
export type MultitaskStrategy = "reject" | "rollback" | "interrupt" | "enqueue";
|
|
17
17
|
export type OnConflictBehavior = "raise" | "do_nothing";
|
|
18
18
|
export type IfNotExists = "create" | "reject";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@langchain/langgraph-api",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.15",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": "^18.19.0 || >=20.16.0"
|
|
@@ -70,13 +70,13 @@
|
|
|
70
70
|
"winston": "^3.17.0",
|
|
71
71
|
"winston-console-format": "^1.0.8",
|
|
72
72
|
"zod": "^3.25.76 || ^4",
|
|
73
|
-
"@langchain/langgraph-ui": "1.1.
|
|
73
|
+
"@langchain/langgraph-ui": "1.1.15"
|
|
74
74
|
},
|
|
75
75
|
"peerDependencies": {
|
|
76
76
|
"@langchain/core": "^0.3.59 || ^1.0.1",
|
|
77
77
|
"@langchain/langgraph": "^0.2.57 || ^0.3.0 || ^0.4.0 || ^1.0.0-alpha || ^1.0.0",
|
|
78
78
|
"@langchain/langgraph-checkpoint": "~0.0.16 || ^0.1.0 || ~1.0.0",
|
|
79
|
-
"@langchain/langgraph-sdk": "~
|
|
79
|
+
"@langchain/langgraph-sdk": "~1.6.5",
|
|
80
80
|
"typescript": "^5.5.4"
|
|
81
81
|
},
|
|
82
82
|
"peerDependenciesMeta": {
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
}
|
|
86
86
|
},
|
|
87
87
|
"devDependencies": {
|
|
88
|
-
"@langchain/core": "^1.1.
|
|
88
|
+
"@langchain/core": "^1.1.28",
|
|
89
89
|
"@types/babel__code-frame": "^7.0.6",
|
|
90
90
|
"@types/node": "^18.15.11",
|
|
91
91
|
"@types/react": "^19.0.8",
|
|
@@ -98,9 +98,9 @@
|
|
|
98
98
|
"typescript": "^4.9.5 || ^5.4.5",
|
|
99
99
|
"vitest": "^3.2.4",
|
|
100
100
|
"wait-port": "^1.1.0",
|
|
101
|
-
"@langchain/langgraph": "1.1
|
|
101
|
+
"@langchain/langgraph": "1.2.1",
|
|
102
102
|
"@langchain/langgraph-checkpoint": "1.0.0",
|
|
103
|
-
"@langchain/langgraph-sdk": "1.6.
|
|
103
|
+
"@langchain/langgraph-sdk": "1.6.5"
|
|
104
104
|
},
|
|
105
105
|
"scripts": {
|
|
106
106
|
"clean": "rm -rf dist/ .turbo/ ./tests/graphs/.langgraph_api/",
|