@dexto/tools-filesystem 1.6.0 → 1.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/directory-approval.cjs +44 -40
- package/dist/directory-approval.d.ts +8 -4
- package/dist/directory-approval.d.ts.map +1 -1
- package/dist/directory-approval.integration.test.cjs +107 -356
- package/dist/directory-approval.integration.test.d.ts +6 -6
- package/dist/directory-approval.integration.test.js +109 -360
- package/dist/directory-approval.js +45 -41
- package/dist/edit-file-tool.cjs +69 -47
- package/dist/edit-file-tool.d.ts.map +1 -1
- package/dist/edit-file-tool.js +77 -48
- package/dist/edit-file-tool.test.cjs +54 -11
- package/dist/edit-file-tool.test.js +54 -11
- package/dist/error-codes.cjs +4 -0
- package/dist/error-codes.d.ts +4 -0
- package/dist/error-codes.d.ts.map +1 -1
- package/dist/error-codes.js +4 -0
- package/dist/errors.cjs +48 -0
- package/dist/errors.d.ts +16 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +48 -0
- package/dist/filesystem-service.cjs +307 -9
- package/dist/filesystem-service.d.ts +28 -1
- package/dist/filesystem-service.d.ts.map +1 -1
- package/dist/filesystem-service.js +308 -10
- package/dist/glob-files-tool.cjs +12 -1
- package/dist/glob-files-tool.d.ts.map +1 -1
- package/dist/glob-files-tool.js +13 -2
- package/dist/grep-content-tool.cjs +13 -1
- package/dist/grep-content-tool.d.ts.map +1 -1
- package/dist/grep-content-tool.js +14 -2
- package/dist/index.cjs +3 -0
- package/dist/index.d.cts +852 -16
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/path-validator.cjs +28 -2
- package/dist/path-validator.d.ts +14 -0
- package/dist/path-validator.d.ts.map +1 -1
- package/dist/path-validator.js +28 -2
- package/dist/read-file-tool.cjs +7 -1
- package/dist/read-file-tool.d.ts.map +1 -1
- package/dist/read-file-tool.js +8 -2
- package/dist/tool-factory.cjs +21 -0
- package/dist/tool-factory.d.ts.map +1 -1
- package/dist/tool-factory.js +21 -0
- package/dist/types.d.ts +65 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/write-file-tool.cjs +60 -38
- package/dist/write-file-tool.d.ts +1 -1
- package/dist/write-file-tool.d.ts.map +1 -1
- package/dist/write-file-tool.js +67 -39
- package/dist/write-file-tool.test.cjs +75 -13
- package/dist/write-file-tool.test.js +75 -13
- package/package.json +4 -4
- package/dist/directory-approval.d.cts +0 -22
- package/dist/directory-approval.integration.test.d.cts +0 -2
- package/dist/edit-file-tool.d.cts +0 -34
- package/dist/edit-file-tool.test.d.cts +0 -2
- package/dist/error-codes.d.cts +0 -32
- package/dist/errors.d.cts +0 -112
- package/dist/file-tool-types.d.cts +0 -18
- package/dist/filesystem-service.d.cts +0 -117
- package/dist/filesystem-service.test.d.cts +0 -2
- package/dist/glob-files-tool.d.cts +0 -31
- package/dist/grep-content-tool.d.cts +0 -40
- package/dist/path-validator.d.cts +0 -97
- package/dist/path-validator.test.d.cts +0 -2
- package/dist/read-file-tool.d.cts +0 -31
- package/dist/tool-factory-config.d.cts +0 -63
- package/dist/tool-factory.d.cts +0 -7
- package/dist/types.d.cts +0 -178
- package/dist/write-file-tool.d.cts +0 -34
- package/dist/write-file-tool.test.d.cts +0 -2
package/dist/error-codes.d.ts
CHANGED
|
@@ -16,7 +16,11 @@ export declare enum FileSystemErrorCode {
|
|
|
16
16
|
FILE_TOO_LARGE = "FILESYSTEM_FILE_TOO_LARGE",
|
|
17
17
|
TOO_MANY_RESULTS = "FILESYSTEM_TOO_MANY_RESULTS",
|
|
18
18
|
READ_FAILED = "FILESYSTEM_READ_FAILED",
|
|
19
|
+
LIST_FAILED = "FILESYSTEM_LIST_FAILED",
|
|
19
20
|
WRITE_FAILED = "FILESYSTEM_WRITE_FAILED",
|
|
21
|
+
CREATE_DIR_FAILED = "FILESYSTEM_CREATE_DIR_FAILED",
|
|
22
|
+
DELETE_FAILED = "FILESYSTEM_DELETE_FAILED",
|
|
23
|
+
RENAME_FAILED = "FILESYSTEM_RENAME_FAILED",
|
|
20
24
|
BACKUP_FAILED = "FILESYSTEM_BACKUP_FAILED",
|
|
21
25
|
EDIT_FAILED = "FILESYSTEM_EDIT_FAILED",
|
|
22
26
|
STRING_NOT_UNIQUE = "FILESYSTEM_STRING_NOT_UNIQUE",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error-codes.d.ts","sourceRoot":"","sources":["../src/error-codes.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,oBAAY,mBAAmB;IAE3B,cAAc,8BAA8B;IAC5C,mBAAmB,mCAAmC;IAGtD,iBAAiB,iCAAiC;IAClD,gBAAgB,gCAAgC;IAChD,YAAY,4BAA4B;IAGxC,YAAY,4BAA4B;IACxC,uBAAuB,uCAAuC;IAC9D,sBAAsB,sCAAsC;IAC5D,gBAAgB,gCAAgC;IAGhD,cAAc,8BAA8B;IAC5C,gBAAgB,gCAAgC;IAGhD,WAAW,2BAA2B;IACtC,YAAY,4BAA4B;IACxC,aAAa,6BAA6B;IAC1C,WAAW,2BAA2B;IACtC,iBAAiB,iCAAiC;IAClD,gBAAgB,gCAAgC;IAGhD,WAAW,2BAA2B;IACtC,aAAa,6BAA6B;IAC1C,eAAe,+BAA+B;IAC9C,aAAa,6BAA6B;IAG1C,cAAc,8BAA8B;IAC5C,uBAAuB,uCAAuC;CACjE"}
|
|
1
|
+
{"version":3,"file":"error-codes.d.ts","sourceRoot":"","sources":["../src/error-codes.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,oBAAY,mBAAmB;IAE3B,cAAc,8BAA8B;IAC5C,mBAAmB,mCAAmC;IAGtD,iBAAiB,iCAAiC;IAClD,gBAAgB,gCAAgC;IAChD,YAAY,4BAA4B;IAGxC,YAAY,4BAA4B;IACxC,uBAAuB,uCAAuC;IAC9D,sBAAsB,sCAAsC;IAC5D,gBAAgB,gCAAgC;IAGhD,cAAc,8BAA8B;IAC5C,gBAAgB,gCAAgC;IAGhD,WAAW,2BAA2B;IACtC,WAAW,2BAA2B;IACtC,YAAY,4BAA4B;IACxC,iBAAiB,iCAAiC;IAClD,aAAa,6BAA6B;IAC1C,aAAa,6BAA6B;IAC1C,aAAa,6BAA6B;IAC1C,WAAW,2BAA2B;IACtC,iBAAiB,iCAAiC;IAClD,gBAAgB,gCAAgC;IAGhD,WAAW,2BAA2B;IACtC,aAAa,6BAA6B;IAC1C,eAAe,+BAA+B;IAC9C,aAAa,6BAA6B;IAG1C,cAAc,8BAA8B;IAC5C,uBAAuB,uCAAuC;CACjE"}
|
package/dist/error-codes.js
CHANGED
|
@@ -11,7 +11,11 @@ var FileSystemErrorCode = /* @__PURE__ */ ((FileSystemErrorCode2) => {
|
|
|
11
11
|
FileSystemErrorCode2["FILE_TOO_LARGE"] = "FILESYSTEM_FILE_TOO_LARGE";
|
|
12
12
|
FileSystemErrorCode2["TOO_MANY_RESULTS"] = "FILESYSTEM_TOO_MANY_RESULTS";
|
|
13
13
|
FileSystemErrorCode2["READ_FAILED"] = "FILESYSTEM_READ_FAILED";
|
|
14
|
+
FileSystemErrorCode2["LIST_FAILED"] = "FILESYSTEM_LIST_FAILED";
|
|
14
15
|
FileSystemErrorCode2["WRITE_FAILED"] = "FILESYSTEM_WRITE_FAILED";
|
|
16
|
+
FileSystemErrorCode2["CREATE_DIR_FAILED"] = "FILESYSTEM_CREATE_DIR_FAILED";
|
|
17
|
+
FileSystemErrorCode2["DELETE_FAILED"] = "FILESYSTEM_DELETE_FAILED";
|
|
18
|
+
FileSystemErrorCode2["RENAME_FAILED"] = "FILESYSTEM_RENAME_FAILED";
|
|
15
19
|
FileSystemErrorCode2["BACKUP_FAILED"] = "FILESYSTEM_BACKUP_FAILED";
|
|
16
20
|
FileSystemErrorCode2["EDIT_FAILED"] = "FILESYSTEM_EDIT_FAILED";
|
|
17
21
|
FileSystemErrorCode2["STRING_NOT_UNIQUE"] = "FILESYSTEM_STRING_NOT_UNIQUE";
|
package/dist/errors.cjs
CHANGED
|
@@ -161,6 +161,54 @@ class FileSystemError {
|
|
|
161
161
|
{ path, cause }
|
|
162
162
|
);
|
|
163
163
|
}
|
|
164
|
+
/**
|
|
165
|
+
* List directory operation failed
|
|
166
|
+
*/
|
|
167
|
+
static listFailed(path, cause) {
|
|
168
|
+
return new import_core.DextoRuntimeError(
|
|
169
|
+
import_error_codes.FileSystemErrorCode.LIST_FAILED,
|
|
170
|
+
FILESYSTEM_SCOPE,
|
|
171
|
+
import_core.ErrorType.SYSTEM,
|
|
172
|
+
`Failed to list directory: ${path}. ${cause}`,
|
|
173
|
+
{ path, cause }
|
|
174
|
+
);
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Create directory operation failed
|
|
178
|
+
*/
|
|
179
|
+
static createDirFailed(path, cause) {
|
|
180
|
+
return new import_core.DextoRuntimeError(
|
|
181
|
+
import_error_codes.FileSystemErrorCode.CREATE_DIR_FAILED,
|
|
182
|
+
FILESYSTEM_SCOPE,
|
|
183
|
+
import_core.ErrorType.SYSTEM,
|
|
184
|
+
`Failed to create directory: ${path}. ${cause}`,
|
|
185
|
+
{ path, cause }
|
|
186
|
+
);
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Delete operation failed
|
|
190
|
+
*/
|
|
191
|
+
static deleteFailed(path, cause) {
|
|
192
|
+
return new import_core.DextoRuntimeError(
|
|
193
|
+
import_error_codes.FileSystemErrorCode.DELETE_FAILED,
|
|
194
|
+
FILESYSTEM_SCOPE,
|
|
195
|
+
import_core.ErrorType.SYSTEM,
|
|
196
|
+
`Failed to delete path: ${path}. ${cause}`,
|
|
197
|
+
{ path, cause }
|
|
198
|
+
);
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Rename operation failed
|
|
202
|
+
*/
|
|
203
|
+
static renameFailed(path, cause) {
|
|
204
|
+
return new import_core.DextoRuntimeError(
|
|
205
|
+
import_error_codes.FileSystemErrorCode.RENAME_FAILED,
|
|
206
|
+
FILESYSTEM_SCOPE,
|
|
207
|
+
import_core.ErrorType.SYSTEM,
|
|
208
|
+
`Failed to rename path: ${path}. ${cause}`,
|
|
209
|
+
{ path, cause }
|
|
210
|
+
);
|
|
211
|
+
}
|
|
164
212
|
/**
|
|
165
213
|
* Write operation failed
|
|
166
214
|
*/
|
package/dist/errors.d.ts
CHANGED
|
@@ -61,6 +61,22 @@ export declare class FileSystemError {
|
|
|
61
61
|
* Read operation failed
|
|
62
62
|
*/
|
|
63
63
|
static readFailed(path: string, cause: string): DextoRuntimeError;
|
|
64
|
+
/**
|
|
65
|
+
* List directory operation failed
|
|
66
|
+
*/
|
|
67
|
+
static listFailed(path: string, cause: string): DextoRuntimeError;
|
|
68
|
+
/**
|
|
69
|
+
* Create directory operation failed
|
|
70
|
+
*/
|
|
71
|
+
static createDirFailed(path: string, cause: string): DextoRuntimeError;
|
|
72
|
+
/**
|
|
73
|
+
* Delete operation failed
|
|
74
|
+
*/
|
|
75
|
+
static deleteFailed(path: string, cause: string): DextoRuntimeError;
|
|
76
|
+
/**
|
|
77
|
+
* Rename operation failed
|
|
78
|
+
*/
|
|
79
|
+
static renameFailed(path: string, cause: string): DextoRuntimeError;
|
|
64
80
|
/**
|
|
65
81
|
* Write operation failed
|
|
66
82
|
*/
|
package/dist/errors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,iBAAiB,EAAa,MAAM,aAAa,CAAC;AAM3D,MAAM,WAAW,sBAAsB;IACnC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;GAE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ACH,MAAM,CAAC,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,iBAAiB;IAWvD;;OAEG;IACH,MAAM,CAAC,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,iBAAiB;IAUvD;;OAEG;IACH,MAAM,CAAC,cAAc,IAAI,iBAAiB;CAU7C"}
|
package/dist/errors.js
CHANGED
|
@@ -138,6 +138,54 @@ class FileSystemError {
|
|
|
138
138
|
{ path, cause }
|
|
139
139
|
);
|
|
140
140
|
}
|
|
141
|
+
/**
|
|
142
|
+
* List directory operation failed
|
|
143
|
+
*/
|
|
144
|
+
static listFailed(path, cause) {
|
|
145
|
+
return new DextoRuntimeError(
|
|
146
|
+
FileSystemErrorCode.LIST_FAILED,
|
|
147
|
+
FILESYSTEM_SCOPE,
|
|
148
|
+
ErrorType.SYSTEM,
|
|
149
|
+
`Failed to list directory: ${path}. ${cause}`,
|
|
150
|
+
{ path, cause }
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Create directory operation failed
|
|
155
|
+
*/
|
|
156
|
+
static createDirFailed(path, cause) {
|
|
157
|
+
return new DextoRuntimeError(
|
|
158
|
+
FileSystemErrorCode.CREATE_DIR_FAILED,
|
|
159
|
+
FILESYSTEM_SCOPE,
|
|
160
|
+
ErrorType.SYSTEM,
|
|
161
|
+
`Failed to create directory: ${path}. ${cause}`,
|
|
162
|
+
{ path, cause }
|
|
163
|
+
);
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Delete operation failed
|
|
167
|
+
*/
|
|
168
|
+
static deleteFailed(path, cause) {
|
|
169
|
+
return new DextoRuntimeError(
|
|
170
|
+
FileSystemErrorCode.DELETE_FAILED,
|
|
171
|
+
FILESYSTEM_SCOPE,
|
|
172
|
+
ErrorType.SYSTEM,
|
|
173
|
+
`Failed to delete path: ${path}. ${cause}`,
|
|
174
|
+
{ path, cause }
|
|
175
|
+
);
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Rename operation failed
|
|
179
|
+
*/
|
|
180
|
+
static renameFailed(path, cause) {
|
|
181
|
+
return new DextoRuntimeError(
|
|
182
|
+
FileSystemErrorCode.RENAME_FAILED,
|
|
183
|
+
FILESYSTEM_SCOPE,
|
|
184
|
+
ErrorType.SYSTEM,
|
|
185
|
+
`Failed to rename path: ${path}. ${cause}`,
|
|
186
|
+
{ path, cause }
|
|
187
|
+
);
|
|
188
|
+
}
|
|
141
189
|
/**
|
|
142
190
|
* Write operation failed
|
|
143
191
|
*/
|
|
@@ -41,6 +41,8 @@ var import_errors = require("./errors.js");
|
|
|
41
41
|
const DEFAULT_ENCODING = "utf-8";
|
|
42
42
|
const DEFAULT_MAX_RESULTS = 1e3;
|
|
43
43
|
const DEFAULT_MAX_SEARCH_RESULTS = 100;
|
|
44
|
+
const DEFAULT_MAX_LIST_RESULTS = 5e3;
|
|
45
|
+
const DEFAULT_LIST_CONCURRENCY = 16;
|
|
44
46
|
class FileSystemService {
|
|
45
47
|
config;
|
|
46
48
|
pathValidator;
|
|
@@ -153,16 +155,14 @@ class FileSystemService {
|
|
|
153
155
|
async isPathWithinConfigAllowed(filePath) {
|
|
154
156
|
return this.pathValidator.isPathWithinAllowed(filePath);
|
|
155
157
|
}
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
*/
|
|
159
|
-
async readFile(filePath, options = {}) {
|
|
160
|
-
await this.ensureInitialized();
|
|
161
|
-
const validation = await this.pathValidator.validatePath(filePath);
|
|
158
|
+
async validateReadPath(filePath, mode) {
|
|
159
|
+
const validation = mode === "toolPreview" ? await this.pathValidator.validatePathForPreview(filePath) : await this.pathValidator.validatePath(filePath);
|
|
162
160
|
if (!validation.isValid || !validation.normalizedPath) {
|
|
163
161
|
throw import_errors.FileSystemError.invalidPath(filePath, validation.error || "Unknown error");
|
|
164
162
|
}
|
|
165
|
-
|
|
163
|
+
return validation.normalizedPath;
|
|
164
|
+
}
|
|
165
|
+
async readNormalizedFile(normalizedPath, options = {}) {
|
|
166
166
|
try {
|
|
167
167
|
const stats = await fs.stat(normalizedPath);
|
|
168
168
|
if (!stats.isFile()) {
|
|
@@ -176,12 +176,18 @@ class FileSystemService {
|
|
|
176
176
|
);
|
|
177
177
|
}
|
|
178
178
|
} catch (error) {
|
|
179
|
+
if (error instanceof import_core.DextoRuntimeError && error.scope === "filesystem") {
|
|
180
|
+
throw error;
|
|
181
|
+
}
|
|
179
182
|
if (error.code === "ENOENT") {
|
|
180
183
|
throw import_errors.FileSystemError.fileNotFound(normalizedPath);
|
|
181
184
|
}
|
|
182
185
|
if (error.code === "EACCES") {
|
|
183
186
|
throw import_errors.FileSystemError.permissionDenied(normalizedPath, "read");
|
|
184
187
|
}
|
|
188
|
+
if (error instanceof import_core.DextoRuntimeError) {
|
|
189
|
+
throw error;
|
|
190
|
+
}
|
|
185
191
|
throw import_errors.FileSystemError.readFailed(
|
|
186
192
|
normalizedPath,
|
|
187
193
|
error instanceof Error ? error.message : String(error)
|
|
@@ -203,20 +209,44 @@ class FileSystemService {
|
|
|
203
209
|
} else {
|
|
204
210
|
selectedLines = lines;
|
|
205
211
|
}
|
|
212
|
+
const returnedContent = selectedLines.join("\n");
|
|
206
213
|
return {
|
|
207
|
-
content:
|
|
214
|
+
content: returnedContent,
|
|
208
215
|
lines: selectedLines.length,
|
|
209
216
|
encoding,
|
|
210
217
|
truncated,
|
|
211
|
-
size: Buffer.byteLength(
|
|
218
|
+
size: Buffer.byteLength(returnedContent, encoding)
|
|
212
219
|
};
|
|
213
220
|
} catch (error) {
|
|
221
|
+
if (error instanceof import_core.DextoRuntimeError && error.scope === "filesystem") {
|
|
222
|
+
throw error;
|
|
223
|
+
}
|
|
214
224
|
throw import_errors.FileSystemError.readFailed(
|
|
215
225
|
normalizedPath,
|
|
216
226
|
error instanceof Error ? error.message : String(error)
|
|
217
227
|
);
|
|
218
228
|
}
|
|
219
229
|
}
|
|
230
|
+
/**
|
|
231
|
+
* Read a file with validation and size limits
|
|
232
|
+
*/
|
|
233
|
+
async readFile(filePath, options = {}) {
|
|
234
|
+
await this.ensureInitialized();
|
|
235
|
+
const normalizedPath = await this.validateReadPath(filePath, "execute");
|
|
236
|
+
return await this.readNormalizedFile(normalizedPath, options);
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Preview-only file read that bypasses config-allowed roots.
|
|
240
|
+
*
|
|
241
|
+
* This is intended for UI previews (diffs, create previews) shown BEFORE a user
|
|
242
|
+
* confirms directory access for the tool call. The returned content is UI-only
|
|
243
|
+
* and should not be forwarded to the LLM.
|
|
244
|
+
*/
|
|
245
|
+
async readFileForToolPreview(filePath, options = {}) {
|
|
246
|
+
await this.ensureInitialized();
|
|
247
|
+
const normalizedPath = await this.validateReadPath(filePath, "toolPreview");
|
|
248
|
+
return await this.readNormalizedFile(normalizedPath, options);
|
|
249
|
+
}
|
|
220
250
|
/**
|
|
221
251
|
* Find files matching a glob pattern
|
|
222
252
|
*/
|
|
@@ -279,6 +309,274 @@ class FileSystemService {
|
|
|
279
309
|
);
|
|
280
310
|
}
|
|
281
311
|
}
|
|
312
|
+
/**
|
|
313
|
+
* List contents of a directory (non-recursive)
|
|
314
|
+
*/
|
|
315
|
+
async listDirectory(dirPath, options = {}) {
|
|
316
|
+
await this.ensureInitialized();
|
|
317
|
+
const validation = await this.pathValidator.validatePath(dirPath);
|
|
318
|
+
if (!validation.isValid || !validation.normalizedPath) {
|
|
319
|
+
throw import_errors.FileSystemError.invalidPath(dirPath, validation.error || "Unknown error");
|
|
320
|
+
}
|
|
321
|
+
const normalizedPath = validation.normalizedPath;
|
|
322
|
+
try {
|
|
323
|
+
const stats = await fs.stat(normalizedPath);
|
|
324
|
+
if (!stats.isDirectory()) {
|
|
325
|
+
throw import_errors.FileSystemError.invalidPath(normalizedPath, "Path is not a directory");
|
|
326
|
+
}
|
|
327
|
+
} catch (error) {
|
|
328
|
+
if (error instanceof import_core.DextoRuntimeError && error.scope === "filesystem") {
|
|
329
|
+
throw error;
|
|
330
|
+
}
|
|
331
|
+
if (error.code === "ENOENT") {
|
|
332
|
+
throw import_errors.FileSystemError.directoryNotFound(normalizedPath);
|
|
333
|
+
}
|
|
334
|
+
if (error.code === "EACCES") {
|
|
335
|
+
throw import_errors.FileSystemError.permissionDenied(normalizedPath, "read");
|
|
336
|
+
}
|
|
337
|
+
throw import_errors.FileSystemError.listFailed(
|
|
338
|
+
normalizedPath,
|
|
339
|
+
error instanceof Error ? error.message : String(error)
|
|
340
|
+
);
|
|
341
|
+
}
|
|
342
|
+
const includeHidden = options.includeHidden ?? true;
|
|
343
|
+
const includeMetadata = options.includeMetadata !== false;
|
|
344
|
+
const maxEntries = options.maxEntries ?? DEFAULT_MAX_LIST_RESULTS;
|
|
345
|
+
try {
|
|
346
|
+
const dirEntries = await fs.readdir(normalizedPath, { withFileTypes: true });
|
|
347
|
+
const candidates = dirEntries.filter(
|
|
348
|
+
(entry) => includeHidden || !entry.name.startsWith(".")
|
|
349
|
+
);
|
|
350
|
+
const concurrency = DEFAULT_LIST_CONCURRENCY;
|
|
351
|
+
const validatedEntries = await this.mapWithConcurrency(
|
|
352
|
+
candidates,
|
|
353
|
+
concurrency,
|
|
354
|
+
async (entry) => {
|
|
355
|
+
const entryPath = path.join(normalizedPath, entry.name);
|
|
356
|
+
const entryValidation = await this.pathValidator.validatePath(entryPath);
|
|
357
|
+
if (!entryValidation.isValid || !entryValidation.normalizedPath) {
|
|
358
|
+
return null;
|
|
359
|
+
}
|
|
360
|
+
return {
|
|
361
|
+
entry,
|
|
362
|
+
normalizedPath: entryValidation.normalizedPath
|
|
363
|
+
};
|
|
364
|
+
}
|
|
365
|
+
);
|
|
366
|
+
const validEntries = validatedEntries.filter(Boolean);
|
|
367
|
+
if (maxEntries <= 0) {
|
|
368
|
+
return {
|
|
369
|
+
path: normalizedPath,
|
|
370
|
+
entries: [],
|
|
371
|
+
truncated: validEntries.length > 0,
|
|
372
|
+
totalEntries: validEntries.length
|
|
373
|
+
};
|
|
374
|
+
}
|
|
375
|
+
if (!includeMetadata) {
|
|
376
|
+
const entries2 = validEntries.slice(0, maxEntries).map((entry) => ({
|
|
377
|
+
name: entry.entry.name,
|
|
378
|
+
path: entry.normalizedPath,
|
|
379
|
+
isDirectory: entry.entry.isDirectory(),
|
|
380
|
+
size: 0,
|
|
381
|
+
modified: /* @__PURE__ */ new Date()
|
|
382
|
+
}));
|
|
383
|
+
return {
|
|
384
|
+
path: normalizedPath,
|
|
385
|
+
entries: entries2,
|
|
386
|
+
truncated: validEntries.length > maxEntries,
|
|
387
|
+
totalEntries: validEntries.length
|
|
388
|
+
};
|
|
389
|
+
}
|
|
390
|
+
const metadataEntries = await this.mapWithConcurrency(
|
|
391
|
+
validEntries,
|
|
392
|
+
concurrency,
|
|
393
|
+
async (entry) => {
|
|
394
|
+
try {
|
|
395
|
+
const stat = await fs.stat(entry.normalizedPath);
|
|
396
|
+
return {
|
|
397
|
+
name: entry.entry.name,
|
|
398
|
+
path: entry.normalizedPath,
|
|
399
|
+
isDirectory: entry.entry.isDirectory(),
|
|
400
|
+
size: stat.size,
|
|
401
|
+
modified: stat.mtime
|
|
402
|
+
};
|
|
403
|
+
} catch {
|
|
404
|
+
return null;
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
);
|
|
408
|
+
const entries = [];
|
|
409
|
+
let successfulStats = 0;
|
|
410
|
+
let cutoffIndex = -1;
|
|
411
|
+
for (let index = 0; index < metadataEntries.length; index += 1) {
|
|
412
|
+
const entry = metadataEntries[index];
|
|
413
|
+
if (!entry) {
|
|
414
|
+
continue;
|
|
415
|
+
}
|
|
416
|
+
successfulStats += 1;
|
|
417
|
+
if (entries.length < maxEntries) {
|
|
418
|
+
entries.push(entry);
|
|
419
|
+
}
|
|
420
|
+
if (successfulStats === maxEntries) {
|
|
421
|
+
cutoffIndex = index;
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
const remainingSuccessful = cutoffIndex >= 0 ? metadataEntries.slice(cutoffIndex + 1).filter((entry) => entry !== null).length : 0;
|
|
425
|
+
const totalEntries = successfulStats < maxEntries ? successfulStats : maxEntries + remainingSuccessful;
|
|
426
|
+
return {
|
|
427
|
+
path: normalizedPath,
|
|
428
|
+
entries,
|
|
429
|
+
truncated: totalEntries > maxEntries,
|
|
430
|
+
totalEntries
|
|
431
|
+
};
|
|
432
|
+
} catch (error) {
|
|
433
|
+
throw import_errors.FileSystemError.listFailed(
|
|
434
|
+
normalizedPath,
|
|
435
|
+
error instanceof Error ? error.message : String(error)
|
|
436
|
+
);
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
async mapWithConcurrency(items, limit, mapper) {
|
|
440
|
+
if (items.length === 0) {
|
|
441
|
+
return [];
|
|
442
|
+
}
|
|
443
|
+
const results = new Array(items.length);
|
|
444
|
+
let nextIndex = 0;
|
|
445
|
+
const workerCount = Math.min(Math.max(1, limit), items.length);
|
|
446
|
+
const workers = Array.from({ length: workerCount }, async () => {
|
|
447
|
+
while (true) {
|
|
448
|
+
const current = nextIndex++;
|
|
449
|
+
if (current >= items.length) {
|
|
450
|
+
return;
|
|
451
|
+
}
|
|
452
|
+
const item = items[current];
|
|
453
|
+
if (item === void 0) {
|
|
454
|
+
continue;
|
|
455
|
+
}
|
|
456
|
+
results[current] = await mapper(item, current);
|
|
457
|
+
}
|
|
458
|
+
});
|
|
459
|
+
await Promise.all(workers);
|
|
460
|
+
return results;
|
|
461
|
+
}
|
|
462
|
+
/**
|
|
463
|
+
* Create a directory
|
|
464
|
+
*/
|
|
465
|
+
async createDirectory(dirPath, options = {}) {
|
|
466
|
+
await this.ensureInitialized();
|
|
467
|
+
const validation = await this.pathValidator.validatePath(dirPath);
|
|
468
|
+
if (!validation.isValid || !validation.normalizedPath) {
|
|
469
|
+
throw import_errors.FileSystemError.invalidPath(dirPath, validation.error || "Unknown error");
|
|
470
|
+
}
|
|
471
|
+
const normalizedPath = validation.normalizedPath;
|
|
472
|
+
const recursive = options.recursive ?? false;
|
|
473
|
+
try {
|
|
474
|
+
const firstCreated = await fs.mkdir(normalizedPath, { recursive });
|
|
475
|
+
const created = recursive ? typeof firstCreated === "string" : true;
|
|
476
|
+
return { path: normalizedPath, created };
|
|
477
|
+
} catch (error) {
|
|
478
|
+
const code = error.code;
|
|
479
|
+
if (code === "EEXIST") {
|
|
480
|
+
try {
|
|
481
|
+
const stat = await fs.stat(normalizedPath);
|
|
482
|
+
if (stat.isDirectory()) {
|
|
483
|
+
return { path: normalizedPath, created: false };
|
|
484
|
+
}
|
|
485
|
+
} catch {
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
if (code === "EACCES" || code === "EPERM") {
|
|
489
|
+
throw import_errors.FileSystemError.permissionDenied(normalizedPath, "create directory");
|
|
490
|
+
}
|
|
491
|
+
throw import_errors.FileSystemError.createDirFailed(
|
|
492
|
+
normalizedPath,
|
|
493
|
+
error instanceof Error ? error.message : String(error)
|
|
494
|
+
);
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
/**
|
|
498
|
+
* Delete a file or directory
|
|
499
|
+
*/
|
|
500
|
+
async deletePath(targetPath, options = {}) {
|
|
501
|
+
await this.ensureInitialized();
|
|
502
|
+
const validation = await this.pathValidator.validatePath(targetPath);
|
|
503
|
+
if (!validation.isValid || !validation.normalizedPath) {
|
|
504
|
+
throw import_errors.FileSystemError.invalidPath(targetPath, validation.error || "Unknown error");
|
|
505
|
+
}
|
|
506
|
+
const normalizedPath = validation.normalizedPath;
|
|
507
|
+
try {
|
|
508
|
+
await fs.rm(normalizedPath, { recursive: options.recursive ?? false, force: false });
|
|
509
|
+
return { path: normalizedPath, deleted: true };
|
|
510
|
+
} catch (error) {
|
|
511
|
+
const code = error.code;
|
|
512
|
+
if (code === "ENOENT") {
|
|
513
|
+
throw import_errors.FileSystemError.fileNotFound(normalizedPath);
|
|
514
|
+
}
|
|
515
|
+
if (code === "EACCES" || code === "EPERM") {
|
|
516
|
+
throw import_errors.FileSystemError.permissionDenied(normalizedPath, "delete");
|
|
517
|
+
}
|
|
518
|
+
throw import_errors.FileSystemError.deleteFailed(
|
|
519
|
+
normalizedPath,
|
|
520
|
+
error instanceof Error ? error.message : String(error)
|
|
521
|
+
);
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
/**
|
|
525
|
+
* Rename or move a file or directory
|
|
526
|
+
*/
|
|
527
|
+
async renamePath(fromPath, toPath) {
|
|
528
|
+
await this.ensureInitialized();
|
|
529
|
+
const fromValidation = await this.pathValidator.validatePath(fromPath);
|
|
530
|
+
if (!fromValidation.isValid || !fromValidation.normalizedPath) {
|
|
531
|
+
throw import_errors.FileSystemError.invalidPath(fromPath, fromValidation.error || "Unknown error");
|
|
532
|
+
}
|
|
533
|
+
const toValidation = await this.pathValidator.validatePath(toPath);
|
|
534
|
+
if (!toValidation.isValid || !toValidation.normalizedPath) {
|
|
535
|
+
throw import_errors.FileSystemError.invalidPath(toPath, toValidation.error || "Unknown error");
|
|
536
|
+
}
|
|
537
|
+
const normalizedFrom = fromValidation.normalizedPath;
|
|
538
|
+
const normalizedTo = toValidation.normalizedPath;
|
|
539
|
+
if (normalizedFrom === normalizedTo) {
|
|
540
|
+
return { from: normalizedFrom, to: normalizedTo };
|
|
541
|
+
}
|
|
542
|
+
try {
|
|
543
|
+
await fs.access(normalizedTo);
|
|
544
|
+
throw import_errors.FileSystemError.renameFailed(
|
|
545
|
+
normalizedFrom,
|
|
546
|
+
`Target already exists: ${normalizedTo}`
|
|
547
|
+
);
|
|
548
|
+
} catch (error) {
|
|
549
|
+
const code = error.code;
|
|
550
|
+
if (!code) {
|
|
551
|
+
throw error;
|
|
552
|
+
}
|
|
553
|
+
if (code === "ENOENT") {
|
|
554
|
+
} else if (code === "EACCES" || code === "EPERM") {
|
|
555
|
+
throw import_errors.FileSystemError.permissionDenied(normalizedTo, "rename");
|
|
556
|
+
} else {
|
|
557
|
+
throw import_errors.FileSystemError.renameFailed(
|
|
558
|
+
normalizedFrom,
|
|
559
|
+
error instanceof Error ? error.message : String(error)
|
|
560
|
+
);
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
try {
|
|
564
|
+
await fs.rename(normalizedFrom, normalizedTo);
|
|
565
|
+
return { from: normalizedFrom, to: normalizedTo };
|
|
566
|
+
} catch (error) {
|
|
567
|
+
const code = error.code;
|
|
568
|
+
if (code === "ENOENT") {
|
|
569
|
+
throw import_errors.FileSystemError.fileNotFound(normalizedFrom);
|
|
570
|
+
}
|
|
571
|
+
if (code === "EACCES" || code === "EPERM") {
|
|
572
|
+
throw import_errors.FileSystemError.permissionDenied(normalizedFrom, "rename");
|
|
573
|
+
}
|
|
574
|
+
throw import_errors.FileSystemError.renameFailed(
|
|
575
|
+
normalizedFrom,
|
|
576
|
+
error instanceof Error ? error.message : String(error)
|
|
577
|
+
);
|
|
578
|
+
}
|
|
579
|
+
}
|
|
282
580
|
/**
|
|
283
581
|
* Search for content in files (grep-like functionality)
|
|
284
582
|
*/
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Secure file system operations for Dexto internal tools
|
|
5
5
|
*/
|
|
6
6
|
import { Logger } from '@dexto/core';
|
|
7
|
-
import { FileSystemConfig, FileContent, ReadFileOptions, GlobOptions, GlobResult, GrepOptions, SearchResult, WriteFileOptions, WriteResult, EditFileOptions, EditResult, EditOperation } from './types.js';
|
|
7
|
+
import { FileSystemConfig, FileContent, ReadFileOptions, GlobOptions, GlobResult, GrepOptions, SearchResult, WriteFileOptions, WriteResult, EditFileOptions, EditResult, EditOperation, ListDirectoryOptions, ListDirectoryResult, CreateDirectoryOptions, CreateDirectoryResult, DeletePathOptions, DeletePathResult, RenamePathResult } from './types.js';
|
|
8
8
|
/**
|
|
9
9
|
* FileSystemService - Handles all file system operations with security checks
|
|
10
10
|
*
|
|
@@ -74,14 +74,41 @@ export declare class FileSystemService {
|
|
|
74
74
|
* @returns true if the path is within config-allowed paths, false otherwise
|
|
75
75
|
*/
|
|
76
76
|
isPathWithinConfigAllowed(filePath: string): Promise<boolean>;
|
|
77
|
+
private validateReadPath;
|
|
78
|
+
private readNormalizedFile;
|
|
77
79
|
/**
|
|
78
80
|
* Read a file with validation and size limits
|
|
79
81
|
*/
|
|
80
82
|
readFile(filePath: string, options?: ReadFileOptions): Promise<FileContent>;
|
|
83
|
+
/**
|
|
84
|
+
* Preview-only file read that bypasses config-allowed roots.
|
|
85
|
+
*
|
|
86
|
+
* This is intended for UI previews (diffs, create previews) shown BEFORE a user
|
|
87
|
+
* confirms directory access for the tool call. The returned content is UI-only
|
|
88
|
+
* and should not be forwarded to the LLM.
|
|
89
|
+
*/
|
|
90
|
+
readFileForToolPreview(filePath: string, options?: ReadFileOptions): Promise<FileContent>;
|
|
81
91
|
/**
|
|
82
92
|
* Find files matching a glob pattern
|
|
83
93
|
*/
|
|
84
94
|
globFiles(pattern: string, options?: GlobOptions): Promise<GlobResult>;
|
|
95
|
+
/**
|
|
96
|
+
* List contents of a directory (non-recursive)
|
|
97
|
+
*/
|
|
98
|
+
listDirectory(dirPath: string, options?: ListDirectoryOptions): Promise<ListDirectoryResult>;
|
|
99
|
+
private mapWithConcurrency;
|
|
100
|
+
/**
|
|
101
|
+
* Create a directory
|
|
102
|
+
*/
|
|
103
|
+
createDirectory(dirPath: string, options?: CreateDirectoryOptions): Promise<CreateDirectoryResult>;
|
|
104
|
+
/**
|
|
105
|
+
* Delete a file or directory
|
|
106
|
+
*/
|
|
107
|
+
deletePath(targetPath: string, options?: DeletePathOptions): Promise<DeletePathResult>;
|
|
108
|
+
/**
|
|
109
|
+
* Rename or move a file or directory
|
|
110
|
+
*/
|
|
111
|
+
renamePath(fromPath: string, toPath: string): Promise<RenamePathResult>;
|
|
85
112
|
/**
|
|
86
113
|
* Search for content in files (grep-like functionality)
|
|
87
114
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filesystem-service.d.ts","sourceRoot":"","sources":["../src/filesystem-service.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,OAAO,
|
|
1
|
+
{"version":3,"file":"filesystem-service.d.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