@langchain/langgraph-api 0.0.51 → 0.0.53
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/CHANGELOG.md +14 -0
- package/dist/api/assistants.mjs +4 -0
- package/dist/api/runs.mjs +1 -0
- package/dist/graph/load.mjs +3 -2
- package/dist/logging.d.mts +4 -1
- package/dist/logging.mjs +16 -1
- package/dist/schemas.d.mts +15 -0
- package/dist/schemas.mjs +4 -0
- package/dist/server.mjs +16 -1
- package/dist/storage/ops.d.mts +5 -0
- package/dist/storage/ops.mjs +10 -0
- package/dist/stream.mjs +1 -0
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @langchain/langgraph-api
|
|
2
2
|
|
|
3
|
+
## 0.0.53
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- f1bcec7: Add support for Context API in in-memory dev server
|
|
8
|
+
- @langchain/langgraph-ui@0.0.53
|
|
9
|
+
|
|
10
|
+
## 0.0.52
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- 030698f: feat(api): add support for injecting `langgraph_node` in structured logs, expose structlog
|
|
15
|
+
- @langchain/langgraph-ui@0.0.52
|
|
16
|
+
|
|
3
17
|
## 0.0.51
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
package/dist/api/assistants.mjs
CHANGED
|
@@ -35,6 +35,7 @@ api.post("/assistants", zValidator("json", schemas.AssistantCreate), async (c) =
|
|
|
35
35
|
const payload = c.req.valid("json");
|
|
36
36
|
const assistant = await Assistants.put(payload.assistant_id ?? uuid(), {
|
|
37
37
|
config: payload.config ?? {},
|
|
38
|
+
context: payload.context ?? {},
|
|
38
39
|
graph_id: payload.graph_id,
|
|
39
40
|
metadata: payload.metadata ?? {},
|
|
40
41
|
if_exists: payload.if_exists ?? "raise",
|
|
@@ -113,6 +114,9 @@ api.get("/assistants/:assistant_id/schemas", zValidator("json", z.object({ confi
|
|
|
113
114
|
output_schema: schema.output,
|
|
114
115
|
state_schema: schema.state,
|
|
115
116
|
config_schema: schema.config,
|
|
117
|
+
// From JS PoV `configSchema` and `contextSchema` are indistinguishable,
|
|
118
|
+
// thus we use config_schema for context_schema.
|
|
119
|
+
context_schema: schema.config,
|
|
116
120
|
});
|
|
117
121
|
});
|
|
118
122
|
api.get("/assistants/:assistant_id/subgraphs/:namespace?", zValidator("param", z.object({ assistant_id: z.string(), namespace: z.string().optional() })), zValidator("query", z.object({ recurse: schemas.coercedBoolean.optional() })), async (c) => {
|
package/dist/api/runs.mjs
CHANGED
package/dist/graph/load.mjs
CHANGED
|
@@ -25,7 +25,7 @@ export async function registerFromEnv(specs, options) {
|
|
|
25
25
|
logger.info(`Registering graph with id '${graphId}'`, {
|
|
26
26
|
graph_id: graphId,
|
|
27
27
|
});
|
|
28
|
-
const config = envConfig?.[graphId];
|
|
28
|
+
const { context, ...config } = envConfig?.[graphId] ?? {};
|
|
29
29
|
const { resolved, ...spec } = await resolveGraph(rawSpec, {
|
|
30
30
|
cwd: options.cwd,
|
|
31
31
|
});
|
|
@@ -35,7 +35,8 @@ export async function registerFromEnv(specs, options) {
|
|
|
35
35
|
await Assistants.put(uuid.v5(graphId, NAMESPACE_GRAPH), {
|
|
36
36
|
graph_id: graphId,
|
|
37
37
|
metadata: { created_by: "system" },
|
|
38
|
-
config
|
|
38
|
+
config,
|
|
39
|
+
context,
|
|
39
40
|
if_exists: "do_nothing",
|
|
40
41
|
name: graphId,
|
|
41
42
|
}, undefined);
|
package/dist/logging.d.mts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import { type Logger } from "winston";
|
|
1
2
|
import type { MiddlewareHandler } from "hono";
|
|
2
|
-
export declare const logger:
|
|
3
|
+
export declare const logger: Logger;
|
|
4
|
+
export declare function registerSdkLogger(): void;
|
|
5
|
+
export declare function registerRuntimeLogFormatter(formatter: (info: Record<string, unknown>) => Record<string, unknown>): Promise<void>;
|
|
3
6
|
export declare const logError: (error: unknown, options?: {
|
|
4
7
|
context?: Record<string, unknown>;
|
|
5
8
|
prefix?: string;
|
package/dist/logging.mjs
CHANGED
|
@@ -7,9 +7,15 @@ import { codeFrameColumns } from "@babel/code-frame";
|
|
|
7
7
|
import path from "node:path";
|
|
8
8
|
const LOG_JSON = process.env.LOG_JSON === "true";
|
|
9
9
|
const LOG_LEVEL = process.env.LOG_LEVEL || "debug";
|
|
10
|
+
let RUNTIME_LOG_FORMATTER;
|
|
11
|
+
const applyRuntimeFormatter = format((info) => {
|
|
12
|
+
if (!RUNTIME_LOG_FORMATTER)
|
|
13
|
+
return info;
|
|
14
|
+
return RUNTIME_LOG_FORMATTER(info);
|
|
15
|
+
});
|
|
10
16
|
export const logger = createLogger({
|
|
11
17
|
level: LOG_LEVEL,
|
|
12
|
-
format: format.combine(format.errors({ stack: true }), format.timestamp(), format.json(), ...(!LOG_JSON
|
|
18
|
+
format: format.combine(applyRuntimeFormatter(), format.errors({ stack: true }), format.timestamp(), format.json(), ...(!LOG_JSON
|
|
13
19
|
? [
|
|
14
20
|
format.colorize({ all: true }),
|
|
15
21
|
format.padLevels(),
|
|
@@ -44,6 +50,15 @@ export const logger = createLogger({
|
|
|
44
50
|
])),
|
|
45
51
|
transports: [new transports.Console()],
|
|
46
52
|
});
|
|
53
|
+
// Expose the logger to be consumed by `getLogger`
|
|
54
|
+
export function registerSdkLogger() {
|
|
55
|
+
const GLOBAL_LOGGER = Symbol.for("langgraph.api.sdk-logger");
|
|
56
|
+
const maybeGlobal = globalThis;
|
|
57
|
+
maybeGlobal[GLOBAL_LOGGER] = logger;
|
|
58
|
+
}
|
|
59
|
+
export async function registerRuntimeLogFormatter(formatter) {
|
|
60
|
+
RUNTIME_LOG_FORMATTER = formatter;
|
|
61
|
+
}
|
|
47
62
|
const formatStack = (stack) => {
|
|
48
63
|
if (!stack)
|
|
49
64
|
return stack;
|
package/dist/schemas.d.mts
CHANGED
|
@@ -175,11 +175,13 @@ export declare const AssistantCreate: z.ZodObject<{
|
|
|
175
175
|
thread_ts: z.ZodOptional<z.ZodString>;
|
|
176
176
|
}, z.ZodUnknown, "strip">>>;
|
|
177
177
|
}, z.ZodUnknown, "strip">>>;
|
|
178
|
+
context: z.ZodOptional<z.ZodUnknown>;
|
|
178
179
|
metadata: z.ZodOptional<z.ZodObject<{}, "strip", z.ZodUnknown, z.objectOutputType<{}, z.ZodUnknown, "strip">, z.objectInputType<{}, z.ZodUnknown, "strip">>>;
|
|
179
180
|
if_exists: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"raise">, z.ZodLiteral<"do_nothing">]>>;
|
|
180
181
|
name: z.ZodOptional<z.ZodString>;
|
|
181
182
|
}, "strip", z.ZodTypeAny, {
|
|
182
183
|
graph_id: string;
|
|
184
|
+
context?: unknown;
|
|
183
185
|
metadata?: z.objectOutputType<{}, z.ZodUnknown, "strip"> | undefined;
|
|
184
186
|
name?: string | undefined;
|
|
185
187
|
config?: z.objectOutputType<{
|
|
@@ -200,6 +202,7 @@ export declare const AssistantCreate: z.ZodObject<{
|
|
|
200
202
|
assistant_id?: string | undefined;
|
|
201
203
|
}, {
|
|
202
204
|
graph_id: string;
|
|
205
|
+
context?: unknown;
|
|
203
206
|
metadata?: z.objectInputType<{}, z.ZodUnknown, "strip"> | undefined;
|
|
204
207
|
name?: string | undefined;
|
|
205
208
|
config?: z.objectInputType<{
|
|
@@ -261,9 +264,11 @@ export declare const AssistantPatch: z.ZodObject<{
|
|
|
261
264
|
thread_ts: z.ZodOptional<z.ZodString>;
|
|
262
265
|
}, z.ZodUnknown, "strip">>>;
|
|
263
266
|
}, z.ZodUnknown, "strip">>>;
|
|
267
|
+
context: z.ZodOptional<z.ZodUnknown>;
|
|
264
268
|
name: z.ZodOptional<z.ZodString>;
|
|
265
269
|
metadata: z.ZodOptional<z.ZodObject<{}, "strip", z.ZodAny, z.objectOutputType<{}, z.ZodAny, "strip">, z.objectInputType<{}, z.ZodAny, "strip">>>;
|
|
266
270
|
}, "strip", z.ZodTypeAny, {
|
|
271
|
+
context?: unknown;
|
|
267
272
|
metadata?: z.objectOutputType<{}, z.ZodAny, "strip"> | undefined;
|
|
268
273
|
name?: string | undefined;
|
|
269
274
|
config?: z.objectOutputType<{
|
|
@@ -282,6 +287,7 @@ export declare const AssistantPatch: z.ZodObject<{
|
|
|
282
287
|
}, z.ZodUnknown, "strip"> | undefined;
|
|
283
288
|
graph_id?: string | undefined;
|
|
284
289
|
}, {
|
|
290
|
+
context?: unknown;
|
|
285
291
|
metadata?: z.objectInputType<{}, z.ZodAny, "strip"> | undefined;
|
|
286
292
|
name?: string | undefined;
|
|
287
293
|
config?: z.objectInputType<{
|
|
@@ -401,6 +407,7 @@ export declare const CronCreate: z.ZodObject<{
|
|
|
401
407
|
thread_ts: z.ZodOptional<z.ZodString>;
|
|
402
408
|
}, z.ZodUnknown, "strip">>>;
|
|
403
409
|
}, z.ZodUnknown, "strip">>>;
|
|
410
|
+
context: z.ZodOptional<z.ZodUnknown>;
|
|
404
411
|
webhook: z.ZodOptional<z.ZodString>;
|
|
405
412
|
interrupt_before: z.ZodOptional<z.ZodUnion<[z.ZodEnum<["*"]>, z.ZodArray<z.ZodString, "many">]>>;
|
|
406
413
|
interrupt_after: z.ZodOptional<z.ZodUnion<[z.ZodEnum<["*"]>, z.ZodArray<z.ZodString, "many">]>>;
|
|
@@ -408,6 +415,7 @@ export declare const CronCreate: z.ZodObject<{
|
|
|
408
415
|
}, "strip", z.ZodTypeAny, {
|
|
409
416
|
thread_id: string;
|
|
410
417
|
assistant_id: string;
|
|
418
|
+
context?: unknown;
|
|
411
419
|
metadata?: z.objectOutputType<{}, z.ZodAny, "strip"> | undefined;
|
|
412
420
|
input?: z.objectOutputType<{}, z.ZodAny, "strip">[] | z.objectOutputType<{}, z.ZodAny, "strip"> | undefined;
|
|
413
421
|
config?: z.objectOutputType<{
|
|
@@ -432,6 +440,7 @@ export declare const CronCreate: z.ZodObject<{
|
|
|
432
440
|
}, {
|
|
433
441
|
thread_id: string;
|
|
434
442
|
assistant_id: string;
|
|
443
|
+
context?: unknown;
|
|
435
444
|
metadata?: z.objectInputType<{}, z.ZodAny, "strip"> | undefined;
|
|
436
445
|
input?: z.objectInputType<{}, z.ZodAny, "strip">[] | z.objectInputType<{}, z.ZodAny, "strip"> | undefined;
|
|
437
446
|
config?: z.objectInputType<{
|
|
@@ -650,6 +659,7 @@ export declare const RunCreate: z.ZodObject<{
|
|
|
650
659
|
resume?: unknown;
|
|
651
660
|
}>>;
|
|
652
661
|
metadata: z.ZodOptional<z.ZodObject<{}, "strip", z.ZodAny, z.objectOutputType<{}, z.ZodAny, "strip">, z.objectInputType<{}, z.ZodAny, "strip">>>;
|
|
662
|
+
context: z.ZodOptional<z.ZodUnknown>;
|
|
653
663
|
config: z.ZodOptional<z.ZodObject<{
|
|
654
664
|
tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
655
665
|
recursion_limit: z.ZodOptional<z.ZodNumber>;
|
|
@@ -715,6 +725,7 @@ export declare const RunCreate: z.ZodObject<{
|
|
|
715
725
|
}, "strip", z.ZodTypeAny, {
|
|
716
726
|
assistant_id: string;
|
|
717
727
|
on_disconnect: "cancel" | "continue";
|
|
728
|
+
context?: unknown;
|
|
718
729
|
metadata?: z.objectOutputType<{}, z.ZodAny, "strip"> | undefined;
|
|
719
730
|
input?: unknown;
|
|
720
731
|
config?: z.objectOutputType<{
|
|
@@ -765,6 +776,7 @@ export declare const RunCreate: z.ZodObject<{
|
|
|
765
776
|
} | undefined;
|
|
766
777
|
}, {
|
|
767
778
|
assistant_id: string;
|
|
779
|
+
context?: unknown;
|
|
768
780
|
metadata?: z.objectInputType<{}, z.ZodAny, "strip"> | undefined;
|
|
769
781
|
input?: unknown;
|
|
770
782
|
config?: z.objectInputType<{
|
|
@@ -876,6 +888,7 @@ export declare const RunBatchCreate: z.ZodArray<z.ZodObject<{
|
|
|
876
888
|
resume?: unknown;
|
|
877
889
|
}>>;
|
|
878
890
|
metadata: z.ZodOptional<z.ZodObject<{}, "strip", z.ZodAny, z.objectOutputType<{}, z.ZodAny, "strip">, z.objectInputType<{}, z.ZodAny, "strip">>>;
|
|
891
|
+
context: z.ZodOptional<z.ZodUnknown>;
|
|
879
892
|
config: z.ZodOptional<z.ZodObject<{
|
|
880
893
|
tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
881
894
|
recursion_limit: z.ZodOptional<z.ZodNumber>;
|
|
@@ -941,6 +954,7 @@ export declare const RunBatchCreate: z.ZodArray<z.ZodObject<{
|
|
|
941
954
|
}, "strip", z.ZodTypeAny, {
|
|
942
955
|
assistant_id: string;
|
|
943
956
|
on_disconnect: "cancel" | "continue";
|
|
957
|
+
context?: unknown;
|
|
944
958
|
metadata?: z.objectOutputType<{}, z.ZodAny, "strip"> | undefined;
|
|
945
959
|
input?: unknown;
|
|
946
960
|
config?: z.objectOutputType<{
|
|
@@ -991,6 +1005,7 @@ export declare const RunBatchCreate: z.ZodArray<z.ZodObject<{
|
|
|
991
1005
|
} | undefined;
|
|
992
1006
|
}, {
|
|
993
1007
|
assistant_id: string;
|
|
1008
|
+
context?: unknown;
|
|
994
1009
|
metadata?: z.objectInputType<{}, z.ZodAny, "strip"> | undefined;
|
|
995
1010
|
input?: unknown;
|
|
996
1011
|
config?: z.objectInputType<{
|
package/dist/schemas.mjs
CHANGED
|
@@ -30,6 +30,7 @@ export const AssistantCreate = z
|
|
|
30
30
|
.optional(),
|
|
31
31
|
graph_id: z.string().describe("The graph to use."),
|
|
32
32
|
config: AssistantConfig.optional(),
|
|
33
|
+
context: z.unknown().optional(),
|
|
33
34
|
metadata: z
|
|
34
35
|
.object({})
|
|
35
36
|
.catchall(z.unknown())
|
|
@@ -45,6 +46,7 @@ export const AssistantPatch = z
|
|
|
45
46
|
.object({
|
|
46
47
|
graph_id: z.string().describe("The graph to use.").optional(),
|
|
47
48
|
config: AssistantConfig.optional(),
|
|
49
|
+
context: z.unknown().optional(),
|
|
48
50
|
name: z.string().optional(),
|
|
49
51
|
metadata: z
|
|
50
52
|
.object({})
|
|
@@ -89,6 +91,7 @@ export const CronCreate = z
|
|
|
89
91
|
.describe("Metadata for the run.")
|
|
90
92
|
.optional(),
|
|
91
93
|
config: AssistantConfig.optional(),
|
|
94
|
+
context: z.unknown().optional(),
|
|
92
95
|
webhook: z.string().optional(),
|
|
93
96
|
interrupt_before: z.union([z.enum(["*"]), z.array(z.string())]).optional(),
|
|
94
97
|
interrupt_after: z.union([z.enum(["*"]), z.array(z.string())]).optional(),
|
|
@@ -175,6 +178,7 @@ export const RunCreate = z
|
|
|
175
178
|
.catchall(z.any())
|
|
176
179
|
.describe("Metadata for the run.")
|
|
177
180
|
.optional(),
|
|
181
|
+
context: z.unknown().optional(),
|
|
178
182
|
config: AssistantConfig.optional(),
|
|
179
183
|
webhook: z.string().optional(),
|
|
180
184
|
interrupt_before: z.union([z.enum(["*"]), z.array(z.string())]).optional(),
|
package/dist/server.mjs
CHANGED
|
@@ -10,7 +10,7 @@ import { truncate, conn as opsConn } from "./storage/ops.mjs";
|
|
|
10
10
|
import { zValidator } from "@hono/zod-validator";
|
|
11
11
|
import { z } from "zod";
|
|
12
12
|
import { queue } from "./queue.mjs";
|
|
13
|
-
import { logger, requestLogger } from "./logging.mjs";
|
|
13
|
+
import { logger, requestLogger, registerRuntimeLogFormatter, registerSdkLogger, } from "./logging.mjs";
|
|
14
14
|
import { checkpointer } from "./storage/checkpoint.mjs";
|
|
15
15
|
import { store as graphStore } from "./storage/store.mjs";
|
|
16
16
|
import { auth } from "./auth/custom.mjs";
|
|
@@ -74,8 +74,23 @@ export async function startServer(options) {
|
|
|
74
74
|
logger.info(`Flushing to persistent storage, exiting...`);
|
|
75
75
|
await Promise.all(callbacks.map((c) => c.flush()));
|
|
76
76
|
};
|
|
77
|
+
// Register global logger that can be consumed via SDK
|
|
78
|
+
// We need to do this before we load the graphs in-case the logger is obtained at top-level.
|
|
79
|
+
registerSdkLogger();
|
|
77
80
|
logger.info(`Registering graphs from ${options.cwd}`);
|
|
78
81
|
await registerFromEnv(options.graphs, { cwd: options.cwd });
|
|
82
|
+
// Make sure to register the runtime formatter after we've loaded the graphs
|
|
83
|
+
// to ensure that we're not loading `@langchain/langgraph` from different path.
|
|
84
|
+
const { getConfig } = await import("@langchain/langgraph");
|
|
85
|
+
registerRuntimeLogFormatter((info) => {
|
|
86
|
+
const config = getConfig();
|
|
87
|
+
if (config == null)
|
|
88
|
+
return info;
|
|
89
|
+
const node = config.metadata?.["langgraph_node"];
|
|
90
|
+
if (node != null)
|
|
91
|
+
info.langgraph_node = node;
|
|
92
|
+
return info;
|
|
93
|
+
});
|
|
79
94
|
const app = new Hono();
|
|
80
95
|
// Loopback fetch used by webhooks and custom routes
|
|
81
96
|
bindLoopbackFetch(app);
|
package/dist/storage/ops.d.mts
CHANGED
|
@@ -27,6 +27,7 @@ interface Assistant {
|
|
|
27
27
|
updated_at: Date;
|
|
28
28
|
version: number;
|
|
29
29
|
config: RunnableConfig;
|
|
30
|
+
context: unknown;
|
|
30
31
|
metadata: Metadata;
|
|
31
32
|
}
|
|
32
33
|
interface AssistantVersion {
|
|
@@ -34,6 +35,7 @@ interface AssistantVersion {
|
|
|
34
35
|
version: number;
|
|
35
36
|
graph_id: string;
|
|
36
37
|
config: RunnableConfig;
|
|
38
|
+
context: unknown;
|
|
37
39
|
metadata: Metadata;
|
|
38
40
|
created_at: Date;
|
|
39
41
|
name: string | undefined;
|
|
@@ -45,6 +47,7 @@ export interface RunKwargs {
|
|
|
45
47
|
interrupt_before?: "*" | string[] | undefined;
|
|
46
48
|
interrupt_after?: "*" | string[] | undefined;
|
|
47
49
|
config?: RunnableConfig;
|
|
50
|
+
context?: unknown;
|
|
48
51
|
subgraphs?: boolean;
|
|
49
52
|
resumable?: boolean;
|
|
50
53
|
temporary?: boolean;
|
|
@@ -126,6 +129,7 @@ export declare class Assistants {
|
|
|
126
129
|
static get(assistant_id: string, auth: AuthContext | undefined): Promise<Assistant>;
|
|
127
130
|
static put(assistant_id: string, options: {
|
|
128
131
|
config: RunnableConfig;
|
|
132
|
+
context: unknown;
|
|
129
133
|
graph_id: string;
|
|
130
134
|
metadata?: Metadata;
|
|
131
135
|
if_exists: OnConflictBehavior;
|
|
@@ -133,6 +137,7 @@ export declare class Assistants {
|
|
|
133
137
|
}, auth: AuthContext | undefined): Promise<Assistant>;
|
|
134
138
|
static patch(assistantId: string, options: {
|
|
135
139
|
config?: RunnableConfig;
|
|
140
|
+
context?: unknown;
|
|
136
141
|
graph_id?: string;
|
|
137
142
|
metadata?: Metadata;
|
|
138
143
|
name?: string;
|
package/dist/storage/ops.mjs
CHANGED
|
@@ -208,6 +208,7 @@ export class Assistants {
|
|
|
208
208
|
const [filters, mutable] = await handleAuthEvent(auth, "assistants:create", {
|
|
209
209
|
assistant_id,
|
|
210
210
|
config: options.config,
|
|
211
|
+
context: options.context,
|
|
211
212
|
graph_id: options.graph_id,
|
|
212
213
|
metadata: options.metadata,
|
|
213
214
|
if_exists: options.if_exists,
|
|
@@ -229,6 +230,7 @@ export class Assistants {
|
|
|
229
230
|
assistant_id: assistant_id,
|
|
230
231
|
version: 1,
|
|
231
232
|
config: options.config ?? {},
|
|
233
|
+
context: options.context ?? {},
|
|
232
234
|
created_at: now,
|
|
233
235
|
updated_at: now,
|
|
234
236
|
graph_id: options.graph_id,
|
|
@@ -240,6 +242,7 @@ export class Assistants {
|
|
|
240
242
|
version: 1,
|
|
241
243
|
graph_id: options.graph_id,
|
|
242
244
|
config: options.config ?? {},
|
|
245
|
+
context: options.context ?? {},
|
|
243
246
|
metadata: mutable.metadata ?? {},
|
|
244
247
|
created_at: now,
|
|
245
248
|
name: options.name || options.graph_id,
|
|
@@ -276,6 +279,9 @@ export class Assistants {
|
|
|
276
279
|
if (options?.config != null) {
|
|
277
280
|
assistant["config"] = options?.config ?? assistant["config"];
|
|
278
281
|
}
|
|
282
|
+
if (options?.context != null) {
|
|
283
|
+
assistant["context"] = options?.context ?? assistant["context"];
|
|
284
|
+
}
|
|
279
285
|
if (options?.name != null) {
|
|
280
286
|
assistant["name"] = options?.name ?? assistant["name"];
|
|
281
287
|
}
|
|
@@ -292,6 +298,7 @@ export class Assistants {
|
|
|
292
298
|
version: newVersion,
|
|
293
299
|
graph_id: options?.graph_id ?? assistant["graph_id"],
|
|
294
300
|
config: options?.config ?? assistant["config"],
|
|
301
|
+
context: options?.context ?? assistant["context"],
|
|
295
302
|
name: options?.name ?? assistant["name"],
|
|
296
303
|
metadata: metadata ?? assistant["metadata"],
|
|
297
304
|
created_at: now,
|
|
@@ -878,6 +885,9 @@ export class Runs {
|
|
|
878
885
|
status: status,
|
|
879
886
|
kwargs: Object.assign({}, kwargs, {
|
|
880
887
|
config: Object.assign({}, assistant.config, config, { configurable }, { metadata: mergedMetadata }),
|
|
888
|
+
context: typeof assistant.context !== "object" && assistant.context != null
|
|
889
|
+
? assistant.context ?? kwargs.context
|
|
890
|
+
: Object.assign({}, assistant.context, kwargs.context),
|
|
881
891
|
}),
|
|
882
892
|
multitask_strategy: multitaskStrategy,
|
|
883
893
|
created_at: new Date(now.valueOf() + afterSeconds * 1000),
|
package/dist/stream.mjs
CHANGED
|
@@ -108,6 +108,7 @@ export async function* streamState(run, options) {
|
|
|
108
108
|
interruptAfter: kwargs.interrupt_after,
|
|
109
109
|
interruptBefore: kwargs.interrupt_before,
|
|
110
110
|
tags: kwargs.config?.tags,
|
|
111
|
+
context: kwargs.context,
|
|
111
112
|
configurable: kwargs.config?.configurable,
|
|
112
113
|
recursionLimit: kwargs.config?.recursion_limit,
|
|
113
114
|
subgraphs: kwargs.subgraphs,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@langchain/langgraph-api",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.53",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": "^18.19.0 || >=20.16.0"
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"@babel/code-frame": "^7.26.2",
|
|
53
53
|
"@hono/node-server": "^1.12.0",
|
|
54
54
|
"@hono/zod-validator": "^0.2.2",
|
|
55
|
-
"@langchain/langgraph-ui": "0.0.
|
|
55
|
+
"@langchain/langgraph-ui": "0.0.53",
|
|
56
56
|
"@types/json-schema": "^7.0.15",
|
|
57
57
|
"@typescript/vfs": "^1.6.0",
|
|
58
58
|
"dedent": "^1.5.3",
|
|
@@ -72,9 +72,9 @@
|
|
|
72
72
|
},
|
|
73
73
|
"peerDependencies": {
|
|
74
74
|
"@langchain/core": "^0.3.59",
|
|
75
|
-
"@langchain/langgraph": "^0.2.57 || ^0.3.0",
|
|
76
|
-
"@langchain/langgraph-checkpoint": "~0.0.16",
|
|
77
|
-
"@langchain/langgraph-sdk": "~0.0.70",
|
|
75
|
+
"@langchain/langgraph": "^0.2.57 || ^0.3.0 || ^0.4.0",
|
|
76
|
+
"@langchain/langgraph-checkpoint": "~0.0.16 || ^0.1.0",
|
|
77
|
+
"@langchain/langgraph-sdk": "~0.0.70 || ^0.1.0",
|
|
78
78
|
"typescript": "^5.5.4"
|
|
79
79
|
},
|
|
80
80
|
"peerDependenciesMeta": {
|
|
@@ -84,9 +84,9 @@
|
|
|
84
84
|
},
|
|
85
85
|
"devDependencies": {
|
|
86
86
|
"@langchain/core": "^0.3.59",
|
|
87
|
-
"@langchain/langgraph": "0.
|
|
88
|
-
"@langchain/langgraph-checkpoint": "0.0
|
|
89
|
-
"@langchain/langgraph-sdk": "0.0.
|
|
87
|
+
"@langchain/langgraph": "0.4.0",
|
|
88
|
+
"@langchain/langgraph-checkpoint": "0.1.0",
|
|
89
|
+
"@langchain/langgraph-sdk": "0.0.103",
|
|
90
90
|
"@types/babel__code-frame": "^7.0.6",
|
|
91
91
|
"@types/node": "^18.15.11",
|
|
92
92
|
"@types/react": "^19.0.8",
|