experimental-agent 0.2.3 → 0.3.0
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/README.md +55 -254
- package/dist/adapter-BigchkkI.d.mts +201 -0
- package/dist/adapter-BigchkkI.d.ts +201 -0
- package/dist/chunk-BFFNCESS.mjs +302 -0
- package/dist/chunk-C4VSUEY2.mjs +72 -0
- package/dist/chunk-DOD4MC5D.mjs +196 -0
- package/dist/chunk-ELWIUJUK.mjs +96 -0
- package/dist/chunk-GKASMIBR.mjs +50 -0
- package/dist/chunk-JO3JDCH5.mjs +107 -0
- package/dist/chunk-MSWINCCM.mjs +128 -0
- package/dist/chunk-RT72C52I.mjs +324 -0
- package/dist/chunk-ZUFJJYC4.mjs +150 -0
- package/dist/{handler-FRUPZ4LX.mjs → docker-QPCLWLYR.mjs} +3 -4
- package/dist/entry-BmQ8FO-5.d.ts +36 -0
- package/dist/entry-CZd9aAwn.d.mts +36 -0
- package/dist/index.d.mts +415 -18
- package/dist/index.d.ts +415 -18
- package/dist/index.js +3036 -5494
- package/dist/index.mjs +3264 -1142
- package/dist/lifecycle-workflow-steps.d.mts +5 -0
- package/dist/lifecycle-workflow-steps.d.ts +5 -0
- package/dist/lifecycle-workflow-steps.js +263 -0
- package/dist/lifecycle-workflow-steps.mjs +9 -0
- package/dist/lifecycle-workflow.d.mts +6 -6
- package/dist/lifecycle-workflow.d.ts +6 -6
- package/dist/lifecycle-workflow.js +192 -905
- package/dist/lifecycle-workflow.mjs +3 -1
- package/dist/local-KJ3BSIFJ.mjs +8 -0
- package/dist/next/loader.js +27 -6
- package/dist/next/loader.mjs +1 -1
- package/dist/next.js +27 -6
- package/dist/next.mjs +1 -1
- package/dist/{process-manager-JDUJDYGU.mjs → process-manager-WQHAIVRB.mjs} +1 -1
- package/dist/sandbox.d.mts +6 -0
- package/dist/sandbox.d.ts +6 -0
- package/dist/sandbox.js +1070 -0
- package/dist/sandbox.mjs +19 -0
- package/dist/steps-BnkRQKlc.d.ts +173 -0
- package/dist/steps-u-mGDbP_.d.mts +173 -0
- package/dist/storage.d.mts +11 -0
- package/dist/storage.d.ts +11 -0
- package/dist/storage.js +234 -0
- package/dist/storage.mjs +12 -0
- package/dist/vercel-QZ6INPMV.mjs +11 -0
- package/package.json +26 -5
- package/dist/agent-workflow.d.mts +0 -30
- package/dist/agent-workflow.d.ts +0 -30
- package/dist/agent-workflow.js +0 -5433
- package/dist/agent-workflow.mjs +0 -14
- package/dist/chunk-7M6UPURS.mjs +0 -75
- package/dist/chunk-AML2VCQS.mjs +0 -1287
- package/dist/chunk-FQ67QZOI.mjs +0 -75
- package/dist/chunk-NO7RHGTH.mjs +0 -2367
- package/dist/chunk-NXDVNJRS.mjs +0 -106
- package/dist/chunk-OZZVS6L5.mjs +0 -139
- package/dist/chunk-SJVFFE5D.mjs +0 -402
- package/dist/chunk-TAXLUVIC.mjs +0 -1
- package/dist/chunk-TGNVXSMX.mjs +0 -399
- package/dist/chunk-YRYXN7W4.mjs +0 -48
- package/dist/chunk-ZIAHPXOJ.mjs +0 -595
- package/dist/client-BKA7XBGW.mjs +0 -15
- package/dist/client-CEeSFGva.d.mts +0 -2376
- package/dist/client-CEeSFGva.d.ts +0 -2376
- package/dist/docker-FB2MJTHJ.mjs +0 -12
- package/dist/local-fs-handlers-SYOCKTPN.mjs +0 -447
- package/dist/sandbox-UENKQV3T.mjs +0 -21
- package/dist/storage-LSDMRW73.mjs +0 -20
- package/dist/vercel-SD3JTECG.mjs +0 -20
- package/dist/vercel-sdk-I6A4MVAN.mjs +0 -8
package/dist/index.d.mts
CHANGED
|
@@ -1,27 +1,424 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import * as _vercel_sandbox from '@vercel/sandbox';
|
|
2
|
+
import { S as SandboxBinding, a as SandboxSetupFields, b as SandboxInstance, W as WithConfig, c as LoggingConfig, E as ExecResult, U as UploadableFile } from './steps-u-mGDbP_.mjs';
|
|
3
|
+
export { d as SandboxAgentRef } from './steps-u-mGDbP_.mjs';
|
|
4
|
+
import { L as LocalBindingConfig, a as LocalBindingMetadata, V as VercelBindingConfig, b as VercelBindingMetadata, D as DockerBindingConfig, c as DockerBindingMetadata } from './entry-CZd9aAwn.mjs';
|
|
5
|
+
import * as ai from 'ai';
|
|
6
|
+
import { InferToolInput, ModelMessage, ToolSet, UIMessage, InferUITools, GatewayModelId } from 'ai';
|
|
7
|
+
import { b as Session, e as Storage, i as StorageInput } from './adapter-BigchkkI.mjs';
|
|
3
8
|
import { z } from 'zod';
|
|
4
|
-
import '
|
|
5
|
-
import '
|
|
6
|
-
import '@vercel/sandbox';
|
|
9
|
+
import { WORKFLOW_SERIALIZE, WORKFLOW_DESERIALIZE } from '@workflow/serde';
|
|
10
|
+
import * as errore from 'errore';
|
|
7
11
|
|
|
8
|
-
type
|
|
9
|
-
|
|
12
|
+
type BuiltInBindings = SandboxBinding<"local", LocalBindingConfig, LocalBindingMetadata> | SandboxBinding<"vercel", VercelBindingConfig, VercelBindingMetadata> | SandboxBinding<"docker", DockerBindingConfig, DockerBindingMetadata>;
|
|
13
|
+
|
|
14
|
+
type SandboxOptions = {
|
|
15
|
+
id?: string;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
type SetupCommonFields = Partial<SandboxSetupFields> & {
|
|
19
|
+
cwd?: string;
|
|
20
|
+
run?: (sandbox: SandboxInstance) => Promise<void>;
|
|
21
|
+
signal?: AbortSignal;
|
|
22
|
+
};
|
|
23
|
+
type ToBindingUnion<T extends SandboxBinding | SandboxBinding[]> = T extends SandboxBinding[] ? T[number] : T;
|
|
24
|
+
type SetupOptsForBinding<B extends SandboxBinding> = B extends SandboxBinding<infer T, infer C, any> ? {
|
|
25
|
+
type: T;
|
|
26
|
+
} & SetupCommonFields & WithConfig<C> : never;
|
|
27
|
+
type IsDefault<T extends SandboxBinding | SandboxBinding[]> = SandboxBinding extends T ? true : false;
|
|
28
|
+
type SetupOpts<TSandboxBindings extends SandboxBinding | SandboxBinding[]> = SetupOptsForBinding<IsDefault<TSandboxBindings> extends true ? BuiltInBindings : ToBindingUnion<TSandboxBindings>> | (SetupCommonFields & {
|
|
29
|
+
type?: never;
|
|
30
|
+
});
|
|
31
|
+
type SetupResult = {
|
|
32
|
+
done: Promise<SandboxInstance>;
|
|
10
33
|
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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;
|
|
14
54
|
};
|
|
15
|
-
type
|
|
16
|
-
|
|
55
|
+
type SessionUsage = {
|
|
56
|
+
total: UsageSummary & {
|
|
57
|
+
messageCount: number;
|
|
58
|
+
};
|
|
59
|
+
byMessageId: Record<string, UsageSummary | null>;
|
|
17
60
|
};
|
|
18
|
-
|
|
19
|
-
|
|
61
|
+
|
|
62
|
+
type StreamOptions = {
|
|
63
|
+
messageId?: string;
|
|
64
|
+
startIndex?: number;
|
|
65
|
+
};
|
|
66
|
+
type WorkflowRunLike = {
|
|
67
|
+
getReadable(options?: {
|
|
68
|
+
startIndex?: number;
|
|
69
|
+
}): ReadableStream;
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
type ToolContext<TContext = Record<string, unknown>> = {
|
|
73
|
+
session: Session;
|
|
74
|
+
sandbox: SandboxInstance;
|
|
75
|
+
storage: Storage;
|
|
76
|
+
context: TContext;
|
|
77
|
+
};
|
|
78
|
+
declare const builtInTools: {
|
|
79
|
+
Read: ai.Tool<{
|
|
80
|
+
label: string;
|
|
81
|
+
path: string;
|
|
82
|
+
startLine?: number | undefined;
|
|
83
|
+
endLine?: number | undefined;
|
|
84
|
+
}, {
|
|
85
|
+
content: string;
|
|
86
|
+
metadata: {
|
|
87
|
+
totalLines: number;
|
|
88
|
+
linesShown: number;
|
|
89
|
+
startLine: number;
|
|
90
|
+
endLine: number;
|
|
91
|
+
isPaginated: boolean;
|
|
92
|
+
fileSize: string;
|
|
93
|
+
path: string;
|
|
94
|
+
};
|
|
95
|
+
}>;
|
|
96
|
+
Grep: ai.Tool<{
|
|
97
|
+
label: string;
|
|
98
|
+
pattern: string;
|
|
99
|
+
caseSensitive: boolean;
|
|
100
|
+
filesWithMatches: boolean;
|
|
101
|
+
path?: string | undefined;
|
|
102
|
+
fileType?: string | undefined;
|
|
103
|
+
glob?: string | undefined;
|
|
104
|
+
contextLines?: number | undefined;
|
|
105
|
+
maxCount?: number | undefined;
|
|
106
|
+
}, {
|
|
107
|
+
matches: string;
|
|
108
|
+
summary: {
|
|
109
|
+
matchCount: number;
|
|
110
|
+
fileCount: number;
|
|
111
|
+
searchPath: string;
|
|
112
|
+
pattern: string;
|
|
113
|
+
};
|
|
114
|
+
}>;
|
|
115
|
+
List: ai.Tool<{
|
|
116
|
+
label: string;
|
|
117
|
+
includeHidden: boolean;
|
|
118
|
+
filesOnly: boolean;
|
|
119
|
+
path?: string | undefined;
|
|
120
|
+
depth?: number | undefined;
|
|
121
|
+
pattern?: string | undefined;
|
|
122
|
+
}, {
|
|
123
|
+
listing: string;
|
|
124
|
+
summary: {
|
|
125
|
+
totalItems: number;
|
|
126
|
+
totalFiles: number;
|
|
127
|
+
totalDirs: number;
|
|
128
|
+
searchPath: string;
|
|
129
|
+
depth?: number | undefined;
|
|
130
|
+
};
|
|
131
|
+
}>;
|
|
132
|
+
Write: ai.Tool<{
|
|
133
|
+
label: string;
|
|
134
|
+
path: string;
|
|
135
|
+
content: string;
|
|
136
|
+
}, {
|
|
137
|
+
success: boolean;
|
|
138
|
+
path: string;
|
|
139
|
+
bytesWritten: number;
|
|
140
|
+
error?: string | undefined;
|
|
141
|
+
}>;
|
|
142
|
+
Edit: ai.Tool<{
|
|
143
|
+
label: string;
|
|
144
|
+
path: string;
|
|
145
|
+
old_string: string;
|
|
146
|
+
new_string: string;
|
|
147
|
+
}, {
|
|
148
|
+
success: boolean;
|
|
149
|
+
path: string;
|
|
150
|
+
error?: string | undefined;
|
|
151
|
+
}>;
|
|
152
|
+
Bash: ai.Tool<{
|
|
153
|
+
label: string;
|
|
154
|
+
command: string;
|
|
155
|
+
waitUntil?: number | undefined;
|
|
156
|
+
}, {
|
|
157
|
+
commandId: string;
|
|
158
|
+
stdout: string;
|
|
159
|
+
stderr: string;
|
|
160
|
+
exitCode: number;
|
|
161
|
+
status: "running" | "failed" | "completed";
|
|
162
|
+
outputDir: string;
|
|
163
|
+
}>;
|
|
164
|
+
Skill: ai.Tool<{
|
|
165
|
+
label: string;
|
|
166
|
+
name: string;
|
|
167
|
+
}, {
|
|
168
|
+
name: string;
|
|
169
|
+
description: string;
|
|
170
|
+
content: string;
|
|
171
|
+
path: string;
|
|
172
|
+
}>;
|
|
173
|
+
JavaScript: ai.Tool<{
|
|
174
|
+
label: string;
|
|
20
175
|
code: string;
|
|
21
|
-
|
|
176
|
+
}, any>;
|
|
177
|
+
};
|
|
178
|
+
type BuiltInToolName = keyof typeof builtInTools;
|
|
179
|
+
declare const builtinToolNames: { [K in BuiltInToolName]: K; };
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Transient status indicators emitted over the stream during long-running phases.
|
|
183
|
+
* Delivered to the client as `data-status` chunks with `transient: true` — not persisted.
|
|
184
|
+
*/
|
|
185
|
+
declare const AgentStatus: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
186
|
+
type: z.ZodLiteral<"sandbox-setup">;
|
|
187
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
188
|
+
type: z.ZodLiteral<"sandbox-setup-cold">;
|
|
189
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
190
|
+
type: z.ZodLiteral<"loading-skills">;
|
|
191
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
192
|
+
type: z.ZodLiteral<"processing-approvals">;
|
|
193
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
194
|
+
type: z.ZodLiteral<"needs-approval">;
|
|
195
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
196
|
+
type: z.ZodLiteral<"thinking">;
|
|
197
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
198
|
+
type: z.ZodLiteral<"custom">;
|
|
199
|
+
status: z.ZodString;
|
|
200
|
+
}, z.core.$strip>], "type">;
|
|
201
|
+
type AgentStatus = z.infer<typeof AgentStatus>;
|
|
202
|
+
type AgentDataTypes = {
|
|
203
|
+
status: AgentStatus;
|
|
204
|
+
};
|
|
205
|
+
type AgentHooks = {
|
|
206
|
+
"tool.before"?: (opts: {
|
|
207
|
+
name: string;
|
|
208
|
+
input: unknown;
|
|
209
|
+
context: ToolContext;
|
|
210
|
+
}) => Promise<undefined | {
|
|
211
|
+
input: unknown;
|
|
212
|
+
}>;
|
|
213
|
+
"tool.after"?: (opts: {
|
|
214
|
+
name: string;
|
|
215
|
+
input: unknown;
|
|
216
|
+
result: unknown;
|
|
217
|
+
context: ToolContext;
|
|
218
|
+
}) => Promise<undefined | {
|
|
219
|
+
result: unknown;
|
|
220
|
+
}>;
|
|
221
|
+
status?: (status: AgentStatus) => void | Promise<void>;
|
|
222
|
+
};
|
|
223
|
+
type ToolName<Tools> = Extract<keyof Tools, string> | BuiltInToolName;
|
|
224
|
+
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;
|
|
225
|
+
type NeedsApprovalMap<Tools> = {
|
|
226
|
+
[K in ToolName<Tools>]?: boolean | ((input: ToolInput<Tools, K>, options: {
|
|
227
|
+
toolCallId: string;
|
|
228
|
+
messages: ModelMessage[];
|
|
229
|
+
experimental_context: unknown;
|
|
230
|
+
}) => boolean | Promise<boolean>);
|
|
231
|
+
};
|
|
232
|
+
type InferUIMessage<A> = A extends {
|
|
233
|
+
tools: infer T extends ToolSet;
|
|
234
|
+
} ? UIMessage<unknown, AgentDataTypes, InferUITools<T>> : UIMessage<unknown, AgentDataTypes>;
|
|
235
|
+
type TypedUIMessage<Tools extends ToolSet = ToolSet> = UIMessage<unknown, AgentDataTypes, InferUITools<Tools>>;
|
|
236
|
+
|
|
237
|
+
type UpdateOptions<Tools extends ToolSet> = Partial<Omit<Session, "id" | "activeTools" | "model"> & {
|
|
238
|
+
model?: GatewayModelId;
|
|
239
|
+
activeTools?: (Extract<keyof Tools, string> | BuiltInToolName)[];
|
|
240
|
+
}>;
|
|
241
|
+
|
|
242
|
+
type SendOptions<Tools extends ToolSet, TContext> = {
|
|
243
|
+
interruptIfStreaming?: boolean | {
|
|
244
|
+
lastPart: {
|
|
245
|
+
index: number;
|
|
246
|
+
part: unknown;
|
|
247
|
+
};
|
|
248
|
+
};
|
|
249
|
+
context?: TContext;
|
|
250
|
+
abortSignal?: AbortSignal;
|
|
251
|
+
} & UpdateOptions<Tools>;
|
|
252
|
+
type SendResult = {
|
|
253
|
+
assistantMessageId: string;
|
|
254
|
+
done: true | Promise<true>;
|
|
255
|
+
};
|
|
256
|
+
|
|
257
|
+
type InterruptOptions = {
|
|
258
|
+
lastPart?: {
|
|
259
|
+
index: number;
|
|
260
|
+
part: unknown;
|
|
22
261
|
};
|
|
23
262
|
};
|
|
24
|
-
type RpcResponse<T = unknown> = RpcSuccessResponse<T> | RpcErrorResponse;
|
|
25
|
-
declare function handleStorageRpc(body: RpcRequest, handlers: Handlers): Promise<RpcResponse>;
|
|
26
263
|
|
|
27
|
-
|
|
264
|
+
type SessionDefaults<Tools extends ToolSet = ToolSet> = {
|
|
265
|
+
model?: GatewayModelId;
|
|
266
|
+
system?: string;
|
|
267
|
+
generation?: Session["generation"];
|
|
268
|
+
activeTools?: (Extract<keyof Tools, string> | BuiltInToolName)[];
|
|
269
|
+
skillsDir?: string | string[];
|
|
270
|
+
};
|
|
271
|
+
type AgentOptions<Tools extends ToolSet = any, TSandboxBindings extends SandboxBinding | SandboxBinding[] = SandboxBinding, TContext extends Record<string, unknown> = Record<string, never>> = SessionDefaults<Tools> & {
|
|
272
|
+
storage?: StorageInput;
|
|
273
|
+
sandbox?: TSandboxBindings;
|
|
274
|
+
tools?: Tools;
|
|
275
|
+
hooks?: AgentHooks;
|
|
276
|
+
needsApproval?: NeedsApprovalMap<Tools>;
|
|
277
|
+
contextSchema?: z.ZodType<TContext>;
|
|
278
|
+
logging?: Omit<LoggingConfig, "name">;
|
|
279
|
+
};
|
|
280
|
+
type AnyAgent = Agent<any, any, any>;
|
|
281
|
+
type InferSession<Agent extends AnyAgent = AnyAgent> = ReturnType<Agent["session"]>;
|
|
282
|
+
type SessionSendArgs<Agent extends AnyAgent, Session extends InferSession<Agent> = InferSession<Agent>> = Parameters<Session["send"]>;
|
|
283
|
+
declare class Agent<Tools extends ToolSet, TSandboxBindings extends SandboxBinding | SandboxBinding[] = SandboxBinding, TContext extends Record<string, unknown> = Record<string, never>> {
|
|
284
|
+
readonly name: string;
|
|
285
|
+
options: AgentOptions<Tools, TSandboxBindings, TContext>;
|
|
286
|
+
constructor(name: string, options?: AgentOptions<Tools, TSandboxBindings, TContext>);
|
|
287
|
+
static [WORKFLOW_SERIALIZE](instance: AnyAgent): {
|
|
288
|
+
name: string;
|
|
289
|
+
};
|
|
290
|
+
static [WORKFLOW_DESERIALIZE](data: {
|
|
291
|
+
name: string;
|
|
292
|
+
}): AnyAgent;
|
|
293
|
+
private _storageWarned;
|
|
294
|
+
get storage(): Storage;
|
|
295
|
+
get tools(): typeof builtInTools & Tools;
|
|
296
|
+
get sessionDefaults(): SessionDefaults;
|
|
297
|
+
get hooks(): AgentHooks;
|
|
298
|
+
readonly session: (id?: string | {
|
|
299
|
+
id?: string;
|
|
300
|
+
} | undefined) => {
|
|
301
|
+
id: string;
|
|
302
|
+
send: (input: (string | {
|
|
303
|
+
type: "approval";
|
|
304
|
+
approval: {
|
|
305
|
+
approvalId: string;
|
|
306
|
+
approved: boolean;
|
|
307
|
+
reason?: string;
|
|
308
|
+
};
|
|
309
|
+
} | (UIMessage<unknown, ai.UIDataTypes, ai.UITools> | {
|
|
310
|
+
role?: TypedUIMessage<Tools_1>["role"];
|
|
311
|
+
parts: ai.UIMessagePart<AgentDataTypes, InferUITools<Tools>>[];
|
|
312
|
+
id?: string;
|
|
313
|
+
}) | {
|
|
314
|
+
type: "message";
|
|
315
|
+
message: UIMessage<unknown, ai.UIDataTypes, ai.UITools> | {
|
|
316
|
+
role?: TypedUIMessage<Tools_1>["role"];
|
|
317
|
+
parts: ai.UIMessagePart<AgentDataTypes, InferUITools<Tools>>[];
|
|
318
|
+
id?: string;
|
|
319
|
+
};
|
|
320
|
+
}) | (string | {
|
|
321
|
+
type: "approval";
|
|
322
|
+
approval: {
|
|
323
|
+
approvalId: string;
|
|
324
|
+
approved: boolean;
|
|
325
|
+
reason?: string;
|
|
326
|
+
};
|
|
327
|
+
} | (UIMessage<unknown, ai.UIDataTypes, ai.UITools> | {
|
|
328
|
+
role?: TypedUIMessage<Tools_1>["role"];
|
|
329
|
+
parts: ai.UIMessagePart<AgentDataTypes, InferUITools<Tools>>[];
|
|
330
|
+
id?: string;
|
|
331
|
+
}) | {
|
|
332
|
+
type: "message";
|
|
333
|
+
message: UIMessage<unknown, ai.UIDataTypes, ai.UITools> | {
|
|
334
|
+
role?: TypedUIMessage<Tools_1>["role"];
|
|
335
|
+
parts: ai.UIMessagePart<AgentDataTypes, InferUITools<Tools>>[];
|
|
336
|
+
id?: string;
|
|
337
|
+
};
|
|
338
|
+
})[], opts?: SendOptions<Tools, TContext> | undefined) => Promise<SendResult>;
|
|
339
|
+
stream: (runOrOpts?: WorkflowRunLike | StreamOptions | undefined) => Promise<ReadableStream<ai.UIMessageChunk>>;
|
|
340
|
+
history: () => Promise<{
|
|
341
|
+
messages: UIMessage<unknown, AgentDataTypes, InferUITools<Tools>>[];
|
|
342
|
+
streamingMessageId: string | null;
|
|
343
|
+
usage: SessionUsage;
|
|
344
|
+
}>;
|
|
345
|
+
interrupt: (opts?: InterruptOptions | undefined) => Promise<void>;
|
|
346
|
+
usage: () => Promise<SessionUsage>;
|
|
347
|
+
update: (opts: Partial<Omit<Session, "id" | "model" | "activeTools"> & {
|
|
348
|
+
model?: GatewayModelId;
|
|
349
|
+
activeTools?: ("Read" | "Grep" | "List" | "Write" | "Edit" | "Bash" | "Skill" | "JavaScript" | Extract<keyof Tools, string>)[] | undefined;
|
|
350
|
+
}>) => Promise<void>;
|
|
351
|
+
};
|
|
352
|
+
readonly sandbox: (id?: string | SandboxOptions | undefined) => {
|
|
353
|
+
id: string;
|
|
354
|
+
readonly cwd: string;
|
|
355
|
+
setup: (opts?: SetupOpts<TSandboxBindings> | undefined) => Promise<SetupResult>;
|
|
356
|
+
exec: (opts: {
|
|
357
|
+
command: string;
|
|
358
|
+
args?: string[];
|
|
359
|
+
cwd?: string;
|
|
360
|
+
env?: Record<string, string>;
|
|
361
|
+
sudo?: boolean;
|
|
362
|
+
signal?: AbortSignal;
|
|
363
|
+
}) => Promise<ExecResult>;
|
|
364
|
+
readFile: (opts: {
|
|
365
|
+
path: string;
|
|
366
|
+
signal?: AbortSignal;
|
|
367
|
+
}) => Promise<Buffer | null>;
|
|
368
|
+
writeFiles: (opts: {
|
|
369
|
+
files: UploadableFile[];
|
|
370
|
+
destPath: string;
|
|
371
|
+
signal?: AbortSignal;
|
|
372
|
+
}) => Promise<void>;
|
|
373
|
+
getDomain: (opts: {
|
|
374
|
+
port: number;
|
|
375
|
+
signal?: AbortSignal;
|
|
376
|
+
}) => Promise<string>;
|
|
377
|
+
updateNetworkPolicy: (opts: {
|
|
378
|
+
policy: _vercel_sandbox.NetworkPolicy;
|
|
379
|
+
signal?: AbortSignal;
|
|
380
|
+
}) => Promise<_vercel_sandbox.NetworkPolicy>;
|
|
381
|
+
start: (opts?: {
|
|
382
|
+
signal?: AbortSignal;
|
|
383
|
+
} | undefined) => Promise<void>;
|
|
384
|
+
stop: (opts?: {
|
|
385
|
+
signal?: AbortSignal;
|
|
386
|
+
} | undefined) => Promise<void>;
|
|
387
|
+
kill: (opts: {
|
|
388
|
+
commandId: string;
|
|
389
|
+
signal?: AbortSignal;
|
|
390
|
+
}) => Promise<void>;
|
|
391
|
+
snapshot: (opts?: {
|
|
392
|
+
signal?: AbortSignal;
|
|
393
|
+
} | undefined) => Promise<{
|
|
394
|
+
snapshotId: string;
|
|
395
|
+
}>;
|
|
396
|
+
getStatus: (opts?: {
|
|
397
|
+
signal?: AbortSignal;
|
|
398
|
+
} | undefined) => Promise<"pending" | "running" | "stopping" | "stopped" | "failed">;
|
|
399
|
+
};
|
|
400
|
+
/** Phantom property for type inference. Use `typeof myAgent.$UIMessage` to get the typed UIMessage. */
|
|
401
|
+
readonly $UIMessage: UIMessage<unknown, AgentDataTypes, InferUITools<typeof builtInTools & Tools>>;
|
|
402
|
+
}
|
|
403
|
+
declare function agent<Tools extends ToolSet, TSandboxBindings extends SandboxBinding | SandboxBinding[] = SandboxBinding, TContext extends Record<string, unknown> = Record<string, never>>(name: string, options?: AgentOptions<Tools, TSandboxBindings, TContext>): Agent<Tools, TSandboxBindings, TContext>;
|
|
404
|
+
|
|
405
|
+
declare const SessionNotFoundError_base: errore.FactoryTaggedErrorClass<"SessionNotFoundError", "Session $id not found", Error>;
|
|
406
|
+
declare class SessionNotFoundError extends SessionNotFoundError_base {
|
|
407
|
+
}
|
|
408
|
+
declare const SandboxNotFoundError_base: errore.FactoryTaggedErrorClass<"SandboxNotFoundError", "Sandbox $id not found", Error>;
|
|
409
|
+
declare class SandboxNotFoundError extends SandboxNotFoundError_base {
|
|
410
|
+
}
|
|
411
|
+
declare const StorageError_base: errore.FactoryTaggedErrorClass<"StorageError", "$reason", Error>;
|
|
412
|
+
declare class StorageError extends StorageError_base {
|
|
413
|
+
}
|
|
414
|
+
declare const StorageConflictError_base: errore.FactoryTaggedErrorClass<"StorageConflictError", "$reason", Error>;
|
|
415
|
+
declare class StorageConflictError extends StorageConflictError_base {
|
|
416
|
+
}
|
|
417
|
+
declare const SandboxError_base: errore.FactoryTaggedErrorClass<"SandboxError", "$reason", Error>;
|
|
418
|
+
declare class SandboxError extends SandboxError_base {
|
|
419
|
+
}
|
|
420
|
+
declare const MessageNotFoundError_base: errore.FactoryTaggedErrorClass<"MessageNotFoundError", "Message $id not found", Error>;
|
|
421
|
+
declare class MessageNotFoundError extends MessageNotFoundError_base {
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
export { type AgentDataTypes, type AgentHooks, type AgentOptions, AgentStatus, type AnyAgent, type BuiltInToolName, ExecResult, type InferSession, type InferUIMessage, MessageNotFoundError, type NeedsApprovalMap, SandboxBinding, SandboxError, SandboxInstance, SandboxNotFoundError, SandboxSetupFields, type SessionDefaults, SessionNotFoundError, type SessionSendArgs, type StepUsage, StorageConflictError, StorageError, type ToolContext, UploadableFile, type UsageSummary, type WorkflowRunLike, agent, builtinToolNames };
|