@indigoai-us/hq-cli 5.345.215 → 5.345.218

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 (161) hide show
  1. package/CHANGELOG.md +168 -0
  2. package/README.md +46 -1
  3. package/assets/bot-workers/setup/skills/add-a-pack.md +3 -3
  4. package/assets/scaffold/core/scripts/hq-session.sh +4 -0
  5. package/assets/scaffold/core/scripts/lib/epochrealtime.sh +30 -0
  6. package/assets/scaffold/core/scripts/lib/work-mesh-enqueue.sh +12 -5
  7. package/dist/command-catalog.generated.d.ts +59 -4
  8. package/dist/command-catalog.generated.js +74 -4
  9. package/dist/command-help.js +3 -1
  10. package/dist/command-registration-plan.d.ts +6 -0
  11. package/dist/command-registration-plan.js +1 -0
  12. package/dist/commands/auth.d.ts +1 -1
  13. package/dist/commands/auth.js +11 -52
  14. package/dist/commands/bot.js +11 -4
  15. package/dist/commands/cloud-demote.d.ts +19 -4
  16. package/dist/commands/cloud-demote.js +85 -12
  17. package/dist/commands/cloud-provision.d.ts +5 -1
  18. package/dist/commands/cloud-provision.js +6 -2
  19. package/dist/commands/cloud.d.ts +37 -1
  20. package/dist/commands/cloud.js +110 -27
  21. package/dist/commands/core-hq-session-native.js +3 -0
  22. package/dist/commands/core.js +1 -0
  23. package/dist/commands/daemon.js +4 -1
  24. package/dist/commands/dm.js +7 -0
  25. package/dist/commands/doctor-usage.d.ts +8 -0
  26. package/dist/commands/doctor-usage.js +20 -0
  27. package/dist/commands/doctor.js +7 -1
  28. package/dist/commands/env.d.ts +18 -0
  29. package/dist/commands/env.js +82 -0
  30. package/dist/commands/install-global.js +3 -3
  31. package/dist/commands/lanes.js +100 -24
  32. package/dist/commands/logout.d.ts +7 -0
  33. package/dist/commands/logout.js +41 -34
  34. package/dist/commands/members.js +1 -1
  35. package/dist/commands/pack-start-bot.d.ts +1 -1
  36. package/dist/commands/pack-start-bot.js +2 -2
  37. package/dist/commands/pkg-update.js +1 -1
  38. package/dist/commands/sources.d.ts +8 -2
  39. package/dist/commands/sources.js +65 -9
  40. package/dist/commands/sync-narrow.js +1 -1
  41. package/dist/commands/team-sync.js +1 -1
  42. package/dist/commands/whoami.js +26 -1
  43. package/dist/data/command-states.json +22 -0
  44. package/dist/index.js +52 -4
  45. package/dist/lazy-commands.js +2 -1
  46. package/dist/lib/anywhere-person-setting.d.ts +2 -0
  47. package/dist/lib/anywhere-person-setting.js +6 -3
  48. package/dist/lib/billing/usage-card.d.ts +25 -4
  49. package/dist/lib/billing/usage-card.js +76 -9
  50. package/dist/lib/billing/usage-cost.d.ts +3 -3
  51. package/dist/lib/billing/usage-cost.js +40 -15
  52. package/dist/lib/billing/usage-only.js +4 -2
  53. package/dist/lib/billing/usage-rate-card.d.ts +2 -2
  54. package/dist/lib/billing/usage-rate-card.js +3 -0
  55. package/dist/lib/bot/fleet-cron.js +93 -6
  56. package/dist/lib/bot/inflight.d.ts +9 -0
  57. package/dist/lib/bot/inflight.js +10 -0
  58. package/dist/lib/bot/jobs/hot-signal-sync.js +12 -1
  59. package/dist/lib/bot/pack-link.d.ts +2 -2
  60. package/dist/lib/bot/pack-link.js +2 -2
  61. package/dist/lib/bot/runtime/grok-acp.d.ts +1 -0
  62. package/dist/lib/bot/runtime/grok-acp.js +26 -11
  63. package/dist/lib/bot/runtime/grok.js +1 -1
  64. package/dist/lib/daemon/flag-monitor.d.ts +8 -0
  65. package/dist/lib/daemon/flag-monitor.js +17 -6
  66. package/dist/lib/daemon/flag.d.ts +65 -1
  67. package/dist/lib/daemon/flag.js +190 -40
  68. package/dist/lib/daemon/hook-env.d.ts +32 -0
  69. package/dist/lib/daemon/hook-env.js +51 -0
  70. package/dist/lib/daemon/ops/policy.js +67 -8
  71. package/dist/lib/daemon/paths.d.ts +72 -2
  72. package/dist/lib/daemon/paths.js +154 -3
  73. package/dist/lib/daemon/run.js +32 -21
  74. package/dist/lib/daemon/selfcheck.d.ts +22 -0
  75. package/dist/lib/daemon/selfcheck.js +40 -1
  76. package/dist/lib/daemon/server.d.ts +3 -1
  77. package/dist/lib/daemon/server.js +7 -22
  78. package/dist/lib/daemon/state-file-switch.d.ts +57 -0
  79. package/dist/lib/daemon/state-file-switch.js +88 -0
  80. package/dist/lib/daemon/state-file.d.ts +198 -0
  81. package/dist/lib/daemon/state-file.js +419 -0
  82. package/dist/lib/daemon/timed-flag-monitors.d.ts +47 -0
  83. package/dist/lib/daemon/timed-flag-monitors.js +75 -0
  84. package/dist/lib/doctor/checks/host-core.d.ts +52 -0
  85. package/dist/lib/doctor/checks/host-core.js +337 -0
  86. package/dist/lib/doctor/checks/replay-recorder.d.ts +39 -0
  87. package/dist/lib/doctor/checks/replay-recorder.js +261 -0
  88. package/dist/lib/doctor/checks/sync-runtime.js +3 -3
  89. package/dist/lib/doctor/registry.js +4 -0
  90. package/dist/lib/environment/credential-shapes.d.ts +61 -0
  91. package/dist/lib/environment/credential-shapes.js +333 -0
  92. package/dist/lib/environment/profile.d.ts +239 -0
  93. package/dist/lib/environment/profile.js +239 -0
  94. package/dist/lib/hook-engine/coverage.d.ts +13 -0
  95. package/dist/lib/hook-engine/coverage.js +124 -0
  96. package/dist/lib/hook-engine/reconcile.js +300 -94
  97. package/dist/lib/hook-engine/registration.d.ts +17 -1
  98. package/dist/lib/hook-engine/registration.js +62 -7
  99. package/dist/lib/hot-channels/adapters/slack.d.ts +21 -5
  100. package/dist/lib/hot-channels/adapters/slack.js +64 -21
  101. package/dist/lib/hot-channels/alert.d.ts +2 -0
  102. package/dist/lib/hot-channels/alert.js +8 -1
  103. package/dist/lib/hot-channels/contract.d.ts +12 -0
  104. package/dist/lib/hot-channels/contract.js +7 -0
  105. package/dist/lib/hot-channels/loop.js +1 -0
  106. package/dist/lib/hot-channels/run.d.ts +6 -0
  107. package/dist/lib/hot-channels/run.js +4 -0
  108. package/dist/lib/hot-channels/signals-pass.d.ts +64 -1
  109. package/dist/lib/hot-channels/signals-pass.js +21 -49
  110. package/dist/lib/install/claude-targets.d.ts +12 -1
  111. package/dist/lib/install/claude-targets.js +70 -5
  112. package/dist/lib/install/codex-pack-contributions.js +1 -1
  113. package/dist/lib/install/codex-targets.d.ts +2 -2
  114. package/dist/lib/install/codex-targets.js +48 -5
  115. package/dist/lib/install/hook-target.d.ts +4 -1
  116. package/dist/lib/install/hook-target.js +14 -1
  117. package/dist/lib/lanes/canonical-host.d.ts +35 -0
  118. package/dist/lib/lanes/canonical-host.js +65 -0
  119. package/dist/lib/lanes/host-capacity.d.ts +30 -0
  120. package/dist/lib/lanes/host-capacity.js +29 -3
  121. package/dist/lib/mesh/live/daemon/run.d.ts +2 -0
  122. package/dist/lib/mesh/live/daemon/run.js +5 -2
  123. package/dist/lib/mesh/live/flush.d.ts +5 -1
  124. package/dist/lib/mesh/live/flush.js +12 -6
  125. package/dist/lib/mesh/live/reporting-privacy.d.ts +32 -0
  126. package/dist/lib/mesh/live/reporting-privacy.js +56 -1
  127. package/dist/lib/mesh/live/spool.d.ts +7 -0
  128. package/dist/lib/mesh/live/spool.js +25 -0
  129. package/dist/lib/packages/setup-block.d.ts +2 -2
  130. package/dist/lib/packages/setup-block.js +2 -2
  131. package/dist/lib/packages/start-bot.d.ts +1 -1
  132. package/dist/lib/packages/start-bot.js +1 -1
  133. package/dist/lib/person-setting-cache.d.ts +38 -0
  134. package/dist/lib/person-setting-cache.js +98 -0
  135. package/dist/lib/safe-store.d.ts +245 -0
  136. package/dist/lib/safe-store.js +777 -0
  137. package/dist/lib/signals/engine.d.ts +29 -2
  138. package/dist/lib/signals/engine.js +103 -4
  139. package/dist/lib/signals/reply.js +73 -18
  140. package/dist/lib/signals/steps/adapters.js +7 -2
  141. package/dist/lib/signals/steps/extract.d.ts +13 -0
  142. package/dist/lib/signals/steps/extract.js +84 -4
  143. package/dist/main.js +47 -4
  144. package/dist/schemas/hq-environment-profile.v1.schema.json +438 -0
  145. package/dist/types.d.ts +1 -1
  146. package/dist/utils/auth-expiry.d.ts +8 -0
  147. package/dist/utils/auth-expiry.js +53 -0
  148. package/dist/utils/callback-port-busy.d.ts +1 -1
  149. package/dist/utils/callback-port-busy.js +4 -4
  150. package/dist/utils/cli-telemetry.d.ts +21 -0
  151. package/dist/utils/cli-telemetry.js +34 -0
  152. package/dist/utils/command-usage.d.ts +275 -0
  153. package/dist/utils/command-usage.js +797 -0
  154. package/dist/utils/hook-trust.d.ts +7 -0
  155. package/dist/utils/hook-trust.js +34 -4
  156. package/dist/utils/host-registration.d.ts +179 -0
  157. package/dist/utils/host-registration.js +505 -0
  158. package/dist/utils/resident-package-preload.js +2 -0
  159. package/package.json +10 -8
  160. package/scripts/bench-core.mjs +1096 -0
  161. package/scripts/check-function-manifest.mjs +702 -0
@@ -1,4 +1,5 @@
1
1
  import { findExecutableOnPath } from './resolve-executable.js';
2
+ import { type CoreNextTarget } from './host-registration.js';
2
3
  import { type SpawnPlan } from './windows-spawn.js';
3
4
  export interface CodexRpcClient {
4
5
  request(method: string, params: unknown): Promise<unknown>;
@@ -26,6 +27,12 @@ export interface HookTrustDependencies {
26
27
  * our read and our commit — which no other seam can reach.
27
28
  */
28
29
  readConfigText?: (file: string) => string;
30
+ /**
31
+ * The new-core target for the Grok user hook file (hq-core-rust US-017),
32
+ * or null for the shipped bash bridge. Injected by tests; the default reads
33
+ * flag `core.next`.
34
+ */
35
+ coreNextTarget?: (home: string) => CoreNextTarget | null;
29
36
  /**
30
37
  * Reads the HQ `.codex` hook files exactly as the installed core release
31
38
  * ships them. Used only by the post-rescue re-trust; see
@@ -11,6 +11,8 @@ import { parse as parseToml } from 'smol-toml';
11
11
  import { acquireLock, atomicReplace, backupConfig, realpathOrSelf, releaseLock, restoreFromBackup, } from '../commands/mcp-registration.js';
12
12
  import { findExecutableOnPath } from './resolve-executable.js';
13
13
  import { loadShippedCodexHookFiles } from './shipped-codex-hooks.js';
14
+ import { forHost } from '../lib/hook-engine/coverage.js';
15
+ import { coreNextTargetOrWarn, grokBridgeJson, replaceFileNoFollow } from './host-registration.js';
14
16
  import { planResolvedCommandSpawn } from './windows-spawn.js';
15
17
  /**
16
18
  * The home directory every runtime's config is resolved under.
@@ -674,11 +676,19 @@ function filesMatch(left, right) {
674
676
  return false;
675
677
  }
676
678
  }
679
+ function textMatches(file, text) {
680
+ try {
681
+ return fs.readFileSync(file, 'utf8') === text;
682
+ }
683
+ catch {
684
+ return false;
685
+ }
686
+ }
677
687
  /** Escape a value for use inside a TOML double-quoted (basic) string key. */
678
688
  function tomlEscapeKey(value) {
679
689
  return value.replace(/\\/g, '\\\\').replace(/"/g, '\\"');
680
690
  }
681
- function grokTrustIsCurrent(hqRoot, home) {
691
+ function grokTrustIsCurrent(hqRoot, home, wantJson) {
682
692
  const grokHome = path.join(home, '.grok');
683
693
  // The key is written TOML-escaped, so match the escaped form. On POSIX paths
684
694
  // (no backslash/quote) this is identical to the raw path.
@@ -705,7 +715,9 @@ function grokTrustIsCurrent(hqRoot, home) {
705
715
  legacyTrusted &&
706
716
  claudeCompatQuiet &&
707
717
  filesMatch(path.join(sourceHooks, 'hq-grok-user-bridge.sh'), path.join(userHooks, 'hq-hq-bridge.sh')) &&
708
- filesMatch(path.join(sourceHooks, 'hq-grok-user-bridge.json'), path.join(userHooks, 'hq-hq-bridge.json')));
718
+ (wantJson === undefined
719
+ ? filesMatch(path.join(sourceHooks, 'hq-grok-user-bridge.json'), path.join(userHooks, 'hq-hq-bridge.json'))
720
+ : textMatches(path.join(userHooks, 'hq-hq-bridge.json'), wantJson)));
709
721
  }
710
722
  /**
711
723
  * Upsert the `[folders."<hqRoot>"]` trust block in ~/.grok/trusted_folders.toml.
@@ -819,7 +831,22 @@ export function trustGrokProjectHooks(hqRoot, deps = DEFAULT_DEPS) {
819
831
  };
820
832
  }
821
833
  const home = deps.homeDir?.() ?? process.env.HOME ?? os.homedir();
822
- if (grokTrustIsCurrent(hqRoot, home)) {
834
+ // Flag `core.next` on: the user hook file calls the new core's entry point
835
+ // (hq-core-rust US-017) for each event the engine has every guard for. Off,
836
+ // when the engine is not available, or when the shipped file cannot be
837
+ // read as JSON: the shipped file, copied byte for byte as before.
838
+ let wantJson;
839
+ try {
840
+ const target = (deps.coreNextTarget ?? ((h) => coreNextTargetOrWarn(h)))(home);
841
+ // Only the events the new core covers in full on Grok switch.
842
+ const grok = forHost(target, hqRoot, 'grok');
843
+ wantJson = grok ? grokBridgeJson(fs.readFileSync(sourceBridgeJson, 'utf8'), hqRoot, grok) : undefined;
844
+ }
845
+ catch (error) {
846
+ process.stderr.write(`hq: warning: the Grok user hook file stays on the old dispatcher (${errorMessage(error)})\n`);
847
+ wantJson = undefined;
848
+ }
849
+ if (grokTrustIsCurrent(hqRoot, home, wantJson)) {
823
850
  return { runtime: 'grok', status: 'unchanged', trusted: 0 };
824
851
  }
825
852
  try {
@@ -835,7 +862,10 @@ export function trustGrokProjectHooks(hqRoot, deps = DEFAULT_DEPS) {
835
862
  quietGrokClaudeCompat(path.join(grokHome, 'config.toml'));
836
863
  fs.copyFileSync(sourceBridgeSh, path.join(userHooks, 'hq-hq-bridge.sh'));
837
864
  fs.chmodSync(path.join(userHooks, 'hq-hq-bridge.sh'), 0o755);
838
- fs.copyFileSync(sourceBridgeJson, path.join(userHooks, 'hq-hq-bridge.json'));
865
+ if (wantJson === undefined)
866
+ fs.copyFileSync(sourceBridgeJson, path.join(userHooks, 'hq-hq-bridge.json'));
867
+ else
868
+ replaceFileNoFollow(path.join(userHooks, 'hq-hq-bridge.json'), wantJson, home);
839
869
  return { runtime: 'grok', status: 'trusted', trusted: 1 };
840
870
  }
841
871
  catch (error) {
@@ -0,0 +1,179 @@
1
+ import { type NativeTarget } from '../lib/hook-engine/registration.js';
2
+ export declare const CORE_NEXT_FLAG = "core.next";
3
+ /** Engine-side kill switch: environment variable and file under the home folder. */
4
+ export declare const CORE_NEXT_KILL_ENV = "HQ_CORE_NEXT";
5
+ export declare const CORE_NEXT_KILL_FILE: string;
6
+ /** The engine-wide kill switch the bridge already honors; the engine checks it too. */
7
+ export declare const ENGINE_KILL_ENV = "HQ_HOOK_ENGINE";
8
+ export declare const ENGINE_KILL_FILE: string;
9
+ /** Name of the release-stable link next to the pinned engine versions. */
10
+ export declare const STABLE_LINK_NAME = "stable";
11
+ export type CoreNextHost = 'claude' | 'codex' | 'grok';
12
+ /**
13
+ * `project`: the HQ root's own registration, always answers.
14
+ * `global`: the user-scope Claude Code entry; answers nothing inside an HQ
15
+ * tree, where the project hooks run (as the old user-scope entry did).
16
+ * `in-tree`: the Grok user bridge; answers nothing outside an HQ tree (as the
17
+ * old bridge did).
18
+ */
19
+ export type CoreNextScope = 'project' | 'global' | 'in-tree';
20
+ /** A registration target with the flag off: the bash dispatcher, the hqd shim, or the pinned launcher. */
21
+ export type FallbackTarget = 'master' | 'shim' | NativeTarget;
22
+ /**
23
+ * Registration target for the new core: the stable engine path, the events
24
+ * whose guards the engine has (only these switch), and what every other event
25
+ * is registered to (the flag-off target; `master` when not given).
26
+ */
27
+ export interface CoreNextTarget {
28
+ coreNext: string;
29
+ events: readonly string[];
30
+ fallback?: FallbackTarget;
31
+ /** The old dispatcher's hooks the engine does in full, per event (`capabilities --json` `covers`). */
32
+ covers?: Readonly<Record<string, readonly string[]>>;
33
+ }
34
+ /** The target one event is registered to: the new core only for an event it can take. */
35
+ export declare function targetForEvent(target: FallbackTarget | CoreNextTarget, event: string): FallbackTarget | CoreNextTarget;
36
+ /**
37
+ * The evaluators an event needs before it may leave the old dispatcher: the
38
+ * new-core ports of what the old dispatcher does on that event (hq-core-rust
39
+ * US-010 to US-015). An event not listed here has no port yet and always keeps
40
+ * the old registration.
41
+ */
42
+ export declare const REQUIRED_EVALUATORS: Readonly<Record<string, readonly string[]>>;
43
+ /** Schema of `hq-hook capabilities --json`. */
44
+ export declare const CAPABILITIES_SCHEMA = "hq-hook.capabilities.v1";
45
+ /** What an engine reported: its version and the evaluators it runs per event. */
46
+ export interface EngineCapabilities {
47
+ version: string;
48
+ events: Record<string, string[]>;
49
+ /** The old dispatcher's hooks the engine does in full, per event; empty for an engine that does not say. */
50
+ covers?: Record<string, string[]>;
51
+ }
52
+ /** Evaluators `event` needs that `caps` lacks; null when the event has no switch rule. */
53
+ export declare function missingEvaluators(caps: EngineCapabilities, event: string): string[] | null;
54
+ /** Events the engine has every required evaluator for. */
55
+ export declare function capableEvents(caps: EngineCapabilities): string[];
56
+ /**
57
+ * Start `engine` the way a host would and read what it evaluates: `--version`
58
+ * must print `hq-hook <version>`, and `capabilities --json` the capability
59
+ * document. Throws when either fails, so the caller keeps the old
60
+ * registrations. Bounded: each call is given five seconds.
61
+ */
62
+ export declare function probeEngine(engine: string): EngineCapabilities;
63
+ /**
64
+ * Check that the stable path resolves to the pinned engine before a
65
+ * registration names it: a missing or dangling `stable` link would leave every
66
+ * new-core registration with nothing to run.
67
+ */
68
+ export declare function checkStableEngine(stable: string, pinned: string): void;
69
+ /**
70
+ * Why the new core is switched off on this machine, or null. The same four
71
+ * switches the engine reads (`crates/hq-hook/src/core_next.rs` `kill_reason`):
72
+ * `HQ_CORE_NEXT=off|0|false|no`, `HQ_HOOK_ENGINE=off`, and the files
73
+ * `~/.hq/state/core-next.off` and `~/.hq/hook-engine.off` (a link counts, as
74
+ * for the engine). With any of them on, `hq reindex` removes the new-core
75
+ * entries it added, so the registrations are what they were before the switch.
76
+ */
77
+ export declare function coreNextKillReason(home: string, env?: NodeJS.ProcessEnv): string | null;
78
+ /** `core.next` for this machine, person or company, offline. */
79
+ export declare function coreNextEnabled(env?: NodeJS.ProcessEnv): boolean;
80
+ /** The stable path that stands for a pinned engine path. */
81
+ export declare function stableEnginePath(pinned: string, home: string): string;
82
+ /**
83
+ * Point `<home>/.hq/bin/hq-hook/stable` at the pinned engine's version folder
84
+ * and return the stable engine path. The link is replaced by rename, so a
85
+ * planted file at the temporary name or the link itself is never followed. A
86
+ * `stable` that is a real folder (not a link) is someone else's and is left
87
+ * alone: the call fails and the caller keeps the current registrations.
88
+ */
89
+ export declare function linkStableEngine(pinned: string, home: string, platform?: NodeJS.Platform): string;
90
+ export interface CoreNextOptions {
91
+ platform?: NodeJS.Platform;
92
+ /** Reads the engine's capabilities; `probeEngine` by default. */
93
+ probe?: (engine: string) => EngineCapabilities;
94
+ }
95
+ /**
96
+ * The new-core target when `core.next` is on, the engine for this CLI is
97
+ * installed, the stable link resolves to it, it runs, and it has every
98
+ * evaluator at least one event needs; else null. Installs the pinned engine
99
+ * as the launcher flag does. Throws when the link or the engine check fails;
100
+ * callers use [`coreNextTargetOrWarn`], which keeps the old registrations.
101
+ *
102
+ * Windows returns null: the new core's Windows path (job objects, the
103
+ * PowerShell forms, junction swaps) is US-022, so every Windows registration
104
+ * stays as it is today.
105
+ */
106
+ export declare function coreNextTarget(home: string, env?: NodeJS.ProcessEnv, options?: CoreNextOptions): CoreNextTarget | null;
107
+ /**
108
+ * [`coreNextTarget`], with any failure turned into one warning and null, so
109
+ * `hq install` and `hq reindex` go on with the old registrations.
110
+ */
111
+ export declare function coreNextTargetOrWarn(home: string, env?: NodeJS.ProcessEnv, options?: CoreNextOptions & {
112
+ warn?: (message: string) => void;
113
+ }): CoreNextTarget | null;
114
+ /** Test hook: forget which warnings were printed. */
115
+ export declare function _resetCoreNextWarningsForTests(): void;
116
+ /** Arguments after the engine path for one host, event and scope. */
117
+ export declare function coreNextArgs(host: CoreNextHost, event: string, root: string, scope: CoreNextScope): string[];
118
+ /** POSIX shell form of a core-next command (Codex and Grok take a command string). */
119
+ export declare function coreNextCommand(engine: string, host: CoreNextHost, event: string, root: string, scope: CoreNextScope): string;
120
+ /** PowerShell form, for hosts that run hook commands through PowerShell on Windows. */
121
+ export declare function coreNextCommandWindows(engine: string, host: CoreNextHost, event: string, root: string, scope: CoreNextScope): string;
122
+ type HookEntry = Record<string, unknown>;
123
+ /** What [`placeEvent`] needs to know about one event's registrations in one file. */
124
+ export interface EventOptions {
125
+ /** An HQ shell-side entry for this event: the old dispatcher, the hqd shim or the pinned launcher. */
126
+ isShell: (entry: HookEntry) => boolean;
127
+ /** An HQ new-core entry (`hq-hook run --host ...`) for this HQ root. */
128
+ isNative: (entry: HookEntry) => boolean;
129
+ /** The shell entry wanted in the place of `entry` (a shell entry, or a new-core entry that took its place). */
130
+ toShell: (entry: HookEntry) => HookEntry;
131
+ /**
132
+ * The new-core entry wanted in the place of the shell entry `entry`, when
133
+ * this event switches on this host; null when it stays on the shell.
134
+ */
135
+ toNative: ((entry: HookEntry) => HookEntry) | null;
136
+ /** A shell entry to add, as its own group at the end, when the event has none left in this file. */
137
+ restore?: HookEntry | null;
138
+ /** Keep only the first HQ entry (user-scope files, which hold one HQ entry per event). */
139
+ single?: boolean;
140
+ }
141
+ /**
142
+ * One event's hook groups for the registration switch (hq-core-rust US-017,
143
+ * coverage-gated). An event is on exactly one core per file:
144
+ *
145
+ * - It switches (`toNative` given) only when the new core does every hook the
146
+ * old dispatcher runs for it on this host (`hook-engine/coverage.ts`). The
147
+ * new-core entry then takes the shell entry's place, so the engine owns the
148
+ * whole event, and its kill-switch hand-back to the old dispatcher runs the
149
+ * shell hooks exactly once.
150
+ * - Otherwise it stays on the shell: every new-core entry for this root is
151
+ * removed, and one standing where the shell entry was becomes the shell
152
+ * entry again. `restore` adds the shell entry back when it is gone from the
153
+ * file (moved out by an HQ settings merge).
154
+ *
155
+ * Entries keep their place and their extra fields both ways, so switching on
156
+ * and off gives the original bytes back. Groups and entries that are not HQ's
157
+ * stay where they are.
158
+ */
159
+ export declare function placeEvent(groups: readonly unknown[], options: EventOptions): unknown[];
160
+ /**
161
+ * The Grok Build user hook file (`~/.grok/hooks/hq-hq-bridge.json`) for a
162
+ * target (already narrowed to the events the new core covers in full on
163
+ * Grok). With no target it is the shipped source text unchanged. With the new
164
+ * core each entry that calls the bash bridge, on a switched event, calls the
165
+ * engine instead; matchers, timeouts, the other events and every other entry
166
+ * stay as they are.
167
+ */
168
+ export declare function grokBridgeJson(source: string, root: string, target: CoreNextTarget | null, platform?: NodeJS.Platform): string;
169
+ /**
170
+ * Write `content` to `file` through the shared safe store (store rule v2): the
171
+ * folder is held open and checked (a real folder of this user, not a link,
172
+ * not writable by group or others, parents checked up to the home folder),
173
+ * and the file is replaced by rename from a new O_EXCL|O_NOFOLLOW temporary
174
+ * file, so a link planted at `file` is replaced, never written through.
175
+ * Throws on any refusal; the caller keeps the current file.
176
+ */
177
+ export declare function replaceFileNoFollow(file: string, content: string, home?: string): void;
178
+ export {};
179
+ //# sourceMappingURL=host-registration.d.ts.map