@indigoai-us/hq-cli 5.345.232 → 5.345.233
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 +17 -0
- package/dist/commands/core-handoff.d.ts +1 -0
- package/dist/commands/core-handoff.js +2 -28
- package/dist/commands/mcp-serve-gate.d.ts +22 -0
- package/dist/commands/mcp-serve-gate.js +37 -0
- package/dist/commands/mcp-serve.js +2 -8
- package/dist/hq-cloud-sync-runner/bin/sync-runner.js +257 -214
- package/dist/hq-cloud-sync-runner/package.json +1 -1
- package/dist/index.js +6 -1
- package/dist/lib/daemon/flag.d.ts +2 -0
- package/dist/lib/daemon/flag.js +6 -4
- package/dist/lib/daemon/shared-flag-reads.d.ts +70 -0
- package/dist/lib/daemon/shared-flag-reads.js +173 -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/utils/cognito-session.d.ts +2 -56
- package/dist/utils/cognito-session.js +6 -164
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,23 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [5.345.233] — 2026-11-19
|
|
6
|
+
- Test: publish the daemon bootstrap lease test's JSON trace atomically.
|
|
7
|
+
- Updates the bundled HQ Cloud to 6.18.113. A company Outpost other than the company's first one now accepts its own sign-in: the box checks the machine token's Outpost id against `HQ_COMPANY_OUTPOST_ID` instead of always expecting the company's first Outpost. Boxes without that variable, or with the first Outpost's id, behave as before.
|
|
8
|
+
- Updates the bundled HQ Cloud to 6.18.114. On an additional company Outpost, shells, exec sessions, lanes, jobs and the company sync service now read the box's Outpost id from `/etc/company-outpost.env` when their environment lacks it, so `hq secrets exec`, `hq integrations` and other machine-authenticated commands work there. The environment still takes precedence, and tokens for any other Outpost or company are still refused.
|
|
9
|
+
- The native secret-reveal command rule now splits commands as the released hook library does (hq-core 16.0.47 and 16.0.48): an ANSI-C string such as `hq secrets $'reveal' KEY` is now refused as the released `block-agent-secrets-reveal` refuses it, and text after a `#` comment is no longer read as a command. hq-hook now claims `block-agent-secrets-reveal` for PreToolUse.
|
|
10
|
+
- hq-hook: the native `lanes-repo-merge-hold` port now refuses a Bash command over 131071 bytes that contains `merge`, on every platform, before `hq runners hold check` is looked up. Before, Linux could not pass such a command to hq as one argument (the kernel's per-argument limit), so the check never ran there. This matches the newer hold shim and the native merge-gates check.
|
|
11
|
+
- Make hq-hook's PreToolUse check read host-specific coverage claims (`PreToolUse@codex`), so a claim for one host can never take another host's PreToolUse off the old dispatcher, and a host whose claim misses a hook refuses instead of skipping it.
|
|
12
|
+
- `hq mcp serve` without a person token cache now writes its "HQ Anywhere is not enabled" denial before it loads the server module and its hqd protocol, package lease and resident preload modules (20 modules loaded instead of 26). The message, exit code 1 and the 40 ms start-up bound are unchanged.
|
|
13
|
+
- Prepare an explicit current-staging arithmetic evaluator with command-wrapper, IFS, and split-string checks; installed hooks retain their existing arithmetic behavior.
|
|
14
|
+
- The native Stop now keeps a block a Stop folder hook has already given when the evaluator chain's deadline cuts the Stop check while a later hook is still running, as master-hook blocks there; before, a fresh Stop was allowed. A hook cut at its deadline is now reaped inside the TERM wait and gets KILL only if its process group is still there, so on Linux a hook that exits on TERM no longer holds the answer for the whole half second.
|
|
15
|
+
- One HQ-root resolver and one session-id resolver: the cloud session helpers use the HQ-root resolver in hq-root-resolver.ts instead of their own copy, and `hq core handoff` uses the shared session-id resolver. Handoff now strips only ASCII whitespace from a session id, as the shell session-id helper does (US-030 c2).
|
|
16
|
+
- Internal: `hq-hook`'s native master-hook lifecycle work (`lifecycle_master`) now models Codex `SubagentStop`, as the released v16.0.47 Codex adapter ran master-hook through `dispatch_settings_hooks "SubagentStop" "ANY"`: the settings entry it read, the payload and `HQ_HARNESS=codex` it passed, the session bind, twin dedupe, timeout journal and fan-out (registry skipped). A Codex payload that names the agent, and settings the adapter read differently, are refused before any write. Not registered or claimed: `master-hook:SubagentStop` and `codex-adapter:SubagentStop` stay unclaimed.
|
|
17
|
+
- Internal: the native Codex PostToolUse port now pins the beta.124 adapter generation that current hq-core ships (adapter a3178b59, core 940bb5a0), as an exact adapter/core pair next to v16.0.47. Before, every Codex tool call on a current root failed closed as an unknown adapter. A mixed pair (one release's adapter with the other's core) still refuses.
|
|
18
|
+
- Match jq 1.8.1 diagnostic formatting when the Windows executable stores its version beside the help text.
|
|
19
|
+
- Show the SessionStart nested-install warning when HQ paths use Windows separators, with its paths spelled as master-hook prints them under Git Bash (`/c/...`).
|
|
20
|
+
- `hq-hook run` now does the Work Mesh SessionStart hook (`core/hooks/SessionStart/35-work-mesh-session-start.sh`) natively on every host: the `session_start` spool line with the harness word each host's adapter set, the live-binding marker, the observation file and the offline preflight, with the reconcile and the pending-registration retry left for the HQ daemon as request notes. On a preflight cache miss it runs `hq mesh context reconcile --offline` with a 2-second limit, binds the device-default session and refills the cache, as the shell hook did. If the daemon state has no answer for the multi-company session lock, the session is bound to its primary company only, with one stderr line.
|
|
21
|
+
|
|
5
22
|
## [5.345.232] — 2026-11-18
|
|
6
23
|
- `hq-hook` claims `codex-adapter:PostToolUse` on Codex only (`PostToolUse@codex`): the Codex adapter's own PostToolUse work is native. `master-hook:PostToolUse` and each settings command keep their own ids and stay unclaimed, so PostToolUse stays on the old dispatcher.
|
|
7
24
|
- hq-hook can now build and leave a `codex-settings` request note for the HQ daemon: one Codex PostToolUse call's `.claude/settings.json` records, with the payload as the note's body. It refuses a note the daemon would drop. No hook calls it yet, and no hook claim changes.
|
|
@@ -16,6 +16,7 @@ type HandoffContext = {
|
|
|
16
16
|
/** Builds the HQ-Fingerprint commit trailer value. Defaults to the offline builder. */
|
|
17
17
|
buildFingerprint?: (root: string) => string | null;
|
|
18
18
|
};
|
|
19
|
+
export declare function boundSessionCompany(root: string): string;
|
|
19
20
|
export declare function runHandoffFinalize(args: string[], context: HandoffContext): RunResult;
|
|
20
21
|
export declare function runHandoffPost(args: string[], context: HandoffContext): RunResult | Promise<RunResult>;
|
|
21
22
|
export declare function runHandoffPostWorker(args: string[], context: HandoffContext): RunResult;
|
|
@@ -14,6 +14,7 @@ import { enqueueSessionEvent } from "../lib/mesh/live/enqueue.js";
|
|
|
14
14
|
import { renderIndexTarget } from "../lib/index-render/index.js";
|
|
15
15
|
import { defaultBackgroundDependencies, runBackgroundLauncher, } from "../lib/search-index/background.js";
|
|
16
16
|
import { resolveLiveRoot } from "../utils/hq-roots.js";
|
|
17
|
+
import { resolveSessionId } from "../lib/core-utils/session-id.js";
|
|
17
18
|
import { runBundledScript } from "../utils/run-bundled-script.js";
|
|
18
19
|
import { describeCoreCommand } from "./core-command-catalog.js";
|
|
19
20
|
import { subprocess } from "./core-delegate.js";
|
|
@@ -33,34 +34,7 @@ const DESCRIPTIONS = {
|
|
|
33
34
|
post: "Run best-effort post-handoff maintenance",
|
|
34
35
|
openSteps: "List and update open handoff steps",
|
|
35
36
|
};
|
|
36
|
-
|
|
37
|
-
"HQ_SESSION_ID",
|
|
38
|
-
"CLAUDE_CODE_SESSION_ID",
|
|
39
|
-
"CLAUDE_SESSION_ID",
|
|
40
|
-
"CODEX_SESSION_ID",
|
|
41
|
-
"CODEX_THREAD_ID",
|
|
42
|
-
"GROK_SESSION_ID",
|
|
43
|
-
"HQ_FLEET_SESSION_ID",
|
|
44
|
-
];
|
|
45
|
-
function validSessionId(value) {
|
|
46
|
-
return value !== "" && value !== "." && value !== ".." && /^[A-Za-z0-9._-]+$/.test(value);
|
|
47
|
-
}
|
|
48
|
-
function resolveSessionId(root) {
|
|
49
|
-
for (const key of SESSION_ID_ENV_KEYS) {
|
|
50
|
-
const value = (process.env[key] ?? "").replace(/\s/g, "");
|
|
51
|
-
if (validSessionId(value))
|
|
52
|
-
return value;
|
|
53
|
-
}
|
|
54
|
-
const current = path.join(root, "workspace/sessions/.current");
|
|
55
|
-
try {
|
|
56
|
-
const value = fs.readFileSync(current, "utf8").replace(/\s/g, "");
|
|
57
|
-
return validSessionId(value) ? value : "";
|
|
58
|
-
}
|
|
59
|
-
catch {
|
|
60
|
-
return "";
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
function boundSessionCompany(root) {
|
|
37
|
+
export function boundSessionCompany(root) {
|
|
64
38
|
const sessionId = resolveSessionId(root);
|
|
65
39
|
if (!sessionId)
|
|
66
40
|
return "";
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The first check of `hq mcp serve`, kept in its own small module so that the
|
|
3
|
+
* fast route in src/index.ts can deny a fresh install before it loads
|
|
4
|
+
* commands/mcp-serve.js and that module's hqd protocol, package lease and
|
|
5
|
+
* resident preload imports. Builtins and the flag key only.
|
|
6
|
+
*/
|
|
7
|
+
export declare const MCP_SERVE_DISABLED_MESSAGE = "HQ Anywhere is not enabled. The hq-anywhere-runtime flag and your HQ Anywhere person setting must both be on.\n";
|
|
8
|
+
/**
|
|
9
|
+
* A person token is required to read the opt-in setting, so without the token
|
|
10
|
+
* cache the server is denied. Mirrors personTokenCacheFile() in
|
|
11
|
+
* utils/cognito-session.ts; duplicated so this path does not load that module.
|
|
12
|
+
*/
|
|
13
|
+
export declare function hasPersonTokenCache(env: NodeJS.ProcessEnv, home: string): boolean;
|
|
14
|
+
/** Write the denial and set exit code 1, as runMcpServe does. */
|
|
15
|
+
export declare function denyMcpServe(stderr?: NodeJS.WritableStream): void;
|
|
16
|
+
/**
|
|
17
|
+
* The fast route's check: true when there is no person token cache, after the
|
|
18
|
+
* denial was written. runMcpServe makes the same check first, so the result
|
|
19
|
+
* and output are the same with or without this step.
|
|
20
|
+
*/
|
|
21
|
+
export declare function denyMcpServeWithoutTokenCache(env?: NodeJS.ProcessEnv, home?: string): boolean;
|
|
22
|
+
//# sourceMappingURL=mcp-serve-gate.d.ts.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The first check of `hq mcp serve`, kept in its own small module so that the
|
|
3
|
+
* fast route in src/index.ts can deny a fresh install before it loads
|
|
4
|
+
* commands/mcp-serve.js and that module's hqd protocol, package lease and
|
|
5
|
+
* resident preload imports. Builtins and the flag key only.
|
|
6
|
+
*/
|
|
7
|
+
import * as fs from "node:fs";
|
|
8
|
+
import * as os from "node:os";
|
|
9
|
+
import * as path from "node:path";
|
|
10
|
+
import { HQ_ANYWHERE_RUNTIME_FLAG } from "../lib/anywhere-runtime-flag-key.js";
|
|
11
|
+
export const MCP_SERVE_DISABLED_MESSAGE = `HQ Anywhere is not enabled. The ${HQ_ANYWHERE_RUNTIME_FLAG} flag and your HQ Anywhere person setting must both be on.\n`;
|
|
12
|
+
/**
|
|
13
|
+
* A person token is required to read the opt-in setting, so without the token
|
|
14
|
+
* cache the server is denied. Mirrors personTokenCacheFile() in
|
|
15
|
+
* utils/cognito-session.ts; duplicated so this path does not load that module.
|
|
16
|
+
*/
|
|
17
|
+
export function hasPersonTokenCache(env, home) {
|
|
18
|
+
const stateDir = env.HQ_STATE_DIR?.trim() || path.join(home, ".hq");
|
|
19
|
+
return fs.existsSync(path.join(stateDir, "cognito-tokens.json"));
|
|
20
|
+
}
|
|
21
|
+
/** Write the denial and set exit code 1, as runMcpServe does. */
|
|
22
|
+
export function denyMcpServe(stderr = process.stderr) {
|
|
23
|
+
stderr.write(MCP_SERVE_DISABLED_MESSAGE);
|
|
24
|
+
process.exitCode = 1;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* The fast route's check: true when there is no person token cache, after the
|
|
28
|
+
* denial was written. runMcpServe makes the same check first, so the result
|
|
29
|
+
* and output are the same with or without this step.
|
|
30
|
+
*/
|
|
31
|
+
export function denyMcpServeWithoutTokenCache(env = process.env, home = os.homedir()) {
|
|
32
|
+
if (hasPersonTokenCache(env, home))
|
|
33
|
+
return false;
|
|
34
|
+
denyMcpServe();
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=mcp-serve-gate.js.map
|
|
@@ -18,7 +18,7 @@ import * as fs from "node:fs";
|
|
|
18
18
|
import * as os from "node:os";
|
|
19
19
|
import * as path from "node:path";
|
|
20
20
|
import { CLI_VERSION } from "../cli-version.js";
|
|
21
|
-
import {
|
|
21
|
+
import { denyMcpServe, hasPersonTokenCache } from "./mcp-serve-gate.js";
|
|
22
22
|
import { createLineSplitter, HqdClientError, hqdRequest, hqdSocketPath } from "../lib/daemon/protocol.js";
|
|
23
23
|
import { releaseCurrentPackageUseLease, releasePackageUseLeaseAfterResidentPreload } from "../utils/package-use-lease.js";
|
|
24
24
|
import { preloadResidentPackageModules, reportResidentPackagePreloadFailure, RESIDENT_PACKAGE_MODULES } from "../utils/resident-package-preload.js";
|
|
@@ -27,11 +27,6 @@ const UNREACHABLE_CODES = new Set(["ENOENT", "ECONNREFUSED", "ECONNRESET", "EPIP
|
|
|
27
27
|
/** hqd is not running, so the request never reached it and a local answer cannot repeat a write. */
|
|
28
28
|
const NOT_RUNNING_CODES = new Set(["ENOENT", "ECONNREFUSED"]);
|
|
29
29
|
const LOCAL_GATE_TTL_MS = 60_000;
|
|
30
|
-
function hasPersonTokenCache(env, home) {
|
|
31
|
-
// Mirrors personTokenCacheFile() in utils/cognito-session.ts; duplicated so this path does not load that module.
|
|
32
|
-
const stateDir = env.HQ_STATE_DIR?.trim() || path.join(home, ".hq");
|
|
33
|
-
return fs.existsSync(path.join(stateDir, "cognito-tokens.json"));
|
|
34
|
-
}
|
|
35
30
|
/** HQ root for prompts: HQ_ROOT, else the ~/.hq/root pointer written by `hq install --global`. */
|
|
36
31
|
export function readHqRoot(env, home) {
|
|
37
32
|
const fromEnv = env.HQ_ROOT?.trim();
|
|
@@ -76,8 +71,7 @@ export async function runMcpServe(opts = {}) {
|
|
|
76
71
|
});
|
|
77
72
|
});
|
|
78
73
|
if (!(await runtimeAllowed())) {
|
|
79
|
-
|
|
80
|
-
process.exitCode = 1;
|
|
74
|
+
denyMcpServe();
|
|
81
75
|
return;
|
|
82
76
|
}
|
|
83
77
|
let packageHandlers;
|