@orbytautomation/engine 0.2.0 → 0.2.2

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.
@@ -0,0 +1,150 @@
1
+ /**
2
+ * Engine Logger
3
+ *
4
+ * Provides structured logging for the Orbyt Engine using ecosystem-core utilities.
5
+ * Supports multiple output formats and log levels with proper filtering.
6
+ *
7
+ * Features:
8
+ * - Severity-based log level filtering using LogLevelSeverity
9
+ * - Multiple output formats (pretty, text, json, structured)
10
+ * - Color support with ANSI codes
11
+ * - Context and error tracking
12
+ * - Performance measurement with automatic severity adjustment
13
+ * - Efficient level comparison using numeric severity
14
+ *
15
+ * @module core
16
+ */
17
+ import { LogLevel } from '@dev-ecosystem/core';
18
+ /**
19
+ * Engine-specific log format type
20
+ */
21
+ export type EngineLogFormat = 'pretty' | 'text' | 'json' | 'structured';
22
+ /**
23
+ * Engine logger configuration
24
+ */
25
+ export interface EngineLoggerConfig {
26
+ /** Minimum log level to output */
27
+ level: LogLevel;
28
+ /** Output format */
29
+ format?: EngineLogFormat;
30
+ /** Enable colors in output */
31
+ colors?: boolean;
32
+ /** Include timestamps */
33
+ timestamp?: boolean;
34
+ /** Source identifier */
35
+ source?: string;
36
+ }
37
+ /**
38
+ * Engine Logger
39
+ *
40
+ * Wraps ecosystem-core logging utilities with engine-specific configuration.
41
+ */
42
+ export declare class EngineLogger {
43
+ private config;
44
+ private formatOptions;
45
+ constructor(config: EngineLoggerConfig);
46
+ /**
47
+ * Log a debug message
48
+ */
49
+ debug(message: string, context?: Record<string, unknown>): void;
50
+ /**
51
+ * Log an info message
52
+ */
53
+ info(message: string, context?: Record<string, unknown>): void;
54
+ /**
55
+ * Log a warning message
56
+ */
57
+ warn(message: string, context?: Record<string, unknown>): void;
58
+ /**
59
+ * Log an error message
60
+ */
61
+ error(message: string, error?: Error, context?: Record<string, unknown>): void;
62
+ /**
63
+ * Log a fatal error message
64
+ */
65
+ fatal(message: string, error?: Error, context?: Record<string, unknown>): void;
66
+ /**
67
+ * Log with a custom level
68
+ */
69
+ logWithLevel(level: LogLevel, message: string, context?: Record<string, unknown>): void;
70
+ /**
71
+ * Log only if severity meets minimum threshold
72
+ */
73
+ logIfSeverity(minSeverity: number, level: LogLevel, message: string, context?: Record<string, unknown>): void;
74
+ /**
75
+ * Measure and log execution time with appropriate log level based on duration
76
+ */
77
+ measureExecution<T>(label: string, fn: () => Promise<T>, thresholds?: {
78
+ warn?: number;
79
+ error?: number;
80
+ }): Promise<T>;
81
+ /**
82
+ * Internal log method
83
+ */
84
+ private log;
85
+ /**
86
+ * Check if a level should be logged using severity comparison
87
+ */
88
+ private shouldLogLevel;
89
+ /**
90
+ * Check if a level is more severe than another
91
+ */
92
+ isMoreSevere(level: LogLevel, compareWith: LogLevel): boolean;
93
+ /**
94
+ * Get severity difference between two levels
95
+ */
96
+ getSeverityDiff(level1: LogLevel, level2: LogLevel): number;
97
+ /**
98
+ * Get the numeric severity of the current log level
99
+ */
100
+ getCurrentSeverity(): number;
101
+ /**
102
+ * Get the numeric severity of a log level
103
+ */
104
+ getSeverity(level: LogLevel): number;
105
+ /**
106
+ * Update logger configuration
107
+ */
108
+ setLevel(level: LogLevel): void;
109
+ /**
110
+ * Set level by severity (0-4)
111
+ */
112
+ setLevelBySeverity(severity: number): void;
113
+ /**
114
+ * Update colors setting
115
+ */
116
+ setColors(enabled: boolean): void;
117
+ /**
118
+ * Update format
119
+ */
120
+ setFormat(format: EngineLogFormat): void;
121
+ /**
122
+ * Check if a level will be logged
123
+ */
124
+ willLog(level: LogLevel): boolean;
125
+ /**
126
+ * Get current configuration
127
+ */
128
+ getConfig(): Readonly<EngineLoggerConfig>;
129
+ /**
130
+ * Check if debug logging is enabled
131
+ */
132
+ isDebugEnabled(): boolean;
133
+ /**
134
+ * Check if info logging is enabled
135
+ */
136
+ isInfoEnabled(): boolean;
137
+ /**
138
+ * Check if warn logging is enabled
139
+ */
140
+ isWarnEnabled(): boolean;
141
+ /**
142
+ * Check if error logging is enabled
143
+ */
144
+ isErrorEnabled(): boolean;
145
+ }
146
+ /**
147
+ * Create a logger instance from engine config
148
+ */
149
+ export declare function createEngineLogger(logLevel: 'debug' | 'info' | 'warn' | 'error' | 'silent', verbose?: boolean): EngineLogger | null;
150
+ //# sourceMappingURL=EngineLogger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EngineLogger.d.ts","sourceRoot":"","sources":["../../src/core/EngineLogger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EACL,QAAQ,EAOT,MAAM,qBAAqB,CAAC;AAE7B;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG,MAAM,GAAG,MAAM,GAAG,YAAY,CAAC;AAExE;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,kCAAkC;IAClC,KAAK,EAAE,QAAQ,CAAC;IAChB,oBAAoB;IACpB,MAAM,CAAC,EAAE,eAAe,CAAC;IACzB,8BAA8B;IAC9B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,yBAAyB;IACzB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,wBAAwB;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;GAIG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,MAAM,CAA+B;IAC7C,OAAO,CAAC,aAAa,CAAmB;gBAE5B,MAAM,EAAE,kBAAkB;IAiBtC;;OAEG;IACH,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAI/D;;OAEG;IACH,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAI9D;;OAEG;IACH,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE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MAAM;IAIpC;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,QAAQ,GAAG,IAAI;IAI/B;;OAEG;IACH,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAQ1C;;OAEG;IACH,SAAS,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;IAKjC;;OAEG;IACH,SAAS,CAAC,MAAM,EAAE,eAAe,GAAG,IAAI;IAKxC;;OAEG;IACH,OAAO,CAAC,KAAK,EAAE,QAAQ,GAAG,OAAO;IAIjC;;OAEG;IACH,SAAS,IAAI,QAAQ,CAAC,kBAAkB,CAAC;IAIzC;;OAEG;IACH,cAAc,IAAI,OAAO;IAIzB;;OAEG;IACH,aAAa,IAAI,OAAO;IAIxB;;OAEG;IACH,aAAa,IAAI,OAAO;IAIxB;;OAEG;IACH,cAAc,IAAI,OAAO;CAG1B;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,EACxD,OAAO,GAAE,OAAe,GACvB,YAAY,GAAG,IAAI,CAuBrB"}
@@ -0,0 +1,252 @@
1
+ /**
2
+ * Engine Logger
3
+ *
4
+ * Provides structured logging for the Orbyt Engine using ecosystem-core utilities.
5
+ * Supports multiple output formats and log levels with proper filtering.
6
+ *
7
+ * Features:
8
+ * - Severity-based log level filtering using LogLevelSeverity
9
+ * - Multiple output formats (pretty, text, json, structured)
10
+ * - Color support with ANSI codes
11
+ * - Context and error tracking
12
+ * - Performance measurement with automatic severity adjustment
13
+ * - Efficient level comparison using numeric severity
14
+ *
15
+ * @module core
16
+ */
17
+ import { LogLevel, LogLevelSeverity, formatLog, createLogEntry, shouldLog, } from '@dev-ecosystem/core';
18
+ /**
19
+ * Engine Logger
20
+ *
21
+ * Wraps ecosystem-core logging utilities with engine-specific configuration.
22
+ */
23
+ export class EngineLogger {
24
+ config;
25
+ formatOptions;
26
+ constructor(config) {
27
+ this.config = {
28
+ level: config.level,
29
+ format: config.format || 'text',
30
+ colors: config.colors ?? true,
31
+ timestamp: config.timestamp ?? true,
32
+ source: config.source || 'Orbyt',
33
+ };
34
+ this.formatOptions = {
35
+ format: this.config.format,
36
+ colors: this.config.colors,
37
+ timestamp: this.config.timestamp,
38
+ includeSource: true,
39
+ };
40
+ }
41
+ /**
42
+ * Log a debug message
43
+ */
44
+ debug(message, context) {
45
+ this.log(LogLevel.DEBUG, message, context);
46
+ }
47
+ /**
48
+ * Log an info message
49
+ */
50
+ info(message, context) {
51
+ this.log(LogLevel.INFO, message, context);
52
+ }
53
+ /**
54
+ * Log a warning message
55
+ */
56
+ warn(message, context) {
57
+ this.log(LogLevel.WARN, message, context);
58
+ }
59
+ /**
60
+ * Log an error message
61
+ */
62
+ error(message, error, context) {
63
+ this.log(LogLevel.ERROR, message, context, error);
64
+ }
65
+ /**
66
+ * Log a fatal error message
67
+ */
68
+ fatal(message, error, context) {
69
+ this.log(LogLevel.FATAL, message, context, error);
70
+ }
71
+ /**
72
+ * Log with a custom level
73
+ */
74
+ logWithLevel(level, message, context) {
75
+ this.log(level, message, context);
76
+ }
77
+ /**
78
+ * Log only if severity meets minimum threshold
79
+ */
80
+ logIfSeverity(minSeverity, level, message, context) {
81
+ if (LogLevelSeverity[level] >= minSeverity) {
82
+ this.log(level, message, context);
83
+ }
84
+ }
85
+ /**
86
+ * Measure and log execution time with appropriate log level based on duration
87
+ */
88
+ async measureExecution(label, fn, thresholds) {
89
+ const start = Date.now();
90
+ try {
91
+ const result = await fn();
92
+ const duration = Date.now() - start;
93
+ // Choose log level based on duration thresholds
94
+ let level = LogLevel.DEBUG;
95
+ if (thresholds?.error && duration > thresholds.error) {
96
+ level = LogLevel.ERROR;
97
+ }
98
+ else if (thresholds?.warn && duration > thresholds.warn) {
99
+ level = LogLevel.WARN;
100
+ }
101
+ else {
102
+ level = LogLevel.INFO;
103
+ }
104
+ this.log(level, `${label} completed`, { duration: `${duration}ms` });
105
+ return result;
106
+ }
107
+ catch (error) {
108
+ const duration = Date.now() - start;
109
+ this.log(LogLevel.ERROR, `${label} failed`, { duration: `${duration}ms` }, error instanceof Error ? error : new Error(String(error)));
110
+ throw error;
111
+ }
112
+ }
113
+ /**
114
+ * Internal log method
115
+ */
116
+ log(level, message, context, error) {
117
+ // Check if this level should be logged (using severity for better performance)
118
+ if (!this.shouldLogLevel(level)) {
119
+ return;
120
+ }
121
+ // Create log entry
122
+ const entry = createLogEntry(level, message, {
123
+ source: this.config.source,
124
+ context,
125
+ error,
126
+ });
127
+ // Format and output
128
+ const formatted = formatLog(entry, this.formatOptions);
129
+ console.log(formatted);
130
+ }
131
+ /**
132
+ * Check if a level should be logged using severity comparison
133
+ */
134
+ shouldLogLevel(level) {
135
+ return LogLevelSeverity[level] >= LogLevelSeverity[this.config.level];
136
+ }
137
+ /**
138
+ * Check if a level is more severe than another
139
+ */
140
+ isMoreSevere(level, compareWith) {
141
+ return LogLevelSeverity[level] > LogLevelSeverity[compareWith];
142
+ }
143
+ /**
144
+ * Get severity difference between two levels
145
+ */
146
+ getSeverityDiff(level1, level2) {
147
+ return LogLevelSeverity[level1] - LogLevelSeverity[level2];
148
+ }
149
+ /**
150
+ * Get the numeric severity of the current log level
151
+ */
152
+ getCurrentSeverity() {
153
+ return LogLevelSeverity[this.config.level];
154
+ }
155
+ /**
156
+ * Get the numeric severity of a log level
157
+ */
158
+ getSeverity(level) {
159
+ return LogLevelSeverity[level];
160
+ }
161
+ /**
162
+ * Update logger configuration
163
+ */
164
+ setLevel(level) {
165
+ this.config.level = level;
166
+ }
167
+ /**
168
+ * Set level by severity (0-4)
169
+ */
170
+ setLevelBySeverity(severity) {
171
+ const levels = Object.entries(LogLevelSeverity)
172
+ .find(([_, sev]) => sev === severity);
173
+ if (levels) {
174
+ this.config.level = levels[0];
175
+ }
176
+ }
177
+ /**
178
+ * Update colors setting
179
+ */
180
+ setColors(enabled) {
181
+ this.config.colors = enabled;
182
+ this.formatOptions.colors = enabled;
183
+ }
184
+ /**
185
+ * Update format
186
+ */
187
+ setFormat(format) {
188
+ this.config.format = format;
189
+ this.formatOptions.format = format;
190
+ }
191
+ /**
192
+ * Check if a level will be logged
193
+ */
194
+ willLog(level) {
195
+ return shouldLog(level, this.config.level);
196
+ }
197
+ /**
198
+ * Get current configuration
199
+ */
200
+ getConfig() {
201
+ return { ...this.config };
202
+ }
203
+ /**
204
+ * Check if debug logging is enabled
205
+ */
206
+ isDebugEnabled() {
207
+ return this.willLog(LogLevel.DEBUG);
208
+ }
209
+ /**
210
+ * Check if info logging is enabled
211
+ */
212
+ isInfoEnabled() {
213
+ return this.willLog(LogLevel.INFO);
214
+ }
215
+ /**
216
+ * Check if warn logging is enabled
217
+ */
218
+ isWarnEnabled() {
219
+ return this.willLog(LogLevel.WARN);
220
+ }
221
+ /**
222
+ * Check if error logging is enabled
223
+ */
224
+ isErrorEnabled() {
225
+ return this.willLog(LogLevel.ERROR);
226
+ }
227
+ }
228
+ /**
229
+ * Create a logger instance from engine config
230
+ */
231
+ export function createEngineLogger(logLevel, verbose = false) {
232
+ // Silent mode - no logger
233
+ if (logLevel === 'silent') {
234
+ return null;
235
+ }
236
+ // Map engine log level to ecosystem LogLevel
237
+ const levelMap = {
238
+ debug: LogLevel.DEBUG,
239
+ info: LogLevel.INFO,
240
+ warn: LogLevel.WARN,
241
+ error: LogLevel.ERROR,
242
+ };
243
+ const level = levelMap[logLevel] || LogLevel.INFO;
244
+ return new EngineLogger({
245
+ level,
246
+ format: verbose ? 'pretty' : 'text',
247
+ colors: true,
248
+ timestamp: false, // Engine adds its own prefix
249
+ source: 'Orbyt',
250
+ });
251
+ }
252
+ //# sourceMappingURL=EngineLogger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EngineLogger.js","sourceRoot":"","sources":["../../src/core/EngineLogger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EACL,QAAQ,EACR,gBAAgB,EAChB,SAAS,EACT,cAAc,EAC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CAAC;AACL,CAAC"}
@@ -1,4 +1,5 @@
1
1
  export * from './EngineConfig.js';
2
2
  export * from './EngineContext.js';
3
3
  export * from './OrbytEngine.js';
4
+ export * from './EngineLogger.js';
4
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC"}
@@ -1,4 +1,5 @@
1
1
  export * from './EngineConfig.js';
2
2
  export * from './EngineContext.js';
3
3
  export * from './OrbytEngine.js';
4
+ export * from './EngineLogger.js';
4
5
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"SchemaValidator.d.ts","sourceRoot":"","sources":["../../src/parser/SchemaValidator.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAuB,KAAK,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AACtF,OAAO,EAML,UAAU,EAEX,MAAM,oBAAoB,CAAC;AAE5B;;GAEG;AACH,qBAAa,eAAe;IAC1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C7B,KAAK,CAAC,EAAE,UAAU,CAAC;KACpB;CAmBF"}
@@ -53,6 +53,13 @@ export class SchemaValidator {
53
53
  if (!obj || typeof obj !== 'object') {
54
54
  return;
55
55
  }
56
+ // Free-form field paths - these can contain any user-defined keys
57
+ const FREE_FORM_PATHS = ['annotations', 'context', 'secrets', 'inputs'];
58
+ const isFreeFormPath = FREE_FORM_PATHS.some(fp => path === fp || path.endsWith('.' + fp));
59
+ // Skip validation for free-form paths (user can define any fields)
60
+ if (isFreeFormPath) {
61
+ return;
62
+ }
56
63
  const validFields = getValidFields(path);
57
64
  const actualFields = Object.keys(obj);
58
65
  for (const field of actualFields) {
@@ -85,10 +92,15 @@ export class SchemaValidator {
85
92
  });
86
93
  }
87
94
  // Recursively validate nested objects
95
+ // Skip validation for free-form fields (user-defined content)
96
+ const FREE_FORM_FIELDS = ['annotations', 'context', 'with', 'outputs', 'env', 'secrets', 'inputs'];
88
97
  const value = obj[field];
89
98
  if (value && typeof value === 'object' && !Array.isArray(value)) {
90
- const nestedPath = path === 'root' ? field : `${path}.${field}`;
91
- this.validateUnknownFields(value, nestedPath);
99
+ // Don't validate contents of free-form fields (they can contain any keys)
100
+ if (!FREE_FORM_FIELDS.includes(field)) {
101
+ const nestedPath = path === 'root' ? field : `${path}.${field}`;
102
+ this.validateUnknownFields(value, nestedPath);
103
+ }
92
104
  }
93
105
  // Validate array items (steps, triggers, etc.)
94
106
  if (Array.isArray(value)) {
@@ -1 +1 @@
1
- {"version":3,"file":"SchemaValidator.js","sourceRoot":"","sources":["../../src/parser/SchemaValidator.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,mBAAmB,EAA8B,MAAM,qBAAqB,CAAC;AACtF,OAAO,EACL,WAAW,EACX,WAAW,EACX,YAAY,EACZ,cAAc,EACd,YAAY,EACZ,UAAU,EACV,aAAa,GACd,MAAM,oBAAoB,CAAC;AAE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,OAAO,CAAC,CAAC,CAAC,eAAe;oBACjE,QAAQ,EAAE,OAAc;iBACzB,CAAC;aACH,CAAC;QACJ,CAAC;IACH,CAAC;CACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orbytautomation/engine",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "Orbyt - Automation Engine Framework",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -39,8 +39,9 @@
39
39
  "node": ">=22.0.0"
40
40
  },
41
41
  "dependencies": {
42
- "@dev-ecosystem/core": "^0.3.1",
42
+ "@dev-ecosystem/core": "^0.4.0",
43
43
  "node-cron": "^4.2.1",
44
+ "yaml": "^2.8.2",
44
45
  "zod": "^4.3.6"
45
46
  },
46
47
  "devDependencies": {
@@ -1,20 +0,0 @@
1
- version: "1.0"
2
- kind: workflow
3
-
4
- metadata:
5
- name: Security Test - Reserved Annotation
6
- description: Attempts to use reserved annotation namespaces
7
-
8
- annotations:
9
- # āŒ INVALID: Reserved annotation prefixes
10
- engine.version: "fake-1.0"
11
- system.override: "attempt"
12
- internal.bypass: true
13
- ai.intent: "data-pipeline" # This one is OK
14
-
15
- workflow:
16
- steps:
17
- - id: test-step
18
- uses: shell.exec
19
- with:
20
- command: echo "Should not execute"
@@ -1,21 +0,0 @@
1
- version: "1.0"
2
- kind: workflow
3
-
4
- metadata:
5
- name: Security Test - Reserved Context Field
6
- description: Attempts to set reserved fields in context
7
-
8
- context:
9
- # āŒ INVALID: Reserved fields in context
10
- _internal:
11
- hack: "attempt"
12
- _billing:
13
- free: true
14
- myData: "this is allowed"
15
-
16
- workflow:
17
- steps:
18
- - id: test-step
19
- uses: shell.exec
20
- with:
21
- command: echo "Should not execute"
package/test-security.mjs DELETED
@@ -1,148 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * Security Validation Test
4
- *
5
- * This script tests that the engine REJECTS workflows with reserved fields
6
- * using the new WorkflowLoader architecture.
7
- *
8
- * Architecture:
9
- * - WorkflowLoader handles file I/O and parsing (utility layer)
10
- * - Engine receives validated objects (execution layer)
11
- * - This test acts as a CLI would (interface layer)
12
- */
13
-
14
- import { OrbytEngine, WorkflowLoader } from './dist/index.js';
15
-
16
- /**
17
- * Test a workflow that should be REJECTED due to security violations
18
- */
19
- async function testSecurityViolation(engine, testFile, description) {
20
- console.log(`\nšŸ“ ${description}`);
21
- console.log('-'.repeat(60));
22
-
23
- try {
24
- const workflow = await WorkflowLoader.fromFile(testFile);
25
- await engine.run(workflow);
26
-
27
- console.log('\nāŒ SECURITY FAILURE: Workflow was NOT rejected!');
28
- console.log(` File: ${testFile}`);
29
- console.log(' Reserved fields were accepted. This is a security vulnerability.');
30
- return false;
31
- } catch (error) {
32
- if (error.message.includes('SECURITY VIOLATION') || error.message.includes('reserved')) {
33
- console.log('\nāœ… SUCCESS: Workflow correctly rejected!');
34
- console.log(`\nError details:`);
35
- console.log(error.message);
36
- return true;
37
- } else {
38
- console.log('\nāš ļø Workflow failed but not due to security validation:');
39
- console.log(error.message);
40
- console.log('\nStack:');
41
- console.log(error.stack);
42
- return false;
43
- }
44
- }
45
- }
46
-
47
- /**
48
- * Test a workflow that should PASS (no security violations)
49
- */
50
- async function testValidWorkflow(engine, testFile, description) {
51
- console.log(`\nšŸ“ ${description}`);
52
- console.log('-'.repeat(60));
53
-
54
- try {
55
- const workflow = await WorkflowLoader.fromFile(testFile);
56
- await engine.run(workflow);
57
- console.log('\nāœ… SUCCESS: Valid workflow executed!');
58
- return true;
59
- } catch (error) {
60
- console.log('\nāŒ FAILURE: Valid workflow was rejected!');
61
- console.log(error.message);
62
- console.log('\nStack:');
63
- console.log(error.stack);
64
- return false;
65
- }
66
- }
67
-
68
- async function testSecurityValidation() {
69
- console.log('šŸ”’ Security Validation Test Suite');
70
- console.log('='.repeat(60));
71
- console.log('\nTesting WorkflowLoader + OrbytEngine architecture');
72
- console.log('Goal: Ensure 0% chance of reserved field manipulation\n');
73
-
74
- const engine = new OrbytEngine({
75
- logLevel: 'silent'
76
- });
77
-
78
- const results = [];
79
-
80
- // Test 1: Root-level reserved fields
81
- results.push(await testSecurityViolation(
82
- engine,
83
- './test-security.yaml',
84
- 'Test 1: Reserved fields at root level (should REJECT)'
85
- ));
86
-
87
- console.log('\n' + '='.repeat(60));
88
-
89
- // Test 2: Context-level reserved fields
90
- results.push(await testSecurityViolation(
91
- engine,
92
- './test-security-context.yaml',
93
- 'Test 2: Reserved fields in context (should REJECT)'
94
- ));
95
-
96
- console.log('\n' + '='.repeat(60));
97
-
98
- // Test 3: Reserved annotation prefixes
99
- results.push(await testSecurityViolation(
100
- engine,
101
- './test-security-annotations.yaml',
102
- 'Test 3: Reserved annotation prefixes (should REJECT)'
103
- ));
104
-
105
- console.log('\n' + '='.repeat(60));
106
-
107
- // Test 4: Valid workflow (should pass)
108
- results.push(await testValidWorkflow(
109
- engine,
110
- './test-valid-workflow.yaml',
111
- 'Test 4: Valid workflow with no violations (should ACCEPT)'
112
- ));
113
-
114
- console.log('\n' + '='.repeat(60));
115
-
116
- // Summary
117
- const passed = results.filter(r => r === true).length;
118
- const total = results.length;
119
-
120
- console.log('\nšŸ“Š Test Summary');
121
- console.log('='.repeat(60));
122
- console.log(`\nPassed: ${passed}/${total}`);
123
-
124
- if (passed === total) {
125
- console.log('\nšŸŽ‰ All security tests passed!');
126
- console.log('\nāœ“ Reserved fields at root level are blocked');
127
- console.log('āœ“ Reserved fields in context are blocked');
128
- console.log('āœ“ Reserved annotation prefixes are blocked');
129
- console.log('āœ“ Valid workflows execute normally');
130
- console.log('\nāœ… Security architecture is working correctly!');
131
- return true;
132
- } else {
133
- console.log('\nāŒ Some tests failed! Security validation is not working correctly.');
134
- return false;
135
- }
136
- }
137
-
138
- // Run the test suite
139
- testSecurityValidation()
140
- .then(success => {
141
- process.exit(success ? 0 : 1);
142
- })
143
- .catch(error => {
144
- console.error('\nšŸ’„ Unexpected error during testing:');
145
- console.error(error);
146
- process.exit(1);
147
- });
148
-
@@ -1,19 +0,0 @@
1
- version: "1.0"
2
- kind: workflow
3
-
4
- metadata:
5
- name: Security Test - Reserved Field at Root
6
- description: Attempts to set _internal field at workflow root level
7
-
8
- # āŒ INVALID: Reserved field at root level
9
- _internal:
10
- usage:
11
- stepCount: 999
12
- manipulated: true
13
-
14
- workflow:
15
- steps:
16
- - id: test-step
17
- uses: shell.exec
18
- with:
19
- command: echo "This should never execute"
@@ -1,26 +0,0 @@
1
- version: "1.0"
2
- kind: workflow
3
-
4
- metadata:
5
- name: Valid Test Workflow
6
- description: A clean workflow with no reserved fields
7
-
8
- annotations:
9
- ai.intent: "testing"
10
- custom.tag: "security-test"
11
-
12
- context:
13
- testData: "allowed"
14
- customField: "also allowed"
15
-
16
- workflow:
17
- steps:
18
- - id: echo-step
19
- uses: shell.exec
20
- with:
21
- command: echo "Hello from valid workflow"
22
-
23
- - id: success-step
24
- uses: shell.exec
25
- with:
26
- command: echo "Security validation passed!"