deepagentsdk 0.14.0 → 0.15.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/dist/adapters/elements/index.cjs +1 -1
- package/dist/adapters/elements/index.d.cts +1 -1
- package/dist/adapters/elements/index.d.mts +1 -1
- package/dist/{agent-D0bKkNI-.d.mts → agent-DHUp_-Fx.d.mts} +135 -25
- package/dist/{agent-DwAj5emJ.d.cts → agent-tfRthBvX.d.cts} +135 -25
- package/dist/{chunk-C5azi7Hr.cjs → chunk-DUZBydyJ.cjs} +7 -0
- package/dist/cli/index.cjs +2 -2
- package/dist/cli/index.mjs +1 -1
- package/dist/{file-saver-Hj5so3dV.mjs → file-saver-CQWTIr8z.mjs} +87 -4
- package/dist/file-saver-CQWTIr8z.mjs.map +1 -0
- package/dist/{file-saver-BYPKakT4.cjs → file-saver-ZDVH1zHI.cjs} +84 -4
- package/dist/file-saver-ZDVH1zHI.cjs.map +1 -0
- package/dist/index.cjs +27508 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +301 -4
- package/dist/index.d.mts +301 -4
- package/dist/index.mjs +27499 -4
- package/dist/index.mjs.map +1 -1
- package/dist/{load-BrRAKlO6.cjs → load-BnaAQyCo.cjs} +4 -4
- package/dist/{load-BrRAKlO6.cjs.map → load-BnaAQyCo.cjs.map} +1 -1
- package/dist/load-CLVcFzo7.cjs +4 -0
- package/dist/{load-BDxe6Cet.mjs → load-DRzSpESX.mjs} +1 -1
- package/dist/{load-BBYEnMwz.mjs → load-FjxJSusX.mjs} +2 -2
- package/dist/{load-BBYEnMwz.mjs.map → load-FjxJSusX.mjs.map} +1 -1
- package/package.json +5 -1
- package/dist/file-saver-BYPKakT4.cjs.map +0 -1
- package/dist/file-saver-Hj5so3dV.mjs.map +0 -1
- package/dist/load-DqllBbDc.cjs +0 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { p as DeepAgentEvent, r as ModelMessage$1, t as DeepAgent, yt as DeepAgentState } from "../../agent-
|
|
1
|
+
import { p as DeepAgentEvent, r as ModelMessage$1, t as DeepAgent, yt as DeepAgentState } from "../../agent-tfRthBvX.cjs";
|
|
2
2
|
import { UIMessage, UIMessage as UIMessage$1, UIMessagePart } from "ai";
|
|
3
3
|
|
|
4
4
|
//#region src/adapters/elements/createElementsRouteHandler.d.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { p as DeepAgentEvent, r as ModelMessage$1, t as DeepAgent, yt as DeepAgentState } from "../../agent-
|
|
1
|
+
import { p as DeepAgentEvent, r as ModelMessage$1, t as DeepAgent, yt as DeepAgentState } from "../../agent-DHUp_-Fx.mjs";
|
|
2
2
|
import { UIMessage, UIMessage as UIMessage$1, UIMessagePart } from "ai";
|
|
3
3
|
|
|
4
4
|
//#region src/adapters/elements/createElementsRouteHandler.d.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as ai2 from "ai";
|
|
2
2
|
import { LanguageModel, LanguageModel as LanguageModel$2, LanguageModelMiddleware, ModelMessage, ModelMessage as ModelMessage$1, StopCondition, ToolLoopAgent, ToolLoopAgentSettings, ToolSet } from "ai";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
|
|
@@ -166,6 +166,68 @@ interface EditResult {
|
|
|
166
166
|
/** Number of replacements made, undefined on failure */
|
|
167
167
|
occurrences?: number;
|
|
168
168
|
}
|
|
169
|
+
/**
|
|
170
|
+
* Standardized error codes for file upload/download operations.
|
|
171
|
+
*
|
|
172
|
+
* These represent common, recoverable errors that an LLM can understand and potentially fix:
|
|
173
|
+
* - "file_not_found": The requested file doesn't exist (download)
|
|
174
|
+
* - "permission_denied": Access denied
|
|
175
|
+
* - "is_directory": Attempted to download a directory as a file
|
|
176
|
+
* - "invalid_path": Path syntax is malformed
|
|
177
|
+
*
|
|
178
|
+
* @example
|
|
179
|
+
* ```typescript
|
|
180
|
+
* type FileError = FileOperationError;
|
|
181
|
+
* // Valid values: "file_not_found" | "permission_denied" | "is_directory" | "invalid_path"
|
|
182
|
+
* ```
|
|
183
|
+
*/
|
|
184
|
+
type FileOperationError = "file_not_found" | "permission_denied" | "is_directory" | "invalid_path";
|
|
185
|
+
/**
|
|
186
|
+
* Result of a single file download operation.
|
|
187
|
+
*
|
|
188
|
+
* The response is designed to allow partial success in batch operations.
|
|
189
|
+
* The errors are standardized using FileOperationError literals.
|
|
190
|
+
*
|
|
191
|
+
* @example Success
|
|
192
|
+
* ```typescript
|
|
193
|
+
* { path: "/app/config.json", content: new Uint8Array(...), error: null }
|
|
194
|
+
* ```
|
|
195
|
+
*
|
|
196
|
+
* @example Failure
|
|
197
|
+
* ```typescript
|
|
198
|
+
* { path: "/wrong/path.txt", content: null, error: "file_not_found" }
|
|
199
|
+
* ```
|
|
200
|
+
*/
|
|
201
|
+
interface FileDownloadResponse {
|
|
202
|
+
/** The file path that was requested */
|
|
203
|
+
path: string;
|
|
204
|
+
/** File contents as bytes on success, null on failure */
|
|
205
|
+
content: Uint8Array | null;
|
|
206
|
+
/** Standardized error code on failure, null on success */
|
|
207
|
+
error: FileOperationError | null;
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Result of a single file upload operation.
|
|
211
|
+
*
|
|
212
|
+
* The response is designed to allow partial success in batch operations.
|
|
213
|
+
* The errors are standardized using FileOperationError literals.
|
|
214
|
+
*
|
|
215
|
+
* @example Success
|
|
216
|
+
* ```typescript
|
|
217
|
+
* { path: "/app/data.txt", error: null }
|
|
218
|
+
* ```
|
|
219
|
+
*
|
|
220
|
+
* @example Failure
|
|
221
|
+
* ```typescript
|
|
222
|
+
* { path: "/readonly/file.txt", error: "permission_denied" }
|
|
223
|
+
* ```
|
|
224
|
+
*/
|
|
225
|
+
interface FileUploadResponse {
|
|
226
|
+
/** The file path that was requested */
|
|
227
|
+
path: string;
|
|
228
|
+
/** Standardized error code on failure, null on success */
|
|
229
|
+
error: FileOperationError | null;
|
|
230
|
+
}
|
|
169
231
|
/**
|
|
170
232
|
* Shared state for deep agent operations.
|
|
171
233
|
* This is passed to tools and modified during execution.
|
|
@@ -236,6 +298,54 @@ interface SandboxBackendProtocol extends BackendProtocol {
|
|
|
236
298
|
* Unique identifier for this sandbox instance.
|
|
237
299
|
*/
|
|
238
300
|
readonly id: string;
|
|
301
|
+
/**
|
|
302
|
+
* Upload multiple files to the sandbox.
|
|
303
|
+
*
|
|
304
|
+
* This API is designed to allow partial success - individual uploads may fail
|
|
305
|
+
* without affecting others. Check the error field in each response.
|
|
306
|
+
*
|
|
307
|
+
* @param files - Array of [path, content] tuples to upload
|
|
308
|
+
* @returns Array of FileUploadResponse objects, one per input file
|
|
309
|
+
*
|
|
310
|
+
* @example
|
|
311
|
+
* ```typescript
|
|
312
|
+
* const responses = await sandbox.uploadFiles([
|
|
313
|
+
* ["/app/config.json", new Uint8Array(b"...")],
|
|
314
|
+
* ["/app/data.txt", new Uint8Array(b"content")],
|
|
315
|
+
* ]);
|
|
316
|
+
* // Check for errors
|
|
317
|
+
* responses.forEach(r => {
|
|
318
|
+
* if (r.error) console.error(`Failed to upload ${r.path}: ${r.error}`);
|
|
319
|
+
* });
|
|
320
|
+
* ```
|
|
321
|
+
*/
|
|
322
|
+
uploadFiles(files: Array<[string, Uint8Array]>): Promise<FileUploadResponse[]>;
|
|
323
|
+
/**
|
|
324
|
+
* Download multiple files from the sandbox.
|
|
325
|
+
*
|
|
326
|
+
* This API is designed to allow partial success - individual downloads may fail
|
|
327
|
+
* without affecting others. Check the error field in each response.
|
|
328
|
+
*
|
|
329
|
+
* @param paths - Array of file paths to download
|
|
330
|
+
* @returns Array of FileDownloadResponse objects, one per input path
|
|
331
|
+
*
|
|
332
|
+
* @example
|
|
333
|
+
* ```typescript
|
|
334
|
+
* const responses = await sandbox.downloadFiles([
|
|
335
|
+
* "/app/config.json",
|
|
336
|
+
* "/app/data.txt",
|
|
337
|
+
* ]);
|
|
338
|
+
* // Process successful downloads
|
|
339
|
+
* for (const r of responses) {
|
|
340
|
+
* if (r.content) {
|
|
341
|
+
* console.log(`Downloaded ${r.path}: ${r.content.length} bytes`);
|
|
342
|
+
* } else if (r.error) {
|
|
343
|
+
* console.error(`Failed to download ${r.path}: ${r.error}`);
|
|
344
|
+
* }
|
|
345
|
+
* }
|
|
346
|
+
* ```
|
|
347
|
+
*/
|
|
348
|
+
downloadFiles(paths: string[]): Promise<FileDownloadResponse[]>;
|
|
239
349
|
}
|
|
240
350
|
/**
|
|
241
351
|
* Type guard to check if a backend is a SandboxBackendProtocol.
|
|
@@ -256,7 +366,7 @@ declare function createWebSearchTool(state: DeepAgentState, options: {
|
|
|
256
366
|
onEvent?: EventCallback;
|
|
257
367
|
toolResultEvictionLimit?: number;
|
|
258
368
|
tavilyApiKey: string;
|
|
259
|
-
}):
|
|
369
|
+
}): ai2.Tool<{
|
|
260
370
|
query: string;
|
|
261
371
|
max_results: number;
|
|
262
372
|
topic: "general" | "news" | "finance";
|
|
@@ -270,7 +380,7 @@ declare function createHttpRequestTool(state: DeepAgentState, options: {
|
|
|
270
380
|
onEvent?: EventCallback;
|
|
271
381
|
toolResultEvictionLimit?: number;
|
|
272
382
|
defaultTimeout: number;
|
|
273
|
-
}):
|
|
383
|
+
}): ai2.Tool<{
|
|
274
384
|
timeout: number;
|
|
275
385
|
url: string;
|
|
276
386
|
method: "GET" | "POST" | "PUT" | "DELETE" | "PATCH";
|
|
@@ -286,7 +396,7 @@ declare function createFetchUrlTool(state: DeepAgentState, options: {
|
|
|
286
396
|
onEvent?: EventCallback;
|
|
287
397
|
toolResultEvictionLimit?: number;
|
|
288
398
|
defaultTimeout: number;
|
|
289
|
-
}):
|
|
399
|
+
}): ai2.Tool<{
|
|
290
400
|
timeout: number;
|
|
291
401
|
url: string;
|
|
292
402
|
extract_article: boolean;
|
|
@@ -323,13 +433,13 @@ declare const fetch_url: typeof createFetchUrlTool;
|
|
|
323
433
|
/**
|
|
324
434
|
* Create the ls tool.
|
|
325
435
|
*/
|
|
326
|
-
declare function createLsTool(state: DeepAgentState, backend: BackendProtocol | BackendFactory, onEvent?: EventCallback):
|
|
436
|
+
declare function createLsTool(state: DeepAgentState, backend: BackendProtocol | BackendFactory, onEvent?: EventCallback): ai2.Tool<{
|
|
327
437
|
path: string;
|
|
328
438
|
}, string>;
|
|
329
439
|
/**
|
|
330
440
|
* Create the read_file tool.
|
|
331
441
|
*/
|
|
332
|
-
declare function createReadFileTool(state: DeepAgentState, backend: BackendProtocol | BackendFactory, evictionLimit?: number, onEvent?: EventCallback):
|
|
442
|
+
declare function createReadFileTool(state: DeepAgentState, backend: BackendProtocol | BackendFactory, evictionLimit?: number, onEvent?: EventCallback): ai2.Tool<{
|
|
333
443
|
file_path: string;
|
|
334
444
|
offset: number;
|
|
335
445
|
limit: number;
|
|
@@ -337,14 +447,14 @@ declare function createReadFileTool(state: DeepAgentState, backend: BackendProto
|
|
|
337
447
|
/**
|
|
338
448
|
* Create the write_file tool.
|
|
339
449
|
*/
|
|
340
|
-
declare function createWriteFileTool(state: DeepAgentState, backend: BackendProtocol | BackendFactory, onEvent?: EventCallback):
|
|
450
|
+
declare function createWriteFileTool(state: DeepAgentState, backend: BackendProtocol | BackendFactory, onEvent?: EventCallback): ai2.Tool<{
|
|
341
451
|
content: string;
|
|
342
452
|
file_path: string;
|
|
343
453
|
}, string>;
|
|
344
454
|
/**
|
|
345
455
|
* Create the edit_file tool.
|
|
346
456
|
*/
|
|
347
|
-
declare function createEditFileTool(state: DeepAgentState, backend: BackendProtocol | BackendFactory, onEvent?: EventCallback):
|
|
457
|
+
declare function createEditFileTool(state: DeepAgentState, backend: BackendProtocol | BackendFactory, onEvent?: EventCallback): ai2.Tool<{
|
|
348
458
|
file_path: string;
|
|
349
459
|
old_string: string;
|
|
350
460
|
new_string: string;
|
|
@@ -353,14 +463,14 @@ declare function createEditFileTool(state: DeepAgentState, backend: BackendProto
|
|
|
353
463
|
/**
|
|
354
464
|
* Create the glob tool.
|
|
355
465
|
*/
|
|
356
|
-
declare function createGlobTool(state: DeepAgentState, backend: BackendProtocol | BackendFactory, onEvent?: EventCallback):
|
|
466
|
+
declare function createGlobTool(state: DeepAgentState, backend: BackendProtocol | BackendFactory, onEvent?: EventCallback): ai2.Tool<{
|
|
357
467
|
path: string;
|
|
358
468
|
pattern: string;
|
|
359
469
|
}, string>;
|
|
360
470
|
/**
|
|
361
471
|
* Create the grep tool.
|
|
362
472
|
*/
|
|
363
|
-
declare function createGrepTool(state: DeepAgentState, backend: BackendProtocol | BackendFactory, evictionLimit?: number, onEvent?: EventCallback):
|
|
473
|
+
declare function createGrepTool(state: DeepAgentState, backend: BackendProtocol | BackendFactory, evictionLimit?: number, onEvent?: EventCallback): ai2.Tool<{
|
|
364
474
|
path: string;
|
|
365
475
|
pattern: string;
|
|
366
476
|
glob?: string | null | undefined;
|
|
@@ -383,29 +493,29 @@ interface CreateFilesystemToolsOptions {
|
|
|
383
493
|
* @param onEvent - Optional callback for emitting events (deprecated, use options)
|
|
384
494
|
*/
|
|
385
495
|
declare function createFilesystemTools(state: DeepAgentState, backendOrOptions?: BackendProtocol | BackendFactory | CreateFilesystemToolsOptions, onEvent?: EventCallback): {
|
|
386
|
-
ls:
|
|
496
|
+
ls: ai2.Tool<{
|
|
387
497
|
path: string;
|
|
388
498
|
}, string>;
|
|
389
|
-
read_file:
|
|
499
|
+
read_file: ai2.Tool<{
|
|
390
500
|
file_path: string;
|
|
391
501
|
offset: number;
|
|
392
502
|
limit: number;
|
|
393
503
|
}, string>;
|
|
394
|
-
write_file:
|
|
504
|
+
write_file: ai2.Tool<{
|
|
395
505
|
content: string;
|
|
396
506
|
file_path: string;
|
|
397
507
|
}, string>;
|
|
398
|
-
edit_file:
|
|
508
|
+
edit_file: ai2.Tool<{
|
|
399
509
|
file_path: string;
|
|
400
510
|
old_string: string;
|
|
401
511
|
new_string: string;
|
|
402
512
|
replace_all: boolean;
|
|
403
513
|
}, string>;
|
|
404
|
-
glob:
|
|
514
|
+
glob: ai2.Tool<{
|
|
405
515
|
path: string;
|
|
406
516
|
pattern: string;
|
|
407
517
|
}, string>;
|
|
408
|
-
grep:
|
|
518
|
+
grep: ai2.Tool<{
|
|
409
519
|
path: string;
|
|
410
520
|
pattern: string;
|
|
411
521
|
glob?: string | null | undefined;
|
|
@@ -428,7 +538,7 @@ declare const grep: typeof createGrepTool;
|
|
|
428
538
|
* @param state - The shared agent state
|
|
429
539
|
* @param onEvent - Optional callback for emitting events
|
|
430
540
|
*/
|
|
431
|
-
declare function createTodosTool(state: DeepAgentState, onEvent?: EventCallback):
|
|
541
|
+
declare function createTodosTool(state: DeepAgentState, onEvent?: EventCallback): ai2.Tool<{
|
|
432
542
|
todos: {
|
|
433
543
|
status: "pending" | "in_progress" | "completed" | "cancelled";
|
|
434
544
|
id: string;
|
|
@@ -489,7 +599,7 @@ interface CreateExecuteToolOptions {
|
|
|
489
599
|
* });
|
|
490
600
|
* ```
|
|
491
601
|
*/
|
|
492
|
-
declare function createExecuteTool(options: CreateExecuteToolOptions):
|
|
602
|
+
declare function createExecuteTool(options: CreateExecuteToolOptions): ai2.Tool<{
|
|
493
603
|
command: string;
|
|
494
604
|
}, string>;
|
|
495
605
|
/**
|
|
@@ -507,7 +617,7 @@ declare function createExecuteTool(options: CreateExecuteToolOptions): ai3.Tool<
|
|
|
507
617
|
* };
|
|
508
618
|
* ```
|
|
509
619
|
*/
|
|
510
|
-
declare function createExecuteToolFromBackend(backend: SandboxBackendProtocol):
|
|
620
|
+
declare function createExecuteToolFromBackend(backend: SandboxBackendProtocol): ai2.Tool<{
|
|
511
621
|
command: string;
|
|
512
622
|
}, string>;
|
|
513
623
|
/**
|
|
@@ -641,7 +751,7 @@ interface PrepareStepArgs {
|
|
|
641
751
|
stepNumber: number;
|
|
642
752
|
steps: unknown[];
|
|
643
753
|
model: LanguageModel$2;
|
|
644
|
-
messages:
|
|
754
|
+
messages: ai2.ModelMessage[];
|
|
645
755
|
experimental_context?: unknown;
|
|
646
756
|
}
|
|
647
757
|
/**
|
|
@@ -1224,7 +1334,7 @@ declare class DeepAgent {
|
|
|
1224
1334
|
generate(options: {
|
|
1225
1335
|
prompt: string;
|
|
1226
1336
|
maxSteps?: number;
|
|
1227
|
-
}): Promise<
|
|
1337
|
+
}): Promise<ai2.GenerateTextResult<{}, never> & {
|
|
1228
1338
|
state: DeepAgentState;
|
|
1229
1339
|
}>;
|
|
1230
1340
|
/**
|
|
@@ -1233,7 +1343,7 @@ declare class DeepAgent {
|
|
|
1233
1343
|
stream(options: {
|
|
1234
1344
|
prompt: string;
|
|
1235
1345
|
maxSteps?: number;
|
|
1236
|
-
}): Promise<
|
|
1346
|
+
}): Promise<ai2.StreamTextResult<{}, never> & {
|
|
1237
1347
|
state: DeepAgentState;
|
|
1238
1348
|
}>;
|
|
1239
1349
|
/**
|
|
@@ -1243,7 +1353,7 @@ declare class DeepAgent {
|
|
|
1243
1353
|
prompt: string;
|
|
1244
1354
|
state: DeepAgentState;
|
|
1245
1355
|
maxSteps?: number;
|
|
1246
|
-
}): Promise<
|
|
1356
|
+
}): Promise<ai2.GenerateTextResult<{}, never> & {
|
|
1247
1357
|
state: DeepAgentState;
|
|
1248
1358
|
}>;
|
|
1249
1359
|
/**
|
|
@@ -1496,5 +1606,5 @@ declare class DeepAgent {
|
|
|
1496
1606
|
*/
|
|
1497
1607
|
declare function createDeepAgent(params: CreateDeepAgentParams): DeepAgent;
|
|
1498
1608
|
//#endregion
|
|
1499
|
-
export { createLsTool as $, TextEvent as A,
|
|
1500
|
-
//# sourceMappingURL=agent-
|
|
1609
|
+
export { createLsTool as $, TextEvent as A, isSandboxBackend as At, DynamicApprovalConfig as B, FileWrittenEvent as C, FileDownloadResponse as Ct, StepStartEvent as D, GrepMatch as Dt, StepFinishEvent as E, FileUploadResponse as Et, WebSearchStartEvent as F, ResumeDecision as Ft, createExecuteToolFromBackend as G, SubAgent as H, AgentMemoryOptions as I, ResumeOptions as It, write_todos as J, execute as K, CreateDeepAgentParams as L, ToolCallEvent as M, Checkpoint as Mt, ToolResultEvent as N, CheckpointSaverOptions as Nt, SubagentFinishEvent as O, SandboxBackendProtocol as Ot, WebSearchFinishEvent as P, InterruptData as Pt, createGrepTool as Q, SummarizationConfig as R, FileWriteStartEvent as S, FileData as St, HttpRequestStartEvent as T, FileOperationError as Tt, CreateExecuteToolOptions as U, InterruptOnConfig as V, createExecuteTool as W, createFilesystemTools as X, createEditFileTool as Y, createGlobTool as Z, ExecuteFinishEvent as _, BackendFactory as _t, eventHasStructuredOutput as a, ls as at, FetchUrlStartEvent as b, EditResult as bt, hasStructuredOutput as c, CreateWebToolsOptions as ct, CheckpointLoadedEvent as d, createWebSearchTool as dt, createReadFileTool as et, CheckpointSavedEvent as f, createWebTools as ft, EventCallback as g, web_search as gt, ErrorEvent as h, http_request as ht, StructuredAgentResult as i, grep as it, TodosChangedEvent as j, BaseCheckpointSaver as jt, SubagentStartEvent as k, WriteResult as kt, ApprovalRequestedEvent as l, createFetchUrlTool as lt, DoneEvent as m, htmlToMarkdown as mt, createDeepAgent as n, edit_file as nt, getEventOutput as o, read_file as ot, DeepAgentEvent as p, fetch_url as pt, createTodosTool as q, ModelMessage$1 as r, glob as rt, getStructuredOutput as s, write_file as st, DeepAgent as t, createWriteFileTool as tt, ApprovalResponseEvent as u, createHttpRequestTool as ut, ExecuteStartEvent as v, BackendProtocol as vt, HttpRequestFinishEvent as w, FileInfo as wt, FileEditedEvent as x, ExecuteResponse as xt, FetchUrlFinishEvent as y, DeepAgentState as yt, TodoItem as z };
|
|
1610
|
+
//# sourceMappingURL=agent-DHUp_-Fx.d.mts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as ai2 from "ai";
|
|
2
2
|
import { LanguageModel, LanguageModel as LanguageModel$2, LanguageModelMiddleware, ModelMessage, ModelMessage as ModelMessage$1, StopCondition, ToolLoopAgent, ToolLoopAgentSettings, ToolSet } from "ai";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
|
|
@@ -166,6 +166,68 @@ interface EditResult {
|
|
|
166
166
|
/** Number of replacements made, undefined on failure */
|
|
167
167
|
occurrences?: number;
|
|
168
168
|
}
|
|
169
|
+
/**
|
|
170
|
+
* Standardized error codes for file upload/download operations.
|
|
171
|
+
*
|
|
172
|
+
* These represent common, recoverable errors that an LLM can understand and potentially fix:
|
|
173
|
+
* - "file_not_found": The requested file doesn't exist (download)
|
|
174
|
+
* - "permission_denied": Access denied
|
|
175
|
+
* - "is_directory": Attempted to download a directory as a file
|
|
176
|
+
* - "invalid_path": Path syntax is malformed
|
|
177
|
+
*
|
|
178
|
+
* @example
|
|
179
|
+
* ```typescript
|
|
180
|
+
* type FileError = FileOperationError;
|
|
181
|
+
* // Valid values: "file_not_found" | "permission_denied" | "is_directory" | "invalid_path"
|
|
182
|
+
* ```
|
|
183
|
+
*/
|
|
184
|
+
type FileOperationError = "file_not_found" | "permission_denied" | "is_directory" | "invalid_path";
|
|
185
|
+
/**
|
|
186
|
+
* Result of a single file download operation.
|
|
187
|
+
*
|
|
188
|
+
* The response is designed to allow partial success in batch operations.
|
|
189
|
+
* The errors are standardized using FileOperationError literals.
|
|
190
|
+
*
|
|
191
|
+
* @example Success
|
|
192
|
+
* ```typescript
|
|
193
|
+
* { path: "/app/config.json", content: new Uint8Array(...), error: null }
|
|
194
|
+
* ```
|
|
195
|
+
*
|
|
196
|
+
* @example Failure
|
|
197
|
+
* ```typescript
|
|
198
|
+
* { path: "/wrong/path.txt", content: null, error: "file_not_found" }
|
|
199
|
+
* ```
|
|
200
|
+
*/
|
|
201
|
+
interface FileDownloadResponse {
|
|
202
|
+
/** The file path that was requested */
|
|
203
|
+
path: string;
|
|
204
|
+
/** File contents as bytes on success, null on failure */
|
|
205
|
+
content: Uint8Array | null;
|
|
206
|
+
/** Standardized error code on failure, null on success */
|
|
207
|
+
error: FileOperationError | null;
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Result of a single file upload operation.
|
|
211
|
+
*
|
|
212
|
+
* The response is designed to allow partial success in batch operations.
|
|
213
|
+
* The errors are standardized using FileOperationError literals.
|
|
214
|
+
*
|
|
215
|
+
* @example Success
|
|
216
|
+
* ```typescript
|
|
217
|
+
* { path: "/app/data.txt", error: null }
|
|
218
|
+
* ```
|
|
219
|
+
*
|
|
220
|
+
* @example Failure
|
|
221
|
+
* ```typescript
|
|
222
|
+
* { path: "/readonly/file.txt", error: "permission_denied" }
|
|
223
|
+
* ```
|
|
224
|
+
*/
|
|
225
|
+
interface FileUploadResponse {
|
|
226
|
+
/** The file path that was requested */
|
|
227
|
+
path: string;
|
|
228
|
+
/** Standardized error code on failure, null on success */
|
|
229
|
+
error: FileOperationError | null;
|
|
230
|
+
}
|
|
169
231
|
/**
|
|
170
232
|
* Shared state for deep agent operations.
|
|
171
233
|
* This is passed to tools and modified during execution.
|
|
@@ -236,6 +298,54 @@ interface SandboxBackendProtocol extends BackendProtocol {
|
|
|
236
298
|
* Unique identifier for this sandbox instance.
|
|
237
299
|
*/
|
|
238
300
|
readonly id: string;
|
|
301
|
+
/**
|
|
302
|
+
* Upload multiple files to the sandbox.
|
|
303
|
+
*
|
|
304
|
+
* This API is designed to allow partial success - individual uploads may fail
|
|
305
|
+
* without affecting others. Check the error field in each response.
|
|
306
|
+
*
|
|
307
|
+
* @param files - Array of [path, content] tuples to upload
|
|
308
|
+
* @returns Array of FileUploadResponse objects, one per input file
|
|
309
|
+
*
|
|
310
|
+
* @example
|
|
311
|
+
* ```typescript
|
|
312
|
+
* const responses = await sandbox.uploadFiles([
|
|
313
|
+
* ["/app/config.json", new Uint8Array(b"...")],
|
|
314
|
+
* ["/app/data.txt", new Uint8Array(b"content")],
|
|
315
|
+
* ]);
|
|
316
|
+
* // Check for errors
|
|
317
|
+
* responses.forEach(r => {
|
|
318
|
+
* if (r.error) console.error(`Failed to upload ${r.path}: ${r.error}`);
|
|
319
|
+
* });
|
|
320
|
+
* ```
|
|
321
|
+
*/
|
|
322
|
+
uploadFiles(files: Array<[string, Uint8Array]>): Promise<FileUploadResponse[]>;
|
|
323
|
+
/**
|
|
324
|
+
* Download multiple files from the sandbox.
|
|
325
|
+
*
|
|
326
|
+
* This API is designed to allow partial success - individual downloads may fail
|
|
327
|
+
* without affecting others. Check the error field in each response.
|
|
328
|
+
*
|
|
329
|
+
* @param paths - Array of file paths to download
|
|
330
|
+
* @returns Array of FileDownloadResponse objects, one per input path
|
|
331
|
+
*
|
|
332
|
+
* @example
|
|
333
|
+
* ```typescript
|
|
334
|
+
* const responses = await sandbox.downloadFiles([
|
|
335
|
+
* "/app/config.json",
|
|
336
|
+
* "/app/data.txt",
|
|
337
|
+
* ]);
|
|
338
|
+
* // Process successful downloads
|
|
339
|
+
* for (const r of responses) {
|
|
340
|
+
* if (r.content) {
|
|
341
|
+
* console.log(`Downloaded ${r.path}: ${r.content.length} bytes`);
|
|
342
|
+
* } else if (r.error) {
|
|
343
|
+
* console.error(`Failed to download ${r.path}: ${r.error}`);
|
|
344
|
+
* }
|
|
345
|
+
* }
|
|
346
|
+
* ```
|
|
347
|
+
*/
|
|
348
|
+
downloadFiles(paths: string[]): Promise<FileDownloadResponse[]>;
|
|
239
349
|
}
|
|
240
350
|
/**
|
|
241
351
|
* Type guard to check if a backend is a SandboxBackendProtocol.
|
|
@@ -256,7 +366,7 @@ declare function createWebSearchTool(state: DeepAgentState, options: {
|
|
|
256
366
|
onEvent?: EventCallback;
|
|
257
367
|
toolResultEvictionLimit?: number;
|
|
258
368
|
tavilyApiKey: string;
|
|
259
|
-
}):
|
|
369
|
+
}): ai2.Tool<{
|
|
260
370
|
query: string;
|
|
261
371
|
max_results: number;
|
|
262
372
|
topic: "general" | "news" | "finance";
|
|
@@ -270,7 +380,7 @@ declare function createHttpRequestTool(state: DeepAgentState, options: {
|
|
|
270
380
|
onEvent?: EventCallback;
|
|
271
381
|
toolResultEvictionLimit?: number;
|
|
272
382
|
defaultTimeout: number;
|
|
273
|
-
}):
|
|
383
|
+
}): ai2.Tool<{
|
|
274
384
|
timeout: number;
|
|
275
385
|
url: string;
|
|
276
386
|
method: "GET" | "POST" | "PUT" | "DELETE" | "PATCH";
|
|
@@ -286,7 +396,7 @@ declare function createFetchUrlTool(state: DeepAgentState, options: {
|
|
|
286
396
|
onEvent?: EventCallback;
|
|
287
397
|
toolResultEvictionLimit?: number;
|
|
288
398
|
defaultTimeout: number;
|
|
289
|
-
}):
|
|
399
|
+
}): ai2.Tool<{
|
|
290
400
|
timeout: number;
|
|
291
401
|
url: string;
|
|
292
402
|
extract_article: boolean;
|
|
@@ -323,13 +433,13 @@ declare const fetch_url: typeof createFetchUrlTool;
|
|
|
323
433
|
/**
|
|
324
434
|
* Create the ls tool.
|
|
325
435
|
*/
|
|
326
|
-
declare function createLsTool(state: DeepAgentState, backend: BackendProtocol | BackendFactory, onEvent?: EventCallback):
|
|
436
|
+
declare function createLsTool(state: DeepAgentState, backend: BackendProtocol | BackendFactory, onEvent?: EventCallback): ai2.Tool<{
|
|
327
437
|
path: string;
|
|
328
438
|
}, string>;
|
|
329
439
|
/**
|
|
330
440
|
* Create the read_file tool.
|
|
331
441
|
*/
|
|
332
|
-
declare function createReadFileTool(state: DeepAgentState, backend: BackendProtocol | BackendFactory, evictionLimit?: number, onEvent?: EventCallback):
|
|
442
|
+
declare function createReadFileTool(state: DeepAgentState, backend: BackendProtocol | BackendFactory, evictionLimit?: number, onEvent?: EventCallback): ai2.Tool<{
|
|
333
443
|
file_path: string;
|
|
334
444
|
offset: number;
|
|
335
445
|
limit: number;
|
|
@@ -337,14 +447,14 @@ declare function createReadFileTool(state: DeepAgentState, backend: BackendProto
|
|
|
337
447
|
/**
|
|
338
448
|
* Create the write_file tool.
|
|
339
449
|
*/
|
|
340
|
-
declare function createWriteFileTool(state: DeepAgentState, backend: BackendProtocol | BackendFactory, onEvent?: EventCallback):
|
|
450
|
+
declare function createWriteFileTool(state: DeepAgentState, backend: BackendProtocol | BackendFactory, onEvent?: EventCallback): ai2.Tool<{
|
|
341
451
|
content: string;
|
|
342
452
|
file_path: string;
|
|
343
453
|
}, string>;
|
|
344
454
|
/**
|
|
345
455
|
* Create the edit_file tool.
|
|
346
456
|
*/
|
|
347
|
-
declare function createEditFileTool(state: DeepAgentState, backend: BackendProtocol | BackendFactory, onEvent?: EventCallback):
|
|
457
|
+
declare function createEditFileTool(state: DeepAgentState, backend: BackendProtocol | BackendFactory, onEvent?: EventCallback): ai2.Tool<{
|
|
348
458
|
file_path: string;
|
|
349
459
|
old_string: string;
|
|
350
460
|
new_string: string;
|
|
@@ -353,14 +463,14 @@ declare function createEditFileTool(state: DeepAgentState, backend: BackendProto
|
|
|
353
463
|
/**
|
|
354
464
|
* Create the glob tool.
|
|
355
465
|
*/
|
|
356
|
-
declare function createGlobTool(state: DeepAgentState, backend: BackendProtocol | BackendFactory, onEvent?: EventCallback):
|
|
466
|
+
declare function createGlobTool(state: DeepAgentState, backend: BackendProtocol | BackendFactory, onEvent?: EventCallback): ai2.Tool<{
|
|
357
467
|
path: string;
|
|
358
468
|
pattern: string;
|
|
359
469
|
}, string>;
|
|
360
470
|
/**
|
|
361
471
|
* Create the grep tool.
|
|
362
472
|
*/
|
|
363
|
-
declare function createGrepTool(state: DeepAgentState, backend: BackendProtocol | BackendFactory, evictionLimit?: number, onEvent?: EventCallback):
|
|
473
|
+
declare function createGrepTool(state: DeepAgentState, backend: BackendProtocol | BackendFactory, evictionLimit?: number, onEvent?: EventCallback): ai2.Tool<{
|
|
364
474
|
path: string;
|
|
365
475
|
pattern: string;
|
|
366
476
|
glob?: string | null | undefined;
|
|
@@ -383,29 +493,29 @@ interface CreateFilesystemToolsOptions {
|
|
|
383
493
|
* @param onEvent - Optional callback for emitting events (deprecated, use options)
|
|
384
494
|
*/
|
|
385
495
|
declare function createFilesystemTools(state: DeepAgentState, backendOrOptions?: BackendProtocol | BackendFactory | CreateFilesystemToolsOptions, onEvent?: EventCallback): {
|
|
386
|
-
ls:
|
|
496
|
+
ls: ai2.Tool<{
|
|
387
497
|
path: string;
|
|
388
498
|
}, string>;
|
|
389
|
-
read_file:
|
|
499
|
+
read_file: ai2.Tool<{
|
|
390
500
|
file_path: string;
|
|
391
501
|
offset: number;
|
|
392
502
|
limit: number;
|
|
393
503
|
}, string>;
|
|
394
|
-
write_file:
|
|
504
|
+
write_file: ai2.Tool<{
|
|
395
505
|
content: string;
|
|
396
506
|
file_path: string;
|
|
397
507
|
}, string>;
|
|
398
|
-
edit_file:
|
|
508
|
+
edit_file: ai2.Tool<{
|
|
399
509
|
file_path: string;
|
|
400
510
|
old_string: string;
|
|
401
511
|
new_string: string;
|
|
402
512
|
replace_all: boolean;
|
|
403
513
|
}, string>;
|
|
404
|
-
glob:
|
|
514
|
+
glob: ai2.Tool<{
|
|
405
515
|
path: string;
|
|
406
516
|
pattern: string;
|
|
407
517
|
}, string>;
|
|
408
|
-
grep:
|
|
518
|
+
grep: ai2.Tool<{
|
|
409
519
|
path: string;
|
|
410
520
|
pattern: string;
|
|
411
521
|
glob?: string | null | undefined;
|
|
@@ -428,7 +538,7 @@ declare const grep: typeof createGrepTool;
|
|
|
428
538
|
* @param state - The shared agent state
|
|
429
539
|
* @param onEvent - Optional callback for emitting events
|
|
430
540
|
*/
|
|
431
|
-
declare function createTodosTool(state: DeepAgentState, onEvent?: EventCallback):
|
|
541
|
+
declare function createTodosTool(state: DeepAgentState, onEvent?: EventCallback): ai2.Tool<{
|
|
432
542
|
todos: {
|
|
433
543
|
status: "pending" | "in_progress" | "completed" | "cancelled";
|
|
434
544
|
id: string;
|
|
@@ -489,7 +599,7 @@ interface CreateExecuteToolOptions {
|
|
|
489
599
|
* });
|
|
490
600
|
* ```
|
|
491
601
|
*/
|
|
492
|
-
declare function createExecuteTool(options: CreateExecuteToolOptions):
|
|
602
|
+
declare function createExecuteTool(options: CreateExecuteToolOptions): ai2.Tool<{
|
|
493
603
|
command: string;
|
|
494
604
|
}, string>;
|
|
495
605
|
/**
|
|
@@ -507,7 +617,7 @@ declare function createExecuteTool(options: CreateExecuteToolOptions): ai18.Tool
|
|
|
507
617
|
* };
|
|
508
618
|
* ```
|
|
509
619
|
*/
|
|
510
|
-
declare function createExecuteToolFromBackend(backend: SandboxBackendProtocol):
|
|
620
|
+
declare function createExecuteToolFromBackend(backend: SandboxBackendProtocol): ai2.Tool<{
|
|
511
621
|
command: string;
|
|
512
622
|
}, string>;
|
|
513
623
|
/**
|
|
@@ -641,7 +751,7 @@ interface PrepareStepArgs {
|
|
|
641
751
|
stepNumber: number;
|
|
642
752
|
steps: unknown[];
|
|
643
753
|
model: LanguageModel$2;
|
|
644
|
-
messages:
|
|
754
|
+
messages: ai2.ModelMessage[];
|
|
645
755
|
experimental_context?: unknown;
|
|
646
756
|
}
|
|
647
757
|
/**
|
|
@@ -1224,7 +1334,7 @@ declare class DeepAgent {
|
|
|
1224
1334
|
generate(options: {
|
|
1225
1335
|
prompt: string;
|
|
1226
1336
|
maxSteps?: number;
|
|
1227
|
-
}): Promise<
|
|
1337
|
+
}): Promise<ai2.GenerateTextResult<{}, never> & {
|
|
1228
1338
|
state: DeepAgentState;
|
|
1229
1339
|
}>;
|
|
1230
1340
|
/**
|
|
@@ -1233,7 +1343,7 @@ declare class DeepAgent {
|
|
|
1233
1343
|
stream(options: {
|
|
1234
1344
|
prompt: string;
|
|
1235
1345
|
maxSteps?: number;
|
|
1236
|
-
}): Promise<
|
|
1346
|
+
}): Promise<ai2.StreamTextResult<{}, never> & {
|
|
1237
1347
|
state: DeepAgentState;
|
|
1238
1348
|
}>;
|
|
1239
1349
|
/**
|
|
@@ -1243,7 +1353,7 @@ declare class DeepAgent {
|
|
|
1243
1353
|
prompt: string;
|
|
1244
1354
|
state: DeepAgentState;
|
|
1245
1355
|
maxSteps?: number;
|
|
1246
|
-
}): Promise<
|
|
1356
|
+
}): Promise<ai2.GenerateTextResult<{}, never> & {
|
|
1247
1357
|
state: DeepAgentState;
|
|
1248
1358
|
}>;
|
|
1249
1359
|
/**
|
|
@@ -1496,5 +1606,5 @@ declare class DeepAgent {
|
|
|
1496
1606
|
*/
|
|
1497
1607
|
declare function createDeepAgent(params: CreateDeepAgentParams): DeepAgent;
|
|
1498
1608
|
//#endregion
|
|
1499
|
-
export { createLsTool as $, TextEvent as A,
|
|
1500
|
-
//# sourceMappingURL=agent-
|
|
1609
|
+
export { createLsTool as $, TextEvent as A, isSandboxBackend as At, DynamicApprovalConfig as B, FileWrittenEvent as C, FileDownloadResponse as Ct, StepStartEvent as D, GrepMatch as Dt, StepFinishEvent as E, FileUploadResponse as Et, WebSearchStartEvent as F, ResumeDecision as Ft, createExecuteToolFromBackend as G, SubAgent as H, AgentMemoryOptions as I, ResumeOptions as It, write_todos as J, execute as K, CreateDeepAgentParams as L, ToolCallEvent as M, Checkpoint as Mt, ToolResultEvent as N, CheckpointSaverOptions as Nt, SubagentFinishEvent as O, SandboxBackendProtocol as Ot, WebSearchFinishEvent as P, InterruptData as Pt, createGrepTool as Q, SummarizationConfig as R, FileWriteStartEvent as S, FileData as St, HttpRequestStartEvent as T, FileOperationError as Tt, CreateExecuteToolOptions as U, InterruptOnConfig as V, createExecuteTool as W, createFilesystemTools as X, createEditFileTool as Y, createGlobTool as Z, ExecuteFinishEvent as _, BackendFactory as _t, eventHasStructuredOutput as a, ls as at, FetchUrlStartEvent as b, EditResult as bt, hasStructuredOutput as c, CreateWebToolsOptions as ct, CheckpointLoadedEvent as d, createWebSearchTool as dt, createReadFileTool as et, CheckpointSavedEvent as f, createWebTools as ft, EventCallback as g, web_search as gt, ErrorEvent as h, http_request as ht, StructuredAgentResult as i, grep as it, TodosChangedEvent as j, BaseCheckpointSaver as jt, SubagentStartEvent as k, WriteResult as kt, ApprovalRequestedEvent as l, createFetchUrlTool as lt, DoneEvent as m, htmlToMarkdown as mt, createDeepAgent as n, edit_file as nt, getEventOutput as o, read_file as ot, DeepAgentEvent as p, fetch_url as pt, createTodosTool as q, ModelMessage$1 as r, glob as rt, getStructuredOutput as s, write_file as st, DeepAgent as t, createWriteFileTool as tt, ApprovalResponseEvent as u, createHttpRequestTool as ut, ExecuteStartEvent as v, BackendProtocol as vt, HttpRequestFinishEvent as w, FileInfo as wt, FileEditedEvent as x, ExecuteResponse as xt, FetchUrlFinishEvent as y, DeepAgentState as yt, TodoItem as z };
|
|
1610
|
+
//# sourceMappingURL=agent-tfRthBvX.d.cts.map
|
|
@@ -6,6 +6,7 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
|
6
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
8
|
var __esmMin = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
9
|
+
var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
9
10
|
var __exportAll = (all, symbols) => {
|
|
10
11
|
let target = {};
|
|
11
12
|
for (var name in all) {
|
|
@@ -41,6 +42,12 @@ var __toCommonJS = (mod) => __hasOwnProp.call(mod, "module.exports") ? mod["modu
|
|
|
41
42
|
|
|
42
43
|
//#endregion
|
|
43
44
|
|
|
45
|
+
Object.defineProperty(exports, '__commonJSMin', {
|
|
46
|
+
enumerable: true,
|
|
47
|
+
get: function () {
|
|
48
|
+
return __commonJSMin;
|
|
49
|
+
}
|
|
50
|
+
});
|
|
44
51
|
Object.defineProperty(exports, '__esmMin', {
|
|
45
52
|
enumerable: true,
|
|
46
53
|
get: function () {
|
package/dist/cli/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
|
-
const require_chunk = require('../chunk-
|
|
3
|
-
const require_file_saver = require('../file-saver-
|
|
2
|
+
const require_chunk = require('../chunk-DUZBydyJ.cjs');
|
|
3
|
+
const require_file_saver = require('../file-saver-ZDVH1zHI.cjs');
|
|
4
4
|
let react = require("react");
|
|
5
5
|
react = require_chunk.__toESM(react);
|
|
6
6
|
let ink = require("ink");
|