@langchain/langgraph-sdk 0.0.18 → 0.0.19

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
@@ -593,12 +593,22 @@ class RunsClient extends BaseClient {
593
593
  after_seconds: payload?.afterSeconds,
594
594
  };
595
595
  const endpoint = threadId == null ? `/runs/wait` : `/threads/${threadId}/runs/wait`;
596
- return this.fetch(endpoint, {
596
+ const response = await this.fetch(endpoint, {
597
597
  method: "POST",
598
598
  json,
599
599
  timeoutMs: null,
600
600
  signal: payload?.signal,
601
601
  });
602
+ const raiseError = payload?.raiseError !== undefined ? payload.raiseError : true;
603
+ if (raiseError &&
604
+ "__error__" in response &&
605
+ typeof response.__error__ === "object" &&
606
+ response.__error__ &&
607
+ "error" in response.__error__ &&
608
+ "message" in response.__error__) {
609
+ throw new Error(`${response.__error__?.error}: ${response.__error__?.message}`);
610
+ }
611
+ return response;
602
612
  }
603
613
  /**
604
614
  * List all runs for a thread.
package/dist/client.js CHANGED
@@ -587,12 +587,22 @@ export class RunsClient extends BaseClient {
587
587
  after_seconds: payload?.afterSeconds,
588
588
  };
589
589
  const endpoint = threadId == null ? `/runs/wait` : `/threads/${threadId}/runs/wait`;
590
- return this.fetch(endpoint, {
590
+ const response = await this.fetch(endpoint, {
591
591
  method: "POST",
592
592
  json,
593
593
  timeoutMs: null,
594
594
  signal: payload?.signal,
595
595
  });
596
+ const raiseError = payload?.raiseError !== undefined ? payload.raiseError : true;
597
+ if (raiseError &&
598
+ "__error__" in response &&
599
+ typeof response.__error__ === "object" &&
600
+ response.__error__ &&
601
+ "error" in response.__error__ &&
602
+ "message" in response.__error__) {
603
+ throw new Error(`${response.__error__?.error}: ${response.__error__?.message}`);
604
+ }
605
+ return response;
596
606
  }
597
607
  /**
598
608
  * List all runs for a thread.
package/dist/types.d.ts CHANGED
@@ -102,5 +102,10 @@ export interface CronsCreatePayload extends RunsCreatePayload {
102
102
  */
103
103
  schedule: string;
104
104
  }
105
- export type RunsWaitPayload = RunsStreamPayload;
105
+ export interface RunsWaitPayload extends RunsStreamPayload {
106
+ /**
107
+ * Raise errors returned by the run. Default is `true`.
108
+ */
109
+ raiseError?: boolean;
110
+ }
106
111
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@langchain/langgraph-sdk",
3
- "version": "0.0.18",
3
+ "version": "0.0.19",
4
4
  "description": "Client library for interacting with the LangGraph API",
5
5
  "type": "module",
6
6
  "packageManager": "yarn@1.22.19",