@langchain/langgraph-sdk 0.0.29 → 0.0.31
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 +12 -4
- package/dist/client.d.ts +11 -3
- package/dist/client.js +12 -4
- package/dist/schema.d.ts +7 -4
- package/package.json +1 -1
package/dist/client.cjs
CHANGED
|
@@ -660,6 +660,7 @@ class RunsClient extends BaseClient {
|
|
|
660
660
|
params: {
|
|
661
661
|
limit: options?.limit ?? 10,
|
|
662
662
|
offset: options?.offset ?? 0,
|
|
663
|
+
status: options?.status ?? undefined,
|
|
663
664
|
},
|
|
664
665
|
});
|
|
665
666
|
}
|
|
@@ -711,14 +712,19 @@ class RunsClient extends BaseClient {
|
|
|
711
712
|
*
|
|
712
713
|
* @param threadId The ID of the thread.
|
|
713
714
|
* @param runId The ID of the run.
|
|
714
|
-
* @param signal An optional abort signal.
|
|
715
715
|
* @returns An async generator yielding stream parts.
|
|
716
716
|
*/
|
|
717
|
-
async *joinStream(threadId, runId,
|
|
717
|
+
async *joinStream(threadId, runId, options) {
|
|
718
|
+
const opts = typeof options === "object" &&
|
|
719
|
+
options != null &&
|
|
720
|
+
options instanceof AbortSignal
|
|
721
|
+
? { signal: options }
|
|
722
|
+
: options;
|
|
718
723
|
const response = await this.asyncCaller.fetch(...this.prepareFetchOptions(`/threads/${threadId}/runs/${runId}/stream`, {
|
|
719
724
|
method: "GET",
|
|
720
725
|
timeoutMs: null,
|
|
721
|
-
signal,
|
|
726
|
+
signal: opts?.signal,
|
|
727
|
+
params: { cancel_on_disconnect: opts?.cancelOnDisconnect ? "1" : "0" },
|
|
722
728
|
}));
|
|
723
729
|
let parser;
|
|
724
730
|
let onEndEvent;
|
|
@@ -726,7 +732,7 @@ class RunsClient extends BaseClient {
|
|
|
726
732
|
const stream = (response.body || new ReadableStream({ start: (ctrl) => ctrl.close() })).pipeThrough(new TransformStream({
|
|
727
733
|
async start(ctrl) {
|
|
728
734
|
parser = (0, index_js_1.createParser)((event) => {
|
|
729
|
-
if ((signal && signal.aborted) ||
|
|
735
|
+
if ((opts?.signal && opts.signal.aborted) ||
|
|
730
736
|
(event.type === "event" && event.data === "[DONE]")) {
|
|
731
737
|
ctrl.terminate();
|
|
732
738
|
return;
|
|
@@ -841,6 +847,7 @@ class StoreClient extends BaseClient {
|
|
|
841
847
|
* @param options.filter Optional dictionary of key-value pairs to filter results.
|
|
842
848
|
* @param options.limit Maximum number of items to return (default is 10).
|
|
843
849
|
* @param options.offset Number of items to skip before returning results (default is 0).
|
|
850
|
+
* @param options.query Optional search query.
|
|
844
851
|
* @returns Promise<SearchItemsResponse>
|
|
845
852
|
*/
|
|
846
853
|
async searchItems(namespacePrefix, options) {
|
|
@@ -849,6 +856,7 @@ class StoreClient extends BaseClient {
|
|
|
849
856
|
filter: options?.filter,
|
|
850
857
|
limit: options?.limit ?? 10,
|
|
851
858
|
offset: options?.offset ?? 0,
|
|
859
|
+
query: options?.query,
|
|
852
860
|
};
|
|
853
861
|
const response = await this.fetch("/store/items/search", {
|
|
854
862
|
method: "POST",
|
package/dist/client.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Assistant, AssistantGraph, CancelAction, Config, DefaultValues, GraphSchema, Metadata, Run, Thread, ThreadState, Cron, AssistantVersion, Subgraphs, Checkpoint, SearchItemsResponse, ListNamespaceResponse, Item, ThreadStatus } from "./schema.js";
|
|
1
|
+
import { Assistant, AssistantGraph, CancelAction, Config, DefaultValues, GraphSchema, Metadata, Run, RunStatus, Thread, ThreadState, Cron, AssistantVersion, Subgraphs, Checkpoint, SearchItemsResponse, ListNamespaceResponse, Item, ThreadStatus } from "./schema.js";
|
|
2
2
|
import { AsyncCaller, AsyncCallerParams } from "./utils/async_caller.js";
|
|
3
3
|
import { RunsCreatePayload, RunsStreamPayload, RunsWaitPayload, StreamEvent, CronsCreatePayload, OnConflictBehavior } from "./types.js";
|
|
4
4
|
/**
|
|
@@ -329,6 +329,10 @@ export declare class RunsClient extends BaseClient {
|
|
|
329
329
|
* Defaults to 0.
|
|
330
330
|
*/
|
|
331
331
|
offset?: number;
|
|
332
|
+
/**
|
|
333
|
+
* Status of the run to filter by.
|
|
334
|
+
*/
|
|
335
|
+
status?: RunStatus;
|
|
332
336
|
}): Promise<Run[]>;
|
|
333
337
|
/**
|
|
334
338
|
* Get a run by ID.
|
|
@@ -365,10 +369,12 @@ export declare class RunsClient extends BaseClient {
|
|
|
365
369
|
*
|
|
366
370
|
* @param threadId The ID of the thread.
|
|
367
371
|
* @param runId The ID of the run.
|
|
368
|
-
* @param signal An optional abort signal.
|
|
369
372
|
* @returns An async generator yielding stream parts.
|
|
370
373
|
*/
|
|
371
|
-
joinStream(threadId: string, runId: string,
|
|
374
|
+
joinStream(threadId: string, runId: string, options?: {
|
|
375
|
+
signal?: AbortSignal;
|
|
376
|
+
cancelOnDisconnect?: boolean;
|
|
377
|
+
} | AbortSignal): AsyncGenerator<{
|
|
372
378
|
event: StreamEvent;
|
|
373
379
|
data: any;
|
|
374
380
|
}>;
|
|
@@ -414,12 +420,14 @@ export declare class StoreClient extends BaseClient {
|
|
|
414
420
|
* @param options.filter Optional dictionary of key-value pairs to filter results.
|
|
415
421
|
* @param options.limit Maximum number of items to return (default is 10).
|
|
416
422
|
* @param options.offset Number of items to skip before returning results (default is 0).
|
|
423
|
+
* @param options.query Optional search query.
|
|
417
424
|
* @returns Promise<SearchItemsResponse>
|
|
418
425
|
*/
|
|
419
426
|
searchItems(namespacePrefix: string[], options?: {
|
|
420
427
|
filter?: Record<string, any>;
|
|
421
428
|
limit?: number;
|
|
422
429
|
offset?: number;
|
|
430
|
+
query?: string;
|
|
423
431
|
}): Promise<SearchItemsResponse>;
|
|
424
432
|
/**
|
|
425
433
|
* List namespaces with optional match conditions.
|
package/dist/client.js
CHANGED
|
@@ -653,6 +653,7 @@ export class RunsClient extends BaseClient {
|
|
|
653
653
|
params: {
|
|
654
654
|
limit: options?.limit ?? 10,
|
|
655
655
|
offset: options?.offset ?? 0,
|
|
656
|
+
status: options?.status ?? undefined,
|
|
656
657
|
},
|
|
657
658
|
});
|
|
658
659
|
}
|
|
@@ -704,14 +705,19 @@ export class RunsClient extends BaseClient {
|
|
|
704
705
|
*
|
|
705
706
|
* @param threadId The ID of the thread.
|
|
706
707
|
* @param runId The ID of the run.
|
|
707
|
-
* @param signal An optional abort signal.
|
|
708
708
|
* @returns An async generator yielding stream parts.
|
|
709
709
|
*/
|
|
710
|
-
async *joinStream(threadId, runId,
|
|
710
|
+
async *joinStream(threadId, runId, options) {
|
|
711
|
+
const opts = typeof options === "object" &&
|
|
712
|
+
options != null &&
|
|
713
|
+
options instanceof AbortSignal
|
|
714
|
+
? { signal: options }
|
|
715
|
+
: options;
|
|
711
716
|
const response = await this.asyncCaller.fetch(...this.prepareFetchOptions(`/threads/${threadId}/runs/${runId}/stream`, {
|
|
712
717
|
method: "GET",
|
|
713
718
|
timeoutMs: null,
|
|
714
|
-
signal,
|
|
719
|
+
signal: opts?.signal,
|
|
720
|
+
params: { cancel_on_disconnect: opts?.cancelOnDisconnect ? "1" : "0" },
|
|
715
721
|
}));
|
|
716
722
|
let parser;
|
|
717
723
|
let onEndEvent;
|
|
@@ -719,7 +725,7 @@ export class RunsClient extends BaseClient {
|
|
|
719
725
|
const stream = (response.body || new ReadableStream({ start: (ctrl) => ctrl.close() })).pipeThrough(new TransformStream({
|
|
720
726
|
async start(ctrl) {
|
|
721
727
|
parser = createParser((event) => {
|
|
722
|
-
if ((signal && signal.aborted) ||
|
|
728
|
+
if ((opts?.signal && opts.signal.aborted) ||
|
|
723
729
|
(event.type === "event" && event.data === "[DONE]")) {
|
|
724
730
|
ctrl.terminate();
|
|
725
731
|
return;
|
|
@@ -833,6 +839,7 @@ export class StoreClient extends BaseClient {
|
|
|
833
839
|
* @param options.filter Optional dictionary of key-value pairs to filter results.
|
|
834
840
|
* @param options.limit Maximum number of items to return (default is 10).
|
|
835
841
|
* @param options.offset Number of items to skip before returning results (default is 0).
|
|
842
|
+
* @param options.query Optional search query.
|
|
836
843
|
* @returns Promise<SearchItemsResponse>
|
|
837
844
|
*/
|
|
838
845
|
async searchItems(namespacePrefix, options) {
|
|
@@ -841,6 +848,7 @@ export class StoreClient extends BaseClient {
|
|
|
841
848
|
filter: options?.filter,
|
|
842
849
|
limit: options?.limit ?? 10,
|
|
843
850
|
offset: options?.offset ?? 0,
|
|
851
|
+
query: options?.query,
|
|
844
852
|
};
|
|
845
853
|
const response = await this.fetch("/store/items/search", {
|
|
846
854
|
method: "POST",
|
package/dist/schema.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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";
|
|
3
|
+
export type RunStatus = "pending" | "running" | "error" | "success" | "timeout" | "interrupted";
|
|
4
4
|
export type ThreadStatus = "idle" | "busy" | "interrupted" | "error";
|
|
5
5
|
type MultitaskStrategy = "reject" | "interrupt" | "rollback" | "enqueue";
|
|
6
6
|
export type CancelAction = "interrupt" | "rollback";
|
|
@@ -194,9 +194,6 @@ export interface Checkpoint {
|
|
|
194
194
|
export interface ListNamespaceResponse {
|
|
195
195
|
namespaces: string[][];
|
|
196
196
|
}
|
|
197
|
-
export interface SearchItemsResponse {
|
|
198
|
-
items: Item[];
|
|
199
|
-
}
|
|
200
197
|
export interface Item {
|
|
201
198
|
namespace: string[];
|
|
202
199
|
key: string;
|
|
@@ -204,4 +201,10 @@ export interface Item {
|
|
|
204
201
|
createdAt: string;
|
|
205
202
|
updatedAt: string;
|
|
206
203
|
}
|
|
204
|
+
export interface SearchItem extends Item {
|
|
205
|
+
score?: number;
|
|
206
|
+
}
|
|
207
|
+
export interface SearchItemsResponse {
|
|
208
|
+
items: SearchItem[];
|
|
209
|
+
}
|
|
207
210
|
export {};
|