@indigoai-us/hq-cli 5.345.219 → 5.345.221
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 +170 -0
- package/dist/command-catalog.generated.d.ts +169 -3
- package/dist/command-catalog.generated.js +206 -3
- package/dist/commands/auth.js +4 -1
- package/dist/commands/bot-runtime.d.ts +18 -5
- package/dist/commands/bot-runtime.js +29 -12
- package/dist/commands/bot.d.ts +85 -0
- package/dist/commands/bot.js +245 -16
- package/dist/commands/cloud.d.ts +16 -0
- package/dist/commands/cloud.js +112 -102
- package/dist/commands/core-checkpoint-native.d.ts +13 -0
- package/dist/commands/core-checkpoint-native.js +167 -52
- package/dist/commands/core-hook-registration-plan.js +5 -4
- package/dist/commands/core-stop-autosave.d.ts +21 -0
- package/dist/commands/core-stop-autosave.js +300 -0
- package/dist/commands/core.js +2 -0
- package/dist/commands/daemon.d.ts +5 -0
- package/dist/commands/daemon.js +52 -9
- package/dist/commands/doctor-usage.d.ts +5 -0
- package/dist/commands/doctor-usage.js +25 -0
- package/dist/commands/env.d.ts +49 -4
- package/dist/commands/env.js +355 -5
- package/dist/commands/integrations.js +84 -3
- package/dist/commands/lanes-shared.d.ts +3 -0
- package/dist/commands/lanes.d.ts +3 -0
- package/dist/commands/lanes.js +87 -3
- package/dist/commands/packs.js +23 -0
- package/dist/commands/pkg-update.d.ts +6 -0
- package/dist/commands/pkg-update.js +15 -7
- package/dist/commands/run.js +55 -45
- package/dist/commands/sources.js +4 -3
- package/dist/commands/sync-core.d.ts +1 -0
- package/dist/commands/sync-core.js +77 -3
- package/dist/commands/whoami.js +96 -80
- package/dist/lib/bot/config.d.ts +17 -0
- package/dist/lib/bot/config.js +13 -0
- package/dist/lib/bot/fleet-cron.js +29 -4
- package/dist/lib/bot/fleet-local.d.ts +30 -2
- package/dist/lib/bot/fleet-local.js +60 -1
- package/dist/lib/bot/grok-login-scope.d.ts +36 -0
- package/dist/lib/bot/grok-login-scope.js +93 -0
- package/dist/lib/bot/inflight.d.ts +9 -0
- package/dist/lib/bot/jobs/hot-signal-sync.d.ts +51 -0
- package/dist/lib/bot/jobs/hot-signal-sync.js +90 -9
- package/dist/lib/bot/legacy-provider-login.d.ts +32 -9
- package/dist/lib/bot/legacy-provider-login.js +28 -22
- package/dist/lib/bot/run.d.ts +29 -5
- package/dist/lib/bot/run.js +203 -1
- package/dist/lib/bot/runtime-sign-in-check.js +6 -1
- package/dist/lib/bot/runtime-sign-in.d.ts +2 -0
- package/dist/lib/bot/signals-try-now.d.ts +76 -0
- package/dist/lib/bot/signals-try-now.js +111 -0
- package/dist/lib/capacity/collectors/claude-oauth.d.ts +22 -3
- package/dist/lib/capacity/collectors/claude-oauth.js +78 -22
- package/dist/lib/capacity/scheduler.d.ts +8 -0
- package/dist/lib/capacity/scheduler.js +5 -2
- package/dist/lib/core-utils/sentry-report.js +2 -0
- package/dist/lib/daemon/machine-checks.d.ts +22 -1
- package/dist/lib/daemon/machine-checks.js +54 -12
- package/dist/lib/daemon/run.js +71 -8
- package/dist/lib/daemon/runtime-notifications.d.ts +7 -0
- package/dist/lib/daemon/runtime-notifications.js +50 -0
- package/dist/lib/daemon/stop-autosave-lock.d.ts +19 -0
- package/dist/lib/daemon/stop-autosave-lock.js +166 -0
- package/dist/lib/daemon/stop-autosave.d.ts +28 -0
- package/dist/lib/daemon/stop-autosave.js +111 -0
- package/dist/lib/daemon/stop-diagnostics.d.ts +11 -0
- package/dist/lib/daemon/stop-diagnostics.js +136 -0
- package/dist/lib/daemon/stop-job-executor.d.ts +19 -0
- package/dist/lib/daemon/stop-job-executor.js +126 -0
- package/dist/lib/daemon/stop-jobs.d.ts +93 -0
- package/dist/lib/daemon/stop-jobs.js +599 -0
- package/dist/lib/doctor/checks/fleet-hook-core.d.ts +9 -1
- package/dist/lib/doctor/checks/fleet-hook-core.js +39 -15
- package/dist/lib/doctor/checks/host-core.js +1 -1
- package/dist/lib/environment/access-probes.d.ts +234 -0
- package/dist/lib/environment/access-probes.js +918 -0
- package/dist/lib/environment/profile.d.ts +15 -2
- package/dist/lib/environment/profile.js +55 -20
- package/dist/lib/environment/rfc3339.d.ts +8 -0
- package/dist/lib/environment/rfc3339.js +26 -0
- package/dist/lib/environment/work-requirements.d.ts +169 -0
- package/dist/lib/environment/work-requirements.js +389 -0
- package/dist/lib/hook-engine/coverage.d.ts +137 -7
- package/dist/lib/hook-engine/coverage.js +1424 -4
- package/dist/lib/hook-engine/fleet-registration.d.ts +17 -5
- package/dist/lib/hook-engine/fleet-registration.js +53 -17
- package/dist/lib/hook-engine/git-stop-config.json +513 -0
- package/dist/lib/hook-engine/native-stop-compatibility.json +311 -0
- package/dist/lib/hook-engine/reconcile.js +2 -2
- package/dist/lib/hot-channels/alert.d.ts +10 -1
- package/dist/lib/hot-channels/alert.js +38 -8
- package/dist/lib/hot-channels/signals-claude-login.d.ts +53 -0
- package/dist/lib/hot-channels/signals-claude-login.js +96 -0
- package/dist/lib/hot-channels/signals-pass.d.ts +143 -17
- package/dist/lib/hot-channels/signals-pass.js +324 -17
- package/dist/lib/hot-channels/signals-runtime.d.ts +30 -0
- package/dist/lib/hot-channels/signals-runtime.js +82 -0
- package/dist/lib/install/hook-target.js +1 -1
- package/dist/lib/lanes/host-capacity.d.ts +26 -2
- package/dist/lib/lanes/host-capacity.js +17 -2
- package/dist/lib/lanes/host-compute.d.ts +90 -0
- package/dist/lib/lanes/host-compute.js +185 -0
- package/dist/lib/lanes/index.d.ts +2 -0
- package/dist/lib/lanes/index.js +1 -0
- package/dist/lib/lanes/reconcile.js +22 -1
- package/dist/lib/lanes/resource-usage.d.ts +155 -0
- package/dist/lib/lanes/resource-usage.js +589 -0
- package/dist/lib/lanes/run-size.d.ts +46 -0
- package/dist/lib/lanes/run-size.js +197 -0
- package/dist/lib/lanes/store.js +27 -0
- package/dist/lib/lanes/throttle.d.ts +36 -1
- package/dist/lib/lanes/throttle.js +47 -10
- package/dist/lib/lanes/types.d.ts +40 -0
- package/dist/lib/lanes/types.js +2 -2
- package/dist/lib/lanes/watcher.js +13 -4
- package/dist/lib/lanes/worker-process.d.ts +25 -2
- package/dist/lib/lanes/worker-process.js +71 -19
- package/dist/lib/placement/match.d.ts +192 -0
- package/dist/lib/placement/match.js +667 -0
- package/dist/lib/safe-store.d.ts +14 -0
- package/dist/lib/safe-store.js +77 -4
- package/dist/lib/search-index/index.d.ts +88 -4
- package/dist/lib/search-index/index.js +299 -25
- package/dist/lib/search-index/max-doc-bytes.d.ts +17 -6
- package/dist/lib/search-index/max-doc-bytes.js +48 -23
- package/dist/lib/signals/codex-lockdown.d.ts +79 -0
- package/dist/lib/signals/codex-lockdown.js +271 -0
- package/dist/lib/signals/codex-login.d.ts +37 -0
- package/dist/lib/signals/codex-login.js +83 -0
- package/dist/lib/signals/engine.d.ts +28 -0
- package/dist/lib/signals/engine.js +77 -0
- package/dist/lib/signals/reply.d.ts +48 -0
- package/dist/lib/signals/reply.js +94 -12
- package/dist/lib/signals/run-record.js +6 -1
- package/dist/lib/signals/settings.d.ts +5 -0
- package/dist/lib/signals/settings.js +2 -0
- package/dist/lib/signals/steps/adapters.js +6 -0
- package/dist/lib/signals/steps/extract.d.ts +135 -12
- package/dist/lib/signals/steps/extract.js +416 -84
- package/dist/lib/signals/steps/types.d.ts +21 -0
- package/dist/lib/sync-core/engine-home.d.ts +41 -2
- package/dist/lib/sync-core/engine-home.js +132 -19
- package/dist/lib/sync-core/reconcile.js +1 -1
- package/dist/lib/sync-core/release-compare.d.ts +7 -0
- package/dist/lib/sync-core/release-compare.js +16 -0
- package/dist/lib/sync-core/release.d.ts +2 -1
- package/dist/lib/sync-core/release.js +2 -10
- package/dist/lib/sync-core/rollout-state.d.ts +2 -1
- package/dist/lib/sync-core/rollout-state.js +5 -2
- package/dist/lib/sync-core/vault-uid.d.ts +2 -0
- package/dist/lib/sync-core/vault-uid.js +4 -0
- package/dist/run/schema-env-overrides.d.ts +24 -0
- package/dist/run/schema-env-overrides.js +72 -0
- package/dist/schemas/hq-work-requirements.v1.schema.json +145 -0
- package/dist/utils/auth-session-check.d.ts +16 -0
- package/dist/utils/auth-session-check.js +16 -0
- package/dist/utils/client-health-contract.d.ts +6 -0
- package/dist/utils/client-health-contract.js +13 -0
- package/dist/utils/client-health.d.ts +7 -0
- package/dist/utils/client-health.js +22 -1
- package/dist/utils/command-usage.d.ts +40 -0
- package/dist/utils/command-usage.js +61 -0
- package/dist/utils/duplicate-command-usage.d.ts +72 -0
- package/dist/utils/duplicate-command-usage.js +125 -0
- package/dist/utils/host-registration.d.ts +1 -1
- package/dist/utils/host-registration.js +6 -1
- package/dist/utils/resident-package-preload.js +4 -0
- package/dist/utils/sentry-fingerprint.js +9 -0
- package/dist/utils/windows-bash.d.ts +2 -0
- package/dist/utils/windows-bash.js +2 -1
- package/package.json +15 -10
- package/scripts/bench-core-compare.mjs +313 -0
- package/scripts/bench-core.mjs +399 -12
- package/scripts/check-function-manifest.mjs +121 -7
- package/dist/commands/__fixtures__/access-vault.d.ts +0 -95
- package/dist/commands/__fixtures__/access-vault.js +0 -166
- package/dist/commands/__fixtures__/make-tar.d.ts +0 -38
- package/dist/commands/__fixtures__/make-tar.js +0 -102
- package/dist/commands/secrets-public-types.test-d.d.ts +0 -2
- package/dist/commands/secrets-public-types.test-d.js +0 -18
- package/dist/lib/decisions/fixtures/us001.d.ts +0 -137
- package/dist/lib/decisions/fixtures/us001.js +0 -21
- package/dist/lib/doctor/__testing__/fake-hq-tree.d.ts +0 -226
- package/dist/lib/doctor/__testing__/fake-hq-tree.js +0 -408
- package/dist/lib/doctor/__testing__/run-doctor.d.ts +0 -8
- package/dist/lib/doctor/__testing__/run-doctor.js +0 -69
- package/dist/lib/fingerprint/fixtures.d.ts +0 -19
- package/dist/lib/fingerprint/fixtures.js +0 -61
- package/dist/lib/hot-channels/adapters/__fixtures__/dummy.d.ts +0 -33
- package/dist/lib/hot-channels/adapters/__fixtures__/dummy.js +0 -53
- package/dist/lib/hot-channels/adapters/__fixtures__/meeting-providers.d.ts +0 -38
- package/dist/lib/hot-channels/adapters/__fixtures__/meeting-providers.js +0 -64
- package/dist/lib/mesh/live/daemon/mqtt-events.test-d.d.ts +0 -2
- package/dist/lib/mesh/live/daemon/mqtt-events.test-d.js +0 -10
- package/dist/lib/test-utils/isolated-flag-company-context.d.ts +0 -3
- package/dist/lib/test-utils/isolated-flag-company-context.js +0 -18
- package/scripts/hook-engine-manifest.mjs +0 -22
- package/scripts/mesh-daemon-if-stale.mjs +0 -20
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { CognitoTokenSource } from "./cognito-session.js";
|
|
2
|
+
/**
|
|
3
|
+
* The exit status `hq auth status` gives for a session state, shared with
|
|
4
|
+
* `hq whoami --check` so the two cannot drift (hq-core-rust US-041).
|
|
5
|
+
*
|
|
6
|
+
* - Machine source: 0, cached session or not; machine creds mint one on demand.
|
|
7
|
+
* - Person source: 0 when a session is cached (valid or expiring), 1 when none
|
|
8
|
+
* is cached (signed out, or the cache file is missing or unreadable).
|
|
9
|
+
*
|
|
10
|
+
* Reads only whether a cache exists; never a token.
|
|
11
|
+
*/
|
|
12
|
+
export declare function authStatusExitCode(state: {
|
|
13
|
+
tokenSource: CognitoTokenSource;
|
|
14
|
+
cached: unknown;
|
|
15
|
+
}): 0 | 1;
|
|
16
|
+
//# sourceMappingURL=auth-session-check.d.ts.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The exit status `hq auth status` gives for a session state, shared with
|
|
3
|
+
* `hq whoami --check` so the two cannot drift (hq-core-rust US-041).
|
|
4
|
+
*
|
|
5
|
+
* - Machine source: 0, cached session or not; machine creds mint one on demand.
|
|
6
|
+
* - Person source: 0 when a session is cached (valid or expiring), 1 when none
|
|
7
|
+
* is cached (signed out, or the cache file is missing or unreadable).
|
|
8
|
+
*
|
|
9
|
+
* Reads only whether a cache exists; never a token.
|
|
10
|
+
*/
|
|
11
|
+
export function authStatusExitCode(state) {
|
|
12
|
+
if (state.tokenSource === "machine")
|
|
13
|
+
return 0;
|
|
14
|
+
return state.cached ? 0 : 1;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=auth-session-check.js.map
|
|
@@ -57,6 +57,9 @@ export type ClientHealthUpdaterState = (typeof CLIENT_HEALTH_UPDATER_STATES)[num
|
|
|
57
57
|
export declare const CLIENT_HEALTH_SYNC_RUNNER_SOURCES: readonly ["npx", "daemon_managed", "daemon_staged", "daemon_bundled", "unknown"];
|
|
58
58
|
export type ClientHealthSyncRunnerSource = (typeof CLIENT_HEALTH_SYNC_RUNNER_SOURCES)[number];
|
|
59
59
|
export declare const CLIENT_HEALTH_DAEMON_HQ_CLOUD_UPDATE_OUTCOMES: readonly ["updated", "up_to_date", "pinned", "failed"];
|
|
60
|
+
export declare const CLIENT_HEALTH_SYNC_ENGINES: readonly ["hq-syncd"];
|
|
61
|
+
export type ClientHealthSyncEngine = (typeof CLIENT_HEALTH_SYNC_ENGINES)[number];
|
|
62
|
+
export declare const CLIENT_HEALTH_MAX_SYNC_ENGINE_VAULTS = 10000;
|
|
60
63
|
export type ClientHealthDaemonHqCloudUpdateOutcome = (typeof CLIENT_HEALTH_DAEMON_HQ_CLOUD_UPDATE_OUTCOMES)[number];
|
|
61
64
|
export declare const CLIENT_HEALTH_DAEMON_HQ_CLOUD_UPDATE_ERROR_CLASSES: readonly ["registry", "install", "convergence", "filesystem", "unknown"];
|
|
62
65
|
export type ClientHealthDaemonHqCloudUpdateErrorClass = (typeof CLIENT_HEALTH_DAEMON_HQ_CLOUD_UPDATE_ERROR_CLASSES)[number];
|
|
@@ -96,6 +99,7 @@ export interface ClientHealthVersions {
|
|
|
96
99
|
cli?: string;
|
|
97
100
|
core?: string;
|
|
98
101
|
syncRunner?: string;
|
|
102
|
+
syncEngine?: string;
|
|
99
103
|
}
|
|
100
104
|
/**
|
|
101
105
|
* Closed, bounded-fact summary of the user's local log/journal FILES —
|
|
@@ -147,6 +151,8 @@ export interface ClientHealthHeartbeat {
|
|
|
147
151
|
updaterState?: ClientHealthUpdaterState;
|
|
148
152
|
failureReason?: ClientHealthFailureReason;
|
|
149
153
|
syncRunnerSource?: ClientHealthSyncRunnerSource;
|
|
154
|
+
syncEngine?: ClientHealthSyncEngine;
|
|
155
|
+
syncEngineVaults?: number;
|
|
150
156
|
daemonHqCloudUpdateLastCheckAt?: string;
|
|
151
157
|
daemonHqCloudUpdateOutcome?: ClientHealthDaemonHqCloudUpdateOutcome;
|
|
152
158
|
daemonHqCloudUpdateTarget?: string;
|
|
@@ -79,6 +79,8 @@ export const CLIENT_HEALTH_DAEMON_HQ_CLOUD_UPDATE_OUTCOMES = [
|
|
|
79
79
|
"pinned",
|
|
80
80
|
"failed",
|
|
81
81
|
];
|
|
82
|
+
export const CLIENT_HEALTH_SYNC_ENGINES = ["hq-syncd"];
|
|
83
|
+
export const CLIENT_HEALTH_MAX_SYNC_ENGINE_VAULTS = 10_000;
|
|
82
84
|
export const CLIENT_HEALTH_DAEMON_HQ_CLOUD_UPDATE_ERROR_CLASSES = [
|
|
83
85
|
"registry",
|
|
84
86
|
"install",
|
|
@@ -275,6 +277,11 @@ export function parseClientHealthHeartbeat(input) {
|
|
|
275
277
|
if (rawVersions[key] !== undefined)
|
|
276
278
|
versions[key] = assertVersion(`versions.${key}`, rawVersions[key]);
|
|
277
279
|
}
|
|
280
|
+
if (rawVersions.syncEngine !== undefined) {
|
|
281
|
+
const engineVersion = copyValidOptionalDiagnostic("versions.syncEngine", rawVersions.syncEngine, assertVersion);
|
|
282
|
+
if (engineVersion !== undefined)
|
|
283
|
+
versions.syncEngine = engineVersion;
|
|
284
|
+
}
|
|
278
285
|
const heartbeat = {
|
|
279
286
|
contractVersion,
|
|
280
287
|
installationId,
|
|
@@ -303,6 +310,12 @@ export function parseClientHealthHeartbeat(input) {
|
|
|
303
310
|
heartbeat.failureReason = assertEnum("failureReason", raw.failureReason, CLIENT_HEALTH_FAILURE_REASONS);
|
|
304
311
|
}
|
|
305
312
|
copyKnownOptionalEnum(heartbeat, "syncRunnerSource", raw.syncRunnerSource, CLIENT_HEALTH_SYNC_RUNNER_SOURCES);
|
|
313
|
+
copyKnownOptionalEnum(heartbeat, "syncEngine", raw.syncEngine, CLIENT_HEALTH_SYNC_ENGINES);
|
|
314
|
+
if (raw.syncEngineVaults !== undefined) {
|
|
315
|
+
const vaults = copyValidOptionalDiagnostic("syncEngineVaults", raw.syncEngineVaults, (field, value) => assertBoundedInt(field, value, CLIENT_HEALTH_MAX_SYNC_ENGINE_VAULTS));
|
|
316
|
+
if (vaults !== undefined)
|
|
317
|
+
heartbeat.syncEngineVaults = vaults;
|
|
318
|
+
}
|
|
306
319
|
if (raw.daemonHqCloudUpdateLastCheckAt !== undefined) {
|
|
307
320
|
const lastCheckAt = copyValidOptionalDiagnostic("daemonHqCloudUpdateLastCheckAt", raw.daemonHqCloudUpdateLastCheckAt, assertIsoUtc);
|
|
308
321
|
if (lastCheckAt !== undefined)
|
|
@@ -178,7 +178,13 @@ export interface BuildCliHeartbeatInput {
|
|
|
178
178
|
* sync OUTCOME events, not on every invocation heartbeat.
|
|
179
179
|
*/
|
|
180
180
|
localFilesOverview?: ClientHealthLocalFilesOverview | null;
|
|
181
|
+
syncEngine?: CliSyncEngine | null;
|
|
181
182
|
}
|
|
183
|
+
export interface CliSyncEngine {
|
|
184
|
+
release: string;
|
|
185
|
+
vaults: number;
|
|
186
|
+
}
|
|
187
|
+
export declare function readCliSyncEngine(stateDir: string): CliSyncEngine | null;
|
|
182
188
|
/** Classify sync failures using typed error identity/code fields only. */
|
|
183
189
|
export declare function classifySyncFailure(err: unknown): ClientHealthFailureReason;
|
|
184
190
|
/**
|
|
@@ -205,6 +211,7 @@ export interface ClientHealthDeps {
|
|
|
205
211
|
timeoutMs?: number;
|
|
206
212
|
/** US-016: overridable for tests; defaults to {@link collectLocalFilesOverview}. */
|
|
207
213
|
localFilesOverview?: () => ClientHealthLocalFilesOverview;
|
|
214
|
+
syncEngine?: () => CliSyncEngine | null;
|
|
208
215
|
/** Override for {@link JOURNAL_OBSERVATION_TTL_MS}. */
|
|
209
216
|
journalObservationTtlMs?: number;
|
|
210
217
|
/** Override for {@link JOURNAL_OBSERVATION_LOCK_STALE_MS}. */
|
|
@@ -41,8 +41,9 @@ import { isExpiring, isMachineIdentity, loadCachedTokens, } from "./cognito-sess
|
|
|
41
41
|
import { vaultApiFetch } from "./vault-api.js";
|
|
42
42
|
import { collectVersions } from "./feedback-versions.js";
|
|
43
43
|
import { isAuthError } from "./auth-error.js";
|
|
44
|
-
import { CLIENT_HEALTH_CONTRACT_VERSION, parseClientHealthHeartbeat, } from "./client-health-contract.js";
|
|
44
|
+
import { CLIENT_HEALTH_CONTRACT_VERSION, CLIENT_HEALTH_MAX_SYNC_ENGINE_VAULTS, parseClientHealthHeartbeat, } from "./client-health-contract.js";
|
|
45
45
|
import { collectLocalFilesOverview } from "./local-files-overview.js";
|
|
46
|
+
import { readSyncCoreRolloutStateFile } from "../lib/sync-core/rollout-state.js";
|
|
46
47
|
/** Same bound as CLI telemetry: a heartbeat may never stall a command. */
|
|
47
48
|
const CLIENT_HEALTH_TIMEOUT_MS = 1_200;
|
|
48
49
|
export const CLIENT_HEALTH_STATE_FILE = "cli-client-health.json";
|
|
@@ -389,6 +390,11 @@ function acquireJournalObservationLock(stateDir, nowMs, staleMs) {
|
|
|
389
390
|
}
|
|
390
391
|
};
|
|
391
392
|
}
|
|
393
|
+
export function readCliSyncEngine(stateDir) {
|
|
394
|
+
const state = readSyncCoreRolloutStateFile(path.join(stateDir, "sync-core", "rollout.json"));
|
|
395
|
+
const vaults = state?.vaults.filter((vault) => vault.phase === "full").length ?? 0;
|
|
396
|
+
return state && vaults > 0 ? { release: state.release, vaults } : null;
|
|
397
|
+
}
|
|
392
398
|
/** Classify sync failures using typed error identity/code fields only. */
|
|
393
399
|
export function classifySyncFailure(err) {
|
|
394
400
|
if (isAuthError(err))
|
|
@@ -495,6 +501,13 @@ export function buildCliHeartbeat(input) {
|
|
|
495
501
|
input.localFilesOverview) {
|
|
496
502
|
heartbeat.localFilesOverview = input.localFilesOverview;
|
|
497
503
|
}
|
|
504
|
+
if (input.syncEngine && input.syncEngine.vaults > 0) {
|
|
505
|
+
heartbeat.syncEngine = "hq-syncd";
|
|
506
|
+
heartbeat.syncEngineVaults = Math.min(input.syncEngine.vaults, CLIENT_HEALTH_MAX_SYNC_ENGINE_VAULTS);
|
|
507
|
+
const engineVersion = input.syncEngine.release.replace(/^v/, "");
|
|
508
|
+
if (SEMVER.test(engineVersion))
|
|
509
|
+
versions.syncEngine = engineVersion;
|
|
510
|
+
}
|
|
498
511
|
return heartbeat;
|
|
499
512
|
}
|
|
500
513
|
const defaultPoster = (heartbeat, token, signal) => vaultApiFetch({
|
|
@@ -654,6 +667,13 @@ async function contributeClientHealthUnbounded(kind, deps, failureReason) {
|
|
|
654
667
|
localFilesOverview = null;
|
|
655
668
|
}
|
|
656
669
|
}
|
|
670
|
+
let syncEngine = null;
|
|
671
|
+
try {
|
|
672
|
+
syncEngine = (deps.syncEngine ?? (() => readCliSyncEngine(stateDir)))();
|
|
673
|
+
}
|
|
674
|
+
catch {
|
|
675
|
+
syncEngine = null;
|
|
676
|
+
}
|
|
657
677
|
const heartbeat = buildCliHeartbeat({
|
|
658
678
|
kind,
|
|
659
679
|
state,
|
|
@@ -663,6 +683,7 @@ async function contributeClientHealthUnbounded(kind, deps, failureReason) {
|
|
|
663
683
|
now,
|
|
664
684
|
localFilesOverview,
|
|
665
685
|
failureReason,
|
|
686
|
+
syncEngine,
|
|
666
687
|
});
|
|
667
688
|
if (!heartbeat)
|
|
668
689
|
return;
|
|
@@ -27,6 +27,13 @@
|
|
|
27
27
|
* is kept until the next one, so the folder holds about twice the compaction
|
|
28
28
|
* threshold at most (about 512 KiB).
|
|
29
29
|
*
|
|
30
|
+
* Time: each line carries its UTC date and nothing finer, so a window is
|
|
31
|
+
* answered in whole UTC dates. `hq doctor usage --duplicates --since <d>`
|
|
32
|
+
* (utils/duplicate-command-usage.ts) counts every date the window touches,
|
|
33
|
+
* which can only count more runs than the exact window holds, never fewer.
|
|
34
|
+
* The format is unchanged by that check; {@link readCommandUsageEntries}
|
|
35
|
+
* reads the same lines and tells an unreadable folder apart from a zero.
|
|
36
|
+
*
|
|
30
37
|
* Every read and write of the usage folder goes through the shared store
|
|
31
38
|
* helper (`src/lib/safe-store.ts`): the folder is held open and checked by its
|
|
32
39
|
* descriptor, files are opened without following a link and without blocking,
|
|
@@ -272,4 +279,37 @@ export interface CommandUsageReport {
|
|
|
272
279
|
export declare function readCommandUsage(options?: CommandUsageOptions): CommandUsageReport;
|
|
273
280
|
/** Plain-text report for `hq doctor usage`. */
|
|
274
281
|
export declare function renderCommandUsageText(report: CommandUsageReport): string;
|
|
282
|
+
/** One line of the usage store after merging: a date, a kind, a command path and its count. */
|
|
283
|
+
export interface CommandUsageEntry {
|
|
284
|
+
/** UTC date, `YYYY-MM-DD`. */
|
|
285
|
+
date: string;
|
|
286
|
+
kind: CommandUseKind;
|
|
287
|
+
command: string;
|
|
288
|
+
count: number;
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* The usage store read for a check that must tell "no runs" from "cannot
|
|
292
|
+
* tell". `ok: false` is never a zero: the folder could not be held (missing,
|
|
293
|
+
* a link, another user's, writable by group or others), could not be listed,
|
|
294
|
+
* or holds a usage file that could not be read safely.
|
|
295
|
+
*/
|
|
296
|
+
export type CommandUsageEntriesRead = {
|
|
297
|
+
ok: true;
|
|
298
|
+
file: string;
|
|
299
|
+
entries: CommandUsageEntry[];
|
|
300
|
+
} | {
|
|
301
|
+
ok: false;
|
|
302
|
+
file: string | null;
|
|
303
|
+
reason: string;
|
|
304
|
+
};
|
|
305
|
+
/**
|
|
306
|
+
* Every counted line the store still keeps (up to
|
|
307
|
+
* {@link COMMAND_USAGE_WINDOW_DAYS} UTC dates), merged across the live file
|
|
308
|
+
* and the not-yet-folded part of each rotated file, as {@link readCommandUsage}
|
|
309
|
+
* reads them. Unlike that report, a folder or file that cannot be read is
|
|
310
|
+
* returned as `ok: false` instead of as an empty count.
|
|
311
|
+
*/
|
|
312
|
+
export declare function readCommandUsageEntries(options?: CommandUsageOptions): CommandUsageEntriesRead;
|
|
313
|
+
/** The UTC date (`YYYY-MM-DD`) of an epoch-millisecond time, as the usage store writes it. */
|
|
314
|
+
export declare function usageDateOf(epochMs: number): string;
|
|
275
315
|
//# sourceMappingURL=command-usage.d.ts.map
|
|
@@ -27,6 +27,13 @@
|
|
|
27
27
|
* is kept until the next one, so the folder holds about twice the compaction
|
|
28
28
|
* threshold at most (about 512 KiB).
|
|
29
29
|
*
|
|
30
|
+
* Time: each line carries its UTC date and nothing finer, so a window is
|
|
31
|
+
* answered in whole UTC dates. `hq doctor usage --duplicates --since <d>`
|
|
32
|
+
* (utils/duplicate-command-usage.ts) counts every date the window touches,
|
|
33
|
+
* which can only count more runs than the exact window holds, never fewer.
|
|
34
|
+
* The format is unchanged by that check; {@link readCommandUsageEntries}
|
|
35
|
+
* reads the same lines and tells an unreadable folder apart from a zero.
|
|
36
|
+
*
|
|
30
37
|
* Every read and write of the usage folder goes through the shared store
|
|
31
38
|
* helper (`src/lib/safe-store.ts`): the folder is held open and checked by its
|
|
32
39
|
* descriptor, files are opened without following a link and without blocking,
|
|
@@ -794,4 +801,58 @@ export function renderCommandUsageText(report) {
|
|
|
794
801
|
}
|
|
795
802
|
return `${lines.join("\n")}\n`;
|
|
796
803
|
}
|
|
804
|
+
/**
|
|
805
|
+
* Every counted line the store still keeps (up to
|
|
806
|
+
* {@link COMMAND_USAGE_WINDOW_DAYS} UTC dates), merged across the live file
|
|
807
|
+
* and the not-yet-folded part of each rotated file, as {@link readCommandUsage}
|
|
808
|
+
* reads them. Unlike that report, a folder or file that cannot be read is
|
|
809
|
+
* returned as `ok: false` instead of as an empty count.
|
|
810
|
+
*/
|
|
811
|
+
export function readCommandUsageEntries(options = {}) {
|
|
812
|
+
const dir = options.dir === undefined ? commandUsageDir(options.env) : options.dir;
|
|
813
|
+
if (!dir)
|
|
814
|
+
return { ok: false, file: null, reason: "this run keeps no count" };
|
|
815
|
+
const file = path.join(dir, COMMAND_USAGE_FILENAME);
|
|
816
|
+
try {
|
|
817
|
+
const opened = openStoreDir(dir, { at: options.at });
|
|
818
|
+
if (!opened.ok)
|
|
819
|
+
return { ok: false, file, reason: opened.code };
|
|
820
|
+
const store = opened.value;
|
|
821
|
+
try {
|
|
822
|
+
const listed = store.list();
|
|
823
|
+
if (!listed.ok)
|
|
824
|
+
return { ok: false, file, reason: listed.code };
|
|
825
|
+
const sources = [];
|
|
826
|
+
for (const name of listed.value) {
|
|
827
|
+
const rotated = ROTATED_FILE_PATTERN.exec(name);
|
|
828
|
+
if (!rotated && name !== COMMAND_USAGE_FILENAME)
|
|
829
|
+
continue;
|
|
830
|
+
const read = store.read(name, { maxBytes: USAGE_READ_MAX_BYTES });
|
|
831
|
+
if (read.ok)
|
|
832
|
+
sources.push({ id: rotated ? rotated[1] : null, name, bytes: read.value });
|
|
833
|
+
// Compaction may remove a rotated file after we read the live file
|
|
834
|
+
// but before its tail was folded into that snapshot. A missing file,
|
|
835
|
+
// like any other read refusal, therefore leaves the count unknown.
|
|
836
|
+
else
|
|
837
|
+
return { ok: false, file, reason: `${name}: ${read.code}` };
|
|
838
|
+
}
|
|
839
|
+
const entries = [];
|
|
840
|
+
for (const [key, count] of collectTotals(sources, mergedOffsets(sources))) {
|
|
841
|
+
const [date, code, command] = key.split("\t");
|
|
842
|
+
entries.push({ date, kind: CODE_KIND[code], command, count });
|
|
843
|
+
}
|
|
844
|
+
return { ok: true, file, entries };
|
|
845
|
+
}
|
|
846
|
+
finally {
|
|
847
|
+
store.close();
|
|
848
|
+
}
|
|
849
|
+
}
|
|
850
|
+
catch (error) {
|
|
851
|
+
return { ok: false, file, reason: error instanceof Error ? error.message : "read failed" };
|
|
852
|
+
}
|
|
853
|
+
}
|
|
854
|
+
/** The UTC date (`YYYY-MM-DD`) of an epoch-millisecond time, as the usage store writes it. */
|
|
855
|
+
export function usageDateOf(epochMs) {
|
|
856
|
+
return utcDate(epochMs);
|
|
857
|
+
}
|
|
797
858
|
//# sourceMappingURL=command-usage.js.map
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `hq doctor usage --duplicates` — were any of the duplicate command paths
|
|
3
|
+
* run on this computer in a recent window (hq-core-rust US-041)?
|
|
4
|
+
*
|
|
5
|
+
* Each duplicate does what another command already does. The check reads the
|
|
6
|
+
* local usage count (utils/command-usage.ts) and nothing else; it sends
|
|
7
|
+
* nothing.
|
|
8
|
+
*
|
|
9
|
+
* The usage store keeps one UTC date per line and nothing finer, so a window
|
|
10
|
+
* (`--since 12h`, `--since 1d`) is widened to every UTC date it touches. A run
|
|
11
|
+
* up to a day older than the window can therefore be counted; a run inside
|
|
12
|
+
* the window is never missed. The store keeps {@link COMMAND_USAGE_WINDOW_DAYS}
|
|
13
|
+
* dates, so the window is at most {@link MAX_SINCE_HOURS} hours (29 days), the
|
|
14
|
+
* longest whose widened dates are all still kept.
|
|
15
|
+
*
|
|
16
|
+
* A usage folder that is missing or cannot be read safely gives "unknown",
|
|
17
|
+
* never zero.
|
|
18
|
+
*/
|
|
19
|
+
import { type CommandStates, type CommandUsageOptions } from "./command-usage.js";
|
|
20
|
+
export interface DuplicateCommand {
|
|
21
|
+
/** The duplicate's command path, by declared names. */
|
|
22
|
+
command: string;
|
|
23
|
+
/** Every path a run of it is counted under: the declared path and its typed alias forms. */
|
|
24
|
+
countedAs: readonly string[];
|
|
25
|
+
/** The command that already does the same work, or null when there is none yet. */
|
|
26
|
+
owner: string | null;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* The duplicates of the US-041 PRD (it says "eight" and lists nine paths; all
|
|
30
|
+
* nine are checked). A run is counted under the path as typed, so an alias
|
|
31
|
+
* form (`packages ls`) is listed too; a test holds this list to the command
|
|
32
|
+
* catalog.
|
|
33
|
+
*/
|
|
34
|
+
export declare const DUPLICATE_COMMANDS: readonly DuplicateCommand[];
|
|
35
|
+
/** Default window. */
|
|
36
|
+
export declare const DEFAULT_SINCE = "1d";
|
|
37
|
+
/** The longest window, in hours: 29 days, so every widened date is still kept. */
|
|
38
|
+
export declare const MAX_SINCE_HOURS: number;
|
|
39
|
+
/** Hours in `text` (`Nh` or `Nd`, N a whole number from 1), or null when it is not a valid window. */
|
|
40
|
+
export declare function parseSince(text: string): number | null;
|
|
41
|
+
export interface DuplicateUsageRow {
|
|
42
|
+
command: string;
|
|
43
|
+
/** State in `src/data/command-states.json`; `live` when it is not listed. */
|
|
44
|
+
state: string;
|
|
45
|
+
owner: string | null;
|
|
46
|
+
/** Runs in the window (every kind: plain, with the still-use flag, refused), or null when unknown. */
|
|
47
|
+
runs: number | null;
|
|
48
|
+
/** Runs on every date the store still keeps, or null when unknown. */
|
|
49
|
+
keptRuns: number | null;
|
|
50
|
+
}
|
|
51
|
+
export interface DuplicateUsageReport {
|
|
52
|
+
schema: 1;
|
|
53
|
+
since: string;
|
|
54
|
+
/** First and last UTC date counted, inclusive. */
|
|
55
|
+
from: string;
|
|
56
|
+
to: string;
|
|
57
|
+
/** `clear`: no duplicate ran; `used`: at least one ran; `unknown`: the count could not be read. */
|
|
58
|
+
status: "clear" | "used" | "unknown";
|
|
59
|
+
/** Why the count is unknown. */
|
|
60
|
+
reason?: string;
|
|
61
|
+
file: string | null;
|
|
62
|
+
leavesThisComputer: false;
|
|
63
|
+
commands: DuplicateUsageRow[];
|
|
64
|
+
}
|
|
65
|
+
/** Exit status for a report: 0 clear, 1 used, 2 unknown. */
|
|
66
|
+
export declare function duplicateUsageExitCode(report: DuplicateUsageReport): 0 | 1 | 2;
|
|
67
|
+
export declare function readDuplicateUsage(options?: CommandUsageOptions & {
|
|
68
|
+
since?: string;
|
|
69
|
+
states?: CommandStates;
|
|
70
|
+
}): DuplicateUsageReport;
|
|
71
|
+
export declare function renderDuplicateUsageText(report: DuplicateUsageReport): string;
|
|
72
|
+
//# sourceMappingURL=duplicate-command-usage.d.ts.map
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `hq doctor usage --duplicates` — were any of the duplicate command paths
|
|
3
|
+
* run on this computer in a recent window (hq-core-rust US-041)?
|
|
4
|
+
*
|
|
5
|
+
* Each duplicate does what another command already does. The check reads the
|
|
6
|
+
* local usage count (utils/command-usage.ts) and nothing else; it sends
|
|
7
|
+
* nothing.
|
|
8
|
+
*
|
|
9
|
+
* The usage store keeps one UTC date per line and nothing finer, so a window
|
|
10
|
+
* (`--since 12h`, `--since 1d`) is widened to every UTC date it touches. A run
|
|
11
|
+
* up to a day older than the window can therefore be counted; a run inside
|
|
12
|
+
* the window is never missed. The store keeps {@link COMMAND_USAGE_WINDOW_DAYS}
|
|
13
|
+
* dates, so the window is at most {@link MAX_SINCE_HOURS} hours (29 days), the
|
|
14
|
+
* longest whose widened dates are all still kept.
|
|
15
|
+
*
|
|
16
|
+
* A usage folder that is missing or cannot be read safely gives "unknown",
|
|
17
|
+
* never zero.
|
|
18
|
+
*/
|
|
19
|
+
import { COMMAND_USAGE_WINDOW_DAYS, loadCommandStates, readCommandUsageEntries, usageDateOf, } from "./command-usage.js";
|
|
20
|
+
/**
|
|
21
|
+
* The duplicates of the US-041 PRD (it says "eight" and lists nine paths; all
|
|
22
|
+
* nine are checked). A run is counted under the path as typed, so an alias
|
|
23
|
+
* form (`packages ls`) is listed too; a test holds this list to the command
|
|
24
|
+
* catalog.
|
|
25
|
+
*/
|
|
26
|
+
export const DUPLICATE_COMMANDS = [
|
|
27
|
+
{ command: "auth login", countedAs: ["auth login"], owner: "login" },
|
|
28
|
+
{ command: "auth logout", countedAs: ["auth logout"], owner: "logout" },
|
|
29
|
+
{ command: "auth status", countedAs: ["auth status"], owner: "whoami" },
|
|
30
|
+
{ command: "sync status", countedAs: ["sync status"], owner: "daemon sync status" },
|
|
31
|
+
{ command: "sync mode", countedAs: ["sync mode"], owner: "daemon sync mode" },
|
|
32
|
+
{ command: "packages install", countedAs: ["packages install"], owner: "install" },
|
|
33
|
+
{ command: "packages list", countedAs: ["packages list", "packages ls"], owner: "packs list" },
|
|
34
|
+
{ command: "packages update", countedAs: ["packages update"], owner: null },
|
|
35
|
+
{ command: "packages remove", countedAs: ["packages remove"], owner: "remove" },
|
|
36
|
+
];
|
|
37
|
+
/** Default window. */
|
|
38
|
+
export const DEFAULT_SINCE = "1d";
|
|
39
|
+
/** The longest window, in hours: 29 days, so every widened date is still kept. */
|
|
40
|
+
export const MAX_SINCE_HOURS = (COMMAND_USAGE_WINDOW_DAYS - 1) * 24;
|
|
41
|
+
const HOUR_MS = 60 * 60 * 1000;
|
|
42
|
+
/** Hours in `text` (`Nh` or `Nd`, N a whole number from 1), or null when it is not a valid window. */
|
|
43
|
+
export function parseSince(text) {
|
|
44
|
+
const match = /^([1-9][0-9]{0,4})([hd])$/.exec(text.trim());
|
|
45
|
+
if (!match)
|
|
46
|
+
return null;
|
|
47
|
+
const hours = Number(match[1]) * (match[2] === "d" ? 24 : 1);
|
|
48
|
+
return hours <= MAX_SINCE_HOURS ? hours : null;
|
|
49
|
+
}
|
|
50
|
+
/** Exit status for a report: 0 clear, 1 used, 2 unknown. */
|
|
51
|
+
export function duplicateUsageExitCode(report) {
|
|
52
|
+
return report.status === "clear" ? 0 : report.status === "used" ? 1 : 2;
|
|
53
|
+
}
|
|
54
|
+
export function readDuplicateUsage(options = {}) {
|
|
55
|
+
const since = options.since ?? DEFAULT_SINCE;
|
|
56
|
+
const hours = parseSince(since);
|
|
57
|
+
if (hours === null)
|
|
58
|
+
throw new RangeError(`invalid window: ${since}`);
|
|
59
|
+
const now = options.now ?? Date.now();
|
|
60
|
+
const from = usageDateOf(now - hours * HOUR_MS);
|
|
61
|
+
const to = usageDateOf(now);
|
|
62
|
+
const states = options.states ?? loadCommandStates(options.env);
|
|
63
|
+
const read = readCommandUsageEntries(options);
|
|
64
|
+
const commands = DUPLICATE_COMMANDS.map((duplicate) => {
|
|
65
|
+
const entry = Object.prototype.hasOwnProperty.call(states, duplicate.command)
|
|
66
|
+
? states[duplicate.command]
|
|
67
|
+
: undefined;
|
|
68
|
+
const state = entry && typeof entry.state === "string" ? entry.state : "live";
|
|
69
|
+
if (!read.ok)
|
|
70
|
+
return { command: duplicate.command, state, owner: duplicate.owner, runs: null, keptRuns: null };
|
|
71
|
+
let runs = 0;
|
|
72
|
+
let keptRuns = 0;
|
|
73
|
+
for (const line of read.entries) {
|
|
74
|
+
if (!duplicate.countedAs.includes(line.command))
|
|
75
|
+
continue;
|
|
76
|
+
keptRuns += line.count;
|
|
77
|
+
if (line.date >= from && line.date <= to)
|
|
78
|
+
runs += line.count;
|
|
79
|
+
}
|
|
80
|
+
return { command: duplicate.command, state, owner: duplicate.owner, runs, keptRuns };
|
|
81
|
+
});
|
|
82
|
+
const status = !read.ok ? "unknown" : commands.some((row) => (row.runs ?? 0) > 0) ? "used" : "clear";
|
|
83
|
+
return {
|
|
84
|
+
schema: 1,
|
|
85
|
+
since,
|
|
86
|
+
from,
|
|
87
|
+
to,
|
|
88
|
+
status,
|
|
89
|
+
...(read.ok ? {} : { reason: read.reason }),
|
|
90
|
+
file: read.file,
|
|
91
|
+
leavesThisComputer: false,
|
|
92
|
+
commands,
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
export function renderDuplicateUsageText(report) {
|
|
96
|
+
const lines = [
|
|
97
|
+
`Duplicate commands run on this computer in the last ${report.since} (UTC dates ${report.from} to ${report.to})`,
|
|
98
|
+
"",
|
|
99
|
+
];
|
|
100
|
+
const headers = ["command", "runs", "kept", "state", "use instead"];
|
|
101
|
+
const table = report.commands.map((row) => [
|
|
102
|
+
row.command,
|
|
103
|
+
row.runs === null ? "unknown" : String(row.runs),
|
|
104
|
+
row.keptRuns === null ? "unknown" : String(row.keptRuns),
|
|
105
|
+
row.state,
|
|
106
|
+
row.owner === null ? "(none yet)" : `hq ${row.owner}`,
|
|
107
|
+
]);
|
|
108
|
+
const widths = headers.map((header, column) => Math.max(header.length, ...table.map((cells) => cells[column].length)));
|
|
109
|
+
const numeric = new Set([1, 2]);
|
|
110
|
+
const format = (cells) => ` ${cells
|
|
111
|
+
.map((cell, column) => (numeric.has(column) ? cell.padStart(widths[column]) : cell.padEnd(widths[column])))
|
|
112
|
+
.join(" ")}`.trimEnd();
|
|
113
|
+
lines.push(format(headers), ...table.map(format), "");
|
|
114
|
+
if (report.status === "unknown") {
|
|
115
|
+
lines.push(`Unknown: the usage count could not be read (${report.reason ?? "unreadable"}${report.file ? `, ${report.file}` : ""}). This is not a zero.`);
|
|
116
|
+
}
|
|
117
|
+
else {
|
|
118
|
+
const used = report.commands.filter((row) => (row.runs ?? 0) > 0).length;
|
|
119
|
+
lines.push(used === 0
|
|
120
|
+
? `None of the ${report.commands.length} duplicates ran in the window.`
|
|
121
|
+
: `${used} of the ${report.commands.length} duplicates ran in the window.`, `"kept" counts every date the file still keeps (up to ${COMMAND_USAGE_WINDOW_DAYS}). Counts are kept per UTC date, so the window covers each whole date it touches.`);
|
|
122
|
+
}
|
|
123
|
+
return `${lines.join("\n")}\n`;
|
|
124
|
+
}
|
|
125
|
+
//# sourceMappingURL=duplicate-command-usage.js.map
|
|
@@ -4,7 +4,7 @@ export { CORE_NEXT_FLAG, coreNextEnabled } from './core-next-flag.js';
|
|
|
4
4
|
export { coreNextKillReason, CORE_NEXT_KILL_ENV, CORE_NEXT_KILL_FILE, ENGINE_KILL_ENV, ENGINE_KILL_FILE } from './core-next-kill.js';
|
|
5
5
|
/** Name of the release-stable link next to the pinned engine versions. */
|
|
6
6
|
export declare const STABLE_LINK_NAME = "stable";
|
|
7
|
-
export type CoreNextHost = 'claude' | 'codex' | 'grok' | 'fleet-local';
|
|
7
|
+
export type CoreNextHost = 'claude' | 'codex' | 'grok' | 'fleet-local' | 'agents-v2';
|
|
8
8
|
/**
|
|
9
9
|
* `project`: the HQ root's own registration, always answers.
|
|
10
10
|
* `global`: the user-scope Claude Code entry; answers nothing inside an HQ
|
|
@@ -48,6 +48,7 @@ import * as hookEngineResolve from '../lib/hook-engine/resolve.js';
|
|
|
48
48
|
import { launcherRoot, quotePosix, quoteWindows } from '../lib/hook-engine/registration.js';
|
|
49
49
|
import { openStoreDir } from '../lib/safe-store.js';
|
|
50
50
|
import { SKIP_CANARY_GATE_ENV, checkHostCanary } from '../lib/hook-engine/canary-gate.js';
|
|
51
|
+
import { resolvedUnder } from '../lib/hook-engine/coverage.js';
|
|
51
52
|
export { CORE_NEXT_FLAG, coreNextEnabled } from './core-next-flag.js';
|
|
52
53
|
import { CORE_NEXT_FLAG, coreNextEnabled } from './core-next-flag.js';
|
|
53
54
|
export { coreNextKillReason, CORE_NEXT_KILL_ENV, CORE_NEXT_KILL_FILE, ENGINE_KILL_ENV, ENGINE_KILL_FILE } from './core-next-kill.js';
|
|
@@ -316,7 +317,7 @@ export function coreNextTarget(home, env = process.env, options = {}) {
|
|
|
316
317
|
const events = capableEvents(caps);
|
|
317
318
|
if (!events.length)
|
|
318
319
|
return null;
|
|
319
|
-
return { coreNext: stable, events, covers: caps.covers ?? {}, canary: hostCanaryGate(home, env, caps.version, platform, options.warn) };
|
|
320
|
+
return resolvedUnder({ coreNext: stable, events, covers: caps.covers ?? {}, canary: hostCanaryGate(home, env, caps.version, platform, options.warn) }, env);
|
|
320
321
|
}
|
|
321
322
|
const warned = new Set();
|
|
322
323
|
function warnOnce(message, warn) {
|
|
@@ -338,6 +339,10 @@ function hostCanaryGate(home, env, version, platform, warn) {
|
|
|
338
339
|
return (root, host) => {
|
|
339
340
|
if (host === 'fleet-local')
|
|
340
341
|
return true;
|
|
342
|
+
// agents-v2 is planned by `hq core hook-registration-plan`, which gates on
|
|
343
|
+
// coverage and never asks this gate; any other caller keeps the shell plan.
|
|
344
|
+
if (host === 'agents-v2')
|
|
345
|
+
return false;
|
|
341
346
|
const gate = checkHostCanary({ home, root, host, engineVersion: version, env, platform });
|
|
342
347
|
if (gate.skipped) {
|
|
343
348
|
warnOnce(`hq: warning: ${SKIP_CANARY_GATE_ENV} is set: bypassing the host canary gate and switching ${host} hook events to the new core (hq-hook ${version}) without a passing host canary (${gate.reason})`, warn);
|
|
@@ -81,6 +81,7 @@ export const RESIDENT_PACKAGE_MODULES = {
|
|
|
81
81
|
"../lib/hot-channels/adapters/index.js",
|
|
82
82
|
"../lib/capacity/collect.js",
|
|
83
83
|
"../lib/capacity/accounts.js",
|
|
84
|
+
"../lib/core-utils/hook-timeout-debug-context-flag.js",
|
|
84
85
|
],
|
|
85
86
|
"daemon-logs-follow": [],
|
|
86
87
|
"mesh-daemon": ["../sentry.js", "../lib/doctor/client-health-reason-codes-flag.js", "@indigoai-us/hq-flags-client", "../lib/plan-limit-nag.js", "../utils/plan-gate-error.js", "../utils/deleted-company-notice.js", "open", "../utils/cognito-session.js", "../lib/first-sync-next-step.js", "@indigoai-us/hq-cloud"],
|
|
@@ -290,6 +291,9 @@ const LOADERS = {
|
|
|
290
291
|
// before it refuses on a stale one.
|
|
291
292
|
() => import("../lib/capacity/collect.js"),
|
|
292
293
|
() => import("../lib/capacity/accounts.js"),
|
|
294
|
+
// Native Stop timeout diagnostics report through sentry-report, whose
|
|
295
|
+
// hook-timeout debug-context gate loads this flag module on demand.
|
|
296
|
+
() => import("../lib/core-utils/hook-timeout-debug-context-flag.js"),
|
|
293
297
|
],
|
|
294
298
|
"daemon-logs-follow": [],
|
|
295
299
|
"mesh-daemon": [
|
|
@@ -151,6 +151,15 @@ const KNOWN_ERROR_NAMES = new Set([
|
|
|
151
151
|
"QmdStoreUnopenableError",
|
|
152
152
|
"QmdQueryDocumentError",
|
|
153
153
|
"QmdModelDownloadError",
|
|
154
|
+
// A damaged SQLite index file. Still captured, so it groups on its own key
|
|
155
|
+
// (HQ-CLI-EJ).
|
|
156
|
+
"QmdStoreCorruptError",
|
|
157
|
+
// Thrown marked expected (the boundary prints the remedy and skips capture),
|
|
158
|
+
// or handled inside reconciliation. Allow-listed defensively, like
|
|
159
|
+
// QmdWorkdirMissingError below (HQ-CLI-EJ, HQ-CLI-GJ).
|
|
160
|
+
"QmdAccessDeniedError",
|
|
161
|
+
"QmdConfigUnwritableError",
|
|
162
|
+
"QmdCollectionPathTakenError",
|
|
154
163
|
// Shares the `Qmd` prefix the qmd branch keys on. The boundary now SUPPRESSES
|
|
155
164
|
// capture for this class, so it should never reach a capture route — allow-
|
|
156
165
|
// listed defensively so a future capture path cannot mint an unbounded group
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/** System32\bash.exe (WSL) or a WindowsApps alias: never used as Git Bash. */
|
|
2
|
+
export declare function isExcludedWindowsBash(file: string, env: Record<string, string | undefined>): boolean;
|
|
1
3
|
export declare function resolveWindowsBash(env: Record<string, string | undefined>): {
|
|
2
4
|
executable?: string;
|
|
3
5
|
cause: unknown;
|
|
@@ -19,7 +19,8 @@ function isWithinWindowsDirectory(file, directory) {
|
|
|
19
19
|
return normalizedFile === normalizedDirectory
|
|
20
20
|
|| normalizedFile.startsWith(`${normalizedDirectory}${path.win32.sep}`);
|
|
21
21
|
}
|
|
22
|
-
|
|
22
|
+
/** System32\bash.exe (WSL) or a WindowsApps alias: never used as Git Bash. */
|
|
23
|
+
export function isExcludedWindowsBash(file, env) {
|
|
23
24
|
if (path.win32.basename(file).toLowerCase() !== "bash.exe")
|
|
24
25
|
return false;
|
|
25
26
|
const windowsDir = envValue(env, "SystemRoot") ?? envValue(env, "WINDIR") ?? "C:\\Windows";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@indigoai-us/hq-cli",
|
|
3
|
-
"version": "5.345.
|
|
3
|
+
"version": "5.345.221",
|
|
4
4
|
"description": "HQ by Indigo management CLI — modules and cloud sync",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -10,6 +10,12 @@
|
|
|
10
10
|
"files": [
|
|
11
11
|
"dist",
|
|
12
12
|
"!dist/**/*.map",
|
|
13
|
+
"!dist/**/__fixtures__",
|
|
14
|
+
"!dist/**/__testing__",
|
|
15
|
+
"!dist/**/*.test-d.*",
|
|
16
|
+
"!dist/lib/test-utils",
|
|
17
|
+
"!dist/lib/decisions/fixtures",
|
|
18
|
+
"!dist/lib/fingerprint/fixtures.*",
|
|
13
19
|
"assets/scaffold",
|
|
14
20
|
"assets/bot-workers",
|
|
15
21
|
"assets/mesh-daemon",
|
|
@@ -21,11 +27,10 @@
|
|
|
21
27
|
"CHANGELOG.md",
|
|
22
28
|
"README.md",
|
|
23
29
|
"contracts",
|
|
24
|
-
"scripts/mesh-daemon-if-stale.mjs",
|
|
25
30
|
"scripts/install-hook-engine.mjs",
|
|
26
|
-
"scripts/hook-engine-manifest.mjs",
|
|
27
31
|
"scripts/check-function-manifest.mjs",
|
|
28
|
-
"scripts/bench-core.mjs"
|
|
32
|
+
"scripts/bench-core.mjs",
|
|
33
|
+
"scripts/bench-core-compare.mjs"
|
|
29
34
|
],
|
|
30
35
|
"scripts": {
|
|
31
36
|
"build": "node scripts/generate-dsn.mjs && node scripts/build-flag-registry-worker.mjs && tsc && node scripts/generate-command-catalog.mjs --check && node scripts/copy-schemas.mjs && node scripts/chmod-bins.mjs && node scripts/bundle-sync-runner.mjs",
|
|
@@ -119,11 +124,11 @@
|
|
|
119
124
|
"*.{ts,tsx,mts,cts,js,jsx,mjs,cjs}": "eslint --cache --no-error-on-unmatched-pattern"
|
|
120
125
|
},
|
|
121
126
|
"optionalDependencies": {
|
|
122
|
-
"@indigoai-us/hq-hook-win32-x64": "5.345.
|
|
123
|
-
"@indigoai-us/hq-hook-win32-arm64": "5.345.
|
|
124
|
-
"@indigoai-us/hq-hook-darwin-x64": "5.345.
|
|
125
|
-
"@indigoai-us/hq-hook-darwin-arm64": "5.345.
|
|
126
|
-
"@indigoai-us/hq-hook-linux-x64": "5.345.
|
|
127
|
-
"@indigoai-us/hq-hook-linux-arm64": "5.345.
|
|
127
|
+
"@indigoai-us/hq-hook-win32-x64": "5.345.221",
|
|
128
|
+
"@indigoai-us/hq-hook-win32-arm64": "5.345.221",
|
|
129
|
+
"@indigoai-us/hq-hook-darwin-x64": "5.345.221",
|
|
130
|
+
"@indigoai-us/hq-hook-darwin-arm64": "5.345.221",
|
|
131
|
+
"@indigoai-us/hq-hook-linux-x64": "5.345.221",
|
|
132
|
+
"@indigoai-us/hq-hook-linux-arm64": "5.345.221"
|
|
128
133
|
}
|
|
129
134
|
}
|