@indigoai-us/hq-cli 5.345.230 → 5.345.232
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +54 -0
- package/README.md +3 -2
- package/assets/lanes-reconcile/hq-lanes-reconcile.service +1 -1
- package/assets/scaffold/core/scripts/pipeline-conductor.sh +14 -14
- package/assets/scaffold/core/scripts/pipeline-driver.sh +7 -7
- package/assets/scaffold/core/scripts/session-project.sh +19 -4
- package/dist/command-catalog.generated.d.ts +213 -177
- package/dist/command-catalog.generated.js +263 -212
- package/dist/command-registration-plan.d.ts +6 -24
- package/dist/command-registration-plan.js +4 -8
- package/dist/commands/auth.js +3 -2
- package/dist/commands/core-pipeline-conductor-command.js +1 -1
- package/dist/commands/core-pipeline-conductor-native.js +5 -5
- package/dist/commands/core-pipeline-driver-native.js +5 -5
- package/dist/commands/crm.js +2 -1
- package/dist/commands/daemon.js +7 -36
- package/dist/commands/deploy-access.js +6 -13
- package/dist/commands/deploy-comments.js +5 -13
- package/dist/commands/deploy-domains.js +6 -13
- package/dist/commands/deploy-list.js +25 -11
- package/dist/commands/deploy-mutations.d.ts +3 -0
- package/dist/commands/deploy-mutations.js +147 -0
- package/dist/commands/link.js +29 -0
- package/dist/commands/mesh.js +3 -1
- package/dist/commands/packs.js +3 -2
- package/dist/commands/pkg-remove.js +2 -1
- package/dist/commands/report.js +12 -9
- package/dist/data/command-states.json +10 -7
- package/dist/lib/bot/fleet-bots-update-pass.d.ts +8 -0
- package/dist/lib/bot/fleet-bots-update-pass.js +40 -0
- package/dist/lib/bot/fleet-bots-update-task.d.ts +12 -0
- package/dist/lib/bot/fleet-bots-update-task.js +52 -0
- package/dist/lib/bot/fleet-bots-update-worker-v1.d.ts +2 -0
- package/dist/lib/bot/fleet-bots-update-worker-v1.js +5 -0
- package/dist/lib/daemon/catalog.d.ts +8 -5
- package/dist/lib/daemon/catalog.js +15 -8
- package/dist/lib/daemon/hook-requests-codex-settings.d.ts +26 -0
- package/dist/lib/daemon/hook-requests-codex-settings.js +185 -0
- package/dist/lib/daemon/hook-requests-conduct-link.d.ts +1 -0
- package/dist/lib/daemon/hook-requests-conduct-link.js +21 -4
- package/dist/lib/daemon/hook-requests.d.ts +3 -2
- package/dist/lib/daemon/hook-requests.js +16 -3
- package/dist/lib/daemon/lock.js +33 -37
- package/dist/lib/daemon/ops/skill-command.d.ts +99 -0
- package/dist/lib/daemon/ops/skill-command.js +260 -0
- package/dist/lib/daemon/protocol.d.ts +1 -1
- package/dist/lib/daemon/protocol.js +1 -0
- package/dist/lib/daemon/run.js +10 -18
- package/dist/lib/daemon/server.js +7 -0
- package/dist/lib/daemon/supervisor.d.ts +5 -0
- package/dist/lib/daemon/supervisor.js +17 -2
- package/dist/lib/db/app-ref.js +10 -15
- package/dist/lib/deploy-apps.d.ts +29 -0
- package/dist/lib/deploy-apps.js +37 -0
- package/dist/lib/doctor/checks/search-index.d.ts +16 -0
- package/dist/lib/doctor/checks/search-index.js +61 -0
- package/dist/lib/doctor/checks/stranded-lanes.js +1 -1
- package/dist/lib/doctor/registry.js +4 -0
- package/dist/lib/flag-registry.d.ts +7 -0
- package/dist/lib/flag-registry.js +20 -0
- package/dist/lib/hook-engine/coverage.d.ts +18 -0
- package/dist/lib/hook-engine/coverage.js +42 -1
- package/dist/lib/lanes/accounts.js +3 -3
- package/dist/lib/lanes/admission-host.js +1 -1
- package/dist/lib/lanes/admission.js +4 -4
- package/dist/lib/lanes/autopilot.js +2 -2
- package/dist/lib/lanes/blocker-freshness.js +1 -1
- package/dist/lib/lanes/compaction.js +5 -5
- package/dist/lib/lanes/delivery.js +1 -1
- package/dist/lib/lanes/depth-cap.js +1 -1
- package/dist/lib/lanes/disk-guard.js +1 -1
- package/dist/lib/lanes/dropbox.js +1 -1
- package/dist/lib/lanes/hooks-install.js +1 -1
- package/dist/lib/lanes/imported-question.js +1 -1
- package/dist/lib/lanes/keep-alive.d.ts +2 -2
- package/dist/lib/lanes/keep-alive.js +3 -3
- package/dist/lib/lanes/kr-freshness.js +1 -1
- package/dist/lib/lanes/links.js +92 -11
- package/dist/lib/lanes/loop.js +2 -2
- package/dist/lib/lanes/machine-identity.js +3 -3
- package/dist/lib/lanes/models.js +6 -6
- package/dist/lib/lanes/quota.js +1 -1
- package/dist/lib/lanes/reconcile-install.js +3 -3
- package/dist/lib/lanes/reconcile.js +16 -16
- package/dist/lib/lanes/remote-control-lane.js +6 -6
- package/dist/lib/lanes/reviews.js +2 -2
- package/dist/lib/lanes/spawn.js +24 -24
- package/dist/lib/lanes/status-fields.js +4 -4
- package/dist/lib/lanes/wait.js +4 -4
- package/dist/lib/lanes/watch.js +2 -2
- package/dist/lib/lanes/watcher-main.js +1 -1
- package/dist/lib/lanes/watcher.js +38 -38
- package/dist/lib/lanes/worker-process.js +5 -5
- package/dist/lib/mesh/live/daemon/pid-lock.d.ts +2 -4
- package/dist/lib/mesh/live/daemon/pid-lock.js +38 -55
- package/dist/utils/exclusive-lock.d.ts +60 -0
- package/dist/utils/exclusive-lock.js +65 -0
- package/dist/utils/exit-after-worker.d.ts +7 -0
- package/dist/utils/exit-after-worker.js +15 -0
- package/package.json +8 -7
- package/dist/commands/staff/listings.d.ts +0 -41
- package/dist/commands/staff/listings.js +0 -160
- package/dist/commands/staff/reset-test-account.d.ts +0 -121
- package/dist/commands/staff/reset-test-account.js +0 -285
- package/dist/commands/staff/test-account.d.ts +0 -51
- package/dist/commands/staff/test-account.js +0 -196
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,60 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [5.345.232] — 2026-11-18
|
|
6
|
+
- `hq-hook` claims `codex-adapter:PostToolUse` on Codex only (`PostToolUse@codex`): the Codex adapter's own PostToolUse work is native. `master-hook:PostToolUse` and each settings command keep their own ids and stay unclaimed, so PostToolUse stays on the old dispatcher.
|
|
7
|
+
- hq-hook can now build and leave a `codex-settings` request note for the HQ daemon: one Codex PostToolUse call's `.claude/settings.json` records, with the payload as the note's body. It refuses a note the daemon would drop. No hook calls it yet, and no hook claim changes.
|
|
8
|
+
- Add authenticated deploy create, archive upload, takedown, password/private gate, and app inspection commands for company and personal scopes. `hq deploy list --personal` lists the personal deploy scope, so the deploy skills can find a personal app without calling the API themselves.
|
|
9
|
+
- Every command that takes a deploy app by id, subdomain or name (`hq deploy comments`, `hq deploy access`, `hq deploy domains --app`, `hq db --app`) now finds it the same way: equal to the app's id, subdomain or name, ignoring case, and refused when more than one app fits. `hq deploy comments` now also accepts a subdomain and ignores case; `hq db --app` now ignores case. `hq report` publishing uses the same lookup but keeps its exact rule: it reuses an app only when the app's subdomain or name equals the report address, case included, never by id; it now refuses an address that fits two apps instead of taking the first.
|
|
10
|
+
- `hq auth status` and the `hq mesh` thread commands (`start`, `progress`, `blocked`, `done`, `note`, and every other `hq mesh` subcommand that fails through the same handler) stop the background flag-registry worker before they exit with an error, so they no longer risk a crash at exit (SIGSEGV on Node 20 and 22) after printing their message.
|
|
11
|
+
- On Grok, a native `list_dir` or `ListDir` call with any target and a `prd.json` or `worker.yaml` pattern is now refused with the message the released adapter gives, instead of being allowed; `Glob` gets the same bytes the adapter writes.
|
|
12
|
+
- The native hook engine's Grok PreToolUse work (not yet switched on) now records, with a test, the calls it refuses that the released Grok adapter allowed without running any hook: a write or edit that names no file, Grok's workflow tool, and a call that names no tool. Calls the adapter skipped and native also allows are checked byte for byte.
|
|
13
|
+
- The seven staff-only commands under `hq staff` (`reset-test-account`, `test-account add`, `remove` and `list`, `listings queue`, `approve` and `reject`) are no longer part of the public CLI. They were marked as being retired in an earlier release; now `hq --help --all` no longer lists them and `hq staff` is an unknown command. The server already refused them to anyone who is not staff. Staff run them from a staff-only tool outside the public CLI.
|
|
14
|
+
- The hq-hook build-identity check now reads Windows paths (backslashes, mixed separators, the `\\?\` prefix `canonicalize` adds, either drive-letter case) the same as slash paths, so test fixtures under `crates/hq-hook/tests` count as fixtures on Windows too and every platform checks the same embedded inputs against the same fingerprinted set.
|
|
15
|
+
- Hooks: the native fleet-local PreToolUse member (not registered yet) now runs the released fleet-local adapter's env dump check on a Bash command and on a Codex exec approval's resolved command, in-process and in the adapter's order, with the adapter's two messages. Where the adapter's verdict depends on the locale, the grep or a Windows carriage return, it blocks whenever any of them would.
|
|
16
|
+
- Hooks: the native fleet-local PreToolUse member now runs the released adapter's sensitive home path check, after the gate and parent scope checks and before the dispatcher and settings checks, as the adapter does. It reads the Bash command, the Read, Grep, Glob, Edit and Write paths, and on the approval path the resolved exec command and each `apply_patch` path. It blocks with the adapter's message. When it cannot decide (for example `HOME` unset or not UTF-8, or an input shape it does not model) it refuses. The member is still not registered. It reads the runtime tool name as the adapter's shell holds it (trailing newlines cut, NUL bytes dropped), and refuses when `HOME` contains a newline or a carriage return.
|
|
17
|
+
- Internal: the `hq-hook` mesh tool-writes parity test's stand-in daemon now runs only the request notes of the hook call whose shim started it, and runs them with its own environment as the HQ daemon does. A stand-in started late by an earlier call on a loaded machine could take a later call's prd-sync note and run it with the wrong stub settings (the Linux CI failure of "f14 same-company switch: prd-sync missing"). Test-only; no behaviour change.
|
|
18
|
+
- `hq-hook` now trusts the `hook-engine-port-*` flags for 15 minutes instead of 24 hours. When the newest flag snapshot (or the daemon's state file) for the scope is older than that, every port flag reads as off and the bridged hooks run in bash, so a hook-engine kill switch reaches a machine without a fresh daemon, including on Windows, within 15 minutes. Every other flag keeps the 24-hour bound. Guards that cannot decide still refuse; only the engine that answers changes.
|
|
19
|
+
- Internal: hq-hook's native Codex SubagentStop `conduct-lanes-link-deliver` note now carries the event's time (`args.at`), so the daemon's `_deliver` run takes only link messages queued at or before the event and leaves later ones queued for the root's next PostToolUse or Stop, as the released adapter's run during the event did. The `us050sas-deliver-note` ledger row loses its second loss.
|
|
20
|
+
- Internal: the manual sign-in tests now bind the registered callback port 8765 instead of 53682. 53682 lies inside the operating system's ephemeral port range, so another test's server could be given it and four sign-in tests failed together with "port 53682 stayed busy". No change to `hq login` itself.
|
|
21
|
+
- `session-project.sh append-event` (and the other locked writes) no longer exits with "could not acquire project write lock" on Windows when the project lock was just released. Windows keeps a removed lock directory delete-pending while another process still holds a handle, and creating it again fails with EPERM, EACCES or EBUSY instead of EEXIST; the shell writer now waits on those codes like the native writer already did, and retries removing its own lock so no ownerless lock directory is left behind. The five-second wait is unchanged, and other platforms still fail fast on those codes.
|
|
22
|
+
- `hq resolve-company --prompt "<text>"` (with optional `--root <dir>`) now resolves the active company for skills and routing (whole-token manifest slug in the text, then the session's company, then the enabled device default) and prints `{"company":"<slug>","source":"prompt|session|device_default|none"}`. It runs the same resolver as `hq core resolve-company --prompt`, so skills can move to the one public command (US-030 c1). `--prompt` cannot be combined with `--path`, and unlike folder mode it does not need HQ Anywhere.
|
|
23
|
+
- hq-hook: `hq-hook bridge inject-policy-on-trigger` takes `--host codex|grok`, the call the released Codex and Grok adapters make when `hook-engine-port-inject-policy-on-trigger` is on, and answers the policy injector natively there, byte for byte as the bash injector the adapter runs today. It keeps bash (exit 75, no output) on a payload that is not one JSON object, a harness that names another host, no HQ root, any other hook id, and on Grok whenever a held-reminder switch is set or a held store exists, and where the Rust state store is off (Windows until US-022), where the native injector would deny every prompt. The native injector now evaluates Grok's PostToolUse for the current injector release, as the bash injector does (US-014).
|
|
24
|
+
- Internal: the host canary (`scripts/host-canary.mjs`) takes `--turns` for Codex and Grok, default 3 (Claude stays at 1). With two or more turns it compares every native policy-injector answer with the bash injector's answer on the same payload, run through the host's released adapter, `hook-adapter-core.sh` and `hook-gate.sh` on a copy of the root cut down to the injector row, after the host exits, in a throwaway HOME, and reports counts only. A parity failure fails the host's canary record.
|
|
25
|
+
- CI: release-tag runs now check, on the Windows "core utility parity" job, that `hq-hook bridge-plan` leaves the state-store ports out where the store is off, and that a Claude Code prompt through master-hook with `hook-engine-port-inject-policy-on-trigger` on is answered by the bash hook instead of the port's store-off deny.
|
|
26
|
+
- User-facing text now names `hq runners` instead of the deprecated `hq lanes` alias: the `hq daemon` remote-control pool `--account-id` help and its HQ-folder error, the `hq doctor` stranded-lane fix command, the `hq-lanes-reconcile.service` ExecStart (bundled asset and the unit `hq runners reconcile install` writes), the bundled `pipeline-conductor.sh` and `pipeline-driver.sh` calls and messages (and the matching native conductor and driver messages), `docs/lanes.md`, `docs/conductor-delivery.md`, and the stderr prefixes and hints in the runners library where no test pins the old text. `hq lanes` still works as an alias with the same routing, and hooks still recognise calls made with the old name.
|
|
27
|
+
- `hq-hook run` has a native `enforce-vault-write-access` in the PreToolUse path rules for Edit, Write, MultiEdit and NotebookEdit, with master-hook's `.hq/vault-access.json` file prefilter, matching the released bash guard; it starts no program. Bash keeps the shell hook and the id is not claimed yet (owner ruling: keep every released block).
|
|
28
|
+
- hq-hook now handles `40-skill-command-script` on UserPromptSubmit itself. It starts no program: when a `/command` prompt resolves to a skill's `command.sh`, it asks the HQ daemon over its socket (new request `skill.command`) and waits up to the daemon's own 2-second request timeout. hqd runs the pinned released hook with the caller's payload and folder, in an environment it builds itself (the hook's own settings, hqd's own PATH, the verified HQ root as HQ_ROOT, and never BASH_ENV, ENV, exported functions, SHELLOPTS, BASHOPTS or CDPATH), and the output is shown to the person only. If the hook, hook-lib.sh, or a session-scope-capability.sh or perl-child-locale.sh present on disk is not the pinned release (hqd checks the same pins), or HQ_ROOT names another checkout, the whole UserPromptSubmit event goes to the released shell hooks instead. With no daemon, a timeout, a daemon refusal or an input the native check cannot decide, the prompt is refused with one message that names hqd and says to start it with `hq daemon start`.
|
|
29
|
+
- hq-hook: `hq-hook run --host codex Stop` now gives the Codex adapter's own Stop answer natively. A hook's block is read as the adapter read it (every block object on stdout, or the last JSON line after words, Windows line ends included), the reason loses its trailing newlines and is not cut, context JSON goes out as its text, and words from a hook that exits 1 are shown. Native stays stricter in four recorded cases: a block with no usable text reason, a block whose JSON holds a bare carriage return, a hook that exits 2, and a payload that names another event all block. `codex-adapter:Stop` is claimed. New parity test against the released adapter (US-050 c1).
|
|
30
|
+
- The native hook engine now does the old dispatcher's Task-agent work on Claude Code's SubagentStart: a new subagent's scope tuple is pinned from the main thread's company lock set (never over an existing tuple), and the subagent's company picks the folder hooks, as before. Under a scope library version the engine does not model, that SubagentStart work is refused natively with the reason on stderr. SubagentStart is not switched over by this change. The parent's multi-company lock is read with the multi-company-session-lock switch, so a subagent is never pinned wider than the old dispatcher pinned it.
|
|
31
|
+
- The native hook engine now claims the old dispatcher's own work on SubagentStart on Claude Code and Grok Build (session bind, duplicate-event check, timeout journal, and on Claude Code the Task-agent scope pin), as it does for Notification, so SubagentStart has no unclaimed hook left in the coverage list. On Grok Build it runs after the adapter's own subagent company bind, as the adapter did. If an HQ has a SubagentStart hook that the engine does not run, the native event does none of that work and prints why on stderr; run `hq reindex` to keep the event on the old dispatcher while such a hook exists. `hq reindex` still keeps SubagentStart on the old dispatcher until the engine reports `lifecycle-dispatch`.
|
|
32
|
+
- Internal: the native Grok PostToolUse port now pins the beta.121 adapter generation (adapter b9075b2f, core 940bb5a0) that current hq-core ships, counting the `HQAD_DISPATCHER_PID` its core exports in the jq byte budget at the widest pid. Before, every Grok tool call on a current root failed closed as an unknown adapter.
|
|
33
|
+
- The daemon's search-index timer no longer falls back to starting `hq index sync` when its in-process worker cannot run (the daemon could not hand its package lease to the worker, or a rollback left an install without the worker). It now schedules nothing, marks the `search-index` unit unavailable with the reason in `hq daemon status`, and a new `hq doctor` check (`search-index.schedule`) warns that the search index is not refreshed on a timer and how to fix it. Running `hq index sync` by hand is unchanged.
|
|
34
|
+
- The daemon's HQ Fleet bot update (`fleet-bots-update`, every 30 minutes) no longer starts a fresh `hq daemon service fleet-bots-update` process. It runs as a daemon internal task on a worker thread, with the same eligibility checks and update steps as before (the command and the task share one function). A failing or crashing pass is recorded as a failed run and stops no other daemon work. `hq daemon service fleet-bots-update` still runs one pass by hand.
|
|
35
|
+
|
|
36
|
+
## [5.345.231] — 2026-11-18
|
|
37
|
+
- The daemon now runs a new `codex-settings` request note: the `.claude/settings.json` PostToolUse commands of one Codex tool call, started one by one with the payload on stdin and the variables the released Codex adapter gave its hooks (`HQ_CHECKPOINT_RUNTIME=codex`, `HQ_HARNESS=codex`, `HQ_WORK_MESH_HARNESS=codex`, `BASH_ENV=/dev/null`, `HQ_ROOT` and `CLAUDE_PROJECT_DIR` set to the root, `HQAD_EVENT_SESSION_ID`; no `HQ_WORK_MESH_DISABLED`). A command the root's settings no longer list is refused. No hook leaves this note yet, and `codex-adapter:PostToolUse` stays unclaimed.
|
|
38
|
+
- `hq-hook run --host codex PreToolUse` now refuses a Codex `apply_patch`, `Edit` or `Write` into `companies/_template/` natively, with the released Codex adapter's own message (`block_template_edit_if_needed`). It also refuses the readings other machines' adapters refused (a CR in the tool name, other case, backslashes, symlinks) and a path it cannot resolve. `codex-adapter:PreToolUse` stays unclaimed. An edit path holding a NUL byte is refused, a Git Bash `/c/...` or cygwin `/cygdrive/c/...` path is read as `C:/...`, and with no `--hq-root` the edit is refused instead of falling back to `HQ_ROOT`, `CLAUDE_PROJECT_DIR` or the cwd. A template edit in a root with no `.claude/hooks/hook-gate.sh` is refused too, where the adapter exited 0 before any check.
|
|
39
|
+
- `hq crm entity list` and `hq crm entity get` stop the background flag-registry worker before they exit with an error, so they no longer risk a crash at exit (SIGSEGV on Node 20 and 22) after printing their message.
|
|
40
|
+
- `hq report` subcommands that fail (`access`, `discard-draft`, `promote`, and the others that share the same handler) stop the background flag-registry worker before the CLI exits, so they no longer risk a crash at exit (SIGSEGV on Node 20 and 22) after printing their message.
|
|
41
|
+
- `hq packages remove`, `hq packages packs list` and `hq packages packs uninstall` stop the background flag-registry worker before they exit with an error, so the CLI no longer risks a crash at exit (SIGSEGV on Node 20 and 22) after printing its message.
|
|
42
|
+
- hq-hook: `grok-adapter:PostToolUse` is claimed (US-050). The Grok adapter's own PostToolUse work is native: the payload rebuild and output contract, the `auto-capture-registry` supplement, and beta.68's held-policy-reminder flush, which the port refuses where the adapter would run it (nothing is started and the held text stays). `master-hook:PostToolUse` keeps its own id, so PostToolUse stays on the old dispatcher. Off Unix, an `hq` found only in Git Bash's own `PATH` folders (Git's `mingw64\bin` and `usr\bin`, `~/bin`) now counts as not known, so the Grok reindex row refuses there instead of allowing.
|
|
43
|
+
- `scripts/replay-harness.mjs` replays recorded Grok Build events as Grok Build runs them: the old side through the released adapter `.grok/hooks/hq-grok-hook-adapter.sh` (from `.grok/hooks`, with `GROK_HOOK_EVENT` and `GROK_WORKSPACE_ROOT`), the new side through the Grok user bridge file and script installed in the run's home as `hq reindex` installs them, not `hq-hook run` directly. A Grok event Grok Build never sends, a root without the adapter or the bridge, and a bridge entry the harness does not model (a tool matcher, more than one command) are reported, never compared as a pass.
|
|
44
|
+
- Test the Grok SubagentStop master-hook handoff against the released adapter for each stop-gate input (stopHookActive true, snake case, non-boolean, absent, a reason, no transcript).
|
|
45
|
+
- Internal: the `hq-hook` cleanup-mcp parity test for protected workflow runners now waits until the runner's helper is up before the hook runs, so a loaded machine can no longer run the hook while only the runner is there. Test-only; no behaviour change.
|
|
46
|
+
- The hq-hook engine now lists hq-core 16.0.48 in its core pins, so the latest-release pin check passes again. The credential guard (`block-credential-file-read`) stays on its bash hook for 16.0.48: the release ships script 6512581d with arithmetic library e90d160f, which the native port does not reproduce yet, and the commands that library newly allows wait for the owner's review first. Five other hooks are recorded as running on bash for 16.0.48 for the same reasons as on 16.0.48-beta.124.
|
|
47
|
+
- Hooks: the native fleet-local PreToolUse member now matches settings records on a `pre_approval_request` the way the released adapter dispatches them: an exec approval matches as tool `Bash` and an apply_patch approval as tool `Edit`. Before, it matched on the approval type (`exec`, `apply_patch`), so a `Bash` or `Edit` matcher that blocks in the adapter was not seen. An approval type other than exec or apply_patch refuses. The member is not registered yet, so nothing live changes.
|
|
48
|
+
- Hooks: the native fleet-local PreToolUse member (not registered yet) now models the released adapter's core and template edit checks: an Edit or Write (or any path of an `apply_patch` approval) into `core/` (unless `HQ_BYPASS_CORE_PROTECT` is set) or `companies/_template/` is refused with the adapter's own message. Paths are resolved in-process, with no `realpath` program; a path that reaches a protected folder through a symlink (a dangling one included, followed to its missing target as GNU `realpath` does), a different letter case or a carriage return is refused too, and a path the check cannot resolve is refused. The runtime tool name is read as the adapter's shell reads it (NUL bytes dropped, trailing newlines cut), so `patch\n`, `Edit\n` or `write_file\n` into `core/` is refused like `patch`, `Edit` or `write_file`, and an `apply_patch` approval that carries no usable path is refused with the adapter's own "carried no paths" message.
|
|
49
|
+
- Hooks: the native fleet-local `pre_tool_call` member (not registered yet) now sets up a subagent session's inherited company scope in process, as the released fleet-local adapter does: it reads the parent from the fleet `state.db`, drops HQ's `personal` placeholder, and writes the capability, the adapter's marker and the `meta.yaml` lines. It starts no program. Where it cannot decide (a CR that changes the decision, a capability file it cannot read as JSON) it blocks the tool call.
|
|
50
|
+
Because it never starts `sqlite3`, a `sqlite3` that fails when run is not modelled: where the released adapter would then inherit nothing, native reads a readable `state.db` and inherits the parent's scope, which only narrows the session. A `state.db` it cannot read still blocks.
|
|
51
|
+
- `hq-hook` builds again: the fleet-local PreToolUse member passes the inherited-scope context (its `PATH` read and parent-scope mint) through the shared answer path that both the PreToolUse and the approval-request answers use.
|
|
52
|
+
- Let an hq-hook coverage claim name the hosts it is for (`SubagentStop@codex`), so a claim on one host no longer switches the same event on the others; claims without a host set mean every host, as before.
|
|
53
|
+
- Internal: `hq lanes link _deliver` honours `HQ_LINK_DELIVER_QUEUED_AT_OR_BEFORE` (UTC `...Z` time): it drains or claims only link messages queued at or before it and leaves later ones queued for the next PostToolUse or Stop; a value it cannot read takes nothing. The daemon's `conduct-lanes-link-deliver` note may carry `args.at`, which the daemon passes to the root's hook script as that variable. Unset, every delivery path is unchanged. Nothing writes `args.at` yet.
|
|
54
|
+
- `hq-hook bridge-plan` no longer lists `inject-policy-on-trigger`, `policy-enforcement-gate` or `image-context-guard` on a platform where the Rust state store is off (Windows until US-022), whatever their `hook-engine-port-*` flag says. master-hook then runs the bash hooks exactly as with the flag off. Before, turning `hook-engine-port-inject-policy-on-trigger` on blocked every Claude Code prompt on Windows with the injector's store-off deny. On macOS and Linux the plan is unchanged, and a port that does run still never hands a call back to bash.
|
|
55
|
+
- hq-hook: on hq-fleet-local, `hq-hook run` now claims the fleet-local adapter's SessionEnd work, including the `on_session_reset` alias. With the released settings, session end runs natively and gives the adapter's answer: exit 0 and empty stdout. A `master-hook.sh` command listed under SessionEnd for another event now goes to the HQ daemon on the same `fleet-local-settings` request note as after a tool call, with event `SessionEnd`. The daemon accepts that event. Any other settings command at session end is still refused natively, as on Codex and Grok. The `cleanup-mcp-processes` registry row now runs on that session end as the released adapter ran it, instead of being refused. It reads the exit reason from the runtime's own payload, stops the session's own MCP helpers and sweeps old temp files. It writes no report line, because the adapter drops master-hook's stderr when master-hook exits 0. The agents-v2 runtime is still refused.
|
|
56
|
+
- Internal: the native Codex SubagentStop runner in `hq-hook` now leaves a `conduct-lanes-link-deliver` or `conduct-link-inherit` request note for the HQ daemon where the released adapter's hook would start `hq`, instead of refusing, and still refuses where a note cannot carry the session id or cannot be left. It also decides payloads that carry Codex's own `hook_event_name` and skips the two rows when the registry lists them `gated: false` (the adapter then runs them with no event argument, so they exit at once), as the released adapter does; parity rows run the released adapter. Still not wired: `codex-adapter:SubagentStop` stays unclaimed while `master-hook:SubagentStop` is not modelled for Codex.
|
|
57
|
+
- `hq-hook run --host grok SubagentStart` now does the released Grok adapter's own subagent company bind and claims it (`grok-adapter:SubagentStart` in `hq-hook capabilities --json`): a subagent with a parent session takes its parent's company, then the spawn company, then the device default (read in process; no program is started from the hook), as `bind_subagent_once` did. A bind it cannot decide writes nothing and refuses the event, with the reason on stderr.
|
|
58
|
+
|
|
5
59
|
## [5.345.230] — 2026-11-18
|
|
6
60
|
- `hq-hook run --host codex PreToolUse` with no `--hq-root` no longer trusts `HQ_ROOT`, `CLAUDE_PROJECT_DIR` or the cwd as the Codex adapter's root for the explicit-path guard: it keeps a refusal from that fallback root and refuses every other Codex Bash call, because the adapter's root was its own location.
|
|
7
61
|
- The HQ daemon now takes two new hook request notes, `conduct-lanes-link-deliver` and `conduct-link-inherit`, for the two programs the Codex adapter started at SubagentStop (`hq lanes link _deliver` and the conduct-link invite settle). Each note carries only the session id; the daemon runs the HQ root's own `.claude/hooks/conduct-lanes-link-deliver.sh` or `.claude/hooks/conduct-link-inherit.sh` with `PostToolUse` and `{"session_id": ...}` on stdin, as the adapter did, and drops their output as the adapter did on SubagentStop. No hook leaves these notes yet.
|
package/README.md
CHANGED
|
@@ -52,10 +52,11 @@ List the hq-deploy apps in your company. Each line shows the app name, public
|
|
|
52
52
|
URL, type, access mode and last activity time (updated, last visit or created,
|
|
53
53
|
whichever the API returns). The optional `query` filters case-insensitively by
|
|
54
54
|
substring across name, subdomain and title. `--company` defaults to the active
|
|
55
|
-
company.
|
|
55
|
+
company. `--personal` lists your personal deploy scope instead (it cannot be
|
|
56
|
+
combined with `--company`). Use `--json` for machine-readable output.
|
|
56
57
|
|
|
57
58
|
```bash
|
|
58
|
-
hq deploy list [query] [--company <slug>] [--json]
|
|
59
|
+
hq deploy list [query] [--company <slug> | --personal] [--json]
|
|
59
60
|
```
|
|
60
61
|
|
|
61
62
|
An empty unfiltered list prints a hint instead of claiming the org has no apps.
|
|
@@ -103,7 +103,7 @@
|
|
|
103
103
|
#
|
|
104
104
|
# State dir layout:
|
|
105
105
|
# stories/<id>.json phases, current index, state, reroutes, worktree
|
|
106
|
-
# envelopes/<id>-<phase>.json envelopes queued to hq
|
|
106
|
+
# envelopes/<id>-<phase>.json envelopes queued to hq runners
|
|
107
107
|
# handoffs/<id>-<phase>.json accepted phase handoffs
|
|
108
108
|
# decisions/<id>-<worker>.md approval items for the parent session
|
|
109
109
|
# decisions/<id>-blocked-<phase>.md a worker returned status blocked
|
|
@@ -197,7 +197,7 @@
|
|
|
197
197
|
#
|
|
198
198
|
# Exit codes: 0 ok; 1 refused or failed; 2 usage; 3 lane capacity/admission (retry next tick);
|
|
199
199
|
# 10 held for a parent decision (approval hold, or a blocked handoff on accept);
|
|
200
|
-
# 11 lane down: `hq
|
|
200
|
+
# 11 lane down: `hq runners enqueue` returned `loop_not_running` or a terminal
|
|
201
201
|
# lane state. The worker mapping is dropped, the story stays queued, and
|
|
202
202
|
# route prints LANE_DOWN <id> <phase> <worker> ...; tick stops there.
|
|
203
203
|
# 12 no lane: the phase's worker has no row in the run's worker table (NO_LANE);
|
|
@@ -1692,10 +1692,10 @@ function do_route(p, sid) {
|
|
|
1692
1692
|
if (lane) {
|
|
1693
1693
|
let rows;
|
|
1694
1694
|
try {
|
|
1695
|
-
const listed = JSON.parse(run(E.PC_HQ, ["
|
|
1695
|
+
const listed = JSON.parse(run(E.PC_HQ, ["runners", "list", "--json"], { timeout: 30000 }).stdout || "{}");
|
|
1696
1696
|
rows = Array.isArray(listed) ? listed : get(listed, "lanes", null);
|
|
1697
|
-
} catch (e) { die("cannot verify mapped pipeline lane ownership: hq
|
|
1698
|
-
if (!Array.isArray(rows)) die("cannot verify mapped pipeline lane ownership: hq
|
|
1697
|
+
} catch (e) { die("cannot verify mapped pipeline lane ownership: hq runners list returned invalid JSON"); }
|
|
1698
|
+
if (!Array.isArray(rows)) die("cannot verify mapped pipeline lane ownership: hq runners list omitted lanes");
|
|
1699
1699
|
const row = rows.find(x => isDict(x) && get(x, "lane_id") === lane);
|
|
1700
1700
|
if (!row) { delete laneMap[ph.worker]; jsave(lanesFile, laneMap); lane = null; }
|
|
1701
1701
|
else if (get(get(row, "company", {}), "slug") !== company || get(row, "project_id") !== project || get(row, "worker") !== ph.worker) {
|
|
@@ -1709,7 +1709,7 @@ function do_route(p, sid) {
|
|
|
1709
1709
|
const laneBrief = pjoin(laneBriefDir, ph.worker + ".md");
|
|
1710
1710
|
writeText(laneBrief, "# Pipeline loop lane: " + project + " / " + ph.worker + "\n\n" +
|
|
1711
1711
|
"Pipeline phases arrive as queued envelopes. Follow each envelope; this standing brief has no task of its own.\n");
|
|
1712
|
-
const createArgs = ["
|
|
1712
|
+
const createArgs = ["runners", "create", "--loop", "--company", company, "--project", project,
|
|
1713
1713
|
"--story", sid, "--worker", ph.worker, "--brief-file", abspath(laneBrief), "--senior", "session:" + session, "--json"];
|
|
1714
1714
|
const table = get(or(jload(sp("run.json"), {}), {}), "table", "");
|
|
1715
1715
|
if (T(table) && exists(table)) {
|
|
@@ -1722,10 +1722,10 @@ function do_route(p, sid) {
|
|
|
1722
1722
|
const createError = get(answer, "error", null);
|
|
1723
1723
|
const code = S(isDict(createError) ? get(createError, "code", get(answer, "code", "create_failed")) : (createError || get(answer, "code", "create_failed")));
|
|
1724
1724
|
if (/admission|capacity|full|limit/i.test(code)) { st.state = "queued"; jsave(sfile(sid), st); print("RETRY " + sid + " " + S(ph.phase) + " lanes-" + code); exit(3); }
|
|
1725
|
-
die("hq
|
|
1725
|
+
die("hq runners create refused pipeline phase: " + code + " " + strip(created.stderr));
|
|
1726
1726
|
}
|
|
1727
1727
|
lane = get(answer, "lane_id", get(answer, "lane"));
|
|
1728
|
-
if (!T(lane)) die("hq
|
|
1728
|
+
if (!T(lane)) die("hq runners create returned no lane_id");
|
|
1729
1729
|
laneMap[ph.worker] = lane;
|
|
1730
1730
|
jsave(lanesFile, laneMap);
|
|
1731
1731
|
}
|
|
@@ -1733,7 +1733,7 @@ function do_route(p, sid) {
|
|
|
1733
1733
|
const suffixes = or(get(st, "envelope_suffixes"), {});
|
|
1734
1734
|
envData.id = baseEnvelopeId + (suffixes[ph.phase] ? ".r" + suffixes[ph.phase] : "");
|
|
1735
1735
|
envData.result_path = abspath(sp("handoffs", sid + "-" + ph.phase + ".json")); jsave(ep, envData);
|
|
1736
|
-
let r = run(E.PC_HQ, ["
|
|
1736
|
+
let r = run(E.PC_HQ, ["runners", "enqueue", lane, "--envelope", abspath(ep)], { timeout: 30000 });
|
|
1737
1737
|
let ans; try { ans = JSON.parse(r.stdout); } catch (e) { ans = {}; }
|
|
1738
1738
|
let enqueueError = get(ans, "error", null);
|
|
1739
1739
|
let code = S(isDict(enqueueError) ? get(enqueueError, "code", get(ans, "code", "enqueue_failed")) : (enqueueError || get(ans, "code", "enqueue_failed")));
|
|
@@ -1742,7 +1742,7 @@ function do_route(p, sid) {
|
|
|
1742
1742
|
const n = Number(suffixes[ph.phase] || 0) + 1;
|
|
1743
1743
|
suffixes[ph.phase] = n; st.envelope_suffixes = suffixes; envData.id = baseEnvelopeId + ".r" + n;
|
|
1744
1744
|
jsave(sfile(sid), st); jsave(ep, envData);
|
|
1745
|
-
r = run(E.PC_HQ, ["
|
|
1745
|
+
r = run(E.PC_HQ, ["runners", "enqueue", lane, "--envelope", abspath(ep)], { timeout: 30000 });
|
|
1746
1746
|
try { ans = JSON.parse(r.stdout); } catch (e) { ans = {}; }
|
|
1747
1747
|
enqueueError = get(ans, "error", null);
|
|
1748
1748
|
code = S(isDict(enqueueError) ? get(enqueueError, "code", get(ans, "code", "enqueue_failed")) : (enqueueError || get(ans, "code", "enqueue_failed")));
|
|
@@ -1752,7 +1752,7 @@ function do_route(p, sid) {
|
|
|
1752
1752
|
delete laneMap[ph.worker]; jsave(lanesFile, laneMap); st.state = "queued"; jsave(sfile(sid), st);
|
|
1753
1753
|
print("LANE_DOWN " + sid + " " + S(ph.phase) + " " + S(ph.worker) + " lanes-" + code); exit(11);
|
|
1754
1754
|
}
|
|
1755
|
-
die("hq
|
|
1755
|
+
die("hq runners enqueue failed for " + sid + "/" + S(ph.phase) + ": " + code + " " + strip(r.stderr));
|
|
1756
1756
|
}
|
|
1757
1757
|
st.state = "in_flight"; st.started = true; st.routed_at = now(); pop(st, "held_for");
|
|
1758
1758
|
pop(st, "owner_retry");
|
|
@@ -2425,7 +2425,7 @@ function lane_runs() {
|
|
|
2425
2425
|
|
|
2426
2426
|
function withdraw(lane, sid, ph) {
|
|
2427
2427
|
if (!T(lane)) return false;
|
|
2428
|
-
const r = run(E.PC_HQ, ["
|
|
2428
|
+
const r = run(E.PC_HQ, ["runners", "interrupt", lane, "--story", sid, "--phase", ph, "--json"], { timeout: 30000 });
|
|
2429
2429
|
let ans; try { ans = JSON.parse(r.stdout); } catch (e) { return false; }
|
|
2430
2430
|
const id = sid + "-" + ph;
|
|
2431
2431
|
if ((get(ans, "withdrawn", []) || []).includes(id)) return true;
|
|
@@ -2484,10 +2484,10 @@ function do_stop() {
|
|
|
2484
2484
|
}
|
|
2485
2485
|
do_interrupt("stop: " + (note() || "parent stop command"));
|
|
2486
2486
|
const lanes = Array.from(lane_runs().values());
|
|
2487
|
-
for (const lane of lanes) run(E.PC_HQ, ["
|
|
2487
|
+
for (const lane of lanes) run(E.PC_HQ, ["runners", "stop", lane], { timeout: 30000 });
|
|
2488
2488
|
let listed = null;
|
|
2489
2489
|
try {
|
|
2490
|
-
const parsed = JSON.parse(run(E.PC_HQ, ["
|
|
2490
|
+
const parsed = JSON.parse(run(E.PC_HQ, ["runners", "list", "--json"], { timeout: 30000 }).stdout || "{}");
|
|
2491
2491
|
listed = Array.isArray(parsed) ? parsed : get(parsed, "lanes", null);
|
|
2492
2492
|
} catch (e) { listed = null; }
|
|
2493
2493
|
const stopped = Array.isArray(listed) && lanes.every(id => {
|
|
@@ -135,7 +135,7 @@
|
|
|
135
135
|
# Stall check: --stall-window (default 600 seconds, env PIPELINE_DRIVER_STALL_SECS).
|
|
136
136
|
# The stall starts at the later of the oldest in-flight phase's route time and
|
|
137
137
|
# the last lane status change, and is kept in driver/stall.json so a restart
|
|
138
|
-
# does not reset it. The lane state comes from `hq
|
|
138
|
+
# does not reset it. The lane state comes from `hq runners list --json`
|
|
139
139
|
# (loop state and queue depth). The event fires once per stall;
|
|
140
140
|
# accepting any phase clears it. No notification hook exists for the driver,
|
|
141
141
|
# so firing writes the event and exits 28 for the parent's waiter.
|
|
@@ -260,14 +260,14 @@ stop_lanes() {
|
|
|
260
260
|
lane_file="$STATE/lanes.json"
|
|
261
261
|
while IFS= read -r lane; do
|
|
262
262
|
[ -n "$lane" ] || continue
|
|
263
|
-
"$PC_HQ"
|
|
263
|
+
"$PC_HQ" runners stop "$lane" >/dev/null 2>&1 || true
|
|
264
264
|
done <<EOF
|
|
265
265
|
$(jq -r 'to_entries[] | .value' "$STATE/lanes.json" 2>/dev/null)
|
|
266
266
|
EOF
|
|
267
267
|
deadline=$(( $(date +%s) + 60 ))
|
|
268
268
|
while [ "$(date +%s)" -lt "$deadline" ]; do
|
|
269
269
|
local rows
|
|
270
|
-
rows="$("$PC_HQ"
|
|
270
|
+
rows="$("$PC_HQ" runners list --json 2>/dev/null)"
|
|
271
271
|
if printf '%s' "$rows" | jq -e --slurpfile owned "$lane_file" '
|
|
272
272
|
(if type == "array" then . else .lanes end) as $rows |
|
|
273
273
|
($rows | type == "array") and
|
|
@@ -363,7 +363,7 @@ function laneRows() {
|
|
|
363
363
|
lanes = new Map();
|
|
364
364
|
try {
|
|
365
365
|
const owned = load(path.join(S, 'lanes.json')) || {};
|
|
366
|
-
const r = cp.spawnSync(HQ, ['
|
|
366
|
+
const r = cp.spawnSync(HQ, ['runners', 'list', '--json'], { encoding: 'utf8', timeout: 30000 });
|
|
367
367
|
if (!r.error) {
|
|
368
368
|
const text = String(r.stdout || ''), starts = [text.indexOf('['), text.indexOf('{')].filter((n) => n >= 0);
|
|
369
369
|
const parsed = JSON.parse(starts.length ? text.slice(Math.min(...starts)) : text);
|
|
@@ -575,7 +575,7 @@ function dumps(v) {
|
|
|
575
575
|
let rows = [];
|
|
576
576
|
try {
|
|
577
577
|
const owned = load(path.join(S, 'lanes.json')) || {};
|
|
578
|
-
const r = require('child_process').spawnSync(HQ, ['
|
|
578
|
+
const r = require('child_process').spawnSync(HQ, ['runners', 'list', '--json'], { encoding: 'utf8', timeout: 30000 });
|
|
579
579
|
const text = String(r.stdout || ''), starts = [text.indexOf('['), text.indexOf('{')].filter((n) => n >= 0);
|
|
580
580
|
const parsed = JSON.parse(starts.length ? text.slice(Math.min(...starts)) : text);
|
|
581
581
|
const listed = Array.isArray(parsed) ? parsed : (isObj(parsed) && Array.isArray(parsed.lanes) ? parsed.lanes : []);
|
|
@@ -723,9 +723,9 @@ act() {
|
|
|
723
723
|
LANE_STALLED)
|
|
724
724
|
company="$(jq -r '.company_slug // empty' "$STATE/run.json" 2>/dev/null)"
|
|
725
725
|
lane="$(jq -r --arg w "$d" '.[$w] // empty' "$STATE/lanes.json" 2>/dev/null)"
|
|
726
|
-
questions="$("$PC_HQ"
|
|
726
|
+
questions="$("$PC_HQ" runners questions list --company "$company" --json 2>/dev/null | jq -c --arg lane "$lane" '.questions[]? | select(.lane_id == $lane and .status == "pending")' 2>/dev/null | head -1)"
|
|
727
727
|
log "LANE_QUESTION story=$b phase=$c lane=$lane question=${questions:-missing}"
|
|
728
|
-
finish 28 "loop lane $lane parked after repeated stalls for $b/$c; answer its pending question with hq
|
|
728
|
+
finish 28 "loop lane $lane parked after repeated stalls for $b/$c; answer its pending question with hq runners questions answer, then restart the driver: ${questions:-no pending question returned}" ;;
|
|
729
729
|
INFLIGHT) ;;
|
|
730
730
|
ACTIVE) ACTIVE="$b" ;;
|
|
731
731
|
'') ;;
|
|
@@ -252,6 +252,14 @@ function processIsAlive(pid) {
|
|
|
252
252
|
catch (error) { return error?.code !== "ESRCH"; }
|
|
253
253
|
}
|
|
254
254
|
|
|
255
|
+
// Windows keeps a just-released lock directory or pid file in a delete-pending
|
|
256
|
+
// state while another waiter still holds a handle on it. Creating the same
|
|
257
|
+
// name in that window fails with EPERM, EACCES or EBUSY instead of EEXIST, so
|
|
258
|
+
// it is lock contention and the waiter keeps polling until its deadline.
|
|
259
|
+
function isTransientWindowsLockError(error) {
|
|
260
|
+
return process.platform === "win32" && ["EPERM", "EACCES", "EBUSY"].includes(error?.code);
|
|
261
|
+
}
|
|
262
|
+
|
|
255
263
|
function acquireProjectWriteLock(prdPath) {
|
|
256
264
|
const lock = `${prdPath}.write-lock`;
|
|
257
265
|
const ownerFile = path.join(lock, "pid");
|
|
@@ -260,13 +268,19 @@ function acquireProjectWriteLock(prdPath) {
|
|
|
260
268
|
try {
|
|
261
269
|
fs.mkdirSync(lock);
|
|
262
270
|
try { fs.writeFileSync(ownerFile, `${process.pid}\n`, { flag: "wx" }); }
|
|
263
|
-
catch {
|
|
264
|
-
fs.rmSync(lock, { recursive: true, force: true });
|
|
265
|
-
return undefined;
|
|
271
|
+
catch (error) {
|
|
272
|
+
fs.rmSync(lock, { recursive: true, force: true, maxRetries: 10, retryDelay: 10 });
|
|
273
|
+
if (!isTransientWindowsLockError(error)) return undefined;
|
|
274
|
+
sleepSync(20);
|
|
275
|
+
continue;
|
|
266
276
|
}
|
|
267
277
|
process.once("exit", () => releaseProjectWriteLock(lock));
|
|
268
278
|
return lock;
|
|
269
279
|
} catch (error) {
|
|
280
|
+
if (isTransientWindowsLockError(error)) {
|
|
281
|
+
sleepSync(20);
|
|
282
|
+
continue;
|
|
283
|
+
}
|
|
270
284
|
if (error?.code !== "EEXIST") return undefined;
|
|
271
285
|
let owner = 0;
|
|
272
286
|
try { owner = Number.parseInt(fs.readFileSync(ownerFile, "utf8"), 10) || 0; } catch { /* new owner has not written its pid yet */ }
|
|
@@ -291,7 +305,8 @@ function acquireProjectWriteLock(prdPath) {
|
|
|
291
305
|
function releaseProjectWriteLock(lock) {
|
|
292
306
|
try {
|
|
293
307
|
const owner = Number.parseInt(fs.readFileSync(path.join(lock, "pid"), "utf8"), 10);
|
|
294
|
-
|
|
308
|
+
// Retry so a waiter's open handle on the pid file cannot leave an ownerless lock directory behind.
|
|
309
|
+
if (owner === process.pid) fs.rmSync(lock, { recursive: true, force: true, maxRetries: 10, retryDelay: 10 });
|
|
295
310
|
} catch { /* lock cleanup is best-effort; stale owners are reclaimed */ }
|
|
296
311
|
}
|
|
297
312
|
|