@elizaos/plugin-agent-orchestrator 0.3.16 → 0.3.18

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/index.js CHANGED
@@ -3400,6 +3400,7 @@ async function handleIdleCheck(ctx, taskCtx, idleMinutes) {
3400
3400
  var UNREGISTERED_BUFFER_MS = 2000;
3401
3401
  var IDLE_SCAN_INTERVAL_MS = 60 * 1000;
3402
3402
  var PAUSE_TIMEOUT_MS = 30000;
3403
+ var MAX_PRE_BRIDGE_BUFFER = 100;
3403
3404
  var STOPPED_RECOVERY_WINDOW_MS = 90000;
3404
3405
 
3405
3406
  class SwarmCoordinator {
@@ -3428,6 +3429,7 @@ class SwarmCoordinator {
3428
3429
  _swarmContext = "";
3429
3430
  swarmCompleteNotified = false;
3430
3431
  pauseBuffer = [];
3432
+ preBridgeBroadcastBuffer = [];
3431
3433
  pauseTimeout = null;
3432
3434
  constructor(runtime) {
3433
3435
  this.runtime = runtime;
@@ -3438,7 +3440,15 @@ class SwarmCoordinator {
3438
3440
  }
3439
3441
  setWsBroadcast(cb) {
3440
3442
  this.wsBroadcast = cb;
3441
- this.log("WS broadcast callback wired");
3443
+ if (this.preBridgeBroadcastBuffer.length > 0) {
3444
+ this.log(`WS broadcast callback wired — replaying ${this.preBridgeBroadcastBuffer.length} buffered event(s)`);
3445
+ for (const event of this.preBridgeBroadcastBuffer) {
3446
+ cb(event);
3447
+ }
3448
+ this.preBridgeBroadcastBuffer.length = 0;
3449
+ } else {
3450
+ this.log("WS broadcast callback wired");
3451
+ }
3442
3452
  }
3443
3453
  setSwarmCompleteCallback(cb) {
3444
3454
  this.swarmCompleteCb = cb;
@@ -3517,6 +3527,7 @@ class SwarmCoordinator {
3517
3527
  this.pauseTimeout = null;
3518
3528
  }
3519
3529
  this.pauseBuffer = [];
3530
+ this.preBridgeBroadcastBuffer.length = 0;
3520
3531
  this.log("SwarmCoordinator stopped");
3521
3532
  }
3522
3533
  get isPaused() {
@@ -3527,7 +3538,12 @@ class SwarmCoordinator {
3527
3538
  return;
3528
3539
  this._paused = true;
3529
3540
  this.log("Coordinator paused — buffering LLM decisions until user message is processed");
3530
- this.broadcast({ type: "coordinator_paused", sessionId: "", timestamp: Date.now(), data: {} });
3541
+ this.broadcast({
3542
+ type: "coordinator_paused",
3543
+ sessionId: "",
3544
+ timestamp: Date.now(),
3545
+ data: {}
3546
+ });
3531
3547
  this.pauseTimeout = setTimeout(() => {
3532
3548
  if (this._paused) {
3533
3549
  this.log("Coordinator auto-resuming after timeout");
@@ -3544,7 +3560,12 @@ class SwarmCoordinator {
3544
3560
  this.pauseTimeout = null;
3545
3561
  }
3546
3562
  this.log(`Coordinator resumed — replaying ${this.pauseBuffer.length} buffered events`);
3547
- this.broadcast({ type: "coordinator_resumed", sessionId: "", timestamp: Date.now(), data: {} });
3563
+ this.broadcast({
3564
+ type: "coordinator_resumed",
3565
+ sessionId: "",
3566
+ timestamp: Date.now(),
3567
+ data: {}
3568
+ });
3548
3569
  const buffered = [...this.pauseBuffer];
3549
3570
  this.pauseBuffer = [];
3550
3571
  for (const entry of buffered) {
@@ -3646,7 +3667,11 @@ class SwarmCoordinator {
3646
3667
  for (const d of dead) {
3647
3668
  this.sseClients.delete(d);
3648
3669
  }
3649
- this.wsBroadcast?.(event);
3670
+ if (this.wsBroadcast) {
3671
+ this.wsBroadcast(event);
3672
+ } else if (this.preBridgeBroadcastBuffer.length < MAX_PRE_BRIDGE_BUFFER) {
3673
+ this.preBridgeBroadcastBuffer.push(event);
3674
+ }
3650
3675
  }
3651
3676
  writeSseEvent(res, event) {
3652
3677
  try {
@@ -7935,5 +7960,5 @@ export {
7935
7960
  CodingWorkspaceService
7936
7961
  };
7937
7962
 
7938
- //# debugId=9A77138F9177BAEA64756E2164756E21
7963
+ //# debugId=6CDD8C39345EE4DA64756E2164756E21
7939
7964
  //# sourceMappingURL=index.js.map