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.
@@ -1,4 +1,4 @@
1
- const require_chunk = require('../../chunk-C5azi7Hr.cjs');
1
+ const require_chunk = require('../../chunk-DUZBydyJ.cjs');
2
2
  let ai = require("ai");
3
3
 
4
4
  //#region src/adapters/elements/createElementsRouteHandler.ts
@@ -1,4 +1,4 @@
1
- import { p as DeepAgentEvent, r as ModelMessage$1, t as DeepAgent, yt as DeepAgentState } from "../../agent-DwAj5emJ.cjs";
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-D0bKkNI-.mjs";
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 ai3 from "ai";
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
- }): ai3.Tool<{
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
- }): ai3.Tool<{
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
- }): ai3.Tool<{
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): ai3.Tool<{
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): ai3.Tool<{
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): ai3.Tool<{
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): ai3.Tool<{
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): ai3.Tool<{
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): ai3.Tool<{
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: ai3.Tool<{
496
+ ls: ai2.Tool<{
387
497
  path: string;
388
498
  }, string>;
389
- read_file: ai3.Tool<{
499
+ read_file: ai2.Tool<{
390
500
  file_path: string;
391
501
  offset: number;
392
502
  limit: number;
393
503
  }, string>;
394
- write_file: ai3.Tool<{
504
+ write_file: ai2.Tool<{
395
505
  content: string;
396
506
  file_path: string;
397
507
  }, string>;
398
- edit_file: ai3.Tool<{
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: ai3.Tool<{
514
+ glob: ai2.Tool<{
405
515
  path: string;
406
516
  pattern: string;
407
517
  }, string>;
408
- grep: ai3.Tool<{
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): ai3.Tool<{
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): ai3.Tool<{
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): ai3.Tool<{
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: ai3.ModelMessage[];
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<ai3.GenerateTextResult<{}, never> & {
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<ai3.StreamTextResult<{}, never> & {
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<ai3.GenerateTextResult<{}, never> & {
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, CheckpointSaverOptions as At, DynamicApprovalConfig as B, FileWrittenEvent as C, FileInfo as Ct, StepStartEvent as D, isSandboxBackend as Dt, StepFinishEvent as E, WriteResult as Et, WebSearchStartEvent as F, createExecuteToolFromBackend as G, SubAgent as H, AgentMemoryOptions as I, write_todos as J, execute as K, CreateDeepAgentParams as L, ToolCallEvent as M, ResumeDecision as Mt, ToolResultEvent as N, ResumeOptions as Nt, SubagentFinishEvent as O, BaseCheckpointSaver as Ot, WebSearchFinishEvent as P, createGrepTool as Q, SummarizationConfig as R, FileWriteStartEvent as S, FileData as St, HttpRequestStartEvent as T, SandboxBackendProtocol 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, InterruptData as jt, SubagentStartEvent as k, Checkpoint 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, GrepMatch as wt, FileEditedEvent as x, ExecuteResponse as xt, FetchUrlFinishEvent as y, DeepAgentState as yt, TodoItem as z };
1500
- //# sourceMappingURL=agent-D0bKkNI-.d.mts.map
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 ai18 from "ai";
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
- }): ai18.Tool<{
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
- }): ai18.Tool<{
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
- }): ai18.Tool<{
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): ai18.Tool<{
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): ai18.Tool<{
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): ai18.Tool<{
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): ai18.Tool<{
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): ai18.Tool<{
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): ai18.Tool<{
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: ai18.Tool<{
496
+ ls: ai2.Tool<{
387
497
  path: string;
388
498
  }, string>;
389
- read_file: ai18.Tool<{
499
+ read_file: ai2.Tool<{
390
500
  file_path: string;
391
501
  offset: number;
392
502
  limit: number;
393
503
  }, string>;
394
- write_file: ai18.Tool<{
504
+ write_file: ai2.Tool<{
395
505
  content: string;
396
506
  file_path: string;
397
507
  }, string>;
398
- edit_file: ai18.Tool<{
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: ai18.Tool<{
514
+ glob: ai2.Tool<{
405
515
  path: string;
406
516
  pattern: string;
407
517
  }, string>;
408
- grep: ai18.Tool<{
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): ai18.Tool<{
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): ai18.Tool<{
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): ai18.Tool<{
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: ai18.ModelMessage[];
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<ai18.GenerateTextResult<{}, never> & {
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<ai18.StreamTextResult<{}, never> & {
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<ai18.GenerateTextResult<{}, never> & {
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, CheckpointSaverOptions as At, DynamicApprovalConfig as B, FileWrittenEvent as C, FileInfo as Ct, StepStartEvent as D, isSandboxBackend as Dt, StepFinishEvent as E, WriteResult as Et, WebSearchStartEvent as F, createExecuteToolFromBackend as G, SubAgent as H, AgentMemoryOptions as I, write_todos as J, execute as K, CreateDeepAgentParams as L, ToolCallEvent as M, ResumeDecision as Mt, ToolResultEvent as N, ResumeOptions as Nt, SubagentFinishEvent as O, BaseCheckpointSaver as Ot, WebSearchFinishEvent as P, createGrepTool as Q, SummarizationConfig as R, FileWriteStartEvent as S, FileData as St, HttpRequestStartEvent as T, SandboxBackendProtocol 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, InterruptData as jt, SubagentStartEvent as k, Checkpoint 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, GrepMatch as wt, FileEditedEvent as x, ExecuteResponse as xt, FetchUrlFinishEvent as y, DeepAgentState as yt, TodoItem as z };
1500
- //# sourceMappingURL=agent-DwAj5emJ.d.cts.map
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 () {
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env bun
2
- const require_chunk = require('../chunk-C5azi7Hr.cjs');
3
- const require_file_saver = require('../file-saver-BYPKakT4.cjs');
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");