@langchain/langgraph-sdk 0.0.59 → 0.0.60

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.
package/dist/client.cjs CHANGED
@@ -352,9 +352,19 @@ class ThreadsClient extends BaseClient {
352
352
  return this.fetch(`/threads`, {
353
353
  method: "POST",
354
354
  json: {
355
- metadata: payload?.metadata,
355
+ metadata: {
356
+ ...payload?.metadata,
357
+ graph_id: payload?.graphId,
358
+ },
356
359
  thread_id: payload?.threadId,
357
360
  if_exists: payload?.ifExists,
361
+ supersteps: payload?.supersteps?.map((s) => ({
362
+ updates: s.updates.map((u) => ({
363
+ values: u.values,
364
+ command: u.command,
365
+ as_node: u.asNode,
366
+ })),
367
+ })),
358
368
  },
359
369
  });
360
370
  }
@@ -446,29 +456,6 @@ class ThreadsClient extends BaseClient {
446
456
  },
447
457
  });
448
458
  }
449
- /**
450
- * Create a new thread from a batch states.
451
- */
452
- async bulkUpdateState(supersteps, options) {
453
- return this.fetch("/threads/state/batch", {
454
- method: "POST",
455
- json: {
456
- supersteps: supersteps.map((s) => ({
457
- updates: s.updates.map((u) => ({
458
- values: u.values,
459
- command: u.command,
460
- as_node: u.asNode,
461
- })),
462
- })),
463
- thread_id: options?.threadId,
464
- metadata: {
465
- ...options?.metadata,
466
- graph_id: options?.graphId,
467
- },
468
- if_exists: options?.ifExists,
469
- },
470
- });
471
- }
472
459
  /**
473
460
  * Patch the metadata of a thread.
474
461
  *
package/dist/client.d.ts CHANGED
@@ -187,8 +187,34 @@ export declare class ThreadsClient<TStateType = DefaultValues, TUpdateType = TSt
187
187
  * Metadata for the thread.
188
188
  */
189
189
  metadata?: Metadata;
190
+ /**
191
+ * ID of the thread to create.
192
+ *
193
+ * If not provided, a random UUID will be generated.
194
+ */
190
195
  threadId?: string;
196
+ /**
197
+ * How to handle duplicate creation.
198
+ *
199
+ * @default "raise"
200
+ */
191
201
  ifExists?: OnConflictBehavior;
202
+ /**
203
+ * Graph ID to associate with the thread.
204
+ */
205
+ graphId?: string;
206
+ /**
207
+ * Apply a list of supersteps when creating a thread, each containing a sequence of updates.
208
+ *
209
+ * Used for copying a thread between deployments.
210
+ */
211
+ supersteps?: Array<{
212
+ updates: Array<{
213
+ values: unknown;
214
+ command?: Command;
215
+ asNode: string;
216
+ }>;
217
+ }>;
192
218
  }): Promise<Thread<TStateType>>;
193
219
  /**
194
220
  * Copy an existing thread
@@ -262,21 +288,6 @@ export declare class ThreadsClient<TStateType = DefaultValues, TUpdateType = TSt
262
288
  checkpointId?: string;
263
289
  asNode?: string;
264
290
  }): Promise<Pick<Config, "configurable">>;
265
- /**
266
- * Create a new thread from a batch states.
267
- */
268
- bulkUpdateState(supersteps: Array<{
269
- updates: Array<{
270
- values: unknown;
271
- command?: Command;
272
- asNode: string;
273
- }>;
274
- }>, options?: {
275
- graphId?: string;
276
- threadId?: string;
277
- metadata?: Metadata;
278
- ifExists?: OnConflictBehavior;
279
- }): Promise<Thread<TStateType>>;
280
291
  /**
281
292
  * Patch the metadata of a thread.
282
293
  *
package/dist/client.js CHANGED
@@ -346,9 +346,19 @@ export class ThreadsClient extends BaseClient {
346
346
  return this.fetch(`/threads`, {
347
347
  method: "POST",
348
348
  json: {
349
- metadata: payload?.metadata,
349
+ metadata: {
350
+ ...payload?.metadata,
351
+ graph_id: payload?.graphId,
352
+ },
350
353
  thread_id: payload?.threadId,
351
354
  if_exists: payload?.ifExists,
355
+ supersteps: payload?.supersteps?.map((s) => ({
356
+ updates: s.updates.map((u) => ({
357
+ values: u.values,
358
+ command: u.command,
359
+ as_node: u.asNode,
360
+ })),
361
+ })),
352
362
  },
353
363
  });
354
364
  }
@@ -440,29 +450,6 @@ export class ThreadsClient extends BaseClient {
440
450
  },
441
451
  });
442
452
  }
443
- /**
444
- * Create a new thread from a batch states.
445
- */
446
- async bulkUpdateState(supersteps, options) {
447
- return this.fetch("/threads/state/batch", {
448
- method: "POST",
449
- json: {
450
- supersteps: supersteps.map((s) => ({
451
- updates: s.updates.map((u) => ({
452
- values: u.values,
453
- command: u.command,
454
- as_node: u.asNode,
455
- })),
456
- })),
457
- thread_id: options?.threadId,
458
- metadata: {
459
- ...options?.metadata,
460
- graph_id: options?.graphId,
461
- },
462
- if_exists: options?.ifExists,
463
- },
464
- });
465
- }
466
453
  /**
467
454
  * Patch the metadata of a thread.
468
455
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@langchain/langgraph-sdk",
3
- "version": "0.0.59",
3
+ "version": "0.0.60",
4
4
  "description": "Client library for interacting with the LangGraph API",
5
5
  "type": "module",
6
6
  "packageManager": "yarn@1.22.19",