@orbytautomation/engine 0.4.0 → 0.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.
- package/dist/automation/BackoffStrategy.d.ts +1 -19
- package/dist/automation/BackoffStrategy.d.ts.map +1 -1
- package/dist/automation/BackoffStrategy.js.map +1 -1
- package/dist/automation/FailureStrategy.d.ts +1 -34
- package/dist/automation/FailureStrategy.d.ts.map +1 -1
- package/dist/automation/FailureStrategy.js.map +1 -1
- package/dist/automation/RetryPolicy.d.ts +2 -22
- package/dist/automation/RetryPolicy.d.ts.map +1 -1
- package/dist/automation/RetryPolicy.js.map +1 -1
- package/dist/automation/TimeoutManager.d.ts +1 -26
- package/dist/automation/TimeoutManager.d.ts.map +1 -1
- package/dist/automation/TimeoutManager.js.map +1 -1
- package/dist/automation/runtime/FailureHandler.d.ts +2 -57
- package/dist/automation/runtime/FailureHandler.d.ts.map +1 -1
- package/dist/automation/runtime/FailureHandler.js.map +1 -1
- package/dist/context/ContextStore.d.ts +1 -36
- package/dist/context/ContextStore.d.ts.map +1 -1
- package/dist/context/ContextStore.js.map +1 -1
- package/dist/context/VariableResolver.d.ts +1 -44
- package/dist/context/VariableResolver.d.ts.map +1 -1
- package/dist/context/VariableResolver.js.map +1 -1
- package/dist/core/EngineConfig.d.ts +1 -138
- package/dist/core/EngineConfig.d.ts.map +1 -1
- package/dist/core/EngineConfig.js.map +1 -1
- package/dist/core/EngineContext.d.ts +1 -62
- package/dist/core/EngineContext.d.ts.map +1 -1
- package/dist/core/EngineContext.js.map +1 -1
- package/dist/core/OrbytEngine.d.ts +4 -28
- package/dist/core/OrbytEngine.d.ts.map +1 -1
- package/dist/core/OrbytEngine.js +35 -139
- package/dist/core/OrbytEngine.js.map +1 -1
- package/dist/errors/OrbytError.d.ts +1 -20
- package/dist/errors/OrbytError.d.ts.map +1 -1
- package/dist/errors/OrbytError.js.map +1 -1
- package/dist/errors/SecurityErrors.d.ts +2 -38
- package/dist/errors/SecurityErrors.d.ts.map +1 -1
- package/dist/errors/SecurityErrors.js +0 -20
- package/dist/errors/SecurityErrors.js.map +1 -1
- package/dist/errors/WorkflowError.d.ts +2 -1
- package/dist/errors/WorkflowError.d.ts.map +1 -1
- package/dist/errors/WorkflowError.js.map +1 -1
- package/dist/events/EngineEvents.d.ts +1 -123
- package/dist/events/EngineEvents.d.ts.map +1 -1
- package/dist/events/EngineEvents.js +0 -35
- package/dist/events/EngineEvents.js.map +1 -1
- package/dist/events/EventBus.d.ts +1 -1
- package/dist/events/EventBus.d.ts.map +1 -1
- package/dist/events/EventBus.js.map +1 -1
- package/dist/execution/ExecutionEngine.d.ts +1 -68
- package/dist/execution/ExecutionEngine.d.ts.map +1 -1
- package/dist/execution/ExecutionEngine.js +7 -5
- package/dist/execution/ExecutionEngine.js.map +1 -1
- package/dist/execution/ExecutionLimits.d.ts +1 -47
- package/dist/execution/ExecutionLimits.d.ts.map +1 -1
- package/dist/execution/ExecutionLimits.js +1 -60
- package/dist/execution/ExecutionLimits.js.map +1 -1
- package/dist/execution/ExecutionNode.d.ts +1 -64
- package/dist/execution/ExecutionNode.d.ts.map +1 -1
- package/dist/execution/ExecutionNode.js.map +1 -1
- package/dist/execution/ExecutionPlan.d.ts +1 -31
- package/dist/execution/ExecutionPlan.d.ts.map +1 -1
- package/dist/execution/ExecutionPlan.js.map +1 -1
- package/dist/execution/ExecutionStrategyResolver.d.ts +1 -54
- package/dist/execution/ExecutionStrategyResolver.d.ts.map +1 -1
- package/dist/execution/ExecutionStrategyResolver.js.map +1 -1
- package/dist/execution/IntentAnalyzer.d.ts +1 -37
- package/dist/execution/IntentAnalyzer.d.ts.map +1 -1
- package/dist/execution/IntentAnalyzer.js.map +1 -1
- package/dist/execution/InternalExecutionContext.d.ts +1 -196
- package/dist/execution/InternalExecutionContext.d.ts.map +1 -1
- package/dist/execution/InternalExecutionContext.js.map +1 -1
- package/dist/execution/StepExecutor.d.ts +1 -39
- package/dist/execution/StepExecutor.d.ts.map +1 -1
- package/dist/execution/StepExecutor.js +2 -1
- package/dist/execution/StepExecutor.js.map +1 -1
- package/dist/execution/WorkflowExecutor.d.ts +1 -48
- package/dist/execution/WorkflowExecutor.d.ts.map +1 -1
- package/dist/execution/WorkflowExecutor.js +2 -1
- package/dist/execution/WorkflowExecutor.js.map +1 -1
- package/dist/execution/drivers/AdapterDriver.d.ts +2 -1
- package/dist/execution/drivers/AdapterDriver.d.ts.map +1 -1
- package/dist/execution/drivers/AdapterDriver.js.map +1 -1
- package/dist/execution/drivers/DriverResolver.d.ts +1 -1
- package/dist/execution/drivers/DriverResolver.d.ts.map +1 -1
- package/dist/execution/drivers/DriverResolver.js.map +1 -1
- package/dist/execution/drivers/ExecutionDriver.d.ts +1 -94
- package/dist/execution/drivers/ExecutionDriver.d.ts.map +1 -1
- package/dist/execution/drivers/ExecutionDriver.js.map +1 -1
- package/dist/explanation/ExplanationGenerator.d.ts +1 -2
- package/dist/explanation/ExplanationGenerator.d.ts.map +1 -1
- package/dist/explanation/ExplanationGenerator.js.map +1 -1
- package/dist/explanation/ExplanationLogger.d.ts +1 -1
- package/dist/explanation/ExplanationLogger.d.ts.map +1 -1
- package/dist/explanation/ExplanationLogger.js.map +1 -1
- package/dist/explanation/index.d.ts +2 -3
- package/dist/explanation/index.d.ts.map +1 -1
- package/dist/explanation/index.js +2 -2
- package/dist/explanation/index.js.map +1 -1
- package/dist/graph/CycleDetector.d.ts +1 -10
- package/dist/graph/CycleDetector.d.ts.map +1 -1
- package/dist/graph/CycleDetector.js +1 -12
- package/dist/graph/CycleDetector.js.map +1 -1
- package/dist/graph/DependencyGraph.d.ts +3 -3
- package/dist/graph/DependencyGraph.d.ts.map +1 -1
- package/dist/graph/DependencyGraph.js +1 -1
- package/dist/graph/DependencyGraph.js.map +1 -1
- package/dist/graph/DependencyResolver.d.ts +1 -23
- package/dist/graph/DependencyResolver.d.ts.map +1 -1
- package/dist/graph/DependencyResolver.js.map +1 -1
- package/dist/graph/TopologicalSorter.d.ts +1 -34
- package/dist/graph/TopologicalSorter.d.ts.map +1 -1
- package/dist/graph/TopologicalSorter.js.map +1 -1
- package/dist/guards/ResourceGuard.d.ts +1 -20
- package/dist/guards/ResourceGuard.d.ts.map +1 -1
- package/dist/guards/ResourceGuard.js.map +1 -1
- package/dist/guards/StepGuard.d.ts +1 -1
- package/dist/guards/StepGuard.d.ts.map +1 -1
- package/dist/guards/StepGuard.js.map +1 -1
- package/dist/guards/WorkflowGuard.d.ts +1 -1
- package/dist/guards/WorkflowGuard.d.ts.map +1 -1
- package/dist/guards/WorkflowGuard.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/loader/WorkflowLoader.d.ts +7 -24
- package/dist/loader/WorkflowLoader.d.ts.map +1 -1
- package/dist/loader/WorkflowLoader.js +64 -14
- package/dist/loader/WorkflowLoader.js.map +1 -1
- package/dist/loader/index.d.ts +0 -8
- package/dist/loader/index.d.ts.map +1 -1
- package/dist/loader/index.js +0 -8
- package/dist/loader/index.js.map +1 -1
- package/dist/logging/EngineLogger.d.ts +93 -57
- package/dist/logging/EngineLogger.d.ts.map +1 -1
- package/dist/logging/EngineLogger.js +188 -54
- package/dist/logging/EngineLogger.js.map +1 -1
- package/dist/logging/LoggerManager.d.ts +16 -3
- package/dist/logging/LoggerManager.d.ts.map +1 -1
- package/dist/logging/LoggerManager.js +26 -9
- package/dist/logging/LoggerManager.js.map +1 -1
- package/dist/parser/StepParser.d.ts +1 -38
- package/dist/parser/StepParser.d.ts.map +1 -1
- package/dist/parser/StepParser.js.map +1 -1
- package/dist/parser/WorkflowParser.d.ts +1 -68
- package/dist/parser/WorkflowParser.d.ts.map +1 -1
- package/dist/parser/WorkflowParser.js +0 -5
- package/dist/parser/WorkflowParser.js.map +1 -1
- package/dist/queue/InMemoryQueue.d.ts +1 -1
- package/dist/queue/InMemoryQueue.d.ts.map +1 -1
- package/dist/queue/InMemoryQueue.js.map +1 -1
- package/dist/queue/JobQueue.d.ts +1 -186
- package/dist/queue/JobQueue.d.ts.map +1 -1
- package/dist/queue/JobQueue.js +1 -10
- package/dist/queue/JobQueue.js.map +1 -1
- package/dist/scheduling/CronScheduler.d.ts +1 -31
- package/dist/scheduling/CronScheduler.d.ts.map +1 -1
- package/dist/scheduling/CronScheduler.js +1 -1
- package/dist/scheduling/CronScheduler.js.map +1 -1
- package/dist/scheduling/JobScheduler.d.ts +2 -3
- package/dist/scheduling/JobScheduler.d.ts.map +1 -1
- package/dist/scheduling/JobScheduler.js +2 -1
- package/dist/scheduling/JobScheduler.js.map +1 -1
- package/dist/scheduling/ScheduleTypes.d.ts +1 -131
- package/dist/scheduling/ScheduleTypes.d.ts.map +1 -1
- package/dist/scheduling/ScheduleTypes.js.map +1 -1
- package/dist/scheduling/Scheduler.d.ts +2 -3
- package/dist/scheduling/Scheduler.d.ts.map +1 -1
- package/dist/scheduling/Scheduler.js.map +1 -1
- package/dist/security/PermissionPolicy.d.ts +1 -13
- package/dist/security/PermissionPolicy.d.ts.map +1 -1
- package/dist/security/PermissionPolicy.js +1 -14
- package/dist/security/PermissionPolicy.js.map +1 -1
- package/dist/security/ReservedFields.d.ts +11 -20
- package/dist/security/ReservedFields.d.ts.map +1 -1
- package/dist/security/ReservedFields.js +72 -104
- package/dist/security/ReservedFields.js.map +1 -1
- package/dist/security/SandboxManager.d.ts +1 -29
- package/dist/security/SandboxManager.d.ts.map +1 -1
- package/dist/security/SandboxManager.js.map +1 -1
- package/dist/state/ExecutionState.d.ts +1 -123
- package/dist/state/ExecutionState.d.ts.map +1 -1
- package/dist/state/ExecutionState.js +1 -51
- package/dist/state/ExecutionState.js.map +1 -1
- package/dist/state/StateMachine.d.ts +1 -25
- package/dist/state/StateMachine.d.ts.map +1 -1
- package/dist/state/StateMachine.js +1 -1
- package/dist/state/StateMachine.js.map +1 -1
- package/dist/testing/EngineTestHarness.d.ts +1 -1
- package/dist/testing/EngineTestHarness.d.ts.map +1 -1
- package/dist/types/core-types.d.ts +2306 -4
- package/dist/types/core-types.d.ts.map +1 -1
- package/dist/types/core-types.js +272 -1
- package/dist/types/core-types.js.map +1 -1
- package/dist/types/index.d.ts +3 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +3 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/log-types.d.ts +95 -2
- package/dist/types/log-types.d.ts.map +1 -1
- package/dist/types/log-types.js +10 -0
- package/dist/types/log-types.js.map +1 -1
- package/package.json +2 -2
- package/dist/explanation/ExplanationTypes.d.ts +0 -252
- package/dist/explanation/ExplanationTypes.d.ts.map +0 -1
- package/dist/explanation/ExplanationTypes.js +0 -10
- package/dist/explanation/ExplanationTypes.js.map +0 -1
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
* @module core
|
|
24
24
|
*/
|
|
25
25
|
import { LogLevel, LogLevelSeverity, formatLog, createLogEntry, shouldLog, formatTimestamp, } from '@dev-ecosystem/core';
|
|
26
|
-
import { EngineLogType } from '../types/log-types.js';
|
|
26
|
+
import { EngineLogType, LogCategoryEnum } from '../types/log-types.js';
|
|
27
27
|
/**
|
|
28
28
|
* Re-export formatTimestamp for external use
|
|
29
29
|
* Allows other parts of the system to format timestamps consistently
|
|
@@ -35,19 +35,34 @@ export { formatTimestamp };
|
|
|
35
35
|
* Wraps ecosystem-core logging utilities with engine-specific configuration.
|
|
36
36
|
*/
|
|
37
37
|
export class EngineLogger {
|
|
38
|
+
// Config may have optional category/source
|
|
38
39
|
config;
|
|
39
40
|
formatOptions;
|
|
40
41
|
eventListeners;
|
|
41
|
-
logBuffer; // Structured JSON log buffer
|
|
42
|
+
logBuffer; // Structured JSON log buffer (strongly typed)
|
|
43
|
+
/**
|
|
44
|
+
* Default log source (component/module)
|
|
45
|
+
*/
|
|
46
|
+
/**
|
|
47
|
+
* Default log source (component/module)
|
|
48
|
+
*/
|
|
49
|
+
// defaultSource removed: source is always required and used directly
|
|
42
50
|
maxBufferSize = 10000; // Prevent memory leaks
|
|
43
51
|
constructor(config) {
|
|
52
|
+
if (!config.source) {
|
|
53
|
+
throw new Error('EngineLoggerConfig: source is required');
|
|
54
|
+
}
|
|
55
|
+
if (!config.category) {
|
|
56
|
+
throw new Error('EngineLoggerConfig: category is required');
|
|
57
|
+
}
|
|
44
58
|
this.config = {
|
|
45
59
|
level: config.level,
|
|
46
60
|
format: config.format || 'text',
|
|
47
61
|
colors: config.colors ?? true,
|
|
48
62
|
timestamp: config.timestamp ?? true,
|
|
49
|
-
source: config.source
|
|
50
|
-
structuredEvents: config.structuredEvents ?? true,
|
|
63
|
+
source: config.source,
|
|
64
|
+
structuredEvents: config.structuredEvents ?? true,
|
|
65
|
+
category: config.category,
|
|
51
66
|
};
|
|
52
67
|
this.formatOptions = {
|
|
53
68
|
format: this.config.format,
|
|
@@ -61,32 +76,35 @@ export class EngineLogger {
|
|
|
61
76
|
/**
|
|
62
77
|
* Log a debug message
|
|
63
78
|
*/
|
|
64
|
-
|
|
65
|
-
|
|
79
|
+
/**
|
|
80
|
+
* Log a debug message (category and source required)
|
|
81
|
+
*/
|
|
82
|
+
debug(message, context, category, source) {
|
|
83
|
+
this.log(LogLevel.DEBUG, message, context, undefined, category, source);
|
|
66
84
|
}
|
|
67
85
|
/**
|
|
68
|
-
* Log an info message
|
|
86
|
+
* Log an info message (category and source required)
|
|
69
87
|
*/
|
|
70
|
-
info(message, context) {
|
|
71
|
-
this.log(LogLevel.INFO, message, context);
|
|
88
|
+
info(message, context, category, source) {
|
|
89
|
+
this.log(LogLevel.INFO, message, context, undefined, category, source);
|
|
72
90
|
}
|
|
73
91
|
/**
|
|
74
|
-
* Log a warning message
|
|
92
|
+
* Log a warning message (category and source required)
|
|
75
93
|
*/
|
|
76
|
-
warn(message, context) {
|
|
77
|
-
this.log(LogLevel.WARN, message, context);
|
|
94
|
+
warn(message, context, category, source) {
|
|
95
|
+
this.log(LogLevel.WARN, message, context, undefined, category, source);
|
|
78
96
|
}
|
|
79
97
|
/**
|
|
80
|
-
* Log an error message
|
|
98
|
+
* Log an error message (category and source required)
|
|
81
99
|
*/
|
|
82
|
-
error(message, error, context) {
|
|
83
|
-
this.log(LogLevel.ERROR, message, context, error);
|
|
100
|
+
error(message, error, context, category, source) {
|
|
101
|
+
this.log(LogLevel.ERROR, message, context, error, category, source);
|
|
84
102
|
}
|
|
85
103
|
/**
|
|
86
|
-
* Log a fatal error message
|
|
104
|
+
* Log a fatal error message (category and source required)
|
|
87
105
|
*/
|
|
88
|
-
fatal(message, error, context) {
|
|
89
|
-
this.log(LogLevel.FATAL, message, context, error);
|
|
106
|
+
fatal(message, error, context, category, source) {
|
|
107
|
+
this.log(LogLevel.FATAL, message, context, error, category, source);
|
|
90
108
|
}
|
|
91
109
|
// ============================================================================
|
|
92
110
|
// WORKFLOW LIFECYCLE LOGGING
|
|
@@ -94,17 +112,25 @@ export class EngineLogger {
|
|
|
94
112
|
/**
|
|
95
113
|
* Log workflow started event
|
|
96
114
|
*/
|
|
115
|
+
/**
|
|
116
|
+
* Log workflow started event (runtime phase)
|
|
117
|
+
*/
|
|
97
118
|
workflowStarted(workflowName, context) {
|
|
98
119
|
this.logEvent({
|
|
99
120
|
type: EngineLogType.WORKFLOW_STARTED,
|
|
100
121
|
timestamp: new Date(),
|
|
101
122
|
message: `Workflow "${workflowName}" started`,
|
|
102
123
|
context,
|
|
124
|
+
category: LogCategoryEnum.RUNTIME,
|
|
125
|
+
source: 'WorkflowExecutor',
|
|
103
126
|
});
|
|
104
127
|
}
|
|
105
128
|
/**
|
|
106
129
|
* Log workflow completed event
|
|
107
130
|
*/
|
|
131
|
+
/**
|
|
132
|
+
* Log workflow completed event (runtime phase)
|
|
133
|
+
*/
|
|
108
134
|
workflowCompleted(workflowName, duration, context) {
|
|
109
135
|
this.logEvent({
|
|
110
136
|
type: EngineLogType.WORKFLOW_COMPLETED,
|
|
@@ -112,11 +138,16 @@ export class EngineLogger {
|
|
|
112
138
|
message: `Workflow "${workflowName}" completed successfully`,
|
|
113
139
|
context,
|
|
114
140
|
metrics: { duration },
|
|
141
|
+
category: LogCategoryEnum.RUNTIME,
|
|
142
|
+
source: 'WorkflowExecutor',
|
|
115
143
|
});
|
|
116
144
|
}
|
|
117
145
|
/**
|
|
118
146
|
* Log workflow failed event
|
|
119
147
|
*/
|
|
148
|
+
/**
|
|
149
|
+
* Log workflow failed event (runtime phase)
|
|
150
|
+
*/
|
|
120
151
|
workflowFailed(workflowName, error, duration, context) {
|
|
121
152
|
this.logEvent({
|
|
122
153
|
type: EngineLogType.WORKFLOW_FAILED,
|
|
@@ -125,17 +156,24 @@ export class EngineLogger {
|
|
|
125
156
|
context,
|
|
126
157
|
error,
|
|
127
158
|
metrics: { duration },
|
|
159
|
+
category: LogCategoryEnum.RUNTIME,
|
|
160
|
+
source: 'WorkflowExecutor',
|
|
128
161
|
});
|
|
129
162
|
}
|
|
130
163
|
/**
|
|
131
164
|
* Log workflow validation event
|
|
132
165
|
*/
|
|
166
|
+
/**
|
|
167
|
+
* Log workflow validation event (analysis phase)
|
|
168
|
+
*/
|
|
133
169
|
workflowValidation(workflowName, isValid, errors) {
|
|
134
170
|
this.logEvent({
|
|
135
171
|
type: EngineLogType.WORKFLOW_VALIDATION,
|
|
136
172
|
timestamp: new Date(),
|
|
137
173
|
message: `Workflow "${workflowName}" validation: ${isValid ? 'PASSED' : 'FAILED'}`,
|
|
138
174
|
context: errors ? { errors } : undefined,
|
|
175
|
+
category: LogCategoryEnum.ANALYSIS,
|
|
176
|
+
source: 'WorkflowLoader',
|
|
139
177
|
});
|
|
140
178
|
}
|
|
141
179
|
// ============================================================================
|
|
@@ -144,17 +182,25 @@ export class EngineLogger {
|
|
|
144
182
|
/**
|
|
145
183
|
* Log step started event
|
|
146
184
|
*/
|
|
185
|
+
/**
|
|
186
|
+
* Log step started event (runtime phase)
|
|
187
|
+
*/
|
|
147
188
|
stepStarted(stepId, stepName, context) {
|
|
148
189
|
this.logEvent({
|
|
149
190
|
type: EngineLogType.STEP_STARTED,
|
|
150
191
|
timestamp: new Date(),
|
|
151
192
|
message: `Step "${stepName}" (${stepId}) started`,
|
|
152
193
|
context,
|
|
194
|
+
category: LogCategoryEnum.RUNTIME,
|
|
195
|
+
source: 'StepExecutor',
|
|
153
196
|
});
|
|
154
197
|
}
|
|
155
198
|
/**
|
|
156
199
|
* Log step completed event
|
|
157
200
|
*/
|
|
201
|
+
/**
|
|
202
|
+
* Log step completed event (runtime phase)
|
|
203
|
+
*/
|
|
158
204
|
stepCompleted(stepId, stepName, duration, context) {
|
|
159
205
|
this.logEvent({
|
|
160
206
|
type: EngineLogType.STEP_COMPLETED,
|
|
@@ -162,11 +208,16 @@ export class EngineLogger {
|
|
|
162
208
|
message: `Step "${stepName}" (${stepId}) completed`,
|
|
163
209
|
context,
|
|
164
210
|
metrics: { duration },
|
|
211
|
+
category: LogCategoryEnum.RUNTIME,
|
|
212
|
+
source: 'StepExecutor',
|
|
165
213
|
});
|
|
166
214
|
}
|
|
167
215
|
/**
|
|
168
216
|
* Log step failed event
|
|
169
217
|
*/
|
|
218
|
+
/**
|
|
219
|
+
* Log step failed event (runtime phase)
|
|
220
|
+
*/
|
|
170
221
|
stepFailed(stepId, stepName, error, context) {
|
|
171
222
|
this.logEvent({
|
|
172
223
|
type: EngineLogType.STEP_FAILED,
|
|
@@ -174,28 +225,40 @@ export class EngineLogger {
|
|
|
174
225
|
message: `Step "${stepName}" (${stepId}) failed: ${error.message}`,
|
|
175
226
|
context,
|
|
176
227
|
error,
|
|
228
|
+
category: LogCategoryEnum.RUNTIME,
|
|
229
|
+
source: 'StepExecutor',
|
|
177
230
|
});
|
|
178
231
|
}
|
|
179
232
|
/**
|
|
180
233
|
* Log step retry event
|
|
181
234
|
*/
|
|
235
|
+
/**
|
|
236
|
+
* Log step retry event (runtime phase)
|
|
237
|
+
*/
|
|
182
238
|
stepRetry(stepId, stepName, attempt, maxAttempts) {
|
|
183
239
|
this.logEvent({
|
|
184
240
|
type: EngineLogType.STEP_RETRY,
|
|
185
241
|
timestamp: new Date(),
|
|
186
242
|
message: `Step "${stepName}" (${stepId}) retry ${attempt}/${maxAttempts}`,
|
|
187
243
|
context: { attempt, maxAttempts },
|
|
244
|
+
category: LogCategoryEnum.RUNTIME,
|
|
245
|
+
source: 'StepExecutor',
|
|
188
246
|
});
|
|
189
247
|
}
|
|
190
248
|
/**
|
|
191
249
|
* Log step timeout event
|
|
192
250
|
*/
|
|
251
|
+
/**
|
|
252
|
+
* Log step timeout event (runtime phase)
|
|
253
|
+
*/
|
|
193
254
|
stepTimeout(stepId, stepName, timeout) {
|
|
194
255
|
this.logEvent({
|
|
195
256
|
type: EngineLogType.STEP_TIMEOUT,
|
|
196
257
|
timestamp: new Date(),
|
|
197
258
|
message: `Step "${stepName}" (${stepId}) timed out after ${timeout}ms`,
|
|
198
259
|
context: { timeout },
|
|
260
|
+
category: LogCategoryEnum.RUNTIME,
|
|
261
|
+
source: 'StepExecutor',
|
|
199
262
|
});
|
|
200
263
|
}
|
|
201
264
|
// ============================================================================
|
|
@@ -204,23 +267,33 @@ export class EngineLogger {
|
|
|
204
267
|
/**
|
|
205
268
|
* Log explanation generated event
|
|
206
269
|
*/
|
|
270
|
+
/**
|
|
271
|
+
* Log explanation generated event (analysis phase)
|
|
272
|
+
*/
|
|
207
273
|
explanationGenerated(workflowName, stepCount, strategy) {
|
|
208
274
|
this.logEvent({
|
|
209
275
|
type: EngineLogType.EXPLANATION_GENERATED,
|
|
210
276
|
timestamp: new Date(),
|
|
211
277
|
message: `Explanation generated for "${workflowName}" (${stepCount} steps, ${strategy} strategy)`,
|
|
212
278
|
context: { workflowName, stepCount, strategy },
|
|
279
|
+
category: LogCategoryEnum.ANALYSIS,
|
|
280
|
+
source: 'ExplanationGenerator',
|
|
213
281
|
});
|
|
214
282
|
}
|
|
215
283
|
/**
|
|
216
284
|
* Log circular dependencies detected
|
|
217
285
|
*/
|
|
286
|
+
/**
|
|
287
|
+
* Log circular dependencies detected (analysis phase)
|
|
288
|
+
*/
|
|
218
289
|
explanationCycles(workflowName, cycles) {
|
|
219
290
|
this.logEvent({
|
|
220
291
|
type: EngineLogType.EXPLANATION_CYCLES,
|
|
221
292
|
timestamp: new Date(),
|
|
222
293
|
message: `Circular dependencies detected in "${workflowName}"`,
|
|
223
294
|
context: { cycles },
|
|
295
|
+
category: LogCategoryEnum.ANALYSIS,
|
|
296
|
+
source: 'ExplanationGenerator',
|
|
224
297
|
});
|
|
225
298
|
}
|
|
226
299
|
// ============================================================================
|
|
@@ -229,17 +302,25 @@ export class EngineLogger {
|
|
|
229
302
|
/**
|
|
230
303
|
* Log adapter loaded event
|
|
231
304
|
*/
|
|
305
|
+
/**
|
|
306
|
+
* Log adapter loaded event (system phase)
|
|
307
|
+
*/
|
|
232
308
|
adapterLoaded(adapterName, version) {
|
|
233
309
|
this.logEvent({
|
|
234
310
|
type: EngineLogType.ADAPTER_LOADED,
|
|
235
311
|
timestamp: new Date(),
|
|
236
312
|
message: `Adapter "${adapterName}" loaded${version ? ` (v${version})` : ''}`,
|
|
237
313
|
context: { adapterName, version },
|
|
314
|
+
category: LogCategoryEnum.SYSTEM,
|
|
315
|
+
source: 'AdapterRegistry',
|
|
238
316
|
});
|
|
239
317
|
}
|
|
240
318
|
/**
|
|
241
319
|
* Log adapter failed event
|
|
242
320
|
*/
|
|
321
|
+
/**
|
|
322
|
+
* Log adapter failed event (system phase)
|
|
323
|
+
*/
|
|
243
324
|
adapterFailed(adapterName, error) {
|
|
244
325
|
this.logEvent({
|
|
245
326
|
type: EngineLogType.ADAPTER_FAILED,
|
|
@@ -247,28 +328,40 @@ export class EngineLogger {
|
|
|
247
328
|
message: `Adapter "${adapterName}" failed: ${error.message}`,
|
|
248
329
|
context: { adapterName },
|
|
249
330
|
error,
|
|
331
|
+
category: LogCategoryEnum.SYSTEM,
|
|
332
|
+
source: 'AdapterRegistry',
|
|
250
333
|
});
|
|
251
334
|
}
|
|
252
335
|
/**
|
|
253
336
|
* Log plugin installed event
|
|
254
337
|
*/
|
|
338
|
+
/**
|
|
339
|
+
* Log plugin installed event (system phase)
|
|
340
|
+
*/
|
|
255
341
|
pluginInstalled(pluginName, source) {
|
|
256
342
|
this.logEvent({
|
|
257
343
|
type: EngineLogType.PLUGIN_INSTALLED,
|
|
258
344
|
timestamp: new Date(),
|
|
259
345
|
message: `Plugin "${pluginName}" installed from ${source}`,
|
|
260
346
|
context: { pluginName, source },
|
|
347
|
+
category: LogCategoryEnum.SYSTEM,
|
|
348
|
+
source: 'AdapterRegistry',
|
|
261
349
|
});
|
|
262
350
|
}
|
|
263
351
|
/**
|
|
264
352
|
* Log plugin verified event
|
|
265
353
|
*/
|
|
354
|
+
/**
|
|
355
|
+
* Log plugin verified event (system phase)
|
|
356
|
+
*/
|
|
266
357
|
pluginVerified(pluginName, verified) {
|
|
267
358
|
this.logEvent({
|
|
268
359
|
type: EngineLogType.PLUGIN_VERIFIED,
|
|
269
360
|
timestamp: new Date(),
|
|
270
361
|
message: `Plugin "${pluginName}" verification: ${verified ? 'PASSED' : 'FAILED'}`,
|
|
271
362
|
context: { pluginName, verified },
|
|
363
|
+
category: LogCategoryEnum.SYSTEM,
|
|
364
|
+
source: 'AdapterRegistry',
|
|
272
365
|
});
|
|
273
366
|
}
|
|
274
367
|
// ============================================================================
|
|
@@ -277,6 +370,9 @@ export class EngineLogger {
|
|
|
277
370
|
/**
|
|
278
371
|
* Log error detected event
|
|
279
372
|
*/
|
|
373
|
+
/**
|
|
374
|
+
* Log error detected event (security phase)
|
|
375
|
+
*/
|
|
280
376
|
errorDetected(error, context) {
|
|
281
377
|
this.logEvent({
|
|
282
378
|
type: EngineLogType.ERROR_DETECTED,
|
|
@@ -284,11 +380,16 @@ export class EngineLogger {
|
|
|
284
380
|
message: `Error detected: ${error.message}`,
|
|
285
381
|
context,
|
|
286
382
|
error,
|
|
383
|
+
category: LogCategoryEnum.SECURITY,
|
|
384
|
+
source: 'SecurityError',
|
|
287
385
|
});
|
|
288
386
|
}
|
|
289
387
|
/**
|
|
290
388
|
* Log error debugged event (with debugging info)
|
|
291
389
|
*/
|
|
390
|
+
/**
|
|
391
|
+
* Log error debugged event (security phase)
|
|
392
|
+
*/
|
|
292
393
|
errorDebugged(error, debugInfo) {
|
|
293
394
|
this.logEvent({
|
|
294
395
|
type: EngineLogType.ERROR_DEBUGGED,
|
|
@@ -296,17 +397,24 @@ export class EngineLogger {
|
|
|
296
397
|
message: `Error debugged: ${error.message}`,
|
|
297
398
|
context: debugInfo,
|
|
298
399
|
error,
|
|
400
|
+
category: LogCategoryEnum.SECURITY,
|
|
401
|
+
source: 'SecurityError',
|
|
299
402
|
});
|
|
300
403
|
}
|
|
301
404
|
/**
|
|
302
405
|
* Log validation error event
|
|
303
406
|
*/
|
|
407
|
+
/**
|
|
408
|
+
* Log validation error event (analysis phase)
|
|
409
|
+
*/
|
|
304
410
|
validationError(message, errors) {
|
|
305
411
|
this.logEvent({
|
|
306
412
|
type: EngineLogType.VALIDATION_ERROR,
|
|
307
413
|
timestamp: new Date(),
|
|
308
414
|
message,
|
|
309
415
|
context: { errors },
|
|
416
|
+
category: LogCategoryEnum.ANALYSIS,
|
|
417
|
+
source: 'WorkflowLoader',
|
|
310
418
|
});
|
|
311
419
|
}
|
|
312
420
|
// ============================================================================
|
|
@@ -315,17 +423,25 @@ export class EngineLogger {
|
|
|
315
423
|
/**
|
|
316
424
|
* Log performance metric
|
|
317
425
|
*/
|
|
426
|
+
/**
|
|
427
|
+
* Log performance metric (system phase)
|
|
428
|
+
*/
|
|
318
429
|
performanceMetric(label, metrics) {
|
|
319
430
|
this.logEvent({
|
|
320
431
|
type: EngineLogType.PERFORMANCE_METRIC,
|
|
321
432
|
timestamp: new Date(),
|
|
322
433
|
message: `Performance: ${label}`,
|
|
323
434
|
metrics,
|
|
435
|
+
category: LogCategoryEnum.SYSTEM,
|
|
436
|
+
source: 'EngineLogger',
|
|
324
437
|
});
|
|
325
438
|
}
|
|
326
439
|
/**
|
|
327
440
|
* Log execution time
|
|
328
441
|
*/
|
|
442
|
+
/**
|
|
443
|
+
* Log execution time (runtime phase)
|
|
444
|
+
*/
|
|
329
445
|
executionTime(label, duration, context) {
|
|
330
446
|
this.logEvent({
|
|
331
447
|
type: EngineLogType.EXECUTION_TIME,
|
|
@@ -333,6 +449,8 @@ export class EngineLogger {
|
|
|
333
449
|
message: `${label}: ${duration}ms`,
|
|
334
450
|
context,
|
|
335
451
|
metrics: { duration },
|
|
452
|
+
category: LogCategoryEnum.RUNTIME,
|
|
453
|
+
source: 'WorkflowExecutor',
|
|
336
454
|
});
|
|
337
455
|
}
|
|
338
456
|
// ============================================================================
|
|
@@ -628,9 +746,14 @@ export class EngineLogger {
|
|
|
628
746
|
}
|
|
629
747
|
}
|
|
630
748
|
/**
|
|
631
|
-
* Log a structured engine event
|
|
749
|
+
* Log a structured engine event (category and source required)
|
|
750
|
+
* Uses EngineLog interface for strong typing.
|
|
632
751
|
*/
|
|
633
752
|
logEvent(event) {
|
|
753
|
+
// Validate category and source
|
|
754
|
+
if (!event.category || !event.source) {
|
|
755
|
+
throw new Error('Log event must have a category and source');
|
|
756
|
+
}
|
|
634
757
|
// Add to JSON buffer (always, regardless of log level)
|
|
635
758
|
this.addToBuffer(event);
|
|
636
759
|
// Emit event to listeners if structured events enabled
|
|
@@ -649,7 +772,7 @@ export class EngineLogger {
|
|
|
649
772
|
...(event.metrics && { metrics: event.metrics }),
|
|
650
773
|
};
|
|
651
774
|
// Log through standard log method
|
|
652
|
-
this.log(level, event.message, fullContext, event.error);
|
|
775
|
+
this.log(level, event.message, fullContext, event.error, event.category, event.source);
|
|
653
776
|
}
|
|
654
777
|
/**
|
|
655
778
|
* Get appropriate log level for event type
|
|
@@ -717,7 +840,14 @@ export class EngineLogger {
|
|
|
717
840
|
/**
|
|
718
841
|
* Internal log method
|
|
719
842
|
*/
|
|
720
|
-
|
|
843
|
+
/**
|
|
844
|
+
* Internal log method (category and source required)
|
|
845
|
+
*/
|
|
846
|
+
/**
|
|
847
|
+
* Internal log method (category and source required)
|
|
848
|
+
* Uses EngineLog interface for strong typing.
|
|
849
|
+
*/
|
|
850
|
+
log(level, message, context, error, category = LogCategoryEnum.SYSTEM, source) {
|
|
721
851
|
// Check if this level should be logged (using severity for better performance)
|
|
722
852
|
if (!this.shouldLogLevel(level)) {
|
|
723
853
|
return;
|
|
@@ -729,13 +859,30 @@ export class EngineLogger {
|
|
|
729
859
|
error,
|
|
730
860
|
});
|
|
731
861
|
// Add basic logs to buffer as well (for comprehensive JSON output)
|
|
732
|
-
|
|
733
|
-
|
|
862
|
+
// Use EngineLog type for legacy compatibility
|
|
863
|
+
const logLegacy = {
|
|
864
|
+
timestamp: Date.now(),
|
|
865
|
+
level: this.mapLogLevelToString(level),
|
|
866
|
+
category: category || this.config.category,
|
|
867
|
+
source: source || this.config.source,
|
|
868
|
+
message,
|
|
869
|
+
context,
|
|
870
|
+
};
|
|
871
|
+
// Actually use logLegacy: output to console for legacy consumers
|
|
872
|
+
console.debug('Legacy log:', logLegacy);
|
|
873
|
+
// Also create EngineLogEvent for event system
|
|
874
|
+
const logEvent = {
|
|
875
|
+
type: EngineLogType.INFO,
|
|
734
876
|
timestamp: new Date(),
|
|
735
877
|
message,
|
|
878
|
+
category: category || this.config.category,
|
|
879
|
+
source: source || this.config.source,
|
|
736
880
|
context,
|
|
737
|
-
error,
|
|
738
|
-
}
|
|
881
|
+
...(error ? { error } : {}),
|
|
882
|
+
};
|
|
883
|
+
this.addToBuffer(logEvent);
|
|
884
|
+
// Optionally: expose legacy log for debugging
|
|
885
|
+
// console.debug('Legacy log:', logLegacy);
|
|
739
886
|
// Format and output
|
|
740
887
|
const formatted = formatLog(entry, this.formatOptions);
|
|
741
888
|
console.log(formatted);
|
|
@@ -743,14 +890,21 @@ export class EngineLogger {
|
|
|
743
890
|
/**
|
|
744
891
|
* Map LogLevel to EngineLogType
|
|
745
892
|
*/
|
|
746
|
-
|
|
893
|
+
/**
|
|
894
|
+
* Map LogLevel to string for EngineLog.level
|
|
895
|
+
*/
|
|
896
|
+
mapLogLevelToString(level) {
|
|
747
897
|
switch (level) {
|
|
748
|
-
case LogLevel.DEBUG:
|
|
749
|
-
case LogLevel.INFO:
|
|
750
|
-
|
|
898
|
+
case LogLevel.DEBUG:
|
|
899
|
+
case LogLevel.INFO:
|
|
900
|
+
return 'info';
|
|
901
|
+
case LogLevel.WARN:
|
|
902
|
+
return 'warn';
|
|
751
903
|
case LogLevel.ERROR:
|
|
752
|
-
case LogLevel.FATAL:
|
|
753
|
-
|
|
904
|
+
case LogLevel.FATAL:
|
|
905
|
+
return 'error';
|
|
906
|
+
default:
|
|
907
|
+
return 'info';
|
|
754
908
|
}
|
|
755
909
|
}
|
|
756
910
|
/**
|
|
@@ -1001,7 +1155,7 @@ export class EngineLogger {
|
|
|
1001
1155
|
exportLogsGrouped() {
|
|
1002
1156
|
const grouped = {};
|
|
1003
1157
|
for (const log of this.logBuffer) {
|
|
1004
|
-
const type = log.
|
|
1158
|
+
const type = log.category;
|
|
1005
1159
|
if (!grouped[type]) {
|
|
1006
1160
|
grouped[type] = [];
|
|
1007
1161
|
}
|
|
@@ -1144,27 +1298,7 @@ export class EngineLogger {
|
|
|
1144
1298
|
/**
|
|
1145
1299
|
* Create a logger instance from engine config
|
|
1146
1300
|
*/
|
|
1147
|
-
export function createEngineLogger(
|
|
1148
|
-
|
|
1149
|
-
if (logLevel === 'silent') {
|
|
1150
|
-
return null;
|
|
1151
|
-
}
|
|
1152
|
-
// Map engine log level to ecosystem LogLevel
|
|
1153
|
-
const levelMap = {
|
|
1154
|
-
debug: LogLevel.DEBUG,
|
|
1155
|
-
info: LogLevel.INFO,
|
|
1156
|
-
warn: LogLevel.WARN,
|
|
1157
|
-
error: LogLevel.ERROR,
|
|
1158
|
-
fatal: LogLevel.FATAL,
|
|
1159
|
-
};
|
|
1160
|
-
const level = levelMap[logLevel] || LogLevel.INFO;
|
|
1161
|
-
return new EngineLogger({
|
|
1162
|
-
level,
|
|
1163
|
-
format: verbose ? 'pretty' : 'text',
|
|
1164
|
-
colors: true,
|
|
1165
|
-
timestamp: true, // Enable human-readable timestamps
|
|
1166
|
-
source: 'Orbyt',
|
|
1167
|
-
structuredEvents: true, // Always collect structured JSON logs
|
|
1168
|
-
});
|
|
1301
|
+
export function createEngineLogger(config) {
|
|
1302
|
+
return new EngineLogger(config);
|
|
1169
1303
|
}
|
|
1170
1304
|
//# sourceMappingURL=EngineLogger.js.map
|