@langchain/langgraph-sdk 0.0.4 → 0.0.6

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.mjs CHANGED
@@ -398,6 +398,7 @@ export class RunsClient extends BaseClient {
398
398
  signal: payload?.signal,
399
399
  }));
400
400
  let parser;
401
+ let onEndEvent;
401
402
  const textDecoder = new TextDecoder();
402
403
  const stream = (response.body || new ReadableStream({ start: (ctrl) => ctrl.close() })).pipeThrough(new TransformStream({
403
404
  async start(ctrl) {
@@ -414,9 +415,17 @@ export class RunsClient extends BaseClient {
414
415
  });
415
416
  }
416
417
  });
418
+ onEndEvent = () => {
419
+ ctrl.enqueue({ event: "end", data: undefined });
420
+ };
417
421
  },
418
422
  async transform(chunk) {
419
- parser.feed(textDecoder.decode(chunk));
423
+ const payload = textDecoder.decode(chunk);
424
+ parser.feed(payload);
425
+ // eventsource-parser will ignore events
426
+ // that are not terminated by a newline
427
+ if (payload.trim() === "event: end")
428
+ onEndEvent();
420
429
  },
421
430
  }));
422
431
  yield* IterableReadableStream.fromReadableStream(stream);
package/dist/schema.d.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  import type { JSONSchema7 } from "json-schema";
2
2
  type Optional<T> = T | null | undefined;
3
+ type RunStatus = "pending" | "running" | "error" | "success" | "timeout" | "interrupted";
4
+ type ThreadStatus = "idle" | "busy" | "interrupted";
3
5
  export interface Config {
4
6
  /**
5
7
  * Tags for this call and any sub-calls (eg. a Chain calling an LLM).
@@ -22,7 +24,7 @@ export interface Config {
22
24
  /**
23
25
  * Timestamp of the state checkpoint
24
26
  */
25
- thread_ts?: string;
27
+ checkpoint_id?: string;
26
28
  [key: string]: unknown;
27
29
  };
28
30
  }
@@ -67,6 +69,7 @@ export interface Thread {
67
69
  created_at: string;
68
70
  updated_at: string;
69
71
  metadata: Metadata;
72
+ status: ThreadStatus;
70
73
  }
71
74
  export interface Cron {
72
75
  cron_id: string;
@@ -85,6 +88,8 @@ export interface ThreadState<ValuesType = DefaultValues> {
85
88
  metadata: Metadata;
86
89
  created_at: Optional<string>;
87
90
  parent_checkpoint_id: Optional<string>;
91
+ config: Config;
92
+ parent_config?: Config;
88
93
  }
89
94
  export interface Run {
90
95
  run_id: string;
@@ -92,7 +97,7 @@ export interface Run {
92
97
  assistant_id: string;
93
98
  created_at: string;
94
99
  updated_at: string;
95
- status: "pending" | "running" | "error" | "success" | "timeout" | "interrupted";
100
+ status: RunStatus;
96
101
  metadata: Metadata;
97
102
  }
98
103
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@langchain/langgraph-sdk",
3
- "version": "0.0.4",
3
+ "version": "0.0.6",
4
4
  "description": "Client library for interacting with the LangGraph API",
5
5
  "type": "module",
6
6
  "packageManager": "yarn@1.22.19",