@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
|
@@ -0,0 +1,261 @@
|
|
|
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 * as fs from "node:fs";
|
|
12
|
+
import * as os from "node:os";
|
|
13
|
+
import * as path from "node:path";
|
|
14
|
+
import { FLAG_SNAPSHOT_MAX_AGE_MS } from "../../flag-snapshot-file.js";
|
|
15
|
+
export const REPLAY_RECORDER_FLAG = "core.replay-recorder";
|
|
16
|
+
export const REPLAY_RECORDER_KILL_ENV = "HQ_REPLAY_RECORDER";
|
|
17
|
+
export const REPLAY_RECORDER_MAX_BYTES_ENV = "HQ_REPLAY_RECORDER_MAX_BYTES";
|
|
18
|
+
const CHECK_ID = "replay-recorder.state";
|
|
19
|
+
const STORE_DISPLAY = "~/.hq/replay-recorder";
|
|
20
|
+
const DEFAULT_MAX_BYTES = 64 * 1024 * 1024;
|
|
21
|
+
const MIN_MAX_BYTES = 8 * 1024;
|
|
22
|
+
const MAX_MAX_BYTES = 1024 * 1024 * 1024;
|
|
23
|
+
/** `HQ_REPLAY_RECORDER` values that turn recording off, in any case. Mirrors `recorder::KILL_SWITCH_VALUES`. */
|
|
24
|
+
export const REPLAY_RECORDER_KILL_VALUES = ["off", "0", "false", "no", "disabled"];
|
|
25
|
+
function storeDir(home) {
|
|
26
|
+
return path.join(home, ".hq", "replay-recorder");
|
|
27
|
+
}
|
|
28
|
+
/** One snapshot file, when it is for the person scope and fresh. */
|
|
29
|
+
function readPersonSnapshot(file, now) {
|
|
30
|
+
let parsed;
|
|
31
|
+
try {
|
|
32
|
+
parsed = JSON.parse(fs.readFileSync(file, "utf8"));
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed))
|
|
38
|
+
return null;
|
|
39
|
+
const value = parsed;
|
|
40
|
+
if (Object.keys(value).sort().join(",") !== "fetched_at,flags,scope" || value.scope !== "person")
|
|
41
|
+
return null;
|
|
42
|
+
if (typeof value.fetched_at !== "string")
|
|
43
|
+
return null;
|
|
44
|
+
const fetchedAt = Date.parse(value.fetched_at);
|
|
45
|
+
const age = now - fetchedAt;
|
|
46
|
+
if (!Number.isFinite(age) || age < 0 || age > FLAG_SNAPSHOT_MAX_AGE_MS)
|
|
47
|
+
return null;
|
|
48
|
+
const flags = value.flags;
|
|
49
|
+
if (!flags || typeof flags !== "object" || Array.isArray(flags))
|
|
50
|
+
return null;
|
|
51
|
+
return { fetchedAt, flags: flags };
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* The snapshot the CLI writes in its private temporary folder when it cannot
|
|
55
|
+
* write the cache folder (`fallbackPersonSnapshotPath` in
|
|
56
|
+
* `flag-snapshot-file.ts`). Only a folder chain this user owns and nobody else
|
|
57
|
+
* can enter is read.
|
|
58
|
+
*/
|
|
59
|
+
function fallbackPersonSnapshotFile(tmpdir) {
|
|
60
|
+
if (typeof process.getuid !== "function")
|
|
61
|
+
return null;
|
|
62
|
+
const uid = process.getuid();
|
|
63
|
+
const root = path.join(tmpdir, `hq-cli-flag-snapshots-${uid}`);
|
|
64
|
+
const directories = [root, path.join(root, "hq"), path.join(root, "hq", "flags")];
|
|
65
|
+
for (const directory of directories) {
|
|
66
|
+
try {
|
|
67
|
+
const stat = fs.lstatSync(directory);
|
|
68
|
+
if (!stat.isDirectory() || stat.isSymbolicLink() || stat.uid !== uid)
|
|
69
|
+
return null;
|
|
70
|
+
if ((stat.mode & 0o077) !== 0)
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
catch {
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return path.join(root, "hq", "flags", "snapshot-person.json");
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Same rule as `flags::person_flag_enabled` in the engine: the newer valid one
|
|
81
|
+
* of the cache snapshot and the permission-fallback snapshot decides, and the
|
|
82
|
+
* flag is on only as the boolean `true`. Equal timestamps keep the cache file.
|
|
83
|
+
*/
|
|
84
|
+
function personFlagOn(home, env, now, tmpdir) {
|
|
85
|
+
const cacheHome = env.XDG_CACHE_HOME || path.join(home, ".cache");
|
|
86
|
+
const primary = readPersonSnapshot(path.join(cacheHome, "hq", "flags", "snapshot-person.json"), now);
|
|
87
|
+
const fallbackFile = fallbackPersonSnapshotFile(tmpdir);
|
|
88
|
+
const fallback = fallbackFile ? readPersonSnapshot(fallbackFile, now) : null;
|
|
89
|
+
const chosen = primary && fallback ? (fallback.fetchedAt > primary.fetchedAt ? fallback : primary) : (primary ?? fallback);
|
|
90
|
+
return chosen?.flags[REPLAY_RECORDER_FLAG] === true;
|
|
91
|
+
}
|
|
92
|
+
function hasRepoOrHqMarkerAbove(directory) {
|
|
93
|
+
let current = directory;
|
|
94
|
+
for (;;) {
|
|
95
|
+
if (fs.existsSync(path.join(current, ".git")))
|
|
96
|
+
return true;
|
|
97
|
+
try {
|
|
98
|
+
if (fs.statSync(path.join(current, "core", "core.yaml")).isFile())
|
|
99
|
+
return true;
|
|
100
|
+
}
|
|
101
|
+
catch {
|
|
102
|
+
// No HQ root marker at this level.
|
|
103
|
+
}
|
|
104
|
+
const parent = path.dirname(current);
|
|
105
|
+
if (parent === current)
|
|
106
|
+
return false;
|
|
107
|
+
current = parent;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* The store path as written, and where it really is: a symlinked parent
|
|
112
|
+
* (`~/.hq` pointing into a checkout) hides the checkout from a walk over the
|
|
113
|
+
* written path, so the nearest ancestor that exists is resolved and walked too.
|
|
114
|
+
*/
|
|
115
|
+
function insideRepoOrHqTree(directory) {
|
|
116
|
+
if (hasRepoOrHqMarkerAbove(directory))
|
|
117
|
+
return true;
|
|
118
|
+
let current = path.dirname(directory);
|
|
119
|
+
for (;;) {
|
|
120
|
+
try {
|
|
121
|
+
return hasRepoOrHqMarkerAbove(fs.realpathSync(current));
|
|
122
|
+
}
|
|
123
|
+
catch {
|
|
124
|
+
// This ancestor does not exist yet; try the one above it.
|
|
125
|
+
}
|
|
126
|
+
const parent = path.dirname(current);
|
|
127
|
+
if (parent === current)
|
|
128
|
+
return false;
|
|
129
|
+
current = parent;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
/** Why the recorder is off, or `null` when it is recording. Mirrors `recorder::gate`. */
|
|
133
|
+
export function replayRecorderOffReason(probe = {}) {
|
|
134
|
+
const env = probe.env ?? process.env;
|
|
135
|
+
const home = probe.home ?? os.homedir();
|
|
136
|
+
if (REPLAY_RECORDER_KILL_VALUES.includes((env[REPLAY_RECORDER_KILL_ENV] ?? "").trim().toLowerCase())) {
|
|
137
|
+
return "kill-switch-env";
|
|
138
|
+
}
|
|
139
|
+
// The recorder records only on Unix until US-022, whatever the flag says.
|
|
140
|
+
if ((probe.platform ?? process.platform) === "win32")
|
|
141
|
+
return "off-on-windows";
|
|
142
|
+
if (fs.existsSync(path.join(home, ".hq", "replay-recorder.off")))
|
|
143
|
+
return "kill-switch-file";
|
|
144
|
+
if (!personFlagOn(home, env, probe.now ?? Date.now(), probe.tmpdir ?? os.tmpdir()))
|
|
145
|
+
return "flag-off";
|
|
146
|
+
if (insideRepoOrHqTree(storeDir(home)))
|
|
147
|
+
return "store-inside-repo";
|
|
148
|
+
if (storeDirNotPrivate(storeDir(home)))
|
|
149
|
+
return "store-not-private";
|
|
150
|
+
return null;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* An existing store folder owned by another user, or one group or others can
|
|
154
|
+
* write to. The recorder refuses it and leaves its permissions as they are.
|
|
155
|
+
* Unix only, as in the recorder.
|
|
156
|
+
*/
|
|
157
|
+
function storeDirNotPrivate(store) {
|
|
158
|
+
if (typeof process.getuid !== "function")
|
|
159
|
+
return false;
|
|
160
|
+
let stat;
|
|
161
|
+
try {
|
|
162
|
+
stat = fs.lstatSync(store);
|
|
163
|
+
}
|
|
164
|
+
catch {
|
|
165
|
+
return false;
|
|
166
|
+
}
|
|
167
|
+
return stat.isDirectory() && (stat.uid !== process.getuid() || (stat.mode & 0o022) !== 0);
|
|
168
|
+
}
|
|
169
|
+
/** Segment count and total size of the store. An absent store holds nothing. */
|
|
170
|
+
export function readReplayRecorderStore(home = os.homedir()) {
|
|
171
|
+
const store = { segments: 0, bytes: 0 };
|
|
172
|
+
let names;
|
|
173
|
+
try {
|
|
174
|
+
names = fs.readdirSync(storeDir(home));
|
|
175
|
+
}
|
|
176
|
+
catch {
|
|
177
|
+
return store;
|
|
178
|
+
}
|
|
179
|
+
for (const name of names) {
|
|
180
|
+
if (!/^segment-\d+\.jsonl$/.test(name))
|
|
181
|
+
continue;
|
|
182
|
+
try {
|
|
183
|
+
const stat = fs.statSync(path.join(storeDir(home), name));
|
|
184
|
+
if (!stat.isFile())
|
|
185
|
+
continue;
|
|
186
|
+
store.segments += 1;
|
|
187
|
+
store.bytes += stat.size;
|
|
188
|
+
}
|
|
189
|
+
catch {
|
|
190
|
+
// A segment removed by a rotation while this check ran.
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
return store;
|
|
194
|
+
}
|
|
195
|
+
function capBytes(env) {
|
|
196
|
+
const raw = (env[REPLAY_RECORDER_MAX_BYTES_ENV] ?? "").trim();
|
|
197
|
+
if (!/^\d+$/.test(raw))
|
|
198
|
+
return DEFAULT_MAX_BYTES;
|
|
199
|
+
return Math.min(MAX_MAX_BYTES, Math.max(MIN_MAX_BYTES, Number(raw)));
|
|
200
|
+
}
|
|
201
|
+
function megabytes(bytes) {
|
|
202
|
+
return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
|
|
203
|
+
}
|
|
204
|
+
const OFF_TEXT = {
|
|
205
|
+
"kill-switch-env": `${REPLAY_RECORDER_KILL_ENV} is set to turn it off`,
|
|
206
|
+
"kill-switch-file": "~/.hq/replay-recorder.off exists",
|
|
207
|
+
"flag-off": `flag ${REPLAY_RECORDER_FLAG} is not on for this person or machine`,
|
|
208
|
+
"store-inside-repo": "the home directory, or the folder ~/.hq links to, is inside a git checkout or an HQ tree",
|
|
209
|
+
"store-not-private": `${STORE_DISPLAY} is owned by another user or writable by group or others`,
|
|
210
|
+
"off-on-windows": "off on Windows until US-022",
|
|
211
|
+
};
|
|
212
|
+
export function checkReplayRecorder(probe = {}) {
|
|
213
|
+
const env = probe.env ?? process.env;
|
|
214
|
+
const home = probe.home ?? os.homedir();
|
|
215
|
+
const reason = replayRecorderOffReason({ ...probe, env, home });
|
|
216
|
+
const store = readReplayRecorderStore(home);
|
|
217
|
+
const cap = capBytes(env);
|
|
218
|
+
const holds = store.segments === 0
|
|
219
|
+
? "It holds nothing."
|
|
220
|
+
: `It holds ${store.segments} segment${store.segments === 1 ? "" : "s"}, ${megabytes(store.bytes)} of a ${megabytes(cap)} cap.`;
|
|
221
|
+
const details = {
|
|
222
|
+
enabled: reason === null,
|
|
223
|
+
reason: reason ?? "on",
|
|
224
|
+
segments: store.segments,
|
|
225
|
+
bytes: store.bytes,
|
|
226
|
+
capBytes: cap,
|
|
227
|
+
};
|
|
228
|
+
if (reason === null) {
|
|
229
|
+
return {
|
|
230
|
+
checkId: CHECK_ID,
|
|
231
|
+
status: "WARN",
|
|
232
|
+
target: STORE_DISPLAY,
|
|
233
|
+
message: `Replay recorder is on: hook events on this machine are redacted and recorded to ${STORE_DISPLAY}. ${holds}`,
|
|
234
|
+
details,
|
|
235
|
+
remediation: `To stop recording, set ${REPLAY_RECORDER_KILL_ENV}=off or create ~/.hq/replay-recorder.off. Delete ${STORE_DISPLAY} to remove what it holds.`,
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
if (store.segments > 0) {
|
|
239
|
+
return {
|
|
240
|
+
checkId: CHECK_ID,
|
|
241
|
+
status: "WARN",
|
|
242
|
+
target: STORE_DISPLAY,
|
|
243
|
+
message: `Replay recorder is off (${OFF_TEXT[reason]}), but an earlier recording is still on disk. ${holds}`,
|
|
244
|
+
details,
|
|
245
|
+
remediation: `Delete ${STORE_DISPLAY} when the recording is no longer needed.`,
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
return {
|
|
249
|
+
checkId: CHECK_ID,
|
|
250
|
+
status: "PASS",
|
|
251
|
+
target: STORE_DISPLAY,
|
|
252
|
+
message: `Replay recorder is off (${OFF_TEXT[reason]}). ${holds}`,
|
|
253
|
+
details,
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
export const replayRecorderFamily = {
|
|
257
|
+
id: "replay-recorder",
|
|
258
|
+
title: "Replay recorder",
|
|
259
|
+
run: async () => [checkReplayRecorder()],
|
|
260
|
+
};
|
|
261
|
+
//# sourceMappingURL=replay-recorder.js.map
|
|
@@ -85,13 +85,13 @@ function receiverPermissionRemediation(byCall) {
|
|
|
85
85
|
const parts = [];
|
|
86
86
|
if (queueLeg) {
|
|
87
87
|
parts.push("The queue credentials vended by POST /v1/sync/subscribe were refused on the per-device queue leg; " +
|
|
88
|
-
"restart the sync runner so it re-subscribes, then run `hq sync status`. If it repeats, the device roster entry for this machine needs attention (hq-pro device slots).");
|
|
88
|
+
"restart the sync runner so it re-subscribes, then run `hq daemon sync status`. If it repeats, the device roster entry for this machine needs attention (hq-pro device slots).");
|
|
89
89
|
}
|
|
90
90
|
if (pullLeg) {
|
|
91
91
|
parts.push("The object pull after a change event was refused; see sync.runtime.pull-access-denied for the refused keys and the grant to compare.");
|
|
92
92
|
}
|
|
93
93
|
if (parts.length === 0) {
|
|
94
|
-
parts.push("Run `hq sync status` and inspect the selected sync log under ~/.hq/logs/, ~/.hq/daemon/logs/, or the configured HQ_DAEMON_DIR/logs/.");
|
|
94
|
+
parts.push("Run `hq daemon sync status` and inspect the selected sync log under ~/.hq/logs/, ~/.hq/daemon/logs/, or the configured HQ_DAEMON_DIR/logs/.");
|
|
95
95
|
}
|
|
96
96
|
return parts.join(" ");
|
|
97
97
|
}
|
|
@@ -313,7 +313,7 @@ export function analyzeSyncRuntimeLog(lines, options) {
|
|
|
313
313
|
message: check.message ?? `${check.count} ${check.label} in the last hour.`,
|
|
314
314
|
...(check.details ? { details: check.details } : {}),
|
|
315
315
|
remediation: check.remediation ??
|
|
316
|
-
"Run `hq sync status` and inspect the selected sync log under ~/.hq/logs/, ~/.hq/daemon/logs/, or the configured HQ_DAEMON_DIR/logs/.",
|
|
316
|
+
"Run `hq daemon sync status` and inspect the selected sync log under ~/.hq/logs/, ~/.hq/daemon/logs/, or the configured HQ_DAEMON_DIR/logs/.",
|
|
317
317
|
}
|
|
318
318
|
: {
|
|
319
319
|
status: "PASS",
|
|
@@ -32,6 +32,7 @@ import { releaseLinksFamily } from "./checks/release-links.js";
|
|
|
32
32
|
import { cliPathFamily } from "./checks/cli-path.js";
|
|
33
33
|
import { ps1ShimsFamily } from "./checks/ps1-shims.js";
|
|
34
34
|
import { tempHomesFamily } from "./checks/temp-homes.js";
|
|
35
|
+
import { replayRecorderFamily } from "./checks/replay-recorder.js";
|
|
35
36
|
import { fixtureCoverageFamily } from "./fixtures/discover.js";
|
|
36
37
|
import { checkClaudeWiring } from "./checks/claude-wiring.js";
|
|
37
38
|
/**
|
|
@@ -289,6 +290,9 @@ export function createDefaultRegistry() {
|
|
|
289
290
|
// Idle tmp.* throwaway homes holding a Rust toolchain download. Dry-run
|
|
290
291
|
// scan only; `hq doctor --sweep-temp-homes` is the delete path.
|
|
291
292
|
registry.register(tempHomesFamily);
|
|
293
|
+
// Replay recorder (flag core.replay-recorder, off by default): whether hook
|
|
294
|
+
// events are being recorded on this machine and how much the store holds.
|
|
295
|
+
registry.register(replayRecorderFamily);
|
|
292
296
|
return registry;
|
|
293
297
|
}
|
|
294
298
|
//# sourceMappingURL=registry.js.map
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Credential shapes in environment profile text.
|
|
3
|
+
*
|
|
4
|
+
* What counts as a credential is decided by SECRET_PATTERNS in
|
|
5
|
+
* src/lib/core-utils/secret-patterns.ts, the list `hq core secret-scan` uses.
|
|
6
|
+
* This module does not keep a second set of shapes. It applies the shared
|
|
7
|
+
* expressions, unchanged, to bounded windows of the text, so that:
|
|
8
|
+
*
|
|
9
|
+
* - the result for a string is the result the shared list gives for it
|
|
10
|
+
* (`sharedShapesIn`, checked against `matchingSecretPatterns` in
|
|
11
|
+
* credential-equivalence.test.ts), and
|
|
12
|
+
* - the time is linear in the length of the string. Applied to one long
|
|
13
|
+
* string as a whole, the JWT expression restarts at every candidate and
|
|
14
|
+
* rescans to the end, which took 29 s for a 320 KB note.
|
|
15
|
+
*
|
|
16
|
+
* Windows.
|
|
17
|
+
*
|
|
18
|
+
* - Every expression except JWT is run on consecutive chunks of CHUNK
|
|
19
|
+
* characters that overlap by OVERLAP. A match of any of those expressions
|
|
20
|
+
* has a shortest form of at most 41 characters from its start (a prefix
|
|
21
|
+
* and a minimum count), so every match start lies in a chunk that holds
|
|
22
|
+
* that shortest form. The cost of one chunk is bounded by its size.
|
|
23
|
+
* - A JWT match is three dot-separated runs of [A-Za-z0-9_-]. Only the
|
|
24
|
+
* minimum counts (20, 20, 10) matter to the expression, so a long run can
|
|
25
|
+
* be cut after 64 characters without changing the answer. Each window is
|
|
26
|
+
* one piece of a first segment (at most 320 characters), the first 64
|
|
27
|
+
* characters of the next segment and the first 64 of the one after.
|
|
28
|
+
*
|
|
29
|
+
* Exemptions. Profile text is sentences, hostnames and labels, and a match
|
|
30
|
+
* rejects the profile. Three exemptions accept ordinary text that matches the
|
|
31
|
+
* shared list: a Slack prefix named in a sentence, a host name that starts
|
|
32
|
+
* with the key prefix letters, and an Authorization header followed by a
|
|
33
|
+
* secret's NAME. Each fails closed: it reads the whole white-space-delimited
|
|
34
|
+
* token and accepts only a closed form. Nothing else the shared list rejects
|
|
35
|
+
* is accepted here, and some ordinary text is rejected as the price of that.
|
|
36
|
+
*
|
|
37
|
+
* There is no exemption for a private key header. Any string that holds a
|
|
38
|
+
* BEGIN ... PRIVATE KEY line is rejected, as on main, with or without key
|
|
39
|
+
* material after it, because the body can sit in another string of the same
|
|
40
|
+
* profile. To mention a key in a profile, name its type in words.
|
|
41
|
+
*
|
|
42
|
+
* One rule is added to the shared list: a URL with an inline password.
|
|
43
|
+
*/
|
|
44
|
+
import { SECRET_PATTERNS } from "../core-utils/secret-patterns.js";
|
|
45
|
+
type SharedShapeName = (typeof SECRET_PATTERNS)[number]["name"];
|
|
46
|
+
declare const URL_PASSWORD = "URL with an inline password";
|
|
47
|
+
export type CredentialShapeName = SharedShapeName | typeof URL_PASSWORD;
|
|
48
|
+
export declare const CREDENTIAL_SHAPE_NAMES: CredentialShapeName[];
|
|
49
|
+
/**
|
|
50
|
+
* The shared shape names that match `text`, in the shared list's order: the
|
|
51
|
+
* same answer as `matchingSecretPatterns(text)`, computed on bounded windows.
|
|
52
|
+
*/
|
|
53
|
+
export declare function sharedShapesIn(text: string): SharedShapeName[];
|
|
54
|
+
/**
|
|
55
|
+
* The credential shapes present in `text` for the profile loader: the shared
|
|
56
|
+
* shapes, less the six ordinary-text exemptions, plus a URL with an inline
|
|
57
|
+
* password. Returns names, never the matched text.
|
|
58
|
+
*/
|
|
59
|
+
export declare function credentialShapesIn(text: string): CredentialShapeName[];
|
|
60
|
+
export {};
|
|
61
|
+
//# sourceMappingURL=credential-shapes.d.ts.map
|