@langchain/langgraph-sdk 0.0.71 → 0.0.73
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 +2 -0
- package/dist/client.d.ts +5 -3
- package/dist/client.js +2 -0
- package/dist/react-ui/index.cjs +3 -1
- package/dist/react-ui/index.d.ts +1 -1
- package/dist/react-ui/index.js +1 -1
- package/dist/react-ui/server/server.cjs +3 -2
- package/dist/react-ui/server/server.d.ts +21 -9
- package/dist/react-ui/server/server.js +3 -2
- package/dist/react-ui/types.cjs +20 -2
- package/dist/react-ui/types.d.ts +7 -4
- package/dist/react-ui/types.js +17 -1
- package/dist/schema.d.ts +3 -0
- package/package.json +1 -1
package/dist/client.cjs
CHANGED
|
@@ -313,6 +313,8 @@ class AssistantsClient extends BaseClient {
|
|
|
313
313
|
metadata: query?.metadata ?? undefined,
|
|
314
314
|
limit: query?.limit ?? 10,
|
|
315
315
|
offset: query?.offset ?? 0,
|
|
316
|
+
sort_by: query?.sortBy ?? undefined,
|
|
317
|
+
sort_order: query?.sortOrder ?? undefined,
|
|
316
318
|
},
|
|
317
319
|
});
|
|
318
320
|
}
|
package/dist/client.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Assistant, AssistantGraph, AssistantVersion, CancelAction, Checkpoint, Config, Cron, CronCreateForThreadResponse, CronCreateResponse, DefaultValues, GraphSchema, Item, ListNamespaceResponse, Metadata, Run, RunStatus, SearchItemsResponse, Subgraphs, Thread, ThreadState, ThreadStatus } from "./schema.js";
|
|
1
|
+
import { Assistant, AssistantGraph, AssistantSortBy, AssistantVersion, CancelAction, Checkpoint, Config, Cron, CronCreateForThreadResponse, CronCreateResponse, DefaultValues, GraphSchema, Item, ListNamespaceResponse, Metadata, Run, RunStatus, SearchItemsResponse, SortOrder, Subgraphs, Thread, ThreadSortBy, ThreadState, ThreadStatus } from "./schema.js";
|
|
2
2
|
import type { Command, CronsCreatePayload, OnConflictBehavior, RunsCreatePayload, RunsStreamPayload, RunsWaitPayload, StreamEvent } from "./types.js";
|
|
3
3
|
import type { StreamMode, TypedAsyncGenerator } from "./types.stream.js";
|
|
4
4
|
import { AsyncCaller, AsyncCallerParams } from "./utils/async_caller.js";
|
|
@@ -149,6 +149,8 @@ export declare class AssistantsClient extends BaseClient {
|
|
|
149
149
|
metadata?: Metadata;
|
|
150
150
|
limit?: number;
|
|
151
151
|
offset?: number;
|
|
152
|
+
sortBy?: AssistantSortBy;
|
|
153
|
+
sortOrder?: SortOrder;
|
|
152
154
|
}): Promise<Assistant[]>;
|
|
153
155
|
/**
|
|
154
156
|
* List all versions of an assistant.
|
|
@@ -271,12 +273,12 @@ export declare class ThreadsClient<TStateType = DefaultValues, TUpdateType = TSt
|
|
|
271
273
|
/**
|
|
272
274
|
* Sort by.
|
|
273
275
|
*/
|
|
274
|
-
sortBy?:
|
|
276
|
+
sortBy?: ThreadSortBy;
|
|
275
277
|
/**
|
|
276
278
|
* Sort order.
|
|
277
279
|
* Must be one of 'asc' or 'desc'.
|
|
278
280
|
*/
|
|
279
|
-
sortOrder?:
|
|
281
|
+
sortOrder?: SortOrder;
|
|
280
282
|
}): Promise<Thread<ValuesType>[]>;
|
|
281
283
|
/**
|
|
282
284
|
* Get state for a thread.
|
package/dist/client.js
CHANGED
|
@@ -308,6 +308,8 @@ export class AssistantsClient extends BaseClient {
|
|
|
308
308
|
metadata: query?.metadata ?? undefined,
|
|
309
309
|
limit: query?.limit ?? 10,
|
|
310
310
|
offset: query?.offset ?? 0,
|
|
311
|
+
sort_by: query?.sortBy ?? undefined,
|
|
312
|
+
sort_order: query?.sortOrder ?? undefined,
|
|
311
313
|
},
|
|
312
314
|
});
|
|
313
315
|
}
|
package/dist/react-ui/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.uiMessageReducer = exports.experimental_loadShare = exports.LoadExternalComponent = exports.useStreamContext = void 0;
|
|
3
|
+
exports.isRemoveUIMessage = exports.isUIMessage = exports.uiMessageReducer = exports.experimental_loadShare = exports.LoadExternalComponent = exports.useStreamContext = void 0;
|
|
4
4
|
const client_js_1 = require("./client.cjs");
|
|
5
5
|
(0, client_js_1.bootstrapUiContext)();
|
|
6
6
|
var client_js_2 = require("./client.cjs");
|
|
@@ -9,3 +9,5 @@ Object.defineProperty(exports, "LoadExternalComponent", { enumerable: true, get:
|
|
|
9
9
|
Object.defineProperty(exports, "experimental_loadShare", { enumerable: true, get: function () { return client_js_2.experimental_loadShare; } });
|
|
10
10
|
var types_js_1 = require("./types.cjs");
|
|
11
11
|
Object.defineProperty(exports, "uiMessageReducer", { enumerable: true, get: function () { return types_js_1.uiMessageReducer; } });
|
|
12
|
+
Object.defineProperty(exports, "isUIMessage", { enumerable: true, get: function () { return types_js_1.isUIMessage; } });
|
|
13
|
+
Object.defineProperty(exports, "isRemoveUIMessage", { enumerable: true, get: function () { return types_js_1.isRemoveUIMessage; } });
|
package/dist/react-ui/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { useStreamContext, LoadExternalComponent, experimental_loadShare, } from "./client.js";
|
|
2
|
-
export { uiMessageReducer, type UIMessage, type RemoveUIMessage, } from "./types.js";
|
|
2
|
+
export { uiMessageReducer, isUIMessage, isRemoveUIMessage, type UIMessage, type RemoveUIMessage, } from "./types.js";
|
package/dist/react-ui/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { bootstrapUiContext } from "./client.js";
|
|
2
2
|
bootstrapUiContext();
|
|
3
3
|
export { useStreamContext, LoadExternalComponent, experimental_loadShare, } from "./client.js";
|
|
4
|
-
export { uiMessageReducer, } from "./types.js";
|
|
4
|
+
export { uiMessageReducer, isUIMessage, isRemoveUIMessage, } from "./types.js";
|
|
@@ -16,13 +16,14 @@ const typedUi = (config, options) => {
|
|
|
16
16
|
const runId = config.metadata?.run_id ?? config.runId;
|
|
17
17
|
if (!runId)
|
|
18
18
|
throw new Error("run_id is required");
|
|
19
|
-
|
|
19
|
+
function handlePush(message, options) {
|
|
20
20
|
const evt = {
|
|
21
21
|
type: "ui",
|
|
22
22
|
id: message?.id ?? (0, uuid_1.v4)(),
|
|
23
23
|
name: message?.name,
|
|
24
24
|
props: message?.props,
|
|
25
25
|
metadata: {
|
|
26
|
+
merge: options?.merge || undefined,
|
|
26
27
|
run_id: runId,
|
|
27
28
|
tags: config.tags,
|
|
28
29
|
name: config.runName,
|
|
@@ -34,7 +35,7 @@ const typedUi = (config, options) => {
|
|
|
34
35
|
config.writer?.(evt);
|
|
35
36
|
config.configurable?.__pregel_send?.([[stateKey, evt]]);
|
|
36
37
|
return evt;
|
|
37
|
-
}
|
|
38
|
+
}
|
|
38
39
|
const handleDelete = (id) => {
|
|
39
40
|
const evt = { type: "remove-ui", id };
|
|
40
41
|
items.push(evt);
|
|
@@ -25,15 +25,27 @@ export declare const typedUi: <Decl extends Record<string, ElementType>>(config:
|
|
|
25
25
|
/** The key to write the UI messages to. Defaults to `ui`. */
|
|
26
26
|
stateKey?: string;
|
|
27
27
|
}) => {
|
|
28
|
-
push:
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
28
|
+
push: {
|
|
29
|
+
<K extends keyof Decl & string>(message: {
|
|
30
|
+
id?: string | undefined;
|
|
31
|
+
name: K;
|
|
32
|
+
props: { [K_1 in keyof Decl]: ComponentPropsWithoutRef<Decl[K_1]>; }[K];
|
|
33
|
+
metadata?: Record<string, unknown> | undefined;
|
|
34
|
+
}, options?: {
|
|
35
|
+
message?: MessageLike;
|
|
36
|
+
merge?: boolean;
|
|
37
|
+
}): UIMessage<K, { [K_1 in keyof Decl]: ComponentPropsWithoutRef<Decl[K_1]>; }[K]>;
|
|
38
|
+
<K_2 extends keyof Decl & string>(message: {
|
|
39
|
+
id?: string | undefined;
|
|
40
|
+
name: K_2;
|
|
41
|
+
props: Partial<{ [K_1 in keyof Decl]: ComponentPropsWithoutRef<Decl[K_1]>; }[K_2]>;
|
|
42
|
+
metadata?: Record<string, unknown> | undefined;
|
|
43
|
+
}, options: {
|
|
44
|
+
message?: MessageLike;
|
|
45
|
+
merge: true;
|
|
46
|
+
}): UIMessage<K_2, Partial<{ [K_1 in keyof Decl]: ComponentPropsWithoutRef<Decl[K_1]>; }[K_2]>>;
|
|
47
|
+
};
|
|
36
48
|
delete: (id: string) => RemoveUIMessage;
|
|
37
|
-
items: (
|
|
49
|
+
items: (RemoveUIMessage | UIMessage<string, Record<string, unknown>>)[];
|
|
38
50
|
};
|
|
39
51
|
export {};
|
|
@@ -13,13 +13,14 @@ export const typedUi = (config, options) => {
|
|
|
13
13
|
const runId = config.metadata?.run_id ?? config.runId;
|
|
14
14
|
if (!runId)
|
|
15
15
|
throw new Error("run_id is required");
|
|
16
|
-
|
|
16
|
+
function handlePush(message, options) {
|
|
17
17
|
const evt = {
|
|
18
18
|
type: "ui",
|
|
19
19
|
id: message?.id ?? uuidv4(),
|
|
20
20
|
name: message?.name,
|
|
21
21
|
props: message?.props,
|
|
22
22
|
metadata: {
|
|
23
|
+
merge: options?.merge || undefined,
|
|
23
24
|
run_id: runId,
|
|
24
25
|
tags: config.tags,
|
|
25
26
|
name: config.runName,
|
|
@@ -31,7 +32,7 @@ export const typedUi = (config, options) => {
|
|
|
31
32
|
config.writer?.(evt);
|
|
32
33
|
config.configurable?.__pregel_send?.([[stateKey, evt]]);
|
|
33
34
|
return evt;
|
|
34
|
-
}
|
|
35
|
+
}
|
|
35
36
|
const handleDelete = (id) => {
|
|
36
37
|
const evt = { type: "remove-ui", id };
|
|
37
38
|
items.push(evt);
|
package/dist/react-ui/types.cjs
CHANGED
|
@@ -1,6 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.uiMessageReducer = void 0;
|
|
3
|
+
exports.uiMessageReducer = exports.isRemoveUIMessage = exports.isUIMessage = void 0;
|
|
4
|
+
function isUIMessage(message) {
|
|
5
|
+
if (typeof message !== "object" || message == null)
|
|
6
|
+
return false;
|
|
7
|
+
if (!("type" in message))
|
|
8
|
+
return false;
|
|
9
|
+
return message.type === "ui";
|
|
10
|
+
}
|
|
11
|
+
exports.isUIMessage = isUIMessage;
|
|
12
|
+
function isRemoveUIMessage(message) {
|
|
13
|
+
if (typeof message !== "object" || message == null)
|
|
14
|
+
return false;
|
|
15
|
+
if (!("type" in message))
|
|
16
|
+
return false;
|
|
17
|
+
return message.type === "remove-ui";
|
|
18
|
+
}
|
|
19
|
+
exports.isRemoveUIMessage = isRemoveUIMessage;
|
|
4
20
|
function uiMessageReducer(state, update) {
|
|
5
21
|
const events = Array.isArray(update) ? update : [update];
|
|
6
22
|
let newState = state.slice();
|
|
@@ -11,7 +27,9 @@ function uiMessageReducer(state, update) {
|
|
|
11
27
|
}
|
|
12
28
|
const index = state.findIndex((ui) => ui.id === event.id);
|
|
13
29
|
if (index !== -1) {
|
|
14
|
-
newState[index] = event
|
|
30
|
+
newState[index] = event.metadata.merge
|
|
31
|
+
? { ...event, props: { ...state[index].props, ...event.props } }
|
|
32
|
+
: event;
|
|
15
33
|
}
|
|
16
34
|
else {
|
|
17
35
|
newState.push(event);
|
package/dist/react-ui/types.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
export interface UIMessage {
|
|
1
|
+
export interface UIMessage<TName extends string = string, TProps extends Record<string, unknown> = Record<string, unknown>> {
|
|
2
2
|
type: "ui";
|
|
3
3
|
id: string;
|
|
4
|
-
name:
|
|
5
|
-
props:
|
|
4
|
+
name: TName;
|
|
5
|
+
props: TProps;
|
|
6
6
|
metadata: {
|
|
7
|
+
merge?: boolean;
|
|
7
8
|
run_id?: string;
|
|
8
9
|
name?: string;
|
|
9
10
|
tags?: string[];
|
|
@@ -15,4 +16,6 @@ export interface RemoveUIMessage {
|
|
|
15
16
|
type: "remove-ui";
|
|
16
17
|
id: string;
|
|
17
18
|
}
|
|
18
|
-
export declare function
|
|
19
|
+
export declare function isUIMessage(message: unknown): message is UIMessage;
|
|
20
|
+
export declare function isRemoveUIMessage(message: unknown): message is RemoveUIMessage;
|
|
21
|
+
export declare function uiMessageReducer(state: UIMessage[], update: UIMessage | RemoveUIMessage | (UIMessage | RemoveUIMessage)[]): UIMessage<string, Record<string, unknown>>[];
|
package/dist/react-ui/types.js
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
export function isUIMessage(message) {
|
|
2
|
+
if (typeof message !== "object" || message == null)
|
|
3
|
+
return false;
|
|
4
|
+
if (!("type" in message))
|
|
5
|
+
return false;
|
|
6
|
+
return message.type === "ui";
|
|
7
|
+
}
|
|
8
|
+
export function isRemoveUIMessage(message) {
|
|
9
|
+
if (typeof message !== "object" || message == null)
|
|
10
|
+
return false;
|
|
11
|
+
if (!("type" in message))
|
|
12
|
+
return false;
|
|
13
|
+
return message.type === "remove-ui";
|
|
14
|
+
}
|
|
1
15
|
export function uiMessageReducer(state, update) {
|
|
2
16
|
const events = Array.isArray(update) ? update : [update];
|
|
3
17
|
let newState = state.slice();
|
|
@@ -8,7 +22,9 @@ export function uiMessageReducer(state, update) {
|
|
|
8
22
|
}
|
|
9
23
|
const index = state.findIndex((ui) => ui.id === event.id);
|
|
10
24
|
if (index !== -1) {
|
|
11
|
-
newState[index] = event
|
|
25
|
+
newState[index] = event.metadata.merge
|
|
26
|
+
? { ...event, props: { ...state[index].props, ...event.props } }
|
|
27
|
+
: event;
|
|
12
28
|
}
|
|
13
29
|
else {
|
|
14
30
|
newState.push(event);
|
package/dist/schema.d.ts
CHANGED
|
@@ -225,4 +225,7 @@ export interface CronCreateResponse {
|
|
|
225
225
|
export interface CronCreateForThreadResponse extends Omit<CronCreateResponse, "thread_id"> {
|
|
226
226
|
thread_id: string;
|
|
227
227
|
}
|
|
228
|
+
export type AssistantSortBy = "assistant_id" | "graph_id" | "name" | "created_at" | "updated_at";
|
|
229
|
+
export type ThreadSortBy = "thread_id" | "status" | "created_at" | "updated_at";
|
|
230
|
+
export type SortOrder = "asc" | "desc";
|
|
228
231
|
export {};
|