@langchain/langgraph-api 1.1.1 → 1.1.8
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/package.json +10 -9
- package/CHANGELOG.md +0 -290
- package/dist/api/assistants.d.mts +0 -3
- package/dist/api/assistants.mjs +0 -193
- package/dist/api/meta.d.mts +0 -3
- package/dist/api/meta.mjs +0 -65
- package/dist/api/runs.d.mts +0 -3
- package/dist/api/runs.mjs +0 -324
- package/dist/api/store.d.mts +0 -3
- package/dist/api/store.mjs +0 -111
- package/dist/api/threads.d.mts +0 -3
- package/dist/api/threads.mjs +0 -143
- package/dist/auth/custom.d.mts +0 -9
- package/dist/auth/custom.mjs +0 -32
- package/dist/auth/index.d.mts +0 -43
- package/dist/auth/index.mjs +0 -163
- package/dist/cli/entrypoint.d.mts +0 -1
- package/dist/cli/entrypoint.mjs +0 -41
- package/dist/cli/spawn.d.mts +0 -42
- package/dist/cli/spawn.mjs +0 -47
- package/dist/cli/utils/ipc/client.d.mts +0 -5
- package/dist/cli/utils/ipc/client.mjs +0 -47
- package/dist/cli/utils/ipc/utils/get-pipe-path.d.mts +0 -1
- package/dist/cli/utils/ipc/utils/get-pipe-path.mjs +0 -29
- package/dist/cli/utils/ipc/utils/temporary-directory.d.mts +0 -5
- package/dist/cli/utils/ipc/utils/temporary-directory.mjs +0 -40
- package/dist/command.d.mts +0 -11
- package/dist/command.mjs +0 -15
- package/dist/experimental/embed.d.mts +0 -42
- package/dist/experimental/embed.mjs +0 -299
- package/dist/graph/api.d.mts +0 -1
- package/dist/graph/api.mjs +0 -2
- package/dist/graph/load.d.mts +0 -19
- package/dist/graph/load.hooks.d.mts +0 -2
- package/dist/graph/load.hooks.mjs +0 -52
- package/dist/graph/load.mjs +0 -96
- package/dist/graph/load.utils.d.mts +0 -22
- package/dist/graph/load.utils.mjs +0 -49
- package/dist/graph/parser/index.d.mts +0 -23
- package/dist/graph/parser/index.mjs +0 -58
- package/dist/graph/parser/parser.d.mts +0 -77
- package/dist/graph/parser/parser.mjs +0 -429
- package/dist/graph/parser/parser.worker.d.mts +0 -1
- package/dist/graph/parser/parser.worker.mjs +0 -7
- package/dist/graph/parser/schema/types.d.mts +0 -154
- package/dist/graph/parser/schema/types.mjs +0 -1496
- package/dist/graph/parser/schema/types.template.d.mts +0 -1
- package/dist/graph/parser/schema/types.template.mts +0 -92
- package/dist/http/custom.d.mts +0 -6
- package/dist/http/custom.mjs +0 -10
- package/dist/http/middleware.d.mts +0 -11
- package/dist/http/middleware.mjs +0 -57
- package/dist/logging.d.mts +0 -10
- package/dist/logging.mjs +0 -115
- package/dist/loopback.d.mts +0 -4
- package/dist/loopback.mjs +0 -10
- package/dist/preload.d.mts +0 -1
- package/dist/preload.mjs +0 -29
- package/dist/queue.d.mts +0 -2
- package/dist/queue.mjs +0 -119
- package/dist/schemas.d.mts +0 -1552
- package/dist/schemas.mjs +0 -492
- package/dist/semver/index.d.mts +0 -15
- package/dist/semver/index.mjs +0 -46
- package/dist/server.d.mts +0 -175
- package/dist/server.mjs +0 -181
- package/dist/state.d.mts +0 -3
- package/dist/state.mjs +0 -30
- package/dist/storage/checkpoint.d.mts +0 -19
- package/dist/storage/checkpoint.mjs +0 -127
- package/dist/storage/context.d.mts +0 -3
- package/dist/storage/context.mjs +0 -11
- package/dist/storage/importMap.d.mts +0 -55
- package/dist/storage/importMap.mjs +0 -55
- package/dist/storage/ops.d.mts +0 -169
- package/dist/storage/ops.mjs +0 -1262
- package/dist/storage/persist.d.mts +0 -18
- package/dist/storage/persist.mjs +0 -81
- package/dist/storage/store.d.mts +0 -17
- package/dist/storage/store.mjs +0 -41
- package/dist/storage/types.d.mts +0 -301
- package/dist/storage/types.mjs +0 -1
- package/dist/stream.d.mts +0 -43
- package/dist/stream.mjs +0 -235
- package/dist/ui/load.d.mts +0 -8
- package/dist/ui/load.mjs +0 -53
- package/dist/utils/abort.d.mts +0 -1
- package/dist/utils/abort.mjs +0 -8
- package/dist/utils/hono.d.mts +0 -5
- package/dist/utils/hono.mjs +0 -24
- package/dist/utils/importMap.d.mts +0 -55
- package/dist/utils/importMap.mjs +0 -55
- package/dist/utils/runnableConfig.d.mts +0 -3
- package/dist/utils/runnableConfig.mjs +0 -45
- package/dist/utils/serde.d.mts +0 -5
- package/dist/utils/serde.mjs +0 -20
- package/dist/vitest.config.d.ts +0 -2
- package/dist/vitest.config.js +0 -12
- package/dist/webhook.d.mts +0 -11
- package/dist/webhook.mjs +0 -30
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export declare function serialize(data: unknown): string;
|
|
2
|
-
export declare function deserialize<T>(input: string): Promise<T>;
|
|
3
|
-
export declare class FileSystemPersistence<Schema> {
|
|
4
|
-
private filepath;
|
|
5
|
-
private data;
|
|
6
|
-
private defaultSchema;
|
|
7
|
-
private name;
|
|
8
|
-
private flushTimeout;
|
|
9
|
-
constructor(name: `.${string}.json`, defaultSchema: () => Schema);
|
|
10
|
-
initialize(cwd: string): Promise<this>;
|
|
11
|
-
protected persist(): Promise<void>;
|
|
12
|
-
protected schedulePersist(): void;
|
|
13
|
-
flush(): Promise<void>;
|
|
14
|
-
with<T>(fn: (data: Schema) => T): Promise<T>;
|
|
15
|
-
withGenerator<T extends AsyncGenerator<any>>(fn: ((data: Schema, options: {
|
|
16
|
-
schedulePersist: () => void;
|
|
17
|
-
}) => T) | T): AsyncGenerator<any, void, any>;
|
|
18
|
-
}
|
package/dist/storage/persist.mjs
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import * as path from "node:path";
|
|
2
|
-
import * as fs from "node:fs/promises";
|
|
3
|
-
import * as superjson from "superjson";
|
|
4
|
-
import * as importMap from "./importMap.mjs";
|
|
5
|
-
import { load } from "@langchain/core/load";
|
|
6
|
-
// Add custom transformers for Uint8Array
|
|
7
|
-
superjson.registerCustom({
|
|
8
|
-
isApplicable: (v) => v instanceof Uint8Array,
|
|
9
|
-
serialize: (v) => Buffer.from(v).toString("base64"),
|
|
10
|
-
deserialize: (v) => new Uint8Array(Buffer.from(v, "base64")),
|
|
11
|
-
}, "Uint8Array");
|
|
12
|
-
export function serialize(data) {
|
|
13
|
-
return superjson.stringify(data);
|
|
14
|
-
}
|
|
15
|
-
export async function deserialize(input) {
|
|
16
|
-
const result = await load(input, { importMap });
|
|
17
|
-
return superjson.deserialize(result);
|
|
18
|
-
}
|
|
19
|
-
export class FileSystemPersistence {
|
|
20
|
-
filepath = null;
|
|
21
|
-
data = null;
|
|
22
|
-
defaultSchema;
|
|
23
|
-
name;
|
|
24
|
-
flushTimeout = undefined;
|
|
25
|
-
constructor(name, defaultSchema) {
|
|
26
|
-
this.name = name;
|
|
27
|
-
this.defaultSchema = defaultSchema;
|
|
28
|
-
}
|
|
29
|
-
async initialize(cwd) {
|
|
30
|
-
this.filepath = path.resolve(cwd, ".langgraph_api", `${this.name}`);
|
|
31
|
-
try {
|
|
32
|
-
this.data = await deserialize(await fs.readFile(this.filepath, "utf-8"));
|
|
33
|
-
}
|
|
34
|
-
catch {
|
|
35
|
-
this.data = this.defaultSchema();
|
|
36
|
-
}
|
|
37
|
-
await fs
|
|
38
|
-
.mkdir(path.dirname(this.filepath), { recursive: true })
|
|
39
|
-
.catch(() => void 0);
|
|
40
|
-
return this;
|
|
41
|
-
}
|
|
42
|
-
async persist() {
|
|
43
|
-
if (this.data == null || this.filepath == null)
|
|
44
|
-
return;
|
|
45
|
-
clearTimeout(this.flushTimeout);
|
|
46
|
-
await fs.writeFile(this.filepath, serialize(this.data), "utf-8");
|
|
47
|
-
}
|
|
48
|
-
schedulePersist() {
|
|
49
|
-
clearTimeout(this.flushTimeout);
|
|
50
|
-
this.flushTimeout = setTimeout(() => this.persist(), 3000);
|
|
51
|
-
}
|
|
52
|
-
async flush() {
|
|
53
|
-
await this.persist();
|
|
54
|
-
}
|
|
55
|
-
async with(fn) {
|
|
56
|
-
if (this.filepath == null || this.data == null) {
|
|
57
|
-
throw new Error(`${this.name} not initialized`);
|
|
58
|
-
}
|
|
59
|
-
try {
|
|
60
|
-
return await fn(this.data);
|
|
61
|
-
}
|
|
62
|
-
finally {
|
|
63
|
-
this.schedulePersist();
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
async *withGenerator(fn) {
|
|
67
|
-
if (this.filepath == null || this.data == null) {
|
|
68
|
-
throw new Error(`${this.name} not initialized`);
|
|
69
|
-
}
|
|
70
|
-
let shouldPersist = false;
|
|
71
|
-
let schedulePersist = () => void (shouldPersist = true);
|
|
72
|
-
try {
|
|
73
|
-
const gen = typeof fn === "function" ? fn(this.data, { schedulePersist }) : fn;
|
|
74
|
-
yield* gen;
|
|
75
|
-
}
|
|
76
|
-
finally {
|
|
77
|
-
if (shouldPersist)
|
|
78
|
-
this.schedulePersist();
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}
|
package/dist/storage/store.d.mts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { InMemoryStore as BaseMemoryStore, type Operation, type OperationResults } from "@langchain/langgraph";
|
|
2
|
-
import { FileSystemPersistence } from "./persist.mjs";
|
|
3
|
-
declare class InMemoryStore extends BaseMemoryStore {
|
|
4
|
-
initialize(cwd: string): Promise<FileSystemPersistence<{
|
|
5
|
-
data: Map<string, any>;
|
|
6
|
-
vectors: Map<string, any>;
|
|
7
|
-
}>>;
|
|
8
|
-
clear(): Promise<void>;
|
|
9
|
-
batch<Op extends readonly Operation[]>(operations: Op): Promise<OperationResults<Op>>;
|
|
10
|
-
get(...args: Parameters<BaseMemoryStore["get"]>): ReturnType<BaseMemoryStore["get"]>;
|
|
11
|
-
search(...args: Parameters<BaseMemoryStore["search"]>): ReturnType<BaseMemoryStore["search"]>;
|
|
12
|
-
put(...args: Parameters<BaseMemoryStore["put"]>): ReturnType<BaseMemoryStore["put"]>;
|
|
13
|
-
listNamespaces(...args: Parameters<BaseMemoryStore["listNamespaces"]>): ReturnType<BaseMemoryStore["listNamespaces"]>;
|
|
14
|
-
toJSON(): string;
|
|
15
|
-
}
|
|
16
|
-
export declare const store: InMemoryStore;
|
|
17
|
-
export {};
|
package/dist/storage/store.mjs
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { InMemoryStore as BaseMemoryStore, } from "@langchain/langgraph";
|
|
2
|
-
import { FileSystemPersistence } from "./persist.mjs";
|
|
3
|
-
const conn = new FileSystemPersistence(".langgraphjs_api.store.json", () => ({
|
|
4
|
-
data: new Map(),
|
|
5
|
-
vectors: new Map(),
|
|
6
|
-
}));
|
|
7
|
-
class InMemoryStore extends BaseMemoryStore {
|
|
8
|
-
async initialize(cwd) {
|
|
9
|
-
await conn.initialize(cwd);
|
|
10
|
-
await conn.with(({ data, vectors }) => {
|
|
11
|
-
Object.assign(this, { data, vectors });
|
|
12
|
-
});
|
|
13
|
-
return conn;
|
|
14
|
-
}
|
|
15
|
-
async clear() {
|
|
16
|
-
await conn.with(({ data, vectors }) => {
|
|
17
|
-
data.clear();
|
|
18
|
-
vectors.clear();
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
async batch(operations) {
|
|
22
|
-
return await conn.with(() => super.batch(operations));
|
|
23
|
-
}
|
|
24
|
-
async get(...args) {
|
|
25
|
-
return await conn.with(() => super.get(...args));
|
|
26
|
-
}
|
|
27
|
-
async search(...args) {
|
|
28
|
-
return await conn.with(() => super.search(...args));
|
|
29
|
-
}
|
|
30
|
-
async put(...args) {
|
|
31
|
-
return await conn.with(() => super.put(...args));
|
|
32
|
-
}
|
|
33
|
-
async listNamespaces(...args) {
|
|
34
|
-
return await conn.with(() => super.listNamespaces(...args));
|
|
35
|
-
}
|
|
36
|
-
toJSON() {
|
|
37
|
-
// Prevent serialization of internal state
|
|
38
|
-
return "[InMemoryStore]";
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
export const store = new InMemoryStore();
|
package/dist/storage/types.d.mts
DELETED
|
@@ -1,301 +0,0 @@
|
|
|
1
|
-
import type { LangGraphRunnableConfig, CheckpointMetadata as LangGraphCheckpointMetadata, StateSnapshot as LangGraphStateSnapshot } from "@langchain/langgraph";
|
|
2
|
-
import type { RunCommand } from "../command.mjs";
|
|
3
|
-
import type { AuthContext } from "../auth/index.mjs";
|
|
4
|
-
export type { RunCommand } from "../command.mjs";
|
|
5
|
-
export type StorageEnv = {
|
|
6
|
-
Variables: {
|
|
7
|
-
LANGGRAPH_OPS: Ops;
|
|
8
|
-
};
|
|
9
|
-
};
|
|
10
|
-
export type Metadata = Record<string, unknown>;
|
|
11
|
-
export type AssistantSelectField = "assistant_id" | "graph_id" | "name" | "description" | "config" | "context" | "created_at" | "updated_at" | "metadata" | "version";
|
|
12
|
-
export type ThreadSelectField = "thread_id" | "created_at" | "updated_at" | "metadata" | "config" | "context" | "status" | "values" | "interrupts";
|
|
13
|
-
export type ThreadStatus = "idle" | "busy" | "interrupted" | "error";
|
|
14
|
-
export type RunStatus = "pending" | "running" | "error" | "success" | "timeout" | "interrupted";
|
|
15
|
-
export type StreamMode = "values" | "messages" | "messages-tuple" | "custom" | "updates" | "events" | "debug" | "tasks" | "checkpoints";
|
|
16
|
-
export type MultitaskStrategy = "reject" | "rollback" | "interrupt" | "enqueue";
|
|
17
|
-
export type OnConflictBehavior = "raise" | "do_nothing";
|
|
18
|
-
export type IfNotExists = "create" | "reject";
|
|
19
|
-
export interface RunnableConfig {
|
|
20
|
-
tags?: string[];
|
|
21
|
-
recursion_limit?: number;
|
|
22
|
-
configurable?: {
|
|
23
|
-
thread_id?: string;
|
|
24
|
-
thread_ts?: string;
|
|
25
|
-
[key: string]: unknown;
|
|
26
|
-
};
|
|
27
|
-
metadata?: LangGraphRunnableConfig["metadata"];
|
|
28
|
-
}
|
|
29
|
-
export interface Assistant {
|
|
30
|
-
name: string;
|
|
31
|
-
description: string | null;
|
|
32
|
-
assistant_id: string;
|
|
33
|
-
graph_id: string;
|
|
34
|
-
created_at: Date;
|
|
35
|
-
updated_at: Date;
|
|
36
|
-
version: number;
|
|
37
|
-
config: RunnableConfig;
|
|
38
|
-
context: unknown;
|
|
39
|
-
metadata: Metadata;
|
|
40
|
-
}
|
|
41
|
-
export interface AssistantVersion {
|
|
42
|
-
assistant_id: string;
|
|
43
|
-
version: number;
|
|
44
|
-
graph_id: string;
|
|
45
|
-
config: RunnableConfig;
|
|
46
|
-
context: unknown;
|
|
47
|
-
metadata: Metadata;
|
|
48
|
-
created_at: Date;
|
|
49
|
-
name: string;
|
|
50
|
-
description: string | null;
|
|
51
|
-
}
|
|
52
|
-
export interface RunKwargs {
|
|
53
|
-
input?: unknown;
|
|
54
|
-
command?: RunCommand;
|
|
55
|
-
stream_mode?: Array<StreamMode>;
|
|
56
|
-
interrupt_before?: "*" | string[] | undefined;
|
|
57
|
-
interrupt_after?: "*" | string[] | undefined;
|
|
58
|
-
config?: RunnableConfig;
|
|
59
|
-
context?: unknown;
|
|
60
|
-
subgraphs?: boolean;
|
|
61
|
-
resumable?: boolean;
|
|
62
|
-
temporary?: boolean;
|
|
63
|
-
webhook?: unknown;
|
|
64
|
-
feedback_keys?: string[] | undefined;
|
|
65
|
-
[key: string]: unknown;
|
|
66
|
-
}
|
|
67
|
-
export interface Run {
|
|
68
|
-
run_id: string;
|
|
69
|
-
thread_id: string;
|
|
70
|
-
assistant_id: string;
|
|
71
|
-
created_at: Date;
|
|
72
|
-
updated_at: Date;
|
|
73
|
-
status: RunStatus;
|
|
74
|
-
metadata: Metadata;
|
|
75
|
-
kwargs: RunKwargs;
|
|
76
|
-
multitask_strategy: MultitaskStrategy;
|
|
77
|
-
}
|
|
78
|
-
export interface Store {
|
|
79
|
-
runs: Record<string, Run>;
|
|
80
|
-
threads: Record<string, Thread>;
|
|
81
|
-
assistants: Record<string, Assistant>;
|
|
82
|
-
assistant_versions: AssistantVersion[];
|
|
83
|
-
retry_counter: Record<string, number>;
|
|
84
|
-
}
|
|
85
|
-
export interface Message {
|
|
86
|
-
topic: `run:${string}:stream:${string}`;
|
|
87
|
-
data: unknown;
|
|
88
|
-
}
|
|
89
|
-
export interface Thread {
|
|
90
|
-
thread_id: string;
|
|
91
|
-
created_at: Date;
|
|
92
|
-
updated_at: Date;
|
|
93
|
-
metadata?: Metadata;
|
|
94
|
-
config?: RunnableConfig;
|
|
95
|
-
status: ThreadStatus;
|
|
96
|
-
values?: Record<string, unknown>;
|
|
97
|
-
interrupts?: Record<string, unknown>;
|
|
98
|
-
}
|
|
99
|
-
export interface CheckpointTask {
|
|
100
|
-
id: string;
|
|
101
|
-
name: string;
|
|
102
|
-
error?: string;
|
|
103
|
-
interrupts: Record<string, unknown>;
|
|
104
|
-
state?: RunnableConfig;
|
|
105
|
-
}
|
|
106
|
-
export interface CheckpointPayload {
|
|
107
|
-
config?: RunnableConfig;
|
|
108
|
-
metadata: LangGraphCheckpointMetadata;
|
|
109
|
-
values: Record<string, unknown>;
|
|
110
|
-
next: string[];
|
|
111
|
-
parent_config?: RunnableConfig;
|
|
112
|
-
tasks: CheckpointTask[];
|
|
113
|
-
}
|
|
114
|
-
export interface Checkpoint {
|
|
115
|
-
thread_id: string;
|
|
116
|
-
checkpoint_ns: string;
|
|
117
|
-
checkpoint_id: string | null;
|
|
118
|
-
checkpoint_map: Record<string, unknown> | null;
|
|
119
|
-
}
|
|
120
|
-
export interface ThreadTask {
|
|
121
|
-
id: string;
|
|
122
|
-
name: string;
|
|
123
|
-
error: string | null;
|
|
124
|
-
interrupts: Record<string, unknown>[];
|
|
125
|
-
checkpoint: Checkpoint | null;
|
|
126
|
-
state: ThreadState | null;
|
|
127
|
-
result: unknown | null;
|
|
128
|
-
}
|
|
129
|
-
export interface ThreadState {
|
|
130
|
-
values: Record<string, unknown>;
|
|
131
|
-
next: string[];
|
|
132
|
-
checkpoint: Checkpoint | null;
|
|
133
|
-
metadata: Record<string, unknown> | undefined;
|
|
134
|
-
created_at: Date | null;
|
|
135
|
-
parent_checkpoint: Checkpoint | null;
|
|
136
|
-
tasks: ThreadTask[];
|
|
137
|
-
}
|
|
138
|
-
export interface RunsRepo {
|
|
139
|
-
next(): AsyncGenerator<{
|
|
140
|
-
run: Run;
|
|
141
|
-
attempt: number;
|
|
142
|
-
signal: AbortSignal;
|
|
143
|
-
}>;
|
|
144
|
-
put(runId: string, assistantId: string, kwargs: RunKwargs, options: {
|
|
145
|
-
threadId?: string;
|
|
146
|
-
userId?: string;
|
|
147
|
-
status?: RunStatus;
|
|
148
|
-
metadata?: Metadata;
|
|
149
|
-
preventInsertInInflight?: boolean;
|
|
150
|
-
multitaskStrategy?: MultitaskStrategy;
|
|
151
|
-
ifNotExists?: IfNotExists;
|
|
152
|
-
afterSeconds?: number;
|
|
153
|
-
}, auth: AuthContext | undefined): Promise<Run[]>;
|
|
154
|
-
get(runId: string, thread_id: string | undefined, auth: AuthContext | undefined): Promise<Run | null>;
|
|
155
|
-
delete(run_id: string, thread_id: string | undefined, auth: AuthContext | undefined): Promise<string | null>;
|
|
156
|
-
wait(runId: string, threadId: string | undefined, auth: AuthContext | undefined): Promise<unknown>;
|
|
157
|
-
join(runId: string, threadId: string, auth: AuthContext | undefined): Promise<unknown>;
|
|
158
|
-
setStatus(runId: string, status: RunStatus): Promise<unknown>;
|
|
159
|
-
cancel(threadId: string | undefined, runIds: string[], options: {
|
|
160
|
-
action?: "interrupt" | "rollback";
|
|
161
|
-
}, auth: AuthContext | undefined): Promise<void>;
|
|
162
|
-
search(threadId: string, options: {
|
|
163
|
-
limit?: number | null;
|
|
164
|
-
offset?: number | null;
|
|
165
|
-
status?: string | null;
|
|
166
|
-
metadata?: Metadata | null;
|
|
167
|
-
}, auth: AuthContext | undefined): Promise<Run[]>;
|
|
168
|
-
readonly stream: RunsStreamRepo;
|
|
169
|
-
}
|
|
170
|
-
export interface RunsStreamRepo {
|
|
171
|
-
join(runId: string, threadId: string | undefined, options: {
|
|
172
|
-
ignore404?: boolean;
|
|
173
|
-
cancelOnDisconnect?: AbortSignal;
|
|
174
|
-
lastEventId: string | undefined;
|
|
175
|
-
}, auth: AuthContext | undefined): AsyncGenerator<{
|
|
176
|
-
id?: string;
|
|
177
|
-
event: string;
|
|
178
|
-
data: unknown;
|
|
179
|
-
}>;
|
|
180
|
-
publish(payload: {
|
|
181
|
-
runId: string;
|
|
182
|
-
resumable: boolean;
|
|
183
|
-
event: string;
|
|
184
|
-
data: unknown | Error;
|
|
185
|
-
}): Promise<void>;
|
|
186
|
-
}
|
|
187
|
-
export interface ThreadsRepo {
|
|
188
|
-
search(options: {
|
|
189
|
-
metadata?: Metadata;
|
|
190
|
-
ids?: string[];
|
|
191
|
-
status?: ThreadStatus;
|
|
192
|
-
values?: Record<string, unknown>;
|
|
193
|
-
limit: number;
|
|
194
|
-
offset: number;
|
|
195
|
-
sort_by?: "thread_id" | "status" | "created_at" | "updated_at";
|
|
196
|
-
sort_order?: "asc" | "desc";
|
|
197
|
-
select?: ThreadSelectField[];
|
|
198
|
-
}, auth: AuthContext | undefined): AsyncGenerator<{
|
|
199
|
-
thread: Thread;
|
|
200
|
-
total: number;
|
|
201
|
-
}>;
|
|
202
|
-
get(thread_id: string, auth: AuthContext | undefined): Promise<Thread>;
|
|
203
|
-
put(thread_id: string, options: {
|
|
204
|
-
metadata?: Metadata;
|
|
205
|
-
if_exists: OnConflictBehavior;
|
|
206
|
-
}, auth: AuthContext | undefined): Promise<Thread>;
|
|
207
|
-
patch(threadId: string, options: {
|
|
208
|
-
metadata?: Metadata;
|
|
209
|
-
}, auth: AuthContext | undefined): Promise<Thread>;
|
|
210
|
-
setStatus(threadId: string, options: {
|
|
211
|
-
checkpoint?: CheckpointPayload;
|
|
212
|
-
exception?: Error;
|
|
213
|
-
}): Promise<void>;
|
|
214
|
-
delete(thread_id: string, auth: AuthContext | undefined): Promise<string[]>;
|
|
215
|
-
copy(thread_id: string, auth: AuthContext | undefined): Promise<Thread>;
|
|
216
|
-
count(options: {
|
|
217
|
-
metadata?: Metadata;
|
|
218
|
-
values?: Record<string, unknown>;
|
|
219
|
-
status?: ThreadStatus;
|
|
220
|
-
}, auth: AuthContext | undefined): Promise<number>;
|
|
221
|
-
readonly state: ThreadsStateRepo;
|
|
222
|
-
}
|
|
223
|
-
export interface ThreadsStateRepo {
|
|
224
|
-
get(config: RunnableConfig, options: {
|
|
225
|
-
subgraphs?: boolean;
|
|
226
|
-
}, auth: AuthContext | undefined): Promise<LangGraphStateSnapshot>;
|
|
227
|
-
post(config: RunnableConfig, values: Record<string, unknown>[] | Record<string, unknown> | null | undefined, asNode: string | undefined, auth: AuthContext | undefined): Promise<{
|
|
228
|
-
checkpoint: Record<string, unknown> | undefined;
|
|
229
|
-
}>;
|
|
230
|
-
bulk(config: RunnableConfig, supersteps: Array<{
|
|
231
|
-
updates: Array<{
|
|
232
|
-
values?: Record<string, unknown>[] | Record<string, unknown> | unknown | null | undefined;
|
|
233
|
-
command?: RunCommand | undefined | null;
|
|
234
|
-
as_node?: string | undefined;
|
|
235
|
-
}>;
|
|
236
|
-
}>, auth: AuthContext | undefined): Promise<{
|
|
237
|
-
checkpoint: Record<string, unknown> | undefined;
|
|
238
|
-
} | unknown[]>;
|
|
239
|
-
list(config: RunnableConfig, options: {
|
|
240
|
-
limit?: number;
|
|
241
|
-
before?: string | RunnableConfig;
|
|
242
|
-
metadata?: Metadata;
|
|
243
|
-
}, auth: AuthContext | undefined): Promise<LangGraphStateSnapshot[]>;
|
|
244
|
-
}
|
|
245
|
-
export interface AssistantsRepo {
|
|
246
|
-
search(options: {
|
|
247
|
-
graph_id?: string;
|
|
248
|
-
name?: string;
|
|
249
|
-
metadata?: Metadata;
|
|
250
|
-
limit: number;
|
|
251
|
-
offset: number;
|
|
252
|
-
sort_by?: "assistant_id" | "created_at" | "updated_at" | "name" | "graph_id";
|
|
253
|
-
sort_order?: "asc" | "desc";
|
|
254
|
-
select?: AssistantSelectField[];
|
|
255
|
-
}, auth: AuthContext | undefined): AsyncGenerator<{
|
|
256
|
-
assistant: Assistant;
|
|
257
|
-
total: number;
|
|
258
|
-
}>;
|
|
259
|
-
get(assistant_id: string, auth: AuthContext | undefined): Promise<Assistant>;
|
|
260
|
-
put(assistant_id: string, options: {
|
|
261
|
-
config: RunnableConfig;
|
|
262
|
-
context: unknown;
|
|
263
|
-
graph_id: string;
|
|
264
|
-
metadata?: Metadata;
|
|
265
|
-
if_exists: OnConflictBehavior;
|
|
266
|
-
name?: string;
|
|
267
|
-
description?: string;
|
|
268
|
-
}, auth: AuthContext | undefined): Promise<Assistant>;
|
|
269
|
-
patch(assistantId: string, options: {
|
|
270
|
-
config?: RunnableConfig;
|
|
271
|
-
context?: unknown;
|
|
272
|
-
graph_id?: string;
|
|
273
|
-
metadata?: Metadata;
|
|
274
|
-
name?: string;
|
|
275
|
-
description?: string;
|
|
276
|
-
}, auth: AuthContext | undefined): Promise<Assistant>;
|
|
277
|
-
delete(assistant_id: string, auth: AuthContext | undefined): Promise<string[]>;
|
|
278
|
-
count(options: {
|
|
279
|
-
graph_id?: string;
|
|
280
|
-
name?: string;
|
|
281
|
-
metadata?: Metadata;
|
|
282
|
-
}, auth: AuthContext | undefined): Promise<number>;
|
|
283
|
-
setLatest(assistant_id: string, version: number, auth: AuthContext | undefined): Promise<Assistant>;
|
|
284
|
-
getVersions(assistant_id: string, options: {
|
|
285
|
-
limit: number;
|
|
286
|
-
offset: number;
|
|
287
|
-
metadata?: Metadata;
|
|
288
|
-
}, auth: AuthContext | undefined): Promise<AssistantVersion[]>;
|
|
289
|
-
}
|
|
290
|
-
export interface Ops {
|
|
291
|
-
readonly assistants: AssistantsRepo;
|
|
292
|
-
readonly threads: ThreadsRepo;
|
|
293
|
-
readonly runs: RunsRepo;
|
|
294
|
-
truncate(flags: {
|
|
295
|
-
runs?: boolean;
|
|
296
|
-
threads?: boolean;
|
|
297
|
-
assistants?: boolean;
|
|
298
|
-
checkpointer?: boolean;
|
|
299
|
-
store?: boolean;
|
|
300
|
-
}): Promise<void>;
|
|
301
|
-
}
|
package/dist/storage/types.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/stream.d.mts
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import type { BaseCheckpointSaver, LangGraphRunnableConfig, CheckpointMetadata, Interrupt, StateSnapshot } from "@langchain/langgraph";
|
|
2
|
-
import type { Pregel } from "@langchain/langgraph/pregel";
|
|
3
|
-
import type { Checkpoint, Run, RunnableConfig } from "./storage/types.mjs";
|
|
4
|
-
interface DebugTask {
|
|
5
|
-
id: string;
|
|
6
|
-
name: string;
|
|
7
|
-
result?: unknown;
|
|
8
|
-
error?: unknown;
|
|
9
|
-
interrupts: Interrupt[];
|
|
10
|
-
state?: RunnableConfig | StateSnapshot;
|
|
11
|
-
path?: [string, ...(string | number)[]];
|
|
12
|
-
}
|
|
13
|
-
interface DebugCheckpoint {
|
|
14
|
-
config: RunnableConfig;
|
|
15
|
-
parentConfig: RunnableConfig | undefined;
|
|
16
|
-
values: unknown;
|
|
17
|
-
metadata: CheckpointMetadata;
|
|
18
|
-
next: string[];
|
|
19
|
-
tasks: DebugTask[];
|
|
20
|
-
}
|
|
21
|
-
type Prettify<T> = {
|
|
22
|
-
[K in keyof T]: T[K];
|
|
23
|
-
} & {};
|
|
24
|
-
export type StreamCheckpoint = Prettify<Omit<DebugCheckpoint, "parentConfig"> & {
|
|
25
|
-
parent_config: DebugCheckpoint["parentConfig"];
|
|
26
|
-
}>;
|
|
27
|
-
export type StreamTaskResult = Prettify<Omit<DebugTask, "state"> & {
|
|
28
|
-
state?: StateSnapshot;
|
|
29
|
-
checkpoint?: Checkpoint;
|
|
30
|
-
}>;
|
|
31
|
-
export declare function streamState(run: Run, options: {
|
|
32
|
-
attempt: number;
|
|
33
|
-
getGraph: (graphId: string, config: LangGraphRunnableConfig | undefined, options?: {
|
|
34
|
-
checkpointer?: BaseCheckpointSaver | null;
|
|
35
|
-
}) => Promise<Pregel<any, any, any, any, any>>;
|
|
36
|
-
onCheckpoint?: (checkpoint: StreamCheckpoint) => void;
|
|
37
|
-
onTaskResult?: (taskResult: StreamTaskResult) => void;
|
|
38
|
-
signal?: AbortSignal;
|
|
39
|
-
}): AsyncGenerator<{
|
|
40
|
-
event: string;
|
|
41
|
-
data: unknown;
|
|
42
|
-
}>;
|
|
43
|
-
export {};
|