@indigoai-us/hq-cli 5.345.215-beta.0 → 5.345.215

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 (124) hide show
  1. package/CHANGELOG.md +65 -1
  2. package/assets/scaffold/core/scripts/hq-delegate-verify.sh +5 -2
  3. package/dist/command-catalog.generated.d.ts +46 -6
  4. package/dist/command-catalog.generated.js +53 -6
  5. package/dist/commands/bot.js +64 -6
  6. package/dist/commands/capacity.d.ts +4 -1
  7. package/dist/commands/capacity.js +46 -10
  8. package/dist/commands/cloud.js +1 -1
  9. package/dist/commands/core-delegate-w1b.js +15 -1
  10. package/dist/commands/core-policy.js +67 -8
  11. package/dist/commands/daemon.js +5 -0
  12. package/dist/commands/files-browse.d.ts +11 -4
  13. package/dist/commands/files-browse.js +21 -4
  14. package/dist/commands/files.d.ts +1 -1
  15. package/dist/commands/files.js +25 -11
  16. package/dist/commands/integrations-auth-rules.d.ts +27 -0
  17. package/dist/commands/integrations-auth-rules.js +79 -0
  18. package/dist/commands/integrations-import.js +124 -12
  19. package/dist/commands/lanes.js +2 -2
  20. package/dist/commands/mesh.d.ts +2 -0
  21. package/dist/commands/mesh.js +60 -35
  22. package/dist/commands/sync-held.js +5 -2
  23. package/dist/lazy-commands.js +3 -5
  24. package/dist/lib/bot/fleet-cron.d.ts +8 -0
  25. package/dist/lib/bot/fleet-cron.js +35 -3
  26. package/dist/lib/bot/fleet-daemon.d.ts +46 -0
  27. package/dist/lib/bot/fleet-daemon.js +99 -1
  28. package/dist/lib/bot/probe.js +7 -1
  29. package/dist/lib/bot/run.js +20 -1
  30. package/dist/lib/bot/runtime/codex.js +1 -1
  31. package/dist/lib/bot/runtime/grok-acp.d.ts +5 -1
  32. package/dist/lib/bot/runtime/grok-acp.js +6 -3
  33. package/dist/lib/bot/runtime/index.js +19 -9
  34. package/dist/lib/bot/runtime/messages-stream.js +2 -2
  35. package/dist/lib/bot/runtime/types.d.ts +15 -0
  36. package/dist/lib/bot/runtime/types.js +9 -0
  37. package/dist/lib/bot/runtime-failure.d.ts +23 -0
  38. package/dist/lib/bot/runtime-failure.js +43 -1
  39. package/dist/lib/capacity/accounts.d.ts +8 -0
  40. package/dist/lib/capacity/accounts.js +19 -0
  41. package/dist/lib/capacity/available.d.ts +154 -0
  42. package/dist/lib/capacity/available.js +905 -0
  43. package/dist/lib/capacity/codex-availability.d.ts +14 -1
  44. package/dist/lib/capacity/codex-availability.js +26 -1
  45. package/dist/lib/capacity/collectors/claude-oauth.d.ts +29 -2
  46. package/dist/lib/capacity/collectors/claude-oauth.js +104 -7
  47. package/dist/lib/capacity/collectors/codex.js +10 -7
  48. package/dist/lib/capacity/ledger.d.ts +37 -1
  49. package/dist/lib/capacity/ledger.js +207 -30
  50. package/dist/lib/capacity/project.d.ts +26 -0
  51. package/dist/lib/capacity/project.js +137 -8
  52. package/dist/lib/capacity/refusal-rows.d.ts +31 -0
  53. package/dist/lib/capacity/refusal-rows.js +61 -0
  54. package/dist/lib/capacity/refusal.d.ts +53 -2
  55. package/dist/lib/capacity/refusal.js +284 -65
  56. package/dist/lib/capacity/route.js +46 -11
  57. package/dist/lib/capacity/widget.d.ts +12 -1
  58. package/dist/lib/capacity/widget.js +91 -3
  59. package/dist/lib/daemon/resolver.d.ts +2 -0
  60. package/dist/lib/daemon/resolver.js +3 -0
  61. package/dist/lib/daemon/run.d.ts +9 -0
  62. package/dist/lib/daemon/run.js +54 -1
  63. package/dist/lib/daemon/server.d.ts +2 -0
  64. package/dist/lib/daemon/server.js +10 -1
  65. package/dist/lib/daemon/tcc-eperm.d.ts +153 -0
  66. package/dist/lib/daemon/tcc-eperm.js +310 -0
  67. package/dist/lib/delivery/admission.d.ts +86 -0
  68. package/dist/lib/delivery/admission.js +148 -0
  69. package/dist/lib/delivery/artifacts.d.ts +7 -1
  70. package/dist/lib/delivery/artifacts.js +29 -10
  71. package/dist/lib/delivery/attempt-id.d.ts +13 -0
  72. package/dist/lib/delivery/attempt-id.js +16 -0
  73. package/dist/lib/delivery/disposable-target.d.ts +42 -0
  74. package/dist/lib/delivery/disposable-target.js +111 -0
  75. package/dist/lib/delivery/effects.d.ts +136 -0
  76. package/dist/lib/delivery/effects.js +541 -0
  77. package/dist/lib/delivery/enrollment.d.ts +21 -17
  78. package/dist/lib/delivery/enrollment.js +83 -5
  79. package/dist/lib/delivery/escalations.d.ts +51 -0
  80. package/dist/lib/delivery/escalations.js +60 -0
  81. package/dist/lib/delivery/lease.d.ts +80 -0
  82. package/dist/lib/delivery/lease.js +134 -0
  83. package/dist/lib/delivery/migrations.d.ts +120 -4
  84. package/dist/lib/delivery/migrations.js +215 -15
  85. package/dist/lib/delivery/mqtt.d.ts +2 -0
  86. package/dist/lib/delivery/mqtt.js +7 -0
  87. package/dist/lib/delivery/reconciler.d.ts +65 -1
  88. package/dist/lib/delivery/reconciler.js +224 -13
  89. package/dist/lib/delivery/rpc/client.d.ts +22 -0
  90. package/dist/lib/delivery/rpc/client.js +159 -0
  91. package/dist/lib/delivery/rpc/port.d.ts +40 -0
  92. package/dist/lib/delivery/rpc/port.js +16 -0
  93. package/dist/lib/delivery/rpc/server.d.ts +30 -0
  94. package/dist/lib/delivery/rpc/server.js +205 -0
  95. package/dist/lib/delivery/rpc/wire.d.ts +85 -0
  96. package/dist/lib/delivery/rpc/wire.js +143 -0
  97. package/dist/lib/delivery/store.d.ts +2 -0
  98. package/dist/lib/delivery/store.js +4 -0
  99. package/dist/lib/delivery/windows-service-install.d.ts +262 -0
  100. package/dist/lib/delivery/windows-service-install.js +892 -0
  101. package/dist/lib/delivery/workers/macos.d.ts +16 -1
  102. package/dist/lib/delivery/workers/macos.js +54 -12
  103. package/dist/lib/delivery/workers/windows-service-live.d.ts +121 -0
  104. package/dist/lib/delivery/workers/windows-service-live.js +711 -0
  105. package/dist/lib/delivery/workers/windows-service-runner.d.ts +33 -0
  106. package/dist/lib/delivery/workers/windows-service-runner.js +82 -0
  107. package/dist/lib/delivery/workers/windows-service.d.ts +140 -0
  108. package/dist/lib/delivery/workers/windows-service.js +584 -0
  109. package/dist/lib/delivery/workers/windows.d.ts +32 -22
  110. package/dist/lib/delivery/workers/windows.js +50 -64
  111. package/dist/lib/hot-channels/adapters/meetings.d.ts +15 -0
  112. package/dist/lib/hot-channels/adapters/meetings.js +36 -3
  113. package/dist/lib/hot-channels/signals-pass.d.ts +10 -0
  114. package/dist/lib/hot-channels/signals-pass.js +71 -2
  115. package/dist/lib/hot-channels/signals-redo.js +10 -2
  116. package/dist/lib/lanes/watcher.js +35 -0
  117. package/dist/lib/signals/steps/extract.js +40 -4
  118. package/dist/schemas/hq-available-ai.v1.schema.json +76 -0
  119. package/dist/utils/catalog-runtime-paths.d.ts +34 -0
  120. package/dist/utils/catalog-runtime-paths.js +53 -0
  121. package/dist/utils/files-browse-acl.js +1 -1
  122. package/package.json +7 -7
  123. package/dist/lib/delivery/workers/windows-boundary.d.ts +0 -453
  124. package/dist/lib/delivery/workers/windows-boundary.js +0 -693
package/CHANGELOG.md CHANGED
@@ -2,15 +2,34 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
- ## [5.345.215-beta.0] — 2026-11-11
5
+ ## [5.345.215] — 2026-11-12
6
+
7
+ - `hq sync held` and the `hq sync push` hold notice no longer say another account was signed in. A first install on a new computer also holds uploads until `hq sync release-held`; that used to read as a security scare (feedback_baa82c96). The hold itself is unchanged.
8
+
6
9
  - `hq login`, `hq auth login` and the automatic browser sign-in now show the provider's account chooser, so a person with several Google accounts picks one instead of being signed in with whichever the browser used last. Set `HQ_COGNITO_PROMPT=` (empty) to turn this off. Token refresh is unchanged.
7
10
  - When a company you belonged to was deleted, `hq whoami`, `hq sources entities`, `hq sync mode --show` and the "No active company memberships found" error now say so on stderr, with the date and how to get it back.
8
11
  - New `hq company restore <company>` restores a company you deleted in the last 30 days, by name, slug or company ID. A restored company comes back without its paid plan. `--json` prints the result as JSON.
9
12
  - `hq agents jobs update <agent> <jobId>` (alias `edit`) edits a hosted agent's scheduled job in place: `--prompt` or `--prompt-file`, `--name`, `--cron` (five-field or `cron(...)`/`rate(...)`) or `--at` with a required `--tz`, `--context` / `--clear-context`, `--script-file` / `--clear-script`. Only the options passed change; the job keeps its id and paused/active status, and the change applies from its next run. Owners and admins of the agent's company can use it, the same as pause, resume and cancel. `hq agents jobs delete` is now an alias of `cancel`, which removes a job for good whether it is active or paused. Paused jobs do not count toward an agent's 25 active-job limit. Needs the hq-pro-agents job edit route; an older server answers with a clear "cannot edit jobs yet" line.
13
+ - On a Mac where `hq daemon` runs local bots, `hq bot create`, `start`, `restart`, `adopt`, `restore` and `auth` now check that the daemon is actually running before handing a bot to it. If its login item is installed but the daemon is stopped, the CLI runs `hq daemon start` and waits up to 20 seconds for it. If it still is not running, the command exits non-zero with one plain sentence (and `reason: "daemon-stopped"` under `--json`) instead of reporting a start that nothing would pick up. `hq bot create` stops before HQ makes the bot's identity.
10
14
  - `hq bot switch-account <name> --runtime <claude|codex> --sign-in` signs the bot in with a login of its own first. It runs a browser sign-in into the bot's own folder (`~/.hq/bots/<name>/auth/<runtime>`), the same login `hq bot login` makes, with no terminal needed. Your own Claude Code or Codex sign-in, and every other bot's login, stay as they are. The desktop app's Switch account uses it.
11
15
  - `hq bot switch-account --sign-in` keeps the bot's previous own login until the new browser sign-in finishes. It is not signed out first. A failed, cancelled, or killed sign-in puts that login back; the next attempt does not delete it.
16
+ - `hq capacity` and the `/capacity` card show each Claude account's banked limit resets, including Fable-only resets. An account at 100% that still holds a reset reads "used up, reset banked" instead of plain "used up", and a "Resets banked" row lists each reset, what it clears, and when it expires. The collector asks the usage endpoint for the reset block (`cedar_ember=1`) and names the installed Claude Code version in its user agent, because the server returns grants only to a Claude Code client. Banked resets are kept per account; before this the ledger kept one provider-level record, so only the last account read would have shown its resets.
17
+ - `hq capacity`, `hq capacity route` and `hq lanes create --account auto` now give one answer for one login. Codex readings from both collectors use one account id per home, an existing ledger is migrated when `now.json` is rebuilt with no event deleted, and accounts on one home or one Claude identity are merged in `now.json`. (find-available-ai US-002)
18
+ - `hq capacity available --json` and `~/.hq/capacity/available.json` give one token-free `hq-available-ai.v1` answer to what AI can run now. A stale view starts one background read, `--fresh` waits at most 3 seconds, and with no ledger the rows come from each tool's own status command. A process that cannot find the HQ root, or whose `HQ_ROOT` or `CLAUDE_PROJECT_DIR` names a folder that is neither an HQ tree nor holds a lanes config, keeps the last `available.json` rather than writing one without the registry's accounts, and logs why. (find-available-ai US-003)
19
+ - A real usage-limit refusal on a model-CLI bot's turn, `hq bot probe` or a lane now holds that account for the window the refusal names (session, weekly, one model, or no window), and a 429 shows as rate limited with the plan figure kept. A refusal that names no window gets the provider's short hold first, and its reset only on a repeat. A hold ends at its reset, or sooner when a newer reading of that limit is below 100%, and then the account is back on its last real reading. Nothing is recorded when the account cannot be identified. Only the error a tool reports in its own output (including the error Grok returns over its Windows protocol) records a refusal, never raw stderr, which can carry the model's own text. On `hq capacity ingest refusal`, `--account` is required unless `--limit-id` names a limit exactly one account has; a limit id several accounts share is a usage error, and a provider with one account is not a default. The default hold for a refusal that names no window is now 15 minutes, shortened from 1 hour. (find-available-ai US-004)
20
+ - On desktops where `hq daemon` runs the mesh service, restart the daemon after upgrading (`hq daemon restart`) so the already-running mesh service picks up `HQ_ROOT` and expired Claude tokens on the capacity card renew again.
12
21
  - `hq integrations connect --client-secret-stdin` (and `--token-stdin`) now print a one-line prompt to stderr and read with input hidden when stdin is a terminal, so the command no longer looks frozen while it waits for the secret. Piped input is unchanged and prints nothing extra (feedback_86a49a5c).
22
+ - `pnpm run build` now passes on Windows. Its command catalog check failed there for two reasons: a checkout with `core.autocrlf=true` has CRLF line endings, and a path in one option's help text was recorded with backslashes. The check now ignores CRLF, the catalog always records the path after `<runtime-home>` or `<runtime-path>` with `/`, and help text shows that path with the platform's own separator. Help text on macOS and Linux is unchanged.
13
23
  - `hq integrations connect --auth-header` now applies the same header-name rule as hq-pro: at most 64 characters, and not a header HQ refuses to put a key in (Host, Content-Length, Expect, Content-Encoding, WWW-Authenticate, Cookie, Set-Cookie, Forwarded, Via, X-Real-IP, True-Client-IP, CF-Connecting-IP, X-Original-URL, hop-by-hop headers, HTTP2-Settings, Proxy-Authorization, Proxy-Authenticate, the headers HQ's MCP client sets itself, and any Proxy-* or X-Forwarded-* header). Authorization is still allowed. A pasted key with an inner space is now refused before sending, as hq-pro refuses it for a Bearer or custom-header key. Before, both were sent and came back as a 400 from hq-pro. (feedback_950d8abe)
24
+ - The native credential guard answers hq-core 16.0.46 again. It pins the released guard (25f5507c), hq-core-staging main after #1926 (0555a4bd) and hq-core-staging #1887 (72296f01), and picks the behavior by script hash: the Unicode fold runs only for 72296f01. In a UTF-8 locale it now also matches U+212A and U+0130 as `k` and `i` under nocasematch, as bash does. The 16.0.46 credential guard handback is removed from `core-pins.json`.
25
+ - The native credential guard also answers hq-core-staging main after #1927 (30015cbc), with the Unicode fold on (#1887 is merged there). The pins for 16.0.46 (25f5507c), #1926 (0555a4bd) and #1887 (72296f01) stay.
26
+ - HQ Native delivery: storing a build artifact no longer fails on Windows with `STORE_IO ... EPERM: operation not permitted, fsync`. Windows cannot fsync a directory, so the artifact store now skips that step there, as the rest of the CLI already does. Other platforms still fsync the blob directory and still refuse when that fails.
27
+ - HQ Native delivery on Windows: the service runner's spool writes, including the heartbeat written every 200 ms, now retry for up to 75 ms when Windows refuses to replace a file another process has open (EPERM, EACCES or EBUSY). A write that still fails removes its temporary file, so failed writes no longer leave `.tmp` files in the spool. macOS and Linux still rename once.
28
+ - A process whose `HQ_ROOT` or `CLAUDE_PROJECT_DIR` is a folder inside an HQ tree (a session opened in `repos/...` or `companies/<slug>`) now refreshes `~/.hq/capacity/available.json` from the account registry of the nearest enclosing folder that has a lanes config (`personal/lanes/config.json`), instead of always keeping the last file. A copy of the hq-core template inside HQ (such as `repos/public/hq-core` or an hq-core-staging worktree) has the same folders as an HQ tree but no lanes config, so it no longer stops the search. Before, a root at or below such a copy read an empty registry and wrote available.json as fresh, with a default login the registry turned off named best and the registry's other accounts missing. When no folder on the way has a lanes config, the outermost HQ tree is used, so a fresh install still gets the default logins. A folder with no enclosing HQ tree still keeps the last file, and an explicit `HQ_ROOT` that has a lanes config is still used as given. (find-available-ai follow-up)
29
+ - On Windows, a Grok bot turn over ACP that Grok refuses (for example a usage limit) is now reported as that refusal even when the Grok process exits with code 0 while a process it started still holds its output open. Before, that turn ended as "grok returned non-JSON output" with no reported error, so the refusal was not recorded. (find-available-ai follow-up)
30
+ - `hq files browse` no longer labels files you created as "creator-only" when teammates can read them. When your creator grant and a team, person, group or open grant both cover a file, the shared grant now wins whatever order the server returns them in. The creator label now reads "creator access (you created it; others may also have access)", because browse sees only your own grants. The JSON `aclSource` value is still `creator` (feedback 10ed97a5).
31
+ - The `/delegate` verifier (the bundled `hq-delegate-verify.sh` and its native port) now accepts both the old and the new creator label. A delegation no longer fails its file check, and its pickup DM is no longer blocked, when the installed hq-cli and the verifier print different creator labels (feedback 10ed97a5).
32
+ - `hq files purge` now tells the truth about a scheduled purge. hq-pro answers with `status: "pending_purge"`, `purgeScheduled: true` and `purged: false`; the CLI used to miss those fields and print that the version was deleted immediately and could not be cancelled. It now says the version is scheduled for deletion on the purge date, stays listed and readable until then, and can be cancelled with `hq files purge --cancel`. `--cancel` itself now sends the `cancel_purge` action hq-pro expects and accepts its `purgeCancelled` / `status: "kept"` reply.
14
33
  - `/capacity` no longer shows Grok as signed out after its six-hour sign-in token lapses. When the stored token has expired and no `grok` process is running, HQ renews it with the stored refresh token and writes it back to `~/.grok/auth.json`. A token that cannot be renewed shows as expired, and a revoked sign-in shows as "signed out: sign-in revoked".
15
34
  - `hq lanes create --provider claude --outpost primary` from a machine that is not an Outpost now reads that Outpost's Claude account snapshot and can create the lane there. The capacity probe for that explicit target waits the single-lane pickup interval. A local-target create still does not call `primary`.
16
35
  - Setting up the HQ Fleet Runtime is faster. The private Python is now installed while the runtime downloads instead of after it, and its install no longer freezes the progress bar. On a Mac whose bots run under hq daemon, `hq bot create` asks the daemon to start the new bot before it registers the bot's scheduled jobs, so the bot boots while they are registered.
@@ -24,11 +43,56 @@
24
43
  - `hq bot auth <name> --provider claude` on a Fleet bot first checks the Claude Code login on this computer. When it is signed out, it changes nothing and exits 1 with `{ ok: false, provider: "claude", signedIn: false, brainSignIn }`. A successful `hq bot auth --json` now also reports `signedIn: true` and `retried`; `retried` stays false until the runtime can answer the messages it held during the sign-out.
25
44
  - For a Fleet bot whose brain is signed out, `hq bot list --json` reports `runtimeSignIn: { state: "signed-out", runtime, since }` (the tool name: claude, codex or grok) and a `brainSignIn`, read from the runtime's `state/sign-in-needed.json` marker. `hq bot auth` leaves such a running bot alone instead of restarting it, because the bot re-checks its login every 5 s and answers the waiting message itself. It waits up to 20 s for the marker to clear and reports `reloaded: true`, `restarted: false` and `retried: true` once it has.
26
45
  - A Fleet bot's persona now tells it to look up its owner's companies with the hq_companies_list tool, because `hq whoami` does not list companies.
46
+ - The native company Git metadata and env-file guards no longer hand calls back to bash. A Windows bash that is not Git Bash and a hook PATH that cannot be built now get a one-line native block that says what to change. The env-file guard also blocks, instead of handing back, an env-file write it cannot classify: a Git Bash locale that is neither UTF-8 nor single-byte, and, off macOS and Windows, content with characters outside ASCII when the locale (LC_ALL, LC_CTYPE or LANG) is not C or POSIX, because gawk and mawk are not modelled yet.
47
+ - hq-hook: adds a shared check (`crates/hq-hook/src/unmodelled.rs`) that native hook ports run first. It blocks a call (exit 2, one line saying what to change) when the hook environment or input is outside what the ports model: bash option variables (`BASHOPTS`, `SHELLOPTS`, `POSIXLY_CORRECT`), exported bash functions other than the ones hosts set for every login shell (RHEL's `which` wrapper, Environment Modules, Lmod, Spack and scl-utils functions pass), a non-empty `CDPATH` or `GLOBIGNORE`, an `OSTYPE` from the other platform family, an unset or empty `PATH` or a `PATH` entry starting with `~`, non-UTF-8 `HOME`/`HQ_ROOT`/`CLAUDE_PROJECT_DIR`, and input that is not one standard UTF-8 JSON value (NaN or other non-standard numbers, numbers of 1e300 or more, unpaired surrogate escapes, a byte-order mark, NUL bytes, nesting past 100 levels, more than one value). `block-hq-glob` and the scope authorizer used to hand these environments back to bash; they now block them the same way (`block-hq-glob` still answers with `CDPATH` or `GLOBIGNORE` set, since its script runs no `cd` and no glob). Claude Code and Codex do not send any of these, and all hook flags stay off.
48
+ - The bot's daily hot-signal-sync script no longer dies with MODULE_NOT_FOUND after an hq-cli update. It still runs `node <baked dist/index.js>` while that file exists; when a pnpm global hash folder is gone, it runs the stable `~/Library/pnpm/bin/hq` launcher (or `hq` on PATH) instead of the old hash path. (feedback_614121bf)
49
+ - The hook engine supports hq-core 16.0.47. `core-pins.json` lists the release, and the native ports for block-company-git-metadata, block-core-writes, block-plans-dir-during-deep-plan, image-context-guard, block-repo-edits-use-worktree and the policy-enforcement gate accept its `hook-lib.sh` (b971dae4), which changes only code those guards never reach. Its credential guard (30015cbc) and block-hq-glob (925bba9f) were already pinned. inject-policy-on-trigger, block-agent-secrets-reveal, lanes-repo-merge-hold and merged-write-guard-shadow run as bash on 16.0.47 until their new behavior is ported. Every earlier pin stays.
27
50
  - The native `block-hq-glob` port now also answers hq-core-staging's normalizing guard (sha256 925bba9f), which denies a Glob of `<hq>/./`, `<hq>//`, `<hq>/core/..` and other spellings of the HQ root. The engine keeps the hq-core 16.0.46 guard pinned and answers it with its own string comparison, choosing by script hash. The normalizing pin takes effect only once hq-core-staging ships that script.
28
51
  - Adds the HQ Native delivery library under `src/lib/delivery` with its tests. It is not connected to any `hq` command, daemon unit or startup path yet, so nothing changes for users. It contains the delivery contracts, a crash-safe store with versioned migrations and a single-controller lock, attempt reconciliation, worker enrollment and tenant-scoped identity, per-job credential planning, an MQTT outbox and inbox for notifications, a contained macOS worker launcher, signed artifact provenance with promotion, and verified backup and restore with authority transfer. The Windows worker launcher is included and fails closed: it refuses every job unless a boundary service is supplied to it, and this release supplies none. `src/lib/db/sqlite-binding.ts` now exports `isNativeBindingError`, and the delivery tests run as their own vitest project, two files at a time.
52
+ - Adds the Windows worker to the HQ Native delivery library (`src/lib/delivery`). It is not connected to any `hq` command, daemon unit or startup path, so nothing changes for users. Jobs run through a Windows service under its own virtual account, and each job runs inside a Windows Job Object that kills the whole process tree on cancel, on a memory, process-count or CPU-time limit, when the service stops and when the runner is killed. Install and uninstall are bound to one pilot service (`HQNDUS006040`); an unsigned service wrapper is accepted only by its pinned sha256, for that pilot service and root, and only with `--pilot-unsigned-wrapper`. Windows results are untrusted and cannot be promoted. Containment holds against normal and buggy jobs, not a deliberately hostile job, because jobs share the runner's account; a separate job identity is required before Windows runs untrusted third-party code. Uninstall takes two rollbacks with a restart between them. See `docs/delivery-windows-pilot.md`. The earlier boundary-service launcher is removed.
53
+ - Adds deployment admission with fenced effects to the HQ Native delivery library (`src/lib/delivery`). It is not connected to any `hq` command, daemon unit or startup path yet, so nothing changes for users. A deployment needs an exact, verified, promoted release artifact and an explicit company policy that approves the environment. The policy is held in the delivery store, signed, and set only by an authenticated company admin; a worker cannot supply it. Every request records a signed snapshot of the policy, artifact and context, and every refusal records a decision scoped to the company and environment, published to the company's escalation topic. Effects are serialized per environment and carry a fence that the target enforces. A stale or lease-lost publisher is refused, and an unknown outcome must be reconciled against the target before any retry. The in-flight guard has a tunable maximum hold. The delivery store moves to schema v6.
54
+ - Adds the HQ Native delivery gate-one test harness (`test/delivery/gate-one.test.ts` and `test/delivery/gate-one/`). It is test code only: nothing is wired to an `hq` command, daemon unit or startup path, so nothing changes for users. On loopback, it takes a tagged fixture repository through `git archive`, a real build and test run, signed artifacts, a store-held company policy and a fenced deploy, then starts the app from the bytes the deployment target stored and checks that the identity the app serves equals the verified artifact and its required test receipts. The commit stamped into the app and named in its provenance is the one read back from the archive. A runner executes the fault matrix (controller and worker process crashes, broker restart, duplicate and reordered notifications, a stale worker, backup and restore with the old controller still running, cross-company denial) against the real delivery library and records every observation itself. The runner owns the required scenario list, which is frozen with its scenario objects: it runs exactly that matrix or fails without running anything, and it writes the "gate one passed" record (with `matrixComplete` and the scenario ids) only when the complete matrix passed. Leftover processes and non-loopback sockets are sampled from the OS (`ps`, plus `lsof` on macOS or `/proc` on Linux), not taken from what scenarios register, and any failed or timed-out sample fails the run. Self-tests prove that a broken scenario, a wrong source commit, an incomplete or padded matrix, an orphaned child and a failed sample each make the result fail. Must be fixed in a second slice before the live gate-one run counts as evidence: socket sampling misses sockets that open and close between samples, and in this run the in-process brokers of four scenarios were never sampled, so the loopback line covers sampled sockets only (N1); a grandchild whose parent exits before any sample sees it escapes the leftover check, so teardown should also check the test process's group (N2); the deployment target stores the deployed bytes and the harness starts them, so the target's own serving is not probed (I3); S-stale-worker loses its lease by returning it, not by expiry, and does not deploy again after reconciling (I4); the broker scenario restarts the broker but does not cut off one worker while it holds a claim (I5); the broker restarts on the same port, so a port taken in that window would show as a failure, not a false pass (I7).
55
+ - Completes the HQ Native delivery gate-one loopback harness (US-011 slice 2). It is still test code only: no `hq` command, daemon unit or shipped code changes. Gate one now proves six more things, each with a self-test that fails without the change:
56
+ - Socket coverage: sockets opened in the test process are recorded as they open. Each scenario samples its long-lived children while they run, and the gate fails unless it saw every known child and its socket.
57
+ - Escaped processes: scenario children run in their own process groups, and any live member of those groups at teardown fails the gate.
58
+ - Served app: the deployment target, not the harness, starts the deployed bytes, and the served identity is read from that app.
59
+ - Stale worker: after reconcile, a stale worker that tries to deploy again is refused, and a fresh deploy applies at the next fence.
60
+ - Partition: a new `S-partition` scenario cuts one worker's notification path while it holds a claim, then lets it reconnect.
61
+ - Broker restart: the broker restarts on a fresh port behind a client address that stays bound.
62
+ - Cleanup: the run kills only its own process groups that still have a live member: at the end, the groups the leftover check reported; on process exit, SIGINT or SIGTERM, the groups with a live recorded member. A clean run sends no signal.
63
+ - Connect attempts: a failed attempt to reach a non-loopback address also fails the loopback check.
64
+ - Refusals: the stale-worker and partition refusal checks require the specific refusal code.
65
+
66
+ Adds `docs/delivery-proof.md`, which explains what gate one proves, how to run it, and what the live run on enrolled machines must add.
67
+ - Extends the HQ Native delivery gate-one loopback harness (US-011 slice 3). It is still test code and docs only: no `hq` command, daemon unit or shipped code changes.
68
+ - A new required scenario, `S-worker-partition`, cuts the worker-to-controller path while the worker holds a claim. The worker's claim, report and deploy calls go over a test-only loopback transport. With an abrupt close, the worker's report fails at once and is accepted once after the heal. With a silent drop, the worker hits its own timeout instead of hanging. A controller restart then fences it, and its late report and publish are refused with exact codes. The target holds one effect.
69
+ - Self-tests show the scenario fails when the worker bypasses the transport, and fails within a bounded time when the worker's client has no timeout.
70
+ - The full run can keep its report in a chosen folder (`HQ_TEST_GATE_ONE_EVIDENCE_DIR`) for the live run.
71
+
72
+ Adds `docs/delivery-gate-one-live-brief.md`, the brief for running gate one on the owner's Mac. `docs/delivery-proof.md` now lists two live-run gaps: the library has no worker-to-controller network transport, and a held claim has no lease timeout.
73
+ - HQ Native delivery library (not yet used by any `hq` command): a worker's claim now carries a lease, 120 seconds by default, that the worker renews with a heartbeat. When the lease expires, the attempt is abandoned, the job can be claimed again under a new attempt id, and the old worker's late report, artifact upload and deploy publication are refused. Revoking a worker now frees its claims in the same step. A deploy attempt that loses its lease is marked unknown and goes to reconcile. Opening an older delivery store migrates it to schema v7 after writing an exact backup.
74
+ - HQ Native delivery library (not yet used by any `hq` command): workers can now reach the controller over a loopback network connection instead of only in the same process. Only the worker calls (read, claim, report, return, renew) are allowed, every call is authenticated again by the controller, a lost answer is retried without creating a second attempt (and a retry is answered only while the worker still holds that claim), and the connection stays on the local machine unless explicitly allowed otherwise. A worker that cannot renew its claim for too long now gives it up on its own.
75
+ - On macOS the hq daemon now recovers by itself when macOS privacy (TCC) stops letting it read the HQ folder, which happened after HQ.app updated itself and left the daemon running from the deleted old app bundle (feedback d63d2633). When hqd sees "operation not permitted" (EPERM) on reads of several paths under the HQ root within a minute, it logs one event, reports it once to Sentry, and exits with code 74 so launchd starts a fresh daemon, instead of failing every file operation until someone ran `launchctl kickstart -k`. EPERM outside the HQ root, EPERM from chmod, chown, utime, unlink, rmdir or rename, EACCES, other platforms and a daemon that is already stopping are left alone. After 3 such exits in 30 minutes, or when the daemon cannot record the exit, it stays up and `hq daemon status` says HQ needs Full Disk Access instead of restarting in a loop. A daemon that stayed up checks the HQ folder every minute and clears that warning once it can read it again.
76
+ - `hq integrations import` now checks each Claude Desktop connector's key against hq-pro's rules before connecting it. A connector whose key header HQ refuses (Proxy-*, X-Forwarded-* and the rest of hq-pro's denylist), whose header name is invalid or longer than 64 characters, or whose key has a space or a non-ASCII character is skipped with a message that never shows the key. `Authorization: Basic` credentials are now imported as HQ's Basic scheme (username and password) instead of a raw key with a space. If hq-pro still refuses one connector with a 400, that connector is skipped and the rest of the import continues. Before, any of these stopped the whole import. (feedback_950d8abe)
77
+ - `hq sources sync` no longer fails the whole meetings step with "meeting id must be a safe path segment" when a bot transcript has no `recall_bot_id` or `transcript_id` (Recall desktop-SDK recordings, legacy exports). The `meeting:` prefix on the document id is stripped once, so these transcripts get `signal_source_ref: meeting:<id>`. A transcript whose id is still not a safe path segment lands without a `signal_source_ref` and the sync prints one warning for it; the other meetings carry on.
78
+ - `hq mesh claim` and `hq mesh story` no longer stop at `404 PROJECT_VIEW_NOT_FOUND` when the project has no Board yet. If the local `prd.json` lists the story, they register the project from it (the same merge `hq mesh project ensure` does) and retry once. `hq mesh claim` also gains `--no-ensure`, which only prints the `hq mesh project ensure` command, and its `--json` output names `registeredFrom` when it registered the project.
29
79
  - Expired Claude tokens on the capacity card renew again on desktops where `hq daemon` runs the mesh service. That service started in the home folder and received the HQ folder only as a `--hq-root` flag, so the capacity collector's lane and account checks (`hq runners list --json`, `hq runners accounts list --json`) exited with `hq_root_unresolved`, the refresh gate failed closed on every collect, and every Claude account stayed "Token expired". The mesh unit now sets `HQ_ROOT`, as the standalone mesh LaunchAgent did before the move under `hq daemon`.
80
+ - Port protected scaffold write checks to Rust, including local-settings bypasses, core YAML exclusions, package mounts, and existing redirects. Pin the guard and shared hook library; leave enablement unchanged. Windows drive letters and MSYS package-mount targets now use the shared path conversion, preventing protected writes from escaping the check. The port runs the shared unmodelled-input deny first, models the Windows hook runner's bash and tool PATH, reads `$PWD` and `HQ_LIB_WINSEP` as bash and hook-lib do, discards every exclusion when yq fails on any document, and denies natively, never handing back, where yq versions, YAML parsers, locales or bash versions would disagree.
81
+ - Port the company Git metadata write guard to the native hook engine with pinned Bash parity on macOS and Windows. Inputs the port does not model (PATH unset, jq-only numbers, deep nesting, bash option variables) get the shared native deny.
82
+ - Port the env-file content guard to native Rust with byte-exact Bash parity and pinned emergency fallback.
83
+ - Port the image-context guard to Rust, including image size and per-context byte/count budgets, sub-agent ledgers, and existing bypasses. The bridge pins the bash guard and shared library; the enablement flag is unchanged. Ledger rows append as one complete write under concurrent reads; incomplete or invalid trailing records do not erase earlier complete charges.
84
+ - Run the merged write guard shadow natively, with the same allow and deny records as the pinned shell and Node helper and no child processes. Inputs the native hooks do not model (unusual JSON, shell option variables, a `core/core.yaml` shape yq reads differently, a missing guard program) now block the call with a one-line message instead of being recorded.
85
+ - Run the numbered policy sibling guard natively, with the same allow and block decisions as the pinned bash hook and no child processes. Inputs the port does not model get the shared native deny, and on Windows it blocks a numbered policy path rather than guess what Git Bash would find on disk.
86
+ - Run the active deep-plan file guard natively with pinned Bash parity and no child processes; inputs the port does not model (bash option variables, exported functions, PATH unset, non-UTF-8 input or paths, deep nesting, non-standard numbers) are blocked natively with a message that says what to change.
87
+ - Run the repository-worktree write guard natively with pinned Bash parity and no child processes.
30
88
  - `hq storage offload --current` matches the companies folder by exact case again. On a case-sensitive disk (Linux, Outposts), files under a personal `COMPANIES/<slug>/` folder were treated as that company's files since #2475, and `hq storage fetch` could not restore them; they are now personal files. On a case-insensitive disk (macOS), a companies folder spelled with other letter case on disk is still treated as the companies folder.
89
+ - `hq core policy retire <slug>` now requires `--evidence "<block log path, incident ref or ledger entry>"` and records it as `retired_evidence:` in the policy frontmatter, so a rule is not retired on guesswork. Whitespace-only evidence is refused, and `--reason` and `--evidence` must be single-line (a newline or other control character exits 2); backslashes and quotes in `retired_reason` and `retired_evidence` are now escaped. `--by` (written as the bare `retired_by:` value) must be a plain id: letters, digits, `.`, `_`, `@`, `-`, starting with a letter or `_` (so YAML cannot read it as a number or date, e.g. `0x1F`, `1e3`, `1.5`, `2026-11-04`), and not a YAML keyword such as `null` or `true`; anything else exits 2. The one exemption from `--evidence` is `--by garden-policy-pass`, which the garden automation uses because it derives its evidence from the age report; the exemption is keyed on that `--by` string, which anyone can type, so it is not an identity check (feedback_7dd12e68).
31
90
  - The HQ Anywhere `claude` and `codex` wrappers in `~/.hq/bin` no longer loop with another tool's wrapper. Typing `claude` in a cmux workspace started cmux's wrapper, which ran HQ's wrapper, which picked cmux's wrapper again from PATH, at about 230 new processes a minute. HQ's wrapper now runs the next `claude` after itself on PATH (never another HQ wrapper), so cmux's wrapper and your own wrappers still run, each once. When that next one is a shell script, the wrapper sets `HQ_ANYWHERE_CLAUDE_WRAPPER_ACTIVE` (`HQ_ANYWHERE_CODEX_WRAPPER_ACTIVE` for codex). If a wrapper runs HQ's wrapper again while that variable is set, HQ's wrapper runs the real executable directly (the first `claude` on PATH that is not a shell script, then `~/.local/bin/claude` and `~/.claude/local/node_modules/.bin/claude`), or stops with exit 127 and a message that every `claude` on PATH is a wrapper. The sign-in check follows the same rule. Run `hq install --global` again to refresh an installed wrapper (feedback ed078ef7).
91
+ - `hq dm send --attach` now sends the file's SHA-256 with the vault presign, so S3 Object Lock no longer rejects the upload with "Content-MD5 OR x-amz-checksum- HTTP header is required". (feedback_c5a9b4bb, feedback_719cfab7)
92
+ - `hq signals run`: when Claude itself stops a source at the run's budget cap, the extract step now records `budget-exceeded` and ends the step as partial, the same as when the engine stops between sources. The source stays unprocessed for the next run, the signal and entity candidates the stopped turn had already written for that source are removed so the next run does not write them twice, and the run record names the source under `detail.budgetStoppedAt`. If the stopped turn also wrote a candidate into another company, that file is still deleted and recorded as a failure, and the run still ends at the stop. Before, that stop was recorded as a failed source with a generic error.
93
+ - The hot-channel signals pass (`hq sources sync`, `hq sources signals`) now sends a document again, up to three calls, when Claude's reply is unusable (`claude-bad-output`), and goes on to the remaining documents if all three replies fail. The failed document stays queued and the run still ends as failed. Before, one reply with a JSON syntax error stopped the run, and the same meeting at the front of the queue blocked every meeting behind it on later runs. A run can now make up to three calls per document instead of one; it stops after three documents in a row fail, and it does not resend a document when Claude printed nothing.
94
+ - `hq sources signals --since` no longer re-queues a landed document whose signals were already written under a `meeting:<id>` index `source_ref` instead of the file path. The daily and on-demand backlog was looping the same meetings and duplicating signal files (feedback_1bdd2f65).
95
+ - The build step that bundles the hq-cloud sync runner now works on Windows. It spawned esbuild's JavaScript launcher directly, which Windows cannot run (spawnSync ENOENT). On Windows it now runs the launcher through node. The bundle and the step on macOS and Linux are unchanged.
32
96
  - `hq sync status` now takes `--all` to list every local-only file instead of the first 20 per company, and `--json` to print the full status (scope summaries and every local-only list, uncapped) as JSON. The default output is unchanged except that the truncation line now reads "... and N more (use --all to list every file)" (feedback_f29d004a).
33
97
 
34
98
  ## [5.345.214] — 2026-11-10
@@ -171,8 +171,11 @@ listing_has_exact_key() {
171
171
  function exact_key(row, expected, modified, size) {
172
172
  gsub(/\033\[[0-9;]*m/, "", row)
173
173
  sub(/[[:space:]]+$/, "", row)
174
- if (row !~ / +(shared-with-you|creator access — creator-only|role-bypass|personal-vault|private folder — children are creator-only)$/) return 0
175
- sub(/ +(shared-with-you|creator access — creator-only|role-bypass|personal-vault|private folder — children are creator-only)$/, "", row)
174
+ # hq-cli releases word the creator label differently ("creator access —
175
+ # creator-only", "creator access (...)"). Match the stable "creator access"
176
+ # prefix with either suffix so any verifier/hq-cli version pair agrees.
177
+ if (row !~ / +(shared-with-you|creator access( — creator-only| \([^()]*\))?|role-bypass|personal-vault|private folder — children are creator-only)$/) return 0
178
+ sub(/ +(shared-with-you|creator access( — creator-only| \([^()]*\))?|role-bypass|personal-vault|private folder — children are creator-only)$/, "", row)
176
179
  modified = row
177
180
  sub(/^.* +/, "", modified)
178
181
  if (modified != "—" && modified !~ /^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]T[0-9][0-9]:[0-9][0-9]:[0-9][0-9]\.[0-9][0-9][0-9]Z$/) return 0
@@ -1202,7 +1202,7 @@ export declare const COMMAND_CATALOG: readonly [{
1202
1202
  readonly subcommands: readonly [];
1203
1203
  }, {
1204
1204
  readonly name: "held";
1205
- readonly description: "Show uploads held because someone else was signed in on this computer";
1205
+ readonly description: "Show uploads held until you confirm they belong to the signed-in account";
1206
1206
  readonly aliases: readonly [];
1207
1207
  readonly hidden: false;
1208
1208
  readonly helpOption: true;
@@ -12023,6 +12023,42 @@ export declare const COMMAND_CATALOG: readonly [{
12023
12023
  readonly hidden: false;
12024
12024
  }];
12025
12025
  readonly subcommands: readonly [];
12026
+ }, {
12027
+ readonly name: "available";
12028
+ readonly description: "What AI can run now, as one token-free hq-available-ai.v1 document (read-only; a stale view starts one background read)";
12029
+ readonly aliases: readonly [];
12030
+ readonly hidden: false;
12031
+ readonly helpOption: true;
12032
+ readonly helpCommand: false;
12033
+ readonly usage: "[options]";
12034
+ readonly helpText: readonly [];
12035
+ readonly arguments: readonly [];
12036
+ readonly options: readonly [{
12037
+ readonly flags: "--json";
12038
+ readonly description: "Print the document as JSON";
12039
+ readonly hidden: false;
12040
+ }, {
12041
+ readonly flags: "--fresh";
12042
+ readonly description: "Start a read and wait for it, at most 3 seconds";
12043
+ readonly hidden: false;
12044
+ }, {
12045
+ readonly flags: "--include-other";
12046
+ readonly description: "Also list capacity-only accounts, each with its organization";
12047
+ readonly hidden: false;
12048
+ }];
12049
+ readonly subcommands: readonly [];
12050
+ }, {
12051
+ readonly name: "collect-once";
12052
+ readonly description: "One capacity read, started in the background by hq capacity available";
12053
+ readonly aliases: readonly [];
12054
+ readonly hidden: true;
12055
+ readonly helpOption: true;
12056
+ readonly helpCommand: false;
12057
+ readonly usage: "[options]";
12058
+ readonly helpText: readonly [];
12059
+ readonly arguments: readonly [];
12060
+ readonly options: readonly [];
12061
+ readonly subcommands: readonly [];
12026
12062
  }, {
12027
12063
  readonly name: "route";
12028
12064
  readonly description: "Pick the account with the most capacity for a new lane (read-only; port of boss-route)";
@@ -12115,7 +12151,7 @@ export declare const COMMAND_CATALOG: readonly [{
12115
12151
  readonly subcommands: readonly [];
12116
12152
  }, {
12117
12153
  readonly name: "refusal";
12118
- readonly description: "Record a classified provider rate-limit refusal as an exhausted reading";
12154
+ readonly description: "Record a classified provider refusal as a hold on one named account";
12119
12155
  readonly aliases: readonly [];
12120
12156
  readonly hidden: false;
12121
12157
  readonly helpOption: true;
@@ -12123,7 +12159,7 @@ export declare const COMMAND_CATALOG: readonly [{
12123
12159
  readonly usage: "[options]";
12124
12160
  readonly helpText: readonly [{
12125
12161
  readonly position: "after";
12126
- readonly text: "\nworkflow-runner and /conduct call this after a provider failure has been\nclassified as a rate-limit refusal (policy\nindigo-provider-failures-classified-not-masked-as-timeout). Do not call it\nfor a timeout that was not classified as a rate-limit refusal:\n\n hq capacity ingest refusal --provider <claude|codex|grok> [--limit-id <id>] [--resets-at <iso|epoch>] [--account <hash>]\n\nWhen --limit-id is omitted, the provider's weekly_all limit id in now.json\nis used, or weekly when that view has none. This command does not wire\nthose callers.\n";
12162
+ readonly text: "\nA model-CLI bot's turn, hq bot probe and the lane failure path record their\nown refusals. Run this by hand only for a provider failure that was classified\nas a rate-limit refusal (policy\nindigo-provider-failures-classified-not-masked-as-timeout), never for a\ntimeout that was not:\n\n hq capacity ingest refusal --provider <claude|codex|grok> --account <hash> [--limit-id <id>] [--resets-at <iso|epoch>]\n\n--account is required unless --limit-id names a limit that exactly one account\nhas. A limit id that several accounts share, or neither flag, is a usage error:\nnothing is recorded against a guess, even when the provider has one account.\nThe refusal is a hold beside the account's readings, and never replaces one.\n--limit-id names the limit it is about; without it the refusal claims no\nwindow. The hold ends at --resets-at, at that limit's own reset, or after a\nshort default, or sooner when a newer reading of that limit is below 100%.\n";
12127
12163
  }];
12128
12164
  readonly arguments: readonly [];
12129
12165
  readonly options: readonly [{
@@ -12132,15 +12168,15 @@ export declare const COMMAND_CATALOG: readonly [{
12132
12168
  readonly hidden: false;
12133
12169
  }, {
12134
12170
  readonly flags: "--limit-id <id>";
12135
- readonly description: "Limit to mark; default is the provider's weekly_all id in now.json, else weekly";
12171
+ readonly description: "The account's limit this refusal is about; without it the refusal claims no window";
12136
12172
  readonly hidden: false;
12137
12173
  }, {
12138
12174
  readonly flags: "--resets-at <when>";
12139
- readonly description: "UTC timestamp or epoch when this limit resets";
12175
+ readonly description: "UTC timestamp or epoch when the hold ends";
12140
12176
  readonly hidden: false;
12141
12177
  }, {
12142
12178
  readonly flags: "--account <hash>";
12143
- readonly description: "Hashed account id; default is the account on the chosen limit";
12179
+ readonly description: "Hashed account id of the account that refused. Required unless --limit-id names a limit exactly one account has";
12144
12180
  readonly hidden: false;
12145
12181
  }, {
12146
12182
  readonly flags: "--json";
@@ -12597,6 +12633,10 @@ export declare const COMMAND_CATALOG: readonly [{
12597
12633
  readonly flags: "--force";
12598
12634
  readonly description: "Take the story even when someone else holds it";
12599
12635
  readonly hidden: false;
12636
+ }, {
12637
+ readonly flags: "--no-ensure";
12638
+ readonly description: "Do not register the project from its local prd.json when the story is not on the Board";
12639
+ readonly hidden: false;
12600
12640
  }, {
12601
12641
  readonly flags: "--company <slug|uid>";
12602
12642
  readonly description: "Company slug or cloud uid";
@@ -1445,7 +1445,7 @@ export const COMMAND_CATALOG = [
1445
1445
  },
1446
1446
  {
1447
1447
  "name": "held",
1448
- "description": "Show uploads held because someone else was signed in on this computer",
1448
+ "description": "Show uploads held until you confirm they belong to the signed-in account",
1449
1449
  "aliases": [],
1450
1450
  "hidden": false,
1451
1451
  "helpOption": true,
@@ -14625,6 +14625,48 @@ export const COMMAND_CATALOG = [
14625
14625
  ],
14626
14626
  "subcommands": []
14627
14627
  },
14628
+ {
14629
+ "name": "available",
14630
+ "description": "What AI can run now, as one token-free hq-available-ai.v1 document (read-only; a stale view starts one background read)",
14631
+ "aliases": [],
14632
+ "hidden": false,
14633
+ "helpOption": true,
14634
+ "helpCommand": false,
14635
+ "usage": "[options]",
14636
+ "helpText": [],
14637
+ "arguments": [],
14638
+ "options": [
14639
+ {
14640
+ "flags": "--json",
14641
+ "description": "Print the document as JSON",
14642
+ "hidden": false
14643
+ },
14644
+ {
14645
+ "flags": "--fresh",
14646
+ "description": "Start a read and wait for it, at most 3 seconds",
14647
+ "hidden": false
14648
+ },
14649
+ {
14650
+ "flags": "--include-other",
14651
+ "description": "Also list capacity-only accounts, each with its organization",
14652
+ "hidden": false
14653
+ }
14654
+ ],
14655
+ "subcommands": []
14656
+ },
14657
+ {
14658
+ "name": "collect-once",
14659
+ "description": "One capacity read, started in the background by hq capacity available",
14660
+ "aliases": [],
14661
+ "hidden": true,
14662
+ "helpOption": true,
14663
+ "helpCommand": false,
14664
+ "usage": "[options]",
14665
+ "helpText": [],
14666
+ "arguments": [],
14667
+ "options": [],
14668
+ "subcommands": []
14669
+ },
14628
14670
  {
14629
14671
  "name": "route",
14630
14672
  "description": "Pick the account with the most capacity for a new lane (read-only; port of boss-route)",
@@ -14730,7 +14772,7 @@ export const COMMAND_CATALOG = [
14730
14772
  },
14731
14773
  {
14732
14774
  "name": "refusal",
14733
- "description": "Record a classified provider rate-limit refusal as an exhausted reading",
14775
+ "description": "Record a classified provider refusal as a hold on one named account",
14734
14776
  "aliases": [],
14735
14777
  "hidden": false,
14736
14778
  "helpOption": true,
@@ -14739,7 +14781,7 @@ export const COMMAND_CATALOG = [
14739
14781
  "helpText": [
14740
14782
  {
14741
14783
  "position": "after",
14742
- "text": "\nworkflow-runner and /conduct call this after a provider failure has been\nclassified as a rate-limit refusal (policy\nindigo-provider-failures-classified-not-masked-as-timeout). Do not call it\nfor a timeout that was not classified as a rate-limit refusal:\n\n hq capacity ingest refusal --provider <claude|codex|grok> [--limit-id <id>] [--resets-at <iso|epoch>] [--account <hash>]\n\nWhen --limit-id is omitted, the provider's weekly_all limit id in now.json\nis used, or weekly when that view has none. This command does not wire\nthose callers.\n"
14784
+ "text": "\nA model-CLI bot's turn, hq bot probe and the lane failure path record their\nown refusals. Run this by hand only for a provider failure that was classified\nas a rate-limit refusal (policy\nindigo-provider-failures-classified-not-masked-as-timeout), never for a\ntimeout that was not:\n\n hq capacity ingest refusal --provider <claude|codex|grok> --account <hash> [--limit-id <id>] [--resets-at <iso|epoch>]\n\n--account is required unless --limit-id names a limit that exactly one account\nhas. A limit id that several accounts share, or neither flag, is a usage error:\nnothing is recorded against a guess, even when the provider has one account.\nThe refusal is a hold beside the account's readings, and never replaces one.\n--limit-id names the limit it is about; without it the refusal claims no\nwindow. The hold ends at --resets-at, at that limit's own reset, or after a\nshort default, or sooner when a newer reading of that limit is below 100%.\n"
14743
14785
  }
14744
14786
  ],
14745
14787
  "arguments": [],
@@ -14751,17 +14793,17 @@ export const COMMAND_CATALOG = [
14751
14793
  },
14752
14794
  {
14753
14795
  "flags": "--limit-id <id>",
14754
- "description": "Limit to mark; default is the provider's weekly_all id in now.json, else weekly",
14796
+ "description": "The account's limit this refusal is about; without it the refusal claims no window",
14755
14797
  "hidden": false
14756
14798
  },
14757
14799
  {
14758
14800
  "flags": "--resets-at <when>",
14759
- "description": "UTC timestamp or epoch when this limit resets",
14801
+ "description": "UTC timestamp or epoch when the hold ends",
14760
14802
  "hidden": false
14761
14803
  },
14762
14804
  {
14763
14805
  "flags": "--account <hash>",
14764
- "description": "Hashed account id; default is the account on the chosen limit",
14806
+ "description": "Hashed account id of the account that refused. Required unless --limit-id names a limit exactly one account has",
14765
14807
  "hidden": false
14766
14808
  },
14767
14809
  {
@@ -15325,6 +15367,11 @@ export const COMMAND_CATALOG = [
15325
15367
  "description": "Take the story even when someone else holds it",
15326
15368
  "hidden": false
15327
15369
  },
15370
+ {
15371
+ "flags": "--no-ensure",
15372
+ "description": "Do not register the project from its local prd.json when the story is not on the Board",
15373
+ "hidden": false
15374
+ },
15328
15375
  {
15329
15376
  "flags": "--company <slug|uid>",
15330
15377
  "description": "Company slug or cloud uid",
@@ -79,7 +79,7 @@ import { clearPendingSwitch, recoverPendingSwitchSafely, writePendingSwitch } fr
79
79
  import { classifyRuntimeFailure, isRuntimeUsageLimit, runtimeFailureReason, usageLimitResetsAt } from "../lib/bot/runtime-failure.js";
80
80
  import { PROBE_DEFAULT_TIMEOUT_MS, probeBotRuntime } from "../lib/bot/probe.js";
81
81
  import { BOT_LOGIN_RUNTIMES, botAuthEnv, botRuntimeAuth, capacityAccountHome, defaultSpawnBrowserSignIn, describeBotAuth, formatBotAuth, isBotLoginRuntime, restoreBotSessions, setAsideBotSessions, discardHeldBotLogin, holdPreviousBotLogin, restoreHeldBotLogin, signInBotRuntime, signOutBotRuntime, withRuntimeAuth, } from "../lib/bot/runtime-auth.js";
82
- 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, botRuntimeFromBrainName, 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, controlFleetBot as controlFleetLocalBot, fleetBotUnitId, fleetBotsManagedByDaemon, fleetLocalGatewayPid, fleetLocalProfileNeedsAdoption, fleetLocalServiceInstalled, fleetProviderForRuntime, importFleetLocalMachineCredential, importFleetLocalProviderLogin, fleetProviderNeedsSignIn, fleetOwnerCompanies, refreshFleetLocalInstructions, fleetLocalPromotionRuntime, installPinnedFleetLocalDistribution, installTargetFleetLocalDistribution, resolveFleetLocalPointerTarget, resolveFleetLocalTargetRelease, fleetLocalProfileDir, fleetProfileOwnerCompanies, fleetLocalChannels, readFleetLocalGatewayState, readFleetLocalIntroSentAt, readFleetLocalSignInNeeded, readPromptSources, removeFleetLocalBot, } from "../lib/bot/index.js";
82
+ 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, botRuntimeFromBrainName, 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, controlFleetBot as controlFleetLocalBot, ensureFleetBotDaemon, FleetDaemonStoppedError, fleetBotUnitId, fleetBotsManagedByDaemon, fleetLocalGatewayPid, fleetLocalProfileNeedsAdoption, fleetLocalServiceInstalled, fleetProviderForRuntime, importFleetLocalMachineCredential, importFleetLocalProviderLogin, fleetProviderNeedsSignIn, fleetOwnerCompanies, refreshFleetLocalInstructions, fleetLocalPromotionRuntime, installPinnedFleetLocalDistribution, installTargetFleetLocalDistribution, resolveFleetLocalPointerTarget, resolveFleetLocalTargetRelease, fleetLocalProfileDir, fleetProfileOwnerCompanies, fleetLocalChannels, readFleetLocalGatewayState, readFleetLocalIntroSentAt, readFleetLocalSignInNeeded, readPromptSources, removeFleetLocalBot, } from "../lib/bot/index.js";
83
83
  import { gatedInteractiveLogin } from "../utils/interactive-caller.js";
84
84
  import { brainSignInStatus, fleetInstallProgressReporter, fleetRuntimeStatus, runBotAuthStatus, runBotRuntimeInstall, runBotRuntimeStatus, runBotSignIn } from "./bot-runtime.js";
85
85
  import { ensureFleetRuntimeInstalled } from "../lib/bot/fleet-local.js";
@@ -381,6 +381,28 @@ function allBotDirs() {
381
381
  return [];
382
382
  }
383
383
  }
384
+ /**
385
+ * Before a command that hands a bot to hq daemon: make sure the daemon is
386
+ * running (start it when its login item is installed but it is off). When it
387
+ * still is not up, fail with one plain sentence, and under --json leave the
388
+ * failure document on stdout first.
389
+ */
390
+ function requireLiveBotDaemon(name, json) {
391
+ reportDaemonStopped(name, json, () => ensureFleetBotDaemon(name));
392
+ }
393
+ /** Run a hand-off; under --json, a daemon that could not be started leaves its failure document on stdout before the error exits non-zero. */
394
+ function reportDaemonStopped(name, json, run) {
395
+ try {
396
+ return run();
397
+ }
398
+ catch (err) {
399
+ if (json && err instanceof FleetDaemonStoppedError && err.jsonReported !== true) {
400
+ console.log(JSON.stringify({ ok: false, name, running: false, reason: err.reason, message: err.message }, null, 2));
401
+ Object.assign(err, { jsonReported: true });
402
+ }
403
+ throw err;
404
+ }
405
+ }
384
406
  function refuseHeldFleetBot(dir) {
385
407
  if (hasPromotionHold(dir))
386
408
  throw new Error("This bot is held for cloud promotion. Continue its promotion before changing local settings or lifecycle.");
@@ -433,7 +455,7 @@ function runFleetRuntimeControl(name, config, action, output) {
433
455
  syncFleetRuntimeJobs(name, botDir(name), config);
434
456
  }
435
457
  const installService = action === "install" || (config.fleetServiceInstallPending === true && (action === "start" || action === "restart"));
436
- const result = controlFleetLocalBot(config.agentUid, installService ? "install" : action);
458
+ const result = reportDaemonStopped(name, json, () => controlFleetLocalBot(config.agentUid, installService ? "install" : action));
437
459
  if (installService && result.ok)
438
460
  patchBotConfig(botDir(name), { fleetServiceInstallPending: false, enabled: true });
439
461
  if (output === "silent")
@@ -997,7 +1019,7 @@ async function startFleetRuntimeBot(name, dir, config, output, extra) {
997
1019
  const before = readBotStatus(dir);
998
1020
  const alreadyRunning = !!before && before.state === "running" && isPidAlive(before.pid);
999
1021
  const installService = adopted || config.fleetServiceInstallPending === true;
1000
- const result = controlFleetLocalBot(config.agentUid, installService ? "install" : alreadyRunning ? "restart" : "start");
1022
+ const result = reportDaemonStopped(name, output === "json", () => controlFleetLocalBot(config.agentUid, installService ? "install" : alreadyRunning ? "restart" : "start"));
1001
1023
  if (installService && result.ok)
1002
1024
  patchBotConfig(dir, { fleetServiceInstallPending: false, enabled: true });
1003
1025
  const how = alreadyRunning ? "restarted by the HQ Fleet Runtime" : "started by the HQ Fleet Runtime";
@@ -1535,6 +1557,11 @@ async function runBotCreateLocked(name, opts) {
1535
1557
  const fleetProvider = fleetProviderForRuntime(runtime, model);
1536
1558
  if (fleetProvider.id === "anthropic")
1537
1559
  requireClaudeCodeLoginForCreate(name);
1560
+ // A bot that starts now is handed to hq daemon where it runs this Mac's bots:
1561
+ // make sure it is up before HQ makes an identity for a bot that would never come online.
1562
+ // A ChatGPT or Grok bot starts now only when a login on this computer is found below.
1563
+ if (opts.start !== false && !fleetProviderNeedsSignIn(fleetProvider))
1564
+ requireLiveBotDaemon(name, opts.json);
1538
1565
  const token = await ownerToken();
1539
1566
  const owner = await resolveCallerPersonUid(token, undefined, { command: "hq bot create" });
1540
1567
  if (!owner)
@@ -1635,6 +1662,8 @@ async function runBotCreateLocked(name, opts) {
1635
1662
  ? await botCreateSeams.brainSignIn(runtime === "grok" ? "grok" : "chatgpt", { target: async () => fleetTarget })
1636
1663
  : null;
1637
1664
  const fleetAuthPending = brainLogin !== null && !brainLogin.signedIn;
1665
+ if (opts.start !== false && brainLogin?.signedIn === true)
1666
+ requireLiveBotDaemon(name, opts.json);
1638
1667
  const runtimeStatus = await botCreateSeams.runtimeStatus({ target: fleetTarget });
1639
1668
  if (!opts.json)
1640
1669
  console.log(chalk.dim(`Setting up ${name} takes ${runtimeStatus.estimate}.`));
@@ -1828,7 +1857,20 @@ async function runBotCreateLocked(name, opts) {
1828
1857
  throw Object.assign(new Error(`${name} was created, but the ${runtimeDisplayName(runtime)} login on this computer could not be reused (${cause}). Sign it in with ${fleetAuthCommand(name, { ...config, fleetAuthPending: true })}.`), { expected: true });
1829
1858
  }
1830
1859
  }
1831
- const startedByDaemon = startNow && daemonRunsFleetBots && controlFleetLocalBot(agentUid, "install").ok === true;
1860
+ let startedByDaemon = false;
1861
+ // The daemon was checked before the identity was made; if it stopped during
1862
+ // setup, the bot is created but reported offline with the reason, never as started.
1863
+ let daemonStopped = null;
1864
+ if (startNow && daemonRunsFleetBots) {
1865
+ try {
1866
+ startedByDaemon = controlFleetLocalBot(agentUid, "install").ok === true;
1867
+ }
1868
+ catch (err) {
1869
+ if (!(err instanceof FleetDaemonStoppedError))
1870
+ throw err;
1871
+ daemonStopped = err.message;
1872
+ }
1873
+ }
1832
1874
  const startedByRuntime = startNow && !daemonRunsFleetBots && brainLogin !== null && controlFleetLocalBot(agentUid, "install").ok === true;
1833
1875
  syncFleetRuntimeJobs(name, dir, config);
1834
1876
  const running = fleetBootstrap.running || startedByDaemon || startedByRuntime;
@@ -1894,6 +1936,8 @@ async function runBotCreateLocked(name, opts) {
1894
1936
  if (fleetAuthPending) {
1895
1937
  console.log(chalk.yellow(` sign it in before it can answer: hq bot auth ${name} --provider ${runtime === "grok" ? "grok" : "chatgpt"}`));
1896
1938
  }
1939
+ if (daemonStopped)
1940
+ console.log(chalk.yellow(` ${daemonStopped}`));
1897
1941
  const readyLine = createReadyLine(name, readiness, readyWait, readyTimeoutMs);
1898
1942
  if (readyLine)
1899
1943
  console.log(readyLine);
@@ -1918,7 +1962,7 @@ async function runBotCreateLocked(name, opts) {
1918
1962
  message: createReadyMessage(name, readiness, readyWait, readyTimeoutMs),
1919
1963
  state: status?.state ?? "unknown",
1920
1964
  pid: status?.pid ?? null,
1921
- lastError: status?.lastError ?? null,
1965
+ lastError: daemonStopped ?? status?.lastError ?? null,
1922
1966
  }, null, 2));
1923
1967
  }
1924
1968
  }
@@ -3679,6 +3723,9 @@ export async function runBotAdopt(nameArg, opts) {
3679
3723
  }
3680
3724
  throw Object.assign(new Error(runnable.message), { expected: true });
3681
3725
  }
3726
+ // Before new credentials are issued for a bot that would start under a stopped hq daemon.
3727
+ if (opts.start !== false)
3728
+ requireLiveBotDaemon(name, opts.json);
3682
3729
  await withBotLock(name, async () => {
3683
3730
  if (readBotConfig(dir)) {
3684
3731
  throw Object.assign(new Error(`Bot "${name}" is already set up on this computer (${dir}). Start it with: hq bot start ${name}`), {
@@ -3742,7 +3789,15 @@ async function repairLocalBot(name, api, bot, daemon) {
3742
3789
  const adopted = await adoptFleetRuntimeProfile(name, dir, config);
3743
3790
  if (!adopted)
3744
3791
  importFleetLocalMachineCredential(bot.agentUid, botCredsPath(dir));
3745
- const restarted = controlFleetLocalBot(bot.agentUid, adopted ? "install" : "restart").ok === true;
3792
+ let restarted;
3793
+ try {
3794
+ restarted = controlFleetLocalBot(bot.agentUid, adopted ? "install" : "restart").ok === true;
3795
+ }
3796
+ catch (err) {
3797
+ if (!(err instanceof FleetDaemonStoppedError))
3798
+ throw err;
3799
+ return `new credentials; the HQ Fleet Runtime did not restart: ${err.message}`;
3800
+ }
3746
3801
  return restarted ? "new credentials, HQ Fleet Runtime restarted" : "new credentials; the HQ Fleet Runtime did not restart (hq bot start " + name + ")";
3747
3802
  }
3748
3803
  if (daemon && process.platform === "darwin") {
@@ -3763,6 +3818,9 @@ export async function runBotRestore(opts) {
3763
3818
  json: opts.json,
3764
3819
  emptyResult: { dryRun: opts.dryRun === true, restored: 0, repaired: 0, skipped: 0, failed: 0, bots: [] },
3765
3820
  }));
3821
+ // Restored bots start under hq daemon where it runs this Mac's bots; make sure it is up first.
3822
+ if (opts.dryRun !== true && opts.start !== false && bots.length > 0)
3823
+ requireLiveBotDaemon("", opts.json);
3766
3824
  const rows = [];
3767
3825
  for (const bot of bots) {
3768
3826
  const name = localNameForRemoteBot(bot);
@@ -12,6 +12,7 @@ import { Command } from "commander";
12
12
  import { type CapacityState, type LedgerEvent, type LedgerOptions, type NowView, type ParserFailureEvent, type Reading, type ReadingSource } from "../lib/capacity/ledger.js";
13
13
  import { type CapacityAccount } from "../lib/capacity/accounts.js";
14
14
  import { type ClaudeRefreshLastEntry } from "../lib/capacity/collectors/claude-oauth.js";
15
+ import type { AvailableDeps } from "../lib/capacity/available.js";
15
16
  export declare const CAPACITY_SCHEMA_VERSION: "hq-capacity-now-view.v1";
16
17
  export declare const DOCTOR_SCHEMA_VERSION = "hq-capacity-doctor.v1";
17
18
  export declare const PARSER_FAILURE_WINDOW_MS: number;
@@ -92,5 +93,7 @@ export declare function formatCapacityTable(view: NowView, nowMs: number, accoun
92
93
  export declare function formatHistory(readings: Reading[]): string;
93
94
  export declare function buildDoctorReport(options?: LedgerOptions): DoctorReport;
94
95
  export declare function formatDoctor(report: DoctorReport): string;
95
- export declare function registerCapacityCommand(program: Command): Command;
96
+ export declare function registerCapacityCommand(program: Command, deps?: {
97
+ available?: AvailableDeps;
98
+ }): Command;
96
99
  //# sourceMappingURL=capacity.d.ts.map