@indigoai-us/hq-cli 5.345.223 → 5.345.226
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 +98 -0
- package/assets/bot-workers/setup/context/quick-reference.md +2 -2
- package/assets/mesh-daemon/README.md +11 -12
- package/dist/command-catalog.generated.d.ts +156 -4
- package/dist/command-catalog.generated.js +191 -4
- package/dist/commands/cloud-provision.d.ts +4 -1
- package/dist/commands/cloud-provision.js +7 -3
- package/dist/commands/cloud-retire.js +1 -1
- package/dist/commands/core-delegate-w1b.js +3 -1
- package/dist/commands/core-delegate.d.ts +5 -0
- package/dist/commands/core-dm-bind-native.d.ts +5 -1
- package/dist/commands/core-dm-bind-native.js +4 -0
- package/dist/commands/core-job-notify-native.d.ts +5 -1
- package/dist/commands/core-job-notify-native.js +8 -2
- package/dist/commands/core-jobs-native.d.ts +27 -1
- package/dist/commands/core-jobs-native.js +49 -28
- package/dist/commands/core-pipeline-conductor-native.js +7 -7
- package/dist/commands/core-pipeline-driver-native.js +5 -5
- package/dist/commands/core-refresh-vault-access-native.d.ts +5 -0
- package/dist/commands/core-refresh-vault-access-native.js +3 -1
- package/dist/commands/core-work-mesh-bind-trusted-native.js +1 -1
- package/dist/commands/daemon.d.ts +2 -0
- package/dist/commands/daemon.js +68 -2
- package/dist/commands/deploy-domains.js +38 -2
- package/dist/commands/lanes-accounts.d.ts +14 -0
- package/dist/commands/lanes-accounts.js +119 -0
- package/dist/commands/lanes-hold.d.ts +2 -27
- package/dist/commands/lanes-hold.js +3 -75
- package/dist/commands/lanes-loop.js +1 -1
- package/dist/commands/lanes-move.js +10 -0
- package/dist/commands/lanes-session-start.js +2 -2
- package/dist/commands/lanes-shared.js +9 -0
- package/dist/commands/lanes.js +137 -12
- package/dist/commands/mesh.d.ts +12 -0
- package/dist/commands/mesh.js +13 -4
- package/dist/commands/monitor.js +1 -1
- package/dist/commands/packs.js +1 -1
- package/dist/commands/sync-held.d.ts +22 -0
- package/dist/commands/sync-held.js +167 -18
- package/dist/commands/whoami.d.ts +10 -17
- package/dist/commands/whoami.js +7 -79
- package/dist/data/command-states.json +13 -0
- package/dist/hq-cloud-sync-runner/bin/sync-runner.js +4845 -2524
- package/dist/hq-cloud-sync-runner/package.json +1 -1
- package/dist/index.js +1 -1
- package/dist/lib/capacity/accounts.d.ts +4 -0
- package/dist/lib/capacity/accounts.js +4 -0
- package/dist/lib/capacity/route.js +14 -0
- package/dist/lib/capacity/sign-in.d.ts +18 -0
- package/dist/lib/capacity/sign-in.js +34 -1
- package/dist/lib/daemon/catalog.d.ts +9 -5
- package/dist/lib/daemon/catalog.js +14 -8
- package/dist/lib/daemon/config.d.ts +5 -0
- package/dist/lib/daemon/config.js +6 -0
- package/dist/lib/daemon/hook-requests.d.ts +76 -0
- package/dist/lib/daemon/hook-requests.js +481 -0
- package/dist/lib/daemon/lanes-monitor-state.d.ts +55 -0
- package/dist/lib/daemon/lanes-monitor-state.js +129 -0
- package/dist/lib/daemon/lanes-reconcile-loader.d.ts +7 -0
- package/dist/lib/daemon/lanes-reconcile-loader.js +13 -0
- package/dist/lib/daemon/lanes-reconcile-status.d.ts +35 -0
- package/dist/lib/daemon/lanes-reconcile-status.js +86 -0
- package/dist/lib/daemon/merge-sections.d.ts +165 -0
- package/dist/lib/daemon/merge-sections.js +556 -0
- package/dist/lib/daemon/ops/policy.d.ts +2 -2
- package/dist/lib/daemon/ops/policy.js +44 -5
- package/dist/lib/daemon/protocol.d.ts +1 -1
- package/dist/lib/daemon/protocol.js +0 -6
- package/dist/lib/daemon/run.js +110 -5
- package/dist/lib/daemon/selfcheck.js +2 -2
- package/dist/lib/daemon/server.d.ts +2 -4
- package/dist/lib/daemon/server.js +11 -49
- package/dist/lib/daemon/state-file.d.ts +74 -4
- package/dist/lib/daemon/state-file.js +159 -19
- package/dist/lib/daemon/supervisor.d.ts +3 -1
- package/dist/lib/daemon/updater.d.ts +2 -6
- package/dist/lib/daemon/updater.js +4 -11
- package/dist/lib/daemon/whoami-cache.d.ts +96 -0
- package/dist/lib/daemon/whoami-cache.js +244 -0
- package/dist/lib/flag-registry-worker-source.generated.d.ts +1 -1
- package/dist/lib/flag-registry-worker-source.generated.js +1 -1
- package/dist/lib/hook-engine/coverage.d.ts +2 -0
- package/dist/lib/hook-engine/coverage.js +71 -0
- package/dist/lib/hook-engine/native-precompact-compatibility.json +449 -0
- package/dist/lib/hook-engine/reconcile.js +14 -8
- package/dist/lib/install/hook-target.d.ts +13 -3
- package/dist/lib/install/hook-target.js +14 -11
- package/dist/lib/lanes/account-company.d.ts +7 -1
- package/dist/lib/lanes/account-company.js +22 -4
- package/dist/lib/lanes/account-ownership.d.ts +65 -0
- package/dist/lib/lanes/account-ownership.js +134 -0
- package/dist/lib/lanes/accounts.js +9 -2
- package/dist/lib/lanes/claude-balance.js +9 -3
- package/dist/lib/lanes/config.js +17 -0
- package/dist/lib/lanes/envelope-repair-dispatch.js +1 -1
- package/dist/lib/lanes/host-capacity.d.ts +19 -0
- package/dist/lib/lanes/host-capacity.js +37 -0
- package/dist/lib/lanes/monitor.d.ts +2 -0
- package/dist/lib/lanes/monitor.js +2 -1
- package/dist/lib/lanes/reconcile.js +44 -3
- package/dist/lib/lanes/registry-flag.d.ts +6 -0
- package/dist/lib/lanes/registry-flag.js +3 -2
- package/dist/lib/lanes/repo-merge-hold.d.ts +39 -0
- package/dist/lib/lanes/repo-merge-hold.js +90 -0
- package/dist/lib/lanes/spawn.d.ts +0 -10
- package/dist/lib/lanes/spawn.js +51 -1
- package/dist/lib/lanes/types.d.ts +12 -0
- package/dist/lib/lanes/watcher-main.js +3 -3
- package/dist/lib/mesh/live/daemon/doctor.js +1 -1
- package/dist/lib/mesh/live/daemon/install.js +2 -2
- package/dist/lib/windows/install-followup.js +1 -1
- package/dist/utils/client-health-contract.d.ts +1 -0
- package/dist/utils/client-health-contract.js +5 -0
- package/dist/utils/client-health.d.ts +2 -0
- package/dist/utils/client-health.js +40 -0
- package/dist/utils/cognito-session.d.ts +2 -14
- package/dist/utils/cognito-session.js +2 -40
- package/dist/utils/daemon-cli-version.d.ts +13 -0
- package/dist/utils/daemon-cli-version.js +47 -0
- package/dist/utils/duplicate-command-usage.js +1 -1
- package/dist/utils/machine-token-cache.d.ts +21 -0
- package/dist/utils/machine-token-cache.js +49 -0
- package/dist/utils/resident-package-preload.js +4 -0
- package/dist/utils/whoami-identity.d.ts +54 -0
- package/dist/utils/whoami-identity.js +108 -0
- package/package.json +8 -8
- package/dist/lib/daemon/ops/memory.d.ts +0 -18
- package/dist/lib/daemon/ops/memory.js +0 -65
- package/dist/lib/daemon/ops/mesh.d.ts +0 -38
- package/dist/lib/daemon/ops/mesh.js +0 -70
|
@@ -1682,7 +1682,7 @@ function do_route(p, sid) {
|
|
|
1682
1682
|
if (lane) {
|
|
1683
1683
|
let rows;
|
|
1684
1684
|
try {
|
|
1685
|
-
const listed = JSON.parse(run(E.PC_HQ, ["
|
|
1685
|
+
const listed = JSON.parse(run(E.PC_HQ, ["runners", "list", "--json"], { timeout: 30000 }).stdout || "{}");
|
|
1686
1686
|
rows = Array.isArray(listed) ? listed : get(listed, "lanes", null);
|
|
1687
1687
|
}
|
|
1688
1688
|
catch (e) {
|
|
@@ -1707,7 +1707,7 @@ function do_route(p, sid) {
|
|
|
1707
1707
|
const laneBrief = pjoin(laneBriefDir, ph.worker + ".md");
|
|
1708
1708
|
writeText(laneBrief, "# Pipeline loop lane: " + project + " / " + ph.worker + "\n\n" +
|
|
1709
1709
|
"Pipeline phases arrive as queued envelopes. Follow each envelope; this standing brief has no task of its own.\n");
|
|
1710
|
-
const createArgs = ["
|
|
1710
|
+
const createArgs = ["runners", "create", "--loop", "--company", company, "--project", project,
|
|
1711
1711
|
"--story", sid, "--worker", ph.worker, "--brief-file", abspath(laneBrief), "--senior", "session:" + session, "--json"];
|
|
1712
1712
|
const table = get(or(jload(sp("run.json"), {}), {}), "table", "");
|
|
1713
1713
|
if (T(table) && exists(table)) {
|
|
@@ -1752,7 +1752,7 @@ function do_route(p, sid) {
|
|
|
1752
1752
|
envData.id = baseEnvelopeId + (suffixes[ph.phase] ? ".r" + suffixes[ph.phase] : "");
|
|
1753
1753
|
envData.result_path = abspath(sp("handoffs", sid + "-" + ph.phase + ".json"));
|
|
1754
1754
|
jsave(ep, envData);
|
|
1755
|
-
let r = run(E.PC_HQ, ["
|
|
1755
|
+
let r = run(E.PC_HQ, ["runners", "enqueue", lane, "--envelope", abspath(ep)], { timeout: 30000 });
|
|
1756
1756
|
let ans;
|
|
1757
1757
|
try {
|
|
1758
1758
|
ans = JSON.parse(r.stdout);
|
|
@@ -1770,7 +1770,7 @@ function do_route(p, sid) {
|
|
|
1770
1770
|
envData.id = baseEnvelopeId + ".r" + n;
|
|
1771
1771
|
jsave(sfile(sid), st);
|
|
1772
1772
|
jsave(ep, envData);
|
|
1773
|
-
r = run(E.PC_HQ, ["
|
|
1773
|
+
r = run(E.PC_HQ, ["runners", "enqueue", lane, "--envelope", abspath(ep)], { timeout: 30000 });
|
|
1774
1774
|
try {
|
|
1775
1775
|
ans = JSON.parse(r.stdout);
|
|
1776
1776
|
}
|
|
@@ -2621,7 +2621,7 @@ function lane_runs() {
|
|
|
2621
2621
|
function withdraw(lane, sid, ph) {
|
|
2622
2622
|
if (!T(lane))
|
|
2623
2623
|
return false;
|
|
2624
|
-
const r = run(E.PC_HQ, ["
|
|
2624
|
+
const r = run(E.PC_HQ, ["runners", "interrupt", lane, "--story", sid, "--phase", ph, "--json"], { timeout: 30000 });
|
|
2625
2625
|
let ans;
|
|
2626
2626
|
try {
|
|
2627
2627
|
ans = JSON.parse(r.stdout);
|
|
@@ -2701,10 +2701,10 @@ function do_stop() {
|
|
|
2701
2701
|
do_interrupt("stop: " + (note() || "parent stop command"));
|
|
2702
2702
|
const lanes = Array.from(lane_runs().values());
|
|
2703
2703
|
for (const lane of lanes)
|
|
2704
|
-
run(E.PC_HQ, ["
|
|
2704
|
+
run(E.PC_HQ, ["runners", "stop", lane], { timeout: 30000 });
|
|
2705
2705
|
let listed = null;
|
|
2706
2706
|
try {
|
|
2707
|
-
const parsed = JSON.parse(run(E.PC_HQ, ["
|
|
2707
|
+
const parsed = JSON.parse(run(E.PC_HQ, ["runners", "list", "--json"], { timeout: 30000 }).stdout || "{}");
|
|
2708
2708
|
listed = Array.isArray(parsed) ? parsed : get(parsed, "lanes", null);
|
|
2709
2709
|
}
|
|
2710
2710
|
catch (e) {
|
|
@@ -54,7 +54,7 @@ export function scanDriverState(stateDir, maxFails, hqBin, run = spawnSync, queu
|
|
|
54
54
|
lanes = new Map();
|
|
55
55
|
try {
|
|
56
56
|
const owned = load(path.join(S, 'lanes.json')) || {};
|
|
57
|
-
const r = run(HQ, ['
|
|
57
|
+
const r = run(HQ, ['runners', 'list', '--json'], { encoding: 'utf8', timeout: 30000 });
|
|
58
58
|
if (!r.error) {
|
|
59
59
|
const text = String(r.stdout || ''), starts = [text.indexOf('['), text.indexOf('{')].filter((n) => n >= 0);
|
|
60
60
|
const parsed = JSON.parse(starts.length ? text.slice(Math.min(...starts)) : text);
|
|
@@ -314,7 +314,7 @@ export function checkDriverStall(stateDir, stallWindow, hqBin, run = spawnSync)
|
|
|
314
314
|
let rows = [];
|
|
315
315
|
try {
|
|
316
316
|
const owned = load(path.join(S, 'lanes.json')) || {};
|
|
317
|
-
const r = run(HQ, ['
|
|
317
|
+
const r = run(HQ, ['runners', 'list', '--json'], { encoding: 'utf8', timeout: 30000 });
|
|
318
318
|
const text = String(r.stdout || ''), starts = [text.indexOf('['), text.indexOf('{')].filter((n) => n >= 0);
|
|
319
319
|
const parsed = JSON.parse(starts.length ? text.slice(Math.min(...starts)) : text);
|
|
320
320
|
const listed = Array.isArray(parsed) ? parsed : (isObj(parsed) && Array.isArray(parsed.lanes) ? parsed.lanes : []);
|
|
@@ -629,7 +629,7 @@ function driverTimestamp() {
|
|
|
629
629
|
return new Date().toISOString().replace(/\.\d{3}Z$/, "Z");
|
|
630
630
|
}
|
|
631
631
|
function laneRowsFromHq(hq) {
|
|
632
|
-
const result = driverRun(hq, ["
|
|
632
|
+
const result = driverRun(hq, ["runners", "list", "--json"]);
|
|
633
633
|
if (result.code !== 0)
|
|
634
634
|
throw new Error(`hq lanes list --json exited ${result.code}: ${result.stderr.trim()}`);
|
|
635
635
|
return extractLaneRows(result.stdout);
|
|
@@ -649,7 +649,7 @@ export async function stopDriverLanes(state, hq, logFile, options = {}) {
|
|
|
649
649
|
const owned = readJson(laneFile) || {};
|
|
650
650
|
const laneIds = Object.values(owned).filter((lane) => typeof lane === "string" && lane.length > 0);
|
|
651
651
|
for (const lane of laneIds)
|
|
652
|
-
(options.stop ?? ((id) => { driverRun(hq, ["
|
|
652
|
+
(options.stop ?? ((id) => { driverRun(hq, ["runners", "stop", id]); }))(lane);
|
|
653
653
|
const deadline = Date.now() + (options.timeoutMs ?? 60_000);
|
|
654
654
|
while (Date.now() < deadline) {
|
|
655
655
|
let rows;
|
|
@@ -861,7 +861,7 @@ export async function runPipelineDriverNative(args, hqRoot = "") {
|
|
|
861
861
|
const worker = c;
|
|
862
862
|
const { lane, company } = stalledLaneContext(state, worker);
|
|
863
863
|
const listed = lane && company
|
|
864
|
-
? driverRun(hq, ["
|
|
864
|
+
? driverRun(hq, ["runners", "questions", "list", "--company", company, "--json"])
|
|
865
865
|
: { code: 1, stdout: "", stderr: "" };
|
|
866
866
|
let question = "";
|
|
867
867
|
if (listed.code === 0) {
|
|
@@ -10,6 +10,11 @@ export type HqResult = {
|
|
|
10
10
|
timedOut?: boolean;
|
|
11
11
|
};
|
|
12
12
|
export type RefreshVaultAccessDependencies = {
|
|
13
|
+
/**
|
|
14
|
+
* The daemon's cached `hq whoami` output (json or plain), or null to run
|
|
15
|
+
* `hq whoami` (hq-core-rust US-036). Default: src/lib/daemon/whoami-cache.ts.
|
|
16
|
+
*/
|
|
17
|
+
daemonWhoami?: (json: boolean) => string | null;
|
|
13
18
|
cwd: string;
|
|
14
19
|
env: NodeJS.ProcessEnv;
|
|
15
20
|
now: () => Date;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/** Native local manifest refresh for core/scripts/refresh-vault-access.sh. */
|
|
2
|
+
import { daemonWhoamiOutput } from "../lib/daemon/whoami-cache.js";
|
|
2
3
|
import { spawnSync } from "node:child_process";
|
|
3
4
|
import { randomBytes } from "node:crypto";
|
|
4
5
|
import * as fs from "node:fs";
|
|
@@ -305,7 +306,8 @@ function resolveEmail(deps, runHq) {
|
|
|
305
306
|
const override = deps.env.HQ_VAULT_ACCESS_EMAIL ?? "";
|
|
306
307
|
if (override)
|
|
307
308
|
return { email: override, stderr: "", signedOut: false };
|
|
308
|
-
const
|
|
309
|
+
const cached = (deps.daemonWhoami ?? ((asJson) => daemonWhoamiOutput(asJson, deps.env)))(false);
|
|
310
|
+
const result = cached !== null ? { stdout: cached } : runHq(["whoami"], deps.cwd);
|
|
309
311
|
const email = getEmail(result.stdout);
|
|
310
312
|
// An API key reaches the vault without a person session, so only a
|
|
311
313
|
// key-less caller whose whoami reports no session is treated as signed out.
|
|
@@ -288,7 +288,7 @@ export function runWorkMeshBindTrusted(args, deps) {
|
|
|
288
288
|
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
289
289
|
const daemon = parsed;
|
|
290
290
|
if (daemon.ok === true && daemon.running === false && typeof daemon.message === "string" && daemon.message.includes("installed (")) {
|
|
291
|
-
stderr += "Work Mesh daemon is installed but not loaded; start it with: hq
|
|
291
|
+
stderr += "Work Mesh daemon is installed but not loaded; start it with: hq daemon install\n";
|
|
292
292
|
}
|
|
293
293
|
}
|
|
294
294
|
}
|
|
@@ -8,7 +8,9 @@
|
|
|
8
8
|
* hq daemon status [--json] includes whether the service manager runs it
|
|
9
9
|
* hq daemon logs [unit] [--follow] [--lines N]
|
|
10
10
|
* hq daemon restart [unit] | trigger <unit>
|
|
11
|
+
* hq daemon doctor Work Mesh health (spool, held, dead-letter, MQTT)
|
|
11
12
|
* hq daemon enable|disable <service...> per-machine overrides
|
|
13
|
+
* hq daemon pause|resume sync-core stop the new sync engine until resumed
|
|
12
14
|
* hq daemon migrate list the older units it would take over (read-only)
|
|
13
15
|
* hq daemon uninstall [--purge]
|
|
14
16
|
*
|
package/dist/commands/daemon.js
CHANGED
|
@@ -8,7 +8,9 @@
|
|
|
8
8
|
* hq daemon status [--json] includes whether the service manager runs it
|
|
9
9
|
* hq daemon logs [unit] [--follow] [--lines N]
|
|
10
10
|
* hq daemon restart [unit] | trigger <unit>
|
|
11
|
+
* hq daemon doctor Work Mesh health (spool, held, dead-letter, MQTT)
|
|
11
12
|
* hq daemon enable|disable <service...> per-machine overrides
|
|
13
|
+
* hq daemon pause|resume sync-core stop the new sync engine until resumed
|
|
12
14
|
* hq daemon migrate list the older units it would take over (read-only)
|
|
13
15
|
* hq daemon uninstall [--purge]
|
|
14
16
|
*
|
|
@@ -496,7 +498,7 @@ function formatUnit(u) {
|
|
|
496
498
|
const detail = u.status === "running" && u.pid
|
|
497
499
|
? `pid ${u.pid}`
|
|
498
500
|
: u.status === "idle" && u.lastResult
|
|
499
|
-
? `last run ${u.lastResult}`
|
|
501
|
+
? `last run ${u.lastResult}${u.lastResult === "failed" && u.lastError ? `: ${u.lastError}` : ""}`
|
|
500
502
|
: (u.reason ?? "");
|
|
501
503
|
const restarts = u.restarts > 0 ? ` (restarted ${u.restarts}x)` : "";
|
|
502
504
|
return ` ${u.id.padEnd(40)} ${u.status.padEnd(12)} ${detail}${restarts}`;
|
|
@@ -552,6 +554,7 @@ async function runStatus(d, opts) {
|
|
|
552
554
|
warnings: statusWarnings(service, paths),
|
|
553
555
|
machineType: state?.machineType ?? config.machineType ?? null,
|
|
554
556
|
units: state?.units ?? [],
|
|
557
|
+
syncCorePause: config.syncCorePause ?? null,
|
|
555
558
|
}, null, 2));
|
|
556
559
|
return;
|
|
557
560
|
}
|
|
@@ -559,6 +562,9 @@ async function runStatus(d, opts) {
|
|
|
559
562
|
? `Service manager: running as the HQ desktop app's child (${service.detail}).`
|
|
560
563
|
: `Service manager: ${describeSupervision(service)}.`;
|
|
561
564
|
const warnings = statusWarnings(service, paths).map((w) => `Warning: ${w}`);
|
|
565
|
+
if (config.syncCorePause) {
|
|
566
|
+
d.out(`sync-core paused at ${config.syncCorePause.at} by ${config.syncCorePause.by}; resume with \`hq daemon resume sync-core\`.`);
|
|
567
|
+
}
|
|
562
568
|
if (!pid || !state) {
|
|
563
569
|
const { detected } = host;
|
|
564
570
|
d.out(`hq daemon is not running. Machine type: ${detected.type} (${detected.detail}).`);
|
|
@@ -974,6 +980,40 @@ async function runToggle(d, action, services) {
|
|
|
974
980
|
d.out(line);
|
|
975
981
|
d.out("A running daemon picks this up within 15 seconds.");
|
|
976
982
|
}
|
|
983
|
+
async function runSyncCorePause(d, paused, service, opts) {
|
|
984
|
+
if (service !== "sync-core") {
|
|
985
|
+
throw new DaemonCommandError(`hq daemon ${paused ? "pause" : "resume"} works on sync-core only. Use hq daemon enable/disable for ${service}.`);
|
|
986
|
+
}
|
|
987
|
+
const host = currentHost(d);
|
|
988
|
+
const config = readDaemonConfig(host.paths.configPath);
|
|
989
|
+
const before = config.syncCorePause;
|
|
990
|
+
// A second pause keeps the first time and requester.
|
|
991
|
+
const next = paused ? (before ?? { at: new Date().toISOString(), by: `local uid ${d.uid}` }) : undefined;
|
|
992
|
+
if (next !== before) {
|
|
993
|
+
const updated = { ...config };
|
|
994
|
+
if (next)
|
|
995
|
+
updated.syncCorePause = next;
|
|
996
|
+
else
|
|
997
|
+
delete updated.syncCorePause;
|
|
998
|
+
writeDaemonConfig(host.paths.configPath, updated);
|
|
999
|
+
}
|
|
1000
|
+
const daemonRunning = queueDaemonSyncControl(d, { action: "reconcile" });
|
|
1001
|
+
const disabled = config.disable.includes("sync-core");
|
|
1002
|
+
const result = { service: "sync-core", paused, syncCorePause: next ?? null, persisted: true, daemonRunning, disabled };
|
|
1003
|
+
if (opts.json) {
|
|
1004
|
+
d.out(JSON.stringify(result, null, 2));
|
|
1005
|
+
return;
|
|
1006
|
+
}
|
|
1007
|
+
d.out(paused
|
|
1008
|
+
? `sync-core paused at ${next.at} by ${next.by}. It stays stopped, including across daemon restarts, until \`hq daemon resume sync-core\`.`
|
|
1009
|
+
: before
|
|
1010
|
+
? "sync-core resumed."
|
|
1011
|
+
: "sync-core was not paused.");
|
|
1012
|
+
if (!daemonRunning)
|
|
1013
|
+
d.out("The daemon is not running; this applies when it starts.");
|
|
1014
|
+
if (!paused && disabled)
|
|
1015
|
+
d.out("sync-core is still disabled on this machine; `hq daemon enable sync-core` turns it back on.");
|
|
1016
|
+
}
|
|
977
1017
|
async function runPinHqCloud(d, version, opts) {
|
|
978
1018
|
if (opts.clear === Boolean(version)) {
|
|
979
1019
|
throw new DaemonCommandError("Pass one exact semver version, or use --clear.");
|
|
@@ -1678,7 +1718,7 @@ export function registerDaemonCommand(program, over = {}) {
|
|
|
1678
1718
|
}));
|
|
1679
1719
|
daemon
|
|
1680
1720
|
.command("call <op>")
|
|
1681
|
-
.description("Send one request to hqd (policy.check, journal.append,
|
|
1721
|
+
.description("Send one request to hqd (policy.check, journal.append, mcp.call, …) and print the result as JSON")
|
|
1682
1722
|
.option("--json <args>", "Request args as a JSON object", "{}")
|
|
1683
1723
|
.option("--timeout <ms>", "Give up after this many milliseconds")
|
|
1684
1724
|
.action(wrap(async (d, op, opts) => {
|
|
@@ -1706,6 +1746,14 @@ export function registerDaemonCommand(program, over = {}) {
|
|
|
1706
1746
|
.description("Show the machine type and each service's state")
|
|
1707
1747
|
.option("--json", "Print machine-readable JSON")
|
|
1708
1748
|
.action(wrap((d, opts) => runStatus(d, opts)));
|
|
1749
|
+
daemon
|
|
1750
|
+
.command("doctor")
|
|
1751
|
+
.description("Report Work Mesh health: running, MQTT, spool, held, dead-letter, outbox and flush (replaces the separate mesh daemon doctor)")
|
|
1752
|
+
.option("--json", "Print machine-readable JSON")
|
|
1753
|
+
.action(async (opts) => {
|
|
1754
|
+
const { runMeshDaemonDoctor } = await import("./mesh.js");
|
|
1755
|
+
await runMeshDaemonDoctor(opts);
|
|
1756
|
+
});
|
|
1709
1757
|
const sync = daemon
|
|
1710
1758
|
.command("sync")
|
|
1711
1759
|
.description("Inspect and control the daemon's company sync runner");
|
|
@@ -1823,6 +1871,16 @@ export function registerDaemonCommand(program, over = {}) {
|
|
|
1823
1871
|
.command("disable <services...>")
|
|
1824
1872
|
.description("Turn default services off for this machine")
|
|
1825
1873
|
.action(wrap((d, services) => runToggle(d, "disable", services)));
|
|
1874
|
+
daemon
|
|
1875
|
+
.command("pause <service>")
|
|
1876
|
+
.description("Stop sync-core and keep it stopped (watchdog and daemon restarts included) until resumed")
|
|
1877
|
+
.option("--json", "Print machine-readable JSON")
|
|
1878
|
+
.action(wrap((d, service, opts) => runSyncCorePause(d, true, service, opts)));
|
|
1879
|
+
daemon
|
|
1880
|
+
.command("resume <service>")
|
|
1881
|
+
.description("Start a paused sync-core again")
|
|
1882
|
+
.option("--json", "Print machine-readable JSON")
|
|
1883
|
+
.action(wrap((d, service, opts) => runSyncCorePause(d, false, service, opts)));
|
|
1826
1884
|
daemon
|
|
1827
1885
|
.command("pin-hq-cloud [version]")
|
|
1828
1886
|
.description("Pin hq-cloud to an exact version, or clear the pin")
|
|
@@ -1849,6 +1907,14 @@ export function registerDaemonCommand(program, over = {}) {
|
|
|
1849
1907
|
const service = daemon
|
|
1850
1908
|
.command("service", { hidden: true })
|
|
1851
1909
|
.description("Entry points the daemon runs for services that have no command of their own");
|
|
1910
|
+
service
|
|
1911
|
+
.command("mesh")
|
|
1912
|
+
.description("Work Mesh Live: spool drain, MQTT presence and the live Board cache (the daemon's mesh service)")
|
|
1913
|
+
.option("--hq-root <path>", "HQ folder the service works against")
|
|
1914
|
+
.action(async (opts) => {
|
|
1915
|
+
const { runMeshDaemonService } = await import("./mesh.js");
|
|
1916
|
+
await runMeshDaemonService(opts);
|
|
1917
|
+
});
|
|
1852
1918
|
service
|
|
1853
1919
|
.command("self-update")
|
|
1854
1920
|
.description("Update the hq CLI, Claude, Codex and Grok, then restart the daemon onto a new CLI")
|
|
@@ -442,6 +442,17 @@ function printDnsRecords(records) {
|
|
|
442
442
|
console.log(` ${displayText(record.type)} ${displayText(record.name)} -> ${displayText(record.value)}`);
|
|
443
443
|
}
|
|
444
444
|
}
|
|
445
|
+
/**
|
|
446
|
+
* True when hq-deploy writes the DNS records itself: the domain was bought
|
|
447
|
+
* through HQ by this company and its Route 53 zone is HQ's. An older server
|
|
448
|
+
* sends no field, which reads as false.
|
|
449
|
+
*/
|
|
450
|
+
function isDnsManaged(body) {
|
|
451
|
+
return body.dnsManaged === true;
|
|
452
|
+
}
|
|
453
|
+
function managedDnsLine(domain) {
|
|
454
|
+
return `HQ manages DNS for ${displayText(domain)}. No records to add.`;
|
|
455
|
+
}
|
|
445
456
|
function dnsRecords(value) {
|
|
446
457
|
if (!Array.isArray(value))
|
|
447
458
|
return [];
|
|
@@ -525,6 +536,7 @@ async function listAction(options) {
|
|
|
525
536
|
displayText(domain.domain),
|
|
526
537
|
displayText(domain.environment ?? "production"),
|
|
527
538
|
displayText(domain.validationState ?? "unknown"),
|
|
539
|
+
...(isDnsManaged(domain) ? ["DNS managed by HQ"] : []),
|
|
528
540
|
].join(" | "));
|
|
529
541
|
}
|
|
530
542
|
}
|
|
@@ -541,6 +553,7 @@ async function addAction(domainArg, options) {
|
|
|
541
553
|
throw await deployError(response, target.orgSlug);
|
|
542
554
|
const body = await readBody(response);
|
|
543
555
|
const records = dnsRecords(body.dnsInstructions);
|
|
556
|
+
const dnsManaged = isDnsManaged(body);
|
|
544
557
|
const apex = body.apex === true;
|
|
545
558
|
const apexGuidance = typeof body.apexGuidance === "string" ? body.apexGuidance : undefined;
|
|
546
559
|
const paid = body.billingBasis === "paid";
|
|
@@ -553,6 +566,7 @@ async function addAction(domainArg, options) {
|
|
|
553
566
|
environment,
|
|
554
567
|
validationState: body.domain?.validationState ?? "pending",
|
|
555
568
|
serving: body.serving === true,
|
|
569
|
+
dnsManaged,
|
|
556
570
|
dnsInstructions: records,
|
|
557
571
|
apex,
|
|
558
572
|
...(apexGuidance ? { apexGuidance } : {}),
|
|
@@ -564,6 +578,11 @@ async function addAction(domainArg, options) {
|
|
|
564
578
|
console.log(`Added ${displayText(domain)} to ${displayText(environment)}. It is not live yet.`);
|
|
565
579
|
if (priceLine)
|
|
566
580
|
console.log(priceLine);
|
|
581
|
+
if (dnsManaged) {
|
|
582
|
+
console.log(managedDnsLine(domain));
|
|
583
|
+
console.log(`To check when it is live, run: hq deploy domains refresh ${displayText(domain)}`);
|
|
584
|
+
return;
|
|
585
|
+
}
|
|
567
586
|
printDnsRecords(records);
|
|
568
587
|
if (apex) {
|
|
569
588
|
console.log(apexGuidance
|
|
@@ -582,10 +601,11 @@ async function refreshAction(domainArg, options) {
|
|
|
582
601
|
const body = await readBody(response);
|
|
583
602
|
const serving = body.serving === true;
|
|
584
603
|
const records = dnsRecords(body.dnsInstructions);
|
|
604
|
+
const dnsManaged = isDnsManaged(body);
|
|
585
605
|
if (!serving)
|
|
586
606
|
process.exitCode = REFRESH_NOT_SERVING_EXIT_CODE;
|
|
587
607
|
if (options.json) {
|
|
588
|
-
console.log(safeJson({ ok: true, appId: target.appId, ...body, domain, serving, dnsInstructions: records }));
|
|
608
|
+
console.log(safeJson({ ok: true, appId: target.appId, ...body, domain, serving, dnsManaged, dnsInstructions: records }));
|
|
589
609
|
return;
|
|
590
610
|
}
|
|
591
611
|
if (serving) {
|
|
@@ -594,6 +614,11 @@ async function refreshAction(domainArg, options) {
|
|
|
594
614
|
}
|
|
595
615
|
const certStatus = typeof body.certStatus === "string" ? ` (certificate ${displayText(body.certStatus)})` : "";
|
|
596
616
|
console.log(`${displayText(domain)} is waiting for DNS validation${certStatus}.`);
|
|
617
|
+
if (dnsManaged) {
|
|
618
|
+
console.log(managedDnsLine(domain));
|
|
619
|
+
console.log(`Run this again to check: hq deploy domains refresh ${displayText(domain)}`);
|
|
620
|
+
return;
|
|
621
|
+
}
|
|
597
622
|
printDnsRecords(records);
|
|
598
623
|
if (body.apex === true && typeof body.apexGuidance === "string")
|
|
599
624
|
console.log(displayText(body.apexGuidance));
|
|
@@ -718,6 +743,7 @@ function baseState(body) {
|
|
|
718
743
|
servingStatus,
|
|
719
744
|
servingError: typeof serving.error === "string" && serving.error ? serving.error : null,
|
|
720
745
|
records: dnsRecords(body.records),
|
|
746
|
+
dnsManaged: isDnsManaged(body),
|
|
721
747
|
live: status === "live" || servingStatus === "live",
|
|
722
748
|
raw: body,
|
|
723
749
|
};
|
|
@@ -750,6 +776,7 @@ async function baseAddAction(domainArg, options) {
|
|
|
750
776
|
baseDomain: state.baseDomain ?? domain,
|
|
751
777
|
status: state.status,
|
|
752
778
|
certificate: state.certStatus,
|
|
779
|
+
dnsManaged: state.dnsManaged,
|
|
753
780
|
records: state.records,
|
|
754
781
|
...(typeof body.billingBasis === "string" ? { billingBasis: body.billingBasis } : {}),
|
|
755
782
|
...(typeof body.monthlyPriceUsd === "number" ? { monthlyPriceUsd: body.monthlyPriceUsd } : {}),
|
|
@@ -760,6 +787,11 @@ async function baseAddAction(domainArg, options) {
|
|
|
760
787
|
console.log(`${displayText(domain)} is now the deploy domain of '${orgSlug}'. It is not live yet.`);
|
|
761
788
|
if (priceLine)
|
|
762
789
|
console.log(priceLine);
|
|
790
|
+
if (state.dnsManaged) {
|
|
791
|
+
console.log(managedDnsLine(state.baseDomain ?? domain));
|
|
792
|
+
console.log("To wait until it is live, run: hq deploy domains base status --wait");
|
|
793
|
+
return;
|
|
794
|
+
}
|
|
763
795
|
printDnsRecords(state.records);
|
|
764
796
|
if (state.records.length < 2) {
|
|
765
797
|
console.log("The certificate's validation record can take a few seconds to appear; 'hq deploy domains base status' prints it.");
|
|
@@ -805,6 +837,7 @@ async function baseStatusAction(options) {
|
|
|
805
837
|
certificate: state.certStatus,
|
|
806
838
|
serving: state.servingStatus,
|
|
807
839
|
...(state.servingError ? { servingError: state.servingError } : {}),
|
|
840
|
+
dnsManaged: state.dnsManaged,
|
|
808
841
|
records: state.live ? [] : state.records,
|
|
809
842
|
attempts,
|
|
810
843
|
...(timedOut ? { timedOut: true } : {}),
|
|
@@ -821,7 +854,10 @@ async function baseStatusAction(options) {
|
|
|
821
854
|
return;
|
|
822
855
|
}
|
|
823
856
|
console.log(`${name} is not live yet: ${describeBaseState(state)}.`);
|
|
824
|
-
|
|
857
|
+
if (state.dnsManaged)
|
|
858
|
+
console.log(managedDnsLine(state.baseDomain ?? "the company deploy domain"));
|
|
859
|
+
else
|
|
860
|
+
printDnsRecords(state.records);
|
|
825
861
|
console.log(timedOut
|
|
826
862
|
? `Stopped waiting after ${minutes} minutes. Run 'hq deploy domains base status --wait' again to keep waiting.`
|
|
827
863
|
: "Run 'hq deploy domains base status --wait' to wait until it is live.");
|
|
@@ -1,4 +1,14 @@
|
|
|
1
|
+
import { type AccountConfig, type LaneProvider } from "../lib/lanes/index.js";
|
|
1
2
|
import type { Ctx, LaneAccountsHandlerDeps } from "./lanes-shared.js";
|
|
3
|
+
/**
|
|
4
|
+
* PS-006 set-owner warnings. The change is still saved; these only flag the
|
|
5
|
+
* likely mistake of recording the owner's own login under his name instead
|
|
6
|
+
* of `owner`, which takes that login away from every lane.
|
|
7
|
+
*/
|
|
8
|
+
export declare function setOwnerWarnings(env: NodeJS.ProcessEnv, provider: LaneProvider, id: string, holder: string | undefined, accounts: Record<string, AccountConfig>): Array<{
|
|
9
|
+
code: string;
|
|
10
|
+
message: string;
|
|
11
|
+
}>;
|
|
2
12
|
export declare function createLaneAccountsHandlers(deps: LaneAccountsHandlerDeps): {
|
|
3
13
|
runAccountsList: (ctx: Ctx, opts: {
|
|
4
14
|
provider?: string;
|
|
@@ -18,6 +28,10 @@ export declare function createLaneAccountsHandlers(deps: LaneAccountsHandlerDeps
|
|
|
18
28
|
host?: string;
|
|
19
29
|
company?: string;
|
|
20
30
|
}) => Promise<void>;
|
|
31
|
+
runAccountsSetOwner: (ctx: Ctx, providerRaw: string, accountIdRaw: string, opts: {
|
|
32
|
+
owningCompany?: string;
|
|
33
|
+
holder?: string;
|
|
34
|
+
}) => Promise<void>;
|
|
21
35
|
runAccountsClearQuota: (ctx: Ctx, providerRaw: string, accountIdRaw: string, opts: {
|
|
22
36
|
model?: string;
|
|
23
37
|
}) => Promise<void>;
|
|
@@ -4,6 +4,7 @@ import { buildOutpostBalanceMoveCommand, dispatchErrorMessage } from "../lib/lan
|
|
|
4
4
|
import { BALANCE_MOVABLE_STATES, accountLoadsForReport, planClaudeBalanceMoves, selectClaudeAccount } from "../lib/lanes/claude-balance.js";
|
|
5
5
|
import { CompanySelectionError } from "../utils/company-selection-error.js";
|
|
6
6
|
import { effectiveAccountHome } from "../lib/lanes/account-home.js";
|
|
7
|
+
import { accountHeldByOther, accountOwnership, heldByOwner, holderProblem, normalizeHolder, normalizeOwningCompany, owningCompanyProblem, ownershipWarning, setOwnerCommand } from "../lib/lanes/account-ownership.js";
|
|
7
8
|
import { AccountResolutionError, DEFAULT_ACCOUNT_HOMES, LANE_PROVIDERS, accountStatus, canonicalizeHome, claudeIdentityDiffers, installDrainHook, isLanesError, listAccountStatuses, loadLanesConfig, parseLaneProvider, probeInteractiveClaudeIdentity, readLane, withProviderHomeEnv, writeLanesConfig } from "../lib/lanes/index.js";
|
|
8
9
|
import { assertUniqueAccountHomes, providerCompactAfterMs } from "../lib/lanes/config.js";
|
|
9
10
|
import { resolveLaneEffort } from "../lib/lanes/effort.js";
|
|
@@ -14,6 +15,33 @@ import { accountQuotaView, clearAccountQuota, loadQuotaState } from "../lib/lane
|
|
|
14
15
|
import { resolveLaneModel } from "../lib/lanes/spawn.js";
|
|
15
16
|
import { leadLaneIds } from "../lib/lanes/admission.js";
|
|
16
17
|
import { resolveLaneCompany } from "../lib/lanes/lane-company.js";
|
|
18
|
+
/**
|
|
19
|
+
* PS-006 set-owner warnings. The change is still saved; these only flag the
|
|
20
|
+
* likely mistake of recording the owner's own login under his name instead
|
|
21
|
+
* of `owner`, which takes that login away from every lane.
|
|
22
|
+
*/
|
|
23
|
+
export function setOwnerWarnings(env, provider, id, holder, accounts) {
|
|
24
|
+
const warnings = [];
|
|
25
|
+
if (holder === undefined || !accountHeldByOther(accounts[id]))
|
|
26
|
+
return warnings;
|
|
27
|
+
const usable = Object.values(accounts).filter((account) => account.enabled && !accountHeldByOther(account));
|
|
28
|
+
if (usable.length === 0) {
|
|
29
|
+
warnings.push({
|
|
30
|
+
code: "no_usable_login",
|
|
31
|
+
message: "No enabled " + provider + " login is usable by lanes now. If " + id + " is really your own login, record it with: hq lanes accounts set-owner " + provider + " " + id + " --holder owner",
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
const localNames = [env.USER, env.LOGNAME, env.USERNAME]
|
|
35
|
+
.filter((name) => typeof name === "string" && name.trim() !== "")
|
|
36
|
+
.map((name) => name.trim().toLowerCase());
|
|
37
|
+
if (localNames.some((name) => name === holder.toLowerCase())) {
|
|
38
|
+
warnings.push({
|
|
39
|
+
code: "holder_matches_local_user",
|
|
40
|
+
message: "Holder " + JSON.stringify(holder) + " matches this machine's user name. If " + id + " is your own login, use --holder owner; a named holder keeps lanes off it.",
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
return warnings;
|
|
44
|
+
}
|
|
17
45
|
export function createLaneAccountsHandlers(deps) {
|
|
18
46
|
const { admitQueuedFromCtx, automaticBalanceMoveHistoryReason, ensureDir, laneWithRecoveredProviderSession, loadClaudeBalanceHostSnapshots, parseRemoteJson, prepareAccountMove, printJson, reconcileHostFromCtx, resolveCallerPath } = deps;
|
|
19
47
|
const VENDOR_LOGIN = {
|
|
@@ -166,8 +194,20 @@ export function createLaneAccountsHandlers(deps) {
|
|
|
166
194
|
effective_effort: effort.effort ?? null,
|
|
167
195
|
effective_effort_source: effort.source,
|
|
168
196
|
...accountQuotaView(quota, provider, status.id),
|
|
197
|
+
// PS-006: who owns and who holds this login. Added fields only.
|
|
198
|
+
...ownershipView(provider, status.id, accountCfg),
|
|
169
199
|
};
|
|
170
200
|
}));
|
|
201
|
+
const ownershipWarnings = providers.flatMap((provider) => Object.entries(config.providers[provider].accounts).flatMap(([id, account]) => {
|
|
202
|
+
const warning = ownershipWarning(provider, id, account);
|
|
203
|
+
return warning === undefined ? [] : [{ provider, account: id, ...warning }];
|
|
204
|
+
}));
|
|
205
|
+
// One summary line, not one per account; the JSON keeps the full list.
|
|
206
|
+
if (ownershipWarnings.length > 0) {
|
|
207
|
+
const names = ownershipWarnings.map((warning) => warning.provider + "/" + warning.account).join(", ");
|
|
208
|
+
process.stderr.write("warning: " + ownershipWarnings.length + " enabled account(s) have no owning_company or holder recorded: " + names +
|
|
209
|
+
". Record them with: hq lanes accounts set-owner <provider> <account-id> --owning-company <slug|personal|unknown> --holder <owner|name>\n");
|
|
210
|
+
}
|
|
171
211
|
const providerDefaults = providers.map((provider) => ({
|
|
172
212
|
provider,
|
|
173
213
|
model: config.providers[provider].model ?? null,
|
|
@@ -180,6 +220,84 @@ export function createLaneAccountsHandlers(deps) {
|
|
|
180
220
|
providers: providerDefaults,
|
|
181
221
|
...(providers.includes("claude") ? { interactive_identity: interactiveIdentity } : {}),
|
|
182
222
|
accounts,
|
|
223
|
+
ownership_warnings: ownershipWarnings,
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
function ownershipView(provider, id, account) {
|
|
227
|
+
const ownership = accountOwnership(account);
|
|
228
|
+
const warning = ownershipWarning(provider, id, account);
|
|
229
|
+
return {
|
|
230
|
+
owning_company: ownership.owning_company,
|
|
231
|
+
owning_company_source: ownership.owning_company_source,
|
|
232
|
+
holder: ownership.holder,
|
|
233
|
+
holder_source: ownership.holder_source,
|
|
234
|
+
// null when no holder is recorded; never true by default.
|
|
235
|
+
held_by_owner: heldByOwner(account),
|
|
236
|
+
ownership_missing: ownership.ownership_missing,
|
|
237
|
+
...(warning !== undefined
|
|
238
|
+
? { ownership_warning: warning.message, ownership_fix_command: warning.fix_command }
|
|
239
|
+
: {}),
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Record who owns and who holds a login (PS-006). Only these two labels are
|
|
244
|
+
* written: no credential, home or vault file is read or moved.
|
|
245
|
+
*/
|
|
246
|
+
async function runAccountsSetOwner(ctx, providerRaw, accountIdRaw, opts) {
|
|
247
|
+
const provider = parseLaneProvider(providerRaw);
|
|
248
|
+
const id = accountIdRaw.trim();
|
|
249
|
+
const owningCompany = opts.owningCompany === undefined ? undefined : normalizeOwningCompany(opts.owningCompany);
|
|
250
|
+
const holder = opts.holder === undefined ? undefined : normalizeHolder(opts.holder);
|
|
251
|
+
if (owningCompany === undefined && holder === undefined) {
|
|
252
|
+
throw new LanesError("ownership_value_required", "Pass --owning-company, --holder, or both", {
|
|
253
|
+
provider,
|
|
254
|
+
account: id,
|
|
255
|
+
usage: setOwnerCommand(provider, id || "<account-id>"),
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
if (owningCompany !== undefined) {
|
|
259
|
+
const problem = owningCompanyProblem(owningCompany);
|
|
260
|
+
if (problem !== null) {
|
|
261
|
+
throw new LanesError("invalid_owning_company", `--owning-company ${problem}`, { provider, account: id, value: opts.owningCompany });
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
if (holder !== undefined) {
|
|
265
|
+
const problem = holderProblem(holder);
|
|
266
|
+
if (problem !== null) {
|
|
267
|
+
throw new LanesError("invalid_holder", `--holder ${problem}`, { provider, account: id, value: opts.holder });
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
const hqRoot = ctx.hqRoot();
|
|
271
|
+
const config = loadLanesConfig(hqRoot);
|
|
272
|
+
const account = config.providers[provider].accounts[id];
|
|
273
|
+
if (account === undefined) {
|
|
274
|
+
throw new AccountResolutionError("unknown_account", `Unknown account ${JSON.stringify(id)} for ${provider}`, {
|
|
275
|
+
provider,
|
|
276
|
+
account: id,
|
|
277
|
+
enabled: Object.entries(config.providers[provider].accounts)
|
|
278
|
+
.filter(([, a]) => a.enabled)
|
|
279
|
+
.map(([key]) => key),
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
const before = { owning_company: account.owning_company ?? null, holder: account.holder ?? null };
|
|
283
|
+
if (owningCompany !== undefined)
|
|
284
|
+
account.owning_company = owningCompany;
|
|
285
|
+
if (holder !== undefined)
|
|
286
|
+
account.holder = holder;
|
|
287
|
+
writeLanesConfig(hqRoot, config);
|
|
288
|
+
const savedConfig = loadLanesConfig(hqRoot);
|
|
289
|
+
const saved = savedConfig.providers[provider].accounts[id];
|
|
290
|
+
const warnings = setOwnerWarnings(ctx.env, provider, id, holder, savedConfig.providers[provider].accounts);
|
|
291
|
+
for (const warning of warnings)
|
|
292
|
+
process.stderr.write("warning: " + warning.message + "\n");
|
|
293
|
+
printJson({
|
|
294
|
+
ok: true,
|
|
295
|
+
action: "accounts.set-owner",
|
|
296
|
+
provider,
|
|
297
|
+
account: id,
|
|
298
|
+
before,
|
|
299
|
+
...ownershipView(provider, id, saved),
|
|
300
|
+
...(warnings.length > 0 ? { warnings } : {}),
|
|
183
301
|
});
|
|
184
302
|
}
|
|
185
303
|
async function runAccountsBalance(ctx, opts) {
|
|
@@ -637,6 +755,7 @@ export function createLaneAccountsHandlers(deps) {
|
|
|
637
755
|
runAccountsBalance,
|
|
638
756
|
runAccountsLogin,
|
|
639
757
|
runAccountsSetHome,
|
|
758
|
+
runAccountsSetOwner,
|
|
640
759
|
runAccountsClearQuota,
|
|
641
760
|
runAccountsEnable,
|
|
642
761
|
runAccountsDisable
|
|
@@ -1,31 +1,7 @@
|
|
|
1
1
|
import type { Command } from "commander";
|
|
2
2
|
import type { LaneCompanyRef } from "../lib/lanes/types.js";
|
|
3
|
-
|
|
4
|
-
export
|
|
5
|
-
export declare const REPO_MERGE_HOLDS_REL: string;
|
|
6
|
-
declare const HOLD_SCHEMA_VERSION = "hq-lanes-repo-merge-hold.v1";
|
|
7
|
-
interface HoldHistoryEntry {
|
|
8
|
-
set_at: string;
|
|
9
|
-
until: string;
|
|
10
|
-
reason: string;
|
|
11
|
-
set_by_lane: string | null;
|
|
12
|
-
set_by_session: string | null;
|
|
13
|
-
released_at?: string;
|
|
14
|
-
released_reason?: string;
|
|
15
|
-
}
|
|
16
|
-
export interface RepoMergeHold {
|
|
17
|
-
schema_version: typeof HOLD_SCHEMA_VERSION;
|
|
18
|
-
repo: string;
|
|
19
|
-
company: LaneCompanyRef;
|
|
20
|
-
reason: string;
|
|
21
|
-
set_at: string;
|
|
22
|
-
until: string;
|
|
23
|
-
set_by_lane: string | null;
|
|
24
|
-
set_by_session: string | null;
|
|
25
|
-
released_at?: string;
|
|
26
|
-
released_reason?: string;
|
|
27
|
-
history: HoldHistoryEntry[];
|
|
28
|
-
}
|
|
3
|
+
import { LANES_REPO_MERGE_HOLD_FLAG, LANES_REVIEW_BEFORE_MERGE_FLAG, REPO_MERGE_HOLDS_REL, type RepoMergeHold } from "../lib/lanes/repo-merge-hold.js";
|
|
4
|
+
export { LANES_REPO_MERGE_HOLD_FLAG, LANES_REVIEW_BEFORE_MERGE_FLAG, REPO_MERGE_HOLDS_REL, type RepoMergeHold };
|
|
29
5
|
export interface LaneRepoMergeHoldDeps {
|
|
30
6
|
hqRoot: () => string;
|
|
31
7
|
resolveCompany: (company?: string) => Promise<LaneCompanyRef>;
|
|
@@ -38,5 +14,4 @@ type WrapHandler = <Args extends unknown[]>(action: (...args: Args) => Promise<v
|
|
|
38
14
|
/** Serialize the read-modify-write cycle so concurrent set/release calls cannot overwrite each other. */
|
|
39
15
|
export declare function withRepoMergeHoldRecordLock<T>(recordPath: string, action: () => T | Promise<T>): Promise<T>;
|
|
40
16
|
export declare function registerLaneRepoMergeHoldCommand(lanes: Command, deps: LaneRepoMergeHoldDeps, wrap: WrapHandler): void;
|
|
41
|
-
export {};
|
|
42
17
|
//# sourceMappingURL=lanes-hold.d.ts.map
|