@indigoai-us/hq-cli 5.345.246 → 5.345.248
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 +63 -0
- package/assets/lanes-hooks/hq-lanes-drain.sh +1 -1
- package/contracts/host-canary-release.json +14 -0
- package/dist/command-catalog.generated.d.ts +1116 -3
- package/dist/command-catalog.generated.js +1373 -3
- package/dist/command-registration-plan.d.ts +6 -0
- package/dist/command-registration-plan.js +1 -0
- package/dist/commands/install-global.d.ts +15 -0
- package/dist/commands/install-global.js +98 -4
- package/dist/commands/lanes-hold.js +7 -7
- package/dist/commands/lanes-resume.js +2 -2
- package/dist/commands/lanes-review.js +1 -1
- package/dist/commands/lanes-session-start.d.ts +1 -1
- package/dist/commands/lanes-session-start.js +3 -3
- package/dist/commands/lanes-shared.d.ts +1 -1
- package/dist/commands/lanes.d.ts +2 -2
- package/dist/commands/lanes.js +50 -50
- package/dist/commands/mcp-registration.d.ts +17 -0
- package/dist/commands/mcp-registration.js +119 -0
- package/dist/commands/mesh.d.ts +25 -0
- package/dist/commands/mesh.js +48 -8
- package/dist/commands/ontology-graph.d.ts +62 -0
- package/dist/commands/ontology-graph.js +439 -0
- package/dist/commands/pkg-install.js +1 -1
- package/dist/commands/reindex.js +1 -1
- package/dist/index.js +1 -1
- package/dist/lanes-monitor-check-argv.d.ts +1 -1
- package/dist/lanes-monitor-check-argv.js +1 -1
- package/dist/lanes-monitor-check-fast.d.ts +1 -1
- package/dist/lanes-monitor-check-fast.js +1 -1
- package/dist/lanes-session-start-argv.d.ts +1 -1
- package/dist/lanes-session-start-argv.js +1 -1
- package/dist/lib/capacity/sign-in.d.ts +1 -1
- package/dist/lib/capacity/sign-in.js +1 -1
- package/dist/lib/daemon/hook-requests-conduct-link.js +2 -2
- package/dist/lib/daemon/lanes-monitor-state.d.ts +2 -2
- package/dist/lib/daemon/lanes-monitor-state.js +2 -2
- package/dist/lib/daemon/merge-sections.d.ts +3 -3
- package/dist/lib/daemon/merge-sections.js +7 -7
- package/dist/lib/daemon/remote-control-pools.js +1 -1
- package/dist/lib/daemon/run.js +1 -1
- package/dist/lib/daemon/state-file.d.ts +1 -1
- package/dist/lib/daemon/state-file.js +1 -1
- package/dist/lib/doctor/checks/antigravity-wiring.d.ts +21 -0
- package/dist/lib/doctor/checks/antigravity-wiring.js +75 -0
- package/dist/lib/doctor/checks/anywhere.js +30 -0
- package/dist/lib/doctor/checks/runtime-probe.js +13 -0
- package/dist/lib/doctor/platform.d.ts +1 -1
- package/dist/lib/doctor/platform.js +5 -0
- package/dist/lib/doctor/registry.js +3 -0
- package/dist/lib/flag-snapshot-file.d.ts +2 -0
- package/dist/lib/flag-snapshot-file.js +118 -48
- package/dist/lib/hook-engine/canary-gate.d.ts +57 -3
- package/dist/lib/hook-engine/canary-gate.js +138 -6
- package/dist/lib/hook-engine/coverage.d.ts +91 -0
- package/dist/lib/hook-engine/coverage.js +184 -0
- package/dist/lib/hot-channels/graph-context.d.ts +105 -0
- package/dist/lib/hot-channels/graph-context.js +377 -0
- package/dist/lib/hot-channels/signals-pass.js +27 -1
- package/dist/lib/install/antigravity-targets.d.ts +39 -0
- package/dist/lib/install/antigravity-targets.js +122 -0
- package/dist/lib/lanes/claude-credential.d.ts +1 -1
- package/dist/lib/lanes/claude-credential.js +1 -1
- package/dist/lib/lanes/delivery-core.d.ts +1 -1
- package/dist/lib/lanes/delivery-core.js +1 -1
- package/dist/lib/lanes/delivery.d.ts +10 -10
- package/dist/lib/lanes/delivery.js +8 -8
- package/dist/lib/lanes/dropbox.d.ts +1 -1
- package/dist/lib/lanes/dropbox.js +1 -1
- package/dist/lib/lanes/hooks-install.js +2 -2
- package/dist/lib/lanes/index.d.ts +1 -1
- package/dist/lib/lanes/index.js +1 -1
- package/dist/lib/lanes/monitor.js +1 -1
- package/dist/lib/lanes/quota-notice.js +1 -1
- package/dist/lib/lanes/quota.d.ts +1 -1
- package/dist/lib/lanes/quota.js +1 -1
- package/dist/lib/lanes/repo-merge-hold.d.ts +2 -2
- package/dist/lib/lanes/repo-merge-hold.js +2 -2
- package/dist/lib/lanes/spawn.d.ts +4 -4
- package/dist/lib/lanes/spawn.js +5 -5
- package/dist/lib/mesh/live/company-flag-refresh.d.ts +61 -0
- package/dist/lib/mesh/live/company-flag-refresh.js +159 -0
- package/dist/lib/mesh/live/company-reporting-gaps.d.ts +61 -0
- package/dist/lib/mesh/live/company-reporting-gaps.js +238 -0
- package/dist/lib/mesh/live/daemon/duplicate-unit.d.ts +156 -0
- package/dist/lib/mesh/live/daemon/duplicate-unit.js +616 -0
- package/dist/lib/mesh/live/daemon/run.d.ts +13 -0
- package/dist/lib/mesh/live/daemon/run.js +35 -2
- package/dist/lib/mesh/live/direct-drain.js +1 -1
- package/dist/lib/mesh/live/emit.d.ts +3 -0
- package/dist/lib/mesh/live/emit.js +32 -9
- package/dist/lib/mesh/live/flush.d.ts +3 -0
- package/dist/lib/mesh/live/flush.js +115 -32
- package/dist/lib/mesh/live/liveness-carry.d.ts +1 -1
- package/dist/lib/mesh/live/liveness-carry.js +1 -1
- package/dist/lib/mesh/live/reporting-privacy.d.ts +119 -3
- package/dist/lib/mesh/live/reporting-privacy.js +235 -11
- package/dist/lib/mesh/live/spool.d.ts +17 -2
- package/dist/lib/mesh/live/spool.js +22 -6
- package/dist/lib/ontology-graph/legacy/coverage.d.ts +67 -0
- package/dist/lib/ontology-graph/legacy/coverage.js +192 -0
- package/dist/lib/ontology-graph/legacy/index.d.ts +199 -0
- package/dist/lib/ontology-graph/legacy/index.js +1150 -0
- package/dist/lib/ontology-graph/legacy/parse.d.ts +49 -0
- package/dist/lib/ontology-graph/legacy/parse.js +126 -0
- package/dist/lib/ontology-graph/legacy/report.d.ts +14 -0
- package/dist/lib/ontology-graph/legacy/report.js +254 -0
- package/dist/lib/ontology-graph/legacy/verb-map.d.ts +35 -0
- package/dist/lib/ontology-graph/legacy/verb-map.js +84 -0
- package/dist/lib/ontology-graph/lint/checks.d.ts +140 -0
- package/dist/lib/ontology-graph/lint/checks.js +717 -0
- package/dist/lib/ontology-graph/lint/coverage.d.ts +106 -0
- package/dist/lib/ontology-graph/lint/coverage.js +241 -0
- package/dist/lib/ontology-graph/lint/daily-job.d.ts +259 -0
- package/dist/lib/ontology-graph/lint/daily-job.js +595 -0
- package/dist/lib/ontology-graph/lint/index.d.ts +65 -0
- package/dist/lib/ontology-graph/lint/index.js +176 -0
- package/dist/lib/ontology-graph/model/files.d.ts +20 -0
- package/dist/lib/ontology-graph/model/files.js +89 -0
- package/dist/lib/ontology-graph/model/index.d.ts +65 -0
- package/dist/lib/ontology-graph/model/index.js +100 -0
- package/dist/lib/ontology-graph/model/pass-tasks.d.ts +156 -0
- package/dist/lib/ontology-graph/model/pass-tasks.js +345 -0
- package/dist/lib/ontology-graph/model/pass.d.ts +109 -0
- package/dist/lib/ontology-graph/model/pass.js +958 -0
- package/dist/lib/ontology-graph/model/runner.d.ts +50 -0
- package/dist/lib/ontology-graph/model/runner.js +160 -0
- package/dist/lib/ontology-graph/model/step.d.ts +195 -0
- package/dist/lib/ontology-graph/model/step.js +523 -0
- package/dist/lib/ontology-graph/model/tasks.d.ts +183 -0
- package/dist/lib/ontology-graph/model/tasks.js +349 -0
- package/dist/lib/ontology-graph/not-implemented.d.ts +5 -0
- package/dist/lib/ontology-graph/not-implemented.js +8 -0
- package/dist/lib/ontology-graph/org/compare.d.ts +28 -0
- package/dist/lib/ontology-graph/org/compare.js +239 -0
- package/dist/lib/ontology-graph/org/derive.d.ts +65 -0
- package/dist/lib/ontology-graph/org/derive.js +352 -0
- package/dist/lib/ontology-graph/org/index.d.ts +73 -0
- package/dist/lib/ontology-graph/org/index.js +513 -0
- package/dist/lib/ontology-graph/org/load.d.ts +31 -0
- package/dist/lib/ontology-graph/org/load.js +476 -0
- package/dist/lib/ontology-graph/org/role.d.ts +38 -0
- package/dist/lib/ontology-graph/org/role.js +268 -0
- package/dist/lib/ontology-graph/org/structure.d.ts +63 -0
- package/dist/lib/ontology-graph/org/structure.js +437 -0
- package/dist/lib/ontology-graph/org/text.d.ts +95 -0
- package/dist/lib/ontology-graph/org/text.js +315 -0
- package/dist/lib/ontology-graph/org/types.d.ts +452 -0
- package/dist/lib/ontology-graph/org/types.js +80 -0
- package/dist/lib/ontology-graph/pages/index.d.ts +64 -0
- package/dist/lib/ontology-graph/pages/index.js +193 -0
- package/dist/lib/ontology-graph/pages/render.d.ts +142 -0
- package/dist/lib/ontology-graph/pages/render.js +682 -0
- package/dist/lib/ontology-graph/proposals/apply.d.ts +109 -0
- package/dist/lib/ontology-graph/proposals/apply.js +468 -0
- package/dist/lib/ontology-graph/proposals/group.d.ts +63 -0
- package/dist/lib/ontology-graph/proposals/group.js +232 -0
- package/dist/lib/ontology-graph/proposals/index.d.ts +173 -0
- package/dist/lib/ontology-graph/proposals/index.js +474 -0
- package/dist/lib/ontology-graph/proposals/model.d.ts +162 -0
- package/dist/lib/ontology-graph/proposals/model.js +196 -0
- package/dist/lib/ontology-graph/proposals/org-chart.d.ts +82 -0
- package/dist/lib/ontology-graph/proposals/org-chart.js +340 -0
- package/dist/lib/ontology-graph/read/brief.d.ts +26 -0
- package/dist/lib/ontology-graph/read/brief.js +251 -0
- package/dist/lib/ontology-graph/read/graph-index.d.ts +76 -0
- package/dist/lib/ontology-graph/read/graph-index.js +198 -0
- package/dist/lib/ontology-graph/read/index.d.ts +59 -0
- package/dist/lib/ontology-graph/read/index.js +792 -0
- package/dist/lib/ontology-graph/read/member.d.ts +7 -0
- package/dist/lib/ontology-graph/read/member.js +34 -0
- package/dist/lib/ontology-graph/read/names.d.ts +44 -0
- package/dist/lib/ontology-graph/read/names.js +292 -0
- package/dist/lib/ontology-graph/read/reader-setting.d.ts +19 -0
- package/dist/lib/ontology-graph/read/reader-setting.js +62 -0
- package/dist/lib/ontology-graph/read/test-graph.d.ts +37 -0
- package/dist/lib/ontology-graph/read/test-graph.js +150 -0
- package/dist/lib/ontology-graph/replay/buffered-store.d.ts +33 -0
- package/dist/lib/ontology-graph/replay/buffered-store.js +50 -0
- package/dist/lib/ontology-graph/replay/config.d.ts +41 -0
- package/dist/lib/ontology-graph/replay/config.js +105 -0
- package/dist/lib/ontology-graph/replay/engine.d.ts +100 -0
- package/dist/lib/ontology-graph/replay/engine.js +1174 -0
- package/dist/lib/ontology-graph/replay/extractors.d.ts +59 -0
- package/dist/lib/ontology-graph/replay/extractors.js +1555 -0
- package/dist/lib/ontology-graph/replay/index.d.ts +90 -0
- package/dist/lib/ontology-graph/replay/index.js +220 -0
- package/dist/lib/ontology-graph/replay/listing-manifest.d.ts +66 -0
- package/dist/lib/ontology-graph/replay/listing-manifest.js +242 -0
- package/dist/lib/ontology-graph/replay/member.d.ts +19 -0
- package/dist/lib/ontology-graph/replay/member.js +65 -0
- package/dist/lib/ontology-graph/replay/mentions.d.ts +58 -0
- package/dist/lib/ontology-graph/replay/mentions.js +239 -0
- package/dist/lib/ontology-graph/replay/readers.d.ts +98 -0
- package/dist/lib/ontology-graph/replay/readers.js +1251 -0
- package/dist/lib/ontology-graph/replay/rules.d.ts +127 -0
- package/dist/lib/ontology-graph/replay/rules.js +374 -0
- package/dist/lib/ontology-graph/replay/scope.d.ts +35 -0
- package/dist/lib/ontology-graph/replay/scope.js +115 -0
- package/dist/lib/ontology-graph/replay/transcripts.d.ts +39 -0
- package/dist/lib/ontology-graph/replay/transcripts.js +224 -0
- package/dist/lib/ontology-graph/replay/util.d.ts +55 -0
- package/dist/lib/ontology-graph/replay/util.js +256 -0
- package/dist/lib/ontology-graph/resolve/entity-index.d.ts +159 -0
- package/dist/lib/ontology-graph/resolve/entity-index.js +652 -0
- package/dist/lib/ontology-graph/resolve/index.d.ts +113 -0
- package/dist/lib/ontology-graph/resolve/index.js +214 -0
- package/dist/lib/ontology-graph/resolve/machine.d.ts +34 -0
- package/dist/lib/ontology-graph/resolve/machine.js +95 -0
- package/dist/lib/ontology-graph/resolve/normalize.d.ts +35 -0
- package/dist/lib/ontology-graph/resolve/normalize.js +124 -0
- package/dist/lib/ontology-graph/resolve/org-chart.d.ts +107 -0
- package/dist/lib/ontology-graph/resolve/org-chart.js +578 -0
- package/dist/lib/ontology-graph/resolve/org-layer.d.ts +78 -0
- package/dist/lib/ontology-graph/resolve/org-layer.js +159 -0
- package/dist/lib/ontology-graph/resolve/org-seed.d.ts +141 -0
- package/dist/lib/ontology-graph/resolve/org-seed.js +631 -0
- package/dist/lib/ontology-graph/resolve/org-sources.d.ts +165 -0
- package/dist/lib/ontology-graph/resolve/org-sources.js +634 -0
- package/dist/lib/ontology-graph/resolve/roster.d.ts +76 -0
- package/dist/lib/ontology-graph/resolve/roster.js +226 -0
- package/dist/lib/ontology-graph/resolve/seed.d.ts +267 -0
- package/dist/lib/ontology-graph/resolve/seed.js +1198 -0
- package/dist/lib/ontology-graph/resolve/upsert.d.ts +58 -0
- package/dist/lib/ontology-graph/resolve/upsert.js +139 -0
- package/dist/lib/ontology-graph/resolve/writer.d.ts +128 -0
- package/dist/lib/ontology-graph/resolve/writer.js +351 -0
- package/dist/lib/ontology-graph/schema/authority.d.ts +73 -0
- package/dist/lib/ontology-graph/schema/authority.js +157 -0
- package/dist/lib/ontology-graph/schema/default-schema.d.ts +10 -0
- package/dist/lib/ontology-graph/schema/default-schema.js +242 -0
- package/dist/lib/ontology-graph/schema/grammar.d.ts +57 -0
- package/dist/lib/ontology-graph/schema/grammar.js +409 -0
- package/dist/lib/ontology-graph/schema/index.d.ts +12 -0
- package/dist/lib/ontology-graph/schema/index.js +10 -0
- package/dist/lib/ontology-graph/schema/validate.d.ts +13 -0
- package/dist/lib/ontology-graph/schema/validate.js +132 -0
- package/dist/lib/ontology-graph/store/files.d.ts +34 -0
- package/dist/lib/ontology-graph/store/files.js +207 -0
- package/dist/lib/ontology-graph/store/fs.d.ts +30 -0
- package/dist/lib/ontology-graph/store/fs.js +101 -0
- package/dist/lib/ontology-graph/store/graph-store.d.ts +14 -0
- package/dist/lib/ontology-graph/store/graph-store.js +520 -0
- package/dist/lib/ontology-graph/store/index.d.ts +18 -0
- package/dist/lib/ontology-graph/store/index.js +15 -0
- package/dist/lib/ontology-graph/store/ingest.d.ts +37 -0
- package/dist/lib/ontology-graph/store/ingest.js +323 -0
- package/dist/lib/ontology-graph/store/paths.d.ts +114 -0
- package/dist/lib/ontology-graph/store/paths.js +232 -0
- package/dist/lib/ontology-graph/types.d.ts +1183 -0
- package/dist/lib/ontology-graph/types.js +131 -0
- package/dist/lib/secret-scan/gitleaks-rules.generated.js +1 -1
- package/dist/utils/frontmatter.d.ts +14 -0
- package/dist/utils/frontmatter.js +18 -0
- package/dist/utils/interactive-caller.js +1 -1
- package/package.json +8 -8
package/dist/commands/lanes.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { readSessionCompanyLock } from "../lib/session-company-lock.js";
|
|
2
2
|
/**
|
|
3
|
-
* `hq
|
|
3
|
+
* `hq runners` — worker lane management and decision queue (spec §5–§7, §10–§11).
|
|
4
4
|
*
|
|
5
5
|
* Existing commands print JSON on stdout by default and take no interactive input, except
|
|
6
6
|
* `accounts login`, which hands the terminal to the vendor's own sign-in.
|
|
@@ -257,7 +257,7 @@ const REMOTE_LANE_NOT_FOUND_GRACE_MS = 15 * 60_000;
|
|
|
257
257
|
/** The lane → mesh seam. Defined in lib/lanes/mesh-events.ts; the watcher shares it. */
|
|
258
258
|
export { emitLaneDecisionEvents };
|
|
259
259
|
const monitorLaneMessageApis = new WeakMap();
|
|
260
|
-
/** Build the same lane message handlers used by `hq
|
|
260
|
+
/** Build the same lane message handlers used by `hq runners _monitor-message`, without a CLI process boundary. */
|
|
261
261
|
export function createMonitorLaneMessageApi(hqRoot, cwd, env = process.env) {
|
|
262
262
|
const program = new Command();
|
|
263
263
|
registerRunnersCommand(program, {
|
|
@@ -292,13 +292,13 @@ function failJson(err) {
|
|
|
292
292
|
: err;
|
|
293
293
|
if (isLanesError(commandError)) {
|
|
294
294
|
if (commandError.error === "hire_grant_exhausted") {
|
|
295
|
-
process.stderr.write(`hq
|
|
295
|
+
process.stderr.write(`hq runners: ${commandError.message}\n`);
|
|
296
296
|
}
|
|
297
297
|
printJson({ ...commandError.toJSON(), message: commandError.message });
|
|
298
298
|
process.exit(["signal_not_found", "no_conductor_link"].includes(commandError.error) ? 2 : 1);
|
|
299
299
|
}
|
|
300
300
|
const message = commandError instanceof Error ? commandError.message : String(commandError);
|
|
301
|
-
process.stderr.write(`hq
|
|
301
|
+
process.stderr.write(`hq runners: ${message}${commandError instanceof Error && commandError.stack ? `\n${commandError.stack}` : ""}\n`);
|
|
302
302
|
printJson({ error: "internal", message });
|
|
303
303
|
process.exit(1);
|
|
304
304
|
}
|
|
@@ -314,7 +314,7 @@ function wrap(action) {
|
|
|
314
314
|
}
|
|
315
315
|
function failText(err) {
|
|
316
316
|
const message = err instanceof Error ? err.message : String(err);
|
|
317
|
-
process.stderr.write(`hq
|
|
317
|
+
process.stderr.write(`hq runners: ${message}\n`);
|
|
318
318
|
process.exit(MONITOR_ERROR_EXIT_CODE);
|
|
319
319
|
}
|
|
320
320
|
function wrapText(action) {
|
|
@@ -472,7 +472,7 @@ function derivedLaneWorkRequirements(ctx, hqRoot, lane) {
|
|
|
472
472
|
}
|
|
473
473
|
}
|
|
474
474
|
/**
|
|
475
|
-
* The derived requirements after hq
|
|
475
|
+
* The derived requirements after hq runners repair-company sets the lane's
|
|
476
476
|
* company. A declared document is left as it is.
|
|
477
477
|
*/
|
|
478
478
|
function repairedWorkRequirements(current, company) {
|
|
@@ -599,7 +599,7 @@ function livenessDepsFromCtx(ctx) {
|
|
|
599
599
|
* Start a lane that admission just let through. A queued loop lane is marked
|
|
600
600
|
* running and gets its loop controller, which works through the queued phase
|
|
601
601
|
* envelopes; every other lane spawns its worker directly. Every admission path
|
|
602
|
-
* (reconcile, in-process queue drain, hq
|
|
602
|
+
* (reconcile, in-process queue drain, hq runners admit) goes through here so a
|
|
603
603
|
* loop lane never runs its brief without a controller.
|
|
604
604
|
*
|
|
605
605
|
* A queued loop lane whose controller is still alive is a deferred phase: the
|
|
@@ -670,12 +670,12 @@ async function admitQueuedFromCtx(ctx) {
|
|
|
670
670
|
env: ctx.env,
|
|
671
671
|
});
|
|
672
672
|
for (const error of result.errors) {
|
|
673
|
-
process.stderr.write(`hq
|
|
673
|
+
process.stderr.write(`hq runners: queue admission: ${error.message}\n`);
|
|
674
674
|
}
|
|
675
675
|
return result.admitted;
|
|
676
676
|
}
|
|
677
677
|
catch (err) {
|
|
678
|
-
process.stderr.write(`hq
|
|
678
|
+
process.stderr.write(`hq runners: queue admission failed: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
679
679
|
return [];
|
|
680
680
|
}
|
|
681
681
|
}
|
|
@@ -1049,7 +1049,7 @@ function ownerErrorFromOutput(stdout) {
|
|
|
1049
1049
|
parsed = JSON.parse(trimmed);
|
|
1050
1050
|
}
|
|
1051
1051
|
catch {
|
|
1052
|
-
process.stderr.write("hq
|
|
1052
|
+
process.stderr.write("hq runners: Outpost lanes dispatch returned malformed JSON\n");
|
|
1053
1053
|
return undefined;
|
|
1054
1054
|
}
|
|
1055
1055
|
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
@@ -1574,7 +1574,7 @@ function subagentLaneHost(ctx) {
|
|
|
1574
1574
|
const reason = unusable(err);
|
|
1575
1575
|
if (reason === null)
|
|
1576
1576
|
throw err;
|
|
1577
|
-
process.stderr.write(`hq
|
|
1577
|
+
process.stderr.write(`hq runners: could not use ${file} (${reason}); recording a host id that can be read\n`);
|
|
1578
1578
|
if (reason === "host_identity_corrupt")
|
|
1579
1579
|
return { kind: "local", id: hostname };
|
|
1580
1580
|
}
|
|
@@ -1585,7 +1585,7 @@ function subagentLaneHost(ctx) {
|
|
|
1585
1585
|
const reason = unusable(err);
|
|
1586
1586
|
if (reason === null)
|
|
1587
1587
|
throw err;
|
|
1588
|
-
process.stderr.write(`hq
|
|
1588
|
+
process.stderr.write(`hq runners: could not read ${file} (${reason}); recording the hostname\n`);
|
|
1589
1589
|
return { kind: "local", id: hostname };
|
|
1590
1590
|
}
|
|
1591
1591
|
}
|
|
@@ -1768,7 +1768,7 @@ async function loadHostCapacitySnapshots(ctx, hqRoot, config = loadLanesConfig(h
|
|
|
1768
1768
|
}
|
|
1769
1769
|
const outpostLaneListMemo = new WeakMap();
|
|
1770
1770
|
const MAX_OUTPOST_LANE_LIST_BYTES = 480 * 1024;
|
|
1771
|
-
/** Tails `hq
|
|
1771
|
+
/** Tails `hq runners logs` retries with when an Outpost's full logs are clipped. */
|
|
1772
1772
|
const REMOTE_LOGS_FALLBACK_TAILS = [200, 20];
|
|
1773
1773
|
/** Whether an Outpost exec result hit the inline output limit and was clipped. */
|
|
1774
1774
|
function outpostExecOutputClipped(result) {
|
|
@@ -2026,7 +2026,7 @@ async function refreshRemoteLaneMirrors(ctx, hqRoot, records, parentLaneIds, opt
|
|
|
2026
2026
|
for (const lane of overflow) {
|
|
2027
2027
|
result.unverifiedRemote.set(lane.lane_id, "refresh_batch_limit");
|
|
2028
2028
|
}
|
|
2029
|
-
process.stderr.write(`hq
|
|
2029
|
+
process.stderr.write(`hq runners: unverified remote mirrors from Outpost ${outpostId} remain counted; refresh batch limit left lanes ${ids.join(", ")} unread\n`);
|
|
2030
2030
|
}
|
|
2031
2031
|
let ownerRecords;
|
|
2032
2032
|
try {
|
|
@@ -2043,7 +2043,7 @@ async function refreshRemoteLaneMirrors(ctx, hqRoot, records, parentLaneIds, opt
|
|
|
2043
2043
|
: dispatchErrorMessage(error);
|
|
2044
2044
|
for (const lane of batch)
|
|
2045
2045
|
result.unverifiedRemote.set(lane.lane_id, detail);
|
|
2046
|
-
process.stderr.write(`hq
|
|
2046
|
+
process.stderr.write(`hq runners: unverified remote mirrors from Outpost ${outpostId} remain counted: ${detail}; lanes ${batch.map((lane) => lane.lane_id).join(", ")}\n`);
|
|
2047
2047
|
continue;
|
|
2048
2048
|
}
|
|
2049
2049
|
for (const mirror of batch) {
|
|
@@ -2083,7 +2083,7 @@ async function refreshRemoteLaneMirrors(ctx, hqRoot, records, parentLaneIds, opt
|
|
|
2083
2083
|
? "owner returned duplicate lane rows"
|
|
2084
2084
|
: "owner lane identity did not match its mirror";
|
|
2085
2085
|
result.unverifiedRemote.set(mirror.lane_id, detail);
|
|
2086
|
-
process.stderr.write(`hq
|
|
2086
|
+
process.stderr.write(`hq runners: unverified remote mirror ${mirror.lane_id} from Outpost ${outpostId} remains counted: ${detail}\n`);
|
|
2087
2087
|
continue;
|
|
2088
2088
|
}
|
|
2089
2089
|
const endedAt = isTerminalLaneState(owner.state)
|
|
@@ -2575,7 +2575,7 @@ function loadSessionMeta(hqRoot, sessionId, ctx) {
|
|
|
2575
2575
|
text = ctx.readFileSync(filePath, "utf8");
|
|
2576
2576
|
}
|
|
2577
2577
|
catch (err) {
|
|
2578
|
-
process.stderr.write(`hq
|
|
2578
|
+
process.stderr.write(`hq runners: failed to read session meta ${filePath}: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
2579
2579
|
return { status: "unreadable" };
|
|
2580
2580
|
}
|
|
2581
2581
|
let doc;
|
|
@@ -2583,7 +2583,7 @@ function loadSessionMeta(hqRoot, sessionId, ctx) {
|
|
|
2583
2583
|
doc = parseUserYaml(text, filePath);
|
|
2584
2584
|
}
|
|
2585
2585
|
catch (err) {
|
|
2586
|
-
process.stderr.write(`hq
|
|
2586
|
+
process.stderr.write(`hq runners: failed to parse session meta ${filePath}: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
2587
2587
|
return { status: "malformed" };
|
|
2588
2588
|
}
|
|
2589
2589
|
if (!isSessionMetaDocument(doc)) {
|
|
@@ -2642,7 +2642,7 @@ function seniorExists(hqRoot, ref, ctx) {
|
|
|
2642
2642
|
return index.sessions[ref.id] !== undefined;
|
|
2643
2643
|
}
|
|
2644
2644
|
catch (err) {
|
|
2645
|
-
process.stderr.write(`hq
|
|
2645
|
+
process.stderr.write(`hq runners: liveness index read failed while checking session ${ref.id}: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
2646
2646
|
throw err;
|
|
2647
2647
|
}
|
|
2648
2648
|
}
|
|
@@ -3194,7 +3194,7 @@ function assertKnownOutpost(requested, known) {
|
|
|
3194
3194
|
}
|
|
3195
3195
|
}
|
|
3196
3196
|
/**
|
|
3197
|
-
* Spec §5.1: `hq
|
|
3197
|
+
* Spec §5.1: `hq runners ask` from inside a lane can hit a binary or dist
|
|
3198
3198
|
* being replaced mid-call (ENOENT / ETXTBSY / a module that no longer
|
|
3199
3199
|
* resolves) or a record written by a newer CLI. Three attempts, waits of
|
|
3200
3200
|
* 5 s then 15 s, 20 s of backoff in total, inside the 30 s bound.
|
|
@@ -3420,7 +3420,7 @@ async function emitLaneTerminalStateSoft(ctx, lane) {
|
|
|
3420
3420
|
await emitLaneTerminalStateEvent(ctx.mesh, lane, lane.state, lane.terminal_reason, AbortSignal.timeout(10_000));
|
|
3421
3421
|
}
|
|
3422
3422
|
catch (err) {
|
|
3423
|
-
process.stderr.write(`hq
|
|
3423
|
+
process.stderr.write(`hq runners: terminal mesh update failed for ${lane.lane_id}: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
3424
3424
|
}
|
|
3425
3425
|
}
|
|
3426
3426
|
/**
|
|
@@ -3450,7 +3450,7 @@ async function emitLaneStartedForStories(ctx, company, lane, threadId, knownAbse
|
|
|
3450
3450
|
const prefix = `Lane ${lane.lane_id} is RUNNING (do not re-run create).`;
|
|
3451
3451
|
const warnings = [];
|
|
3452
3452
|
const fail = (text) => {
|
|
3453
|
-
process.stderr.write(`hq
|
|
3453
|
+
process.stderr.write(`hq runners: ${prefix} ${text}\n`);
|
|
3454
3454
|
warnings.push(`${prefix} ${text}`);
|
|
3455
3455
|
};
|
|
3456
3456
|
const storyFix = (story) => `hq mesh story --company ${company.slug} --project ${story.project_id} --story ${story.story_id} --status in_progress`;
|
|
@@ -5361,8 +5361,8 @@ async function dispatchCreatedOutpostLane(ctx, input) {
|
|
|
5361
5361
|
// The pickup exec was submitted, but the wait for its result ended (a
|
|
5362
5362
|
// timeout or a failed poll). The Outpost may already run the lane, so this
|
|
5363
5363
|
// is an unknown outcome, not a failed dispatch. Writing `failed` here made
|
|
5364
|
-
// `hq
|
|
5365
|
-
// `hq
|
|
5364
|
+
// `hq runners watch` report a running Outpost lane as terminal while
|
|
5365
|
+
// `hq runners show` read it running from its owner (feedback_b929c4a8).
|
|
5366
5366
|
if (isLanesError(err) &&
|
|
5367
5367
|
err.error === DISPATCH_TERMINAL_REASON &&
|
|
5368
5368
|
err.details.outcome_unknown === true &&
|
|
@@ -5418,10 +5418,10 @@ function parseRemoteJson(stdout, surface) {
|
|
|
5418
5418
|
if (parsed !== null && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
5419
5419
|
return parsed;
|
|
5420
5420
|
}
|
|
5421
|
-
process.stderr.write(`hq
|
|
5421
|
+
process.stderr.write(`hq runners: ${surface} stdout is not a JSON object\n`);
|
|
5422
5422
|
}
|
|
5423
5423
|
catch (err) {
|
|
5424
|
-
process.stderr.write(`hq
|
|
5424
|
+
process.stderr.write(`hq runners: failed to parse ${surface} JSON: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
5425
5425
|
return null;
|
|
5426
5426
|
}
|
|
5427
5427
|
return null;
|
|
@@ -6438,7 +6438,7 @@ async function laneStatusFieldsForCommand(ctx, hqRoot, lane, now) {
|
|
|
6438
6438
|
});
|
|
6439
6439
|
}
|
|
6440
6440
|
catch (err) {
|
|
6441
|
-
process.stderr.write(`hq
|
|
6441
|
+
process.stderr.write(`hq runners: status row fields flag read failed open: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
6442
6442
|
}
|
|
6443
6443
|
if (!enabled)
|
|
6444
6444
|
return {};
|
|
@@ -7011,7 +7011,7 @@ async function refreshOutpostLaneCopiesForShow(ctx, lane, localLanes) {
|
|
|
7011
7011
|
const detail = isLanesError(err)
|
|
7012
7012
|
? `${err.error}: ${err.message}`
|
|
7013
7013
|
: `outpost_lane_sync_unavailable: ${dispatchErrorMessage(err)}`;
|
|
7014
|
-
process.stderr.write(`hq
|
|
7014
|
+
process.stderr.write(`hq runners: owner snapshot refresh failed for lane ${laneId}: ${detail}\n`);
|
|
7015
7015
|
return null;
|
|
7016
7016
|
}
|
|
7017
7017
|
};
|
|
@@ -7062,7 +7062,7 @@ async function runShow(ctx, laneId, hasPendingQuestionForLane, resolveLaneTarget
|
|
|
7062
7062
|
catch (err) {
|
|
7063
7063
|
managerStatusGateError = err instanceof LanesError ? err.error : "manager_status_gate_unavailable";
|
|
7064
7064
|
const message = err instanceof Error ? err.message : String(err);
|
|
7065
|
-
process.stderr.write(`hq
|
|
7065
|
+
process.stderr.write(`hq runners: manager status gate disabled for ${storedLane.lane_id}: ${managerStatusGateError}: ${message}\n`);
|
|
7066
7066
|
}
|
|
7067
7067
|
const blockerFreshness = await resolveBlockerFreshnessForLane(hqRoot, storedLane, {
|
|
7068
7068
|
env: ctx.env,
|
|
@@ -7086,7 +7086,7 @@ async function runShow(ctx, laneId, hasPendingQuestionForLane, resolveLaneTarget
|
|
|
7086
7086
|
? listLaneReviews(hqRoot, laneId)
|
|
7087
7087
|
: { reviews: [], skipped: 0 };
|
|
7088
7088
|
if (reviewListing.skipped > 0) {
|
|
7089
|
-
console.error(`hq
|
|
7089
|
+
console.error(`hq runners show: skipped ${reviewListing.skipped} invalid or unreadable review item(s)`);
|
|
7090
7090
|
}
|
|
7091
7091
|
const recentReviews = reviewListing.reviews
|
|
7092
7092
|
.filter((item) => {
|
|
@@ -7402,13 +7402,13 @@ async function printGrantResult(ctx, hqRoot, updated, hierarchy) {
|
|
|
7402
7402
|
});
|
|
7403
7403
|
}
|
|
7404
7404
|
/**
|
|
7405
|
-
* `hq
|
|
7405
|
+
* `hq runners set`: change the model or effort a lane uses from its next
|
|
7406
7406
|
* resume. The running turn keeps its values. Both are stored as explicit
|
|
7407
|
-
* (`cli`) choices, so keep-alive and `hq
|
|
7407
|
+
* (`cli`) choices, so keep-alive and `hq runners resume` keep them until the
|
|
7408
7408
|
* next `set` or an explicit resume `--effort`/`--worker`.
|
|
7409
7409
|
*
|
|
7410
7410
|
* A lane whose state lives on another Outpost is resolved the same way
|
|
7411
|
-
* `hq
|
|
7411
|
+
* `hq runners grant` resolves it, and the change is forwarded to the owning
|
|
7412
7412
|
* Outpost after the caller is checked against the owner's senior.
|
|
7413
7413
|
*/
|
|
7414
7414
|
async function runSet(ctx, laneId, opts) {
|
|
@@ -7451,7 +7451,7 @@ async function runSet(ctx, laneId, opts) {
|
|
|
7451
7451
|
printLaneSetResult(updated);
|
|
7452
7452
|
}
|
|
7453
7453
|
/**
|
|
7454
|
-
* Owner side of a forwarded `hq
|
|
7454
|
+
* Owner side of a forwarded `hq runners set`. The primary has already checked
|
|
7455
7455
|
* the caller against the lane's senior; this side accepts only an SSM Run
|
|
7456
7456
|
* Command dispatch for a lane hosted here whose senior is still the one the
|
|
7457
7457
|
* primary checked.
|
|
@@ -9320,7 +9320,7 @@ async function runLogs(ctx, laneId, opts) {
|
|
|
9320
9320
|
throw new LanesError("outpost_lane_logs_invalid", `Outpost ${outpostId} returned a malformed logs payload for lane ${laneId}`, { lane_id: laneId, outpost_id: outpostId });
|
|
9321
9321
|
}
|
|
9322
9322
|
if (tail === undefined && appliedTail !== undefined) {
|
|
9323
|
-
process.stderr.write(`hq
|
|
9323
|
+
process.stderr.write(`hq runners: full logs for lane ${laneId} exceed the Outpost exec output limit; showing the last ${appliedTail} lines of each stream\n`);
|
|
9324
9324
|
printJson({ ...body, tail_applied: appliedTail });
|
|
9325
9325
|
return;
|
|
9326
9326
|
}
|
|
@@ -9754,7 +9754,7 @@ async function dispatchOutpostLaneStop(ctx, lane, reason, quiet = false, behavio
|
|
|
9754
9754
|
* same attribution as a process lane (company, project, story, worker, brief,
|
|
9755
9755
|
* senior, model) so it shows on the lanes board, but admission and capacity
|
|
9756
9756
|
* are skipped and no provider process or watcher starts. The lane is
|
|
9757
|
-
* `running` from creation; `hq
|
|
9757
|
+
* `running` from creation; `hq runners progress` reports lines and the result.
|
|
9758
9758
|
*/
|
|
9759
9759
|
async function runCreateSubagent(ctx, opts) {
|
|
9760
9760
|
const unsupported = [
|
|
@@ -9942,7 +9942,7 @@ async function runCreateSubagent(ctx, opts) {
|
|
|
9942
9942
|
});
|
|
9943
9943
|
return lane;
|
|
9944
9944
|
}
|
|
9945
|
-
/** Longest progress line kept; `hq
|
|
9945
|
+
/** Longest progress line kept; `hq runners list` clips its last line further. */
|
|
9946
9946
|
const SUBAGENT_PROGRESS_LINE_MAX = 500;
|
|
9947
9947
|
/**
|
|
9948
9948
|
* Report on a subagent lane: append a progress line, record the final
|
|
@@ -10141,12 +10141,12 @@ async function runStop(ctx, laneId, reason, quiet = false) {
|
|
|
10141
10141
|
}
|
|
10142
10142
|
/** Stderr notice that `stop` ends a lane for good, naming the resumable path. */
|
|
10143
10143
|
function stopTerminalWarning(laneId) {
|
|
10144
|
-
return `hq
|
|
10144
|
+
return `hq runners: warning: stop kills lane ${laneId} and it cannot be resumed. ` +
|
|
10145
10145
|
`To pause it and keep it resumable, use hq runners interrupt ${laneId}.\n`;
|
|
10146
10146
|
}
|
|
10147
10147
|
/**
|
|
10148
10148
|
* Stop a running lane's worker and leave it `interrupted`, keeping the provider
|
|
10149
|
-
* session so `hq
|
|
10149
|
+
* session so `hq runners resume` continues it. Keep-alive resumes only
|
|
10150
10150
|
* `exited_with_partial_output` interruptions, so it leaves this lane alone.
|
|
10151
10151
|
*/
|
|
10152
10152
|
/** Stop-history text for an operator interrupt given without --reason. */
|
|
@@ -10154,7 +10154,7 @@ function defaultOperatorInterruptReason(ctx) {
|
|
|
10154
10154
|
const sessionId = sessionIdFromEnv(ctx.env);
|
|
10155
10155
|
const laneId = ctx.env.HQ_LANE_ID?.trim();
|
|
10156
10156
|
const caller = laneId ? ` by lane ${laneId}` : sessionId ? ` by session ${sessionId}` : "";
|
|
10157
|
-
return `hq
|
|
10157
|
+
return `hq runners interrupt${caller} (no reason given)`;
|
|
10158
10158
|
}
|
|
10159
10159
|
async function runInterrupt(ctx, laneId, reason, options = {}) {
|
|
10160
10160
|
const operatorReason = reason?.trim();
|
|
@@ -10267,7 +10267,7 @@ function persistInterruptedSession(hqRoot, lane) {
|
|
|
10267
10267
|
sessionId = readWorkerRunResult(runDir, lane.provider, readSpawnManifest(runDir).worker_out_offset ?? 0)?.session_id ?? null;
|
|
10268
10268
|
}
|
|
10269
10269
|
catch (err) {
|
|
10270
|
-
process.stderr.write(`hq
|
|
10270
|
+
process.stderr.write(`hq runners: could not read the session id of interrupted lane ${lane.lane_id}: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
10271
10271
|
}
|
|
10272
10272
|
if (sessionId === null || sessionId === lane.provider_session_id)
|
|
10273
10273
|
return lane;
|
|
@@ -10277,7 +10277,7 @@ function persistInterruptedSession(hqRoot, lane) {
|
|
|
10277
10277
|
}
|
|
10278
10278
|
/** Stderr notice when an interrupted lane has no session to resume from. */
|
|
10279
10279
|
function interruptNotResumableWarning(laneId) {
|
|
10280
|
-
return `hq
|
|
10280
|
+
return `hq runners: warning: lane ${laneId} was interrupted before its provider reported a session id, ` +
|
|
10281
10281
|
`so hq runners resume cannot continue it. Start a new lane for the remaining work.\n`;
|
|
10282
10282
|
}
|
|
10283
10283
|
function parseQuestionPriority(value) {
|
|
@@ -10351,7 +10351,7 @@ async function runAsk(ctx, opts) {
|
|
|
10351
10351
|
});
|
|
10352
10352
|
}
|
|
10353
10353
|
if (priority === undefined) {
|
|
10354
|
-
process.stderr.write(`hq
|
|
10354
|
+
process.stderr.write(`hq runners ask: warning: ${ASK_PRIORITY_WARNING}\n`);
|
|
10355
10355
|
}
|
|
10356
10356
|
printJson({
|
|
10357
10357
|
ok: true,
|
|
@@ -10367,7 +10367,7 @@ async function runAsk(ctx, opts) {
|
|
|
10367
10367
|
if (isLanesError(err) && err.error === "secret_text_refused")
|
|
10368
10368
|
throw err;
|
|
10369
10369
|
lastErr = err;
|
|
10370
|
-
process.stderr.write(`hq
|
|
10370
|
+
process.stderr.write(`hq runners ask: attempt ${i + 1}/${attempts} failed for ${lane.lane_id}: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
10371
10371
|
if (i === attempts - 1)
|
|
10372
10372
|
break;
|
|
10373
10373
|
await ctx.sleep(ASK_BACKOFF_MS[i] ?? ASK_BACKOFF_MS[ASK_BACKOFF_MS.length - 1]);
|
|
@@ -10386,7 +10386,7 @@ async function runAsk(ctx, opts) {
|
|
|
10386
10386
|
writeJsonFile(askDeliveryFailedPath(hqRoot, lane.lane_id), failure);
|
|
10387
10387
|
}
|
|
10388
10388
|
catch (writeErr) {
|
|
10389
|
-
process.stderr.write(`hq
|
|
10389
|
+
process.stderr.write(`hq runners: failed to write ask_delivery_failed for ${lane.lane_id}: ${writeErr instanceof Error ? writeErr.message : String(writeErr)}\n`);
|
|
10390
10390
|
}
|
|
10391
10391
|
throw new LanesError("ask_delivery_failed", `Failed to deliver ask for lane ${lane.lane_id}`, {
|
|
10392
10392
|
lane_id: lane.lane_id,
|
|
@@ -10519,7 +10519,7 @@ function writeAnswerDeliveryFailed(hqRoot, laneId, questionId, err, at) {
|
|
|
10519
10519
|
writeJsonFile(askDeliveryFailedPath(hqRoot, laneId), failure);
|
|
10520
10520
|
}
|
|
10521
10521
|
catch (writeErr) {
|
|
10522
|
-
process.stderr.write(`hq
|
|
10522
|
+
process.stderr.write(`hq runners: failed to write ask_delivery_failed for ${laneId}: ${writeErr instanceof Error ? writeErr.message : String(writeErr)}\n`);
|
|
10523
10523
|
}
|
|
10524
10524
|
}
|
|
10525
10525
|
/**
|
|
@@ -10776,17 +10776,17 @@ async function runReconcile(ctx, opts, recoverQueuedMessages) {
|
|
|
10776
10776
|
if (isNonInteractiveLoginError(error)) {
|
|
10777
10777
|
// Signed out: there is no Outpost list to read and nothing to sync.
|
|
10778
10778
|
// The daemon already reports this unit as waiting for sign-in, so the
|
|
10779
|
-
// pass records a note and stays healthy instead of failing every
|
|
10779
|
+
// pass records a note and stays healthy instead of failing every pass.
|
|
10780
10780
|
summary.notes ??= [];
|
|
10781
10781
|
summary.notes.push("Lead autopilot registry sync skipped: not signed in");
|
|
10782
|
-
process.stderr.write("hq
|
|
10782
|
+
process.stderr.write("hq runners autopilot registry: note: skipped, not signed in\n");
|
|
10783
10783
|
}
|
|
10784
10784
|
else {
|
|
10785
10785
|
const code = error instanceof LanesError ? error.error : "lead_autopilot_registry_sync_failed";
|
|
10786
10786
|
const message = error instanceof Error ? error.message : String(error);
|
|
10787
10787
|
summary.ok = false;
|
|
10788
10788
|
summary.errors.push({ code, message });
|
|
10789
|
-
process.stderr.write(`hq
|
|
10789
|
+
process.stderr.write(`hq runners autopilot registry: ${message}\n`);
|
|
10790
10790
|
}
|
|
10791
10791
|
}
|
|
10792
10792
|
}
|
|
@@ -10809,7 +10809,7 @@ async function runReconcile(ctx, opts, recoverQueuedMessages) {
|
|
|
10809
10809
|
const message = error instanceof Error ? error.message : String(error);
|
|
10810
10810
|
summary.ok = false;
|
|
10811
10811
|
summary.errors.push({ code: error instanceof LanesError ? error.error : "lead_autopilot_failed", message });
|
|
10812
|
-
process.stderr.write(`hq
|
|
10812
|
+
process.stderr.write(`hq runners autopilot: ${message}\n`);
|
|
10813
10813
|
}
|
|
10814
10814
|
if (!opts.inProcess) {
|
|
10815
10815
|
printJson({
|
|
@@ -198,6 +198,10 @@ export declare function codexHome(env: SafeWriteEnv): string;
|
|
|
198
198
|
export declare function codexConfigPath(env: SafeWriteEnv): string;
|
|
199
199
|
/** True iff the Codex runtime is installed (`~/.codex` exists). Never creates it. */
|
|
200
200
|
export declare function isCodexInstalled(env: SafeWriteEnv): boolean;
|
|
201
|
+
/** `~/.gemini/config` — the Antigravity config root. */
|
|
202
|
+
export declare function antigravityConfigDir(env: SafeWriteEnv): string;
|
|
203
|
+
/** `~/.gemini/config/mcp_config.json` — the GLOBAL Antigravity MCP config (App, IDE and CLI share it). */
|
|
204
|
+
export declare function antigravityConfigPath(env: SafeWriteEnv): string;
|
|
201
205
|
/** `~/.claude.json` — the PINNED single Claude surface (top-level mcpServers). */
|
|
202
206
|
export declare function claudeConfigPath(env: SafeWriteEnv): string;
|
|
203
207
|
/** Outcome of {@link readConfigDoc}: a parsed doc plus whether the file pre-existed. */
|
|
@@ -622,6 +626,19 @@ export declare function assertValidServerName(name: string): void;
|
|
|
622
626
|
* @throws ConfigParseError / ConfigPermissionError / PartialRegistrationError (from the core)
|
|
623
627
|
*/
|
|
624
628
|
export declare function registerClaudeServer(opts: RegisterServerOptions): RegisterSurfaceResult;
|
|
629
|
+
export declare const antigravityConfigFormat: ConfigFormat<Record<string, unknown>>;
|
|
630
|
+
/** Build the Antigravity server def (same command/args/env as Claude and Codex). */
|
|
631
|
+
export declare function buildAntigravityServerDef(manifest: McpManifest, resolve: SecretResolver, secretSink: Set<string>): Record<string, unknown>;
|
|
632
|
+
/** True iff `entry` is a local stdio server launched as `<cmd> ... mcp serve` (the shape HQ writes). */
|
|
633
|
+
export declare function isHqLocalAntigravityServer(entry: unknown): boolean;
|
|
634
|
+
/** Merge fn for the Antigravity surface. A foreign entry of the same name throws McpNameCollisionError. */
|
|
635
|
+
export declare function mergeAntigravityServer(name: string, def: Record<string, unknown>): (doc: Record<string, unknown>) => Record<string, unknown>;
|
|
636
|
+
/**
|
|
637
|
+
* Emit ONE server into `~/.gemini/config/mcp_config.json`, creating the file if
|
|
638
|
+
* needed. Skips SSE manifests, which Antigravity does not support. Called only by
|
|
639
|
+
* `hq install --global`; registerServer does not fan out to Antigravity.
|
|
640
|
+
*/
|
|
641
|
+
export declare function registerAntigravityServer(opts: RegisterServerOptions): RegisterSurfaceResult | RegisterSurfaceSkip;
|
|
625
642
|
/**
|
|
626
643
|
* Fan ONE server out across the per-runtime surfaces. US-007 wires the Claude/JSON
|
|
627
644
|
* arm ({@link registerClaudeServer}); US-008 wires the Codex/TOML arm
|
|
@@ -219,6 +219,14 @@ export function isCodexInstalled(env) {
|
|
|
219
219
|
return false;
|
|
220
220
|
}
|
|
221
221
|
}
|
|
222
|
+
/** `~/.gemini/config` — the Antigravity config root. */
|
|
223
|
+
export function antigravityConfigDir(env) {
|
|
224
|
+
return path.join(env.home, '.gemini', 'config');
|
|
225
|
+
}
|
|
226
|
+
/** `~/.gemini/config/mcp_config.json` — the GLOBAL Antigravity MCP config (App, IDE and CLI share it). */
|
|
227
|
+
export function antigravityConfigPath(env) {
|
|
228
|
+
return path.join(antigravityConfigDir(env), 'mcp_config.json');
|
|
229
|
+
}
|
|
222
230
|
/** `~/.claude.json` — the PINNED single Claude surface (top-level mcpServers). */
|
|
223
231
|
export function claudeConfigPath(env) {
|
|
224
232
|
return path.join(env.home, '.claude.json');
|
|
@@ -1315,6 +1323,117 @@ export function registerClaudeServer(opts) {
|
|
|
1315
1323
|
throw e;
|
|
1316
1324
|
}
|
|
1317
1325
|
}
|
|
1326
|
+
// ---------------------------------------------------------------------------
|
|
1327
|
+
// Antigravity/JSON surface (`~/.gemini/config/mcp_config.json`).
|
|
1328
|
+
//
|
|
1329
|
+
// Shape: {"mcpServers": {"<name>": {command, args, env}}} for stdio, or
|
|
1330
|
+
// {serverUrl, headers} for Streamable HTTP. Antigravity does not support legacy
|
|
1331
|
+
// SSE, so an `sse` manifest is skipped. Every other server and top-level key is
|
|
1332
|
+
// preserved by the merge; the file goes through writeConfigAtomic (lock, backup,
|
|
1333
|
+
// atomic replace, verify). A non-empty file that is not valid JSON aborts with
|
|
1334
|
+
// ConfigParseError and is never overwritten.
|
|
1335
|
+
//
|
|
1336
|
+
// Only `hq install --global` writes here, and only the core `hq` server. Entries
|
|
1337
|
+
// carry no `_hqPack` provenance key: Google documents a fixed set of entry keys,
|
|
1338
|
+
// so HQ adds none. An existing entry counts as HQ's own when it is a local stdio
|
|
1339
|
+
// `... mcp serve` server (see {@link isHqLocalAntigravityServer}).
|
|
1340
|
+
// ---------------------------------------------------------------------------
|
|
1341
|
+
export const antigravityConfigFormat = {
|
|
1342
|
+
parse: jsonFormat.parse,
|
|
1343
|
+
serialize: jsonFormat.serialize,
|
|
1344
|
+
emptyDoc: () => ({}),
|
|
1345
|
+
assertEntry(doc, name) {
|
|
1346
|
+
const servers = doc.mcpServers;
|
|
1347
|
+
if (!servers || typeof servers !== 'object' || Array.isArray(servers) || !(name in servers)) {
|
|
1348
|
+
throw new Error(`mcpServers.${name} not present after write`);
|
|
1349
|
+
}
|
|
1350
|
+
},
|
|
1351
|
+
};
|
|
1352
|
+
/** Build the Antigravity server def (same command/args/env as Claude and Codex). */
|
|
1353
|
+
export function buildAntigravityServerDef(manifest, resolve, secretSink) {
|
|
1354
|
+
const def = {};
|
|
1355
|
+
if (manifest.type === 'http') {
|
|
1356
|
+
if (manifest.url !== undefined)
|
|
1357
|
+
def.serverUrl = manifest.url;
|
|
1358
|
+
if (manifest.headers !== undefined)
|
|
1359
|
+
def.headers = resolveStringMap(manifest.headers, resolve, secretSink);
|
|
1360
|
+
}
|
|
1361
|
+
else {
|
|
1362
|
+
if (manifest.command !== undefined)
|
|
1363
|
+
def.command = manifest.command;
|
|
1364
|
+
if (manifest.args !== undefined)
|
|
1365
|
+
def.args = manifest.args.map((arg) => resolveSecretRefs(arg, resolve, secretSink));
|
|
1366
|
+
if (manifest.env !== undefined)
|
|
1367
|
+
def.env = resolveStringMap(manifest.env, resolve, secretSink);
|
|
1368
|
+
}
|
|
1369
|
+
return def;
|
|
1370
|
+
}
|
|
1371
|
+
/** True iff `entry` is a local stdio server launched as `<cmd> ... mcp serve` (the shape HQ writes). */
|
|
1372
|
+
export function isHqLocalAntigravityServer(entry) {
|
|
1373
|
+
if (!entry || typeof entry !== 'object' || Array.isArray(entry))
|
|
1374
|
+
return false;
|
|
1375
|
+
const e = entry;
|
|
1376
|
+
if (typeof e.command !== 'string' || e.serverUrl !== undefined || e.url !== undefined)
|
|
1377
|
+
return false;
|
|
1378
|
+
if (!Array.isArray(e.args) || e.args.length < 2)
|
|
1379
|
+
return false;
|
|
1380
|
+
return e.args[e.args.length - 2] === 'mcp' && e.args[e.args.length - 1] === 'serve';
|
|
1381
|
+
}
|
|
1382
|
+
/** Merge fn for the Antigravity surface. A foreign entry of the same name throws McpNameCollisionError. */
|
|
1383
|
+
export function mergeAntigravityServer(name, def) {
|
|
1384
|
+
return (doc) => {
|
|
1385
|
+
const current = doc.mcpServers;
|
|
1386
|
+
if (current !== undefined && (current === null || typeof current !== 'object' || Array.isArray(current))) {
|
|
1387
|
+
throw new McpNameCollisionError('mcpServers in ~/.gemini/config/mcp_config.json is not an object; refusing to rewrite it.');
|
|
1388
|
+
}
|
|
1389
|
+
const servers = { ...(current ?? {}) };
|
|
1390
|
+
const existing = servers[name];
|
|
1391
|
+
if (existing !== undefined) {
|
|
1392
|
+
if (serverDefsEqual(existing, def))
|
|
1393
|
+
return doc;
|
|
1394
|
+
if (isHqLocalAntigravityServer(existing) && isHqLocalAntigravityServer(def)) {
|
|
1395
|
+
servers[name] = def;
|
|
1396
|
+
return { ...doc, mcpServers: servers };
|
|
1397
|
+
}
|
|
1398
|
+
throw new McpNameCollisionError(`MCP server "${name}" is already defined in ~/.gemini/config/mcp_config.json with a ` +
|
|
1399
|
+
'different definition — refusing to overwrite. Remove or rename the existing server, then re-install.');
|
|
1400
|
+
}
|
|
1401
|
+
servers[name] = def;
|
|
1402
|
+
return { ...doc, mcpServers: servers };
|
|
1403
|
+
};
|
|
1404
|
+
}
|
|
1405
|
+
/**
|
|
1406
|
+
* Emit ONE server into `~/.gemini/config/mcp_config.json`, creating the file if
|
|
1407
|
+
* needed. Skips SSE manifests, which Antigravity does not support. Called only by
|
|
1408
|
+
* `hq install --global`; registerServer does not fan out to Antigravity.
|
|
1409
|
+
*/
|
|
1410
|
+
export function registerAntigravityServer(opts) {
|
|
1411
|
+
assertValidServerName(opts.name);
|
|
1412
|
+
const env = resolveEnv(opts.env);
|
|
1413
|
+
if (opts.manifest.type === 'sse') {
|
|
1414
|
+
return { skipped: true, reason: 'Antigravity supports stdio and Streamable HTTP MCP servers, not SSE' };
|
|
1415
|
+
}
|
|
1416
|
+
const secretSink = new Set();
|
|
1417
|
+
const def = buildAntigravityServerDef(opts.manifest, opts.resolveSecret ?? noSecretResolver, secretSink);
|
|
1418
|
+
try {
|
|
1419
|
+
const res = writeConfigAtomic({
|
|
1420
|
+
target: antigravityConfigPath(env),
|
|
1421
|
+
pack: opts.pack,
|
|
1422
|
+
format: antigravityConfigFormat,
|
|
1423
|
+
merge: mergeAntigravityServer(opts.name, def),
|
|
1424
|
+
assertName: opts.name,
|
|
1425
|
+
env: opts.env,
|
|
1426
|
+
lock: opts.lock,
|
|
1427
|
+
stamp: opts.stamp,
|
|
1428
|
+
});
|
|
1429
|
+
return { changed: res.changed, realTarget: res.realTarget };
|
|
1430
|
+
}
|
|
1431
|
+
catch (e) {
|
|
1432
|
+
if (secretSink.size > 0 && e instanceof Error)
|
|
1433
|
+
e.message = redactSecrets(e.message, secretSink);
|
|
1434
|
+
throw e;
|
|
1435
|
+
}
|
|
1436
|
+
}
|
|
1318
1437
|
/**
|
|
1319
1438
|
* Resolve the Claude target path from a (partial) env, mirroring
|
|
1320
1439
|
* {@link claudeConfigPath} but tolerating an undefined env (production default).
|
package/dist/commands/mesh.d.ts
CHANGED
|
@@ -76,6 +76,31 @@ export declare function sessionEventGoesToSpool(kind: SessionEventKind, enqueue:
|
|
|
76
76
|
export declare function registerMeshCommand(program: Command, deps?: {
|
|
77
77
|
defaultCompanyPrompt?: DefaultCompanyPromptDeps;
|
|
78
78
|
}): void;
|
|
79
|
+
/** What the duplicate user unit check before the pid lock tells the start path. */
|
|
80
|
+
export interface DuplicateUnitCheck {
|
|
81
|
+
/** This process belongs to the user unit that was just removed: exit instead of starting. */
|
|
82
|
+
exitAfter?: boolean;
|
|
83
|
+
/** This process belongs to the system unit: remove the user unit only after holding the pid lock. */
|
|
84
|
+
removeAfterLock?: boolean;
|
|
85
|
+
}
|
|
86
|
+
export interface DuplicateUnitStartHooks {
|
|
87
|
+
/** Check before the pid lock (tests inject; default reconcileDuplicateMeshUnit on Linux). */
|
|
88
|
+
reconcile?: () => Promise<DuplicateUnitCheck>;
|
|
89
|
+
/** Removal once the pid lock is held (tests inject; default removeDuplicateUserUnitOnceSettled). */
|
|
90
|
+
onLockHeld?: (lockDir: string) => Promise<unknown>;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Start the Work Mesh daemon with the Linux duplicate user unit check around
|
|
94
|
+
* it (boxes that run Work Mesh from /etc/systemd/system/hq-mesh-daemon.service
|
|
95
|
+
* and also carry a per-user unit). Returns null when this process belongs to
|
|
96
|
+
* the removed user unit and must exit. A process of the system unit removes
|
|
97
|
+
* the user unit only after `start` has taken the pid lock; when another live
|
|
98
|
+
* daemon holds the lock, `start` throws as before and nothing is removed.
|
|
99
|
+
* The check itself never throws and never stops the daemon from starting.
|
|
100
|
+
*/
|
|
101
|
+
export declare function startMeshDaemonWithDuplicateCheck<T extends {
|
|
102
|
+
dir: string;
|
|
103
|
+
}>(start: () => Promise<T>, hooks?: DuplicateUnitStartHooks): Promise<T | null>;
|
|
79
104
|
/**
|
|
80
105
|
* The resident Work Mesh loop. `hq daemon` runs it as its `mesh` service
|
|
81
106
|
* (`hq daemon service mesh`); `hq mesh daemon run`, which older standalone
|