aegis-bridge 2.17.3 → 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.
@@ -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
- if (pipeline.status !== 'running') {
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aegis-bridge",
3
- "version": "2.17.3",
3
+ "version": "2.17.4",
4
4
  "type": "module",
5
5
  "description": "Orchestrate Claude Code sessions via API. Create, brief, monitor, refine, ship.",
6
6
  "main": "dist/server.js",