stringray-ai 1.0.37 â 1.0.39
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/plugin/architectural-integrity.d.ts +21 -0
- package/dist/plugin/architectural-integrity.d.ts.map +1 -0
- package/dist/plugin/architectural-integrity.js +81 -0
- package/dist/plugin/architectural-integrity.js.map +1 -0
- package/dist/plugin/boot-orchestrator.d.ts +100 -0
- package/dist/plugin/boot-orchestrator.d.ts.map +1 -0
- package/dist/plugin/boot-orchestrator.js +606 -0
- package/dist/plugin/boot-orchestrator.js.map +1 -0
- package/dist/plugin/codex-injector.d.ts +72 -0
- package/dist/plugin/codex-injector.d.ts.map +1 -0
- package/dist/plugin/codex-injector.js +387 -0
- package/dist/plugin/codex-injector.js.map +1 -0
- package/dist/plugin/delegation/index.d.ts +16 -0
- package/dist/plugin/delegation/index.d.ts.map +1 -0
- package/dist/plugin/delegation/index.js +13 -0
- package/dist/plugin/delegation/index.js.map +1 -0
- package/dist/plugin/delegation/session-coordinator.d.ts +121 -0
- package/dist/plugin/delegation/session-coordinator.d.ts.map +1 -0
- package/dist/plugin/delegation/session-coordinator.js +346 -0
- package/dist/plugin/delegation/session-coordinator.js.map +1 -0
- package/dist/plugin/index.d.ts +3 -0
- package/dist/plugin/index.d.ts.map +1 -0
- package/dist/plugin/index.js +3 -0
- package/dist/plugin/index.js.map +1 -0
- package/dist/plugin/monitoring/memory-monitor.d.ts +113 -0
- package/dist/plugin/monitoring/memory-monitor.d.ts.map +1 -0
- package/dist/plugin/monitoring/memory-monitor.js +283 -0
- package/dist/plugin/monitoring/memory-monitor.js.map +1 -0
- package/dist/plugin/postprocessor/PostProcessor.d.ts +90 -0
- package/dist/plugin/postprocessor/PostProcessor.d.ts.map +1 -0
- package/dist/plugin/postprocessor/PostProcessor.js +631 -0
- package/dist/plugin/postprocessor/PostProcessor.js.map +1 -0
- package/dist/plugin/postprocessor/analysis/FailureAnalysisEngine.d.ts +40 -0
- package/dist/plugin/postprocessor/analysis/FailureAnalysisEngine.d.ts.map +1 -0
- package/dist/plugin/postprocessor/analysis/FailureAnalysisEngine.js +244 -0
- package/dist/plugin/postprocessor/analysis/FailureAnalysisEngine.js.map +1 -0
- package/dist/plugin/postprocessor/autofix/AutoFixEngine.d.ts +50 -0
- package/dist/plugin/postprocessor/autofix/AutoFixEngine.d.ts.map +1 -0
- package/dist/plugin/postprocessor/autofix/AutoFixEngine.js +246 -0
- package/dist/plugin/postprocessor/autofix/AutoFixEngine.js.map +1 -0
- package/dist/plugin/postprocessor/autofix/FixValidator.d.ts +27 -0
- package/dist/plugin/postprocessor/autofix/FixValidator.d.ts.map +1 -0
- package/dist/plugin/postprocessor/autofix/FixValidator.js +158 -0
- package/dist/plugin/postprocessor/autofix/FixValidator.js.map +1 -0
- package/dist/plugin/postprocessor/config.d.ts +7 -0
- package/dist/plugin/postprocessor/config.d.ts.map +1 -0
- package/dist/plugin/postprocessor/config.js +66 -0
- package/dist/plugin/postprocessor/config.js.map +1 -0
- package/dist/plugin/postprocessor/escalation/EscalationEngine.d.ts +73 -0
- package/dist/plugin/postprocessor/escalation/EscalationEngine.d.ts.map +1 -0
- package/dist/plugin/postprocessor/escalation/EscalationEngine.js +249 -0
- package/dist/plugin/postprocessor/escalation/EscalationEngine.js.map +1 -0
- package/dist/plugin/postprocessor/monitoring/MonitoringEngine.d.ts +19 -0
- package/dist/plugin/postprocessor/monitoring/MonitoringEngine.d.ts.map +1 -0
- package/dist/plugin/postprocessor/monitoring/MonitoringEngine.js +120 -0
- package/dist/plugin/postprocessor/monitoring/MonitoringEngine.js.map +1 -0
- package/dist/plugin/postprocessor/redeploy/RedeployCoordinator.d.ts +92 -0
- package/dist/plugin/postprocessor/redeploy/RedeployCoordinator.d.ts.map +1 -0
- package/dist/plugin/postprocessor/redeploy/RedeployCoordinator.js +319 -0
- package/dist/plugin/postprocessor/redeploy/RedeployCoordinator.js.map +1 -0
- package/dist/plugin/postprocessor/success/SuccessHandler.d.ts +61 -0
- package/dist/plugin/postprocessor/success/SuccessHandler.d.ts.map +1 -0
- package/dist/plugin/postprocessor/success/SuccessHandler.js +148 -0
- package/dist/plugin/postprocessor/success/SuccessHandler.js.map +1 -0
- package/dist/plugin/postprocessor/triggers/APITrigger.d.ts +13 -0
- package/dist/plugin/postprocessor/triggers/APITrigger.d.ts.map +1 -0
- package/dist/plugin/postprocessor/triggers/APITrigger.js +20 -0
- package/dist/plugin/postprocessor/triggers/APITrigger.js.map +1 -0
- package/dist/plugin/postprocessor/triggers/GitHookTrigger.d.ts +17 -0
- package/dist/plugin/postprocessor/triggers/GitHookTrigger.d.ts.map +1 -0
- package/dist/plugin/postprocessor/triggers/GitHookTrigger.js +285 -0
- package/dist/plugin/postprocessor/triggers/GitHookTrigger.js.map +1 -0
- package/dist/plugin/postprocessor/triggers/WebhookTrigger.d.ts +13 -0
- package/dist/plugin/postprocessor/triggers/WebhookTrigger.d.ts.map +1 -0
- package/dist/plugin/postprocessor/triggers/WebhookTrigger.js +21 -0
- package/dist/plugin/postprocessor/triggers/WebhookTrigger.js.map +1 -0
- package/dist/plugin/postprocessor/types.d.ts +198 -0
- package/dist/plugin/postprocessor/types.d.ts.map +1 -0
- package/dist/plugin/postprocessor/types.js +5 -0
- package/dist/plugin/postprocessor/types.js.map +1 -0
- package/dist/plugin/security/security-auditor.d.ts +57 -0
- package/dist/plugin/security/security-auditor.d.ts.map +1 -0
- package/dist/plugin/security/security-auditor.js +583 -0
- package/dist/plugin/security/security-auditor.js.map +1 -0
- package/dist/plugin/security/security-hardener.d.ts +63 -0
- package/dist/plugin/security/security-hardener.d.ts.map +1 -0
- package/dist/plugin/security/security-hardener.js +181 -0
- package/dist/plugin/security/security-hardener.js.map +1 -0
- package/dist/plugin/security/security-headers.d.ts +52 -0
- package/dist/plugin/security/security-headers.d.ts.map +1 -0
- package/dist/plugin/security/security-headers.js +118 -0
- package/dist/plugin/security/security-headers.js.map +1 -0
- package/dist/plugin/session/session-cleanup-manager.d.ts +118 -0
- package/dist/plugin/session/session-cleanup-manager.d.ts.map +1 -0
- package/dist/plugin/session/session-cleanup-manager.js +324 -0
- package/dist/plugin/session/session-cleanup-manager.js.map +1 -0
- package/dist/plugin/session/session-monitor.d.ts +99 -0
- package/dist/plugin/session/session-monitor.d.ts.map +1 -0
- package/dist/plugin/session/session-monitor.js +363 -0
- package/dist/plugin/session/session-monitor.js.map +1 -0
- package/dist/plugin/session/session-state-manager.d.ts +142 -0
- package/dist/plugin/session/session-state-manager.d.ts.map +1 -0
- package/dist/plugin/session/session-state-manager.js +504 -0
- package/dist/plugin/session/session-state-manager.js.map +1 -0
- package/dist/plugin/strray-activation.d.ts +18 -0
- package/dist/plugin/strray-activation.d.ts.map +1 -0
- package/dist/plugin/strray-activation.js +114 -0
- package/dist/plugin/strray-activation.js.map +1 -0
- package/dist/plugin/validation/report-content-validator.d.ts +43 -0
- package/dist/plugin/validation/report-content-validator.d.ts.map +1 -0
- package/dist/plugin/validation/report-content-validator.js +219 -0
- package/dist/plugin/validation/report-content-validator.js.map +1 -0
- package/package.json +1 -1
- package/scripts/test-complex-orchestration.mjs +1 -1
- package/scripts/test-simple-prompt.mjs +1 -1
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fix Validation and Rollback for Post-Processor
|
|
3
|
+
*/
|
|
4
|
+
import { execSync } from "child_process";
|
|
5
|
+
export class FixValidator {
|
|
6
|
+
/**
|
|
7
|
+
* Validate that applied fixes resolve the original issue
|
|
8
|
+
*/
|
|
9
|
+
async validateFixes(fixes, originalFailure, context) {
|
|
10
|
+
console.log("â
Validating applied fixes...");
|
|
11
|
+
if (fixes.length === 0) {
|
|
12
|
+
console.log("â ī¸ No fixes to validate");
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
try {
|
|
16
|
+
// Run validation tests based on the original failure type
|
|
17
|
+
const validationPassed = await this.runValidationTests(originalFailure.category);
|
|
18
|
+
if (validationPassed) {
|
|
19
|
+
console.log("â
Fix validation passed - original issue appears resolved");
|
|
20
|
+
return true;
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
console.log("â Fix validation failed - issue still exists");
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
catch (error) {
|
|
28
|
+
console.error("â Fix validation error:", error);
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Run appropriate validation tests based on failure category
|
|
34
|
+
*/
|
|
35
|
+
async runValidationTests(category) {
|
|
36
|
+
try {
|
|
37
|
+
switch (category) {
|
|
38
|
+
case "test-failure":
|
|
39
|
+
console.log("đ§Ē Running test validation...");
|
|
40
|
+
execSync("npm test", {
|
|
41
|
+
stdio: "pipe",
|
|
42
|
+
timeout: 120000, // 2 minutes
|
|
43
|
+
});
|
|
44
|
+
return true;
|
|
45
|
+
case "build-failure":
|
|
46
|
+
console.log("đ¨ Running build validation...");
|
|
47
|
+
execSync("npm run build", {
|
|
48
|
+
stdio: "pipe",
|
|
49
|
+
timeout: 120000, // 2 minutes
|
|
50
|
+
});
|
|
51
|
+
return true;
|
|
52
|
+
case "code-quality-failure":
|
|
53
|
+
console.log("đ¨ Running code quality validation...");
|
|
54
|
+
execSync("npm run lint", {
|
|
55
|
+
stdio: "pipe",
|
|
56
|
+
timeout: 60000, // 1 minute
|
|
57
|
+
});
|
|
58
|
+
return true;
|
|
59
|
+
case "security-failure":
|
|
60
|
+
console.log("đĄī¸ Running security validation...");
|
|
61
|
+
execSync("npm run security-audit", {
|
|
62
|
+
stdio: "pipe",
|
|
63
|
+
timeout: 60000, // 1 minute
|
|
64
|
+
});
|
|
65
|
+
return true;
|
|
66
|
+
case "performance-regression":
|
|
67
|
+
console.log("⥠Running performance validation...");
|
|
68
|
+
execSync("npm run test:performance", {
|
|
69
|
+
stdio: "pipe",
|
|
70
|
+
timeout: 120000, // 2 minutes
|
|
71
|
+
});
|
|
72
|
+
return true;
|
|
73
|
+
case "ci-pipeline-failure":
|
|
74
|
+
default:
|
|
75
|
+
console.log("đ Running general validation...");
|
|
76
|
+
// Run type checking as basic validation
|
|
77
|
+
execSync("npm run typecheck", {
|
|
78
|
+
stdio: "pipe",
|
|
79
|
+
timeout: 60000, // 1 minute
|
|
80
|
+
});
|
|
81
|
+
return true;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
catch (error) {
|
|
85
|
+
console.log(`â Validation failed for ${category}:`, error instanceof Error ? error.message : String(error));
|
|
86
|
+
return false;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Rollback applied fixes if validation fails
|
|
91
|
+
*/
|
|
92
|
+
async rollbackFixes(fixes) {
|
|
93
|
+
console.log("đ Rolling back applied fixes...");
|
|
94
|
+
if (fixes.length === 0) {
|
|
95
|
+
console.log("â ī¸ No fixes to rollback");
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
try {
|
|
99
|
+
// Create a backup branch before rollback
|
|
100
|
+
const backupBranch = `backup-fix-${Date.now()}`;
|
|
101
|
+
execSync(`git branch ${backupBranch}`, { stdio: "pipe" });
|
|
102
|
+
console.log(`đž Created backup branch: ${backupBranch}`);
|
|
103
|
+
// Reset to the commit before fixes were applied
|
|
104
|
+
execSync("git reset --hard HEAD~1", { stdio: "inherit" });
|
|
105
|
+
console.log("â
Fixes rolled back to previous commit");
|
|
106
|
+
// Restore working directory state if needed
|
|
107
|
+
// This is a simplified rollback - in production, we'd track exact changes
|
|
108
|
+
console.log("đ Rollback completed successfully");
|
|
109
|
+
}
|
|
110
|
+
catch (error) {
|
|
111
|
+
console.error("â Rollback failed:", error);
|
|
112
|
+
throw new Error(`Rollback failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Create a detailed validation report
|
|
117
|
+
*/
|
|
118
|
+
async generateValidationReport(fixes, validationResult, originalFailure) {
|
|
119
|
+
return {
|
|
120
|
+
timestamp: new Date().toISOString(),
|
|
121
|
+
originalFailure: {
|
|
122
|
+
category: originalFailure.category,
|
|
123
|
+
severity: originalFailure.severity,
|
|
124
|
+
confidence: originalFailure.confidence,
|
|
125
|
+
},
|
|
126
|
+
appliedFixes: fixes.map((fix) => ({
|
|
127
|
+
type: fix.type,
|
|
128
|
+
description: fix.description,
|
|
129
|
+
files: fix.files,
|
|
130
|
+
})),
|
|
131
|
+
validationResult,
|
|
132
|
+
summary: validationResult
|
|
133
|
+
? "Fixes validated successfully - issue resolved"
|
|
134
|
+
: "Fixes did not resolve the issue - manual intervention required",
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Check if rollback is safe and recommended
|
|
139
|
+
*/
|
|
140
|
+
isRollbackRecommended(fixes, validationResult, originalFailure) {
|
|
141
|
+
// Don't rollback if fixes were applied and validation passed
|
|
142
|
+
if (validationResult) {
|
|
143
|
+
return false;
|
|
144
|
+
}
|
|
145
|
+
// Rollback if high-severity failures couldn't be fixed
|
|
146
|
+
if (originalFailure.severity === "critical" ||
|
|
147
|
+
originalFailure.severity === "high") {
|
|
148
|
+
return true;
|
|
149
|
+
}
|
|
150
|
+
// Rollback if multiple fixes were applied but still failed
|
|
151
|
+
if (fixes.length > 1) {
|
|
152
|
+
return true;
|
|
153
|
+
}
|
|
154
|
+
// For low-risk changes, rollback is safer
|
|
155
|
+
return fixes.some((fix) => fix.type === "dependency-update" || fix.type === "code-fix");
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
//# sourceMappingURL=FixValidator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FixValidator.js","sourceRoot":"","sources":["../../../../src/postprocessor/autofix/FixValidator.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,MAAM,OAAO,YAAY;IACvB;;OAEG;IACH,KAAK,CAAC,aAA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CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;gBAChC,IAAI,EAAE,GAAG,CAAC,IAAI;gBACd,WAAW,EAAE,GAAG,CAAC,WAAW;gBAC5B,KAAK,EAAE,GAAG,CAAC,KAAK;aACjB,CAAC,CAAC;YACH,gBAAgB;YAChB,OAAO,EAAE,gBAAgB;gBACvB,CAAC,CAAC,+CAA+C;gBACjD,CAAC,CAAC,gEAAgE;SACrE,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,qBAAqB,CACnB,KAAY,EACZ,gBAAyB,EACzB,eAAgC;QAEhC,6DAA6D;QAC7D,IAAI,gBAAgB,EAAE,CAAC;YACrB,OAAO,KAAK,CAAC;QACf,CAAC;QAED,uDAAuD;QACvD,IACE,eAAe,CAAC,QAAQ,KAAK,UAAU;YACvC,eAAe,CAAC,QAAQ,KAAK,MAAM,EACnC,CAAC;YACD,OAAO,IAAI,CAAC;QACd,CAAC;QAED,2DAA2D;QAC3D,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACrB,OAAO,IAAI,CAAC;QACd,CAAC;QAED,0CAA0C;QAC1C,OAAO,KAAK,CAAC,IAAI,CACf,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,KAAK,mBAAmB,IAAI,GAAG,CAAC,IAAI,KAAK,UAAU,CACrE,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Post-Processor Configuration
|
|
3
|
+
*/
|
|
4
|
+
import { PostProcessorConfig } from "./types.js";
|
|
5
|
+
export declare const defaultConfig: PostProcessorConfig;
|
|
6
|
+
export declare function validateConfig(config: Partial<PostProcessorConfig>): PostProcessorConfig;
|
|
7
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/postprocessor/config.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEjD,eAAO,MAAM,aAAa,EAAE,mBAqD3B,CAAC;AAEF,wBAAgB,cAAc,CAC5B,MAAM,EAAE,OAAO,CAAC,mBAAmB,CAAC,GACnC,mBAAmB,CAoBrB"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Post-Processor Configuration
|
|
3
|
+
*/
|
|
4
|
+
export const defaultConfig = {
|
|
5
|
+
triggers: {
|
|
6
|
+
gitHooks: true,
|
|
7
|
+
webhooks: true,
|
|
8
|
+
api: false,
|
|
9
|
+
},
|
|
10
|
+
monitoring: {
|
|
11
|
+
enabled: true,
|
|
12
|
+
interval: 30000, // 30 seconds
|
|
13
|
+
timeout: 3600000, // 1 hour
|
|
14
|
+
},
|
|
15
|
+
autoFix: {
|
|
16
|
+
enabled: true,
|
|
17
|
+
confidenceThreshold: 0.8,
|
|
18
|
+
maxAttempts: 3,
|
|
19
|
+
},
|
|
20
|
+
maxAttempts: 3,
|
|
21
|
+
retryDelay: 30000, // 30 seconds
|
|
22
|
+
escalation: {
|
|
23
|
+
manualInterventionThreshold: 2,
|
|
24
|
+
rollbackThreshold: 3,
|
|
25
|
+
emergencyThreshold: 5,
|
|
26
|
+
},
|
|
27
|
+
redeploy: {
|
|
28
|
+
maxRetries: 3,
|
|
29
|
+
retryDelay: 30000,
|
|
30
|
+
backoffStrategy: "exponential",
|
|
31
|
+
canaryEnabled: true,
|
|
32
|
+
canaryPhases: 3,
|
|
33
|
+
canaryTrafficIncrement: 25,
|
|
34
|
+
healthCheckTimeout: 60000,
|
|
35
|
+
rollbackOnFailure: true,
|
|
36
|
+
},
|
|
37
|
+
success: {
|
|
38
|
+
successConfirmation: true,
|
|
39
|
+
cleanupEnabled: true,
|
|
40
|
+
notificationEnabled: true,
|
|
41
|
+
metricsCollection: true,
|
|
42
|
+
},
|
|
43
|
+
reporting: {
|
|
44
|
+
enabled: true,
|
|
45
|
+
autoGenerate: true,
|
|
46
|
+
reportThreshold: 50, // Auto-generate reports for complexity scores >= 50
|
|
47
|
+
reportDir: ".opencode/reports",
|
|
48
|
+
retentionDays: 30,
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
export function validateConfig(config) {
|
|
52
|
+
const merged = { ...defaultConfig, ...config };
|
|
53
|
+
// Validate ranges
|
|
54
|
+
if (merged.autoFix.confidenceThreshold < 0 ||
|
|
55
|
+
merged.autoFix.confidenceThreshold > 1) {
|
|
56
|
+
throw new Error("autoFix.confidenceThreshold must be between 0 and 1");
|
|
57
|
+
}
|
|
58
|
+
if (merged.monitoring.interval < 5000) {
|
|
59
|
+
throw new Error("monitoring.interval must be at least 5000ms");
|
|
60
|
+
}
|
|
61
|
+
if (merged.maxAttempts < 1 || merged.maxAttempts > 10) {
|
|
62
|
+
throw new Error("maxAttempts must be between 1 and 10");
|
|
63
|
+
}
|
|
64
|
+
return merged;
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/postprocessor/config.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,MAAM,CAAC,MAAM,aAAa,GAAwB;IAChD,QAAQ,EAAE;QACR,QAAQ,EAAE,IAAI;QACd,QAAQ,EAAE,IAAI;QACd,GAAG,EAAE,KAAK;KACX;IAED,UAAU,EAAE;QACV,OAAO,EAAE,IAAI;QACb,QAAQ,EAAE,KAAK,EAAE,aAAa;QAC9B,OAAO,EAAE,OAAO,EAAE,SAAS;KAC5B;IAED,OAAO,EAAE;QACP,OAAO,EAAE,IAAI;QACb,mBAAmB,EAAE,GAAG;QACxB,WAAW,EAAE,CAAC;KACf;IAED,WAAW,EAAE,CAAC;IACd,UAAU,EAAE,KAAK,EAAE,aAAa;IAEhC,UAAU,EAAE;QACV,2BAA2B,EAAE,CAAC;QAC9B,iBAAiB,EAAE,CAAC;QACpB,kBAAkB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processor
|
|
3
|
+
* Handles incident reporting, manual intervention triggers, and alerting
|
|
4
|
+
*/
|
|
5
|
+
import { PostProcessorContext, EscalationResult, IncidentReport } from "../types.js";
|
|
6
|
+
export interface EscalationConfig {
|
|
7
|
+
manualInterventionThreshold: number;
|
|
8
|
+
rollbackThreshold: number;
|
|
9
|
+
emergencyThreshold: number;
|
|
10
|
+
alertChannels: string[];
|
|
11
|
+
incidentReporting: boolean;
|
|
12
|
+
}
|
|
13
|
+
export interface AlertMessage {
|
|
14
|
+
level: "info" | "warning" | "error" | "critical";
|
|
15
|
+
title: string;
|
|
16
|
+
message: string;
|
|
17
|
+
context: PostProcessorContext;
|
|
18
|
+
metadata?: any;
|
|
19
|
+
}
|
|
20
|
+
export declare class EscalationEngine {
|
|
21
|
+
private config;
|
|
22
|
+
private incidents;
|
|
23
|
+
constructor(config?: Partial<EscalationConfig>);
|
|
24
|
+
/**
|
|
25
|
+
* Evaluate if escalation is needed based on failure context
|
|
26
|
+
*/
|
|
27
|
+
evaluateEscalation(context: PostProcessorContext, attempts: number, error: string, monitoringResults: any[]): Promise<EscalationResult | null>;
|
|
28
|
+
/**
|
|
29
|
+
* Create a detailed incident report
|
|
30
|
+
*/
|
|
31
|
+
private createIncidentReport;
|
|
32
|
+
/**
|
|
33
|
+
* Send alerts through configured channels
|
|
34
|
+
*/
|
|
35
|
+
private sendAlerts;
|
|
36
|
+
/**
|
|
37
|
+
* Send alert to specific channel
|
|
38
|
+
*/
|
|
39
|
+
private sendAlertToChannel;
|
|
40
|
+
/**
|
|
41
|
+
* Get emoji for alert level
|
|
42
|
+
*/
|
|
43
|
+
private getAlertEmoji;
|
|
44
|
+
/**
|
|
45
|
+
* Map escalation level to severity
|
|
46
|
+
*/
|
|
47
|
+
private mapLevelToSeverity;
|
|
48
|
+
/**
|
|
49
|
+
* Map escalation level to alert level
|
|
50
|
+
*/
|
|
51
|
+
private mapLevelToAlertLevel;
|
|
52
|
+
/**
|
|
53
|
+
* Get incident report by ID
|
|
54
|
+
*/
|
|
55
|
+
getIncidentReport(incidentId: string): IncidentReport | undefined;
|
|
56
|
+
/**
|
|
57
|
+
* Get all active incidents
|
|
58
|
+
*/
|
|
59
|
+
getActiveIncidents(): IncidentReport[];
|
|
60
|
+
/**
|
|
61
|
+
* Resolve an incident
|
|
62
|
+
*/
|
|
63
|
+
resolveIncident(incidentId: string, resolution: string): boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Get escalation statistics
|
|
66
|
+
*/
|
|
67
|
+
getStats(): {
|
|
68
|
+
totalIncidents: number;
|
|
69
|
+
activeIncidents: number;
|
|
70
|
+
escalationsByLevel: Record<string, number>;
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=EscalationEngine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EscalationEngine.d.ts","sourceRoot":"","sources":["../../../../src/postprocessor/escalation/EscalationEngine.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,oBAAoB,EACpB,gBAAgB,EAChB,cAAc,EAEf,MAAM,aAAa,CAAC;AAErB,MAAM,WAAW,gBAAgB;IAC/B,2BAA2B,EAAE,MAAM,CAAC;IACpC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,iBAAiB,EAAE,OAAO,CAAC;CAC5B;AAED,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,GAAG,UAAU,CAAC;IACjD,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,oBAAoB,CAAC;IAC9B,QAAQ,CAAC,EAAE,GAAG,CAAC;CAChB;AAED,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,MAAM,CAAmB;IACjC,OAAO,CAAC,SAAS,CAA0C;gBAE/C,MAAM,GAAE,OAAO,CAAC,gBAAgB,CAAM;IAWlD;;OAEG;IACG,kBAAkB,CACtB,OAAO,EAAE,oBAAoB,EAC7B,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,EACb,iBAAiB,EAAE,GAAG,EAAE,GACvB,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC;IA6DnC;;OAEG;YACW,oBAAoB;IAwDlC;;OAEG;YACW,UAAU;IAuBxB;;OAEG;YACW,kBAAkB;IA4BhC;;OAEG;IACH,OAAO,CAAC,aAAa;IAerB;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAa1B;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAe5B;;OAEG;IACH,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS;IAIjE;;OAEG;IACH,kBAAkB,IAAI,cAAc,EAAE;IAMtC;;OAEG;IACH,eAAe,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO;IAehE;;OAEG;IACH,QAAQ,IAAI;QACV,cAAc,EAAE,MAAM,CAAC;QACvB,eAAe,EAAE,MAAM,CAAC;QACxB,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KAC5C;CAiBF"}
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Escalation Engine for Post-Processor
|
|
3
|
+
* Handles incident reporting, manual intervention triggers, and alerting
|
|
4
|
+
*/
|
|
5
|
+
export class EscalationEngine {
|
|
6
|
+
config;
|
|
7
|
+
incidents = new Map();
|
|
8
|
+
constructor(config = {}) {
|
|
9
|
+
this.config = {
|
|
10
|
+
manualInterventionThreshold: 2,
|
|
11
|
+
rollbackThreshold: 3,
|
|
12
|
+
emergencyThreshold: 5,
|
|
13
|
+
alertChannels: ["console", "log"],
|
|
14
|
+
incidentReporting: true,
|
|
15
|
+
...config,
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Evaluate if escalation is needed based on failure context
|
|
20
|
+
*/
|
|
21
|
+
async evaluateEscalation(context, attempts, error, monitoringResults) {
|
|
22
|
+
console.log(`đ Evaluating escalation: ${attempts} attempts, error: ${error}`);
|
|
23
|
+
let escalationLevel;
|
|
24
|
+
let reason;
|
|
25
|
+
let recommendations;
|
|
26
|
+
if (attempts >= this.config.emergencyThreshold) {
|
|
27
|
+
escalationLevel = "emergency";
|
|
28
|
+
reason = `Emergency threshold exceeded (${attempts}/${this.config.emergencyThreshold} attempts)`;
|
|
29
|
+
recommendations = [
|
|
30
|
+
"Immediate manual intervention required",
|
|
31
|
+
"Consider rolling back to previous stable version",
|
|
32
|
+
"Escalate to senior engineering team",
|
|
33
|
+
"Review deployment pipeline for systemic issues",
|
|
34
|
+
];
|
|
35
|
+
}
|
|
36
|
+
else if (attempts >= this.config.rollbackThreshold) {
|
|
37
|
+
escalationLevel = "rollback";
|
|
38
|
+
reason = `Rollback threshold exceeded (${attempts}/${this.config.rollbackThreshold} attempts)`;
|
|
39
|
+
recommendations = [
|
|
40
|
+
"Automatic rollback initiated",
|
|
41
|
+
"Review fix validation logic",
|
|
42
|
+
"Check for environmental issues",
|
|
43
|
+
"Monitor system stability post-rollback",
|
|
44
|
+
];
|
|
45
|
+
}
|
|
46
|
+
else if (attempts >= this.config.manualInterventionThreshold) {
|
|
47
|
+
escalationLevel = "manual-intervention";
|
|
48
|
+
reason = `Manual intervention threshold exceeded (${attempts}/${this.config.manualInterventionThreshold} attempts)`;
|
|
49
|
+
recommendations = [
|
|
50
|
+
"Human review of failure analysis required",
|
|
51
|
+
"Verify auto-fix confidence scores",
|
|
52
|
+
"Check deployment environment health",
|
|
53
|
+
"Consider temporary deployment pause",
|
|
54
|
+
];
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
// No escalation needed
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
const incidentReport = await this.createIncidentReport(context, escalationLevel, reason, error, attempts, monitoringResults);
|
|
61
|
+
// Send alerts
|
|
62
|
+
await this.sendAlerts(escalationLevel, context, reason, recommendations);
|
|
63
|
+
return {
|
|
64
|
+
level: escalationLevel,
|
|
65
|
+
reason,
|
|
66
|
+
recommendations,
|
|
67
|
+
incidentReport,
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Create a detailed incident report
|
|
72
|
+
*/
|
|
73
|
+
async createIncidentReport(context, level, reason, error, attempts, monitoringResults) {
|
|
74
|
+
const incidentId = `incident-${context.commitSha}-${Date.now()}`;
|
|
75
|
+
const timeline = [
|
|
76
|
+
{
|
|
77
|
+
timestamp: new Date(),
|
|
78
|
+
event: "Incident Created",
|
|
79
|
+
details: `Post-processor escalation triggered: ${reason}`,
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
timestamp: new Date(Date.now() - attempts * 60000), // Estimate start time
|
|
83
|
+
event: "Post-Processor Started",
|
|
84
|
+
details: `Started monitoring commit ${context.commitSha}`,
|
|
85
|
+
},
|
|
86
|
+
];
|
|
87
|
+
// Add monitoring results to timeline
|
|
88
|
+
monitoringResults.forEach((result, index) => {
|
|
89
|
+
timeline.push({
|
|
90
|
+
timestamp: new Date(result.timestamp),
|
|
91
|
+
event: `Monitoring Attempt ${index + 1}`,
|
|
92
|
+
details: `Status: ${result.overallStatus}, Duration: ${result.duration}ms`,
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
const incidentReport = {
|
|
96
|
+
id: incidentId,
|
|
97
|
+
commitSha: context.commitSha,
|
|
98
|
+
timestamp: new Date(),
|
|
99
|
+
severity: this.mapLevelToSeverity(level),
|
|
100
|
+
affectedSystems: ["ci-cd-pipeline", "deployment-system"],
|
|
101
|
+
rootCause: error,
|
|
102
|
+
impact: `CI/CD pipeline failures preventing deployment of commit ${context.commitSha}`,
|
|
103
|
+
resolution: "Pending manual intervention",
|
|
104
|
+
timeline,
|
|
105
|
+
};
|
|
106
|
+
this.incidents.set(incidentId, incidentReport);
|
|
107
|
+
if (this.config.incidentReporting) {
|
|
108
|
+
console.log(`đ Incident Report Created: ${incidentId}`);
|
|
109
|
+
console.log(` Severity: ${incidentReport.severity}`);
|
|
110
|
+
console.log(` Root Cause: ${incidentReport.rootCause}`);
|
|
111
|
+
console.log(` Impact: ${incidentReport.impact}`);
|
|
112
|
+
}
|
|
113
|
+
return incidentReport;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Send alerts through configured channels
|
|
117
|
+
*/
|
|
118
|
+
async sendAlerts(level, context, reason, recommendations) {
|
|
119
|
+
const alertMessage = {
|
|
120
|
+
level: this.mapLevelToAlertLevel(level),
|
|
121
|
+
title: `CI/CD Escalation: ${level.toUpperCase()}`,
|
|
122
|
+
message: `Post-processor escalation triggered for commit ${context.commitSha}`,
|
|
123
|
+
context,
|
|
124
|
+
metadata: {
|
|
125
|
+
reason,
|
|
126
|
+
recommendations,
|
|
127
|
+
timestamp: new Date().toISOString(),
|
|
128
|
+
},
|
|
129
|
+
};
|
|
130
|
+
for (const channel of this.config.alertChannels) {
|
|
131
|
+
await this.sendAlertToChannel(channel, alertMessage);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Send alert to specific channel
|
|
136
|
+
*/
|
|
137
|
+
async sendAlertToChannel(channel, alert) {
|
|
138
|
+
const emoji = this.getAlertEmoji(alert.level);
|
|
139
|
+
switch (channel) {
|
|
140
|
+
case "console":
|
|
141
|
+
console.log(`${emoji} ${alert.title}`);
|
|
142
|
+
console.log(` Commit: ${alert.context.commitSha}`);
|
|
143
|
+
console.log(` Message: ${alert.message}`);
|
|
144
|
+
if (alert.metadata?.reason) {
|
|
145
|
+
console.log(` Reason: ${alert.metadata.reason}`);
|
|
146
|
+
}
|
|
147
|
+
break;
|
|
148
|
+
case "log":
|
|
149
|
+
// In a real system, this would write to a logging service
|
|
150
|
+
console.log(`[ALERT-${alert.level.toUpperCase()}] ${JSON.stringify(alert)}`);
|
|
151
|
+
break;
|
|
152
|
+
default:
|
|
153
|
+
console.warn(`Unknown alert channel: ${channel}`);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Get emoji for alert level
|
|
158
|
+
*/
|
|
159
|
+
getAlertEmoji(level) {
|
|
160
|
+
switch (level) {
|
|
161
|
+
case "critical":
|
|
162
|
+
return "đ¨";
|
|
163
|
+
case "error":
|
|
164
|
+
return "â";
|
|
165
|
+
case "warning":
|
|
166
|
+
return "â ī¸";
|
|
167
|
+
case "info":
|
|
168
|
+
return "âšī¸";
|
|
169
|
+
default:
|
|
170
|
+
return "đĸ";
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Map escalation level to severity
|
|
175
|
+
*/
|
|
176
|
+
mapLevelToSeverity(level) {
|
|
177
|
+
switch (level) {
|
|
178
|
+
case "emergency":
|
|
179
|
+
return "critical";
|
|
180
|
+
case "rollback":
|
|
181
|
+
return "high";
|
|
182
|
+
case "manual-intervention":
|
|
183
|
+
return "medium";
|
|
184
|
+
default:
|
|
185
|
+
return "low";
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Map escalation level to alert level
|
|
190
|
+
*/
|
|
191
|
+
mapLevelToAlertLevel(level) {
|
|
192
|
+
switch (level) {
|
|
193
|
+
case "emergency":
|
|
194
|
+
return "critical";
|
|
195
|
+
case "rollback":
|
|
196
|
+
return "error";
|
|
197
|
+
case "manual-intervention":
|
|
198
|
+
return "warning";
|
|
199
|
+
default:
|
|
200
|
+
return "info";
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Get incident report by ID
|
|
205
|
+
*/
|
|
206
|
+
getIncidentReport(incidentId) {
|
|
207
|
+
return this.incidents.get(incidentId);
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Get all active incidents
|
|
211
|
+
*/
|
|
212
|
+
getActiveIncidents() {
|
|
213
|
+
return Array.from(this.incidents.values()).filter((incident) => incident.resolution === "Pending manual intervention");
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Resolve an incident
|
|
217
|
+
*/
|
|
218
|
+
resolveIncident(incidentId, resolution) {
|
|
219
|
+
const incident = this.incidents.get(incidentId);
|
|
220
|
+
if (incident) {
|
|
221
|
+
incident.resolution = resolution;
|
|
222
|
+
incident.timeline.push({
|
|
223
|
+
timestamp: new Date(),
|
|
224
|
+
event: "Incident Resolved",
|
|
225
|
+
details: resolution,
|
|
226
|
+
});
|
|
227
|
+
console.log(`â
Incident ${incidentId} resolved: ${resolution}`);
|
|
228
|
+
return true;
|
|
229
|
+
}
|
|
230
|
+
return false;
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Get escalation statistics
|
|
234
|
+
*/
|
|
235
|
+
getStats() {
|
|
236
|
+
const incidents = Array.from(this.incidents.values());
|
|
237
|
+
const escalationsByLevel = {};
|
|
238
|
+
incidents.forEach((incident) => {
|
|
239
|
+
const level = incident.severity;
|
|
240
|
+
escalationsByLevel[level] = (escalationsByLevel[level] || 0) + 1;
|
|
241
|
+
});
|
|
242
|
+
return {
|
|
243
|
+
totalIncidents: incidents.length,
|
|
244
|
+
activeIncidents: incidents.filter((i) => i.resolution === "Pending manual intervention").length,
|
|
245
|
+
escalationsByLevel,
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
//# sourceMappingURL=EscalationEngine.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EscalationEngine.js","sourceRoot":"","sources":["../../../../src/postprocessor/escalation/EscalationEngine.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAyBH,MAAM,OAAO,gBAAgB;IACnB,MAAM,CAAmB;IACzB,SAAS,GAAgC,IAAI,GAAG,EAAE,CAAC;IAE3D,YAAY,SAAoC,EAAE;QAChD,IAAI,CAAC,MAAM,GAAG;YACZ,2BAA2B,EAAE,CAAC;YAC9B,iBAAiB,EAAE,C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AC,IAAI,CAAC;gBACrB,SAAS,EAAE,IAAI,IAAI,EAAE;gBACrB,KAAK,EAAE,mBAAmB;gBAC1B,OAAO,EAAE,UAAU;aACpB,CAAC,CAAC;YACH,OAAO,CAAC,GAAG,CAAC,cAAc,UAAU,cAAc,UAAU,EAAE,CAAC,CAAC;YAChE,OAAO,IAAI,CAAC;QACd,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;OAEG;IACH,QAAQ;QAKN,MAAM,SAAS,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,CAAC,CAAC;QACtD,MAAM,kBAAkB,GAA2B,EAAE,CAAC;QAEtD,SAAS,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE;YAC7B,MAAM,KAAK,GAAG,QAAQ,CAAC,QAAQ,CAAC;YAChC,kBAAkB,CAAC,KAAK,CAAC,GAAG,CAAC,kBAAkB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;QACnE,CAAC,CAAC,CAAC;QAEH,OAAO;YACL,cAAc,EAAE,SAAS,CAAC,MAAM;YAChC,eAAe,EAAE,SAAS,CAAC,MAAM,CAC/B,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,KAAK,6BAA6B,CACtD,CAAC,MAAM;YACR,kBAAkB;SACnB,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Post-Processor Monitoring Engine
|
|
3
|
+
*/
|
|
4
|
+
import { StringRayStateManager } from "../../state/state-manager.js";
|
|
5
|
+
import { SessionMonitor } from "../../session/session-monitor.js";
|
|
6
|
+
import { MonitoringResult } from "../types.js";
|
|
7
|
+
export declare class PostProcessorMonitoringEngine {
|
|
8
|
+
private stateManager;
|
|
9
|
+
private sessionMonitor?;
|
|
10
|
+
constructor(stateManager: StringRayStateManager, sessionMonitor?: SessionMonitor | undefined);
|
|
11
|
+
initialize(): Promise<void>;
|
|
12
|
+
monitorDeployment(commitSha: string): Promise<MonitoringResult>;
|
|
13
|
+
private checkCIStatus;
|
|
14
|
+
private checkPerformanceStatus;
|
|
15
|
+
private checkSecurityStatus;
|
|
16
|
+
private determineOverallStatus;
|
|
17
|
+
getStatus(): Promise<any>;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=MonitoringEngine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MonitoringEngine.d.ts","sourceRoot":"","sources":["../../../../src/postprocessor/monitoring/MonitoringEngine.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,qBAAa,6BAA6B;IAEtC,OAAO,CAAC,YAAY;IACpB,OAAO,CAAC,cAAc,CAAC;gBADf,YAAY,EAAE,qBAAqB,EACnC,cAAc,CAAC,EAAE,cAAc,YAAA;IAGnC,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAK3B,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC;YA8BvD,aAAa;YAgCb,sBAAsB;YAkBtB,mBAAmB;IAsBjC,OAAO,CAAC,sBAAsB;IAcxB,SAAS,IAAI,OAAO,CAAC,GAAG,CAAC;CAOhC"}
|