@indigoai-us/hq-cli 5.345.267 → 5.345.269
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +29 -0
- package/README.md +12 -0
- package/contracts/host-canary-release.json +7 -7
- package/dist/commands/core-job-notify-native.d.ts +6 -0
- package/dist/commands/core-job-notify-native.js +64 -4
- package/dist/commands/core-jobs-native.js +3 -16
- package/dist/commands/install-global.js +54 -17
- package/dist/lib/daemon/machine-check-owner.js +1 -1
- package/dist/lib/daemon/machine-checks.d.ts +3 -11
- package/dist/lib/daemon/machine-checks.js +4 -15
- package/dist/lib/daemon/run.js +12 -0
- package/dist/lib/doctor/checks/codex-wiring.d.ts +4 -2
- package/dist/lib/doctor/checks/codex-wiring.js +70 -13
- package/dist/lib/doctor/checks/fleet-hook-core.d.ts +4 -4
- package/dist/lib/doctor/checks/fleet-hook-core.js +5 -10
- package/dist/lib/doctor/checks/grok-wiring.js +38 -0
- package/dist/lib/doctor/checks/hook-engine.js +0 -2
- package/dist/lib/doctor/checks/host-core.d.ts +1 -1
- package/dist/lib/doctor/checks/host-core.js +8 -38
- package/dist/lib/hook-engine/coverage.d.ts +10 -1
- package/dist/lib/hook-engine/coverage.js +63 -8
- package/dist/lib/hook-engine/fleet-registration.js +7 -4
- package/dist/lib/hook-engine/native-precompact-compatibility.json +7 -1
- package/dist/lib/hook-engine/native-stop-compatibility.json +30 -11
- package/dist/lib/hook-engine/reconcile.d.ts +10 -1
- package/dist/lib/hook-engine/reconcile.js +339 -42
- package/dist/lib/hook-engine/stable-gate.d.ts +43 -0
- package/dist/lib/hook-engine/stable-gate.js +276 -0
- package/dist/lib/hot-channels/fleet-complete.js +2 -2
- package/dist/lib/install/antigravity-targets.js +2 -1
- package/dist/lib/install/claude-targets.d.ts +6 -6
- package/dist/lib/install/claude-targets.js +13 -9
- package/dist/lib/install/codex-targets.d.ts +4 -4
- package/dist/lib/install/codex-targets.js +26 -16
- package/dist/lib/install/hook-target.d.ts +23 -2
- package/dist/lib/install/hook-target.js +89 -16
- package/dist/lib/outpost-identity-env.d.ts +18 -0
- package/dist/lib/outpost-identity-env.js +29 -0
- package/dist/lib/signals/steps/extract.js +46 -12
- package/dist/utils/core-next-kill.d.ts +2 -15
- package/dist/utils/core-next-kill.js +5 -36
- package/dist/utils/hook-engine-crash.d.ts +86 -0
- package/dist/utils/hook-engine-crash.js +325 -0
- package/dist/utils/hook-engine-rollup.d.ts +8 -3
- package/dist/utils/hook-engine-rollup.js +0 -1
- package/dist/utils/hook-trust.d.ts +2 -0
- package/dist/utils/hook-trust.js +156 -13
- package/dist/utils/host-registration.d.ts +158 -4
- package/dist/utils/host-registration.js +500 -17
- package/dist/utils/version-gate.d.ts +42 -4
- package/dist/utils/version-gate.js +84 -25
- package/package.json +7 -7
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import { type EngineOptions } from '../lib/hook-engine/resolve.js';
|
|
2
2
|
import { type NativeTarget } from '../lib/hook-engine/registration.js';
|
|
3
3
|
export { CORE_NEXT_FLAG, coreNextEnabled } from './core-next-flag.js';
|
|
4
|
-
export {
|
|
4
|
+
export { coreNextStrictReason, ENGINE_STRICT_ENV, ENGINE_STRICT_FILE } from './core-next-kill.js';
|
|
5
5
|
/** Name of the release-stable link next to the pinned engine versions. */
|
|
6
6
|
export declare const STABLE_LINK_NAME = "stable";
|
|
7
|
+
/** Record of canary-accepted hook engines committed to `stable`, under the home folder. */
|
|
8
|
+
export declare const ACCEPTED_HOOK_ENGINE_RECORD: string;
|
|
9
|
+
/** Schema of [`ACCEPTED_HOOK_ENGINE_RECORD`]. */
|
|
10
|
+
export declare const ACCEPTED_HOOK_ENGINE_SCHEMA = "hq.accepted-hook-engine.v1";
|
|
7
11
|
export type CoreNextHost = 'claude' | 'codex' | 'grok' | 'fleet-local' | 'agents-v2' | 'antigravity';
|
|
8
12
|
/**
|
|
9
13
|
* `project`: the HQ root's own registration, always answers.
|
|
@@ -13,8 +17,8 @@ export type CoreNextHost = 'claude' | 'codex' | 'grok' | 'fleet-local' | 'agents
|
|
|
13
17
|
* old bridge did).
|
|
14
18
|
*/
|
|
15
19
|
export type CoreNextScope = 'project' | 'global' | 'in-tree';
|
|
16
|
-
/** A registration target with the flag off: the bash dispatcher, the hqd shim, or the pinned launcher. */
|
|
17
|
-
export type FallbackTarget = 'master' | 'shim' | NativeTarget;
|
|
20
|
+
/** A registration target with the flag off: the bash dispatcher, the hqd shim, the fail-closed portable native wrapper, or the pinned launcher. */
|
|
21
|
+
export type FallbackTarget = 'master' | 'shim' | 'portable' | NativeTarget;
|
|
18
22
|
/**
|
|
19
23
|
* Registration target for the new core: the stable engine path, the events
|
|
20
24
|
* whose guards the engine has (only these switch), and what every other event
|
|
@@ -35,6 +39,14 @@ export interface CoreNextTarget {
|
|
|
35
39
|
*/
|
|
36
40
|
canary?: (root: string, host: CoreNextHost) => boolean;
|
|
37
41
|
}
|
|
42
|
+
/** Candidate metadata stored off-object (WeakMap) so `CoreNextTarget` identity and enumerable shape stay unchanged. */
|
|
43
|
+
export interface CoreNextCandidateMeta {
|
|
44
|
+
pinnedEngine: string;
|
|
45
|
+
engineVersion: string;
|
|
46
|
+
commitStable?: (acceptedHosts?: readonly CoreNextHost[]) => string;
|
|
47
|
+
}
|
|
48
|
+
/** Read the candidate engine metadata attached by [`coreNextTarget`], if any. */
|
|
49
|
+
export declare function getCoreNextCandidate(target: CoreNextTarget | null | undefined): CoreNextCandidateMeta | undefined;
|
|
38
50
|
/** The target one event is registered to: the new core only for an event it can take. */
|
|
39
51
|
export declare function targetForEvent(target: FallbackTarget | CoreNextTarget, event: string): FallbackTarget | CoreNextTarget;
|
|
40
52
|
/**
|
|
@@ -88,6 +100,12 @@ export interface CoreNextOptions {
|
|
|
88
100
|
probe?: (engine: string) => EngineCapabilities;
|
|
89
101
|
/** Where gate warnings go (once each); standard error by default. */
|
|
90
102
|
warn?: (message: string) => void;
|
|
103
|
+
/**
|
|
104
|
+
* When true, probe the pinned engine directly and defer moving
|
|
105
|
+
* `<home>/.hq/bin/hq-hook/stable` until the caller invokes `commitStable()`
|
|
106
|
+
* after the host canary gate accepts the candidate.
|
|
107
|
+
*/
|
|
108
|
+
deferLink?: boolean;
|
|
91
109
|
}
|
|
92
110
|
/** Why this home stays on shell registrations, or null when engine selection may run. */
|
|
93
111
|
export declare function coreNextOffReason(home: string, env: NodeJS.ProcessEnv, platform: NodeJS.Platform): string | null;
|
|
@@ -97,6 +115,8 @@ export interface CoreNextEngineOptions {
|
|
|
97
115
|
platform?: NodeJS.Platform;
|
|
98
116
|
probe?: (engine: string) => EngineCapabilities;
|
|
99
117
|
lookup?: CoreNextEngineLookup;
|
|
118
|
+
/** Install mode only: probe `pinned` without moving `stable` yet. */
|
|
119
|
+
deferLink?: boolean;
|
|
100
120
|
}
|
|
101
121
|
export interface CoreNextEngine {
|
|
102
122
|
stable: string;
|
|
@@ -104,10 +124,102 @@ export interface CoreNextEngine {
|
|
|
104
124
|
caps: EngineCapabilities;
|
|
105
125
|
}
|
|
106
126
|
/**
|
|
107
|
-
* The one engine selection. Install links the stable path
|
|
127
|
+
* The one engine selection. Install links the stable path (unless `deferLink`
|
|
128
|
+
* is set, in which case `pinned` is probed directly so the caller can commit
|
|
129
|
+
* `stable` only after the host canary gate accepts it). Read-only never
|
|
108
130
|
* writes. Both fail when the pinned bundle or the stable link is wrong.
|
|
109
131
|
*/
|
|
110
132
|
export declare function resolveCoreNextEngine(home: string, options: CoreNextEngineOptions): CoreNextEngine;
|
|
133
|
+
/** One canary-accepted engine recorded when `commitStable` moved `stable` to it. */
|
|
134
|
+
export interface AcceptedHookEngineEntry {
|
|
135
|
+
engineVersion: string;
|
|
136
|
+
pinnedEngine: string;
|
|
137
|
+
acceptedAt: string;
|
|
138
|
+
hosts: CoreNextHost[];
|
|
139
|
+
}
|
|
140
|
+
export interface AcceptedHookEngineRecord {
|
|
141
|
+
schema: typeof ACCEPTED_HOOK_ENGINE_SCHEMA;
|
|
142
|
+
engines: Record<string, AcceptedHookEngineEntry>;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Read `<home>/.hq/bin/hq-hook/accepted-engine.json`; null when absent,
|
|
146
|
+
* unreadable, invalid, or writable by another user.
|
|
147
|
+
*/
|
|
148
|
+
export declare function readAcceptedHookEngineRecord(home: string, platform?: NodeJS.Platform): AcceptedHookEngineRecord | null;
|
|
149
|
+
/**
|
|
150
|
+
* Record `pinned` (`engineVersion`) as canary-accepted for `hosts` after
|
|
151
|
+
* committing `<home>/.hq/bin/hq-hook/stable`. Merges `hosts` when the same
|
|
152
|
+
* canonical binary is already recorded. Uses store-rule-v2 atomic replace.
|
|
153
|
+
*/
|
|
154
|
+
export declare function recordAcceptedHookEngine(home: string, pinned: string, engineVersion: string, hosts: readonly CoreNextHost[], platform?: NodeJS.Platform): void;
|
|
155
|
+
/**
|
|
156
|
+
* Return `<home>/.hq/bin/hq-hook/stable/<binary>` if `stable` already resolves
|
|
157
|
+
* to a runnable engine file (and, when `excludeBinary` is given, does NOT
|
|
158
|
+
* resolve to that refused binary). Read-only; never installs or moves `stable`.
|
|
159
|
+
*/
|
|
160
|
+
export declare function existingStableHookEngine(home: string, options?: {
|
|
161
|
+
platform?: NodeJS.Platform;
|
|
162
|
+
excludeBinary?: string | null;
|
|
163
|
+
}): string | null;
|
|
164
|
+
/**
|
|
165
|
+
* Return `<home>/.hq/bin/hq-hook/stable/<binary>` only when it resolves to a
|
|
166
|
+
* runnable engine that was recorded as canary-accepted (never an engine linked
|
|
167
|
+
* with `core.next` off, forced via `--skip-host-canary-gate`, or symlinked by
|
|
168
|
+
* hand) and covers every canary host in `requiredHosts`.
|
|
169
|
+
*/
|
|
170
|
+
export declare function existingAcceptedStableHookEngine(home: string, options: {
|
|
171
|
+
platform?: NodeJS.Platform;
|
|
172
|
+
excludeBinary?: string | null;
|
|
173
|
+
root: string;
|
|
174
|
+
env?: NodeJS.ProcessEnv;
|
|
175
|
+
requiredHosts?: readonly CoreNextHost[];
|
|
176
|
+
}): {
|
|
177
|
+
stable: string;
|
|
178
|
+
engineVersion: string;
|
|
179
|
+
} | null;
|
|
180
|
+
/**
|
|
181
|
+
* Install the pinned hook engine (if available) and point
|
|
182
|
+
* `<home>/.hq/bin/hq-hook/stable` at it (symlink on POSIX, junction on
|
|
183
|
+
* Windows), regardless of `core.next`. When the npm engine package is gone,
|
|
184
|
+
* reuses an existing runnable `stable` or relinks `stable` from an already-
|
|
185
|
+
* pinned copy of this CLI's version under `<home>/.hq/bin/hq-hook/<version>`.
|
|
186
|
+
* Returns null when no usable engine exists on disk.
|
|
187
|
+
*/
|
|
188
|
+
export declare function ensureStableHookEngine(home: string, options?: {
|
|
189
|
+
platform?: NodeJS.Platform;
|
|
190
|
+
lookup?: CoreNextEngineLookup;
|
|
191
|
+
}): string | null;
|
|
192
|
+
export interface PortableEngineResolution {
|
|
193
|
+
stable: string | null;
|
|
194
|
+
/** Clear operator-facing explanation when no accepted engine can be linked or reused. */
|
|
195
|
+
refusalReason?: string;
|
|
196
|
+
/** True when falling back to a previously accepted `stable` engine after a canary/coverage refusal. */
|
|
197
|
+
keptPriorEngine?: boolean;
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Resolve the engine behind `<home>/.hq/bin/hq-hook/stable` for portable
|
|
201
|
+
* fallback on a native-only HQ root.
|
|
202
|
+
*
|
|
203
|
+
* - When `core.next` is off (or on Windows where `core.next` is not active),
|
|
204
|
+
* links `stable` via [`ensureStableHookEngine`].
|
|
205
|
+
* - When `core.next` IS active and a candidate engine was refused by the host
|
|
206
|
+
* canary or coverage gate (M-2), NEVER links or runs that refused engine:
|
|
207
|
+
* keeps a previously accepted engine already at `stable`, or refuses clearly.
|
|
208
|
+
*/
|
|
209
|
+
export declare function resolvePortableEngineForNativeOnly(home: string, options: {
|
|
210
|
+
platform?: NodeJS.Platform;
|
|
211
|
+
env?: NodeJS.ProcessEnv;
|
|
212
|
+
host: CoreNextHost;
|
|
213
|
+
root: string;
|
|
214
|
+
candidate?: {
|
|
215
|
+
pinnedEngine?: string;
|
|
216
|
+
engineVersion?: string;
|
|
217
|
+
refusedHosts?: readonly CoreNextHost[];
|
|
218
|
+
checkedHosts?: readonly CoreNextHost[];
|
|
219
|
+
} | null;
|
|
220
|
+
requiredHosts?: readonly CoreNextHost[];
|
|
221
|
+
lookup?: CoreNextEngineLookup;
|
|
222
|
+
}): PortableEngineResolution;
|
|
111
223
|
/**
|
|
112
224
|
* The new-core target when `core.next` is on, the engine for this CLI is
|
|
113
225
|
* installed, the stable link resolves to it, it runs, and it has every
|
|
@@ -152,6 +264,48 @@ export declare function coreNextArgs(host: CoreNextHost, event: string, root: st
|
|
|
152
264
|
export declare function coreNextCommand(engine: string, host: CoreNextHost, event: string, root: string, scope: CoreNextScope): string;
|
|
153
265
|
/** PowerShell form, for hosts that run hook commands through PowerShell on Windows. */
|
|
154
266
|
export declare function coreNextCommandWindows(engine: string, host: CoreNextHost, event: string, root: string, scope: CoreNextScope): string;
|
|
267
|
+
/** Shipped post-US-027 fail-closed portable `hq-hook` shell command for `event` in `<root>/.claude/settings.json`. */
|
|
268
|
+
export declare function shippedPortableClaudeCommand(event: string): string;
|
|
269
|
+
/** True only for HQ's exact shipped portable `.claude/settings.json` command for `event`. */
|
|
270
|
+
export declare function isShippedPortableClaudeCommand(command: string, event: string): boolean;
|
|
271
|
+
/**
|
|
272
|
+
* Fail-closed portable `hq-hook` command with an explicit HQ root (for user-scope
|
|
273
|
+
* settings, Grok user bridge, and Antigravity on native-only roots when `core.next`
|
|
274
|
+
* is off or no direct stable path is resolved).
|
|
275
|
+
*/
|
|
276
|
+
export declare function portableNativeCommand(host: 'claude' | 'codex' | 'grok' | 'antigravity', event: string, root: string, scope: CoreNextScope): string;
|
|
277
|
+
/**
|
|
278
|
+
* Inner PowerShell script executed by [`portableNativeCommandWindows`].
|
|
279
|
+
* Encoded as UTF-16LE Base64 under `-EncodedCommand` so neither Git Bash
|
|
280
|
+
* (Claude Code on Windows) nor Windows PowerShell (Codex `commandWindows`)
|
|
281
|
+
* expands `$h`, `$env:USERPROFILE`, `$LASTEXITCODE`, or root characters before
|
|
282
|
+
* the child `powershell.exe` parses the script.
|
|
283
|
+
*/
|
|
284
|
+
export declare function portableNativeWindowsScript(host: 'claude' | 'codex' | 'grok' | 'antigravity', event: string, root: string, scope: CoreNextScope): string;
|
|
285
|
+
/**
|
|
286
|
+
* Windows PowerShell fail-closed portable `hq-hook.exe` wrapper (never POSIX `sh -c`,
|
|
287
|
+
* and never dollar-expressions inside a double-quoted `-Command` string) for
|
|
288
|
+
* user-scope Claude, Codex, Grok bridge, and Antigravity on native-only roots.
|
|
289
|
+
*/
|
|
290
|
+
export declare function portableNativeCommandWindows(host: 'claude' | 'codex' | 'grok' | 'antigravity', event: string, root: string, scope: CoreNextScope): string;
|
|
291
|
+
/** Portable native command for `platform`: PowerShell on Windows, POSIX `sh -c` elsewhere. */
|
|
292
|
+
export declare function portableNativeCommandForPlatform(host: 'claude' | 'codex' | 'grok' | 'antigravity', event: string, root: string, scope: CoreNextScope, platform?: NodeJS.Platform): string;
|
|
293
|
+
/** True only for HQ's exact fail-closed portable native entry for `host`, `root`, and `scope`. */
|
|
294
|
+
export declare function isPortableNativeEntry(entry: Record<string, unknown>, host: 'claude' | 'codex' | 'grok' | 'antigravity', root: string, scope: CoreNextScope): boolean;
|
|
295
|
+
/**
|
|
296
|
+
* Synthesize `~/.grok/hooks/hq-hq-bridge.json` with fail-closed portable native
|
|
297
|
+
* entries for a native-only HQ root when `core.next` is off or no direct stable
|
|
298
|
+
* target is active.
|
|
299
|
+
*/
|
|
300
|
+
export declare function portableGrokBridgeJson(root: string, platform?: NodeJS.Platform): string;
|
|
301
|
+
/** Canonical Grok Build hook events registered in ~/.grok/hooks/hq-hq-bridge.json. */
|
|
302
|
+
export declare const GROK_NATIVE_HOOK_EVENTS: readonly ["SessionStart", "UserPromptSubmit", "PreToolUse", "PostToolUse", "Stop", "PreCompact", "SessionEnd", "SubagentStop", "Notification", "StopCancelled", "StopFailure", "PostToolUseFailure", "PermissionDenied", "SubagentStart", "PostCompact"];
|
|
303
|
+
/**
|
|
304
|
+
* Synthesize `~/.grok/hooks/hq-hq-bridge.json` directly for a native-only HQ
|
|
305
|
+
* root whose `.grok/hooks/hq-grok-user-bridge.{sh,json}` files were removed
|
|
306
|
+
* (US-027). Every event covered by `target` calls `hq-hook run --host grok`.
|
|
307
|
+
*/
|
|
308
|
+
export declare function nativeGrokBridgeJson(root: string, target: CoreNextTarget, platform?: NodeJS.Platform): string;
|
|
155
309
|
type HookEntry = Record<string, unknown>;
|
|
156
310
|
/** What [`placeEvent`] needs to know about one event's registrations in one file. */
|
|
157
311
|
export interface EventOptions {
|