@indigoai-us/hq-cli 5.345.204 → 5.345.206

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.
Files changed (80) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/dist/command-catalog.generated.d.ts +51 -1
  3. package/dist/command-catalog.generated.js +63 -1
  4. package/dist/commands/bot.d.ts +67 -0
  5. package/dist/commands/bot.js +301 -39
  6. package/dist/commands/cloud-off-gate.d.ts +9 -2
  7. package/dist/commands/cloud-off-gate.js +49 -13
  8. package/dist/commands/feedback.d.ts +26 -0
  9. package/dist/commands/feedback.js +91 -5
  10. package/dist/commands/install-global.d.ts +3 -1
  11. package/dist/commands/install-global.js +15 -4
  12. package/dist/commands/lanes.d.ts +2 -0
  13. package/dist/commands/lanes.js +9 -3
  14. package/dist/commands/mcp-serve.d.ts +5 -2
  15. package/dist/commands/mcp-serve.js +45 -3
  16. package/dist/commands/mcp-status.d.ts +3 -1
  17. package/dist/commands/mcp-status.js +24 -14
  18. package/dist/commands/secrets.js +11 -1
  19. package/dist/commands/sources.js +10 -15
  20. package/dist/index.js +7 -2
  21. package/dist/lib/bot/executive-settings.d.ts +13 -0
  22. package/dist/lib/bot/executive-settings.js +20 -17
  23. package/dist/lib/bot/executive-sync.d.ts +12 -0
  24. package/dist/lib/bot/executive-sync.js +36 -0
  25. package/dist/lib/bot/executive.d.ts +51 -0
  26. package/dist/lib/bot/executive.js +144 -0
  27. package/dist/lib/bot/fleet-cron.d.ts +7 -0
  28. package/dist/lib/bot/fleet-cron.js +2 -1
  29. package/dist/lib/bot/fleet-local.js +9 -9
  30. package/dist/lib/bot/jobs/executive-handover.d.ts +6 -0
  31. package/dist/lib/bot/jobs/executive-handover.js +33 -0
  32. package/dist/lib/bot/jobs/hot-signal-sync.d.ts +22 -0
  33. package/dist/lib/bot/jobs/hot-signal-sync.js +47 -0
  34. package/dist/lib/bot/listed-running.d.ts +16 -0
  35. package/dist/lib/bot/listed-running.js +16 -0
  36. package/dist/lib/bot/pending-switch.d.ts +51 -0
  37. package/dist/lib/bot/pending-switch.js +103 -0
  38. package/dist/lib/bot/run.js +27 -3
  39. package/dist/lib/bot/runtime-failure.js +19 -3
  40. package/dist/lib/bot/status.d.ts +20 -0
  41. package/dist/lib/company-skill-wrapper.js +29 -0
  42. package/dist/lib/daemon/hq-child-bootstrap.mjs +197 -2
  43. package/dist/lib/daemon/resolver.d.ts +14 -0
  44. package/dist/lib/daemon/resolver.js +96 -0
  45. package/dist/lib/daemon/run.d.ts +11 -0
  46. package/dist/lib/daemon/run.js +58 -6
  47. package/dist/lib/daemon/server.d.ts +2 -9
  48. package/dist/lib/daemon/server.js +3 -89
  49. package/dist/lib/doctor/checks/claude-wiring.js +41 -0
  50. package/dist/lib/doctor/checks/sync-health.d.ts +8 -0
  51. package/dist/lib/doctor/checks/sync-health.js +34 -2
  52. package/dist/lib/doctor/duplicate-hook-registrations.d.ts +34 -0
  53. package/dist/lib/doctor/duplicate-hook-registrations.js +130 -0
  54. package/dist/lib/doctor/fix/apply.js +79 -3
  55. package/dist/lib/doctor/fix/remediation.d.ts +1 -1
  56. package/dist/lib/doctor/fix/remediation.js +15 -0
  57. package/dist/lib/doctor/types.d.ts +1 -1
  58. package/dist/lib/doctor/types.js +1 -0
  59. package/dist/lib/lanes/links.d.ts +2 -0
  60. package/dist/lib/lanes/links.js +12 -1
  61. package/dist/lib/mcp/local-native-tools.d.ts +40 -0
  62. package/dist/lib/mcp/local-native-tools.js +111 -0
  63. package/dist/lib/mcp/tools.d.ts +2 -0
  64. package/dist/lib/mcp/tools.js +2 -0
  65. package/dist/lib/signals/steps/extract.d.ts +1 -1
  66. package/dist/lib/signals/steps/extract.js +4 -16
  67. package/dist/sentry-init.js +6 -0
  68. package/dist/utils/cli-network-lifecycle.d.ts +11 -1
  69. package/dist/utils/cli-network-lifecycle.js +36 -2
  70. package/dist/utils/daemon-helper-lifetime.d.ts +39 -0
  71. package/dist/utils/daemon-helper-lifetime.js +209 -0
  72. package/dist/utils/daemon-helper-markers.d.ts +24 -0
  73. package/dist/utils/daemon-helper-markers.js +53 -0
  74. package/dist/utils/mcp-launcher.d.ts +28 -0
  75. package/dist/utils/mcp-launcher.js +117 -0
  76. package/dist/utils/package-use-lease.d.ts +10 -0
  77. package/dist/utils/package-use-lease.js +31 -0
  78. package/dist/utils/resident-package-preload.js +4 -1
  79. package/docs/anywhere-runtime.md +7 -0
  80. package/package.json +7 -7
@@ -25,6 +25,7 @@ import { hasPromotionHold, promotionHoldSummary } from "../lib/bot/promotion-hol
25
25
  * hq bot restore [--all] [--dry-run] (every bot you own that is missing here)
26
26
  * hq bot start|stop|restart <name>
27
27
  * hq bot status <name> [--json]
28
+ * hq bot eb [name] [--json] (show or choose the Executive bot)
28
29
  * hq bot logs <name> [--follow] [-n N]
29
30
  * hq bot run <name> (the resident process; launchd runs this)
30
31
  * hq bot daemon install|uninstall|status <name>
@@ -48,6 +49,9 @@ import { registerBotContinuityCommand } from "./bot-continuity.js";
48
49
  import { registerBotJobsCommand } from "./bot-jobs.js";
49
50
  import { registerBotEventsCommand } from "./bot-events.js";
50
51
  import { executiveStatus } from "../lib/bot/executive-settings.js";
52
+ import { describeExecutiveBotSource, resolveExecutiveBot, setExecutiveBot } from "../lib/bot/executive.js";
53
+ import { executiveHotSignalSyncCompanies } from "../lib/bot/executive-sync.js";
54
+ import { readBotListedProcess } from "../lib/bot/listed-running.js";
51
55
  import { ensureFleetHotSignalSync, fleetCronOps, migrateLegacyJobsToFleet } from "../lib/bot/fleet-cron.js";
52
56
  import { resolvePackSetupPrompt } from "../lib/bot/pack-setup.js";
53
57
  import { detectCodingToolActivity } from "../lib/bot/coding-tool-activity.js";
@@ -70,10 +74,11 @@ import { isAncestorProcess } from "../lib/bot/self-process.js";
70
74
  import { runtimeDisplayName, signInCommand } from "../lib/bot/runtime-sign-in.js";
71
75
  import { checkClaudeCodeLogin, claudeLoginFix, describeClaudeLoginSources } from "../lib/bot/claude-login.js";
72
76
  import { unresolvedLastFailure } from "../lib/doctor/checks/bots.js";
73
- import { classifyRuntimeFailure, runtimeFailureReason } from "../lib/bot/runtime-failure.js";
77
+ import { clearPendingSwitch, recoverPendingSwitchSafely, writePendingSwitch } from "../lib/bot/pending-switch.js";
78
+ import { classifyRuntimeFailure, isRuntimeUsageLimit, runtimeFailureReason, usageLimitResetsAt } from "../lib/bot/runtime-failure.js";
74
79
  import { PROBE_DEFAULT_TIMEOUT_MS, probeBotRuntime } from "../lib/bot/probe.js";
75
80
  import { BOT_LOGIN_RUNTIMES, botAuthEnv, botRuntimeAuth, capacityAccountHome, describeBotAuth, formatBotAuth, isBotLoginRuntime, restoreBotSessions, setAsideBotSessions, signInBotRuntime, signOutBotRuntime, withRuntimeAuth, } from "../lib/bot/runtime-auth.js";
76
- import { BotApi, BotApiError, BOT_RESTORE_DEFAULTS, buildBotLocalConfig, describeBotLocalConfig, orphanBotRunMessage, parseBotLocalConfig, removeOrphanBotDaemon, botDaemonStatus, botDir, botCredsPath, botLogPath, botsRoot, botTokenStateDir, botWorkerRelDir, buildBotDaemonPaths, createBotLogger, deleteBotCreds, installBotDaemon, repairBotDaemonIfStale, healBotDaemonNodeFromJob, introDmText, isBotMemoryMode, botLocalMemoryDir, botMemoryMode, resolveBotMemoryDir, validateBotIntro, validateBotDisplayName, validateBotKickoff, validateBotEffort, validateBotModel, effectiveBotEffort, BOT_EFFORT_LEVELS, DEFAULT_BOT_EFFORT, BOT_MEMORY_MODES, BOT_KINDS, isBotKind, effectiveBotKind, effectiveBotCompanies, normalizeBotCompanies, SETUP_BOT_WORKER_ID, isBotRuntimeId, localNameForRemoteBot, remoteBotRunnability, isPidAlive, listBotWorkerOptions, patchBotConfig, readBotConfig, readBotCredsIdentity, readBotStatus, runtimeCrashSinceStart, resolveBotWorker, runBot, runtimeFor, scaffoldBotMemory, scaffoldBotWorker, startBotDaemon, stopBotDaemon, uninstallBotDaemon, validateBotName, writeBotConfig, writeBotCreds, BOT_RUNTIMES, BOT_INTRO_MAX_CHARS, BOT_DISPLAY_NAME_MAX_CHARS, BOT_KICKOFF_MAX_CHARS, detectBotPlatform, withBotLock, localBotRole, remoteBotRole, remoteBotDisplayName, personFacingName, writeCloudDisplayName, setupSlugFor, ASSISTANT_ROLE, HQ_FLEET_RUNTIME_ENGINE_ID, HQ_FLEET_LOCAL_RELEASE, authenticateFleetLocalBot, bootstrapFleetLocalBot, buildSystemPrompt, controlFleetLocalBot, ensureFleetPython, fleetLocalGatewayPid, fleetLocalProfileNeedsAdoption, fleetLocalServiceInstalled, fleetProviderForRuntime, importFleetLocalMachineCredential, importFleetLocalProviderLogin, fleetProviderNeedsSignIn, fleetOwnerCompanies, refreshFleetLocalInstructions, fleetLocalPromotionRuntime, installPinnedFleetLocalDistribution, installTargetFleetLocalDistribution, resolveFleetLocalPointerTarget, resolveFleetLocalTargetRelease, fleetLocalProfileDir, fleetProfileOwnerCompanies, fleetLocalChannels, readFleetLocalGatewayState, readPromptSources, removeFleetLocalBot, } from "../lib/bot/index.js";
81
+ import { BotApi, BotApiError, BOT_RESTORE_DEFAULTS, buildBotLocalConfig, describeBotLocalConfig, orphanBotRunMessage, parseBotLocalConfig, removeOrphanBotDaemon, botDaemonStatus, botDir, botCredsPath, botLogPath, botsRoot, botTokenStateDir, botWorkerRelDir, buildBotDaemonPaths, createBotLogger, deleteBotCreds, installBotDaemon, repairBotDaemonIfStale, healBotDaemonNodeFromJob, introDmText, isBotMemoryMode, botLocalMemoryDir, botMemoryMode, resolveBotMemoryDir, validateBotIntro, validateBotDisplayName, validateBotKickoff, validateBotEffort, validateBotModel, effectiveBotEffort, BOT_EFFORT_LEVELS, DEFAULT_BOT_EFFORT, BOT_MEMORY_MODES, BOT_KINDS, isBotKind, effectiveBotKind, effectiveBotCompanies, normalizeBotCompanies, SETUP_BOT_WORKER_ID, isBotRuntimeId, localNameForRemoteBot, remoteBotRunnability, isPidAlive, listBotWorkerOptions, patchBotConfig, readBotConfig, readBotCredsIdentity, readBotStatus, patchBotStatus, runtimeCrashSinceStart, resolveBotWorker, runBot, runtimeFor, scaffoldBotMemory, scaffoldBotWorker, startBotDaemon, stopBotDaemon, uninstallBotDaemon, validateBotName, writeBotConfig, writeBotCreds, BOT_RUNTIMES, BOT_INTRO_MAX_CHARS, BOT_DISPLAY_NAME_MAX_CHARS, BOT_KICKOFF_MAX_CHARS, detectBotPlatform, withBotLock, localBotRole, remoteBotRole, remoteBotDisplayName, personFacingName, writeCloudDisplayName, setupSlugFor, ASSISTANT_ROLE, HQ_FLEET_RUNTIME_ENGINE_ID, HQ_FLEET_LOCAL_RELEASE, authenticateFleetLocalBot, bootstrapFleetLocalBot, buildSystemPrompt, controlFleetLocalBot, ensureFleetPython, fleetLocalGatewayPid, fleetLocalProfileNeedsAdoption, fleetLocalServiceInstalled, fleetProviderForRuntime, importFleetLocalMachineCredential, importFleetLocalProviderLogin, fleetProviderNeedsSignIn, fleetOwnerCompanies, refreshFleetLocalInstructions, fleetLocalPromotionRuntime, installPinnedFleetLocalDistribution, installTargetFleetLocalDistribution, resolveFleetLocalPointerTarget, resolveFleetLocalTargetRelease, fleetLocalProfileDir, fleetProfileOwnerCompanies, fleetLocalChannels, readFleetLocalGatewayState, readPromptSources, removeFleetLocalBot, } from "../lib/bot/index.js";
77
82
  import { gatedInteractiveLogin } from "../utils/interactive-caller.js";
78
83
  import { fleetInstallProgressReporter, runBotRuntimeInstall, runBotRuntimeStatus } from "./bot-runtime.js";
79
84
  function collectRepeated(value, previous) {
@@ -128,6 +133,7 @@ export function listBotNames(root) {
128
133
  function requireBot(name) {
129
134
  const valid = validateBotName(name);
130
135
  const dir = botDir(valid);
136
+ recoverPendingSwitchSafely(dir);
131
137
  const config = readBotConfig(dir);
132
138
  if (!config) {
133
139
  // Never point at `create` alone: after a wiped ~/.hq the cloud still has
@@ -252,13 +258,18 @@ function syncFleetRuntimeJobs(name, dir, config) {
252
258
  log("warn", `could not move ${name}'s scheduled jobs into the HQ Fleet Runtime: ${err instanceof Error ? err.message : String(err)}`);
253
259
  }
254
260
  try {
255
- let otherBotDirs = [];
256
- try {
257
- otherBotDirs = listBotNames(botsRoot()).map((n) => botDir(n));
258
- }
259
- catch {
260
- otherBotDirs = [];
261
- }
261
+ // The Executive bot is preferred for daily hot-signal-sync jobs.
262
+ // The Executive bot registers them on its start regardless of what other
263
+ // bots hold (so a new Executive bot does not wait for the old one); a bot
264
+ // that is no longer the Executive bot removes only jobs covered by it.
265
+ //
266
+ // This follows the Executive identity only (resolveExecutiveBot), never
267
+ // the executive.enabled opt-in: the hot-channel sync runs for every user.
268
+ // With no personal bot here there is no Executive bot, so every bot keeps
269
+ // the earlier behaviour (each syncs its company, one bot per company).
270
+ const executiveBot = resolveExecutiveBot();
271
+ const role = hotSignalSyncRole(name, config, executiveBot);
272
+ const executive = role.executive;
262
273
  const result = ensureFleetHotSignalSync({
263
274
  dir,
264
275
  config,
@@ -266,13 +277,20 @@ function syncFleetRuntimeJobs(name, dir, config) {
266
277
  profileDir: fleetLocalProfileDir(config.agentUid),
267
278
  activeCompany: readActiveCompanySlug(config.hqRoot) ?? null,
268
279
  ownerCompanies: fleetProfileOwnerCompanies(config.agentUid),
269
- otherBotDirs,
280
+ otherBotDirs: role.otherBotDirs,
270
281
  nodeBinary: resolveNodeBinary(),
271
282
  hqBinary: resolveHqBinary(),
272
283
  signalsJobEnabled: fleetSignalsJobEnabled(),
284
+ executive,
285
+ executiveCompanies: role.executiveCompanies,
273
286
  });
274
- for (const id of result.removed)
275
- log("info", `removed the hot-signal-sync job ${id}: this bot no longer syncs that company`);
287
+ if (executive === false && result.removed.length > 0) {
288
+ log("info", `removed the daily hot-signal-sync from this bot (${result.removed.length} job${result.removed.length === 1 ? "" : "s"}): ${executiveBot ? `${executiveBot.name} is the Executive bot now and runs it` : "only the Executive bot runs it"}`);
289
+ }
290
+ else {
291
+ for (const id of result.removed)
292
+ log("info", `removed the hot-signal-sync job ${id}: this bot no longer syncs that company`);
293
+ }
276
294
  for (const entry of result.companies) {
277
295
  if (entry.created)
278
296
  log("info", `registered the daily hot-signal-sync job for ${entry.company} at 06:30 in the HQ Fleet Runtime`);
@@ -284,6 +302,47 @@ function syncFleetRuntimeJobs(name, dir, config) {
284
302
  log("warn", `could not set up ${name}'s hot-signal-sync job: ${err instanceof Error ? err.message : String(err)}`);
285
303
  }
286
304
  }
305
+ /**
306
+ * How a bot takes part in the daily hot-channel sync. Identity only (never
307
+ * the executive.enabled opt-in):
308
+ * - a company bot, or any bot when there is no personal bot here: the earlier
309
+ * behaviour, each bot syncs its company and one bot per company;
310
+ * - the Executive bot: registers its companies, leaving a company to a company
311
+ * bot that already runs it (other personal bots do not hold it back);
312
+ * - any other personal bot: hands over only companies the Executive already holds.
313
+ */
314
+ export function hotSignalSyncRole(name, config, executiveBot) {
315
+ if (!executiveBot || effectiveBotKind(config) !== "personal")
316
+ return { otherBotDirs: allBotDirs() };
317
+ if (executiveBot.name !== name)
318
+ return {
319
+ executive: false,
320
+ executiveCompanies: executiveHotSignalSyncCompanies(executiveBot),
321
+ otherBotDirs: allBotDirs().filter((dir) => path.resolve(dir) !== path.resolve(executiveBot.dir)),
322
+ };
323
+ return { executive: true, otherBotDirs: companyBotDirs() };
324
+ }
325
+ /** Every local company bot folder; empty when they cannot be listed. */
326
+ function companyBotDirs() {
327
+ return allBotDirs().filter((dir) => {
328
+ try {
329
+ const other = readBotConfig(dir);
330
+ return other !== null && effectiveBotKind(other) !== "personal";
331
+ }
332
+ catch {
333
+ return false;
334
+ }
335
+ });
336
+ }
337
+ /** Every local bot folder; empty when they cannot be listed. */
338
+ function allBotDirs() {
339
+ try {
340
+ return listBotNames(botsRoot()).map((n) => botDir(n));
341
+ }
342
+ catch {
343
+ return [];
344
+ }
345
+ }
287
346
  function refuseHeldFleetBot(dir) {
288
347
  if (hasPromotionHold(dir))
289
348
  throw new Error("This bot is held for cloud promotion. Continue its promotion before changing local settings or lifecycle.");
@@ -372,10 +431,38 @@ export function runtimeSignedIn(status, processAlive) {
372
431
  return status.runtimeSignInCheck?.signedIn ?? null;
373
432
  }
374
433
  /**
375
- * Whether the bot's model provider must be signed in before it can run, from
376
- * what this computer knows: the bot's settings, its last reported failure or
377
- * sign-in check, and (legacy) why it has not moved to the HQ Fleet Runtime.
434
+ * `brainUsage` for a row. A model-CLI bot records it itself (status.brainUsage);
435
+ * a Fleet bot's last failure carries the runtime's `brain_usage`, and an older
436
+ * runtime's usage-limit cause is read from its text.
378
437
  */
438
+ /** The bot runtime a Fleet provider name belongs to ("anthropic" is claude), or null. */
439
+ function runtimeIdForFleetProvider(provider) {
440
+ const p = (provider ?? "").trim().toLowerCase();
441
+ if (!p)
442
+ return null;
443
+ if (p === "claude" || p.includes("anthropic"))
444
+ return "claude";
445
+ if (p === "codex" || p === "chatgpt" || p.includes("openai"))
446
+ return "codex";
447
+ if (p === "grok" || p.includes("xai") || p === "x.ai")
448
+ return "grok";
449
+ return null;
450
+ }
451
+ export function brainUsageFor(config, status) {
452
+ const provider = config.runtime;
453
+ const own = status?.brainUsage;
454
+ if (own?.state === "exhausted")
455
+ return { state: "exhausted", provider: own.runtime ?? provider, resetsAt: own.resetsAt ?? null, since: own.since ?? null };
456
+ const failure = unresolvedLastFailure(status);
457
+ if (failure) {
458
+ const reported = failure.brainUsage?.state === "exhausted";
459
+ if (reported || isRuntimeUsageLimit(failure.cause)) {
460
+ const resetsAt = (reported ? failure.brainUsage?.resetsAt : null) ?? usageLimitResetsAt(failure.cause) ?? null;
461
+ return { state: "exhausted", provider: runtimeIdForFleetProvider(failure.provider) ?? provider, resetsAt, since: failure.at ?? null };
462
+ }
463
+ }
464
+ return { state: "ok", provider, resetsAt: null, since: null };
465
+ }
379
466
  export function brainSignInFor(name, config, status, legacy) {
380
467
  const provider = config.runtime;
381
468
  const command = fleetAuthCommand(name, config);
@@ -400,12 +487,15 @@ function signedOutReason(name, issue) {
400
487
  }
401
488
  function rowFor(name, opts = {}) {
402
489
  const dir = botDir(name);
490
+ recoverPendingSwitchSafely(dir);
403
491
  const config = readBotConfig(dir);
404
- const fleet = isFleetRuntimeBot(config);
405
- const status = readBotStatus(dir);
492
+ const executiveBot = opts.executiveBot === undefined ? resolveExecutiveBot() : opts.executiveBot;
493
+ const listed = readBotListedProcess(dir, config);
494
+ const fleet = listed.fleet;
495
+ const status = listed.status;
406
496
  const legacy = fleet ? null : opts.legacy ?? legacyMoveState(dir, config, legacyConvertSeams.providerLogin(dir, config));
407
- const pid = fleet ? fleetLocalGatewayPid(config.agentUid) : (status?.pid ?? null);
408
- const processAlive = pid !== null && isPidAlive(pid) && (fleet || status?.state === "running");
497
+ const pid = listed.pid;
498
+ const processAlive = listed.running;
409
499
  // Turns this bot has taken and not finished: what "thinking" means.
410
500
  const inflightTurns = readInflightTurns(dir);
411
501
  let daemonInstalled = false;
@@ -451,6 +541,7 @@ function rowFor(name, opts = {}) {
451
541
  ...(fleet && config.fleetServiceInstallPending === true ? { needsSignIn: false, serviceInstallPending: true } : {}),
452
542
  signInCommand: fleet ? fleetAuthCommand(name, config) : signInCommand(config.runtime),
453
543
  brainSignIn: brainSignInFor(name, config, status, legacy),
544
+ brainUsage: brainUsageFor(config, status),
454
545
  ...(legacy ? { legacy: legacyStatusJson(legacy) } : {}),
455
546
  runtimeCrash: processAlive ? runtimeCrashSinceStart(status) : null,
456
547
  daemonInstalled,
@@ -460,6 +551,7 @@ function rowFor(name, opts = {}) {
460
551
  introSentAt: config.introSentAt,
461
552
  kind: effectiveBotKind(config),
462
553
  companies: effectiveBotCompanies(config),
554
+ executive: executiveBot?.name === name,
463
555
  workerSource: config.workerSource ?? "scaffold",
464
556
  workerDir: config.workerDir,
465
557
  ...(config.workerId ? { workerId: config.workerId } : {}),
@@ -1739,18 +1831,17 @@ async function runBotResident(nameArg) {
1739
1831
  // A new pass per run: the login preflight and the 20-document cap are per run.
1740
1832
  signalsPass: createClaudeSignalsPass({ hqRoot: config.hqRoot, company: input.company }),
1741
1833
  }));
1742
- let otherBotDirs = [];
1743
- try {
1744
- otherBotDirs = listBotNames(botsRoot()).map((n) => botDir(n));
1745
- }
1746
- catch {
1747
- // No other bots could be listed; this bot is the only one checked.
1748
- }
1834
+ // Prefer the Executive bot for daily hot-channel sync. Other personal bots
1835
+ // keep their company covered until the Executive has a replacement job.
1836
+ // Identity only (never the executive.enabled opt-in); with no personal bot
1837
+ // here every bot keeps the earlier one-bot-per-company behaviour.
1838
+ const executiveBot = resolveExecutiveBot();
1749
1839
  registerHotSignalSyncOnStart({
1750
1840
  dir,
1751
1841
  config,
1752
1842
  activeCompany: readActiveCompanySlug(config.hqRoot) ?? null,
1753
- otherBotDirs,
1843
+ ...hotSignalSyncRole(name, config, executiveBot),
1844
+ executiveName: executiveBot?.name ?? null,
1754
1845
  timezone: machineTimeZone(),
1755
1846
  runFirst: (company) => runHotSignalSync({ company, catchUp: false, firstRun: true, now: () => new Date() }),
1756
1847
  log: (level, message) => (level === "warn" ? console.error(message) : console.log(message)),
@@ -1813,10 +1904,14 @@ async function runBotList(opts) {
1813
1904
  await runBotListRemote(opts);
1814
1905
  return;
1815
1906
  }
1816
- const rows = listBotNames(botsRoot()).map((n) => rowFor(n));
1907
+ const executiveBot = resolveExecutiveBot();
1908
+ const rows = listBotNames(botsRoot()).map((n) => rowFor(n, { executiveBot }));
1817
1909
  await decorateOnline(rows);
1818
1910
  if (opts.json) {
1819
- console.log(JSON.stringify({ bots: rows }, null, 2));
1911
+ console.log(JSON.stringify({
1912
+ bots: rows,
1913
+ executiveBot: executiveBot ? { name: executiveBot.name, source: executiveBot.source } : null,
1914
+ }, null, 2));
1820
1915
  return;
1821
1916
  }
1822
1917
  if (rows.length === 0) {
@@ -1824,9 +1919,37 @@ async function runBotList(opts) {
1824
1919
  return;
1825
1920
  }
1826
1921
  for (const r of rows) {
1827
- console.log(`${chalk.bold(r.name.padEnd(16))} ${r.agentUid} ${r.runtime.padEnd(6)} ${humanOnline(r).padEnd(8)} ${r.processAlive ? chalk.green(`pid ${r.pid}`) : chalk.gray(r.state)}${chalk.dim(` ${r.kind === "company" ? `company bot: ${r.companies.join(", ") || "no company"}` : "personal"}`)}${r.daemonInstalled ? chalk.dim(" launchd") : ""}${r.daemonNodeMissing ? chalk.red(` node missing (hq bot start ${r.name})`) : ""}${r.workerId ? chalk.dim(` worker ${r.workerId}${r.companySlug ? ` (${r.companySlug})` : ""}`) : ""}`);
1922
+ console.log(`${chalk.bold(r.name.padEnd(16))} ${r.agentUid} ${r.runtime.padEnd(6)} ${humanOnline(r).padEnd(8)} ${r.processAlive ? chalk.green(`pid ${r.pid}`) : chalk.gray(r.state)}${chalk.dim(` ${r.kind === "company" ? `company bot: ${r.companies.join(", ") || "no company"}` : "personal"}`)}${r.executive ? chalk.cyan(" (executive)") : ""}${r.daemonInstalled ? chalk.dim(" launchd") : ""}${r.daemonNodeMissing ? chalk.red(` node missing (hq bot start ${r.name})`) : ""}${r.workerId ? chalk.dim(` worker ${r.workerId}${r.companySlug ? ` (${r.companySlug})` : ""}`) : ""}`);
1828
1923
  }
1829
1924
  }
1925
+ /**
1926
+ * `hq bot eb [name]`: show or set the Executive bot (lib/bot/executive.ts).
1927
+ * Setting writes ~/.hq/executive.json; the bots pick the change up on their
1928
+ * next start (the new Executive bot registers the daily jobs, the old one
1929
+ * removes its copies).
1930
+ */
1931
+ async function runBotEb(nameArg, opts) {
1932
+ if (nameArg === undefined) {
1933
+ const current = resolveExecutiveBot();
1934
+ if (opts.json) {
1935
+ console.log(JSON.stringify(current ? { name: current.name, source: current.source, runtime: current.config.runtime } : null, null, 2));
1936
+ return;
1937
+ }
1938
+ console.log(describeExecutiveBotSource(current));
1939
+ return;
1940
+ }
1941
+ const result = setExecutiveBot(nameArg);
1942
+ if (opts.json) {
1943
+ console.log(JSON.stringify(result, null, 2));
1944
+ return;
1945
+ }
1946
+ if (!result.changed) {
1947
+ console.log(`${result.name} is already the Executive bot; it is now the chosen one (hq bot eb ${result.name}).`);
1948
+ return;
1949
+ }
1950
+ console.log(`${result.name} is the Executive bot now: it builds your Daily Brief, extracts signals, runs the daily hot-channel sync and asks your decisions.`);
1951
+ console.log(chalk.dim(`Running bots pick this up on their next start: restart them with hq bot restart <name>.`));
1952
+ }
1830
1953
  async function runBotStatus(nameArg, opts) {
1831
1954
  const { name, dir, config } = requireBot(nameArg);
1832
1955
  const fleet = isFleetRuntimeBot(config);
@@ -1853,6 +1976,8 @@ async function runBotStatus(nameArg, opts) {
1853
1976
  else
1854
1977
  console.log(` engine: ${chalk.yellow(`legacy ${runtimeDisplayName(config.runtime)} runner (not on the HQ Fleet Runtime)`)}`);
1855
1978
  console.log(` kind: ${describeKind(row.kind, row.companies)}`);
1979
+ if (row.executive)
1980
+ console.log(` executive: yes (the Executive bot on this computer; change it with hq bot eb <name>)`);
1856
1981
  const login = describeBotAuth(dir, config);
1857
1982
  console.log(` runtime: ${row.runtime} model ${row.model ?? "default"} thinking ${row.effort}${row.effortIsDefault ? " (default)" : ""}`);
1858
1983
  console.log(` login: ${login.login === "own" && !login.present ? chalk.red(formatBotAuth(login, name)) : formatBotAuth(login, name)}`);
@@ -1862,6 +1987,9 @@ async function runBotStatus(nameArg, opts) {
1862
1987
  console.log(` process: ${row.processAlive ? chalk.green(`running (pid ${row.pid})`) : chalk.gray(row.state)}`);
1863
1988
  if (row.needsSignIn)
1864
1989
  console.log(` sign-in: required (${row.authCommand})`);
1990
+ if (row.brainUsage.state === "exhausted") {
1991
+ console.log(` usage: ${chalk.yellow(`out of usage${row.brainUsage.resetsAt ? `, resets ${row.brainUsage.resetsAt}` : ""}`)} — switch account: hq bot switch-account ${name} --runtime <claude|codex|grok>`);
1992
+ }
1865
1993
  console.log(` HQ online: ${humanOnline(row)}${row.lastHeartbeatAt ? chalk.dim(` last heartbeat ${row.lastHeartbeatAt}`) : ""}${row.lastHeartbeatOk === false && status?.lastHeartbeatError ? chalk.dim(` (${status.lastHeartbeatError})`) : ""}`);
1866
1994
  if (status?.lastInboxPollOk === false) {
1867
1995
  console.log(` inbox: ${chalk.red("cannot receive")}${status.lastInboxError ? chalk.dim(` ${status.lastInboxError}`) : ""}`);
@@ -2390,6 +2518,7 @@ async function switchRuntimeOrAccount(input) {
2390
2518
  runtime: targetRuntime,
2391
2519
  ...(candidate.model ? { model: candidate.model } : {}),
2392
2520
  ...(candidate.effort ? { effort: candidate.effort } : {}),
2521
+ ...(input.probeTimeoutMs ? { timeoutMs: input.probeTimeoutMs } : {}),
2393
2522
  env: probeEnv,
2394
2523
  });
2395
2524
  if (!probe.ok) {
@@ -2400,25 +2529,66 @@ async function switchRuntimeOrAccount(input) {
2400
2529
  throw Object.assign(new Error(`${name} cannot change its runtime or login from inside one of its own turns. Run this from outside the bot. Nothing was changed.`), { expected: true });
2401
2530
  }
2402
2531
  const wasRunning = life.isRunning(dir);
2532
+ const shouldStart = wasRunning || input.startAlways === true;
2533
+ // Written before anything changes: a switch killed part-way (the desktop's
2534
+ // time budget, a closed terminal) is rolled back, or finished when the bot
2535
+ // was already up on the new account, by the next start, status or list.
2536
+ const journal = input.journal
2537
+ ? {
2538
+ v: 1,
2539
+ pid: process.pid,
2540
+ startedAt: new Date().toISOString(),
2541
+ phase: "changing",
2542
+ wasRunning,
2543
+ from: { runtime: config.runtime, runtimeAuth: config.runtimeAuth ?? null, model: config.model ?? null, effort: config.effort ?? null },
2544
+ to: targetRuntime,
2545
+ aside: null,
2546
+ brainState: null,
2547
+ }
2548
+ : null;
2549
+ const saveJournal = (patch = {}) => {
2550
+ if (journal)
2551
+ writePendingSwitch(dir, Object.assign(journal, patch));
2552
+ };
2553
+ saveJournal();
2403
2554
  if (wasRunning && !(await life.stop(name, dir, config))) {
2555
+ clearPendingSwitch(dir);
2404
2556
  throw Object.assign(new Error(`${name} did not stop, so nothing was changed. Try again, or run hq bot stop ${name} first.`), { expected: true });
2405
2557
  }
2406
2558
  let aside = null;
2559
+ // The old account's sign-in and usage state, as it was before a clear, so a
2560
+ // rollback puts it back: the bot is on that account again, and HQ must keep
2561
+ // saying it is out of usage or signed out.
2562
+ let clearedBrainState = null;
2407
2563
  // Only the settings this command changed go back, onto a fresh bot.json.
2408
2564
  const rollBack = () => {
2409
2565
  if (aside)
2410
2566
  restoreBotSessions(dir, aside);
2567
+ if (clearedBrainState && readBotStatus(dir))
2568
+ patchBotStatus(dir, clearedBrainState, () => readBotStatus(dir));
2411
2569
  return patchBotConfig(dir, { runtime: config.runtime, runtimeAuth: config.runtimeAuth, model: config.model, effort: config.effort });
2412
2570
  };
2413
2571
  let next;
2414
2572
  let running = false;
2415
2573
  let rolledBack = false;
2416
2574
  try {
2417
- if (switching)
2575
+ if (switching) {
2418
2576
  aside = setAsideBotSessions(dir, config.runtime);
2577
+ saveJournal({ aside: { archiveDir: aside.archiveDir, moved: aside.moved } });
2578
+ }
2579
+ const before = input.clearBrainState ? readBotStatus(dir) : null;
2580
+ if (before) {
2581
+ clearedBrainState = { brainUsage: before.brainUsage ?? null, runtimeSignIn: before.runtimeSignIn ?? null, modelHold: before.modelHold ?? null };
2582
+ saveJournal({ brainState: clearedBrainState });
2583
+ }
2419
2584
  next = patchBotConfig(dir, patch);
2420
- if (wasRunning)
2585
+ if (before)
2586
+ patchBotStatus(dir, { brainUsage: null, runtimeSignIn: null, modelHold: null }, () => readBotStatus(dir));
2587
+ if (shouldStart)
2421
2588
  running = await life.start(name, dir, next);
2589
+ // Up on the new account: a kill from here on finishes the switch instead of undoing it.
2590
+ if (running)
2591
+ saveJournal({ phase: "started" });
2422
2592
  }
2423
2593
  catch (err) {
2424
2594
  // Any failure part-way puts the old settings and sessions back, and the bot back up.
@@ -2427,19 +2597,22 @@ async function switchRuntimeOrAccount(input) {
2427
2597
  }
2428
2598
  catch { /* best effort */ }
2429
2599
  const old = rollBack();
2600
+ clearPendingSwitch(dir);
2430
2601
  if (wasRunning)
2431
2602
  await life.start(name, dir, old);
2432
2603
  throw err;
2433
2604
  }
2434
2605
  const login = describeBotAuth(dir, next);
2435
2606
  createBotLogger(dir)("info", `settings: runtime=${next.runtime} login=${login.login}${login.account ? ` account=${login.account}` : ""} model=${next.model ?? "default"} effort=${effectiveBotEffort(next)}${aside ? ` (sessions set aside in ${aside.archiveDir})` : ""}`);
2436
- if (wasRunning && !running) {
2607
+ if (shouldStart && !running) {
2437
2608
  await life.stop(name, dir, next);
2438
2609
  const old = rollBack();
2439
2610
  rolledBack = true;
2440
- running = await life.start(name, dir, old);
2611
+ clearPendingSwitch(dir);
2612
+ running = wasRunning ? await life.start(name, dir, old) : false;
2441
2613
  createBotLogger(dir)("warn", `settings rolled back: ${name} did not start on ${next.runtime}`);
2442
2614
  }
2615
+ clearPendingSwitch(dir);
2443
2616
  const result = {
2444
2617
  ok: !rolledBack,
2445
2618
  name,
@@ -2451,7 +2624,7 @@ async function switchRuntimeOrAccount(input) {
2451
2624
  sessionsSetAside: aside && !rolledBack ? { dir: aside.archiveDir, files: aside.moved.length } : null,
2452
2625
  backup: aside ? path.join(aside.archiveDir, "bot.json") : null,
2453
2626
  running,
2454
- restarted: wasRunning,
2627
+ restarted: shouldStart,
2455
2628
  rolledBack,
2456
2629
  };
2457
2630
  if (rolledBack)
@@ -2471,9 +2644,86 @@ async function switchRuntimeOrAccount(input) {
2471
2644
  else {
2472
2645
  console.log(chalk.green(`${name} now uses ${formatBotAuth(login, name)} for ${next.runtime}.`));
2473
2646
  }
2474
- if (wasRunning)
2647
+ if (shouldStart)
2475
2648
  console.log(chalk.dim(running ? " restarted" : ` did not report running; check: hq bot logs ${name}`));
2476
2649
  }
2650
+ /** switch-account's test turn: short, so probe, stop, start and a rollback fit the desktop's 5-minute budget. */
2651
+ export const SWITCH_ACCOUNT_PROBE_TIMEOUT_MS = 60_000;
2652
+ /** The Fleet provider `hq bot auth` takes for a bot runtime. */
2653
+ function fleetProviderForRuntimeId(runtime) {
2654
+ return runtime === "grok" ? "grok" : runtime === "codex" ? "chatgpt" : "claude";
2655
+ }
2656
+ /**
2657
+ * switch-account for a bot on the HQ Fleet Runtime: the Fleet sign-in path
2658
+ * (`hq bot auth`). Claude reads the owner's Claude Code sign-in, which the
2659
+ * desktop signs in to the new account first. ChatGPT and Grok run the Fleet
2660
+ * runtime's own browser sign-in for this bot. The bot keeps its identity,
2661
+ * profile, memory and jobs and is restarted on the new login. On success the
2662
+ * old account's out-of-usage report is cleared from status.json.
2663
+ */
2664
+ async function switchFleetBotAccount(name, dir, runtime, opts, deps) {
2665
+ const auth = deps.fleetAuth ?? runBotAuth;
2666
+ const signedIn = await auth(name, { provider: fleetProviderForRuntimeId(runtime), ...(opts.json ? { json: true } : {}) });
2667
+ // A sign-in whose gateway did not come up is not a working new account yet:
2668
+ // keep the old report so HQ still says why the bot is not answering.
2669
+ if (signedIn && signedIn.running === false) {
2670
+ process.exitCode = 1;
2671
+ return;
2672
+ }
2673
+ const status = readBotStatus(dir);
2674
+ if (status && (status.lastFailure || status.brainUsage || status.runtimeSignIn)) {
2675
+ patchBotStatus(dir, { lastFailure: undefined, brainUsage: null, runtimeSignIn: null }, () => readBotStatus(dir));
2676
+ }
2677
+ createBotLogger(dir)("info", `switch-account: ${name} signed in to ${fleetProviderForRuntimeId(runtime)} through the HQ Fleet sign-in`);
2678
+ }
2679
+ /**
2680
+ * `hq bot switch-account <name> --runtime <runtime>`: move an existing local
2681
+ * bot onto the account the owner's own sign-in for `runtime` now uses (the
2682
+ * desktop app's Switch account signs that in first, with the same switcher as
2683
+ * New bot). Same provider or a different one. The bot keeps its HQ identity,
2684
+ * worker folder, memory, DM history and jobs: only its runtime and login
2685
+ * settings change, the new setup is probed first (nothing changes when it
2686
+ * cannot answer), the old sign-in and usage state are cleared, and the bot is
2687
+ * started again even when it was stopped because it was signed out or out of
2688
+ * usage. A bot that does not come back is rolled back.
2689
+ */
2690
+ export async function runBotSwitchAccount(nameArg, opts, deps = {}) {
2691
+ const name = validateBotName(nameArg);
2692
+ await withBotLock(name, async () => {
2693
+ const { dir, config } = requireBot(name);
2694
+ if (hasPromotionHold(dir))
2695
+ throw new Error("This bot is held for cloud promotion. Continue its promotion before changing local settings or lifecycle.");
2696
+ if (!isBotRuntimeId(opts.runtime)) {
2697
+ throw Object.assign(new Error(`--runtime must be one of ${BOT_RUNTIMES.join(", ")}`), { expected: true });
2698
+ }
2699
+ if (isFleetRuntimeBot(config)) {
2700
+ if (opts.runtime === "grok") {
2701
+ // The Fleet Grok sign-in reuses another bot's xAI login on this
2702
+ // computer, so it cannot reach a different account.
2703
+ throw Object.assign(new Error(`Grok accounts cannot be switched for HQ Fleet bots yet: the Fleet Grok sign-in reuses the xAI login already on this computer. Nothing was changed.`), { expected: true });
2704
+ }
2705
+ return switchFleetBotAccount(name, dir, opts.runtime, opts, deps);
2706
+ }
2707
+ const targetRuntime = opts.runtime;
2708
+ const switching = targetRuntime !== config.runtime;
2709
+ // The owner's own sign-in for the target runtime: the account just picked.
2710
+ const runtimeAuth = withRuntimeAuth(config.runtimeAuth, targetRuntime, null);
2711
+ return switchRuntimeOrAccount({
2712
+ name,
2713
+ dir,
2714
+ config,
2715
+ targetRuntime,
2716
+ switching,
2717
+ runtimeAuth,
2718
+ opts: { ...(opts.json ? { json: true } : {}) },
2719
+ deps,
2720
+ startAlways: true,
2721
+ clearBrainState: true,
2722
+ probeTimeoutMs: SWITCH_ACCOUNT_PROBE_TIMEOUT_MS,
2723
+ journal: true,
2724
+ });
2725
+ }, { command: "hq bot switch-account" });
2726
+ }
2477
2727
  /** `hq bot login <name>`: sign the bot in with a login of its own. */
2478
2728
  export async function runBotLogin(nameArg, opts, deps = {}) {
2479
2729
  const name = validateBotName(nameArg);
@@ -2619,7 +2869,7 @@ export async function runBotRestart(nameArg, opts = {}) {
2619
2869
  await stopBot(b.name, b.dir, b.config, "silent");
2620
2870
  await startBot(b.name, b.dir, b.config, opts.output ?? (opts.json ? "json" : "text"));
2621
2871
  }
2622
- async function runBotAuth(nameArg, opts) {
2872
+ export async function runBotAuth(nameArg, opts) {
2623
2873
  const b = requireBot(nameArg);
2624
2874
  const apiKey = opts.apiKey ? fs.readFileSync(0, "utf8").trim() : undefined;
2625
2875
  if (opts.apiKey && !apiKey) {
@@ -2703,11 +2953,12 @@ async function runBotAuth(nameArg, opts) {
2703
2953
  const running = await fleetGatewayComesUp(b.config.agentUid, result.restarted ? fleetStartWaitMs() : 0);
2704
2954
  if (opts.json) {
2705
2955
  console.log(JSON.stringify({ ok: true, name: b.name, runtime: HQ_FLEET_RUNTIME_ENGINE_ID, ...result, needsSignIn: false, running, serviceInstallPending: pending && !result.restarted, ...(legacy ? { movedToFleet: true } : {}) }, null, 2));
2706
- return;
2956
+ return { running };
2707
2957
  }
2708
2958
  console.log(running
2709
2959
  ? chalk.green(`${b.name} is signed in to ${result.provider} and running ${result.model}.`)
2710
2960
  : chalk.yellow(`${b.name} is signed in to ${result.provider}, but did not start. Run hq bot start ${b.name}.`));
2961
+ return { running };
2711
2962
  }
2712
2963
  // ── adopt / restore (bring a bot you own back to this computer) ──────────────
2713
2964
  /**
@@ -3415,7 +3666,7 @@ export function registerBotCommand(program) {
3415
3666
  .option("--transport <transport>", "Provider transport: chat_completions, anthropic_messages, or codex_responses")
3416
3667
  .option("--no-browser", "Do not open a browser during device authorization")
3417
3668
  .option("--json", "Print machine-readable JSON")
3418
- .action((name, opts) => wrap(() => runBotAuth(name, opts))());
3669
+ .action((name, opts) => wrap(async () => { await runBotAuth(name, opts); })());
3419
3670
  bot
3420
3671
  .command("logs <name>")
3421
3672
  .description("Show the bot's log")
@@ -3443,6 +3694,17 @@ export function registerBotCommand(program) {
3443
3694
  .option("--effort <level>", `Thinking level (claude ${BOT_EFFORT_LEVELS.claude.join("|")}; codex ${BOT_EFFORT_LEVELS.codex.join("|")}; grok ${BOT_EFFORT_LEVELS.grok.join("|")}), or default (${DEFAULT_BOT_EFFORT})`)
3444
3695
  .option("--json", "Print machine-readable JSON")
3445
3696
  .action((name, opts) => wrap(() => runBotSet(name, opts))());
3697
+ bot
3698
+ .command("switch-account <name>")
3699
+ .description("Move the bot onto another account (same provider or another), keeping its identity, worker, memory and jobs, then start it again. A model-CLI bot uses your own sign-in for --runtime, checked with one test turn first; a cut-off switch is rolled back by the next start or status. A Fleet Runtime bot uses the HQ Fleet sign-in (hq bot auth)")
3700
+ .requiredOption("--runtime <runtime>", `${BOT_RUNTIMES.join("|")}`)
3701
+ .option("--json", "Print machine-readable JSON")
3702
+ .action((name, opts) => wrap(() => runBotSwitchAccount(name, opts))());
3703
+ bot
3704
+ .command("eb [name]")
3705
+ .description("Executive bot (EB): the main personal bot that builds your Daily Brief, extracts signals, runs the daily hot-channel sync and asks your decisions. With no name, show which bot it is and how that was decided; with a name, make that personal bot the Executive bot (its jobs move on the bots' next start)")
3706
+ .option("--json", "Print machine-readable JSON")
3707
+ .action((name, opts) => wrap(() => runBotEb(name, opts))());
3446
3708
  bot
3447
3709
  .command("login <name>")
3448
3710
  .description("Give the bot a model login of its own, so it does not use yours: runs the runtime's own sign-in into ~/.hq/bots/<name>/auth/<runtime>")
@@ -37,6 +37,13 @@ export type GatedSyncCommand = "push" | "pull" | "now";
37
37
  export declare function isCloudOff(home?: string): boolean;
38
38
  /** True when `company` (a slug) is a company vault whose switch is off. */
39
39
  export declare function isCompanyVaultOff(switches: VaultSyncSwitches, company: string): boolean;
40
+ export interface EngineOwnedVaults {
41
+ personal: boolean;
42
+ companies: ReadonlySet<string>;
43
+ uidSlugs: ReadonlyMap<string, string>;
44
+ }
45
+ export declare const NO_ENGINE_VAULTS: EngineOwnedVaults;
46
+ export declare function readEngineOwnedVaults(home?: string): EngineOwnedVaults;
40
47
  /**
41
48
  * The refusal text when every vault is off. The first line keeps the phrase
42
49
  * "refused immediately": `handoff-sync-prefetch` (shell and native) reports
@@ -93,7 +100,7 @@ export declare function resolveVaultRef(ref: string, hqRoot: string | undefined)
93
100
  * With `--creds-from-stdin` and no `--company`, the target is unknown until
94
101
  * stdin is parsed; {@link refusalForEntity} checks it then.
95
102
  */
96
- export declare function refusalFor(command: GatedSyncCommand, selection: SyncSelection, switches: VaultSyncSwitches): VaultRefusal | null;
103
+ export declare function refusalFor(command: GatedSyncCommand, selection: SyncSelection, switches: VaultSyncSwitches, engine?: EngineOwnedVaults): VaultRefusal | null;
97
104
  /**
98
105
  * The refusal for a pre-vended EntityContext read from stdin. A `prs_*` uid
99
106
  * is the personal vault; otherwise the slug (or the uid, through the
@@ -102,7 +109,7 @@ export declare function refusalFor(command: GatedSyncCommand, selection: SyncSel
102
109
  export declare function refusalForEntity(command: GatedSyncCommand, entity: {
103
110
  uid?: unknown;
104
111
  slug?: unknown;
105
- }, hqRoot: string | undefined, switches: VaultSyncSwitches): VaultRefusal | null;
112
+ }, hqRoot: string | undefined, switches: VaultSyncSwitches, engine?: EngineOwnedVaults): VaultRefusal | null;
106
113
  /** The vaults an `--all` run leaves out. */
107
114
  export declare function vaultSkips(selection: SyncSelection, switches: VaultSyncSwitches): VaultSkips;
108
115
  /** Thrown after stdin is parsed when its target vault is off. */