@indigoai-us/hq-cli 5.345.230 → 5.345.232
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 +54 -0
- package/README.md +3 -2
- package/assets/lanes-reconcile/hq-lanes-reconcile.service +1 -1
- package/assets/scaffold/core/scripts/pipeline-conductor.sh +14 -14
- package/assets/scaffold/core/scripts/pipeline-driver.sh +7 -7
- package/assets/scaffold/core/scripts/session-project.sh +19 -4
- package/dist/command-catalog.generated.d.ts +213 -177
- package/dist/command-catalog.generated.js +263 -212
- package/dist/command-registration-plan.d.ts +6 -24
- package/dist/command-registration-plan.js +4 -8
- package/dist/commands/auth.js +3 -2
- package/dist/commands/core-pipeline-conductor-command.js +1 -1
- package/dist/commands/core-pipeline-conductor-native.js +5 -5
- package/dist/commands/core-pipeline-driver-native.js +5 -5
- package/dist/commands/crm.js +2 -1
- package/dist/commands/daemon.js +7 -36
- package/dist/commands/deploy-access.js +6 -13
- package/dist/commands/deploy-comments.js +5 -13
- package/dist/commands/deploy-domains.js +6 -13
- package/dist/commands/deploy-list.js +25 -11
- package/dist/commands/deploy-mutations.d.ts +3 -0
- package/dist/commands/deploy-mutations.js +147 -0
- package/dist/commands/link.js +29 -0
- package/dist/commands/mesh.js +3 -1
- package/dist/commands/packs.js +3 -2
- package/dist/commands/pkg-remove.js +2 -1
- package/dist/commands/report.js +12 -9
- package/dist/data/command-states.json +10 -7
- package/dist/lib/bot/fleet-bots-update-pass.d.ts +8 -0
- package/dist/lib/bot/fleet-bots-update-pass.js +40 -0
- package/dist/lib/bot/fleet-bots-update-task.d.ts +12 -0
- package/dist/lib/bot/fleet-bots-update-task.js +52 -0
- package/dist/lib/bot/fleet-bots-update-worker-v1.d.ts +2 -0
- package/dist/lib/bot/fleet-bots-update-worker-v1.js +5 -0
- package/dist/lib/daemon/catalog.d.ts +8 -5
- package/dist/lib/daemon/catalog.js +15 -8
- package/dist/lib/daemon/hook-requests-codex-settings.d.ts +26 -0
- package/dist/lib/daemon/hook-requests-codex-settings.js +185 -0
- package/dist/lib/daemon/hook-requests-conduct-link.d.ts +1 -0
- package/dist/lib/daemon/hook-requests-conduct-link.js +21 -4
- package/dist/lib/daemon/hook-requests.d.ts +3 -2
- package/dist/lib/daemon/hook-requests.js +16 -3
- package/dist/lib/daemon/lock.js +33 -37
- package/dist/lib/daemon/ops/skill-command.d.ts +99 -0
- package/dist/lib/daemon/ops/skill-command.js +260 -0
- package/dist/lib/daemon/protocol.d.ts +1 -1
- package/dist/lib/daemon/protocol.js +1 -0
- package/dist/lib/daemon/run.js +10 -18
- package/dist/lib/daemon/server.js +7 -0
- package/dist/lib/daemon/supervisor.d.ts +5 -0
- package/dist/lib/daemon/supervisor.js +17 -2
- package/dist/lib/db/app-ref.js +10 -15
- package/dist/lib/deploy-apps.d.ts +29 -0
- package/dist/lib/deploy-apps.js +37 -0
- package/dist/lib/doctor/checks/search-index.d.ts +16 -0
- package/dist/lib/doctor/checks/search-index.js +61 -0
- package/dist/lib/doctor/checks/stranded-lanes.js +1 -1
- package/dist/lib/doctor/registry.js +4 -0
- package/dist/lib/flag-registry.d.ts +7 -0
- package/dist/lib/flag-registry.js +20 -0
- package/dist/lib/hook-engine/coverage.d.ts +18 -0
- package/dist/lib/hook-engine/coverage.js +42 -1
- package/dist/lib/lanes/accounts.js +3 -3
- package/dist/lib/lanes/admission-host.js +1 -1
- package/dist/lib/lanes/admission.js +4 -4
- package/dist/lib/lanes/autopilot.js +2 -2
- package/dist/lib/lanes/blocker-freshness.js +1 -1
- package/dist/lib/lanes/compaction.js +5 -5
- package/dist/lib/lanes/delivery.js +1 -1
- package/dist/lib/lanes/depth-cap.js +1 -1
- package/dist/lib/lanes/disk-guard.js +1 -1
- package/dist/lib/lanes/dropbox.js +1 -1
- package/dist/lib/lanes/hooks-install.js +1 -1
- package/dist/lib/lanes/imported-question.js +1 -1
- package/dist/lib/lanes/keep-alive.d.ts +2 -2
- package/dist/lib/lanes/keep-alive.js +3 -3
- package/dist/lib/lanes/kr-freshness.js +1 -1
- package/dist/lib/lanes/links.js +92 -11
- package/dist/lib/lanes/loop.js +2 -2
- package/dist/lib/lanes/machine-identity.js +3 -3
- package/dist/lib/lanes/models.js +6 -6
- package/dist/lib/lanes/quota.js +1 -1
- package/dist/lib/lanes/reconcile-install.js +3 -3
- package/dist/lib/lanes/reconcile.js +16 -16
- package/dist/lib/lanes/remote-control-lane.js +6 -6
- package/dist/lib/lanes/reviews.js +2 -2
- package/dist/lib/lanes/spawn.js +24 -24
- package/dist/lib/lanes/status-fields.js +4 -4
- package/dist/lib/lanes/wait.js +4 -4
- package/dist/lib/lanes/watch.js +2 -2
- package/dist/lib/lanes/watcher-main.js +1 -1
- package/dist/lib/lanes/watcher.js +38 -38
- package/dist/lib/lanes/worker-process.js +5 -5
- package/dist/lib/mesh/live/daemon/pid-lock.d.ts +2 -4
- package/dist/lib/mesh/live/daemon/pid-lock.js +38 -55
- package/dist/utils/exclusive-lock.d.ts +60 -0
- package/dist/utils/exclusive-lock.js +65 -0
- package/dist/utils/exit-after-worker.d.ts +7 -0
- package/dist/utils/exit-after-worker.js +15 -0
- package/package.json +8 -7
- package/dist/commands/staff/listings.d.ts +0 -41
- package/dist/commands/staff/listings.js +0 -160
- package/dist/commands/staff/reset-test-account.d.ts +0 -121
- package/dist/commands/staff/reset-test-account.js +0 -285
- package/dist/commands/staff/test-account.d.ts +0 -51
- package/dist/commands/staff/test-account.js +0 -196
|
@@ -102,7 +102,7 @@ function shellQuote(v) {
|
|
|
102
102
|
return /^[A-Za-z0-9_./:-]+$/.test(v) ? v : `'${v.replace(/'/g, `'\\''`)}'`;
|
|
103
103
|
}
|
|
104
104
|
export function renderReconcileService(opts) {
|
|
105
|
-
const exec = [opts.nodeBinary, opts.hqBinary, "
|
|
105
|
+
const exec = [opts.nodeBinary, opts.hqBinary, "runners", "reconcile"]
|
|
106
106
|
.map(shellQuote)
|
|
107
107
|
.join(" ");
|
|
108
108
|
const home = opts.home ?? os.homedir();
|
|
@@ -168,7 +168,7 @@ function writeIfChanged(filePath, contents) {
|
|
|
168
168
|
catch (unlinkErr) {
|
|
169
169
|
const unlinkCode = unlinkErr.code;
|
|
170
170
|
if (unlinkCode !== "ENOENT") {
|
|
171
|
-
process.stderr.write(`hq
|
|
171
|
+
process.stderr.write(`hq runners reconcile install: unlink tmp failed for ${tmp}: ${unlinkErr instanceof Error ? unlinkErr.message : String(unlinkErr)}\n`);
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
174
|
throw err;
|
|
@@ -237,7 +237,7 @@ export function uninstallReconcileTimer(opts) {
|
|
|
237
237
|
RECONCILE_TIMER_NAME,
|
|
238
238
|
]);
|
|
239
239
|
if (disable.status !== 0) {
|
|
240
|
-
process.stderr.write(`hq
|
|
240
|
+
process.stderr.write(`hq runners reconcile uninstall: systemctl disable exited ${disable.status}: ${(disable.stderr ?? "").trim()}\n`);
|
|
241
241
|
}
|
|
242
242
|
opts.runCommand("systemctl", ["--user", "daemon-reload"]);
|
|
243
243
|
}
|
|
@@ -110,12 +110,12 @@ async function resumeDueQuotaHeldLanes(hqRoot, lanes, summary, deps, now) {
|
|
|
110
110
|
const message = error instanceof Error ? error.message : String(error);
|
|
111
111
|
summary.errors.push({ message: `${lane.lane_id}: quota retry failed: ${message}` });
|
|
112
112
|
summary.ok = false;
|
|
113
|
-
process.stderr.write(`hq
|
|
113
|
+
process.stderr.write(`hq runners reconcile: quota retry failed for ${lane.lane_id}: ${message}\n`);
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
117
|
function logSkip(skip) {
|
|
118
|
-
process.stderr.write(`hq
|
|
118
|
+
process.stderr.write(`hq runners reconcile: skipped ${skip.kind}${skip.id ? ` ${skip.id}` : ""}: ${skip.why}\n`);
|
|
119
119
|
}
|
|
120
120
|
function emptySummary(dryRun) {
|
|
121
121
|
return {
|
|
@@ -149,7 +149,7 @@ function recordMissingCodexHomeNote(summary, home) {
|
|
|
149
149
|
const note = `Codex rollout retention skipped home absent on this host: ${home}`;
|
|
150
150
|
summary.notes ??= [];
|
|
151
151
|
summary.notes.push(note);
|
|
152
|
-
process.stderr.write(`hq
|
|
152
|
+
process.stderr.write(`hq runners reconcile: note: ${note}\n`);
|
|
153
153
|
}
|
|
154
154
|
function homeIsMissingAfterError(home, error) {
|
|
155
155
|
if (!isMissingPathError(error))
|
|
@@ -172,7 +172,7 @@ function terminalizeModelUnsupported(hqRoot, lane, err) {
|
|
|
172
172
|
});
|
|
173
173
|
}
|
|
174
174
|
catch (writeErr) {
|
|
175
|
-
process.stderr.write(`hq
|
|
175
|
+
process.stderr.write(`hq runners reconcile: failed to terminalize ${lane.lane_id} after model validation: ${writeErr instanceof Error ? writeErr.message : String(writeErr)}\n`);
|
|
176
176
|
}
|
|
177
177
|
}
|
|
178
178
|
function markError(summary, err) {
|
|
@@ -180,7 +180,7 @@ function markError(summary, err) {
|
|
|
180
180
|
const code = err instanceof LanesError ? err.error : undefined;
|
|
181
181
|
summary.errors.push(code ? { message, code } : { message });
|
|
182
182
|
summary.ok = false;
|
|
183
|
-
process.stderr.write(`hq
|
|
183
|
+
process.stderr.write(`hq runners reconcile: ${message}${err instanceof Error && err.stack ? `\n${err.stack}` : ""}\n`);
|
|
184
184
|
}
|
|
185
185
|
export function reconcileHeartbeatPath(hqRoot) {
|
|
186
186
|
return path.join(hqRoot, "workspace", "lanes-runs", "reconcile-heartbeat.json");
|
|
@@ -926,7 +926,7 @@ function writeHeartbeatFile(hqRoot, summary, at) {
|
|
|
926
926
|
catch (unlinkErr) {
|
|
927
927
|
const code = unlinkErr.code;
|
|
928
928
|
if (code !== "ENOENT") {
|
|
929
|
-
process.stderr.write(`hq
|
|
929
|
+
process.stderr.write(`hq runners reconcile: unlink heartbeat tmp failed: ${unlinkErr instanceof Error ? unlinkErr.message : String(unlinkErr)}\n`);
|
|
930
930
|
}
|
|
931
931
|
}
|
|
932
932
|
throw err;
|
|
@@ -963,7 +963,7 @@ async function withReconcileLock(hqRoot, fn) {
|
|
|
963
963
|
fs.closeSync(fd);
|
|
964
964
|
}
|
|
965
965
|
catch (err) {
|
|
966
|
-
process.stderr.write(`hq
|
|
966
|
+
process.stderr.write(`hq runners reconcile: lock close failed: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
967
967
|
}
|
|
968
968
|
try {
|
|
969
969
|
// Unlink only our own lock; a reclaimer may have replaced it.
|
|
@@ -974,7 +974,7 @@ async function withReconcileLock(hqRoot, fn) {
|
|
|
974
974
|
catch (err) {
|
|
975
975
|
const code = err.code;
|
|
976
976
|
if (code !== "ENOENT") {
|
|
977
|
-
process.stderr.write(`hq
|
|
977
|
+
process.stderr.write(`hq runners reconcile: lock unlink failed: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
978
978
|
}
|
|
979
979
|
}
|
|
980
980
|
}
|
|
@@ -990,14 +990,14 @@ async function withReconcileLock(hqRoot, fn) {
|
|
|
990
990
|
if (reclaimStaleLock(lockPath, {
|
|
991
991
|
staleMs: RECONCILE_LOCK_STALE_MS,
|
|
992
992
|
liveOwnerMaxMs: liveOwnerMaxMs(),
|
|
993
|
-
label: "hq
|
|
993
|
+
label: "hq runners reconcile",
|
|
994
994
|
}))
|
|
995
995
|
continue;
|
|
996
996
|
}
|
|
997
997
|
catch (statErr) {
|
|
998
998
|
const statCode = statErr.code;
|
|
999
999
|
if (statCode !== "ENOENT") {
|
|
1000
|
-
process.stderr.write(`hq
|
|
1000
|
+
process.stderr.write(`hq runners reconcile: stale-lock probe failed: ${statErr instanceof Error ? statErr.message : String(statErr)}\n`);
|
|
1001
1001
|
}
|
|
1002
1002
|
}
|
|
1003
1003
|
Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, 10);
|
|
@@ -1401,7 +1401,7 @@ export async function runPassBody(hqRoot, deps) {
|
|
|
1401
1401
|
if (!(err instanceof LanesError))
|
|
1402
1402
|
throw err;
|
|
1403
1403
|
maxAgedAdvances = MAX_AGED_ADVANCES;
|
|
1404
|
-
process.stderr.write(`hq
|
|
1404
|
+
process.stderr.write(`hq runners reconcile: lane depth config failed for company=${JSON.stringify(question.company?.slug)}; using default ${MAX_LANE_DEPTH}: ${err.message}\n`);
|
|
1405
1405
|
}
|
|
1406
1406
|
if (shouldAgeQuestion(question, audience, nowMs, questionAgeWindowMs(audience), maxAgedAdvances)) {
|
|
1407
1407
|
const nextHop = question.hop + 1;
|
|
@@ -1892,7 +1892,7 @@ async function heartbeatAndDeadHosts(hqRoot, lanes, summary, deps, now) {
|
|
|
1892
1892
|
}
|
|
1893
1893
|
catch (sizeErr) {
|
|
1894
1894
|
const sizeMessage = sizeErr instanceof Error ? sizeErr.message : String(sizeErr);
|
|
1895
|
-
process.stderr.write(`hq
|
|
1895
|
+
process.stderr.write(`hq runners reconcile: run size not recorded before account failover for ${lane.lane_id}: ${sizeMessage}\n`);
|
|
1896
1896
|
// The write did not land, so the classified record is still current.
|
|
1897
1897
|
retryLane = classified;
|
|
1898
1898
|
}
|
|
@@ -1910,7 +1910,7 @@ async function heartbeatAndDeadHosts(hqRoot, lanes, summary, deps, now) {
|
|
|
1910
1910
|
}
|
|
1911
1911
|
catch (err) {
|
|
1912
1912
|
const message = err instanceof Error ? err.message : String(err);
|
|
1913
|
-
process.stderr.write(`hq
|
|
1913
|
+
process.stderr.write(`hq runners reconcile: account failover failed for ${lane.lane_id}: ${message}\n`);
|
|
1914
1914
|
if (readLane(hqRoot, lane.lane_id).state !== "running") {
|
|
1915
1915
|
summary.errors.push({ message: `${lane.lane_id}: account failover left a non-running record after ${message}` });
|
|
1916
1916
|
continue;
|
|
@@ -1934,7 +1934,7 @@ async function heartbeatAndDeadHosts(hqRoot, lanes, summary, deps, now) {
|
|
|
1934
1934
|
state: "failed",
|
|
1935
1935
|
reason: `question_record_refused:${questionRefusalCode}`,
|
|
1936
1936
|
};
|
|
1937
|
-
process.stderr.write(`hq
|
|
1937
|
+
process.stderr.write(`hq runners reconcile: terminal ask refused for ${lane.lane_id}: ${questionRefusalCode}\n`);
|
|
1938
1938
|
}
|
|
1939
1939
|
}
|
|
1940
1940
|
let terminalEnvelope = latest?.envelope;
|
|
@@ -2043,7 +2043,7 @@ async function heartbeatAndDeadHosts(hqRoot, lanes, summary, deps, now) {
|
|
|
2043
2043
|
}
|
|
2044
2044
|
catch (err) {
|
|
2045
2045
|
const message = err instanceof Error ? err.message : String(err);
|
|
2046
|
-
process.stderr.write(`hq
|
|
2046
|
+
process.stderr.write(`hq runners reconcile: quota notice failed for ${lane.lane_id}: ${message}\n`);
|
|
2047
2047
|
}
|
|
2048
2048
|
}
|
|
2049
2049
|
if (result.changed) {
|
|
@@ -2549,7 +2549,7 @@ function recordKeepAliveSkip(hqRoot, lane, reason, summary, deps, detail) {
|
|
|
2549
2549
|
});
|
|
2550
2550
|
if (lane.keep_alive === true) {
|
|
2551
2551
|
summary.keep_alive_blocked.push({ id: lane.lane_id, reason });
|
|
2552
|
-
process.stderr.write(`hq
|
|
2552
|
+
process.stderr.write(`hq runners reconcile: keep-alive blocked for lane ${lane.lane_id} (${reason}); ${keepAliveSkipGuidance(lane.lane_id, reason)}\n`);
|
|
2553
2553
|
}
|
|
2554
2554
|
if (deps.dryRun)
|
|
2555
2555
|
return;
|
|
@@ -184,13 +184,13 @@ async function runInside(args) {
|
|
|
184
184
|
tmux(socket, ["kill-session", "-t", session]);
|
|
185
185
|
const started = tmux(socket, ["new-session", "-d", "-s", session, "-c", process.cwd(), command]);
|
|
186
186
|
if (started.status !== 0) {
|
|
187
|
-
process.stderr.write(`hq
|
|
187
|
+
process.stderr.write(`hq runners: could not start Remote Control terminal: ${started.stderr}\n`);
|
|
188
188
|
return 1;
|
|
189
189
|
}
|
|
190
190
|
const retained = tmux(socket, ["set-option", "-t", session, "remain-on-exit", "on"]);
|
|
191
191
|
if (retained.status !== 0) {
|
|
192
192
|
tmux(socket, ["kill-session", "-t", session]);
|
|
193
|
-
process.stderr.write(`hq
|
|
193
|
+
process.stderr.write(`hq runners: could not retain Remote Control terminal output: ${retained.stderr}\n`);
|
|
194
194
|
return 1;
|
|
195
195
|
}
|
|
196
196
|
let stopped = false;
|
|
@@ -200,7 +200,7 @@ async function runInside(args) {
|
|
|
200
200
|
try {
|
|
201
201
|
while (!stopped) {
|
|
202
202
|
if (!ownedForwarder(readyFile, accountId)) {
|
|
203
|
-
process.stderr.write(`hq
|
|
203
|
+
process.stderr.write(`hq runners: daemon inference forwarder for account ${accountId} stopped\n`);
|
|
204
204
|
return 1;
|
|
205
205
|
}
|
|
206
206
|
if (fs.existsSync(envelopePath)) {
|
|
@@ -211,7 +211,7 @@ async function runInside(args) {
|
|
|
211
211
|
await new Promise((resolve) => setTimeout(resolve, 500));
|
|
212
212
|
}
|
|
213
213
|
if (!fs.existsSync(transcript)) {
|
|
214
|
-
process.stderr.write("hq
|
|
214
|
+
process.stderr.write("hq runners: Remote Control wrote an envelope but its session transcript is missing\n");
|
|
215
215
|
return 1;
|
|
216
216
|
}
|
|
217
217
|
process.stdout.write(`${JSON.stringify({ type: "result", session_id: sessionId })}\n`);
|
|
@@ -223,7 +223,7 @@ async function runInside(args) {
|
|
|
223
223
|
const paneText = remoteControlFailureText(socket, session);
|
|
224
224
|
if (paneText.trim())
|
|
225
225
|
process.stderr.write(`${paneText}\n`);
|
|
226
|
-
process.stderr.write("hq
|
|
226
|
+
process.stderr.write("hq runners: Remote Control terminal exited before the lane envelope was written\n");
|
|
227
227
|
return 1;
|
|
228
228
|
}
|
|
229
229
|
await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
@@ -268,7 +268,7 @@ async function runOuter(args) {
|
|
|
268
268
|
process.once("SIGTERM", forward);
|
|
269
269
|
process.once("SIGINT", forward);
|
|
270
270
|
child.once("error", (error) => {
|
|
271
|
-
process.stderr.write(`hq
|
|
271
|
+
process.stderr.write(`hq runners: Remote Control namespace could not start: ${error.message}\n`);
|
|
272
272
|
finish(127);
|
|
273
273
|
});
|
|
274
274
|
child.once("exit", (code) => finish(code ?? 1));
|
|
@@ -345,7 +345,7 @@ async function withReviewRecordLock(file, action) {
|
|
|
345
345
|
fs.closeSync(fd);
|
|
346
346
|
}
|
|
347
347
|
catch (error) {
|
|
348
|
-
process.stderr.write(`hq
|
|
348
|
+
process.stderr.write(`hq runners review: lock close failed for ${lockPath}: ${error instanceof Error ? error.message : String(error)}\n`);
|
|
349
349
|
}
|
|
350
350
|
if (ownedStat) {
|
|
351
351
|
try {
|
|
@@ -355,7 +355,7 @@ async function withReviewRecordLock(file, action) {
|
|
|
355
355
|
}
|
|
356
356
|
catch (error) {
|
|
357
357
|
if (error.code !== "ENOENT") {
|
|
358
|
-
process.stderr.write(`hq
|
|
358
|
+
process.stderr.write(`hq runners review: lock cleanup failed for ${lockPath}: ${error instanceof Error ? error.message : String(error)}\n`);
|
|
359
359
|
}
|
|
360
360
|
}
|
|
361
361
|
}
|
package/dist/lib/lanes/spawn.js
CHANGED
|
@@ -1043,7 +1043,7 @@ export function readProcStarttimeDetailed(pid) {
|
|
|
1043
1043
|
}
|
|
1044
1044
|
if (code === "ENOENT")
|
|
1045
1045
|
return { starttime: null, error: "ENOENT" };
|
|
1046
|
-
process.stderr.write(`hq
|
|
1046
|
+
process.stderr.write(`hq runners: failed to read starttime for pid ${pid}: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
1047
1047
|
return {
|
|
1048
1048
|
starttime: null,
|
|
1049
1049
|
error: typeof code === "string" ? code : "unreadable",
|
|
@@ -1083,7 +1083,7 @@ export function readPidRecord(filePath) {
|
|
|
1083
1083
|
const code = err.code;
|
|
1084
1084
|
if (code === "ENOENT")
|
|
1085
1085
|
return null;
|
|
1086
|
-
process.stderr.write(`hq
|
|
1086
|
+
process.stderr.write(`hq runners: failed to read pid file ${filePath}: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
1087
1087
|
throw err;
|
|
1088
1088
|
}
|
|
1089
1089
|
}
|
|
@@ -1189,7 +1189,7 @@ export function signalProcessGroup(pid, signal, killProcess) {
|
|
|
1189
1189
|
if (code === "ESRCH")
|
|
1190
1190
|
return;
|
|
1191
1191
|
if (code !== "EINVAL" && code !== "EPERM") {
|
|
1192
|
-
process.stderr.write(`hq
|
|
1192
|
+
process.stderr.write(`hq runners: process-group ${signal} for pid ${pid} failed: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
1193
1193
|
}
|
|
1194
1194
|
}
|
|
1195
1195
|
try {
|
|
@@ -1199,7 +1199,7 @@ export function signalProcessGroup(pid, signal, killProcess) {
|
|
|
1199
1199
|
const code = err.code;
|
|
1200
1200
|
if (code === "ESRCH")
|
|
1201
1201
|
return;
|
|
1202
|
-
process.stderr.write(`hq
|
|
1202
|
+
process.stderr.write(`hq runners: ${signal} for pid ${pid} failed: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
1203
1203
|
throw err;
|
|
1204
1204
|
}
|
|
1205
1205
|
}
|
|
@@ -1264,7 +1264,7 @@ export function defaultProveDetached(pid, deps = {}) {
|
|
|
1264
1264
|
catch (err) {
|
|
1265
1265
|
const code = err.code;
|
|
1266
1266
|
if (code !== "ENOENT") {
|
|
1267
|
-
process.stderr.write(`hq
|
|
1267
|
+
process.stderr.write(`hq runners: failed to read ${proc}: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
1268
1268
|
throw err;
|
|
1269
1269
|
}
|
|
1270
1270
|
}
|
|
@@ -1277,7 +1277,7 @@ export function defaultProveDetached(pid, deps = {}) {
|
|
|
1277
1277
|
return { detached: false, pid, method: "pid_alive", reason: "pid_not_alive" };
|
|
1278
1278
|
}
|
|
1279
1279
|
if (code !== "EPERM") {
|
|
1280
|
-
process.stderr.write(`hq
|
|
1280
|
+
process.stderr.write(`hq runners: liveness probe for pid ${pid} failed: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
1281
1281
|
throw err;
|
|
1282
1282
|
}
|
|
1283
1283
|
}
|
|
@@ -1314,7 +1314,7 @@ function proveDetachedViaPs(pid) {
|
|
|
1314
1314
|
};
|
|
1315
1315
|
}
|
|
1316
1316
|
catch (err) {
|
|
1317
|
-
process.stderr.write(`hq
|
|
1317
|
+
process.stderr.write(`hq runners: ps detach proof failed for pid ${pid}: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
1318
1318
|
return null;
|
|
1319
1319
|
}
|
|
1320
1320
|
}
|
|
@@ -1446,7 +1446,7 @@ export function readAnsweredQuestionLines(answersPath) {
|
|
|
1446
1446
|
const code = err.code;
|
|
1447
1447
|
if (code === "ENOENT")
|
|
1448
1448
|
return [];
|
|
1449
|
-
process.stderr.write(`hq
|
|
1449
|
+
process.stderr.write(`hq runners: failed to read ${answersPath}: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
1450
1450
|
throw err;
|
|
1451
1451
|
}
|
|
1452
1452
|
let parsed;
|
|
@@ -1561,7 +1561,7 @@ function recoverRawJsonArrayField(rawText, field) {
|
|
|
1561
1561
|
return Array.isArray(parsed) ? parsed : undefined;
|
|
1562
1562
|
}
|
|
1563
1563
|
catch {
|
|
1564
|
-
process.stderr.write("hq
|
|
1564
|
+
process.stderr.write("hq runners: envelope repair could not recover the supplied JSON array\n");
|
|
1565
1565
|
return undefined;
|
|
1566
1566
|
}
|
|
1567
1567
|
}
|
|
@@ -1628,7 +1628,7 @@ export function envelopeRepairPrompt(input) {
|
|
|
1628
1628
|
originalObject = parsed;
|
|
1629
1629
|
}
|
|
1630
1630
|
catch {
|
|
1631
|
-
process.stderr.write("hq
|
|
1631
|
+
process.stderr.write("hq runners: envelope repair is recovering values from invalid JSON\n");
|
|
1632
1632
|
}
|
|
1633
1633
|
const rawStringField = (field) => {
|
|
1634
1634
|
const token = input.rawText.match(new RegExp(`"${field}"\\s*:\\s*("(?:\\\\.|[^"\\\\])*")`))?.[1];
|
|
@@ -1638,7 +1638,7 @@ export function envelopeRepairPrompt(input) {
|
|
|
1638
1638
|
return JSON.parse(token);
|
|
1639
1639
|
}
|
|
1640
1640
|
catch {
|
|
1641
|
-
process.stderr.write(`hq
|
|
1641
|
+
process.stderr.write(`hq runners: envelope repair could not recover the supplied ${field} string\n`);
|
|
1642
1642
|
return undefined;
|
|
1643
1643
|
}
|
|
1644
1644
|
};
|
|
@@ -1925,7 +1925,7 @@ function installedWorkerPolicyHookSupportsDirectory(hqRoot) {
|
|
|
1925
1925
|
const code = err.code;
|
|
1926
1926
|
if (code === "ENOENT")
|
|
1927
1927
|
return false;
|
|
1928
|
-
process.stderr.write(`hq
|
|
1928
|
+
process.stderr.write(`hq runners: cannot inspect worker-policy hook capability at ${hookPath}: ${err instanceof Error ? err.message : String(err)}; keeping policy prompt delivery\n`);
|
|
1929
1929
|
return false;
|
|
1930
1930
|
}
|
|
1931
1931
|
}
|
|
@@ -1946,7 +1946,7 @@ function fileSizeOrZero(filePath) {
|
|
|
1946
1946
|
const code = err.code;
|
|
1947
1947
|
if (code === "ENOENT")
|
|
1948
1948
|
return 0;
|
|
1949
|
-
process.stderr.write(`hq
|
|
1949
|
+
process.stderr.write(`hq runners: failed to stat ${filePath}: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
1950
1950
|
throw err;
|
|
1951
1951
|
}
|
|
1952
1952
|
}
|
|
@@ -1972,7 +1972,7 @@ function closeFd(fd, label) {
|
|
|
1972
1972
|
fs.closeSync(fd);
|
|
1973
1973
|
}
|
|
1974
1974
|
catch (err) {
|
|
1975
|
-
process.stderr.write(`hq
|
|
1975
|
+
process.stderr.write(`hq runners: failed to close ${label} fd ${fd}: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
1976
1976
|
throw err;
|
|
1977
1977
|
}
|
|
1978
1978
|
}
|
|
@@ -1984,7 +1984,7 @@ function killQuietly(kill, pid, label) {
|
|
|
1984
1984
|
const code = err.code;
|
|
1985
1985
|
if (code === "ESRCH")
|
|
1986
1986
|
return;
|
|
1987
|
-
process.stderr.write(`hq
|
|
1987
|
+
process.stderr.write(`hq runners: failed to stop ${label} pid ${pid}: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
1988
1988
|
throw err;
|
|
1989
1989
|
}
|
|
1990
1990
|
}
|
|
@@ -2262,7 +2262,7 @@ export function readSpawnManifest(runDir) {
|
|
|
2262
2262
|
const code = err.code;
|
|
2263
2263
|
if (code === "ENOENT")
|
|
2264
2264
|
return {};
|
|
2265
|
-
process.stderr.write(`hq
|
|
2265
|
+
process.stderr.write(`hq runners: failed to read ${filePath}: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
2266
2266
|
throw err;
|
|
2267
2267
|
}
|
|
2268
2268
|
let parsed;
|
|
@@ -2270,7 +2270,7 @@ export function readSpawnManifest(runDir) {
|
|
|
2270
2270
|
parsed = JSON.parse(text);
|
|
2271
2271
|
}
|
|
2272
2272
|
catch (err) {
|
|
2273
|
-
process.stderr.write(`hq
|
|
2273
|
+
process.stderr.write(`hq runners: ${filePath} is not valid JSON: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
2274
2274
|
return {};
|
|
2275
2275
|
}
|
|
2276
2276
|
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed))
|
|
@@ -2592,11 +2592,11 @@ export function spawnLaneWorker(hqRoot, lane, deps = {}, launch = {}) {
|
|
|
2592
2592
|
};
|
|
2593
2593
|
});
|
|
2594
2594
|
if (recorded) {
|
|
2595
|
-
process.stderr.write(`hq
|
|
2595
|
+
process.stderr.write(`hq runners: lane ${lane.lane_id} waits: ${err.message}\n`);
|
|
2596
2596
|
}
|
|
2597
2597
|
throw err;
|
|
2598
2598
|
}
|
|
2599
|
-
process.stderr.write(`hq
|
|
2599
|
+
process.stderr.write(`hq runners: account bind failed for ${lane.lane_id}: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
2600
2600
|
throw err;
|
|
2601
2601
|
}
|
|
2602
2602
|
const preservedAccountModel = selection.preservedModel;
|
|
@@ -2717,7 +2717,7 @@ export function spawnLaneWorker(hqRoot, lane, deps = {}, launch = {}) {
|
|
|
2717
2717
|
installDrainHook(lane.provider, remoteControlHome ?? resolved.home);
|
|
2718
2718
|
}
|
|
2719
2719
|
catch (err) {
|
|
2720
|
-
process.stderr.write(`hq
|
|
2720
|
+
process.stderr.write(`hq runners: drain hook install failed for ${resolved.home}: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
2721
2721
|
throw err;
|
|
2722
2722
|
}
|
|
2723
2723
|
const briefPath = path.join(runDir, "brief.md");
|
|
@@ -2931,7 +2931,7 @@ export function spawnLaneWorker(hqRoot, lane, deps = {}, launch = {}) {
|
|
|
2931
2931
|
catch (err) {
|
|
2932
2932
|
const code = err instanceof LanesError ? err.error : "manager_status_gate_unavailable";
|
|
2933
2933
|
const message = err instanceof Error ? err.message : String(err);
|
|
2934
|
-
process.stderr.write(`hq
|
|
2934
|
+
process.stderr.write(`hq runners: manager status gate disabled for ${lane.lane_id}: ${code}: ${message}\n`);
|
|
2935
2935
|
statusGateHeartbeat = undefined;
|
|
2936
2936
|
}
|
|
2937
2937
|
let claimed = false;
|
|
@@ -3113,10 +3113,10 @@ export function spawnLaneWorker(hqRoot, lane, deps = {}, launch = {}) {
|
|
|
3113
3113
|
fs.rmSync(replayStateTempPath, { force: true });
|
|
3114
3114
|
}
|
|
3115
3115
|
catch (cleanupErr) {
|
|
3116
|
-
process.stderr.write(`hq
|
|
3116
|
+
process.stderr.write(`hq runners: compaction replay state temp cleanup failed for ${lane.lane_id}: ${cleanupErr instanceof Error ? cleanupErr.message : String(cleanupErr)}\n`);
|
|
3117
3117
|
}
|
|
3118
3118
|
delete childEnv.HQ_LANE_TURN_ID;
|
|
3119
|
-
process.stderr.write(`hq
|
|
3119
|
+
process.stderr.write(`hq runners: compaction replay disabled for ${lane.lane_id}; failed to reset turn state: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
3120
3120
|
}
|
|
3121
3121
|
const workerOutPath = path.join(logsDir, "worker.out");
|
|
3122
3122
|
const workerOutOffset = fileSizeOrZero(workerOutPath);
|
|
@@ -3362,7 +3362,7 @@ export function spawnEnvelopeRepair(hqRoot, lane, input, deps = {}) {
|
|
|
3362
3362
|
? { registryWorkerRecord: lane.registry_worker }
|
|
3363
3363
|
: {}),
|
|
3364
3364
|
onUnknownMetaFields: (fields) => {
|
|
3365
|
-
process.stderr.write(`hq
|
|
3365
|
+
process.stderr.write(`hq runners watcher: envelope repair ignored unknown worker profile meta field(s) for ${lane.worker_profile}: ${fields.join(", ")}\n`);
|
|
3366
3366
|
input.onProfileWarning?.(fields);
|
|
3367
3367
|
},
|
|
3368
3368
|
})
|
|
@@ -19,7 +19,7 @@ function readTail(filePath, maxBytes) {
|
|
|
19
19
|
}
|
|
20
20
|
catch (error) {
|
|
21
21
|
if (error.code !== "ENOENT") {
|
|
22
|
-
process.stderr.write(`hq
|
|
22
|
+
process.stderr.write(`hq runners: could not read status tail ${filePath}: ${error instanceof Error ? error.message : String(error)}\n`);
|
|
23
23
|
}
|
|
24
24
|
return null;
|
|
25
25
|
}
|
|
@@ -101,7 +101,7 @@ function terminalExit(lane, runDir) {
|
|
|
101
101
|
return parsed.exit_code;
|
|
102
102
|
}
|
|
103
103
|
catch {
|
|
104
|
-
process.stderr.write(`hq
|
|
104
|
+
process.stderr.write(`hq runners: worker exit record is invalid for ${lane.lane_id}\n`);
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
107
|
const row = lane;
|
|
@@ -125,7 +125,7 @@ function startTimeMs(lane, runDir) {
|
|
|
125
125
|
}
|
|
126
126
|
catch (error) {
|
|
127
127
|
if (error.code !== "ENOENT") {
|
|
128
|
-
process.stderr.write(`hq
|
|
128
|
+
process.stderr.write(`hq runners: could not read worker start time ${runDir}: ${error instanceof Error ? error.message : String(error)}\n`);
|
|
129
129
|
}
|
|
130
130
|
return null;
|
|
131
131
|
}
|
|
@@ -153,7 +153,7 @@ export function readLaneStatusRowFields(hqRoot, lane, nowMs = Date.now(), local
|
|
|
153
153
|
}
|
|
154
154
|
catch (error) {
|
|
155
155
|
if (error.code !== "ENOENT") {
|
|
156
|
-
process.stderr.write(`hq
|
|
156
|
+
process.stderr.write(`hq runners: could not read status envelopes for ${lane.lane_id}: ${error instanceof Error ? error.message : String(error)}\n`);
|
|
157
157
|
}
|
|
158
158
|
}
|
|
159
159
|
const prSources = [
|
package/dist/lib/lanes/wait.js
CHANGED
|
@@ -14,22 +14,22 @@ function invalidInput(message, details = {}) {
|
|
|
14
14
|
function validateInput(laneIds, changeTypes, timeoutMs) {
|
|
15
15
|
const normalizedLaneIds = laneIds.map((laneId) => laneId.trim());
|
|
16
16
|
if (normalizedLaneIds.length === 0 || normalizedLaneIds.some((laneId) => laneId.length === 0)) {
|
|
17
|
-
invalidInput("hq
|
|
17
|
+
invalidInput("hq runners wait requires at least one non-empty lane id", { lane_ids: laneIds });
|
|
18
18
|
}
|
|
19
19
|
if (normalizedLaneIds.some((laneId) => laneId === "." || laneId === ".." || /[\\/]/.test(laneId))) {
|
|
20
20
|
invalidInput("Lane ids must not contain path separators", { lane_ids: laneIds });
|
|
21
21
|
}
|
|
22
22
|
const uniqueLaneIds = [...new Set(normalizedLaneIds)];
|
|
23
23
|
if (uniqueLaneIds.length > LANE_WAIT_MAX_LANES) {
|
|
24
|
-
invalidInput(`hq
|
|
24
|
+
invalidInput(`hq runners wait accepts at most ${LANE_WAIT_MAX_LANES} lane ids`, {
|
|
25
25
|
max: LANE_WAIT_MAX_LANES,
|
|
26
26
|
});
|
|
27
27
|
}
|
|
28
28
|
if (changeTypes.length === 0 || changeTypes.some((kind) => !LANE_WAIT_CHANGE_TYPES.includes(kind))) {
|
|
29
|
-
invalidInput(`hq
|
|
29
|
+
invalidInput(`hq runners wait requires one or more --for values: ${LANE_WAIT_CHANGE_TYPES.join(", ")}`, { accepted: [...LANE_WAIT_CHANGE_TYPES], values: changeTypes });
|
|
30
30
|
}
|
|
31
31
|
if (!Number.isFinite(timeoutMs) || timeoutMs <= 0 || !Number.isSafeInteger(Math.ceil(timeoutMs))) {
|
|
32
|
-
invalidInput("hq
|
|
32
|
+
invalidInput("hq runners wait requires a positive finite timeout", { timeout_ms: timeoutMs });
|
|
33
33
|
}
|
|
34
34
|
return {
|
|
35
35
|
laneIds: uniqueLaneIds,
|
package/dist/lib/lanes/watch.js
CHANGED
|
@@ -29,10 +29,10 @@ function validateLaneIds(laneIds) {
|
|
|
29
29
|
throw new LanesError("watch_invalid_lane_id", "Lane ids must not be empty");
|
|
30
30
|
}
|
|
31
31
|
if (unique.length === 0) {
|
|
32
|
-
throw new LanesError("watch_no_lanes", "hq
|
|
32
|
+
throw new LanesError("watch_no_lanes", "hq runners watch requires at least one lane id");
|
|
33
33
|
}
|
|
34
34
|
if (unique.length > MAX_WATCHED_LANES) {
|
|
35
|
-
throw new LanesError("watch_too_many_lanes", `hq
|
|
35
|
+
throw new LanesError("watch_too_many_lanes", `hq runners watch accepts at most ${MAX_WATCHED_LANES} lane ids`, { max: MAX_WATCHED_LANES });
|
|
36
36
|
}
|
|
37
37
|
return unique;
|
|
38
38
|
}
|
|
@@ -97,7 +97,7 @@ function main() {
|
|
|
97
97
|
process.exit(1);
|
|
98
98
|
}
|
|
99
99
|
void runWatcherLoop(hqRoot, laneId, watcherMainDeps(hqRoot, laneId, process.env)).catch((err) => {
|
|
100
|
-
process.stderr.write(`hq
|
|
100
|
+
process.stderr.write(`hq runners watcher: ${err instanceof Error ? err.message : String(err)}${err instanceof Error && err.stack ? `\n${err.stack}` : ""}\n`);
|
|
101
101
|
process.exit(1);
|
|
102
102
|
});
|
|
103
103
|
}
|