@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.
- package/CHANGELOG.md +168 -0
- package/README.md +46 -1
- package/assets/bot-workers/setup/skills/add-a-pack.md +3 -3
- package/assets/scaffold/core/scripts/hq-session.sh +4 -0
- package/assets/scaffold/core/scripts/lib/epochrealtime.sh +30 -0
- package/assets/scaffold/core/scripts/lib/work-mesh-enqueue.sh +12 -5
- package/dist/command-catalog.generated.d.ts +59 -4
- package/dist/command-catalog.generated.js +74 -4
- package/dist/command-help.js +3 -1
- package/dist/command-registration-plan.d.ts +6 -0
- package/dist/command-registration-plan.js +1 -0
- package/dist/commands/auth.d.ts +1 -1
- package/dist/commands/auth.js +11 -52
- package/dist/commands/bot.js +11 -4
- package/dist/commands/cloud-demote.d.ts +19 -4
- package/dist/commands/cloud-demote.js +85 -12
- package/dist/commands/cloud-provision.d.ts +5 -1
- package/dist/commands/cloud-provision.js +6 -2
- package/dist/commands/cloud.d.ts +37 -1
- package/dist/commands/cloud.js +110 -27
- package/dist/commands/core-hq-session-native.js +3 -0
- package/dist/commands/core.js +1 -0
- package/dist/commands/daemon.js +4 -1
- package/dist/commands/dm.js +7 -0
- package/dist/commands/doctor-usage.d.ts +8 -0
- package/dist/commands/doctor-usage.js +20 -0
- package/dist/commands/doctor.js +7 -1
- package/dist/commands/env.d.ts +18 -0
- package/dist/commands/env.js +82 -0
- package/dist/commands/install-global.js +3 -3
- package/dist/commands/lanes.js +100 -24
- package/dist/commands/logout.d.ts +7 -0
- package/dist/commands/logout.js +41 -34
- package/dist/commands/members.js +1 -1
- package/dist/commands/pack-start-bot.d.ts +1 -1
- package/dist/commands/pack-start-bot.js +2 -2
- package/dist/commands/pkg-update.js +1 -1
- package/dist/commands/sources.d.ts +8 -2
- package/dist/commands/sources.js +65 -9
- package/dist/commands/sync-narrow.js +1 -1
- package/dist/commands/team-sync.js +1 -1
- package/dist/commands/whoami.js +26 -1
- package/dist/data/command-states.json +22 -0
- package/dist/index.js +52 -4
- package/dist/lazy-commands.js +2 -1
- package/dist/lib/anywhere-person-setting.d.ts +2 -0
- package/dist/lib/anywhere-person-setting.js +6 -3
- package/dist/lib/billing/usage-card.d.ts +25 -4
- package/dist/lib/billing/usage-card.js +76 -9
- package/dist/lib/billing/usage-cost.d.ts +3 -3
- package/dist/lib/billing/usage-cost.js +40 -15
- package/dist/lib/billing/usage-only.js +4 -2
- package/dist/lib/billing/usage-rate-card.d.ts +2 -2
- package/dist/lib/billing/usage-rate-card.js +3 -0
- package/dist/lib/bot/fleet-cron.js +93 -6
- package/dist/lib/bot/inflight.d.ts +9 -0
- package/dist/lib/bot/inflight.js +10 -0
- package/dist/lib/bot/jobs/hot-signal-sync.js +12 -1
- package/dist/lib/bot/pack-link.d.ts +2 -2
- package/dist/lib/bot/pack-link.js +2 -2
- package/dist/lib/bot/runtime/grok-acp.d.ts +1 -0
- package/dist/lib/bot/runtime/grok-acp.js +26 -11
- package/dist/lib/bot/runtime/grok.js +1 -1
- package/dist/lib/daemon/flag-monitor.d.ts +8 -0
- package/dist/lib/daemon/flag-monitor.js +17 -6
- package/dist/lib/daemon/flag.d.ts +65 -1
- package/dist/lib/daemon/flag.js +190 -40
- package/dist/lib/daemon/hook-env.d.ts +32 -0
- package/dist/lib/daemon/hook-env.js +51 -0
- package/dist/lib/daemon/ops/policy.js +67 -8
- package/dist/lib/daemon/paths.d.ts +72 -2
- package/dist/lib/daemon/paths.js +154 -3
- package/dist/lib/daemon/run.js +32 -21
- package/dist/lib/daemon/selfcheck.d.ts +22 -0
- package/dist/lib/daemon/selfcheck.js +40 -1
- package/dist/lib/daemon/server.d.ts +3 -1
- package/dist/lib/daemon/server.js +7 -22
- package/dist/lib/daemon/state-file-switch.d.ts +57 -0
- package/dist/lib/daemon/state-file-switch.js +88 -0
- package/dist/lib/daemon/state-file.d.ts +198 -0
- package/dist/lib/daemon/state-file.js +419 -0
- package/dist/lib/daemon/timed-flag-monitors.d.ts +47 -0
- package/dist/lib/daemon/timed-flag-monitors.js +75 -0
- package/dist/lib/doctor/checks/host-core.d.ts +52 -0
- package/dist/lib/doctor/checks/host-core.js +337 -0
- package/dist/lib/doctor/checks/replay-recorder.d.ts +39 -0
- package/dist/lib/doctor/checks/replay-recorder.js +261 -0
- package/dist/lib/doctor/checks/sync-runtime.js +3 -3
- package/dist/lib/doctor/registry.js +4 -0
- package/dist/lib/environment/credential-shapes.d.ts +61 -0
- package/dist/lib/environment/credential-shapes.js +333 -0
- package/dist/lib/environment/profile.d.ts +239 -0
- package/dist/lib/environment/profile.js +239 -0
- package/dist/lib/hook-engine/coverage.d.ts +13 -0
- package/dist/lib/hook-engine/coverage.js +124 -0
- package/dist/lib/hook-engine/reconcile.js +300 -94
- package/dist/lib/hook-engine/registration.d.ts +17 -1
- package/dist/lib/hook-engine/registration.js +62 -7
- package/dist/lib/hot-channels/adapters/slack.d.ts +21 -5
- package/dist/lib/hot-channels/adapters/slack.js +64 -21
- package/dist/lib/hot-channels/alert.d.ts +2 -0
- package/dist/lib/hot-channels/alert.js +8 -1
- package/dist/lib/hot-channels/contract.d.ts +12 -0
- package/dist/lib/hot-channels/contract.js +7 -0
- package/dist/lib/hot-channels/loop.js +1 -0
- package/dist/lib/hot-channels/run.d.ts +6 -0
- package/dist/lib/hot-channels/run.js +4 -0
- package/dist/lib/hot-channels/signals-pass.d.ts +64 -1
- package/dist/lib/hot-channels/signals-pass.js +21 -49
- package/dist/lib/install/claude-targets.d.ts +12 -1
- package/dist/lib/install/claude-targets.js +70 -5
- package/dist/lib/install/codex-pack-contributions.js +1 -1
- package/dist/lib/install/codex-targets.d.ts +2 -2
- package/dist/lib/install/codex-targets.js +48 -5
- package/dist/lib/install/hook-target.d.ts +4 -1
- package/dist/lib/install/hook-target.js +14 -1
- package/dist/lib/lanes/canonical-host.d.ts +35 -0
- package/dist/lib/lanes/canonical-host.js +65 -0
- package/dist/lib/lanes/host-capacity.d.ts +30 -0
- package/dist/lib/lanes/host-capacity.js +29 -3
- package/dist/lib/mesh/live/daemon/run.d.ts +2 -0
- package/dist/lib/mesh/live/daemon/run.js +5 -2
- package/dist/lib/mesh/live/flush.d.ts +5 -1
- package/dist/lib/mesh/live/flush.js +12 -6
- package/dist/lib/mesh/live/reporting-privacy.d.ts +32 -0
- package/dist/lib/mesh/live/reporting-privacy.js +56 -1
- package/dist/lib/mesh/live/spool.d.ts +7 -0
- package/dist/lib/mesh/live/spool.js +25 -0
- package/dist/lib/packages/setup-block.d.ts +2 -2
- package/dist/lib/packages/setup-block.js +2 -2
- package/dist/lib/packages/start-bot.d.ts +1 -1
- package/dist/lib/packages/start-bot.js +1 -1
- package/dist/lib/person-setting-cache.d.ts +38 -0
- package/dist/lib/person-setting-cache.js +98 -0
- package/dist/lib/safe-store.d.ts +245 -0
- package/dist/lib/safe-store.js +777 -0
- package/dist/lib/signals/engine.d.ts +29 -2
- package/dist/lib/signals/engine.js +103 -4
- package/dist/lib/signals/reply.js +73 -18
- package/dist/lib/signals/steps/adapters.js +7 -2
- package/dist/lib/signals/steps/extract.d.ts +13 -0
- package/dist/lib/signals/steps/extract.js +84 -4
- package/dist/main.js +47 -4
- package/dist/schemas/hq-environment-profile.v1.schema.json +438 -0
- package/dist/types.d.ts +1 -1
- package/dist/utils/auth-expiry.d.ts +8 -0
- package/dist/utils/auth-expiry.js +53 -0
- package/dist/utils/callback-port-busy.d.ts +1 -1
- package/dist/utils/callback-port-busy.js +4 -4
- package/dist/utils/cli-telemetry.d.ts +21 -0
- package/dist/utils/cli-telemetry.js +34 -0
- package/dist/utils/command-usage.d.ts +275 -0
- package/dist/utils/command-usage.js +797 -0
- package/dist/utils/hook-trust.d.ts +7 -0
- package/dist/utils/hook-trust.js +34 -4
- package/dist/utils/host-registration.d.ts +179 -0
- package/dist/utils/host-registration.js +505 -0
- package/dist/utils/resident-package-preload.js +2 -0
- package/package.json +10 -8
- package/scripts/bench-core.mjs +1096 -0
- 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
|
package/dist/utils/hook-trust.js
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|