@langchain/langgraph-api 0.0.29 → 0.0.31

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 (52) hide show
  1. package/dist/api/assistants.d.mts +3 -0
  2. package/dist/api/assistants.mjs +37 -21
  3. package/dist/api/meta.d.mts +3 -0
  4. package/dist/api/runs.d.mts +3 -0
  5. package/dist/api/store.d.mts +3 -0
  6. package/dist/api/threads.d.mts +3 -0
  7. package/dist/auth/custom.d.mts +12 -0
  8. package/dist/auth/index.d.mts +1 -1
  9. package/dist/cli/entrypoint.d.mts +1 -0
  10. package/dist/cli/utils/ipc/client.d.mts +5 -0
  11. package/dist/cli/utils/ipc/utils/get-pipe-path.d.mts +1 -0
  12. package/dist/cli/utils/ipc/utils/temporary-directory.d.mts +5 -0
  13. package/dist/command.d.mts +11 -0
  14. package/dist/graph/load.d.mts +16 -0
  15. package/dist/graph/load.hooks.d.mts +2 -0
  16. package/dist/graph/load.mjs +17 -4
  17. package/dist/graph/load.utils.d.mts +22 -0
  18. package/dist/graph/load.utils.mjs +4 -36
  19. package/dist/graph/parser/index.d.mts +17 -0
  20. package/dist/graph/parser/index.mjs +41 -0
  21. package/dist/graph/parser/parser.d.mts +63 -0
  22. package/dist/graph/parser/parser.mjs +3 -3
  23. package/dist/graph/parser/parser.worker.d.mts +1 -0
  24. package/dist/graph/parser/schema/types.d.mts +154 -0
  25. package/dist/graph/parser/schema/types.mjs +0 -111
  26. package/dist/graph/parser/schema/types.template.d.mts +1 -0
  27. package/dist/http/custom.d.mts +6 -0
  28. package/dist/http/middleware.d.mts +11 -0
  29. package/dist/logging.d.mts +7 -0
  30. package/dist/loopback.d.mts +3 -0
  31. package/dist/preload.d.mts +1 -0
  32. package/dist/queue.d.mts +1 -0
  33. package/dist/schemas.d.mts +1369 -0
  34. package/dist/semver/index.mjs +11 -1
  35. package/dist/server.d.mts +157 -0
  36. package/dist/state.d.mts +3 -0
  37. package/dist/storage/checkpoint.d.mts +19 -0
  38. package/dist/storage/importMap.d.mts +55 -0
  39. package/dist/storage/ops.d.mts +284 -0
  40. package/dist/storage/ops.mjs +14 -20
  41. package/dist/storage/persist.d.mts +18 -0
  42. package/dist/storage/store.d.mts +17 -0
  43. package/dist/stream.d.mts +38 -0
  44. package/dist/stream.mjs +7 -2
  45. package/dist/ui/load.d.mts +8 -0
  46. package/dist/utils/abort.d.mts +1 -0
  47. package/dist/utils/hono.d.mts +5 -0
  48. package/dist/utils/importMap.d.mts +55 -0
  49. package/dist/utils/runnableConfig.d.mts +3 -0
  50. package/dist/utils/serde.d.mts +5 -0
  51. package/dist/webhook.d.mts +11 -0
  52. package/package.json +10 -6
package/dist/stream.mjs CHANGED
@@ -3,6 +3,7 @@ import { Client as LangSmithClient } from "langsmith";
3
3
  import { runnableConfigToCheckpoint, taskRunnableConfigToCheckpoint, } from "./utils/runnableConfig.mjs";
4
4
  import { isBaseMessage } from "@langchain/core/messages";
5
5
  import { getLangGraphCommand } from "./command.mjs";
6
+ import { checkLangGraphSemver } from "./semver/index.mjs";
6
7
  const isRunnableConfig = (config) => {
7
8
  if (typeof config !== "object" || config == null)
8
9
  return false;
@@ -51,6 +52,7 @@ function preprocessDebugCheckpoint(payload) {
51
52
  result.parent_config = deleteInternalConfigurableFields(result.parent_config);
52
53
  return result;
53
54
  }
55
+ let LANGGRAPH_VERSION;
54
56
  export async function* streamState(run, attempt = 1, options) {
55
57
  const kwargs = run.kwargs;
56
58
  const graphId = kwargs.config?.configurable?.graph_id;
@@ -74,11 +76,14 @@ export async function* streamState(run, attempt = 1, options) {
74
76
  event: "metadata",
75
77
  data: { run_id: run.run_id, attempt },
76
78
  };
79
+ if (!LANGGRAPH_VERSION) {
80
+ const version = await checkLangGraphSemver();
81
+ LANGGRAPH_VERSION = version.find((v) => v.name === "@langchain/langgraph");
82
+ }
77
83
  const metadata = {
78
84
  ...kwargs.config?.metadata,
79
85
  run_attempt: attempt,
80
- // TODO: get langgraph version from NPM / load.hooks.mjs
81
- langgraph_version: "0.2.35",
86
+ langgraph_version: LANGGRAPH_VERSION?.version ?? "0.0.0",
82
87
  langgraph_plan: "developer",
83
88
  langgraph_host: "self-hosted",
84
89
  langgraph_api_url: process.env.LANGGRAPH_API_URL ?? undefined,
@@ -0,0 +1,8 @@
1
+ import { Hono } from "hono";
2
+ export declare function registerGraphUi(defs: Record<string, string>, options: {
3
+ cwd: string;
4
+ config?: {
5
+ shared?: string[];
6
+ };
7
+ }): Promise<void>;
8
+ export declare const api: Hono<import("hono/types").BlankEnv, import("hono/types").BlankSchema, "/">;
@@ -0,0 +1 @@
1
+ export declare const combineAbortSignals: (...input: (AbortSignal | undefined | null)[]) => AbortSignal;
@@ -0,0 +1,5 @@
1
+ import type { Context } from "hono";
2
+ import { StreamingApi } from "hono/utils/stream";
3
+ export declare function jsonExtra<T>(c: Context, object: T): Response & import("hono").TypedResponse<unknown, import("hono/utils/http-status").ContentfulStatusCode, "body">;
4
+ export declare function waitKeepAlive(c: Context, promise: Promise<unknown>): Response;
5
+ export declare const getDisconnectAbortSignal: (c: Context, stream: StreamingApi) => AbortSignal;
@@ -0,0 +1,55 @@
1
+ import { PromptTemplate, AIMessagePromptTemplate, ChatMessagePromptTemplate, ChatPromptTemplate, HumanMessagePromptTemplate, MessagesPlaceholder, SystemMessagePromptTemplate, ImagePromptTemplate, PipelinePromptTemplate } from "@langchain/core/prompts";
2
+ import { AIMessage, AIMessageChunk, BaseMessage, BaseMessageChunk, ChatMessage, ChatMessageChunk, FunctionMessage, FunctionMessageChunk, HumanMessage, HumanMessageChunk, SystemMessage, SystemMessageChunk, ToolMessage, ToolMessageChunk } from "@langchain/core/messages";
3
+ import { StringPromptValue } from "@langchain/core/prompt_values";
4
+ export declare const prompts__prompt: {
5
+ PromptTemplate: typeof PromptTemplate;
6
+ };
7
+ export declare const schema__messages: {
8
+ AIMessage: typeof AIMessage;
9
+ AIMessageChunk: typeof AIMessageChunk;
10
+ BaseMessage: typeof BaseMessage;
11
+ BaseMessageChunk: typeof BaseMessageChunk;
12
+ ChatMessage: typeof ChatMessage;
13
+ ChatMessageChunk: typeof ChatMessageChunk;
14
+ FunctionMessage: typeof FunctionMessage;
15
+ FunctionMessageChunk: typeof FunctionMessageChunk;
16
+ HumanMessage: typeof HumanMessage;
17
+ HumanMessageChunk: typeof HumanMessageChunk;
18
+ SystemMessage: typeof SystemMessage;
19
+ SystemMessageChunk: typeof SystemMessageChunk;
20
+ ToolMessage: typeof ToolMessage;
21
+ ToolMessageChunk: typeof ToolMessageChunk;
22
+ };
23
+ export declare const schema: {
24
+ AIMessage: typeof AIMessage;
25
+ AIMessageChunk: typeof AIMessageChunk;
26
+ BaseMessage: typeof BaseMessage;
27
+ BaseMessageChunk: typeof BaseMessageChunk;
28
+ ChatMessage: typeof ChatMessage;
29
+ ChatMessageChunk: typeof ChatMessageChunk;
30
+ FunctionMessage: typeof FunctionMessage;
31
+ FunctionMessageChunk: typeof FunctionMessageChunk;
32
+ HumanMessage: typeof HumanMessage;
33
+ HumanMessageChunk: typeof HumanMessageChunk;
34
+ SystemMessage: typeof SystemMessage;
35
+ SystemMessageChunk: typeof SystemMessageChunk;
36
+ ToolMessage: typeof ToolMessage;
37
+ ToolMessageChunk: typeof ToolMessageChunk;
38
+ };
39
+ export declare const prompts__chat: {
40
+ AIMessagePromptTemplate: typeof AIMessagePromptTemplate;
41
+ ChatMessagePromptTemplate: typeof ChatMessagePromptTemplate;
42
+ ChatPromptTemplate: typeof ChatPromptTemplate;
43
+ HumanMessagePromptTemplate: typeof HumanMessagePromptTemplate;
44
+ MessagesPlaceholder: typeof MessagesPlaceholder;
45
+ SystemMessagePromptTemplate: typeof SystemMessagePromptTemplate;
46
+ };
47
+ export declare const prompts__image: {
48
+ ImagePromptTemplate: typeof ImagePromptTemplate;
49
+ };
50
+ export declare const prompts__pipeline: {
51
+ PipelinePromptTemplate: typeof PipelinePromptTemplate;
52
+ };
53
+ export declare const prompts__base: {
54
+ StringPromptValue: typeof StringPromptValue;
55
+ };
@@ -0,0 +1,3 @@
1
+ import type { Checkpoint, RunnableConfig } from "../storage/ops.mjs";
2
+ export declare const runnableConfigToCheckpoint: (config: RunnableConfig | null | undefined) => Checkpoint | null;
3
+ export declare const taskRunnableConfigToCheckpoint: (config: RunnableConfig | null | undefined) => Partial<Checkpoint> | null;
@@ -0,0 +1,5 @@
1
+ export declare const serialiseAsDict: (obj: unknown) => string;
2
+ export declare const serializeError: (error: unknown) => {
3
+ error: string;
4
+ message: string;
5
+ };
@@ -0,0 +1,11 @@
1
+ import type { Run } from "./storage/ops.mjs";
2
+ import type { StreamCheckpoint } from "./stream.mjs";
3
+ export declare function callWebhook(result: {
4
+ checkpoint: StreamCheckpoint | undefined;
5
+ status: string | undefined;
6
+ exception: Error | undefined;
7
+ run: Run;
8
+ webhook: string;
9
+ run_started_at: Date;
10
+ run_ended_at: Date | undefined;
11
+ }): Promise<void>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@langchain/langgraph-api",
3
- "version": "0.0.29",
3
+ "version": "0.0.31",
4
4
  "type": "module",
5
5
  "engines": {
6
6
  "node": "^18.19.0 || >=20.16.0"
@@ -12,17 +12,21 @@
12
12
  ],
13
13
  "exports": {
14
14
  ".": {
15
- "types": "./dist/cli/spawn.d.ts",
15
+ "types": "./dist/cli/spawn.d.mts",
16
16
  "default": "./dist/cli/spawn.mjs"
17
17
  },
18
18
  "./auth": {
19
- "types": "./dist/auth/index.d.ts",
19
+ "types": "./dist/auth/index.d.mts",
20
20
  "default": "./dist/auth/index.mjs"
21
21
  },
22
22
  "./semver": {
23
- "types": "./dist/semver/index.d.ts",
23
+ "types": "./dist/semver/index.d.mts",
24
24
  "default": "./dist/semver/index.mjs"
25
25
  },
26
+ "./schema": {
27
+ "types": "./dist/graph/parser/index.d.mts",
28
+ "default": "./dist/graph/parser/index.mjs"
29
+ },
26
30
  "./package.json": "./package.json"
27
31
  },
28
32
  "repository": {
@@ -49,13 +53,13 @@
49
53
  "winston": "^3.17.0",
50
54
  "winston-console-format": "^1.0.8",
51
55
  "zod": "^3.23.8",
52
- "@langchain/langgraph-ui": "0.0.29"
56
+ "@langchain/langgraph-ui": "0.0.31"
53
57
  },
54
58
  "peerDependencies": {
55
59
  "@langchain/core": "^0.3.42",
56
60
  "@langchain/langgraph": "^0.2.57",
57
61
  "@langchain/langgraph-checkpoint": "~0.0.16",
58
- "@langchain/langgraph-sdk": "^0.0.70",
62
+ "@langchain/langgraph-sdk": "~0.0.70",
59
63
  "typescript": "^5.5.4"
60
64
  },
61
65
  "peerDependenciesMeta": {