erosolar-cli 2.1.258 → 2.1.261
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/capabilities/orchestrationCapability.js +1 -1
- package/dist/capabilities/orchestrationCapability.js.map +1 -1
- package/dist/contracts/tools.schema.json +2 -0
- package/dist/core/deepBugAnalyzer.d.ts +25 -0
- package/dist/core/deepBugAnalyzer.d.ts.map +1 -0
- package/dist/core/deepBugAnalyzer.js +44 -0
- package/dist/core/deepBugAnalyzer.js.map +1 -0
- package/dist/core/errors/errorTypes.d.ts +56 -29
- package/dist/core/errors/errorTypes.d.ts.map +1 -1
- package/dist/core/errors/errorTypes.js +231 -49
- package/dist/core/errors/errorTypes.js.map +1 -1
- package/dist/core/hypothesisEngine.d.ts +27 -0
- package/dist/core/hypothesisEngine.d.ts.map +1 -0
- package/dist/core/hypothesisEngine.js +58 -0
- package/dist/core/hypothesisEngine.js.map +1 -0
- package/dist/core/productTestHarness.d.ts +46 -0
- package/dist/core/productTestHarness.d.ts.map +1 -0
- package/dist/core/productTestHarness.js +127 -0
- package/dist/core/productTestHarness.js.map +1 -0
- package/dist/tools/frontendTestingTools.d.ts +9 -0
- package/dist/tools/frontendTestingTools.d.ts.map +1 -0
- package/dist/tools/frontendTestingTools.js +291 -0
- package/dist/tools/frontendTestingTools.js.map +1 -0
- package/dist/tools/grepTools.d.ts +3 -0
- package/dist/tools/grepTools.d.ts.map +1 -0
- package/dist/tools/grepTools.js +119 -0
- package/dist/tools/grepTools.js.map +1 -0
- package/dist/tools/searchTools.d.ts.map +1 -1
- package/dist/tools/searchTools.js +5 -1
- package/dist/tools/searchTools.js.map +1 -1
- package/dist/ui/UnifiedUIRenderer.d.ts +3 -5
- package/dist/ui/UnifiedUIRenderer.d.ts.map +1 -1
- package/dist/ui/UnifiedUIRenderer.js +20 -47
- package/dist/ui/UnifiedUIRenderer.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Comprehensive Error Classification System
|
|
3
|
+
*
|
|
4
|
+
* Provides structured error handling with:
|
|
5
|
+
* - Error categorization (dangerous, blocked, invalid, etc.)
|
|
6
|
+
* - Severity levels (critical, error, warning, info)
|
|
7
|
+
* - Auto-fixing suggestions
|
|
8
|
+
* - Recovery strategies
|
|
3
9
|
*/
|
|
4
10
|
export var ErrorSeverity;
|
|
5
11
|
(function (ErrorSeverity) {
|
|
@@ -10,6 +16,8 @@ export var ErrorSeverity;
|
|
|
10
16
|
})(ErrorSeverity || (ErrorSeverity = {}));
|
|
11
17
|
export var ErrorCategory;
|
|
12
18
|
(function (ErrorCategory) {
|
|
19
|
+
ErrorCategory["DANGEROUS"] = "dangerous";
|
|
20
|
+
ErrorCategory["BLOCKED"] = "blocked";
|
|
13
21
|
ErrorCategory["INVALID"] = "invalid";
|
|
14
22
|
ErrorCategory["PERMISSION"] = "permission";
|
|
15
23
|
ErrorCategory["RESOURCE"] = "resource";
|
|
@@ -21,7 +29,7 @@ export var ErrorCategory;
|
|
|
21
29
|
ErrorCategory["UNKNOWN"] = "unknown";
|
|
22
30
|
})(ErrorCategory || (ErrorCategory = {}));
|
|
23
31
|
/**
|
|
24
|
-
* Base class for structured errors
|
|
32
|
+
* Base class for all structured errors
|
|
25
33
|
*/
|
|
26
34
|
export class StructuredError extends Error {
|
|
27
35
|
severity;
|
|
@@ -36,34 +44,71 @@ export class StructuredError extends Error {
|
|
|
36
44
|
this.name = this.constructor.name;
|
|
37
45
|
this.severity = details.severity;
|
|
38
46
|
this.category = details.category;
|
|
39
|
-
this.suggestions = [...details.suggestions];
|
|
47
|
+
this.suggestions = [...details.suggestions]; // Copy to mutable array
|
|
40
48
|
this.originalInput = details.originalInput;
|
|
41
49
|
this.metadata = details.metadata;
|
|
42
50
|
this.timestamp = details.timestamp;
|
|
43
51
|
this.recoverable = details.recoverable;
|
|
52
|
+
// Maintain proper stack trace
|
|
44
53
|
Error.captureStackTrace(this, this.constructor);
|
|
45
54
|
}
|
|
55
|
+
/**
|
|
56
|
+
* Format error for display with suggestions
|
|
57
|
+
*/
|
|
46
58
|
toDisplayString() {
|
|
47
|
-
|
|
59
|
+
const parts = [
|
|
60
|
+
`[${this.severity.toUpperCase()}] ${this.message}`,
|
|
61
|
+
];
|
|
62
|
+
if (this.originalInput) {
|
|
63
|
+
parts.push(` Input: ${this.originalInput}`);
|
|
64
|
+
}
|
|
65
|
+
if (this.suggestions.length > 0) {
|
|
66
|
+
parts.push('\nSuggestions:');
|
|
67
|
+
for (const suggestion of this.suggestions) {
|
|
68
|
+
parts.push(` • ${suggestion.action}`);
|
|
69
|
+
if (suggestion.example) {
|
|
70
|
+
parts.push(` Example: ${suggestion.example}`);
|
|
71
|
+
}
|
|
72
|
+
if (suggestion.autoFixable) {
|
|
73
|
+
parts.push(` [Auto-fixable]`);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return parts.join('\n');
|
|
48
78
|
}
|
|
79
|
+
/**
|
|
80
|
+
* Convert to JSON for logging/telemetry
|
|
81
|
+
*/
|
|
49
82
|
toJSON() {
|
|
50
83
|
return {
|
|
51
84
|
name: this.name,
|
|
52
85
|
severity: this.severity,
|
|
53
86
|
category: this.category,
|
|
54
87
|
message: this.message,
|
|
88
|
+
originalInput: this.originalInput,
|
|
89
|
+
suggestions: this.suggestions.map(s => ({
|
|
90
|
+
action: s.action,
|
|
91
|
+
example: s.example,
|
|
92
|
+
autoFixable: s.autoFixable,
|
|
93
|
+
})),
|
|
55
94
|
metadata: this.metadata,
|
|
56
95
|
timestamp: this.timestamp,
|
|
96
|
+
recoverable: this.recoverable,
|
|
97
|
+
stack: this.stack,
|
|
57
98
|
};
|
|
58
99
|
}
|
|
100
|
+
/**
|
|
101
|
+
* Try to auto-fix the error if possible
|
|
102
|
+
*/
|
|
59
103
|
tryAutoFix() {
|
|
60
104
|
for (const suggestion of this.suggestions) {
|
|
61
105
|
if (suggestion.autoFixable && suggestion.autoFix) {
|
|
62
106
|
try {
|
|
63
|
-
|
|
107
|
+
const result = suggestion.autoFix();
|
|
108
|
+
return { fixed: true, result };
|
|
64
109
|
}
|
|
65
110
|
catch {
|
|
66
|
-
|
|
111
|
+
// Continue to next suggestion
|
|
67
112
|
}
|
|
68
113
|
}
|
|
69
114
|
}
|
|
@@ -71,39 +116,128 @@ export class StructuredError extends Error {
|
|
|
71
116
|
}
|
|
72
117
|
}
|
|
73
118
|
/**
|
|
74
|
-
*
|
|
119
|
+
* Dangerous operation error - operation could harm the system
|
|
120
|
+
*/
|
|
121
|
+
export class DangerousOperationError extends StructuredError {
|
|
122
|
+
constructor(operation, reason, safeAlternative) {
|
|
123
|
+
const suggestions = [];
|
|
124
|
+
if (safeAlternative) {
|
|
125
|
+
suggestions.push({
|
|
126
|
+
action: `Use safer alternative: ${safeAlternative}`,
|
|
127
|
+
example: safeAlternative,
|
|
128
|
+
autoFixable: true,
|
|
129
|
+
autoFix: () => safeAlternative,
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
suggestions.push({
|
|
134
|
+
action: 'Review operation for safety before retrying',
|
|
135
|
+
autoFixable: false,
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
super({
|
|
139
|
+
severity: ErrorSeverity.CRITICAL,
|
|
140
|
+
category: ErrorCategory.DANGEROUS,
|
|
141
|
+
message: `Dangerous operation blocked: ${operation}. Reason: ${reason}`,
|
|
142
|
+
originalInput: operation,
|
|
143
|
+
suggestions,
|
|
144
|
+
recoverable: safeAlternative !== undefined,
|
|
145
|
+
timestamp: new Date().toISOString(),
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Blocked operation error - explicitly forbidden by policy
|
|
151
|
+
*/
|
|
152
|
+
export class BlockedOperationError extends StructuredError {
|
|
153
|
+
constructor(operation, policy, allowedAlternatives) {
|
|
154
|
+
const suggestions = [];
|
|
155
|
+
if (allowedAlternatives && allowedAlternatives.length > 0) {
|
|
156
|
+
for (const alt of allowedAlternatives) {
|
|
157
|
+
suggestions.push({
|
|
158
|
+
action: `Try allowed alternative: ${alt}`,
|
|
159
|
+
example: alt,
|
|
160
|
+
autoFixable: true,
|
|
161
|
+
autoFix: () => alt,
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
else {
|
|
166
|
+
suggestions.push({
|
|
167
|
+
action: 'This operation is not permitted by policy',
|
|
168
|
+
autoFixable: false,
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
super({
|
|
172
|
+
severity: ErrorSeverity.ERROR,
|
|
173
|
+
category: ErrorCategory.BLOCKED,
|
|
174
|
+
message: `Operation blocked by policy "${policy}": ${operation}`,
|
|
175
|
+
originalInput: operation,
|
|
176
|
+
suggestions,
|
|
177
|
+
recoverable: allowedAlternatives !== undefined && allowedAlternatives.length > 0,
|
|
178
|
+
timestamp: new Date().toISOString(),
|
|
179
|
+
metadata: { policy, allowedAlternatives },
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Context overflow error - token/character limits exceeded
|
|
75
185
|
*/
|
|
76
186
|
export class ContextOverflowError extends StructuredError {
|
|
77
|
-
constructor(actual, limit, unit,
|
|
187
|
+
constructor(actual, limit, unit = 'tokens', truncatable = true) {
|
|
188
|
+
const percentage = limit > 0 ? Math.round((actual / limit) * 100) : 0;
|
|
189
|
+
const suggestions = [];
|
|
190
|
+
if (truncatable) {
|
|
191
|
+
suggestions.push({
|
|
192
|
+
action: `Auto-truncate to ${limit} ${unit}`,
|
|
193
|
+
example: `Content will be reduced from ${actual} to ${limit} ${unit}`,
|
|
194
|
+
autoFixable: true,
|
|
195
|
+
autoFix: () => ({ truncate: true, limit }),
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
suggestions.push({
|
|
199
|
+
action: `Reduce scope to use less than ${limit} ${unit}`,
|
|
200
|
+
autoFixable: false,
|
|
201
|
+
});
|
|
78
202
|
super({
|
|
79
203
|
severity: ErrorSeverity.CRITICAL,
|
|
80
204
|
category: ErrorCategory.CONTEXT_OVERFLOW,
|
|
81
|
-
message: `Context overflow: ${actual} ${unit} exceeds limit of ${limit} ${unit}`,
|
|
82
|
-
suggestions
|
|
83
|
-
recoverable:
|
|
205
|
+
message: `Context overflow: ${actual} ${unit} exceeds limit of ${limit} ${unit} (${percentage}%)`,
|
|
206
|
+
suggestions,
|
|
207
|
+
recoverable: truncatable,
|
|
84
208
|
timestamp: new Date().toISOString(),
|
|
85
|
-
metadata: { actual, limit, unit },
|
|
209
|
+
metadata: { actual, limit, unit, percentage },
|
|
86
210
|
});
|
|
87
211
|
}
|
|
88
212
|
}
|
|
89
213
|
/**
|
|
90
|
-
* Resource
|
|
214
|
+
* Resource error - limits exceeded
|
|
91
215
|
*/
|
|
92
216
|
export class ResourceLimitError extends StructuredError {
|
|
93
|
-
constructor(resource, actual, limit,
|
|
217
|
+
constructor(resource, actual, limit, reducible = true) {
|
|
218
|
+
const suggestions = [];
|
|
219
|
+
if (reducible) {
|
|
220
|
+
const safeValue = Math.floor(limit * 0.8); // 80% of limit
|
|
221
|
+
suggestions.push({
|
|
222
|
+
action: `Reduce ${resource} to ${safeValue} (80% of limit)`,
|
|
223
|
+
example: `Set ${resource}=${safeValue}`,
|
|
224
|
+
autoFixable: true,
|
|
225
|
+
autoFix: () => safeValue,
|
|
226
|
+
});
|
|
227
|
+
}
|
|
94
228
|
super({
|
|
95
229
|
severity: ErrorSeverity.ERROR,
|
|
96
230
|
category: ErrorCategory.RESOURCE,
|
|
97
231
|
message: `Resource limit exceeded: ${resource} is ${actual}, maximum is ${limit}`,
|
|
98
|
-
suggestions
|
|
99
|
-
recoverable:
|
|
232
|
+
suggestions,
|
|
233
|
+
recoverable: reducible,
|
|
100
234
|
timestamp: new Date().toISOString(),
|
|
101
235
|
metadata: { resource, actual, limit },
|
|
102
236
|
});
|
|
103
237
|
}
|
|
104
238
|
}
|
|
105
239
|
/**
|
|
106
|
-
* Validation error
|
|
240
|
+
* Validation error - input/schema validation failed
|
|
107
241
|
*/
|
|
108
242
|
export class ValidationError extends StructuredError {
|
|
109
243
|
constructor(field, code, message) {
|
|
@@ -111,53 +245,101 @@ export class ValidationError extends StructuredError {
|
|
|
111
245
|
severity: ErrorSeverity.ERROR,
|
|
112
246
|
category: ErrorCategory.VALIDATION,
|
|
113
247
|
message: `Validation failed for ${field}: ${code}. ${message}`,
|
|
114
|
-
|
|
248
|
+
originalInput: code,
|
|
249
|
+
suggestions: [
|
|
250
|
+
{
|
|
251
|
+
action: `Fix the field "${field}" to satisfy validation`,
|
|
252
|
+
example: `${field}: <provide valid value>`,
|
|
253
|
+
autoFixable: false,
|
|
254
|
+
},
|
|
255
|
+
],
|
|
115
256
|
recoverable: false,
|
|
116
257
|
timestamp: new Date().toISOString(),
|
|
117
258
|
metadata: { field, code },
|
|
118
259
|
});
|
|
119
260
|
}
|
|
120
261
|
}
|
|
121
|
-
// Legacy compatibility - these are no-ops now
|
|
122
|
-
export class DangerousOperationError extends StructuredError {
|
|
123
|
-
constructor(operation, reason, _safeAlternative) {
|
|
124
|
-
super({
|
|
125
|
-
severity: ErrorSeverity.WARNING,
|
|
126
|
-
category: ErrorCategory.UNKNOWN,
|
|
127
|
-
message: `${operation}: ${reason}`,
|
|
128
|
-
suggestions: [],
|
|
129
|
-
recoverable: true,
|
|
130
|
-
timestamp: new Date().toISOString(),
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
export class BlockedOperationError extends StructuredError {
|
|
135
|
-
constructor(operation, policy, _allowedAlternatives) {
|
|
136
|
-
super({
|
|
137
|
-
severity: ErrorSeverity.WARNING,
|
|
138
|
-
category: ErrorCategory.UNKNOWN,
|
|
139
|
-
message: `${operation}: ${policy}`,
|
|
140
|
-
suggestions: [],
|
|
141
|
-
recoverable: true,
|
|
142
|
-
timestamp: new Date().toISOString(),
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
262
|
/**
|
|
147
|
-
*
|
|
263
|
+
* Format any error as a structured error
|
|
148
264
|
*/
|
|
149
265
|
export function toStructuredError(error) {
|
|
150
|
-
|
|
266
|
+
// Already structured
|
|
267
|
+
if (error instanceof StructuredError) {
|
|
151
268
|
return error;
|
|
269
|
+
}
|
|
270
|
+
// Convert standard errors
|
|
152
271
|
const message = error instanceof Error ? error.message : String(error);
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
272
|
+
// Detect error category from message
|
|
273
|
+
const category = detectErrorCategory(message);
|
|
274
|
+
const severity = detectErrorSeverity(category);
|
|
275
|
+
class GenericStructuredError extends StructuredError {
|
|
276
|
+
}
|
|
277
|
+
return new GenericStructuredError({
|
|
278
|
+
severity,
|
|
279
|
+
category,
|
|
157
280
|
message,
|
|
158
281
|
suggestions: [],
|
|
159
282
|
recoverable: false,
|
|
160
283
|
timestamp: new Date().toISOString(),
|
|
161
284
|
});
|
|
162
285
|
}
|
|
286
|
+
/**
|
|
287
|
+
* Detect error category from error message
|
|
288
|
+
*/
|
|
289
|
+
function detectErrorCategory(message) {
|
|
290
|
+
const lower = message.toLowerCase();
|
|
291
|
+
if (lower.includes('dangerous') || lower.includes('unsafe') || lower.includes('harmful')) {
|
|
292
|
+
return ErrorCategory.DANGEROUS;
|
|
293
|
+
}
|
|
294
|
+
if (lower.includes('blocked') || lower.includes('forbidden') || lower.includes('not allowed')) {
|
|
295
|
+
return ErrorCategory.BLOCKED;
|
|
296
|
+
}
|
|
297
|
+
if (lower.includes('invalid') || lower.includes('malformed')) {
|
|
298
|
+
return ErrorCategory.INVALID;
|
|
299
|
+
}
|
|
300
|
+
if (lower.includes('permission') || lower.includes('unauthorized') || lower.includes('access denied')) {
|
|
301
|
+
return ErrorCategory.PERMISSION;
|
|
302
|
+
}
|
|
303
|
+
if (lower.includes('limit') || lower.includes('exceeded') || lower.includes('too large')) {
|
|
304
|
+
return ErrorCategory.RESOURCE;
|
|
305
|
+
}
|
|
306
|
+
if (lower.includes('timeout') || lower.includes('timed out')) {
|
|
307
|
+
return ErrorCategory.TIMEOUT;
|
|
308
|
+
}
|
|
309
|
+
if (lower.includes('network') || lower.includes('connection')) {
|
|
310
|
+
return ErrorCategory.NETWORK;
|
|
311
|
+
}
|
|
312
|
+
if (lower.includes('validation') || lower.includes('schema')) {
|
|
313
|
+
return ErrorCategory.VALIDATION;
|
|
314
|
+
}
|
|
315
|
+
if (lower.includes('context') || lower.includes('token') || lower.includes('overflow')) {
|
|
316
|
+
return ErrorCategory.CONTEXT_OVERFLOW;
|
|
317
|
+
}
|
|
318
|
+
if (lower.includes('not found') || lower.includes('does not exist')) {
|
|
319
|
+
return ErrorCategory.NOT_FOUND;
|
|
320
|
+
}
|
|
321
|
+
return ErrorCategory.UNKNOWN;
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* Determine severity from category
|
|
325
|
+
*/
|
|
326
|
+
function detectErrorSeverity(category) {
|
|
327
|
+
switch (category) {
|
|
328
|
+
case ErrorCategory.DANGEROUS:
|
|
329
|
+
case ErrorCategory.CONTEXT_OVERFLOW:
|
|
330
|
+
return ErrorSeverity.CRITICAL;
|
|
331
|
+
case ErrorCategory.BLOCKED:
|
|
332
|
+
case ErrorCategory.PERMISSION:
|
|
333
|
+
case ErrorCategory.VALIDATION:
|
|
334
|
+
case ErrorCategory.INVALID:
|
|
335
|
+
case ErrorCategory.RESOURCE:
|
|
336
|
+
return ErrorSeverity.ERROR;
|
|
337
|
+
case ErrorCategory.TIMEOUT:
|
|
338
|
+
case ErrorCategory.NETWORK:
|
|
339
|
+
case ErrorCategory.NOT_FOUND:
|
|
340
|
+
return ErrorSeverity.WARNING;
|
|
341
|
+
default:
|
|
342
|
+
return ErrorSeverity.ERROR;
|
|
343
|
+
}
|
|
344
|
+
}
|
|
163
345
|
//# sourceMappingURL=errorTypes.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errorTypes.js","sourceRoot":"","sources":["../../../src/core/errors/errorTypes.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"errorTypes.js","sourceRoot":"","sources":["../../../src/core/errors/errorTypes.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,MAAM,CAAN,IAAY,aAKX;AALD,WAAY,aAAa;IACvB,sCAAqB,CAAA;IACrB,gCAAe,CAAA;IACf,oCAAmB,CAAA;IACnB,8BAAa,CAAA;AACf,CAAC,EALW,aAAa,KAAb,aAAa,QAKxB;AAED,MAAM,CAAN,IAAY,aAYX;AAZD,WAAY,aAAa;IACvB,wCAAuB,CAAA;IACvB,oCAAmB,CAAA;IACnB,oCAAmB,CAAA;IACnB,0CAAyB,CAAA;IACzB,sCAAqB,CAAA;IACrB,oCAAmB,CAAA;IACnB,oCAAmB,CAAA;IACnB,0CAAyB,CAAA;IACzB,sDAAqC,CAAA;IACrC,wCAAuB,CAAA;IACvB,oCAAmB,CAAA;AACrB,CAAC,EAZW,aAAa,KAAb,aAAa,QAYxB;AA4BD;;GAEG;AACH,MAAM,OAAgB,eAAgB,SAAQ,KAAK;IACjC,QAAQ,CAAgB;IACxB,QAAQ,CAAgB;IACxB,WAAW,CAAoB;IAC/B,aAAa,CAAU;IACvB,QAAQ,CAA2B;IACnC,SAAS,CAAS;IAClB,WAAW,CAAU;IAErC,YAAY,OAA+B;QACzC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QACvB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;QAClC,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;QACjC,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;QACjC,IAAI,CAAC,WAAW,GAAG,CAAC,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,wBAAwB;QACrE,IAAI,CAAC,aAAa,GAAG,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interface Hypothesis {
|
|
8
|
+
id: string;
|
|
9
|
+
description: string;
|
|
10
|
+
confidence: number;
|
|
11
|
+
evidence: Evidence[];
|
|
12
|
+
status: 'pending' | 'testing' | 'validated' | 'rejected';
|
|
13
|
+
}
|
|
14
|
+
export declare class BugHypothesisAnalyzer {
|
|
15
|
+
scoreEvidence(evidence: Evidence[]): number;
|
|
16
|
+
}
|
|
17
|
+
export declare class HypothesisEngine {
|
|
18
|
+
private readonly maxHypotheses;
|
|
19
|
+
private readonly analyzer;
|
|
20
|
+
private hypotheses;
|
|
21
|
+
constructor(maxHypotheses?: number);
|
|
22
|
+
generateHypothesis(description: string, evidence?: Evidence[]): Hypothesis;
|
|
23
|
+
addEvidence(id: string, evidence: Evidence): void;
|
|
24
|
+
getHypothesis(id: string): Hypothesis | undefined;
|
|
25
|
+
getBestHypothesis(): Hypothesis | undefined;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=hypothesisEngine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hypothesisEngine.d.ts","sourceRoot":"","sources":["../../src/core/hypothesisEngine.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,QAAQ,GAAG;IACrB,IAAI,EAAE,aAAa,GAAG,MAAM,GAAG,aAAa,GAAG,eAAe,CAAC;IAC/D,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,IAAI,CAAC;CACjB,CAAC;AAEF,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,QAAQ,EAAE,CAAC;IACrB,MAAM,EAAE,SAAS,GAAG,SAAS,GAAG,WAAW,GAAG,UAAU,CAAC;CAC1D;AAED,qBAAa,qBAAqB;IAChC,aAAa,CAAC,QAAQ,EAAE,QAAQ,EAAE,GAAG,MAAM;CAM5C;AAED,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAS;IACvC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAwB;IACjD,OAAO,CAAC,UAAU,CAAsC;gBAE5C,aAAa,SAAK;IAK9B,kBAAkB,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,GAAE,QAAQ,EAAO,GAAG,UAAU;IAoB9E,WAAW,CAAC,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,IAAI;IAQjD,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS;IAIjD,iBAAiB,IAAI,UAAU,GAAG,SAAS;CAS5C"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { randomUUID } from 'node:crypto';
|
|
2
|
+
export class BugHypothesisAnalyzer {
|
|
3
|
+
scoreEvidence(evidence) {
|
|
4
|
+
if (!evidence.length)
|
|
5
|
+
return 0.3;
|
|
6
|
+
const totalWeight = evidence.reduce((sum, item) => sum + item.weight, 0);
|
|
7
|
+
const normalized = Math.max(0, Math.min(1, 0.5 + totalWeight / (evidence.length * 2)));
|
|
8
|
+
return normalized;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
export class HypothesisEngine {
|
|
12
|
+
maxHypotheses;
|
|
13
|
+
analyzer;
|
|
14
|
+
hypotheses = new Map();
|
|
15
|
+
constructor(maxHypotheses = 10) {
|
|
16
|
+
this.maxHypotheses = Math.max(1, maxHypotheses);
|
|
17
|
+
this.analyzer = new BugHypothesisAnalyzer();
|
|
18
|
+
}
|
|
19
|
+
generateHypothesis(description, evidence = []) {
|
|
20
|
+
// Keep memory bounded
|
|
21
|
+
if (this.hypotheses.size >= this.maxHypotheses) {
|
|
22
|
+
const oldest = [...this.hypotheses.keys()][0];
|
|
23
|
+
if (oldest)
|
|
24
|
+
this.hypotheses.delete(oldest);
|
|
25
|
+
}
|
|
26
|
+
const confidence = this.analyzer.scoreEvidence(evidence);
|
|
27
|
+
const hypothesis = {
|
|
28
|
+
id: randomUUID(),
|
|
29
|
+
description,
|
|
30
|
+
confidence,
|
|
31
|
+
evidence: [...evidence],
|
|
32
|
+
status: 'pending',
|
|
33
|
+
};
|
|
34
|
+
this.hypotheses.set(hypothesis.id, hypothesis);
|
|
35
|
+
return hypothesis;
|
|
36
|
+
}
|
|
37
|
+
addEvidence(id, evidence) {
|
|
38
|
+
const hyp = this.hypotheses.get(id);
|
|
39
|
+
if (!hyp)
|
|
40
|
+
return;
|
|
41
|
+
hyp.evidence.push(evidence);
|
|
42
|
+
hyp.confidence = this.analyzer.scoreEvidence(hyp.evidence);
|
|
43
|
+
hyp.status = 'pending';
|
|
44
|
+
}
|
|
45
|
+
getHypothesis(id) {
|
|
46
|
+
return this.hypotheses.get(id);
|
|
47
|
+
}
|
|
48
|
+
getBestHypothesis() {
|
|
49
|
+
let best;
|
|
50
|
+
for (const hyp of this.hypotheses.values()) {
|
|
51
|
+
if (!best || hyp.confidence > best.confidence) {
|
|
52
|
+
best = hyp;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return best;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=hypothesisEngine.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hypothesisEngine.js","sourceRoot":"","sources":["../../src/core/hypothesisEngine.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAiBzC,MAAM,OAAO,qBAAqB;IAChC,aAAa,CAAC,QAAoB;QAChC,IAAI,CAAC,QAAQ,CAAC,MAAM;YAAE,OAAO,GAAG,CAAC;QACjC,MAAM,WAAW,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,CAAC,GAAG,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;QACzE,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,CAA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AAU,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QACpC,IAAI,CAAC,GAAG;YAAE,OAAO;QACjB,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC5B,GAAG,CAAC,UAAU,GAAG,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QAC3D,GAAG,CAAC,MAAM,GAAG,SAAS,CAAC;IACzB,CAAC;IAED,aAAa,CAAC,EAAU;QACtB,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IACjC,CAAC;IAED,iBAAiB;QACf,IAAI,IAA4B,CAAC;QACjC,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,EAAE,CAAC;YAC3C,IAAI,CAAC,IAAI,IAAI,GAAG,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;gBAC9C,IAAI,GAAG,GAAG,CAAC;YACb,CAAC;QACH,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;CACF"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export interface TestScenario {
|
|
2
|
+
name: string;
|
|
3
|
+
description: string;
|
|
4
|
+
timeout?: number;
|
|
5
|
+
execute: () => Promise<{
|
|
6
|
+
scenario: string;
|
|
7
|
+
passed: boolean;
|
|
8
|
+
duration: number;
|
|
9
|
+
output: string;
|
|
10
|
+
}>;
|
|
11
|
+
}
|
|
12
|
+
export interface ScenarioResult {
|
|
13
|
+
scenario: string;
|
|
14
|
+
passed: boolean;
|
|
15
|
+
duration: number;
|
|
16
|
+
output: string;
|
|
17
|
+
error?: string;
|
|
18
|
+
}
|
|
19
|
+
export interface TestRunResult {
|
|
20
|
+
total: number;
|
|
21
|
+
passed: number;
|
|
22
|
+
failed: number;
|
|
23
|
+
results: ScenarioResult[];
|
|
24
|
+
summary: string;
|
|
25
|
+
}
|
|
26
|
+
export declare class ProductTestHarness {
|
|
27
|
+
private scenarios;
|
|
28
|
+
addScenario(scenario: TestScenario): void;
|
|
29
|
+
runAll(): Promise<TestRunResult>;
|
|
30
|
+
}
|
|
31
|
+
export declare function createRuntimeEnvironment(): {
|
|
32
|
+
execute: (code: string, runtime?: "node" | "bash") => Promise<{
|
|
33
|
+
exitCode: any;
|
|
34
|
+
stdout: any;
|
|
35
|
+
stderr: any;
|
|
36
|
+
}>;
|
|
37
|
+
writeFile: (path: string, content: string) => void;
|
|
38
|
+
readFile: (path: string) => string;
|
|
39
|
+
fileExists: (path: string) => boolean;
|
|
40
|
+
cleanup: () => void;
|
|
41
|
+
root: string;
|
|
42
|
+
};
|
|
43
|
+
export declare class TestScenarioGenerator {
|
|
44
|
+
generateSmokeTests(): TestScenario[];
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=productTestHarness.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"productTestHarness.d.ts","sourceRoot":"","sources":["../../src/core/productTestHarness.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,OAAO,CAAC;QACrB,QAAQ,EAAE,MAAM,CAAC;QACjB,MAAM,EAAE,OAAO,CAAC;QAChB,QAAQ,EAAE,MAAM,CAAC;QACjB,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC,CAAC;CACJ;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,cAAc,EAAE,CAAC;IAC1B,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,SAAS,CAAsB;IAEvC,WAAW,CAAC,QAAQ,EAAE,YAAY,GAAG,IAAI;IAInC,MAAM,IAAI,OAAO,CAAC,aAAa,CAAC;CAqCvC;AAyBD,wBAAgB,wBAAwB;oBAGT,MAAM,YAAW,MAAM,GAAG,MAAM;;;;;sBAqBpC,MAAM,WAAW,MAAM,KAAG,IAAI;qBAK/B,MAAM,KAAG,MAAM;uBAIb,MAAM,KAAG,OAAO;mBAItB,IAAI;;EASzB;AAMD,qBAAa,qBAAqB;IAChC,kBAAkB,IAAI,YAAY,EAAE;CAcrC"}
|