@dexto/tools-process 1.5.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.
Files changed (42) hide show
  1. package/LICENSE +44 -0
  2. package/dist/bash-exec-tool.cjs +130 -0
  3. package/dist/bash-exec-tool.d.cts +17 -0
  4. package/dist/bash-exec-tool.d.ts +17 -0
  5. package/dist/bash-exec-tool.js +96 -0
  6. package/dist/bash-output-tool.cjs +49 -0
  7. package/dist/bash-output-tool.d.cts +16 -0
  8. package/dist/bash-output-tool.d.ts +16 -0
  9. package/dist/bash-output-tool.js +25 -0
  10. package/dist/command-validator.cjs +554 -0
  11. package/dist/command-validator.d.cts +52 -0
  12. package/dist/command-validator.d.ts +52 -0
  13. package/dist/command-validator.js +530 -0
  14. package/dist/error-codes.cjs +47 -0
  15. package/dist/error-codes.d.cts +26 -0
  16. package/dist/error-codes.d.ts +26 -0
  17. package/dist/error-codes.js +23 -0
  18. package/dist/errors.cjs +243 -0
  19. package/dist/errors.d.cts +90 -0
  20. package/dist/errors.d.ts +90 -0
  21. package/dist/errors.js +219 -0
  22. package/dist/index.cjs +49 -0
  23. package/dist/index.d.cts +11 -0
  24. package/dist/index.d.ts +11 -0
  25. package/dist/index.js +18 -0
  26. package/dist/kill-process-tool.cjs +47 -0
  27. package/dist/kill-process-tool.d.cts +16 -0
  28. package/dist/kill-process-tool.d.ts +16 -0
  29. package/dist/kill-process-tool.js +23 -0
  30. package/dist/process-service.cjs +544 -0
  31. package/dist/process-service.d.cts +96 -0
  32. package/dist/process-service.d.ts +96 -0
  33. package/dist/process-service.js +510 -0
  34. package/dist/tool-provider.cjs +96 -0
  35. package/dist/tool-provider.d.cts +72 -0
  36. package/dist/tool-provider.d.ts +72 -0
  37. package/dist/tool-provider.js +72 -0
  38. package/dist/types.cjs +16 -0
  39. package/dist/types.d.cts +108 -0
  40. package/dist/types.d.ts +108 -0
  41. package/dist/types.js +0 -0
  42. package/package.json +38 -0
@@ -0,0 +1,243 @@
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
+ ProcessError: () => ProcessError
22
+ });
23
+ module.exports = __toCommonJS(errors_exports);
24
+ var import_core = require("@dexto/core");
25
+ var import_error_codes = require("./error-codes.js");
26
+ class ProcessError {
27
+ constructor() {
28
+ }
29
+ /**
30
+ * Invalid command error
31
+ */
32
+ static invalidCommand(command, reason) {
33
+ return new import_core.DextoRuntimeError(
34
+ import_error_codes.ProcessErrorCode.INVALID_COMMAND,
35
+ import_core.ErrorScope.PROCESS,
36
+ import_core.ErrorType.USER,
37
+ `Invalid command: ${command}. ${reason}`,
38
+ { command, reason }
39
+ );
40
+ }
41
+ /**
42
+ * Command blocked error
43
+ */
44
+ static commandBlocked(command, reason) {
45
+ return new import_core.DextoRuntimeError(
46
+ import_error_codes.ProcessErrorCode.COMMAND_BLOCKED,
47
+ import_core.ErrorScope.PROCESS,
48
+ import_core.ErrorType.FORBIDDEN,
49
+ `Command is blocked: ${command}. ${reason}`,
50
+ { command, reason }
51
+ );
52
+ }
53
+ /**
54
+ * Command too long error
55
+ */
56
+ static commandTooLong(length, maxLength) {
57
+ return new import_core.DextoRuntimeError(
58
+ import_error_codes.ProcessErrorCode.COMMAND_TOO_LONG,
59
+ import_core.ErrorScope.PROCESS,
60
+ import_core.ErrorType.USER,
61
+ `Command too long: ${length} characters. Maximum allowed: ${maxLength}`,
62
+ { length, maxLength }
63
+ );
64
+ }
65
+ /**
66
+ * Command injection detected error
67
+ */
68
+ static commandInjection(command, pattern) {
69
+ return new import_core.DextoRuntimeError(
70
+ import_error_codes.ProcessErrorCode.INJECTION_DETECTED,
71
+ import_core.ErrorScope.PROCESS,
72
+ import_core.ErrorType.FORBIDDEN,
73
+ `Potential command injection detected in: ${command}. Pattern: ${pattern}`,
74
+ { command, pattern }
75
+ );
76
+ }
77
+ /**
78
+ * Command approval required error
79
+ */
80
+ static approvalRequired(command, reason) {
81
+ return new import_core.DextoRuntimeError(
82
+ import_error_codes.ProcessErrorCode.APPROVAL_REQUIRED,
83
+ import_core.ErrorScope.PROCESS,
84
+ import_core.ErrorType.FORBIDDEN,
85
+ `Command requires approval: ${command}${reason ? `. ${reason}` : ""}`,
86
+ { command, reason },
87
+ "Provide an approval function to execute dangerous commands"
88
+ );
89
+ }
90
+ /**
91
+ * Command approval denied error
92
+ */
93
+ static approvalDenied(command) {
94
+ return new import_core.DextoRuntimeError(
95
+ import_error_codes.ProcessErrorCode.APPROVAL_DENIED,
96
+ import_core.ErrorScope.PROCESS,
97
+ import_core.ErrorType.FORBIDDEN,
98
+ `Command approval denied by user: ${command}`,
99
+ { command }
100
+ );
101
+ }
102
+ /**
103
+ * Command execution failed error
104
+ */
105
+ static executionFailed(command, cause) {
106
+ return new import_core.DextoRuntimeError(
107
+ import_error_codes.ProcessErrorCode.EXECUTION_FAILED,
108
+ import_core.ErrorScope.PROCESS,
109
+ import_core.ErrorType.SYSTEM,
110
+ `Command execution failed: ${command}. ${cause}`,
111
+ { command, cause }
112
+ );
113
+ }
114
+ /**
115
+ * Command timeout error
116
+ */
117
+ static timeout(command, timeout) {
118
+ return new import_core.DextoRuntimeError(
119
+ import_error_codes.ProcessErrorCode.TIMEOUT,
120
+ import_core.ErrorScope.PROCESS,
121
+ import_core.ErrorType.TIMEOUT,
122
+ `Command timed out after ${timeout}ms: ${command}`,
123
+ { command, timeout },
124
+ "Increase timeout or optimize the command"
125
+ );
126
+ }
127
+ /**
128
+ * Permission denied error
129
+ */
130
+ static permissionDenied(command) {
131
+ return new import_core.DextoRuntimeError(
132
+ import_error_codes.ProcessErrorCode.PERMISSION_DENIED,
133
+ import_core.ErrorScope.PROCESS,
134
+ import_core.ErrorType.FORBIDDEN,
135
+ `Permission denied: ${command}`,
136
+ { command }
137
+ );
138
+ }
139
+ /**
140
+ * Command not found error
141
+ */
142
+ static commandNotFound(command) {
143
+ return new import_core.DextoRuntimeError(
144
+ import_error_codes.ProcessErrorCode.COMMAND_NOT_FOUND,
145
+ import_core.ErrorScope.PROCESS,
146
+ import_core.ErrorType.NOT_FOUND,
147
+ `Command not found: ${command}`,
148
+ { command },
149
+ "Ensure the command is installed and available in PATH"
150
+ );
151
+ }
152
+ /**
153
+ * Invalid working directory error
154
+ */
155
+ static invalidWorkingDirectory(path, reason) {
156
+ return new import_core.DextoRuntimeError(
157
+ import_error_codes.ProcessErrorCode.WORKING_DIRECTORY_INVALID,
158
+ import_core.ErrorScope.PROCESS,
159
+ import_core.ErrorType.USER,
160
+ `Invalid working directory: ${path}. ${reason}`,
161
+ { path, reason }
162
+ );
163
+ }
164
+ /**
165
+ * Process not found error
166
+ */
167
+ static processNotFound(processId) {
168
+ return new import_core.DextoRuntimeError(
169
+ import_error_codes.ProcessErrorCode.PROCESS_NOT_FOUND,
170
+ import_core.ErrorScope.PROCESS,
171
+ import_core.ErrorType.NOT_FOUND,
172
+ `Process not found: ${processId}`,
173
+ { processId }
174
+ );
175
+ }
176
+ /**
177
+ * Too many concurrent processes error
178
+ */
179
+ static tooManyProcesses(current, max) {
180
+ return new import_core.DextoRuntimeError(
181
+ import_error_codes.ProcessErrorCode.TOO_MANY_PROCESSES,
182
+ import_core.ErrorScope.PROCESS,
183
+ import_core.ErrorType.USER,
184
+ `Too many concurrent processes: ${current}. Maximum allowed: ${max}`,
185
+ { current, max },
186
+ "Wait for running processes to complete or increase the limit"
187
+ );
188
+ }
189
+ /**
190
+ * Kill process failed error
191
+ */
192
+ static killFailed(processId, cause) {
193
+ return new import_core.DextoRuntimeError(
194
+ import_error_codes.ProcessErrorCode.KILL_FAILED,
195
+ import_core.ErrorScope.PROCESS,
196
+ import_core.ErrorType.SYSTEM,
197
+ `Failed to kill process ${processId}: ${cause}`,
198
+ { processId, cause }
199
+ );
200
+ }
201
+ /**
202
+ * Output buffer full error
203
+ */
204
+ static outputBufferFull(processId, size, maxSize) {
205
+ return new import_core.DextoRuntimeError(
206
+ import_error_codes.ProcessErrorCode.OUTPUT_BUFFER_FULL,
207
+ import_core.ErrorScope.PROCESS,
208
+ import_core.ErrorType.SYSTEM,
209
+ `Output buffer full for process ${processId}: ${size} bytes. Maximum: ${maxSize}`,
210
+ { processId, size, maxSize },
211
+ "Process output exceeded buffer limit"
212
+ );
213
+ }
214
+ /**
215
+ * Invalid configuration error
216
+ */
217
+ static invalidConfig(reason) {
218
+ return new import_core.DextoRuntimeError(
219
+ import_error_codes.ProcessErrorCode.INVALID_CONFIG,
220
+ import_core.ErrorScope.PROCESS,
221
+ import_core.ErrorType.USER,
222
+ `Invalid Process configuration: ${reason}`,
223
+ { reason }
224
+ );
225
+ }
226
+ /**
227
+ * Service not initialized error
228
+ */
229
+ static notInitialized() {
230
+ return new import_core.DextoRuntimeError(
231
+ import_error_codes.ProcessErrorCode.SERVICE_NOT_INITIALIZED,
232
+ import_core.ErrorScope.PROCESS,
233
+ import_core.ErrorType.SYSTEM,
234
+ "ProcessService has not been initialized",
235
+ {},
236
+ "Initialize the ProcessService before using it"
237
+ );
238
+ }
239
+ }
240
+ // Annotate the CommonJS export names for ESM import in node:
241
+ 0 && (module.exports = {
242
+ ProcessError
243
+ });
@@ -0,0 +1,90 @@
1
+ import { DextoRuntimeError } from '@dexto/core';
2
+
3
+ /**
4
+ * Process Service Errors
5
+ *
6
+ * Error classes for process execution and management
7
+ */
8
+
9
+ interface ProcessErrorContext {
10
+ command?: string;
11
+ processId?: string;
12
+ timeout?: number;
13
+ [key: string]: unknown;
14
+ }
15
+ /**
16
+ * Factory class for creating Process-related errors
17
+ */
18
+ declare class ProcessError {
19
+ private constructor();
20
+ /**
21
+ * Invalid command error
22
+ */
23
+ static invalidCommand(command: string, reason: string): DextoRuntimeError;
24
+ /**
25
+ * Command blocked error
26
+ */
27
+ static commandBlocked(command: string, reason: string): DextoRuntimeError;
28
+ /**
29
+ * Command too long error
30
+ */
31
+ static commandTooLong(length: number, maxLength: number): DextoRuntimeError;
32
+ /**
33
+ * Command injection detected error
34
+ */
35
+ static commandInjection(command: string, pattern: string): DextoRuntimeError;
36
+ /**
37
+ * Command approval required error
38
+ */
39
+ static approvalRequired(command: string, reason?: string): DextoRuntimeError;
40
+ /**
41
+ * Command approval denied error
42
+ */
43
+ static approvalDenied(command: string): DextoRuntimeError;
44
+ /**
45
+ * Command execution failed error
46
+ */
47
+ static executionFailed(command: string, cause: string): DextoRuntimeError;
48
+ /**
49
+ * Command timeout error
50
+ */
51
+ static timeout(command: string, timeout: number): DextoRuntimeError;
52
+ /**
53
+ * Permission denied error
54
+ */
55
+ static permissionDenied(command: string): DextoRuntimeError;
56
+ /**
57
+ * Command not found error
58
+ */
59
+ static commandNotFound(command: string): DextoRuntimeError;
60
+ /**
61
+ * Invalid working directory error
62
+ */
63
+ static invalidWorkingDirectory(path: string, reason: string): DextoRuntimeError;
64
+ /**
65
+ * Process not found error
66
+ */
67
+ static processNotFound(processId: string): DextoRuntimeError;
68
+ /**
69
+ * Too many concurrent processes error
70
+ */
71
+ static tooManyProcesses(current: number, max: number): DextoRuntimeError;
72
+ /**
73
+ * Kill process failed error
74
+ */
75
+ static killFailed(processId: string, cause: string): DextoRuntimeError;
76
+ /**
77
+ * Output buffer full error
78
+ */
79
+ static outputBufferFull(processId: string, size: number, maxSize: number): DextoRuntimeError;
80
+ /**
81
+ * Invalid configuration error
82
+ */
83
+ static invalidConfig(reason: string): DextoRuntimeError;
84
+ /**
85
+ * Service not initialized error
86
+ */
87
+ static notInitialized(): DextoRuntimeError;
88
+ }
89
+
90
+ export { ProcessError, type ProcessErrorContext };
@@ -0,0 +1,90 @@
1
+ import { DextoRuntimeError } from '@dexto/core';
2
+
3
+ /**
4
+ * Process Service Errors
5
+ *
6
+ * Error classes for process execution and management
7
+ */
8
+
9
+ interface ProcessErrorContext {
10
+ command?: string;
11
+ processId?: string;
12
+ timeout?: number;
13
+ [key: string]: unknown;
14
+ }
15
+ /**
16
+ * Factory class for creating Process-related errors
17
+ */
18
+ declare class ProcessError {
19
+ private constructor();
20
+ /**
21
+ * Invalid command error
22
+ */
23
+ static invalidCommand(command: string, reason: string): DextoRuntimeError;
24
+ /**
25
+ * Command blocked error
26
+ */
27
+ static commandBlocked(command: string, reason: string): DextoRuntimeError;
28
+ /**
29
+ * Command too long error
30
+ */
31
+ static commandTooLong(length: number, maxLength: number): DextoRuntimeError;
32
+ /**
33
+ * Command injection detected error
34
+ */
35
+ static commandInjection(command: string, pattern: string): DextoRuntimeError;
36
+ /**
37
+ * Command approval required error
38
+ */
39
+ static approvalRequired(command: string, reason?: string): DextoRuntimeError;
40
+ /**
41
+ * Command approval denied error
42
+ */
43
+ static approvalDenied(command: string): DextoRuntimeError;
44
+ /**
45
+ * Command execution failed error
46
+ */
47
+ static executionFailed(command: string, cause: string): DextoRuntimeError;
48
+ /**
49
+ * Command timeout error
50
+ */
51
+ static timeout(command: string, timeout: number): DextoRuntimeError;
52
+ /**
53
+ * Permission denied error
54
+ */
55
+ static permissionDenied(command: string): DextoRuntimeError;
56
+ /**
57
+ * Command not found error
58
+ */
59
+ static commandNotFound(command: string): DextoRuntimeError;
60
+ /**
61
+ * Invalid working directory error
62
+ */
63
+ static invalidWorkingDirectory(path: string, reason: string): DextoRuntimeError;
64
+ /**
65
+ * Process not found error
66
+ */
67
+ static processNotFound(processId: string): DextoRuntimeError;
68
+ /**
69
+ * Too many concurrent processes error
70
+ */
71
+ static tooManyProcesses(current: number, max: number): DextoRuntimeError;
72
+ /**
73
+ * Kill process failed error
74
+ */
75
+ static killFailed(processId: string, cause: string): DextoRuntimeError;
76
+ /**
77
+ * Output buffer full error
78
+ */
79
+ static outputBufferFull(processId: string, size: number, maxSize: number): DextoRuntimeError;
80
+ /**
81
+ * Invalid configuration error
82
+ */
83
+ static invalidConfig(reason: string): DextoRuntimeError;
84
+ /**
85
+ * Service not initialized error
86
+ */
87
+ static notInitialized(): DextoRuntimeError;
88
+ }
89
+
90
+ export { ProcessError, type ProcessErrorContext };
package/dist/errors.js ADDED
@@ -0,0 +1,219 @@
1
+ import { DextoRuntimeError, ErrorScope, ErrorType } from "@dexto/core";
2
+ import { ProcessErrorCode } from "./error-codes.js";
3
+ class ProcessError {
4
+ constructor() {
5
+ }
6
+ /**
7
+ * Invalid command error
8
+ */
9
+ static invalidCommand(command, reason) {
10
+ return new DextoRuntimeError(
11
+ ProcessErrorCode.INVALID_COMMAND,
12
+ ErrorScope.PROCESS,
13
+ ErrorType.USER,
14
+ `Invalid command: ${command}. ${reason}`,
15
+ { command, reason }
16
+ );
17
+ }
18
+ /**
19
+ * Command blocked error
20
+ */
21
+ static commandBlocked(command, reason) {
22
+ return new DextoRuntimeError(
23
+ ProcessErrorCode.COMMAND_BLOCKED,
24
+ ErrorScope.PROCESS,
25
+ ErrorType.FORBIDDEN,
26
+ `Command is blocked: ${command}. ${reason}`,
27
+ { command, reason }
28
+ );
29
+ }
30
+ /**
31
+ * Command too long error
32
+ */
33
+ static commandTooLong(length, maxLength) {
34
+ return new DextoRuntimeError(
35
+ ProcessErrorCode.COMMAND_TOO_LONG,
36
+ ErrorScope.PROCESS,
37
+ ErrorType.USER,
38
+ `Command too long: ${length} characters. Maximum allowed: ${maxLength}`,
39
+ { length, maxLength }
40
+ );
41
+ }
42
+ /**
43
+ * Command injection detected error
44
+ */
45
+ static commandInjection(command, pattern) {
46
+ return new DextoRuntimeError(
47
+ ProcessErrorCode.INJECTION_DETECTED,
48
+ ErrorScope.PROCESS,
49
+ ErrorType.FORBIDDEN,
50
+ `Potential command injection detected in: ${command}. Pattern: ${pattern}`,
51
+ { command, pattern }
52
+ );
53
+ }
54
+ /**
55
+ * Command approval required error
56
+ */
57
+ static approvalRequired(command, reason) {
58
+ return new DextoRuntimeError(
59
+ ProcessErrorCode.APPROVAL_REQUIRED,
60
+ ErrorScope.PROCESS,
61
+ ErrorType.FORBIDDEN,
62
+ `Command requires approval: ${command}${reason ? `. ${reason}` : ""}`,
63
+ { command, reason },
64
+ "Provide an approval function to execute dangerous commands"
65
+ );
66
+ }
67
+ /**
68
+ * Command approval denied error
69
+ */
70
+ static approvalDenied(command) {
71
+ return new DextoRuntimeError(
72
+ ProcessErrorCode.APPROVAL_DENIED,
73
+ ErrorScope.PROCESS,
74
+ ErrorType.FORBIDDEN,
75
+ `Command approval denied by user: ${command}`,
76
+ { command }
77
+ );
78
+ }
79
+ /**
80
+ * Command execution failed error
81
+ */
82
+ static executionFailed(command, cause) {
83
+ return new DextoRuntimeError(
84
+ ProcessErrorCode.EXECUTION_FAILED,
85
+ ErrorScope.PROCESS,
86
+ ErrorType.SYSTEM,
87
+ `Command execution failed: ${command}. ${cause}`,
88
+ { command, cause }
89
+ );
90
+ }
91
+ /**
92
+ * Command timeout error
93
+ */
94
+ static timeout(command, timeout) {
95
+ return new DextoRuntimeError(
96
+ ProcessErrorCode.TIMEOUT,
97
+ ErrorScope.PROCESS,
98
+ ErrorType.TIMEOUT,
99
+ `Command timed out after ${timeout}ms: ${command}`,
100
+ { command, timeout },
101
+ "Increase timeout or optimize the command"
102
+ );
103
+ }
104
+ /**
105
+ * Permission denied error
106
+ */
107
+ static permissionDenied(command) {
108
+ return new DextoRuntimeError(
109
+ ProcessErrorCode.PERMISSION_DENIED,
110
+ ErrorScope.PROCESS,
111
+ ErrorType.FORBIDDEN,
112
+ `Permission denied: ${command}`,
113
+ { command }
114
+ );
115
+ }
116
+ /**
117
+ * Command not found error
118
+ */
119
+ static commandNotFound(command) {
120
+ return new DextoRuntimeError(
121
+ ProcessErrorCode.COMMAND_NOT_FOUND,
122
+ ErrorScope.PROCESS,
123
+ ErrorType.NOT_FOUND,
124
+ `Command not found: ${command}`,
125
+ { command },
126
+ "Ensure the command is installed and available in PATH"
127
+ );
128
+ }
129
+ /**
130
+ * Invalid working directory error
131
+ */
132
+ static invalidWorkingDirectory(path, reason) {
133
+ return new DextoRuntimeError(
134
+ ProcessErrorCode.WORKING_DIRECTORY_INVALID,
135
+ ErrorScope.PROCESS,
136
+ ErrorType.USER,
137
+ `Invalid working directory: ${path}. ${reason}`,
138
+ { path, reason }
139
+ );
140
+ }
141
+ /**
142
+ * Process not found error
143
+ */
144
+ static processNotFound(processId) {
145
+ return new DextoRuntimeError(
146
+ ProcessErrorCode.PROCESS_NOT_FOUND,
147
+ ErrorScope.PROCESS,
148
+ ErrorType.NOT_FOUND,
149
+ `Process not found: ${processId}`,
150
+ { processId }
151
+ );
152
+ }
153
+ /**
154
+ * Too many concurrent processes error
155
+ */
156
+ static tooManyProcesses(current, max) {
157
+ return new DextoRuntimeError(
158
+ ProcessErrorCode.TOO_MANY_PROCESSES,
159
+ ErrorScope.PROCESS,
160
+ ErrorType.USER,
161
+ `Too many concurrent processes: ${current}. Maximum allowed: ${max}`,
162
+ { current, max },
163
+ "Wait for running processes to complete or increase the limit"
164
+ );
165
+ }
166
+ /**
167
+ * Kill process failed error
168
+ */
169
+ static killFailed(processId, cause) {
170
+ return new DextoRuntimeError(
171
+ ProcessErrorCode.KILL_FAILED,
172
+ ErrorScope.PROCESS,
173
+ ErrorType.SYSTEM,
174
+ `Failed to kill process ${processId}: ${cause}`,
175
+ { processId, cause }
176
+ );
177
+ }
178
+ /**
179
+ * Output buffer full error
180
+ */
181
+ static outputBufferFull(processId, size, maxSize) {
182
+ return new DextoRuntimeError(
183
+ ProcessErrorCode.OUTPUT_BUFFER_FULL,
184
+ ErrorScope.PROCESS,
185
+ ErrorType.SYSTEM,
186
+ `Output buffer full for process ${processId}: ${size} bytes. Maximum: ${maxSize}`,
187
+ { processId, size, maxSize },
188
+ "Process output exceeded buffer limit"
189
+ );
190
+ }
191
+ /**
192
+ * Invalid configuration error
193
+ */
194
+ static invalidConfig(reason) {
195
+ return new DextoRuntimeError(
196
+ ProcessErrorCode.INVALID_CONFIG,
197
+ ErrorScope.PROCESS,
198
+ ErrorType.USER,
199
+ `Invalid Process configuration: ${reason}`,
200
+ { reason }
201
+ );
202
+ }
203
+ /**
204
+ * Service not initialized error
205
+ */
206
+ static notInitialized() {
207
+ return new DextoRuntimeError(
208
+ ProcessErrorCode.SERVICE_NOT_INITIALIZED,
209
+ ErrorScope.PROCESS,
210
+ ErrorType.SYSTEM,
211
+ "ProcessService has not been initialized",
212
+ {},
213
+ "Initialize the ProcessService before using it"
214
+ );
215
+ }
216
+ }
217
+ export {
218
+ ProcessError
219
+ };
package/dist/index.cjs ADDED
@@ -0,0 +1,49 @@
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 index_exports = {};
20
+ __export(index_exports, {
21
+ CommandValidator: () => import_command_validator.CommandValidator,
22
+ ProcessError: () => import_errors.ProcessError,
23
+ ProcessErrorCode: () => import_error_codes.ProcessErrorCode,
24
+ ProcessService: () => import_process_service.ProcessService,
25
+ createBashExecTool: () => import_bash_exec_tool.createBashExecTool,
26
+ createBashOutputTool: () => import_bash_output_tool.createBashOutputTool,
27
+ createKillProcessTool: () => import_kill_process_tool.createKillProcessTool,
28
+ processToolsProvider: () => import_tool_provider.processToolsProvider
29
+ });
30
+ module.exports = __toCommonJS(index_exports);
31
+ var import_tool_provider = require("./tool-provider.js");
32
+ var import_process_service = require("./process-service.js");
33
+ var import_command_validator = require("./command-validator.js");
34
+ var import_errors = require("./errors.js");
35
+ var import_error_codes = require("./error-codes.js");
36
+ var import_bash_exec_tool = require("./bash-exec-tool.js");
37
+ var import_bash_output_tool = require("./bash-output-tool.js");
38
+ var import_kill_process_tool = require("./kill-process-tool.js");
39
+ // Annotate the CommonJS export names for ESM import in node:
40
+ 0 && (module.exports = {
41
+ CommandValidator,
42
+ ProcessError,
43
+ ProcessErrorCode,
44
+ ProcessService,
45
+ createBashExecTool,
46
+ createBashOutputTool,
47
+ createKillProcessTool,
48
+ processToolsProvider
49
+ });
@@ -0,0 +1,11 @@
1
+ export { processToolsProvider } from './tool-provider.cjs';
2
+ export { ProcessService } from './process-service.cjs';
3
+ export { CommandValidator } from './command-validator.cjs';
4
+ export { ProcessError } from './errors.cjs';
5
+ export { ProcessErrorCode } from './error-codes.cjs';
6
+ export { CommandValidation, ExecuteOptions, OutputBuffer, ProcessConfig, ProcessHandle, ProcessInfo, ProcessOutput, ProcessResult } from './types.cjs';
7
+ export { createBashExecTool } from './bash-exec-tool.cjs';
8
+ export { createBashOutputTool } from './bash-output-tool.cjs';
9
+ export { createKillProcessTool } from './kill-process-tool.cjs';
10
+ import 'zod';
11
+ import '@dexto/core';