@langchain/langgraph-sdk 0.1.10 → 1.0.1

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 (235) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/README.md +11 -0
  3. package/dist/_virtual/rolldown_runtime.cjs +25 -0
  4. package/dist/auth/error.cjs +76 -86
  5. package/dist/auth/error.cjs.map +1 -0
  6. package/dist/auth/error.d.cts +13 -0
  7. package/dist/auth/error.d.cts.map +1 -0
  8. package/dist/auth/error.d.ts +12 -8
  9. package/dist/auth/error.d.ts.map +1 -0
  10. package/dist/auth/error.js +76 -83
  11. package/dist/auth/error.js.map +1 -0
  12. package/dist/auth/index.cjs +36 -44
  13. package/dist/auth/index.cjs.map +1 -0
  14. package/dist/auth/index.d.cts +31 -0
  15. package/dist/auth/index.d.cts.map +1 -0
  16. package/dist/auth/index.d.ts +20 -15
  17. package/dist/auth/index.d.ts.map +1 -0
  18. package/dist/auth/index.js +35 -39
  19. package/dist/auth/index.js.map +1 -0
  20. package/dist/auth/types.d.cts +294 -0
  21. package/dist/auth/types.d.cts.map +1 -0
  22. package/dist/auth/types.d.ts +162 -165
  23. package/dist/auth/types.d.ts.map +1 -0
  24. package/dist/client.cjs +1110 -1294
  25. package/dist/client.cjs.map +1 -0
  26. package/dist/client.d.cts +697 -0
  27. package/dist/client.d.cts.map +1 -0
  28. package/dist/client.d.ts +656 -639
  29. package/dist/client.d.ts.map +1 -0
  30. package/dist/client.js +1101 -1281
  31. package/dist/client.js.map +1 -0
  32. package/dist/index.cjs +6 -8
  33. package/dist/index.d.cts +7 -0
  34. package/dist/index.d.ts +7 -7
  35. package/dist/index.js +4 -2
  36. package/dist/logging/index.cjs +30 -31
  37. package/dist/logging/index.cjs.map +1 -0
  38. package/dist/logging/index.d.cts +47 -0
  39. package/dist/logging/index.d.cts.map +1 -0
  40. package/dist/logging/index.d.ts +20 -16
  41. package/dist/logging/index.d.ts.map +1 -0
  42. package/dist/logging/index.js +31 -29
  43. package/dist/logging/index.js.map +1 -0
  44. package/dist/react/index.cjs +5 -7
  45. package/dist/react/index.d.cts +4 -0
  46. package/dist/react/index.d.ts +4 -3
  47. package/dist/react/index.js +4 -2
  48. package/dist/react/stream.cjs +14 -15
  49. package/dist/react/stream.cjs.map +1 -0
  50. package/dist/react/stream.custom.cjs +126 -145
  51. package/dist/react/stream.custom.cjs.map +1 -0
  52. package/dist/react/stream.custom.d.cts +39 -0
  53. package/dist/react/stream.custom.d.cts.map +1 -0
  54. package/dist/react/stream.custom.d.ts +35 -37
  55. package/dist/react/stream.custom.d.ts.map +1 -0
  56. package/dist/react/stream.custom.js +122 -137
  57. package/dist/react/stream.custom.js.map +1 -0
  58. package/dist/react/stream.d.cts +73 -0
  59. package/dist/react/stream.d.cts.map +1 -0
  60. package/dist/react/stream.d.ts +21 -15
  61. package/dist/react/stream.d.ts.map +1 -0
  62. package/dist/react/stream.js +12 -11
  63. package/dist/react/stream.js.map +1 -0
  64. package/dist/react/stream.lgp.cjs +438 -498
  65. package/dist/react/stream.lgp.cjs.map +1 -0
  66. package/dist/react/stream.lgp.js +433 -490
  67. package/dist/react/stream.lgp.js.map +1 -0
  68. package/dist/react/thread.cjs +18 -15
  69. package/dist/react/thread.cjs.map +1 -0
  70. package/dist/react/thread.js +19 -13
  71. package/dist/react/thread.js.map +1 -0
  72. package/dist/react/types.d.cts +356 -0
  73. package/dist/react/types.d.cts.map +1 -0
  74. package/dist/react/types.d.ts +334 -329
  75. package/dist/react/types.d.ts.map +1 -0
  76. package/dist/react-ui/client.cjs +123 -184
  77. package/dist/react-ui/client.cjs.map +1 -0
  78. package/dist/react-ui/client.d.cts +90 -0
  79. package/dist/react-ui/client.d.cts.map +1 -0
  80. package/dist/react-ui/client.d.ts +67 -51
  81. package/dist/react-ui/client.d.ts.map +1 -0
  82. package/dist/react-ui/client.js +118 -143
  83. package/dist/react-ui/client.js.map +1 -0
  84. package/dist/react-ui/index.cjs +14 -13
  85. package/dist/react-ui/index.cjs.map +1 -0
  86. package/dist/react-ui/index.d.cts +3 -0
  87. package/dist/react-ui/index.d.ts +3 -2
  88. package/dist/react-ui/index.js +8 -3
  89. package/dist/react-ui/index.js.map +1 -0
  90. package/dist/react-ui/server/index.cjs +5 -7
  91. package/dist/react-ui/server/index.d.cts +3 -0
  92. package/dist/react-ui/server/index.d.ts +3 -2
  93. package/dist/react-ui/server/index.js +4 -2
  94. package/dist/react-ui/server/server.cjs +53 -44
  95. package/dist/react-ui/server/server.cjs.map +1 -0
  96. package/dist/react-ui/server/server.d.cts +55 -0
  97. package/dist/react-ui/server/server.d.cts.map +1 -0
  98. package/dist/react-ui/server/server.d.ts +43 -39
  99. package/dist/react-ui/server/server.d.ts.map +1 -0
  100. package/dist/react-ui/server/server.js +54 -42
  101. package/dist/react-ui/server/server.js.map +1 -0
  102. package/dist/react-ui/types.cjs +32 -36
  103. package/dist/react-ui/types.cjs.map +1 -0
  104. package/dist/react-ui/types.d.cts +25 -0
  105. package/dist/react-ui/types.d.cts.map +1 -0
  106. package/dist/react-ui/types.d.ts +23 -19
  107. package/dist/react-ui/types.d.ts.map +1 -0
  108. package/dist/react-ui/types.js +32 -34
  109. package/dist/react-ui/types.js.map +1 -0
  110. package/dist/schema.d.cts +278 -0
  111. package/dist/schema.d.cts.map +1 -0
  112. package/dist/schema.d.ts +250 -242
  113. package/dist/schema.d.ts.map +1 -0
  114. package/dist/singletons/fetch.cjs +16 -20
  115. package/dist/singletons/fetch.cjs.map +1 -0
  116. package/dist/singletons/fetch.d.cts +14 -0
  117. package/dist/singletons/fetch.d.cts.map +1 -0
  118. package/dist/singletons/fetch.d.ts +5 -2
  119. package/dist/singletons/fetch.d.ts.map +1 -0
  120. package/dist/singletons/fetch.js +16 -17
  121. package/dist/singletons/fetch.js.map +1 -0
  122. package/dist/types.d.cts +187 -0
  123. package/dist/types.d.cts.map +1 -0
  124. package/dist/types.d.ts +178 -173
  125. package/dist/types.d.ts.map +1 -0
  126. package/dist/types.messages.d.cts +91 -0
  127. package/dist/types.messages.d.cts.map +1 -0
  128. package/dist/types.messages.d.ts +71 -66
  129. package/dist/types.messages.d.ts.map +1 -0
  130. package/dist/types.stream.d.cts +235 -0
  131. package/dist/types.stream.d.cts.map +1 -0
  132. package/dist/types.stream.d.ts +149 -142
  133. package/dist/types.stream.d.ts.map +1 -0
  134. package/dist/ui/branching.cjs +145 -141
  135. package/dist/ui/branching.cjs.map +1 -0
  136. package/dist/ui/branching.d.cts +22 -0
  137. package/dist/ui/branching.d.cts.map +1 -0
  138. package/dist/ui/branching.d.ts +17 -30
  139. package/dist/ui/branching.d.ts.map +1 -0
  140. package/dist/ui/branching.js +147 -139
  141. package/dist/ui/branching.js.map +1 -0
  142. package/dist/ui/errors.cjs +14 -12
  143. package/dist/ui/errors.cjs.map +1 -0
  144. package/dist/ui/errors.js +14 -9
  145. package/dist/ui/errors.js.map +1 -0
  146. package/dist/ui/manager.cjs +156 -232
  147. package/dist/ui/manager.cjs.map +1 -0
  148. package/dist/ui/manager.js +156 -228
  149. package/dist/ui/manager.js.map +1 -0
  150. package/dist/ui/messages.cjs +55 -69
  151. package/dist/ui/messages.cjs.map +1 -0
  152. package/dist/ui/messages.js +55 -66
  153. package/dist/ui/messages.js.map +1 -0
  154. package/dist/ui/utils.cjs +10 -10
  155. package/dist/ui/utils.cjs.map +1 -0
  156. package/dist/ui/utils.js +10 -8
  157. package/dist/ui/utils.js.map +1 -0
  158. package/dist/utils/async_caller.cjs +103 -185
  159. package/dist/utils/async_caller.cjs.map +1 -0
  160. package/dist/utils/async_caller.d.cts +53 -0
  161. package/dist/utils/async_caller.d.cts.map +1 -0
  162. package/dist/utils/async_caller.d.ts +36 -31
  163. package/dist/utils/async_caller.d.ts.map +1 -0
  164. package/dist/utils/async_caller.js +101 -177
  165. package/dist/utils/async_caller.js.map +1 -0
  166. package/dist/utils/env.cjs +11 -13
  167. package/dist/utils/env.cjs.map +1 -0
  168. package/dist/utils/env.js +11 -11
  169. package/dist/utils/env.js.map +1 -0
  170. package/dist/utils/signals.cjs +18 -19
  171. package/dist/utils/signals.cjs.map +1 -0
  172. package/dist/utils/signals.js +18 -17
  173. package/dist/utils/signals.js.map +1 -0
  174. package/dist/utils/sse.cjs +110 -140
  175. package/dist/utils/sse.cjs.map +1 -0
  176. package/dist/utils/sse.js +110 -138
  177. package/dist/utils/sse.js.map +1 -0
  178. package/dist/utils/stream.cjs +90 -114
  179. package/dist/utils/stream.cjs.map +1 -0
  180. package/dist/utils/stream.js +90 -111
  181. package/dist/utils/stream.js.map +1 -0
  182. package/package.json +73 -81
  183. package/auth.cjs +0 -1
  184. package/auth.d.cts +0 -1
  185. package/auth.d.ts +0 -1
  186. package/auth.js +0 -1
  187. package/client.cjs +0 -1
  188. package/client.d.cts +0 -1
  189. package/client.d.ts +0 -1
  190. package/client.js +0 -1
  191. package/dist/auth/types.cjs +0 -2
  192. package/dist/auth/types.js +0 -1
  193. package/dist/react/stream.lgp.d.ts +0 -7
  194. package/dist/react/thread.d.ts +0 -4
  195. package/dist/react/types.cjs +0 -2
  196. package/dist/react/types.js +0 -1
  197. package/dist/schema.cjs +0 -2
  198. package/dist/schema.js +0 -1
  199. package/dist/types.cjs +0 -2
  200. package/dist/types.js +0 -1
  201. package/dist/types.messages.cjs +0 -2
  202. package/dist/types.messages.js +0 -1
  203. package/dist/types.stream.cjs +0 -2
  204. package/dist/types.stream.js +0 -1
  205. package/dist/ui/branching.test.cjs +0 -370
  206. package/dist/ui/branching.test.d.ts +0 -1
  207. package/dist/ui/branching.test.js +0 -368
  208. package/dist/ui/errors.d.ts +0 -12
  209. package/dist/ui/manager.d.ts +0 -87
  210. package/dist/ui/messages.d.ts +0 -18
  211. package/dist/ui/utils.d.ts +0 -2
  212. package/dist/utils/env.d.ts +0 -1
  213. package/dist/utils/signals.d.ts +0 -1
  214. package/dist/utils/sse.d.ts +0 -8
  215. package/dist/utils/stream.d.ts +0 -13
  216. package/index.cjs +0 -1
  217. package/index.d.cts +0 -1
  218. package/index.d.ts +0 -1
  219. package/index.js +0 -1
  220. package/logging.cjs +0 -1
  221. package/logging.d.cts +0 -1
  222. package/logging.d.ts +0 -1
  223. package/logging.js +0 -1
  224. package/react-ui/server.cjs +0 -1
  225. package/react-ui/server.d.cts +0 -1
  226. package/react-ui/server.d.ts +0 -1
  227. package/react-ui/server.js +0 -1
  228. package/react-ui.cjs +0 -1
  229. package/react-ui.d.cts +0 -1
  230. package/react-ui.d.ts +0 -1
  231. package/react-ui.js +0 -1
  232. package/react.cjs +0 -1
  233. package/react.d.cts +0 -1
  234. package/react.d.ts +0 -1
  235. package/react.js +0 -1
package/dist/schema.d.ts CHANGED
@@ -1,270 +1,278 @@
1
- import type { JSONSchema7 } from "json-schema";
1
+ import { JSONSchema7 } from "json-schema";
2
+
3
+ //#region src/schema.d.ts
2
4
  type Optional<T> = T | null | undefined;
3
- export type RunStatus = "pending" | "running" | "error" | "success" | "timeout" | "interrupted";
4
- export type ThreadStatus = "idle" | "busy" | "interrupted" | "error";
5
+ type RunStatus = "pending" | "running" | "error" | "success" | "timeout" | "interrupted";
6
+ type ThreadStatus = "idle" | "busy" | "interrupted" | "error";
5
7
  type MultitaskStrategy = "reject" | "interrupt" | "rollback" | "enqueue";
6
- export type CancelAction = "interrupt" | "rollback";
7
- export type Config = {
8
+ type CancelAction = "interrupt" | "rollback";
9
+ type Config = {
10
+ /**
11
+ * Tags for this call and any sub-calls (eg. a Chain calling an LLM).
12
+ * You can use these to filter calls.
13
+ */
14
+ tags?: string[];
15
+ /**
16
+ * Maximum number of times a call can recurse.
17
+ * If not provided, defaults to 25.
18
+ */
19
+ recursion_limit?: number;
20
+ /**
21
+ * Runtime values for attributes previously made configurable on this Runnable.
22
+ */
23
+ configurable?: {
8
24
  /**
9
- * Tags for this call and any sub-calls (eg. a Chain calling an LLM).
10
- * You can use these to filter calls.
25
+ * ID of the thread
11
26
  */
12
- tags?: string[];
27
+ thread_id?: Optional<string>;
13
28
  /**
14
- * Maximum number of times a call can recurse.
15
- * If not provided, defaults to 25.
29
+ * Timestamp of the state checkpoint
16
30
  */
17
- recursion_limit?: number;
18
- /**
19
- * Runtime values for attributes previously made configurable on this Runnable.
20
- */
21
- configurable?: {
22
- /**
23
- * ID of the thread
24
- */
25
- thread_id?: Optional<string>;
26
- /**
27
- * Timestamp of the state checkpoint
28
- */
29
- checkpoint_id?: Optional<string>;
30
- [key: string]: unknown;
31
- };
31
+ checkpoint_id?: Optional<string>;
32
+ [key: string]: unknown;
33
+ };
32
34
  };
33
- export interface GraphSchema {
34
- /**
35
- * The ID of the graph.
36
- */
37
- graph_id: string;
38
- /**
39
- * The schema for the input state.
40
- * Missing if unable to generate JSON schema from graph.
41
- */
42
- input_schema?: JSONSchema7 | null | undefined;
43
- /**
44
- * The schema for the output state.
45
- * Missing if unable to generate JSON schema from graph.
46
- */
47
- output_schema?: JSONSchema7 | null | undefined;
48
- /**
49
- * The schema for the graph state.
50
- * Missing if unable to generate JSON schema from graph.
51
- */
52
- state_schema?: JSONSchema7 | null | undefined;
53
- /**
54
- * The schema for the graph config.
55
- * Missing if unable to generate JSON schema from graph.
56
- */
57
- config_schema?: JSONSchema7 | null | undefined;
58
- /**
59
- * The schema for the graph context.
60
- * Missing if unable to generate JSON schema from graph.
61
- */
62
- context_schema?: JSONSchema7 | null | undefined;
35
+ interface GraphSchema {
36
+ /**
37
+ * The ID of the graph.
38
+ */
39
+ graph_id: string;
40
+ /**
41
+ * The schema for the input state.
42
+ * Missing if unable to generate JSON schema from graph.
43
+ */
44
+ input_schema?: JSONSchema7 | null | undefined;
45
+ /**
46
+ * The schema for the output state.
47
+ * Missing if unable to generate JSON schema from graph.
48
+ */
49
+ output_schema?: JSONSchema7 | null | undefined;
50
+ /**
51
+ * The schema for the graph state.
52
+ * Missing if unable to generate JSON schema from graph.
53
+ */
54
+ state_schema?: JSONSchema7 | null | undefined;
55
+ /**
56
+ * The schema for the graph config.
57
+ * Missing if unable to generate JSON schema from graph.
58
+ */
59
+ config_schema?: JSONSchema7 | null | undefined;
60
+ /**
61
+ * The schema for the graph context.
62
+ * Missing if unable to generate JSON schema from graph.
63
+ */
64
+ context_schema?: JSONSchema7 | null | undefined;
63
65
  }
64
- export type Subgraphs = Record<string, GraphSchema>;
65
- export type Metadata = Optional<{
66
- source?: "input" | "loop" | "update" | (string & {});
67
- step?: number;
68
- writes?: Record<string, unknown> | null;
69
- parents?: Record<string, string>;
70
- [key: string]: unknown;
66
+ type Subgraphs = Record<string, GraphSchema>;
67
+ type Metadata = Optional<{
68
+ source?: "input" | "loop" | "update" | (string & {}); // eslint-disable-line @typescript-eslint/ban-types
69
+ step?: number;
70
+ writes?: Record<string, unknown> | null;
71
+ parents?: Record<string, string>;
72
+ [key: string]: unknown;
71
73
  }>;
72
- export interface AssistantBase {
73
- /** The ID of the assistant. */
74
- assistant_id: string;
75
- /** The ID of the graph. */
76
- graph_id: string;
77
- /** The assistant config. */
78
- config: Config;
79
- /** The assistant context. */
80
- context: unknown;
81
- /** The time the assistant was created. */
82
- created_at: string;
83
- /** The assistant metadata. */
84
- metadata: Metadata;
85
- /** The version of the assistant. */
86
- version: number;
87
- /** The name of the assistant */
88
- name: string;
89
- /** The description of the assistant */
90
- description?: string;
74
+ interface AssistantBase {
75
+ /** The ID of the assistant. */
76
+ assistant_id: string;
77
+ /** The ID of the graph. */
78
+ graph_id: string;
79
+ /** The assistant config. */
80
+ config: Config;
81
+ /** The assistant context. */
82
+ context: unknown;
83
+ /** The time the assistant was created. */
84
+ created_at: string;
85
+ /** The assistant metadata. */
86
+ metadata: Metadata;
87
+ /** The version of the assistant. */
88
+ version: number;
89
+ /** The name of the assistant */
90
+ name: string;
91
+ /** The description of the assistant */
92
+ description?: string;
91
93
  }
92
- export interface AssistantVersion extends AssistantBase {
94
+ interface AssistantVersion extends AssistantBase {}
95
+ interface Assistant extends AssistantBase {
96
+ /** The last time the assistant was updated. */
97
+ updated_at: string;
93
98
  }
94
- export interface Assistant extends AssistantBase {
95
- /** The last time the assistant was updated. */
96
- updated_at: string;
97
- }
98
- export interface AssistantGraph {
99
- nodes: Array<{
100
- id: string | number;
101
- name?: string;
102
- data?: Record<string, any> | string;
103
- metadata?: unknown;
104
- }>;
105
- edges: Array<{
106
- source: string;
107
- target: string;
108
- data?: string;
109
- conditional?: boolean;
110
- }>;
99
+ interface AssistantGraph {
100
+ nodes: Array<{
101
+ id: string | number;
102
+ name?: string;
103
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
104
+ data?: Record<string, any> | string;
105
+ metadata?: unknown;
106
+ }>;
107
+ edges: Array<{
108
+ source: string;
109
+ target: string;
110
+ data?: string;
111
+ conditional?: boolean;
112
+ }>;
111
113
  }
112
114
  /**
113
115
  * An interrupt thrown inside a thread.
114
116
  */
115
- export interface Interrupt<TValue = unknown> {
116
- /**
117
- * The ID of the interrupt.
118
- */
119
- id?: string;
120
- /**
121
- * The value of the interrupt.
122
- */
123
- value?: TValue;
124
- /**
125
- * Will be deprecated in the future.
126
- * @deprecated Will be removed in the future.
127
- */
128
- when?: "during" | (string & {});
129
- /**
130
- * Whether the interrupt can be resumed.
131
- * @deprecated Will be removed in the future.
132
- */
133
- resumable?: boolean;
134
- /**
135
- * The namespace of the interrupt.
136
- * @deprecated Replaced by `interrupt_id`
137
- */
138
- ns?: string[];
117
+ interface Interrupt<TValue = unknown> {
118
+ /**
119
+ * The ID of the interrupt.
120
+ */
121
+ id?: string;
122
+ /**
123
+ * The value of the interrupt.
124
+ */
125
+ value?: TValue;
126
+ /**
127
+ * Will be deprecated in the future.
128
+ * @deprecated Will be removed in the future.
129
+ */
130
+ when?: "during" | (string & {}); // eslint-disable-line @typescript-eslint/ban-types
131
+ /**
132
+ * Whether the interrupt can be resumed.
133
+ * @deprecated Will be removed in the future.
134
+ */
135
+ resumable?: boolean;
136
+ /**
137
+ * The namespace of the interrupt.
138
+ * @deprecated Replaced by `interrupt_id`
139
+ */
140
+ ns?: string[];
139
141
  }
140
- export interface Thread<ValuesType = DefaultValues> {
141
- /** The ID of the thread. */
142
- thread_id: string;
143
- /** The time the thread was created. */
144
- created_at: string;
145
- /** The last time the thread was updated. */
146
- updated_at: string;
147
- /** The thread metadata. */
148
- metadata: Metadata;
149
- /** The status of the thread */
150
- status: ThreadStatus;
151
- /** The current state of the thread. */
152
- values: ValuesType;
153
- /** Interrupts which were thrown in this thread */
154
- interrupts: Record<string, Array<Interrupt>>;
142
+ interface Thread<ValuesType = DefaultValues> {
143
+ /** The ID of the thread. */
144
+ thread_id: string;
145
+ /** The time the thread was created. */
146
+ created_at: string;
147
+ /** The last time the thread was updated. */
148
+ updated_at: string;
149
+ /** The thread metadata. */
150
+ metadata: Metadata;
151
+ /** The status of the thread */
152
+ status: ThreadStatus;
153
+ /** The current state of the thread. */
154
+ values: ValuesType;
155
+ /** Interrupts which were thrown in this thread */
156
+ interrupts: Record<string, Array<Interrupt>>;
155
157
  }
156
- export interface Cron {
157
- /** The ID of the cron */
158
- cron_id: string;
159
- /** The ID of the assistant */
160
- assistant_id: string;
161
- /** The ID of the thread */
162
- thread_id: Optional<string>;
163
- /** The end date to stop running the cron. */
164
- end_time: Optional<string>;
165
- /** The schedule to run, cron format. */
166
- schedule: string;
167
- /** The time the cron was created. */
168
- created_at: string;
169
- /** The last time the cron was updated. */
170
- updated_at: string;
171
- /** The run payload to use for creating new run. */
172
- payload: Record<string, unknown>;
173
- /** The user ID of the cron */
174
- user_id: Optional<string>;
175
- /** The next run date of the cron */
176
- next_run_date: Optional<string>;
177
- /** The metadata of the cron */
178
- metadata: Record<string, unknown>;
158
+ interface Cron {
159
+ /** The ID of the cron */
160
+ cron_id: string;
161
+ /** The ID of the assistant */
162
+ assistant_id: string;
163
+ /** The ID of the thread */
164
+ thread_id: Optional<string>;
165
+ /** The end date to stop running the cron. */
166
+ end_time: Optional<string>;
167
+ /** The schedule to run, cron format. */
168
+ schedule: string;
169
+ /** The time the cron was created. */
170
+ created_at: string;
171
+ /** The last time the cron was updated. */
172
+ updated_at: string;
173
+ /** The run payload to use for creating new run. */
174
+ payload: Record<string, unknown>;
175
+ /** The user ID of the cron */
176
+ user_id: Optional<string>;
177
+ /** The next run date of the cron */
178
+ next_run_date: Optional<string>;
179
+ /** The metadata of the cron */
180
+ metadata: Record<string, unknown>;
179
181
  }
180
- export type DefaultValues = Record<string, unknown>[] | Record<string, unknown>;
181
- export interface ThreadState<ValuesType = DefaultValues> {
182
- /** The state values */
183
- values: ValuesType;
184
- /** The next nodes to execute. If empty, the thread is done until new input is received */
185
- next: string[];
186
- /** Checkpoint of the thread state */
187
- checkpoint: Checkpoint;
188
- /** Metadata for this state */
189
- metadata: Metadata;
190
- /** Time of state creation */
191
- created_at: Optional<string>;
192
- /** The parent checkpoint. If missing, this is the root checkpoint */
193
- parent_checkpoint: Optional<Checkpoint>;
194
- /** Tasks to execute in this step. If already attempted, may contain an error */
195
- tasks: Array<ThreadTask>;
182
+ type DefaultValues = Record<string, unknown>[] | Record<string, unknown>;
183
+ type ThreadValuesFilter = Record<string, unknown>;
184
+ interface ThreadState<ValuesType = DefaultValues> {
185
+ /** The state values */
186
+ values: ValuesType;
187
+ /** The next nodes to execute. If empty, the thread is done until new input is received */
188
+ next: string[];
189
+ /** Checkpoint of the thread state */
190
+ checkpoint: Checkpoint;
191
+ /** Metadata for this state */
192
+ metadata: Metadata;
193
+ /** Time of state creation */
194
+ created_at: Optional<string>;
195
+ /** The parent checkpoint. If missing, this is the root checkpoint */
196
+ parent_checkpoint: Optional<Checkpoint>;
197
+ /** Tasks to execute in this step. If already attempted, may contain an error */
198
+ tasks: Array<ThreadTask>;
196
199
  }
197
- export interface ThreadTask {
198
- id: string;
199
- name: string;
200
- result?: unknown;
201
- error: Optional<string>;
202
- interrupts: Array<Interrupt>;
203
- checkpoint: Optional<Checkpoint>;
204
- state: Optional<ThreadState>;
200
+ interface ThreadTask {
201
+ id: string;
202
+ name: string;
203
+ result?: unknown;
204
+ error: Optional<string>;
205
+ interrupts: Array<Interrupt>;
206
+ checkpoint: Optional<Checkpoint>;
207
+ state: Optional<ThreadState>;
205
208
  }
206
- export interface Run {
207
- /** The ID of the run */
208
- run_id: string;
209
- /** The ID of the thread */
210
- thread_id: string;
211
- /** The assistant that wwas used for this run */
212
- assistant_id: string;
213
- /** The time the run was created */
214
- created_at: string;
215
- /** The last time the run was updated */
216
- updated_at: string;
217
- /** The status of the run. */
218
- status: RunStatus;
219
- /** Run metadata */
220
- metadata: Metadata;
221
- /** Strategy to handle concurrent runs on the same thread */
222
- multitask_strategy: Optional<MultitaskStrategy>;
209
+ interface Run {
210
+ /** The ID of the run */
211
+ run_id: string;
212
+ /** The ID of the thread */
213
+ thread_id: string;
214
+ /** The assistant that wwas used for this run */
215
+ assistant_id: string;
216
+ /** The time the run was created */
217
+ created_at: string;
218
+ /** The last time the run was updated */
219
+ updated_at: string;
220
+ /** The status of the run. */
221
+ status: RunStatus;
222
+ /** Run metadata */
223
+ metadata: Metadata;
224
+ /** Strategy to handle concurrent runs on the same thread */
225
+ multitask_strategy: Optional<MultitaskStrategy>;
223
226
  }
224
- export type Checkpoint = {
225
- thread_id: string;
226
- checkpoint_ns: string;
227
- checkpoint_id: Optional<string>;
228
- checkpoint_map: Optional<Record<string, unknown>>;
227
+ type Checkpoint = {
228
+ thread_id: string;
229
+ checkpoint_ns: string;
230
+ checkpoint_id: Optional<string>;
231
+ checkpoint_map: Optional<Record<string, unknown>>;
229
232
  };
230
- export interface ListNamespaceResponse {
231
- namespaces: string[][];
233
+ interface ListNamespaceResponse {
234
+ namespaces: string[][];
232
235
  }
233
- export interface Item {
234
- namespace: string[];
235
- key: string;
236
- value: Record<string, any>;
237
- createdAt: string;
238
- updatedAt: string;
236
+ interface Item {
237
+ namespace: string[];
238
+ key: string;
239
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
240
+ value: Record<string, any>;
241
+ createdAt: string;
242
+ updatedAt: string;
239
243
  }
240
- export interface SearchItem extends Item {
241
- score?: number;
244
+ interface SearchItem extends Item {
245
+ score?: number;
242
246
  }
243
- export interface SearchItemsResponse {
244
- items: SearchItem[];
247
+ interface SearchItemsResponse {
248
+ items: SearchItem[];
245
249
  }
246
- export interface CronCreateResponse {
247
- cron_id: string;
248
- assistant_id: string;
249
- thread_id: string | undefined;
250
- user_id: string;
251
- payload: Record<string, unknown>;
252
- schedule: string;
253
- next_run_date: string;
254
- end_time: string | undefined;
255
- created_at: string;
256
- updated_at: string;
257
- metadata: Metadata;
250
+ interface CronCreateResponse {
251
+ cron_id: string;
252
+ assistant_id: string;
253
+ thread_id: string | undefined;
254
+ user_id: string;
255
+ payload: Record<string, unknown>;
256
+ schedule: string;
257
+ next_run_date: string;
258
+ end_time: string | undefined;
259
+ created_at: string;
260
+ updated_at: string;
261
+ metadata: Metadata;
258
262
  }
259
- export interface CronCreateForThreadResponse extends Omit<CronCreateResponse, "thread_id"> {
260
- thread_id: string;
263
+ interface CronCreateForThreadResponse extends Omit<CronCreateResponse, "thread_id"> {
264
+ thread_id: string;
261
265
  }
262
- export type AssistantSortBy = "assistant_id" | "graph_id" | "name" | "created_at" | "updated_at";
263
- export type ThreadSortBy = "thread_id" | "status" | "created_at" | "updated_at";
264
- export type CronSortBy = "cron_id" | "assistant_id" | "thread_id" | "created_at" | "updated_at" | "next_run_date";
265
- export type SortOrder = "asc" | "desc";
266
- export type AssistantSelectField = "assistant_id" | "graph_id" | "name" | "description" | "config" | "context" | "created_at" | "updated_at" | "metadata" | "version";
267
- export type ThreadSelectField = "thread_id" | "created_at" | "updated_at" | "metadata" | "config" | "context" | "status" | "values" | "interrupts";
268
- export type RunSelectField = "run_id" | "thread_id" | "assistant_id" | "created_at" | "updated_at" | "status" | "metadata" | "kwargs" | "multitask_strategy";
269
- export type CronSelectField = "cron_id" | "assistant_id" | "thread_id" | "end_time" | "schedule" | "created_at" | "updated_at" | "user_id" | "payload" | "next_run_date" | "metadata" | "now";
270
- export {};
266
+ type AssistantSortBy = "assistant_id" | "graph_id" | "name" | "created_at" | "updated_at";
267
+ type ThreadSortBy = "thread_id" | "status" | "created_at" | "updated_at";
268
+ type CronSortBy = "cron_id" | "assistant_id" | "thread_id" | "created_at" | "updated_at" | "next_run_date";
269
+ type SortOrder = "asc" | "desc";
270
+ // Select field aliases for client-side typing of `select` parameters.
271
+ // These mirror the server's allowed field sets.
272
+ type AssistantSelectField = "assistant_id" | "graph_id" | "name" | "description" | "config" | "context" | "created_at" | "updated_at" | "metadata" | "version";
273
+ type ThreadSelectField = "thread_id" | "created_at" | "updated_at" | "metadata" | "config" | "context" | "status" | "values" | "interrupts";
274
+ type RunSelectField = "run_id" | "thread_id" | "assistant_id" | "created_at" | "updated_at" | "status" | "metadata" | "kwargs" | "multitask_strategy";
275
+ type CronSelectField = "cron_id" | "assistant_id" | "thread_id" | "end_time" | "schedule" | "created_at" | "updated_at" | "user_id" | "payload" | "next_run_date" | "metadata" | "now";
276
+ //#endregion
277
+ export { Assistant, AssistantBase, AssistantGraph, AssistantSelectField, AssistantSortBy, AssistantVersion, CancelAction, Checkpoint, Config, Cron, CronCreateForThreadResponse, CronCreateResponse, CronSelectField, CronSortBy, DefaultValues, GraphSchema, Interrupt, Item, ListNamespaceResponse, Metadata, Run, RunSelectField, RunStatus, SearchItem, SearchItemsResponse, SortOrder, Subgraphs, Thread, ThreadSelectField, ThreadSortBy, ThreadState, ThreadStatus, ThreadTask, ThreadValuesFilter };
278
+ //# sourceMappingURL=schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.d.ts","names":["JSONSchema7","Optional","T","RunStatus","ThreadStatus","MultitaskStrategy","CancelAction","Config","GraphSchema","Subgraphs","Record","Metadata","AssistantBase","AssistantVersion","Assistant","AssistantGraph","Array","Interrupt","TValue","Thread","DefaultValues","ValuesType","Cron","ThreadValuesFilter","ThreadState","Checkpoint","ThreadTask","Run","ListNamespaceResponse","Item","SearchItem","SearchItemsResponse","CronCreateResponse","CronCreateForThreadResponse","Omit","AssistantSortBy","ThreadSortBy","CronSortBy","SortOrder","AssistantSelectField","ThreadSelectField","RunSelectField","CronSelectField"],"sources":["../src/schema.d.ts"],"sourcesContent":["import type { JSONSchema7 } from \"json-schema\";\ntype Optional<T> = T | null | undefined;\nexport type RunStatus = \"pending\" | \"running\" | \"error\" | \"success\" | \"timeout\" | \"interrupted\";\nexport type ThreadStatus = \"idle\" | \"busy\" | \"interrupted\" | \"error\";\ntype MultitaskStrategy = \"reject\" | \"interrupt\" | \"rollback\" | \"enqueue\";\nexport type CancelAction = \"interrupt\" | \"rollback\";\nexport type Config = {\n /**\n * Tags for this call and any sub-calls (eg. a Chain calling an LLM).\n * You can use these to filter calls.\n */\n tags?: string[];\n /**\n * Maximum number of times a call can recurse.\n * If not provided, defaults to 25.\n */\n recursion_limit?: number;\n /**\n * Runtime values for attributes previously made configurable on this Runnable.\n */\n configurable?: {\n /**\n * ID of the thread\n */\n thread_id?: Optional<string>;\n /**\n * Timestamp of the state checkpoint\n */\n checkpoint_id?: Optional<string>;\n [key: string]: unknown;\n };\n};\nexport interface GraphSchema {\n /**\n * The ID of the graph.\n */\n graph_id: string;\n /**\n * The schema for the input state.\n * Missing if unable to generate JSON schema from graph.\n */\n input_schema?: JSONSchema7 | null | undefined;\n /**\n * The schema for the output state.\n * Missing if unable to generate JSON schema from graph.\n */\n output_schema?: JSONSchema7 | null | undefined;\n /**\n * The schema for the graph state.\n * Missing if unable to generate JSON schema from graph.\n */\n state_schema?: JSONSchema7 | null | undefined;\n /**\n * The schema for the graph config.\n * Missing if unable to generate JSON schema from graph.\n */\n config_schema?: JSONSchema7 | null | undefined;\n /**\n * The schema for the graph context.\n * Missing if unable to generate JSON schema from graph.\n */\n context_schema?: JSONSchema7 | null | undefined;\n}\nexport type Subgraphs = Record<string, GraphSchema>;\nexport type Metadata = Optional<{\n source?: \"input\" | \"loop\" | \"update\" | (string & {}); // eslint-disable-line @typescript-eslint/ban-types\n step?: number;\n writes?: Record<string, unknown> | null;\n parents?: Record<string, string>;\n [key: string]: unknown;\n}>;\nexport interface AssistantBase {\n /** The ID of the assistant. */\n assistant_id: string;\n /** The ID of the graph. */\n graph_id: string;\n /** The assistant config. */\n config: Config;\n /** The assistant context. */\n context: unknown;\n /** The time the assistant was created. */\n created_at: string;\n /** The assistant metadata. */\n metadata: Metadata;\n /** The version of the assistant. */\n version: number;\n /** The name of the assistant */\n name: string;\n /** The description of the assistant */\n description?: string;\n}\nexport interface AssistantVersion extends AssistantBase {\n}\nexport interface Assistant extends AssistantBase {\n /** The last time the assistant was updated. */\n updated_at: string;\n}\nexport interface AssistantGraph {\n nodes: Array<{\n id: string | number;\n name?: string;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n data?: Record<string, any> | string;\n metadata?: unknown;\n }>;\n edges: Array<{\n source: string;\n target: string;\n data?: string;\n conditional?: boolean;\n }>;\n}\n/**\n * An interrupt thrown inside a thread.\n */\nexport interface Interrupt<TValue = unknown> {\n /**\n * The ID of the interrupt.\n */\n id?: string;\n /**\n * The value of the interrupt.\n */\n value?: TValue;\n /**\n * Will be deprecated in the future.\n * @deprecated Will be removed in the future.\n */\n when?: \"during\" | (string & {}); // eslint-disable-line @typescript-eslint/ban-types\n /**\n * Whether the interrupt can be resumed.\n * @deprecated Will be removed in the future.\n */\n resumable?: boolean;\n /**\n * The namespace of the interrupt.\n * @deprecated Replaced by `interrupt_id`\n */\n ns?: string[];\n}\nexport interface Thread<ValuesType = DefaultValues> {\n /** The ID of the thread. */\n thread_id: string;\n /** The time the thread was created. */\n created_at: string;\n /** The last time the thread was updated. */\n updated_at: string;\n /** The thread metadata. */\n metadata: Metadata;\n /** The status of the thread */\n status: ThreadStatus;\n /** The current state of the thread. */\n values: ValuesType;\n /** Interrupts which were thrown in this thread */\n interrupts: Record<string, Array<Interrupt>>;\n}\nexport interface Cron {\n /** The ID of the cron */\n cron_id: string;\n /** The ID of the assistant */\n assistant_id: string;\n /** The ID of the thread */\n thread_id: Optional<string>;\n /** The end date to stop running the cron. */\n end_time: Optional<string>;\n /** The schedule to run, cron format. */\n schedule: string;\n /** The time the cron was created. */\n created_at: string;\n /** The last time the cron was updated. */\n updated_at: string;\n /** The run payload to use for creating new run. */\n payload: Record<string, unknown>;\n /** The user ID of the cron */\n user_id: Optional<string>;\n /** The next run date of the cron */\n next_run_date: Optional<string>;\n /** The metadata of the cron */\n metadata: Record<string, unknown>;\n}\nexport type DefaultValues = Record<string, unknown>[] | Record<string, unknown>;\nexport type ThreadValuesFilter = Record<string, unknown>;\nexport interface ThreadState<ValuesType = DefaultValues> {\n /** The state values */\n values: ValuesType;\n /** The next nodes to execute. If empty, the thread is done until new input is received */\n next: string[];\n /** Checkpoint of the thread state */\n checkpoint: Checkpoint;\n /** Metadata for this state */\n metadata: Metadata;\n /** Time of state creation */\n created_at: Optional<string>;\n /** The parent checkpoint. If missing, this is the root checkpoint */\n parent_checkpoint: Optional<Checkpoint>;\n /** Tasks to execute in this step. If already attempted, may contain an error */\n tasks: Array<ThreadTask>;\n}\nexport interface ThreadTask {\n id: string;\n name: string;\n result?: unknown;\n error: Optional<string>;\n interrupts: Array<Interrupt>;\n checkpoint: Optional<Checkpoint>;\n state: Optional<ThreadState>;\n}\nexport interface Run {\n /** The ID of the run */\n run_id: string;\n /** The ID of the thread */\n thread_id: string;\n /** The assistant that wwas used for this run */\n assistant_id: string;\n /** The time the run was created */\n created_at: string;\n /** The last time the run was updated */\n updated_at: string;\n /** The status of the run. */\n status: RunStatus;\n /** Run metadata */\n metadata: Metadata;\n /** Strategy to handle concurrent runs on the same thread */\n multitask_strategy: Optional<MultitaskStrategy>;\n}\nexport type Checkpoint = {\n thread_id: string;\n checkpoint_ns: string;\n checkpoint_id: Optional<string>;\n checkpoint_map: Optional<Record<string, unknown>>;\n};\nexport interface ListNamespaceResponse {\n namespaces: string[][];\n}\nexport interface Item {\n namespace: string[];\n key: string;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n value: Record<string, any>;\n createdAt: string;\n updatedAt: string;\n}\nexport interface SearchItem extends Item {\n score?: number;\n}\nexport interface SearchItemsResponse {\n items: SearchItem[];\n}\nexport interface CronCreateResponse {\n cron_id: string;\n assistant_id: string;\n thread_id: string | undefined;\n user_id: string;\n payload: Record<string, unknown>;\n schedule: string;\n next_run_date: string;\n end_time: string | undefined;\n created_at: string;\n updated_at: string;\n metadata: Metadata;\n}\nexport interface CronCreateForThreadResponse extends Omit<CronCreateResponse, \"thread_id\"> {\n thread_id: string;\n}\nexport type AssistantSortBy = \"assistant_id\" | \"graph_id\" | \"name\" | \"created_at\" | \"updated_at\";\nexport type ThreadSortBy = \"thread_id\" | \"status\" | \"created_at\" | \"updated_at\";\nexport type CronSortBy = \"cron_id\" | \"assistant_id\" | \"thread_id\" | \"created_at\" | \"updated_at\" | \"next_run_date\";\nexport type SortOrder = \"asc\" | \"desc\";\n// Select field aliases for client-side typing of `select` parameters.\n// These mirror the server's allowed field sets.\nexport type AssistantSelectField = \"assistant_id\" | \"graph_id\" | \"name\" | \"description\" | \"config\" | \"context\" | \"created_at\" | \"updated_at\" | \"metadata\" | \"version\";\nexport type ThreadSelectField = \"thread_id\" | \"created_at\" | \"updated_at\" | \"metadata\" | \"config\" | \"context\" | \"status\" | \"values\" | \"interrupts\";\nexport type RunSelectField = \"run_id\" | \"thread_id\" | \"assistant_id\" | \"created_at\" | \"updated_at\" | \"status\" | \"metadata\" | \"kwargs\" | \"multitask_strategy\";\nexport type CronSelectField = \"cron_id\" | \"assistant_id\" | \"thread_id\" | \"end_time\" | \"schedule\" | \"created_at\" | \"updated_at\" | \"user_id\" | \"payload\" | \"next_run_date\" | \"metadata\" | \"now\";\nexport {};\n"],"mappings":"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"}
@@ -1,28 +1,24 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports._getFetchImplementation = exports.overrideFetchImplementation = void 0;
4
- /* eslint-disable @typescript-eslint/no-explicit-any */
5
- // Wrap the default fetch call due to issues with illegal invocations
6
- // in some environments:
7
- // https://stackoverflow.com/questions/69876859/why-does-bind-fix-failed-to-execute-fetch-on-window-illegal-invocation-err
8
- // @ts-expect-error Broad typing to support a range of fetch implementations
1
+
2
+ //#region src/singletons/fetch.ts
9
3
  const DEFAULT_FETCH_IMPLEMENTATION = (...args) => fetch(...args);
10
4
  const LANGSMITH_FETCH_IMPLEMENTATION_KEY = Symbol.for("lg:fetch_implementation");
11
5
  /**
12
- * Overrides the fetch implementation used for LangSmith calls.
13
- * You should use this if you need to use an implementation of fetch
14
- * other than the default global (e.g. for dealing with proxies).
15
- * @param fetch The new fetch function to use.
16
- */
17
- const overrideFetchImplementation = (fetch) => {
18
- globalThis[LANGSMITH_FETCH_IMPLEMENTATION_KEY] = fetch;
6
+ * Overrides the fetch implementation used for LangSmith calls.
7
+ * You should use this if you need to use an implementation of fetch
8
+ * other than the default global (e.g. for dealing with proxies).
9
+ * @param fetch The new fetch function to use.
10
+ */
11
+ const overrideFetchImplementation = (fetch$1) => {
12
+ globalThis[LANGSMITH_FETCH_IMPLEMENTATION_KEY] = fetch$1;
19
13
  };
20
- exports.overrideFetchImplementation = overrideFetchImplementation;
21
14
  /**
22
- * @internal
23
- */
15
+ * @internal
16
+ */
24
17
  const _getFetchImplementation = () => {
25
- return (globalThis[LANGSMITH_FETCH_IMPLEMENTATION_KEY] ??
26
- DEFAULT_FETCH_IMPLEMENTATION);
18
+ return globalThis[LANGSMITH_FETCH_IMPLEMENTATION_KEY] ?? DEFAULT_FETCH_IMPLEMENTATION;
27
19
  };
20
+
21
+ //#endregion
28
22
  exports._getFetchImplementation = _getFetchImplementation;
23
+ exports.overrideFetchImplementation = overrideFetchImplementation;
24
+ //# sourceMappingURL=fetch.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetch.cjs","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,14 @@
1
+ //#region src/singletons/fetch.d.ts
2
+ /**
3
+ * Overrides the fetch implementation used for LangSmith calls.
4
+ * You should use this if you need to use an implementation of fetch
5
+ * other than the default global (e.g. for dealing with proxies).
6
+ * @param fetch The new fetch function to use.
7
+ */
8
+ declare const overrideFetchImplementation: (fetch: (...args: any[]) => any) => void;
9
+ /**
10
+ * @internal
11
+ */
12
+ //#endregion
13
+ export { overrideFetchImplementation };
14
+ //# sourceMappingURL=fetch.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetch.d.cts","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"}