@dreb/coding-agent 2.34.1 → 2.34.3

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.
@@ -197,6 +197,7 @@ export class InteractiveMode {
197
197
  throw new Error("No API key available for the current model.");
198
198
  return manager.reroll(model, apiKey);
199
199
  },
200
+ onVisibilityChange: (visible) => this.syncBuddyWidget(visible),
200
201
  });
201
202
  this.ui = new TUI(new ProcessTerminal(), this.settingsManager.getShowHardwareCursor());
202
203
  this.headerContainer = new Container();
@@ -1993,7 +1994,10 @@ export class InteractiveMode {
1993
1994
  return;
1994
1995
  }
1995
1996
  }
1996
- // Capture user message for buddy context and reset idle timer
1997
+ // Capture user message for buddy context and reset idle timer.
1998
+ // refreshVisibility() first, so a /buddy off from another concurrent
1999
+ // instance unmounts this TUI's widget as the user resumes interacting.
2000
+ this.buddyController.refreshVisibility();
1997
2001
  this.buddyController.appendContext(`User: ${text}`);
1998
2002
  this.buddyController.markActivity();
1999
2003
  this.buddyController.resetIdleTimer();
@@ -4569,6 +4573,19 @@ ${cycleModelForward || cycleModelBackward ? `| \`${cycleModelForward}\` / \`${cy
4569
4573
  this.mountBuddy(existingBuddy);
4570
4574
  }
4571
4575
  }
4576
+ syncBuddyWidget(visible) {
4577
+ // Another concurrent dreb instance toggled the buddy via /buddy off
4578
+ // or /buddy. Converge this TUI's widget to the persisted state.
4579
+ if (visible) {
4580
+ const state = this.buddyController.manager.getState() ?? this.buddyController.manager.load();
4581
+ if (state)
4582
+ this.mountBuddy(state);
4583
+ }
4584
+ else {
4585
+ this.removeBuddy();
4586
+ }
4587
+ this.ui.requestRender();
4588
+ }
4572
4589
  mountBuddy(state) {
4573
4590
  // Remove existing if any
4574
4591
  this.removeBuddy();