@dexto/core 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.
Files changed (102) hide show
  1. package/dist/agent/DextoAgent.cjs +61 -155
  2. package/dist/agent/DextoAgent.d.ts +11 -54
  3. package/dist/agent/DextoAgent.d.ts.map +1 -1
  4. package/dist/agent/DextoAgent.js +61 -155
  5. package/dist/context/compaction/strategies/reactive-overflow.cjs +5 -3
  6. package/dist/context/compaction/strategies/reactive-overflow.d.ts +1 -0
  7. package/dist/context/compaction/strategies/reactive-overflow.d.ts.map +1 -1
  8. package/dist/context/compaction/strategies/reactive-overflow.js +5 -3
  9. package/dist/context/compaction/types.d.ts +13 -1
  10. package/dist/context/compaction/types.d.ts.map +1 -1
  11. package/dist/errors/types.cjs +0 -2
  12. package/dist/errors/types.d.ts +1 -5
  13. package/dist/errors/types.d.ts.map +1 -1
  14. package/dist/errors/types.js +0 -2
  15. package/dist/events/index.cjs +0 -2
  16. package/dist/events/index.d.ts +6 -25
  17. package/dist/events/index.d.ts.map +1 -1
  18. package/dist/events/index.js +0 -2
  19. package/dist/llm/executor/stream-processor.cjs +85 -27
  20. package/dist/llm/executor/stream-processor.d.ts +4 -0
  21. package/dist/llm/executor/stream-processor.d.ts.map +1 -1
  22. package/dist/llm/executor/stream-processor.js +85 -27
  23. package/dist/llm/executor/turn-executor.cjs +58 -130
  24. package/dist/llm/executor/turn-executor.d.ts +9 -43
  25. package/dist/llm/executor/turn-executor.d.ts.map +1 -1
  26. package/dist/llm/executor/turn-executor.js +58 -130
  27. package/dist/llm/executor/types.d.ts +0 -28
  28. package/dist/llm/executor/types.d.ts.map +1 -1
  29. package/dist/llm/services/vercel.cjs +2 -5
  30. package/dist/llm/services/vercel.d.ts +1 -6
  31. package/dist/llm/services/vercel.d.ts.map +1 -1
  32. package/dist/llm/services/vercel.js +2 -5
  33. package/dist/logger/logger.cjs +6 -7
  34. package/dist/logger/logger.d.ts +1 -0
  35. package/dist/logger/logger.d.ts.map +1 -1
  36. package/dist/logger/logger.js +6 -7
  37. package/dist/session/chat-session.cjs +19 -12
  38. package/dist/session/chat-session.d.ts +3 -6
  39. package/dist/session/chat-session.d.ts.map +1 -1
  40. package/dist/session/chat-session.js +19 -12
  41. package/dist/session/session-manager.cjs +0 -135
  42. package/dist/session/session-manager.d.ts +0 -43
  43. package/dist/session/session-manager.d.ts.map +1 -1
  44. package/dist/session/session-manager.js +0 -135
  45. package/dist/telemetry/telemetry.cjs +12 -5
  46. package/dist/telemetry/telemetry.d.ts.map +1 -1
  47. package/dist/telemetry/telemetry.js +12 -5
  48. package/dist/tools/schemas.cjs +2 -2
  49. package/dist/tools/schemas.js +2 -2
  50. package/package.json +15 -5
  51. package/dist/filesystem/error-codes.cjs +0 -53
  52. package/dist/filesystem/error-codes.d.ts +0 -31
  53. package/dist/filesystem/error-codes.d.ts.map +0 -1
  54. package/dist/filesystem/error-codes.js +0 -30
  55. package/dist/filesystem/errors.cjs +0 -303
  56. package/dist/filesystem/errors.d.ts +0 -109
  57. package/dist/filesystem/errors.d.ts.map +0 -1
  58. package/dist/filesystem/errors.js +0 -280
  59. package/dist/filesystem/filesystem-service.cjs +0 -534
  60. package/dist/filesystem/filesystem-service.d.ts +0 -97
  61. package/dist/filesystem/filesystem-service.d.ts.map +0 -1
  62. package/dist/filesystem/filesystem-service.js +0 -501
  63. package/dist/filesystem/index.cjs +0 -37
  64. package/dist/filesystem/index.d.ts +0 -11
  65. package/dist/filesystem/index.d.ts.map +0 -1
  66. package/dist/filesystem/index.js +0 -11
  67. package/dist/filesystem/path-validator.cjs +0 -250
  68. package/dist/filesystem/path-validator.d.ts +0 -103
  69. package/dist/filesystem/path-validator.d.ts.map +0 -1
  70. package/dist/filesystem/path-validator.js +0 -217
  71. package/dist/filesystem/types.cjs +0 -16
  72. package/dist/filesystem/types.d.ts +0 -175
  73. package/dist/filesystem/types.d.ts.map +0 -1
  74. package/dist/filesystem/types.js +0 -0
  75. package/dist/process/command-validator.cjs +0 -554
  76. package/dist/process/command-validator.d.ts +0 -49
  77. package/dist/process/command-validator.d.ts.map +0 -1
  78. package/dist/process/command-validator.js +0 -531
  79. package/dist/process/error-codes.cjs +0 -47
  80. package/dist/process/error-codes.d.ts +0 -25
  81. package/dist/process/error-codes.d.ts.map +0 -1
  82. package/dist/process/error-codes.js +0 -24
  83. package/dist/process/errors.cjs +0 -244
  84. package/dist/process/errors.d.ts +0 -87
  85. package/dist/process/errors.d.ts.map +0 -1
  86. package/dist/process/errors.js +0 -221
  87. package/dist/process/index.cjs +0 -37
  88. package/dist/process/index.d.ts +0 -11
  89. package/dist/process/index.d.ts.map +0 -1
  90. package/dist/process/index.js +0 -11
  91. package/dist/process/process-service.cjs +0 -497
  92. package/dist/process/process-service.d.ts +0 -69
  93. package/dist/process/process-service.d.ts.map +0 -1
  94. package/dist/process/process-service.js +0 -464
  95. package/dist/process/types.cjs +0 -16
  96. package/dist/process/types.d.ts +0 -107
  97. package/dist/process/types.d.ts.map +0 -1
  98. package/dist/process/types.js +0 -0
  99. package/dist/session/compaction-service.cjs +0 -139
  100. package/dist/session/compaction-service.d.ts +0 -81
  101. package/dist/session/compaction-service.d.ts.map +0 -1
  102. package/dist/session/compaction-service.js +0 -106
@@ -91,15 +91,18 @@ class Telemetry {
91
91
  if (enabled) {
92
92
  let NodeSDK;
93
93
  let Resource;
94
- let getNodeAutoInstrumentations;
94
+ let HttpInstrumentation;
95
+ let UndiciInstrumentation;
95
96
  let ATTR_SERVICE_NAME;
96
97
  try {
97
98
  const sdkModule = await import("@opentelemetry/sdk-node");
98
99
  NodeSDK = sdkModule.NodeSDK;
99
100
  const resourcesModule = await import("@opentelemetry/resources");
100
101
  Resource = resourcesModule.Resource;
101
- const autoInstModule = await import("@opentelemetry/auto-instrumentations-node");
102
- getNodeAutoInstrumentations = autoInstModule.getNodeAutoInstrumentations;
102
+ const httpInstModule = await import("@opentelemetry/instrumentation-http");
103
+ HttpInstrumentation = httpInstModule.HttpInstrumentation;
104
+ const undiciInstModule = await import("@opentelemetry/instrumentation-undici");
105
+ UndiciInstrumentation = undiciInstModule.UndiciInstrumentation;
103
106
  const semanticModule = await import("@opentelemetry/semantic-conventions");
104
107
  ATTR_SERVICE_NAME = semanticModule.ATTR_SERVICE_NAME;
105
108
  } catch (importError) {
@@ -107,7 +110,8 @@ class Telemetry {
107
110
  if (err.code === "ERR_MODULE_NOT_FOUND") {
108
111
  throw TelemetryError.dependencyNotInstalled([
109
112
  "@opentelemetry/sdk-node",
110
- "@opentelemetry/auto-instrumentations-node",
113
+ "@opentelemetry/instrumentation-http",
114
+ "@opentelemetry/instrumentation-undici",
111
115
  "@opentelemetry/resources",
112
116
  "@opentelemetry/semantic-conventions",
113
117
  "@opentelemetry/sdk-trace-base",
@@ -126,7 +130,10 @@ class Telemetry {
126
130
  sdk = new NodeSDK({
127
131
  resource,
128
132
  traceExporter,
129
- instrumentations: [getNodeAutoInstrumentations()]
133
+ instrumentations: [
134
+ new HttpInstrumentation(),
135
+ new UndiciInstrumentation()
136
+ ]
130
137
  });
131
138
  await sdk.start();
132
139
  const sigterm = () => {
@@ -68,7 +68,7 @@ const ToolConfirmationConfigSchema = import_zod.z.object({
68
68
  "Tool confirmation mode: manual (interactive), auto-approve (all tools), auto-deny (no tools)"
69
69
  ),
70
70
  timeout: import_zod.z.number().int().positive().optional().describe(
71
- "Timeout for tool confirmation requests in milliseconds (optional - no timeout if not specified)"
71
+ "Timeout for tool confirmation requests in milliseconds. If not set, waits indefinitely."
72
72
  ),
73
73
  allowedToolsStorage: import_zod.z.enum(ALLOWED_TOOLS_STORAGE_TYPES).default(DEFAULT_ALLOWED_TOOLS_STORAGE).describe(
74
74
  "Storage type for remembered tool approvals: memory (session-only) or storage (persistent)"
@@ -82,7 +82,7 @@ const ElicitationConfigSchema = import_zod.z.object({
82
82
  "Enable elicitation support (ask_user tool and MCP server elicitations). When disabled, elicitation requests will be rejected."
83
83
  ),
84
84
  timeout: import_zod.z.number().int().positive().optional().describe(
85
- "Timeout for elicitation requests in milliseconds (optional - no timeout if not specified)"
85
+ "Timeout for elicitation requests in milliseconds. If not set, waits indefinitely."
86
86
  )
87
87
  }).strict().describe(
88
88
  "Elicitation configuration for user input requests. Independent from tool confirmation mode, allowing auto-approve for tools while still supporting elicitation."
@@ -33,7 +33,7 @@ const ToolConfirmationConfigSchema = z.object({
33
33
  "Tool confirmation mode: manual (interactive), auto-approve (all tools), auto-deny (no tools)"
34
34
  ),
35
35
  timeout: z.number().int().positive().optional().describe(
36
- "Timeout for tool confirmation requests in milliseconds (optional - no timeout if not specified)"
36
+ "Timeout for tool confirmation requests in milliseconds. If not set, waits indefinitely."
37
37
  ),
38
38
  allowedToolsStorage: z.enum(ALLOWED_TOOLS_STORAGE_TYPES).default(DEFAULT_ALLOWED_TOOLS_STORAGE).describe(
39
39
  "Storage type for remembered tool approvals: memory (session-only) or storage (persistent)"
@@ -47,7 +47,7 @@ const ElicitationConfigSchema = z.object({
47
47
  "Enable elicitation support (ask_user tool and MCP server elicitations). When disabled, elicitation requests will be rejected."
48
48
  ),
49
49
  timeout: z.number().int().positive().optional().describe(
50
- "Timeout for elicitation requests in milliseconds (optional - no timeout if not specified)"
50
+ "Timeout for elicitation requests in milliseconds. If not set, waits indefinitely."
51
51
  )
52
52
  }).strict().describe(
53
53
  "Elicitation configuration for user input requests. Independent from tool confirmation mode, allowing auto-approve for tools while still supporting elicitation."
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dexto/core",
3
- "version": "1.5.4",
3
+ "version": "1.5.6",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -43,15 +43,22 @@
43
43
  "zod-to-json-schema": "^3.24.6"
44
44
  },
45
45
  "devDependencies": {
46
+ "@opentelemetry/instrumentation-http": "^0.210.0",
47
+ "@opentelemetry/instrumentation-undici": "^0.20.0",
48
+ "@opentelemetry/resources": "^1.28.0",
49
+ "@opentelemetry/sdk-node": "^0.55.0",
50
+ "@opentelemetry/sdk-trace-base": "^1.28.0",
51
+ "@opentelemetry/semantic-conventions": "^1.28.0",
46
52
  "@types/diff": "^8.0.0",
47
53
  "@types/json-schema": "^7.0.15",
48
54
  "zod": "^3.25.0"
49
55
  },
50
56
  "peerDependencies": {
51
- "@opentelemetry/auto-instrumentations-node": "^0.52.1",
52
57
  "@opentelemetry/core": "^1.28.0",
53
58
  "@opentelemetry/exporter-trace-otlp-grpc": "^0.55.0",
54
59
  "@opentelemetry/exporter-trace-otlp-http": "^0.55.0",
60
+ "@opentelemetry/instrumentation-http": "^0.210.0",
61
+ "@opentelemetry/instrumentation-undici": "^0.20.0",
55
62
  "@opentelemetry/resources": "^1.28.0",
56
63
  "@opentelemetry/sdk-node": "^0.55.0",
57
64
  "@opentelemetry/sdk-trace-base": "^1.28.0",
@@ -63,9 +70,6 @@
63
70
  "zod": "^3.25.0"
64
71
  },
65
72
  "peerDependenciesMeta": {
66
- "@opentelemetry/auto-instrumentations-node": {
67
- "optional": true
68
- },
69
73
  "@opentelemetry/core": {
70
74
  "optional": true
71
75
  },
@@ -75,6 +79,12 @@
75
79
  "@opentelemetry/exporter-trace-otlp-http": {
76
80
  "optional": true
77
81
  },
82
+ "@opentelemetry/instrumentation-http": {
83
+ "optional": true
84
+ },
85
+ "@opentelemetry/instrumentation-undici": {
86
+ "optional": true
87
+ },
78
88
  "@opentelemetry/resources": {
79
89
  "optional": true
80
90
  },
@@ -1,53 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var error_codes_exports = {};
20
- __export(error_codes_exports, {
21
- FileSystemErrorCode: () => FileSystemErrorCode
22
- });
23
- module.exports = __toCommonJS(error_codes_exports);
24
- var FileSystemErrorCode = /* @__PURE__ */ ((FileSystemErrorCode2) => {
25
- FileSystemErrorCode2["FILE_NOT_FOUND"] = "FILESYSTEM_FILE_NOT_FOUND";
26
- FileSystemErrorCode2["DIRECTORY_NOT_FOUND"] = "FILESYSTEM_DIRECTORY_NOT_FOUND";
27
- FileSystemErrorCode2["PERMISSION_DENIED"] = "FILESYSTEM_PERMISSION_DENIED";
28
- FileSystemErrorCode2["PATH_NOT_ALLOWED"] = "FILESYSTEM_PATH_NOT_ALLOWED";
29
- FileSystemErrorCode2["PATH_BLOCKED"] = "FILESYSTEM_PATH_BLOCKED";
30
- FileSystemErrorCode2["INVALID_PATH"] = "FILESYSTEM_INVALID_PATH";
31
- FileSystemErrorCode2["PATH_TRAVERSAL_DETECTED"] = "FILESYSTEM_PATH_TRAVERSAL_DETECTED";
32
- FileSystemErrorCode2["INVALID_FILE_EXTENSION"] = "FILESYSTEM_INVALID_FILE_EXTENSION";
33
- FileSystemErrorCode2["INVALID_ENCODING"] = "FILESYSTEM_INVALID_ENCODING";
34
- FileSystemErrorCode2["FILE_TOO_LARGE"] = "FILESYSTEM_FILE_TOO_LARGE";
35
- FileSystemErrorCode2["TOO_MANY_RESULTS"] = "FILESYSTEM_TOO_MANY_RESULTS";
36
- FileSystemErrorCode2["READ_FAILED"] = "FILESYSTEM_READ_FAILED";
37
- FileSystemErrorCode2["WRITE_FAILED"] = "FILESYSTEM_WRITE_FAILED";
38
- FileSystemErrorCode2["BACKUP_FAILED"] = "FILESYSTEM_BACKUP_FAILED";
39
- FileSystemErrorCode2["EDIT_FAILED"] = "FILESYSTEM_EDIT_FAILED";
40
- FileSystemErrorCode2["STRING_NOT_UNIQUE"] = "FILESYSTEM_STRING_NOT_UNIQUE";
41
- FileSystemErrorCode2["STRING_NOT_FOUND"] = "FILESYSTEM_STRING_NOT_FOUND";
42
- FileSystemErrorCode2["GLOB_FAILED"] = "FILESYSTEM_GLOB_FAILED";
43
- FileSystemErrorCode2["SEARCH_FAILED"] = "FILESYSTEM_SEARCH_FAILED";
44
- FileSystemErrorCode2["INVALID_PATTERN"] = "FILESYSTEM_INVALID_PATTERN";
45
- FileSystemErrorCode2["REGEX_TIMEOUT"] = "FILESYSTEM_REGEX_TIMEOUT";
46
- FileSystemErrorCode2["INVALID_CONFIG"] = "FILESYSTEM_INVALID_CONFIG";
47
- FileSystemErrorCode2["SERVICE_NOT_INITIALIZED"] = "FILESYSTEM_SERVICE_NOT_INITIALIZED";
48
- return FileSystemErrorCode2;
49
- })(FileSystemErrorCode || {});
50
- // Annotate the CommonJS export names for ESM import in node:
51
- 0 && (module.exports = {
52
- FileSystemErrorCode
53
- });
@@ -1,31 +0,0 @@
1
- /**
2
- * FileSystem Service Error Codes
3
- *
4
- * Standardized error codes for file system operations
5
- */
6
- export declare enum FileSystemErrorCode {
7
- FILE_NOT_FOUND = "FILESYSTEM_FILE_NOT_FOUND",
8
- DIRECTORY_NOT_FOUND = "FILESYSTEM_DIRECTORY_NOT_FOUND",
9
- PERMISSION_DENIED = "FILESYSTEM_PERMISSION_DENIED",
10
- PATH_NOT_ALLOWED = "FILESYSTEM_PATH_NOT_ALLOWED",
11
- PATH_BLOCKED = "FILESYSTEM_PATH_BLOCKED",
12
- INVALID_PATH = "FILESYSTEM_INVALID_PATH",
13
- PATH_TRAVERSAL_DETECTED = "FILESYSTEM_PATH_TRAVERSAL_DETECTED",
14
- INVALID_FILE_EXTENSION = "FILESYSTEM_INVALID_FILE_EXTENSION",
15
- INVALID_ENCODING = "FILESYSTEM_INVALID_ENCODING",
16
- FILE_TOO_LARGE = "FILESYSTEM_FILE_TOO_LARGE",
17
- TOO_MANY_RESULTS = "FILESYSTEM_TOO_MANY_RESULTS",
18
- READ_FAILED = "FILESYSTEM_READ_FAILED",
19
- WRITE_FAILED = "FILESYSTEM_WRITE_FAILED",
20
- BACKUP_FAILED = "FILESYSTEM_BACKUP_FAILED",
21
- EDIT_FAILED = "FILESYSTEM_EDIT_FAILED",
22
- STRING_NOT_UNIQUE = "FILESYSTEM_STRING_NOT_UNIQUE",
23
- STRING_NOT_FOUND = "FILESYSTEM_STRING_NOT_FOUND",
24
- GLOB_FAILED = "FILESYSTEM_GLOB_FAILED",
25
- SEARCH_FAILED = "FILESYSTEM_SEARCH_FAILED",
26
- INVALID_PATTERN = "FILESYSTEM_INVALID_PATTERN",
27
- REGEX_TIMEOUT = "FILESYSTEM_REGEX_TIMEOUT",
28
- INVALID_CONFIG = "FILESYSTEM_INVALID_CONFIG",
29
- SERVICE_NOT_INITIALIZED = "FILESYSTEM_SERVICE_NOT_INITIALIZED"
30
- }
31
- //# sourceMappingURL=error-codes.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"error-codes.d.ts","sourceRoot":"","sources":["../../src/filesystem/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,30 +0,0 @@
1
- import "../chunk-PTJYTZNU.js";
2
- var FileSystemErrorCode = /* @__PURE__ */ ((FileSystemErrorCode2) => {
3
- FileSystemErrorCode2["FILE_NOT_FOUND"] = "FILESYSTEM_FILE_NOT_FOUND";
4
- FileSystemErrorCode2["DIRECTORY_NOT_FOUND"] = "FILESYSTEM_DIRECTORY_NOT_FOUND";
5
- FileSystemErrorCode2["PERMISSION_DENIED"] = "FILESYSTEM_PERMISSION_DENIED";
6
- FileSystemErrorCode2["PATH_NOT_ALLOWED"] = "FILESYSTEM_PATH_NOT_ALLOWED";
7
- FileSystemErrorCode2["PATH_BLOCKED"] = "FILESYSTEM_PATH_BLOCKED";
8
- FileSystemErrorCode2["INVALID_PATH"] = "FILESYSTEM_INVALID_PATH";
9
- FileSystemErrorCode2["PATH_TRAVERSAL_DETECTED"] = "FILESYSTEM_PATH_TRAVERSAL_DETECTED";
10
- FileSystemErrorCode2["INVALID_FILE_EXTENSION"] = "FILESYSTEM_INVALID_FILE_EXTENSION";
11
- FileSystemErrorCode2["INVALID_ENCODING"] = "FILESYSTEM_INVALID_ENCODING";
12
- FileSystemErrorCode2["FILE_TOO_LARGE"] = "FILESYSTEM_FILE_TOO_LARGE";
13
- FileSystemErrorCode2["TOO_MANY_RESULTS"] = "FILESYSTEM_TOO_MANY_RESULTS";
14
- FileSystemErrorCode2["READ_FAILED"] = "FILESYSTEM_READ_FAILED";
15
- FileSystemErrorCode2["WRITE_FAILED"] = "FILESYSTEM_WRITE_FAILED";
16
- FileSystemErrorCode2["BACKUP_FAILED"] = "FILESYSTEM_BACKUP_FAILED";
17
- FileSystemErrorCode2["EDIT_FAILED"] = "FILESYSTEM_EDIT_FAILED";
18
- FileSystemErrorCode2["STRING_NOT_UNIQUE"] = "FILESYSTEM_STRING_NOT_UNIQUE";
19
- FileSystemErrorCode2["STRING_NOT_FOUND"] = "FILESYSTEM_STRING_NOT_FOUND";
20
- FileSystemErrorCode2["GLOB_FAILED"] = "FILESYSTEM_GLOB_FAILED";
21
- FileSystemErrorCode2["SEARCH_FAILED"] = "FILESYSTEM_SEARCH_FAILED";
22
- FileSystemErrorCode2["INVALID_PATTERN"] = "FILESYSTEM_INVALID_PATTERN";
23
- FileSystemErrorCode2["REGEX_TIMEOUT"] = "FILESYSTEM_REGEX_TIMEOUT";
24
- FileSystemErrorCode2["INVALID_CONFIG"] = "FILESYSTEM_INVALID_CONFIG";
25
- FileSystemErrorCode2["SERVICE_NOT_INITIALIZED"] = "FILESYSTEM_SERVICE_NOT_INITIALIZED";
26
- return FileSystemErrorCode2;
27
- })(FileSystemErrorCode || {});
28
- export {
29
- FileSystemErrorCode
30
- };
@@ -1,303 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var errors_exports = {};
20
- __export(errors_exports, {
21
- FileSystemError: () => FileSystemError
22
- });
23
- module.exports = __toCommonJS(errors_exports);
24
- var import_errors = require("../errors/index.js");
25
- var import_types = require("../errors/types.js");
26
- var import_error_codes = require("./error-codes.js");
27
- class FileSystemError {
28
- constructor() {
29
- }
30
- /**
31
- * File not found error
32
- */
33
- static fileNotFound(path) {
34
- return new import_errors.DextoRuntimeError(
35
- import_error_codes.FileSystemErrorCode.FILE_NOT_FOUND,
36
- import_types.ErrorScope.FILESYSTEM,
37
- import_types.ErrorType.NOT_FOUND,
38
- `File not found: ${path}`,
39
- { path }
40
- );
41
- }
42
- /**
43
- * Directory not found error
44
- */
45
- static directoryNotFound(path) {
46
- return new import_errors.DextoRuntimeError(
47
- import_error_codes.FileSystemErrorCode.DIRECTORY_NOT_FOUND,
48
- import_types.ErrorScope.FILESYSTEM,
49
- import_types.ErrorType.NOT_FOUND,
50
- `Directory not found: ${path}`,
51
- { path }
52
- );
53
- }
54
- /**
55
- * Permission denied error
56
- */
57
- static permissionDenied(path, operation) {
58
- return new import_errors.DextoRuntimeError(
59
- import_error_codes.FileSystemErrorCode.PERMISSION_DENIED,
60
- import_types.ErrorScope.FILESYSTEM,
61
- import_types.ErrorType.FORBIDDEN,
62
- `Permission denied: cannot ${operation} ${path}`,
63
- { path, operation }
64
- );
65
- }
66
- /**
67
- * Path not allowed error
68
- */
69
- static pathNotAllowed(path, allowedPaths) {
70
- return new import_errors.DextoRuntimeError(
71
- import_error_codes.FileSystemErrorCode.PATH_NOT_ALLOWED,
72
- import_types.ErrorScope.FILESYSTEM,
73
- import_types.ErrorType.USER,
74
- `Path not allowed: ${path}. Must be within allowed paths: ${allowedPaths.join(", ")}`,
75
- { path, allowedPaths },
76
- "Ensure the path is within the configured allowed paths"
77
- );
78
- }
79
- /**
80
- * Path blocked error
81
- */
82
- static pathBlocked(path, reason) {
83
- return new import_errors.DextoRuntimeError(
84
- import_error_codes.FileSystemErrorCode.PATH_BLOCKED,
85
- import_types.ErrorScope.FILESYSTEM,
86
- import_types.ErrorType.FORBIDDEN,
87
- `Path is blocked: ${path}. Reason: ${reason}`,
88
- { path, reason }
89
- );
90
- }
91
- /**
92
- * Invalid path error
93
- */
94
- static invalidPath(path, reason) {
95
- return new import_errors.DextoRuntimeError(
96
- import_error_codes.FileSystemErrorCode.INVALID_PATH,
97
- import_types.ErrorScope.FILESYSTEM,
98
- import_types.ErrorType.USER,
99
- `Invalid path: ${path}. ${reason}`,
100
- { path, reason }
101
- );
102
- }
103
- /**
104
- * Path traversal detected
105
- */
106
- static pathTraversal(path) {
107
- return new import_errors.DextoRuntimeError(
108
- import_error_codes.FileSystemErrorCode.PATH_TRAVERSAL_DETECTED,
109
- import_types.ErrorScope.FILESYSTEM,
110
- import_types.ErrorType.FORBIDDEN,
111
- `Path traversal detected in: ${path}`,
112
- { path }
113
- );
114
- }
115
- /**
116
- * Invalid file extension error
117
- */
118
- static invalidExtension(path, blockedExtensions) {
119
- return new import_errors.DextoRuntimeError(
120
- import_error_codes.FileSystemErrorCode.INVALID_FILE_EXTENSION,
121
- import_types.ErrorScope.FILESYSTEM,
122
- import_types.ErrorType.USER,
123
- `Invalid file extension: ${path}. Blocked extensions: ${blockedExtensions.join(", ")}`,
124
- { path, blockedExtensions }
125
- );
126
- }
127
- /**
128
- * File too large error
129
- */
130
- static fileTooLarge(path, size, maxSize) {
131
- return new import_errors.DextoRuntimeError(
132
- import_error_codes.FileSystemErrorCode.FILE_TOO_LARGE,
133
- import_types.ErrorScope.FILESYSTEM,
134
- import_types.ErrorType.USER,
135
- `File too large: ${path} (${size} bytes). Maximum allowed: ${maxSize} bytes`,
136
- { path, size, maxSize }
137
- );
138
- }
139
- /**
140
- * Too many results error
141
- */
142
- static tooManyResults(operation, count, maxResults) {
143
- return new import_errors.DextoRuntimeError(
144
- import_error_codes.FileSystemErrorCode.TOO_MANY_RESULTS,
145
- import_types.ErrorScope.FILESYSTEM,
146
- import_types.ErrorType.USER,
147
- `Too many results from ${operation}: ${count}. Maximum allowed: ${maxResults}`,
148
- { operation, count, maxResults },
149
- "Narrow your search pattern or increase maxResults limit"
150
- );
151
- }
152
- /**
153
- * Read operation failed
154
- */
155
- static readFailed(path, cause) {
156
- return new import_errors.DextoRuntimeError(
157
- import_error_codes.FileSystemErrorCode.READ_FAILED,
158
- import_types.ErrorScope.FILESYSTEM,
159
- import_types.ErrorType.SYSTEM,
160
- `Failed to read file: ${path}. ${cause}`,
161
- { path, cause }
162
- );
163
- }
164
- /**
165
- * Write operation failed
166
- */
167
- static writeFailed(path, cause) {
168
- return new import_errors.DextoRuntimeError(
169
- import_error_codes.FileSystemErrorCode.WRITE_FAILED,
170
- import_types.ErrorScope.FILESYSTEM,
171
- import_types.ErrorType.SYSTEM,
172
- `Failed to write file: ${path}. ${cause}`,
173
- { path, cause }
174
- );
175
- }
176
- /**
177
- * Backup creation failed
178
- */
179
- static backupFailed(path, cause) {
180
- return new import_errors.DextoRuntimeError(
181
- import_error_codes.FileSystemErrorCode.BACKUP_FAILED,
182
- import_types.ErrorScope.FILESYSTEM,
183
- import_types.ErrorType.SYSTEM,
184
- `Failed to create backup for: ${path}. ${cause}`,
185
- { path, cause }
186
- );
187
- }
188
- /**
189
- * Edit operation failed
190
- */
191
- static editFailed(path, cause) {
192
- return new import_errors.DextoRuntimeError(
193
- import_error_codes.FileSystemErrorCode.EDIT_FAILED,
194
- import_types.ErrorScope.FILESYSTEM,
195
- import_types.ErrorType.SYSTEM,
196
- `Failed to edit file: ${path}. ${cause}`,
197
- { path, cause }
198
- );
199
- }
200
- /**
201
- * String not unique error
202
- */
203
- static stringNotUnique(path, searchString, occurrences) {
204
- return new import_errors.DextoRuntimeError(
205
- import_error_codes.FileSystemErrorCode.STRING_NOT_UNIQUE,
206
- import_types.ErrorScope.FILESYSTEM,
207
- import_types.ErrorType.USER,
208
- `String is not unique in ${path}: "${searchString}" found ${occurrences} times. Use replaceAll=true or provide a more specific string.`,
209
- { path, searchString, occurrences },
210
- "Use replaceAll option or provide more context in the search string"
211
- );
212
- }
213
- /**
214
- * String not found error
215
- */
216
- static stringNotFound(path, searchString) {
217
- return new import_errors.DextoRuntimeError(
218
- import_error_codes.FileSystemErrorCode.STRING_NOT_FOUND,
219
- import_types.ErrorScope.FILESYSTEM,
220
- import_types.ErrorType.USER,
221
- `String not found in ${path}: "${searchString}"`,
222
- { path, searchString }
223
- );
224
- }
225
- /**
226
- * Glob operation failed
227
- */
228
- static globFailed(pattern, cause) {
229
- return new import_errors.DextoRuntimeError(
230
- import_error_codes.FileSystemErrorCode.GLOB_FAILED,
231
- import_types.ErrorScope.FILESYSTEM,
232
- import_types.ErrorType.SYSTEM,
233
- `Glob operation failed for pattern: ${pattern}. ${cause}`,
234
- { pattern, cause }
235
- );
236
- }
237
- /**
238
- * Search operation failed
239
- */
240
- static searchFailed(pattern, cause) {
241
- return new import_errors.DextoRuntimeError(
242
- import_error_codes.FileSystemErrorCode.SEARCH_FAILED,
243
- import_types.ErrorScope.FILESYSTEM,
244
- import_types.ErrorType.SYSTEM,
245
- `Search operation failed for pattern: ${pattern}. ${cause}`,
246
- { pattern, cause }
247
- );
248
- }
249
- /**
250
- * Invalid pattern error
251
- */
252
- static invalidPattern(pattern, cause) {
253
- return new import_errors.DextoRuntimeError(
254
- import_error_codes.FileSystemErrorCode.INVALID_PATTERN,
255
- import_types.ErrorScope.FILESYSTEM,
256
- import_types.ErrorType.USER,
257
- `Invalid pattern: ${pattern}. ${cause}`,
258
- { pattern, cause }
259
- );
260
- }
261
- /**
262
- * Regex timeout error
263
- */
264
- static regexTimeout(pattern) {
265
- return new import_errors.DextoRuntimeError(
266
- import_error_codes.FileSystemErrorCode.REGEX_TIMEOUT,
267
- import_types.ErrorScope.FILESYSTEM,
268
- import_types.ErrorType.TIMEOUT,
269
- `Regex operation timed out for pattern: ${pattern}`,
270
- { pattern },
271
- "Simplify your regex pattern or increase timeout"
272
- );
273
- }
274
- /**
275
- * Invalid configuration error
276
- */
277
- static invalidConfig(reason) {
278
- return new import_errors.DextoRuntimeError(
279
- import_error_codes.FileSystemErrorCode.INVALID_CONFIG,
280
- import_types.ErrorScope.FILESYSTEM,
281
- import_types.ErrorType.USER,
282
- `Invalid FileSystem configuration: ${reason}`,
283
- { reason }
284
- );
285
- }
286
- /**
287
- * Service not initialized error
288
- */
289
- static notInitialized() {
290
- return new import_errors.DextoRuntimeError(
291
- import_error_codes.FileSystemErrorCode.SERVICE_NOT_INITIALIZED,
292
- import_types.ErrorScope.FILESYSTEM,
293
- import_types.ErrorType.SYSTEM,
294
- "FileSystemService has not been initialized",
295
- {},
296
- "Initialize the FileSystemService before using it"
297
- );
298
- }
299
- }
300
- // Annotate the CommonJS export names for ESM import in node:
301
- 0 && (module.exports = {
302
- FileSystemError
303
- });
@@ -1,109 +0,0 @@
1
- /**
2
- * FileSystem Service Errors
3
- *
4
- * Error classes for file system operations
5
- */
6
- import { DextoRuntimeError } from '../errors/index.js';
7
- export interface FileSystemErrorContext {
8
- path?: string;
9
- pattern?: string;
10
- size?: number;
11
- maxSize?: number;
12
- encoding?: string;
13
- operation?: string;
14
- }
15
- /**
16
- * Factory class for creating FileSystem-related errors
17
- */
18
- export declare class FileSystemError {
19
- private constructor();
20
- /**
21
- * File not found error
22
- */
23
- static fileNotFound(path: string): DextoRuntimeError;
24
- /**
25
- * Directory not found error
26
- */
27
- static directoryNotFound(path: string): DextoRuntimeError;
28
- /**
29
- * Permission denied error
30
- */
31
- static permissionDenied(path: string, operation: string): DextoRuntimeError;
32
- /**
33
- * Path not allowed error
34
- */
35
- static pathNotAllowed(path: string, allowedPaths: string[]): DextoRuntimeError;
36
- /**
37
- * Path blocked error
38
- */
39
- static pathBlocked(path: string, reason: string): DextoRuntimeError;
40
- /**
41
- * Invalid path error
42
- */
43
- static invalidPath(path: string, reason: string): DextoRuntimeError;
44
- /**
45
- * Path traversal detected
46
- */
47
- static pathTraversal(path: string): DextoRuntimeError;
48
- /**
49
- * Invalid file extension error
50
- */
51
- static invalidExtension(path: string, blockedExtensions: string[]): DextoRuntimeError;
52
- /**
53
- * File too large error
54
- */
55
- static fileTooLarge(path: string, size: number, maxSize: number): DextoRuntimeError;
56
- /**
57
- * Too many results error
58
- */
59
- static tooManyResults(operation: string, count: number, maxResults: number): DextoRuntimeError;
60
- /**
61
- * Read operation failed
62
- */
63
- static readFailed(path: string, cause: string): DextoRuntimeError;
64
- /**
65
- * Write operation failed
66
- */
67
- static writeFailed(path: string, cause: string): DextoRuntimeError;
68
- /**
69
- * Backup creation failed
70
- */
71
- static backupFailed(path: string, cause: string): DextoRuntimeError;
72
- /**
73
- * Edit operation failed
74
- */
75
- static editFailed(path: string, cause: string): DextoRuntimeError;
76
- /**
77
- * String not unique error
78
- */
79
- static stringNotUnique(path: string, searchString: string, occurrences: number): DextoRuntimeError;
80
- /**
81
- * String not found error
82
- */
83
- static stringNotFound(path: string, searchString: string): DextoRuntimeError;
84
- /**
85
- * Glob operation failed
86
- */
87
- static globFailed(pattern: string, cause: string): DextoRuntimeError;
88
- /**
89
- * Search operation failed
90
- */
91
- static searchFailed(pattern: string, cause: string): DextoRuntimeError;
92
- /**
93
- * Invalid pattern error
94
- */
95
- static invalidPattern(pattern: string, cause: string): DextoRuntimeError;
96
- /**
97
- * Regex timeout error
98
- */
99
- static regexTimeout(pattern: string): DextoRuntimeError;
100
- /**
101
- * Invalid configuration error
102
- */
103
- static invalidConfig(reason: string): DextoRuntimeError;
104
- /**
105
- * Service not initialized error
106
- */
107
- static notInitialized(): DextoRuntimeError;
108
- }
109
- //# sourceMappingURL=errors.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/filesystem/errors.ts"],"names":[],"mappings":"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"}