@indigoai-us/hq-cli 5.345.221 → 5.345.223

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 (87) hide show
  1. package/CHANGELOG.md +70 -1
  2. package/dist/command-catalog.generated.d.ts +31 -0
  3. package/dist/command-catalog.generated.js +38 -0
  4. package/dist/commands/auth.js +2 -1
  5. package/dist/commands/bot.d.ts +1 -1
  6. package/dist/commands/bot.js +34 -33
  7. package/dist/commands/core-delegate-w1b.js +216 -190
  8. package/dist/commands/daemon.d.ts +1 -0
  9. package/dist/commands/daemon.js +15 -1
  10. package/dist/commands/link.d.ts +2 -0
  11. package/dist/commands/link.js +14 -2
  12. package/dist/commands/mesh.js +23 -3
  13. package/dist/commands/packs.js +13 -2
  14. package/dist/commands/sync-core.d.ts +6 -0
  15. package/dist/commands/sync-core.js +75 -1
  16. package/dist/data/command-states.json +3 -0
  17. package/dist/lib/bot/fleet-cron.d.ts +26 -3
  18. package/dist/lib/bot/fleet-cron.js +44 -4
  19. package/dist/lib/bot/run.d.ts +4 -4
  20. package/dist/lib/bot/run.js +5 -3
  21. package/dist/lib/bot/signals-engine-flag.d.ts +53 -13
  22. package/dist/lib/bot/signals-engine-flag.js +202 -9
  23. package/dist/lib/daemon/catalog.js +2 -0
  24. package/dist/lib/daemon/install.d.ts +2 -1
  25. package/dist/lib/daemon/install.js +9 -0
  26. package/dist/lib/daemon/legacy.d.ts +1 -0
  27. package/dist/lib/daemon/legacy.js +5 -2
  28. package/dist/lib/daemon/machine-check-owner.d.ts +2 -0
  29. package/dist/lib/daemon/machine-check-owner.js +6 -1
  30. package/dist/lib/daemon/machine-checks.d.ts +52 -1
  31. package/dist/lib/daemon/machine-checks.js +104 -11
  32. package/dist/lib/daemon/mesh-owner.d.ts +45 -0
  33. package/dist/lib/daemon/mesh-owner.js +166 -0
  34. package/dist/lib/daemon/native-notice-ledger.d.ts +36 -0
  35. package/dist/lib/daemon/native-notice-ledger.js +156 -0
  36. package/dist/lib/daemon/run.d.ts +15 -0
  37. package/dist/lib/daemon/run.js +72 -3
  38. package/dist/lib/daemon/selfcheck.d.ts +35 -2
  39. package/dist/lib/daemon/selfcheck.js +118 -9
  40. package/dist/lib/daemon/supervisor.d.ts +10 -0
  41. package/dist/lib/daemon/supervisor.js +86 -0
  42. package/dist/lib/flag-registry-worker-source.generated.d.ts +1 -1
  43. package/dist/lib/flag-registry-worker-source.generated.js +1 -1
  44. package/dist/lib/flag-registry-worker.js +33 -3
  45. package/dist/lib/flag-registry.js +13 -0
  46. package/dist/lib/hook-engine/coverage.d.ts +9 -0
  47. package/dist/lib/hook-engine/coverage.js +56 -0
  48. package/dist/lib/hook-engine/native-stop-compatibility.json +56 -5
  49. package/dist/lib/mesh/live/daemon/config.d.ts +8 -1
  50. package/dist/lib/mesh/live/daemon/config.js +16 -0
  51. package/dist/lib/mesh/live/daemon/install.d.ts +31 -2
  52. package/dist/lib/mesh/live/daemon/install.js +142 -1
  53. package/dist/lib/mesh/live/daemon/login-home.d.ts +5 -0
  54. package/dist/lib/mesh/live/daemon/login-home.js +27 -0
  55. package/dist/lib/mesh/live/daemon/unit-home.d.ts +49 -0
  56. package/dist/lib/mesh/live/daemon/unit-home.js +134 -0
  57. package/dist/lib/registry/registry.d.ts +35 -7
  58. package/dist/lib/registry/registry.js +88 -13
  59. package/dist/lib/scan-packages/index.js +23 -2
  60. package/dist/lib/search-index/max-doc-bytes.js +2 -1
  61. package/dist/lib/service-manager/startup-migration.d.ts +1 -0
  62. package/dist/lib/service-manager/startup-migration.js +3 -0
  63. package/dist/lib/signals/engine.d.ts +8 -0
  64. package/dist/lib/signals/engine.js +15 -5
  65. package/dist/lib/sync-core/engine-holds.d.ts +14 -0
  66. package/dist/lib/sync-core/engine-holds.js +60 -0
  67. package/dist/lib/sync-core/engine-home.d.ts +2 -0
  68. package/dist/lib/sync-core/flag.d.ts +18 -0
  69. package/dist/lib/sync-core/flag.js +66 -0
  70. package/dist/lib/sync-core/reconcile.d.ts +6 -0
  71. package/dist/lib/sync-core/reconcile.js +23 -0
  72. package/dist/lib/sync-core/rollout-state.d.ts +2 -0
  73. package/dist/lib/sync-core/rollout-state.js +7 -0
  74. package/dist/lib/sync-core/vault-settings.d.ts +32 -0
  75. package/dist/lib/sync-core/vault-settings.js +147 -0
  76. package/dist/lib/windows/install-followup.d.ts +2 -0
  77. package/dist/lib/windows/install-followup.js +4 -1
  78. package/dist/utils/host-registration.js +3 -1
  79. package/dist/utils/pack-contributions.d.ts +16 -1
  80. package/dist/utils/pack-contributions.js +139 -26
  81. package/dist/utils/self-update.d.ts +3 -1
  82. package/dist/utils/self-update.js +56 -11
  83. package/dist/utils/update-lock.d.ts +151 -14
  84. package/dist/utils/update-lock.js +782 -46
  85. package/dist/utils/version-gate.js +12 -2
  86. package/package.json +7 -7
  87. package/scripts/bench-core.mjs +34 -3
package/CHANGELOG.md CHANGED
@@ -2,6 +2,76 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [5.345.223] — 2026-11-17
6
+ - Refresh person-scoped flags for agent callers even when the CLI runs in company context, so recorder overrides take effect and can be removed.
7
+ - hq-hook: the daemon state file reader now refuses what the CLI's own reader refuses. A file whose stated maximum age is under one second is no longer read as fresh for a whole second. A time at second 60 is not a time. A file is not trusted when a folder above the daemon folder can be written by group or others, or belongs to another user. In `HQ_FLAG_DAEMON_STATE_FILE`, U+FEFF around `false` now turns the state file off, and U+0085 around `true` no longer turns it on.
8
+ - On macOS, `hq-hook` now reads when a Grok Build hook process started from the system's monotonic clock, not the wall clock. Before, if the wall clock was set back while the hook was starting, the time spent before the hook began running was not counted. A refusal could then reach Grok after its 5-second cutoff, and the call went through. If only the wall-clock record can be read and it shows a start in the future, the hook now assumes 0.8 seconds were spent before it began running, not none. Claude Code and Codex calls are unchanged.
9
+ - The native company scope guard now refuses four inputs the bash guard it replaces refused but the native guard let through: a `companies/<slug>` path followed by a vertical tab, form feed or Unicode space (such as U+00A0 or U+3000), a tool name with a NUL character or a trailing line break (`Read\n`), `$(git rev-parse --show-toplevel)` while `GIT_DIR`, `GIT_WORK_TREE` or `GIT_CONFIG_PARAMETERS` is set, and a path under an HQ root registered in another Unicode normalisation than the one on disk.
10
+ - bench-core: on Windows, the old core's hook script is now passed to Git Bash as `/c/...` with forward slashes. A backslash path made `master-hook.sh` look for its sibling scripts in the working directory, so every old-core Claude tool call exited 2.
11
+ - bench-core: `--core new` now runs `hq-hook run --host <host> <Event> --hq-root <root>`, the same arguments host registration writes. Without `--hq-root`, every new-core tool call on Windows was refused with "the HQ root is unknown".
12
+ - The new core's user-scope (`--global`) hook entry now stands aside only where the old user-scope command did (the project folder is the HQ root itself, or the working folder is inside an HQ folder); with a project folder nested inside HQ and the working folder outside it, the guards now run instead of being skipped.
13
+ - Serialize confirmed delegation grants and delivery manifest reads with verification so concurrent updates preserve publication receipts.
14
+ - Keep the work-mesh kill-switch regression reliable when the hook exits before reading its input.
15
+ - Make conduct-link deadline regressions deterministic while retaining a real process-group termination check.
16
+ - The daemon's machine-check batch runs the scripts in collect-only mode when the installed core advertises `machineCheckCollectOnly: 1` in `core/core.yaml`. The scripts then report findings without writing their delivery stamps, so a session whose HOME the native notice ledger refuses still shows a finding the daemon batch already collected. Once the native notice has shown a check's finding, the next batch runs that check once in normal mode, so the script records it as shown (the desktop result is claimed, client-health's pending messages clear) without showing it again. With an older core the batch runs as before.
17
+ - Preserve the shell's policy-row format for built-in Bash reminders so triggering a reminder does not block later calls in the session.
18
+ - packs: `hq packs update` no longer removes the namespaced `/<pack>:<skill>` skill links that reindex writes; they stay through the update, and only the links of skills the new version dropped are removed. Before, they disappeared until the next reindex.
19
+ - packs: scan-packages skips the unprefixed skill link only when the pack's own `<pack>:<skill>` wrapper exists. Another pack's or a company's `*:<skill>` folder no longer stops it.
20
+ - Isolate Stop unit fixtures from runner Git overrides so host-format assertions use their declared environment.
21
+ - Make SessionStart timeout tests deterministic with a virtual polling clock and retain a real-process timeout smoke test.
22
+ - Bot: the morning `hot-signal-sync` job now reads the `cli.bot-signals-engine-job` flag for the company each job is for. Before, it was read once with no company, and a personal bot has no company of its own, so turning the flag on for one company never started the signals engine. A bot with several companies now runs the signals engine only for the companies where the flag is on and keeps the plain hot-channel sync for the rest. This covers the HQ Fleet Runtime job script (rewritten when the bot starts), the bot's own job and "Try now". If the flag cannot be read for a company, that company keeps the plain sync and the bot's log says so. `HQ_FLAG_CLI_BOT_SIGNALS_ENGINE_JOB` still decides for every company on that computer.
23
+ - Bot: with `cli.bot-signals-engine-job` on for a company, the morning `hot-signal-sync` job now runs the signals engine only on a computer where `signals_capture` or `ontology_capture` is on for that company. The engine skips a company with both settings off, and those settings are per computer and off by default, so a teammate with capture off would have gone from meeting signals every morning to nothing once the flag was on for their company. Such a computer keeps the plain hot-channel sync (`hq sources sync`), as before, and the bot's log says why. The check is the engine's own, and it covers the HQ Fleet Runtime job script, the bot's own job and "Try now". If the capture settings cannot be read, the job keeps the plain sync and logs it. The Fleet job script is chosen when `hq bot` writes it (for example `hq bot start` or `hq bot restart`), so a capture setting changed later reaches a Fleet bot only then: after turning capture on the bot keeps the plain sync until the script is next written, and after turning capture off it keeps the engine, which skips the company, until then. Restart the bot after changing a capture setting. `HQ_FLAG_CLI_BOT_SIGNALS_ENGINE_JOB=true` turns the flag on for every company on that computer; capture must still be on for the engine to run.
24
+ - A company's parallel downloads for the new sync engine can now be set for all its members' computers from the flag registry. Two company flags form a ladder: `sync.parallel-downloads` gives 8 download streams, `sync.parallel-downloads-16` gives 16 and wins over the first. The sync-core reconcile reads them for each company vault on the engine (every 10 minutes) and hq daemon passes the result to that vault's engine as `HQ_SYNC_PARALLEL_DOWNLOADS` / `HQ_SYNC_DOWNLOAD_STREAMS`. If the registry cannot be read, the vault keeps the value it had; with no flag on, nothing changes and the engine default (off) applies. A computer's own `hq sync-core config` setting still wins: `parallel-downloads off` now opts this computer out of a company value, and the new `parallel-downloads default` follows the company again. When only these settings change, hq daemon restarts that vault's engine when its current sync cycle ends (at most 30 minutes later), never the current sync runner or another vault's engine.
25
+ - Make the real-process update-lock test end on observed state instead of a fixed 3-second crasher window, which failed on Windows under CPU contention (v5.345.222 tag), and add tests for the failing ordering and for reclaiming a takeover mutex left by a holder killed mid-heartbeat.
26
+ - Run written host-registration execution tests in the Windows hook-registration job.
27
+
28
+ ## [5.345.222] — 2026-11-16
29
+ - `hq packs uninstall` removes the namespaced `.claude/skills/<pack>:<skill>` host (symlink or empty reindex wrapper) and the uninstall rescan no longer adds unprefixed skill links next to those wrappers.
30
+
31
+ - The native `policy-enforcement-gate` in the new hook core (`hq-hook run`) no longer lets through two outbound calls the shell gate refuses. A Bash command sent as an argument list (for example `["bash","-c","hq dm <one person> ..."]`) is now also checked as the shell gate read it, as JSON text, so it is not treated as an exempt one-person `hq dm`. `HQ_NATIVE_POLICY_STATE_ROOT` in the hook's environment no longer moves the gate's session state to another folder, which had let an outbound send that lacked a required skill or brief through.
32
+ - Tests only, no change to `hq` behaviour: the environment profile's credential-shape scan is no longer checked against a one-second wall-clock limit for 1 MB, which failed on loaded CI runners under coverage although the scan is linear. The test now counts what the scan hands to the regular expression engine (every input at most 4097 characters, at most 16 characters per character of text) and checks that 32 times the text takes at most 128 times as long. The first check fails when an expression is run over the whole text, and the second fails when a loop outside the engine grows with the text.
33
+ - Machine-check findings are shown again on a machine whose HOME is reached through a link. `hq core machine-check-owner` already answered `legacy` there, because the native SessionStart notice cannot use its ledger, so the legacy hooks ran the checks. The daemon's hourly schedule did not apply the same rule and kept running its batch, which left the checks' cooldown stamps behind (check-hq-update's under the HQ root, the setup nag's under HOME); the legacy run then printed nothing, so neither path showed the finding. The schedule now runs no batch when the native notice cannot use its ledger, logging "machine checks skipped: the native notice cannot use its ledger". The ledger rule moved to `src/lib/daemon/native-notice-ledger.ts` so the owner and the schedule share it.
34
+ - Native `hq core delegate verify` now re-reads the manifest after publishing, so the publication receipt survives and a following native `send` no longer refuses with "verified publication receipt missing".
35
+ - `hq-hook dispatch` now skips the two per-prompt machine checks (`30-ensure-hq-cli.sh`, `31-ensure-hq-desktop.sh`) when the daemon runs them on its schedule, as `master-hook.sh` already does. The engine decides this itself from the same files `hq core machine-check-owner` reads, without starting `hq` or any other process; whenever it cannot tell, the checks run as before. Optional machine-check skip tracing ignores special files and opens nonblocking so a trace FIFO without a reader cannot hang dispatch.
36
+ - Test only: the dispatch machine-check parity tests no longer depend on how fast the machine starts the stub `hq`. No behaviour change.
37
+ - hq-hook: a new test, `run_starts_no_interpreter`, runs every recorded host payload through `hq-hook run` with `PATH` holding only stand-in programs named `bash`, `node`, `jq`, `hq`, `git`, `pwsh` and others, and fails if any of them is started. It runs on macOS, Linux and Windows. It also checks that turning the new core off (`HQ_CORE_NEXT=off`) does reach the stand-in `bash`, and it fails on any absolute interpreter path (such as `/bin/bash`) added to the crate's sources without a recorded reason.
38
+ - hq-hook: `run_starts_no_interpreter` allows exactly one process, as an exception Corey approved on 2026-11-16: `hq --version`, started at SessionStart by the native conduct-lanes-session-start port. The test checks that disabling that hook removes the start, and any other process (`hq` with other arguments, a second start, bash, sh, node, python) still fails it. The stand-in `PATH` now also holds `qmd`, so the hook no longer adds `/opt/homebrew/bin` or `/usr/local/bin` in front of it and start a real `hq` the test could not see.
39
+ - hq-hook: fix Linux host parity while retaining native refusals. Env-file validation keeps Q18's native deny of content outside ASCII in a multibyte locale off macOS and Windows; the branch's earlier, narrower Linux check is removed. Oversized image-ledger totals produce one native refusal line. On glibc, credential matching follows the host's case-insensitive regex behavior. The scope port and its Bash reference name the canonical owner root list. Parity tests probe the host tools and apply exact ledgered differences only where native still denies. Bash-version diagnostic probes have a deadline and bounded output, so an unresponsive shell cannot hang either guard.
40
+ - Linux parity ledger: each env-file input where Q18 changes the result against legacy Bash is its own entry, with both results pinned. It is either a legacy allow that native blocks, or a new kind, both block with a different message (Corey, 2026-11-16). An input missing from the ledger still fails its test. Tests only.
41
+ - Run Linux env-file, image-context, worktree, diagnostic deadline and parity ledger tests on PRs with GNU basename and the Estonian locale; recognize absolute Bash paths in locale warnings while preserving native refusals.
42
+ - `hq-hook run --host grok`: two prompt hooks of one session saving deferred context at the same time can no longer delete each other's file and leave nothing held while stderr says "deferred". The held file is now renamed over the old one in one step, so both saves land and the later one is held; a save that fails removes nothing and its stderr line says the context was not deferred. Every save and delivery attempt also runs a bounded sweep of the `grok-deferred` state folder (at most 16 entries checked and 4 removed per call) that removes any session's held context and dead claims past the 10-minute TTL, and temporary files a crashed writer left. A fresh file of any session, a claim still inside its TTL, and links are left alone. Decisions and exit codes are unchanged.
43
+ - `hq-hook run --host grok PostToolUse` now runs the three PostToolUse hooks the hq-core v16.0.48-beta.68 Grok adapter ran for them (`policy-enforcement-gate`, `screenshot-resize-trigger`, `conduct-lanes-link-deliver`), rebuilding the Claude-shaped payload and returning `hookSpecificOutput.additionalContext`. A `decision: block` from a hook is not a block on Grok. Codex PostToolUse is unchanged. Unmodelled inputs are refused with one line. Settings-file hooks, auto-capture-registry, master-hook fan-out and the held policy reminder are not part of this port, and `grok-adapter:PostToolUse` is not claimed in covers.
44
+ - Machine-check findings are no longer lost when HOME is reached through a link. The native SessionStart notice records what it shows in a ledger that the hq-hook store refuses to open through a link above its folder, so on such a machine it showed nothing while `hq core machine-check-owner` still answered `daemon` and the legacy hooks stood down. The owner check (TypeScript and the native dispatcher port) now answers `legacy` when that ledger could not be used: a link that is not root's on its path, a folder others may write or another account owns, or a ledger file that is a link or has a second name. The store's link rule is unchanged.
45
+ - On macOS, `hq mesh daemon install`, its uninstall, the automatic install on a command's first run after an update, the restart after an update, the startup LaunchAgent migration and `hq daemon`'s takeover of an older Work Mesh service now leave launchd alone when `HOME` is not the account's own home folder. macOS keeps one `ai.getindigo.hq-mesh-daemon` service per login, so a command run with a temporary `HOME` used to replace the real Work Mesh service with one that had no sign-in.
46
+ - `hq daemon install`, `start` and `uninstall` on macOS refuse to act when `HOME` is not the account's own home folder, for the same reason: macOS keeps one `ai.getindigo.hq-daemon` service per login.
47
+ - A Mac whose Work Mesh or `hq daemon` service was already replaced this way repairs itself on the first `hq` command after updating to this release, run from the account's own home folder. It stops a service loaded from outside the home folder and waits for it to exit, loads the account's own `hq daemon` service again when its plist exists and the desktop app or a foreground `hq daemon` does not already run the daemon, and loads or installs the right Work Mesh service unless `hq daemon` runs Work Mesh for that account. A repair that fails is retried an hour later. An `hq daemon` repair interrupted after the old service was stopped is remembered in `~/.hq/launchd-heal-pending.json` and finished on that retry. When the retry runs outside the HQ folder with no `HQ_ROOT`, `hq mesh daemon install --if-stale` uses the HQ folder of the installed Work Mesh service, or else the last one it trusted. The restart after later CLI updates does the same. `hq daemon` checks the Work Mesh service when it starts: it stops such a service and runs Work Mesh itself when it is the account's background service with Work Mesh on, and otherwise loads or installs the right one, or says how to turn Work Mesh back on.
48
+ - The sync engine self-check (`hq daemon service sync-core-selfcheck`) now reports, in its once-a-day DM, when a sync engine is running and Work Mesh is meant to run but two checks at least 30 minutes apart found its change-notification marker stale or not connected. This report does not delay a DM about a sync engine that has stopped syncing.
49
+ - Add native command safety rules to the optional `hq-hook run` entrypoint, including package acquisition, file edits, cached flags, and image accounting. They run at registry slot 4 after PreToolUse batch 1, which keeps answering `block-env-dump`, so each call is refused at most once.
50
+ - Preserve legacy merge-gate registration until its state producer is available; refuse missing merge authority, check every edit path, and read command flags from company scope.
51
+ - Retain legacy ownership for live command flags and repository identity; directly invoked native guards refuse operations whose authority is not yet available.
52
+ - Limit the Windows image-store refusal to image candidates, so ordinary text reads and shell calls retain their existing behavior.
53
+ - Preserve package checks through shell command options and rc-file glob destinations, and retain merge holds and required reviews when a command segment cannot be parsed.
54
+ - Run the command-rule and changed-guard integration tests (command_rules, command_guards, image_context_guard, env_file, repo_worktree) in hq-hook PR CI.
55
+ - Preserve legacy package-install refusals for quoted manager names after remote-command wrappers, and refuse package-scan wrapper nesting past 64 layers before it can exhaust the evaluator stack.
56
+ - Preserve trailing operands in split-string and package call launchers, unwrap manager names after assignments in both scans, and count quoted names toward the launcher nesting cap.
57
+ - The repository-worktree rule refuses a repo edit only in an HQ root that has the legacy `block-repo-edits-use-worktree` hook script, as master-hook runs it; elsewhere the edit keeps its existing warning.
58
+ - The native PreCompact (`hq-hook run ... PreCompact`) now accepts the PreCompact files of hq-core v16.0.48-beta.104 and beta.105, where it refused every compaction before. It pins the versions those releases ship of master-hook.sh, hook-lib.sh, hook-gate.sh, hook-adapter-core.sh and hook-timeout-watchdog.sh, and pins core/scripts/lib/session-id.sh, which the beta.104 master-hook sources. Under a beta.104 or later master-hook it refuses what that dispatcher reads differently and the native PreCompact does not model: a payload that names a conversation id without `session_id`, a Cursor payload (`cursor_version`), an earlier session-id.sh beside it, and `SESSION_ID_PAYLOAD_JQ` set when session-id.sh is missing.
59
+ - The new hook core (`hq-hook run`) no longer refuses every tool call on HQ roots whose `hook-registry.json` gives the `policy-enforcement-gate` PreToolUse row `"runner":"source"`, as hq-core 16.0.46, 16.0.47 and the 16.0.48 betas from beta.88 through beta.105 do. The `source` and `exec` runners run the gate the same way and are both modelled; any other runner value is still refused natively. The new core also answers the `policy-enforcement-gate.sh` that hq-core v16.0.48-beta.90 through beta.105 ship, with the libraries those betas ship, instead of refusing UserPromptSubmit with "not a version the port reproduces". That gate's one change, rewriting the count wording "attachment count(s)" before it tests a prompt for a declared brief, is reproduced byte for byte.
60
+ - The native Stop (`hq-hook run ... Stop`) now accepts the Stop files of hq-core v16.0.48-beta.104 and beta.105, where it held every Stop on master-hook before. It ports what changed there: master-hook reads a Cursor chat's session from `conversation_id`, does not run the five Claude-only Stop gates on a Cursor payload, gives each folder Stop hook 10 seconds within a shared 30-second Stop budget, and exports `HQ_HOOK_CURSOR`; the Work Mesh turn-end hook takes the session master-hook read when no session variable is set. An HQ whose Stop files mix releases from before and after beta.104 is held on master-hook, as is one with the later Stop files and a `.claude/hooks/master-hook.sh` that is not a released beta.104 or later version, and so is a Stop the port does not model: a Cursor Stop with personal, pack or company Stop hooks or under the Stop dedupe, a payload that names `conversation_id` without `session_id`, a session id the turn-end hook would use as an unchecked file name, and `HQ_MASTER_STOP_BUDGET` or `HQ_MASTER_STOP_CHILD_TIMEOUT` set.
61
+ - The new hook core (`hq-hook run`) now does six more PreToolUse hooks natively, with no bash, jq, git, perl, node or `hq` process: `block-hq-worktree-session`, `block-hq-glob`, `block-hq-grep`, `block-foreground-timeout-over-harness-ceiling`, `block-hq-unbounded-search` and `block-inline-story-impl`. A refusal reads byte for byte as the old dispatcher printed it (the hook's message, then `Blocked by hook <id>.`), and the inline-story warning still goes to stderr. Input a port does not model is refused with one line naming the hook, including a Bash command whose quotes or substitutions nest more than 200 levels deep, which `block-hq-unbounded-search` now refuses instead of overflowing the stack. `block-hq-glob` reads the Git top level the way git does (including the `safe.directory` ownership refusal) and refuses a Glob with a path when that answer cannot be proven without running git, which includes any `GIT_CONFIG_SYSTEM` or `GIT_CONFIG_NOSYSTEM` setting (the port does not guess which system config git reads); the worktree guard refuses every call when no HQ root is known (no `CLAUDE_PROJECT_DIR` or `HQ_ROOT`, no `--hq-root` and no HQ around the binary), since the old hook used its own install folder and blocked when that folder was a linked worktree. Two decisions are stricter: the foreground-timeout guard reads only the `HQ_FLAG_CLI_FOREGROUND_TIMEOUT_GUARD` override of its rollout gate and otherwise blocks for every identity, and the worktree guard keeps its block where the old hook asked the flag service for the safe-directory flag. The foreground-timeout guard refuses a Bash `timeout` that is not a finite number (such as `1e400`, which the old guard read as Infinity and blocked). The worktree guard reads `agent_id`, `session_id` and `cwd` the way the old hook did when master-hook's own parse fails, compares the git dir and common dir as bash spells them (a case-variant `commondir` on macOS is a linked worktree), and refuses a `.git` or `commondir` first line that holds a NUL byte (bash 3.2, the macOS `/bin/bash`, ends the line at the NUL where bash 4 drops it), is longer than 64 KiB or is not UTF-8. `hq-hook capabilities --json` lists the six under `covers.PreToolUse`; PreToolUse stays on the old dispatcher until every PreToolUse hook is covered. Grok’s camelCase `toolInput.timeout` is checked as well as the snake_case timeout, and the worktree guard also checks the decoded directory on other hosts (including Grok’s `workspaceRoot` and a command’s `workdir`); neither additional check can erase an existing refusal. Grok’s camelCase Grep patterns retain the original hook refusal, and camelCase session-spawn inputs are checked alongside snake_case inputs so neither spelling can erase a refusal. The inline-story warning also reads Grok’s camelCase edit input. Timeout numbers at or beyond 2^53 are refused natively rather than printing digits that differ from JavaScript’s shortest numeric representation. Worktree guard cache reads are capped at 64 KiB; oversized caches miss and the guard checks the call afresh.
62
+ - Company skill files edited or written without a registered skill id are still blocked when the native hook core runs, on Claude Code, Codex and Grok Build, including from a subfolder of HQ without CLAUDE_PROJECT_DIR (the registered HQ root is used, a trailing slash on it no longer lets the edit through, a path relative to the session folder, a ./ or ../ path, or one spelled with // or /./ is checked as the file it names, and an edit is refused when no HQ root can be found, the root is not absolute, or the path cannot be resolved), while reading them stays allowed; the infra-policy reminder stays silent, matching the current hooks.
63
+ - Keep the company skill guard enabled when disabled-hook entries contain non-ASCII whitespace, and recognize valid YAML registry layouts, including merge keys (`<<`), when refusing generated legacy wrappers. A legacy wrapper write is refused when companies/manifest.yaml exists but cannot be read as one YAML document or names the owning company with a non-string key, and a path under CLAUDE_PROJECT_DIR is checked even when the registered HQ root differs.
64
+ - The new hook core (`core.next`) now does two more PreToolUse hooks natively: the start_session half of `conduct-link-inherit` (a session on a conduct link records an invite for the session it starts, byte for byte as the node lib wrote it, with no node needed) and `core/hooks/PreToolUse/50-prefer-agent-browser.sh` (the agent-browser nudge on Claude-in-Chrome and Playwright MCP tools, with the same text and the same `PATH` lookup). Neither ever blocks; an input either port does not model is refused with a reason instead of being allowed. `hq-hook capabilities --json` lists both as covered for PreToolUse. `spawn-company-handoff` is not ported yet, since the new core cannot hand back a changed tool input. PreToolUse stays on the old dispatcher until every hook it runs is covered.
65
+ - The new hook core (`core.next`) now does the work of two more SessionStart hooks natively, with no bash, no `node` or `hq` process and no network call. `migrate-policy-triggers` checks whether a policy changed since its last run and, if so, backfills `when:`/`on:` into policies that lack them, as `hq core migrate-policy-triggers` does, with the same cooldown, lock and stamps; it no longer needs `hq` installed. `merged-write-guard-shadow-refresh` clears the session's shadow-guard marker when no flag service is configured. Each honours `HQ_HOOK_PROFILE` and `HQ_DISABLED_HOOKS`. An input a port does not model (a configured flag service, an edited hook script, a policy with non-ASCII tags, ...) skips that port, with the reason printed on stderr (with no HQ root registered, as when `hq-hook run` gets no `--hq-root`, both ports skip and print one line each); later SessionStart work still runs and a session start is never blocked. `hq-hook capabilities --json` lists the two under `covers.SessionStart`. SessionStart stays on the old dispatcher until every one of its hooks is covered.
66
+ - The new hook core (`hq-hook run`) now does three UserPromptSubmit hooks itself: it delivers queued `hq monitor` events to a Claude Code or Codex session (`hq-monitor-session-hook`), joins a session started from a conduct-linked session to that link and adds the link's standing rules (`conduct-link-inherit`), and its policy injector now stands in for `inject-policy-on-trigger` on that event; when `HQ_DISABLED_HOOKS` turns that hook off, or the HQ root's `hook-gate.sh` cannot be read, it refuses the prompt with one line instead of skipping its checks. UserPromptSubmit still runs on the old dispatcher until every hook registered for it has a port; an unusual registry row or a stored value the native port cannot read the way the old hook did refuses the prompt with one line saying what to fix.
67
+ - qmd size-exclusion no longer treats an unrecognised collection mask as a finished walk, so previously owned ignore entries stay until the mask can be parsed.
68
+ - hq-hook: the replay recorder now stores events from a hosted agents-v2 box under `host: agents-v2`. The agents-v2 adapter sets `HQ_CHECKPOINT_RUNTIME=agents-v2` and no `HQ_HARNESS`, so these rows used to be labelled `claude-code`. The native `hq-hook run --host agents-v2` early-exit rows (unreadable payload, core off with no dispatcher, stalled checks, PreCompact) used to be labelled `fleet-session` and are now `agents-v2` too. The fleet session launcher's own events keep `fleet-session`. Nothing else about how rows are recorded or redacted changed.
69
+ - `hq resolve-company --path` now binds `companies/<slug>/**` from HQ's own tree, `hq link` refuses a folder that would steal the enclosing repo's origin, and manifest `~/…` repo entries expand instead of seeding `github.com/~/…`.
70
+ - `hq sync-core config <vault> parallel-downloads on|off` and `hq sync-core config <vault> download-streams <1-32>|default` set the new sync engine's parallel downloads for one vault on this computer only. `<vault>` is a company slug, `personal`, or a vault uid on the new engine here; `hq sync-core config <vault>` shows the current setting. The setting lives in `~/.hq/sync-core/vault-settings.json`, which the reconcile does not rewrite. hq daemon passes it to that vault's engine as `HQ_SYNC_PARALLEL_DOWNLOADS` / `HQ_SYNC_DOWNLOAD_STREAMS` and restarts only that engine within about 15 seconds, both when it is turned on and when it is turned off. Parallel downloads stay off by default, other computers, vaults and companies are not changed, and the rollout flag is not touched. An unknown setting or an out-of-range value is refused. Engine releases without parallel downloads ignore the setting.
71
+ - When a vault switches back from the new sync engine to the current sync while the engine holds deletes for it, the reconcile log now names the vault, the number of held deletes, and up to 20 of the held paths that the current sync will now apply. The switch-back itself is unchanged and still happens at once.
72
+ - The shared HQ CLI update lock is safer when several updaters race. HQ writes the lock to a temporary file and links it into place, so other processes never see it empty. Creating a lock, taking over a stale lock and releasing a lock now all happen inside a short-lived `cli-update.lock.takeover` folder that the HQ desktop app uses too, so no process can slip into the lock name while a takeover is checking it. If the fallback write on filesystems without hard links fails or stops short, HQ removes the file and reports that it does not hold the lock. A stale lock is moved aside and deleted only if it still matches what was judged stale; otherwise it is put back, or kept under its moved-aside name and cleaned up after 10 minutes. If the folder is left behind by a crash, HQ takes it over after 30 seconds by renaming the holder's file inside it, so two processes cannot both take it and an out-of-date check cannot affect a newer holder, and a process that cannot take it keeps to its wait limit. Releasing leaves the lock in place when the folder stays busy, or when another process has already replaced the lock; a lock left behind is reclaimed once its holder exits or after 10 minutes. An unreadable lock younger than 30 seconds is left alone. Before installing, the updater checks that the lock is still its own and skips the update if not. An older HQ desktop app or CLI without this change can still race with a newer one until both are updated. Matches the HQ desktop app fix for indigoai-us/hq-desktop-app-src#1949. The HQ CLI keeps its update lock fresh while an install runs. Every 60 seconds it rewrites the lock's start time, the same way the HQ desktop app does, so an install that runs longer than 10 minutes is no longer treated as abandoned and a second install cannot start over it. The CLI now applies the desktop app's rules for when a lock is stale: a lock dated 10 or more minutes in the future is stale, and an older lock with no process id expires by age only. When the CLI starts up and needs to update, it waits at most 1 second (was 10) for another process that is in the middle of taking over the lock. If releasing the lock finds another process busy with it, the CLI tries once more when it exits.
73
+ - Mark `hq auth login`, `hq auth logout` and `hq packages install` retiring in the command states table and the function manifest (use `hq login`, `hq logout` and `hq install`). They still run exactly as before.
74
+
5
75
  ## [5.345.221] — 2026-11-16
6
76
  - `hq-hook run` now treats a hook event that names only an agent type (`agent_type`) or a parent session or thread id as coming from inside an agent, as HQ's bash hooks already do. When such a prompt or compaction event cannot be evaluated, it is now refused instead of let through.
7
77
  - When the same hook registration is loaded twice, an earlier answer for a tool call is no longer reused for a call with the same id from another agent, or from the main thread. Each one is now evaluated on its own.
@@ -67,7 +137,6 @@
67
137
  - The native Stop now looks for `hq` on PATH as bash's `command -v` does. An `hq` on PATH that cannot be run (for example an `npm link` target rebuilt without its execute bit) is the one the lanes Monitor gate uses when no runnable `hq` comes after it; the gate fails on it as the shell gate did, instead of finding another `hq` in an install folder. An empty PATH entry is the working directory and a relative entry is read from it. Native hook PATH setup now also puts `~/.npm-global/bin` ahead of `~/.local/bin`, as every released hook-gate.sh does, and only skips a folder already on PATH when its text matches, as the shell does.
68
138
  - On macOS the native Stop now decides which `hq` (and `id` and `find`) bash's lookup finds from the file's mode bits, as both macOS bashes do, so an `hq` with execute bits that an ACL or a `noexec` volume stops is the one the lanes gate runs and fails on, as the shell did. A leading `~` in a PATH entry (`export PATH="~/bin:$PATH"`) is expanded as bash expands it for the lanes gate and the checkpoint gate, and not for the conduct deliver hook, whose `env hq` does not expand it. The native Stop now refuses, on every call and retry, a Stop whose environment exports a bash function other than the usual host login functions, a PATH that is not UTF-8, a PATH entry starting with `~+`, `~-` or `~` and a digit, a `~` entry under `POSIXLY_CORRECT` or `POSIX_PEDANTIC`, and a hook-gate.sh whose `hq_augment_path` or `hq_highest_node_version` is not the released body (an edited or older copy, or a missing one).
69
139
  - The native observe-patterns now folds case in ASCII only, as the shell's `grep -i` does on macOS in every locale. Commit summaries such as `ſcript` or `hooK` (with U+017F or the Kelvin sign) no longer produce an observation the shell never wrote.
70
- - The native Stop and `hq reindex` now accept only plain Git config lines: blank lines, `#` or `;` comment lines, a `[section]` or `[section "subsection"]` header with at most a comment after it, and a `key` or `key = value` line whose value has no backslash, double quote or control character and may end in a comment. Any other line keeps master-hook ("unmodeled Git config syntax"): a backslash continuation or escape, a quoted value, CRLF line ends, a setting on the header line (`[core] repositoryformatversion = 1`), the legacy `[section.subsection]` header, or a non-ASCII header. git reads several of these differently from a line-by-line reader, for example a value ending in `\` that hides the next `[section]` header, so such a repository is no longer let through where git refuses it or reads another file. A leading UTF-8 byte-order mark is skipped, as git skips it.
71
140
  - The native Stop and PreCompact accept the `core/scripts/hook-lib.sh` that hq-core v16.0.48-beta.98 ships.
72
141
  - The native Stop and `hq reindex` now check Git config against an allowlist. In a section that git reads during observe-patterns' commands (for example `core`, `diff`, `color`, `user`, `push`, `fetch`, `trace2` or `safe`), a variable keeps the shell Stop unless it is one the native Stop models, with a value in that variable's strict grammar. Examples that keep the shell Stop: `core.filemode = maybe`, `core.deltaBaseCacheLimit = -0`, `core.disambiguate`, `[diff "color"]`, or a bare `trace2.*` key. A repository extension git refuses (for example `refStorage` under `repositoryformatversion = 0`) also keeps it. git dies on these, so the shell's observe-patterns writes nothing, where the native reader used to write an observation. The modeled variables cover a default `git init` and the common developer settings (`user.*`, `init.defaultBranch`, `push.default`, `fetch.prune`, `diff.algorithm`, `color.ui`, `core.editor`, `core.pager`, `core.excludesFile`, `core.hooksPath`, `safe.directory`, and so on). Values are read with git's own config syntax, so quoted values (`editor = "code --wait"`), escapes, inline `#` and `;` comments and a trailing `\` continuation are read as git reads them; a file git refuses with "bad config line" keeps the shell Stop, as do CR, NUL and the legacy `[section.sub]` header. The modeled variables also include `branch.autoSetupMerge`, `branch.autoSetupRebase`, `branch.sort`, the common `core.*` keys (`compression`, `quotePath`, `fsmonitor`, `untrackedCache`, `sshCommand`, `whitespace`, `sparseCheckout` and others), `log.date`, `log.decorate` (off or `auto`), `color.diff`, `color.status`, `color.branch` and `[color "diff"]` slots, `diff.colorMoved`, `diff.renames`, `diff.mnemonicPrefix`, `diff.tool`, `index.version`, `index.sparse`, `gc.auto`, `init.templateDir`, `feature.manyFiles`, `protocol.version`, `transfer.fsckObjects`, `fetch.writeCommitGraph`, `fetch.pruneTags`, `fetch.all`, `push.followTags`, `submodule.recurse`, `advice.*` and `pager.<command>`; `diff.algorithm` and the color words are matched ignoring case, as git matches them. `core.notesRef`, `log.showSignature = true` and `color.* = always` still keep the shell Stop, since they change what `git log` prints. `[include]` and `[includeIf]` files are now read and checked the same way, instead of always keeping the shell Stop, except an `includeIf "hasconfig:..."` include, which keeps it (git fails when the file it names sets a remote URL, whether or not the condition matches). For an HQ root inside another Git repository (a folder below the repository's top, at any depth), or a linked worktree (`git worktree add`), the native Stop now checks the config of the repository git finds: the parent's `.git/config`, or the worktree's shared config and its own `config.worktree`, plus the global and system files. Before, the folder inside a repository was not checked at all, and a linked worktree always kept the shell Stop. A layout the check does not model still keeps the shell Stop: a gitfile or `commondir` git cannot follow, a bare repository on the way up, a `.git` past a file-system boundary, a repository the current user does not own, or a project folder reached through a link whose path and real path lead to different repositories. The sections come from running git 2.50.1 over every documented and compiled-in config name in the system, global, local and worktree files (`crates/hq-hook/tests/git-config-lab/derive.mjs`).
73
142
  - Native Stop and `hq reindex`: a repository with `extensions.worktreeConfig` in repository format 0 no longer keeps Stop on master-hook. Each value, read with git's own config tokenizer, must be a boolean git and gix read the same way (`true`, `yes`, `on`, `1`, `false`, `no`, `off`, `0` in any case, or a bare key); any other value, an empty one included, is still refused. The main worktree's `.git/config.worktree`, which git loads with the extension on, is checked under the same rules as `.git/config`, the Git config allowlist included, so a guarded key there is still refused. In a linked worktree, the worktree's own `config.worktree` is checked the same way; repository format 1 is still refused. A key on its section header's line and a value continued with a trailing backslash are read as git reads them, and a byte-order mark at the start of a file is skipped as git does; before, each of these could hide a guarded key. The native check and the reindex check run the same cases (`crates/hq-hook/tests/fixtures/stop-git-config/cases.json`). The native Stop also refuses edited PATH helpers in hook-gate.sh: a helper that changes the hook profile could previously make native Stop skip a hook that master-hook would run and block. A Stop registration timeout too large to represent now refuses every Stop instead of panicking before the hooks run. On Windows, absolute Git config and PATH locations now replace the HQ base path, matching the native reader, instead of being appended to it.
@@ -19730,6 +19730,37 @@ export declare const COMMAND_CATALOG: readonly [{
19730
19730
  readonly hidden: false;
19731
19731
  }];
19732
19732
  readonly subcommands: readonly [];
19733
+ }, {
19734
+ readonly name: "config";
19735
+ readonly description: "Show or change this computer's new sync engine settings for one vault: parallel-downloads on|off|default (default follows the company setting), download-streams 1-32|default";
19736
+ readonly aliases: readonly [];
19737
+ readonly hidden: false;
19738
+ readonly helpOption: true;
19739
+ readonly helpCommand: false;
19740
+ readonly usage: "[options] <vault> [key] [value]";
19741
+ readonly helpText: readonly [];
19742
+ readonly arguments: readonly [{
19743
+ readonly name: "vault";
19744
+ readonly required: true;
19745
+ readonly variadic: false;
19746
+ readonly description: "";
19747
+ }, {
19748
+ readonly name: "key";
19749
+ readonly required: false;
19750
+ readonly variadic: false;
19751
+ readonly description: "";
19752
+ }, {
19753
+ readonly name: "value";
19754
+ readonly required: false;
19755
+ readonly variadic: false;
19756
+ readonly description: "";
19757
+ }];
19758
+ readonly options: readonly [{
19759
+ readonly flags: "--json";
19760
+ readonly description: "Print JSON";
19761
+ readonly hidden: false;
19762
+ }];
19763
+ readonly subcommands: readonly [];
19733
19764
  }, {
19734
19765
  readonly name: "status";
19735
19766
  readonly description: "Show which vaults are on the new sync engine on this machine";
@@ -24065,6 +24065,44 @@ export const COMMAND_CATALOG = [
24065
24065
  ],
24066
24066
  "subcommands": []
24067
24067
  },
24068
+ {
24069
+ "name": "config",
24070
+ "description": "Show or change this computer's new sync engine settings for one vault: parallel-downloads on|off|default (default follows the company setting), download-streams 1-32|default",
24071
+ "aliases": [],
24072
+ "hidden": false,
24073
+ "helpOption": true,
24074
+ "helpCommand": false,
24075
+ "usage": "[options] <vault> [key] [value]",
24076
+ "helpText": [],
24077
+ "arguments": [
24078
+ {
24079
+ "name": "vault",
24080
+ "required": true,
24081
+ "variadic": false,
24082
+ "description": ""
24083
+ },
24084
+ {
24085
+ "name": "key",
24086
+ "required": false,
24087
+ "variadic": false,
24088
+ "description": ""
24089
+ },
24090
+ {
24091
+ "name": "value",
24092
+ "required": false,
24093
+ "variadic": false,
24094
+ "description": ""
24095
+ }
24096
+ ],
24097
+ "options": [
24098
+ {
24099
+ "flags": "--json",
24100
+ "description": "Print JSON",
24101
+ "hidden": false
24102
+ }
24103
+ ],
24104
+ "subcommands": []
24105
+ },
24068
24106
  {
24069
24107
  "name": "status",
24070
24108
  "description": "Show which vaults are on the new sync engine on this machine",
@@ -328,7 +328,8 @@ export function registerAuthCommands(program) {
328
328
  .action(async () => {
329
329
  // Second name for `hq logout`. It signs out exactly as `hq logout` does,
330
330
  // so the refresh token is revoked on the server on this path too. It is
331
- // not marked retiring yet: the shipped /hq-logout skill still runs it.
331
+ // marked retiring (US-041: the core skills now run `hq logout`), but the
332
+ // retiring gate is off, so this command still runs exactly as before.
332
333
  const { runLogout } = await import("./logout.js");
333
334
  await runLogout();
334
335
  });
@@ -169,7 +169,7 @@ export declare function hotSignalSyncRole(name: string, config: BotConfig, execu
169
169
  * that is busy (its lock is held) or held for promotion is left for its next
170
170
  * start. Returns the names it re-checked.
171
171
  */
172
- export declare function resyncHotSignalSyncAfterRemoval(removed: string, sync?: (name: string, dir: string, config: BotConfig) => void): Promise<string[]>;
172
+ export declare function resyncHotSignalSyncAfterRemoval(removed: string, sync?: (name: string, dir: string, config: BotConfig) => void | Promise<void>): Promise<string[]>;
173
173
  /** Bot-identity token supplier: per-bot creds + per-bot token cache dir. */
174
174
  export declare function botTokenSupplier(dir: string): () => Promise<string>;
175
175
  /**
@@ -6,8 +6,7 @@ import { CLI_VERSION } from "../cli-version.js";
6
6
  import { BOT_SIGNALS_RUNTIME_SETTINGS, signalsPassRuntime } from "../lib/bot/config.js";
7
7
  import { runSignals } from "../lib/signals/engine.js";
8
8
  // The main bot's runtime, the same one the signals engine's extract step uses.
9
- import { BOT_SIGNALS_ENGINE_JOB_FLAG, signalsEngineForJob } from "../lib/bot/signals-engine-flag.js";
10
- import { resolveProcessFlagGate } from "../lib/flag-registry.js";
9
+ import { signalsEngineForJob } from "../lib/bot/signals-engine-flag.js";
11
10
  import { currentHotSignalSyncCompany, hasScheduledBriefJob, hotSignalSyncJobCompanies, readActiveCompanySlug, registerHotSignalSyncOnStart, runHotSignalSyncJob } from "../lib/bot/jobs/hot-signal-sync.js";
12
11
  import { CLAUDE_SIGN_IN_STEPS, CODEX_SIGN_IN_STEPS, codexBotSignalsOptInCommand, createClaudeSignalsPass } from "../lib/hot-channels/signals-pass.js";
13
12
  import { executiveSignalsRuntimeOptions, signalsPassCodexLogin } from "../lib/hot-channels/signals-runtime.js";
@@ -57,7 +56,7 @@ import { describeExecutiveBotSource, resolveExecutiveBot, setExecutiveBot } from
57
56
  import { executiveHotSignalSyncCompanies } from "../lib/bot/executive-sync.js";
58
57
  import { readBotListedProcess } from "../lib/bot/listed-running.js";
59
58
  import { DEFAULT_BOT_READY_TIMEOUT_SECONDS, botReadinessReport, clearBotSetupStep, createSetupStepReporter, readBotSetupStep, waitForGatewayReady, fleetStatusCarriesReady, writeBotSetupStep, } from "../lib/bot/readiness.js";
60
- import { ensureFleetHotSignalSync, fleetCronOps, migrateLegacyJobsToFleet } from "../lib/bot/fleet-cron.js";
59
+ import { ensureFleetHotSignalSync, fleetCronOps, fleetHotSignalSyncEngineCompanies, migrateLegacyJobsToFleet } from "../lib/bot/fleet-cron.js";
61
60
  import { resolvePackSetupPrompt } from "../lib/bot/pack-setup.js";
62
61
  import { detectCodingToolActivity } from "../lib/bot/coding-tool-activity.js";
63
62
  import { setupToolOfferPendingSection, setupToolOfferText, setupWelcomeOpening } from "../lib/bot/setup-tool-offer.js";
@@ -227,16 +226,7 @@ function fleetSetupToolOffer(dir, config) {
227
226
  return null;
228
227
  }
229
228
  }
230
- /** The daily Fleet signals job is gated by the same default-off flag as the in-process engine job. */
231
- function fleetSignalsJobEnabled() {
232
- try {
233
- return resolveProcessFlagGate(BOT_SIGNALS_ENGINE_JOB_FLAG, { fallback: false }, () => false);
234
- }
235
- catch {
236
- return false;
237
- }
238
- }
239
- function syncFleetRuntimeJobs(name, dir, config) {
229
+ async function syncFleetRuntimeJobs(name, dir, config) {
240
230
  const log = createBotLogger(dir);
241
231
  let ops;
242
232
  try {
@@ -277,7 +267,12 @@ function syncFleetRuntimeJobs(name, dir, config) {
277
267
  const executiveBot = resolveExecutiveBot();
278
268
  const role = hotSignalSyncRole(name, config, executiveBot);
279
269
  const executive = role.executive;
280
- const result = ensureFleetHotSignalSync({
270
+ // The daily Fleet signals job is gated by the same default-off flag as the
271
+ // in-process engine job (cli.bot-signals-engine-job), read for each company
272
+ // this bot has a job for: a personal bot has no company of its own. A
273
+ // company with the flag on and both capture settings off on this computer
274
+ // keeps the plain sync script (the engine would skip it).
275
+ const jobs = {
281
276
  dir,
282
277
  config,
283
278
  ops,
@@ -287,10 +282,11 @@ function syncFleetRuntimeJobs(name, dir, config) {
287
282
  otherBotDirs: role.otherBotDirs,
288
283
  nodeBinary: resolveNodeBinary(),
289
284
  hqBinary: resolveHqBinary(),
290
- signalsJobEnabled: fleetSignalsJobEnabled(),
291
285
  executive,
292
286
  executiveCompanies: role.executiveCompanies,
293
- });
287
+ };
288
+ const signalsJobEnabled = await fleetHotSignalSyncEngineCompanies(jobs, undefined, (message) => log("warn", message));
289
+ const result = ensureFleetHotSignalSync({ ...jobs, signalsJobEnabled });
294
290
  if (executive === false && result.removed.length > 0) {
295
291
  log("info", `removed the daily hot-signal-sync from this bot (${result.removed.length} job${result.removed.length === 1 ? "" : "s"}): ${executiveBot ? `${executiveBot.name} is the Executive bot now and runs it` : "only the Executive bot runs it"}`);
296
292
  }
@@ -366,7 +362,7 @@ export async function resyncHotSignalSyncAfterRemoval(removed, sync = syncFleetR
366
362
  const config = readBotConfig(dir);
367
363
  if (!config || config.enabled === false || !isFleetRuntimeBot(config) || hasPromotionHold(dir))
368
364
  return;
369
- sync(other, dir, config);
365
+ await sync(other, dir, config);
370
366
  done.push(other);
371
367
  }, { command: "hq bot rm (hot-signal-sync hand-over)", waitMs: 5_000 });
372
368
  }
@@ -444,7 +440,7 @@ async function fleetGatewayComesUp(agentUid, waitMs, stepMs = 500) {
444
440
  await new Promise((r) => setTimeout(r, stepMs));
445
441
  }
446
442
  }
447
- function runFleetRuntimeControl(name, config, action, output) {
443
+ async function runFleetRuntimeControl(name, config, action, output) {
448
444
  const json = output === true;
449
445
  if ((action === "install" || action === "start" || action === "restart") && config.fleetAuthPending === true) {
450
446
  const authCommand = fleetAuthCommand(name, config);
@@ -456,7 +452,7 @@ function runFleetRuntimeControl(name, config, action, output) {
456
452
  }
457
453
  if (action === "install" || action === "start" || action === "restart") {
458
454
  refreshFleetLocalInstructions(config.agentUid, fleetBotSystemPrompt(name, config));
459
- syncFleetRuntimeJobs(name, botDir(name), config);
455
+ await syncFleetRuntimeJobs(name, botDir(name), config);
460
456
  }
461
457
  const installService = action === "install" || (config.fleetServiceInstallPending === true && (action === "start" || action === "restart"));
462
458
  const result = reportDaemonStopped(name, json, () => controlFleetLocalBot(config.agentUid, installService ? "install" : action));
@@ -1060,7 +1056,7 @@ async function convertLegacyBotToFleet(name, dir, config, from) {
1060
1056
  // The legacy runner's copy of the machine credentials goes only now: a failed move above still needs it.
1061
1057
  fs.rmSync(botCredsPath(dir), { force: true });
1062
1058
  log("info", `moved ${name} to the HQ Fleet Runtime under the same identity; its ${config.runtime} runner is retired`);
1063
- syncFleetRuntimeJobs(name, dir, fleet);
1059
+ await syncFleetRuntimeJobs(name, dir, fleet);
1064
1060
  retireLegacyBotAgent(name, dir, config, from === "run" ? "detached" : "inline");
1065
1061
  return { fleet, state: null };
1066
1062
  }
@@ -1160,7 +1156,7 @@ async function startFleetRuntimeBot(name, dir, config, output, extra) {
1160
1156
  }
1161
1157
  const adopted = await adoptFleetRuntimeProfile(name, dir, config);
1162
1158
  refreshFleetLocalInstructions(config.agentUid, fleetBotSystemPrompt(name, config));
1163
- syncFleetRuntimeJobs(name, dir, config);
1159
+ await syncFleetRuntimeJobs(name, dir, config);
1164
1160
  const before = readBotStatus(dir);
1165
1161
  const alreadyRunning = !!before && before.state === "running" && isPidAlive(before.pid);
1166
1162
  const installService = adopted || config.fleetServiceInstallPending === true;
@@ -2019,7 +2015,7 @@ async function runBotCreateLocked(name, opts) {
2019
2015
  }
2020
2016
  }
2021
2017
  const startedByRuntime = startNow && !daemonRunsFleetBots && brainLogin !== null && controlFleetLocalBot(agentUid, "install").ok === true;
2022
- syncFleetRuntimeJobs(name, dir, config);
2018
+ await syncFleetRuntimeJobs(name, dir, config);
2023
2019
  const running = fleetBootstrap.running || startedByDaemon || startedByRuntime;
2024
2020
  let readyWait = null;
2025
2021
  if (!startNow) {
@@ -2264,9 +2260,13 @@ async function runBotResident(nameArg) {
2264
2260
  // unless that bot is a Codex bot with signalsRuntime "bot".
2265
2261
  signalsPass: createClaudeSignalsPass({ hqRoot: config.hqRoot, company: input.company, ...executiveSignalsRuntimeOptions(), onClaudeLogin: recordSignalsPassClaudeLogin }),
2266
2262
  });
2267
- // The engine is gated default-off (cli.bot-signals-engine-job); with the
2268
- // flag off the job runs the hot-channel sync alone, as before US-006.
2269
- const runHotSignalSync = (input) => signalsEngineForJob(runSignals).then((signals) => hotSignalSyncJob(input, signals));
2263
+ // The engine is gated default-off (cli.bot-signals-engine-job), read for the
2264
+ // company the job is for; with the flag off for that company the job runs
2265
+ // the hot-channel sync alone, as before US-006. It also keeps the sync when
2266
+ // the engine would skip the company as prefs-off on this computer (both
2267
+ // capture settings off). The job and "Try now" ask this one function.
2268
+ const signalsEngineFor = (company) => signalsEngineForJob(runSignals, company, { hqRoot: config.hqRoot });
2269
+ const runHotSignalSync = (input) => signalsEngineFor(input.company).then((signals) => hotSignalSyncJob(input, signals));
2270
2270
  // Prefer the Executive bot for daily hot-channel sync. Other personal bots
2271
2271
  // keep their company covered until the Executive has a replacement job.
2272
2272
  // Identity only (never the executive.enabled opt-in); with no personal bot
@@ -2292,9 +2292,10 @@ async function runBotResident(nameArg) {
2292
2292
  hotSignalSync: (input) => runHotSignalSync(input),
2293
2293
  // US-006 AC9: the member's "Try now" runs the same entry point as the job,
2294
2294
  // as `--trigger chat --force`, behind the same cli.bot-signals-engine-job
2295
- // flag. Flag off: null, and the message goes to the model as before.
2296
- signalsTryNow: async () => {
2297
- const signals = await signalsEngineForJob(runSignals);
2295
+ // flag and capture check. Engine not chosen: null, and the message goes to
2296
+ // the model as before.
2297
+ signalsTryNow: async (company) => {
2298
+ const signals = await signalsEngineFor(company);
2298
2299
  if (!signals)
2299
2300
  return null;
2300
2301
  return (input) => hotSignalSyncJob({ ...input, catchUp: false, tryNow: true }, signals);
@@ -3440,7 +3441,7 @@ export async function updateFleetRuntimeBot(nameArg, opts = {}) {
3440
3441
  const config = readBotConfig(b.dir) ?? b.config;
3441
3442
  if (adopted) {
3442
3443
  refreshFleetLocalInstructions(config.agentUid, fleetBotSystemPrompt(b.name, config));
3443
- syncFleetRuntimeJobs(b.name, b.dir, config);
3444
+ await syncFleetRuntimeJobs(b.name, b.dir, config);
3444
3445
  }
3445
3446
  if (opts.busy?.()) {
3446
3447
  patchBotConfig(b.dir, { fleetRestartPending: true });
@@ -3464,7 +3465,7 @@ async function restartBot(nameArg, opts = {}) {
3464
3465
  if (isFleetRuntimeBot(b.config)) {
3465
3466
  refuseHeldFleetBot(b.dir);
3466
3467
  const adopted = await adoptFleetRuntimeProfile(b.name, b.dir, b.config);
3467
- const result = runFleetRuntimeControl(b.name, b.config, adopted ? "install" : "restart", opts.output === "silent" ? "silent" : opts.json === true || opts.output === "json");
3468
+ const result = await runFleetRuntimeControl(b.name, b.config, adopted ? "install" : "restart", opts.output === "silent" ? "silent" : opts.json === true || opts.output === "json");
3468
3469
  return { ok: result.ok === true, detail: typeof result.summary === "string" && result.summary ? result.summary : null };
3469
3470
  }
3470
3471
  const running = readBotStatus(b.dir);
@@ -3577,7 +3578,7 @@ export async function runBotAuth(nameArg, opts) {
3577
3578
  clearFleetMoveRecords(b.dir);
3578
3579
  fs.rmSync(botCredsPath(b.dir), { force: true });
3579
3580
  createBotLogger(b.dir)("info", `moved ${b.name} to the HQ Fleet Runtime with its ${opts.provider} sign-in; its ${legacy.runtime} runner is retired`);
3580
- syncFleetRuntimeJobs(b.name, b.dir, moved);
3581
+ await syncFleetRuntimeJobs(b.name, b.dir, moved);
3581
3582
  retireLegacyBotAgent(b.name, b.dir, legacy, "inline");
3582
3583
  }
3583
3584
  const signedInRuntime = result.runtimeProvider === "anthropic" ? "claude" : result.runtimeProvider === "xai-oauth" ? "grok" : result.runtimeProvider === "openai-codex" ? "codex" : null;
@@ -4286,7 +4287,7 @@ export function registerBotCommand(program) {
4286
4287
  if (isFleetRuntimeBot(b.config)) {
4287
4288
  refuseHeldFleetBot(b.dir);
4288
4289
  const adopted = await adoptFleetRuntimeProfile(b.name, b.dir, b.config, { progress: fleetInstallProgressReporter(opts.json ? "silent" : "text") });
4289
- runFleetRuntimeControl(b.name, b.config, adopted ? "install" : "start", opts.json === true);
4290
+ await runFleetRuntimeControl(b.name, b.config, adopted ? "install" : "start", opts.json === true);
4290
4291
  return;
4291
4292
  }
4292
4293
  await startBot(b.name, b.dir, b.config, opts.json ? "json" : "text");
@@ -4299,7 +4300,7 @@ export function registerBotCommand(program) {
4299
4300
  const b = requireBot(name);
4300
4301
  if (isFleetRuntimeBot(b.config)) {
4301
4302
  refuseHeldFleetBot(b.dir);
4302
- runFleetRuntimeControl(b.name, b.config, "stop", opts.json === true);
4303
+ await runFleetRuntimeControl(b.name, b.config, "stop", opts.json === true);
4303
4304
  return;
4304
4305
  }
4305
4306
  await stopBot(b.name, b.dir, b.config, opts.json ? "json" : "text");