@langchain/langgraph-api 0.0.30 → 0.0.32
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/api/assistants.d.mts +3 -0
- package/dist/api/assistants.mjs +37 -21
- package/dist/api/meta.d.mts +3 -0
- package/dist/api/runs.d.mts +3 -0
- package/dist/api/store.d.mts +3 -0
- package/dist/api/threads.d.mts +3 -0
- package/dist/auth/custom.d.mts +12 -0
- package/dist/auth/index.d.mts +1 -1
- package/dist/cli/entrypoint.d.mts +1 -0
- package/dist/cli/utils/ipc/client.d.mts +5 -0
- package/dist/cli/utils/ipc/utils/get-pipe-path.d.mts +1 -0
- package/dist/cli/utils/ipc/utils/temporary-directory.d.mts +5 -0
- package/dist/command.d.mts +11 -0
- package/dist/graph/load.d.mts +16 -0
- package/dist/graph/load.hooks.d.mts +2 -0
- package/dist/graph/load.mjs +17 -4
- package/dist/graph/load.utils.d.mts +22 -0
- package/dist/graph/load.utils.mjs +4 -36
- package/dist/graph/parser/index.d.mts +17 -0
- package/dist/graph/parser/index.mjs +41 -0
- package/dist/graph/parser/parser.d.mts +63 -0
- package/dist/graph/parser/parser.mjs +3 -3
- package/dist/graph/parser/parser.worker.d.mts +1 -0
- package/dist/graph/parser/schema/types.d.mts +154 -0
- package/dist/graph/parser/schema/types.mjs +0 -111
- package/dist/graph/parser/schema/types.template.d.mts +1 -0
- package/dist/graph/parser/schema/types.template.mts +9 -4
- package/dist/http/custom.d.mts +6 -0
- package/dist/http/middleware.d.mts +11 -0
- package/dist/logging.d.mts +7 -0
- package/dist/loopback.d.mts +3 -0
- package/dist/preload.d.mts +1 -0
- package/dist/queue.d.mts +1 -0
- package/dist/schemas.d.mts +1369 -0
- package/dist/server.d.mts +157 -0
- package/dist/state.d.mts +3 -0
- package/dist/storage/checkpoint.d.mts +19 -0
- package/dist/storage/importMap.d.mts +55 -0
- package/dist/storage/ops.d.mts +284 -0
- package/dist/storage/persist.d.mts +18 -0
- package/dist/storage/store.d.mts +17 -0
- package/dist/stream.d.mts +38 -0
- package/dist/ui/load.d.mts +8 -0
- package/dist/utils/abort.d.mts +1 -0
- package/dist/utils/hono.d.mts +5 -0
- package/dist/utils/importMap.d.mts +55 -0
- package/dist/utils/runnableConfig.d.mts +3 -0
- package/dist/utils/serde.d.mts +5 -0
- package/dist/webhook.d.mts +11 -0
- package/package.json +10 -6
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const StartServerSchema: z.ZodObject<{
|
|
3
|
+
port: z.ZodNumber;
|
|
4
|
+
nWorkers: z.ZodNumber;
|
|
5
|
+
host: z.ZodString;
|
|
6
|
+
cwd: z.ZodString;
|
|
7
|
+
graphs: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
8
|
+
auth: z.ZodOptional<z.ZodObject<{
|
|
9
|
+
path: z.ZodOptional<z.ZodString>;
|
|
10
|
+
disable_studio_auth: z.ZodDefault<z.ZodBoolean>;
|
|
11
|
+
}, "strip", z.ZodTypeAny, {
|
|
12
|
+
disable_studio_auth: boolean;
|
|
13
|
+
path?: string | undefined;
|
|
14
|
+
}, {
|
|
15
|
+
path?: string | undefined;
|
|
16
|
+
disable_studio_auth?: boolean | undefined;
|
|
17
|
+
}>>;
|
|
18
|
+
ui: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
19
|
+
ui_config: z.ZodOptional<z.ZodObject<{
|
|
20
|
+
shared: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
21
|
+
}, "strip", z.ZodTypeAny, {
|
|
22
|
+
shared?: string[] | undefined;
|
|
23
|
+
}, {
|
|
24
|
+
shared?: string[] | undefined;
|
|
25
|
+
}>>;
|
|
26
|
+
http: z.ZodOptional<z.ZodObject<{
|
|
27
|
+
app: z.ZodOptional<z.ZodString>;
|
|
28
|
+
disable_assistants: z.ZodDefault<z.ZodBoolean>;
|
|
29
|
+
disable_threads: z.ZodDefault<z.ZodBoolean>;
|
|
30
|
+
disable_runs: z.ZodDefault<z.ZodBoolean>;
|
|
31
|
+
disable_store: z.ZodDefault<z.ZodBoolean>;
|
|
32
|
+
disable_meta: z.ZodDefault<z.ZodBoolean>;
|
|
33
|
+
cors: z.ZodOptional<z.ZodObject<{
|
|
34
|
+
allow_origins: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
35
|
+
allow_methods: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
36
|
+
allow_headers: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
37
|
+
allow_credentials: z.ZodOptional<z.ZodBoolean>;
|
|
38
|
+
allow_origin_regex: z.ZodOptional<z.ZodString>;
|
|
39
|
+
expose_headers: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
40
|
+
max_age: z.ZodOptional<z.ZodNumber>;
|
|
41
|
+
}, "strip", z.ZodTypeAny, {
|
|
42
|
+
allow_origin_regex?: string | undefined;
|
|
43
|
+
allow_origins?: string[] | undefined;
|
|
44
|
+
allow_methods?: string[] | undefined;
|
|
45
|
+
allow_headers?: string[] | undefined;
|
|
46
|
+
allow_credentials?: boolean | undefined;
|
|
47
|
+
expose_headers?: string[] | undefined;
|
|
48
|
+
max_age?: number | undefined;
|
|
49
|
+
}, {
|
|
50
|
+
allow_origin_regex?: string | undefined;
|
|
51
|
+
allow_origins?: string[] | undefined;
|
|
52
|
+
allow_methods?: string[] | undefined;
|
|
53
|
+
allow_headers?: string[] | undefined;
|
|
54
|
+
allow_credentials?: boolean | undefined;
|
|
55
|
+
expose_headers?: string[] | undefined;
|
|
56
|
+
max_age?: number | undefined;
|
|
57
|
+
}>>;
|
|
58
|
+
}, "strip", z.ZodTypeAny, {
|
|
59
|
+
disable_assistants: boolean;
|
|
60
|
+
disable_threads: boolean;
|
|
61
|
+
disable_runs: boolean;
|
|
62
|
+
disable_store: boolean;
|
|
63
|
+
disable_meta: boolean;
|
|
64
|
+
cors?: {
|
|
65
|
+
allow_origin_regex?: string | undefined;
|
|
66
|
+
allow_origins?: string[] | undefined;
|
|
67
|
+
allow_methods?: string[] | undefined;
|
|
68
|
+
allow_headers?: string[] | undefined;
|
|
69
|
+
allow_credentials?: boolean | undefined;
|
|
70
|
+
expose_headers?: string[] | undefined;
|
|
71
|
+
max_age?: number | undefined;
|
|
72
|
+
} | undefined;
|
|
73
|
+
app?: string | undefined;
|
|
74
|
+
}, {
|
|
75
|
+
cors?: {
|
|
76
|
+
allow_origin_regex?: string | undefined;
|
|
77
|
+
allow_origins?: string[] | undefined;
|
|
78
|
+
allow_methods?: string[] | undefined;
|
|
79
|
+
allow_headers?: string[] | undefined;
|
|
80
|
+
allow_credentials?: boolean | undefined;
|
|
81
|
+
expose_headers?: string[] | undefined;
|
|
82
|
+
max_age?: number | undefined;
|
|
83
|
+
} | undefined;
|
|
84
|
+
app?: string | undefined;
|
|
85
|
+
disable_assistants?: boolean | undefined;
|
|
86
|
+
disable_threads?: boolean | undefined;
|
|
87
|
+
disable_runs?: boolean | undefined;
|
|
88
|
+
disable_store?: boolean | undefined;
|
|
89
|
+
disable_meta?: boolean | undefined;
|
|
90
|
+
}>>;
|
|
91
|
+
}, "strip", z.ZodTypeAny, {
|
|
92
|
+
cwd: string;
|
|
93
|
+
host: string;
|
|
94
|
+
port: number;
|
|
95
|
+
nWorkers: number;
|
|
96
|
+
graphs: Record<string, string>;
|
|
97
|
+
auth?: {
|
|
98
|
+
disable_studio_auth: boolean;
|
|
99
|
+
path?: string | undefined;
|
|
100
|
+
} | undefined;
|
|
101
|
+
ui?: Record<string, string> | undefined;
|
|
102
|
+
ui_config?: {
|
|
103
|
+
shared?: string[] | undefined;
|
|
104
|
+
} | undefined;
|
|
105
|
+
http?: {
|
|
106
|
+
disable_assistants: boolean;
|
|
107
|
+
disable_threads: boolean;
|
|
108
|
+
disable_runs: boolean;
|
|
109
|
+
disable_store: boolean;
|
|
110
|
+
disable_meta: boolean;
|
|
111
|
+
cors?: {
|
|
112
|
+
allow_origin_regex?: string | undefined;
|
|
113
|
+
allow_origins?: string[] | undefined;
|
|
114
|
+
allow_methods?: string[] | undefined;
|
|
115
|
+
allow_headers?: string[] | undefined;
|
|
116
|
+
allow_credentials?: boolean | undefined;
|
|
117
|
+
expose_headers?: string[] | undefined;
|
|
118
|
+
max_age?: number | undefined;
|
|
119
|
+
} | undefined;
|
|
120
|
+
app?: string | undefined;
|
|
121
|
+
} | undefined;
|
|
122
|
+
}, {
|
|
123
|
+
cwd: string;
|
|
124
|
+
host: string;
|
|
125
|
+
port: number;
|
|
126
|
+
nWorkers: number;
|
|
127
|
+
graphs: Record<string, string>;
|
|
128
|
+
auth?: {
|
|
129
|
+
path?: string | undefined;
|
|
130
|
+
disable_studio_auth?: boolean | undefined;
|
|
131
|
+
} | undefined;
|
|
132
|
+
ui?: Record<string, string> | undefined;
|
|
133
|
+
ui_config?: {
|
|
134
|
+
shared?: string[] | undefined;
|
|
135
|
+
} | undefined;
|
|
136
|
+
http?: {
|
|
137
|
+
cors?: {
|
|
138
|
+
allow_origin_regex?: string | undefined;
|
|
139
|
+
allow_origins?: string[] | undefined;
|
|
140
|
+
allow_methods?: string[] | undefined;
|
|
141
|
+
allow_headers?: string[] | undefined;
|
|
142
|
+
allow_credentials?: boolean | undefined;
|
|
143
|
+
expose_headers?: string[] | undefined;
|
|
144
|
+
max_age?: number | undefined;
|
|
145
|
+
} | undefined;
|
|
146
|
+
app?: string | undefined;
|
|
147
|
+
disable_assistants?: boolean | undefined;
|
|
148
|
+
disable_threads?: boolean | undefined;
|
|
149
|
+
disable_runs?: boolean | undefined;
|
|
150
|
+
disable_store?: boolean | undefined;
|
|
151
|
+
disable_meta?: boolean | undefined;
|
|
152
|
+
} | undefined;
|
|
153
|
+
}>;
|
|
154
|
+
export declare function startServer(options: z.infer<typeof StartServerSchema>): Promise<{
|
|
155
|
+
host: string;
|
|
156
|
+
cleanup: () => Promise<void>;
|
|
157
|
+
}>;
|
package/dist/state.d.mts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { RunnableConfig } from "@langchain/core/runnables";
|
|
2
|
+
import { type Checkpoint, type CheckpointMetadata, MemorySaver } from "@langchain/langgraph";
|
|
3
|
+
import { FileSystemPersistence } from "./persist.mjs";
|
|
4
|
+
declare class InMemorySaver extends MemorySaver {
|
|
5
|
+
initialize(cwd: string): Promise<FileSystemPersistence<{
|
|
6
|
+
storage: typeof MemorySaver.prototype.storage;
|
|
7
|
+
writes: typeof MemorySaver.prototype.writes;
|
|
8
|
+
}>>;
|
|
9
|
+
clear(): void;
|
|
10
|
+
getTuple(...args: Parameters<MemorySaver["getTuple"]>): ReturnType<MemorySaver["getTuple"]>;
|
|
11
|
+
list(...args: Parameters<MemorySaver["list"]>): ReturnType<MemorySaver["list"]>;
|
|
12
|
+
putWrites(...args: Parameters<MemorySaver["putWrites"]>): Promise<void>;
|
|
13
|
+
put(config: RunnableConfig, checkpoint: Checkpoint, metadata: CheckpointMetadata): Promise<RunnableConfig>;
|
|
14
|
+
delete(threadId: string, runId: string | null | undefined): Promise<void>;
|
|
15
|
+
copy(threadId: string, newThreadId: string): Promise<void>;
|
|
16
|
+
toJSON(): string;
|
|
17
|
+
}
|
|
18
|
+
export declare const checkpointer: InMemorySaver;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { PromptTemplate, AIMessagePromptTemplate, ChatMessagePromptTemplate, ChatPromptTemplate, HumanMessagePromptTemplate, MessagesPlaceholder, SystemMessagePromptTemplate, ImagePromptTemplate, PipelinePromptTemplate } from "@langchain/core/prompts";
|
|
2
|
+
import { AIMessage, AIMessageChunk, BaseMessage, BaseMessageChunk, ChatMessage, ChatMessageChunk, FunctionMessage, FunctionMessageChunk, HumanMessage, HumanMessageChunk, SystemMessage, SystemMessageChunk, ToolMessage, ToolMessageChunk } from "@langchain/core/messages";
|
|
3
|
+
import { StringPromptValue } from "@langchain/core/prompt_values";
|
|
4
|
+
export declare const prompts__prompt: {
|
|
5
|
+
PromptTemplate: typeof PromptTemplate;
|
|
6
|
+
};
|
|
7
|
+
export declare const schema__messages: {
|
|
8
|
+
AIMessage: typeof AIMessage;
|
|
9
|
+
AIMessageChunk: typeof AIMessageChunk;
|
|
10
|
+
BaseMessage: typeof BaseMessage;
|
|
11
|
+
BaseMessageChunk: typeof BaseMessageChunk;
|
|
12
|
+
ChatMessage: typeof ChatMessage;
|
|
13
|
+
ChatMessageChunk: typeof ChatMessageChunk;
|
|
14
|
+
FunctionMessage: typeof FunctionMessage;
|
|
15
|
+
FunctionMessageChunk: typeof FunctionMessageChunk;
|
|
16
|
+
HumanMessage: typeof HumanMessage;
|
|
17
|
+
HumanMessageChunk: typeof HumanMessageChunk;
|
|
18
|
+
SystemMessage: typeof SystemMessage;
|
|
19
|
+
SystemMessageChunk: typeof SystemMessageChunk;
|
|
20
|
+
ToolMessage: typeof ToolMessage;
|
|
21
|
+
ToolMessageChunk: typeof ToolMessageChunk;
|
|
22
|
+
};
|
|
23
|
+
export declare const schema: {
|
|
24
|
+
AIMessage: typeof AIMessage;
|
|
25
|
+
AIMessageChunk: typeof AIMessageChunk;
|
|
26
|
+
BaseMessage: typeof BaseMessage;
|
|
27
|
+
BaseMessageChunk: typeof BaseMessageChunk;
|
|
28
|
+
ChatMessage: typeof ChatMessage;
|
|
29
|
+
ChatMessageChunk: typeof ChatMessageChunk;
|
|
30
|
+
FunctionMessage: typeof FunctionMessage;
|
|
31
|
+
FunctionMessageChunk: typeof FunctionMessageChunk;
|
|
32
|
+
HumanMessage: typeof HumanMessage;
|
|
33
|
+
HumanMessageChunk: typeof HumanMessageChunk;
|
|
34
|
+
SystemMessage: typeof SystemMessage;
|
|
35
|
+
SystemMessageChunk: typeof SystemMessageChunk;
|
|
36
|
+
ToolMessage: typeof ToolMessage;
|
|
37
|
+
ToolMessageChunk: typeof ToolMessageChunk;
|
|
38
|
+
};
|
|
39
|
+
export declare const prompts__chat: {
|
|
40
|
+
AIMessagePromptTemplate: typeof AIMessagePromptTemplate;
|
|
41
|
+
ChatMessagePromptTemplate: typeof ChatMessagePromptTemplate;
|
|
42
|
+
ChatPromptTemplate: typeof ChatPromptTemplate;
|
|
43
|
+
HumanMessagePromptTemplate: typeof HumanMessagePromptTemplate;
|
|
44
|
+
MessagesPlaceholder: typeof MessagesPlaceholder;
|
|
45
|
+
SystemMessagePromptTemplate: typeof SystemMessagePromptTemplate;
|
|
46
|
+
};
|
|
47
|
+
export declare const prompts__image: {
|
|
48
|
+
ImagePromptTemplate: typeof ImagePromptTemplate;
|
|
49
|
+
};
|
|
50
|
+
export declare const prompts__pipeline: {
|
|
51
|
+
PipelinePromptTemplate: typeof PipelinePromptTemplate;
|
|
52
|
+
};
|
|
53
|
+
export declare const prompts__base: {
|
|
54
|
+
StringPromptValue: typeof StringPromptValue;
|
|
55
|
+
};
|
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
import type { CheckpointMetadata as LangGraphCheckpointMetadata, LangGraphRunnableConfig, StateSnapshot as LangGraphStateSnapshot } from "@langchain/langgraph";
|
|
2
|
+
import type { AuthContext } from "../auth/index.mjs";
|
|
3
|
+
import { type RunCommand } from "../command.mjs";
|
|
4
|
+
import { FileSystemPersistence } from "./persist.mjs";
|
|
5
|
+
export type Metadata = Record<string, unknown>;
|
|
6
|
+
export type ThreadStatus = "idle" | "busy" | "interrupted" | "error";
|
|
7
|
+
export type RunStatus = "pending" | "running" | "error" | "success" | "timeout" | "interrupted";
|
|
8
|
+
export type StreamMode = "values" | "messages" | "messages-tuple" | "custom" | "updates" | "events" | "debug";
|
|
9
|
+
export type MultitaskStrategy = "reject" | "rollback" | "interrupt" | "enqueue";
|
|
10
|
+
export type OnConflictBehavior = "raise" | "do_nothing";
|
|
11
|
+
export type IfNotExists = "create" | "reject";
|
|
12
|
+
export interface RunnableConfig {
|
|
13
|
+
tags?: string[];
|
|
14
|
+
recursion_limit?: number;
|
|
15
|
+
configurable?: {
|
|
16
|
+
thread_id?: string;
|
|
17
|
+
thread_ts?: string;
|
|
18
|
+
[key: string]: unknown;
|
|
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
|
+
metadata: Metadata;
|
|
31
|
+
}
|
|
32
|
+
interface AssistantVersion {
|
|
33
|
+
assistant_id: string;
|
|
34
|
+
version: number;
|
|
35
|
+
graph_id: string;
|
|
36
|
+
config: RunnableConfig;
|
|
37
|
+
metadata: Metadata;
|
|
38
|
+
created_at: Date;
|
|
39
|
+
name: string | undefined;
|
|
40
|
+
}
|
|
41
|
+
export interface RunKwargs {
|
|
42
|
+
input?: unknown;
|
|
43
|
+
command?: RunCommand;
|
|
44
|
+
stream_mode?: Array<StreamMode>;
|
|
45
|
+
interrupt_before?: "*" | string[] | undefined;
|
|
46
|
+
interrupt_after?: "*" | string[] | undefined;
|
|
47
|
+
config?: RunnableConfig;
|
|
48
|
+
subgraphs?: boolean;
|
|
49
|
+
temporary?: boolean;
|
|
50
|
+
webhook?: unknown;
|
|
51
|
+
feedback_keys?: string[] | undefined;
|
|
52
|
+
[key: string]: unknown;
|
|
53
|
+
}
|
|
54
|
+
export interface Run {
|
|
55
|
+
run_id: string;
|
|
56
|
+
thread_id: string;
|
|
57
|
+
assistant_id: string;
|
|
58
|
+
created_at: Date;
|
|
59
|
+
updated_at: Date;
|
|
60
|
+
status: RunStatus;
|
|
61
|
+
metadata: Metadata;
|
|
62
|
+
kwargs: RunKwargs;
|
|
63
|
+
multitask_strategy: MultitaskStrategy;
|
|
64
|
+
}
|
|
65
|
+
interface Store {
|
|
66
|
+
runs: Record<string, Run>;
|
|
67
|
+
threads: Record<string, Thread>;
|
|
68
|
+
assistants: Record<string, Assistant>;
|
|
69
|
+
assistant_versions: AssistantVersion[];
|
|
70
|
+
retry_counter: Record<string, number>;
|
|
71
|
+
}
|
|
72
|
+
export declare const conn: FileSystemPersistence<Store>;
|
|
73
|
+
interface Message {
|
|
74
|
+
topic: `run:${string}:stream:${string}`;
|
|
75
|
+
data: unknown;
|
|
76
|
+
}
|
|
77
|
+
declare class Queue {
|
|
78
|
+
private buffer;
|
|
79
|
+
private listeners;
|
|
80
|
+
push(item: Message): void;
|
|
81
|
+
get(options: {
|
|
82
|
+
timeout: number;
|
|
83
|
+
signal?: AbortSignal;
|
|
84
|
+
}): Promise<Message>;
|
|
85
|
+
}
|
|
86
|
+
declare class CancellationAbortController extends AbortController {
|
|
87
|
+
abort(reason: "rollback" | "interrupt"): void;
|
|
88
|
+
}
|
|
89
|
+
declare class StreamManagerImpl {
|
|
90
|
+
readers: Record<string, Queue>;
|
|
91
|
+
control: Record<string, CancellationAbortController>;
|
|
92
|
+
getQueue(runId: string, options: {
|
|
93
|
+
ifNotFound: "create";
|
|
94
|
+
}): Queue;
|
|
95
|
+
getQueue(runId: string, options: {
|
|
96
|
+
ifNotFound: "ignore";
|
|
97
|
+
}): Queue | undefined;
|
|
98
|
+
getControl(runId: string): CancellationAbortController | undefined;
|
|
99
|
+
isLocked(runId: string): boolean;
|
|
100
|
+
lock(runId: string): AbortSignal;
|
|
101
|
+
unlock(runId: string): void;
|
|
102
|
+
}
|
|
103
|
+
export declare const StreamManager: StreamManagerImpl;
|
|
104
|
+
export declare const truncate: (flags: {
|
|
105
|
+
runs?: boolean;
|
|
106
|
+
threads?: boolean;
|
|
107
|
+
assistants?: boolean;
|
|
108
|
+
checkpointer?: boolean;
|
|
109
|
+
store?: boolean;
|
|
110
|
+
}) => Promise<void>;
|
|
111
|
+
export declare class Assistants {
|
|
112
|
+
static search(options: {
|
|
113
|
+
graph_id?: string;
|
|
114
|
+
metadata?: Metadata;
|
|
115
|
+
limit: number;
|
|
116
|
+
offset: number;
|
|
117
|
+
}, auth: AuthContext | undefined): AsyncGenerator<any, void, unknown>;
|
|
118
|
+
static get(assistant_id: string, auth: AuthContext | undefined): Promise<Assistant>;
|
|
119
|
+
static put(assistant_id: string, options: {
|
|
120
|
+
config: RunnableConfig;
|
|
121
|
+
graph_id: string;
|
|
122
|
+
metadata?: Metadata;
|
|
123
|
+
if_exists: OnConflictBehavior;
|
|
124
|
+
name?: string;
|
|
125
|
+
}, auth: AuthContext | undefined): Promise<Assistant>;
|
|
126
|
+
static patch(assistantId: string, options: {
|
|
127
|
+
config?: RunnableConfig;
|
|
128
|
+
graph_id?: string;
|
|
129
|
+
metadata?: Metadata;
|
|
130
|
+
name?: string;
|
|
131
|
+
}, auth: AuthContext | undefined): Promise<Assistant>;
|
|
132
|
+
static delete(assistant_id: string, auth: AuthContext | undefined): Promise<string[]>;
|
|
133
|
+
static setLatest(assistant_id: string, version: number, auth: AuthContext | undefined): Promise<Assistant>;
|
|
134
|
+
static getVersions(assistant_id: string, options: {
|
|
135
|
+
limit: number;
|
|
136
|
+
offset: number;
|
|
137
|
+
metadata?: Metadata;
|
|
138
|
+
}, auth: AuthContext | undefined): Promise<AssistantVersion[]>;
|
|
139
|
+
}
|
|
140
|
+
interface Thread {
|
|
141
|
+
thread_id: string;
|
|
142
|
+
created_at: Date;
|
|
143
|
+
updated_at: Date;
|
|
144
|
+
metadata?: Metadata;
|
|
145
|
+
config?: RunnableConfig;
|
|
146
|
+
status: ThreadStatus;
|
|
147
|
+
values?: Record<string, unknown>;
|
|
148
|
+
interrupts?: Record<string, unknown>;
|
|
149
|
+
}
|
|
150
|
+
interface CheckpointTask {
|
|
151
|
+
id: string;
|
|
152
|
+
name: string;
|
|
153
|
+
error?: string;
|
|
154
|
+
interrupts: Record<string, unknown>;
|
|
155
|
+
state?: RunnableConfig;
|
|
156
|
+
}
|
|
157
|
+
interface CheckpointPayload {
|
|
158
|
+
config?: RunnableConfig;
|
|
159
|
+
metadata: LangGraphCheckpointMetadata;
|
|
160
|
+
values: Record<string, unknown>;
|
|
161
|
+
next: string[];
|
|
162
|
+
parent_config?: RunnableConfig;
|
|
163
|
+
tasks: CheckpointTask[];
|
|
164
|
+
}
|
|
165
|
+
export interface Checkpoint {
|
|
166
|
+
thread_id: string;
|
|
167
|
+
checkpoint_ns: string;
|
|
168
|
+
checkpoint_id: string | null;
|
|
169
|
+
checkpoint_map: Record<string, unknown> | null;
|
|
170
|
+
}
|
|
171
|
+
interface ThreadTask {
|
|
172
|
+
id: string;
|
|
173
|
+
name: string;
|
|
174
|
+
error: string | null;
|
|
175
|
+
interrupts: Record<string, unknown>[];
|
|
176
|
+
checkpoint: Checkpoint | null;
|
|
177
|
+
state: ThreadState | null;
|
|
178
|
+
result: Record<string, unknown> | null;
|
|
179
|
+
}
|
|
180
|
+
export interface ThreadState {
|
|
181
|
+
values: Record<string, unknown>;
|
|
182
|
+
next: string[];
|
|
183
|
+
checkpoint: Checkpoint | null;
|
|
184
|
+
metadata: Record<string, unknown> | undefined;
|
|
185
|
+
created_at: Date | null;
|
|
186
|
+
parent_checkpoint: Checkpoint | null;
|
|
187
|
+
tasks: ThreadTask[];
|
|
188
|
+
}
|
|
189
|
+
export declare class Threads {
|
|
190
|
+
static search(options: {
|
|
191
|
+
metadata?: Metadata;
|
|
192
|
+
status?: ThreadStatus;
|
|
193
|
+
values?: Record<string, unknown>;
|
|
194
|
+
limit: number;
|
|
195
|
+
offset: number;
|
|
196
|
+
sort_by?: "thread_id" | "status" | "created_at" | "updated_at";
|
|
197
|
+
sort_order?: "asc" | "desc";
|
|
198
|
+
}, auth: AuthContext | undefined): AsyncGenerator<{
|
|
199
|
+
thread: Thread;
|
|
200
|
+
total: number;
|
|
201
|
+
}>;
|
|
202
|
+
static get(thread_id: string, auth: AuthContext | undefined): Promise<Thread>;
|
|
203
|
+
static put(thread_id: string, options: {
|
|
204
|
+
metadata?: Metadata;
|
|
205
|
+
if_exists: OnConflictBehavior;
|
|
206
|
+
}, auth: AuthContext | undefined): Promise<Thread>;
|
|
207
|
+
static patch(threadId: string, options: {
|
|
208
|
+
metadata?: Metadata;
|
|
209
|
+
}, auth: AuthContext | undefined): Promise<Thread>;
|
|
210
|
+
static setStatus(threadId: string, options: {
|
|
211
|
+
checkpoint?: CheckpointPayload;
|
|
212
|
+
exception?: Error;
|
|
213
|
+
}): Promise<void>;
|
|
214
|
+
static delete(thread_id: string, auth: AuthContext | undefined): Promise<string[]>;
|
|
215
|
+
static copy(thread_id: string, auth: AuthContext | undefined): Promise<Thread>;
|
|
216
|
+
static State: {
|
|
217
|
+
new (): {};
|
|
218
|
+
get(config: RunnableConfig, options: {
|
|
219
|
+
subgraphs?: boolean;
|
|
220
|
+
}, auth: AuthContext | undefined): Promise<LangGraphStateSnapshot>;
|
|
221
|
+
post(config: RunnableConfig, values: Record<string, unknown>[] | Record<string, unknown> | null | undefined, asNode: string | undefined, auth: AuthContext | undefined): Promise<{
|
|
222
|
+
checkpoint: Record<string, any> | undefined;
|
|
223
|
+
}>;
|
|
224
|
+
bulk(config: RunnableConfig, supersteps: Array<{
|
|
225
|
+
updates: Array<{
|
|
226
|
+
values?: Record<string, unknown>[] | Record<string, unknown> | unknown | null | undefined;
|
|
227
|
+
command?: RunCommand | undefined | null;
|
|
228
|
+
as_node?: string | undefined;
|
|
229
|
+
}>;
|
|
230
|
+
}>, auth: AuthContext | undefined): Promise<never[] | {
|
|
231
|
+
checkpoint: Record<string, any> | undefined;
|
|
232
|
+
}>;
|
|
233
|
+
list(config: RunnableConfig, options: {
|
|
234
|
+
limit?: number;
|
|
235
|
+
before?: string | RunnableConfig;
|
|
236
|
+
metadata?: Metadata;
|
|
237
|
+
}, auth: AuthContext | undefined): Promise<LangGraphStateSnapshot[]>;
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
export declare class Runs {
|
|
241
|
+
static next(): AsyncGenerator<{
|
|
242
|
+
run: Run;
|
|
243
|
+
attempt: number;
|
|
244
|
+
signal: AbortSignal;
|
|
245
|
+
}>;
|
|
246
|
+
static put(runId: string, assistantId: string, kwargs: RunKwargs, options: {
|
|
247
|
+
threadId?: string;
|
|
248
|
+
userId?: string;
|
|
249
|
+
status?: RunStatus;
|
|
250
|
+
metadata?: Metadata;
|
|
251
|
+
preventInsertInInflight?: boolean;
|
|
252
|
+
multitaskStrategy?: MultitaskStrategy;
|
|
253
|
+
ifNotExists?: IfNotExists;
|
|
254
|
+
afterSeconds?: number;
|
|
255
|
+
}, auth: AuthContext | undefined): Promise<Run[]>;
|
|
256
|
+
static get(runId: string, thread_id: string | undefined, auth: AuthContext | undefined): Promise<Run | null>;
|
|
257
|
+
static delete(run_id: string, thread_id: string | undefined, auth: AuthContext | undefined): Promise<string | null>;
|
|
258
|
+
static wait(runId: string, threadId: string | undefined, auth: AuthContext | undefined): Promise<unknown>;
|
|
259
|
+
static join(runId: string, threadId: string, auth: AuthContext | undefined): Promise<{} | undefined>;
|
|
260
|
+
static cancel(threadId: string | undefined, runIds: string[], options: {
|
|
261
|
+
action?: "interrupt" | "rollback";
|
|
262
|
+
}, auth: AuthContext | undefined): Promise<void>;
|
|
263
|
+
static search(threadId: string, options: {
|
|
264
|
+
limit?: number | null;
|
|
265
|
+
offset?: number | null;
|
|
266
|
+
status?: string | null;
|
|
267
|
+
metadata?: Metadata | null;
|
|
268
|
+
}, auth: AuthContext | undefined): Promise<Run[]>;
|
|
269
|
+
static setStatus(runId: string, status: RunStatus): Promise<void>;
|
|
270
|
+
static Stream: {
|
|
271
|
+
new (): {};
|
|
272
|
+
join(runId: string, threadId: string | undefined, options: {
|
|
273
|
+
ignore404?: boolean;
|
|
274
|
+
cancelOnDisconnect?: AbortSignal;
|
|
275
|
+
}, auth: AuthContext | undefined): AsyncGenerator<{
|
|
276
|
+
event: string;
|
|
277
|
+
data: unknown;
|
|
278
|
+
}>;
|
|
279
|
+
publish(runId: string, topic: string, data: unknown): Promise<void>;
|
|
280
|
+
};
|
|
281
|
+
}
|
|
282
|
+
export declare class Crons {
|
|
283
|
+
}
|
|
284
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
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, unknown>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
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 {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { Run, RunnableConfig, Checkpoint } from "./storage/ops.mjs";
|
|
2
|
+
import { type CheckpointMetadata, type Interrupt, type StateSnapshot } from "@langchain/langgraph";
|
|
3
|
+
interface DebugTask {
|
|
4
|
+
id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
result?: unknown;
|
|
7
|
+
error?: unknown;
|
|
8
|
+
interrupts: Interrupt[];
|
|
9
|
+
state?: RunnableConfig | StateSnapshot;
|
|
10
|
+
path?: [string, ...(string | number)[]];
|
|
11
|
+
}
|
|
12
|
+
interface DebugCheckpoint {
|
|
13
|
+
config: RunnableConfig;
|
|
14
|
+
parentConfig: RunnableConfig | undefined;
|
|
15
|
+
values: unknown;
|
|
16
|
+
metadata: CheckpointMetadata;
|
|
17
|
+
next: string[];
|
|
18
|
+
tasks: DebugTask[];
|
|
19
|
+
}
|
|
20
|
+
type Prettify<T> = {
|
|
21
|
+
[K in keyof T]: T[K];
|
|
22
|
+
} & {};
|
|
23
|
+
export type StreamCheckpoint = Prettify<Omit<DebugCheckpoint, "parentConfig"> & {
|
|
24
|
+
parent_config: DebugCheckpoint["parentConfig"];
|
|
25
|
+
}>;
|
|
26
|
+
export type StreamTaskResult = Prettify<Omit<DebugTask, "state"> & {
|
|
27
|
+
state?: StateSnapshot;
|
|
28
|
+
checkpoint?: Checkpoint;
|
|
29
|
+
}>;
|
|
30
|
+
export declare function streamState(run: Run, attempt?: number, options?: {
|
|
31
|
+
onCheckpoint?: (checkpoint: StreamCheckpoint) => void;
|
|
32
|
+
onTaskResult?: (taskResult: StreamTaskResult) => void;
|
|
33
|
+
signal?: AbortSignal;
|
|
34
|
+
}): AsyncGenerator<{
|
|
35
|
+
event: string;
|
|
36
|
+
data: unknown;
|
|
37
|
+
}>;
|
|
38
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Hono } from "hono";
|
|
2
|
+
export declare function registerGraphUi(defs: Record<string, string>, options: {
|
|
3
|
+
cwd: string;
|
|
4
|
+
config?: {
|
|
5
|
+
shared?: string[];
|
|
6
|
+
};
|
|
7
|
+
}): Promise<void>;
|
|
8
|
+
export declare const api: Hono<import("hono/types").BlankEnv, import("hono/types").BlankSchema, "/">;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const combineAbortSignals: (...input: (AbortSignal | undefined | null)[]) => AbortSignal;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Context } from "hono";
|
|
2
|
+
import { StreamingApi } from "hono/utils/stream";
|
|
3
|
+
export declare function jsonExtra<T>(c: Context, object: T): Response & import("hono").TypedResponse<unknown, import("hono/utils/http-status").ContentfulStatusCode, "body">;
|
|
4
|
+
export declare function waitKeepAlive(c: Context, promise: Promise<unknown>): Response;
|
|
5
|
+
export declare const getDisconnectAbortSignal: (c: Context, stream: StreamingApi) => AbortSignal;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { PromptTemplate, AIMessagePromptTemplate, ChatMessagePromptTemplate, ChatPromptTemplate, HumanMessagePromptTemplate, MessagesPlaceholder, SystemMessagePromptTemplate, ImagePromptTemplate, PipelinePromptTemplate } from "@langchain/core/prompts";
|
|
2
|
+
import { AIMessage, AIMessageChunk, BaseMessage, BaseMessageChunk, ChatMessage, ChatMessageChunk, FunctionMessage, FunctionMessageChunk, HumanMessage, HumanMessageChunk, SystemMessage, SystemMessageChunk, ToolMessage, ToolMessageChunk } from "@langchain/core/messages";
|
|
3
|
+
import { StringPromptValue } from "@langchain/core/prompt_values";
|
|
4
|
+
export declare const prompts__prompt: {
|
|
5
|
+
PromptTemplate: typeof PromptTemplate;
|
|
6
|
+
};
|
|
7
|
+
export declare const schema__messages: {
|
|
8
|
+
AIMessage: typeof AIMessage;
|
|
9
|
+
AIMessageChunk: typeof AIMessageChunk;
|
|
10
|
+
BaseMessage: typeof BaseMessage;
|
|
11
|
+
BaseMessageChunk: typeof BaseMessageChunk;
|
|
12
|
+
ChatMessage: typeof ChatMessage;
|
|
13
|
+
ChatMessageChunk: typeof ChatMessageChunk;
|
|
14
|
+
FunctionMessage: typeof FunctionMessage;
|
|
15
|
+
FunctionMessageChunk: typeof FunctionMessageChunk;
|
|
16
|
+
HumanMessage: typeof HumanMessage;
|
|
17
|
+
HumanMessageChunk: typeof HumanMessageChunk;
|
|
18
|
+
SystemMessage: typeof SystemMessage;
|
|
19
|
+
SystemMessageChunk: typeof SystemMessageChunk;
|
|
20
|
+
ToolMessage: typeof ToolMessage;
|
|
21
|
+
ToolMessageChunk: typeof ToolMessageChunk;
|
|
22
|
+
};
|
|
23
|
+
export declare const schema: {
|
|
24
|
+
AIMessage: typeof AIMessage;
|
|
25
|
+
AIMessageChunk: typeof AIMessageChunk;
|
|
26
|
+
BaseMessage: typeof BaseMessage;
|
|
27
|
+
BaseMessageChunk: typeof BaseMessageChunk;
|
|
28
|
+
ChatMessage: typeof ChatMessage;
|
|
29
|
+
ChatMessageChunk: typeof ChatMessageChunk;
|
|
30
|
+
FunctionMessage: typeof FunctionMessage;
|
|
31
|
+
FunctionMessageChunk: typeof FunctionMessageChunk;
|
|
32
|
+
HumanMessage: typeof HumanMessage;
|
|
33
|
+
HumanMessageChunk: typeof HumanMessageChunk;
|
|
34
|
+
SystemMessage: typeof SystemMessage;
|
|
35
|
+
SystemMessageChunk: typeof SystemMessageChunk;
|
|
36
|
+
ToolMessage: typeof ToolMessage;
|
|
37
|
+
ToolMessageChunk: typeof ToolMessageChunk;
|
|
38
|
+
};
|
|
39
|
+
export declare const prompts__chat: {
|
|
40
|
+
AIMessagePromptTemplate: typeof AIMessagePromptTemplate;
|
|
41
|
+
ChatMessagePromptTemplate: typeof ChatMessagePromptTemplate;
|
|
42
|
+
ChatPromptTemplate: typeof ChatPromptTemplate;
|
|
43
|
+
HumanMessagePromptTemplate: typeof HumanMessagePromptTemplate;
|
|
44
|
+
MessagesPlaceholder: typeof MessagesPlaceholder;
|
|
45
|
+
SystemMessagePromptTemplate: typeof SystemMessagePromptTemplate;
|
|
46
|
+
};
|
|
47
|
+
export declare const prompts__image: {
|
|
48
|
+
ImagePromptTemplate: typeof ImagePromptTemplate;
|
|
49
|
+
};
|
|
50
|
+
export declare const prompts__pipeline: {
|
|
51
|
+
PipelinePromptTemplate: typeof PipelinePromptTemplate;
|
|
52
|
+
};
|
|
53
|
+
export declare const prompts__base: {
|
|
54
|
+
StringPromptValue: typeof StringPromptValue;
|
|
55
|
+
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { Checkpoint, RunnableConfig } from "../storage/ops.mjs";
|
|
2
|
+
export declare const runnableConfigToCheckpoint: (config: RunnableConfig | null | undefined) => Checkpoint | null;
|
|
3
|
+
export declare const taskRunnableConfigToCheckpoint: (config: RunnableConfig | null | undefined) => Partial<Checkpoint> | null;
|