@indigoai-us/hq-cli 5.345.203 → 5.345.205

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 (95) hide show
  1. package/CHANGELOG.md +34 -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 +308 -41
  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/cloud.d.ts +14 -2
  9. package/dist/commands/cloud.js +25 -16
  10. package/dist/commands/feedback.d.ts +26 -0
  11. package/dist/commands/feedback.js +91 -5
  12. package/dist/commands/install-global.d.ts +3 -1
  13. package/dist/commands/install-global.js +15 -4
  14. package/dist/commands/lanes.d.ts +2 -0
  15. package/dist/commands/lanes.js +9 -3
  16. package/dist/commands/mcp-serve.d.ts +5 -2
  17. package/dist/commands/mcp-serve.js +45 -3
  18. package/dist/commands/mcp-status.d.ts +3 -1
  19. package/dist/commands/mcp-status.js +24 -14
  20. package/dist/commands/secrets.js +11 -1
  21. package/dist/commands/sources.js +10 -15
  22. package/dist/commands/sync-core.js +2 -0
  23. package/dist/index.js +7 -2
  24. package/dist/lib/bot/claude-login.d.ts +7 -1
  25. package/dist/lib/bot/claude-login.js +56 -16
  26. package/dist/lib/bot/executive-settings.d.ts +13 -0
  27. package/dist/lib/bot/executive-settings.js +20 -17
  28. package/dist/lib/bot/executive-sync.d.ts +12 -0
  29. package/dist/lib/bot/executive-sync.js +36 -0
  30. package/dist/lib/bot/executive.d.ts +51 -0
  31. package/dist/lib/bot/executive.js +144 -0
  32. package/dist/lib/bot/fleet-cron.d.ts +7 -0
  33. package/dist/lib/bot/fleet-cron.js +2 -1
  34. package/dist/lib/bot/jobs/executive-handover.d.ts +6 -0
  35. package/dist/lib/bot/jobs/executive-handover.js +33 -0
  36. package/dist/lib/bot/jobs/hot-signal-sync.d.ts +22 -0
  37. package/dist/lib/bot/jobs/hot-signal-sync.js +47 -0
  38. package/dist/lib/bot/listed-running.d.ts +16 -0
  39. package/dist/lib/bot/listed-running.js +16 -0
  40. package/dist/lib/bot/pending-switch.d.ts +51 -0
  41. package/dist/lib/bot/pending-switch.js +103 -0
  42. package/dist/lib/bot/run.js +27 -3
  43. package/dist/lib/bot/runtime-failure.js +19 -3
  44. package/dist/lib/bot/status.d.ts +20 -0
  45. package/dist/lib/capacity/collectors/claude-oauth.d.ts +53 -5
  46. package/dist/lib/capacity/collectors/claude-oauth.js +251 -71
  47. package/dist/lib/company-skill-wrapper.js +29 -0
  48. package/dist/lib/daemon/catalog.js +2 -2
  49. package/dist/lib/daemon/hq-child-bootstrap.mjs +197 -2
  50. package/dist/lib/daemon/resolver.d.ts +14 -0
  51. package/dist/lib/daemon/resolver.js +96 -0
  52. package/dist/lib/daemon/run.d.ts +11 -0
  53. package/dist/lib/daemon/run.js +60 -8
  54. package/dist/lib/daemon/server.d.ts +2 -9
  55. package/dist/lib/daemon/server.js +3 -89
  56. package/dist/lib/doctor/checks/claude-wiring.js +41 -0
  57. package/dist/lib/doctor/checks/sync-health.d.ts +8 -0
  58. package/dist/lib/doctor/checks/sync-health.js +34 -2
  59. package/dist/lib/doctor/duplicate-hook-registrations.d.ts +34 -0
  60. package/dist/lib/doctor/duplicate-hook-registrations.js +130 -0
  61. package/dist/lib/doctor/fix/apply.js +79 -3
  62. package/dist/lib/doctor/fix/remediation.d.ts +1 -1
  63. package/dist/lib/doctor/fix/remediation.js +15 -0
  64. package/dist/lib/doctor/types.d.ts +1 -1
  65. package/dist/lib/doctor/types.js +1 -0
  66. package/dist/lib/lanes/config.js +13 -0
  67. package/dist/lib/lanes/throttle.d.ts +12 -1
  68. package/dist/lib/lanes/throttle.js +27 -8
  69. package/dist/lib/lanes/types.d.ts +5 -0
  70. package/dist/lib/mcp/local-native-tools.d.ts +40 -0
  71. package/dist/lib/mcp/local-native-tools.js +111 -0
  72. package/dist/lib/mcp/tools.d.ts +2 -0
  73. package/dist/lib/mcp/tools.js +2 -0
  74. package/dist/lib/signals/steps/extract.d.ts +111 -5
  75. package/dist/lib/signals/steps/extract.js +524 -55
  76. package/dist/lib/sync-core/engine-home.d.ts +2 -1
  77. package/dist/lib/sync-core/engine-home.js +25 -8
  78. package/dist/lib/sync-core/reconcile.d.ts +3 -1
  79. package/dist/lib/sync-core/reconcile.js +21 -8
  80. package/dist/lib/sync-core/release.d.ts +14 -5
  81. package/dist/lib/sync-core/release.js +58 -14
  82. package/dist/sentry-init.js +6 -0
  83. package/dist/utils/cli-network-lifecycle.d.ts +11 -1
  84. package/dist/utils/cli-network-lifecycle.js +36 -2
  85. package/dist/utils/daemon-helper-lifetime.d.ts +39 -0
  86. package/dist/utils/daemon-helper-lifetime.js +209 -0
  87. package/dist/utils/daemon-helper-markers.d.ts +24 -0
  88. package/dist/utils/daemon-helper-markers.js +53 -0
  89. package/dist/utils/mcp-launcher.d.ts +28 -0
  90. package/dist/utils/mcp-launcher.js +117 -0
  91. package/dist/utils/package-use-lease.d.ts +10 -0
  92. package/dist/utils/package-use-lease.js +31 -0
  93. package/dist/utils/resident-package-preload.js +4 -1
  94. package/docs/anywhere-runtime.md +7 -0
  95. package/package.json +7 -7
package/CHANGELOG.md CHANGED
@@ -2,6 +2,40 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [5.345.205] — 2026-11-05
6
+ - Long-lived daemon helpers no longer open a Sentry transport. That covers `hq daemon run`, `hq mesh daemon run`, `hq bot run`, the agent-kit heartbeat and inbox, the outpost heartbeat and session host, and the remote-control hosts, including when the daemon starts them through the child bootstrap. A short daemon job, such as a reconcile pass or search indexing, still reports errors.
7
+ - A daemon child-bootstrap helper now exits when its parent exits or the owner pipe closes, and it stops the command it started, including one that ignores SIGTERM. A Linux handoff still leaves the named services running for the next daemon. On macOS a daemon restart now stops the helpers the daemon launched. stdin left on `/dev/null` is not treated as the parent leaving.
8
+ - Only that direct helper is bound. It clears the one-shot owner and resident markers before it starts another hq command, and it keeps `HQ_DAEMON_UNIT` so the session can still tell it is under the daemon. A detached reindex, or any other short hq command inside the session, keeps running after its launcher exits and still reports errors to Sentry.
9
+ - The sync runner, the sync-core engines, and the outpost heartbeat and session-host runners do not receive the resident mark, the handoff path, or the owner-control fd. An hq command they start keeps Sentry on and keeps running after its launcher exits, including when its stdin pipe closes.
10
+ - `hq doctor` now warns when `.claude/settings.local.json` registers a hook that `.claude/settings.json` already registers for the same event and matcher with identical settings, or repeats one inside a file, since each such hook runs twice (doubled Work Mesh events, extra checkpoint sessions). A local hook with the same command but a different `if`, `timeout`, `async` or `shell` is kept. `hq doctor --fix` removes only the repeated entries from `settings.local.json`, backs the file up first, writes through a temp file and rename, skips the file untouched if it cannot be parsed at that moment, and never edits `settings.json`. A stale or never-synced journal for a vault switched off in Settings > Sync now reports "off by choice" (NA, no fix offered) instead of a WARN with a `hq sync pull` autofix the sync gate refuses (feedback a73db922).
11
+ - The Executive bot (EB): one personal local bot per computer is the main bot that builds your Daily Brief, extracts signals, runs the daily hot-channel sync, rides meetings and asks your decisions. `hq bot eb` shows which bot it is and how that was decided; `hq bot eb <name>` chooses a personal bot (a company bot is refused); `--json` on both. The choice lives in `~/.hq/executive.json` (`{"bot":"<name>","setAt":"<ISO>"}`, 0600, written atomically by the CLI). With no choice, or a chosen bot that is no longer here, the Executive bot is the personal bot created first on the computer (the setup bot on a fresh install; after it is removed, the next-oldest personal bot) instead of the literal "setup". `hq bot list --json` carries `executive` per bot and a top-level `executiveBot: {name, source}`; `hq bot list` marks it "(executive)"; `hq bot status --json` keeps `executive.is_executive`. The Executive bot is preferred for daily hot-signal-sync jobs (jobs.json and the HQ Fleet Runtime); other personal bots keep syncing each company until the Executive has a replacement job for it. A stopped Executive bot does not count as that replacement just because a previous run left the job in its jobs.json: `hq bot list` has to show it running. An enabled HQ Fleet job for the company still counts while the local process is stopped. Company bots retain their own sync. Only the Executive bot registers the meeting rider and signal-to-lane jobs: when the choice changes, the new Executive bot adds them on its next start and the previous one removes its copies (and their registration markers) on its next start, logging one line. Signal extraction runs under the Executive bot's runtime, and `hq sources schedule --at` registers the daily sync on the Executive bot.
12
+ - New `hq bot switch-account <name> --runtime <claude|codex|grok>` moves an existing local bot onto the account your own sign-in for that provider now uses (the same provider or another one), keeping its HQ identity, worker folder, memory, DM history and jobs. It checks the new setup with one test turn first, clears the old account's usage and sign-in state, starts the bot again even when it was stopped, and rolls everything back if the bot does not come back. The desktop app's Switch account button runs it.
13
+ - `hq bot list --json` and `hq bot status --json` now report `brainUsage` (`ok` or `exhausted`, with the reset time when the tool said it). A bot whose account ran out of plan usage records it on the failed turn, keeps it across restarts, and clears it on the next turn that works or on `hq bot switch-account`. `hq bot status` prints an out-of-usage line with the switch command.
14
+ - `hq bot switch-account` also works for bots on the HQ Fleet Runtime, through the Fleet sign-in (`hq bot auth`), so a legacy bot that moved to Fleet keeps its Switch account. A model-CLI switch writes a journal before it changes anything; if the switch is cut off (closed terminal, the desktop's time limit), the next `hq bot start`, `status` or `list` puts the bot back on its old account, or keeps the new one when the bot was already up on it.
15
+ - A rate limit ("You've hit your rate limit", "You've reached your API rate limit") or a conversation length limit no longer counts as out of usage.
16
+ - `hq feedback bug` now prints the server's update message cleanly when the install is behind the latest release, and gains `--file-anyway` to file the report regardless.
17
+ - Fixture privacy checks now accept synthetic email addresses on reserved test domains (example.com/.net/.org, .test, .example, .invalid, .localhost, localhost.localdomain), so the scope-authorizer parity fixture no longer fails CI. Other addresses are still rejected.
18
+ - Keep drive-shaped policy gate paths relative to the HQ root on Unix and share Windows absolute-path classification across native guards.
19
+ - Match the Glob guard’s deterministic stderr ordering when pipeline diagnostics overlap, preserving exact output bytes and updating the pinned Bash reference.
20
+ - Make command-guard parity tests use the same fixed flag snapshot on both sides, retaining real timeout coverage and removing retry-based flake handling.
21
+ - `hq lanes create --no-story <reason>` now works without `--project` (the lane uses project `standing`), so `conduct-standing.sh send` no longer fails with "--project is required" (feedback 01e64023).
22
+ - The `hq` MCP connector's `hq_journal_append`, `hq_resolve_company` and `hq_policy_check` tools now work when the HQ daemon (hqd) is not running, for example in the desktop app when it does not host hqd. `hq mcp serve` answers them itself with the same company binding, HQ Anywhere check and policy check that hqd applies, instead of returning `hqd_unreachable`. It answers locally only when no daemon is listening, so a slow or failing daemon never gets a repeated journal write. `hq_run_worker` and the hosted HQ tools still need hqd. (feedback 31380021)
23
+ - Fix the hq MCP registration pinning a version-specific pnpm store path (feedback fa48b458). `hq install --global` now registers the absolute node binary plus a stable, unversioned entry path of the running CLI (for pnpm, the global `node_modules/@indigoai-us/hq-cli` link), so the MCP server keeps running the current CLI after updates and no PATH lookup or shell shim is involved (also correct on Windows). Re-running it repairs a stale entry for Claude and Codex. `hq mcp status` now reports the `hq` server as UNHEALTHY when its entry is pinned to a versioned store path (pnpm, Homebrew Cellar, nvm/fnm/volta, yarn berry cache) that is not the running CLI, and resolves bare commands under the registered PATH.
24
+ - `hq secrets set` and `hq secrets delete` no longer hold the HQ CLI package-use lease while they wait at a terminal prompt, so a forgotten prompt cannot stop the desktop app from updating the CLI. Any process now gives up its package-use lease after 3 hours (change with `HQ_CLI_PACKAGE_USE_MAX_HOLD_MS`) and prints which pid and command kind released it. Previously a waiting prompt held the lease for about four days and blocked every update (feedback_77165502).
25
+ - `hq sync push` now uploads to a company or personal vault that the new sync engine runs on this computer, even though the engine keeps that vault's legacy sync switch off. `/delegate` and other skills that push a folder no longer stop with "Sync is off" for those vaults. Pull and sync-now still follow the legacy switch, and a vault on neither sync is still refused.
26
+ - Add the first native scope-authorizer slice for file and search tools, with hardened capability reads and cross-platform parity tests. The port remains unregistered and rollout stays off.
27
+ - Refuse to bridge a company skill whose canonical SKILL.md is empty, and verify the bridged wrapper reads back the same body, so a skill is never surfaced as an empty placeholder (feedback 3fd22113).
28
+ - Run native injector tests in the hook workflow and full Linux/Windows parity on weekly and release runs. Harden fixture privacy checks for generator sources, private-policy matches and personal identifiers; add SessionStart and unreadable HARD policy coverage. The injector rollout flag remains off.
29
+
30
+ ## [5.345.204] — 2026-11-05
31
+ - `hq bot create`, `hq doctor` and the Claude bot sign-in check now read the macOS Keychain item that Claude Code keeps under your login account name first. A Mac can also hold an older item for the same service under another account (often "unknown", with no Claude login in it). The check used to read that one and said Claude was not signed in right after you signed in from HQ Desktop, so Create bot failed.
32
+ - `hq bot create --json` now includes `brainSignIn` (the same shape `hq bot list`, `status` and `start` report) when it refuses a Claude bot because Claude Code is not signed in, so HQ Desktop can offer its own sign-in instead of "Could not create".
33
+ - `hq capacity` renews expired Claude tokens on a busy Mac again. The refresh check reads the lane list once per collect instead of once per account, runs its two reads together without blocking the mesh daemon, skips the Outpost mirror refresh it does not need, and allows each read 30 seconds instead of 15. On macOS it now reads each running `claude` process's environment, so an open session on the default home no longer blocks the refresh of every other account home. A process whose environment cannot be read still blocks every home, and if the lane read fails no token is refreshed. A session started with `HOME` set to another directory and no `CLAUDE_CONFIG_DIR` now blocks the refresh of that directory's `.claude` home.
34
+ - `hq signals run` now runs the extract step on the Grok CLI when the main local bot runs on Grok, instead of failing every source item with "grok has no restricted tool mode". Each turn runs grok 1.0.70 or newer in `dontAsk` mode with only the file reader allowed, grok's own read-only shell list denied, the MCP bridge, web tools and subagents off, a turn cap, and a per-turn `strict` sandbox profile that can read only the item's channel folder (plus the scripts the candidate command needs) and grants no extra writes. Reads of the Grok login are denied for the literal `~/.grok` spelling, the isolated home and the real home, because Grok matches a `~` path literally before expanding it. An older grok, or a main bot on grok with no grok installed, is never run unrestricted: the step uses Claude Code, then Codex, when that tool is installed and signed in, records the fallback in the run's step detail, and otherwise fails the run naming the grok version it needs. On macOS and Windows the step does not select Grok, because Grok only blocks child-process network on Linux, and falls through the same way. Grok has no terminal tool: HQ validates its returned candidate commands, checks the pinned writer still matches the script it generated, and then invokes that writer with fixed arguments, rejecting shell chaining, substitutions and redirections. The host writes candidates after the turn. The resolved Grok executable is pinned for the probe and turn, and probe caching distinguishes changes to PATH. Its isolated temporary home carries only a private login-file copy, excludes user configuration and hooks, and is removed when the turn ends, and its environment is an allowlist.
35
+ - `hq lanes` admission on macOS no longer holds every new lane while `kern.memorystatus_vm_pressure_level` is warn. A warn level now holds only when the free percentage (`kern.memorystatus_level`) is at or below `throttle.memory_warn_min_free_percent` (default 20, a number from 0 to 100); critical still always holds, and `throttle.min_available_mem_mb` still applies. The hold message states this rule.
36
+ - The daemon's new-sync-engine units now plan on Windows. A Windows machine downloads the `windows-x64` or `windows-arm64` zip, installs `hq-syncd.exe` (moving a running copy aside to `hq-syncd.exe.old`), and writes an engine home with no symlinks: the config names the token file and the engine reads `menubar.json` and `work-mesh/` from the daemon's state folder. Windows vaults stay on the current sync, and no engine is downloaded, until `SYNC_CORE_WINDOWS_FULL_RELEASE` names an engine release whose Windows build runs full sync; it is unset in this release. One machine can test a build first by setting `HQ_SYNC_CORE_WINDOWS_FULL_RELEASE` to that release.
37
+ - Show the upload-hold explanation and recovery command in sync status.
38
+
5
39
  ## [5.345.203] — 2026-11-05
6
40
  - Fix Codex capacity routing after plan exhaustion: available credits keep accounts usable at lowest priority, and superseded snapshots or passed resets no longer retain exhausted usage.
7
41
  - Keep company Outpost integration commands on their delegated machine session and allow sharing connections with an `out_*` principal.
@@ -4668,6 +4668,10 @@ export declare const COMMAND_CATALOG: readonly [{
4668
4668
  readonly flags: "--no-logs";
4669
4669
  readonly description: "Do not attach redacted tails of your ~/.hq log files (also: HQ_FEEDBACK_LOGS=0)";
4670
4670
  readonly hidden: false;
4671
+ }, {
4672
+ readonly flags: "--file-anyway";
4673
+ readonly description: "File the report even if this HQ install is behind the latest release (the row is stamped as filed on an outdated client)";
4674
+ readonly hidden: false;
4671
4675
  }];
4672
4676
  readonly subcommands: readonly [];
4673
4677
  }, {
@@ -15871,7 +15875,7 @@ export declare const COMMAND_CATALOG: readonly [{
15871
15875
  readonly hidden: false;
15872
15876
  }, {
15873
15877
  readonly flags: "--project <slug>";
15874
- readonly description: "HQ project slug (executive-bot for --signal)";
15878
+ readonly description: "HQ project slug (executive-bot for --signal; defaults to standing with --no-story)";
15875
15879
  readonly hidden: false;
15876
15880
  }, {
15877
15881
  readonly flags: "--signal <id>";
@@ -19704,6 +19708,52 @@ export declare const COMMAND_CATALOG: readonly [{
19704
19708
  readonly hidden: false;
19705
19709
  }];
19706
19710
  readonly subcommands: readonly [];
19711
+ }, {
19712
+ readonly name: "switch-account";
19713
+ readonly 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)";
19714
+ readonly aliases: readonly [];
19715
+ readonly hidden: false;
19716
+ readonly helpOption: true;
19717
+ readonly helpCommand: false;
19718
+ readonly usage: "[options] <name>";
19719
+ readonly helpText: readonly [];
19720
+ readonly arguments: readonly [{
19721
+ readonly name: "name";
19722
+ readonly required: true;
19723
+ readonly variadic: false;
19724
+ readonly description: "";
19725
+ }];
19726
+ readonly options: readonly [{
19727
+ readonly flags: "--runtime <runtime>";
19728
+ readonly description: "claude|codex|grok";
19729
+ readonly hidden: false;
19730
+ }, {
19731
+ readonly flags: "--json";
19732
+ readonly description: "Print machine-readable JSON";
19733
+ readonly hidden: false;
19734
+ }];
19735
+ readonly subcommands: readonly [];
19736
+ }, {
19737
+ readonly name: "eb";
19738
+ readonly 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)";
19739
+ readonly aliases: readonly [];
19740
+ readonly hidden: false;
19741
+ readonly helpOption: true;
19742
+ readonly helpCommand: false;
19743
+ readonly usage: "[options] [name]";
19744
+ readonly helpText: readonly [];
19745
+ readonly arguments: readonly [{
19746
+ readonly name: "name";
19747
+ readonly required: false;
19748
+ readonly variadic: false;
19749
+ readonly description: "";
19750
+ }];
19751
+ readonly options: readonly [{
19752
+ readonly flags: "--json";
19753
+ readonly description: "Print machine-readable JSON";
19754
+ readonly hidden: false;
19755
+ }];
19756
+ readonly subcommands: readonly [];
19707
19757
  }, {
19708
19758
  readonly name: "login";
19709
19759
  readonly 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>";
@@ -5658,6 +5658,11 @@ export const COMMAND_CATALOG = [
5658
5658
  "flags": "--no-logs",
5659
5659
  "description": "Do not attach redacted tails of your ~/.hq log files (also: HQ_FEEDBACK_LOGS=0)",
5660
5660
  "hidden": false
5661
+ },
5662
+ {
5663
+ "flags": "--file-anyway",
5664
+ "description": "File the report even if this HQ install is behind the latest release (the row is stamped as filed on an outdated client)",
5665
+ "hidden": false
5661
5666
  }
5662
5667
  ],
5663
5668
  "subcommands": []
@@ -19338,7 +19343,7 @@ export const COMMAND_CATALOG = [
19338
19343
  },
19339
19344
  {
19340
19345
  "flags": "--project <slug>",
19341
- "description": "HQ project slug (executive-bot for --signal)",
19346
+ "description": "HQ project slug (executive-bot for --signal; defaults to standing with --no-story)",
19342
19347
  "hidden": false
19343
19348
  },
19344
19349
  {
@@ -24026,6 +24031,63 @@ export const COMMAND_CATALOG = [
24026
24031
  ],
24027
24032
  "subcommands": []
24028
24033
  },
24034
+ {
24035
+ "name": "switch-account",
24036
+ "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)",
24037
+ "aliases": [],
24038
+ "hidden": false,
24039
+ "helpOption": true,
24040
+ "helpCommand": false,
24041
+ "usage": "[options] <name>",
24042
+ "helpText": [],
24043
+ "arguments": [
24044
+ {
24045
+ "name": "name",
24046
+ "required": true,
24047
+ "variadic": false,
24048
+ "description": ""
24049
+ }
24050
+ ],
24051
+ "options": [
24052
+ {
24053
+ "flags": "--runtime <runtime>",
24054
+ "description": "claude|codex|grok",
24055
+ "hidden": false
24056
+ },
24057
+ {
24058
+ "flags": "--json",
24059
+ "description": "Print machine-readable JSON",
24060
+ "hidden": false
24061
+ }
24062
+ ],
24063
+ "subcommands": []
24064
+ },
24065
+ {
24066
+ "name": "eb",
24067
+ "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)",
24068
+ "aliases": [],
24069
+ "hidden": false,
24070
+ "helpOption": true,
24071
+ "helpCommand": false,
24072
+ "usage": "[options] [name]",
24073
+ "helpText": [],
24074
+ "arguments": [
24075
+ {
24076
+ "name": "name",
24077
+ "required": false,
24078
+ "variadic": false,
24079
+ "description": ""
24080
+ }
24081
+ ],
24082
+ "options": [
24083
+ {
24084
+ "flags": "--json",
24085
+ "description": "Print machine-readable JSON",
24086
+ "hidden": false
24087
+ }
24088
+ ],
24089
+ "subcommands": []
24090
+ },
24029
24091
  {
24030
24092
  "name": "login",
24031
24093
  "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>",
@@ -1,5 +1,6 @@
1
1
  import { type LegacyMoveState, type LegacyProviderLoginProbe } from "../lib/bot/legacy-convert.js";
2
2
  import { Command } from "commander";
3
+ import { type ExecutiveBot } from "../lib/bot/executive.js";
3
4
  import { type RuntimeSignInCheck, type RuntimeSignInIssue } from "../lib/bot/runtime-sign-in.js";
4
5
  import { type ClaudeLoginCheck } from "../lib/bot/claude-login.js";
5
6
  import type { BotStatusFile } from "../lib/bot/status.js";
@@ -71,6 +72,12 @@ export interface BotRow {
71
72
  * bot to the HQ Fleet Runtime); null when no sign-in is needed.
72
73
  */
73
74
  brainSignIn: BrainSignIn | null;
75
+ /**
76
+ * Whether the account the bot's brain is signed in with has plan usage left.
77
+ * `exhausted` means turns fail until the plan resets (`resetsAt`, as the tool
78
+ * wrote it, or null) or the bot switches account (`hq bot switch-account`).
79
+ */
80
+ brainUsage: BrainUsage;
74
81
  /** A bot still on its legacy runner: whether and why it moves at its next start. Absent for a Fleet bot. */
75
82
  legacy?: Record<string, unknown>;
76
83
  /**
@@ -91,6 +98,8 @@ export interface BotRow {
91
98
  kind: BotKind;
92
99
  /** Company bots: the companies the bot is a member of (empty for a personal bot). */
93
100
  companies: string[];
101
+ /** This bot is the Executive bot on this computer (hq bot eb). */
102
+ executive: boolean;
94
103
  workerSource: "scaffold" | "worker";
95
104
  workerDir: string;
96
105
  workerId?: string;
@@ -110,6 +119,20 @@ export interface BotRow {
110
119
  kickoff?: string;
111
120
  }
112
121
  export declare function listBotNames(root: string): string[];
122
+ /**
123
+ * How a bot takes part in the daily hot-channel sync. Identity only (never
124
+ * the executive.enabled opt-in):
125
+ * - a company bot, or any bot when there is no personal bot here: the earlier
126
+ * behaviour, each bot syncs its company and one bot per company;
127
+ * - the Executive bot: registers its companies, leaving a company to a company
128
+ * bot that already runs it (other personal bots do not hold it back);
129
+ * - any other personal bot: hands over only companies the Executive already holds.
130
+ */
131
+ export declare function hotSignalSyncRole(name: string, config: BotConfig, executiveBot: ExecutiveBot | null): {
132
+ executive?: boolean;
133
+ executiveCompanies?: string[];
134
+ otherBotDirs: string[];
135
+ };
113
136
  /** Bot-identity token supplier: per-bot creds + per-bot token cache dir. */
114
137
  export declare function botTokenSupplier(dir: string): () => Promise<string>;
115
138
  /**
@@ -135,6 +158,13 @@ export interface BrainSignIn {
135
158
  * what this computer knows: the bot's settings, its last reported failure or
136
159
  * sign-in check, and (legacy) why it has not moved to the HQ Fleet Runtime.
137
160
  */
161
+ export interface BrainUsage {
162
+ state: "ok" | "exhausted";
163
+ provider: string;
164
+ resetsAt: string | null;
165
+ since: string | null;
166
+ }
167
+ export declare function brainUsageFor(config: BotConfig, status: BotStatusFile | null): BrainUsage;
138
168
  export declare function brainSignInFor(name: string, config: BotConfig, status: BotStatusFile | null, legacy: LegacyMoveState | null): BrainSignIn | null;
139
169
  /** Spawn `hq bot run <name>` detached (no launchd). */
140
170
  export declare function spawnDetachedRun(name: string, dir: string): number;
@@ -261,6 +291,13 @@ export interface BotSetOptions {
261
291
  }
262
292
  export interface BotSetDeps {
263
293
  probe?: typeof probeBotRuntime;
294
+ /** Test seam: the Fleet sign-in (`hq bot auth`) switch-account runs for a Fleet bot. */
295
+ fleetAuth?: (name: string, opts: {
296
+ provider: string;
297
+ json?: boolean;
298
+ }) => Promise<{
299
+ running: boolean;
300
+ } | void>;
264
301
  /** Test seam: stop and start the bot process. */
265
302
  lifecycle?: {
266
303
  isRunning: (dir: string) => boolean;
@@ -269,6 +306,25 @@ export interface BotSetDeps {
269
306
  };
270
307
  }
271
308
  export declare function runBotSet(nameArg: string, opts: BotSetOptions, deps?: BotSetDeps): Promise<void>;
309
+ /** switch-account's test turn: short, so probe, stop, start and a rollback fit the desktop's 5-minute budget. */
310
+ export declare const SWITCH_ACCOUNT_PROBE_TIMEOUT_MS = 60000;
311
+ export interface BotSwitchAccountOptions {
312
+ /** The runtime the owner just signed in to (the Create-bot account switcher's runtime). */
313
+ runtime: string;
314
+ json?: boolean;
315
+ }
316
+ /**
317
+ * `hq bot switch-account <name> --runtime <runtime>`: move an existing local
318
+ * bot onto the account the owner's own sign-in for `runtime` now uses (the
319
+ * desktop app's Switch account signs that in first, with the same switcher as
320
+ * New bot). Same provider or a different one. The bot keeps its HQ identity,
321
+ * worker folder, memory, DM history and jobs: only its runtime and login
322
+ * settings change, the new setup is probed first (nothing changes when it
323
+ * cannot answer), the old sign-in and usage state are cleared, and the bot is
324
+ * started again even when it was stopped because it was signed out or out of
325
+ * usage. A bot that does not come back is rolled back.
326
+ */
327
+ export declare function runBotSwitchAccount(nameArg: string, opts: BotSwitchAccountOptions, deps?: BotSetDeps): Promise<void>;
272
328
  /** `hq bot login <name>`: sign the bot in with a login of its own. */
273
329
  export declare function runBotLogin(nameArg: string, opts: {
274
330
  runtime?: string;
@@ -307,6 +363,17 @@ export declare function runBotRestart(nameArg: string, opts?: {
307
363
  json?: boolean;
308
364
  output?: "json" | "text" | "silent";
309
365
  }): Promise<void>;
366
+ export declare function runBotAuth(nameArg: string, opts: {
367
+ provider: string;
368
+ model?: string;
369
+ apiKey?: boolean;
370
+ baseUrl?: string;
371
+ transport?: "chat_completions" | "anthropic_messages" | "codex_responses";
372
+ browser?: boolean;
373
+ json?: boolean;
374
+ }): Promise<{
375
+ running: boolean;
376
+ }>;
310
377
  /**
311
378
  * The one bot the caller means. Matches the local folder name, the cloud slug,
312
379
  * the display name, or the agt_ uid; an ambiguous name is refused rather than