@langchain/langgraph-api 0.0.59 → 0.0.61
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/CHANGELOG.md +16 -0
- package/dist/api/assistants.mjs +16 -11
- package/dist/api/meta.mjs +24 -17
- package/dist/api/runs.mjs +19 -19
- package/dist/api/store.mjs +1 -1
- package/dist/api/threads.mjs +19 -14
- package/dist/auth/custom.d.mts +1 -4
- package/dist/auth/custom.mjs +1 -34
- package/dist/auth/index.d.mts +3 -0
- package/dist/auth/index.mjs +33 -0
- package/dist/experimental/embed.d.mts +1 -1
- package/dist/graph/api.d.mts +1 -0
- package/dist/graph/api.mjs +2 -0
- package/dist/graph/load.d.mts +3 -1
- package/dist/graph/load.mjs +9 -5
- package/dist/http/middleware.mjs +14 -10
- package/dist/loopback.d.mts +2 -1
- package/dist/queue.d.mts +2 -1
- package/dist/queue.mjs +10 -11
- package/dist/schemas.d.mts +141 -118
- package/dist/schemas.mjs +25 -0
- package/dist/server.d.mts +16 -13
- package/dist/server.mjs +27 -8
- package/dist/state.d.mts +1 -1
- package/dist/storage/context.d.mts +3 -0
- package/dist/storage/context.mjs +11 -0
- package/dist/storage/ops.d.mts +62 -202
- package/dist/storage/ops.mjs +187 -94
- package/dist/storage/types.d.mts +288 -0
- package/dist/storage/types.mjs +1 -0
- package/dist/stream.d.mts +1 -1
- package/dist/stream.mjs +12 -0
- package/dist/utils/runnableConfig.d.mts +1 -1
- package/dist/webhook.d.mts +1 -1
- package/package.json +16 -4
package/dist/server.d.mts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Ops } from "./storage/types.mjs";
|
|
1
2
|
import { z } from "zod";
|
|
2
3
|
export declare const StartServerSchema: z.ZodObject<{
|
|
3
4
|
port: z.ZodNumber;
|
|
@@ -50,19 +51,19 @@ export declare const StartServerSchema: z.ZodObject<{
|
|
|
50
51
|
}, "strip", z.ZodTypeAny, {
|
|
51
52
|
allow_origin_regex?: string | undefined;
|
|
52
53
|
expose_headers?: string[] | undefined;
|
|
53
|
-
|
|
54
|
+
max_age?: number | undefined;
|
|
54
55
|
allow_methods?: string[] | undefined;
|
|
55
56
|
allow_headers?: string[] | undefined;
|
|
56
57
|
allow_credentials?: boolean | undefined;
|
|
57
|
-
|
|
58
|
+
allow_origins?: string[] | undefined;
|
|
58
59
|
}, {
|
|
59
60
|
allow_origin_regex?: string | undefined;
|
|
60
61
|
expose_headers?: string[] | undefined;
|
|
61
|
-
|
|
62
|
+
max_age?: number | undefined;
|
|
62
63
|
allow_methods?: string[] | undefined;
|
|
63
64
|
allow_headers?: string[] | undefined;
|
|
64
65
|
allow_credentials?: boolean | undefined;
|
|
65
|
-
|
|
66
|
+
allow_origins?: string[] | undefined;
|
|
66
67
|
}>>;
|
|
67
68
|
}, "strip", z.ZodTypeAny, {
|
|
68
69
|
disable_assistants: boolean;
|
|
@@ -73,22 +74,22 @@ export declare const StartServerSchema: z.ZodObject<{
|
|
|
73
74
|
cors?: {
|
|
74
75
|
allow_origin_regex?: string | undefined;
|
|
75
76
|
expose_headers?: string[] | undefined;
|
|
76
|
-
|
|
77
|
+
max_age?: number | undefined;
|
|
77
78
|
allow_methods?: string[] | undefined;
|
|
78
79
|
allow_headers?: string[] | undefined;
|
|
79
80
|
allow_credentials?: boolean | undefined;
|
|
80
|
-
|
|
81
|
+
allow_origins?: string[] | undefined;
|
|
81
82
|
} | undefined;
|
|
82
83
|
app?: string | undefined;
|
|
83
84
|
}, {
|
|
84
85
|
cors?: {
|
|
85
86
|
allow_origin_regex?: string | undefined;
|
|
86
87
|
expose_headers?: string[] | undefined;
|
|
87
|
-
|
|
88
|
+
max_age?: number | undefined;
|
|
88
89
|
allow_methods?: string[] | undefined;
|
|
89
90
|
allow_headers?: string[] | undefined;
|
|
90
91
|
allow_credentials?: boolean | undefined;
|
|
91
|
-
|
|
92
|
+
allow_origins?: string[] | undefined;
|
|
92
93
|
} | undefined;
|
|
93
94
|
app?: string | undefined;
|
|
94
95
|
disable_assistants?: boolean | undefined;
|
|
@@ -123,11 +124,11 @@ export declare const StartServerSchema: z.ZodObject<{
|
|
|
123
124
|
cors?: {
|
|
124
125
|
allow_origin_regex?: string | undefined;
|
|
125
126
|
expose_headers?: string[] | undefined;
|
|
126
|
-
|
|
127
|
+
max_age?: number | undefined;
|
|
127
128
|
allow_methods?: string[] | undefined;
|
|
128
129
|
allow_headers?: string[] | undefined;
|
|
129
130
|
allow_credentials?: boolean | undefined;
|
|
130
|
-
|
|
131
|
+
allow_origins?: string[] | undefined;
|
|
131
132
|
} | undefined;
|
|
132
133
|
app?: string | undefined;
|
|
133
134
|
} | undefined;
|
|
@@ -152,11 +153,11 @@ export declare const StartServerSchema: z.ZodObject<{
|
|
|
152
153
|
cors?: {
|
|
153
154
|
allow_origin_regex?: string | undefined;
|
|
154
155
|
expose_headers?: string[] | undefined;
|
|
155
|
-
|
|
156
|
+
max_age?: number | undefined;
|
|
156
157
|
allow_methods?: string[] | undefined;
|
|
157
158
|
allow_headers?: string[] | undefined;
|
|
158
159
|
allow_credentials?: boolean | undefined;
|
|
159
|
-
|
|
160
|
+
allow_origins?: string[] | undefined;
|
|
160
161
|
} | undefined;
|
|
161
162
|
app?: string | undefined;
|
|
162
163
|
disable_assistants?: boolean | undefined;
|
|
@@ -166,7 +167,9 @@ export declare const StartServerSchema: z.ZodObject<{
|
|
|
166
167
|
disable_meta?: boolean | undefined;
|
|
167
168
|
} | undefined;
|
|
168
169
|
}>;
|
|
169
|
-
export declare function startServer(options: z.infer<typeof StartServerSchema
|
|
170
|
+
export declare function startServer(options: z.infer<typeof StartServerSchema>, storage?: {
|
|
171
|
+
ops?: Ops;
|
|
172
|
+
}): Promise<{
|
|
170
173
|
host: string;
|
|
171
174
|
cleanup: () => Promise<void>;
|
|
172
175
|
}>;
|
package/dist/server.mjs
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import { serve } from "@hono/node-server";
|
|
2
2
|
import { Hono } from "hono";
|
|
3
|
+
import { contextStorage } from "hono/context-storage";
|
|
3
4
|
import { registerFromEnv } from "./graph/load.mjs";
|
|
4
5
|
import runs from "./api/runs.mjs";
|
|
5
6
|
import threads from "./api/threads.mjs";
|
|
6
7
|
import assistants from "./api/assistants.mjs";
|
|
7
8
|
import store from "./api/store.mjs";
|
|
8
9
|
import meta from "./api/meta.mjs";
|
|
9
|
-
import { truncate, conn as opsConn } from "./storage/ops.mjs";
|
|
10
10
|
import { zValidator } from "@hono/zod-validator";
|
|
11
11
|
import { z } from "zod";
|
|
12
12
|
import { queue } from "./queue.mjs";
|
|
13
13
|
import { logger, requestLogger, registerRuntimeLogFormatter, registerSdkLogger, } from "./logging.mjs";
|
|
14
14
|
import { checkpointer } from "./storage/checkpoint.mjs";
|
|
15
|
+
import { FileSystemOps } from "./storage/ops.mjs";
|
|
15
16
|
import { store as graphStore } from "./storage/store.mjs";
|
|
16
17
|
import { auth } from "./auth/custom.mjs";
|
|
17
18
|
import { registerAuth } from "./auth/index.mjs";
|
|
@@ -20,6 +21,7 @@ import { cors, ensureContentType } from "./http/middleware.mjs";
|
|
|
20
21
|
import { bindLoopbackFetch } from "./loopback.mjs";
|
|
21
22
|
import { checkLangGraphSemver } from "./semver/index.mjs";
|
|
22
23
|
import { getConfig } from "@langchain/langgraph";
|
|
24
|
+
import { FileSystemPersistence } from "./storage/persist.mjs";
|
|
23
25
|
export const StartServerSchema = z.object({
|
|
24
26
|
port: z.number(),
|
|
25
27
|
nWorkers: z.number(),
|
|
@@ -59,7 +61,7 @@ export const StartServerSchema = z.object({
|
|
|
59
61
|
})
|
|
60
62
|
.optional(),
|
|
61
63
|
});
|
|
62
|
-
export async function startServer(options) {
|
|
64
|
+
export async function startServer(options, storage) {
|
|
63
65
|
const semver = await checkLangGraphSemver();
|
|
64
66
|
const invalidPackages = semver.filter((s) => !s.satisfies);
|
|
65
67
|
if (invalidPackages.length > 0) {
|
|
@@ -69,11 +71,23 @@ export async function startServer(options) {
|
|
|
69
71
|
])));
|
|
70
72
|
}
|
|
71
73
|
logger.info(`Initializing storage...`);
|
|
72
|
-
|
|
73
|
-
opsConn.initialize(options.cwd),
|
|
74
|
+
let initCalls = [
|
|
74
75
|
checkpointer.initialize(options.cwd),
|
|
75
76
|
graphStore.initialize(options.cwd),
|
|
76
|
-
]
|
|
77
|
+
];
|
|
78
|
+
let ops = storage?.ops;
|
|
79
|
+
if (ops == null) {
|
|
80
|
+
const opsConn = new FileSystemPersistence(".langgraphjs_ops.json", () => ({
|
|
81
|
+
runs: {},
|
|
82
|
+
threads: {},
|
|
83
|
+
assistants: {},
|
|
84
|
+
assistant_versions: [],
|
|
85
|
+
retry_counter: {},
|
|
86
|
+
}));
|
|
87
|
+
initCalls.push(opsConn.initialize(options.cwd));
|
|
88
|
+
ops = new FileSystemOps(opsConn);
|
|
89
|
+
}
|
|
90
|
+
const callbacks = await Promise.all(initCalls);
|
|
77
91
|
const cleanup = async () => {
|
|
78
92
|
logger.info(`Flushing to persistent storage, exiting...`);
|
|
79
93
|
await Promise.all(callbacks.map((c) => c.flush()));
|
|
@@ -95,7 +109,7 @@ export async function startServer(options) {
|
|
|
95
109
|
if (hasGraphDescriptions) {
|
|
96
110
|
logger.warn("A graph definition in `langgraph.json` has a `description` property. Local MCP features are not yet supported with the JS CLI and will be ignored.");
|
|
97
111
|
}
|
|
98
|
-
await registerFromEnv(graphPaths, { cwd: options.cwd });
|
|
112
|
+
await registerFromEnv(ops.assistants, graphPaths, { cwd: options.cwd });
|
|
99
113
|
registerRuntimeLogFormatter((info) => {
|
|
100
114
|
const config = getConfig();
|
|
101
115
|
if (config == null)
|
|
@@ -106,6 +120,11 @@ export async function startServer(options) {
|
|
|
106
120
|
return info;
|
|
107
121
|
});
|
|
108
122
|
const app = new Hono();
|
|
123
|
+
app.use(contextStorage());
|
|
124
|
+
app.use(async (c, next) => {
|
|
125
|
+
c.set("LANGGRAPH_OPS", ops);
|
|
126
|
+
await next();
|
|
127
|
+
});
|
|
109
128
|
// Loopback fetch used by webhooks and custom routes
|
|
110
129
|
bindLoopbackFetch(app);
|
|
111
130
|
app.post("/internal/truncate", zValidator("json", z.object({
|
|
@@ -116,7 +135,7 @@ export async function startServer(options) {
|
|
|
116
135
|
store: z.boolean().optional(),
|
|
117
136
|
})), (c) => {
|
|
118
137
|
const { runs, threads, assistants, checkpointer, store } = c.req.valid("json");
|
|
119
|
-
truncate({ runs, threads, assistants, checkpointer, store });
|
|
138
|
+
ops.truncate({ runs, threads, assistants, checkpointer, store });
|
|
120
139
|
return c.json({ ok: true });
|
|
121
140
|
});
|
|
122
141
|
app.use(cors(options.http?.cors));
|
|
@@ -153,7 +172,7 @@ export async function startServer(options) {
|
|
|
153
172
|
}
|
|
154
173
|
logger.info(`Starting ${options.nWorkers} workers`);
|
|
155
174
|
for (let i = 0; i < options.nWorkers; i++)
|
|
156
|
-
queue();
|
|
175
|
+
queue(ops);
|
|
157
176
|
return new Promise((resolve) => {
|
|
158
177
|
serve({ fetch: app.fetch, port: options.port, hostname: options.host }, (c) => {
|
|
159
178
|
resolve({ host: `${c.address}:${c.port}`, cleanup });
|
package/dist/state.d.mts
CHANGED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// Hono context helpers for accessing repositories, etc.
|
|
2
|
+
import { getContext } from "hono/context-storage";
|
|
3
|
+
export const assistants = () => {
|
|
4
|
+
return getContext().var.LANGGRAPH_OPS.assistants;
|
|
5
|
+
};
|
|
6
|
+
export const runs = () => {
|
|
7
|
+
return getContext().var.LANGGRAPH_OPS.runs;
|
|
8
|
+
};
|
|
9
|
+
export const threads = () => {
|
|
10
|
+
return getContext().var.LANGGRAPH_OPS.threads;
|
|
11
|
+
};
|
package/dist/storage/ops.d.mts
CHANGED
|
@@ -1,82 +1,19 @@
|
|
|
1
|
-
import type { CheckpointMetadata as LangGraphCheckpointMetadata, LangGraphRunnableConfig, StateSnapshot as LangGraphStateSnapshot } from "@langchain/langgraph";
|
|
2
1
|
import type { AuthContext } from "../auth/index.mjs";
|
|
3
|
-
import { type RunCommand } from "../command.mjs";
|
|
4
2
|
import { FileSystemPersistence } from "./persist.mjs";
|
|
5
|
-
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
};
|
|
20
|
-
metadata?: LangGraphRunnableConfig["metadata"];
|
|
21
|
-
}
|
|
22
|
-
interface Assistant {
|
|
23
|
-
name: string | undefined;
|
|
24
|
-
assistant_id: string;
|
|
25
|
-
graph_id: string;
|
|
26
|
-
created_at: Date;
|
|
27
|
-
updated_at: Date;
|
|
28
|
-
version: number;
|
|
29
|
-
config: RunnableConfig;
|
|
30
|
-
context: unknown;
|
|
31
|
-
metadata: Metadata;
|
|
32
|
-
}
|
|
33
|
-
interface AssistantVersion {
|
|
34
|
-
assistant_id: string;
|
|
35
|
-
version: number;
|
|
36
|
-
graph_id: string;
|
|
37
|
-
config: RunnableConfig;
|
|
38
|
-
context: unknown;
|
|
39
|
-
metadata: Metadata;
|
|
40
|
-
created_at: Date;
|
|
41
|
-
name: string | undefined;
|
|
42
|
-
}
|
|
43
|
-
export interface RunKwargs {
|
|
44
|
-
input?: unknown;
|
|
45
|
-
command?: RunCommand;
|
|
46
|
-
stream_mode?: Array<StreamMode>;
|
|
47
|
-
interrupt_before?: "*" | string[] | undefined;
|
|
48
|
-
interrupt_after?: "*" | string[] | undefined;
|
|
49
|
-
config?: RunnableConfig;
|
|
50
|
-
context?: unknown;
|
|
51
|
-
subgraphs?: boolean;
|
|
52
|
-
resumable?: boolean;
|
|
53
|
-
temporary?: boolean;
|
|
54
|
-
webhook?: unknown;
|
|
55
|
-
feedback_keys?: string[] | undefined;
|
|
56
|
-
[key: string]: unknown;
|
|
57
|
-
}
|
|
58
|
-
export interface Run {
|
|
59
|
-
run_id: string;
|
|
60
|
-
thread_id: string;
|
|
61
|
-
assistant_id: string;
|
|
62
|
-
created_at: Date;
|
|
63
|
-
updated_at: Date;
|
|
64
|
-
status: RunStatus;
|
|
65
|
-
metadata: Metadata;
|
|
66
|
-
kwargs: RunKwargs;
|
|
67
|
-
multitask_strategy: MultitaskStrategy;
|
|
68
|
-
}
|
|
69
|
-
interface Store {
|
|
70
|
-
runs: Record<string, Run>;
|
|
71
|
-
threads: Record<string, Thread>;
|
|
72
|
-
assistants: Record<string, Assistant>;
|
|
73
|
-
assistant_versions: AssistantVersion[];
|
|
74
|
-
retry_counter: Record<string, number>;
|
|
75
|
-
}
|
|
76
|
-
export declare const conn: FileSystemPersistence<Store>;
|
|
77
|
-
interface Message {
|
|
78
|
-
topic: `run:${string}:stream:${string}`;
|
|
79
|
-
data: unknown;
|
|
3
|
+
import type { Metadata, ThreadStatus, RunStatus, MultitaskStrategy, OnConflictBehavior, IfNotExists, RunnableConfig, Assistant, RunKwargs, Run, Store, Message, Thread, CheckpointPayload, Ops, AssistantsRepo, RunsRepo, RunsStreamRepo, ThreadsRepo, ThreadsStateRepo } from "./types.mjs";
|
|
4
|
+
export declare class FileSystemOps implements Ops {
|
|
5
|
+
private readonly conn;
|
|
6
|
+
readonly assistants: FileSystemAssistants;
|
|
7
|
+
readonly runs: FileSystemRuns;
|
|
8
|
+
readonly threads: FileSystemThreads;
|
|
9
|
+
constructor(conn: FileSystemPersistence<Store>);
|
|
10
|
+
truncate(flags: {
|
|
11
|
+
runs?: boolean;
|
|
12
|
+
threads?: boolean;
|
|
13
|
+
assistants?: boolean;
|
|
14
|
+
checkpointer?: boolean;
|
|
15
|
+
store?: boolean;
|
|
16
|
+
}): Promise<void>;
|
|
80
17
|
}
|
|
81
18
|
declare class Queue {
|
|
82
19
|
private log;
|
|
@@ -109,15 +46,10 @@ declare class StreamManagerImpl {
|
|
|
109
46
|
unlock(runId: string): void;
|
|
110
47
|
}
|
|
111
48
|
export declare const StreamManager: StreamManagerImpl;
|
|
112
|
-
export declare
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
checkpointer?: boolean;
|
|
117
|
-
store?: boolean;
|
|
118
|
-
}) => Promise<void>;
|
|
119
|
-
export declare class Assistants {
|
|
120
|
-
static search(options: {
|
|
49
|
+
export declare class FileSystemAssistants implements AssistantsRepo {
|
|
50
|
+
private readonly conn;
|
|
51
|
+
constructor(conn: FileSystemPersistence<Store>);
|
|
52
|
+
search(options: {
|
|
121
53
|
graph_id?: string;
|
|
122
54
|
metadata?: Metadata;
|
|
123
55
|
limit: number;
|
|
@@ -126,8 +58,8 @@ export declare class Assistants {
|
|
|
126
58
|
assistant: Assistant;
|
|
127
59
|
total: number;
|
|
128
60
|
}>;
|
|
129
|
-
|
|
130
|
-
|
|
61
|
+
get(assistant_id: string, auth: AuthContext | undefined): Promise<Assistant>;
|
|
62
|
+
put(assistant_id: string, options: {
|
|
131
63
|
config: RunnableConfig;
|
|
132
64
|
context: unknown;
|
|
133
65
|
graph_id: string;
|
|
@@ -135,72 +67,30 @@ export declare class Assistants {
|
|
|
135
67
|
if_exists: OnConflictBehavior;
|
|
136
68
|
name?: string;
|
|
137
69
|
}, auth: AuthContext | undefined): Promise<Assistant>;
|
|
138
|
-
|
|
70
|
+
patch(assistantId: string, options: {
|
|
139
71
|
config?: RunnableConfig;
|
|
140
72
|
context?: unknown;
|
|
141
73
|
graph_id?: string;
|
|
142
74
|
metadata?: Metadata;
|
|
143
75
|
name?: string;
|
|
144
76
|
}, auth: AuthContext | undefined): Promise<Assistant>;
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
77
|
+
delete(assistant_id: string, auth: AuthContext | undefined): Promise<string[]>;
|
|
78
|
+
setLatest(assistant_id: string, version: number, auth: AuthContext | undefined): Promise<Assistant>;
|
|
79
|
+
getVersions(assistant_id: string, options: {
|
|
148
80
|
limit: number;
|
|
149
81
|
offset: number;
|
|
150
82
|
metadata?: Metadata;
|
|
151
|
-
}, auth: AuthContext | undefined): Promise<AssistantVersion[]>;
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
updated_at: Date;
|
|
157
|
-
metadata?: Metadata;
|
|
158
|
-
config?: RunnableConfig;
|
|
159
|
-
status: ThreadStatus;
|
|
160
|
-
values?: Record<string, unknown>;
|
|
161
|
-
interrupts?: Record<string, unknown>;
|
|
162
|
-
}
|
|
163
|
-
interface CheckpointTask {
|
|
164
|
-
id: string;
|
|
165
|
-
name: string;
|
|
166
|
-
error?: string;
|
|
167
|
-
interrupts: Record<string, unknown>;
|
|
168
|
-
state?: RunnableConfig;
|
|
169
|
-
}
|
|
170
|
-
interface CheckpointPayload {
|
|
171
|
-
config?: RunnableConfig;
|
|
172
|
-
metadata: LangGraphCheckpointMetadata;
|
|
173
|
-
values: Record<string, unknown>;
|
|
174
|
-
next: string[];
|
|
175
|
-
parent_config?: RunnableConfig;
|
|
176
|
-
tasks: CheckpointTask[];
|
|
177
|
-
}
|
|
178
|
-
export interface Checkpoint {
|
|
179
|
-
thread_id: string;
|
|
180
|
-
checkpoint_ns: string;
|
|
181
|
-
checkpoint_id: string | null;
|
|
182
|
-
checkpoint_map: Record<string, unknown> | null;
|
|
183
|
-
}
|
|
184
|
-
interface ThreadTask {
|
|
185
|
-
id: string;
|
|
186
|
-
name: string;
|
|
187
|
-
error: string | null;
|
|
188
|
-
interrupts: Record<string, unknown>[];
|
|
189
|
-
checkpoint: Checkpoint | null;
|
|
190
|
-
state: ThreadState | null;
|
|
191
|
-
result: unknown | null;
|
|
192
|
-
}
|
|
193
|
-
export interface ThreadState {
|
|
194
|
-
values: Record<string, unknown>;
|
|
195
|
-
next: string[];
|
|
196
|
-
checkpoint: Checkpoint | null;
|
|
197
|
-
metadata: Record<string, unknown> | undefined;
|
|
198
|
-
created_at: Date | null;
|
|
199
|
-
parent_checkpoint: Checkpoint | null;
|
|
200
|
-
tasks: ThreadTask[];
|
|
83
|
+
}, auth: AuthContext | undefined): Promise<import("./types.mjs").AssistantVersion[]>;
|
|
84
|
+
count(options: {
|
|
85
|
+
graph_id?: string;
|
|
86
|
+
metadata?: Metadata;
|
|
87
|
+
}, auth: AuthContext | undefined): Promise<number>;
|
|
201
88
|
}
|
|
202
|
-
export declare class
|
|
203
|
-
|
|
89
|
+
export declare class FileSystemThreads implements ThreadsRepo {
|
|
90
|
+
private readonly conn;
|
|
91
|
+
readonly state: ThreadsStateRepo;
|
|
92
|
+
constructor(conn: FileSystemPersistence<Store>);
|
|
93
|
+
search(options: {
|
|
204
94
|
metadata?: Metadata;
|
|
205
95
|
status?: ThreadStatus;
|
|
206
96
|
values?: Record<string, unknown>;
|
|
@@ -212,51 +102,38 @@ export declare class Threads {
|
|
|
212
102
|
thread: Thread;
|
|
213
103
|
total: number;
|
|
214
104
|
}>;
|
|
215
|
-
|
|
216
|
-
|
|
105
|
+
get(thread_id: string, auth: AuthContext | undefined): Promise<Thread>;
|
|
106
|
+
put(thread_id: string, options: {
|
|
217
107
|
metadata?: Metadata;
|
|
218
108
|
if_exists: OnConflictBehavior;
|
|
219
109
|
}, auth: AuthContext | undefined): Promise<Thread>;
|
|
220
|
-
|
|
110
|
+
patch(threadId: string, options: {
|
|
221
111
|
metadata?: Metadata;
|
|
222
112
|
}, auth: AuthContext | undefined): Promise<Thread>;
|
|
223
|
-
|
|
113
|
+
setStatus(threadId: string, options: {
|
|
224
114
|
checkpoint?: CheckpointPayload;
|
|
225
115
|
exception?: Error;
|
|
226
116
|
}): Promise<void>;
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
}>;
|
|
243
|
-
}>, auth: AuthContext | undefined): Promise<never[] | {
|
|
244
|
-
checkpoint: Record<string, any> | undefined;
|
|
245
|
-
}>;
|
|
246
|
-
list(config: RunnableConfig, options: {
|
|
247
|
-
limit?: number;
|
|
248
|
-
before?: string | RunnableConfig;
|
|
249
|
-
metadata?: Metadata;
|
|
250
|
-
}, auth: AuthContext | undefined): Promise<LangGraphStateSnapshot[]>;
|
|
251
|
-
};
|
|
252
|
-
}
|
|
253
|
-
export declare class Runs {
|
|
254
|
-
static next(): AsyncGenerator<{
|
|
117
|
+
delete(thread_id: string, auth: AuthContext | undefined): Promise<string[]>;
|
|
118
|
+
copy(thread_id: string, auth: AuthContext | undefined): Promise<Thread>;
|
|
119
|
+
count(options: {
|
|
120
|
+
metadata?: Metadata;
|
|
121
|
+
values?: Record<string, unknown>;
|
|
122
|
+
status?: ThreadStatus;
|
|
123
|
+
}, auth: AuthContext | undefined): Promise<number>;
|
|
124
|
+
private static State;
|
|
125
|
+
}
|
|
126
|
+
export declare class FileSystemRuns implements RunsRepo {
|
|
127
|
+
private readonly conn;
|
|
128
|
+
private readonly threads;
|
|
129
|
+
readonly stream: RunsStreamRepo;
|
|
130
|
+
constructor(conn: FileSystemPersistence<Store>);
|
|
131
|
+
next(): AsyncGenerator<{
|
|
255
132
|
run: Run;
|
|
256
133
|
attempt: number;
|
|
257
134
|
signal: AbortSignal;
|
|
258
135
|
}>;
|
|
259
|
-
|
|
136
|
+
put(runId: string, assistantId: string, kwargs: RunKwargs, options: {
|
|
260
137
|
threadId?: string;
|
|
261
138
|
userId?: string;
|
|
262
139
|
status?: RunStatus;
|
|
@@ -266,38 +143,21 @@ export declare class Runs {
|
|
|
266
143
|
ifNotExists?: IfNotExists;
|
|
267
144
|
afterSeconds?: number;
|
|
268
145
|
}, auth: AuthContext | undefined): Promise<Run[]>;
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
146
|
+
get(runId: string, thread_id: string | undefined, auth: AuthContext | undefined): Promise<Run | null>;
|
|
147
|
+
delete(run_id: string, thread_id: string | undefined, auth: AuthContext | undefined): Promise<string | null>;
|
|
148
|
+
wait(runId: string, threadId: string | undefined, auth: AuthContext | undefined): Promise<unknown>;
|
|
149
|
+
join(runId: string, threadId: string, auth: AuthContext | undefined): Promise<{} | null>;
|
|
150
|
+
cancel(threadId: string | undefined, runIds: string[], options: {
|
|
274
151
|
action?: "interrupt" | "rollback";
|
|
275
152
|
}, auth: AuthContext | undefined): Promise<void>;
|
|
276
|
-
|
|
153
|
+
search(threadId: string, options: {
|
|
277
154
|
limit?: number | null;
|
|
278
155
|
offset?: number | null;
|
|
279
156
|
status?: string | null;
|
|
280
157
|
metadata?: Metadata | null;
|
|
281
158
|
}, auth: AuthContext | undefined): Promise<Run[]>;
|
|
282
|
-
|
|
283
|
-
static Stream
|
|
284
|
-
new (): {};
|
|
285
|
-
join(runId: string, threadId: string | undefined, options: {
|
|
286
|
-
ignore404?: boolean;
|
|
287
|
-
cancelOnDisconnect?: AbortSignal;
|
|
288
|
-
lastEventId: string | undefined;
|
|
289
|
-
}, auth: AuthContext | undefined): AsyncGenerator<{
|
|
290
|
-
id?: string;
|
|
291
|
-
event: string;
|
|
292
|
-
data: unknown;
|
|
293
|
-
}>;
|
|
294
|
-
publish(payload: {
|
|
295
|
-
runId: string;
|
|
296
|
-
event: string;
|
|
297
|
-
data: unknown;
|
|
298
|
-
resumable: boolean;
|
|
299
|
-
}): Promise<void>;
|
|
300
|
-
};
|
|
159
|
+
setStatus(runId: string, status: RunStatus): Promise<void>;
|
|
160
|
+
private static Stream;
|
|
301
161
|
}
|
|
302
162
|
export declare class Crons {
|
|
303
163
|
}
|