@dexto/tools-filesystem 1.5.4 → 1.5.6

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/errors.cjs CHANGED
@@ -23,6 +23,7 @@ __export(errors_exports, {
23
23
  module.exports = __toCommonJS(errors_exports);
24
24
  var import_core = require("@dexto/core");
25
25
  var import_error_codes = require("./error-codes.js");
26
+ const FILESYSTEM_SCOPE = "filesystem";
26
27
  class FileSystemError {
27
28
  constructor() {
28
29
  }
@@ -32,7 +33,7 @@ class FileSystemError {
32
33
  static fileNotFound(path) {
33
34
  return new import_core.DextoRuntimeError(
34
35
  import_error_codes.FileSystemErrorCode.FILE_NOT_FOUND,
35
- import_core.ErrorScope.FILESYSTEM,
36
+ FILESYSTEM_SCOPE,
36
37
  import_core.ErrorType.NOT_FOUND,
37
38
  `File not found: ${path}`,
38
39
  { path }
@@ -44,7 +45,7 @@ class FileSystemError {
44
45
  static directoryNotFound(path) {
45
46
  return new import_core.DextoRuntimeError(
46
47
  import_error_codes.FileSystemErrorCode.DIRECTORY_NOT_FOUND,
47
- import_core.ErrorScope.FILESYSTEM,
48
+ FILESYSTEM_SCOPE,
48
49
  import_core.ErrorType.NOT_FOUND,
49
50
  `Directory not found: ${path}`,
50
51
  { path }
@@ -56,7 +57,7 @@ class FileSystemError {
56
57
  static permissionDenied(path, operation) {
57
58
  return new import_core.DextoRuntimeError(
58
59
  import_error_codes.FileSystemErrorCode.PERMISSION_DENIED,
59
- import_core.ErrorScope.FILESYSTEM,
60
+ FILESYSTEM_SCOPE,
60
61
  import_core.ErrorType.FORBIDDEN,
61
62
  `Permission denied: cannot ${operation} ${path}`,
62
63
  { path, operation }
@@ -68,7 +69,7 @@ class FileSystemError {
68
69
  static pathNotAllowed(path, allowedPaths) {
69
70
  return new import_core.DextoRuntimeError(
70
71
  import_error_codes.FileSystemErrorCode.PATH_NOT_ALLOWED,
71
- import_core.ErrorScope.FILESYSTEM,
72
+ FILESYSTEM_SCOPE,
72
73
  import_core.ErrorType.USER,
73
74
  `Path not allowed: ${path}. Must be within allowed paths: ${allowedPaths.join(", ")}`,
74
75
  { path, allowedPaths },
@@ -81,7 +82,7 @@ class FileSystemError {
81
82
  static pathBlocked(path, reason) {
82
83
  return new import_core.DextoRuntimeError(
83
84
  import_error_codes.FileSystemErrorCode.PATH_BLOCKED,
84
- import_core.ErrorScope.FILESYSTEM,
85
+ FILESYSTEM_SCOPE,
85
86
  import_core.ErrorType.FORBIDDEN,
86
87
  `Path is blocked: ${path}. Reason: ${reason}`,
87
88
  { path, reason }
@@ -93,7 +94,7 @@ class FileSystemError {
93
94
  static invalidPath(path, reason) {
94
95
  return new import_core.DextoRuntimeError(
95
96
  import_error_codes.FileSystemErrorCode.INVALID_PATH,
96
- import_core.ErrorScope.FILESYSTEM,
97
+ FILESYSTEM_SCOPE,
97
98
  import_core.ErrorType.USER,
98
99
  `Invalid path: ${path}. ${reason}`,
99
100
  { path, reason }
@@ -105,7 +106,7 @@ class FileSystemError {
105
106
  static pathTraversal(path) {
106
107
  return new import_core.DextoRuntimeError(
107
108
  import_error_codes.FileSystemErrorCode.PATH_TRAVERSAL_DETECTED,
108
- import_core.ErrorScope.FILESYSTEM,
109
+ FILESYSTEM_SCOPE,
109
110
  import_core.ErrorType.FORBIDDEN,
110
111
  `Path traversal detected in: ${path}`,
111
112
  { path }
@@ -117,7 +118,7 @@ class FileSystemError {
117
118
  static invalidExtension(path, blockedExtensions) {
118
119
  return new import_core.DextoRuntimeError(
119
120
  import_error_codes.FileSystemErrorCode.INVALID_FILE_EXTENSION,
120
- import_core.ErrorScope.FILESYSTEM,
121
+ FILESYSTEM_SCOPE,
121
122
  import_core.ErrorType.USER,
122
123
  `Invalid file extension: ${path}. Blocked extensions: ${blockedExtensions.join(", ")}`,
123
124
  { path, blockedExtensions }
@@ -129,7 +130,7 @@ class FileSystemError {
129
130
  static fileTooLarge(path, size, maxSize) {
130
131
  return new import_core.DextoRuntimeError(
131
132
  import_error_codes.FileSystemErrorCode.FILE_TOO_LARGE,
132
- import_core.ErrorScope.FILESYSTEM,
133
+ FILESYSTEM_SCOPE,
133
134
  import_core.ErrorType.USER,
134
135
  `File too large: ${path} (${size} bytes). Maximum allowed: ${maxSize} bytes`,
135
136
  { path, size, maxSize }
@@ -141,7 +142,7 @@ class FileSystemError {
141
142
  static tooManyResults(operation, count, maxResults) {
142
143
  return new import_core.DextoRuntimeError(
143
144
  import_error_codes.FileSystemErrorCode.TOO_MANY_RESULTS,
144
- import_core.ErrorScope.FILESYSTEM,
145
+ FILESYSTEM_SCOPE,
145
146
  import_core.ErrorType.USER,
146
147
  `Too many results from ${operation}: ${count}. Maximum allowed: ${maxResults}`,
147
148
  { operation, count, maxResults },
@@ -154,7 +155,7 @@ class FileSystemError {
154
155
  static readFailed(path, cause) {
155
156
  return new import_core.DextoRuntimeError(
156
157
  import_error_codes.FileSystemErrorCode.READ_FAILED,
157
- import_core.ErrorScope.FILESYSTEM,
158
+ FILESYSTEM_SCOPE,
158
159
  import_core.ErrorType.SYSTEM,
159
160
  `Failed to read file: ${path}. ${cause}`,
160
161
  { path, cause }
@@ -166,7 +167,7 @@ class FileSystemError {
166
167
  static writeFailed(path, cause) {
167
168
  return new import_core.DextoRuntimeError(
168
169
  import_error_codes.FileSystemErrorCode.WRITE_FAILED,
169
- import_core.ErrorScope.FILESYSTEM,
170
+ FILESYSTEM_SCOPE,
170
171
  import_core.ErrorType.SYSTEM,
171
172
  `Failed to write file: ${path}. ${cause}`,
172
173
  { path, cause }
@@ -178,7 +179,7 @@ class FileSystemError {
178
179
  static backupFailed(path, cause) {
179
180
  return new import_core.DextoRuntimeError(
180
181
  import_error_codes.FileSystemErrorCode.BACKUP_FAILED,
181
- import_core.ErrorScope.FILESYSTEM,
182
+ FILESYSTEM_SCOPE,
182
183
  import_core.ErrorType.SYSTEM,
183
184
  `Failed to create backup for: ${path}. ${cause}`,
184
185
  { path, cause }
@@ -190,7 +191,7 @@ class FileSystemError {
190
191
  static editFailed(path, cause) {
191
192
  return new import_core.DextoRuntimeError(
192
193
  import_error_codes.FileSystemErrorCode.EDIT_FAILED,
193
- import_core.ErrorScope.FILESYSTEM,
194
+ FILESYSTEM_SCOPE,
194
195
  import_core.ErrorType.SYSTEM,
195
196
  `Failed to edit file: ${path}. ${cause}`,
196
197
  { path, cause }
@@ -202,7 +203,7 @@ class FileSystemError {
202
203
  static stringNotUnique(path, searchString, occurrences) {
203
204
  return new import_core.DextoRuntimeError(
204
205
  import_error_codes.FileSystemErrorCode.STRING_NOT_UNIQUE,
205
- import_core.ErrorScope.FILESYSTEM,
206
+ FILESYSTEM_SCOPE,
206
207
  import_core.ErrorType.USER,
207
208
  `String is not unique in ${path}: "${searchString}" found ${occurrences} times. Use replaceAll=true or provide a more specific string.`,
208
209
  { path, searchString, occurrences },
@@ -215,7 +216,7 @@ class FileSystemError {
215
216
  static stringNotFound(path, searchString) {
216
217
  return new import_core.DextoRuntimeError(
217
218
  import_error_codes.FileSystemErrorCode.STRING_NOT_FOUND,
218
- import_core.ErrorScope.FILESYSTEM,
219
+ FILESYSTEM_SCOPE,
219
220
  import_core.ErrorType.USER,
220
221
  `String not found in ${path}: "${searchString}"`,
221
222
  { path, searchString }
@@ -227,7 +228,7 @@ class FileSystemError {
227
228
  static globFailed(pattern, cause) {
228
229
  return new import_core.DextoRuntimeError(
229
230
  import_error_codes.FileSystemErrorCode.GLOB_FAILED,
230
- import_core.ErrorScope.FILESYSTEM,
231
+ FILESYSTEM_SCOPE,
231
232
  import_core.ErrorType.SYSTEM,
232
233
  `Glob operation failed for pattern: ${pattern}. ${cause}`,
233
234
  { pattern, cause }
@@ -239,7 +240,7 @@ class FileSystemError {
239
240
  static searchFailed(pattern, cause) {
240
241
  return new import_core.DextoRuntimeError(
241
242
  import_error_codes.FileSystemErrorCode.SEARCH_FAILED,
242
- import_core.ErrorScope.FILESYSTEM,
243
+ FILESYSTEM_SCOPE,
243
244
  import_core.ErrorType.SYSTEM,
244
245
  `Search operation failed for pattern: ${pattern}. ${cause}`,
245
246
  { pattern, cause }
@@ -251,7 +252,7 @@ class FileSystemError {
251
252
  static invalidPattern(pattern, cause) {
252
253
  return new import_core.DextoRuntimeError(
253
254
  import_error_codes.FileSystemErrorCode.INVALID_PATTERN,
254
- import_core.ErrorScope.FILESYSTEM,
255
+ FILESYSTEM_SCOPE,
255
256
  import_core.ErrorType.USER,
256
257
  `Invalid pattern: ${pattern}. ${cause}`,
257
258
  { pattern, cause }
@@ -263,7 +264,7 @@ class FileSystemError {
263
264
  static regexTimeout(pattern) {
264
265
  return new import_core.DextoRuntimeError(
265
266
  import_error_codes.FileSystemErrorCode.REGEX_TIMEOUT,
266
- import_core.ErrorScope.FILESYSTEM,
267
+ FILESYSTEM_SCOPE,
267
268
  import_core.ErrorType.TIMEOUT,
268
269
  `Regex operation timed out for pattern: ${pattern}`,
269
270
  { pattern },
@@ -276,7 +277,7 @@ class FileSystemError {
276
277
  static invalidConfig(reason) {
277
278
  return new import_core.DextoRuntimeError(
278
279
  import_error_codes.FileSystemErrorCode.INVALID_CONFIG,
279
- import_core.ErrorScope.FILESYSTEM,
280
+ FILESYSTEM_SCOPE,
280
281
  import_core.ErrorType.USER,
281
282
  `Invalid FileSystem configuration: ${reason}`,
282
283
  { reason }
@@ -288,7 +289,7 @@ class FileSystemError {
288
289
  static notInitialized() {
289
290
  return new import_core.DextoRuntimeError(
290
291
  import_error_codes.FileSystemErrorCode.SERVICE_NOT_INITIALIZED,
291
- import_core.ErrorScope.FILESYSTEM,
292
+ FILESYSTEM_SCOPE,
292
293
  import_core.ErrorType.SYSTEM,
293
294
  "FileSystemService has not been initialized",
294
295
  {},
package/dist/errors.js CHANGED
@@ -1,4 +1,5 @@
1
- import { DextoRuntimeError, ErrorScope, ErrorType } from "@dexto/core";
1
+ import { DextoRuntimeError, ErrorType } from "@dexto/core";
2
+ const FILESYSTEM_SCOPE = "filesystem";
2
3
  import { FileSystemErrorCode } from "./error-codes.js";
3
4
  class FileSystemError {
4
5
  constructor() {
@@ -9,7 +10,7 @@ class FileSystemError {
9
10
  static fileNotFound(path) {
10
11
  return new DextoRuntimeError(
11
12
  FileSystemErrorCode.FILE_NOT_FOUND,
12
- ErrorScope.FILESYSTEM,
13
+ FILESYSTEM_SCOPE,
13
14
  ErrorType.NOT_FOUND,
14
15
  `File not found: ${path}`,
15
16
  { path }
@@ -21,7 +22,7 @@ class FileSystemError {
21
22
  static directoryNotFound(path) {
22
23
  return new DextoRuntimeError(
23
24
  FileSystemErrorCode.DIRECTORY_NOT_FOUND,
24
- ErrorScope.FILESYSTEM,
25
+ FILESYSTEM_SCOPE,
25
26
  ErrorType.NOT_FOUND,
26
27
  `Directory not found: ${path}`,
27
28
  { path }
@@ -33,7 +34,7 @@ class FileSystemError {
33
34
  static permissionDenied(path, operation) {
34
35
  return new DextoRuntimeError(
35
36
  FileSystemErrorCode.PERMISSION_DENIED,
36
- ErrorScope.FILESYSTEM,
37
+ FILESYSTEM_SCOPE,
37
38
  ErrorType.FORBIDDEN,
38
39
  `Permission denied: cannot ${operation} ${path}`,
39
40
  { path, operation }
@@ -45,7 +46,7 @@ class FileSystemError {
45
46
  static pathNotAllowed(path, allowedPaths) {
46
47
  return new DextoRuntimeError(
47
48
  FileSystemErrorCode.PATH_NOT_ALLOWED,
48
- ErrorScope.FILESYSTEM,
49
+ FILESYSTEM_SCOPE,
49
50
  ErrorType.USER,
50
51
  `Path not allowed: ${path}. Must be within allowed paths: ${allowedPaths.join(", ")}`,
51
52
  { path, allowedPaths },
@@ -58,7 +59,7 @@ class FileSystemError {
58
59
  static pathBlocked(path, reason) {
59
60
  return new DextoRuntimeError(
60
61
  FileSystemErrorCode.PATH_BLOCKED,
61
- ErrorScope.FILESYSTEM,
62
+ FILESYSTEM_SCOPE,
62
63
  ErrorType.FORBIDDEN,
63
64
  `Path is blocked: ${path}. Reason: ${reason}`,
64
65
  { path, reason }
@@ -70,7 +71,7 @@ class FileSystemError {
70
71
  static invalidPath(path, reason) {
71
72
  return new DextoRuntimeError(
72
73
  FileSystemErrorCode.INVALID_PATH,
73
- ErrorScope.FILESYSTEM,
74
+ FILESYSTEM_SCOPE,
74
75
  ErrorType.USER,
75
76
  `Invalid path: ${path}. ${reason}`,
76
77
  { path, reason }
@@ -82,7 +83,7 @@ class FileSystemError {
82
83
  static pathTraversal(path) {
83
84
  return new DextoRuntimeError(
84
85
  FileSystemErrorCode.PATH_TRAVERSAL_DETECTED,
85
- ErrorScope.FILESYSTEM,
86
+ FILESYSTEM_SCOPE,
86
87
  ErrorType.FORBIDDEN,
87
88
  `Path traversal detected in: ${path}`,
88
89
  { path }
@@ -94,7 +95,7 @@ class FileSystemError {
94
95
  static invalidExtension(path, blockedExtensions) {
95
96
  return new DextoRuntimeError(
96
97
  FileSystemErrorCode.INVALID_FILE_EXTENSION,
97
- ErrorScope.FILESYSTEM,
98
+ FILESYSTEM_SCOPE,
98
99
  ErrorType.USER,
99
100
  `Invalid file extension: ${path}. Blocked extensions: ${blockedExtensions.join(", ")}`,
100
101
  { path, blockedExtensions }
@@ -106,7 +107,7 @@ class FileSystemError {
106
107
  static fileTooLarge(path, size, maxSize) {
107
108
  return new DextoRuntimeError(
108
109
  FileSystemErrorCode.FILE_TOO_LARGE,
109
- ErrorScope.FILESYSTEM,
110
+ FILESYSTEM_SCOPE,
110
111
  ErrorType.USER,
111
112
  `File too large: ${path} (${size} bytes). Maximum allowed: ${maxSize} bytes`,
112
113
  { path, size, maxSize }
@@ -118,7 +119,7 @@ class FileSystemError {
118
119
  static tooManyResults(operation, count, maxResults) {
119
120
  return new DextoRuntimeError(
120
121
  FileSystemErrorCode.TOO_MANY_RESULTS,
121
- ErrorScope.FILESYSTEM,
122
+ FILESYSTEM_SCOPE,
122
123
  ErrorType.USER,
123
124
  `Too many results from ${operation}: ${count}. Maximum allowed: ${maxResults}`,
124
125
  { operation, count, maxResults },
@@ -131,7 +132,7 @@ class FileSystemError {
131
132
  static readFailed(path, cause) {
132
133
  return new DextoRuntimeError(
133
134
  FileSystemErrorCode.READ_FAILED,
134
- ErrorScope.FILESYSTEM,
135
+ FILESYSTEM_SCOPE,
135
136
  ErrorType.SYSTEM,
136
137
  `Failed to read file: ${path}. ${cause}`,
137
138
  { path, cause }
@@ -143,7 +144,7 @@ class FileSystemError {
143
144
  static writeFailed(path, cause) {
144
145
  return new DextoRuntimeError(
145
146
  FileSystemErrorCode.WRITE_FAILED,
146
- ErrorScope.FILESYSTEM,
147
+ FILESYSTEM_SCOPE,
147
148
  ErrorType.SYSTEM,
148
149
  `Failed to write file: ${path}. ${cause}`,
149
150
  { path, cause }
@@ -155,7 +156,7 @@ class FileSystemError {
155
156
  static backupFailed(path, cause) {
156
157
  return new DextoRuntimeError(
157
158
  FileSystemErrorCode.BACKUP_FAILED,
158
- ErrorScope.FILESYSTEM,
159
+ FILESYSTEM_SCOPE,
159
160
  ErrorType.SYSTEM,
160
161
  `Failed to create backup for: ${path}. ${cause}`,
161
162
  { path, cause }
@@ -167,7 +168,7 @@ class FileSystemError {
167
168
  static editFailed(path, cause) {
168
169
  return new DextoRuntimeError(
169
170
  FileSystemErrorCode.EDIT_FAILED,
170
- ErrorScope.FILESYSTEM,
171
+ FILESYSTEM_SCOPE,
171
172
  ErrorType.SYSTEM,
172
173
  `Failed to edit file: ${path}. ${cause}`,
173
174
  { path, cause }
@@ -179,7 +180,7 @@ class FileSystemError {
179
180
  static stringNotUnique(path, searchString, occurrences) {
180
181
  return new DextoRuntimeError(
181
182
  FileSystemErrorCode.STRING_NOT_UNIQUE,
182
- ErrorScope.FILESYSTEM,
183
+ FILESYSTEM_SCOPE,
183
184
  ErrorType.USER,
184
185
  `String is not unique in ${path}: "${searchString}" found ${occurrences} times. Use replaceAll=true or provide a more specific string.`,
185
186
  { path, searchString, occurrences },
@@ -192,7 +193,7 @@ class FileSystemError {
192
193
  static stringNotFound(path, searchString) {
193
194
  return new DextoRuntimeError(
194
195
  FileSystemErrorCode.STRING_NOT_FOUND,
195
- ErrorScope.FILESYSTEM,
196
+ FILESYSTEM_SCOPE,
196
197
  ErrorType.USER,
197
198
  `String not found in ${path}: "${searchString}"`,
198
199
  { path, searchString }
@@ -204,7 +205,7 @@ class FileSystemError {
204
205
  static globFailed(pattern, cause) {
205
206
  return new DextoRuntimeError(
206
207
  FileSystemErrorCode.GLOB_FAILED,
207
- ErrorScope.FILESYSTEM,
208
+ FILESYSTEM_SCOPE,
208
209
  ErrorType.SYSTEM,
209
210
  `Glob operation failed for pattern: ${pattern}. ${cause}`,
210
211
  { pattern, cause }
@@ -216,7 +217,7 @@ class FileSystemError {
216
217
  static searchFailed(pattern, cause) {
217
218
  return new DextoRuntimeError(
218
219
  FileSystemErrorCode.SEARCH_FAILED,
219
- ErrorScope.FILESYSTEM,
220
+ FILESYSTEM_SCOPE,
220
221
  ErrorType.SYSTEM,
221
222
  `Search operation failed for pattern: ${pattern}. ${cause}`,
222
223
  { pattern, cause }
@@ -228,7 +229,7 @@ class FileSystemError {
228
229
  static invalidPattern(pattern, cause) {
229
230
  return new DextoRuntimeError(
230
231
  FileSystemErrorCode.INVALID_PATTERN,
231
- ErrorScope.FILESYSTEM,
232
+ FILESYSTEM_SCOPE,
232
233
  ErrorType.USER,
233
234
  `Invalid pattern: ${pattern}. ${cause}`,
234
235
  { pattern, cause }
@@ -240,7 +241,7 @@ class FileSystemError {
240
241
  static regexTimeout(pattern) {
241
242
  return new DextoRuntimeError(
242
243
  FileSystemErrorCode.REGEX_TIMEOUT,
243
- ErrorScope.FILESYSTEM,
244
+ FILESYSTEM_SCOPE,
244
245
  ErrorType.TIMEOUT,
245
246
  `Regex operation timed out for pattern: ${pattern}`,
246
247
  { pattern },
@@ -253,7 +254,7 @@ class FileSystemError {
253
254
  static invalidConfig(reason) {
254
255
  return new DextoRuntimeError(
255
256
  FileSystemErrorCode.INVALID_CONFIG,
256
- ErrorScope.FILESYSTEM,
257
+ FILESYSTEM_SCOPE,
257
258
  ErrorType.USER,
258
259
  `Invalid FileSystem configuration: ${reason}`,
259
260
  { reason }
@@ -265,7 +266,7 @@ class FileSystemError {
265
266
  static notInitialized() {
266
267
  return new DextoRuntimeError(
267
268
  FileSystemErrorCode.SERVICE_NOT_INITIALIZED,
268
- ErrorScope.FILESYSTEM,
269
+ FILESYSTEM_SCOPE,
269
270
  ErrorType.SYSTEM,
270
271
  "FileSystemService has not been initialized",
271
272
  {},
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dexto/tools-filesystem",
3
- "version": "1.5.4",
3
+ "version": "1.5.6",
4
4
  "description": "FileSystem tools provider for Dexto agents",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -22,7 +22,7 @@
22
22
  "glob": "^11.1.0",
23
23
  "safe-regex": "^2.1.1",
24
24
  "zod": "^3.25.0",
25
- "@dexto/core": "1.5.4"
25
+ "@dexto/core": "1.5.6"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@types/diff": "^5.2.3",