@indigoai-us/hq-cli 5.228.3 → 5.228.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/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [5.228.4] — 2026-09-27
6
+
7
+ ### Fixed
8
+
9
+ - Account history now distinguishes automatic moves caused by a quota hold, an
10
+ unavailable or logged-out account, or uneven load.
11
+
5
12
  ## [5.228.3] — 2026-09-27
6
13
 
7
14
  ### Fixed
@@ -5635,9 +5635,20 @@ async function selectAutomaticClaudeResumeAccount(ctx, lane, workerProfile, opti
5635
5635
  ...(model !== undefined ? { model } : {}),
5636
5636
  unavailableHosts: balanceHosts.unavailableHosts,
5637
5637
  });
5638
+ const historyReason = lane.account === undefined
5639
+ ? "load_balance"
5640
+ : currentConfig?.enabled !== true
5641
+ ? "account_unavailable"
5642
+ : currentLogin === false
5643
+ ? "recorded_account_logged_out"
5644
+ : currentLogin !== true
5645
+ ? "account_unavailable"
5646
+ : quotaBlockFor(loadQuotaState(hqRoot), "claude", lane.account, model, ctx.now()).blocked
5647
+ ? "usage_limit"
5648
+ : "load_balance";
5638
5649
  return {
5639
5650
  selection: { ...selected, selected_at: ctx.now().toISOString() },
5640
- ...(repairUnavailableAccount ? { historyReason: "recorded_account_logged_out" } : {}),
5651
+ historyReason,
5641
5652
  ...(preservedModel !== undefined ? { preservedModel } : {}),
5642
5653
  };
5643
5654
  }
@@ -6269,6 +6280,7 @@ async function applyClaudeBalanceMove(ctx, suggestion) {
6269
6280
  const moved = await prepareAccountMove(ctx, lane, {
6270
6281
  account: suggestion.to,
6271
6282
  cliModel: undefined,
6283
+ accountHistoryReason: automaticBalanceMoveHistoryReason(ctx, lane),
6272
6284
  deferTurnStart: true,
6273
6285
  });
6274
6286
  return { lane_id: moved.lane.lane_id, host: moved.lane.host, from: moved.from ?? suggestion.from, to: moved.to, state: moved.lane.state };
@@ -6324,6 +6336,7 @@ async function runClaudeBalanceMoveTarget(ctx, laneId, opts) {
6324
6336
  const moved = await prepareAccountMove(ctx, lane, {
6325
6337
  account,
6326
6338
  cliModel: undefined,
6339
+ accountHistoryReason: automaticBalanceMoveHistoryReason(ctx, lane),
6327
6340
  deferTurnStart: true,
6328
6341
  });
6329
6342
  printJson({
@@ -6335,6 +6348,32 @@ async function runClaudeBalanceMoveTarget(ctx, laneId, opts) {
6335
6348
  account: moved.lane.account,
6336
6349
  });
6337
6350
  }
6351
+ function automaticBalanceMoveHistoryReason(ctx, lane) {
6352
+ const hqRoot = ctx.hqRoot();
6353
+ const config = loadLanesConfig(hqRoot);
6354
+ const accountId = lane.account;
6355
+ if (accountId === undefined)
6356
+ return "load_balance";
6357
+ const source = config.providers[lane.provider].accounts[accountId];
6358
+ if (source?.enabled !== true)
6359
+ return "account_unavailable";
6360
+ const login = accountStatus(lane.provider, accountId, config, {
6361
+ existsSync: ctx.existsSync,
6362
+ hostname: ctx.hostname(),
6363
+ probe: ctx.probeProvider,
6364
+ env: ctx.env,
6365
+ }).logged_in;
6366
+ if (login === false)
6367
+ return "recorded_account_logged_out";
6368
+ if (login !== true)
6369
+ return "account_unavailable";
6370
+ const provider = config.providers[lane.provider];
6371
+ const model = lane.model ?? source.model ?? provider.model;
6372
+ if (quotaBlockFor(loadQuotaState(hqRoot), lane.provider, accountId, model, ctx.now()).blocked) {
6373
+ return "usage_limit";
6374
+ }
6375
+ return "load_balance";
6376
+ }
6338
6377
  function laneWithRecoveredProviderSession(hqRoot, lane) {
6339
6378
  const manifest = readSpawnManifest(laneRunDir(hqRoot, lane.lane_id));
6340
6379
  const sessionId = (typeof lane.provider_session_id === "string" && lane.provider_session_id.trim()
@@ -189,7 +189,7 @@ function selectSpawnAccount(input) {
189
189
  const operatorMovePending = lane.pending_resume !== undefined &&
190
190
  lane.account_history?.at(-1)?.reason === "operator_move";
191
191
  if (current === undefined || !current.enabled) {
192
- reason = repairRecordedAccount ? "recorded_account_logged_out" : "account_unavailable";
192
+ reason = "account_unavailable";
193
193
  refusal = new AccountResolutionError(current === undefined ? "unknown_account" : "account_disabled", `Account ${JSON.stringify(lane.account)} is unavailable for ${lane.provider}`, { provider: lane.provider, account: lane.account });
194
194
  }
195
195
  else {
@@ -244,7 +244,11 @@ function selectSpawnAccount(input) {
244
244
  account: lane.account,
245
245
  });
246
246
  }
247
- if (reason === "recorded_account_logged_out" && lane.provider === "claude") {
247
+ const recoverRecordedClaudeModel = lane.provider === "claude" &&
248
+ reason !== undefined &&
249
+ (reason === "recorded_account_logged_out" ||
250
+ (reason === "account_unavailable" && repairRecordedAccount && recordedModel !== undefined));
251
+ if (recoverRecordedClaudeModel) {
248
252
  const lanes = listLaneIds(hqRoot)
249
253
  .map((laneId) => readLane(hqRoot, laneId))
250
254
  .filter((record) => record.host.kind === lane.host.kind && record.host.id === lane.host.id);
@@ -268,7 +272,8 @@ function selectSpawnAccount(input) {
268
272
  });
269
273
  return {
270
274
  account: resolveAccount(lane.provider, selection.account, config, context),
271
- changeReason: "recorded_account_logged_out",
275
+ changeReason: reason,
276
+ ...(recordedModel !== undefined ? { preservedModel: recordedModel } : {}),
272
277
  };
273
278
  }
274
279
  const allowedAccounts = Object.entries(config.providers[lane.provider].accounts)
@@ -1726,7 +1731,7 @@ export function spawnLaneWorker(hqRoot, lane, deps = {}, launch = {}) {
1726
1731
  process.stderr.write(`hq lanes: account bind failed for ${lane.lane_id}: ${err instanceof Error ? err.message : String(err)}\n`);
1727
1732
  throw err;
1728
1733
  }
1729
- const preservedAccountModel = selection.changeReason === "recorded_account_logged_out" ? recordedModel : undefined;
1734
+ const preservedAccountModel = selection.preservedModel;
1730
1735
  if (preservedAccountModel !== undefined)
1731
1736
  pinnedModel = preservedAccountModel;
1732
1737
  const resolved = selection.account;
@@ -523,7 +523,7 @@ export interface AccountHistoryEntry {
523
523
  from: string | null;
524
524
  to: string;
525
525
  at: string;
526
- reason: "first_assignment" | "model_change" | "usage_limit" | "account_unavailable" | "recorded_account_logged_out" | "operator_move";
526
+ reason: "first_assignment" | "model_change" | "usage_limit" | "account_unavailable" | "recorded_account_logged_out" | "load_balance" | "operator_move";
527
527
  }
528
528
  export interface PendingResume {
529
529
  /** Fresh answered-question launches need no previous session id. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@indigoai-us/hq-cli",
3
- "version": "5.228.3",
3
+ "version": "5.228.4",
4
4
  "description": "HQ by Indigo management CLI — modules and cloud sync",
5
5
  "main": "dist/index.js",
6
6
  "bin": {