@indigoai-us/hq-cli 5.345.222 → 5.345.225
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 +89 -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 +79 -5
- package/dist/command-catalog.generated.js +95 -5
- package/dist/commands/bot.d.ts +1 -1
- package/dist/commands/bot.js +34 -33
- 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 +210 -188
- 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 +67 -1
- 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-session-start.js +2 -2
- 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 +14 -3
- package/dist/commands/sync-core.js +31 -12
- 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/index.js +1 -1
- package/dist/lib/bot/fleet-cron.d.ts +26 -3
- package/dist/lib/bot/fleet-cron.js +44 -4
- package/dist/lib/bot/run.d.ts +4 -4
- package/dist/lib/bot/run.js +5 -3
- package/dist/lib/bot/signals-engine-flag.d.ts +53 -13
- package/dist/lib/bot/signals-engine-flag.js +202 -9
- package/dist/lib/daemon/catalog.d.ts +8 -5
- package/dist/lib/daemon/catalog.js +13 -7
- package/dist/lib/daemon/config.d.ts +5 -0
- package/dist/lib/daemon/config.js +6 -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/machine-checks.d.ts +45 -0
- package/dist/lib/daemon/machine-checks.js +95 -11
- package/dist/lib/daemon/merge-sections.d.ts +165 -0
- package/dist/lib/daemon/merge-sections.js +556 -0
- package/dist/lib/daemon/native-notice-ledger.d.ts +9 -0
- package/dist/lib/daemon/native-notice-ledger.js +43 -0
- package/dist/lib/daemon/ops/policy.d.ts +1 -1
- package/dist/lib/daemon/ops/policy.js +1 -1
- package/dist/lib/daemon/protocol.d.ts +1 -1
- package/dist/lib/daemon/protocol.js +0 -6
- package/dist/lib/daemon/run.js +76 -3
- package/dist/lib/daemon/selfcheck.js +2 -2
- package/dist/lib/daemon/server.d.ts +2 -4
- package/dist/lib/daemon/server.js +5 -48
- 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 +11 -1
- package/dist/lib/daemon/supervisor.js +86 -0
- 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/flag-registry-worker.js +33 -3
- package/dist/lib/flag-registry.js +13 -0
- 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/envelope-repair-dispatch.js +1 -1
- package/dist/lib/lanes/monitor.d.ts +2 -0
- package/dist/lib/lanes/monitor.js +2 -1
- 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/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/scan-packages/index.js +8 -9
- package/dist/lib/signals/engine.d.ts +8 -0
- package/dist/lib/signals/engine.js +15 -5
- package/dist/lib/sync-core/flag.d.ts +18 -0
- package/dist/lib/sync-core/flag.js +66 -0
- package/dist/lib/sync-core/reconcile.d.ts +6 -0
- package/dist/lib/sync-core/reconcile.js +15 -0
- package/dist/lib/sync-core/rollout-state.d.ts +2 -0
- package/dist/lib/sync-core/rollout-state.js +7 -0
- package/dist/lib/sync-core/vault-settings.d.ts +12 -1
- package/dist/lib/sync-core/vault-settings.js +23 -7
- 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/pack-contributions.d.ts +14 -2
- package/dist/utils/pack-contributions.js +31 -5
- 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 +7 -7
- package/scripts/bench-core.mjs +34 -3
- 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
package/dist/commands/bot.js
CHANGED
|
@@ -6,8 +6,7 @@ import { CLI_VERSION } from "../cli-version.js";
|
|
|
6
6
|
import { BOT_SIGNALS_RUNTIME_SETTINGS, signalsPassRuntime } from "../lib/bot/config.js";
|
|
7
7
|
import { runSignals } from "../lib/signals/engine.js";
|
|
8
8
|
// The main bot's runtime, the same one the signals engine's extract step uses.
|
|
9
|
-
import {
|
|
10
|
-
import { resolveProcessFlagGate } from "../lib/flag-registry.js";
|
|
9
|
+
import { signalsEngineForJob } from "../lib/bot/signals-engine-flag.js";
|
|
11
10
|
import { currentHotSignalSyncCompany, hasScheduledBriefJob, hotSignalSyncJobCompanies, readActiveCompanySlug, registerHotSignalSyncOnStart, runHotSignalSyncJob } from "../lib/bot/jobs/hot-signal-sync.js";
|
|
12
11
|
import { CLAUDE_SIGN_IN_STEPS, CODEX_SIGN_IN_STEPS, codexBotSignalsOptInCommand, createClaudeSignalsPass } from "../lib/hot-channels/signals-pass.js";
|
|
13
12
|
import { executiveSignalsRuntimeOptions, signalsPassCodexLogin } from "../lib/hot-channels/signals-runtime.js";
|
|
@@ -57,7 +56,7 @@ import { describeExecutiveBotSource, resolveExecutiveBot, setExecutiveBot } from
|
|
|
57
56
|
import { executiveHotSignalSyncCompanies } from "../lib/bot/executive-sync.js";
|
|
58
57
|
import { readBotListedProcess } from "../lib/bot/listed-running.js";
|
|
59
58
|
import { DEFAULT_BOT_READY_TIMEOUT_SECONDS, botReadinessReport, clearBotSetupStep, createSetupStepReporter, readBotSetupStep, waitForGatewayReady, fleetStatusCarriesReady, writeBotSetupStep, } from "../lib/bot/readiness.js";
|
|
60
|
-
import { ensureFleetHotSignalSync, fleetCronOps, migrateLegacyJobsToFleet } from "../lib/bot/fleet-cron.js";
|
|
59
|
+
import { ensureFleetHotSignalSync, fleetCronOps, fleetHotSignalSyncEngineCompanies, migrateLegacyJobsToFleet } from "../lib/bot/fleet-cron.js";
|
|
61
60
|
import { resolvePackSetupPrompt } from "../lib/bot/pack-setup.js";
|
|
62
61
|
import { detectCodingToolActivity } from "../lib/bot/coding-tool-activity.js";
|
|
63
62
|
import { setupToolOfferPendingSection, setupToolOfferText, setupWelcomeOpening } from "../lib/bot/setup-tool-offer.js";
|
|
@@ -227,16 +226,7 @@ function fleetSetupToolOffer(dir, config) {
|
|
|
227
226
|
return null;
|
|
228
227
|
}
|
|
229
228
|
}
|
|
230
|
-
|
|
231
|
-
function fleetSignalsJobEnabled() {
|
|
232
|
-
try {
|
|
233
|
-
return resolveProcessFlagGate(BOT_SIGNALS_ENGINE_JOB_FLAG, { fallback: false }, () => false);
|
|
234
|
-
}
|
|
235
|
-
catch {
|
|
236
|
-
return false;
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
function syncFleetRuntimeJobs(name, dir, config) {
|
|
229
|
+
async function syncFleetRuntimeJobs(name, dir, config) {
|
|
240
230
|
const log = createBotLogger(dir);
|
|
241
231
|
let ops;
|
|
242
232
|
try {
|
|
@@ -277,7 +267,12 @@ function syncFleetRuntimeJobs(name, dir, config) {
|
|
|
277
267
|
const executiveBot = resolveExecutiveBot();
|
|
278
268
|
const role = hotSignalSyncRole(name, config, executiveBot);
|
|
279
269
|
const executive = role.executive;
|
|
280
|
-
|
|
270
|
+
// The daily Fleet signals job is gated by the same default-off flag as the
|
|
271
|
+
// in-process engine job (cli.bot-signals-engine-job), read for each company
|
|
272
|
+
// this bot has a job for: a personal bot has no company of its own. A
|
|
273
|
+
// company with the flag on and both capture settings off on this computer
|
|
274
|
+
// keeps the plain sync script (the engine would skip it).
|
|
275
|
+
const jobs = {
|
|
281
276
|
dir,
|
|
282
277
|
config,
|
|
283
278
|
ops,
|
|
@@ -287,10 +282,11 @@ function syncFleetRuntimeJobs(name, dir, config) {
|
|
|
287
282
|
otherBotDirs: role.otherBotDirs,
|
|
288
283
|
nodeBinary: resolveNodeBinary(),
|
|
289
284
|
hqBinary: resolveHqBinary(),
|
|
290
|
-
signalsJobEnabled: fleetSignalsJobEnabled(),
|
|
291
285
|
executive,
|
|
292
286
|
executiveCompanies: role.executiveCompanies,
|
|
293
|
-
}
|
|
287
|
+
};
|
|
288
|
+
const signalsJobEnabled = await fleetHotSignalSyncEngineCompanies(jobs, undefined, (message) => log("warn", message));
|
|
289
|
+
const result = ensureFleetHotSignalSync({ ...jobs, signalsJobEnabled });
|
|
294
290
|
if (executive === false && result.removed.length > 0) {
|
|
295
291
|
log("info", `removed the daily hot-signal-sync from this bot (${result.removed.length} job${result.removed.length === 1 ? "" : "s"}): ${executiveBot ? `${executiveBot.name} is the Executive bot now and runs it` : "only the Executive bot runs it"}`);
|
|
296
292
|
}
|
|
@@ -366,7 +362,7 @@ export async function resyncHotSignalSyncAfterRemoval(removed, sync = syncFleetR
|
|
|
366
362
|
const config = readBotConfig(dir);
|
|
367
363
|
if (!config || config.enabled === false || !isFleetRuntimeBot(config) || hasPromotionHold(dir))
|
|
368
364
|
return;
|
|
369
|
-
sync(other, dir, config);
|
|
365
|
+
await sync(other, dir, config);
|
|
370
366
|
done.push(other);
|
|
371
367
|
}, { command: "hq bot rm (hot-signal-sync hand-over)", waitMs: 5_000 });
|
|
372
368
|
}
|
|
@@ -444,7 +440,7 @@ async function fleetGatewayComesUp(agentUid, waitMs, stepMs = 500) {
|
|
|
444
440
|
await new Promise((r) => setTimeout(r, stepMs));
|
|
445
441
|
}
|
|
446
442
|
}
|
|
447
|
-
function runFleetRuntimeControl(name, config, action, output) {
|
|
443
|
+
async function runFleetRuntimeControl(name, config, action, output) {
|
|
448
444
|
const json = output === true;
|
|
449
445
|
if ((action === "install" || action === "start" || action === "restart") && config.fleetAuthPending === true) {
|
|
450
446
|
const authCommand = fleetAuthCommand(name, config);
|
|
@@ -456,7 +452,7 @@ function runFleetRuntimeControl(name, config, action, output) {
|
|
|
456
452
|
}
|
|
457
453
|
if (action === "install" || action === "start" || action === "restart") {
|
|
458
454
|
refreshFleetLocalInstructions(config.agentUid, fleetBotSystemPrompt(name, config));
|
|
459
|
-
syncFleetRuntimeJobs(name, botDir(name), config);
|
|
455
|
+
await syncFleetRuntimeJobs(name, botDir(name), config);
|
|
460
456
|
}
|
|
461
457
|
const installService = action === "install" || (config.fleetServiceInstallPending === true && (action === "start" || action === "restart"));
|
|
462
458
|
const result = reportDaemonStopped(name, json, () => controlFleetLocalBot(config.agentUid, installService ? "install" : action));
|
|
@@ -1060,7 +1056,7 @@ async function convertLegacyBotToFleet(name, dir, config, from) {
|
|
|
1060
1056
|
// The legacy runner's copy of the machine credentials goes only now: a failed move above still needs it.
|
|
1061
1057
|
fs.rmSync(botCredsPath(dir), { force: true });
|
|
1062
1058
|
log("info", `moved ${name} to the HQ Fleet Runtime under the same identity; its ${config.runtime} runner is retired`);
|
|
1063
|
-
syncFleetRuntimeJobs(name, dir, fleet);
|
|
1059
|
+
await syncFleetRuntimeJobs(name, dir, fleet);
|
|
1064
1060
|
retireLegacyBotAgent(name, dir, config, from === "run" ? "detached" : "inline");
|
|
1065
1061
|
return { fleet, state: null };
|
|
1066
1062
|
}
|
|
@@ -1160,7 +1156,7 @@ async function startFleetRuntimeBot(name, dir, config, output, extra) {
|
|
|
1160
1156
|
}
|
|
1161
1157
|
const adopted = await adoptFleetRuntimeProfile(name, dir, config);
|
|
1162
1158
|
refreshFleetLocalInstructions(config.agentUid, fleetBotSystemPrompt(name, config));
|
|
1163
|
-
syncFleetRuntimeJobs(name, dir, config);
|
|
1159
|
+
await syncFleetRuntimeJobs(name, dir, config);
|
|
1164
1160
|
const before = readBotStatus(dir);
|
|
1165
1161
|
const alreadyRunning = !!before && before.state === "running" && isPidAlive(before.pid);
|
|
1166
1162
|
const installService = adopted || config.fleetServiceInstallPending === true;
|
|
@@ -2019,7 +2015,7 @@ async function runBotCreateLocked(name, opts) {
|
|
|
2019
2015
|
}
|
|
2020
2016
|
}
|
|
2021
2017
|
const startedByRuntime = startNow && !daemonRunsFleetBots && brainLogin !== null && controlFleetLocalBot(agentUid, "install").ok === true;
|
|
2022
|
-
syncFleetRuntimeJobs(name, dir, config);
|
|
2018
|
+
await syncFleetRuntimeJobs(name, dir, config);
|
|
2023
2019
|
const running = fleetBootstrap.running || startedByDaemon || startedByRuntime;
|
|
2024
2020
|
let readyWait = null;
|
|
2025
2021
|
if (!startNow) {
|
|
@@ -2264,9 +2260,13 @@ async function runBotResident(nameArg) {
|
|
|
2264
2260
|
// unless that bot is a Codex bot with signalsRuntime "bot".
|
|
2265
2261
|
signalsPass: createClaudeSignalsPass({ hqRoot: config.hqRoot, company: input.company, ...executiveSignalsRuntimeOptions(), onClaudeLogin: recordSignalsPassClaudeLogin }),
|
|
2266
2262
|
});
|
|
2267
|
-
// The engine is gated default-off (cli.bot-signals-engine-job)
|
|
2268
|
-
//
|
|
2269
|
-
|
|
2263
|
+
// The engine is gated default-off (cli.bot-signals-engine-job), read for the
|
|
2264
|
+
// company the job is for; with the flag off for that company the job runs
|
|
2265
|
+
// the hot-channel sync alone, as before US-006. It also keeps the sync when
|
|
2266
|
+
// the engine would skip the company as prefs-off on this computer (both
|
|
2267
|
+
// capture settings off). The job and "Try now" ask this one function.
|
|
2268
|
+
const signalsEngineFor = (company) => signalsEngineForJob(runSignals, company, { hqRoot: config.hqRoot });
|
|
2269
|
+
const runHotSignalSync = (input) => signalsEngineFor(input.company).then((signals) => hotSignalSyncJob(input, signals));
|
|
2270
2270
|
// Prefer the Executive bot for daily hot-channel sync. Other personal bots
|
|
2271
2271
|
// keep their company covered until the Executive has a replacement job.
|
|
2272
2272
|
// Identity only (never the executive.enabled opt-in); with no personal bot
|
|
@@ -2292,9 +2292,10 @@ async function runBotResident(nameArg) {
|
|
|
2292
2292
|
hotSignalSync: (input) => runHotSignalSync(input),
|
|
2293
2293
|
// US-006 AC9: the member's "Try now" runs the same entry point as the job,
|
|
2294
2294
|
// as `--trigger chat --force`, behind the same cli.bot-signals-engine-job
|
|
2295
|
-
// flag.
|
|
2296
|
-
|
|
2297
|
-
|
|
2295
|
+
// flag and capture check. Engine not chosen: null, and the message goes to
|
|
2296
|
+
// the model as before.
|
|
2297
|
+
signalsTryNow: async (company) => {
|
|
2298
|
+
const signals = await signalsEngineFor(company);
|
|
2298
2299
|
if (!signals)
|
|
2299
2300
|
return null;
|
|
2300
2301
|
return (input) => hotSignalSyncJob({ ...input, catchUp: false, tryNow: true }, signals);
|
|
@@ -3440,7 +3441,7 @@ export async function updateFleetRuntimeBot(nameArg, opts = {}) {
|
|
|
3440
3441
|
const config = readBotConfig(b.dir) ?? b.config;
|
|
3441
3442
|
if (adopted) {
|
|
3442
3443
|
refreshFleetLocalInstructions(config.agentUid, fleetBotSystemPrompt(b.name, config));
|
|
3443
|
-
syncFleetRuntimeJobs(b.name, b.dir, config);
|
|
3444
|
+
await syncFleetRuntimeJobs(b.name, b.dir, config);
|
|
3444
3445
|
}
|
|
3445
3446
|
if (opts.busy?.()) {
|
|
3446
3447
|
patchBotConfig(b.dir, { fleetRestartPending: true });
|
|
@@ -3464,7 +3465,7 @@ async function restartBot(nameArg, opts = {}) {
|
|
|
3464
3465
|
if (isFleetRuntimeBot(b.config)) {
|
|
3465
3466
|
refuseHeldFleetBot(b.dir);
|
|
3466
3467
|
const adopted = await adoptFleetRuntimeProfile(b.name, b.dir, b.config);
|
|
3467
|
-
const result = runFleetRuntimeControl(b.name, b.config, adopted ? "install" : "restart", opts.output === "silent" ? "silent" : opts.json === true || opts.output === "json");
|
|
3468
|
+
const result = await runFleetRuntimeControl(b.name, b.config, adopted ? "install" : "restart", opts.output === "silent" ? "silent" : opts.json === true || opts.output === "json");
|
|
3468
3469
|
return { ok: result.ok === true, detail: typeof result.summary === "string" && result.summary ? result.summary : null };
|
|
3469
3470
|
}
|
|
3470
3471
|
const running = readBotStatus(b.dir);
|
|
@@ -3577,7 +3578,7 @@ export async function runBotAuth(nameArg, opts) {
|
|
|
3577
3578
|
clearFleetMoveRecords(b.dir);
|
|
3578
3579
|
fs.rmSync(botCredsPath(b.dir), { force: true });
|
|
3579
3580
|
createBotLogger(b.dir)("info", `moved ${b.name} to the HQ Fleet Runtime with its ${opts.provider} sign-in; its ${legacy.runtime} runner is retired`);
|
|
3580
|
-
syncFleetRuntimeJobs(b.name, b.dir, moved);
|
|
3581
|
+
await syncFleetRuntimeJobs(b.name, b.dir, moved);
|
|
3581
3582
|
retireLegacyBotAgent(b.name, b.dir, legacy, "inline");
|
|
3582
3583
|
}
|
|
3583
3584
|
const signedInRuntime = result.runtimeProvider === "anthropic" ? "claude" : result.runtimeProvider === "xai-oauth" ? "grok" : result.runtimeProvider === "openai-codex" ? "codex" : null;
|
|
@@ -4286,7 +4287,7 @@ export function registerBotCommand(program) {
|
|
|
4286
4287
|
if (isFleetRuntimeBot(b.config)) {
|
|
4287
4288
|
refuseHeldFleetBot(b.dir);
|
|
4288
4289
|
const adopted = await adoptFleetRuntimeProfile(b.name, b.dir, b.config, { progress: fleetInstallProgressReporter(opts.json ? "silent" : "text") });
|
|
4289
|
-
runFleetRuntimeControl(b.name, b.config, adopted ? "install" : "start", opts.json === true);
|
|
4290
|
+
await runFleetRuntimeControl(b.name, b.config, adopted ? "install" : "start", opts.json === true);
|
|
4290
4291
|
return;
|
|
4291
4292
|
}
|
|
4292
4293
|
await startBot(b.name, b.dir, b.config, opts.json ? "json" : "text");
|
|
@@ -4299,7 +4300,7 @@ export function registerBotCommand(program) {
|
|
|
4299
4300
|
const b = requireBot(name);
|
|
4300
4301
|
if (isFleetRuntimeBot(b.config)) {
|
|
4301
4302
|
refuseHeldFleetBot(b.dir);
|
|
4302
|
-
runFleetRuntimeControl(b.name, b.config, "stop", opts.json === true);
|
|
4303
|
+
await runFleetRuntimeControl(b.name, b.config, "stop", opts.json === true);
|
|
4303
4304
|
return;
|
|
4304
4305
|
}
|
|
4305
4306
|
await stopBot(b.name, b.dir, b.config, opts.json ? "json" : "text");
|
|
@@ -153,8 +153,11 @@ export interface VaultClient {
|
|
|
153
153
|
* Soft-tombstone a company (`DELETE /entity/{uid}`). Owner-only. Leaves the
|
|
154
154
|
* row, S3 bucket, KMS key, and memberships intact. Idempotent on an already
|
|
155
155
|
* deleted company. Used by `hq cloud retire company`.
|
|
156
|
+
*
|
|
157
|
+
* hq-pro requires a JSON body `{ confirmName }` matching the company name
|
|
158
|
+
* or slug (`COMPANY_DELETE_CONFIRMATION_REQUIRED` otherwise).
|
|
156
159
|
*/
|
|
157
|
-
softDeleteCompany(uid: string): Promise<{
|
|
160
|
+
softDeleteCompany(uid: string, confirmName: string): Promise<{
|
|
158
161
|
deleted: true;
|
|
159
162
|
uid: string;
|
|
160
163
|
}>;
|
|
@@ -413,9 +413,13 @@ export function createDefaultVaultClient(apiUrl, accessToken) {
|
|
|
413
413
|
return data.entity;
|
|
414
414
|
});
|
|
415
415
|
},
|
|
416
|
-
async softDeleteCompany(uid) {
|
|
416
|
+
async softDeleteCompany(uid, confirmName) {
|
|
417
417
|
const url = `${apiUrl.replace(/\/$/, "")}/entity/${encodeURIComponent(uid)}`;
|
|
418
|
-
return withVaultRequest(url, {
|
|
418
|
+
return withVaultRequest(url, {
|
|
419
|
+
method: "DELETE",
|
|
420
|
+
headers,
|
|
421
|
+
body: JSON.stringify({ confirmName }),
|
|
422
|
+
}, async (res) => {
|
|
419
423
|
if (res.status === 403) {
|
|
420
424
|
const body = await safeBody(res);
|
|
421
425
|
throw new ProvisionError(2, `Refusing to retire '${uid}': only the company owner can soft-tombstone it. ${body}`);
|
|
@@ -628,7 +632,7 @@ export async function provisionCompany(options) {
|
|
|
628
632
|
let retired = false;
|
|
629
633
|
if (createdEntity) {
|
|
630
634
|
try {
|
|
631
|
-
await vaultClient.softDeleteCompany(entity.uid);
|
|
635
|
+
await vaultClient.softDeleteCompany(entity.uid, entity.slug || options.slug);
|
|
632
636
|
retired = true;
|
|
633
637
|
log(`retired vault entity uid=${entity.uid} — assigned slug ${assigned} differs from requested ${options.slug}`);
|
|
634
638
|
}
|