@indigoai-us/hq-cli 5.345.238 → 5.345.241
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 +25 -0
- package/assets/scaffold/core/scripts/hq-delegate-repo.sh +7 -1
- package/assets/scaffold/core/scripts/hq-delegate-secrets.sh +95 -20
- package/assets/scaffold/core/scripts/hq-delegate-transfer.sh +57 -9
- package/dist/command-catalog.generated.d.ts +185 -3
- package/dist/command-catalog.generated.js +228 -3
- package/dist/command-registration-plan.d.ts +6 -0
- package/dist/command-registration-plan.js +1 -0
- package/dist/commands/cloud-off-gate.d.ts +2 -1
- package/dist/commands/cloud-off-gate.js +17 -4
- package/dist/commands/cloud.d.ts +17 -2
- package/dist/commands/cloud.js +126 -24
- package/dist/commands/core-delegate-w1b.js +35 -10
- package/dist/commands/core-delegate.d.ts +2 -1
- package/dist/commands/core-delegate.js +207 -48
- package/dist/commands/deploy-comments.js +8 -2
- package/dist/commands/deploy-events.d.ts +40 -0
- package/dist/commands/deploy-events.js +300 -0
- package/dist/commands/doctor.d.ts +4 -4
- package/dist/commands/doctor.js +2 -2
- package/dist/commands/feedback.js +2 -3
- package/dist/commands/keyed-sync-pull.d.ts +12 -0
- package/dist/commands/keyed-sync-pull.js +151 -0
- package/dist/commands/library-add.d.ts +5 -2
- package/dist/commands/library-add.js +22 -9
- package/dist/commands/mcp-registration.d.ts +4 -18
- package/dist/commands/mcp-registration.js +9 -29
- package/dist/commands/mesh.d.ts +4 -0
- package/dist/commands/mesh.js +25 -5
- package/dist/commands/pack-install.d.ts +2 -3
- package/dist/commands/pack-install.js +6 -8
- package/dist/commands/secrets.d.ts +3 -4
- package/dist/commands/secrets.js +3 -20
- package/dist/hq-cloud-sync-runner/bin/sync-runner.js +307 -232
- package/dist/hq-cloud-sync-runner/package.json +1 -1
- package/dist/lib/bot/api.d.ts +2 -1
- package/dist/lib/bot/api.js +2 -15
- package/dist/lib/capacity/collectors/claude-oauth.d.ts +0 -2
- package/dist/lib/capacity/collectors/claude-oauth.js +0 -5
- package/dist/lib/core-utils/delegate-helper-paths.d.ts +26 -0
- package/dist/lib/core-utils/delegate-helper-paths.js +33 -0
- package/dist/lib/daemon/jq-provision.d.ts +63 -0
- package/dist/lib/daemon/jq-provision.js +155 -0
- package/dist/lib/daemon/lanes-reconcile-guard.d.ts +4 -3
- package/dist/lib/daemon/lanes-reconcile-guard.js +4 -4
- package/dist/lib/daemon/mesh-owner.d.ts +4 -0
- package/dist/lib/daemon/mesh-owner.js +20 -0
- package/dist/lib/daemon/ops/policy.d.ts +3 -0
- package/dist/lib/daemon/ops/policy.js +32 -4
- package/dist/lib/daemon/run.js +1 -0
- package/dist/lib/daemon/server.d.ts +6 -0
- package/dist/lib/daemon/server.js +5 -0
- package/dist/lib/daemon/verified-jq.d.ts +96 -0
- package/dist/lib/daemon/verified-jq.js +337 -0
- package/dist/lib/doctor/checks/jq.js +16 -0
- package/dist/lib/doctor/deep/executor.d.ts +7 -0
- package/dist/lib/doctor/deep/executor.js +1 -1
- package/dist/lib/doctor/deep/parity.js +1 -27
- package/dist/lib/doctor/deep/sandbox.d.ts +2 -2
- package/dist/lib/doctor/deep/sandbox.js +3 -19
- package/dist/lib/doctor/fix/refresh-sync-handoff.js +52 -21
- package/dist/lib/doctor/fixtures/discover.d.ts +2 -0
- package/dist/lib/doctor/fixtures/discover.js +1 -1
- package/dist/lib/doctor/json-output.d.ts +1 -1
- package/dist/lib/doctor/registry.d.ts +6 -7
- package/dist/lib/doctor/registry.js +6 -7
- package/dist/lib/doctor/report.d.ts +9 -10
- package/dist/lib/doctor/report.js +4 -4
- package/dist/lib/flag-registry-worker-source.generated.d.ts +1 -1
- package/dist/lib/flag-registry-worker-source.generated.js +1 -1
- package/dist/lib/jq/install.d.ts +27 -0
- package/dist/lib/jq/install.js +156 -0
- package/dist/lib/lanes/outpost-dispatch.d.ts +1 -1
- package/dist/lib/lanes/outpost-dispatch.js +13 -13
- package/dist/lib/lanes/outpost-pruner-install.js +1 -1
- package/dist/lib/mesh/live/daemon/doctor.js +7 -1
- package/dist/lib/mesh/live/daemon/install.d.ts +4 -0
- package/dist/lib/mesh/live/daemon/install.js +10 -0
- package/dist/lib/mesh/live/daemon/run.js +17 -0
- package/dist/lib/mesh/live/emit-retry.d.ts +20 -2
- package/dist/lib/mesh/live/emit-retry.js +57 -4
- package/dist/lib/mesh/live/emit.js +25 -4
- package/dist/lib/mesh/live/flush.d.ts +2 -0
- package/dist/lib/mesh/live/flush.js +21 -8
- package/dist/lib/mesh/live/spool.d.ts +9 -1
- package/dist/lib/mesh/live/spool.js +41 -29
- package/dist/lib/sync-core/rollout-state.d.ts +9 -1
- package/dist/lib/sync-core/rollout-state.js +34 -4
- package/dist/lib/windows/jq.d.ts +4 -0
- package/dist/lib/windows/jq.js +10 -39
- package/dist/lib/workers-registry/index.js +7 -11
- package/dist/utils/callback-port-busy.d.ts +2 -2
- package/dist/utils/callback-port-busy.js +2 -2
- package/dist/utils/cli-network-lifecycle.js +1 -0
- package/dist/utils/client-health-contract.d.ts +2 -0
- package/dist/utils/client-health-contract.js +1 -1
- package/dist/utils/client-health.js +1 -9
- package/dist/utils/cognito-config.js +5 -0
- package/dist/utils/cognito-session.d.ts +4 -6
- package/dist/utils/cognito-session.js +4 -24
- package/dist/utils/incomplete-install-error.js +1 -11
- package/dist/utils/install-tree-torn.d.ts +11 -0
- package/dist/utils/install-tree-torn.js +1 -1
- package/dist/utils/resident-package-preload.js +2 -1
- package/docs/anywhere-runtime.md +8 -0
- package/package.json +9 -9
|
@@ -450,36 +450,67 @@ export function acquireRefreshSpawnLock(hqRoot, nowMs, identity) {
|
|
|
450
450
|
const holder = parseSpawnLock(text);
|
|
451
451
|
if (!holder || !ownerProvenGone(holder, identity))
|
|
452
452
|
return null;
|
|
453
|
-
//
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
453
|
+
// Remove the dead holder's lock, then retry the O_EXCL create above.
|
|
454
|
+
if (!removeLockIfUnchanged(file, text, token, identity))
|
|
455
|
+
return null;
|
|
456
|
+
}
|
|
457
|
+
return null;
|
|
458
|
+
}
|
|
459
|
+
/**
|
|
460
|
+
* Remove `file` only while it still holds exactly `expected` (a holder judged
|
|
461
|
+
* gone), so that at most one process ever removes a given holder.
|
|
462
|
+
*
|
|
463
|
+
* The remover first creates `<file>.takeover-<hash of expected>` with O_EXCL.
|
|
464
|
+
* Only the process that creates it may remove `file`, and only after reading
|
|
465
|
+
* `expected` there again. A holder's text carries a random token and is never
|
|
466
|
+
* written twice, so once it is removed no later remover can match it: a new
|
|
467
|
+
* holder's lock is never removed by a taker that judged an older one.
|
|
468
|
+
*
|
|
469
|
+
* Returns true when this call removed `expected`. If a remover crashed while
|
|
470
|
+
* holding the claim file, the claim is cleared the same way, one level down,
|
|
471
|
+
* once its own owner is proven gone; this call then returns false and the
|
|
472
|
+
* next acquire can take the lock over.
|
|
473
|
+
*/
|
|
474
|
+
function removeLockIfUnchanged(file, expected, token, identity, depth = 0) {
|
|
475
|
+
const digest = crypto.createHash("sha256").update(expected).digest("hex").slice(0, 16);
|
|
476
|
+
const claim = `${file}.takeover-${digest}`;
|
|
477
|
+
try {
|
|
478
|
+
fs.writeFileSync(claim, token, { flag: "wx", mode: 0o600 });
|
|
479
|
+
}
|
|
480
|
+
catch (error) {
|
|
481
|
+
if (error.code !== "EEXIST" || depth >= 2)
|
|
482
|
+
return false;
|
|
483
|
+
// Another process is removing this same holder now, or one crashed while
|
|
484
|
+
// doing so.
|
|
485
|
+
let claimText;
|
|
457
486
|
try {
|
|
458
|
-
fs.
|
|
487
|
+
claimText = fs.readFileSync(claim, "utf8");
|
|
459
488
|
}
|
|
460
489
|
catch {
|
|
461
|
-
return
|
|
490
|
+
return false;
|
|
462
491
|
}
|
|
463
|
-
|
|
492
|
+
const claimOwner = parseSpawnLock(claimText);
|
|
493
|
+
if (claimOwner && ownerProvenGone(claimOwner, identity)) {
|
|
494
|
+
removeLockIfUnchanged(claim, claimText, token, identity, depth + 1);
|
|
495
|
+
}
|
|
496
|
+
return false;
|
|
497
|
+
}
|
|
498
|
+
try {
|
|
499
|
+
let current;
|
|
464
500
|
try {
|
|
465
|
-
|
|
501
|
+
current = fs.readFileSync(file, "utf8");
|
|
466
502
|
}
|
|
467
503
|
catch {
|
|
468
|
-
|
|
504
|
+
current = null;
|
|
469
505
|
}
|
|
470
|
-
if (
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
fs.rmSync(aside, { force: true });
|
|
478
|
-
return null;
|
|
479
|
-
}
|
|
480
|
-
fs.rmSync(aside, { force: true });
|
|
506
|
+
if (current !== expected)
|
|
507
|
+
return false;
|
|
508
|
+
fs.rmSync(file, { force: true });
|
|
509
|
+
return true;
|
|
510
|
+
}
|
|
511
|
+
finally {
|
|
512
|
+
fs.rmSync(claim, { force: true });
|
|
481
513
|
}
|
|
482
|
-
return null;
|
|
483
514
|
}
|
|
484
515
|
/** A spawn lock still held after this long is reported by `hq doctor`. */
|
|
485
516
|
export const REFRESH_SPAWN_LOCK_WARN_MS = 10 * 60 * 1000;
|
|
@@ -30,6 +30,8 @@ import { type ParsedFixture } from "./schema.js";
|
|
|
30
30
|
export declare const HOOK_TESTS_RELDIR: string;
|
|
31
31
|
/** checkId of the single coverage-ratio result the report surfaces in its summary. */
|
|
32
32
|
export declare const FIXTURE_COVERAGE_CHECK_ID = "hooks.fixtures.coverage";
|
|
33
|
+
/** A `*.yaml` file in `core/hook-tests/` that is not a fixture and must be skipped. */
|
|
34
|
+
export declare const NON_FIXTURE_FILES: Set<string>;
|
|
33
35
|
/**
|
|
34
36
|
* The hook ids the wiring tier found registered, deduplicated and sorted. A hook
|
|
35
37
|
* id is the identity a fixture is keyed by: the id passed to `hook-gate.sh` when
|
|
@@ -36,7 +36,7 @@ const FIXTURES_FAMILY_ID = "fixtures";
|
|
|
36
36
|
/** checkId of the single coverage-ratio result the report surfaces in its summary. */
|
|
37
37
|
export const FIXTURE_COVERAGE_CHECK_ID = "hooks.fixtures.coverage";
|
|
38
38
|
/** A `*.yaml` file in `core/hook-tests/` that is not a fixture and must be skipped. */
|
|
39
|
-
const NON_FIXTURE_FILES = new Set(["allowed-divergence.yaml"]);
|
|
39
|
+
export const NON_FIXTURE_FILES = new Set(["allowed-divergence.yaml"]);
|
|
40
40
|
// --- registered-hook enumeration ----------------------------------------------
|
|
41
41
|
/**
|
|
42
42
|
* The hook ids the wiring tier found registered, deduplicated and sorted. A hook
|
|
@@ -71,7 +71,7 @@ export interface DoctorJsonResult {
|
|
|
71
71
|
export interface DoctorJsonDocument {
|
|
72
72
|
/** Output-contract version. See {@link DOCTOR_JSON_SCHEMA_VERSION}. */
|
|
73
73
|
schemaVersion: number;
|
|
74
|
-
/** The detected agent platform and its evidence
|
|
74
|
+
/** The detected agent platform and its evidence. */
|
|
75
75
|
platform: DoctorPlatform;
|
|
76
76
|
/** The resolved HQ tree root. */
|
|
77
77
|
hqRoot: string;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The doctor engine — an ordered set of check families — and the
|
|
3
|
-
* (hooks).
|
|
2
|
+
* The doctor engine — an ordered set of check families — and the hooks family.
|
|
4
3
|
*
|
|
5
4
|
* The engine is deliberately ignorant of any specific family: `register`
|
|
6
5
|
* accepts any object implementing {@link CheckFamily}, and `run` iterates them
|
|
@@ -8,10 +7,10 @@
|
|
|
8
7
|
* added by registering it — never by editing this class — which is exactly the
|
|
9
8
|
* property US-002 requires and later stories rely on.
|
|
10
9
|
*
|
|
11
|
-
* The hooks family
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
10
|
+
* The hooks family checks `.claude/settings.json` (presence, validity and
|
|
11
|
+
* required command-hook events), Codex and Grok hook wiring, and the runtime
|
|
12
|
+
* probe. The default registry below also registers the other families (hook
|
|
13
|
+
* engine, jq, sync health, integrations, bots, search index and more).
|
|
15
14
|
*/
|
|
16
15
|
import type { CheckContext, CheckFamily, FamilyRun } from "./types.js";
|
|
17
16
|
/**
|
|
@@ -44,7 +43,7 @@ export declare class DoctorRegistry {
|
|
|
44
43
|
/** Run every family in order and collect grouped results. */
|
|
45
44
|
run(context: CheckContext): Promise<FamilyRun[]>;
|
|
46
45
|
}
|
|
47
|
-
/** The id of the hooks family
|
|
46
|
+
/** The id of the hooks family, the first family the default registry runs. */
|
|
48
47
|
export declare const HOOKS_FAMILY_ID = "hooks";
|
|
49
48
|
/**
|
|
50
49
|
* The hooks check family. US-002 shipped the skeleton (Claude settings presence
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The doctor engine — an ordered set of check families — and the
|
|
3
|
-
* (hooks).
|
|
2
|
+
* The doctor engine — an ordered set of check families — and the hooks family.
|
|
4
3
|
*
|
|
5
4
|
* The engine is deliberately ignorant of any specific family: `register`
|
|
6
5
|
* accepts any object implementing {@link CheckFamily}, and `run` iterates them
|
|
@@ -8,10 +7,10 @@
|
|
|
8
7
|
* added by registering it — never by editing this class — which is exactly the
|
|
9
8
|
* property US-002 requires and later stories rely on.
|
|
10
9
|
*
|
|
11
|
-
* The hooks family
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
10
|
+
* The hooks family checks `.claude/settings.json` (presence, validity and
|
|
11
|
+
* required command-hook events), Codex and Grok hook wiring, and the runtime
|
|
12
|
+
* probe. The default registry below also registers the other families (hook
|
|
13
|
+
* engine, jq, sync health, integrations, bots, search index and more).
|
|
15
14
|
*/
|
|
16
15
|
import * as fs from "node:fs";
|
|
17
16
|
import { hookEngineFamily } from './checks/hook-engine.js';
|
|
@@ -88,7 +87,7 @@ export class DoctorRegistry {
|
|
|
88
87
|
return runs;
|
|
89
88
|
}
|
|
90
89
|
}
|
|
91
|
-
/** The id of the hooks family
|
|
90
|
+
/** The id of the hooks family, the first family the default registry runs. */
|
|
92
91
|
export const HOOKS_FAMILY_ID = "hooks";
|
|
93
92
|
/**
|
|
94
93
|
* The hooks check family. US-002 shipped the skeleton (Claude settings presence
|
|
@@ -22,25 +22,24 @@
|
|
|
22
22
|
* output carries no ANSI escape sequences at all, so a run piped to a file
|
|
23
23
|
* or consumed by CI has the same information content as an interactive one.
|
|
24
24
|
*
|
|
25
|
-
* The platform field
|
|
26
|
-
*
|
|
27
|
-
*
|
|
25
|
+
* The platform field comes from host platform detection (`detectPlatform` in
|
|
26
|
+
* ./platform.ts), which the command layer passes in through the `platform`
|
|
27
|
+
* option. {@link UNKNOWN_PLATFORM} is the fallback when no platform is given.
|
|
28
28
|
*/
|
|
29
29
|
import { type CheckResult, type DoctorStatus, type FamilyRun } from "./types.js";
|
|
30
30
|
/**
|
|
31
|
-
* The detected agent platform and the evidence for the verdict.
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
* change here.
|
|
31
|
+
* The detected agent platform and the evidence for the verdict. Host platform
|
|
32
|
+
* detection (`detectPlatform` in ./platform.ts) produces it and the report
|
|
33
|
+
* passes it through unchanged. `evidence` is typed `unknown` so the detector
|
|
34
|
+
* owns its signal shape.
|
|
36
35
|
*/
|
|
37
36
|
export interface DoctorPlatform {
|
|
38
37
|
/** Platform id, e.g. `claude-code-cli`, `codex`, `grok`, or `unknown`. */
|
|
39
38
|
id: string;
|
|
40
|
-
/** Evidence that led to the verdict. Shape owned by
|
|
39
|
+
/** Evidence that led to the verdict. Shape owned by the platform detector. */
|
|
41
40
|
evidence?: unknown;
|
|
42
41
|
}
|
|
43
|
-
/** The
|
|
42
|
+
/** The fallback platform used when the caller passes no detected platform. */
|
|
44
43
|
export declare const UNKNOWN_PLATFORM: DoctorPlatform;
|
|
45
44
|
/** Per-status tallies across every result of a run. */
|
|
46
45
|
export type StatusCounts = Record<DoctorStatus, number>;
|
|
@@ -22,14 +22,14 @@
|
|
|
22
22
|
* output carries no ANSI escape sequences at all, so a run piped to a file
|
|
23
23
|
* or consumed by CI has the same information content as an interactive one.
|
|
24
24
|
*
|
|
25
|
-
* The platform field
|
|
26
|
-
*
|
|
27
|
-
*
|
|
25
|
+
* The platform field comes from host platform detection (`detectPlatform` in
|
|
26
|
+
* ./platform.ts), which the command layer passes in through the `platform`
|
|
27
|
+
* option. {@link UNKNOWN_PLATFORM} is the fallback when no platform is given.
|
|
28
28
|
*/
|
|
29
29
|
import { Chalk } from "chalk";
|
|
30
30
|
import { DOCTOR_STATUSES, } from "./types.js";
|
|
31
31
|
import { FIXTURE_COVERAGE_CHECK_ID } from "./fixtures/discover.js";
|
|
32
|
-
/** The
|
|
32
|
+
/** The fallback platform used when the caller passes no detected platform. */
|
|
33
33
|
export const UNKNOWN_PLATFORM = { id: "unknown" };
|
|
34
34
|
/**
|
|
35
35
|
* The statuses that fail the command. This is the whole exit-code contract:
|