@indigoai-us/hq-cli 5.345.218 → 5.345.219

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 (62) hide show
  1. package/CHANGELOG.md +78 -0
  2. package/dist/command-catalog.generated.d.ts +69 -0
  3. package/dist/command-catalog.generated.js +83 -0
  4. package/dist/commands/agents.d.ts +22 -0
  5. package/dist/commands/agents.js +92 -1
  6. package/dist/commands/core-hook-registration-plan.d.ts +8 -0
  7. package/dist/commands/core-hook-registration-plan.js +21 -0
  8. package/dist/commands/core.js +9 -0
  9. package/dist/commands/doctor.js +4 -0
  10. package/dist/commands/lanes-shared.d.ts +2 -0
  11. package/dist/commands/lanes-watch.js +28 -1
  12. package/dist/commands/lanes.d.ts +2 -0
  13. package/dist/commands/lanes.js +99 -9
  14. package/dist/commands/reindex.js +6 -0
  15. package/dist/index.js +8 -0
  16. package/dist/lib/anywhere-person-setting.d.ts +2 -2
  17. package/dist/lib/anywhere-person-setting.js +2 -2
  18. package/dist/lib/daemon/anywhere-listener.d.ts +33 -1
  19. package/dist/lib/daemon/anywhere-listener.js +86 -4
  20. package/dist/lib/daemon/machine-check-owner.d.ts +21 -0
  21. package/dist/lib/daemon/machine-check-owner.js +95 -0
  22. package/dist/lib/daemon/machine-check-registration.d.ts +4 -0
  23. package/dist/lib/daemon/machine-check-registration.js +64 -0
  24. package/dist/lib/daemon/machine-checks.d.ts +144 -0
  25. package/dist/lib/daemon/machine-checks.js +412 -0
  26. package/dist/lib/daemon/run.js +30 -4
  27. package/dist/lib/daemon/server.d.ts +2 -0
  28. package/dist/lib/daemon/server.js +6 -0
  29. package/dist/lib/daemon/state-file.d.ts +12 -1
  30. package/dist/lib/daemon/state-file.js +23 -1
  31. package/dist/lib/doctor/checks/fleet-hook-core.d.ts +4 -0
  32. package/dist/lib/doctor/checks/fleet-hook-core.js +103 -0
  33. package/dist/lib/doctor/checks/host-core.js +3 -1
  34. package/dist/lib/doctor/checks/machine-checks.d.ts +16 -0
  35. package/dist/lib/doctor/checks/machine-checks.js +103 -0
  36. package/dist/lib/doctor/registry.js +4 -0
  37. package/dist/lib/doctor/types.d.ts +4 -0
  38. package/dist/lib/hook-engine/canary-gate.d.ts +64 -0
  39. package/dist/lib/hook-engine/canary-gate.js +147 -0
  40. package/dist/lib/hook-engine/coverage.d.ts +3 -1
  41. package/dist/lib/hook-engine/coverage.js +8 -2
  42. package/dist/lib/hook-engine/fleet-registration.d.ts +30 -0
  43. package/dist/lib/hook-engine/fleet-registration.js +132 -0
  44. package/dist/lib/hook-engine/reconcile.js +3 -2
  45. package/dist/lib/hook-engine/registration-identity.d.ts +33 -0
  46. package/dist/lib/hook-engine/registration-identity.js +97 -0
  47. package/dist/lib/hook-engine/registration.d.ts +1 -30
  48. package/dist/lib/hook-engine/registration.js +1 -88
  49. package/dist/lib/hook-engine/resolve.d.ts +2 -0
  50. package/dist/lib/hook-engine/resolve.js +7 -3
  51. package/dist/lib/lanes/canonical-host.d.ts +8 -1
  52. package/dist/lib/lanes/canonical-host.js +9 -3
  53. package/dist/lib/lanes/machine-identity.d.ts +15 -0
  54. package/dist/lib/lanes/machine-identity.js +26 -0
  55. package/dist/lib/lanes/spawn.js +17 -3
  56. package/dist/utils/core-next-flag.d.ts +4 -0
  57. package/dist/utils/core-next-flag.js +22 -0
  58. package/dist/utils/core-next-kill.d.ts +16 -0
  59. package/dist/utils/core-next-kill.js +35 -0
  60. package/dist/utils/host-registration.d.ts +33 -23
  61. package/dist/utils/host-registration.js +86 -66
  62. package/package.json +8 -8
package/CHANGELOG.md CHANGED
@@ -2,6 +2,84 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [5.345.219] — 2026-11-15
6
+ - Add `hq agents create-external` so an admin can mint an external bot and
7
+ a one-time enrollment code from the CLI. Console Add bot is hosted-only
8
+ and no longer exposes this path.
9
+ - Reduced test time spent waiting for mocked bot readiness and lane-lock deadlines. Added coverage-provider and slow-file timings to CI output so test execution, worker shutdown, coverage generation, and report writing can be distinguished.
10
+ - The twelve machine checks that ran on every session start or prompt (HQ update, client health, stale model pin, desktop bridge health, review base repair, welcome brief, vault access refresh, setup completeness, fingerprint hooks, agent-browser presence, and the hq CLI and HQ desktop install checks) can now run on the daemon's schedule instead: about a minute after the daemon starts and then hourly, never closer than 15 minutes apart, one at a time, each with its own time limit. The schedule runs when the new hook core (`core.next`) is on for this machine, read at each run so a change takes effect without a daemon restart, and stays off whenever a switch that sends the machine back to the old core is set: `HQ_CORE_NEXT` set to `off`, `0`, `false` or `no`, `HQ_HOOK_ENGINE=off`, or a `~/.hq/state/core-next.off` or `~/.hq/hook-engine.off` file. A script is run only when it is a regular file inside the HQ root with one link, owned by the user and not writable by group or others, in folders that pass the same rules; anything else is reported as not installed or refused and is not run. The results are written owner-only to `~/.hq/daemon/machine-checks.json` and carried into the daemon's state file with each finding's full text and a fingerprint. The hook engine shows each new finding once, at a session start, with no process and no network call, and records what it showed in an owner-only ledger. A finding is recorded as shown only once it is in the session's context; a finding cut or dropped to fit the host's limit is shown at a later start. `hq doctor --only machine-checks` runs the same checks on demand with no daemon (`--verbose` and `--json` include the full text), and a doctor started from inside a check does not start them again.
11
+
12
+ - The legacy dispatcher transfers checks only when this host has a native SessionStart registered for the daemon's HQ root, core.next is enabled, the daemon heartbeat is fresh, and scheduled results exist. The schedule stays dormant without a native SessionStart. Ordinary doctor calls show cached results and their age; only `--only machine-checks` runs repair-capable scripts, with a warning. Findings are recorded as shown only after stdout is written and flushed successfully.
13
+
14
+ - Keep offline machine-check registration and kill-switch queries independent of hook installation metadata so bundled daemon startup and restart work outside the CLI source layout.
15
+ - Isolate launcher and probe test subprocesses from the developer's HQ environment, home, caches and working directory while preserving each test's explicit fixture settings.
16
+ - The host canary (`scripts/host-canary.mjs`) now passes `HQ_FLAG_CORE_NEXT` and the core.next kill switches to the host and its hooks, runs `hq reindex` on its disposable HQ root first (a failed reindex fails the run), and records which command answered each hook, with a per-event `path: shell`, `path: native`, or `path: native+shell` line.
17
+ - New test-only `--fake-full-coverage` mode points that reindex at a stand-in engine that claims every hook, so a canary run can prove the new hook core is actually called.
18
+ - Codex hooks in the host canary are the tracked `.codex/config.toml` registration (parsed; a parse error or missing tool hooks fails the host, as before) combined per event with the `hooks.json` files `hq reindex` rewrites (the user-scope `$CODEX_HOME/hooks.json`, seeded first with what `hq install` writes, and the root's `.codex/hooks.json`). An event where both a shell and a new-core registration run prints `path: native+shell`, so with `--fake-full-coverage` Codex shows `native+shell` because config.toml still runs the shell adapter.
19
+ - Fix the native credential guard being looser than bash on Linux for the hq-core 16.0.46 and #1926 guard versions: in a UTF-8 locale, glibc's regex matches a long-s (U+017F) look-alike against `s`, so bash blocks python3 code that names `.aw<long-s>/credentials` and native now blocks it too. Fold revisions and macOS are unchanged.
20
+ - Make the credential-guard fold tests probe the disk (case-insensitive or not) and bash's own case matching at run time, so the 16.0.46 expectations hold on Linux and stay exactly as before on macOS. Add Linux regression rows.
21
+ - The native detect-secrets port now shortens values in jq's join error the way the installed jq does (jq 1.7.x, 1.8.0/1.8.1, 1.8.2), chosen from `jq --version`; unknown versions use the 1.8.2 style. The verdict is unchanged.
22
+ - `hq-hook` on Linux now answers like the bash it replaces in two cases. The native credential guard no longer reads the no-break space U+00A0 (or U+2007, U+202F) as a word break in a UTF-8 locale, since glibc does not, so `xargs "git<U+00A0>show"` is allowed as bash allows it instead of blocked. The deterministic gate hands a macOS bash 3.2 capture in a multibyte locale other than UTF-8 (eucJP and the like) back to bash off macOS instead of answering it. The delivery-regex parity test compares non-ASCII policy lines only in the C locale off macOS, where awk multibyte decoding is not ported by design.
23
+ - `hq-hook dispatch` now blocks a tool call when a PreToolUse hook registry safety guard (`"safety": true`) points at a script that is missing, as master-hook.sh does. It exits 2 with `BLOCKED: a required HQ safety check is missing (<id>). Run hq rescue from a terminal (or re-run /update-hq) to repair it, then retry.` Before, a missing safety script was skipped and the tool call ran unchecked; only `fail_closed` rows blocked. A guard marked both `safety` and `fail_closed` gets the new message. Missing scripts on other events, and missing non-safety rows without `fail_closed`, are still skipped (owner decision, 2026-11-10).
24
+ - The protect-core test corpus from the closed native port (#2430) now runs against the US-010 path rule table: 100 observed file tool calls and 12 symlinked-cwd relative writes, each under every project and PWD spelling. Tests only; hook behaviour is unchanged.
25
+ - `hq-hook run --host <host> Stop` reads the caller's token file (`~/.hq/cognito-tokens.json` or `HQ_COGNITO_TOKENS_FILE`) as the old checkpoint gate read it: through links, with no folder or file mode check, as a regular file only. Before, a group-writable `~/.hq` or token file, a linked `~/.hq`, a token file with a second hard link, or an override file in a shared folder left the caller's email unknown and silently skipped the opt-in company-scope gate. A folder or FIFO in the token file's place now applies the scope gate as for an in-scope caller, with one stderr line. The PreCompact banner reads today's journal `INDEX.md` the same way, so a linked HQ root or a umask-002 journal folder no longer drops it. No host registration calls `hq-hook run` yet, so hook behavior is unchanged.
26
+ - Fix the hq-hook Windows build and Clippy run that failed the v5.345.218 tag build: a Windows-only test was missing the new `stop_deliverable` field, `scope_bash` tests used Unix-only file APIs, and several test helpers used only by Unix tests were reported as dead code on Windows. Also clear two Clippy errors in the native grep/sed code that failed Windows and Linux (a test-only `compile` reported as never used, and a needless deref). No behaviour change.
27
+ - CI: hq-hook pull requests now run Clippy for the x86_64-pc-windows-msvc target on the Linux runner, so Windows-only compile and lint breaks fail the PR instead of the release tag build. ring's C build uses stub compiler and archiver scripts in scripts/ci because Clippy never links.
28
+ - Fix two Windows clippy lints in hq-hook (a redundant `return` in the injector's scope-cache clock, and items after the test module in the plans-dir port) that failed the v5.345.216 tag build. No behaviour change.
29
+ - The native detect-secrets port now shortens values in jq's join error the jq 1.6 way on hosts whose `jq --version` is 1.6 (for example Ubuntu 22.04): 11 bytes, then `...`, the same as jq 1.7.x. Before, jq 1.6 fell back to the 1.8.2 style. Unknown versions still use the 1.8.2 style. The verdict is unchanged.
30
+ - hq-hook's collation tests now pass on macOS 15.7.7, which orders characters that older macOS collated equal under en_US.UTF-8 and ja_JP.UTF-8. The image-context-guard tests ask the host's awk which ledger paths tie and require bash to treat exactly those as already seen, with at least the old number of collisions, adding `LC_COLLATE=kk_KZ.PT154` cases that still tie. The glob tie tests choose a locale that ties on the host: en_US.UTF-8 where it still does, otherwise kk_KZ.PT154. A new test checks the untied en_US.UTF-8 order against both bashes. The hook's behavior is unchanged.
31
+ - The native Stop check now does what the `40-auto-acl-share-suggestion.sh` and `50-after-turn-suggestions.sh` hooks did: the share-suggestion reminder and the after-turn suggestions, with the same first-turn note and saved state. Neither can block a Stop. Claude Code gets plain text, Codex gets a `systemMessage`, and Grok and Fleet get nothing, matching the old hooks.
32
+ - `hq-hook capabilities` now lists both hooks as covered for Stop. Stop still runs on the old dispatcher until the remaining Stop hooks are ported.
33
+ - Check credential reads natively through the optional hook entrypoint, including Git history, without shell or helper subprocesses. Refuse unsupported Git inputs and argv forms, and include untracked stash files in credential checks.
34
+ - In a repository with replacement refs (`git replace`) or a grafts file, history reads are refused natively, because the guard cannot model that history. Staged changes (`git diff --cached`) and commits that only a linked worktree's HEAD reaches are checked too.
35
+ - The native Stop check now runs the lanes Monitor gate and delivers linked-session messages at Stop, the way `lanes-senior-monitor-stop-gate` and the Stop half of `conduct-lanes-link-deliver` did. Each calls `hq lanes` with a hard time limit that also stays inside the hook's time budget.
36
+ - A Claude Code Stop whose hook input cannot be read is now refused with the lanes gate's message, as the shell gate refused it. Before, it was let through.
37
+ - Run validate-policy-frontmatter natively, with the same allow and deny messages as the pinned shell and no child processes on the PreToolUse path. Inputs the port does not model (non-UTF-8 or NUL payloads, Windows policy writes, hq launchers it cannot read the version of) are blocked with a one-line message instead of being handed back to bash.
38
+ - Reduce test-suite waiting by advancing lock retry clocks in focused command tests and sharing per-case signed-out CLI fixtures. Preserve assertions and process isolation. Add coverage lifecycle timing markers so CI reports the gap between the last test, coverage generation, report writing and shutdown.
39
+ - One host id per machine, the remaining writers and readers. A lane created with `--runner subagent` now records the same stable host id as a worker lane on that machine (the id in `~/.hq/lane-host.json`), where it used to record the hostname. When that file cannot be created or updated, the lane is still created and records the id already on disk, or the hostname when there is none; when the file is not valid, it records the hostname. Placement, Claude account balancing and the local `host_capacity` entry of `hq runners list --json` now count the lanes that lane admission treats as running on this machine, so a lane written under the machine's old hostname id is counted with the lanes written under its stable id, and on a machine that is not an Outpost `hq runners list` and `hq runners capacity` print the same local counts. Fixed: resuming or messaging a Claude lane written under an older id of this machine failed with `claude_account_balance_target_host_unavailable`; `hq lanes watch` failed with `watch_account_host_unavailable` for a lane that carries an earlier hostname of this machine; and account repair at spawn ignored this machine's lanes written under its other ids. On an Outpost, `hq runners capacity --json` also lists the EC2 instance id in `host.aliases` when a lane record of the last 30 days carries it as its origin; the id is read from a local file, with no network call. Counting on an Outpost is unchanged, no lane record is rewritten, and `host.id` is unchanged.
40
+ - `hq-hook` now records three early exits when the replay recorder is on, each with an `exit_reason`: the new core is off and the old dispatcher cannot start (`core-off-no-dispatcher`), an unusable command line (`unusable-command-line`), and an unreadable payload (`unreadable-payload`). Nothing is recorded while the recorder is off. These records do not keep the payload. Fleet hosts are recorded as `local-bot` and `fleet-session`, as in other records. Recording cannot change the hook's answer or exit code. The hook waits at most 2 seconds for the record, the same deadline as `hq-hook record`, so a store lock held by another process or a stalled disk cannot keep the hook from exiting with its answer.
41
+ - `hq-hook` no longer holds an early exit past the host's time budget while it records the exit. The wait for the record is now capped at 2 seconds or the time left in the host's budget for the call, whichever is shorter (for Grok Build, 4 seconds by default), so a store lock held by another process or a stalled disk cannot keep the hook running until the host stops waiting and lets the call through. With no budget left, nothing is recorded. A recorder panic prints nothing.
42
+ - The daemon's hqd listener no longer re-checks HQ Anywhere every 60 seconds:
43
+ it checks when the daemon's shared flag read changes the HQ Anywhere answer
44
+ or the running hqd server's gate changes, with a 10-minute fallback check
45
+ for a missed event.
46
+ - Added tests that the hqd server reports each runtime-gate change to `onRuntimeChange` (and still revokes the login when that observer throws), and that the HQ Anywhere listener unsubscribes from daemon events on `close()`.
47
+ - The native hook engine can now answer two more Bash guards itself, the environment-dump guard and the secret detector, with the same decisions and messages as the shell versions and without starting a process. Both stay off until their engine flags are turned on.
48
+ - Tighten the US-014 injector fixture guard: `setup` and the guard now share one
49
+ list of copied reference and policy folders, a macOS `.DS_Store` no longer
50
+ fails the count locally, and the guard is renamed and split so the two
51
+ sequence files the differential run reads are counted apart from the four
52
+ records it does not read.
53
+ - Guard the US-014 injector corpus so a sign-off run fails unless it compares
54
+ all 76 sequences and 246 events with the Bash injector, and every one of the
55
+ 3,075 injector fixture files is a policy, reference or harness file it uses.
56
+ - The US-015 conditional ledger now records a caller token file over the 1 MiB cap with an out-of-domain email, or none, as an old allow that becomes a block for an unbound session, and its token-file reason no longer lists layouts the gate now reads. A new `hq-hook` test reads every story's `conditional-differences.yaml` and `side-effect-differences.yaml` with the replay harness's own parser, checks the ledger shape, and fails on any block-to-allow entry outside a frozen list of ten existing US-015 ids. Tests only; hook behavior is unchanged.
57
+ - The native Stop check now fails closed where a refused state file or a
58
+ size cap hides what the old shell hooks saw. A refused checkpoint-gate
59
+ state folder or file (a link, a FIFO, a hard link, or a file others can
60
+ write) no longer lets the Stop through: the gate runs without that file,
61
+ still blocks, and says why. When it can neither read nor write its
62
+ block counter, or cannot keep its nudge file, the gate blocks at most
63
+ once per stop cycle: the Stop that follows a block (`stop_hook_active`)
64
+ goes through, so it cannot block forever. A counter it cannot read but
65
+ can still replace (mode 000) is rewritten and counts to three as before.
66
+ When the last 400 transcript lines pass the 16 MiB tail cap before the
67
+ turn's first message, the gate blocks as for a turn with no checkpoint,
68
+ at most three times in a row. When the newest reply lies past the 64 MiB scan
69
+ cap, the capability-link and humanize checks block once and ask for the
70
+ reply again. This applies where the opt-in `core.next` registration
71
+ routes Stop to `hq-hook run`; Windows stays on the shell Stop hook.
72
+ - On Grok, the native Stop check now works out whether a Stop can carry a lanes message from the Stop itself. Before, a `HQ_STOP_DECISION_DELIVERABLE` value inherited from the parent process could reach `hq lanes link _deliver`. An inherited `0` then kept the message queue on an end-of-turn Stop that should have delivered it.
73
+ - With a group-writable HQ folder (umask 0002), the share-suggestion reminder and the "turn off these nudges" note now show once, as the shell hooks show them. Before, they came back on every Stop. hq-hook still writes no state into such folders. It keeps the "shown" note in its own private folder instead and says once a session which folders to fix.
74
+ - The host canary now fails a normal Codex run when the tracked `.codex/config.toml` hooks are broken. Each Codex record carries `source` (`config.toml`, `hooks.json:user`, or `hooks.json:root`), and the allow, deny and token checks read only the `config.toml` records, so the user-scope `hooks.json` entry the canary seeds can no longer pass the run for a `config.toml` that points at a missing adapter. Those errors start with `config.toml hooks:`. `--fake-full-coverage` still reads every record.
75
+ - With `core.next` on, `hq reindex` and `hq install` move a host's hook events (Claude Code, Codex, Grok Build) to the new hook core only when a current host canary passed for that host: `~/.hq/state/host-canary.json` must hold a passing standard run under seven days old for the same hq-hook version and the same hq-core gate (SHA-256 of the root's `.claude/hooks/policy-enforcement-gate.sh`). Otherwise that host keeps its old registrations and reindex prints one warning saying why. Windows stays on the old registrations.
76
+ - `scripts/host-canary.mjs` now writes that record after a standard run (`--record <file>` to choose the file). Each host's entry holds only pass or fail, the time, the hq-hook version and the gate hash: no paths, prompts, payloads or output. `--fake-full-coverage` and the diagnostic probes do not write it.
77
+ - New `scripts/require-canary.mjs --hq-root <checkout>` exits non-zero, naming the reason per host, unless every host has a current passing canary. Flip and deletion work runs it first.
78
+ - New override `hq reindex --skip-host-canary-gate` (or `HQ_SKIP_HOST_CANARY_GATE=1`) switches without a passing canary and prints a warning naming what it bypassed.
79
+ - Fix the new hook core refusing every shell tool call on hq-core v16.0.48-beta.68 ("policy-enforcement-gate.sh is not a version the port reproduces"). hq-hook now pins beta.68's gate (`6005f231`, `gate::Revision::Core16_0_48Beta68`) and its `hook-lib.sh` (`c3eb950f`), and reproduces what the gate added. Refusals label each required skill with the prompt words that set it or "required by a matched policy". The state records `skillTriggers` and `policySkills`. A command whose only send is one `hq dm` to one email or `prs_`/`agt_` uid is no longer held to a work-broadcast requirement the prompt set; its literal body still goes to the delivery gates. A command holding a blank outside ASCII (for example a no-break space) is never exempt, because node may read it as a DM or not depending on where its stdin chunks break; the work-broadcast requirement stays, and its body is never trusted. An input the port cannot settle exactly is denied natively. An unknown gate is still refused.
80
+ - Add the beta.68 gate fixture and run the full gate differential suite against the real beta.68 bash gate, with new scenarios for the labels, the prompt words and the one-person DM exemption, compared on every pinned gate.
81
+ - Added a shared, coverage-gated fleet-local registration plan and validated doctor reporting, with exact adapter handback when a core kill switch is set. Fleet planning and doctor inspection use the same pinned-copy integrity check as desktop reindex. Unsupported agents-v2 registrations fail doctor and are not advertised. Coverage claims remain unchanged.
82
+
5
83
  ## [5.345.218] — 2026-11-14
6
84
 
7
85
  - `hq-session add company <slug>` with a slug that has no folder now says which folder it looked for (`companies/<slug>/`, with the full path) and what to do next: run `ls companies/` and pass the exact folder name, or create the company with `/newcompany`. It used to say the slug "must use the exact real directory name". Follow-up for feedback ec3775c2, finding 2 (finding 1, demote after retire, was fixed in #2621).
@@ -6823,6 +6823,10 @@ export declare const COMMAND_CATALOG: readonly [{
6823
6823
  readonly flags: "--lock-timeout <seconds>";
6824
6824
  readonly description: "Bound the wait for the per-root operation lock (seconds). 0 = refuse immediately; omitted = wait indefinitely (the interactive default). --from-hook implies 0; an explicit --lock-timeout wins.";
6825
6825
  readonly hidden: false;
6826
+ }, {
6827
+ readonly flags: "--skip-host-canary-gate";
6828
+ readonly description: "Bypass the host canary gate (hq-core-rust US-019): with core.next on, switch Claude Code, Codex and Grok Build hook events to the new core even when no current passing host canary exists for this hq-hook version and HQ root. Prints a warning. Same as HQ_SKIP_HOST_CANARY_GATE=1.";
6829
+ readonly hidden: false;
6826
6830
  }];
6827
6831
  readonly subcommands: readonly [];
6828
6832
  }, {
@@ -7880,6 +7884,39 @@ export declare const COMMAND_CATALOG: readonly [{
7880
7884
  readonly hidden: false;
7881
7885
  }];
7882
7886
  readonly subcommands: readonly [];
7887
+ }, {
7888
+ readonly name: "create-external";
7889
+ readonly description: "Create an external bot and print a one-time enrollment code";
7890
+ readonly aliases: readonly [];
7891
+ readonly hidden: false;
7892
+ readonly helpOption: true;
7893
+ readonly helpCommand: false;
7894
+ readonly usage: "[options] <name>";
7895
+ readonly helpText: readonly [];
7896
+ readonly arguments: readonly [{
7897
+ readonly name: "name";
7898
+ readonly required: true;
7899
+ readonly variadic: false;
7900
+ readonly description: "";
7901
+ }];
7902
+ readonly options: readonly [{
7903
+ readonly flags: "--company <slug>";
7904
+ readonly description: "Company slug (resolves to companyUid)";
7905
+ readonly hidden: false;
7906
+ }, {
7907
+ readonly flags: "--framework <framework>";
7908
+ readonly description: "Bot framework: grokbot, openclaw, or mcp";
7909
+ readonly hidden: false;
7910
+ }, {
7911
+ readonly flags: "--role <role>";
7912
+ readonly description: "Membership role: member (default) or admin";
7913
+ readonly hidden: false;
7914
+ }, {
7915
+ readonly flags: "--json";
7916
+ readonly description: "Emit raw JSON (code included — pipe carefully)";
7917
+ readonly hidden: false;
7918
+ }];
7919
+ readonly subcommands: readonly [];
7883
7920
  }, {
7884
7921
  readonly name: "rotate";
7885
7922
  readonly description: "Issue a fresh enrollment code for an external agent (old secret + host key stop minting)";
@@ -9643,6 +9680,18 @@ export declare const COMMAND_CATALOG: readonly [{
9643
9680
  readonly hidden: true;
9644
9681
  }];
9645
9682
  readonly subcommands: readonly [{
9683
+ readonly name: "machine-check-owner";
9684
+ readonly description: "Report the offline owner of the twelve scheduled machine checks";
9685
+ readonly aliases: readonly [];
9686
+ readonly hidden: false;
9687
+ readonly helpOption: true;
9688
+ readonly helpCommand: false;
9689
+ readonly usage: "[options]";
9690
+ readonly helpText: readonly [];
9691
+ readonly arguments: readonly [];
9692
+ readonly options: readonly [];
9693
+ readonly subcommands: readonly [];
9694
+ }, {
9646
9695
  readonly name: "checkpoint";
9647
9696
  readonly description: "Record an end-of-turn checkpoint and start HQ maintenance";
9648
9697
  readonly aliases: readonly [];
@@ -9755,6 +9804,26 @@ export declare const COMMAND_CATALOG: readonly [{
9755
9804
  readonly hidden: false;
9756
9805
  }];
9757
9806
  readonly subcommands: readonly [];
9807
+ }, {
9808
+ readonly name: "hook-registration-plan";
9809
+ readonly description: "Print the offline fleet hook registration plan without changing the installation";
9810
+ readonly aliases: readonly [];
9811
+ readonly hidden: false;
9812
+ readonly helpOption: true;
9813
+ readonly helpCommand: false;
9814
+ readonly usage: "[options]";
9815
+ readonly helpText: readonly [];
9816
+ readonly arguments: readonly [];
9817
+ readonly options: readonly [{
9818
+ readonly flags: "--host <host>";
9819
+ readonly description: "Registration host";
9820
+ readonly hidden: false;
9821
+ }, {
9822
+ readonly flags: "--json";
9823
+ readonly description: "Print JSON";
9824
+ readonly hidden: false;
9825
+ }];
9826
+ readonly subcommands: readonly [];
9758
9827
  }, {
9759
9828
  readonly name: "hook-engine-path";
9760
9829
  readonly description: "Print the offline, version-pinned native hook engine path";
@@ -8321,6 +8321,11 @@ export const COMMAND_CATALOG = [
8321
8321
  "flags": "--lock-timeout <seconds>",
8322
8322
  "description": "Bound the wait for the per-root operation lock (seconds). 0 = refuse immediately; omitted = wait indefinitely (the interactive default). --from-hook implies 0; an explicit --lock-timeout wins.",
8323
8323
  "hidden": false
8324
+ },
8325
+ {
8326
+ "flags": "--skip-host-canary-gate",
8327
+ "description": "Bypass the host canary gate (hq-core-rust US-019): with core.next on, switch Claude Code, Codex and Grok Build hook events to the new core even when no current passing host canary exists for this hq-hook version and HQ root. Prints a warning. Same as HQ_SKIP_HOST_CANARY_GATE=1.",
8328
+ "hidden": false
8324
8329
  }
8325
8330
  ],
8326
8331
  "subcommands": []
@@ -9631,6 +9636,47 @@ export const COMMAND_CATALOG = [
9631
9636
  ],
9632
9637
  "subcommands": []
9633
9638
  },
9639
+ {
9640
+ "name": "create-external",
9641
+ "description": "Create an external bot and print a one-time enrollment code",
9642
+ "aliases": [],
9643
+ "hidden": false,
9644
+ "helpOption": true,
9645
+ "helpCommand": false,
9646
+ "usage": "[options] <name>",
9647
+ "helpText": [],
9648
+ "arguments": [
9649
+ {
9650
+ "name": "name",
9651
+ "required": true,
9652
+ "variadic": false,
9653
+ "description": ""
9654
+ }
9655
+ ],
9656
+ "options": [
9657
+ {
9658
+ "flags": "--company <slug>",
9659
+ "description": "Company slug (resolves to companyUid)",
9660
+ "hidden": false
9661
+ },
9662
+ {
9663
+ "flags": "--framework <framework>",
9664
+ "description": "Bot framework: grokbot, openclaw, or mcp",
9665
+ "hidden": false
9666
+ },
9667
+ {
9668
+ "flags": "--role <role>",
9669
+ "description": "Membership role: member (default) or admin",
9670
+ "hidden": false
9671
+ },
9672
+ {
9673
+ "flags": "--json",
9674
+ "description": "Emit raw JSON (code included — pipe carefully)",
9675
+ "hidden": false
9676
+ }
9677
+ ],
9678
+ "subcommands": []
9679
+ },
9634
9680
  {
9635
9681
  "name": "rotate",
9636
9682
  "description": "Issue a fresh enrollment code for an external agent (old secret + host key stop minting)",
@@ -11788,6 +11834,19 @@ export const COMMAND_CATALOG = [
11788
11834
  }
11789
11835
  ],
11790
11836
  "subcommands": [
11837
+ {
11838
+ "name": "machine-check-owner",
11839
+ "description": "Report the offline owner of the twelve scheduled machine checks",
11840
+ "aliases": [],
11841
+ "hidden": false,
11842
+ "helpOption": true,
11843
+ "helpCommand": false,
11844
+ "usage": "[options]",
11845
+ "helpText": [],
11846
+ "arguments": [],
11847
+ "options": [],
11848
+ "subcommands": []
11849
+ },
11791
11850
  {
11792
11851
  "name": "checkpoint",
11793
11852
  "description": "Record an end-of-turn checkpoint and start HQ maintenance",
@@ -11926,6 +11985,30 @@ export const COMMAND_CATALOG = [
11926
11985
  ],
11927
11986
  "subcommands": []
11928
11987
  },
11988
+ {
11989
+ "name": "hook-registration-plan",
11990
+ "description": "Print the offline fleet hook registration plan without changing the installation",
11991
+ "aliases": [],
11992
+ "hidden": false,
11993
+ "helpOption": true,
11994
+ "helpCommand": false,
11995
+ "usage": "[options]",
11996
+ "helpText": [],
11997
+ "arguments": [],
11998
+ "options": [
11999
+ {
12000
+ "flags": "--host <host>",
12001
+ "description": "Registration host",
12002
+ "hidden": false
12003
+ },
12004
+ {
12005
+ "flags": "--json",
12006
+ "description": "Print JSON",
12007
+ "hidden": false
12008
+ }
12009
+ ],
12010
+ "subcommands": []
12011
+ },
11929
12012
  {
11930
12013
  "name": "hook-engine-path",
11931
12014
  "description": "Print the offline, version-pinned native hook engine path",
@@ -15,6 +15,7 @@
15
15
  * hq agents start|stop <uid> — EC2 start/stop
16
16
  * hq agents retry <uid> — resume setup from first non-done step
17
17
  * hq agents rm <uid> --yes — deprovision (destructive; flag-guarded)
18
+ * hq agents create-external <name> — mint an external agent + one-time enroll code
18
19
  * hq agents rotate <uid> — new enrollment code for an external agent
19
20
  * hq agents revoke <uid> --yes — revoke an external agent (--remove deletes it)
20
21
  * hq agents jobs list <uid> — off-box job roster (schedule + rate)
@@ -489,6 +490,25 @@ export interface RotateAgentResult {
489
490
  agentUid: string;
490
491
  enrollment: EnrollmentIssue;
491
492
  }
493
+ export declare const VALID_EXTERNAL_FRAMEWORKS: Set<string>;
494
+ export declare const VALID_EXTERNAL_MEMBERSHIP_ROLES: Set<string>;
495
+ export interface CreateExternalAgentInput {
496
+ name: string;
497
+ framework: string;
498
+ membershipRole?: string;
499
+ }
500
+ export interface CreateExternalAgentResult {
501
+ agentUid: string;
502
+ agentEmail: string;
503
+ framework: string;
504
+ enrollment: EnrollmentIssue;
505
+ }
506
+ /**
507
+ * POST /v1/companies/{companyUid}/agents/external — admin mint of an external
508
+ * bot. Returns the one-time enrollment code exactly once (api-contract v1).
509
+ * Console Add bot no longer exposes this path (feedback_6e5798b3).
510
+ */
511
+ export declare function createExternalAgent(token: string, companyUid: string, input: CreateExternalAgentInput): Promise<CreateExternalAgentResult>;
492
512
  /**
493
513
  * POST /v1/agents/{uid}/rotate — invalidate the current secret and host key
494
514
  * and issue a fresh one-time enrollment code (returned exactly once).
@@ -503,6 +523,8 @@ export declare function groupEnrollmentCode(code: string): string;
503
523
  export declare function revokeAgent(token: string, agentUid: string, remove: boolean): Promise<{
504
524
  removed: boolean;
505
525
  }>;
526
+ /** Lines printed after create-external: the code is shown once and never stored. */
527
+ export declare function formatCreateExternalOutput(result: CreateExternalAgentResult): string[];
506
528
  /** Lines printed after a rotate: the code is shown once and never stored. */
507
529
  export declare function formatRotateOutput(result: RotateAgentResult): string[];
508
530
  export declare function registerAgentsCommand(program: Command): void;
@@ -15,6 +15,7 @@
15
15
  * hq agents start|stop <uid> — EC2 start/stop
16
16
  * hq agents retry <uid> — resume setup from first non-done step
17
17
  * hq agents rm <uid> --yes — deprovision (destructive; flag-guarded)
18
+ * hq agents create-external <name> — mint an external agent + one-time enroll code
18
19
  * hq agents rotate <uid> — new enrollment code for an external agent
19
20
  * hq agents revoke <uid> --yes — revoke an external agent (--remove deletes it)
20
21
  * hq agents jobs list <uid> — off-box job roster (schedule + rate)
@@ -1272,6 +1273,48 @@ export function waitForAgentMessageWithPackageLease(waitForReply, leaseOptions =
1272
1273
  function sleep(ms) {
1273
1274
  return new Promise((resolve) => setTimeout(resolve, ms));
1274
1275
  }
1276
+ export const VALID_EXTERNAL_FRAMEWORKS = new Set([
1277
+ "grokbot",
1278
+ "openclaw",
1279
+ "mcp",
1280
+ ]);
1281
+ export const VALID_EXTERNAL_MEMBERSHIP_ROLES = new Set(["member", "admin"]);
1282
+ /**
1283
+ * POST /v1/companies/{companyUid}/agents/external — admin mint of an external
1284
+ * bot. Returns the one-time enrollment code exactly once (api-contract v1).
1285
+ * Console Add bot no longer exposes this path (feedback_6e5798b3).
1286
+ */
1287
+ export async function createExternalAgent(token, companyUid, input) {
1288
+ const body = {
1289
+ name: input.name,
1290
+ framework: input.framework,
1291
+ };
1292
+ if (input.membershipRole)
1293
+ body.membershipRole = input.membershipRole;
1294
+ const data = await agentsRequest({
1295
+ token,
1296
+ path: `/v1/companies/${encodeURIComponent(companyUid)}/agents/external`,
1297
+ method: "POST",
1298
+ body,
1299
+ });
1300
+ const e = data.enrollment ?? {};
1301
+ if (typeof e.code !== "string" || !e.code) {
1302
+ throw new AgentsHttpError(502, "create-external succeeded but the response carried no enrollment code");
1303
+ }
1304
+ if (typeof data.agentUid !== "string" || !data.agentUid) {
1305
+ throw new AgentsHttpError(502, "create-external succeeded but the response carried no agentUid");
1306
+ }
1307
+ return {
1308
+ agentUid: data.agentUid,
1309
+ agentEmail: typeof data.agentEmail === "string" ? data.agentEmail : "",
1310
+ framework: typeof data.framework === "string" ? data.framework : input.framework,
1311
+ enrollment: {
1312
+ code: e.code,
1313
+ expiresAt: typeof e.expiresAt === "string" ? e.expiresAt : "",
1314
+ enrollmentId: typeof e.enrollmentId === "string" ? e.enrollmentId : "",
1315
+ },
1316
+ };
1317
+ }
1275
1318
  /**
1276
1319
  * POST /v1/agents/{uid}/rotate — invalidate the current secret and host key
1277
1320
  * and issue a fresh one-time enrollment code (returned exactly once).
@@ -1313,6 +1356,20 @@ export async function revokeAgent(token, agentUid, remove) {
1313
1356
  });
1314
1357
  return { removed: data.removed === true || remove };
1315
1358
  }
1359
+ /** Lines printed after create-external: the code is shown once and never stored. */
1360
+ export function formatCreateExternalOutput(result) {
1361
+ const lines = [
1362
+ `Created external agent ${result.agentUid}${result.agentEmail ? ` (${result.agentEmail})` : ""}.`,
1363
+ ` framework: ${result.framework}`,
1364
+ "",
1365
+ ` enrollment code: ${groupEnrollmentCode(result.enrollment.code)}`,
1366
+ ];
1367
+ if (result.enrollment.expiresAt) {
1368
+ lines.push(` expires: ${result.enrollment.expiresAt} (15 minutes)`);
1369
+ }
1370
+ lines.push("", "Shown once. On the agent's host run:", ` hq agent enroll ${groupEnrollmentCode(result.enrollment.code)}`, " hq agent probe");
1371
+ return lines;
1372
+ }
1316
1373
  /** Lines printed after a rotate: the code is shown once and never stored. */
1317
1374
  export function formatRotateOutput(result) {
1318
1375
  const lines = [
@@ -1383,10 +1440,11 @@ export function registerAgentsCommand(program) {
1383
1440
  // `/v1/keys/agents/{uid}/terminal` route, so machine keys fail closed.
1384
1441
  terminal: { capability: "agents:use", routeAvailable: false },
1385
1442
  // External-agent lifecycle is an admin action on the JWT-only
1386
- // /v1/agents/{uid}/rotate|revoke routes (api-contract v1); no keyed
1443
+ // create-external / rotate / revoke routes (api-contract v1); no keyed
1387
1444
  // parallel exists, so machine keys fail closed here too.
1388
1445
  rotate: { capability: "agents:use", routeAvailable: false },
1389
1446
  revoke: { capability: "agents:use", routeAvailable: false },
1447
+ "create-external": { capability: "agents:use", routeAvailable: false },
1390
1448
  },
1391
1449
  });
1392
1450
  // `--company` may live on the group or the subcommand; the subcommand value
@@ -2137,6 +2195,39 @@ export function registerAgentsCommand(program) {
2137
2195
  fail(err);
2138
2196
  }
2139
2197
  });
2198
+ agents
2199
+ .command("create-external <name>")
2200
+ .description("Create an external bot and print a one-time enrollment code")
2201
+ .option("--company <slug>", "Company slug (resolves to companyUid)")
2202
+ .option("--framework <framework>", "Bot framework: grokbot, openclaw, or mcp")
2203
+ .option("--role <role>", "Membership role: member (default) or admin")
2204
+ .option("--json", "Emit raw JSON (code included — pipe carefully)")
2205
+ .action(async function (name, opts) {
2206
+ const framework = parseEnumOption(opts.framework, VALID_EXTERNAL_FRAMEWORKS, "--framework");
2207
+ if (!framework) {
2208
+ console.error(chalk.red("--framework is required: grokbot, openclaw, or mcp"));
2209
+ process.exit(1);
2210
+ }
2211
+ const membershipRole = parseEnumOption(opts.role, VALID_EXTERNAL_MEMBERSHIP_ROLES, "--role");
2212
+ try {
2213
+ const token = (await resolveVaultCredential()).token;
2214
+ const companyUid = await getCompanyUid(token, companyOf(this));
2215
+ const result = await createExternalAgent(token, companyUid, {
2216
+ name,
2217
+ framework,
2218
+ ...(membershipRole ? { membershipRole } : {}),
2219
+ });
2220
+ if (opts.json) {
2221
+ console.log(JSON.stringify(result, null, 2));
2222
+ return;
2223
+ }
2224
+ for (const line of formatCreateExternalOutput(result))
2225
+ console.log(line);
2226
+ }
2227
+ catch (err) {
2228
+ fail(err);
2229
+ }
2230
+ });
2140
2231
  agents
2141
2232
  .command("rotate <agentUid>")
2142
2233
  .description("Issue a fresh enrollment code for an external agent (old secret + host key stop minting)")
@@ -0,0 +1,8 @@
1
+ import type { Command } from 'commander';
2
+ import { type FleetPlanOptions } from '../lib/hook-engine/fleet-registration.js';
3
+ export declare function registerCoreHookRegistrationPlan(core: Command, runtime?: {
4
+ readInput?: () => string;
5
+ writeOutput?: (value: string) => void;
6
+ planOptions?: FleetPlanOptions;
7
+ }): void;
8
+ //# sourceMappingURL=core-hook-registration-plan.d.ts.map
@@ -0,0 +1,21 @@
1
+ import * as fs from 'node:fs';
2
+ import * as os from 'node:os';
3
+ import { fleetRegistrationPlan } from '../lib/hook-engine/fleet-registration.js';
4
+ import { describeCoreCommand } from './core-command-catalog.js';
5
+ export function registerCoreHookRegistrationPlan(core, runtime = {}) {
6
+ const command = core.command('hook-registration-plan')
7
+ .description('Print the offline fleet hook registration plan without changing the installation')
8
+ .requiredOption('--host <host>', 'Registration host')
9
+ .option('--json', 'Print JSON')
10
+ .action((options, command) => {
11
+ if (options.host !== 'fleet-local')
12
+ throw new Error('Only fleet-local registration is supported');
13
+ const root = command.optsWithGlobals().hqRoot;
14
+ if (!root)
15
+ throw new Error('--hq-root is required');
16
+ const fallbacks = JSON.parse((runtime.readInput ?? (() => fs.readFileSync(0, 'utf8')))());
17
+ (runtime.writeOutput ?? console.log)(JSON.stringify(fleetRegistrationPlan(root, fallbacks, runtime.planOptions ?? { home: process.env.HOME ?? os.homedir() })));
18
+ });
19
+ describeCoreCommand(command, { execution: 'native', root: 'live' });
20
+ }
21
+ //# sourceMappingURL=core-hook-registration-plan.js.map
@@ -29,6 +29,7 @@
29
29
  * `ScaffoldRoot`.
30
30
  */
31
31
  import { Option } from "commander";
32
+ import { registerCoreHookRegistrationPlan } from "./core-hook-registration-plan.js";
32
33
  import { registerCoreCheckpointCommand } from "./core-checkpoint.js";
33
34
  import { runHookEnginePath } from '../hook-engine-path.js';
34
35
  import { registerCoreDelegateCommand } from "./core-delegate.js";
@@ -442,7 +443,15 @@ export function registerCoreCommands(program) {
442
443
  .addOption(new Option("--hq-root <path>", "HQ installation to operate on (live-root commands)").hideHelp());
443
444
  // This group primarily hosts manifest-driven bundled assets, but it also
444
445
  // hosts native TypeScript plumbing when a scaffold contract needs it.
446
+ const machineCheckOwnerCommand = core.command("machine-check-owner")
447
+ .description("Report the offline owner of the twelve scheduled machine checks")
448
+ .action(async () => {
449
+ const { machineCheckOwner } = await import("../lib/daemon/machine-check-owner.js");
450
+ process.stdout.write(`${JSON.stringify(machineCheckOwner())}\n`);
451
+ });
452
+ describeCoreCommand(machineCheckOwnerCommand, { execution: "native", root: "cwd" });
445
453
  registerCoreCheckpointCommand(core);
454
+ registerCoreHookRegistrationPlan(core);
446
455
  const hookEnginePath = core.command('hook-engine-path')
447
456
  .description('Print the offline, version-pinned native hook engine path')
448
457
  .option('--repair', 'Repair the pinned copy after closing running hook processes')
@@ -134,7 +134,11 @@ export async function runDoctor(options = {}) {
134
134
  liveRuntimes: options.liveRuntimes === true,
135
135
  company: options.company,
136
136
  integrations: options.integrations !== false,
137
+ verbose: options.verbose === true,
138
+ runMachineChecks: requested?.includes("machine-checks") === true,
137
139
  };
140
+ if (context.runMachineChecks)
141
+ writeErr("hq doctor: machine checks run repair actions on this machine.\n");
138
142
  const families = await registry.run(context);
139
143
  if (!requested)
140
144
  await addHostCoreFamily(families, registry, context);
@@ -309,6 +309,8 @@ export interface Ctx {
309
309
  /** Claude access-token expiry check for account status. Absent in tests that fake the probe. */
310
310
  readClaudeCredential?: ClaudeCredentialReader;
311
311
  resolveMachineIdentity: () => MachineIdentity;
312
+ /** This machine's EC2 instance id from a local file, or null. No network call. */
313
+ readInstanceIdFromDisk: () => string | null;
312
314
  runCompaction?: RunCompactionFn;
313
315
  locateTranscript?: (home: string, sessionId: string) => string | null;
314
316
  monitorEvidence: MonitorEvidenceReader;
@@ -1,5 +1,7 @@
1
1
  import { accountStatus, coveredLaneIds, expiredLaneIds, loadLanesConfig, MAX_WATCHED_LANES, MONITOR_ENGINES, MONITOR_MAX_TIMEOUT_MS, MONITOR_UNCOVERED_EXIT_CODE, monitorReminderText, runLaneWatch, } from "../lib/lanes/index.js";
2
+ import { resolveAdmissionHost } from "../lib/lanes/admission-host.js";
2
3
  import { LEAD_LANE_KEEP_ALIVE_FLAG } from "../lib/lanes/keep-alive.js";
4
+ import { localHostIdsReferToSameMachine } from "../lib/lanes/local-host-identity.js";
3
5
  import { resolveLaneCompany } from "../lib/lanes/lane-company.js";
4
6
  import { readLanesRegistryFlag } from "../lib/lanes/registry-flag.js";
5
7
  import { isLanesError, LanesError } from "../lib/lanes/errors.js";
@@ -44,6 +46,7 @@ export function createLaneWatchHandlers(deps) {
44
46
  async function runWatch(ctx, laneIds, opts) {
45
47
  const rawInterval = opts.intervalMs === undefined ? undefined : Number(opts.intervalMs);
46
48
  const hqRoot = ctx.hqRoot();
49
+ let localMatch;
47
50
  await runLaneWatch(hqRoot, laneIds, {
48
51
  intervalMs: rawInterval,
49
52
  sleep: ctx.sleep,
@@ -57,8 +60,32 @@ export function createLaneWatchHandlers(deps) {
57
60
  const config = loadLanesConfig(hqRoot);
58
61
  const currentHost = laneHostFromCtx(ctx);
59
62
  const currentHostname = ctx.hostname().trim();
63
+ // A local lane is on this machine under any id admission accepts for it:
64
+ // the stable id, the hostname, or an earlier hostname in lane-host.json.
65
+ // The identity file is read once per watch, not once per poll. If it
66
+ // cannot be read, the watch matches by hostname as it did before.
67
+ if (localMatch === undefined) {
68
+ try {
69
+ const admissionHost = resolveAdmissionHost({
70
+ hostname: ctx.hostname,
71
+ homedir: ctx.homedir,
72
+ readOutpostIdentity: () => ({ kind: "not_outpost" }),
73
+ });
74
+ localMatch = {
75
+ hostname: admissionHost.hostname,
76
+ ...(admissionHost.machineId !== undefined ? { machineId: admissionHost.machineId } : {}),
77
+ ...(admissionHost.aliases !== undefined ? { aliases: admissionHost.aliases } : {}),
78
+ };
79
+ }
80
+ catch (err) {
81
+ process.stderr.write(`lane watch: could not read the lane host identity, matching local lanes by hostname: ${err instanceof Error ? err.message : String(err)}\n`);
82
+ localMatch = { hostname: currentHostname };
83
+ }
84
+ }
85
+ const match = localMatch;
60
86
  const isCurrentHost = (host) => (host.kind === currentHost.kind && host.id === currentHost.id) ||
61
- (host.kind === "local" && host.id === currentHostname);
87
+ (host.kind === "local" && host.id === currentHostname) ||
88
+ (host.kind === "local" && localHostIdsReferToSameMachine(host.id, match));
62
89
  const remoteOutpostIds = [...new Set(lanes
63
90
  .filter((lane) => lane.host.kind === "outpost" && !isCurrentHost(lane.host))
64
91
  .map((lane) => lane.host.id))];
@@ -90,6 +90,8 @@ export interface LanesCommandDeps {
90
90
  */
91
91
  readClaudeCredential?: ClaudeCredentialReader;
92
92
  resolveMachineIdentity?: () => MachineIdentity;
93
+ /** Injected in tests; the default reads the board asset tag on Linux and makes no network call. */
94
+ readInstanceIdFromDisk?: () => string | null;
93
95
  stageOutpostPayload?: (outpostId: string, bytes: Uint8Array) => Promise<{
94
96
  getUrl: string;
95
97
  }>;