experimental-agent 0.5.0 → 0.6.1
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/{adapter-Cl735Kp4.d.mts → adapter-txsF6hou.d.mts} +2 -0
- package/dist/{adapter-Cl735Kp4.d.ts → adapter-txsF6hou.d.ts} +2 -0
- package/dist/{chunk-AB2JYY6A.mjs → chunk-CCWLV27N.mjs} +10 -2
- package/dist/chunk-CS2SEUAA.mjs +405 -0
- package/dist/{chunk-6MS4CGEZ.mjs → chunk-D35AQN7O.mjs} +5 -5
- package/dist/chunk-LZOMFHX3.mjs +38 -0
- package/dist/chunk-PH2FXKOU.mjs +9 -0
- package/dist/client-B2ohNvwc.d.mts +494 -0
- package/dist/client-BbQZtxca.d.ts +494 -0
- package/dist/client.mjs +1 -1
- package/dist/{docker-OBUQX5ZI.mjs → docker-FCSNVBEQ.mjs} +1 -1
- package/dist/{entry-Bs17QEiq.d.mts → entry-BUiucCNp.d.mts} +1 -1
- package/dist/{entry-QNyd4S1s.d.ts → entry-ok9EBUS3.d.ts} +1 -1
- package/dist/index.d.mts +475 -475
- package/dist/index.d.ts +475 -475
- package/dist/index.js +16595 -245
- package/dist/index.mjs +16406 -117
- package/dist/lifecycle-workflow-steps.d.mts +2 -2
- package/dist/lifecycle-workflow-steps.d.ts +2 -2
- package/dist/lifecycle-workflow-steps.mjs +1 -1
- package/dist/lifecycle-workflow.d.mts +2 -2
- package/dist/lifecycle-workflow.d.ts +2 -2
- package/dist/lifecycle-workflow.mjs +1 -1
- package/dist/{local-4C3V4EFS.mjs → local-NXHIUJTO.mjs} +1 -1
- package/dist/next/loader.js +10 -2
- package/dist/next/loader.mjs +2 -2
- package/dist/next.js +10 -2
- package/dist/next.mjs +2 -2
- package/dist/{process-manager-WQHAIVRB.mjs → process-manager-26NELLRU.mjs} +1 -1
- package/dist/react.d.mts +56 -0
- package/dist/react.d.ts +56 -0
- package/dist/react.js +144 -0
- package/dist/react.mjs +117 -0
- package/dist/sandbox.d.mts +3 -3
- package/dist/sandbox.d.ts +3 -3
- package/dist/sandbox.js +5 -5
- package/dist/sandbox.mjs +2 -2
- package/dist/{steps-XA4wG8W3.d.ts → steps-BOKeU8X3.d.ts} +3 -2
- package/dist/{steps-eTytqxQb.d.mts → steps-Mi3sjYbD.d.mts} +3 -2
- package/dist/storage.d.mts +2 -2
- package/dist/storage.d.ts +2 -2
- package/dist/storage.js +107 -48
- package/dist/storage.mjs +2 -2
- package/dist/{vercel-6ORAC625.mjs → vercel-BOGHAFI4.mjs} +2 -2
- package/package.json +9 -1
- package/dist/chunk-BJTO5JO5.mjs +0 -11
- package/dist/chunk-I5DCB7RU.mjs +0 -346
package/dist/index.d.mts
CHANGED
|
@@ -1,483 +1,50 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
import
|
|
1
|
+
import { T as ToolContext, A as AnyAgent, S as SessionSendArgs, b as SendResult } from './client-B2ohNvwc.mjs';
|
|
2
|
+
export { c as AgentDataTypes, d as AgentHooks, e as AgentOptions, a as AgentStatus, f as ApprovalData, B as BuiltInToolName, G as GitSkillEntry, g as GitSkillInput, H as HostSkillEntry, h as HostSkillInput, I as InferSession, i as InferUIMessage, j as InlineSkillEntry, k as InlineSkillInput, N as NeedsApprovalMap, R as Resolvable, l as ResolvableArgs, m as SandboxSkillEntry, n as SandboxSkillInput, o as SendInput, p as SessionDefaults, q as SkillEntry, r as SkillInput, s as SkillSourceType, t as StepUsage, U as UsageSummary, W as WorkflowRunLike, u as agent, v as builtinToolNames } from './client-B2ohNvwc.mjs';
|
|
3
|
+
import * as errore from 'errore';
|
|
4
|
+
import * as elysia from 'elysia';
|
|
5
|
+
import elysia__default from 'elysia';
|
|
6
6
|
import * as ai from 'ai';
|
|
7
|
-
import {
|
|
7
|
+
import { Tool } from 'ai';
|
|
8
|
+
import z$1 from '../../node_modules/zod/v4/classic/external.cjs';
|
|
9
|
+
export { E as ExecResult, S as SandboxAgentRef, a as SandboxBinding, b as SandboxInstance, c as SandboxSetupFields, U as UploadableFile } from './steps-Mi3sjYbD.mjs';
|
|
8
10
|
import { z } from 'zod';
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
type SetupCommonFields = Partial<SandboxSetupFields> & {
|
|
15
|
-
cwd?: string;
|
|
16
|
-
run?: (sandbox: SandboxInstance) => Promise<void>;
|
|
17
|
-
signal?: AbortSignal;
|
|
18
|
-
};
|
|
19
|
-
type ToBindingUnion<T extends SandboxBinding | SandboxBinding[]> = T extends SandboxBinding[] ? T[number] : T;
|
|
20
|
-
type SetupOptsForBinding<B extends SandboxBinding> = B extends SandboxBinding<infer T, infer C, any> ? {
|
|
21
|
-
type: T;
|
|
22
|
-
} & SetupCommonFields & WithConfig<C> : never;
|
|
23
|
-
type IsDefault<T extends SandboxBinding | SandboxBinding[]> = SandboxBinding extends T ? true : false;
|
|
24
|
-
type SetupOpts<TSandboxBindings extends SandboxBinding | SandboxBinding[]> = SetupOptsForBinding<IsDefault<TSandboxBindings> extends true ? BuiltInBindings : ToBindingUnion<TSandboxBindings>> | (SetupCommonFields & {
|
|
25
|
-
type?: never;
|
|
26
|
-
});
|
|
27
|
-
type SetupResult = {
|
|
28
|
-
done: Promise<SandboxInstance>;
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
type SandboxOptions = {
|
|
32
|
-
id?: string;
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
type StepUsage = {
|
|
36
|
-
stepIndex: number;
|
|
37
|
-
model: string;
|
|
38
|
-
inputTokens: number;
|
|
39
|
-
outputTokens: number;
|
|
40
|
-
totalTokens: number;
|
|
41
|
-
cacheReadTokens: number;
|
|
42
|
-
cacheWriteTokens: number;
|
|
43
|
-
reasoningTokens: number;
|
|
44
|
-
};
|
|
45
|
-
type UsageSummary = {
|
|
46
|
-
model: string;
|
|
47
|
-
inputTokens: number;
|
|
48
|
-
outputTokens: number;
|
|
49
|
-
totalTokens: number;
|
|
50
|
-
cacheReadTokens: number;
|
|
51
|
-
cacheWriteTokens: number;
|
|
52
|
-
reasoningTokens: number;
|
|
53
|
-
stepCount: number;
|
|
54
|
-
};
|
|
55
|
-
type SessionUsage = {
|
|
56
|
-
total: UsageSummary & {
|
|
57
|
-
messageCount: number;
|
|
58
|
-
};
|
|
59
|
-
byMessageId: Record<string, UsageSummary | null>;
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
type SkillSourceType = "sandbox" | "host" | "git" | "inline";
|
|
63
|
-
type SandboxSkillInput = {
|
|
64
|
-
type: "sandbox";
|
|
65
|
-
path: string;
|
|
66
|
-
};
|
|
67
|
-
type HostSkillInput = {
|
|
68
|
-
type: "host";
|
|
69
|
-
path: string;
|
|
70
|
-
};
|
|
71
|
-
type GitSkillInput = {
|
|
72
|
-
type: "git";
|
|
73
|
-
repo: string;
|
|
74
|
-
ref?: string;
|
|
75
|
-
path?: string;
|
|
76
|
-
/**
|
|
77
|
-
* Skill directory name under `path`.
|
|
78
|
-
*/
|
|
79
|
-
name?: string;
|
|
80
|
-
};
|
|
81
|
-
type InlineSkillInput = {
|
|
82
|
-
type: "inline";
|
|
83
|
-
name: string;
|
|
84
|
-
description: string;
|
|
85
|
-
instructions: string;
|
|
86
|
-
};
|
|
87
|
-
type SkillInput = SandboxSkillInput | HostSkillInput | GitSkillInput | InlineSkillInput;
|
|
88
|
-
type SandboxSkillEntry = {
|
|
89
|
-
type: "sandbox";
|
|
90
|
-
path: string;
|
|
91
|
-
};
|
|
92
|
-
type HostSkillEntry = {
|
|
93
|
-
type: "host";
|
|
94
|
-
path: string;
|
|
95
|
-
};
|
|
96
|
-
type GitSkillEntry = {
|
|
97
|
-
type: "git";
|
|
98
|
-
repo: string;
|
|
99
|
-
ref?: string;
|
|
100
|
-
path?: string;
|
|
101
|
-
/**
|
|
102
|
-
* Skill directory name under `path`.
|
|
103
|
-
*/
|
|
104
|
-
name?: string;
|
|
105
|
-
};
|
|
106
|
-
type InlineSkillEntry = {
|
|
107
|
-
type: "inline";
|
|
108
|
-
name: string;
|
|
109
|
-
description: string;
|
|
110
|
-
instructions: string;
|
|
111
|
-
};
|
|
112
|
-
type SkillEntry = SandboxSkillEntry | HostSkillEntry | GitSkillEntry | InlineSkillEntry;
|
|
113
|
-
|
|
114
|
-
type ToolContext<TContext = Record<string, unknown>, Tools extends ToolSet = ToolSet> = ResolvableArgs<TContext, Tools>;
|
|
115
|
-
declare const builtInTools: {
|
|
116
|
-
Read: ai.Tool<{
|
|
117
|
-
label: string;
|
|
118
|
-
path: string;
|
|
119
|
-
startLine?: number | undefined;
|
|
120
|
-
endLine?: number | undefined;
|
|
121
|
-
}, {
|
|
122
|
-
content: string;
|
|
123
|
-
metadata: {
|
|
124
|
-
totalLines: number;
|
|
125
|
-
linesShown: number;
|
|
126
|
-
startLine: number;
|
|
127
|
-
endLine: number;
|
|
128
|
-
isPaginated: boolean;
|
|
129
|
-
fileSize: string;
|
|
130
|
-
path: string;
|
|
131
|
-
};
|
|
132
|
-
}>;
|
|
133
|
-
Grep: ai.Tool<{
|
|
134
|
-
label: string;
|
|
135
|
-
pattern: string;
|
|
136
|
-
caseSensitive: boolean;
|
|
137
|
-
filesWithMatches: boolean;
|
|
138
|
-
path?: string | undefined;
|
|
139
|
-
fileType?: string | undefined;
|
|
140
|
-
glob?: string | undefined;
|
|
141
|
-
contextLines?: number | undefined;
|
|
142
|
-
maxCount?: number | undefined;
|
|
143
|
-
}, {
|
|
144
|
-
matches: string;
|
|
145
|
-
summary: {
|
|
146
|
-
matchCount: number;
|
|
147
|
-
fileCount: number;
|
|
148
|
-
searchPath: string;
|
|
149
|
-
pattern: string;
|
|
150
|
-
};
|
|
151
|
-
}>;
|
|
152
|
-
List: ai.Tool<{
|
|
153
|
-
label: string;
|
|
154
|
-
includeHidden: boolean;
|
|
155
|
-
filesOnly: boolean;
|
|
156
|
-
path?: string | undefined;
|
|
157
|
-
depth?: number | undefined;
|
|
158
|
-
pattern?: string | undefined;
|
|
159
|
-
}, {
|
|
160
|
-
listing: string;
|
|
161
|
-
summary: {
|
|
162
|
-
totalItems: number;
|
|
163
|
-
totalFiles: number;
|
|
164
|
-
totalDirs: number;
|
|
165
|
-
searchPath: string;
|
|
166
|
-
depth?: number | undefined;
|
|
167
|
-
};
|
|
168
|
-
}>;
|
|
169
|
-
Write: ai.Tool<{
|
|
170
|
-
label: string;
|
|
171
|
-
path: string;
|
|
172
|
-
content: string;
|
|
173
|
-
}, {
|
|
174
|
-
success: boolean;
|
|
175
|
-
path: string;
|
|
176
|
-
bytesWritten: number;
|
|
177
|
-
error?: string | undefined;
|
|
178
|
-
}>;
|
|
179
|
-
Edit: ai.Tool<{
|
|
180
|
-
label: string;
|
|
181
|
-
path: string;
|
|
182
|
-
old_string: string;
|
|
183
|
-
new_string: string;
|
|
184
|
-
}, {
|
|
185
|
-
success: boolean;
|
|
186
|
-
path: string;
|
|
187
|
-
error?: string | undefined;
|
|
188
|
-
}>;
|
|
189
|
-
Bash: ai.Tool<{
|
|
190
|
-
label: string;
|
|
191
|
-
command: string;
|
|
192
|
-
waitUntil?: number | undefined;
|
|
193
|
-
}, {
|
|
194
|
-
commandId: string;
|
|
195
|
-
stdout: string;
|
|
196
|
-
stderr: string;
|
|
197
|
-
exitCode: number;
|
|
198
|
-
status: "running" | "failed" | "completed";
|
|
199
|
-
outputDir: string;
|
|
200
|
-
}>;
|
|
201
|
-
Skill: ai.Tool<{
|
|
202
|
-
label: string;
|
|
203
|
-
name: string;
|
|
204
|
-
}, {
|
|
205
|
-
name: string;
|
|
206
|
-
description: string;
|
|
207
|
-
content: string;
|
|
208
|
-
path: string;
|
|
209
|
-
}>;
|
|
210
|
-
JavaScript: ai.Tool<{
|
|
211
|
-
label: string;
|
|
212
|
-
code: string;
|
|
213
|
-
}, any>;
|
|
214
|
-
};
|
|
215
|
-
type BuiltInToolName = keyof typeof builtInTools;
|
|
216
|
-
declare const builtinToolNames: { [K in BuiltInToolName]: K; };
|
|
11
|
+
import '@vercel/sandbox';
|
|
12
|
+
import './entry-BUiucCNp.mjs';
|
|
13
|
+
import './adapter-txsF6hou.mjs';
|
|
14
|
+
import '@workflow/serde';
|
|
217
15
|
|
|
218
16
|
/**
|
|
219
|
-
*
|
|
220
|
-
*
|
|
17
|
+
* Define an agent tool with typed context and state.
|
|
18
|
+
*
|
|
19
|
+
* Pass the same `contextSchema` and/or `stateSchema` (Zod objects) used in
|
|
20
|
+
* your agent definition to get typed `context` and `state` inside `execute`.
|
|
21
|
+
*
|
|
22
|
+
* ```ts
|
|
23
|
+
* import { tool } from "experimental-agent";
|
|
24
|
+
* import { contextSchema, stateSchema } from "./context";
|
|
25
|
+
*
|
|
26
|
+
* export const MyTool = tool({
|
|
27
|
+
* contextSchema,
|
|
28
|
+
* stateSchema,
|
|
29
|
+
* inputSchema: z.object({ query: z.string() }),
|
|
30
|
+
* execute: async ({ query }, { context, state, sandbox }) => {
|
|
31
|
+
* context.channelId // ✓ typed from contextSchema
|
|
32
|
+
* state.counter++ // ✓ typed from stateSchema, mutable
|
|
33
|
+
* },
|
|
34
|
+
* });
|
|
35
|
+
* ```
|
|
221
36
|
*/
|
|
222
|
-
declare
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
type: z.ZodLiteral<"processing-approvals">;
|
|
230
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
231
|
-
type: z.ZodLiteral<"needs-approval">;
|
|
232
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
233
|
-
type: z.ZodLiteral<"thinking">;
|
|
234
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
235
|
-
type: z.ZodLiteral<"custom">;
|
|
236
|
-
status: z.ZodString;
|
|
237
|
-
}, z.core.$strip>], "type">;
|
|
238
|
-
type AgentStatus = z.infer<typeof AgentStatus>;
|
|
239
|
-
type AgentDataTypes = {
|
|
240
|
-
status: AgentStatus;
|
|
241
|
-
};
|
|
242
|
-
type AgentHooks = {
|
|
243
|
-
"tool.before"?: (opts: {
|
|
244
|
-
name: string;
|
|
245
|
-
input: unknown;
|
|
246
|
-
context: ToolContext;
|
|
247
|
-
}) => Promise<undefined | {
|
|
248
|
-
input: unknown;
|
|
249
|
-
}>;
|
|
250
|
-
"tool.after"?: (opts: {
|
|
251
|
-
name: string;
|
|
252
|
-
input: unknown;
|
|
253
|
-
result: unknown;
|
|
254
|
-
context: ToolContext;
|
|
255
|
-
}) => Promise<undefined | {
|
|
256
|
-
result: unknown;
|
|
257
|
-
}>;
|
|
258
|
-
status?: (status: AgentStatus) => void | Promise<void>;
|
|
259
|
-
};
|
|
260
|
-
type ToolName<Tools> = Extract<keyof Tools, string> | BuiltInToolName;
|
|
261
|
-
type ToolInput<Tools, K> = K extends BuiltInToolName ? InferToolInput<(typeof builtInTools)[K]> : K extends keyof Tools ? Tools[K] extends ai.Tool ? InferToolInput<Tools[K]> : unknown : unknown;
|
|
262
|
-
type NeedsApprovalMap<Tools> = {
|
|
263
|
-
[K in ToolName<Tools>]?: boolean | ((input: ToolInput<Tools, K>, options: {
|
|
37
|
+
declare function tool<TInputSchema extends z.ZodType, TContextSchema extends z.ZodType = z.ZodType<Record<string, unknown>>, TStateSchema extends z.ZodType = z.ZodType<Record<string, unknown>>, TOutputSchema extends z.ZodType = z.ZodType<any>>(def: {
|
|
38
|
+
description?: string;
|
|
39
|
+
inputSchema: TInputSchema;
|
|
40
|
+
outputSchema?: TOutputSchema;
|
|
41
|
+
contextSchema?: TContextSchema;
|
|
42
|
+
stateSchema?: TStateSchema;
|
|
43
|
+
execute?: (input: z.infer<TInputSchema>, options: ToolContext<z.infer<TContextSchema>, z.infer<TStateSchema>> & {
|
|
264
44
|
toolCallId: string;
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
};
|
|
269
|
-
type InferUIMessage<A> = A extends {
|
|
270
|
-
tools: infer T extends ToolSet;
|
|
271
|
-
$UIMessage: UIMessage<infer M>;
|
|
272
|
-
} ? UIMessage<M, AgentDataTypes, InferUITools<T>> : A extends {
|
|
273
|
-
tools: infer T extends ToolSet;
|
|
274
|
-
} ? UIMessage<unknown, AgentDataTypes, InferUITools<T>> : UIMessage<unknown, AgentDataTypes>;
|
|
275
|
-
type TypedUIMessage<TMessageMetadata = unknown, Tools extends ToolSet = ToolSet> = UIMessage<TMessageMetadata, AgentDataTypes, InferUITools<Tools>>;
|
|
276
|
-
|
|
277
|
-
type StreamOptions = {
|
|
278
|
-
messageId?: string;
|
|
279
|
-
startIndex?: number;
|
|
280
|
-
};
|
|
281
|
-
type WorkflowRunLike = {
|
|
282
|
-
getReadable(options?: {
|
|
283
|
-
startIndex?: number;
|
|
284
|
-
}): ReadableStream;
|
|
285
|
-
};
|
|
286
|
-
|
|
287
|
-
type ApprovalData = {
|
|
288
|
-
approvalId: string;
|
|
289
|
-
approved: boolean;
|
|
290
|
-
reason?: string;
|
|
291
|
-
};
|
|
292
|
-
type MessageData<Tools extends ToolSet> = UIMessage | {
|
|
293
|
-
role?: TypedUIMessage<unknown, Tools>["role"];
|
|
294
|
-
parts: TypedUIMessage<unknown, Tools>["parts"];
|
|
295
|
-
metadata?: Record<string, unknown> | null;
|
|
296
|
-
id?: string;
|
|
297
|
-
};
|
|
298
|
-
type SendInput<Tools extends ToolSet> = string | MessageData<Tools> | {
|
|
299
|
-
type: "message";
|
|
300
|
-
message: MessageData<Tools>;
|
|
301
|
-
} | {
|
|
302
|
-
type: "approval";
|
|
303
|
-
approval: ApprovalData;
|
|
304
|
-
};
|
|
305
|
-
type SendOptions<TContext> = {
|
|
306
|
-
interruptIfStreaming?: boolean | {
|
|
307
|
-
lastPart: {
|
|
308
|
-
index: number;
|
|
309
|
-
part: unknown;
|
|
310
|
-
};
|
|
311
|
-
};
|
|
312
|
-
context?: TContext;
|
|
313
|
-
abortSignal?: AbortSignal;
|
|
314
|
-
sandboxId?: string;
|
|
315
|
-
};
|
|
316
|
-
type SendResult = {
|
|
317
|
-
assistantMessageId: string;
|
|
318
|
-
done: true | Promise<true>;
|
|
319
|
-
};
|
|
320
|
-
|
|
321
|
-
type InterruptOptions = {
|
|
322
|
-
lastPart?: {
|
|
323
|
-
index: number;
|
|
324
|
-
part: unknown;
|
|
325
|
-
};
|
|
326
|
-
};
|
|
327
|
-
|
|
328
|
-
type ResolvableArgs<TContext = Record<string, unknown>, Tools extends ToolSet = ToolSet> = {
|
|
329
|
-
context: TContext;
|
|
330
|
-
sessionId: string;
|
|
331
|
-
sandbox: SandboxInstance;
|
|
332
|
-
messages: UIMessage<unknown, AgentDataTypes, InferUITools<Tools>>[];
|
|
333
|
-
};
|
|
334
|
-
type Resolvable<T, TContext = Record<string, unknown>, Tools extends ToolSet = ToolSet> = T | ((args: ResolvableArgs<TContext, Tools>) => T | Promise<T>);
|
|
335
|
-
type SessionDefaults<Tools extends ToolSet = ToolSet, TContext extends Record<string, unknown> = Record<string, unknown>> = {
|
|
336
|
-
model?: Resolvable<GatewayModelId | undefined, TContext, Tools>;
|
|
337
|
-
system?: Resolvable<string | string[] | undefined, TContext, Tools>;
|
|
338
|
-
generation?: Resolvable<GenerationOptions | undefined, TContext, Tools>;
|
|
339
|
-
activeTools?: Resolvable<readonly (Extract<keyof Tools, string> | BuiltInToolName)[] | undefined, TContext, Tools>;
|
|
340
|
-
skills?: Resolvable<SkillInput[] | undefined, TContext, Tools>;
|
|
341
|
-
};
|
|
342
|
-
type AgentOptions<Tools extends ToolSet = any, TSandboxBindings extends SandboxBinding | SandboxBinding[] = SandboxBinding, TContext extends Record<string, unknown> = Record<string, never>> = SessionDefaults<Tools, TContext> & {
|
|
343
|
-
storage?: StorageInput;
|
|
344
|
-
sandbox?: TSandboxBindings;
|
|
345
|
-
tools?: Tools;
|
|
346
|
-
hooks?: AgentHooks;
|
|
347
|
-
needsApproval?: NeedsApprovalMap<Tools>;
|
|
348
|
-
contextSchema?: z.ZodType<TContext>;
|
|
349
|
-
logging?: Omit<LoggingConfig, "name">;
|
|
350
|
-
};
|
|
351
|
-
type AnyAgent = Agent<any, any, any, any>;
|
|
352
|
-
type InferSession<Agent extends AnyAgent = AnyAgent> = ReturnType<Agent["session"]>;
|
|
353
|
-
type SessionSendArgs<Agent extends AnyAgent, Session extends InferSession<Agent> = InferSession<Agent>> = Parameters<Session["send"]>;
|
|
354
|
-
declare class Agent<TMessageMetadata = unknown, Tools extends ToolSet = ToolSet, TSandboxBindings extends SandboxBinding | SandboxBinding[] = SandboxBinding, TContext extends Record<string, unknown> = Record<string, never>> {
|
|
355
|
-
readonly name: string;
|
|
356
|
-
options: AgentOptions<Tools, TSandboxBindings, TContext>;
|
|
357
|
-
constructor(name: string, options?: AgentOptions<Tools, TSandboxBindings, TContext>);
|
|
358
|
-
static [WORKFLOW_SERIALIZE](instance: AnyAgent): {
|
|
359
|
-
name: string;
|
|
360
|
-
};
|
|
361
|
-
static [WORKFLOW_DESERIALIZE](data: {
|
|
362
|
-
name: string;
|
|
363
|
-
}): AnyAgent;
|
|
364
|
-
private _resolvedStorage;
|
|
365
|
-
get storage(): Storage;
|
|
366
|
-
get tools(): typeof builtInTools & Tools;
|
|
367
|
-
get hooks(): AgentHooks;
|
|
368
|
-
readonly session: (id?: string | {
|
|
369
|
-
id?: string;
|
|
370
|
-
} | undefined) => {
|
|
371
|
-
id: string;
|
|
372
|
-
send: (input: SendInput<Tools> | SendInput<Tools>[], opts?: SendOptions<TContext> | undefined) => Promise<SendResult>;
|
|
373
|
-
stream: (runOrOpts?: StreamOptions | WorkflowRunLike | undefined) => Promise<ReadableStream<ai.UIMessageChunk>>;
|
|
374
|
-
history: () => Promise<{
|
|
375
|
-
messages: UIMessage<unknown, AgentDataTypes, InferUITools<Tools>>[];
|
|
376
|
-
streamingMessageId: string | null;
|
|
377
|
-
usage: SessionUsage;
|
|
378
|
-
}>;
|
|
379
|
-
interrupt: (opts?: InterruptOptions | undefined) => Promise<void>;
|
|
380
|
-
usage: () => Promise<SessionUsage>;
|
|
381
|
-
update: (opts: Partial<Omit<Session, "id" | "createdAt" | "updatedAt">>) => Promise<void>;
|
|
382
|
-
sandbox: {
|
|
383
|
-
setup: (opts?: SetupOpts<TSandboxBindings> | undefined) => Promise<SetupResult>;
|
|
384
|
-
exec: (opts: {
|
|
385
|
-
command: string;
|
|
386
|
-
args?: string[];
|
|
387
|
-
cwd?: string;
|
|
388
|
-
env?: Record<string, string>;
|
|
389
|
-
sudo?: boolean;
|
|
390
|
-
signal?: AbortSignal;
|
|
391
|
-
}) => Promise<ExecResult>;
|
|
392
|
-
stop: (opts?: {
|
|
393
|
-
signal?: AbortSignal;
|
|
394
|
-
} | undefined) => Promise<void>;
|
|
395
|
-
snapshot: (opts?: {
|
|
396
|
-
signal?: AbortSignal;
|
|
397
|
-
} | undefined) => Promise<{
|
|
398
|
-
snapshotId: string;
|
|
399
|
-
}>;
|
|
400
|
-
getDomain: (opts: {
|
|
401
|
-
port: number;
|
|
402
|
-
signal?: AbortSignal;
|
|
403
|
-
}) => Promise<string>;
|
|
404
|
-
getStatus: (opts?: {
|
|
405
|
-
signal?: AbortSignal;
|
|
406
|
-
} | undefined) => Promise<"pending" | "running" | "stopping" | "stopped" | "failed">;
|
|
407
|
-
kill: (opts: {
|
|
408
|
-
commandId: string;
|
|
409
|
-
signal?: AbortSignal;
|
|
410
|
-
}) => Promise<void>;
|
|
411
|
-
readFile: (opts: {
|
|
412
|
-
path: string;
|
|
413
|
-
signal?: AbortSignal;
|
|
414
|
-
}) => Promise<Buffer | null>;
|
|
415
|
-
start: (opts?: {
|
|
416
|
-
signal?: AbortSignal;
|
|
417
|
-
} | undefined) => Promise<void>;
|
|
418
|
-
updateNetworkPolicy: (opts: {
|
|
419
|
-
policy: _vercel_sandbox.NetworkPolicy;
|
|
420
|
-
signal?: AbortSignal;
|
|
421
|
-
}) => Promise<_vercel_sandbox.NetworkPolicy>;
|
|
422
|
-
writeFiles: (opts: {
|
|
423
|
-
files: UploadableFile[];
|
|
424
|
-
destPath: string;
|
|
425
|
-
signal?: AbortSignal;
|
|
426
|
-
}) => Promise<void>;
|
|
427
|
-
};
|
|
428
|
-
};
|
|
429
|
-
readonly sandbox: (id?: string | SandboxOptions | undefined) => {
|
|
430
|
-
id: string;
|
|
431
|
-
readonly cwd: string;
|
|
432
|
-
setup: (opts?: SetupOpts<TSandboxBindings> | undefined) => Promise<SetupResult>;
|
|
433
|
-
exec: (opts: {
|
|
434
|
-
command: string;
|
|
435
|
-
args?: string[];
|
|
436
|
-
cwd?: string;
|
|
437
|
-
env?: Record<string, string>;
|
|
438
|
-
sudo?: boolean;
|
|
439
|
-
signal?: AbortSignal;
|
|
440
|
-
}) => Promise<ExecResult>;
|
|
441
|
-
readFile: (opts: {
|
|
442
|
-
path: string;
|
|
443
|
-
signal?: AbortSignal;
|
|
444
|
-
}) => Promise<Buffer | null>;
|
|
445
|
-
writeFiles: (opts: {
|
|
446
|
-
files: UploadableFile[];
|
|
447
|
-
destPath: string;
|
|
448
|
-
signal?: AbortSignal;
|
|
449
|
-
}) => Promise<void>;
|
|
450
|
-
getDomain: (opts: {
|
|
451
|
-
port: number;
|
|
452
|
-
signal?: AbortSignal;
|
|
453
|
-
}) => Promise<string>;
|
|
454
|
-
updateNetworkPolicy: (opts: {
|
|
455
|
-
policy: _vercel_sandbox.NetworkPolicy;
|
|
456
|
-
signal?: AbortSignal;
|
|
457
|
-
}) => Promise<_vercel_sandbox.NetworkPolicy>;
|
|
458
|
-
start: (opts?: {
|
|
459
|
-
signal?: AbortSignal;
|
|
460
|
-
} | undefined) => Promise<void>;
|
|
461
|
-
stop: (opts?: {
|
|
462
|
-
signal?: AbortSignal;
|
|
463
|
-
} | undefined) => Promise<void>;
|
|
464
|
-
kill: (opts: {
|
|
465
|
-
commandId: string;
|
|
466
|
-
signal?: AbortSignal;
|
|
467
|
-
}) => Promise<void>;
|
|
468
|
-
snapshot: (opts?: {
|
|
469
|
-
signal?: AbortSignal;
|
|
470
|
-
} | undefined) => Promise<{
|
|
471
|
-
snapshotId: string;
|
|
472
|
-
}>;
|
|
473
|
-
getStatus: (opts?: {
|
|
474
|
-
signal?: AbortSignal;
|
|
475
|
-
} | undefined) => Promise<"pending" | "running" | "stopping" | "stopped" | "failed">;
|
|
476
|
-
};
|
|
477
|
-
/** Phantom property for type inference. Use `typeof myAgent.$UIMessage` to get the typed UIMessage. */
|
|
478
|
-
readonly $UIMessage: UIMessage<TMessageMetadata, AgentDataTypes, InferUITools<typeof builtInTools & Tools>>;
|
|
479
|
-
}
|
|
480
|
-
declare function agent<TMessageMetadata = unknown, Tools extends ToolSet = ToolSet, TSandboxBindings extends SandboxBinding | SandboxBinding[] = SandboxBinding, TContext extends Record<string, unknown> = Record<string, never>>(name: string, options?: AgentOptions<Tools, TSandboxBindings, TContext>): Agent<TMessageMetadata, Tools, TSandboxBindings, TContext>;
|
|
45
|
+
abortSignal: AbortSignal;
|
|
46
|
+
}) => any;
|
|
47
|
+
}): Tool<any, any>;
|
|
481
48
|
|
|
482
49
|
declare const SessionNotFoundError_base: errore.FactoryTaggedErrorClass<"SessionNotFoundError", "Session $id not found", Error>;
|
|
483
50
|
declare class SessionNotFoundError extends SessionNotFoundError_base {
|
|
@@ -498,4 +65,437 @@ declare const MessageNotFoundError_base: errore.FactoryTaggedErrorClass<"Message
|
|
|
498
65
|
declare class MessageNotFoundError extends MessageNotFoundError_base {
|
|
499
66
|
}
|
|
500
67
|
|
|
501
|
-
|
|
68
|
+
declare function agentContract<Agent extends AnyAgent>(agent: Agent): {
|
|
69
|
+
"session.get": {
|
|
70
|
+
params: z$1.ZodObject<{
|
|
71
|
+
sessionId: z$1.ZodString;
|
|
72
|
+
}, z$1.core.$strip>;
|
|
73
|
+
response: z$1.ZodObject<{
|
|
74
|
+
messages: z$1.ZodArray<z$1.ZodObject<{
|
|
75
|
+
id: z$1.ZodString;
|
|
76
|
+
role: z$1.ZodEnum<{
|
|
77
|
+
user: "user";
|
|
78
|
+
assistant: "assistant";
|
|
79
|
+
system: "system";
|
|
80
|
+
}>;
|
|
81
|
+
parts: z$1.ZodArray<z$1.ZodType<ai.TextUIPart | ai.ReasoningUIPart | ai.SourceUrlUIPart | ai.FileUIPart | ai.StepStartUIPart | ({
|
|
82
|
+
type: `tool-${string}`;
|
|
83
|
+
} & ai.UIToolInvocation<ai.InferUITool<any>>), unknown, z$1.core.$ZodTypeInternals<ai.TextUIPart | ai.ReasoningUIPart | ai.SourceUrlUIPart | ai.FileUIPart | ai.StepStartUIPart | ({
|
|
84
|
+
type: `tool-${string}`;
|
|
85
|
+
} & ai.UIToolInvocation<ai.InferUITool<any>>), unknown>>>;
|
|
86
|
+
}, z$1.core.$strip>>;
|
|
87
|
+
streamingMessageId: z$1.ZodNullable<z$1.ZodString>;
|
|
88
|
+
usage: z$1.ZodObject<{
|
|
89
|
+
total: z$1.ZodObject<{
|
|
90
|
+
model: z$1.ZodString;
|
|
91
|
+
inputTokens: z$1.ZodNumber;
|
|
92
|
+
outputTokens: z$1.ZodNumber;
|
|
93
|
+
totalTokens: z$1.ZodNumber;
|
|
94
|
+
cacheReadTokens: z$1.ZodNumber;
|
|
95
|
+
cacheWriteTokens: z$1.ZodNumber;
|
|
96
|
+
reasoningTokens: z$1.ZodNumber;
|
|
97
|
+
stepCount: z$1.ZodNumber;
|
|
98
|
+
messageCount: z$1.ZodNumber;
|
|
99
|
+
}, z$1.core.$strip>;
|
|
100
|
+
byMessageId: z$1.ZodRecord<z$1.ZodString, z$1.ZodNullable<z$1.ZodObject<{
|
|
101
|
+
model: z$1.ZodString;
|
|
102
|
+
inputTokens: z$1.ZodNumber;
|
|
103
|
+
outputTokens: z$1.ZodNumber;
|
|
104
|
+
totalTokens: z$1.ZodNumber;
|
|
105
|
+
cacheReadTokens: z$1.ZodNumber;
|
|
106
|
+
cacheWriteTokens: z$1.ZodNumber;
|
|
107
|
+
reasoningTokens: z$1.ZodNumber;
|
|
108
|
+
stepCount: z$1.ZodNumber;
|
|
109
|
+
}, z$1.core.$strip>>>;
|
|
110
|
+
}, z$1.core.$strip>;
|
|
111
|
+
}, z$1.core.$strip>;
|
|
112
|
+
};
|
|
113
|
+
"session.post": {
|
|
114
|
+
params: z$1.ZodObject<{
|
|
115
|
+
sessionId: z$1.ZodString;
|
|
116
|
+
}, z$1.core.$strip>;
|
|
117
|
+
body: z$1.ZodUnion<readonly [z$1.ZodString, z$1.ZodObject<{
|
|
118
|
+
id: z$1.ZodString;
|
|
119
|
+
role: z$1.ZodEnum<{
|
|
120
|
+
user: "user";
|
|
121
|
+
assistant: "assistant";
|
|
122
|
+
system: "system";
|
|
123
|
+
}>;
|
|
124
|
+
parts: z$1.ZodArray<z$1.ZodType<ai.TextUIPart | ai.ReasoningUIPart | ai.SourceUrlUIPart | ai.FileUIPart | ai.StepStartUIPart | ({
|
|
125
|
+
type: `tool-${string}`;
|
|
126
|
+
} & ai.UIToolInvocation<ai.InferUITool<any>>), unknown, z$1.core.$ZodTypeInternals<ai.TextUIPart | ai.ReasoningUIPart | ai.SourceUrlUIPart | ai.FileUIPart | ai.StepStartUIPart | ({
|
|
127
|
+
type: `tool-${string}`;
|
|
128
|
+
} & ai.UIToolInvocation<ai.InferUITool<any>>), unknown>>>;
|
|
129
|
+
}, z$1.core.$strip>]>;
|
|
130
|
+
response: z$1.ZodAny;
|
|
131
|
+
};
|
|
132
|
+
"reconnect.get": {
|
|
133
|
+
params: z$1.ZodObject<{
|
|
134
|
+
sessionId: z$1.ZodString;
|
|
135
|
+
}, z$1.core.$strip>;
|
|
136
|
+
response: z$1.ZodAny;
|
|
137
|
+
};
|
|
138
|
+
"interrupt.post": {
|
|
139
|
+
params: z$1.ZodObject<{
|
|
140
|
+
sessionId: z$1.ZodString;
|
|
141
|
+
}, z$1.core.$strip>;
|
|
142
|
+
body: z$1.ZodOptional<z$1.ZodObject<{
|
|
143
|
+
lastPart: z$1.ZodOptional<z$1.ZodObject<{
|
|
144
|
+
index: z$1.ZodNumber;
|
|
145
|
+
part: z$1.ZodType<ai.TextUIPart | ai.ReasoningUIPart | ai.SourceUrlUIPart | ai.FileUIPart | ai.StepStartUIPart | ({
|
|
146
|
+
type: `tool-${string}`;
|
|
147
|
+
} & ai.UIToolInvocation<ai.InferUITool<any>>), unknown, z$1.core.$ZodTypeInternals<ai.TextUIPart | ai.ReasoningUIPart | ai.SourceUrlUIPart | ai.FileUIPart | ai.StepStartUIPart | ({
|
|
148
|
+
type: `tool-${string}`;
|
|
149
|
+
} & ai.UIToolInvocation<ai.InferUITool<any>>), unknown>>;
|
|
150
|
+
}, z$1.core.$strip>>;
|
|
151
|
+
}, z$1.core.$strip>>;
|
|
152
|
+
response: z$1.ZodObject<{
|
|
153
|
+
success: z$1.ZodBoolean;
|
|
154
|
+
}, z$1.core.$strip>;
|
|
155
|
+
};
|
|
156
|
+
};
|
|
157
|
+
type AgentContract<Agent extends AnyAgent> = ReturnType<typeof agentContract<Agent>>;
|
|
158
|
+
type InferContract<Agent extends AnyAgent> = {
|
|
159
|
+
[K in keyof AgentContract<Agent>]: {
|
|
160
|
+
[K2 in keyof AgentContract<Agent>[K]]: z$1.infer<AgentContract<Agent>[K][K2]>;
|
|
161
|
+
};
|
|
162
|
+
};
|
|
163
|
+
type InferResponse<Agent extends AnyAgent, Key extends keyof AgentContract<Agent>> = InferContract<Agent>[Key]["response"];
|
|
164
|
+
|
|
165
|
+
type BasePath = `/api/agents/[agent]`;
|
|
166
|
+
|
|
167
|
+
type Without<O, K extends keyof O> = Omit<O, K>;
|
|
168
|
+
declare function handleRequest<Agent extends AnyAgent, AgentBasePath extends string = BasePath>(agent: Agent, options?: {
|
|
169
|
+
basePath?: AgentBasePath;
|
|
170
|
+
workflow?: (sessionId: string, ...args: SessionSendArgs<AnyAgent>) => Promise<SendResult>;
|
|
171
|
+
overrides?: {
|
|
172
|
+
[K in keyof AgentContract<Agent>]?: (contract: Without<InferContract<Agent>[K], "response">, next: () => Promise<InferResponse<Agent, K> | Response>) => Promise<InferResponse<Agent, K> | Response>;
|
|
173
|
+
};
|
|
174
|
+
}): elysia__default<`/api/agents/${string}` | AgentBasePath, {
|
|
175
|
+
decorator: {};
|
|
176
|
+
store: {};
|
|
177
|
+
derive: {};
|
|
178
|
+
resolve: {};
|
|
179
|
+
}, {
|
|
180
|
+
typebox: {};
|
|
181
|
+
error: {};
|
|
182
|
+
}, {
|
|
183
|
+
schema: {};
|
|
184
|
+
standaloneSchema: {};
|
|
185
|
+
macro: {};
|
|
186
|
+
macroFn: {};
|
|
187
|
+
parser: {};
|
|
188
|
+
response: {};
|
|
189
|
+
}, ((({
|
|
190
|
+
api: {
|
|
191
|
+
agents: {
|
|
192
|
+
[x: string]: {
|
|
193
|
+
":sessionId": {
|
|
194
|
+
get: {
|
|
195
|
+
body: unknown;
|
|
196
|
+
params: {
|
|
197
|
+
sessionId: string;
|
|
198
|
+
};
|
|
199
|
+
query: unknown;
|
|
200
|
+
headers: unknown;
|
|
201
|
+
response: {
|
|
202
|
+
422: {
|
|
203
|
+
type: "validation";
|
|
204
|
+
on: string;
|
|
205
|
+
summary?: string;
|
|
206
|
+
message?: string;
|
|
207
|
+
found?: unknown;
|
|
208
|
+
property?: string;
|
|
209
|
+
expected?: string;
|
|
210
|
+
};
|
|
211
|
+
200: {
|
|
212
|
+
messages: {
|
|
213
|
+
id: string;
|
|
214
|
+
role: "user" | "assistant" | "system";
|
|
215
|
+
parts: (ai.TextUIPart | ai.ReasoningUIPart | ai.SourceUrlUIPart | ai.FileUIPart | ai.StepStartUIPart | ({
|
|
216
|
+
type: `tool-${string}`;
|
|
217
|
+
} & ai.UIToolInvocation<ai.InferUITool<any>>))[];
|
|
218
|
+
}[];
|
|
219
|
+
streamingMessageId: string | null;
|
|
220
|
+
usage: {
|
|
221
|
+
total: {
|
|
222
|
+
model: string;
|
|
223
|
+
inputTokens: number;
|
|
224
|
+
outputTokens: number;
|
|
225
|
+
totalTokens: number;
|
|
226
|
+
cacheReadTokens: number;
|
|
227
|
+
cacheWriteTokens: number;
|
|
228
|
+
reasoningTokens: number;
|
|
229
|
+
stepCount: number;
|
|
230
|
+
messageCount: number;
|
|
231
|
+
};
|
|
232
|
+
byMessageId: Record<string, {
|
|
233
|
+
model: string;
|
|
234
|
+
inputTokens: number;
|
|
235
|
+
outputTokens: number;
|
|
236
|
+
totalTokens: number;
|
|
237
|
+
cacheReadTokens: number;
|
|
238
|
+
cacheWriteTokens: number;
|
|
239
|
+
reasoningTokens: number;
|
|
240
|
+
stepCount: number;
|
|
241
|
+
} | null>;
|
|
242
|
+
};
|
|
243
|
+
};
|
|
244
|
+
};
|
|
245
|
+
};
|
|
246
|
+
};
|
|
247
|
+
};
|
|
248
|
+
};
|
|
249
|
+
};
|
|
250
|
+
} | ({} & elysia.CreateEden<`${AgentBasePath}/:sessionId`, {
|
|
251
|
+
get: {
|
|
252
|
+
body: unknown;
|
|
253
|
+
params: {
|
|
254
|
+
sessionId: string;
|
|
255
|
+
};
|
|
256
|
+
query: unknown;
|
|
257
|
+
headers: unknown;
|
|
258
|
+
response: {
|
|
259
|
+
422: {
|
|
260
|
+
type: "validation";
|
|
261
|
+
on: string;
|
|
262
|
+
summary?: string;
|
|
263
|
+
message?: string;
|
|
264
|
+
found?: unknown;
|
|
265
|
+
property?: string;
|
|
266
|
+
expected?: string;
|
|
267
|
+
};
|
|
268
|
+
200: {
|
|
269
|
+
messages: {
|
|
270
|
+
id: string;
|
|
271
|
+
role: "user" | "assistant" | "system";
|
|
272
|
+
parts: (ai.TextUIPart | ai.ReasoningUIPart | ai.SourceUrlUIPart | ai.FileUIPart | ai.StepStartUIPart | ({
|
|
273
|
+
type: `tool-${string}`;
|
|
274
|
+
} & ai.UIToolInvocation<ai.InferUITool<any>>))[];
|
|
275
|
+
}[];
|
|
276
|
+
streamingMessageId: string | null;
|
|
277
|
+
usage: {
|
|
278
|
+
total: {
|
|
279
|
+
model: string;
|
|
280
|
+
inputTokens: number;
|
|
281
|
+
outputTokens: number;
|
|
282
|
+
totalTokens: number;
|
|
283
|
+
cacheReadTokens: number;
|
|
284
|
+
cacheWriteTokens: number;
|
|
285
|
+
reasoningTokens: number;
|
|
286
|
+
stepCount: number;
|
|
287
|
+
messageCount: number;
|
|
288
|
+
};
|
|
289
|
+
byMessageId: Record<string, {
|
|
290
|
+
model: string;
|
|
291
|
+
inputTokens: number;
|
|
292
|
+
outputTokens: number;
|
|
293
|
+
totalTokens: number;
|
|
294
|
+
cacheReadTokens: number;
|
|
295
|
+
cacheWriteTokens: number;
|
|
296
|
+
reasoningTokens: number;
|
|
297
|
+
stepCount: number;
|
|
298
|
+
} | null>;
|
|
299
|
+
};
|
|
300
|
+
};
|
|
301
|
+
};
|
|
302
|
+
};
|
|
303
|
+
}>)) & ({
|
|
304
|
+
api: {
|
|
305
|
+
agents: {
|
|
306
|
+
[x: string]: {
|
|
307
|
+
":sessionId": {
|
|
308
|
+
post: {
|
|
309
|
+
body: string | {
|
|
310
|
+
id: string;
|
|
311
|
+
role: "user" | "assistant" | "system";
|
|
312
|
+
parts: (ai.TextUIPart | ai.ReasoningUIPart | ai.SourceUrlUIPart | ai.FileUIPart | ai.StepStartUIPart | ({
|
|
313
|
+
type: `tool-${string}`;
|
|
314
|
+
} & ai.UIToolInvocation<ai.InferUITool<any>>))[];
|
|
315
|
+
};
|
|
316
|
+
params: {
|
|
317
|
+
sessionId: string;
|
|
318
|
+
};
|
|
319
|
+
query: unknown;
|
|
320
|
+
headers: unknown;
|
|
321
|
+
response: {
|
|
322
|
+
422: {
|
|
323
|
+
type: "validation";
|
|
324
|
+
on: string;
|
|
325
|
+
summary?: string;
|
|
326
|
+
message?: string;
|
|
327
|
+
found?: unknown;
|
|
328
|
+
property?: string;
|
|
329
|
+
expected?: string;
|
|
330
|
+
};
|
|
331
|
+
200: any;
|
|
332
|
+
};
|
|
333
|
+
};
|
|
334
|
+
};
|
|
335
|
+
};
|
|
336
|
+
};
|
|
337
|
+
};
|
|
338
|
+
} | elysia.CreateEden<`${AgentBasePath}/:sessionId`, {
|
|
339
|
+
post: {
|
|
340
|
+
body: string | {
|
|
341
|
+
id: string;
|
|
342
|
+
role: "user" | "assistant" | "system";
|
|
343
|
+
parts: (ai.TextUIPart | ai.ReasoningUIPart | ai.SourceUrlUIPart | ai.FileUIPart | ai.StepStartUIPart | ({
|
|
344
|
+
type: `tool-${string}`;
|
|
345
|
+
} & ai.UIToolInvocation<ai.InferUITool<any>>))[];
|
|
346
|
+
};
|
|
347
|
+
params: {
|
|
348
|
+
sessionId: string;
|
|
349
|
+
};
|
|
350
|
+
query: unknown;
|
|
351
|
+
headers: unknown;
|
|
352
|
+
response: {
|
|
353
|
+
422: {
|
|
354
|
+
type: "validation";
|
|
355
|
+
on: string;
|
|
356
|
+
summary?: string;
|
|
357
|
+
message?: string;
|
|
358
|
+
found?: unknown;
|
|
359
|
+
property?: string;
|
|
360
|
+
expected?: string;
|
|
361
|
+
};
|
|
362
|
+
200: any;
|
|
363
|
+
};
|
|
364
|
+
};
|
|
365
|
+
}>)) & ({
|
|
366
|
+
api: {
|
|
367
|
+
agents: {
|
|
368
|
+
[x: string]: {
|
|
369
|
+
":sessionId": {
|
|
370
|
+
reconnect: {
|
|
371
|
+
get: {
|
|
372
|
+
body: unknown;
|
|
373
|
+
params: {
|
|
374
|
+
sessionId: string;
|
|
375
|
+
};
|
|
376
|
+
query: unknown;
|
|
377
|
+
headers: unknown;
|
|
378
|
+
response: {
|
|
379
|
+
422: {
|
|
380
|
+
type: "validation";
|
|
381
|
+
on: string;
|
|
382
|
+
summary?: string;
|
|
383
|
+
message?: string;
|
|
384
|
+
found?: unknown;
|
|
385
|
+
property?: string;
|
|
386
|
+
expected?: string;
|
|
387
|
+
};
|
|
388
|
+
200: any;
|
|
389
|
+
};
|
|
390
|
+
};
|
|
391
|
+
};
|
|
392
|
+
};
|
|
393
|
+
};
|
|
394
|
+
};
|
|
395
|
+
};
|
|
396
|
+
} | elysia.CreateEden<`${AgentBasePath}/:sessionId/reconnect`, {
|
|
397
|
+
get: {
|
|
398
|
+
body: unknown;
|
|
399
|
+
params: {
|
|
400
|
+
sessionId: string;
|
|
401
|
+
};
|
|
402
|
+
query: unknown;
|
|
403
|
+
headers: unknown;
|
|
404
|
+
response: {
|
|
405
|
+
422: {
|
|
406
|
+
type: "validation";
|
|
407
|
+
on: string;
|
|
408
|
+
summary?: string;
|
|
409
|
+
message?: string;
|
|
410
|
+
found?: unknown;
|
|
411
|
+
property?: string;
|
|
412
|
+
expected?: string;
|
|
413
|
+
};
|
|
414
|
+
200: any;
|
|
415
|
+
};
|
|
416
|
+
};
|
|
417
|
+
}>)) & ({
|
|
418
|
+
api: {
|
|
419
|
+
agents: {
|
|
420
|
+
[x: string]: {
|
|
421
|
+
":sessionId": {
|
|
422
|
+
interrupt: {
|
|
423
|
+
post: {
|
|
424
|
+
body: {
|
|
425
|
+
lastPart?: {
|
|
426
|
+
index: number;
|
|
427
|
+
part: ai.TextUIPart | ai.ReasoningUIPart | ai.SourceUrlUIPart | ai.FileUIPart | ai.StepStartUIPart | ({
|
|
428
|
+
type: `tool-${string}`;
|
|
429
|
+
} & ai.UIToolInvocation<ai.InferUITool<any>>);
|
|
430
|
+
} | undefined;
|
|
431
|
+
} | undefined;
|
|
432
|
+
params: {
|
|
433
|
+
sessionId: string;
|
|
434
|
+
};
|
|
435
|
+
query: unknown;
|
|
436
|
+
headers: unknown;
|
|
437
|
+
response: {
|
|
438
|
+
422: {
|
|
439
|
+
type: "validation";
|
|
440
|
+
on: string;
|
|
441
|
+
summary?: string;
|
|
442
|
+
message?: string;
|
|
443
|
+
found?: unknown;
|
|
444
|
+
property?: string;
|
|
445
|
+
expected?: string;
|
|
446
|
+
};
|
|
447
|
+
200: {
|
|
448
|
+
success: boolean;
|
|
449
|
+
};
|
|
450
|
+
};
|
|
451
|
+
};
|
|
452
|
+
};
|
|
453
|
+
};
|
|
454
|
+
};
|
|
455
|
+
};
|
|
456
|
+
};
|
|
457
|
+
} | elysia.CreateEden<`${AgentBasePath}/:sessionId/interrupt`, {
|
|
458
|
+
post: {
|
|
459
|
+
body: {
|
|
460
|
+
lastPart?: {
|
|
461
|
+
index: number;
|
|
462
|
+
part: ai.TextUIPart | ai.ReasoningUIPart | ai.SourceUrlUIPart | ai.FileUIPart | ai.StepStartUIPart | ({
|
|
463
|
+
type: `tool-${string}`;
|
|
464
|
+
} & ai.UIToolInvocation<ai.InferUITool<any>>);
|
|
465
|
+
} | undefined;
|
|
466
|
+
} | undefined;
|
|
467
|
+
params: {
|
|
468
|
+
sessionId: string;
|
|
469
|
+
};
|
|
470
|
+
query: unknown;
|
|
471
|
+
headers: unknown;
|
|
472
|
+
response: {
|
|
473
|
+
422: {
|
|
474
|
+
type: "validation";
|
|
475
|
+
on: string;
|
|
476
|
+
summary?: string;
|
|
477
|
+
message?: string;
|
|
478
|
+
found?: unknown;
|
|
479
|
+
property?: string;
|
|
480
|
+
expected?: string;
|
|
481
|
+
};
|
|
482
|
+
200: {
|
|
483
|
+
success: boolean;
|
|
484
|
+
};
|
|
485
|
+
};
|
|
486
|
+
};
|
|
487
|
+
}>), {
|
|
488
|
+
derive: {};
|
|
489
|
+
resolve: {};
|
|
490
|
+
schema: {};
|
|
491
|
+
standaloneSchema: {};
|
|
492
|
+
response: {};
|
|
493
|
+
}, {
|
|
494
|
+
derive: {};
|
|
495
|
+
resolve: {};
|
|
496
|
+
schema: {};
|
|
497
|
+
standaloneSchema: {};
|
|
498
|
+
response: {};
|
|
499
|
+
}>;
|
|
500
|
+
|
|
501
|
+
export { AnyAgent, MessageNotFoundError, SandboxError, SandboxNotFoundError, SessionNotFoundError, SessionSendArgs, StorageConflictError, StorageError, ToolContext, handleRequest, tool };
|