@langchain/langgraph-sdk 0.0.66 → 0.0.67

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.
@@ -3,6 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.HTTPException = exports.Auth = void 0;
4
4
  class Auth {
5
5
  constructor() {
6
+ /**
7
+ * @internal
8
+ * @ignore
9
+ */
6
10
  Object.defineProperty(this, "~handlerCache", {
7
11
  enumerable: true,
8
12
  configurable: true,
@@ -1,5 +1,9 @@
1
1
  import type { AuthenticateCallback, AnyCallback, CallbackEvent, OnCallback, BaseAuthReturn, ToUserLike, BaseUser } from "./types.js";
2
2
  export declare class Auth<TExtra = {}, TAuthReturn extends BaseAuthReturn = BaseAuthReturn, TUser extends BaseUser = ToUserLike<TAuthReturn>> {
3
+ /**
4
+ * @internal
5
+ * @ignore
6
+ */
3
7
  "~handlerCache": {
4
8
  authenticate?: AuthenticateCallback<BaseAuthReturn>;
5
9
  callbacks?: Record<string, AnyCallback>;
@@ -1,5 +1,9 @@
1
1
  export class Auth {
2
2
  constructor() {
3
+ /**
4
+ * @internal
5
+ * @ignore
6
+ */
3
7
  Object.defineProperty(this, "~handlerCache", {
4
8
  enumerable: true,
5
9
  configurable: true,
@@ -9,6 +9,9 @@ interface AssistantConfig {
9
9
  [key: string]: unknown;
10
10
  }>;
11
11
  }
12
+ /**
13
+ * @inline
14
+ */
12
15
  interface AssistantCreate {
13
16
  assistant_id?: Maybe<string>;
14
17
  metadata?: Maybe<Record<string, unknown>>;
@@ -17,10 +20,16 @@ interface AssistantCreate {
17
20
  name?: Maybe<string>;
18
21
  graph_id: string;
19
22
  }
23
+ /**
24
+ * @inline
25
+ */
20
26
  interface AssistantRead {
21
27
  assistant_id: string;
22
28
  metadata?: Maybe<Record<string, unknown>>;
23
29
  }
30
+ /**
31
+ * @inline
32
+ */
24
33
  interface AssistantUpdate {
25
34
  assistant_id: string;
26
35
  metadata?: Maybe<Record<string, unknown>>;
@@ -29,32 +38,53 @@ interface AssistantUpdate {
29
38
  name?: Maybe<string>;
30
39
  version?: Maybe<number>;
31
40
  }
41
+ /**
42
+ * @inline
43
+ */
32
44
  interface AssistantDelete {
33
45
  assistant_id: string;
34
46
  }
47
+ /**
48
+ * @inline
49
+ */
35
50
  interface AssistantSearch {
36
51
  graph_id?: Maybe<string>;
37
52
  metadata?: Maybe<Record<string, unknown>>;
38
53
  limit?: Maybe<number>;
39
54
  offset?: Maybe<number>;
40
55
  }
56
+ /**
57
+ * @inline
58
+ */
41
59
  interface ThreadCreate {
42
60
  thread_id?: Maybe<string>;
43
61
  metadata?: Maybe<Record<string, unknown>>;
44
62
  if_exists?: Maybe<"raise" | "do_nothing">;
45
63
  }
64
+ /**
65
+ * @inline
66
+ */
46
67
  interface ThreadRead {
47
68
  thread_id?: Maybe<string>;
48
69
  }
70
+ /**
71
+ * @inline
72
+ */
49
73
  interface ThreadUpdate {
50
74
  thread_id?: Maybe<string>;
51
75
  metadata?: Maybe<Record<string, unknown>>;
52
76
  action?: Maybe<"interrupt" | "rollback">;
53
77
  }
78
+ /**
79
+ * @inline
80
+ */
54
81
  interface ThreadDelete {
55
82
  thread_id?: Maybe<string>;
56
83
  run_id?: Maybe<string>;
57
84
  }
85
+ /**
86
+ * @inline
87
+ */
58
88
  interface ThreadSearch {
59
89
  thread_id?: Maybe<string>;
60
90
  status?: Maybe<"idle" | "busy" | "interrupted" | "error" | (string & {})>;
@@ -63,6 +93,9 @@ interface ThreadSearch {
63
93
  limit?: Maybe<number>;
64
94
  offset?: Maybe<number>;
65
95
  }
96
+ /**
97
+ * @inline
98
+ */
66
99
  interface CronCreate {
67
100
  payload?: Maybe<Record<string, unknown>>;
68
101
  schedule: string;
@@ -71,32 +104,53 @@ interface CronCreate {
71
104
  user_id?: Maybe<string>;
72
105
  end_time?: Maybe<string>;
73
106
  }
107
+ /**
108
+ * @inline
109
+ */
74
110
  interface CronRead {
75
111
  cron_id: string;
76
112
  }
113
+ /**
114
+ * @inline
115
+ */
77
116
  interface CronUpdate {
78
117
  cron_id: string;
79
118
  payload?: Maybe<Record<string, unknown>>;
80
119
  schedule?: Maybe<string>;
81
120
  }
121
+ /**
122
+ * @inline
123
+ */
82
124
  interface CronDelete {
83
125
  cron_id: string;
84
126
  }
127
+ /**
128
+ * @inline
129
+ */
85
130
  interface CronSearch {
86
131
  assistant_id?: Maybe<string>;
87
132
  thread_id?: Maybe<string>;
88
133
  limit?: Maybe<number>;
89
134
  offset?: Maybe<number>;
90
135
  }
136
+ /**
137
+ * @inline
138
+ */
91
139
  interface StorePut {
92
140
  namespace: string[];
93
141
  key: string;
94
142
  value: Record<string, unknown>;
95
143
  }
144
+ /**
145
+ * @inline
146
+ */
96
147
  interface StoreGet {
97
148
  namespace: Maybe<string[]>;
98
149
  key: string;
99
150
  }
151
+ /**
152
+ * @inline
153
+ */
100
154
  interface StoreSearch {
101
155
  namespace?: Maybe<string[]>;
102
156
  filter?: Maybe<Record<string, unknown>>;
@@ -104,6 +158,9 @@ interface StoreSearch {
104
158
  offset?: Maybe<number>;
105
159
  query?: Maybe<string>;
106
160
  }
161
+ /**
162
+ * @inline
163
+ */
107
164
  interface StoreListNamespaces {
108
165
  namespace?: Maybe<string[]>;
109
166
  suffix?: Maybe<string[]>;
@@ -111,10 +168,16 @@ interface StoreListNamespaces {
111
168
  limit?: Maybe<number>;
112
169
  offset?: Maybe<number>;
113
170
  }
171
+ /**
172
+ * @inline
173
+ */
114
174
  interface StoreDelete {
115
175
  namespace?: Maybe<string[]>;
116
176
  key: string;
117
177
  }
178
+ /**
179
+ * @inline
180
+ */
118
181
  interface RunsCreate {
119
182
  thread_id?: Maybe<string>;
120
183
  assistant_id: string;
package/dist/client.cjs CHANGED
@@ -58,16 +58,29 @@ class BaseClient {
58
58
  writable: true,
59
59
  value: void 0
60
60
  });
61
- this.asyncCaller = new async_caller_js_1.AsyncCaller({
61
+ const callerOptions = {
62
62
  maxRetries: 4,
63
63
  maxConcurrency: 4,
64
64
  ...config?.callerOptions,
65
- });
65
+ };
66
+ let defaultApiUrl = "http://localhost:8123";
67
+ if (!config?.apiUrl &&
68
+ typeof globalThis === "object" &&
69
+ globalThis != null) {
70
+ const fetchSmb = Symbol.for("langgraph_api:fetch");
71
+ const urlSmb = Symbol.for("langgraph_api:url");
72
+ const global = globalThis;
73
+ if (global[fetchSmb])
74
+ callerOptions.fetch ??= global[fetchSmb];
75
+ if (global[urlSmb])
76
+ defaultApiUrl = global[urlSmb];
77
+ }
78
+ this.asyncCaller = new async_caller_js_1.AsyncCaller(callerOptions);
66
79
  this.timeoutMs = config?.timeoutMs;
67
80
  // default limit being capped by Chrome
68
81
  // https://github.com/nodejs/undici/issues/1373
69
82
  // Regex to remove trailing slash, if present
70
- this.apiUrl = config?.apiUrl?.replace(/\/$/, "") || "http://localhost:8123";
83
+ this.apiUrl = config?.apiUrl?.replace(/\/$/, "") || defaultApiUrl;
71
84
  this.defaultHeaders = config?.defaultHeaders || {};
72
85
  const apiKey = getApiKey(config?.apiKey);
73
86
  if (apiKey) {
package/dist/client.js CHANGED
@@ -54,16 +54,29 @@ class BaseClient {
54
54
  writable: true,
55
55
  value: void 0
56
56
  });
57
- this.asyncCaller = new AsyncCaller({
57
+ const callerOptions = {
58
58
  maxRetries: 4,
59
59
  maxConcurrency: 4,
60
60
  ...config?.callerOptions,
61
- });
61
+ };
62
+ let defaultApiUrl = "http://localhost:8123";
63
+ if (!config?.apiUrl &&
64
+ typeof globalThis === "object" &&
65
+ globalThis != null) {
66
+ const fetchSmb = Symbol.for("langgraph_api:fetch");
67
+ const urlSmb = Symbol.for("langgraph_api:url");
68
+ const global = globalThis;
69
+ if (global[fetchSmb])
70
+ callerOptions.fetch ??= global[fetchSmb];
71
+ if (global[urlSmb])
72
+ defaultApiUrl = global[urlSmb];
73
+ }
74
+ this.asyncCaller = new AsyncCaller(callerOptions);
62
75
  this.timeoutMs = config?.timeoutMs;
63
76
  // default limit being capped by Chrome
64
77
  // https://github.com/nodejs/undici/issues/1373
65
78
  // Regex to remove trailing slash, if present
66
- this.apiUrl = config?.apiUrl?.replace(/\/$/, "") || "http://localhost:8123";
79
+ this.apiUrl = config?.apiUrl?.replace(/\/$/, "") || defaultApiUrl;
67
80
  this.defaultHeaders = config?.defaultHeaders || {};
68
81
  const apiKey = getApiKey(config?.apiKey);
69
82
  if (apiKey) {
@@ -1 +1 @@
1
- export { useStream, type MessageMetadata } from "./stream.js";
1
+ export { useStream, type MessageMetadata, type UseStream, type UseStreamOptions, } from "./stream.js";
@@ -1 +1 @@
1
- export { useStream } from "./stream.js";
1
+ export { useStream, } from "./stream.js";
@@ -53,7 +53,7 @@ type GetInterruptType<Bag extends BagTemplate> = Bag extends {
53
53
  type GetCustomEventType<Bag extends BagTemplate> = Bag extends {
54
54
  CustomEventType: unknown;
55
55
  } ? Bag["CustomEventType"] : unknown;
56
- interface UseStreamOptions<StateType extends Record<string, unknown> = Record<string, unknown>, Bag extends BagTemplate = BagTemplate> {
56
+ export interface UseStreamOptions<StateType extends Record<string, unknown> = Record<string, unknown>, Bag extends BagTemplate = BagTemplate> {
57
57
  /**
58
58
  * The ID of the assistant to use.
59
59
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@langchain/langgraph-sdk",
3
- "version": "0.0.66",
3
+ "version": "0.0.67",
4
4
  "description": "Client library for interacting with the LangGraph API",
5
5
  "type": "module",
6
6
  "packageManager": "yarn@1.22.19",
@@ -11,7 +11,7 @@
11
11
  "format": "prettier --write src",
12
12
  "lint": "prettier --check src && tsc --noEmit",
13
13
  "test": "NODE_OPTIONS=--experimental-vm-modules jest --testPathIgnorePatterns=\\.int\\.test.ts",
14
- "typedoc": "typedoc && typedoc src/react/index.ts --out docs/react --options typedoc.react.json"
14
+ "typedoc": "typedoc && typedoc src/react/index.ts --out docs/react --options typedoc.react.json && typedoc src/auth/index.ts --out docs/auth --options typedoc.auth.json"
15
15
  },
16
16
  "main": "index.js",
17
17
  "license": "MIT",