@indigoai-us/hq-cli 5.345.215-beta.0 → 5.345.217
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 +206 -1
- package/README.md +45 -0
- package/assets/scaffold/core/scripts/hq-delegate-verify.sh +5 -2
- 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 +105 -10
- package/dist/command-catalog.generated.js +127 -10
- 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 +75 -10
- package/dist/commands/capacity.d.ts +4 -1
- package/dist/commands/capacity.js +46 -10
- 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 +36 -0
- package/dist/commands/cloud.js +110 -27
- package/dist/commands/core-delegate-w1b.js +15 -1
- package/dist/commands/core-policy.js +67 -8
- package/dist/commands/core.js +1 -0
- package/dist/commands/daemon.js +9 -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/files-browse.d.ts +11 -4
- package/dist/commands/files-browse.js +21 -4
- package/dist/commands/files.d.ts +1 -1
- package/dist/commands/files.js +25 -11
- package/dist/commands/install-global.js +2 -2
- package/dist/commands/integrations-auth-rules.d.ts +27 -0
- package/dist/commands/integrations-auth-rules.js +79 -0
- package/dist/commands/integrations-import.js +124 -12
- package/dist/commands/lanes.js +102 -26
- package/dist/commands/logout.d.ts +7 -0
- package/dist/commands/logout.js +41 -34
- package/dist/commands/mesh.d.ts +2 -0
- package/dist/commands/mesh.js +60 -35
- package/dist/commands/sources.d.ts +8 -2
- package/dist/commands/sources.js +65 -9
- package/dist/commands/sync-held.js +5 -2
- package/dist/commands/whoami.js +26 -1
- package/dist/data/command-states.json +15 -0
- package/dist/index.js +52 -4
- package/dist/lazy-commands.js +5 -6
- 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 +35 -13
- 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.d.ts +8 -0
- package/dist/lib/bot/fleet-cron.js +126 -7
- package/dist/lib/bot/fleet-daemon.d.ts +46 -0
- package/dist/lib/bot/fleet-daemon.js +99 -1
- 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/probe.js +7 -1
- package/dist/lib/bot/run.js +20 -1
- package/dist/lib/bot/runtime/codex.js +1 -1
- package/dist/lib/bot/runtime/grok-acp.d.ts +6 -1
- package/dist/lib/bot/runtime/grok-acp.js +32 -14
- package/dist/lib/bot/runtime/grok.js +1 -1
- package/dist/lib/bot/runtime/index.js +19 -9
- package/dist/lib/bot/runtime/messages-stream.js +2 -2
- package/dist/lib/bot/runtime/types.d.ts +15 -0
- package/dist/lib/bot/runtime/types.js +9 -0
- package/dist/lib/bot/runtime-failure.d.ts +23 -0
- package/dist/lib/bot/runtime-failure.js +43 -1
- package/dist/lib/capacity/accounts.d.ts +8 -0
- package/dist/lib/capacity/accounts.js +19 -0
- package/dist/lib/capacity/available.d.ts +154 -0
- package/dist/lib/capacity/available.js +905 -0
- package/dist/lib/capacity/codex-availability.d.ts +14 -1
- package/dist/lib/capacity/codex-availability.js +26 -1
- package/dist/lib/capacity/collectors/claude-oauth.d.ts +29 -2
- package/dist/lib/capacity/collectors/claude-oauth.js +104 -7
- package/dist/lib/capacity/collectors/codex.js +10 -7
- package/dist/lib/capacity/ledger.d.ts +37 -1
- package/dist/lib/capacity/ledger.js +207 -30
- package/dist/lib/capacity/project.d.ts +26 -0
- package/dist/lib/capacity/project.js +137 -8
- package/dist/lib/capacity/refusal-rows.d.ts +31 -0
- package/dist/lib/capacity/refusal-rows.js +61 -0
- package/dist/lib/capacity/refusal.d.ts +53 -2
- package/dist/lib/capacity/refusal.js +284 -65
- package/dist/lib/capacity/route.js +46 -11
- package/dist/lib/capacity/widget.d.ts +12 -1
- package/dist/lib/capacity/widget.js +91 -3
- 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/ops/policy.js +62 -5
- package/dist/lib/daemon/paths.d.ts +72 -2
- package/dist/lib/daemon/paths.js +154 -3
- package/dist/lib/daemon/resolver.d.ts +2 -0
- package/dist/lib/daemon/resolver.js +3 -0
- package/dist/lib/daemon/run.d.ts +9 -0
- package/dist/lib/daemon/run.js +79 -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 +5 -1
- package/dist/lib/daemon/server.js +17 -23
- 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/tcc-eperm.d.ts +153 -0
- package/dist/lib/daemon/tcc-eperm.js +310 -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/delivery/admission.d.ts +86 -0
- package/dist/lib/delivery/admission.js +148 -0
- package/dist/lib/delivery/artifacts.d.ts +7 -1
- package/dist/lib/delivery/artifacts.js +29 -10
- package/dist/lib/delivery/attempt-id.d.ts +13 -0
- package/dist/lib/delivery/attempt-id.js +16 -0
- package/dist/lib/delivery/disposable-target.d.ts +42 -0
- package/dist/lib/delivery/disposable-target.js +111 -0
- package/dist/lib/delivery/effects.d.ts +136 -0
- package/dist/lib/delivery/effects.js +541 -0
- package/dist/lib/delivery/enrollment.d.ts +21 -17
- package/dist/lib/delivery/enrollment.js +83 -5
- package/dist/lib/delivery/escalations.d.ts +51 -0
- package/dist/lib/delivery/escalations.js +60 -0
- package/dist/lib/delivery/lease.d.ts +80 -0
- package/dist/lib/delivery/lease.js +134 -0
- package/dist/lib/delivery/migrations.d.ts +120 -4
- package/dist/lib/delivery/migrations.js +215 -15
- package/dist/lib/delivery/mqtt.d.ts +2 -0
- package/dist/lib/delivery/mqtt.js +7 -0
- package/dist/lib/delivery/reconciler.d.ts +65 -1
- package/dist/lib/delivery/reconciler.js +224 -13
- package/dist/lib/delivery/rpc/client.d.ts +22 -0
- package/dist/lib/delivery/rpc/client.js +159 -0
- package/dist/lib/delivery/rpc/port.d.ts +40 -0
- package/dist/lib/delivery/rpc/port.js +16 -0
- package/dist/lib/delivery/rpc/server.d.ts +30 -0
- package/dist/lib/delivery/rpc/server.js +205 -0
- package/dist/lib/delivery/rpc/wire.d.ts +85 -0
- package/dist/lib/delivery/rpc/wire.js +143 -0
- package/dist/lib/delivery/store.d.ts +2 -0
- package/dist/lib/delivery/store.js +4 -0
- package/dist/lib/delivery/windows-service-install.d.ts +262 -0
- package/dist/lib/delivery/windows-service-install.js +892 -0
- package/dist/lib/delivery/workers/macos.d.ts +16 -1
- package/dist/lib/delivery/workers/macos.js +54 -12
- package/dist/lib/delivery/workers/windows-service-live.d.ts +121 -0
- package/dist/lib/delivery/workers/windows-service-live.js +711 -0
- package/dist/lib/delivery/workers/windows-service-runner.d.ts +33 -0
- package/dist/lib/delivery/workers/windows-service-runner.js +82 -0
- package/dist/lib/delivery/workers/windows-service.d.ts +140 -0
- package/dist/lib/delivery/workers/windows-service.js +584 -0
- package/dist/lib/delivery/workers/windows.d.ts +32 -22
- package/dist/lib/delivery/workers/windows.js +50 -64
- package/dist/lib/doctor/checks/host-core.d.ts +50 -0
- package/dist/lib/doctor/checks/host-core.js +269 -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/registry.js +4 -0
- package/dist/lib/environment/profile.d.ts +239 -0
- package/dist/lib/environment/profile.js +251 -0
- package/dist/lib/hook-engine/reconcile.js +39 -13
- package/dist/lib/hook-engine/registration.d.ts +9 -0
- package/dist/lib/hook-engine/registration.js +19 -0
- package/dist/lib/hot-channels/adapters/meetings.d.ts +15 -0
- package/dist/lib/hot-channels/adapters/meetings.js +36 -3
- 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 +74 -1
- package/dist/lib/hot-channels/signals-pass.js +82 -41
- package/dist/lib/hot-channels/signals-redo.js +10 -2
- package/dist/lib/install/claude-targets.d.ts +12 -1
- package/dist/lib/install/claude-targets.js +57 -5
- package/dist/lib/install/codex-targets.d.ts +2 -2
- package/dist/lib/install/codex-targets.js +36 -6
- package/dist/lib/install/hook-target.d.ts +3 -0
- package/dist/lib/install/hook-target.js +11 -0
- 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/lanes/watcher.js +35 -0
- 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/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 +122 -6
- package/dist/main.js +46 -3
- package/dist/schemas/hq-available-ai.v1.schema.json +76 -0
- package/dist/schemas/hq-environment-profile.v1.schema.json +438 -0
- package/dist/utils/auth-expiry.d.ts +8 -0
- package/dist/utils/auth-expiry.js +53 -0
- package/dist/utils/catalog-runtime-paths.d.ts +34 -0
- package/dist/utils/catalog-runtime-paths.js +53 -0
- 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/files-browse-acl.js +1 -1
- package/dist/utils/hook-trust.d.ts +7 -0
- package/dist/utils/hook-trust.js +31 -4
- package/dist/utils/host-registration.d.ts +126 -0
- package/dist/utils/host-registration.js +378 -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
- package/dist/lib/delivery/workers/windows-boundary.d.ts +0 -453
- package/dist/lib/delivery/workers/windows-boundary.js +0 -693
|
@@ -20,19 +20,48 @@
|
|
|
20
20
|
* (passed or failed) and appended once to the result log. Nothing in the
|
|
21
21
|
* store is deleted. Results hold environment keys only, never values.
|
|
22
22
|
*
|
|
23
|
-
* Containment on Windows is the
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
* windows-boundary.ts at runtime so it can be bundled without node_modules.
|
|
23
|
+
* Containment on Windows is the proposal 040 service host: the launcher in
|
|
24
|
+
* windows-service.ts submits to the runner over the spool and fails closed
|
|
25
|
+
* when the runner is not live. This module has no compile and no spawn path
|
|
26
|
+
* of its own, and imports only node built-ins at runtime.
|
|
28
27
|
*/
|
|
29
28
|
import { execFileSync } from "node:child_process";
|
|
30
29
|
import { createHash, randomBytes } from "node:crypto";
|
|
31
30
|
import { chmodSync, closeSync, existsSync, fsyncSync, mkdirSync, openSync, readFileSync, renameSync, writeFileSync, writeSync } from "node:fs";
|
|
32
31
|
import { isAbsolute, join } from "node:path";
|
|
33
|
-
import { evaluateBoundary } from "./windows-boundary.js";
|
|
34
32
|
export const EXECUTION_SPEC_VERSION = "hq-delivery.execution.v1";
|
|
35
33
|
export const WORKER_RESULT_VERSION = "hq-delivery.worker-result.v1";
|
|
34
|
+
/**
|
|
35
|
+
* Owner decision 2026-10-28 ("Mark Windows untrusted"). Why Windows results
|
|
36
|
+
* are untrusted, as advertised in the profile and the docs.
|
|
37
|
+
*/
|
|
38
|
+
export const WINDOWS_TRUST_NOTE = "Windows results are not trusted against a hostile job: under proposal 040 the job runs as the shared runner identity (the service's virtual account), so a job can write its own or another job's events and results. Workers are capped at standard trust and their results are never release-eligible. Closing this needs a separate job account (future work).";
|
|
39
|
+
/** The highest trust a Windows worker may hold. */
|
|
40
|
+
export const WINDOWS_MAX_TRUST = "standard";
|
|
41
|
+
function trustCapped(asked) {
|
|
42
|
+
return new WorkerRefusal("WINDOWS_TRUST_CAPPED", `a Windows worker may not hold ${asked} trust; it is capped at ${WINDOWS_MAX_TRUST} because jobs share the runner identity (shared runner identity). ${WINDOWS_TRUST_NOTE}`);
|
|
43
|
+
}
|
|
44
|
+
/** Issue an enrollment ticket for a Windows worker. Release trust is refused with WINDOWS_TRUST_CAPPED; nothing is issued. */
|
|
45
|
+
export function issueWindowsEnrollment(access, scope, request) {
|
|
46
|
+
if (request?.trust !== WINDOWS_MAX_TRUST)
|
|
47
|
+
throw trustCapped(String(request?.trust));
|
|
48
|
+
return access.issueEnrollment(scope, request);
|
|
49
|
+
}
|
|
50
|
+
/** Redeem a Windows enrollment. Release trust is refused with WINDOWS_TRUST_CAPPED, whatever the ticket allows. */
|
|
51
|
+
export function enrollWindowsWorker(access, input) {
|
|
52
|
+
if (input?.trust !== WINDOWS_MAX_TRUST)
|
|
53
|
+
throw trustCapped(String(input?.trust));
|
|
54
|
+
return access.enroll(input);
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* The promotion gate for Windows results. Every Windows result is untrusted,
|
|
58
|
+
* so this always refuses with WINDOWS_RESULT_UNTRUSTED. Merge point: US-008's
|
|
59
|
+
* shared release-eligibility check (assertJobTrust on the integration branch)
|
|
60
|
+
* should call this for Windows results; this base does not have it.
|
|
61
|
+
*/
|
|
62
|
+
export function assertReleaseEligible(result) {
|
|
63
|
+
throw new WorkerRefusal("WINDOWS_RESULT_UNTRUSTED", `result for job ${result.jobId} (${result.kind}) came from a Windows worker and is ${result.resultTrust ?? "untrusted"}; it cannot be promoted. ${WINDOWS_TRUST_NOTE}`);
|
|
64
|
+
}
|
|
36
65
|
/** What the native launcher contains. A job may require any of these. */
|
|
37
66
|
export const CONTAINMENT_CAPABILITIES = ["job-object-containment", "process-tree-kill", "memory-limit", "process-limit", "cpu-time-limit"];
|
|
38
67
|
export const KNOWN_CAPABILITIES = [...CONTAINMENT_CAPABILITIES, "posix-signals", "git"];
|
|
@@ -65,6 +94,8 @@ export function detectProfile() {
|
|
|
65
94
|
if (git)
|
|
66
95
|
capabilities.push("git");
|
|
67
96
|
cachedProfile = { platform, arch: process.arch, toolchains, capabilities };
|
|
97
|
+
if (platform === "windows")
|
|
98
|
+
cachedProfile.resultTrust = "untrusted";
|
|
68
99
|
return cachedProfile;
|
|
69
100
|
}
|
|
70
101
|
const COMPARATOR = /^(>=|<=|>|<|=|\^|~)?v?(\d+|[xX*])(?:\.(\d+|[xX*]))?(?:\.(\d+|[xX*]))?(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/;
|
|
@@ -392,64 +423,6 @@ export function helperOutcome(h) {
|
|
|
392
423
|
}
|
|
393
424
|
return { reason: "supervisor_lost", detail: `job helper exited ${h.code} without a result` };
|
|
394
425
|
}
|
|
395
|
-
function unavailable(detail, reason) {
|
|
396
|
-
return new WorkerRefusal("CONTAINMENT_UNAVAILABLE", `${detail}: ${reason}`);
|
|
397
|
-
}
|
|
398
|
-
/**
|
|
399
|
-
* The native Windows launcher (proposal 039). A job runs only through the
|
|
400
|
-
* boundary service: the probe must report all seven predicates as passing,
|
|
401
|
-
* fresh and for this installation, and the job goes to the service over the
|
|
402
|
-
* transport. There is no local compile and no same-user fallback; any missing
|
|
403
|
-
* piece is CONTAINMENT_UNAVAILABLE before the claim.
|
|
404
|
-
*/
|
|
405
|
-
export function nativeWindowsLauncher(opts = {}) {
|
|
406
|
-
const platform = opts.platform ?? process.platform;
|
|
407
|
-
// One launch per admission. A worker passes the run to launch; a caller that
|
|
408
|
-
// does not gets the most recent admission.
|
|
409
|
-
const admitted = new Map();
|
|
410
|
-
let latest;
|
|
411
|
-
const key = (run) => JSON.stringify([run.tenantId, run.runId, run.jobId]);
|
|
412
|
-
const check = (run) => {
|
|
413
|
-
if (platform !== "win32")
|
|
414
|
-
throw unavailable("BOUNDARY_SERVICE_UNAVAILABLE", `native Windows containment needs Windows; this host is ${platform}`);
|
|
415
|
-
if (!run)
|
|
416
|
-
throw unavailable("BOUNDARY_RUN_SETUP", "no admitted run");
|
|
417
|
-
const { probe, context, transport } = opts;
|
|
418
|
-
if (!probe || !context)
|
|
419
|
-
throw unavailable("BOUNDARY_SERVICE_UNAVAILABLE", "no boundary service is configured");
|
|
420
|
-
let results;
|
|
421
|
-
try {
|
|
422
|
-
results = probe.probe({ tenantId: run.tenantId, runId: run.runId, jobId: run.jobId });
|
|
423
|
-
}
|
|
424
|
-
catch (err) {
|
|
425
|
-
throw unavailable("BOUNDARY_SERVICE_UNAVAILABLE", `the boundary probe failed: ${err.message.split("\n")[0]}`);
|
|
426
|
-
}
|
|
427
|
-
const verdict = evaluateBoundary(results, context);
|
|
428
|
-
if (!verdict.ok)
|
|
429
|
-
throw unavailable(verdict.detail, verdict.reason);
|
|
430
|
-
if (!transport)
|
|
431
|
-
throw unavailable("BOUNDARY_CHANNEL_IDENTITY", "no authenticated service channel");
|
|
432
|
-
return { run, transport };
|
|
433
|
-
};
|
|
434
|
-
return {
|
|
435
|
-
prepare(run) {
|
|
436
|
-
latest = undefined;
|
|
437
|
-
const ok = check(run).run;
|
|
438
|
-
latest = key(ok);
|
|
439
|
-
admitted.set(latest, { tenantId: ok.tenantId, runId: ok.runId, jobId: ok.jobId });
|
|
440
|
-
},
|
|
441
|
-
launch(req, run) {
|
|
442
|
-
const k = run ? key(run) : latest;
|
|
443
|
-
const entry = k === undefined ? undefined : admitted.get(k);
|
|
444
|
-
if (k !== undefined)
|
|
445
|
-
admitted.delete(k);
|
|
446
|
-
if (k === latest)
|
|
447
|
-
latest = undefined;
|
|
448
|
-
const checked = check(entry);
|
|
449
|
-
return checked.transport.submit(req, checked.run);
|
|
450
|
-
},
|
|
451
|
-
};
|
|
452
|
-
}
|
|
453
426
|
/** A store error carries a string code; checked by shape so no runtime import is needed. */
|
|
454
427
|
function storeCode(err) {
|
|
455
428
|
const code = err?.code;
|
|
@@ -482,6 +455,8 @@ export class WindowsWorker {
|
|
|
482
455
|
startedAt: null,
|
|
483
456
|
finishedAt: this.now(),
|
|
484
457
|
...fields,
|
|
458
|
+
resultTrust: "untrusted",
|
|
459
|
+
releaseEligible: false,
|
|
485
460
|
};
|
|
486
461
|
}
|
|
487
462
|
refuse(spec, code, detail) {
|
|
@@ -517,6 +492,17 @@ export class WindowsWorker {
|
|
|
517
492
|
const invalid = validateSpec(spec);
|
|
518
493
|
if (invalid)
|
|
519
494
|
return this.refuse(spec, "INVALID_SPEC", invalid);
|
|
495
|
+
// Owner decision 2026-10-28: a Windows worker never runs with release trust.
|
|
496
|
+
try {
|
|
497
|
+
const trust = this.opts.access.workerTrust(this.opts.identity);
|
|
498
|
+
if (trust !== WINDOWS_MAX_TRUST) {
|
|
499
|
+
const e = trustCapped(trust);
|
|
500
|
+
return this.refuse(spec, e.code, e.detail);
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
catch (err) {
|
|
504
|
+
return this.refuse(spec, storeCode(err) ?? "UNKNOWN_JOB", message(err));
|
|
505
|
+
}
|
|
520
506
|
try {
|
|
521
507
|
const { run, jobs } = this.opts.access.readRun(this.opts.identity, spec.runId);
|
|
522
508
|
if (run.tenantId !== spec.tenantId)
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { type EngineCapabilities } from '../../../utils/host-registration.js';
|
|
2
|
+
import type { CheckContext, CheckResult, FamilyRun } from '../types.js';
|
|
3
|
+
import { type DoctorRegistry } from '../registry.js';
|
|
4
|
+
export declare const HOST_CORE_FAMILY_ID = "host-core";
|
|
5
|
+
export declare const HOST_CORE_FAMILY_TITLE = "Hook core per host";
|
|
6
|
+
export type CoreKind = 'new-core' | 'launcher' | 'old-dispatcher';
|
|
7
|
+
export interface HostRegistrationFile {
|
|
8
|
+
host: 'claude' | 'codex' | 'grok';
|
|
9
|
+
scope: 'project' | 'user';
|
|
10
|
+
file: string;
|
|
11
|
+
}
|
|
12
|
+
export interface HostCoreOptions {
|
|
13
|
+
home?: string;
|
|
14
|
+
env?: NodeJS.ProcessEnv;
|
|
15
|
+
platform?: NodeJS.Platform;
|
|
16
|
+
/** Reads an engine's capabilities; `probeEngine` by default. */
|
|
17
|
+
probe?: (engine: string) => EngineCapabilities;
|
|
18
|
+
}
|
|
19
|
+
/** The registration files `hq reindex` reconciles, per host. */
|
|
20
|
+
export declare function hostRegistrationFiles(root: string, home: string, env: NodeJS.ProcessEnv): HostRegistrationFile[];
|
|
21
|
+
/** Which core one HQ hook entry calls, or null when the entry is not HQ's. */
|
|
22
|
+
export declare function classifyEntry(entry: Record<string, unknown>, host: HostRegistrationFile['host'], root: string): CoreKind | null;
|
|
23
|
+
type Status = 'PASS' | 'WARN' | 'FAIL';
|
|
24
|
+
/** Which core one event of one registration file uses, and why. */
|
|
25
|
+
export interface EventCore {
|
|
26
|
+
event: string;
|
|
27
|
+
core: CoreKind;
|
|
28
|
+
status: Status;
|
|
29
|
+
reason: string;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* One result per registration file, with each event's core and the reason
|
|
33
|
+
* for it. An event registered to the new core passes only when its engine
|
|
34
|
+
* runs and has every evaluator the event needs; a missing or dangling engine
|
|
35
|
+
* link, an engine that does not run, or a missing evaluator is FAIL with the
|
|
36
|
+
* fix. With the flag on, an event left on the old dispatcher says why.
|
|
37
|
+
*/
|
|
38
|
+
export declare function hostCoreResults(root: string, options?: HostCoreOptions): CheckResult[];
|
|
39
|
+
/** Flag and kill-switch state, shown once. */
|
|
40
|
+
export declare function coreSwitchResult(options?: HostCoreOptions): CheckResult;
|
|
41
|
+
/** The family `hq doctor` prints. */
|
|
42
|
+
export declare function hostCoreFamily(context: CheckContext, options?: HostCoreOptions): Promise<FamilyRun>;
|
|
43
|
+
/**
|
|
44
|
+
* The one call `hq doctor` makes on a run without `--only`: when the hook
|
|
45
|
+
* wiring family ran, add this family right after it. Registries without it
|
|
46
|
+
* (tests that register their own families) are left as they are.
|
|
47
|
+
*/
|
|
48
|
+
export declare function addHostCoreFamily(families: FamilyRun[], registry: Pick<DoctorRegistry, 'has'>, context: CheckContext, options?: HostCoreOptions): Promise<void>;
|
|
49
|
+
export {};
|
|
50
|
+
//# sourceMappingURL=host-core.d.ts.map
|
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
/**
|
|
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
|
|
5
|
+
* new core, or the flag is on, it starts the engine once (`--version` and
|
|
6
|
+
* `capabilities --json`) to see which evaluators it has. An event registered
|
|
7
|
+
* to a new core that is missing, does not run, or lacks the event's guards is
|
|
8
|
+
* FAIL; a host with no HQ registration is NA.
|
|
9
|
+
*/
|
|
10
|
+
import * as fs from 'node:fs';
|
|
11
|
+
import * as os from 'node:os';
|
|
12
|
+
import * as path from 'node:path';
|
|
13
|
+
import { jsonFormat } from '../../../commands/mcp-registration.js';
|
|
14
|
+
import { CORE_NEXT_LINK, isCoreNextEntry, isNativeEntry } from '../../hook-engine/registration.js';
|
|
15
|
+
import { isAdapterEntry } from '../../install/codex-targets.js';
|
|
16
|
+
import { masterHookPath, shimPath } from '../../install/claude-targets.js';
|
|
17
|
+
import { CORE_NEXT_FLAG, CORE_NEXT_KILL_ENV, CORE_NEXT_KILL_FILE, ENGINE_KILL_ENV, ENGINE_KILL_FILE, REQUIRED_EVALUATORS, STABLE_LINK_NAME, coreNextEnabled, missingEvaluators, probeEngine, } from '../../../utils/host-registration.js';
|
|
18
|
+
import { HOOKS_FAMILY_ID } from '../registry.js';
|
|
19
|
+
export const HOST_CORE_FAMILY_ID = 'host-core';
|
|
20
|
+
export const HOST_CORE_FAMILY_TITLE = 'Hook core per host';
|
|
21
|
+
/** The registration files `hq reindex` reconciles, per host. */
|
|
22
|
+
export function hostRegistrationFiles(root, home, env) {
|
|
23
|
+
return [
|
|
24
|
+
{ host: 'claude', scope: 'project', file: path.join(root, '.claude', 'settings.json') },
|
|
25
|
+
{ host: 'claude', scope: 'user', file: path.join(env.CLAUDE_CONFIG_DIR || path.join(home, '.claude'), 'settings.json') },
|
|
26
|
+
{ host: 'codex', scope: 'project', file: path.join(root, '.codex', 'hooks.json') },
|
|
27
|
+
{ host: 'codex', scope: 'user', file: path.join(env.CODEX_HOME || path.join(home, '.codex'), 'hooks.json') },
|
|
28
|
+
{ host: 'grok', scope: 'user', file: path.join(home, '.grok', 'hooks', 'hq-hq-bridge.json') },
|
|
29
|
+
];
|
|
30
|
+
}
|
|
31
|
+
function hookEntries(doc) {
|
|
32
|
+
const hooks = doc?.hooks;
|
|
33
|
+
if (!hooks || typeof hooks !== 'object' || Array.isArray(hooks))
|
|
34
|
+
return [];
|
|
35
|
+
return Object.values(hooks).flatMap((groups) => Array.isArray(groups)
|
|
36
|
+
? groups.flatMap((g) => Array.isArray(g?.hooks) ? g.hooks.filter((h) => !!h && typeof h === 'object') : [])
|
|
37
|
+
: []);
|
|
38
|
+
}
|
|
39
|
+
/** Which core one HQ hook entry calls, or null when the entry is not HQ's. */
|
|
40
|
+
export function classifyEntry(entry, host, root) {
|
|
41
|
+
if (isCoreNextEntry(entry, root))
|
|
42
|
+
return 'new-core';
|
|
43
|
+
if (isNativeEntry(entry, root))
|
|
44
|
+
return 'launcher';
|
|
45
|
+
const command = entry.command;
|
|
46
|
+
if (typeof command !== 'string')
|
|
47
|
+
return null;
|
|
48
|
+
// A stable-path entry for another HQ root still calls the new core.
|
|
49
|
+
if (CORE_NEXT_LINK.test(command))
|
|
50
|
+
return 'new-core';
|
|
51
|
+
if (host === 'grok')
|
|
52
|
+
return command.includes('hq-hq-bridge.sh') ? 'old-dispatcher' : null;
|
|
53
|
+
if (host === 'codex') {
|
|
54
|
+
if (isAdapterEntry(entry, root))
|
|
55
|
+
return 'old-dispatcher';
|
|
56
|
+
return command.includes('hq-codex-hook-adapter.sh') ? 'old-dispatcher' : null;
|
|
57
|
+
}
|
|
58
|
+
return command.includes('master-hook.sh') || command.includes(masterHookPath(root)) || command.includes(shimPath(root)) ? 'old-dispatcher' : null;
|
|
59
|
+
}
|
|
60
|
+
const OLD_DISPATCHER = {
|
|
61
|
+
claude: 'old dispatcher (master-hook.sh)',
|
|
62
|
+
codex: 'old dispatcher (Codex hook adapter)',
|
|
63
|
+
grok: 'old dispatcher (Grok bash bridge)',
|
|
64
|
+
};
|
|
65
|
+
function label(kind, host) {
|
|
66
|
+
if (kind === 'new-core')
|
|
67
|
+
return 'new core (hq-hook run)';
|
|
68
|
+
if (kind === 'launcher')
|
|
69
|
+
return 'old dispatcher through the pinned hq-hook launcher';
|
|
70
|
+
return OLD_DISPATCHER[host];
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* The engine path a new-core entry runs: the command itself in exec form, or
|
|
74
|
+
* the first single-quoted word of a command string (POSIX or PowerShell form).
|
|
75
|
+
*/
|
|
76
|
+
function enginePathOf(entries, host, root) {
|
|
77
|
+
const entry = entries.find((e) => classifyEntry(e, host, root) === 'new-core');
|
|
78
|
+
const command = entry?.command;
|
|
79
|
+
if (typeof command !== 'string')
|
|
80
|
+
return undefined;
|
|
81
|
+
if (Array.isArray(entry.args))
|
|
82
|
+
return command;
|
|
83
|
+
const quoted = command.match(/^(?:& )?'((?:[^']|'\\'')*)'/)?.[1];
|
|
84
|
+
return quoted?.replace(/'\\''/g, "'");
|
|
85
|
+
}
|
|
86
|
+
const RANK = { PASS: 0, WARN: 1, FAIL: 2 };
|
|
87
|
+
/** The stable engine path for this platform (what a new-core registration names). */
|
|
88
|
+
function defaultStableEngine(home, platform) {
|
|
89
|
+
const binary = platform === 'darwin' ? path.join('hq-hook.app', 'Contents', 'MacOS', 'hq-hook') : 'hq-hook';
|
|
90
|
+
return path.join(home, '.hq', 'bin', 'hq-hook', STABLE_LINK_NAME, binary);
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* One result per registration file, with each event's core and the reason
|
|
94
|
+
* for it. An event registered to the new core passes only when its engine
|
|
95
|
+
* runs and has every evaluator the event needs; a missing or dangling engine
|
|
96
|
+
* link, an engine that does not run, or a missing evaluator is FAIL with the
|
|
97
|
+
* fix. With the flag on, an event left on the old dispatcher says why.
|
|
98
|
+
*/
|
|
99
|
+
export function hostCoreResults(root, options = {}) {
|
|
100
|
+
const env = options.env ?? process.env;
|
|
101
|
+
const home = options.home ?? env.HOME ?? os.homedir();
|
|
102
|
+
const platform = options.platform ?? process.platform;
|
|
103
|
+
const probe = options.probe ?? probeEngine;
|
|
104
|
+
const flagOn = coreNextEnabled(env);
|
|
105
|
+
const probed = new Map();
|
|
106
|
+
const capabilities = (engine) => {
|
|
107
|
+
let found = probed.get(engine);
|
|
108
|
+
if (!found) {
|
|
109
|
+
try {
|
|
110
|
+
found = probe(engine);
|
|
111
|
+
}
|
|
112
|
+
catch (error) {
|
|
113
|
+
found = error;
|
|
114
|
+
}
|
|
115
|
+
probed.set(engine, found);
|
|
116
|
+
}
|
|
117
|
+
return found;
|
|
118
|
+
};
|
|
119
|
+
const newCore = (event, engine) => {
|
|
120
|
+
if (!engine)
|
|
121
|
+
return { status: 'FAIL', reason: 'the registration names no engine path' };
|
|
122
|
+
try {
|
|
123
|
+
fs.realpathSync(engine);
|
|
124
|
+
}
|
|
125
|
+
catch {
|
|
126
|
+
return { status: 'FAIL', reason: `${engine} does not resolve (missing or dangling ${STABLE_LINK_NAME} link), so this event has no hook running` };
|
|
127
|
+
}
|
|
128
|
+
const caps = capabilities(engine);
|
|
129
|
+
if (caps instanceof Error)
|
|
130
|
+
return { status: 'FAIL', reason: `the engine does not run (${caps.message})` };
|
|
131
|
+
const missing = missingEvaluators(caps, event);
|
|
132
|
+
if (missing === null)
|
|
133
|
+
return { status: 'FAIL', reason: 'no new-core port of the old hooks for this event' };
|
|
134
|
+
if (missing.length > 0)
|
|
135
|
+
return { status: 'FAIL', reason: `the new core lacks ${missing.join(', ')}` };
|
|
136
|
+
return { status: 'PASS', reason: `the new core has ${REQUIRED_EVALUATORS[event].join(', ')}` };
|
|
137
|
+
};
|
|
138
|
+
const oldCore = (event) => {
|
|
139
|
+
if (!flagOn)
|
|
140
|
+
return { status: 'PASS', reason: `flag ${CORE_NEXT_FLAG} is off` };
|
|
141
|
+
if (platform === 'win32')
|
|
142
|
+
return { status: 'PASS', reason: 'Windows keeps the old registration until US-022' };
|
|
143
|
+
if (!REQUIRED_EVALUATORS[event])
|
|
144
|
+
return { status: 'PASS', reason: 'no new-core port of the old hooks for this event yet' };
|
|
145
|
+
const caps = capabilities(defaultStableEngine(home, platform));
|
|
146
|
+
if (caps instanceof Error)
|
|
147
|
+
return { status: 'PASS', reason: `the new core is not available (${caps.message})` };
|
|
148
|
+
const missing = missingEvaluators(caps, event);
|
|
149
|
+
if (missing.length > 0)
|
|
150
|
+
return { status: 'PASS', reason: `the new core lacks ${missing.join(', ')}` };
|
|
151
|
+
return { status: 'WARN', reason: 'the new core can take this event; run hq reindex to switch it' };
|
|
152
|
+
};
|
|
153
|
+
const results = [];
|
|
154
|
+
for (const target of hostRegistrationFiles(root, home, env)) {
|
|
155
|
+
const checkId = `host-core:${target.host}-${target.scope}`;
|
|
156
|
+
let text;
|
|
157
|
+
try {
|
|
158
|
+
text = fs.readFileSync(target.file, 'utf8');
|
|
159
|
+
}
|
|
160
|
+
catch {
|
|
161
|
+
results.push({ status: 'NA', checkId, target: target.file, message: `${target.host} (${target.scope}): no registration file` });
|
|
162
|
+
continue;
|
|
163
|
+
}
|
|
164
|
+
let doc;
|
|
165
|
+
try {
|
|
166
|
+
doc = jsonFormat.parse(text);
|
|
167
|
+
}
|
|
168
|
+
catch {
|
|
169
|
+
results.push({ status: 'WARN', checkId, target: target.file, message: `${target.host} (${target.scope}): registration file is not valid JSON` });
|
|
170
|
+
continue;
|
|
171
|
+
}
|
|
172
|
+
const events = [];
|
|
173
|
+
const mixed = [];
|
|
174
|
+
for (const [event, entries] of eventEntries(doc)) {
|
|
175
|
+
const kinds = [...new Set(entries.map((entry) => classifyEntry(entry, target.host, root)).filter((k) => k !== null))];
|
|
176
|
+
if (kinds.length === 0)
|
|
177
|
+
continue;
|
|
178
|
+
if (kinds.length > 1) {
|
|
179
|
+
mixed.push(event);
|
|
180
|
+
events.push({ event, core: kinds.includes('new-core') ? 'new-core' : kinds[0], status: 'WARN', reason: `two HQ registrations: ${kinds.map((k) => label(k, target.host)).join(', ')}` });
|
|
181
|
+
continue;
|
|
182
|
+
}
|
|
183
|
+
const core = kinds[0];
|
|
184
|
+
events.push({ event, core, ...(core === 'new-core' ? newCore(event, enginePathOf(entries, target.host, root)) : oldCore(event)) });
|
|
185
|
+
}
|
|
186
|
+
if (events.length === 0) {
|
|
187
|
+
results.push({ status: 'NA', checkId, target: target.file, message: `${target.host} (${target.scope}): no HQ hook registered` });
|
|
188
|
+
continue;
|
|
189
|
+
}
|
|
190
|
+
const status = events.reduce((worst, e) => (RANK[e.status] > RANK[worst] ? e.status : worst), 'PASS');
|
|
191
|
+
// Events grouped by core and reason, in file order: "<core> for A, B (reason)".
|
|
192
|
+
const groups = new Map();
|
|
193
|
+
for (const e of events) {
|
|
194
|
+
const key = `${label(e.core, target.host)}\u0000${e.reason}`;
|
|
195
|
+
groups.set(key, [...(groups.get(key) ?? []), e.event]);
|
|
196
|
+
}
|
|
197
|
+
const summary = [...groups].map(([key, names]) => {
|
|
198
|
+
const [label, reason] = key.split('\u0000');
|
|
199
|
+
return `${label} for ${names.join(', ')} (${reason})`;
|
|
200
|
+
}).join('; ');
|
|
201
|
+
const cores = [...new Set(events.map((e) => e.core))];
|
|
202
|
+
const failed = events.filter((e) => e.status === 'FAIL').map((e) => e.event);
|
|
203
|
+
results.push({
|
|
204
|
+
status,
|
|
205
|
+
checkId,
|
|
206
|
+
target: target.file,
|
|
207
|
+
message: `${target.host} (${target.scope}): ${summary}`,
|
|
208
|
+
details: { ...(cores.length === 1 ? { core: cores[0] } : {}), cores, events },
|
|
209
|
+
...(failed.length > 0
|
|
210
|
+
? { 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. Until then those events run no HQ hook, or a new core without their guards.` }
|
|
211
|
+
: mixed.length > 0
|
|
212
|
+
? { remediation: 'Run hq reindex to leave one HQ registration per event.' }
|
|
213
|
+
: {}),
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
return results;
|
|
217
|
+
}
|
|
218
|
+
/** HQ-relevant entries per event, in file order. */
|
|
219
|
+
function eventEntries(doc) {
|
|
220
|
+
const hooks = doc?.hooks;
|
|
221
|
+
if (!hooks || typeof hooks !== 'object' || Array.isArray(hooks))
|
|
222
|
+
return [];
|
|
223
|
+
return Object.entries(hooks).map(([event, groups]) => [event, hookEntries({ hooks: { [event]: groups } })]);
|
|
224
|
+
}
|
|
225
|
+
/** Flag and kill-switch state, shown once. */
|
|
226
|
+
export function coreSwitchResult(options = {}) {
|
|
227
|
+
const env = options.env ?? process.env;
|
|
228
|
+
const home = options.home ?? env.HOME ?? os.homedir();
|
|
229
|
+
const on = coreNextEnabled(env);
|
|
230
|
+
const killedBy = [
|
|
231
|
+
/^(off|0|false|no)$/i.test((env[CORE_NEXT_KILL_ENV] ?? '').trim()) ? `${CORE_NEXT_KILL_ENV}=${env[CORE_NEXT_KILL_ENV]}` : '',
|
|
232
|
+
/^off$/i.test((env[ENGINE_KILL_ENV] ?? '').trim()) ? `${ENGINE_KILL_ENV}=${env[ENGINE_KILL_ENV]}` : '',
|
|
233
|
+
exists(path.join(home, CORE_NEXT_KILL_FILE)) ? path.join(home, CORE_NEXT_KILL_FILE) : '',
|
|
234
|
+
exists(path.join(home, ENGINE_KILL_FILE)) ? path.join(home, ENGINE_KILL_FILE) : '',
|
|
235
|
+
].filter(Boolean);
|
|
236
|
+
const flag = `flag ${CORE_NEXT_FLAG} is ${on ? 'on' : 'off'}`;
|
|
237
|
+
const kill = killedBy.length
|
|
238
|
+
? `; kill switch on (${killedBy.join(', ')}): new-core registrations hand each event to the old dispatcher`
|
|
239
|
+
: '';
|
|
240
|
+
return { status: 'PASS', checkId: 'host-core:switch', message: `${flag}${kill}`, details: { flag: on, killSwitch: killedBy } };
|
|
241
|
+
}
|
|
242
|
+
function exists(file) {
|
|
243
|
+
try {
|
|
244
|
+
fs.lstatSync(file);
|
|
245
|
+
return true;
|
|
246
|
+
}
|
|
247
|
+
catch {
|
|
248
|
+
return false;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
/** The family `hq doctor` prints. */
|
|
252
|
+
export async function hostCoreFamily(context, options = {}) {
|
|
253
|
+
return {
|
|
254
|
+
family: { id: HOST_CORE_FAMILY_ID, title: HOST_CORE_FAMILY_TITLE },
|
|
255
|
+
results: [coreSwitchResult(options), ...hostCoreResults(context.hqRoot, options)],
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* The one call `hq doctor` makes on a run without `--only`: when the hook
|
|
260
|
+
* wiring family ran, add this family right after it. Registries without it
|
|
261
|
+
* (tests that register their own families) are left as they are.
|
|
262
|
+
*/
|
|
263
|
+
export async function addHostCoreFamily(families, registry, context, options = {}) {
|
|
264
|
+
if (!registry.has(HOOKS_FAMILY_ID))
|
|
265
|
+
return;
|
|
266
|
+
const hooks = families.findIndex((run) => run.family.id === HOOKS_FAMILY_ID);
|
|
267
|
+
families.splice(hooks + 1, 0, await hostCoreFamily(context, options));
|
|
268
|
+
}
|
|
269
|
+
//# sourceMappingURL=host-core.js.map
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Replay recorder: is it on, and how much does it hold?
|
|
3
|
+
*
|
|
4
|
+
* The recorder (`hq-hook record`, crates/hq-hook/src/recorder.rs) appends
|
|
5
|
+
* redacted hook events to `~/.hq/replay-recorder/` when the flag
|
|
6
|
+
* `core.replay-recorder` is on for the person or machine. It is off by default.
|
|
7
|
+
* This check reads the same three inputs the recorder reads (the kill switch
|
|
8
|
+
* variable, the kill switch file and the cached person flag snapshot) and the
|
|
9
|
+
* size of the store. It starts no process and makes no network call.
|
|
10
|
+
*/
|
|
11
|
+
import type { CheckFamily, CheckResult } from "../types.js";
|
|
12
|
+
export declare const REPLAY_RECORDER_FLAG = "core.replay-recorder";
|
|
13
|
+
export declare const REPLAY_RECORDER_KILL_ENV = "HQ_REPLAY_RECORDER";
|
|
14
|
+
export declare const REPLAY_RECORDER_MAX_BYTES_ENV = "HQ_REPLAY_RECORDER_MAX_BYTES";
|
|
15
|
+
export interface ReplayRecorderProbe {
|
|
16
|
+
env?: NodeJS.ProcessEnv;
|
|
17
|
+
/** Home directory. Default: `os.homedir()`. */
|
|
18
|
+
home?: string;
|
|
19
|
+
/** Clock in epoch milliseconds. Default: `Date.now()`. */
|
|
20
|
+
now?: number;
|
|
21
|
+
/** Temporary folder that holds the permission-fallback snapshot. Default: `os.tmpdir()`. */
|
|
22
|
+
tmpdir?: string;
|
|
23
|
+
/** Operating system. Default: `process.platform`. */
|
|
24
|
+
platform?: NodeJS.Platform;
|
|
25
|
+
}
|
|
26
|
+
export type ReplayRecorderOffReason = "kill-switch-env" | "kill-switch-file" | "flag-off" | "store-inside-repo" | "store-not-private" | "off-on-windows";
|
|
27
|
+
/** `HQ_REPLAY_RECORDER` values that turn recording off, in any case. Mirrors `recorder::KILL_SWITCH_VALUES`. */
|
|
28
|
+
export declare const REPLAY_RECORDER_KILL_VALUES: readonly string[];
|
|
29
|
+
export interface ReplayRecorderStore {
|
|
30
|
+
segments: number;
|
|
31
|
+
bytes: number;
|
|
32
|
+
}
|
|
33
|
+
/** Why the recorder is off, or `null` when it is recording. Mirrors `recorder::gate`. */
|
|
34
|
+
export declare function replayRecorderOffReason(probe?: ReplayRecorderProbe): ReplayRecorderOffReason | null;
|
|
35
|
+
/** Segment count and total size of the store. An absent store holds nothing. */
|
|
36
|
+
export declare function readReplayRecorderStore(home?: string): ReplayRecorderStore;
|
|
37
|
+
export declare function checkReplayRecorder(probe?: ReplayRecorderProbe): CheckResult;
|
|
38
|
+
export declare const replayRecorderFamily: CheckFamily;
|
|
39
|
+
//# sourceMappingURL=replay-recorder.d.ts.map
|