@genesislcap/ai-assistant 15.10.4 → 15.10.6

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.
@@ -3526,13 +3526,13 @@ var ChatDriver = class _ChatDriver extends EventTarget {
3526
3526
  maxTurnSnapshots = DEFAULT_MAX_TURN_SNAPSHOTS,
3527
3527
  sessionKey = "",
3528
3528
  activityBus = NOOP_ACTIVITY_BUS,
3529
- budgetExhaustedMessage = DEFAULT_BUDGET_EXHAUSTED_MESSAGE
3529
+ budgetExhaustedMessage
3530
3530
  } = config;
3531
3531
  this.maxToolIterations = maxToolIterations;
3532
3532
  this.condenseBatchCalls = condenseBatchCalls;
3533
3533
  this.sessionKey = sessionKey;
3534
3534
  this.activityBus = activityBus;
3535
- this.budgetExhaustedMessage = budgetExhaustedMessage;
3535
+ this.budgetExhaustedMessageOverride = budgetExhaustedMessage;
3536
3536
  if (typeof toolHandlers === "function") {
3537
3537
  this.toolHandlersFactory = toolHandlers;
3538
3538
  this.toolHandlers = {};
@@ -3669,6 +3669,12 @@ var ChatDriver = class _ChatDriver extends EventTarget {
3669
3669
  *
3670
3670
  * @internal
3671
3671
  */
3672
+ budgetExhaustedBubble(wall) {
3673
+ if (this.budgetExhaustedMessageOverride != null) return this.budgetExhaustedMessageOverride;
3674
+ if (wall?.otherVendorAvailable !== true) return DEFAULT_BUDGET_EXHAUSTED_MESSAGE;
3675
+ const subject = wall?.vendorLabel ? `${wall.vendorLabel}'s AI usage limit` : "your AI usage limit";
3676
+ return `You've reached ${subject}. Switch to another AI provider in Settings to keep going, or contact your administrator to raise it.`;
3677
+ }
3672
3678
  reportBudgetExhausted(e, pendingUserMessage) {
3673
3679
  if (pendingUserMessage) this.appendToHistory(pendingUserMessage);
3674
3680
  this.budgetExhaustedThisTurn = true;
@@ -3687,7 +3693,7 @@ var ChatDriver = class _ChatDriver extends EventTarget {
3687
3693
  spentUsd: e.spentUsd,
3688
3694
  isSubAgent: this.isSubAgent
3689
3695
  });
3690
- this.appendToHistory({ role: "assistant", content: this.budgetExhaustedMessage });
3696
+ this.appendToHistory({ role: "assistant", content: this.budgetExhaustedBubble(e) });
3691
3697
  return this.turnDone("budget-exhausted", budgetDetailOf(e));
3692
3698
  }
3693
3699
  /** The typed failure reason on a loop result, or `undefined` for a clean turn / handoff. */
@@ -4816,7 +4822,10 @@ Output format (strict):
4816
4822
  if (this.isSubAgent) {
4817
4823
  this.failSubAgent("budget_exhausted", this.budgetWallDetail);
4818
4824
  } else {
4819
- this.appendToHistory({ role: "assistant", content: this.budgetExhaustedMessage });
4825
+ this.appendToHistory({
4826
+ role: "assistant",
4827
+ content: this.budgetExhaustedBubble(this.budgetWallDetail)
4828
+ });
4820
4829
  }
4821
4830
  return this.turnDone("budget-exhausted", this.budgetWallDetail);
4822
4831
  }