@indigoai-us/hq-cli 5.345.251 → 5.345.252
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 +112 -0
- package/assets/scaffold/core/scripts/hq-session.sh +9 -0
- package/contracts/host-canary-release.json +9 -3
- package/dist/command-catalog.generated.d.ts +121 -1
- package/dist/command-catalog.generated.js +148 -1
- package/dist/commands/bot.js +7 -2
- package/dist/commands/core-bucket-c-work-mesh-offer-native.js +1 -1
- package/dist/commands/core-hq-session-binding.d.ts +140 -0
- package/dist/commands/core-hq-session-binding.js +363 -0
- package/dist/commands/core-hq-session-native.d.ts +23 -0
- package/dist/commands/core-hq-session-native.js +59 -9
- package/dist/commands/core-stop-autosave.js +1 -1
- package/dist/commands/core.js +10 -0
- package/dist/commands/doctor.d.ts +5 -1
- package/dist/commands/doctor.js +42 -5
- package/dist/commands/files.js +1 -1
- package/dist/commands/install-global.js +4 -2
- package/dist/commands/logout.js +4 -0
- package/dist/commands/ontology-graph.d.ts +2 -0
- package/dist/commands/ontology-graph.js +33 -0
- package/dist/commands/report.js +35 -2
- package/dist/commands/storage-gate.js +1 -1
- package/dist/commands/vault-retention-flag.js +2 -1
- package/dist/commands/whoami.js +1 -1
- package/dist/hq-cloud-sync-runner/bin/sync-runner.js +238 -221
- package/dist/hq-cloud-sync-runner/package.json +1 -1
- package/dist/index.js +3 -1
- package/dist/lib/agent-kit/inbox-poll-backoff-flag.js +1 -1
- package/dist/lib/agent-kit/mcp/tools.js +48 -0
- package/dist/lib/bot/fleet-bots-update-pass.js +1 -1
- package/dist/lib/bot/fleet-cron.d.ts +35 -0
- package/dist/lib/bot/fleet-cron.js +54 -12
- package/dist/lib/bot/fleet-local.d.ts +18 -0
- package/dist/lib/bot/fleet-local.js +51 -5
- package/dist/lib/bot/inbox-poll-backoff-flag.js +1 -1
- package/dist/lib/bot/signals-engine-flag.d.ts +1 -1
- package/dist/lib/bot/signals-engine-flag.js +1 -1
- package/dist/lib/cli-invite-nudge.js +1 -1
- package/dist/lib/client-version.d.ts +2 -0
- package/dist/lib/client-version.js +24 -0
- package/dist/lib/company-flag-gate.d.ts +30 -0
- package/dist/lib/company-flag-gate.js +104 -0
- package/dist/lib/core-utils/hook-timeout-debug-context-flag.js +1 -1
- package/dist/lib/daemon/flag.js +2 -1
- package/dist/lib/daemon/legacy-journal-gate.js +3 -1
- package/dist/lib/daemon/shared-flag-reads.js +1 -1
- package/dist/lib/doctor/checks/host-core.js +22 -4
- package/dist/lib/doctor/checks/jq.d.ts +27 -6
- package/dist/lib/doctor/checks/jq.js +46 -8
- package/dist/lib/doctor/client-health-reason-codes-flag.js +1 -1
- package/dist/lib/doctor/fix/refresh-sync-handoff.d.ts +1 -1
- package/dist/lib/doctor/fix/refresh-sync-handoff.js +1 -1
- package/dist/lib/flag-client-gate-headers.d.ts +38 -0
- package/dist/lib/flag-client-gate-headers.js +62 -0
- package/dist/lib/flag-client-headers.d.ts +15 -0
- package/dist/lib/flag-client-headers.js +25 -0
- 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/flag-registry-worker.js +35 -0
- package/dist/lib/flag-registry.d.ts +1 -20
- package/dist/lib/flag-registry.js +5 -81
- package/dist/lib/hook-engine/adapter-core-pin.d.ts +29 -0
- package/dist/lib/hook-engine/adapter-core-pin.js +29 -0
- package/dist/lib/hook-engine/coverage.d.ts +50 -1
- package/dist/lib/hook-engine/coverage.js +111 -7
- package/dist/lib/hook-engine/reconcile.js +3 -2
- package/dist/lib/hot-channels/prompts/signals-pass.md +20 -0
- package/dist/lib/hot-channels/signal-changes.d.ts +228 -0
- package/dist/lib/hot-channels/signal-changes.js +683 -0
- package/dist/lib/hot-channels/signals-pass.d.ts +24 -0
- package/dist/lib/hot-channels/signals-pass.js +232 -12
- package/dist/lib/lanes/outpost-worktree-pruner-flag.d.ts +1 -1
- package/dist/lib/lanes/outpost-worktree-pruner-flag.js +1 -1
- package/dist/lib/lanes/registry-flag.js +2 -1
- package/dist/lib/lanes/spawn.js +11 -1
- package/dist/lib/mesh/live/binding-intent.d.ts +61 -0
- package/dist/lib/mesh/live/binding-intent.js +201 -0
- package/dist/lib/mesh/live/binding-receipt.d.ts +157 -0
- package/dist/lib/mesh/live/binding-receipt.js +365 -0
- package/dist/lib/mesh/live/company-flag-refresh.js +1 -1
- package/dist/lib/mesh/live/daemon/doctor-telemetry.d.ts +39 -0
- package/dist/lib/mesh/live/daemon/doctor-telemetry.js +58 -0
- package/dist/lib/mesh/live/daemon/install.js +2 -1
- package/dist/lib/mesh/live/daemon/presence.js +9 -0
- package/dist/lib/mesh/live/daemon/run.d.ts +3 -0
- package/dist/lib/mesh/live/daemon/run.js +33 -1
- package/dist/lib/ontology-graph/lineage/index.d.ts +401 -0
- package/dist/lib/ontology-graph/lineage/index.js +1027 -0
- package/dist/lib/ontology-graph/model/index.d.ts +54 -0
- package/dist/lib/ontology-graph/model/index.js +112 -0
- package/dist/lib/ontology-graph/model/pass-tasks.d.ts +75 -0
- package/dist/lib/ontology-graph/model/pass-tasks.js +166 -0
- package/dist/lib/ontology-graph/model/pass.d.ts +6 -0
- package/dist/lib/ontology-graph/model/pass.js +9 -2
- package/dist/lib/ontology-graph/model/pending-items.d.ts +8 -0
- package/dist/lib/ontology-graph/model/pending-items.js +24 -1
- package/dist/lib/ontology-graph/model/step.d.ts +1 -1
- package/dist/lib/ontology-graph/model/tasks.d.ts +11 -3
- package/dist/lib/ontology-graph/model/tasks.js +20 -7
- package/dist/lib/ontology-graph/read/brief.js +41 -6
- package/dist/lib/ontology-graph/read/index.d.ts +4 -0
- package/dist/lib/ontology-graph/read/index.js +173 -29
- package/dist/lib/ontology-graph/read/lineage.d.ts +101 -0
- package/dist/lib/ontology-graph/read/lineage.js +262 -0
- package/dist/lib/ontology-graph/replay/buffered-store.js +17 -0
- package/dist/lib/ontology-graph/replay/engine.d.ts +32 -1
- package/dist/lib/ontology-graph/replay/engine.js +213 -8
- package/dist/lib/ontology-graph/replay/extractors.d.ts +26 -0
- package/dist/lib/ontology-graph/replay/extractors.js +25 -1
- package/dist/lib/ontology-graph/replay/index.d.ts +2 -0
- package/dist/lib/ontology-graph/replay/index.js +9 -3
- package/dist/lib/ontology-graph/replay/signal-changes.d.ts +118 -0
- package/dist/lib/ontology-graph/replay/signal-changes.js +687 -0
- package/dist/lib/ontology-graph/schema/decision-status.d.ts +18 -0
- package/dist/lib/ontology-graph/schema/decision-status.js +20 -0
- package/dist/lib/ontology-graph/schema/index.d.ts +1 -0
- package/dist/lib/ontology-graph/schema/index.js +1 -0
- package/dist/lib/ontology-graph/setup/index.js +13 -3
- package/dist/lib/search-index/index.d.ts +33 -1
- package/dist/lib/search-index/index.js +180 -25
- package/dist/lib/search-index/qmd-exit-diagnostics.d.ts +7 -0
- package/dist/lib/search-index/qmd-exit-diagnostics.js +25 -1
- package/dist/lib/signals/adapters-catalog.js +1 -1
- package/dist/lib/sync-core/engine-holds.d.ts +1 -0
- package/dist/lib/sync-core/engine-holds.js +26 -0
- package/dist/lib/sync-core/engine-home.d.ts +3 -0
- package/dist/lib/sync-core/engine-home.js +41 -1
- package/dist/lib/sync-core/flag.js +2 -1
- package/dist/lib/sync-core/legacy-journal-export-child.js +5 -3
- package/dist/lib/sync-core/legacy-journal-export.d.ts +23 -4
- package/dist/lib/sync-core/legacy-journal-export.js +120 -55
- package/dist/lib/sync-core/reconcile.d.ts +2 -1
- package/dist/lib/sync-core/reconcile.js +30 -5
- package/dist/lib/sync-invalid-entity-warning.js +2 -1
- package/dist/lib/windows/install-followup.d.ts +41 -0
- package/dist/lib/windows/install-followup.js +87 -0
- package/dist/lib/windows/jq.d.ts +59 -0
- package/dist/lib/windows/jq.js +154 -3
- package/dist/lib/windows/user-path.d.ts +5 -0
- package/dist/lib/windows/user-path.js +1 -1
- package/dist/lib/work-context/auto-bind.d.ts +12 -0
- package/dist/lib/work-context/auto-bind.js +49 -3
- package/dist/lib/work-context/organize.d.ts +4 -2
- package/dist/lib/work-context/organize.js +18 -8
- package/dist/lib/work-context/reconcile.js +16 -1
- package/dist/main.js +12 -1
- package/dist/utils/client-health-contract.d.ts +30 -0
- package/dist/utils/client-health-contract.js +111 -0
- package/dist/utils/client-health.d.ts +5 -2
- package/dist/utils/client-health.js +74 -5
- package/dist/utils/exclusive-lock.d.ts +5 -1
- package/dist/utils/exclusive-lock.js +9 -2
- package/dist/utils/host-registration.d.ts +7 -0
- package/dist/utils/host-registration.js +10 -1
- package/dist/utils/pid.d.ts +31 -0
- package/dist/utils/pid.js +65 -0
- package/dist/utils/resident-package-preload.js +12 -4
- package/dist/utils/sentry-fingerprint.js +3 -0
- package/package.json +8 -8
- package/scripts/install-hook-engine.mjs +5 -3
|
@@ -6,7 +6,7 @@ import { createRequire } from "node:module";
|
|
|
6
6
|
import { spawn, spawnSync } from "node:child_process";
|
|
7
7
|
import { awkCannotOpenFileDiagnostic } from "../lib/core-utils/awk-diagnostics.js";
|
|
8
8
|
import { shellDisplayPath } from "../lib/core-utils/shell-display-path.js";
|
|
9
|
-
import { SESSION_ID_ENV_KEYS, validSessionId, resolveSessionId as resolveSharedSessionId } from "../lib/core-utils/session-id.js";
|
|
9
|
+
import { SESSION_ID_ENV_KEYS, sessionIdFromEnv, validSessionId, resolveSessionId as resolveSharedSessionId } from "../lib/core-utils/session-id.js";
|
|
10
10
|
export const HQ_SESSION_ASSET = "core/scripts/hq-session.sh";
|
|
11
11
|
const requireSessionDependency = createRequire(import.meta.url);
|
|
12
12
|
export const HQ_SESSION_HELP = [
|
|
@@ -28,6 +28,12 @@ export const HQ_SESSION_HELP = [
|
|
|
28
28
|
"Global option (before the subcommand):",
|
|
29
29
|
" --session-id <id> operate on this session instead of the resolved one",
|
|
30
30
|
].join("\n") + "\n";
|
|
31
|
+
/** How `sessionOverride || resolveSessionId(...)` found its id. */
|
|
32
|
+
function sessionVia(sessionOverride, env) {
|
|
33
|
+
if (sessionOverride)
|
|
34
|
+
return "flag";
|
|
35
|
+
return sessionIdFromEnv(env) ? "env" : "current";
|
|
36
|
+
}
|
|
31
37
|
const defaultDependencies = () => ({
|
|
32
38
|
env: process.env,
|
|
33
39
|
now: () => new Date(),
|
|
@@ -136,7 +142,7 @@ function isRegisteredCompany(root, slug, deps) {
|
|
|
136
142
|
return false;
|
|
137
143
|
}
|
|
138
144
|
}
|
|
139
|
-
function withCompanyLock(root, sessionId, action) {
|
|
145
|
+
export function withCompanyLock(root, sessionId, action) {
|
|
140
146
|
const lock = path.join(root, "workspace", "sessions", sessionId, ".company-lock-set.lock");
|
|
141
147
|
const deadline = Date.now() + 30_000;
|
|
142
148
|
while (true) {
|
|
@@ -566,6 +572,15 @@ function mintScopeCapability(root, sessionId, companies, deps, includeSet = fals
|
|
|
566
572
|
}
|
|
567
573
|
/** In-process command body, with injectable file access for parity tests. */
|
|
568
574
|
export function executeHqSession(argv, context, overrides = {}) {
|
|
575
|
+
// The result keeps the shell's shape (code, stdout, stderr) for parity.
|
|
576
|
+
const { code, stdout, stderr } = executeHqSessionTargeted(argv, context, overrides);
|
|
577
|
+
return { code, stdout, stderr };
|
|
578
|
+
}
|
|
579
|
+
/**
|
|
580
|
+
* {@link executeHqSession}, plus the session a successful company change
|
|
581
|
+
* wrote and how it was found, for the binding receipt.
|
|
582
|
+
*/
|
|
583
|
+
export function executeHqSessionTargeted(argv, context, overrides = {}) {
|
|
569
584
|
const deps = { ...defaultDependencies(), ...overrides };
|
|
570
585
|
const root = context.hqRoot || context.cwd;
|
|
571
586
|
let sessionOverride = "";
|
|
@@ -687,7 +702,10 @@ export function executeHqSession(argv, context, overrides = {}) {
|
|
|
687
702
|
const workMeshOutput = primaryChanged
|
|
688
703
|
? registerWorkMeshCompany(root, sessionId, next[0], updatedText, context.cwd, deps)
|
|
689
704
|
: { stdout: "", stderr: "" };
|
|
690
|
-
return {
|
|
705
|
+
return {
|
|
706
|
+
code: 0, stdout: stdout + workMeshOutput.stdout, stderr: workMeshOutput.stderr,
|
|
707
|
+
target: { sessionId, via: sessionVia(sessionOverride, deps.env) },
|
|
708
|
+
};
|
|
691
709
|
}
|
|
692
710
|
catch (error) {
|
|
693
711
|
const message = error instanceof Error ? error.message : String(error);
|
|
@@ -696,7 +714,9 @@ export function executeHqSession(argv, context, overrides = {}) {
|
|
|
696
714
|
});
|
|
697
715
|
}
|
|
698
716
|
const key = args[0] ?? "";
|
|
699
|
-
|
|
717
|
+
// `personal` in any letter case is the no-company scope, as hq-session.sh
|
|
718
|
+
// folds it and the CLI's session readers read it: never a company named PERSONAL.
|
|
719
|
+
const value = key === "company_slug" && /^personal$/i.test(args[1] ?? "") ? "personal" : (args[1] ?? "");
|
|
700
720
|
if (!key || args.length < 2)
|
|
701
721
|
return { code: 1, stdout: "", stderr: "usage: hq-session.sh set <key> <value>\n" };
|
|
702
722
|
if (key === "company_slugs")
|
|
@@ -772,7 +792,10 @@ export function executeHqSession(argv, context, overrides = {}) {
|
|
|
772
792
|
cwd: deps.env.PWD || context.cwd,
|
|
773
793
|
metadata: updatedText,
|
|
774
794
|
}, deps);
|
|
775
|
-
return {
|
|
795
|
+
return {
|
|
796
|
+
code: 0, stdout: stdout + workMeshOutput.stdout, stderr: workMeshOutput.stderr,
|
|
797
|
+
target: { sessionId, via: sessionVia(sessionOverride, deps.env) },
|
|
798
|
+
};
|
|
776
799
|
}
|
|
777
800
|
catch (error) {
|
|
778
801
|
const message = error instanceof Error ? error.message : String(error);
|
|
@@ -781,9 +804,18 @@ export function executeHqSession(argv, context, overrides = {}) {
|
|
|
781
804
|
}
|
|
782
805
|
/** Signature consumed by the lightweight fast-core dispatcher. */
|
|
783
806
|
export async function runHqSessionFast(argv, _stdin, cwd, hqRoot) {
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
807
|
+
// Every leading --session-id, as executeHqSessionTargeted reads them (the
|
|
808
|
+
// last one wins): a doubled flag must not hide the subcommand.
|
|
809
|
+
let first = 0;
|
|
810
|
+
while (first < argv.length) {
|
|
811
|
+
if (argv[first] === "--session-id")
|
|
812
|
+
first += 2;
|
|
813
|
+
else if (argv[first]?.startsWith("--session-id="))
|
|
814
|
+
first += 1;
|
|
815
|
+
else
|
|
816
|
+
break;
|
|
817
|
+
}
|
|
818
|
+
const commandArgs = argv.slice(first);
|
|
787
819
|
const needsMultiCompanyFlag = commandArgs[0] === "add"
|
|
788
820
|
|| (commandArgs[0] === "get" && commandArgs[1] === "company_slugs");
|
|
789
821
|
let enabled = false;
|
|
@@ -794,11 +826,29 @@ export async function runHqSessionFast(argv, _stdin, cwd, hqRoot) {
|
|
|
794
826
|
]);
|
|
795
827
|
enabled = await fastFlagEnabledDefaultOn(MULTI_COMPANY_SESSION_LOCK_FLAG);
|
|
796
828
|
}
|
|
797
|
-
const result =
|
|
829
|
+
const result = executeHqSessionTargeted(argv, { cwd, hqRoot }, { multiCompanyLockEnabled: enabled });
|
|
798
830
|
if (result.stdout)
|
|
799
831
|
process.stdout.write(result.stdout);
|
|
800
832
|
if (result.stderr)
|
|
801
833
|
process.stderr.write(result.stderr);
|
|
834
|
+
// A company change that succeeded leaves a dated binding receipt. Loaded
|
|
835
|
+
// only for those commands, so other calls keep the fast path's cost.
|
|
836
|
+
if (result.code === 0 && ["set", "add", "remove"].includes(commandArgs[0] ?? "") &&
|
|
837
|
+
["company_slug", "company"].includes(commandArgs[1] ?? "")) {
|
|
838
|
+
try {
|
|
839
|
+
const { recordSessionBinding } = await import("./core-hq-session-binding.js");
|
|
840
|
+
// The session this command wrote, never a second lookup of .current,
|
|
841
|
+
// and only when --session-id named it: an inherited environment can
|
|
842
|
+
// name a parent session (hq-session.sh always forwards --session-id).
|
|
843
|
+
recordSessionBinding(argv, { cwd, hqRoot }, {
|
|
844
|
+
target: result.target ?? null,
|
|
845
|
+
withCompanyLock: (sessionId, action) => withCompanyLock(hqRoot || cwd, sessionId, action),
|
|
846
|
+
});
|
|
847
|
+
}
|
|
848
|
+
catch {
|
|
849
|
+
// No receipt. The command itself succeeded.
|
|
850
|
+
}
|
|
851
|
+
}
|
|
802
852
|
return result.code;
|
|
803
853
|
}
|
|
804
854
|
//# sourceMappingURL=core-hq-session-native.js.map
|
|
@@ -2,7 +2,7 @@ import * as fs from "node:fs";
|
|
|
2
2
|
import * as os from "node:os";
|
|
3
3
|
import * as path from "node:path";
|
|
4
4
|
import { spawnSync } from "node:child_process";
|
|
5
|
-
import { createFlagClient } from "
|
|
5
|
+
import { createHqFlagClient as createFlagClient } from "../lib/flag-client-headers.js";
|
|
6
6
|
import { loadCachedTokens } from "@indigoai-us/hq-cloud";
|
|
7
7
|
import { resolveFlagRegistryEndpoint } from "../lib/flag-registry-endpoint.js";
|
|
8
8
|
import { executeHqSession } from "./core-hq-session-native.js";
|
package/dist/commands/core.js
CHANGED
|
@@ -30,6 +30,8 @@
|
|
|
30
30
|
*/
|
|
31
31
|
import { Option } from "commander";
|
|
32
32
|
import { registerCoreHookRegistrationPlan } from "./core-hook-registration-plan.js";
|
|
33
|
+
import { recordSessionBinding, scriptSessionTarget } from "./core-hq-session-binding.js";
|
|
34
|
+
import { withCompanyLock } from "./core-hq-session-native.js";
|
|
33
35
|
import { registerCoreCheckpointCommand } from "./core-checkpoint.js";
|
|
34
36
|
import { registerCoreStopAutosave } from "./core-stop-autosave.js";
|
|
35
37
|
import { runHookEnginePath } from '../hook-engine-path.js';
|
|
@@ -428,6 +430,14 @@ function runEntry(entry, scope, args) {
|
|
|
428
430
|
// caller's contract.
|
|
429
431
|
if (code !== 0)
|
|
430
432
|
process.exit(code);
|
|
433
|
+
if (entry.asset === "core/scripts/hq-session.sh") {
|
|
434
|
+
// A company change that succeeded leaves a dated binding receipt, for the
|
|
435
|
+
// session the script was named (--session-id or the environment) only.
|
|
436
|
+
recordSessionBinding(args, { cwd, hqRoot }, {
|
|
437
|
+
target: scriptSessionTarget(args),
|
|
438
|
+
withCompanyLock: (sessionId, action) => withCompanyLock(hqRoot || cwd, sessionId, action),
|
|
439
|
+
});
|
|
440
|
+
}
|
|
431
441
|
}
|
|
432
442
|
function expectedUserError(message) {
|
|
433
443
|
return Object.assign(new Error(message), { expected: true });
|
|
@@ -25,6 +25,8 @@ import { Command } from "commander";
|
|
|
25
25
|
import { type DoctorRegistry } from "../lib/doctor/registry.js";
|
|
26
26
|
import type { FamilyRun } from "../lib/doctor/types.js";
|
|
27
27
|
import { type DoctorPlatform } from "../lib/doctor/report.js";
|
|
28
|
+
import type { CheckResult } from "../lib/doctor/types.js";
|
|
29
|
+
import { type EnsureJqResult } from "../lib/windows/jq.js";
|
|
28
30
|
import { type TempHomeSweepResult } from "../lib/doctor/temp-home-sweeper.js";
|
|
29
31
|
/**
|
|
30
32
|
* Marker directories that identify an HQ tree root. A directory is an HQ root
|
|
@@ -133,7 +135,9 @@ export interface DoctorCommandDeps {
|
|
|
133
135
|
sweepTempHomes?: (options: {
|
|
134
136
|
dryRun: boolean;
|
|
135
137
|
}) => TempHomeSweepResult;
|
|
136
|
-
|
|
138
|
+
ensureWindowsJq?: () => Promise<EnsureJqResult | undefined>;
|
|
139
|
+
/** The closing check of --fix-jq: jq.on-path against the stored Windows PATH. */
|
|
140
|
+
verifyJq?: () => CheckResult[];
|
|
137
141
|
}
|
|
138
142
|
/** Text report for `hq doctor --sweep-temp-homes`. */
|
|
139
143
|
export declare function renderTempHomeSweepText(result: TempHomeSweepResult): string;
|
package/dist/commands/doctor.js
CHANGED
|
@@ -33,7 +33,8 @@ import { DEEP_FAMILY_ID, DEEP_FAMILY_TITLE, runDeepGuardTests, } from "../lib/do
|
|
|
33
33
|
import { PARITY_FAMILY_ID, PARITY_FAMILY_TITLE, runParityReplay, } from "../lib/doctor/deep/parity.js";
|
|
34
34
|
import { applyFixes } from "../lib/doctor/fix/apply.js";
|
|
35
35
|
import { renderDoctorFixJson } from "../lib/doctor/fix/json-output.js";
|
|
36
|
-
import {
|
|
36
|
+
import { verifyJqForNewSessions } from "../lib/doctor/checks/jq.js";
|
|
37
|
+
import { ensureWindowsJq, jqRemainingStep } from "../lib/windows/jq.js";
|
|
37
38
|
import { clientHealthCheckStatusEnabled as isActiveCompanyClientHealthCheckStatusEnabled, clientHealthCheckStatusEnabledForCompany, clientHealthReasonCodesEnabled as isActiveCompanyClientHealthReasonCodesEnabled, clientHealthReasonCodesEnabledForCompany, } from "../lib/doctor/client-health-reason-codes-flag.js";
|
|
38
39
|
import { clientHealthCompanyScopeFromCheckId } from "../lib/doctor/checks/sync-health.js";
|
|
39
40
|
import { readCompaniesManifestMap } from "../lib/work-context/repo-remote.js";
|
|
@@ -356,7 +357,7 @@ export function registerDoctorCommand(program, deps = {}) {
|
|
|
356
357
|
.option("--company <slug>", "Company slug for integrations checks (otherwise resolves your single active company).")
|
|
357
358
|
.option("--only <families>", "Run only these comma-separated check families (e.g. hooks). Unknown names are rejected; --json then records the scope.")
|
|
358
359
|
.option("--fix", "Apply the allowlisted safe repairs (backs up first; read-only without this flag).")
|
|
359
|
-
.option("--fix-jq", "Install the verified jq required by HQ hooks on Windows.")
|
|
360
|
+
.option("--fix-jq", "Install the verified jq required by HQ hooks on Windows, add it to your PATH, and check it.")
|
|
360
361
|
.addOption(new Option("--client-health-report", "Resolve the opt-in hq-flags gate used by the client-health report hook.").hideHelp())
|
|
361
362
|
.option("--sweep-temp-homes", "Delete idle temp homes (90+ minutes untouched, not in use): tmp.* folders holding .rustup or .cargo, and hq-temp-home.* folders left by the wrapper. Reports GB freed.")
|
|
362
363
|
.option("--dry-run", "With --sweep-temp-homes, list what would be removed and delete nothing.")
|
|
@@ -370,10 +371,46 @@ export function registerDoctorCommand(program, deps = {}) {
|
|
|
370
371
|
return;
|
|
371
372
|
}
|
|
372
373
|
try {
|
|
373
|
-
const
|
|
374
|
-
if (!
|
|
374
|
+
const ensured = await (deps.ensureWindowsJq ?? ensureWindowsJq)();
|
|
375
|
+
if (!ensured)
|
|
375
376
|
throw new Error("The managed jq repair is only available on Windows.");
|
|
376
|
-
|
|
377
|
+
// Installed is not repaired (hq-cli #3716): finish with the same
|
|
378
|
+
// check `hq doctor` runs, against the PATH a new session will get.
|
|
379
|
+
const check = (deps.verifyJq ?? verifyJqForNewSessions)()[0] ?? {
|
|
380
|
+
status: "FAIL",
|
|
381
|
+
checkId: "jq.on-path",
|
|
382
|
+
message: "The jq check returned no result.",
|
|
383
|
+
};
|
|
384
|
+
const ok = check.status === "PASS";
|
|
385
|
+
const remaining = ok ? undefined : jqRemainingStep(ensured, check);
|
|
386
|
+
if (opts.json) {
|
|
387
|
+
process.stdout.write(`${JSON.stringify({
|
|
388
|
+
target: ensured.target,
|
|
389
|
+
...(ensured.sessionTarget === undefined ? {} : { sessionTarget: ensured.sessionTarget }),
|
|
390
|
+
onPath: ok,
|
|
391
|
+
userPath: ensured.path,
|
|
392
|
+
check: { status: check.status, message: check.message },
|
|
393
|
+
...(remaining === undefined ? {} : { remaining }),
|
|
394
|
+
})}\n`);
|
|
395
|
+
}
|
|
396
|
+
else if (ok) {
|
|
397
|
+
// The check can pass through another jq, or the copy beside
|
|
398
|
+
// hq.cmd, when the PATH step did not happen: say which it was.
|
|
399
|
+
const pathLine = ensured.path === "written"
|
|
400
|
+
? `Added ${ensured.dir} to your user PATH.`
|
|
401
|
+
: ensured.path === "present"
|
|
402
|
+
? `${ensured.dir} is already on your user PATH.`
|
|
403
|
+
: `HQ did not add ${ensured.dir} to your user PATH (${ensured.path}); hooks find jq at the path above.`;
|
|
404
|
+
const sessionLine = ensured.sessionTarget
|
|
405
|
+
? `Also placed at ${ensured.sessionTarget}, which terminals and Claude Code sessions that are already open can find.\n`
|
|
406
|
+
: "";
|
|
407
|
+
process.stdout.write(`Verified jq is ready at ${check.target ?? ensured.target}.\n${pathLine}\n${sessionLine}If a terminal or Claude Code session that was already open still reports jq missing, restart it.\n`);
|
|
408
|
+
}
|
|
409
|
+
else {
|
|
410
|
+
process.stderr.write(`hq doctor --fix-jq: jq is installed at ${ensured.target}, but HQ hooks will not find it yet. ${check.message}\n${remaining}\n`);
|
|
411
|
+
}
|
|
412
|
+
if (!ok)
|
|
413
|
+
process.exitCode = 1;
|
|
377
414
|
}
|
|
378
415
|
catch (error) {
|
|
379
416
|
const message = error instanceof Error ? error.message : String(error);
|
package/dist/commands/files.js
CHANGED
|
@@ -14,7 +14,7 @@ import { suggestChannels, withChannelSuggestions } from "./channel-suggest.js";
|
|
|
14
14
|
import { resolveCompanySlug, resolvePersonWithRosterFallback, } from "./people.js";
|
|
15
15
|
import { findHqRoot } from "../utils/manifest.js";
|
|
16
16
|
import { maxLength } from "../utils/table-width.js";
|
|
17
|
-
import { resolveCompanyFlagGate } from "../lib/flag-
|
|
17
|
+
import { resolveCompanyFlagGate } from "../lib/company-flag-gate.js";
|
|
18
18
|
import { raiseAccessRefresh } from "../lib/sync-core/access-refresh.js";
|
|
19
19
|
const PERSON_UID_PATTERN = /^(prs|agt)_[A-Za-z0-9_-]+$/;
|
|
20
20
|
const AGENT_UID_PATTERN = /^agt_[A-Za-z0-9_-]+$/;
|
|
@@ -31,7 +31,7 @@ import { trustCodexUserHooks } from '../utils/hook-trust.js';
|
|
|
31
31
|
import { assertProviderWrappersInstallable, installProviderWrappers, providerWrapperInstallPaths, removeProviderWrappers } from '../lib/install/provider-wrappers.js';
|
|
32
32
|
import { checkShimOnPath, ensureShimOnUserPath, npmShimDir, shimPathWarning } from '../lib/windows/user-path.js';
|
|
33
33
|
import { removeHqCliPs1Shims } from '../lib/windows/ps1-shims.js';
|
|
34
|
-
import {
|
|
34
|
+
import { ensureWindowsJq, WINDOWS_JQ_REPAIR } from '../lib/windows/jq.js';
|
|
35
35
|
import { addAgentsMdBlock, addCodexHooks, classifyLegacySkills, codexAdapterPath, codexCharterSource, codexHookTrustKeys, codexTargets, hasAllCodexHooks, HQ_OWNED_MARKER, LEGACY_BACKUP_NAME, LEGACY_SKILLS_NAME, removeAgentsMdBlock, removeCodexHooks, } from '../lib/install/codex-targets.js';
|
|
36
36
|
import { addClaudeMdBlock, addHqHooks, charterPath, claudeTargets, hasAllHqHooks, HQ_ANYWHERE_PACK, HQ_MCP_SERVER_NAME, hqSkillsSource, lineDiff, masterHookPath, shimPath, removeClaudeMdBlock, removeHqHooks, SKILL_LINK_PREFIX, } from '../lib/install/claude-targets.js';
|
|
37
37
|
export { hookTargetFor, isDaemonInstalled } from '../lib/install/hook-target.js';
|
|
@@ -1291,7 +1291,9 @@ export async function runInstallGlobal(opts) {
|
|
|
1291
1291
|
const install = runtime === 'codex' ? installGlobalCodex : installGlobalClaude;
|
|
1292
1292
|
if (process.platform === 'win32' && !opts.dryRun) {
|
|
1293
1293
|
try {
|
|
1294
|
-
|
|
1294
|
+
// Installs jq and puts it where hooks find it; a home that is not the
|
|
1295
|
+
// signed-in profile gets the file but no user PATH entry.
|
|
1296
|
+
await ensureWindowsJq({ home: opts.home });
|
|
1295
1297
|
}
|
|
1296
1298
|
catch (error) {
|
|
1297
1299
|
const message = error instanceof Error ? error.message : String(error);
|
package/dist/commands/logout.js
CHANGED
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
*/
|
|
13
13
|
import chalk from 'chalk';
|
|
14
14
|
import { clearCachedTokens, loadCachedTokens } from '@indigoai-us/hq-cloud';
|
|
15
|
+
import { clearBindingReceipts } from '../lib/mesh/live/binding-receipt.js';
|
|
15
16
|
import { retainUsageAttributionForPerson } from '../lib/work-context/config.js';
|
|
16
17
|
import { workContextRoot } from '../lib/work-context/paths.js';
|
|
17
18
|
import { DEFAULT_COGNITO } from '../utils/cognito-config.js';
|
|
@@ -30,6 +31,9 @@ export async function runLogout() {
|
|
|
30
31
|
catch (error) {
|
|
31
32
|
console.error(chalk.yellow('Could not withdraw the usage opt-in:'), error instanceof Error ? error.message : 'Unknown error');
|
|
32
33
|
}
|
|
34
|
+
// Binding receipts record which company this person bound each session
|
|
35
|
+
// to. They belong to the person signing out.
|
|
36
|
+
clearBindingReceipts();
|
|
33
37
|
const existing = loadCachedTokens();
|
|
34
38
|
if (!existing) {
|
|
35
39
|
console.log(chalk.yellow('No cached HQ session'));
|
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
* hq ontology status | reader [graph|entities] | model [<model>] (setup: what this machine reads and builds with)
|
|
9
9
|
* hq ontology rebuild --company <slug> [--from D --to D] [--resume] [--budget-tokens N] [--max-input-tokens N] [--max-output-tokens N] [--no-model] [--dry-run]
|
|
10
10
|
* hq ontology update --company <slug> [--input <path>] [--budget-tokens N] [--no-model]
|
|
11
|
+
* hq ontology lineage backfill --company <slug> [--from D --to D] [--restart] [--retry-unanswered] [--allow-unanswered] [--max-input-tokens N] [--max-output-tokens N] [--dry-run]
|
|
12
|
+
* hq ontology lineage undo --company <slug> [--graph-root <dir>] [--dry-run]
|
|
11
13
|
* hq ontology lookup <name> [--page] | neighbors <id> [--depth N] | search <text> | traverse <from> [<to>]
|
|
12
14
|
* hq ontology lint [--strict] [--coverage] | proposals list|accept|nope|undo [--set <name>] | brief [--style map|full]
|
|
13
15
|
* hq ontology org-chart draft | confirm --from <file> [--yes] | show
|
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
* hq ontology status | reader [graph|entities] | model [<model>] (setup: what this machine reads and builds with)
|
|
9
9
|
* hq ontology rebuild --company <slug> [--from D --to D] [--resume] [--budget-tokens N] [--max-input-tokens N] [--max-output-tokens N] [--no-model] [--dry-run]
|
|
10
10
|
* hq ontology update --company <slug> [--input <path>] [--budget-tokens N] [--no-model]
|
|
11
|
+
* hq ontology lineage backfill --company <slug> [--from D --to D] [--restart] [--retry-unanswered] [--allow-unanswered] [--max-input-tokens N] [--max-output-tokens N] [--dry-run]
|
|
12
|
+
* hq ontology lineage undo --company <slug> [--graph-root <dir>] [--dry-run]
|
|
11
13
|
* hq ontology lookup <name> [--page] | neighbors <id> [--depth N] | search <text> | traverse <from> [<to>]
|
|
12
14
|
* hq ontology lint [--strict] [--coverage] | proposals list|accept|nope|undo [--set <name>] | brief [--style map|full]
|
|
13
15
|
* hq ontology org-chart draft | confirm --from <file> [--yes] | show
|
|
@@ -314,6 +316,37 @@ export function registerOntologyCommand(program, deps = {}) {
|
|
|
314
316
|
throw error;
|
|
315
317
|
}
|
|
316
318
|
}));
|
|
319
|
+
const lineage = ontology.command("lineage").description("Decision lineage: which decision replaced an earlier one");
|
|
320
|
+
scoped(lineage.command("backfill"))
|
|
321
|
+
.description("Ask the model, day by day from the oldest, whether each decision with no stated change replaces or reverses an earlier open one, and write a link for each that holds (model authority, no status row; each written link is listed in .state/lineage-backfill.jsonl, and `hq ontology lineage undo` removes exactly those). A day with a decision that got no usable reply is not written: the next run sends it again, and after 3 runs it is recorded as unanswered. Exit code 2 when the walk stopped early, 3 when it finished with a decision unanswered in this run. Runs whenever it is invoked, whatever model_tasks says")
|
|
322
|
+
.option("--from <date>", "first decision day to ask about (YYYY-MM-DD)", isoDateArg)
|
|
323
|
+
.option("--to <date>", "last decision day to ask about (YYYY-MM-DD)", isoDateArg)
|
|
324
|
+
.option("--restart", "forget what earlier runs settled, their attempt counts and their unanswered decisions, and walk from the first day; answers already given cost nothing")
|
|
325
|
+
.option("--retry-unanswered", "send the decisions earlier runs recorded as unanswered again")
|
|
326
|
+
.option("--allow-unanswered", "record a decision with no usable reply as unanswered at once instead of holding its day for the next run, and do not exit non-zero for it")
|
|
327
|
+
.option("--max-input-tokens <n>", "model input tokens allowed per day for this run, counting the day's earlier runs (default 150000)", capArg)
|
|
328
|
+
.option("--max-output-tokens <n>", "model output tokens allowed per day for this run (default 20000)", capArg)
|
|
329
|
+
.option("--dry-run", "count the decisions and batches and estimate the tokens and the list-price cost as ranges, with the flags that let the estimate through the daily cap; call no model and write nothing")
|
|
330
|
+
.action(run(async (context, options) => {
|
|
331
|
+
const { lineageBackfillCommand } = await import("../lib/ontology-graph/lineage/index.js");
|
|
332
|
+
return lineageBackfillCommand(context, {
|
|
333
|
+
...(options.from ? { from: options.from } : {}),
|
|
334
|
+
...(options.to ? { to: options.to } : {}),
|
|
335
|
+
...(options.restart ? { restart: true } : {}),
|
|
336
|
+
...(options.retryUnanswered ? { retryUnanswered: true } : {}),
|
|
337
|
+
...(options.allowUnanswered ? { allowUnanswered: true } : {}),
|
|
338
|
+
...(options.maxInputTokens !== undefined ? { maxInputTokens: options.maxInputTokens } : {}),
|
|
339
|
+
...(options.maxOutputTokens !== undefined ? { maxOutputTokens: options.maxOutputTokens } : {}),
|
|
340
|
+
dryRun: Boolean(options.dryRun),
|
|
341
|
+
});
|
|
342
|
+
}));
|
|
343
|
+
scoped(lineage.command("undo"))
|
|
344
|
+
.description("Take back what `hq ontology lineage backfill` wrote: remove the rows .state/lineage-backfill.jsonl lists (each link's edge and its inverse) and clear the walk's state, so a later backfill starts from the first day. A row is removed only when the graph still holds it as the backfill wrote it; a row changed since is left and counted. No other row is touched, and no model is called")
|
|
345
|
+
.option("--dry-run", "count what would be removed and left; write nothing")
|
|
346
|
+
.action(run(async (context, options) => {
|
|
347
|
+
const { lineageUndoCommand } = await import("../lib/ontology-graph/lineage/index.js");
|
|
348
|
+
return lineageUndoCommand(context, { dryRun: Boolean(options.dryRun) });
|
|
349
|
+
}));
|
|
317
350
|
scoped(ontology.command("lookup"))
|
|
318
351
|
.description("Find an entity by name and print its facts, each with a source and date")
|
|
319
352
|
.argument("<name>", "name, alias, email or <type>/<slug>")
|
package/dist/commands/report.js
CHANGED
|
@@ -478,9 +478,39 @@ async function adoptAction(reportId, options) {
|
|
|
478
478
|
rememberReportChannelAfterSuccess(updated);
|
|
479
479
|
print(updated, options.json === true);
|
|
480
480
|
}
|
|
481
|
+
async function retireReportRecord(token, report) {
|
|
482
|
+
const res = await vaultApiFetch({
|
|
483
|
+
token,
|
|
484
|
+
path: reportPath(report.channelId, report.reportId),
|
|
485
|
+
method: "DELETE",
|
|
486
|
+
body: { revision: report.revision },
|
|
487
|
+
});
|
|
488
|
+
if (res.status === 403) {
|
|
489
|
+
throw new ReportPublishError(`Only the report's creator or a company admin can retire this report (DELETE ${reportPath(report.channelId, report.reportId)}).`, "source-invalid");
|
|
490
|
+
}
|
|
491
|
+
if (res.status === 409) {
|
|
492
|
+
const body = await res.json().catch(() => ({}));
|
|
493
|
+
if (body.error === "revision-mismatch") {
|
|
494
|
+
throw new ReportPublishError("Report changed while it was being retired; refresh and retry.", "revision-conflict");
|
|
495
|
+
}
|
|
496
|
+
throw new ReportPublishError("Could not retire the report record.", "revision-conflict");
|
|
497
|
+
}
|
|
498
|
+
if (!res.ok)
|
|
499
|
+
throw new ReportPublishError("Could not retire the report record.");
|
|
500
|
+
const body = await res.json();
|
|
501
|
+
if (body.report?.state === "decommissioned")
|
|
502
|
+
return body.report;
|
|
503
|
+
const latest = await readReportInChannel(token, report.channelId, report.reportId);
|
|
504
|
+
if (latest?.state === "decommissioned")
|
|
505
|
+
return latest;
|
|
506
|
+
throw new ReportPublishError(`Report is still ${latest?.state ?? report.state}; DELETE ${reportPath(report.channelId, report.reportId)} did not retire it.`);
|
|
507
|
+
}
|
|
481
508
|
async function decommissionAction(reportId, options) {
|
|
482
509
|
const token = await ensureCognitoToken();
|
|
483
|
-
|
|
510
|
+
let report = await resolveReport(token, reportId, options.channel);
|
|
511
|
+
if (report.state !== "decommissioned") {
|
|
512
|
+
report = await retireReportRecord(token, report);
|
|
513
|
+
}
|
|
484
514
|
const org = await orgFor(token, report);
|
|
485
515
|
const leftover = [];
|
|
486
516
|
for (const id of [report.deployAppId, report.draft?.appId]) {
|
|
@@ -501,7 +531,6 @@ async function decommissionAction(reportId, options) {
|
|
|
501
531
|
leftover.push("A deployment could not be reached.");
|
|
502
532
|
}
|
|
503
533
|
}
|
|
504
|
-
// The durable report is marked decommissioned by hq-pro before this prompt.
|
|
505
534
|
// Cleanup gaps stay on the result so a missing app or offline bot does not roll the record back.
|
|
506
535
|
if (report.jobId) {
|
|
507
536
|
try {
|
|
@@ -512,6 +541,10 @@ async function decommissionAction(reportId, options) {
|
|
|
512
541
|
}
|
|
513
542
|
}
|
|
514
543
|
const note = leftover.length ? [...new Set(leftover)].join(" ") : null;
|
|
544
|
+
if (report.state !== "decommissioned") {
|
|
545
|
+
print({ reportId: report.reportId, decommissioned: false, state: report.state, note }, options.json === true);
|
|
546
|
+
throw new ReportPublishError(`Report is still ${report.state}.`);
|
|
547
|
+
}
|
|
515
548
|
print({ reportId: report.reportId, decommissioned: true, note }, options.json === true);
|
|
516
549
|
}
|
|
517
550
|
export function registerReportCommand(program) {
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* already async; the registrar and every subcommand stay synchronous.
|
|
13
13
|
*/
|
|
14
14
|
import { Command } from "commander";
|
|
15
|
-
import { resolveCompanyFlagGate } from "../lib/flag-
|
|
15
|
+
import { resolveCompanyFlagGate } from "../lib/company-flag-gate.js";
|
|
16
16
|
import { HQ_STORAGE_FLAG, STORAGE_FEATURE_DISABLED_MESSAGE, storageFeatureDisabledJson, storageFeatureEnabledFromCache, hideStorageInCatalog, } from "../lib/storage-feature-flag.js";
|
|
17
17
|
const MEMBERSHIP_TIMEOUT_MS = 3_000;
|
|
18
18
|
async function defaultToken() {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { resolveCompanyFlagGate
|
|
1
|
+
import { resolveCompanyFlagGate } from "../lib/company-flag-gate.js";
|
|
2
|
+
import { resolveProcessFlagGate } from "../lib/flag-registry.js";
|
|
2
3
|
export const VAULT_RETENTION_SETTINGS_FLAG = "cli.vault-retention-settings";
|
|
3
4
|
export function vaultRetentionSettingsEnabled(companyUid, idToken) {
|
|
4
5
|
if (companyUid && idToken) {
|
package/dist/commands/whoami.js
CHANGED
|
@@ -6,7 +6,7 @@ import { loadCachedTokens, isExpiring, loadMachineCreds, } from '@indigoai-us/hq
|
|
|
6
6
|
import { buildWhoamiIdentity, peekWhoamiTokenIdentity as peekIdToken, resolveWhoamiIdentity, } from "../utils/whoami-identity.js";
|
|
7
7
|
import { ensureCognitoToken, loadMachineCachedTokens, resolveCognitoTokenSource, } from "../utils/cognito-session.js";
|
|
8
8
|
import { colorizePlanLimitNotice, fetchPlanLimitStatus, renderPlanLine, renderPlanLimitNotice, } from "../lib/billing/plan-lock.js";
|
|
9
|
-
import { resolveCompanyFlagGate, } from "../lib/flag-
|
|
9
|
+
import { resolveCompanyFlagGate, } from "../lib/company-flag-gate.js";
|
|
10
10
|
import { queuePlanLimitInviteTeammateExposure } from "../utils/cli-telemetry.js";
|
|
11
11
|
import { resolveCallerPersonUid } from "../utils/vault-api.js";
|
|
12
12
|
import { printDeletedCompanyNotices } from "../utils/deleted-company-notice.js";
|