@orbytautomation/engine 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/OrbytEngine.d.ts.map +1 -1
- package/dist/core/OrbytEngine.js +18 -4
- package/dist/core/OrbytEngine.js.map +1 -1
- package/dist/errors/ErrorDebugger.d.ts +78 -25
- package/dist/errors/ErrorDebugger.d.ts.map +1 -1
- package/dist/errors/ErrorDebugger.js +383 -2
- package/dist/errors/ErrorDebugger.js.map +1 -1
- package/dist/errors/ErrorDetector.d.ts +107 -5
- package/dist/errors/ErrorDetector.d.ts.map +1 -1
- package/dist/errors/ErrorDetector.js +195 -40
- package/dist/errors/ErrorDetector.js.map +1 -1
- package/dist/errors/ErrorFormatter.d.ts +51 -0
- package/dist/errors/ErrorFormatter.d.ts.map +1 -1
- package/dist/errors/ErrorFormatter.js +128 -0
- package/dist/errors/ErrorFormatter.js.map +1 -1
- package/dist/errors/ErrorHandler.d.ts +93 -7
- package/dist/errors/ErrorHandler.d.ts.map +1 -1
- package/dist/errors/ErrorHandler.js +91 -42
- package/dist/errors/ErrorHandler.js.map +1 -1
- package/dist/errors/OrbytError.d.ts +28 -0
- package/dist/errors/OrbytError.d.ts.map +1 -1
- package/dist/errors/OrbytError.js.map +1 -1
- package/dist/errors/SecurityErrors.d.ts +2 -25
- package/dist/errors/SecurityErrors.d.ts.map +1 -1
- package/dist/errors/SecurityErrors.js +5 -119
- package/dist/errors/SecurityErrors.js.map +1 -1
- package/dist/errors/WorkflowError.d.ts +11 -1
- package/dist/errors/WorkflowError.d.ts.map +1 -1
- package/dist/errors/WorkflowError.js +104 -0
- package/dist/errors/WorkflowError.js.map +1 -1
- package/dist/loader/WorkflowLoader.d.ts +71 -5
- package/dist/loader/WorkflowLoader.d.ts.map +1 -1
- package/dist/loader/WorkflowLoader.js +135 -50
- package/dist/loader/WorkflowLoader.js.map +1 -1
- package/dist/logging/EngineLogger.d.ts +252 -337
- package/dist/logging/EngineLogger.d.ts.map +1 -1
- package/dist/logging/EngineLogger.js +460 -1012
- package/dist/logging/EngineLogger.js.map +1 -1
- package/dist/logging/LoggerManager.d.ts +109 -33
- package/dist/logging/LoggerManager.d.ts.map +1 -1
- package/dist/logging/LoggerManager.js +136 -47
- package/dist/logging/LoggerManager.js.map +1 -1
- package/dist/logging/index.d.ts.map +1 -1
- package/dist/logging/index.js.map +1 -1
- package/dist/types/log-types.d.ts +50 -11
- package/dist/types/log-types.d.ts.map +1 -1
- package/dist/types/log-types.js.map +1 -1
- package/package.json +1 -1
|
@@ -55,8 +55,55 @@ import { OrbytError } from './OrbytError.js';
|
|
|
55
55
|
import { type ErrorContext } from './ErrorDetector.js';
|
|
56
56
|
import { ExecutionControl } from './ErrorCodes.js';
|
|
57
57
|
/**
|
|
58
|
-
* Error
|
|
59
|
-
*
|
|
58
|
+
* Error Handler (Automatic Error Management)
|
|
59
|
+
*
|
|
60
|
+
* Central error handling system that orchestrates detection, logging, and execution control.
|
|
61
|
+
* Designed to work automatically without manual error handling in engine.
|
|
62
|
+
*
|
|
63
|
+
* ARCHITECTURE:
|
|
64
|
+
* =============
|
|
65
|
+
* - AUTOMATIC in Engine: Errors are auto-detected and classified
|
|
66
|
+
* - MANUAL in CLI/API/SDK: Use ErrorHandler explicitly for custom handling
|
|
67
|
+
* - INTEGRATED with WorkflowLoader: Validates and detects errors on load
|
|
68
|
+
*
|
|
69
|
+
* EXECUTION CONTROL:
|
|
70
|
+
* ==================
|
|
71
|
+
* Based on severity, automatically determines what to do:
|
|
72
|
+
* - CRITICAL/FATAL → Stop entire workflow immediately
|
|
73
|
+
* - ERROR → Stop entire workflow
|
|
74
|
+
* - MEDIUM → Stop current step, try next step
|
|
75
|
+
* - LOW/WARNING/INFO → Log and continue
|
|
76
|
+
*
|
|
77
|
+
* USAGE:
|
|
78
|
+
* ======
|
|
79
|
+
* ```typescript
|
|
80
|
+
* // In Engine (automatic):
|
|
81
|
+
* try {
|
|
82
|
+
* await executeStep(step);
|
|
83
|
+
* } catch (error) {
|
|
84
|
+
* const result = await ErrorHandler.handle(error, {
|
|
85
|
+
* location: `steps[${index}]`,
|
|
86
|
+
* stepId: step.id
|
|
87
|
+
* });
|
|
88
|
+
*
|
|
89
|
+
* if (result.shouldStopWorkflow) {
|
|
90
|
+
* throw result.error;
|
|
91
|
+
* }
|
|
92
|
+
* if (result.shouldStopStep) {
|
|
93
|
+
* continue; // Skip to next step
|
|
94
|
+
* }
|
|
95
|
+
* // Continue current step
|
|
96
|
+
* }
|
|
97
|
+
*
|
|
98
|
+
* // In CLI/API (manual):
|
|
99
|
+
* try {
|
|
100
|
+
* const workflow = await WorkflowLoader.fromFile(path);
|
|
101
|
+
* } catch (error) {
|
|
102
|
+
* const result = await ErrorHandler.handle(error, { location: path });
|
|
103
|
+
* console.error(result.debug?.formatted);
|
|
104
|
+
* process.exit(result.error.exitCode);
|
|
105
|
+
* }
|
|
106
|
+
* ```
|
|
60
107
|
*/
|
|
61
108
|
export interface ErrorHandlingResult {
|
|
62
109
|
/** The detected and classified OrbytError */
|
|
@@ -155,6 +202,10 @@ export declare class ErrorHandler {
|
|
|
155
202
|
* Handle error from WorkflowLoader
|
|
156
203
|
* Special handling for load-time errors with file path context
|
|
157
204
|
*
|
|
205
|
+
* @deprecated Use {@link handleLoaderErrorEnhanced} directly. This wrapper
|
|
206
|
+
* now delegates to it so behaviour is identical, but the enhanced variant
|
|
207
|
+
* is preferred for clarity in new call sites.
|
|
208
|
+
*
|
|
158
209
|
* @param error - Error from loader
|
|
159
210
|
* @param filePath - Path to workflow file being loaded
|
|
160
211
|
* @param options - Handler options
|
|
@@ -224,18 +275,53 @@ export declare class ErrorHandler {
|
|
|
224
275
|
* Detect and classify error into OrbytError
|
|
225
276
|
*/
|
|
226
277
|
private static detectError;
|
|
227
|
-
/**
|
|
228
|
-
* Detect error type from WorkflowLoader errors
|
|
229
|
-
*/
|
|
230
|
-
private static detectLoaderErrorType;
|
|
231
278
|
/**
|
|
232
279
|
* Log error with appropriate level
|
|
233
280
|
*/
|
|
234
281
|
private static logError;
|
|
235
282
|
/**
|
|
236
|
-
* Generate complete debug information
|
|
283
|
+
* Generate complete debug information.
|
|
284
|
+
*
|
|
285
|
+
* Uses context-aware variants so fix steps and formatted output reference
|
|
286
|
+
* the actual workflow file path / field name when WorkflowContext is set
|
|
287
|
+
* on LoggerManager (populated automatically by WorkflowLoader after parsing).
|
|
288
|
+
* Falls back to generic output when no context is available.
|
|
237
289
|
*/
|
|
238
290
|
private static generateDebugInfo;
|
|
291
|
+
/**
|
|
292
|
+
* Generate debug information enriched with workflow file context.
|
|
293
|
+
*
|
|
294
|
+
* Uses {@link ErrorDebugger.formatWithContext} so the "How to fix" section
|
|
295
|
+
* references the actual file path + line number when available.
|
|
296
|
+
* Uses {@link formatErrorWithLocation} for the `detailed` field so the
|
|
297
|
+
* location header (File / Line / Field) is present in verbose output.
|
|
298
|
+
*
|
|
299
|
+
* @param error - Detected OrbytError
|
|
300
|
+
* @param useColors - Whether to use ANSI colors
|
|
301
|
+
* @returns Debug info with context-aware fix steps
|
|
302
|
+
* @since 0.5.0
|
|
303
|
+
*/
|
|
304
|
+
private static generateDebugInfoWithContext;
|
|
305
|
+
/**
|
|
306
|
+
* Handle a WorkflowLoader error with full workflow-context enrichment.
|
|
307
|
+
*
|
|
308
|
+
* Enhancement of {@link handleLoaderError} that:
|
|
309
|
+
* - Uses {@link ErrorDetector.detectFromExceptionEnhanced} to extract
|
|
310
|
+
* line/column numbers from YAML parse errors.
|
|
311
|
+
* - Generates debug info via {@link ErrorDebugger.analyzeWithContext} so
|
|
312
|
+
* fix steps reference the actual file path and line number.
|
|
313
|
+
* - Formats detailed output with {@link formatErrorWithLocation} for a
|
|
314
|
+
* File: / Line: / Field: location header.
|
|
315
|
+
*
|
|
316
|
+
* Debug is always enabled for loader errors — no option needed.
|
|
317
|
+
*
|
|
318
|
+
* @param error - Error thrown by WorkflowLoader
|
|
319
|
+
* @param filePath - Path to the workflow file being loaded
|
|
320
|
+
* @param options - Handler options
|
|
321
|
+
* @returns Error handling result with file-aware debug info
|
|
322
|
+
* @since 0.5.0
|
|
323
|
+
*/
|
|
324
|
+
static handleLoaderErrorEnhanced(error: unknown, filePath: string, options?: ErrorHandlerOptions): Promise<ErrorHandlingResult>;
|
|
239
325
|
}
|
|
240
326
|
/**
|
|
241
327
|
* Global error handler instance for convenience
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorHandler.d.ts","sourceRoot":"","sources":["../../src/errors/ErrorHandler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAiB,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"ErrorHandler.d.ts","sourceRoot":"","sources":["../../src/errors/ErrorHandler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAiB,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEtE,OAAO,EAEH,gBAAgB,EAInB,MAAM,iBAAiB,CAAC;AAEzB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AACH,MAAM,WAAW,mBAAmB;IAChC,6CAA6C;IAC7C,KAAK,EAAE,UAAU,CAAC;IAElB,oEAAoE;IACpE,OAAO,EAAE,gBAAgB,CAAC;IAE1B,6CAA6C;IAC7C,kBAAkB,EAAE,OAAO,CAAC;IAE5B,0CAA0C;IAC1C,cAAc,EAAE,OAAO,CAAC;IAExB,8BAA8B;IAC9B,cAAc,EAAE,OAAO,CAAC;IAExB,uCAAuC;IACvC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BAAyB,CAClC,KAAK,EAAE,OAAO,EACd,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE,mBAAwB,GAClC,OAAO,CAAC,mBAAmB,CAAC;CA+BlC;AAED;;;GAGG;AACH,qBAAa,kBAAkB;IAC3B,OAAO,CAAC,MAAM,CAAC,cAAc,CAI3B;IAEF;;OAEG;IACH,MAAM,CAAC,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC,mBAAmB,CAAC,GAAG,IAAI;IAI7D;;OAEG;WACU,MAAM,CACf,KAAK,EAAE,OAAO,EACd,OAAO,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,GAChC,OAAO,CAAC,mBAAmB,CAAC;IAI/B;;OAEG;IACH,MAAM,CAAC,UAAU,IAAI,mBAAmB;CAG3C"}
|
|
@@ -53,8 +53,7 @@
|
|
|
53
53
|
*/
|
|
54
54
|
import { OrbytError } from './OrbytError.js';
|
|
55
55
|
import { ErrorDetector } from './ErrorDetector.js';
|
|
56
|
-
import {
|
|
57
|
-
import { formatDetailedError } from './ErrorFormatter.js';
|
|
56
|
+
import { formatDetailedError, formatErrorWithLocation } from './ErrorFormatter.js';
|
|
58
57
|
import { ErrorSeverity, ExecutionControl, getExecutionControl, shouldStopWorkflow, shouldStopStep, } from './ErrorCodes.js';
|
|
59
58
|
/**
|
|
60
59
|
* Error Handler
|
|
@@ -125,19 +124,17 @@ export class ErrorHandler {
|
|
|
125
124
|
* Handle error from WorkflowLoader
|
|
126
125
|
* Special handling for load-time errors with file path context
|
|
127
126
|
*
|
|
127
|
+
* @deprecated Use {@link handleLoaderErrorEnhanced} directly. This wrapper
|
|
128
|
+
* now delegates to it so behaviour is identical, but the enhanced variant
|
|
129
|
+
* is preferred for clarity in new call sites.
|
|
130
|
+
*
|
|
128
131
|
* @param error - Error from loader
|
|
129
132
|
* @param filePath - Path to workflow file being loaded
|
|
130
133
|
* @param options - Handler options
|
|
131
134
|
* @returns Error handling result
|
|
132
135
|
*/
|
|
133
136
|
static async handleLoaderError(error, filePath, options = {}) {
|
|
134
|
-
return this.
|
|
135
|
-
location: filePath,
|
|
136
|
-
type: this.detectLoaderErrorType(error),
|
|
137
|
-
}, {
|
|
138
|
-
...options,
|
|
139
|
-
enableDebug: true, // Always enable debug for loader errors
|
|
140
|
-
});
|
|
137
|
+
return this.handleLoaderErrorEnhanced(error, filePath, options);
|
|
141
138
|
}
|
|
142
139
|
/**
|
|
143
140
|
* Handle error from context object
|
|
@@ -238,9 +235,10 @@ export class ErrorHandler {
|
|
|
238
235
|
if (error instanceof OrbytError) {
|
|
239
236
|
return error;
|
|
240
237
|
}
|
|
241
|
-
// Standard Error
|
|
238
|
+
// Standard Error — use the enhanced variant so YAML parse errors carry
|
|
239
|
+
// line/column numbers in their diagnostic context and fix steps.
|
|
242
240
|
if (error instanceof Error) {
|
|
243
|
-
return ErrorDetector.
|
|
241
|
+
return ErrorDetector.detectFromExceptionEnhanced(error, context?.location);
|
|
244
242
|
}
|
|
245
243
|
// Error context object - detect from context
|
|
246
244
|
if (typeof error === 'object' && error !== null && 'type' in error) {
|
|
@@ -261,33 +259,6 @@ export class ErrorHandler {
|
|
|
261
259
|
location: context?.location,
|
|
262
260
|
});
|
|
263
261
|
}
|
|
264
|
-
/**
|
|
265
|
-
* Detect error type from WorkflowLoader errors
|
|
266
|
-
*/
|
|
267
|
-
static detectLoaderErrorType(error) {
|
|
268
|
-
if (!(error instanceof Error))
|
|
269
|
-
return 'unknown';
|
|
270
|
-
const message = error.message.toLowerCase();
|
|
271
|
-
if (message.includes('file not found') || message.includes('enoent')) {
|
|
272
|
-
return 'unknown'; // Will be classified as RUNTIME_FILE_NOT_FOUND
|
|
273
|
-
}
|
|
274
|
-
if (message.includes('yaml') || message.includes('syntax')) {
|
|
275
|
-
return 'parse_error';
|
|
276
|
-
}
|
|
277
|
-
if (message.includes('json')) {
|
|
278
|
-
return 'parse_error';
|
|
279
|
-
}
|
|
280
|
-
if (message.includes('reserved field')) {
|
|
281
|
-
return 'reserved_field';
|
|
282
|
-
}
|
|
283
|
-
if (message.includes('unknown field')) {
|
|
284
|
-
return 'unknown_field';
|
|
285
|
-
}
|
|
286
|
-
if (message.includes('missing') || message.includes('required')) {
|
|
287
|
-
return 'missing_field';
|
|
288
|
-
}
|
|
289
|
-
return 'unknown';
|
|
290
|
-
}
|
|
291
262
|
/**
|
|
292
263
|
* Log error with appropriate level
|
|
293
264
|
*/
|
|
@@ -327,13 +298,49 @@ export class ErrorHandler {
|
|
|
327
298
|
}
|
|
328
299
|
}
|
|
329
300
|
/**
|
|
330
|
-
* Generate complete debug information
|
|
301
|
+
* Generate complete debug information.
|
|
302
|
+
*
|
|
303
|
+
* Uses context-aware variants so fix steps and formatted output reference
|
|
304
|
+
* the actual workflow file path / field name when WorkflowContext is set
|
|
305
|
+
* on LoggerManager (populated automatically by WorkflowLoader after parsing).
|
|
306
|
+
* Falls back to generic output when no context is available.
|
|
331
307
|
*/
|
|
332
308
|
static generateDebugInfo(error, useColors) {
|
|
333
|
-
const debugInfo =
|
|
334
|
-
const formatted =
|
|
309
|
+
const debugInfo = ErrorDetector.analyzeDebugInfo(error);
|
|
310
|
+
const formatted = ErrorDetector.formatDebugOutput(error, undefined, useColors);
|
|
335
311
|
const detailed = formatDetailedError(error, useColors);
|
|
336
|
-
const quickFix =
|
|
312
|
+
const quickFix = ErrorDetector.quickDebugSummary(error);
|
|
313
|
+
return {
|
|
314
|
+
explanation: debugInfo.explanation,
|
|
315
|
+
cause: debugInfo.cause,
|
|
316
|
+
fixSteps: debugInfo.fixSteps,
|
|
317
|
+
quickFix,
|
|
318
|
+
formatted,
|
|
319
|
+
detailed,
|
|
320
|
+
commonMistakes: debugInfo.commonMistakes,
|
|
321
|
+
estimatedFixTime: debugInfo.estimatedFixTime,
|
|
322
|
+
};
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* Generate debug information enriched with workflow file context.
|
|
326
|
+
*
|
|
327
|
+
* Uses {@link ErrorDebugger.formatWithContext} so the "How to fix" section
|
|
328
|
+
* references the actual file path + line number when available.
|
|
329
|
+
* Uses {@link formatErrorWithLocation} for the `detailed` field so the
|
|
330
|
+
* location header (File / Line / Field) is present in verbose output.
|
|
331
|
+
*
|
|
332
|
+
* @param error - Detected OrbytError
|
|
333
|
+
* @param useColors - Whether to use ANSI colors
|
|
334
|
+
* @returns Debug info with context-aware fix steps
|
|
335
|
+
* @since 0.5.0
|
|
336
|
+
*/
|
|
337
|
+
static generateDebugInfoWithContext(error, useColors) {
|
|
338
|
+
const debugInfo = ErrorDetector.analyzeDebugInfo(error);
|
|
339
|
+
// formatDebugOutput gives file-aware "How to fix" content
|
|
340
|
+
const formatted = ErrorDetector.formatDebugOutput(error, undefined, useColors);
|
|
341
|
+
// formatErrorWithLocation prepends File: / Line: / Field: header
|
|
342
|
+
const detailed = formatErrorWithLocation(error, undefined, useColors, true);
|
|
343
|
+
const quickFix = ErrorDetector.quickDebugSummary(error);
|
|
337
344
|
return {
|
|
338
345
|
explanation: debugInfo.explanation,
|
|
339
346
|
cause: debugInfo.cause,
|
|
@@ -345,6 +352,48 @@ export class ErrorHandler {
|
|
|
345
352
|
estimatedFixTime: debugInfo.estimatedFixTime,
|
|
346
353
|
};
|
|
347
354
|
}
|
|
355
|
+
/**
|
|
356
|
+
* Handle a WorkflowLoader error with full workflow-context enrichment.
|
|
357
|
+
*
|
|
358
|
+
* Enhancement of {@link handleLoaderError} that:
|
|
359
|
+
* - Uses {@link ErrorDetector.detectFromExceptionEnhanced} to extract
|
|
360
|
+
* line/column numbers from YAML parse errors.
|
|
361
|
+
* - Generates debug info via {@link ErrorDebugger.analyzeWithContext} so
|
|
362
|
+
* fix steps reference the actual file path and line number.
|
|
363
|
+
* - Formats detailed output with {@link formatErrorWithLocation} for a
|
|
364
|
+
* File: / Line: / Field: location header.
|
|
365
|
+
*
|
|
366
|
+
* Debug is always enabled for loader errors — no option needed.
|
|
367
|
+
*
|
|
368
|
+
* @param error - Error thrown by WorkflowLoader
|
|
369
|
+
* @param filePath - Path to the workflow file being loaded
|
|
370
|
+
* @param options - Handler options
|
|
371
|
+
* @returns Error handling result with file-aware debug info
|
|
372
|
+
* @since 0.5.0
|
|
373
|
+
*/
|
|
374
|
+
static async handleLoaderErrorEnhanced(error, filePath, options = {}) {
|
|
375
|
+
const { useColors = true, logger = console, context = {} } = options;
|
|
376
|
+
// Use enhanced detection so line/col are extracted from YAML errors
|
|
377
|
+
const orbytError = error instanceof OrbytError
|
|
378
|
+
? error
|
|
379
|
+
: ErrorDetector.detectFromExceptionEnhanced(error instanceof Error ? error : new Error(String(error)), filePath);
|
|
380
|
+
const control = getExecutionControl(orbytError.severity);
|
|
381
|
+
const stopWorkflow = shouldStopWorkflow(orbytError.severity);
|
|
382
|
+
const stopStep = shouldStopStep(orbytError.severity);
|
|
383
|
+
// Always log loader errors
|
|
384
|
+
const logEntry = this.logError(orbytError, logger, { filePath, ...context });
|
|
385
|
+
// Always generate context-aware debug info for loader errors
|
|
386
|
+
const debug = this.generateDebugInfoWithContext(orbytError, useColors);
|
|
387
|
+
return {
|
|
388
|
+
error: orbytError,
|
|
389
|
+
control,
|
|
390
|
+
shouldStopWorkflow: stopWorkflow,
|
|
391
|
+
shouldStopStep: stopStep,
|
|
392
|
+
shouldContinue: control === ExecutionControl.CONTINUE,
|
|
393
|
+
debug,
|
|
394
|
+
logEntry,
|
|
395
|
+
};
|
|
396
|
+
}
|
|
348
397
|
}
|
|
349
398
|
/**
|
|
350
399
|
* Global error handler instance for convenience
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorHandler.js","sourceRoot":"","sources":["../../src/errors/ErrorHandler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAqB,MAAM,oBAAoB,CAAC;AACtE,OAAO,EAAE,
|
|
1
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AAE,IAAI;KAClB,CAAC;IAEF;;OAEG;IACH,MAAM,CAAC,SAAS,CAAC,OAAqC;QAClD,IAAI,CAAC,cAAc,GAAG,EAAE,GAAG,IAAI,CAAC,cAAc,EAAE,GAAG,OAAO,EAAE,CAAC;IACjE,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,KAAK,CAAC,MAAM,CACf,KAAc,EACd,OAA+B;QAE/B,OAAO,YAAY,CAAC,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;IACpE,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,UAAU;QACb,OAAO,EAAE,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC;IACtC,CAAC"}
|
|
@@ -15,6 +15,34 @@
|
|
|
15
15
|
import { ExitCodes } from '@dev-ecosystem/core';
|
|
16
16
|
import { OrbytErrorCode, ErrorSeverity } from './ErrorCodes.js';
|
|
17
17
|
import { OrbytErrorDiagnostic } from '../types/core-types.js';
|
|
18
|
+
/**
|
|
19
|
+
* Structured debug information produced by ErrorDebugger and stored on
|
|
20
|
+
* WorkflowError factory classes.
|
|
21
|
+
*
|
|
22
|
+
* Consumers should obtain instances via ErrorDetector (which calls
|
|
23
|
+
* ErrorDebugger internally) rather than building them manually.
|
|
24
|
+
*/
|
|
25
|
+
export interface ErrorDebugInfo {
|
|
26
|
+
/** Plain English explanation of what went wrong */
|
|
27
|
+
explanation: string;
|
|
28
|
+
/** Why this error occurred (root cause) */
|
|
29
|
+
cause: string;
|
|
30
|
+
/** Step-by-step fix instructions */
|
|
31
|
+
fixSteps: string[];
|
|
32
|
+
/** Common mistakes that lead to this error */
|
|
33
|
+
commonMistakes?: string[];
|
|
34
|
+
/** Related documentation links */
|
|
35
|
+
docsLinks?: string[];
|
|
36
|
+
/** Example of correct usage */
|
|
37
|
+
example?: {
|
|
38
|
+
description: string;
|
|
39
|
+
code: string;
|
|
40
|
+
};
|
|
41
|
+
/** Whether this requires immediate action */
|
|
42
|
+
urgent: boolean;
|
|
43
|
+
/** Estimated time to fix */
|
|
44
|
+
estimatedFixTime?: string;
|
|
45
|
+
}
|
|
18
46
|
/**
|
|
19
47
|
* Base error class for all Orbyt errors
|
|
20
48
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OrbytError.d.ts","sourceRoot":"","sources":["../../src/errors/OrbytError.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EACL,cAAc,EACd,aAAa,EAOd,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"OrbytError.d.ts","sourceRoot":"","sources":["../../src/errors/OrbytError.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EACL,cAAc,EACd,aAAa,EAOd,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAO9D;;;;;;GAMG;AACH,MAAM,WAAW,cAAc;IAC7B,mDAAmD;IACnD,WAAW,EAAE,MAAM,CAAC;IACpB,2CAA2C;IAC3C,KAAK,EAAE,MAAM,CAAC;IACd,oCAAoC;IACpC,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,8CAA8C;IAC9C,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,kCAAkC;IAClC,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,+BAA+B;IAC/B,OAAO,CAAC,EAAE;QACR,WAAW,EAAE,MAAM,CAAC;QACpB,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;IACF,6CAA6C;IAC7C,MAAM,EAAE,OAAO,CAAC;IAChB,4BAA4B;IAC5B,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC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AAI;YACf,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,OAAO,EAAE,IAAI,CAAC,UAAU,CAAC,OAAO;YAChC,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE;YACvC,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,WAAW,EAAE,IAAI,CAAC,WAAW;SAC9B,CAAC;IACJ,CAAC;IAED;;;;;OAKG;IACH,cAAc;QAMZ,OAAO;YACL,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,IAAI,EAAE,IAAI,CAAC,IAAI;SAChB,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
import { ExitCodes } from '@dev-ecosystem/core';
|
|
32
32
|
import { OrbytError } from './OrbytError.js';
|
|
33
33
|
import { OrbytErrorCode, ErrorSeverity } from './ErrorCodes.js';
|
|
34
|
-
import { OrbytErrorDiagnostic
|
|
34
|
+
import { OrbytErrorDiagnostic } from '../types/core-types.js';
|
|
35
35
|
/**
|
|
36
36
|
* Security Error
|
|
37
37
|
*
|
|
@@ -44,12 +44,7 @@ import { OrbytErrorDiagnostic, SecurityViolationDetails } from '../types/core-ty
|
|
|
44
44
|
* - System security → Bypassing access controls
|
|
45
45
|
*/
|
|
46
46
|
export declare class SecurityError extends OrbytError {
|
|
47
|
-
|
|
48
|
-
constructor(diagnostic: OrbytErrorDiagnostic | SecurityViolationDetails[]);
|
|
49
|
-
/**
|
|
50
|
-
* Format violations into a clear, actionable error message
|
|
51
|
-
*/
|
|
52
|
-
private static formatViolations;
|
|
47
|
+
constructor(diagnostic: OrbytErrorDiagnostic);
|
|
53
48
|
/**
|
|
54
49
|
* Create reserved field override error
|
|
55
50
|
*
|
|
@@ -96,26 +91,8 @@ export declare class SecurityError extends OrbytError {
|
|
|
96
91
|
message: string;
|
|
97
92
|
exitCode: ExitCodes;
|
|
98
93
|
hint: string | undefined;
|
|
99
|
-
violations: SecurityViolationDetails[] | undefined;
|
|
100
94
|
severity: ErrorSeverity;
|
|
101
95
|
context: Record<string, any> | undefined;
|
|
102
96
|
};
|
|
103
97
|
}
|
|
104
|
-
/**
|
|
105
|
-
* Create a security error for reserved field violations
|
|
106
|
-
*
|
|
107
|
-
* @deprecated Use SecurityError.reservedFieldOverride() or other factory methods instead
|
|
108
|
-
* @param violations - Array of security violation details
|
|
109
|
-
* @returns SecurityError instance
|
|
110
|
-
*
|
|
111
|
-
* @example
|
|
112
|
-
* ```typescript
|
|
113
|
-
* // Old way (legacy):
|
|
114
|
-
* const error = createSecurityError([{ field: '_internal', ... }]);
|
|
115
|
-
*
|
|
116
|
-
* // New way (preferred):
|
|
117
|
-
* const error = SecurityError.reservedFieldOverride('_internal', 'workflow.context');
|
|
118
|
-
* ```
|
|
119
|
-
*/
|
|
120
|
-
export declare function createSecurityError(violations: SecurityViolationDetails[]): SecurityError;
|
|
121
98
|
//# sourceMappingURL=SecurityErrors.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SecurityErrors.d.ts","sourceRoot":"","sources":["../../src/errors/SecurityErrors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChE,OAAO,EAAE,oBAAoB,EAAE,
|
|
1
|
+
{"version":3,"file":"SecurityErrors.d.ts","sourceRoot":"","sources":["../../src/errors/SecurityErrors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChE,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D;;;;;;;;;;GAUG;AACH,qBAAa,aAAc,SAAQ,UAAU;gBAC/B,UAAU,EAAE,oBAAoB;IAU5C;;;;;;;OAOG;IACH,MAAM,CAAC,qBAAqB,CAC1B,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,EACZ,SAAS,GAAE,SAAS,GAAG,WAAW,GAAG,UAAU,GAAG,WAAW,GAAG,OAAO,GAAG,UAAuB,GAChG,aAAa;IAqBhB;;;;;;OAMG;IACH,MAAM,CAAC,kBAAkB,CACvB,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,MAAM,GACX,aAAa;IAYhB;;;;;;OAMG;IACH,MAAM,CAAC,yBAAyB,CAC9B,MAAM,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,EAChD,IAAI,EAAE,MAAM,GACX,aAAa;IAahB;;;;;;;OAOG;IACH,MAAM,CAAC,gBAAgB,CACrB,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,EACZ,kBAAkB,CAAC,EAAE,MAAM,GAC1B,aAAa;IAgBhB;;OAEG;IACH,MAAM;;;;;;;;;CAWP"}
|
|
@@ -43,106 +43,12 @@ import { OrbytErrorCode, ErrorSeverity } from './ErrorCodes.js';
|
|
|
43
43
|
* - System security → Bypassing access controls
|
|
44
44
|
*/
|
|
45
45
|
export class SecurityError extends OrbytError {
|
|
46
|
-
violations; // For backward compatibility
|
|
47
46
|
constructor(diagnostic) {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
code: OrbytErrorCode.RUNTIME_PERMISSION_DENIED,
|
|
54
|
-
exitCode: ExitCodes.SECURITY_VIOLATION,
|
|
55
|
-
message: errorMessage,
|
|
56
|
-
hint: 'Remove all reserved fields from your workflow',
|
|
57
|
-
severity: ErrorSeverity.ERROR,
|
|
58
|
-
context: { violations: diagnostic },
|
|
59
|
-
});
|
|
60
|
-
this.violations = diagnostic;
|
|
61
|
-
}
|
|
62
|
-
else {
|
|
63
|
-
// New format: use OrbytError diagnostic
|
|
64
|
-
super({
|
|
65
|
-
...diagnostic,
|
|
66
|
-
severity: ErrorSeverity.ERROR,
|
|
67
|
-
exitCode: diagnostic.exitCode || ExitCodes.SECURITY_VIOLATION,
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Format violations into a clear, actionable error message
|
|
73
|
-
*/
|
|
74
|
-
static formatViolations(violations) {
|
|
75
|
-
const lines = [
|
|
76
|
-
'━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━',
|
|
77
|
-
'❌ SECURITY VIOLATION: Engine-Controlled Fields Detected',
|
|
78
|
-
'━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━',
|
|
79
|
-
'',
|
|
80
|
-
'⚠️ Your workflow contains fields that are RESERVED for engine control.',
|
|
81
|
-
' These fields are critical for:',
|
|
82
|
-
' • Billing integrity and usage tracking',
|
|
83
|
-
' • Security and audit compliance',
|
|
84
|
-
' • Execution identity and ownership',
|
|
85
|
-
'',
|
|
86
|
-
'🚫 User workflows CANNOT set these fields. The engine injects them.',
|
|
87
|
-
'',
|
|
88
|
-
];
|
|
89
|
-
if (violations.length === 1) {
|
|
90
|
-
const v = violations[0];
|
|
91
|
-
lines.push('VIOLATION DETAILS:');
|
|
92
|
-
lines.push('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━');
|
|
93
|
-
lines.push(` Error Code: ${v.code}`);
|
|
94
|
-
lines.push(` Location: ${v.location}`);
|
|
95
|
-
lines.push(` Field: "${v.field}"`);
|
|
96
|
-
lines.push(` Reason: ${v.reason}`);
|
|
97
|
-
lines.push('');
|
|
98
|
-
lines.push(` 💡 Solution: ${v.suggestion}`);
|
|
99
|
-
}
|
|
100
|
-
else {
|
|
101
|
-
lines.push(`FOUND ${violations.length} VIOLATIONS:`);
|
|
102
|
-
lines.push('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━');
|
|
103
|
-
violations.forEach((v, index) => {
|
|
104
|
-
lines.push('');
|
|
105
|
-
lines.push(`${index + 1}. ${v.code}`);
|
|
106
|
-
lines.push(` Location: ${v.location}`);
|
|
107
|
-
lines.push(` Field: "${v.field}"`);
|
|
108
|
-
lines.push(` Reason: ${v.reason}`);
|
|
109
|
-
lines.push(` Solution: ${v.suggestion}`);
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
lines.push('');
|
|
113
|
-
lines.push('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━');
|
|
114
|
-
lines.push('WHY THIS MATTERS:');
|
|
115
|
-
lines.push('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━');
|
|
116
|
-
lines.push('');
|
|
117
|
-
lines.push(' If users could set these fields:');
|
|
118
|
-
lines.push(' ❌ Billing could be manipulated');
|
|
119
|
-
lines.push(' ❌ Usage tracking would be unreliable');
|
|
120
|
-
lines.push(' ❌ Audit trails would be compromised');
|
|
121
|
-
lines.push(' ❌ Security boundaries would collapse');
|
|
122
|
-
lines.push('');
|
|
123
|
-
lines.push(' The engine protects these fields to ensure:');
|
|
124
|
-
lines.push(' ✅ Billing integrity');
|
|
125
|
-
lines.push(' ✅ Accurate usage tracking');
|
|
126
|
-
lines.push(' ✅ Complete audit trails');
|
|
127
|
-
lines.push(' ✅ Security compliance');
|
|
128
|
-
lines.push('');
|
|
129
|
-
lines.push('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━');
|
|
130
|
-
lines.push('WHAT TO DO:');
|
|
131
|
-
lines.push('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━');
|
|
132
|
-
lines.push('');
|
|
133
|
-
lines.push(' 1. Remove all fields starting with "_" from your workflow');
|
|
134
|
-
lines.push(' 2. Remove any billing, execution, or identity fields');
|
|
135
|
-
lines.push(' 3. Use only your own custom field names');
|
|
136
|
-
lines.push('');
|
|
137
|
-
lines.push(' EXAMPLE:');
|
|
138
|
-
lines.push(' ❌ BAD: _internal: { ... }');
|
|
139
|
-
lines.push(' ❌ BAD: executionId: "xyz"');
|
|
140
|
-
lines.push(' ❌ BAD: billingMode: "free"');
|
|
141
|
-
lines.push(' ✅ GOOD: myData: { ... }');
|
|
142
|
-
lines.push(' ✅ GOOD: customConfig: { ... }');
|
|
143
|
-
lines.push('');
|
|
144
|
-
lines.push('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━');
|
|
145
|
-
return lines.join('\n');
|
|
47
|
+
super({
|
|
48
|
+
...diagnostic,
|
|
49
|
+
severity: ErrorSeverity.ERROR,
|
|
50
|
+
exitCode: diagnostic.exitCode || ExitCodes.SECURITY_VIOLATION,
|
|
51
|
+
});
|
|
146
52
|
}
|
|
147
53
|
// ==================== FACTORY METHODS ====================
|
|
148
54
|
/**
|
|
@@ -241,29 +147,9 @@ export class SecurityError extends OrbytError {
|
|
|
241
147
|
message: this.message,
|
|
242
148
|
exitCode: this.exitCode,
|
|
243
149
|
hint: this.hint,
|
|
244
|
-
violations: this.violations, // Legacy support
|
|
245
150
|
severity: this.severity,
|
|
246
151
|
context: this.diagnostic.context,
|
|
247
152
|
};
|
|
248
153
|
}
|
|
249
154
|
}
|
|
250
|
-
/**
|
|
251
|
-
* Create a security error for reserved field violations
|
|
252
|
-
*
|
|
253
|
-
* @deprecated Use SecurityError.reservedFieldOverride() or other factory methods instead
|
|
254
|
-
* @param violations - Array of security violation details
|
|
255
|
-
* @returns SecurityError instance
|
|
256
|
-
*
|
|
257
|
-
* @example
|
|
258
|
-
* ```typescript
|
|
259
|
-
* // Old way (legacy):
|
|
260
|
-
* const error = createSecurityError([{ field: '_internal', ... }]);
|
|
261
|
-
*
|
|
262
|
-
* // New way (preferred):
|
|
263
|
-
* const error = SecurityError.reservedFieldOverride('_internal', 'workflow.context');
|
|
264
|
-
* ```
|
|
265
|
-
*/
|
|
266
|
-
export function createSecurityError(violations) {
|
|
267
|
-
return new SecurityError(violations);
|
|
268
|
-
}
|
|
269
155
|
//# sourceMappingURL=SecurityErrors.js.map
|