@langchain/langgraph-sdk 0.1.9 → 1.0.0

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 (234) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/_virtual/rolldown_runtime.cjs +25 -0
  3. package/dist/auth/error.cjs +76 -86
  4. package/dist/auth/error.cjs.map +1 -0
  5. package/dist/auth/error.d.cts +13 -0
  6. package/dist/auth/error.d.cts.map +1 -0
  7. package/dist/auth/error.d.ts +12 -8
  8. package/dist/auth/error.d.ts.map +1 -0
  9. package/dist/auth/error.js +76 -83
  10. package/dist/auth/error.js.map +1 -0
  11. package/dist/auth/index.cjs +36 -44
  12. package/dist/auth/index.cjs.map +1 -0
  13. package/dist/auth/index.d.cts +31 -0
  14. package/dist/auth/index.d.cts.map +1 -0
  15. package/dist/auth/index.d.ts +20 -15
  16. package/dist/auth/index.d.ts.map +1 -0
  17. package/dist/auth/index.js +35 -39
  18. package/dist/auth/index.js.map +1 -0
  19. package/dist/auth/types.d.cts +294 -0
  20. package/dist/auth/types.d.cts.map +1 -0
  21. package/dist/auth/types.d.ts +162 -165
  22. package/dist/auth/types.d.ts.map +1 -0
  23. package/dist/client.cjs +1108 -1294
  24. package/dist/client.cjs.map +1 -0
  25. package/dist/client.d.cts +688 -0
  26. package/dist/client.d.cts.map +1 -0
  27. package/dist/client.d.ts +647 -639
  28. package/dist/client.d.ts.map +1 -0
  29. package/dist/client.js +1099 -1281
  30. package/dist/client.js.map +1 -0
  31. package/dist/index.cjs +6 -8
  32. package/dist/index.d.cts +7 -0
  33. package/dist/index.d.ts +7 -7
  34. package/dist/index.js +4 -2
  35. package/dist/logging/index.cjs +30 -31
  36. package/dist/logging/index.cjs.map +1 -0
  37. package/dist/logging/index.d.cts +47 -0
  38. package/dist/logging/index.d.cts.map +1 -0
  39. package/dist/logging/index.d.ts +20 -16
  40. package/dist/logging/index.d.ts.map +1 -0
  41. package/dist/logging/index.js +31 -29
  42. package/dist/logging/index.js.map +1 -0
  43. package/dist/react/index.cjs +5 -7
  44. package/dist/react/index.d.cts +4 -0
  45. package/dist/react/index.d.ts +4 -3
  46. package/dist/react/index.js +4 -2
  47. package/dist/react/stream.cjs +14 -15
  48. package/dist/react/stream.cjs.map +1 -0
  49. package/dist/react/stream.custom.cjs +126 -145
  50. package/dist/react/stream.custom.cjs.map +1 -0
  51. package/dist/react/stream.custom.d.cts +39 -0
  52. package/dist/react/stream.custom.d.cts.map +1 -0
  53. package/dist/react/stream.custom.d.ts +35 -37
  54. package/dist/react/stream.custom.d.ts.map +1 -0
  55. package/dist/react/stream.custom.js +122 -137
  56. package/dist/react/stream.custom.js.map +1 -0
  57. package/dist/react/stream.d.cts +73 -0
  58. package/dist/react/stream.d.cts.map +1 -0
  59. package/dist/react/stream.d.ts +21 -15
  60. package/dist/react/stream.d.ts.map +1 -0
  61. package/dist/react/stream.js +12 -11
  62. package/dist/react/stream.js.map +1 -0
  63. package/dist/react/stream.lgp.cjs +438 -495
  64. package/dist/react/stream.lgp.cjs.map +1 -0
  65. package/dist/react/stream.lgp.js +433 -487
  66. package/dist/react/stream.lgp.js.map +1 -0
  67. package/dist/react/thread.cjs +18 -15
  68. package/dist/react/thread.cjs.map +1 -0
  69. package/dist/react/thread.js +19 -13
  70. package/dist/react/thread.js.map +1 -0
  71. package/dist/react/types.d.cts +355 -0
  72. package/dist/react/types.d.cts.map +1 -0
  73. package/dist/react/types.d.ts +333 -329
  74. package/dist/react/types.d.ts.map +1 -0
  75. package/dist/react-ui/client.cjs +123 -184
  76. package/dist/react-ui/client.cjs.map +1 -0
  77. package/dist/react-ui/client.d.cts +90 -0
  78. package/dist/react-ui/client.d.cts.map +1 -0
  79. package/dist/react-ui/client.d.ts +67 -51
  80. package/dist/react-ui/client.d.ts.map +1 -0
  81. package/dist/react-ui/client.js +118 -143
  82. package/dist/react-ui/client.js.map +1 -0
  83. package/dist/react-ui/index.cjs +14 -13
  84. package/dist/react-ui/index.cjs.map +1 -0
  85. package/dist/react-ui/index.d.cts +3 -0
  86. package/dist/react-ui/index.d.ts +3 -2
  87. package/dist/react-ui/index.js +8 -3
  88. package/dist/react-ui/index.js.map +1 -0
  89. package/dist/react-ui/server/index.cjs +5 -7
  90. package/dist/react-ui/server/index.d.cts +3 -0
  91. package/dist/react-ui/server/index.d.ts +3 -2
  92. package/dist/react-ui/server/index.js +4 -2
  93. package/dist/react-ui/server/server.cjs +53 -44
  94. package/dist/react-ui/server/server.cjs.map +1 -0
  95. package/dist/react-ui/server/server.d.cts +55 -0
  96. package/dist/react-ui/server/server.d.cts.map +1 -0
  97. package/dist/react-ui/server/server.d.ts +43 -39
  98. package/dist/react-ui/server/server.d.ts.map +1 -0
  99. package/dist/react-ui/server/server.js +54 -42
  100. package/dist/react-ui/server/server.js.map +1 -0
  101. package/dist/react-ui/types.cjs +32 -36
  102. package/dist/react-ui/types.cjs.map +1 -0
  103. package/dist/react-ui/types.d.cts +25 -0
  104. package/dist/react-ui/types.d.cts.map +1 -0
  105. package/dist/react-ui/types.d.ts +23 -19
  106. package/dist/react-ui/types.d.ts.map +1 -0
  107. package/dist/react-ui/types.js +32 -34
  108. package/dist/react-ui/types.js.map +1 -0
  109. package/dist/schema.d.cts +277 -0
  110. package/dist/schema.d.cts.map +1 -0
  111. package/dist/schema.d.ts +249 -242
  112. package/dist/schema.d.ts.map +1 -0
  113. package/dist/singletons/fetch.cjs +16 -20
  114. package/dist/singletons/fetch.cjs.map +1 -0
  115. package/dist/singletons/fetch.d.cts +14 -0
  116. package/dist/singletons/fetch.d.cts.map +1 -0
  117. package/dist/singletons/fetch.d.ts +5 -2
  118. package/dist/singletons/fetch.d.ts.map +1 -0
  119. package/dist/singletons/fetch.js +16 -17
  120. package/dist/singletons/fetch.js.map +1 -0
  121. package/dist/types.d.cts +187 -0
  122. package/dist/types.d.cts.map +1 -0
  123. package/dist/types.d.ts +178 -173
  124. package/dist/types.d.ts.map +1 -0
  125. package/dist/types.messages.d.cts +91 -0
  126. package/dist/types.messages.d.cts.map +1 -0
  127. package/dist/types.messages.d.ts +71 -66
  128. package/dist/types.messages.d.ts.map +1 -0
  129. package/dist/types.stream.d.cts +235 -0
  130. package/dist/types.stream.d.cts.map +1 -0
  131. package/dist/types.stream.d.ts +149 -142
  132. package/dist/types.stream.d.ts.map +1 -0
  133. package/dist/ui/branching.cjs +145 -141
  134. package/dist/ui/branching.cjs.map +1 -0
  135. package/dist/ui/branching.d.cts +22 -0
  136. package/dist/ui/branching.d.cts.map +1 -0
  137. package/dist/ui/branching.d.ts +17 -30
  138. package/dist/ui/branching.d.ts.map +1 -0
  139. package/dist/ui/branching.js +147 -139
  140. package/dist/ui/branching.js.map +1 -0
  141. package/dist/ui/errors.cjs +14 -12
  142. package/dist/ui/errors.cjs.map +1 -0
  143. package/dist/ui/errors.js +14 -9
  144. package/dist/ui/errors.js.map +1 -0
  145. package/dist/ui/manager.cjs +156 -232
  146. package/dist/ui/manager.cjs.map +1 -0
  147. package/dist/ui/manager.js +156 -228
  148. package/dist/ui/manager.js.map +1 -0
  149. package/dist/ui/messages.cjs +55 -69
  150. package/dist/ui/messages.cjs.map +1 -0
  151. package/dist/ui/messages.js +55 -66
  152. package/dist/ui/messages.js.map +1 -0
  153. package/dist/ui/utils.cjs +10 -10
  154. package/dist/ui/utils.cjs.map +1 -0
  155. package/dist/ui/utils.js +10 -8
  156. package/dist/ui/utils.js.map +1 -0
  157. package/dist/utils/async_caller.cjs +103 -185
  158. package/dist/utils/async_caller.cjs.map +1 -0
  159. package/dist/utils/async_caller.d.cts +53 -0
  160. package/dist/utils/async_caller.d.cts.map +1 -0
  161. package/dist/utils/async_caller.d.ts +36 -31
  162. package/dist/utils/async_caller.d.ts.map +1 -0
  163. package/dist/utils/async_caller.js +101 -177
  164. package/dist/utils/async_caller.js.map +1 -0
  165. package/dist/utils/env.cjs +11 -13
  166. package/dist/utils/env.cjs.map +1 -0
  167. package/dist/utils/env.js +11 -11
  168. package/dist/utils/env.js.map +1 -0
  169. package/dist/utils/signals.cjs +18 -19
  170. package/dist/utils/signals.cjs.map +1 -0
  171. package/dist/utils/signals.js +18 -17
  172. package/dist/utils/signals.js.map +1 -0
  173. package/dist/utils/sse.cjs +110 -140
  174. package/dist/utils/sse.cjs.map +1 -0
  175. package/dist/utils/sse.js +110 -138
  176. package/dist/utils/sse.js.map +1 -0
  177. package/dist/utils/stream.cjs +90 -114
  178. package/dist/utils/stream.cjs.map +1 -0
  179. package/dist/utils/stream.js +90 -111
  180. package/dist/utils/stream.js.map +1 -0
  181. package/package.json +72 -80
  182. package/auth.cjs +0 -1
  183. package/auth.d.cts +0 -1
  184. package/auth.d.ts +0 -1
  185. package/auth.js +0 -1
  186. package/client.cjs +0 -1
  187. package/client.d.cts +0 -1
  188. package/client.d.ts +0 -1
  189. package/client.js +0 -1
  190. package/dist/auth/types.cjs +0 -2
  191. package/dist/auth/types.js +0 -1
  192. package/dist/react/stream.lgp.d.ts +0 -7
  193. package/dist/react/thread.d.ts +0 -4
  194. package/dist/react/types.cjs +0 -2
  195. package/dist/react/types.js +0 -1
  196. package/dist/schema.cjs +0 -2
  197. package/dist/schema.js +0 -1
  198. package/dist/types.cjs +0 -2
  199. package/dist/types.js +0 -1
  200. package/dist/types.messages.cjs +0 -2
  201. package/dist/types.messages.js +0 -1
  202. package/dist/types.stream.cjs +0 -2
  203. package/dist/types.stream.js +0 -1
  204. package/dist/ui/branching.test.cjs +0 -370
  205. package/dist/ui/branching.test.d.ts +0 -1
  206. package/dist/ui/branching.test.js +0 -368
  207. package/dist/ui/errors.d.ts +0 -12
  208. package/dist/ui/manager.d.ts +0 -87
  209. package/dist/ui/messages.d.ts +0 -18
  210. package/dist/ui/utils.d.ts +0 -2
  211. package/dist/utils/env.d.ts +0 -1
  212. package/dist/utils/signals.d.ts +0 -1
  213. package/dist/utils/sse.d.ts +0 -8
  214. package/dist/utils/stream.d.ts +0 -13
  215. package/index.cjs +0 -1
  216. package/index.d.cts +0 -1
  217. package/index.d.ts +0 -1
  218. package/index.js +0 -1
  219. package/logging.cjs +0 -1
  220. package/logging.d.cts +0 -1
  221. package/logging.d.ts +0 -1
  222. package/logging.js +0 -1
  223. package/react-ui/server.cjs +0 -1
  224. package/react-ui/server.d.cts +0 -1
  225. package/react-ui/server.d.ts +0 -1
  226. package/react-ui/server.js +0 -1
  227. package/react-ui.cjs +0 -1
  228. package/react-ui.d.cts +0 -1
  229. package/react-ui.d.ts +0 -1
  230. package/react-ui.js +0 -1
  231. package/react.cjs +0 -1
  232. package/react.d.cts +0 -1
  233. package/react.d.ts +0 -1
  234. package/react.js +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetch.d.ts","names":["overrideFetchImplementation","_getFetchImplementation"],"sources":["../../src/singletons/fetch.d.ts"],"sourcesContent":["/**\n * Overrides the fetch implementation used for LangSmith calls.\n * You should use this if you need to use an implementation of fetch\n * other than the default global (e.g. for dealing with proxies).\n * @param fetch The new fetch function to use.\n */\nexport declare const overrideFetchImplementation: (fetch: (...args: any[]) => any) => void;\n/**\n * @internal\n */\nexport declare const _getFetchImplementation: () => (...args: any[]) => any;\n"],"mappings":";;AAMA;;;;;cAAqBA"}
@@ -1,23 +1,22 @@
1
- /* eslint-disable @typescript-eslint/no-explicit-any */
2
- // Wrap the default fetch call due to issues with illegal invocations
3
- // in some environments:
4
- // https://stackoverflow.com/questions/69876859/why-does-bind-fix-failed-to-execute-fetch-on-window-illegal-invocation-err
5
- // @ts-expect-error Broad typing to support a range of fetch implementations
1
+ //#region src/singletons/fetch.ts
6
2
  const DEFAULT_FETCH_IMPLEMENTATION = (...args) => fetch(...args);
7
3
  const LANGSMITH_FETCH_IMPLEMENTATION_KEY = Symbol.for("lg:fetch_implementation");
8
4
  /**
9
- * Overrides the fetch implementation used for LangSmith calls.
10
- * You should use this if you need to use an implementation of fetch
11
- * other than the default global (e.g. for dealing with proxies).
12
- * @param fetch The new fetch function to use.
13
- */
14
- export const overrideFetchImplementation = (fetch) => {
15
- globalThis[LANGSMITH_FETCH_IMPLEMENTATION_KEY] = fetch;
5
+ * Overrides the fetch implementation used for LangSmith calls.
6
+ * You should use this if you need to use an implementation of fetch
7
+ * other than the default global (e.g. for dealing with proxies).
8
+ * @param fetch The new fetch function to use.
9
+ */
10
+ const overrideFetchImplementation = (fetch$1) => {
11
+ globalThis[LANGSMITH_FETCH_IMPLEMENTATION_KEY] = fetch$1;
16
12
  };
17
13
  /**
18
- * @internal
19
- */
20
- export const _getFetchImplementation = () => {
21
- return (globalThis[LANGSMITH_FETCH_IMPLEMENTATION_KEY] ??
22
- DEFAULT_FETCH_IMPLEMENTATION);
14
+ * @internal
15
+ */
16
+ const _getFetchImplementation = () => {
17
+ return globalThis[LANGSMITH_FETCH_IMPLEMENTATION_KEY] ?? DEFAULT_FETCH_IMPLEMENTATION;
23
18
  };
19
+
20
+ //#endregion
21
+ export { _getFetchImplementation, overrideFetchImplementation };
22
+ //# sourceMappingURL=fetch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetch.js","names":["fetch","_getFetchImplementation: () => (...args: any[]) => any"],"sources":["../../src/singletons/fetch.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n// Wrap the default fetch call due to issues with illegal invocations\n// in some environments:\n// https://stackoverflow.com/questions/69876859/why-does-bind-fix-failed-to-execute-fetch-on-window-illegal-invocation-err\n// @ts-expect-error Broad typing to support a range of fetch implementations\nconst DEFAULT_FETCH_IMPLEMENTATION = (...args: any[]) => fetch(...args);\n\nconst LANGSMITH_FETCH_IMPLEMENTATION_KEY = Symbol.for(\n \"lg:fetch_implementation\"\n);\n\n/**\n * Overrides the fetch implementation used for LangSmith calls.\n * You should use this if you need to use an implementation of fetch\n * other than the default global (e.g. for dealing with proxies).\n * @param fetch The new fetch function to use.\n */\nexport const overrideFetchImplementation = (fetch: (...args: any[]) => any) => {\n (globalThis as any)[LANGSMITH_FETCH_IMPLEMENTATION_KEY] = fetch;\n};\n\n/**\n * @internal\n */\nexport const _getFetchImplementation: () => (...args: any[]) => any = () => {\n return (\n (globalThis as any)[LANGSMITH_FETCH_IMPLEMENTATION_KEY] ??\n DEFAULT_FETCH_IMPLEMENTATION\n );\n};\n"],"mappings":";AAKA,MAAM,gCAAgC,GAAG,SAAgB,MAAM,GAAG;AAElE,MAAM,qCAAqC,OAAO,IAChD;;;;;;;AASF,MAAa,+BAA+B,YAAmC;AAC7E,CAAC,WAAmB,sCAAsCA;;;;;AAM5D,MAAaC,gCAA+D;AAC1E,QACG,WAAmB,uCACpB"}
@@ -0,0 +1,187 @@
1
+ import { Checkpoint, Config, Metadata } from "./schema.cjs";
2
+ import { StreamMode } from "./types.stream.cjs";
3
+ import { LangChainTracer } from "@langchain/core/tracers/tracer_langchain";
4
+
5
+ //#region src/types.d.ts
6
+ type MultitaskStrategy = "reject" | "interrupt" | "rollback" | "enqueue";
7
+ type OnConflictBehavior = "raise" | "do_nothing";
8
+ type OnCompletionBehavior = "complete" | "continue";
9
+ type DisconnectMode = "cancel" | "continue";
10
+ type Durability = "exit" | "async" | "sync";
11
+ type StreamEvent = "events" | "metadata" | "debug" | "updates" | "values" | "messages/partial" | "messages/metadata" | "messages/complete" | "messages" | (string & {}); // eslint-disable-line @typescript-eslint/ban-types
12
+ interface Send {
13
+ node: string;
14
+ input: unknown | null;
15
+ }
16
+ interface Command {
17
+ /**
18
+ * An object to update the thread state with.
19
+ */
20
+ update?: Record<string, unknown> | [string, unknown][] | null;
21
+ /**
22
+ * The value to return from an `interrupt` function call.
23
+ */
24
+ resume?: unknown;
25
+ /**
26
+ * Determine the next node to navigate to. Can be one of the following:
27
+ * - Name(s) of the node names to navigate to next.
28
+ * - `Send` command(s) to execute node(s) with provided input.
29
+ */
30
+ goto?: Send | Send[] | string | string[];
31
+ }
32
+ interface RunsInvokePayload {
33
+ /**
34
+ * Input to the run. Pass `null` to resume from the current state of the thread.
35
+ */
36
+ input?: Record<string, unknown> | null;
37
+ /**
38
+ * Metadata for the run.
39
+ */
40
+ metadata?: Metadata;
41
+ /**
42
+ * Additional configuration for the run.
43
+ */
44
+ config?: Config;
45
+ /**
46
+ * Static context to add to the assistant.
47
+ * @remarks Added in LangGraph.js 0.4
48
+ */
49
+ context?: unknown;
50
+ /**
51
+ * Checkpoint ID for when creating a new run.
52
+ */
53
+ checkpointId?: string;
54
+ /**
55
+ * Checkpoint for when creating a new run.
56
+ */
57
+ checkpoint?: Omit<Checkpoint, "thread_id">;
58
+ /**
59
+ * Whether to checkpoint during the run (or only at the end/interruption).
60
+ * @deprecated Use `durability` instead.
61
+ */
62
+ checkpointDuring?: boolean;
63
+ /**
64
+ * Whether to checkpoint during the run (or only at the end/interruption).
65
+ * - `"async"`: Save checkpoint asynchronously while the next step executes (default).
66
+ * - `"sync"`: Save checkpoint synchronously before the next step starts.
67
+ * - `"exit"`: Save checkpoint only when the graph exits.
68
+ * @default "async"
69
+ */
70
+ durability?: Durability;
71
+ /**
72
+ * Interrupt execution before entering these nodes.
73
+ */
74
+ interruptBefore?: "*" | string[];
75
+ /**
76
+ * Interrupt execution after leaving these nodes.
77
+ */
78
+ interruptAfter?: "*" | string[];
79
+ /**
80
+ * Strategy to handle concurrent runs on the same thread. Only relevant if
81
+ * there is a pending/inflight run on the same thread. One of:
82
+ * - "reject": Reject the new run.
83
+ * - "interrupt": Interrupt the current run, keeping steps completed until now,
84
+ and start a new one.
85
+ * - "rollback": Cancel and delete the existing run, rolling back the thread to
86
+ the state before it had started, then start the new run.
87
+ * - "enqueue": Queue up the new run to start after the current run finishes.
88
+ */
89
+ multitaskStrategy?: MultitaskStrategy;
90
+ /**
91
+ * Abort controller signal to cancel the run.
92
+ */
93
+ signal?: AbortController["signal"];
94
+ /**
95
+ * Behavior to handle run completion. Only relevant if
96
+ * there is a pending/inflight run on the same thread. One of:
97
+ * - "complete": Complete the run.
98
+ * - "continue": Continue the run.
99
+ */
100
+ onCompletion?: OnCompletionBehavior;
101
+ /**
102
+ * Webhook to call when the run is complete.
103
+ */
104
+ webhook?: string;
105
+ /**
106
+ * Behavior to handle disconnection. Only relevant if
107
+ * there is a pending/inflight run on the same thread. One of:
108
+ * - "cancel": Cancel the run.
109
+ * - "continue": Continue the run.
110
+ */
111
+ onDisconnect?: DisconnectMode;
112
+ /**
113
+ * The number of seconds to wait before starting the run.
114
+ * Use to schedule future runs.
115
+ */
116
+ afterSeconds?: number;
117
+ /**
118
+ * Behavior if the specified run doesn't exist. Defaults to "reject".
119
+ */
120
+ ifNotExists?: "create" | "reject";
121
+ /**
122
+ * One or more commands to invoke the graph with.
123
+ */
124
+ command?: Command;
125
+ /**
126
+ * Callback when a run is created.
127
+ */
128
+ onRunCreated?: (params: {
129
+ run_id: string;
130
+ thread_id?: string;
131
+ }) => void;
132
+ /**
133
+ * @internal
134
+ * For LangSmith tracing purposes only. Not part of the public API.
135
+ */
136
+ _langsmithTracer?: LangChainTracer;
137
+ }
138
+ interface RunsStreamPayload<TStreamMode extends StreamMode | StreamMode[] = [], TSubgraphs extends boolean = false> extends RunsInvokePayload {
139
+ /**
140
+ * One of `"values"`, `"messages"`, `"messages-tuple"`, `"updates"`, `"events"`, `"debug"`, `"custom"`.
141
+ */
142
+ streamMode?: TStreamMode;
143
+ /**
144
+ * Stream output from subgraphs. By default, streams only the top graph.
145
+ */
146
+ streamSubgraphs?: TSubgraphs;
147
+ /**
148
+ * Whether the stream is considered resumable.
149
+ * If true, the stream can be resumed and replayed in its entirety even after disconnection.
150
+ */
151
+ streamResumable?: boolean;
152
+ /**
153
+ * Pass one or more feedbackKeys if you want to request short-lived signed URLs
154
+ * for submitting feedback to LangSmith with this key for this run.
155
+ */
156
+ feedbackKeys?: string[];
157
+ }
158
+ interface RunsCreatePayload extends RunsInvokePayload {
159
+ /**
160
+ * One of `"values"`, `"messages"`, `"messages-tuple"`, `"updates"`, `"events"`, `"debug"`, `"custom"`.
161
+ */
162
+ streamMode?: StreamMode | Array<StreamMode>;
163
+ /**
164
+ * Stream output from subgraphs. By default, streams only the top graph.
165
+ */
166
+ streamSubgraphs?: boolean;
167
+ /**
168
+ * Whether the stream is considered resumable.
169
+ * If true, the stream can be resumed and replayed in its entirety even after disconnection.
170
+ */
171
+ streamResumable?: boolean;
172
+ }
173
+ interface CronsCreatePayload extends RunsCreatePayload {
174
+ /**
175
+ * Schedule for running the Cron Job
176
+ */
177
+ schedule: string;
178
+ }
179
+ interface RunsWaitPayload extends RunsStreamPayload {
180
+ /**
181
+ * Raise errors returned by the run. Default is `true`.
182
+ */
183
+ raiseError?: boolean;
184
+ }
185
+ //#endregion
186
+ export { Command, CronsCreatePayload, DisconnectMode, Durability, MultitaskStrategy, OnCompletionBehavior, OnConflictBehavior, RunsCreatePayload, RunsInvokePayload, RunsStreamPayload, RunsWaitPayload, StreamEvent };
187
+ //# sourceMappingURL=types.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.cts","names":["LangChainTracer","Checkpoint","Config","Metadata","StreamMode","MultitaskStrategy","OnConflictBehavior","OnCompletionBehavior","DisconnectMode","Durability","StreamEvent","Send","Command","Record","RunsInvokePayload","Omit","AbortController","RunsStreamPayload","TStreamMode","TSubgraphs","RunsCreatePayload","Array","CronsCreatePayload","RunsWaitPayload"],"sources":["../src/types.d.ts"],"sourcesContent":["import { LangChainTracer } from \"@langchain/core/tracers/tracer_langchain\";\nimport { Checkpoint, Config, Metadata } from \"./schema.js\";\nimport { StreamMode } from \"./types.stream.js\";\nexport type MultitaskStrategy = \"reject\" | \"interrupt\" | \"rollback\" | \"enqueue\";\nexport type OnConflictBehavior = \"raise\" | \"do_nothing\";\nexport type OnCompletionBehavior = \"complete\" | \"continue\";\nexport type DisconnectMode = \"cancel\" | \"continue\";\nexport type Durability = \"exit\" | \"async\" | \"sync\";\nexport type StreamEvent = \"events\" | \"metadata\" | \"debug\" | \"updates\" | \"values\" | \"messages/partial\" | \"messages/metadata\" | \"messages/complete\" | \"messages\" | (string & {}); // eslint-disable-line @typescript-eslint/ban-types\nexport interface Send {\n node: string;\n input: unknown | null;\n}\nexport interface Command {\n /**\n * An object to update the thread state with.\n */\n update?: Record<string, unknown> | [string, unknown][] | null;\n /**\n * The value to return from an `interrupt` function call.\n */\n resume?: unknown;\n /**\n * Determine the next node to navigate to. Can be one of the following:\n * - Name(s) of the node names to navigate to next.\n * - `Send` command(s) to execute node(s) with provided input.\n */\n goto?: Send | Send[] | string | string[];\n}\nexport interface RunsInvokePayload {\n /**\n * Input to the run. Pass `null` to resume from the current state of the thread.\n */\n input?: Record<string, unknown> | null;\n /**\n * Metadata for the run.\n */\n metadata?: Metadata;\n /**\n * Additional configuration for the run.\n */\n config?: Config;\n /**\n * Static context to add to the assistant.\n * @remarks Added in LangGraph.js 0.4\n */\n context?: unknown;\n /**\n * Checkpoint ID for when creating a new run.\n */\n checkpointId?: string;\n /**\n * Checkpoint for when creating a new run.\n */\n checkpoint?: Omit<Checkpoint, \"thread_id\">;\n /**\n * Whether to checkpoint during the run (or only at the end/interruption).\n * @deprecated Use `durability` instead.\n */\n checkpointDuring?: boolean;\n /**\n * Whether to checkpoint during the run (or only at the end/interruption).\n * - `\"async\"`: Save checkpoint asynchronously while the next step executes (default).\n * - `\"sync\"`: Save checkpoint synchronously before the next step starts.\n * - `\"exit\"`: Save checkpoint only when the graph exits.\n * @default \"async\"\n */\n durability?: Durability;\n /**\n * Interrupt execution before entering these nodes.\n */\n interruptBefore?: \"*\" | string[];\n /**\n * Interrupt execution after leaving these nodes.\n */\n interruptAfter?: \"*\" | string[];\n /**\n * Strategy to handle concurrent runs on the same thread. Only relevant if\n * there is a pending/inflight run on the same thread. One of:\n * - \"reject\": Reject the new run.\n * - \"interrupt\": Interrupt the current run, keeping steps completed until now,\n and start a new one.\n * - \"rollback\": Cancel and delete the existing run, rolling back the thread to\n the state before it had started, then start the new run.\n * - \"enqueue\": Queue up the new run to start after the current run finishes.\n */\n multitaskStrategy?: MultitaskStrategy;\n /**\n * Abort controller signal to cancel the run.\n */\n signal?: AbortController[\"signal\"];\n /**\n * Behavior to handle run completion. Only relevant if\n * there is a pending/inflight run on the same thread. One of:\n * - \"complete\": Complete the run.\n * - \"continue\": Continue the run.\n */\n onCompletion?: OnCompletionBehavior;\n /**\n * Webhook to call when the run is complete.\n */\n webhook?: string;\n /**\n * Behavior to handle disconnection. Only relevant if\n * there is a pending/inflight run on the same thread. One of:\n * - \"cancel\": Cancel the run.\n * - \"continue\": Continue the run.\n */\n onDisconnect?: DisconnectMode;\n /**\n * The number of seconds to wait before starting the run.\n * Use to schedule future runs.\n */\n afterSeconds?: number;\n /**\n * Behavior if the specified run doesn't exist. Defaults to \"reject\".\n */\n ifNotExists?: \"create\" | \"reject\";\n /**\n * One or more commands to invoke the graph with.\n */\n command?: Command;\n /**\n * Callback when a run is created.\n */\n onRunCreated?: (params: {\n run_id: string;\n thread_id?: string;\n }) => void;\n /**\n * @internal\n * For LangSmith tracing purposes only. Not part of the public API.\n */\n _langsmithTracer?: LangChainTracer;\n}\nexport interface RunsStreamPayload<TStreamMode extends StreamMode | StreamMode[] = [], TSubgraphs extends boolean = false> extends RunsInvokePayload {\n /**\n * One of `\"values\"`, `\"messages\"`, `\"messages-tuple\"`, `\"updates\"`, `\"events\"`, `\"debug\"`, `\"custom\"`.\n */\n streamMode?: TStreamMode;\n /**\n * Stream output from subgraphs. By default, streams only the top graph.\n */\n streamSubgraphs?: TSubgraphs;\n /**\n * Whether the stream is considered resumable.\n * If true, the stream can be resumed and replayed in its entirety even after disconnection.\n */\n streamResumable?: boolean;\n /**\n * Pass one or more feedbackKeys if you want to request short-lived signed URLs\n * for submitting feedback to LangSmith with this key for this run.\n */\n feedbackKeys?: string[];\n}\nexport interface RunsCreatePayload extends RunsInvokePayload {\n /**\n * One of `\"values\"`, `\"messages\"`, `\"messages-tuple\"`, `\"updates\"`, `\"events\"`, `\"debug\"`, `\"custom\"`.\n */\n streamMode?: StreamMode | Array<StreamMode>;\n /**\n * Stream output from subgraphs. By default, streams only the top graph.\n */\n streamSubgraphs?: boolean;\n /**\n * Whether the stream is considered resumable.\n * If true, the stream can be resumed and replayed in its entirety even after disconnection.\n */\n streamResumable?: boolean;\n}\nexport interface CronsCreatePayload extends RunsCreatePayload {\n /**\n * Schedule for running the Cron Job\n */\n schedule: string;\n}\nexport interface RunsWaitPayload extends RunsStreamPayload {\n /**\n * Raise errors returned by the run. Default is `true`.\n */\n raiseError?: boolean;\n}\n"],"mappings":";;;;;KAGYK,iBAAAA;KACAC,kBAAAA;AADAD,KAEAE,oBAAAA,GAFiB,UAAA,GAAA,UAAA;AACjBD,KAEAE,cAAAA,GAFkB,QAAA,GAAA,UAAA;AAClBD,KAEAE,UAAAA,GAFAF,MAAoB,GAAA,OAAA,GAAA,MAAA;AACpBC,KAEAE,WAAAA,GAFc,QAAA,GAAA,UAAA,GAAA,OAAA,GAAA,SAAA,GAAA,QAAA,GAAA,kBAAA,GAAA,mBAAA,GAAA,mBAAA,GAAA,UAAA,GAAA,CAAA,MAAA,GAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AACdD,UAEKE,IAAAA,CAFK;EACVD,IAAAA,EAAAA,MAAAA;EACKC,KAAAA,EAAI,OAAA,GAAA,IAAA;AAIrB;AAAwB,UAAPC,OAAAA,CAAO;;;;WAIXC;EAYIC;;;QAQFX,CAAAA,EAAAA,OAAAA;;;;;;MAqDFa,CAAAA,EA/DFL,IA+DEK,GA/DKL,IA+DLK,EAAAA,GAAAA,MAAAA,GAAAA,MAAAA,EAAAA;;AAkBMR,UA/EFM,iBAAAA,CA+EEN;;;;EA2BFS,KAAAA,CAAAA,EAtGLJ,MAsGKI,CAAAA,MAAiB,EAAA,OAAA,CAAA,GAAA,IAAA;EAAA;;;UAIjBC,CAAAA,EAtGFf,QAsGEe;;;;EAgBAE,MAAAA,CAAAA,EAlHJlB,MAkHIkB;EAAiB;;;;SAASN,CAAAA,EAAAA,OAAAA;;AAe3C;AAMA;;;;;eA1HiBC,KAAKd;;;;;;;;;;;;;eAaLQ;;;;;;;;;;;;;;;;;;;sBAmBOJ;;;;WAIXW;;;;;;;iBAOMT;;;;;;;;;;;iBAWAC;;;;;;;;;;;;;YAaLI;;;;;;;;;;;;qBAYSZ;;UAENiB,sCAAsCb,aAAaA,+DAA+DU;;;;eAIlHI;;;;oBAIKC;;;;;;;;;;;;UAYLC,iBAAAA,SAA0BN;;;;eAI1BV,aAAaiB,MAAMjB;;;;;;;;;;;UAWnBkB,kBAAAA,SAA2BF;;;;;;UAM3BG,eAAAA,SAAwBN"}
package/dist/types.d.ts CHANGED
@@ -1,182 +1,187 @@
1
- import { LangChainTracer } from "@langchain/core/tracers/tracer_langchain";
2
1
  import { Checkpoint, Config, Metadata } from "./schema.js";
3
2
  import { StreamMode } from "./types.stream.js";
4
- export type MultitaskStrategy = "reject" | "interrupt" | "rollback" | "enqueue";
5
- export type OnConflictBehavior = "raise" | "do_nothing";
6
- export type OnCompletionBehavior = "complete" | "continue";
7
- export type DisconnectMode = "cancel" | "continue";
8
- export type Durability = "exit" | "async" | "sync";
9
- export type StreamEvent = "events" | "metadata" | "debug" | "updates" | "values" | "messages/partial" | "messages/metadata" | "messages/complete" | "messages" | (string & {});
10
- export interface Send {
11
- node: string;
12
- input: unknown | null;
3
+ import { LangChainTracer } from "@langchain/core/tracers/tracer_langchain";
4
+
5
+ //#region src/types.d.ts
6
+ type MultitaskStrategy = "reject" | "interrupt" | "rollback" | "enqueue";
7
+ type OnConflictBehavior = "raise" | "do_nothing";
8
+ type OnCompletionBehavior = "complete" | "continue";
9
+ type DisconnectMode = "cancel" | "continue";
10
+ type Durability = "exit" | "async" | "sync";
11
+ type StreamEvent = "events" | "metadata" | "debug" | "updates" | "values" | "messages/partial" | "messages/metadata" | "messages/complete" | "messages" | (string & {}); // eslint-disable-line @typescript-eslint/ban-types
12
+ interface Send {
13
+ node: string;
14
+ input: unknown | null;
13
15
  }
14
- export interface Command {
15
- /**
16
- * An object to update the thread state with.
17
- */
18
- update?: Record<string, unknown> | [string, unknown][] | null;
19
- /**
20
- * The value to return from an `interrupt` function call.
21
- */
22
- resume?: unknown;
23
- /**
24
- * Determine the next node to navigate to. Can be one of the following:
25
- * - Name(s) of the node names to navigate to next.
26
- * - `Send` command(s) to execute node(s) with provided input.
27
- */
28
- goto?: Send | Send[] | string | string[];
16
+ interface Command {
17
+ /**
18
+ * An object to update the thread state with.
19
+ */
20
+ update?: Record<string, unknown> | [string, unknown][] | null;
21
+ /**
22
+ * The value to return from an `interrupt` function call.
23
+ */
24
+ resume?: unknown;
25
+ /**
26
+ * Determine the next node to navigate to. Can be one of the following:
27
+ * - Name(s) of the node names to navigate to next.
28
+ * - `Send` command(s) to execute node(s) with provided input.
29
+ */
30
+ goto?: Send | Send[] | string | string[];
29
31
  }
30
- export interface RunsInvokePayload {
31
- /**
32
- * Input to the run. Pass `null` to resume from the current state of the thread.
33
- */
34
- input?: Record<string, unknown> | null;
35
- /**
36
- * Metadata for the run.
37
- */
38
- metadata?: Metadata;
39
- /**
40
- * Additional configuration for the run.
41
- */
42
- config?: Config;
43
- /**
44
- * Static context to add to the assistant.
45
- * @remarks Added in LangGraph.js 0.4
46
- */
47
- context?: unknown;
48
- /**
49
- * Checkpoint ID for when creating a new run.
50
- */
51
- checkpointId?: string;
52
- /**
53
- * Checkpoint for when creating a new run.
54
- */
55
- checkpoint?: Omit<Checkpoint, "thread_id">;
56
- /**
57
- * Whether to checkpoint during the run (or only at the end/interruption).
58
- * @deprecated Use `durability` instead.
59
- */
60
- checkpointDuring?: boolean;
61
- /**
62
- * Whether to checkpoint during the run (or only at the end/interruption).
63
- * - `"async"`: Save checkpoint asynchronously while the next step executes (default).
64
- * - `"sync"`: Save checkpoint synchronously before the next step starts.
65
- * - `"exit"`: Save checkpoint only when the graph exits.
66
- * @default "async"
67
- */
68
- durability?: Durability;
69
- /**
70
- * Interrupt execution before entering these nodes.
71
- */
72
- interruptBefore?: "*" | string[];
73
- /**
74
- * Interrupt execution after leaving these nodes.
75
- */
76
- interruptAfter?: "*" | string[];
77
- /**
78
- * Strategy to handle concurrent runs on the same thread. Only relevant if
79
- * there is a pending/inflight run on the same thread. One of:
80
- * - "reject": Reject the new run.
81
- * - "interrupt": Interrupt the current run, keeping steps completed until now,
82
- and start a new one.
83
- * - "rollback": Cancel and delete the existing run, rolling back the thread to
84
- the state before it had started, then start the new run.
85
- * - "enqueue": Queue up the new run to start after the current run finishes.
86
- */
87
- multitaskStrategy?: MultitaskStrategy;
88
- /**
89
- * Abort controller signal to cancel the run.
90
- */
91
- signal?: AbortController["signal"];
92
- /**
93
- * Behavior to handle run completion. Only relevant if
94
- * there is a pending/inflight run on the same thread. One of:
95
- * - "complete": Complete the run.
96
- * - "continue": Continue the run.
97
- */
98
- onCompletion?: OnCompletionBehavior;
99
- /**
100
- * Webhook to call when the run is complete.
101
- */
102
- webhook?: string;
103
- /**
104
- * Behavior to handle disconnection. Only relevant if
105
- * there is a pending/inflight run on the same thread. One of:
106
- * - "cancel": Cancel the run.
107
- * - "continue": Continue the run.
108
- */
109
- onDisconnect?: DisconnectMode;
110
- /**
111
- * The number of seconds to wait before starting the run.
112
- * Use to schedule future runs.
113
- */
114
- afterSeconds?: number;
115
- /**
116
- * Behavior if the specified run doesn't exist. Defaults to "reject".
117
- */
118
- ifNotExists?: "create" | "reject";
119
- /**
120
- * One or more commands to invoke the graph with.
121
- */
122
- command?: Command;
123
- /**
124
- * Callback when a run is created.
125
- */
126
- onRunCreated?: (params: {
127
- run_id: string;
128
- thread_id?: string;
129
- }) => void;
130
- /**
131
- * @internal
132
- * For LangSmith tracing purposes only. Not part of the public API.
133
- */
134
- _langsmithTracer?: LangChainTracer;
32
+ interface RunsInvokePayload {
33
+ /**
34
+ * Input to the run. Pass `null` to resume from the current state of the thread.
35
+ */
36
+ input?: Record<string, unknown> | null;
37
+ /**
38
+ * Metadata for the run.
39
+ */
40
+ metadata?: Metadata;
41
+ /**
42
+ * Additional configuration for the run.
43
+ */
44
+ config?: Config;
45
+ /**
46
+ * Static context to add to the assistant.
47
+ * @remarks Added in LangGraph.js 0.4
48
+ */
49
+ context?: unknown;
50
+ /**
51
+ * Checkpoint ID for when creating a new run.
52
+ */
53
+ checkpointId?: string;
54
+ /**
55
+ * Checkpoint for when creating a new run.
56
+ */
57
+ checkpoint?: Omit<Checkpoint, "thread_id">;
58
+ /**
59
+ * Whether to checkpoint during the run (or only at the end/interruption).
60
+ * @deprecated Use `durability` instead.
61
+ */
62
+ checkpointDuring?: boolean;
63
+ /**
64
+ * Whether to checkpoint during the run (or only at the end/interruption).
65
+ * - `"async"`: Save checkpoint asynchronously while the next step executes (default).
66
+ * - `"sync"`: Save checkpoint synchronously before the next step starts.
67
+ * - `"exit"`: Save checkpoint only when the graph exits.
68
+ * @default "async"
69
+ */
70
+ durability?: Durability;
71
+ /**
72
+ * Interrupt execution before entering these nodes.
73
+ */
74
+ interruptBefore?: "*" | string[];
75
+ /**
76
+ * Interrupt execution after leaving these nodes.
77
+ */
78
+ interruptAfter?: "*" | string[];
79
+ /**
80
+ * Strategy to handle concurrent runs on the same thread. Only relevant if
81
+ * there is a pending/inflight run on the same thread. One of:
82
+ * - "reject": Reject the new run.
83
+ * - "interrupt": Interrupt the current run, keeping steps completed until now,
84
+ and start a new one.
85
+ * - "rollback": Cancel and delete the existing run, rolling back the thread to
86
+ the state before it had started, then start the new run.
87
+ * - "enqueue": Queue up the new run to start after the current run finishes.
88
+ */
89
+ multitaskStrategy?: MultitaskStrategy;
90
+ /**
91
+ * Abort controller signal to cancel the run.
92
+ */
93
+ signal?: AbortController["signal"];
94
+ /**
95
+ * Behavior to handle run completion. Only relevant if
96
+ * there is a pending/inflight run on the same thread. One of:
97
+ * - "complete": Complete the run.
98
+ * - "continue": Continue the run.
99
+ */
100
+ onCompletion?: OnCompletionBehavior;
101
+ /**
102
+ * Webhook to call when the run is complete.
103
+ */
104
+ webhook?: string;
105
+ /**
106
+ * Behavior to handle disconnection. Only relevant if
107
+ * there is a pending/inflight run on the same thread. One of:
108
+ * - "cancel": Cancel the run.
109
+ * - "continue": Continue the run.
110
+ */
111
+ onDisconnect?: DisconnectMode;
112
+ /**
113
+ * The number of seconds to wait before starting the run.
114
+ * Use to schedule future runs.
115
+ */
116
+ afterSeconds?: number;
117
+ /**
118
+ * Behavior if the specified run doesn't exist. Defaults to "reject".
119
+ */
120
+ ifNotExists?: "create" | "reject";
121
+ /**
122
+ * One or more commands to invoke the graph with.
123
+ */
124
+ command?: Command;
125
+ /**
126
+ * Callback when a run is created.
127
+ */
128
+ onRunCreated?: (params: {
129
+ run_id: string;
130
+ thread_id?: string;
131
+ }) => void;
132
+ /**
133
+ * @internal
134
+ * For LangSmith tracing purposes only. Not part of the public API.
135
+ */
136
+ _langsmithTracer?: LangChainTracer;
135
137
  }
136
- export interface RunsStreamPayload<TStreamMode extends StreamMode | StreamMode[] = [], TSubgraphs extends boolean = false> extends RunsInvokePayload {
137
- /**
138
- * One of `"values"`, `"messages"`, `"messages-tuple"`, `"updates"`, `"events"`, `"debug"`, `"custom"`.
139
- */
140
- streamMode?: TStreamMode;
141
- /**
142
- * Stream output from subgraphs. By default, streams only the top graph.
143
- */
144
- streamSubgraphs?: TSubgraphs;
145
- /**
146
- * Whether the stream is considered resumable.
147
- * If true, the stream can be resumed and replayed in its entirety even after disconnection.
148
- */
149
- streamResumable?: boolean;
150
- /**
151
- * Pass one or more feedbackKeys if you want to request short-lived signed URLs
152
- * for submitting feedback to LangSmith with this key for this run.
153
- */
154
- feedbackKeys?: string[];
138
+ interface RunsStreamPayload<TStreamMode extends StreamMode | StreamMode[] = [], TSubgraphs extends boolean = false> extends RunsInvokePayload {
139
+ /**
140
+ * One of `"values"`, `"messages"`, `"messages-tuple"`, `"updates"`, `"events"`, `"debug"`, `"custom"`.
141
+ */
142
+ streamMode?: TStreamMode;
143
+ /**
144
+ * Stream output from subgraphs. By default, streams only the top graph.
145
+ */
146
+ streamSubgraphs?: TSubgraphs;
147
+ /**
148
+ * Whether the stream is considered resumable.
149
+ * If true, the stream can be resumed and replayed in its entirety even after disconnection.
150
+ */
151
+ streamResumable?: boolean;
152
+ /**
153
+ * Pass one or more feedbackKeys if you want to request short-lived signed URLs
154
+ * for submitting feedback to LangSmith with this key for this run.
155
+ */
156
+ feedbackKeys?: string[];
155
157
  }
156
- export interface RunsCreatePayload extends RunsInvokePayload {
157
- /**
158
- * One of `"values"`, `"messages"`, `"messages-tuple"`, `"updates"`, `"events"`, `"debug"`, `"custom"`.
159
- */
160
- streamMode?: StreamMode | Array<StreamMode>;
161
- /**
162
- * Stream output from subgraphs. By default, streams only the top graph.
163
- */
164
- streamSubgraphs?: boolean;
165
- /**
166
- * Whether the stream is considered resumable.
167
- * If true, the stream can be resumed and replayed in its entirety even after disconnection.
168
- */
169
- streamResumable?: boolean;
158
+ interface RunsCreatePayload extends RunsInvokePayload {
159
+ /**
160
+ * One of `"values"`, `"messages"`, `"messages-tuple"`, `"updates"`, `"events"`, `"debug"`, `"custom"`.
161
+ */
162
+ streamMode?: StreamMode | Array<StreamMode>;
163
+ /**
164
+ * Stream output from subgraphs. By default, streams only the top graph.
165
+ */
166
+ streamSubgraphs?: boolean;
167
+ /**
168
+ * Whether the stream is considered resumable.
169
+ * If true, the stream can be resumed and replayed in its entirety even after disconnection.
170
+ */
171
+ streamResumable?: boolean;
170
172
  }
171
- export interface CronsCreatePayload extends RunsCreatePayload {
172
- /**
173
- * Schedule for running the Cron Job
174
- */
175
- schedule: string;
173
+ interface CronsCreatePayload extends RunsCreatePayload {
174
+ /**
175
+ * Schedule for running the Cron Job
176
+ */
177
+ schedule: string;
176
178
  }
177
- export interface RunsWaitPayload extends RunsStreamPayload {
178
- /**
179
- * Raise errors returned by the run. Default is `true`.
180
- */
181
- raiseError?: boolean;
179
+ interface RunsWaitPayload extends RunsStreamPayload {
180
+ /**
181
+ * Raise errors returned by the run. Default is `true`.
182
+ */
183
+ raiseError?: boolean;
182
184
  }
185
+ //#endregion
186
+ export { Command, CronsCreatePayload, DisconnectMode, Durability, MultitaskStrategy, OnCompletionBehavior, OnConflictBehavior, RunsCreatePayload, RunsInvokePayload, RunsStreamPayload, RunsWaitPayload, StreamEvent };
187
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","names":["LangChainTracer","Checkpoint","Config","Metadata","StreamMode","MultitaskStrategy","OnConflictBehavior","OnCompletionBehavior","DisconnectMode","Durability","StreamEvent","Send","Command","Record","RunsInvokePayload","Omit","AbortController","RunsStreamPayload","TStreamMode","TSubgraphs","RunsCreatePayload","Array","CronsCreatePayload","RunsWaitPayload"],"sources":["../src/types.d.ts"],"sourcesContent":["import { LangChainTracer } from \"@langchain/core/tracers/tracer_langchain\";\nimport { Checkpoint, Config, Metadata } from \"./schema.js\";\nimport { StreamMode } from \"./types.stream.js\";\nexport type MultitaskStrategy = \"reject\" | \"interrupt\" | \"rollback\" | \"enqueue\";\nexport type OnConflictBehavior = \"raise\" | \"do_nothing\";\nexport type OnCompletionBehavior = \"complete\" | \"continue\";\nexport type DisconnectMode = \"cancel\" | \"continue\";\nexport type Durability = \"exit\" | \"async\" | \"sync\";\nexport type StreamEvent = \"events\" | \"metadata\" | \"debug\" | \"updates\" | \"values\" | \"messages/partial\" | \"messages/metadata\" | \"messages/complete\" | \"messages\" | (string & {}); // eslint-disable-line @typescript-eslint/ban-types\nexport interface Send {\n node: string;\n input: unknown | null;\n}\nexport interface Command {\n /**\n * An object to update the thread state with.\n */\n update?: Record<string, unknown> | [string, unknown][] | null;\n /**\n * The value to return from an `interrupt` function call.\n */\n resume?: unknown;\n /**\n * Determine the next node to navigate to. Can be one of the following:\n * - Name(s) of the node names to navigate to next.\n * - `Send` command(s) to execute node(s) with provided input.\n */\n goto?: Send | Send[] | string | string[];\n}\nexport interface RunsInvokePayload {\n /**\n * Input to the run. Pass `null` to resume from the current state of the thread.\n */\n input?: Record<string, unknown> | null;\n /**\n * Metadata for the run.\n */\n metadata?: Metadata;\n /**\n * Additional configuration for the run.\n */\n config?: Config;\n /**\n * Static context to add to the assistant.\n * @remarks Added in LangGraph.js 0.4\n */\n context?: unknown;\n /**\n * Checkpoint ID for when creating a new run.\n */\n checkpointId?: string;\n /**\n * Checkpoint for when creating a new run.\n */\n checkpoint?: Omit<Checkpoint, \"thread_id\">;\n /**\n * Whether to checkpoint during the run (or only at the end/interruption).\n * @deprecated Use `durability` instead.\n */\n checkpointDuring?: boolean;\n /**\n * Whether to checkpoint during the run (or only at the end/interruption).\n * - `\"async\"`: Save checkpoint asynchronously while the next step executes (default).\n * - `\"sync\"`: Save checkpoint synchronously before the next step starts.\n * - `\"exit\"`: Save checkpoint only when the graph exits.\n * @default \"async\"\n */\n durability?: Durability;\n /**\n * Interrupt execution before entering these nodes.\n */\n interruptBefore?: \"*\" | string[];\n /**\n * Interrupt execution after leaving these nodes.\n */\n interruptAfter?: \"*\" | string[];\n /**\n * Strategy to handle concurrent runs on the same thread. Only relevant if\n * there is a pending/inflight run on the same thread. One of:\n * - \"reject\": Reject the new run.\n * - \"interrupt\": Interrupt the current run, keeping steps completed until now,\n and start a new one.\n * - \"rollback\": Cancel and delete the existing run, rolling back the thread to\n the state before it had started, then start the new run.\n * - \"enqueue\": Queue up the new run to start after the current run finishes.\n */\n multitaskStrategy?: MultitaskStrategy;\n /**\n * Abort controller signal to cancel the run.\n */\n signal?: AbortController[\"signal\"];\n /**\n * Behavior to handle run completion. Only relevant if\n * there is a pending/inflight run on the same thread. One of:\n * - \"complete\": Complete the run.\n * - \"continue\": Continue the run.\n */\n onCompletion?: OnCompletionBehavior;\n /**\n * Webhook to call when the run is complete.\n */\n webhook?: string;\n /**\n * Behavior to handle disconnection. Only relevant if\n * there is a pending/inflight run on the same thread. One of:\n * - \"cancel\": Cancel the run.\n * - \"continue\": Continue the run.\n */\n onDisconnect?: DisconnectMode;\n /**\n * The number of seconds to wait before starting the run.\n * Use to schedule future runs.\n */\n afterSeconds?: number;\n /**\n * Behavior if the specified run doesn't exist. Defaults to \"reject\".\n */\n ifNotExists?: \"create\" | \"reject\";\n /**\n * One or more commands to invoke the graph with.\n */\n command?: Command;\n /**\n * Callback when a run is created.\n */\n onRunCreated?: (params: {\n run_id: string;\n thread_id?: string;\n }) => void;\n /**\n * @internal\n * For LangSmith tracing purposes only. Not part of the public API.\n */\n _langsmithTracer?: LangChainTracer;\n}\nexport interface RunsStreamPayload<TStreamMode extends StreamMode | StreamMode[] = [], TSubgraphs extends boolean = false> extends RunsInvokePayload {\n /**\n * One of `\"values\"`, `\"messages\"`, `\"messages-tuple\"`, `\"updates\"`, `\"events\"`, `\"debug\"`, `\"custom\"`.\n */\n streamMode?: TStreamMode;\n /**\n * Stream output from subgraphs. By default, streams only the top graph.\n */\n streamSubgraphs?: TSubgraphs;\n /**\n * Whether the stream is considered resumable.\n * If true, the stream can be resumed and replayed in its entirety even after disconnection.\n */\n streamResumable?: boolean;\n /**\n * Pass one or more feedbackKeys if you want to request short-lived signed URLs\n * for submitting feedback to LangSmith with this key for this run.\n */\n feedbackKeys?: string[];\n}\nexport interface RunsCreatePayload extends RunsInvokePayload {\n /**\n * One of `\"values\"`, `\"messages\"`, `\"messages-tuple\"`, `\"updates\"`, `\"events\"`, `\"debug\"`, `\"custom\"`.\n */\n streamMode?: StreamMode | Array<StreamMode>;\n /**\n * Stream output from subgraphs. By default, streams only the top graph.\n */\n streamSubgraphs?: boolean;\n /**\n * Whether the stream is considered resumable.\n * If true, the stream can be resumed and replayed in its entirety even after disconnection.\n */\n streamResumable?: boolean;\n}\nexport interface CronsCreatePayload extends RunsCreatePayload {\n /**\n * Schedule for running the Cron Job\n */\n schedule: string;\n}\nexport interface RunsWaitPayload extends RunsStreamPayload {\n /**\n * Raise errors returned by the run. Default is `true`.\n */\n raiseError?: boolean;\n}\n"],"mappings":";;;;;KAGYK,iBAAAA;KACAC,kBAAAA;AADAD,KAEAE,oBAAAA,GAFiB,UAAA,GAAA,UAAA;AACjBD,KAEAE,cAAAA,GAFkB,QAAA,GAAA,UAAA;AAClBD,KAEAE,UAAAA,GAFAF,MAAoB,GAAA,OAAA,GAAA,MAAA;AACpBC,KAEAE,WAAAA,GAFc,QAAA,GAAA,UAAA,GAAA,OAAA,GAAA,SAAA,GAAA,QAAA,GAAA,kBAAA,GAAA,mBAAA,GAAA,mBAAA,GAAA,UAAA,GAAA,CAAA,MAAA,GAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AACdD,UAEKE,IAAAA,CAFK;EACVD,IAAAA,EAAAA,MAAAA;EACKC,KAAAA,EAAI,OAAA,GAAA,IAAA;AAIrB;AAAwB,UAAPC,OAAAA,CAAO;;;;WAIXC;EAYIC;;;QAQFX,CAAAA,EAAAA,OAAAA;;;;;;MAqDFa,CAAAA,EA/DFL,IA+DEK,GA/DKL,IA+DLK,EAAAA,GAAAA,MAAAA,GAAAA,MAAAA,EAAAA;;AAkBMR,UA/EFM,iBAAAA,CA+EEN;;;;EA2BFS,KAAAA,CAAAA,EAtGLJ,MAsGKI,CAAAA,MAAiB,EAAA,OAAA,CAAA,GAAA,IAAA;EAAA;;;UAIjBC,CAAAA,EAtGFf,QAsGEe;;;;EAgBAE,MAAAA,CAAAA,EAlHJlB,MAkHIkB;EAAiB;;;;SAASN,CAAAA,EAAAA,OAAAA;;AAe3C;AAMA;;;;;eA1HiBC,KAAKd;;;;;;;;;;;;;eAaLQ;;;;;;;;;;;;;;;;;;;sBAmBOJ;;;;WAIXW;;;;;;;iBAOMT;;;;;;;;;;;iBAWAC;;;;;;;;;;;;;YAaLI;;;;;;;;;;;;qBAYSZ;;UAENiB,sCAAsCb,aAAaA,+DAA+DU;;;;eAIlHI;;;;oBAIKC;;;;;;;;;;;;UAYLC,iBAAAA,SAA0BN;;;;eAI1BV,aAAaiB,MAAMjB;;;;;;;;;;;UAWnBkB,kBAAAA,SAA2BF;;;;;;UAM3BG,eAAAA,SAAwBN"}