@langchain/langgraph-api 1.1.1 → 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 +10 -9
  2. package/CHANGELOG.md +0 -290
  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.1",
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.1",
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",
@@ -86,7 +87,7 @@
86
87
  "@langchain/core": "^0.3.59 || ^1.0.1",
87
88
  "@langchain/langgraph": "^0.2.57 || ^0.3.0 || ^0.4.0 || ^1.0.0-alpha || ^1.0.0",
88
89
  "@langchain/langgraph-checkpoint": "~0.0.16 || ^0.1.0 || ~1.0.0",
89
- "@langchain/langgraph-sdk": "~0.0.16 || ^0.1.0 || ~1.0.0",
90
+ "@langchain/langgraph-sdk": "~0.0.16 || ^0.1.0 || ^1.0.0",
90
91
  "typescript": "^5.5.4"
91
92
  },
92
93
  "peerDependenciesMeta": {
@@ -96,9 +97,9 @@
96
97
  },
97
98
  "devDependencies": {
98
99
  "@langchain/core": "^1.0.0",
99
- "@langchain/langgraph": "1.0.3",
100
- "@langchain/langgraph-checkpoint": "1.0.0",
101
- "@langchain/langgraph-sdk": "1.1.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,290 +0,0 @@
1
- # @langchain/langgraph-api
2
-
3
- ## 1.1.1
4
-
5
- ### Patch Changes
6
-
7
- - 35e8fc7: Add name parameter to assistants count API.
8
- - Updated dependencies [e19e76c]
9
- - Updated dependencies [fa6c009]
10
- - Updated dependencies [35e8fc7]
11
- - Updated dependencies [b78a738]
12
- - @langchain/langgraph-sdk@1.1.0
13
- - @langchain/langgraph-ui@1.1.1
14
-
15
- ## 1.1.0
16
-
17
- ### Patch Changes
18
-
19
- - @langchain/langgraph-ui@1.1.0
20
-
21
- ## 1.0.4
22
-
23
- ### Patch Changes
24
-
25
- - b9be526: Adding functionality to search assistants by name in the in-memory server implementation.
26
- - @langchain/langgraph-ui@1.0.4
27
-
28
- ## 1.0.3
29
-
30
- ### Patch Changes
31
-
32
- - 6cd8ecb: Remove Zod 3.x dependency constraint to allow Zod 4.x and avoid installing duplicate Zod packages
33
- - Updated dependencies [6cd8ecb]
34
- - @langchain/langgraph-ui@1.0.3
35
-
36
- ## 1.0.2
37
-
38
- ### Patch Changes
39
-
40
- - ebe5ae7: Add back support for older versions of LangChain / LangGraph
41
- - @langchain/langgraph-ui@1.0.2
42
-
43
- ## 1.0.1
44
-
45
- ### Patch Changes
46
-
47
- - 610e1e1: Hotfix graph resolution for createAgent
48
- - @langchain/langgraph-ui@1.0.1
49
-
50
- ## 1.0.0
51
-
52
- ### Major Changes
53
-
54
- - 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.
55
-
56
- ### Patch Changes
57
-
58
- - Updated dependencies [1e1ecbb]
59
- - @langchain/langgraph-ui@1.0.0
60
- - @langchain/langgraph-checkpoint@1.0.0
61
- - @langchain/langgraph-sdk@1.0.0
62
-
63
- ## 0.0.71
64
-
65
- ### Patch Changes
66
-
67
- - f5865ac: Update API spec to match python api
68
- - @langchain/langgraph-ui@0.0.71
69
-
70
- ## 0.0.70
71
-
72
- ### Patch Changes
73
-
74
- - 636e142: Updated types to match python api
75
- - @langchain/langgraph-ui@0.0.70
76
-
77
- ## 0.0.69
78
-
79
- ### Patch Changes
80
-
81
- - f2aa533: Updated typing of auth filters
82
- - @langchain/langgraph-ui@0.0.69
83
-
84
- ## 0.0.68
85
-
86
- ### Patch Changes
87
-
88
- - @langchain/langgraph-ui@0.0.68
89
-
90
- ## 0.0.67
91
-
92
- ### Patch Changes
93
-
94
- - e23fa7f: Add support for `sort_by`, `sort_order` and `select` when searching for assistants and add support for pagination headers.
95
- - @langchain/langgraph-ui@0.0.67
96
-
97
- ## 0.0.66
98
-
99
- ### Patch Changes
100
-
101
- - 5176f1c: chore(api): add description field for assistants
102
- - 68a1aa8: fix(api): call threads:create auth handler when copying a thread
103
- - @langchain/langgraph-ui@0.0.66
104
-
105
- ## 0.0.65
106
-
107
- ### Patch Changes
108
-
109
- - 0aefafe: Skip auth middleware when requesting JS/CSS assets for built-in generative UI
110
- - @langchain/langgraph-ui@0.0.65
111
-
112
- ## 0.0.64
113
-
114
- ### Patch Changes
115
-
116
- - 30bcfcd: Assume `http` protocol only when accessing UI components from frontend served from `localhost` or `127.0.0.1` (#1596, #1573)
117
- - 572de43: feat(threads): add `ids` filter to Threads.search
118
-
119
- - SDK: `ThreadsClient.search` now accepts `ids?: string[]` and forwards it to `/threads/search`.
120
- - API: `/threads/search` schema accepts `ids` and storage filters by provided thread IDs.
121
-
122
- This enables fetching a specific set of threads directly via the search endpoint, while remaining backward compatible.
123
-
124
- - @langchain/langgraph-ui@0.0.64
125
-
126
- ## 0.0.63
127
-
128
- ### Patch Changes
129
-
130
- - c9d4dfd: Add support for @langchain/core 1.0.0-alpha and @langchain/langgraph 1.0.0-alpha
131
- - @langchain/langgraph-ui@0.0.63
132
-
133
- ## 0.0.62
134
-
135
- ### Patch Changes
136
-
137
- - c868796: Exports more graph-related helper functions.
138
- - @langchain/langgraph-ui@0.0.62
139
-
140
- ## 0.0.61
141
-
142
- ### Patch Changes
143
-
144
- - a334897: feat(api): add /count endpoints for threads and assistants
145
- - 9357bb7: chore(api): abstract internal operations away from createServer
146
- - 9f13d74: fix(api): prevent overriding default CORS config when applying a single override
147
- - @langchain/langgraph-ui@0.0.61
148
-
149
- ## 0.0.60
150
-
151
- ### Patch Changes
152
-
153
- - 9c57526: fix(api): serialization of "checkpoints" and "tasks" stream modes
154
- - @langchain/langgraph-ui@0.0.60
155
-
156
- ## 0.0.59
157
-
158
- ### Patch Changes
159
-
160
- - 3412f9f: fix(api): unintended schema inference to BaseMessage[] for all state keys when `strictFunctionTypes: true`
161
- - @langchain/langgraph-ui@0.0.59
162
-
163
- ## 0.0.58
164
-
165
- ### Patch Changes
166
-
167
- - f65f619: fix(api): send Content-Location header for stateless runs
168
- - c857357: feat(api): harden embed server, implement missing endpoints needed for interrupts
169
- - @langchain/langgraph-ui@0.0.58
170
-
171
- ## 0.0.57
172
-
173
- ### Patch Changes
174
-
175
- - 31cc9f7: support description property for `langgraph.json`
176
- - @langchain/langgraph-ui@0.0.57
177
-
178
- ## 0.0.56
179
-
180
- ### Patch Changes
181
-
182
- - 3c390c9: fix(api): parser: sanitise generated symbol names, honor typescript extension
183
- - @langchain/langgraph-ui@0.0.56
184
-
185
- ## 0.0.55
186
-
187
- ### Patch Changes
188
-
189
- - ef84039: fix(api): place the schema inference template next to the graph code, use whole path for symbol name
190
- - 7edf347: exlcude meta routes from auth
191
- - 77b21d5: add installed langgraph version to info endpoint for js server
192
- - @langchain/langgraph-ui@0.0.55
193
-
194
- ## 0.0.54
195
-
196
- ### Patch Changes
197
-
198
- - 1777878: fix(cli): only warn the user if an invalid LangSmith API key is passed while tracing is enabled
199
- - @langchain/langgraph-ui@0.0.54
200
-
201
- ## 0.0.53
202
-
203
- ### Patch Changes
204
-
205
- - f1bcec7: Add support for Context API in in-memory dev server
206
- - @langchain/langgraph-ui@0.0.53
207
-
208
- ## 0.0.52
209
-
210
- ### Patch Changes
211
-
212
- - 030698f: feat(api): add support for injecting `langgraph_node` in structured logs, expose structlog
213
- - @langchain/langgraph-ui@0.0.52
214
-
215
- ## 0.0.51
216
-
217
- ### Patch Changes
218
-
219
- - @langchain/langgraph-ui@0.0.51
220
-
221
- ## 0.0.50
222
-
223
- ### Patch Changes
224
-
225
- - @langchain/langgraph-ui@0.0.50
226
-
227
- ## 0.0.49
228
-
229
- ### Patch Changes
230
-
231
- - ee1defa: feat(api): pass through "tasks" and "checkpoints" stream mode
232
- - @langchain/langgraph-ui@0.0.49
233
-
234
- ## 0.0.48
235
-
236
- ### Patch Changes
237
-
238
- - ac7b067: fix(sdk): use `kind` when checking for Studio user
239
- - Updated dependencies [ac7b067]
240
- - @langchain/langgraph-ui@0.0.48
241
-
242
- ## 0.0.47
243
-
244
- ### Patch Changes
245
-
246
- - 39cc88f: Fix apply namespace to messages-tuple stream mode
247
- - c1ddda1: Embed methods for obtaining state should use `getGraph(...)`
248
- - Updated dependencies [39cc88f]
249
- - Updated dependencies [c1ddda1]
250
- - @langchain/langgraph-ui@0.0.47
251
-
252
- ## 0.0.46
253
-
254
- ### Patch Changes
255
-
256
- - d172de3: Fix apply namespace to messages-tuple stream mode
257
- - Updated dependencies [d172de3]
258
- - @langchain/langgraph-ui@0.0.46
259
-
260
- ## 0.0.45
261
-
262
- ### Patch Changes
263
-
264
- - 603daa6: Embed should properly handle `payload.checkpoint` and `payload.checkpoint_id`
265
- - Updated dependencies [603daa6]
266
- - @langchain/langgraph-ui@0.0.45
267
-
268
- ## 0.0.44
269
-
270
- ### Patch Changes
271
-
272
- - 2f26f2f: Expose get/delete thread endpoint to embed server
273
- - Updated dependencies [2f26f2f]
274
- - @langchain/langgraph-ui@0.0.44
275
-
276
- ## 0.0.43
277
-
278
- ### Patch Changes
279
-
280
- - ce0a39a: Fix invalid package.json dependencies
281
- - Updated dependencies [ce0a39a]
282
- - @langchain/langgraph-ui@0.0.43
283
-
284
- ## 0.0.42
285
-
286
- ### Patch Changes
287
-
288
- - 972b66a: Support gen UI components namespaced with a hyphen
289
- - Updated dependencies [972b66a]
290
- - @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;