deepagentsdk 0.13.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 +322 -82
- package/dist/adapters/elements/index.cjs.map +1 -1
- package/dist/adapters/elements/index.d.cts +28 -3
- package/dist/adapters/elements/index.d.mts +28 -3
- package/dist/adapters/elements/index.mjs +321 -82
- package/dist/adapters/elements/index.mjs.map +1 -1
- package/dist/{agent-BDM-PIu8.d.mts → agent-DHUp_-Fx.d.mts} +114 -4
- package/dist/{agent-DToEVxs-.d.cts → agent-tfRthBvX.d.cts} +114 -4
- 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 +299 -2
- 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
|
@@ -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.
|
|
@@ -338,8 +448,8 @@ declare function createReadFileTool(state: DeepAgentState, backend: BackendProto
|
|
|
338
448
|
* Create the write_file tool.
|
|
339
449
|
*/
|
|
340
450
|
declare function createWriteFileTool(state: DeepAgentState, backend: BackendProtocol | BackendFactory, onEvent?: EventCallback): ai2.Tool<{
|
|
341
|
-
file_path: string;
|
|
342
451
|
content: string;
|
|
452
|
+
file_path: string;
|
|
343
453
|
}, string>;
|
|
344
454
|
/**
|
|
345
455
|
* Create the edit_file tool.
|
|
@@ -392,8 +502,8 @@ declare function createFilesystemTools(state: DeepAgentState, backendOrOptions?:
|
|
|
392
502
|
limit: number;
|
|
393
503
|
}, string>;
|
|
394
504
|
write_file: ai2.Tool<{
|
|
395
|
-
file_path: string;
|
|
396
505
|
content: string;
|
|
506
|
+
file_path: string;
|
|
397
507
|
}, string>;
|
|
398
508
|
edit_file: ai2.Tool<{
|
|
399
509
|
file_path: string;
|
|
@@ -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
|
|
@@ -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.
|
|
@@ -338,8 +448,8 @@ declare function createReadFileTool(state: DeepAgentState, backend: BackendProto
|
|
|
338
448
|
* Create the write_file tool.
|
|
339
449
|
*/
|
|
340
450
|
declare function createWriteFileTool(state: DeepAgentState, backend: BackendProtocol | BackendFactory, onEvent?: EventCallback): ai2.Tool<{
|
|
341
|
-
file_path: string;
|
|
342
451
|
content: string;
|
|
452
|
+
file_path: string;
|
|
343
453
|
}, string>;
|
|
344
454
|
/**
|
|
345
455
|
* Create the edit_file tool.
|
|
@@ -392,8 +502,8 @@ declare function createFilesystemTools(state: DeepAgentState, backendOrOptions?:
|
|
|
392
502
|
limit: number;
|
|
393
503
|
}, string>;
|
|
394
504
|
write_file: ai2.Tool<{
|
|
395
|
-
file_path: string;
|
|
396
505
|
content: string;
|
|
506
|
+
file_path: string;
|
|
397
507
|
}, string>;
|
|
398
508
|
edit_file: ai2.Tool<{
|
|
399
509
|
file_path: string;
|
|
@@ -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");
|
package/dist/cli/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
|
-
import { St as init_limits, _t as DEFAULT_EVICTION_TOKEN_LIMIT, bt as DEFAULT_SUMMARIZATION_THRESHOLD, gt as CONTEXT_WINDOW, l as estimateMessagesTokens, n as parseModelString, o as createDeepAgent, r as LocalSandbox, t as FileSaver, vt as DEFAULT_KEEP_MESSAGES } from "../file-saver-
|
|
2
|
+
import { St as init_limits, _t as DEFAULT_EVICTION_TOKEN_LIMIT, bt as DEFAULT_SUMMARIZATION_THRESHOLD, gt as CONTEXT_WINDOW, l as estimateMessagesTokens, n as parseModelString, o as createDeepAgent, r as LocalSandbox, t as FileSaver, vt as DEFAULT_KEEP_MESSAGES } from "../file-saver-CQWTIr8z.mjs";
|
|
3
3
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
4
4
|
import { Box, Text, render, useApp, useInput } from "ink";
|
|
5
5
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
1
2
|
import { Output, ToolLoopAgent, generateText, stepCountIs, streamText, tool, wrapLanguageModel } from "ai";
|
|
2
3
|
import { z } from "zod";
|
|
3
4
|
import micromatch from "micromatch";
|
|
@@ -18,6 +19,7 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
18
19
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
19
20
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
20
21
|
var __esmMin = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
22
|
+
var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
21
23
|
var __exportAll = (all, symbols) => {
|
|
22
24
|
let target = {};
|
|
23
25
|
for (var name in all) {
|
|
@@ -46,6 +48,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
46
48
|
return to;
|
|
47
49
|
};
|
|
48
50
|
var __toCommonJS = (mod) => __hasOwnProp.call(mod, "module.exports") ? mod["module.exports"] : __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
51
|
+
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
49
52
|
|
|
50
53
|
//#endregion
|
|
51
54
|
//#region src/constants/limits.ts
|
|
@@ -233,7 +236,7 @@ var init_events = __esmMin((() => {}));
|
|
|
233
236
|
* Type guard to check if a backend is a SandboxBackendProtocol.
|
|
234
237
|
*/
|
|
235
238
|
function isSandboxBackend(backend) {
|
|
236
|
-
return typeof backend.execute === "function" && typeof backend.id === "string";
|
|
239
|
+
return typeof backend.execute === "function" && typeof backend.uploadFiles === "function" && typeof backend.downloadFiles === "function" && typeof backend.id === "string";
|
|
237
240
|
}
|
|
238
241
|
|
|
239
242
|
//#endregion
|
|
@@ -2321,7 +2324,7 @@ var DeepAgent = class {
|
|
|
2321
2324
|
* Supports both legacy skillsDir and new agentId modes.
|
|
2322
2325
|
*/
|
|
2323
2326
|
async loadSkills(options) {
|
|
2324
|
-
const { listSkills } = await import("./load-
|
|
2327
|
+
const { listSkills } = await import("./load-DRzSpESX.mjs");
|
|
2325
2328
|
this.skillsMetadata = (await listSkills(options.agentId ? { agentId: options.agentId } : { projectSkillsDir: options.skillsDir })).map((s) => ({
|
|
2326
2329
|
name: s.name,
|
|
2327
2330
|
description: s.description,
|
|
@@ -2920,6 +2923,18 @@ function createDeepAgent(params) {
|
|
|
2920
2923
|
init_errors();
|
|
2921
2924
|
init_limits();
|
|
2922
2925
|
/**
|
|
2926
|
+
* Map error messages to FileOperationError literals.
|
|
2927
|
+
*
|
|
2928
|
+
* This provides structured error handling that LLMs can understand and potentially fix.
|
|
2929
|
+
*/
|
|
2930
|
+
function mapErrorToOperationError(errorMessage, path) {
|
|
2931
|
+
const lowerError = errorMessage.toLowerCase();
|
|
2932
|
+
if (lowerError.includes("no such file") || lowerError.includes("not found") || lowerError.includes("cannot find")) return "file_not_found";
|
|
2933
|
+
if (lowerError.includes("permission denied") || lowerError.includes("access denied") || lowerError.includes("read-only")) return "permission_denied";
|
|
2934
|
+
if (lowerError.includes("is a directory") || lowerError.includes("directory not empty")) return "is_directory";
|
|
2935
|
+
return "invalid_path";
|
|
2936
|
+
}
|
|
2937
|
+
/**
|
|
2923
2938
|
* Encode string to base64 for safe shell transmission.
|
|
2924
2939
|
*/
|
|
2925
2940
|
function toBase64(str) {
|
|
@@ -2958,6 +2973,74 @@ function buildNodeScript(script, args) {
|
|
|
2958
2973
|
* ```
|
|
2959
2974
|
*/
|
|
2960
2975
|
var BaseSandbox = class {
|
|
2976
|
+
/**
|
|
2977
|
+
* Upload multiple files to the sandbox.
|
|
2978
|
+
*
|
|
2979
|
+
* Default implementation uses base64 encoding via shell commands.
|
|
2980
|
+
* Subclasses can override if they have a native file upload API.
|
|
2981
|
+
*
|
|
2982
|
+
* This API is designed to allow partial success - individual uploads may fail
|
|
2983
|
+
* without affecting others. Check the error field in each response.
|
|
2984
|
+
*/
|
|
2985
|
+
async uploadFiles(files) {
|
|
2986
|
+
const responses = [];
|
|
2987
|
+
for (const [path, content] of files) try {
|
|
2988
|
+
const base64Content = Buffer.from(content).toString("base64");
|
|
2989
|
+
const escapedPath = path.replace(/'/g, "'\\''");
|
|
2990
|
+
const result = await this.execute(`echo '${base64Content}' | base64 -d > '${escapedPath}'`);
|
|
2991
|
+
if (result.exitCode !== 0) responses.push({
|
|
2992
|
+
path,
|
|
2993
|
+
error: mapErrorToOperationError(result.output, path)
|
|
2994
|
+
});
|
|
2995
|
+
else responses.push({
|
|
2996
|
+
path,
|
|
2997
|
+
error: null
|
|
2998
|
+
});
|
|
2999
|
+
} catch (error) {
|
|
3000
|
+
responses.push({
|
|
3001
|
+
path,
|
|
3002
|
+
error: "permission_denied"
|
|
3003
|
+
});
|
|
3004
|
+
}
|
|
3005
|
+
return responses;
|
|
3006
|
+
}
|
|
3007
|
+
/**
|
|
3008
|
+
* Download multiple files from the sandbox.
|
|
3009
|
+
*
|
|
3010
|
+
* Default implementation uses base64 encoding via shell commands.
|
|
3011
|
+
* Subclasses can override if they have a native file download API.
|
|
3012
|
+
*
|
|
3013
|
+
* This API is designed to allow partial success - individual downloads may fail
|
|
3014
|
+
* without affecting others. Check the error field in each response.
|
|
3015
|
+
*/
|
|
3016
|
+
async downloadFiles(paths) {
|
|
3017
|
+
const responses = [];
|
|
3018
|
+
for (const path of paths) try {
|
|
3019
|
+
const escapedPath = path.replace(/'/g, "'\\''");
|
|
3020
|
+
const result = await this.execute(`base64 '${escapedPath}'`);
|
|
3021
|
+
if (result.exitCode !== 0) responses.push({
|
|
3022
|
+
path,
|
|
3023
|
+
content: null,
|
|
3024
|
+
error: mapErrorToOperationError(result.output, path)
|
|
3025
|
+
});
|
|
3026
|
+
else {
|
|
3027
|
+
const base64Content = result.output.trim();
|
|
3028
|
+
const content = Buffer.from(base64Content, "base64");
|
|
3029
|
+
responses.push({
|
|
3030
|
+
path,
|
|
3031
|
+
content,
|
|
3032
|
+
error: null
|
|
3033
|
+
});
|
|
3034
|
+
}
|
|
3035
|
+
} catch (error) {
|
|
3036
|
+
responses.push({
|
|
3037
|
+
path,
|
|
3038
|
+
content: null,
|
|
3039
|
+
error: "permission_denied"
|
|
3040
|
+
});
|
|
3041
|
+
}
|
|
3042
|
+
return responses;
|
|
3043
|
+
}
|
|
2961
3044
|
/**
|
|
2962
3045
|
* List files and directories in a path.
|
|
2963
3046
|
*/
|
|
@@ -3564,5 +3647,5 @@ var FileSaver = class {
|
|
|
3564
3647
|
};
|
|
3565
3648
|
|
|
3566
3649
|
//#endregion
|
|
3567
|
-
export { grepMatchesFromFiles as $, createGrepTool as A, DEFAULT_EVICTION_TOKEN_LIMIT as B, htmlToMarkdown as C, createEditFileTool as D, web_search as E, glob as F, shouldEvict as G, estimateTokens as H, grep as I, createFileData as J, StateBackend as K, ls as L, createReadFileTool as M, createWriteFileTool as N, createFilesystemTools as O, edit_file as P, globSearchFiles as Q, read_file as R, fetch_url as S, init_limits as St, init_web as T, evictToolResult as U, createToolResultWrapper as V, init_eviction as W, formatContentWithLineNumbers as X, fileDataToString as Y, formatReadResponse as Z, execute as _, DEFAULT_EVICTION_TOKEN_LIMIT$1 as _t, DeepAgent as a, createTodosTool as at, createWebSearchTool as b, DEFAULT_SUMMARIZATION_THRESHOLD$1 as bt, DEFAULT_SUMMARIZATION_THRESHOLD as c, DEFAULT_GENERAL_PURPOSE_DESCRIPTION as ct, summarizeIfNeeded as d, FILESYSTEM_SYSTEM_PROMPT as dt, performStringReplacement as et, hasDanglingToolCalls as f, TASK_SYSTEM_PROMPT as ft, createExecuteToolFromBackend as g, CONTEXT_WINDOW as gt, createExecuteTool as h, isSandboxBackend as ht, BaseSandbox as i, init_errors as it, createLsTool as j, createGlobTool as k, estimateMessagesTokens as l, DEFAULT_SUBAGENT_PROMPT as lt, createSubagentTool as m, getTaskToolDescription as mt, parseModelString as n, FILE_ALREADY_EXISTS as nt, createDeepAgent as o, write_todos as ot, patchToolCalls as p, TODO_SYSTEM_PROMPT as pt, checkEmptyContent as q, LocalSandbox as r, FILE_NOT_FOUND as rt, DEFAULT_KEEP_MESSAGES as s, BASE_PROMPT as st, FileSaver as t, updateFileData as tt, needsSummarization as u, EXECUTE_SYSTEM_PROMPT as ut, createFetchUrlTool as v, DEFAULT_KEEP_MESSAGES$1 as vt, http_request as w, createWebTools as x, MAX_FILE_SIZE_MB as xt, createHttpRequestTool as y, DEFAULT_READ_LIMIT as yt, write_file as z };
|
|
3568
|
-
//# sourceMappingURL=file-saver-
|
|
3650
|
+
export { grepMatchesFromFiles as $, createGrepTool as A, DEFAULT_EVICTION_TOKEN_LIMIT as B, htmlToMarkdown as C, __commonJSMin as Ct, createEditFileTool as D, __toCommonJS as Dt, web_search as E, __require as Et, glob as F, shouldEvict as G, estimateTokens as H, grep as I, createFileData as J, StateBackend as K, ls as L, createReadFileTool as M, createWriteFileTool as N, createFilesystemTools as O, edit_file as P, globSearchFiles as Q, read_file as R, fetch_url as S, init_limits as St, init_web as T, __exportAll as Tt, evictToolResult as U, createToolResultWrapper as V, init_eviction as W, formatContentWithLineNumbers as X, fileDataToString as Y, formatReadResponse as Z, execute as _, DEFAULT_EVICTION_TOKEN_LIMIT$1 as _t, DeepAgent as a, createTodosTool as at, createWebSearchTool as b, DEFAULT_SUMMARIZATION_THRESHOLD$1 as bt, DEFAULT_SUMMARIZATION_THRESHOLD as c, DEFAULT_GENERAL_PURPOSE_DESCRIPTION as ct, summarizeIfNeeded as d, FILESYSTEM_SYSTEM_PROMPT as dt, performStringReplacement as et, hasDanglingToolCalls as f, TASK_SYSTEM_PROMPT as ft, createExecuteToolFromBackend as g, CONTEXT_WINDOW as gt, createExecuteTool as h, isSandboxBackend as ht, BaseSandbox as i, init_errors as it, createLsTool as j, createGlobTool as k, estimateMessagesTokens as l, DEFAULT_SUBAGENT_PROMPT as lt, createSubagentTool as m, getTaskToolDescription as mt, parseModelString as n, FILE_ALREADY_EXISTS as nt, createDeepAgent as o, write_todos as ot, patchToolCalls as p, TODO_SYSTEM_PROMPT as pt, checkEmptyContent as q, LocalSandbox as r, FILE_NOT_FOUND as rt, DEFAULT_KEEP_MESSAGES as s, BASE_PROMPT as st, FileSaver as t, updateFileData as tt, needsSummarization as u, EXECUTE_SYSTEM_PROMPT as ut, createFetchUrlTool as v, DEFAULT_KEEP_MESSAGES$1 as vt, http_request as w, __esmMin as wt, createWebTools as x, MAX_FILE_SIZE_MB as xt, createHttpRequestTool as y, DEFAULT_READ_LIMIT as yt, write_file as z };
|
|
3651
|
+
//# sourceMappingURL=file-saver-CQWTIr8z.mjs.map
|