@langchain/langgraph-sdk 0.0.57 → 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
  }
package/dist/client.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Assistant, AssistantGraph, CancelAction, Config, DefaultValues, GraphSchema, Metadata, Run, RunStatus, Thread, ThreadState, Cron, AssistantVersion, Subgraphs, Checkpoint, SearchItemsResponse, ListNamespaceResponse, Item, ThreadStatus, CronCreateResponse, CronCreateForThreadResponse } from "./schema.js";
2
2
  import { AsyncCaller, AsyncCallerParams } from "./utils/async_caller.js";
3
- import type { RunsCreatePayload, RunsStreamPayload, RunsWaitPayload, StreamEvent, CronsCreatePayload, OnConflictBehavior } from "./types.js";
3
+ import type { RunsCreatePayload, RunsStreamPayload, RunsWaitPayload, StreamEvent, CronsCreatePayload, OnConflictBehavior, Command } from "./types.js";
4
4
  import type { TypedAsyncGenerator, StreamMode } from "./types.stream.js";
5
5
  /**
6
6
  * Get the API key from the environment.
@@ -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
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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@langchain/langgraph-sdk",
3
- "version": "0.0.57",
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",