aegis-bridge 2.17.2 → 2.17.4
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/README.md +30 -0
- package/dashboard/dist/assets/{index-FXVsThDA.js → index-CFVRwPA_.js} +59 -59
- package/dashboard/dist/assets/{index-FXVsThDA.js.map → index-CFVRwPA_.js.map} +1 -1
- package/dashboard/dist/index.html +1 -1
- package/dist/pipeline.d.ts +1 -0
- package/dist/pipeline.js +14 -2
- package/dist/server.js +14 -0
- package/package.json +1 -1
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>Aegis Dashboard</title>
|
|
7
7
|
<link rel="icon" type="image/svg+xml" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>🛡️</text></svg>" />
|
|
8
|
-
<script type="module" crossorigin src="/dashboard/assets/index-
|
|
8
|
+
<script type="module" crossorigin src="/dashboard/assets/index-CFVRwPA_.js"></script>
|
|
9
9
|
<link rel="stylesheet" crossorigin href="/dashboard/assets/index-DnIfWYzW.css">
|
|
10
10
|
</head>
|
|
11
11
|
<body class="bg-[#0a0a0f] text-gray-200 antialiased">
|
package/dist/pipeline.d.ts
CHANGED
|
@@ -75,6 +75,7 @@ export declare class PipelineManager {
|
|
|
75
75
|
private pipelines;
|
|
76
76
|
private pipelineConfigs;
|
|
77
77
|
private pollInterval;
|
|
78
|
+
private cleanupTimers;
|
|
78
79
|
constructor(sessions: SessionManager, eventBus?: SessionEventBus | undefined);
|
|
79
80
|
/** Create multiple sessions in parallel. */
|
|
80
81
|
batchCreate(specs: BatchSessionSpec[]): Promise<BatchResult>;
|
package/dist/pipeline.js
CHANGED
|
@@ -15,6 +15,7 @@ export class PipelineManager {
|
|
|
15
15
|
pipelines = new Map();
|
|
16
16
|
pipelineConfigs = new Map(); // #219: preserve original stage config
|
|
17
17
|
pollInterval = null;
|
|
18
|
+
cleanupTimers = new Map(); // #1092: track cleanup timers per pipeline
|
|
18
19
|
constructor(sessions, eventBus) {
|
|
19
20
|
this.sessions = sessions;
|
|
20
21
|
this.eventBus = eventBus;
|
|
@@ -212,9 +213,11 @@ export class PipelineManager {
|
|
|
212
213
|
}
|
|
213
214
|
// #221: Clean up completed/failed pipelines after 30s to avoid memory leak
|
|
214
215
|
// Note: advancePipeline may change status from 'running' to 'completed'/'failed'
|
|
215
|
-
|
|
216
|
+
// #1092: Track cleanup timer to prevent duplicates and allow destroy() cleanup
|
|
217
|
+
if (pipeline.status !== 'running' && !this.cleanupTimers.has(id)) {
|
|
216
218
|
const pipelineId = id;
|
|
217
|
-
setTimeout(() => {
|
|
219
|
+
const timer = setTimeout(() => {
|
|
220
|
+
this.cleanupTimers.delete(pipelineId);
|
|
218
221
|
this.pipelines.delete(pipelineId);
|
|
219
222
|
this.pipelineConfigs.delete(pipelineId); // #219: clean up stored config
|
|
220
223
|
// #578: Stop polling when no pipelines remain
|
|
@@ -223,6 +226,7 @@ export class PipelineManager {
|
|
|
223
226
|
this.pollInterval = null;
|
|
224
227
|
}
|
|
225
228
|
}, 30_000);
|
|
229
|
+
this.cleanupTimers.set(pipelineId, timer);
|
|
226
230
|
}
|
|
227
231
|
}
|
|
228
232
|
}
|
|
@@ -275,5 +279,13 @@ export class PipelineManager {
|
|
|
275
279
|
clearInterval(this.pollInterval);
|
|
276
280
|
this.pollInterval = null;
|
|
277
281
|
}
|
|
282
|
+
// #1092: Clear all pending cleanup timers
|
|
283
|
+
for (const timer of this.cleanupTimers.values()) {
|
|
284
|
+
clearTimeout(timer);
|
|
285
|
+
}
|
|
286
|
+
this.cleanupTimers.clear();
|
|
287
|
+
// #1092: Clear maps to release memory
|
|
288
|
+
this.pipelines.clear();
|
|
289
|
+
this.pipelineConfigs.clear();
|
|
278
290
|
}
|
|
279
291
|
}
|
package/dist/server.js
CHANGED
|
@@ -54,6 +54,17 @@ import { authKeySchema, sendMessageSchema, commandSchema, bashSchema, screenshot
|
|
|
54
54
|
const __filename = fileURLToPath(import.meta.url);
|
|
55
55
|
const __dirname = path.dirname(__filename);
|
|
56
56
|
const consensusRequests = new Map();
|
|
57
|
+
/** #1091: TTL for consensus request entries (1 hour) */
|
|
58
|
+
const CONSENSUS_REQUEST_TTL_MS = 60 * 60 * 1000;
|
|
59
|
+
/** #1091: Prune consensus requests older than the TTL to prevent unbounded memory growth. */
|
|
60
|
+
function pruneConsensusRequests() {
|
|
61
|
+
const cutoff = Date.now() - CONSENSUS_REQUEST_TTL_MS;
|
|
62
|
+
for (const [id, request] of consensusRequests) {
|
|
63
|
+
if (request.createdAt < cutoff) {
|
|
64
|
+
consensusRequests.delete(id);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
57
68
|
// ── Configuration ────────────────────────────────────────────────────
|
|
58
69
|
// Issue #349: CSP policy for dashboard responses (shared between static and SPA fallback)
|
|
59
70
|
const DASHBOARD_CSP = "default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; connect-src 'self' ws: wss: https://registry.npmjs.org";
|
|
@@ -1769,6 +1780,8 @@ async function main() {
|
|
|
1769
1780
|
const authFailPruneInterval = setInterval(pruneAuthFailLimits, 60_000);
|
|
1770
1781
|
// #398: Sweep stale API key rate limit buckets every 5 minutes
|
|
1771
1782
|
const authSweepInterval = setInterval(() => auth.sweepStaleRateLimits(), 5 * 60_000);
|
|
1783
|
+
// #1091: Prune stale consensus requests every minute
|
|
1784
|
+
const consensusPruneInterval = setInterval(pruneConsensusRequests, 60_000);
|
|
1772
1785
|
let pidFilePath = '';
|
|
1773
1786
|
// Issue #361: Graceful shutdown handler
|
|
1774
1787
|
// Issue #415: Reentrance guard at handler level prevents double execution on rapid SIGINT
|
|
@@ -1798,6 +1811,7 @@ async function main() {
|
|
|
1798
1811
|
clearInterval(ipPruneInterval);
|
|
1799
1812
|
clearInterval(authFailPruneInterval);
|
|
1800
1813
|
clearInterval(authSweepInterval);
|
|
1814
|
+
clearInterval(consensusPruneInterval);
|
|
1801
1815
|
// Issue #569: Kill all CC sessions and tmux windows before exit
|
|
1802
1816
|
try {
|
|
1803
1817
|
await killAllSessions(sessions, tmux);
|