stringray-ai 1.0.38 → 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.
Files changed (113) hide show
  1. package/dist/plugin/architectural-integrity.d.ts +21 -0
  2. package/dist/plugin/architectural-integrity.d.ts.map +1 -0
  3. package/dist/plugin/architectural-integrity.js +81 -0
  4. package/dist/plugin/architectural-integrity.js.map +1 -0
  5. package/dist/plugin/boot-orchestrator.d.ts +100 -0
  6. package/dist/plugin/boot-orchestrator.d.ts.map +1 -0
  7. package/dist/plugin/boot-orchestrator.js +606 -0
  8. package/dist/plugin/boot-orchestrator.js.map +1 -0
  9. package/dist/plugin/codex-injector.d.ts +72 -0
  10. package/dist/plugin/codex-injector.d.ts.map +1 -0
  11. package/dist/plugin/codex-injector.js +387 -0
  12. package/dist/plugin/codex-injector.js.map +1 -0
  13. package/dist/plugin/delegation/index.d.ts +16 -0
  14. package/dist/plugin/delegation/index.d.ts.map +1 -0
  15. package/dist/plugin/delegation/index.js +13 -0
  16. package/dist/plugin/delegation/index.js.map +1 -0
  17. package/dist/plugin/delegation/session-coordinator.d.ts +121 -0
  18. package/dist/plugin/delegation/session-coordinator.d.ts.map +1 -0
  19. package/dist/plugin/delegation/session-coordinator.js +346 -0
  20. package/dist/plugin/delegation/session-coordinator.js.map +1 -0
  21. package/dist/plugin/index.d.ts +3 -0
  22. package/dist/plugin/index.d.ts.map +1 -0
  23. package/dist/plugin/index.js +3 -0
  24. package/dist/plugin/index.js.map +1 -0
  25. package/dist/plugin/monitoring/memory-monitor.d.ts +113 -0
  26. package/dist/plugin/monitoring/memory-monitor.d.ts.map +1 -0
  27. package/dist/plugin/monitoring/memory-monitor.js +283 -0
  28. package/dist/plugin/monitoring/memory-monitor.js.map +1 -0
  29. package/dist/plugin/postprocessor/PostProcessor.d.ts +90 -0
  30. package/dist/plugin/postprocessor/PostProcessor.d.ts.map +1 -0
  31. package/dist/plugin/postprocessor/PostProcessor.js +631 -0
  32. package/dist/plugin/postprocessor/PostProcessor.js.map +1 -0
  33. package/dist/plugin/postprocessor/analysis/FailureAnalysisEngine.d.ts +40 -0
  34. package/dist/plugin/postprocessor/analysis/FailureAnalysisEngine.d.ts.map +1 -0
  35. package/dist/plugin/postprocessor/analysis/FailureAnalysisEngine.js +244 -0
  36. package/dist/plugin/postprocessor/analysis/FailureAnalysisEngine.js.map +1 -0
  37. package/dist/plugin/postprocessor/autofix/AutoFixEngine.d.ts +50 -0
  38. package/dist/plugin/postprocessor/autofix/AutoFixEngine.d.ts.map +1 -0
  39. package/dist/plugin/postprocessor/autofix/AutoFixEngine.js +246 -0
  40. package/dist/plugin/postprocessor/autofix/AutoFixEngine.js.map +1 -0
  41. package/dist/plugin/postprocessor/autofix/FixValidator.d.ts +27 -0
  42. package/dist/plugin/postprocessor/autofix/FixValidator.d.ts.map +1 -0
  43. package/dist/plugin/postprocessor/autofix/FixValidator.js +158 -0
  44. package/dist/plugin/postprocessor/autofix/FixValidator.js.map +1 -0
  45. package/dist/plugin/postprocessor/config.d.ts +7 -0
  46. package/dist/plugin/postprocessor/config.d.ts.map +1 -0
  47. package/dist/plugin/postprocessor/config.js +66 -0
  48. package/dist/plugin/postprocessor/config.js.map +1 -0
  49. package/dist/plugin/postprocessor/escalation/EscalationEngine.d.ts +73 -0
  50. package/dist/plugin/postprocessor/escalation/EscalationEngine.d.ts.map +1 -0
  51. package/dist/plugin/postprocessor/escalation/EscalationEngine.js +249 -0
  52. package/dist/plugin/postprocessor/escalation/EscalationEngine.js.map +1 -0
  53. package/dist/plugin/postprocessor/monitoring/MonitoringEngine.d.ts +19 -0
  54. package/dist/plugin/postprocessor/monitoring/MonitoringEngine.d.ts.map +1 -0
  55. package/dist/plugin/postprocessor/monitoring/MonitoringEngine.js +120 -0
  56. package/dist/plugin/postprocessor/monitoring/MonitoringEngine.js.map +1 -0
  57. package/dist/plugin/postprocessor/redeploy/RedeployCoordinator.d.ts +92 -0
  58. package/dist/plugin/postprocessor/redeploy/RedeployCoordinator.d.ts.map +1 -0
  59. package/dist/plugin/postprocessor/redeploy/RedeployCoordinator.js +319 -0
  60. package/dist/plugin/postprocessor/redeploy/RedeployCoordinator.js.map +1 -0
  61. package/dist/plugin/postprocessor/success/SuccessHandler.d.ts +61 -0
  62. package/dist/plugin/postprocessor/success/SuccessHandler.d.ts.map +1 -0
  63. package/dist/plugin/postprocessor/success/SuccessHandler.js +148 -0
  64. package/dist/plugin/postprocessor/success/SuccessHandler.js.map +1 -0
  65. package/dist/plugin/postprocessor/triggers/APITrigger.d.ts +13 -0
  66. package/dist/plugin/postprocessor/triggers/APITrigger.d.ts.map +1 -0
  67. package/dist/plugin/postprocessor/triggers/APITrigger.js +20 -0
  68. package/dist/plugin/postprocessor/triggers/APITrigger.js.map +1 -0
  69. package/dist/plugin/postprocessor/triggers/GitHookTrigger.d.ts +17 -0
  70. package/dist/plugin/postprocessor/triggers/GitHookTrigger.d.ts.map +1 -0
  71. package/dist/plugin/postprocessor/triggers/GitHookTrigger.js +285 -0
  72. package/dist/plugin/postprocessor/triggers/GitHookTrigger.js.map +1 -0
  73. package/dist/plugin/postprocessor/triggers/WebhookTrigger.d.ts +13 -0
  74. package/dist/plugin/postprocessor/triggers/WebhookTrigger.d.ts.map +1 -0
  75. package/dist/plugin/postprocessor/triggers/WebhookTrigger.js +21 -0
  76. package/dist/plugin/postprocessor/triggers/WebhookTrigger.js.map +1 -0
  77. package/dist/plugin/postprocessor/types.d.ts +198 -0
  78. package/dist/plugin/postprocessor/types.d.ts.map +1 -0
  79. package/dist/plugin/postprocessor/types.js +5 -0
  80. package/dist/plugin/postprocessor/types.js.map +1 -0
  81. package/dist/plugin/security/security-auditor.d.ts +57 -0
  82. package/dist/plugin/security/security-auditor.d.ts.map +1 -0
  83. package/dist/plugin/security/security-auditor.js +583 -0
  84. package/dist/plugin/security/security-auditor.js.map +1 -0
  85. package/dist/plugin/security/security-hardener.d.ts +63 -0
  86. package/dist/plugin/security/security-hardener.d.ts.map +1 -0
  87. package/dist/plugin/security/security-hardener.js +181 -0
  88. package/dist/plugin/security/security-hardener.js.map +1 -0
  89. package/dist/plugin/security/security-headers.d.ts +52 -0
  90. package/dist/plugin/security/security-headers.d.ts.map +1 -0
  91. package/dist/plugin/security/security-headers.js +118 -0
  92. package/dist/plugin/security/security-headers.js.map +1 -0
  93. package/dist/plugin/session/session-cleanup-manager.d.ts +118 -0
  94. package/dist/plugin/session/session-cleanup-manager.d.ts.map +1 -0
  95. package/dist/plugin/session/session-cleanup-manager.js +324 -0
  96. package/dist/plugin/session/session-cleanup-manager.js.map +1 -0
  97. package/dist/plugin/session/session-monitor.d.ts +99 -0
  98. package/dist/plugin/session/session-monitor.d.ts.map +1 -0
  99. package/dist/plugin/session/session-monitor.js +363 -0
  100. package/dist/plugin/session/session-monitor.js.map +1 -0
  101. package/dist/plugin/session/session-state-manager.d.ts +142 -0
  102. package/dist/plugin/session/session-state-manager.d.ts.map +1 -0
  103. package/dist/plugin/session/session-state-manager.js +504 -0
  104. package/dist/plugin/session/session-state-manager.js.map +1 -0
  105. package/dist/plugin/strray-activation.d.ts +18 -0
  106. package/dist/plugin/strray-activation.d.ts.map +1 -0
  107. package/dist/plugin/strray-activation.js +114 -0
  108. package/dist/plugin/strray-activation.js.map +1 -0
  109. package/dist/plugin/validation/report-content-validator.d.ts +43 -0
  110. package/dist/plugin/validation/report-content-validator.d.ts.map +1 -0
  111. package/dist/plugin/validation/report-content-validator.js +219 -0
  112. package/dist/plugin/validation/report-content-validator.js.map +1 -0
  113. package/package.json +1 -1
@@ -0,0 +1,283 @@
1
+ import { EventEmitter } from "events";
2
+ export class MemoryMonitor extends EventEmitter {
3
+ config;
4
+ monitoringInterval = null;
5
+ statsHistory = [];
6
+ maxHistorySize = 1000;
7
+ leakDetectionEnabled = true;
8
+ lastLeakCheck = Date.now();
9
+ leakCheckInterval = 5 * 60 * 1000;
10
+ constructor(config = {}) {
11
+ super();
12
+ this.config = {
13
+ checkInterval: 30000,
14
+ alertThresholds: {
15
+ warning: 200,
16
+ critical: 400,
17
+ leakDetection: {
18
+ growthRate: 10,
19
+ sustainedPeriod: 10,
20
+ },
21
+ },
22
+ enableFrameworkLogging: true,
23
+ sessionTracking: true,
24
+ ...config,
25
+ };
26
+ }
27
+ /**
28
+ * Start memory monitoring
29
+ */
30
+ start() {
31
+ this.log("🔍 Starting Memory Monitor...");
32
+ this.monitoringInterval = setInterval(() => {
33
+ this.checkMemory();
34
+ }, this.config.checkInterval);
35
+ this.checkMemory();
36
+ }
37
+ /**
38
+ * Stop memory monitoring
39
+ */
40
+ stop() {
41
+ if (this.monitoringInterval) {
42
+ clearInterval(this.monitoringInterval);
43
+ }
44
+ this.monitoringInterval = null;
45
+ this.log("🛑 Memory Monitor stopped");
46
+ }
47
+ /**
48
+ * Get current memory statistics
49
+ */
50
+ getCurrentStats() {
51
+ const memUsage = process.memoryUsage();
52
+ return {
53
+ heapUsed: Math.round((memUsage.heapUsed / 1024 / 1024) * 100) / 100,
54
+ heapTotal: Math.round((memUsage.heapTotal / 1024 / 1024) * 100) / 100,
55
+ external: Math.round((memUsage.external / 1024 / 1024) * 100) / 100,
56
+ rss: Math.round((memUsage.rss / 1024 / 1024) * 100) / 100,
57
+ timestamp: Date.now(),
58
+ };
59
+ }
60
+ /**
61
+ * Check memory usage and detect issues
62
+ */
63
+ checkMemory() {
64
+ const stats = this.getCurrentStats();
65
+ this.statsHistory.push(stats);
66
+ if (this.statsHistory.length > this.maxHistorySize) {
67
+ this.statsHistory.shift();
68
+ }
69
+ this.checkThresholds(stats);
70
+ if (this.leakDetectionEnabled &&
71
+ Date.now() - this.lastLeakCheck > this.leakCheckInterval) {
72
+ this.detectMemoryLeaks();
73
+ this.lastLeakCheck = Date.now();
74
+ }
75
+ if (this.config.enableFrameworkLogging) {
76
+ this.logFrameworkMemory(stats);
77
+ }
78
+ }
79
+ /**
80
+ * Check memory usage against thresholds
81
+ */
82
+ checkThresholds(stats) {
83
+ const heapMB = stats.heapUsed;
84
+ if (heapMB >= this.config.alertThresholds.critical) {
85
+ this.emitAlert({
86
+ type: "high_usage",
87
+ severity: "critical",
88
+ message: `Critical memory usage: ${heapMB.toFixed(2)}MB (threshold: ${this.config.alertThresholds.critical}MB)`,
89
+ details: {
90
+ currentUsage: heapMB,
91
+ threshold: this.config.alertThresholds.critical,
92
+ trend: this.calculateTrend(),
93
+ recommendations: [
94
+ "Force garbage collection if available",
95
+ "Check for memory leaks in caches and event listeners",
96
+ "Consider reducing concurrent operations",
97
+ "Monitor large data structures (Maps, Sets, Arrays)",
98
+ ],
99
+ },
100
+ });
101
+ }
102
+ else if (heapMB >= this.config.alertThresholds.warning) {
103
+ this.emitAlert({
104
+ type: "high_usage",
105
+ severity: "high",
106
+ message: `High memory usage: ${heapMB.toFixed(2)}MB (threshold: ${this.config.alertThresholds.warning}MB)`,
107
+ details: {
108
+ currentUsage: heapMB,
109
+ threshold: this.config.alertThresholds.warning,
110
+ trend: this.calculateTrend(),
111
+ recommendations: [
112
+ "Monitor memory growth rate",
113
+ "Check for inefficient algorithms",
114
+ "Consider memory optimization techniques",
115
+ ],
116
+ },
117
+ });
118
+ }
119
+ }
120
+ /**
121
+ * Detect potential memory leaks
122
+ */
123
+ detectMemoryLeaks() {
124
+ if (this.statsHistory.length < 10)
125
+ return;
126
+ const recentStats = this.statsHistory.slice(-20);
127
+ if (recentStats.length < 2)
128
+ return;
129
+ const timeSpan = recentStats[recentStats.length - 1].timestamp -
130
+ recentStats[0].timestamp;
131
+ const timeSpanMinutes = timeSpan / (1000 * 60);
132
+ if (timeSpanMinutes < 1)
133
+ return;
134
+ const startUsage = recentStats[0].heapUsed;
135
+ const endUsage = recentStats[recentStats.length - 1].heapUsed;
136
+ const growthRate = (endUsage - startUsage) / timeSpanMinutes;
137
+ if (growthRate > this.config.alertThresholds.leakDetection.growthRate) {
138
+ const sustainedPeriod = this.config.alertThresholds.leakDetection.sustainedPeriod;
139
+ if (timeSpanMinutes >= sustainedPeriod) {
140
+ this.emitAlert({
141
+ type: "leak_detected",
142
+ severity: "medium",
143
+ message: `Potential memory leak detected: ${growthRate.toFixed(2)}MB/min growth rate over ${timeSpanMinutes.toFixed(1)} minutes`,
144
+ details: {
145
+ currentUsage: endUsage,
146
+ threshold: this.config.alertThresholds.leakDetection.growthRate,
147
+ trend: "increasing",
148
+ recommendations: [
149
+ "Check for uncleansed event listeners",
150
+ "Review timer/interval cleanup",
151
+ "Inspect cache growth in Map/Set structures",
152
+ "Monitor object retention in closures",
153
+ "Consider memory profiling tools",
154
+ ],
155
+ },
156
+ });
157
+ }
158
+ }
159
+ }
160
+ /**
161
+ * Calculate memory usage trend
162
+ */
163
+ calculateTrend() {
164
+ if (this.statsHistory.length < 5)
165
+ return "stable";
166
+ const recent = this.statsHistory.slice(-5);
167
+ const older = this.statsHistory.slice(-10, -5);
168
+ const recentAvg = recent.reduce((sum, s) => sum + s.heapUsed, 0) / recent.length;
169
+ const olderAvg = older.reduce((sum, s) => sum + s.heapUsed, 0) / older.length;
170
+ const diff = recentAvg - olderAvg;
171
+ const threshold = 5;
172
+ if (diff > threshold)
173
+ return "increasing";
174
+ if (diff < -threshold)
175
+ return "decreasing";
176
+ return "stable";
177
+ }
178
+ /**
179
+ * Emit memory alert
180
+ */
181
+ emitAlert(alert) {
182
+ this.emit("alert", alert);
183
+ const severityEmoji = {
184
+ low: "ℹ️",
185
+ medium: "⚠️",
186
+ high: "🔴",
187
+ critical: "🚨",
188
+ };
189
+ this.log(`${severityEmoji[alert.severity]} MEMORY ALERT: ${alert.message}`);
190
+ alert.details.recommendations.forEach((rec) => {
191
+ this.log(` 💡 ${rec}`);
192
+ });
193
+ }
194
+ /**
195
+ * Log memory stats to framework log
196
+ */
197
+ logFrameworkMemory(stats) {
198
+ const logEntry = `🧠 Memory: ${stats.heapUsed.toFixed(1)}MB heap, ${stats.heapTotal.toFixed(1)}MB total, ${stats.external.toFixed(1)}MB external, ${stats.rss.toFixed(1)}MB RSS`;
199
+ this.log(logEntry);
200
+ }
201
+ /**
202
+ * Get memory usage history
203
+ */
204
+ getHistory(hours = 1) {
205
+ const cutoff = Date.now() - hours * 60 * 60 * 1000;
206
+ return this.statsHistory.filter((stat) => stat.timestamp >= cutoff);
207
+ }
208
+ /**
209
+ * Get memory usage summary
210
+ */
211
+ getSummary() {
212
+ const current = this.getCurrentStats();
213
+ const peak = this.statsHistory.reduce((max, stat) => (stat.heapUsed > max.heapUsed ? stat : max), this.statsHistory[0] || current);
214
+ const average = this.statsHistory.length > 0
215
+ ? this.statsHistory.reduce((sum, stat) => sum + stat.heapUsed, 0) /
216
+ this.statsHistory.length
217
+ : current.heapUsed;
218
+ return {
219
+ current,
220
+ peak,
221
+ average: Math.round(average * 100) / 100,
222
+ trend: this.calculateTrend(),
223
+ };
224
+ }
225
+ /**
226
+ * Force garbage collection (if available)
227
+ */
228
+ forceGC() {
229
+ if (global.gc) {
230
+ const before = this.getCurrentStats().heapUsed;
231
+ global.gc();
232
+ const after = this.getCurrentStats().heapUsed;
233
+ const freed = before - after;
234
+ this.log(`🗑️ GC: Freed ${freed.toFixed(2)}MB (${before.toFixed(2)}MB → ${after.toFixed(2)}MB)`);
235
+ return true;
236
+ }
237
+ return false;
238
+ }
239
+ /**
240
+ * Internal logging method - writes to framework log only
241
+ */
242
+ log(message) {
243
+ // Write to framework activity log instead of console
244
+ try {
245
+ const fs = require("fs");
246
+ const logDir = "./.opencode/logs";
247
+ const logFile = `${logDir}/memory-monitor-${new Date().toISOString().split("T")[0]}.log`;
248
+ if (!fs.existsSync(logDir)) {
249
+ fs.mkdirSync(logDir, { recursive: true });
250
+ }
251
+ const logEntry = `[${new Date().toISOString()}] ${message}\n`;
252
+ fs.appendFileSync(logFile, logEntry);
253
+ }
254
+ catch (error) {
255
+ // Silent fail - don't spam console with logging errors
256
+ }
257
+ }
258
+ }
259
+ // Export singleton instance
260
+ export const memoryMonitor = new MemoryMonitor();
261
+ // Helper functions
262
+ export function getMemoryUsage() {
263
+ return memoryMonitor.getCurrentStats();
264
+ }
265
+ export function logMemoryUsage() {
266
+ const stats = getMemoryUsage();
267
+ console.log(`🧠 Memory Usage: ${stats.heapUsed}MB heap, ${stats.heapTotal}MB total, ${stats.external}MB external`);
268
+ }
269
+ export function checkMemoryHealth() {
270
+ const summary = memoryMonitor.getSummary();
271
+ const issues = [];
272
+ if (summary.current.heapUsed > 300) {
273
+ issues.push(`High heap usage: ${summary.current.heapUsed}MB`);
274
+ }
275
+ if (summary.trend === "increasing") {
276
+ issues.push("Memory usage trending upward");
277
+ }
278
+ return {
279
+ healthy: issues.length === 0,
280
+ issues,
281
+ };
282
+ }
283
+ //# sourceMappingURL=memory-monitor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memory-monitor.js","sourceRoot":"","sources":["../../../src/monitoring/memory-monitor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAiDtC,MAAM,OAAO,aAAc,SAAQ,YAAY;IACrC,MAAM,CAAsB;IAC5B,kBAAkB,GAA0B,IAAI,CAAC;IACjD,YAAY,GAAkB,EAAE,CAAC;IACjC,cAAc,GAAG,IAAI,CAAC;IACtB,oBAAoB,GAAG,IAAI,CAAC;IAC5B,aAAa,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IAC3B,iBAAiB,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;IAE1C,YAAY,SAAuC,EAAE;QACnD,KAAK,EAAE,CAAC;QAER,IAAI,CAAC,MAAM,GAAG;YACZ,aAAa,EAAE,KAAK;YACpB,eAAe,EAAE;gBACf,OAAO,EAAE,GAAG;gBACZ,QAAQ,EAAE,GAAG;gBACb,aAAa,EAAE;oBACb,UAAU,EAAE,EAAE;oBACd,eAAe,EAAE,EAAE;iBACpB;aACF;YACD,sBAAsB,EAAE,IAAI;YAC5B,eAAe,EAAE,IAAI;YACrB,GAAG,MAAM;SACV,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,KAAK;QACH,IAAI,CAA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,EAAE,CAAC;AAEjD,mBAAmB;AACnB,MAAM,UAAU,cAAc;IAC5B,OAAO,aAAa,CAAC,eAAe,EAAE,CAAC;AACzC,CAAC;AAED,MAAM,UAAU,cAAc;IAC5B,MAAM,KAAK,GAAG,cAAc,EAAE,CAAC;IAC/B,OAAO,CAAC,GAAG,CACT,oBAAoB,KAAK,CAAC,QAAQ,YAAY,KAAK,CAAC,SAAS,aAAa,KAAK,CAAC,QAAQ,aAAa,CACtG,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,iBAAiB;IAC/B,MAAM,OAAO,GAAG,aAAa,CAAC,UAAU,EAAE,CAAC;IAC3C,MAAM,MAAM,GAAa,EAAE,CAAC;IAE5B,IAAI,OAAO,CAAC,OAAO,CAAC,QAAQ,GAAG,GAAG,EAAE,CAAC;QACnC,MAAM,CAAC,IAAI,CAAC,oBAAoB,OAAO,CAAC,OAAO,CAAC,QAAQ,IAAI,CAAC,CAAC;IAChE,CAAC;IAED,IAAI,OAAO,CAAC,KAAK,KAAK,YAAY,EAAE,CAAC;QACnC,MAAM,CAAC,IAAI,CAAC,8BAA8B,CAAC,CAAC;IAC9C,CAAC;IAED,OAAO;QACL,OAAO,EAAE,MAAM,CAAC,MAAM,KAAK,CAAC;QAC5B,MAAM;KACP,CAAC;AACJ,CAAC"}
@@ -0,0 +1,90 @@
1
+ /**
2
+ * StringRay Post-Processor - Core Infrastructure
3
+ *
4
+ * Automated CI/CD loop orchestration: commit → push → monitor → fix → redeploy → monitor
5
+ * Provides systematic error prevention and deployment automation.
6
+ *
7
+ * @version 1.0.0
8
+ * @since 2026-01-13
9
+ */
10
+ import { StringRayStateManager } from "../state/state-manager.js";
11
+ import { SessionMonitor } from "../session/session-monitor.js";
12
+ import { PostProcessorConfig, PostProcessorResult, PostProcessorContext } from "./types.js";
13
+ export declare class PostProcessor {
14
+ private stateManager;
15
+ private sessionMonitor;
16
+ private config;
17
+ private monitoringEngine;
18
+ private failureAnalysisEngine;
19
+ private autoFixEngine;
20
+ private fixValidator;
21
+ private reportValidator;
22
+ private redeployCoordinator;
23
+ private escalationEngine;
24
+ private successHandler;
25
+ private triggers;
26
+ constructor(stateManager: StringRayStateManager, sessionMonitor?: SessionMonitor | null, config?: Partial<PostProcessorConfig>);
27
+ /**
28
+ * Generate automated framework report if conditions are met
29
+ */
30
+ private generateFrameworkReport;
31
+ /**
32
+ * Calculate complexity score for automated report triggering
33
+ */
34
+ private calculateComplexityScore;
35
+ /**
36
+ * Validate generated reports for hidden issues
37
+ */
38
+ private validateGeneratedReport;
39
+ /**
40
+ * Clean up old reports based on retention policy
41
+ */
42
+ private cleanupOldReports;
43
+ /**
44
+ * Initialize the post-processor system
45
+ */
46
+ initialize(): Promise<void>;
47
+ /**
48
+ * Validate architectural compliance against codex rules
49
+ */
50
+ private validateArchitecturalCompliance;
51
+ private checkSystemIntegrity;
52
+ private checkIntegrationTesting;
53
+ private checkPathResolution;
54
+ private checkFeatureCompleteness;
55
+ /**
56
+ * Rule 50: Path Analysis Guidelines Enforcement
57
+ * Ensures AIs follow path resolution guidelines for all write/edit operations
58
+ * Covers all 3 types of path violations from PATH_RESOLUTION_ANALYSIS.md
59
+ */
60
+ private checkPathAnalysisGuidelines;
61
+ /**
62
+ * Execute the complete post-processor loop
63
+ */
64
+ executePostProcessorLoop(context: PostProcessorContext): Promise<PostProcessorResult>;
65
+ /**
66
+ * Execute the monitoring loop until success or max attempts
67
+ */
68
+ private executeMonitoringLoop;
69
+ /**
70
+ * Redeploy after applying fixes using the RedeployCoordinator
71
+ */
72
+ private redeployWithFixes;
73
+ /**
74
+ * Attempt to apply automatic fixes
75
+ */
76
+ private attemptAutoFix;
77
+ /**
78
+ * Escalate to manual intervention
79
+ */
80
+ private escalateToManualIntervention;
81
+ /**
82
+ * Wait before retry with exponential backoff
83
+ */
84
+ private waitBeforeRetry;
85
+ /**
86
+ * Get post-processor status
87
+ */
88
+ getStatus(): Promise<any>;
89
+ }
90
+ //# sourceMappingURL=PostProcessor.d.ts.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