@indigoai-us/hq-cli 5.345.267 → 5.345.268

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 (45) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/contracts/host-canary-release.json +7 -7
  3. package/dist/commands/core-job-notify-native.d.ts +6 -0
  4. package/dist/commands/core-job-notify-native.js +64 -4
  5. package/dist/commands/core-jobs-native.js +3 -16
  6. package/dist/commands/install-global.js +54 -17
  7. package/dist/lib/daemon/machine-check-owner.js +1 -1
  8. package/dist/lib/daemon/machine-checks.d.ts +3 -11
  9. package/dist/lib/daemon/machine-checks.js +4 -15
  10. package/dist/lib/doctor/checks/codex-wiring.d.ts +4 -2
  11. package/dist/lib/doctor/checks/codex-wiring.js +70 -13
  12. package/dist/lib/doctor/checks/fleet-hook-core.d.ts +4 -4
  13. package/dist/lib/doctor/checks/fleet-hook-core.js +5 -10
  14. package/dist/lib/doctor/checks/grok-wiring.js +38 -0
  15. package/dist/lib/doctor/checks/hook-engine.js +0 -2
  16. package/dist/lib/doctor/checks/host-core.d.ts +1 -1
  17. package/dist/lib/doctor/checks/host-core.js +8 -38
  18. package/dist/lib/hook-engine/coverage.d.ts +10 -1
  19. package/dist/lib/hook-engine/coverage.js +63 -8
  20. package/dist/lib/hook-engine/fleet-registration.js +7 -4
  21. package/dist/lib/hook-engine/native-precompact-compatibility.json +7 -1
  22. package/dist/lib/hook-engine/native-stop-compatibility.json +30 -11
  23. package/dist/lib/hook-engine/reconcile.d.ts +10 -1
  24. package/dist/lib/hook-engine/reconcile.js +339 -42
  25. package/dist/lib/hook-engine/stable-gate.d.ts +43 -0
  26. package/dist/lib/hook-engine/stable-gate.js +276 -0
  27. package/dist/lib/hot-channels/fleet-complete.js +2 -2
  28. package/dist/lib/install/antigravity-targets.js +2 -1
  29. package/dist/lib/install/claude-targets.d.ts +6 -6
  30. package/dist/lib/install/claude-targets.js +13 -9
  31. package/dist/lib/install/codex-targets.d.ts +4 -4
  32. package/dist/lib/install/codex-targets.js +26 -16
  33. package/dist/lib/install/hook-target.d.ts +23 -2
  34. package/dist/lib/install/hook-target.js +89 -16
  35. package/dist/lib/outpost-identity-env.d.ts +18 -0
  36. package/dist/lib/outpost-identity-env.js +29 -0
  37. package/dist/lib/signals/steps/extract.js +46 -12
  38. package/dist/utils/core-next-kill.d.ts +2 -15
  39. package/dist/utils/core-next-kill.js +5 -36
  40. package/dist/utils/hook-engine-rollup.js +0 -1
  41. package/dist/utils/hook-trust.d.ts +2 -0
  42. package/dist/utils/hook-trust.js +156 -13
  43. package/dist/utils/host-registration.d.ts +158 -4
  44. package/dist/utils/host-registration.js +500 -17
  45. package/package.json +7 -7
@@ -34,6 +34,32 @@ const GROK_BRIDGE_FILES = ["hq-hq-bridge.sh", "hq-hq-bridge.json"];
34
34
  export function checkGrokWiring(context, options = {}) {
35
35
  const grokDir = path.join(context.hqRoot, ".grok", "hooks");
36
36
  const bridgeDir = options.bridgeDir ?? path.join(os.homedir(), ".grok", "hooks");
37
+ const nativeBridge = nativeBridgeEvents(bridgeDir);
38
+ const legacyAbsent = !fileState(path.join(grokDir, "hq-grok.json")).present &&
39
+ !fileState(path.join(grokDir, "hq-grok-hook-adapter.sh")).present;
40
+ if (legacyAbsent && nativeBridge !== null) {
41
+ return [
42
+ {
43
+ status: "NA",
44
+ checkId: "hooks.grok.scope",
45
+ target: "grok",
46
+ message: "Grok hook checks are wiring only (registration, native bridge presence); live Grok hook execution is verified only when the doctor runs under the Grok host.",
47
+ },
48
+ {
49
+ status: "PASS",
50
+ checkId: "hooks.grok.registration",
51
+ target: path.join(bridgeDir, "hq-hq-bridge.json"),
52
+ message: `User-global Grok bridge registers native hq-hook across ${nativeBridge} event${nativeBridge === 1 ? "" : "s"}.`,
53
+ },
54
+ {
55
+ status: "PASS",
56
+ checkId: "hooks.grok.adapter",
57
+ target: path.join(bridgeDir, "hq-hq-bridge.json"),
58
+ message: "Grok routes directly through native hq-hook (no bash adapter required).",
59
+ },
60
+ checkBridge(bridgeDir),
61
+ ];
62
+ }
37
63
  return [
38
64
  {
39
65
  status: "NA",
@@ -46,6 +72,18 @@ export function checkGrokWiring(context, options = {}) {
46
72
  checkBridge(bridgeDir),
47
73
  ];
48
74
  }
75
+ function nativeBridgeEvents(bridgeDir) {
76
+ try {
77
+ const raw = fs.readFileSync(path.join(bridgeDir, "hq-hq-bridge.json"), "utf8");
78
+ const parsed = JSON.parse(raw);
79
+ const commands = collectCommands(parsed);
80
+ const native = commands.filter((command) => command.includes("hq-hook") && command.includes("--host") && command.includes("grok"));
81
+ return native.length > 0 ? native.length : null;
82
+ }
83
+ catch {
84
+ return null;
85
+ }
86
+ }
49
87
  function checkRegistration(registrationPath) {
50
88
  let raw;
51
89
  try {
@@ -17,8 +17,6 @@ function pathPresent(filePath) {
17
17
  function isStrictModeActive(env) {
18
18
  const engineEnv = env.HQ_HOOK_ENGINE?.trim().toLowerCase();
19
19
  const home = env.HOME || env.USERPROFILE || homedir();
20
- if (engineEnv === 'off' || pathPresent(join(home, '.hq', 'hook-engine.off')))
21
- return false;
22
20
  if (engineEnv === 'strict')
23
21
  return true;
24
22
  return pathPresent(join(home, '.hq', 'hook-engine.strict'));
@@ -38,7 +38,7 @@ export interface EventCore {
38
38
  * fix. With the flag on, an event left on the old dispatcher says why.
39
39
  */
40
40
  export declare function hostCoreResults(root: string, options?: HostCoreOptions): CheckResult[];
41
- /** Flag and kill-switch state, shown once. */
41
+ /** Flag state, shown once. */
42
42
  export declare function coreSwitchResult(options?: HostCoreOptions): CheckResult;
43
43
  /** The family `hq doctor` prints. */
44
44
  export declare function hostCoreFamily(context: CheckContext, options?: HostCoreOptions): Promise<FamilyRun>;
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * `hq doctor`: which core each host on this machine is using, per event, and
3
- * why (hq-core-rust US-017). Reads the registration files `hq reindex` writes
4
- * and the kill switch, and writes nothing. When an event is registered to the
3
+ * why (hq-core-rust US-017). Reads the registration files `hq reindex` writes,
4
+ * and writes nothing. When an event is registered to the
5
5
  * new core, or the flag is on, it starts the engine once (`--version` and
6
6
  * `capabilities --json`) to see which evaluators it has. An event registered
7
7
  * to a new core that is missing, does not run, or lacks the event's guards is
@@ -16,7 +16,7 @@ import { isAdapterEntry } from '../../install/codex-targets.js';
16
16
  import { antigravityEventEntries, antigravityTargets } from '../../install/antigravity-targets.js';
17
17
  import { claudeProjectAdapterHold, stopCompatibilityHold, uncoveredHooks } from '../../hook-engine/coverage.js';
18
18
  import { masterHookPath, shimPath } from '../../install/claude-targets.js';
19
- import { CORE_NEXT_FLAG, CORE_NEXT_KILL_ENV, CORE_NEXT_KILL_FILE, ENGINE_KILL_ENV, ENGINE_KILL_FILE, REQUIRED_EVALUATORS, STABLE_LINK_NAME, coreNextEnabled, coreNextKillReason, coreNextTargetFor, missingEvaluators, probeEngine, } from '../../../utils/host-registration.js';
19
+ import { CORE_NEXT_FLAG, REQUIRED_EVALUATORS, STABLE_LINK_NAME, coreNextEnabled, coreNextTargetFor, missingEvaluators, probeEngine, } from '../../../utils/host-registration.js';
20
20
  import { fleetHookCoreResults } from './fleet-hook-core.js';
21
21
  import { HOOKS_FAMILY_ID } from '../registry.js';
22
22
  export const HOST_CORE_FAMILY_ID = 'host-core';
@@ -109,7 +109,6 @@ export function hostCoreResults(root, options = {}) {
109
109
  const platform = options.platform ?? process.platform;
110
110
  const probe = options.probe ?? probeEngine;
111
111
  const flagOn = coreNextEnabled(env);
112
- const killedBy = coreNextKillReason(home, env);
113
112
  const probed = new Map();
114
113
  const capabilities = (engine) => {
115
114
  let found = probed.get(engine);
@@ -161,8 +160,6 @@ export function hostCoreResults(root, options = {}) {
161
160
  const oldCore = (event, host, scope) => {
162
161
  if (!flagOn)
163
162
  return { status: 'PASS', reason: `flag ${CORE_NEXT_FLAG} is off` };
164
- if (killedBy)
165
- return { status: 'PASS', reason: `the kill switch is on (${killedBy})` };
166
163
  if (platform === 'win32')
167
164
  return { status: 'PASS', reason: 'Windows keeps the old registration until US-022' };
168
165
  if (!REQUIRED_EVALUATORS[event])
@@ -239,11 +236,8 @@ export function hostCoreResults(root, options = {}) {
239
236
  // the engine must do every hook the old dispatcher runs for it here.
240
237
  const shell = kinds.filter((k) => k !== 'new-core');
241
238
  let verdict;
242
- if (killedBy) {
243
- verdict = { status: 'FAIL', reason: `the kill switch is on (${killedBy}) but this event is still registered to the new core; run hq reindex to remove the new-core entry` };
244
- }
245
- else if (shell.length > 0) {
246
- verdict = { status: 'FAIL', reason: `registered to the new core beside the ${shell.map((k) => label(k, target.host)).join(', ')}, so both run and the kill switch would run the old dispatcher twice` };
239
+ if (shell.length > 0) {
240
+ verdict = { status: 'FAIL', reason: `registered to the new core beside the ${shell.map((k) => label(k, target.host)).join(', ')}, so both run` };
247
241
  }
248
242
  else if (all.filter((k) => k === 'new-core').length > 1) {
249
243
  verdict = { status: 'WARN', reason: 'registered to the new core more than once, so its checks run twice' };
@@ -299,7 +293,7 @@ export function hostCoreResults(root, options = {}) {
299
293
  message: `${target.host} (${target.scope}): ${summary}`,
300
294
  details: { ...(cores.length === 1 ? { core: cores[0] } : {}), cores, events },
301
295
  ...(failed.length > 0
302
- ? { remediation: `Run hq reindex: it puts ${failed.join(', ')} back on the old dispatcher when the new core cannot take them, or repairs the ${STABLE_LINK_NAME} link. It also puts an event back on the old dispatcher when the new core no longer covers every hook the old dispatcher runs for it, leaves one registration per event, and removes the new-core entries while the kill switch is on. Until then those events run no HQ hook, a new core without their guards, hooks twice, or none of the hooks the new core does not cover.` }
296
+ ? { remediation: `Run hq reindex: it puts ${failed.join(', ')} back on the old dispatcher when the new core cannot take them, or repairs the ${STABLE_LINK_NAME} link. It also puts an event back on the old dispatcher when the new core no longer covers every hook the old dispatcher runs for it and leaves one registration per event. Until then those events run no HQ hook, a new core without their guards, hooks twice, or none of the hooks the new core does not cover.` }
303
297
  : mixed.length > 0
304
298
  ? { remediation: 'Run hq reindex to leave one HQ registration per event.' }
305
299
  : {}),
@@ -316,36 +310,12 @@ function eventEntries(doc, host) {
316
310
  return [];
317
311
  return Object.entries(hooks).map(([event, groups]) => [event, hookEntries({ hooks: { [event]: groups } })]);
318
312
  }
319
- /** Flag and kill-switch state, shown once. */
313
+ /** Flag state, shown once. */
320
314
  export function coreSwitchResult(options = {}) {
321
315
  const env = options.env ?? process.env;
322
- const home = options.home ?? env.HOME ?? os.homedir();
323
316
  const on = coreNextEnabled(env);
324
- const killedBy = [
325
- /^(off|0|false|no)$/i.test((env[CORE_NEXT_KILL_ENV] ?? '').trim()) ? `${CORE_NEXT_KILL_ENV}=${env[CORE_NEXT_KILL_ENV]}` : '',
326
- /^off$/i.test((env[ENGINE_KILL_ENV] ?? '').trim()) ? `${ENGINE_KILL_ENV}=${env[ENGINE_KILL_ENV]}` : '',
327
- exists(path.join(home, CORE_NEXT_KILL_FILE)) ? path.join(home, CORE_NEXT_KILL_FILE) : '',
328
- exists(path.join(home, ENGINE_KILL_FILE)) ? path.join(home, ENGINE_KILL_FILE) : '',
329
- ].filter(Boolean);
330
317
  const flag = `flag ${CORE_NEXT_FLAG} is ${on ? 'on' : 'off'}`;
331
- const kill = killedBy.length
332
- ? `; kill switch on (${killedBy.join(', ')}): new-core registrations hand each event to the old dispatcher, and hq reindex removes them`
333
- : '';
334
- // The engine reads the kill switch from each hook's own environment; this
335
- // check and hq reindex read it from theirs.
336
- const hostEnv = on || killedBy.length
337
- ? `. ${CORE_NEXT_KILL_ENV} or ${ENGINE_KILL_ENV} set only in a host's environment (for example Claude Code settings env) is honored by the engine at run time only; hq reindex and this check do not see it, so use the file ${path.join('~', CORE_NEXT_KILL_FILE)} to switch the registrations back`
338
- : '';
339
- return { status: 'PASS', checkId: 'host-core:switch', message: `${flag}${kill}${hostEnv}`, details: { flag: on, killSwitch: killedBy } };
340
- }
341
- function exists(file) {
342
- try {
343
- fs.lstatSync(file);
344
- return true;
345
- }
346
- catch {
347
- return false;
348
- }
318
+ return { status: 'PASS', checkId: 'host-core:switch', message: flag, details: { flag: on } };
349
319
  }
350
320
  /** The family `hq doctor` prints. */
351
321
  export async function hostCoreFamily(context, options = {}) {
@@ -1,4 +1,4 @@
1
- import type { CoreNextHost, CoreNextTarget } from '../../utils/host-registration.js';
1
+ import { type CoreNextHost, type CoreNextTarget } from '../../utils/host-registration.js';
2
2
  /** Stands for the hook list when it cannot be read; never covered. */
3
3
  export declare const UNREADABLE = "(the old dispatcher hook list could not be read)";
4
4
  /** One item of a Git config file as git 2.50 reads it: a section header, or a variable under the last one. */
@@ -166,6 +166,15 @@ export declare function coversKey(key: string): {
166
166
  * order, each id once. The same as covers_hosts.rs `claims_on`.
167
167
  */
168
168
  export declare function coveredOn(covers: Readonly<Record<string, readonly string[]>> | undefined, event: string, host: CoreNextHost): string[];
169
+ /**
170
+ * True for a post-US-027 native-only HQ root, keyed on the core version
171
+ * declared in `core/core.yaml` (`hookDispatcherVersion >= 2` or `hqVersion`
172
+ * major `>= 17`) rather than on the absence of retired files on disk (which
173
+ * `hq rescue` may leave behind before cleanup). `hq reindex` still enforces
174
+ * `shellHooks` against `COVERS` for custom hooks, but skips sha256 pin holds
175
+ * for deleted bash dispatchers and adapters.
176
+ */
177
+ export declare function isNativeOnlyCoreRoot(root: string): boolean;
169
178
  /** The old dispatcher's hooks for `event` on `host` that the engine does not cover. */
170
179
  export declare function uncoveredHooks(root: string, host: CoreNextHost, event: string, covers: Readonly<Record<string, readonly string[]>> | undefined, env?: NodeJS.ProcessEnv): string[];
171
180
  /**
@@ -26,6 +26,7 @@
26
26
  import { createHash } from 'node:crypto';
27
27
  import * as fs from 'node:fs';
28
28
  import * as path from 'node:path';
29
+ import { isShippedPortableClaudeCommand } from '../../utils/host-registration.js';
29
30
  import { isCoreNextEntry } from './registration.js';
30
31
  import { CLASSIFYING_ADAPTER_CORE_SHA256, RELEASED_CLASSIFYING_ADAPTER_CORE_SHA256 } from './adapter-core-pin.js';
31
32
  const CRATE_POLICY_FALLBACKS = {
@@ -1559,9 +1560,12 @@ export function shellHooks(root, host, event) {
1559
1560
  for (const group of Array.isArray(registered) ? registered : []) {
1560
1561
  for (const entry of Array.isArray(group?.hooks) ? group.hooks : []) {
1561
1562
  const command = entry?.command;
1562
- // HQ's own entry for the event (master-hook, or the Claude Code
1563
- // new-core entry that took its place) is the dispatcher counted above.
1564
- if (typeof command !== 'string' || command.includes('master-hook.sh') || isCoreNextEntry(entry, root))
1563
+ // HQ's own entry for the event (master-hook, shipped portable hq-hook,
1564
+ // or the Claude Code new-core entry that took its place) is the dispatcher counted above.
1565
+ if (typeof command !== 'string'
1566
+ || command.includes('master-hook.sh')
1567
+ || (!Array.isArray(entry.args) && isShippedPortableClaudeCommand(command, event))
1568
+ || isCoreNextEntry(entry, root))
1565
1569
  continue;
1566
1570
  out.push(`settings:${command}`);
1567
1571
  }
@@ -1686,6 +1690,55 @@ export function coveredOn(covers, event, host) {
1686
1690
  }
1687
1691
  return out;
1688
1692
  }
1693
+ function coreYamlU32(text, key) {
1694
+ for (const raw of text.split(/\r?\n/)) {
1695
+ const line = raw.split('#')[0]?.trim() ?? '';
1696
+ if (!line.startsWith(`${key}:`))
1697
+ continue;
1698
+ const val = line.slice(key.length + 1).trim().replace(/^["']|["']$/g, '');
1699
+ if (/^\d+$/.test(val))
1700
+ return Number.parseInt(val, 10);
1701
+ }
1702
+ return null;
1703
+ }
1704
+ function coreYamlHqMajor(text) {
1705
+ for (const raw of text.split(/\r?\n/)) {
1706
+ const line = raw.split('#')[0]?.trim() ?? '';
1707
+ if (!line.startsWith('hqVersion:'))
1708
+ continue;
1709
+ const val = line.slice('hqVersion:'.length).trim().replace(/^["']|["']$/g, '').replace(/^v/, '');
1710
+ const match = /^(\d+)\./.exec(val);
1711
+ if (match)
1712
+ return Number.parseInt(match[1], 10);
1713
+ }
1714
+ return null;
1715
+ }
1716
+ /**
1717
+ * True for a post-US-027 native-only HQ root, keyed on the core version
1718
+ * declared in `core/core.yaml` (`hookDispatcherVersion >= 2` or `hqVersion`
1719
+ * major `>= 17`) rather than on the absence of retired files on disk (which
1720
+ * `hq rescue` may leave behind before cleanup). `hq reindex` still enforces
1721
+ * `shellHooks` against `COVERS` for custom hooks, but skips sha256 pin holds
1722
+ * for deleted bash dispatchers and adapters.
1723
+ */
1724
+ export function isNativeOnlyCoreRoot(root) {
1725
+ const coreYamlPath = path.join(root, 'core', 'core.yaml');
1726
+ if (!regularFile(coreYamlPath) || !regularFile(path.join(root, '.claude', 'hooks', 'hook-registry.json'))) {
1727
+ return false;
1728
+ }
1729
+ let text;
1730
+ try {
1731
+ text = fs.readFileSync(coreYamlPath, 'utf8');
1732
+ }
1733
+ catch {
1734
+ return false;
1735
+ }
1736
+ const dispatcherVersion = coreYamlU32(text, 'hookDispatcherVersion');
1737
+ if (dispatcherVersion !== null && dispatcherVersion >= 2)
1738
+ return true;
1739
+ const major = coreYamlHqMajor(text);
1740
+ return major !== null && major >= 17;
1741
+ }
1689
1742
  /** The old dispatcher's hooks for `event` on `host` that the engine does not cover. */
1690
1743
  export function uncoveredHooks(root, host, event, covers, env = process.env) {
1691
1744
  const hooks = shellHooks(root, host, event);
@@ -1693,6 +1746,8 @@ export function uncoveredHooks(root, host, event, covers, env = process.env) {
1693
1746
  return [UNREADABLE];
1694
1747
  const covered = coveredOn(covers, event, host);
1695
1748
  const missing = hooks.filter((hook) => !covered.some((claim) => claimCovers(claim, hook)));
1749
+ if (isNativeOnlyCoreRoot(root))
1750
+ return missing;
1696
1751
  if (event === 'Stop' && covered.includes('master-hook:Stop')) {
1697
1752
  const hold = stopCompatibilityHold(root, env);
1698
1753
  if (hold)
@@ -1866,7 +1921,7 @@ export const SESSION_START_PINS = [
1866
1921
  ['core/scripts/hqd-hook-flag-cache-lib.sh', ['061d264460408e9eaf43fdf0fdde662c906a9a7dacb4e7a591e684bca28c138a']],
1867
1922
  ['core/scripts/hq-session.sh', ['db701162f71b53fd2188974d2f46c58250593dde1252d65b36e6d02b9a765fe7', '02a37c5dbf4fb5af27cc64d0f271121e990758b757a479f60e9ce099f4d65ded', 'd4d4aef60ff8b095e3abcc817598f376d3c2de8d59758c3ed6dd40d4aa4b11fb']],
1868
1923
  ['core/scripts/lib/session-id.sh', ['2ebbc50893c7c601a111b9e8f9945afeac88f552d7caeec09c4096f4c27a833d', 'd6a04155571ec53edd853878cebaba5a5bab93801a73e356499440c1cd009c71']],
1869
- ['core/scripts/lib/session-scope-capability.sh', ['388ffef43cfe05810c38ce377245d0d86f415b4009b21a008bca8897be0c9ead']],
1924
+ ['core/scripts/lib/session-scope-capability.sh', ['388ffef43cfe05810c38ce377245d0d86f415b4009b21a008bca8897be0c9ead', '498ffa6e4342c79eecb0c1fddec56ba03e169bb627b2da8f8ef2f09f55954b38']],
1870
1925
  ['core/scripts/resolve-company.sh', ['00d6fa069f574a86087c77daa44887a2617446d4300d5daebecc9bfb5d81abe7']],
1871
1926
  ];
1872
1927
  /**
@@ -1968,7 +2023,7 @@ export const FLEET_LOCAL_PRE_TOOL_USE_PINS = [
1968
2023
  ],
1969
2024
  missing: 'allowed',
1970
2025
  },
1971
- { relative: 'core/scripts/lib/session-scope-capability.sh', accepted: ['388ffef43cfe05810c38ce377245d0d86f415b4009b21a008bca8897be0c9ead'], missing: 'allowed' },
2026
+ { relative: 'core/scripts/lib/session-scope-capability.sh', accepted: ['388ffef43cfe05810c38ce377245d0d86f415b4009b21a008bca8897be0c9ead', '498ffa6e4342c79eecb0c1fddec56ba03e169bb627b2da8f8ef2f09f55954b38'], missing: 'allowed' },
1972
2027
  ];
1973
2028
  /**
1974
2029
  * Why fleet-local PreToolUse must stay on the shell adapter in `root`: a present file of
@@ -2208,7 +2263,7 @@ export const PRE_TOOL_USE_DISPATCHER_PINS = [
2208
2263
  { relative: 'core/scripts/lib/epochrealtime.sh', accepted: ['4c9205520dba31533c95eea145f6068ba626885c342c2aa1f232a7237d046cdf'] },
2209
2264
  { relative: 'core/scripts/lib/perl-child-locale.sh', accepted: ['18e6b9d0e22874eea00ecc868b4dcfebbc3bb42434d8d0c81b20baec1194df2e'] },
2210
2265
  { relative: 'core/scripts/lib/session-id.sh', accepted: ['2ebbc50893c7c601a111b9e8f9945afeac88f552d7caeec09c4096f4c27a833d', 'd6a04155571ec53edd853878cebaba5a5bab93801a73e356499440c1cd009c71'] },
2211
- { relative: 'core/scripts/lib/session-scope-capability.sh', accepted: ['388ffef43cfe05810c38ce377245d0d86f415b4009b21a008bca8897be0c9ead'] },
2266
+ { relative: 'core/scripts/lib/session-scope-capability.sh', accepted: ['388ffef43cfe05810c38ce377245d0d86f415b4009b21a008bca8897be0c9ead', '498ffa6e4342c79eecb0c1fddec56ba03e169bb627b2da8f8ef2f09f55954b38'] },
2212
2267
  { relative: 'core/scripts/resolve-hq-root.sh', accepted: ['188e99c7c60bc9909290a666d6f3b93387ae6cf68f2eeb41fd24c2dea62a5240'] },
2213
2268
  ];
2214
2269
  /**
@@ -2629,7 +2684,7 @@ export const PROMPT_COMPANY_BIND_PINS = [
2629
2684
  },
2630
2685
  { relative: 'core/scripts/hq-session.sh', accepted: ['db701162f71b53fd2188974d2f46c58250593dde1252d65b36e6d02b9a765fe7', '02a37c5dbf4fb5af27cc64d0f271121e990758b757a479f60e9ce099f4d65ded', 'd4d4aef60ff8b095e3abcc817598f376d3c2de8d59758c3ed6dd40d4aa4b11fb'] },
2631
2686
  { relative: 'core/scripts/lib/session-id.sh', accepted: ['2ebbc50893c7c601a111b9e8f9945afeac88f552d7caeec09c4096f4c27a833d', 'd6a04155571ec53edd853878cebaba5a5bab93801a73e356499440c1cd009c71'] },
2632
- { relative: 'core/scripts/lib/session-scope-capability.sh', accepted: ['388ffef43cfe05810c38ce377245d0d86f415b4009b21a008bca8897be0c9ead'] },
2687
+ { relative: 'core/scripts/lib/session-scope-capability.sh', accepted: ['388ffef43cfe05810c38ce377245d0d86f415b4009b21a008bca8897be0c9ead', '498ffa6e4342c79eecb0c1fddec56ba03e169bb627b2da8f8ef2f09f55954b38'] },
2633
2688
  ];
2634
2689
  /**
2635
2690
  * Why UserPromptSubmit must stay on the shell registration in `root`: the native
@@ -2732,7 +2787,7 @@ export function postToolUseAdapterHold(root, host) {
2732
2787
  return null;
2733
2788
  }
2734
2789
  /** The session-scope-capability.sh master-hook's Task-agent pin is modelled on (crates/hq-hook/src/scope/session.rs `SUBAGENT_PIN_LIB_SHA256`). */
2735
- export const SUBAGENT_SCOPE_LIBRARY = { relative: 'core/scripts/lib/session-scope-capability.sh', accepted: ['388ffef43cfe05810c38ce377245d0d86f415b4009b21a008bca8897be0c9ead'] };
2790
+ export const SUBAGENT_SCOPE_LIBRARY = { relative: 'core/scripts/lib/session-scope-capability.sh', accepted: ['388ffef43cfe05810c38ce377245d0d86f415b4009b21a008bca8897be0c9ead', '498ffa6e4342c79eecb0c1fddec56ba03e169bb627b2da8f8ef2f09f55954b38'] };
2736
2791
  /**
2737
2792
  * Why SubagentStart or SubagentStop (`event`) must stay on the shell registration in `root`: the
2738
2793
  * native master work (crates/hq-hook/src/lifecycle_master.rs `begin`) refuses every such event that
@@ -13,7 +13,7 @@ import * as fs from 'node:fs';
13
13
  import * as path from 'node:path';
14
14
  import { checkStableEngine, coreNextOffReason, capableEvents, probeEngine, missingEvaluators, resolveCoreNextEngine } from '../../utils/host-registration.js';
15
15
  import { verifyHookEngine } from './resolve.js';
16
- import { forHost, uncoveredHooks } from './coverage.js';
16
+ import { forHost, isNativeOnlyCoreRoot, uncoveredHooks } from './coverage.js';
17
17
  import { quotePosix } from './registration.js';
18
18
  export const FLEET_EVENTS = { pre_tool_call: 'PreToolUse', post_tool_call: 'PostToolUse', pre_llm_call: 'UserPromptSubmit', on_session_start: 'SessionStart', pre_verify: 'Stop', on_session_finalize: 'SessionEnd', subagent_stop: 'SubagentStop' };
19
19
  /** Literal POSIX argv only. Never expands variables or executes shell syntax. */
@@ -171,15 +171,18 @@ export function fleetRegistrationPlan(root, fallbacks, options) {
171
171
  caps = undefined;
172
172
  }
173
173
  const target = caps ? forHost({ coreNext: engine, events: capableEvents(caps), covers: caps.covers }, root, host, env) : null;
174
+ const nativeOnly = isNativeOnlyCoreRoot(root);
174
175
  const events = {};
175
176
  for (const [event, canonical] of Object.entries(FLEET_EVENTS)) {
176
177
  const fallback = fallbacks[event] ?? [];
177
178
  if (!Array.isArray(fallback) || !fallback.every(arg => typeof arg === 'string'))
178
179
  throw new Error(`${event}: fallback must be an argv vector`);
179
- const problem = fallbackProblem(fallback, host, event);
180
+ const problem = nativeOnly && fallback.length === 0 ? null : fallbackProblem(fallback, host, event);
180
181
  const covered = !reason && !problem && target?.events.includes(canonical);
181
- const nativeArgv = [engine, 'run', '--host', host, event, '--hq-root', root, '--fleet-fallback', JSON.stringify(fallback)];
182
- const handBack = covered && caps ? engineHandBack(caps, nativeArgv, env, options.handBackQuery) : null;
182
+ const nativeArgv = fallback.length > 0
183
+ ? [engine, 'run', '--host', host, event, '--hq-root', root, '--fleet-fallback', JSON.stringify(fallback)]
184
+ : [engine, 'run', '--host', host, event, '--hq-root', root];
185
+ const handBack = covered && caps && fallback.length > 0 ? engineHandBack(caps, nativeArgv, env, options.handBackQuery) : null;
183
186
  const native = covered && !handBack;
184
187
  const argv = native ? nativeArgv : fallback;
185
188
  const why = native ? 'complete evaluator and hook coverage' : handBack ?? reason ?? problem ?? (caps && missingEvaluators(caps, canonical)?.length ? 'required evaluators are missing' : `uncovered hooks: ${uncoveredHooks(root, host, canonical, caps?.covers, env).join(', ')}`);
@@ -161,6 +161,7 @@
161
161
  ],
162
162
  ".claude/hooks/hook-timeout-probe.sh": [
163
163
  "167003cbe1207144572365d78dbca4e285d5889885d1332b99c58081035c24be",
164
+ "3529d40c72f5da406ec324f5a37546ce8755da4f0889dacfdb496c7adb3bd2e7",
164
165
  "3c5716f75fa21f238e19ff82f57181dbd1501e7bf2b0628416173ca694ab2e5d",
165
166
  "3c72f4b8610beabbd43f96cad1752e50f94a91ed9f7706bbd91ed85c106e2faf",
166
167
  "51762806ca5d2cef64c654c3b8a19a92abc95e69da19e4e5156dc43ad0f7bda3",
@@ -209,6 +210,7 @@
209
210
  "baae190dc352bc85e1d452027d46b7a0703f8dc56a9c496adedbd7a767b3c8ce",
210
211
  "cb03a3e05f90ab95c5152c29ea6361528d63d1e3eb66aea11df80dfac3d41d61",
211
212
  "d89b30e5c8017b68db1d093c91dd9aa6a00605855a3eb94fc311b8f729e13833",
213
+ "da5296ec24dece22b694c406d5a5a4aa53b0491110c4fd1779ed25d9ea2daebe",
212
214
  "e6d7b86b58a0d325938817d4318a6fbebdcd153ce680398514451c6684f781b0",
213
215
  "e750ab8b96cefcac007088f1fb583ff56af8a1169666656518b862296a149f0c",
214
216
  "e8f2f3d22d44b1909e3b1fe9e10d023d273bc2f856ded9fea76b6f3a9c52f9c2",
@@ -297,7 +299,8 @@
297
299
  "e2286d05303df29a656ea71ed160385d669c4e47c1dc168c349d660e18a17dc2",
298
300
  "efc23d2ccbfad6b70580617a7f5bb4e1e314a41bcee5c5a251c094b54cd07fbc",
299
301
  "f8591f1728b4ec848fd3455032c09dcd66a1e7813a7910c99b0cae3f7fcf96d0",
300
- "f8f2e3dd853332fd009bb0836c81c717a2892ed71ee94150427290dd4c8ab57f"
302
+ "f8f2e3dd853332fd009bb0836c81c717a2892ed71ee94150427290dd4c8ab57f",
303
+ "fab0ada24e4ac09e05eb5293a795f7f2bde4d58b47ac5112bfc8a5ad4900eda5"
301
304
  ],
302
305
  "core/scripts/lib/session-scope-capability.sh": [
303
306
  "038670d6973a1dc14da63b742a7c90c47a032916e8c8d072147456977da1a298",
@@ -306,6 +309,7 @@
306
309
  "148375c67f8cc7d059f6eb36ec507f8f3f3cb05cad2f81229748fb20af21755b",
307
310
  "3194d664e3840dcbf48a2d5681feb7cd299bd6f60d296337c70d8042d60886c2",
308
311
  "388ffef43cfe05810c38ce377245d0d86f415b4009b21a008bca8897be0c9ead",
312
+ "498ffa6e4342c79eecb0c1fddec56ba03e169bb627b2da8f8ef2f09f55954b38",
309
313
  "5d4c619a55db0de6ff210a3aa0e99aa92fb5795a3290dcfcafc141e3ad3894b6",
310
314
  "743d9438922f0bcc29f09b38f159b4fd686cc2ba15390602ef7b7f1d8db9ac26",
311
315
  "9ea044084200e5f2d1f47477ffeaf591a87b406e9bf48c8fd6e24c551c799fc1",
@@ -343,6 +347,7 @@
343
347
  "1ca40fbd5a58474ab801384becdd5c58340adf8d5c678d41fd7b867aa06136c4",
344
348
  "1e38462b0ee9075da598da7bf8589238bf4884b8433ee391f1278ea82f8fe8dc",
345
349
  "3017517bbcd618be5162c621105c229aeba66fea1c39f6dd744416029f0448b5",
350
+ "32c5c8d50cae02e8850bf08bfbd7ff4b614fa178902b27dfb342ac210a9ef7ab",
346
351
  "5f116978283ba812ba72290736af767dbf41e9b80f7985d919f23d185c4eb17d",
347
352
  "70d56899659145c75024138919043b8f0a77c1ec6c3949ae97f66a5cbf582e4b",
348
353
  "81197d6c024845d955acab7d9a0a74e5a1a2fb54e3cfbd95f0bc15d846b4e3f6",
@@ -371,6 +376,7 @@
371
376
  "8e54096bce6e3f2017e70264bef2e94c08024f26c6d917fc7c0ff285d50c36c4",
372
377
  "ab289ac0af680fe3bcacb110302ca8b998bdc33c6f94321d42bd04a344163eed",
373
378
  "c96c7c92dd4986de20a889e04a64aebe876791fbb5189beabbf6a2c14e6b435b",
379
+ "d1d7e7d0231131afc1a49547018207e9bf4df03808aca3fda8f25fedade15b2f",
374
380
  "e15d5d0f94824748d0ab9ceff10c6c4e2a853cd7ed2452bf9e97f11efcb1c823",
375
381
  "fb798116f1428e3c9a613947930874572c8556287d54470343ee33e6d9fa7854"
376
382
  ],
@@ -63,7 +63,8 @@
63
63
  "f2d442586a1d09ddd79cb259253a773192fc17763d7cc6c1b586a86d4d7df787"
64
64
  ],
65
65
  ".claude/hooks/hq-autocommit-bash-sweep.sh": [
66
- "01b9669c41dcdb438295aea52545ec9306b8ed8c83c30c7560798bdc06b50aed"
66
+ "01b9669c41dcdb438295aea52545ec9306b8ed8c83c30c7560798bdc06b50aed",
67
+ "4c3c104f2e22680f9cb0be442e44daba06c0c3c0aaf4918e87c73a06ec13a117"
67
68
  ],
68
69
  ".claude/hooks/checkpoint-stop-gate.sh": [
69
70
  "1fc121ad2d0d3acfd13c8daee9215013d9a01bd1856aa716154739f18506c3ce"
@@ -100,14 +101,17 @@
100
101
  "b373b582a906b0993a3ce56aa43c1ef0aec6668a6b7e150d59ef3214b7d65b70"
101
102
  ],
102
103
  ".claude/hooks/hq-autocommit-bash-flag.cjs": [
103
- "419c65157c0167473ace808bacc7cb5902afa4336f8281f7e7f9c228d74a77a4"
104
+ "419c65157c0167473ace808bacc7cb5902afa4336f8281f7e7f9c228d74a77a4",
105
+ "absent"
104
106
  ],
105
107
  ".claude/hooks/hq-autocommit-failure-context-flag.cjs": [
106
- "9e6fa4930830624fd588241b24315f6e6b5f3ae6778e8f61020bf237490ac30c"
108
+ "9e6fa4930830624fd588241b24315f6e6b5f3ae6778e8f61020bf237490ac30c",
109
+ "absent"
107
110
  ],
108
111
  ".claude/hooks/hq-autocommit.sh": [
109
112
  "f7c01bc6de7f79e51eedc9806a7c903fdf0947e540ba226d1b37fc3667919304",
110
- "66f5c09b16364e07c659c22d0b6c5519a05894918ea9d0749340023c00e231c2"
113
+ "66f5c09b16364e07c659c22d0b6c5519a05894918ea9d0749340023c00e231c2",
114
+ "dffe923274db253856fa34045e2aae5f58271f3d11202341ba7c22f2c368e04a"
111
115
  ],
112
116
  ".claude/hooks/lib/parse-estimates.pl": [
113
117
  "absent"
@@ -116,7 +120,8 @@
116
120
  "e7ae5c522075b8535672fc2c8642c220282aa5cd91a19accc1072aff304be63e"
117
121
  ],
118
122
  ".codex/hooks/codex-explicit-path-flag.cjs": [
119
- "85e3c00b1f879bfc695c32714129d00554674bce7a139c4386d07f01a63ef83f"
123
+ "85e3c00b1f879bfc695c32714129d00554674bce7a139c4386d07f01a63ef83f",
124
+ "absent"
120
125
  ],
121
126
  "core/hooks/SessionStart/35-work-mesh-session-start.sh": [
122
127
  "865e5855c72c5ac0d503efbbc095a2d2835396418a12b20fa0ce3bd2f66d8d27",
@@ -124,7 +129,8 @@
124
129
  "4ab85c27d7b78c7a4ccbf76b4f7e3e3ca6b4fdf14f09a63aac49d0c4dc44c8f1"
125
130
  ],
126
131
  "core/scripts/board-project-id.sh": [
127
- "b3c80668460c556267b06a0869e41e0088963ba2a709ac459d14bb8bd08252a7"
132
+ "b3c80668460c556267b06a0869e41e0088963ba2a709ac459d14bb8bd08252a7",
133
+ "6f623e9ba4886d35df2c9cd28414bb9fe5ddfa40fdefc456414aa9f68c7f3add"
128
134
  ],
129
135
  "core/scripts/conduct-runner-resolve.sh": [
130
136
  "1510f360bb6773206fb2bd2d07091c15c1018ee1910f992e60fa7df6d49c845b",
@@ -155,7 +161,8 @@
155
161
  "core/scripts/hq-session.sh": [
156
162
  "db701162f71b53fd2188974d2f46c58250593dde1252d65b36e6d02b9a765fe7",
157
163
  "a0dd3e603c201150e6f2bf4de9f2d01c822978dcf40b3ed03a547a8f070da2de",
158
- "e686c5a5a477d2640c4056122223d1cbf85e71c5dce965776c15dfee86232c6b"
164
+ "e686c5a5a477d2640c4056122223d1cbf85e71c5dce965776c15dfee86232c6b",
165
+ "02a37c5dbf4fb5af27cc64d0f271121e990758b757a479f60e9ce099f4d65ded"
159
166
  ],
160
167
  "core/scripts/hqd-hook-flag-cache-lib.sh": [
161
168
  "061d264460408e9eaf43fdf0fdde662c906a9a7dacb4e7a591e684bca28c138a"
@@ -189,7 +196,8 @@
189
196
  "d6a04155571ec53edd853878cebaba5a5bab93801a73e356499440c1cd009c71"
190
197
  ],
191
198
  "core/scripts/lib/session-scope-capability.sh": [
192
- "388ffef43cfe05810c38ce377245d0d86f415b4009b21a008bca8897be0c9ead"
199
+ "388ffef43cfe05810c38ce377245d0d86f415b4009b21a008bca8897be0c9ead",
200
+ "498ffa6e4342c79eecb0c1fddec56ba03e169bb627b2da8f8ef2f09f55954b38"
193
201
  ],
194
202
  "core/scripts/lib/transcript-tail.sh": [
195
203
  "73eadafdd8e7c375bd12383947ac73c43e7dfe79b29e6553da1cb5b2746bb217"
@@ -209,6 +217,11 @@
209
217
  "fdce833824a8e387a50f0dd3020f5c5c0535af6372242e391ab99518d2fa5fc4",
210
218
  "b65670de9a5aa063f88694fb1cf44239725f0e71bd6245972aa093ef31f09114"
211
219
  ],
220
+ "core/scripts/setup-path-flag.cjs": [
221
+ "absent",
222
+ "7eb46bbcfeab9cf66a276c2ab2f0e452685e31c98c3d2a9c7f10a165509bee3d",
223
+ "c75e44c353549338dd09d76f5db7b71a3cdf076926b6dd36e55d1a8e59e54c8a"
224
+ ],
212
225
  "core/scripts/share-suggestion-state.sh": [
213
226
  "d2a8ba30f7650b89f0ed221f840ef2c8e731b9df35d57e0f4576feadad6f7597"
214
227
  ]
@@ -217,7 +230,8 @@
217
230
  ".claude/hooks/hq-autocommit-bash-sweep.sh": [
218
231
  ".claude/hooks/hq-autocommit-bash-flag.cjs",
219
232
  ".claude/hooks/hq-autocommit.sh",
220
- "core/scripts/lib/hook-stop-async.sh"
233
+ "core/scripts/lib/hook-stop-async.sh",
234
+ "core/scripts/setup-path-flag.cjs"
221
235
  ],
222
236
  ".claude/hooks/checkpoint-stop-gate.sh": [
223
237
  "core/scripts/hq-hidden-run.sh"
@@ -260,7 +274,8 @@
260
274
  "core/scripts/lib/work-mesh-enqueue.sh"
261
275
  ],
262
276
  ".claude/hooks/hq-autocommit.sh": [
263
- ".claude/hooks/hq-autocommit-failure-context-flag.cjs"
277
+ ".claude/hooks/hq-autocommit-failure-context-flag.cjs",
278
+ "core/scripts/setup-path-flag.cjs"
264
279
  ],
265
280
  ".claude/hooks/hq-autocommit-bash-flag.cjs": [
266
281
  "core/scripts/hq-session.sh"
@@ -306,7 +321,11 @@
306
321
  ],
307
322
  "core/scripts/lib/session-scope-capability.sh": [
308
323
  ".codex/hooks/codex-explicit-path-flag.cjs",
309
- "core/scripts/hqd-hook-flag-cache-lib.sh"
324
+ "core/scripts/hqd-hook-flag-cache-lib.sh",
325
+ "core/scripts/setup-path-flag.cjs"
326
+ ],
327
+ "core/scripts/setup-path-flag.cjs": [
328
+ "core/scripts/hq-session.sh"
310
329
  ],
311
330
  "core/scripts/lib/work-mesh-enqueue.sh": [
312
331
  "core/scripts/lib/epochrealtime.sh"
@@ -1,3 +1,12 @@
1
+ /** Every Claude Code project event that shipped a master-hook.sh entry in `.claude/settings.json`. */
2
+ export declare const PROJECT_CLAUDE_HOOK_EVENTS: readonly ["PreToolUse", "PostToolUse", "PreCompact", "Stop", "SessionStart", "UserPromptSubmit", "Notification", "SubagentStart", "SubagentStop", "SessionEnd"];
3
+ /** Every Codex project event that shipped a `[[hooks.<Event>]]` block in `.codex/config.toml`. */
4
+ export declare const PROJECT_CODEX_HOOK_EVENTS: ReadonlyArray<{
5
+ event: string;
6
+ matcher?: string;
7
+ timeout: number;
8
+ statusMessage: string;
9
+ }>;
1
10
  export interface ReconcileResult {
2
11
  /** Codex user-scope trust keys for the HQ entries in the global hooks.json. */
3
12
  codexUserKeys: string[];
@@ -5,5 +14,5 @@ export interface ReconcileResult {
5
14
  failures: string[];
6
15
  }
7
16
  /** Reconcile existing registrations only; reindex must not install a runtime. */
8
- export declare function reconcileHookRegistrations(root: string, home?: string, env?: NodeJS.ProcessEnv, daemonInstalled?: boolean): ReconcileResult;
17
+ export declare function reconcileHookRegistrations(root: string, home?: string, env?: NodeJS.ProcessEnv, daemonInstalled?: boolean, platform?: NodeJS.Platform): ReconcileResult;
9
18
  //# sourceMappingURL=reconcile.d.ts.map