@indigoai-us/hq-cli 5.323.0 → 5.325.0
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 +11 -1
- package/dist/bin/hq-auth-refresh.d.ts +5 -1
- package/dist/bin/hq-auth-refresh.js +33 -1
- package/dist/command-catalog.generated.d.ts +125 -6
- package/dist/command-catalog.generated.js +162 -6
- package/dist/command-registration-plan.d.ts +24 -0
- package/dist/command-registration-plan.js +4 -0
- package/dist/commands/anywhere-runtime-flag.d.ts +9 -0
- package/dist/commands/anywhere-runtime-flag.js +22 -0
- package/dist/commands/core-derive-trigger-facts-native.js +37 -3
- package/dist/commands/daemon.js +39 -2
- package/dist/commands/db-provision.js +6 -1
- package/dist/commands/doctor.js +8 -4
- package/dist/commands/feedback.d.ts +2 -0
- package/dist/commands/feedback.js +10 -0
- package/dist/commands/install-global.d.ts +46 -0
- package/dist/commands/install-global.js +674 -0
- package/dist/commands/link.d.ts +30 -0
- package/dist/commands/link.js +184 -0
- package/dist/commands/mcp-status.d.ts +6 -0
- package/dist/commands/mcp-status.js +21 -4
- package/dist/commands/pkg-install.js +20 -1
- package/dist/commands/update.d.ts +19 -0
- package/dist/commands/update.js +52 -6
- package/dist/fast-core.d.ts +2 -1
- package/dist/fast-core.js +12 -8
- package/dist/index.js +9 -7
- package/dist/lib/core-utils/timeout-guard-native-flags.d.ts +6 -0
- package/dist/lib/core-utils/timeout-guard-native-flags.js +30 -0
- package/dist/lib/core-utils/timeout-guard-native.d.ts +0 -3
- package/dist/lib/core-utils/timeout-guard-native.js +4 -30
- package/dist/lib/core-utils/timeout-guard.d.ts +2 -0
- package/dist/lib/core-utils/timeout-guard.js +2 -1
- package/dist/lib/daemon/convergence.d.ts +42 -0
- package/dist/lib/daemon/convergence.js +66 -0
- package/dist/lib/daemon/heartbeat.d.ts +43 -0
- package/dist/lib/daemon/heartbeat.js +70 -0
- package/dist/lib/daemon/ops/journal.d.ts +29 -0
- package/dist/lib/daemon/ops/journal.js +141 -0
- package/dist/lib/daemon/ops/memory.d.ts +20 -0
- package/dist/lib/daemon/ops/memory.js +65 -0
- package/dist/lib/daemon/ops/mesh.d.ts +38 -0
- package/dist/lib/daemon/ops/mesh.js +70 -0
- package/dist/lib/daemon/ops/policy.d.ts +78 -0
- package/dist/lib/daemon/ops/policy.js +283 -0
- package/dist/lib/daemon/protocol.d.ts +68 -0
- package/dist/lib/daemon/protocol.js +154 -0
- package/dist/lib/daemon/run.d.ts +10 -0
- package/dist/lib/daemon/run.js +85 -3
- package/dist/lib/daemon/server.d.ts +36 -0
- package/dist/lib/daemon/server.js +306 -0
- package/dist/lib/daemon/session-registry.d.ts +30 -0
- package/dist/lib/daemon/session-registry.js +42 -0
- package/dist/lib/doctor/checks/anywhere.d.ts +38 -0
- package/dist/lib/doctor/checks/anywhere.js +182 -0
- package/dist/lib/doctor/registry.js +6 -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/install/claude-targets.d.ts +47 -0
- package/dist/lib/install/claude-targets.js +203 -0
- package/dist/lib/install/codex-targets.d.ts +57 -0
- package/dist/lib/install/codex-targets.js +187 -0
- package/dist/lib/mesh/live/session-seq.js +62 -9
- package/dist/lib/registry/normalize-remote.d.ts +21 -0
- package/dist/lib/registry/normalize-remote.js +68 -0
- package/dist/lib/registry/registry.d.ts +75 -0
- package/dist/lib/registry/registry.js +261 -0
- package/dist/utils/cognito-session.d.ts +5 -1
- package/dist/utils/cognito-session.js +8 -12
- package/dist/utils/feedback-diagnostics.d.ts +2 -0
- package/dist/utils/version-check.d.ts +2 -0
- package/dist/utils/version-check.js +7 -0
- package/package.json +2 -2
package/dist/commands/daemon.js
CHANGED
|
@@ -31,6 +31,7 @@ import { processCommandLine } from "../lib/daemon/lock.js";
|
|
|
31
31
|
import { writeControlRequest } from "../lib/daemon/requests.js";
|
|
32
32
|
import { isSyncRunnerCommandLine, readWatchRunnerOwnerStatus, watchRunnerOwnerStatusPath } from "../lib/daemon/sync-runner.js";
|
|
33
33
|
import { getSyncModeForCompany, setSyncMode } from "./sync-mode.js";
|
|
34
|
+
import { requireAnywhereRuntime } from "./anywhere-runtime-flag.js";
|
|
34
35
|
import { resolveDefaultHqRoot } from "../utils/cognito-session.js";
|
|
35
36
|
class DaemonCommandError extends Error {
|
|
36
37
|
}
|
|
@@ -766,6 +767,37 @@ export function registerDaemonCommand(program, over = {}) {
|
|
|
766
767
|
hqBinary: d.hqBinary,
|
|
767
768
|
});
|
|
768
769
|
}));
|
|
770
|
+
daemon
|
|
771
|
+
.command("call <op>")
|
|
772
|
+
.description("Send one request to hqd (policy.check, journal.append, memory.get, memory.put, mesh.presence, …) and print the result as JSON")
|
|
773
|
+
.option("--json <args>", "Request args as a JSON object", "{}")
|
|
774
|
+
.option("--timeout <ms>", "Give up after this many milliseconds")
|
|
775
|
+
.action(wrap(async (d, op, opts) => {
|
|
776
|
+
requireAnywhereRuntime();
|
|
777
|
+
let args;
|
|
778
|
+
try {
|
|
779
|
+
args = JSON.parse(opts.json);
|
|
780
|
+
}
|
|
781
|
+
catch {
|
|
782
|
+
throw new Error("--json must be valid JSON");
|
|
783
|
+
}
|
|
784
|
+
if (!args || typeof args !== "object" || Array.isArray(args))
|
|
785
|
+
throw new Error("--json must be a JSON object");
|
|
786
|
+
const timeoutMs = Number(opts.timeout ?? (op === "policy.check" ? "40000" : "20000"));
|
|
787
|
+
if (!Number.isFinite(timeoutMs) || timeoutMs <= 0)
|
|
788
|
+
throw new Error("--timeout must be a positive number of milliseconds");
|
|
789
|
+
const { hqdRequest, hqdSocketPath, HqdClientError } = await import("../lib/daemon/protocol.js");
|
|
790
|
+
try {
|
|
791
|
+
const result = await hqdRequest(op, args, { socketPath: hqdSocketPath(d.home, d.env), timeoutMs });
|
|
792
|
+
d.out(JSON.stringify(result, null, 2));
|
|
793
|
+
}
|
|
794
|
+
catch (err) {
|
|
795
|
+
if (!(err instanceof HqdClientError))
|
|
796
|
+
throw err;
|
|
797
|
+
d.out(JSON.stringify({ error: { code: err.code, message: err.message } }, null, 2));
|
|
798
|
+
process.exitCode = 1;
|
|
799
|
+
}
|
|
800
|
+
}));
|
|
769
801
|
daemon
|
|
770
802
|
.command("status")
|
|
771
803
|
.description("Show the machine type and each service's state")
|
|
@@ -828,8 +860,13 @@ export function registerDaemonCommand(program, over = {}) {
|
|
|
828
860
|
.action(wrap((d, unit, opts) => runLogs(d, unit, opts)));
|
|
829
861
|
daemon
|
|
830
862
|
.command("restart [unit]")
|
|
831
|
-
.description("Restart one service, or
|
|
832
|
-
.
|
|
863
|
+
.description("Restart one service, every service, or the daemon process")
|
|
864
|
+
.option("--daemon", "Restart the supervisor process itself")
|
|
865
|
+
.action(wrap(async (d, unit, opts) => {
|
|
866
|
+
if (opts.daemon && unit)
|
|
867
|
+
throw new DaemonCommandError("--daemon cannot be combined with a service name");
|
|
868
|
+
return queueRequest(d, opts.daemon ? { action: "restart-daemon" } : unit ? { action: "restart", unit } : { action: "restart" }, opts.daemon ? "restart daemon" : unit ? `restart ${unit}` : "restart all services");
|
|
869
|
+
}));
|
|
833
870
|
daemon
|
|
834
871
|
.command("trigger <unit>")
|
|
835
872
|
.description("Run a scheduled service now (for example search-index)")
|
|
@@ -65,7 +65,12 @@ export function registerDbProvisionCommand(db, depsFactory = defaultDeps) {
|
|
|
65
65
|
throw error;
|
|
66
66
|
const msg = error instanceof Error ? error.message : "Unknown error";
|
|
67
67
|
const status = error.status;
|
|
68
|
-
|
|
68
|
+
const code = error.code;
|
|
69
|
+
if (code === "REMOTE_DB_NOT_AVAILABLE" || status === 501) {
|
|
70
|
+
console.error(chalk.red("Error:"), "Remote databases are not available yet.");
|
|
71
|
+
console.error(chalk.dim("Local hq db status|sql|migrate still work offline."));
|
|
72
|
+
}
|
|
73
|
+
else if (status === 402 || /PLAN_REQUIRED|Team plan|Workforce|\$500/i.test(msg)) {
|
|
69
74
|
console.error(chalk.red("Error:"), "Remote vault DB requires the HQ Workforce plan ($500/mo).");
|
|
70
75
|
console.error(chalk.dim("Local databases still work: hq db status|sql|migrate — no HQ Workforce plan required."));
|
|
71
76
|
}
|
package/dist/commands/doctor.js
CHANGED
|
@@ -37,6 +37,7 @@ import { isCompanyJournalSlug } from "../lib/doctor/checks/sync-health.js";
|
|
|
37
37
|
import { readCompaniesManifestMap } from "../lib/work-context/repo-remote.js";
|
|
38
38
|
import * as readline from "node:readline";
|
|
39
39
|
import { runSideEffectTests } from "../lib/doctor/deep/sandbox.js";
|
|
40
|
+
import { anywhereRuntimeEnabled } from "./anywhere-runtime-flag.js";
|
|
40
41
|
/**
|
|
41
42
|
* Marker directories that identify an HQ tree root. A directory is an HQ root
|
|
42
43
|
* only when it contains ALL of these. `.claude` + `core` are present in both
|
|
@@ -90,7 +91,8 @@ export async function runDoctor(options = {}) {
|
|
|
90
91
|
const write = options.stdout ?? ((chunk) => void process.stdout.write(chunk));
|
|
91
92
|
const writeErr = options.stderr ?? ((chunk) => void process.stderr.write(chunk));
|
|
92
93
|
const hqRoot = options.root ?? resolveHqRoot(options.cwd);
|
|
93
|
-
|
|
94
|
+
const standaloneAnywhere = !hqRoot && options.only?.length === 1 && options.only[0] === "anywhere" && anywhereRuntimeEnabled();
|
|
95
|
+
if (!hqRoot && !standaloneAnywhere) {
|
|
94
96
|
const from = options.cwd ?? process.cwd();
|
|
95
97
|
writeErr(`hq doctor: not inside an HQ tree.\n` +
|
|
96
98
|
` Searched upward from: ${from}\n` +
|
|
@@ -121,7 +123,9 @@ export async function runDoctor(options = {}) {
|
|
|
121
123
|
// The detected platform and the session id are exposed to every check so the
|
|
122
124
|
// host-specific runtime probe (US-006) can decide UNKNOWN vs FAIL vs UNTESTED.
|
|
123
125
|
const context = {
|
|
124
|
-
|
|
126
|
+
// Anywhere checks inspect ~/.hq and are intentionally runnable from a foreign
|
|
127
|
+
// repo. No other family is selected in this standalone path.
|
|
128
|
+
hqRoot: hqRoot ?? "",
|
|
125
129
|
platform: { id: platform.id, evidence: platform.evidence },
|
|
126
130
|
sessionId: options.sessionId,
|
|
127
131
|
liveRuntimes: options.liveRuntimes === true,
|
|
@@ -166,7 +170,7 @@ export async function runDoctor(options = {}) {
|
|
|
166
170
|
? await resolveClientHealthReasonCodesCheckIds(families, options.resolveClientHealthReasonCodesForCompany)
|
|
167
171
|
: undefined;
|
|
168
172
|
write(renderJson(buildDoctorJson({
|
|
169
|
-
hqRoot,
|
|
173
|
+
hqRoot: hqRoot ?? "",
|
|
170
174
|
families,
|
|
171
175
|
platform,
|
|
172
176
|
scope,
|
|
@@ -175,7 +179,7 @@ export async function runDoctor(options = {}) {
|
|
|
175
179
|
}
|
|
176
180
|
else {
|
|
177
181
|
write(renderText({
|
|
178
|
-
hqRoot,
|
|
182
|
+
hqRoot: hqRoot ?? "",
|
|
179
183
|
families,
|
|
180
184
|
platform,
|
|
181
185
|
verbose: options.verbose ?? false,
|
|
@@ -2,6 +2,8 @@ import { Command } from "commander";
|
|
|
2
2
|
import { type DiagnosticsBlob } from "../utils/feedback-diagnostics.js";
|
|
3
3
|
import { collectFeedbackLogs, feedbackLogsEnabled } from "../utils/feedback-logs.js";
|
|
4
4
|
import { type LogBundleRef } from "../utils/feedback-log-bundle.js";
|
|
5
|
+
export declare const FEEDBACK_LATEST_VERSION_FLAG = "feedback.latest-version";
|
|
6
|
+
export declare const FEEDBACK_LATEST_VERSION_FLAG_FALLBACK = false;
|
|
5
7
|
export declare const BODY_MAX_BYTES: number;
|
|
6
8
|
/** Validate fields that must be valid before feedback attachments are uploaded. */
|
|
7
9
|
export declare function validateFeedbackContent(title: string, body: string): void;
|
|
@@ -6,6 +6,10 @@ import { collectDiagnostics } from "../utils/feedback-diagnostics.js";
|
|
|
6
6
|
import { MAX_SCREENSHOTS, uploadScreenshots } from "../utils/feedback-screenshots.js";
|
|
7
7
|
import { FEEDBACK_LOGS_MAX_TOTAL_BYTES, FEEDBACK_LOGS_MIN_USEFUL_BYTES, collectFeedbackLogs, feedbackLogsEnabled, } from "../utils/feedback-logs.js";
|
|
8
8
|
import { uploadLogBundle } from "../utils/feedback-log-bundle.js";
|
|
9
|
+
import { resolveProcessFlagGate } from "../lib/flag-registry.js";
|
|
10
|
+
import { cachedLatestVersion } from "../utils/version-check.js";
|
|
11
|
+
export const FEEDBACK_LATEST_VERSION_FLAG = "feedback.latest-version";
|
|
12
|
+
export const FEEDBACK_LATEST_VERSION_FLAG_FALLBACK = false;
|
|
9
13
|
export const BODY_MAX_BYTES = 64 * 1024;
|
|
10
14
|
/** Validate fields that must be valid before feedback attachments are uploaded. */
|
|
11
15
|
export function validateFeedbackContent(title, body) {
|
|
@@ -181,6 +185,12 @@ function registerSubcommand(feedbackCmd, type) {
|
|
|
181
185
|
// diagnostics are passed through so submitFeedback does not collect
|
|
182
186
|
// them again after attachments have been uploaded.
|
|
183
187
|
const diagnostics = collectDiagnostics();
|
|
188
|
+
const includeLatestVersion = resolveProcessFlagGate(FEEDBACK_LATEST_VERSION_FLAG, { fallback: FEEDBACK_LATEST_VERSION_FLAG_FALLBACK }, () => FEEDBACK_LATEST_VERSION_FLAG_FALLBACK);
|
|
189
|
+
if (includeLatestVersion) {
|
|
190
|
+
const latestVersion = cachedLatestVersion();
|
|
191
|
+
if (latestVersion)
|
|
192
|
+
diagnostics.latestVersion = latestVersion;
|
|
193
|
+
}
|
|
184
194
|
const logsEnabled = opts.logs !== false && feedbackLogsEnabled();
|
|
185
195
|
// Validate the serialized server request envelope before screenshots
|
|
186
196
|
// or the log bundle can create remote objects. Attachment references
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { AnywhereRuntimeDisabledError } from './anywhere-runtime-flag.js';
|
|
3
|
+
export interface GlobalInstallOptions {
|
|
4
|
+
/** HQ checkout to install from (absolute). */
|
|
5
|
+
hqRoot: string;
|
|
6
|
+
/** Home directory; tests MUST pass a tmpdir. */
|
|
7
|
+
home?: string;
|
|
8
|
+
dryRun?: boolean;
|
|
9
|
+
env?: NodeJS.ProcessEnv;
|
|
10
|
+
/** Absolute node binary for the MCP server command (default process.execPath). */
|
|
11
|
+
nodePath?: string;
|
|
12
|
+
/** Absolute hq CLI entry script (default realpath of process.argv[1]). */
|
|
13
|
+
cliEntry?: string;
|
|
14
|
+
/** Registry file override (default ~/.hq/registry.json under `home`). */
|
|
15
|
+
registryFile?: string;
|
|
16
|
+
log?: (line: string) => void;
|
|
17
|
+
}
|
|
18
|
+
export { AnywhereRuntimeDisabledError as AnywhereDisabledError };
|
|
19
|
+
export declare const isAnywhereEnabled: (_home: string, env?: NodeJS.ProcessEnv) => boolean;
|
|
20
|
+
/** Install HQ into Claude Code user scope. Returns the files touched (or that would be). */
|
|
21
|
+
export declare function installGlobalClaude(opts: GlobalInstallOptions): string[];
|
|
22
|
+
export interface GlobalUninstallOptions {
|
|
23
|
+
home?: string;
|
|
24
|
+
/** Used when no install state exists (falls back to ~/.hq/root). */
|
|
25
|
+
hqRoot?: string;
|
|
26
|
+
dryRun?: boolean;
|
|
27
|
+
env?: NodeJS.ProcessEnv;
|
|
28
|
+
registryFile?: string;
|
|
29
|
+
log?: (line: string) => void;
|
|
30
|
+
}
|
|
31
|
+
/** Reverse every install step; non-HQ entries are left untouched. */
|
|
32
|
+
export declare function uninstallGlobalClaude(opts?: GlobalUninstallOptions): string[];
|
|
33
|
+
/** Install HQ into Codex user scope. Returns the files touched (or that would be). */
|
|
34
|
+
export declare function installGlobalCodex(opts: GlobalInstallOptions): string[];
|
|
35
|
+
/** Reverse every Codex install step; non-HQ entries are left untouched. */
|
|
36
|
+
export declare function uninstallGlobalCodex(opts?: GlobalUninstallOptions): string[];
|
|
37
|
+
export interface GlobalCommandOpts {
|
|
38
|
+
global?: boolean;
|
|
39
|
+
runtime?: string;
|
|
40
|
+
dryRun?: boolean;
|
|
41
|
+
hqRoot?: string;
|
|
42
|
+
}
|
|
43
|
+
/** Entry used by `hq install --global` (wired from pkg-install.ts). */
|
|
44
|
+
export declare function runInstallGlobal(opts: GlobalCommandOpts): void;
|
|
45
|
+
export declare function registerUninstallCommand(program: Command): void;
|
|
46
|
+
//# sourceMappingURL=install-global.d.ts.map
|