@langchain/langgraph-api 1.1.2 → 1.1.8

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.
Files changed (100) hide show
  1. package/package.json +9 -8
  2. package/CHANGELOG.md +0 -297
  3. package/dist/api/assistants.d.mts +0 -3
  4. package/dist/api/assistants.mjs +0 -193
  5. package/dist/api/meta.d.mts +0 -3
  6. package/dist/api/meta.mjs +0 -65
  7. package/dist/api/runs.d.mts +0 -3
  8. package/dist/api/runs.mjs +0 -324
  9. package/dist/api/store.d.mts +0 -3
  10. package/dist/api/store.mjs +0 -111
  11. package/dist/api/threads.d.mts +0 -3
  12. package/dist/api/threads.mjs +0 -143
  13. package/dist/auth/custom.d.mts +0 -9
  14. package/dist/auth/custom.mjs +0 -32
  15. package/dist/auth/index.d.mts +0 -43
  16. package/dist/auth/index.mjs +0 -163
  17. package/dist/cli/entrypoint.d.mts +0 -1
  18. package/dist/cli/entrypoint.mjs +0 -41
  19. package/dist/cli/spawn.d.mts +0 -42
  20. package/dist/cli/spawn.mjs +0 -47
  21. package/dist/cli/utils/ipc/client.d.mts +0 -5
  22. package/dist/cli/utils/ipc/client.mjs +0 -47
  23. package/dist/cli/utils/ipc/utils/get-pipe-path.d.mts +0 -1
  24. package/dist/cli/utils/ipc/utils/get-pipe-path.mjs +0 -29
  25. package/dist/cli/utils/ipc/utils/temporary-directory.d.mts +0 -5
  26. package/dist/cli/utils/ipc/utils/temporary-directory.mjs +0 -40
  27. package/dist/command.d.mts +0 -11
  28. package/dist/command.mjs +0 -15
  29. package/dist/experimental/embed.d.mts +0 -42
  30. package/dist/experimental/embed.mjs +0 -299
  31. package/dist/graph/api.d.mts +0 -1
  32. package/dist/graph/api.mjs +0 -2
  33. package/dist/graph/load.d.mts +0 -19
  34. package/dist/graph/load.hooks.d.mts +0 -2
  35. package/dist/graph/load.hooks.mjs +0 -52
  36. package/dist/graph/load.mjs +0 -96
  37. package/dist/graph/load.utils.d.mts +0 -22
  38. package/dist/graph/load.utils.mjs +0 -49
  39. package/dist/graph/parser/index.d.mts +0 -23
  40. package/dist/graph/parser/index.mjs +0 -58
  41. package/dist/graph/parser/parser.d.mts +0 -77
  42. package/dist/graph/parser/parser.mjs +0 -429
  43. package/dist/graph/parser/parser.worker.d.mts +0 -1
  44. package/dist/graph/parser/parser.worker.mjs +0 -7
  45. package/dist/graph/parser/schema/types.d.mts +0 -154
  46. package/dist/graph/parser/schema/types.mjs +0 -1496
  47. package/dist/graph/parser/schema/types.template.d.mts +0 -1
  48. package/dist/graph/parser/schema/types.template.mts +0 -92
  49. package/dist/http/custom.d.mts +0 -6
  50. package/dist/http/custom.mjs +0 -10
  51. package/dist/http/middleware.d.mts +0 -11
  52. package/dist/http/middleware.mjs +0 -57
  53. package/dist/logging.d.mts +0 -10
  54. package/dist/logging.mjs +0 -115
  55. package/dist/loopback.d.mts +0 -4
  56. package/dist/loopback.mjs +0 -10
  57. package/dist/preload.d.mts +0 -1
  58. package/dist/preload.mjs +0 -29
  59. package/dist/queue.d.mts +0 -2
  60. package/dist/queue.mjs +0 -119
  61. package/dist/schemas.d.mts +0 -1552
  62. package/dist/schemas.mjs +0 -492
  63. package/dist/semver/index.d.mts +0 -15
  64. package/dist/semver/index.mjs +0 -46
  65. package/dist/server.d.mts +0 -175
  66. package/dist/server.mjs +0 -181
  67. package/dist/state.d.mts +0 -3
  68. package/dist/state.mjs +0 -30
  69. package/dist/storage/checkpoint.d.mts +0 -19
  70. package/dist/storage/checkpoint.mjs +0 -127
  71. package/dist/storage/context.d.mts +0 -3
  72. package/dist/storage/context.mjs +0 -11
  73. package/dist/storage/importMap.d.mts +0 -55
  74. package/dist/storage/importMap.mjs +0 -55
  75. package/dist/storage/ops.d.mts +0 -169
  76. package/dist/storage/ops.mjs +0 -1262
  77. package/dist/storage/persist.d.mts +0 -18
  78. package/dist/storage/persist.mjs +0 -81
  79. package/dist/storage/store.d.mts +0 -17
  80. package/dist/storage/store.mjs +0 -41
  81. package/dist/storage/types.d.mts +0 -301
  82. package/dist/storage/types.mjs +0 -1
  83. package/dist/stream.d.mts +0 -43
  84. package/dist/stream.mjs +0 -235
  85. package/dist/ui/load.d.mts +0 -8
  86. package/dist/ui/load.mjs +0 -53
  87. package/dist/utils/abort.d.mts +0 -1
  88. package/dist/utils/abort.mjs +0 -8
  89. package/dist/utils/hono.d.mts +0 -5
  90. package/dist/utils/hono.mjs +0 -24
  91. package/dist/utils/importMap.d.mts +0 -55
  92. package/dist/utils/importMap.mjs +0 -55
  93. package/dist/utils/runnableConfig.d.mts +0 -3
  94. package/dist/utils/runnableConfig.mjs +0 -45
  95. package/dist/utils/serde.d.mts +0 -5
  96. package/dist/utils/serde.mjs +0 -20
  97. package/dist/vitest.config.d.ts +0 -2
  98. package/dist/vitest.config.js +0 -12
  99. package/dist/webhook.d.mts +0 -11
  100. package/dist/webhook.mjs +0 -30
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@langchain/langgraph-api",
3
- "version": "1.1.2",
3
+ "version": "1.1.8",
4
4
  "type": "module",
5
5
  "engines": {
6
6
  "node": "^18.19.0 || >=20.16.0"
@@ -47,7 +47,8 @@
47
47
  },
48
48
  "repository": {
49
49
  "type": "git",
50
- "url": "git@github.com:langchain-ai/langgraphjs-api.git"
50
+ "url": "git+ssh://git@github.com/langchain-ai/langgraphjs.git",
51
+ "directory": "libs/langgraph-api"
51
52
  },
52
53
  "scripts": {
53
54
  "clean": "rm -rf dist/ .turbo/ ./tests/graphs/.langgraph_api/",
@@ -63,8 +64,8 @@
63
64
  "dependencies": {
64
65
  "@babel/code-frame": "^7.26.2",
65
66
  "@hono/node-server": "^1.12.0",
66
- "@hono/zod-validator": "^0.2.2",
67
- "@langchain/langgraph-ui": "1.1.2",
67
+ "@hono/zod-validator": "^0.7.6",
68
+ "@langchain/langgraph-ui": "workspace:*",
68
69
  "@types/json-schema": "^7.0.15",
69
70
  "@typescript/vfs": "^1.6.0",
70
71
  "dedent": "^1.5.3",
@@ -96,9 +97,9 @@
96
97
  },
97
98
  "devDependencies": {
98
99
  "@langchain/core": "^1.0.0",
99
- "@langchain/langgraph": "1.0.4",
100
- "@langchain/langgraph-checkpoint": "1.0.0",
101
- "@langchain/langgraph-sdk": "1.2.0",
100
+ "@langchain/langgraph": "workspace:*",
101
+ "@langchain/langgraph-checkpoint": "workspace:*",
102
+ "@langchain/langgraph-sdk": "workspace:*",
102
103
  "@types/babel__code-frame": "^7.0.6",
103
104
  "@types/node": "^18.15.11",
104
105
  "@types/react": "^19.0.8",
@@ -112,4 +113,4 @@
112
113
  "vitest": "^3.2.4",
113
114
  "wait-port": "^1.1.0"
114
115
  }
115
- }
116
+ }
package/CHANGELOG.md DELETED
@@ -1,297 +0,0 @@
1
- # @langchain/langgraph-api
2
-
3
- ## 1.1.2
4
-
5
- ### Patch Changes
6
-
7
- - d08e484: Fix semver range for SDK
8
- - @langchain/langgraph-ui@1.1.2
9
-
10
- ## 1.1.1
11
-
12
- ### Patch Changes
13
-
14
- - 35e8fc7: Add name parameter to assistants count API.
15
- - Updated dependencies [e19e76c]
16
- - Updated dependencies [fa6c009]
17
- - Updated dependencies [35e8fc7]
18
- - Updated dependencies [b78a738]
19
- - @langchain/langgraph-sdk@1.1.0
20
- - @langchain/langgraph-ui@1.1.1
21
-
22
- ## 1.1.0
23
-
24
- ### Patch Changes
25
-
26
- - @langchain/langgraph-ui@1.1.0
27
-
28
- ## 1.0.4
29
-
30
- ### Patch Changes
31
-
32
- - b9be526: Adding functionality to search assistants by name in the in-memory server implementation.
33
- - @langchain/langgraph-ui@1.0.4
34
-
35
- ## 1.0.3
36
-
37
- ### Patch Changes
38
-
39
- - 6cd8ecb: Remove Zod 3.x dependency constraint to allow Zod 4.x and avoid installing duplicate Zod packages
40
- - Updated dependencies [6cd8ecb]
41
- - @langchain/langgraph-ui@1.0.3
42
-
43
- ## 1.0.2
44
-
45
- ### Patch Changes
46
-
47
- - ebe5ae7: Add back support for older versions of LangChain / LangGraph
48
- - @langchain/langgraph-ui@1.0.2
49
-
50
- ## 1.0.1
51
-
52
- ### Patch Changes
53
-
54
- - 610e1e1: Hotfix graph resolution for createAgent
55
- - @langchain/langgraph-ui@1.0.1
56
-
57
- ## 1.0.0
58
-
59
- ### Major Changes
60
-
61
- - 1e1ecbb: This release updates the package for compatibility with LangGraph v1.0. See the [v1.0 release notes](https://docs.langchain.com/oss/javascript/releases/langgraph-v1) for details on what's new.
62
-
63
- ### Patch Changes
64
-
65
- - Updated dependencies [1e1ecbb]
66
- - @langchain/langgraph-ui@1.0.0
67
- - @langchain/langgraph-checkpoint@1.0.0
68
- - @langchain/langgraph-sdk@1.0.0
69
-
70
- ## 0.0.71
71
-
72
- ### Patch Changes
73
-
74
- - f5865ac: Update API spec to match python api
75
- - @langchain/langgraph-ui@0.0.71
76
-
77
- ## 0.0.70
78
-
79
- ### Patch Changes
80
-
81
- - 636e142: Updated types to match python api
82
- - @langchain/langgraph-ui@0.0.70
83
-
84
- ## 0.0.69
85
-
86
- ### Patch Changes
87
-
88
- - f2aa533: Updated typing of auth filters
89
- - @langchain/langgraph-ui@0.0.69
90
-
91
- ## 0.0.68
92
-
93
- ### Patch Changes
94
-
95
- - @langchain/langgraph-ui@0.0.68
96
-
97
- ## 0.0.67
98
-
99
- ### Patch Changes
100
-
101
- - e23fa7f: Add support for `sort_by`, `sort_order` and `select` when searching for assistants and add support for pagination headers.
102
- - @langchain/langgraph-ui@0.0.67
103
-
104
- ## 0.0.66
105
-
106
- ### Patch Changes
107
-
108
- - 5176f1c: chore(api): add description field for assistants
109
- - 68a1aa8: fix(api): call threads:create auth handler when copying a thread
110
- - @langchain/langgraph-ui@0.0.66
111
-
112
- ## 0.0.65
113
-
114
- ### Patch Changes
115
-
116
- - 0aefafe: Skip auth middleware when requesting JS/CSS assets for built-in generative UI
117
- - @langchain/langgraph-ui@0.0.65
118
-
119
- ## 0.0.64
120
-
121
- ### Patch Changes
122
-
123
- - 30bcfcd: Assume `http` protocol only when accessing UI components from frontend served from `localhost` or `127.0.0.1` (#1596, #1573)
124
- - 572de43: feat(threads): add `ids` filter to Threads.search
125
-
126
- - SDK: `ThreadsClient.search` now accepts `ids?: string[]` and forwards it to `/threads/search`.
127
- - API: `/threads/search` schema accepts `ids` and storage filters by provided thread IDs.
128
-
129
- This enables fetching a specific set of threads directly via the search endpoint, while remaining backward compatible.
130
-
131
- - @langchain/langgraph-ui@0.0.64
132
-
133
- ## 0.0.63
134
-
135
- ### Patch Changes
136
-
137
- - c9d4dfd: Add support for @langchain/core 1.0.0-alpha and @langchain/langgraph 1.0.0-alpha
138
- - @langchain/langgraph-ui@0.0.63
139
-
140
- ## 0.0.62
141
-
142
- ### Patch Changes
143
-
144
- - c868796: Exports more graph-related helper functions.
145
- - @langchain/langgraph-ui@0.0.62
146
-
147
- ## 0.0.61
148
-
149
- ### Patch Changes
150
-
151
- - a334897: feat(api): add /count endpoints for threads and assistants
152
- - 9357bb7: chore(api): abstract internal operations away from createServer
153
- - 9f13d74: fix(api): prevent overriding default CORS config when applying a single override
154
- - @langchain/langgraph-ui@0.0.61
155
-
156
- ## 0.0.60
157
-
158
- ### Patch Changes
159
-
160
- - 9c57526: fix(api): serialization of "checkpoints" and "tasks" stream modes
161
- - @langchain/langgraph-ui@0.0.60
162
-
163
- ## 0.0.59
164
-
165
- ### Patch Changes
166
-
167
- - 3412f9f: fix(api): unintended schema inference to BaseMessage[] for all state keys when `strictFunctionTypes: true`
168
- - @langchain/langgraph-ui@0.0.59
169
-
170
- ## 0.0.58
171
-
172
- ### Patch Changes
173
-
174
- - f65f619: fix(api): send Content-Location header for stateless runs
175
- - c857357: feat(api): harden embed server, implement missing endpoints needed for interrupts
176
- - @langchain/langgraph-ui@0.0.58
177
-
178
- ## 0.0.57
179
-
180
- ### Patch Changes
181
-
182
- - 31cc9f7: support description property for `langgraph.json`
183
- - @langchain/langgraph-ui@0.0.57
184
-
185
- ## 0.0.56
186
-
187
- ### Patch Changes
188
-
189
- - 3c390c9: fix(api): parser: sanitise generated symbol names, honor typescript extension
190
- - @langchain/langgraph-ui@0.0.56
191
-
192
- ## 0.0.55
193
-
194
- ### Patch Changes
195
-
196
- - ef84039: fix(api): place the schema inference template next to the graph code, use whole path for symbol name
197
- - 7edf347: exlcude meta routes from auth
198
- - 77b21d5: add installed langgraph version to info endpoint for js server
199
- - @langchain/langgraph-ui@0.0.55
200
-
201
- ## 0.0.54
202
-
203
- ### Patch Changes
204
-
205
- - 1777878: fix(cli): only warn the user if an invalid LangSmith API key is passed while tracing is enabled
206
- - @langchain/langgraph-ui@0.0.54
207
-
208
- ## 0.0.53
209
-
210
- ### Patch Changes
211
-
212
- - f1bcec7: Add support for Context API in in-memory dev server
213
- - @langchain/langgraph-ui@0.0.53
214
-
215
- ## 0.0.52
216
-
217
- ### Patch Changes
218
-
219
- - 030698f: feat(api): add support for injecting `langgraph_node` in structured logs, expose structlog
220
- - @langchain/langgraph-ui@0.0.52
221
-
222
- ## 0.0.51
223
-
224
- ### Patch Changes
225
-
226
- - @langchain/langgraph-ui@0.0.51
227
-
228
- ## 0.0.50
229
-
230
- ### Patch Changes
231
-
232
- - @langchain/langgraph-ui@0.0.50
233
-
234
- ## 0.0.49
235
-
236
- ### Patch Changes
237
-
238
- - ee1defa: feat(api): pass through "tasks" and "checkpoints" stream mode
239
- - @langchain/langgraph-ui@0.0.49
240
-
241
- ## 0.0.48
242
-
243
- ### Patch Changes
244
-
245
- - ac7b067: fix(sdk): use `kind` when checking for Studio user
246
- - Updated dependencies [ac7b067]
247
- - @langchain/langgraph-ui@0.0.48
248
-
249
- ## 0.0.47
250
-
251
- ### Patch Changes
252
-
253
- - 39cc88f: Fix apply namespace to messages-tuple stream mode
254
- - c1ddda1: Embed methods for obtaining state should use `getGraph(...)`
255
- - Updated dependencies [39cc88f]
256
- - Updated dependencies [c1ddda1]
257
- - @langchain/langgraph-ui@0.0.47
258
-
259
- ## 0.0.46
260
-
261
- ### Patch Changes
262
-
263
- - d172de3: Fix apply namespace to messages-tuple stream mode
264
- - Updated dependencies [d172de3]
265
- - @langchain/langgraph-ui@0.0.46
266
-
267
- ## 0.0.45
268
-
269
- ### Patch Changes
270
-
271
- - 603daa6: Embed should properly handle `payload.checkpoint` and `payload.checkpoint_id`
272
- - Updated dependencies [603daa6]
273
- - @langchain/langgraph-ui@0.0.45
274
-
275
- ## 0.0.44
276
-
277
- ### Patch Changes
278
-
279
- - 2f26f2f: Expose get/delete thread endpoint to embed server
280
- - Updated dependencies [2f26f2f]
281
- - @langchain/langgraph-ui@0.0.44
282
-
283
- ## 0.0.43
284
-
285
- ### Patch Changes
286
-
287
- - ce0a39a: Fix invalid package.json dependencies
288
- - Updated dependencies [ce0a39a]
289
- - @langchain/langgraph-ui@0.0.43
290
-
291
- ## 0.0.42
292
-
293
- ### Patch Changes
294
-
295
- - 972b66a: Support gen UI components namespaced with a hyphen
296
- - Updated dependencies [972b66a]
297
- - @langchain/langgraph-ui@0.0.42
@@ -1,3 +0,0 @@
1
- import { Hono } from "hono";
2
- declare const api: Hono<import("hono/types").BlankEnv, import("hono/types").BlankSchema, "/">;
3
- export default api;
@@ -1,193 +0,0 @@
1
- import { zValidator } from "@hono/zod-validator";
2
- import { Hono } from "hono";
3
- import { v4 as uuid } from "uuid";
4
- import { z } from "zod/v3";
5
- import { getAssistantId, getCachedStaticGraphSchema, getGraph, } from "../graph/load.mjs";
6
- import { getRuntimeGraphSchema } from "../graph/parser/index.mjs";
7
- import { HTTPException } from "hono/http-exception";
8
- import * as schemas from "../schemas.mjs";
9
- import { assistants } from "../storage/context.mjs";
10
- const api = new Hono();
11
- const RunnableConfigSchema = z.object({
12
- tags: z.array(z.string()).optional(),
13
- metadata: z.record(z.unknown()).optional(),
14
- run_name: z.string().optional(),
15
- max_concurrency: z.number().optional(),
16
- recursion_limit: z.number().optional(),
17
- configurable: z.record(z.unknown()).optional(),
18
- run_id: z.string().uuid().optional(),
19
- });
20
- const getRunnableConfig = (userConfig) => {
21
- if (!userConfig)
22
- return {};
23
- return {
24
- configurable: userConfig.configurable,
25
- tags: userConfig.tags,
26
- metadata: userConfig.metadata,
27
- runName: userConfig.run_name,
28
- maxConcurrency: userConfig.max_concurrency,
29
- recursionLimit: userConfig.recursion_limit,
30
- runId: userConfig.run_id,
31
- };
32
- };
33
- api.post("/assistants", zValidator("json", schemas.AssistantCreate), async (c) => {
34
- // Create Assistant
35
- const payload = c.req.valid("json");
36
- const assistant = await assistants().put(payload.assistant_id ?? uuid(), {
37
- config: payload.config ?? {},
38
- context: payload.context ?? {},
39
- graph_id: payload.graph_id,
40
- metadata: payload.metadata ?? {},
41
- if_exists: payload.if_exists ?? "raise",
42
- name: payload.name ?? "Untitled",
43
- description: payload.description,
44
- }, c.var.auth);
45
- return c.json(assistant);
46
- });
47
- api.post("/assistants/search", zValidator("json", schemas.AssistantSearchRequest), async (c) => {
48
- // Search Assistants
49
- const payload = c.req.valid("json");
50
- const result = [];
51
- let total = 0;
52
- for await (const item of assistants().search({
53
- graph_id: payload.graph_id,
54
- name: payload.name,
55
- metadata: payload.metadata,
56
- limit: payload.limit ?? 10,
57
- offset: payload.offset ?? 0,
58
- sort_by: payload.sort_by,
59
- sort_order: payload.sort_order,
60
- select: payload.select,
61
- }, c.var.auth)) {
62
- result.push(Object.fromEntries(Object.entries(item.assistant).filter(([k]) => !payload.select || payload.select.includes(k))));
63
- if (total === 0) {
64
- total = item.total;
65
- }
66
- }
67
- if (total === payload.limit) {
68
- c.res.headers.set("X-Pagination-Next", ((payload.offset ?? 0) + total).toString());
69
- c.res.headers.set("X-Pagination-Total", ((payload.offset ?? 0) + total + 1).toString());
70
- }
71
- else {
72
- c.res.headers.set("X-Pagination-Total", ((payload.offset ?? 0) + total).toString());
73
- }
74
- return c.json(result);
75
- });
76
- api.post("/assistants/count", zValidator("json", schemas.AssistantCountRequest), async (c) => {
77
- const payload = c.req.valid("json");
78
- const total = await assistants().count(payload, c.var.auth);
79
- return c.json(total);
80
- });
81
- api.get("/assistants/:assistant_id", async (c) => {
82
- // Get Assistant
83
- const assistantId = getAssistantId(c.req.param("assistant_id"));
84
- return c.json(await assistants().get(assistantId, c.var.auth));
85
- });
86
- api.delete("/assistants/:assistant_id", async (c) => {
87
- // Delete Assistant
88
- const assistantId = getAssistantId(c.req.param("assistant_id"));
89
- return c.json(await assistants().delete(assistantId, c.var.auth));
90
- });
91
- api.patch("/assistants/:assistant_id", zValidator("json", schemas.AssistantPatch), async (c) => {
92
- // Patch Assistant
93
- const assistantId = getAssistantId(c.req.param("assistant_id"));
94
- const payload = c.req.valid("json");
95
- return c.json(await assistants().patch(assistantId, payload, c.var.auth));
96
- });
97
- api.get("/assistants/:assistant_id/graph", zValidator("query", z.object({ xray: schemas.coercedBoolean.optional() })), async (c) => {
98
- // Get Assistant Graph
99
- const assistantId = getAssistantId(c.req.param("assistant_id"));
100
- const assistant = await assistants().get(assistantId, c.var.auth);
101
- const { xray } = c.req.valid("query");
102
- const config = getRunnableConfig(assistant.config);
103
- const graph = await getGraph(assistant.graph_id, config);
104
- const drawable = await graph.getGraphAsync({
105
- ...config,
106
- xray: xray ?? undefined,
107
- });
108
- return c.json(drawable.toJSON());
109
- });
110
- api.get("/assistants/:assistant_id/schemas", zValidator("json", z.object({ config: RunnableConfigSchema.optional() })), async (c) => {
111
- // Get Assistant Schemas
112
- const json = c.req.valid("json");
113
- const assistantId = getAssistantId(c.req.param("assistant_id"));
114
- const assistant = await assistants().get(assistantId, c.var.auth);
115
- const config = getRunnableConfig(json.config);
116
- const graph = await getGraph(assistant.graph_id, config);
117
- const schema = await (async () => {
118
- const runtimeSchema = await getRuntimeGraphSchema(graph);
119
- if (runtimeSchema)
120
- return runtimeSchema;
121
- const graphSchema = await getCachedStaticGraphSchema(assistant.graph_id);
122
- const rootGraphId = Object.keys(graphSchema).find((i) => !i.includes("|"));
123
- if (!rootGraphId)
124
- throw new HTTPException(404, { message: "Failed to find root graph" });
125
- return graphSchema[rootGraphId];
126
- })();
127
- return c.json({
128
- graph_id: assistant.graph_id,
129
- input_schema: schema.input,
130
- output_schema: schema.output,
131
- state_schema: schema.state,
132
- config_schema: schema.config,
133
- // From JS PoV `configSchema` and `contextSchema` are indistinguishable,
134
- // thus we use config_schema for context_schema.
135
- context_schema: schema.config,
136
- });
137
- });
138
- 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) => {
139
- // Get Assistant Subgraphs
140
- const { assistant_id, namespace } = c.req.valid("param");
141
- const { recurse } = c.req.valid("query");
142
- const assistantId = getAssistantId(assistant_id);
143
- const assistant = await assistants().get(assistantId, c.var.auth);
144
- const config = getRunnableConfig(assistant.config);
145
- const graph = await getGraph(assistant.graph_id, config);
146
- const result = [];
147
- const subgraphsGenerator = "getSubgraphsAsync" in graph
148
- ? graph.getSubgraphsAsync.bind(graph)
149
- : // @ts-expect-error older versions of langgraph don't have getSubgraphsAsync
150
- graph.getSubgraphs.bind(graph);
151
- let graphSchemaPromise;
152
- for await (const [ns, subgraph] of subgraphsGenerator(namespace, recurse)) {
153
- const schema = await (async () => {
154
- const runtimeSchema = await getRuntimeGraphSchema(subgraph);
155
- if (runtimeSchema)
156
- return runtimeSchema;
157
- graphSchemaPromise ??= getCachedStaticGraphSchema(assistant.graph_id);
158
- const graphSchema = await graphSchemaPromise;
159
- const rootGraphId = Object.keys(graphSchema).find((i) => !i.includes("|"));
160
- if (!rootGraphId) {
161
- throw new HTTPException(404, {
162
- message: "Failed to find root graph",
163
- });
164
- }
165
- return graphSchema[`${rootGraphId}|${ns}`] || graphSchema[rootGraphId];
166
- })();
167
- result.push([ns, schema]);
168
- }
169
- return c.json(Object.fromEntries(result));
170
- });
171
- api.post("/assistants/:assistant_id/latest", zValidator("json", schemas.AssistantLatestVersion), async (c) => {
172
- // Set Latest Assistant Version
173
- const assistantId = getAssistantId(c.req.param("assistant_id"));
174
- const { version } = c.req.valid("json");
175
- return c.json(await assistants().setLatest(assistantId, version, c.var.auth));
176
- });
177
- api.post("/assistants/:assistant_id/versions", zValidator("json", z.object({
178
- limit: z.number().min(1).max(1000).optional().default(10),
179
- offset: z.number().min(0).optional().default(0),
180
- metadata: z.record(z.unknown()).optional(),
181
- })), async (c) => {
182
- // Get Assistant Versions
183
- const assistantId = getAssistantId(c.req.param("assistant_id"));
184
- const { limit, offset, metadata } = c.req.valid("json");
185
- const versions = await assistants().getVersions(assistantId, { limit, offset, metadata }, c.var.auth);
186
- if (!versions?.length) {
187
- throw new HTTPException(404, {
188
- message: `Assistant "${assistantId}" not found.`,
189
- });
190
- }
191
- return c.json(versions);
192
- });
193
- export default api;
@@ -1,3 +0,0 @@
1
- import { Hono } from "hono";
2
- declare const api: Hono<import("hono/types").BlankEnv, import("hono/types").BlankSchema, "/">;
3
- export default api;
package/dist/api/meta.mjs DELETED
@@ -1,65 +0,0 @@
1
- import { Hono } from "hono";
2
- import * as fs from "node:fs/promises";
3
- import * as path from "node:path";
4
- import * as url from "node:url";
5
- const api = new Hono();
6
- // Get the version using the same pattern as semver/index.mts
7
- const packageJsonPath = path.resolve(url.fileURLToPath(import.meta.url), "../../../package.json");
8
- let version;
9
- let langgraph_js_version;
10
- let versionInfoLoaded = false;
11
- const loadVersionInfo = async () => {
12
- try {
13
- const packageJson = JSON.parse(await fs.readFile(packageJsonPath, "utf-8"));
14
- version = packageJson.version;
15
- }
16
- catch {
17
- console.warn("Could not determine version of langgraph-api");
18
- }
19
- // Get the installed version of @langchain/langgraph
20
- try {
21
- const langgraphPkg = await import("@langchain/langgraph/package.json");
22
- if (langgraphPkg?.default?.version) {
23
- langgraph_js_version = langgraphPkg.default.version;
24
- }
25
- }
26
- catch {
27
- console.warn("Could not determine version of @langchain/langgraph");
28
- }
29
- };
30
- // read env variable
31
- const env = process.env;
32
- api.get("/info", async (c) => {
33
- if (!versionInfoLoaded) {
34
- await loadVersionInfo();
35
- versionInfoLoaded = true;
36
- }
37
- const langsmithApiKey = env["LANGSMITH_API_KEY"] || env["LANGCHAIN_API_KEY"];
38
- const langsmithTracing = (() => {
39
- if (langsmithApiKey) {
40
- // Check if any tracing variable is explicitly set to "false"
41
- const tracingVars = [
42
- env["LANGCHAIN_TRACING_V2"],
43
- env["LANGCHAIN_TRACING"],
44
- env["LANGSMITH_TRACING_V2"],
45
- env["LANGSMITH_TRACING"],
46
- ];
47
- // Return true unless explicitly disabled
48
- return !tracingVars.some((val) => val === "false" || val === "False");
49
- }
50
- return undefined;
51
- })();
52
- return c.json({
53
- version,
54
- langgraph_js_version,
55
- context: "js",
56
- flags: {
57
- assistants: true,
58
- crons: false,
59
- langsmith: !!langsmithTracing,
60
- langsmith_tracing_replicas: true,
61
- },
62
- });
63
- });
64
- api.get("/ok", (c) => c.json({ ok: true }));
65
- export default api;
@@ -1,3 +0,0 @@
1
- import { Hono } from "hono";
2
- declare const api: Hono<import("hono/types").BlankEnv, import("hono/types").BlankSchema, "/">;
3
- export default api;