@indigoai-us/hq-cli 5.345.236 → 5.345.238

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.
Files changed (96) hide show
  1. package/CHANGELOG.md +46 -0
  2. package/dist/command-catalog.generated.d.ts +1 -1
  3. package/dist/command-catalog.generated.js +1 -1
  4. package/dist/commands/bot.d.ts +2 -0
  5. package/dist/commands/bot.js +32 -0
  6. package/dist/commands/daemon.d.ts +1 -0
  7. package/dist/commands/daemon.js +70 -6
  8. package/dist/commands/deploy-app-db.js +4 -19
  9. package/dist/commands/deploy-app-upload.js +66 -40
  10. package/dist/commands/deploy-mutations.js +24 -16
  11. package/dist/commands/deploy-runtime-bindings.js +7 -26
  12. package/dist/commands/deploy-ssr.js +5 -24
  13. package/dist/commands/mesh.js +6 -2
  14. package/dist/commands/signals-run.d.ts +43 -2
  15. package/dist/commands/signals-run.js +85 -7
  16. package/dist/commands/sync-core.d.ts +7 -0
  17. package/dist/commands/sync-core.js +52 -3
  18. package/dist/lib/agent-kit/inbox-state.d.ts +2 -1
  19. package/dist/lib/agent-kit/inbox-state.js +27 -3
  20. package/dist/lib/bot/continuity.d.ts +21 -2
  21. package/dist/lib/bot/continuity.js +48 -19
  22. package/dist/lib/bot/fleet-cron.js +6 -0
  23. package/dist/lib/bot/fleet-local.d.ts +11 -1
  24. package/dist/lib/bot/fleet-local.js +21 -1
  25. package/dist/lib/bot/fleet-state.d.ts +129 -0
  26. package/dist/lib/bot/fleet-state.js +669 -0
  27. package/dist/lib/bot/promote.d.ts +32 -3
  28. package/dist/lib/bot/promote.js +188 -16
  29. package/dist/lib/bot/promotion-hold-reconcile.d.ts +56 -0
  30. package/dist/lib/bot/promotion-hold-reconcile.js +155 -0
  31. package/dist/lib/daemon/catalog.d.ts +13 -0
  32. package/dist/lib/daemon/catalog.js +32 -6
  33. package/dist/lib/daemon/lanes-reconcile-status.d.ts +0 -4
  34. package/dist/lib/daemon/lanes-reconcile-status.js +2 -12
  35. package/dist/lib/daemon/lanes-reconcile-watcher.d.ts +1 -1
  36. package/dist/lib/daemon/lanes-reconcile-watcher.js +2 -1
  37. package/dist/lib/daemon/legacy-handover.d.ts +38 -0
  38. package/dist/lib/daemon/legacy-handover.js +117 -0
  39. package/dist/lib/daemon/mesh-owner.js +2 -1
  40. package/dist/lib/daemon/run.d.ts +35 -2
  41. package/dist/lib/daemon/run.js +108 -15
  42. package/dist/lib/daemon/selfcheck.d.ts +28 -0
  43. package/dist/lib/daemon/selfcheck.js +86 -15
  44. package/dist/lib/deploy-api.d.ts +1 -1
  45. package/dist/lib/deploy-api.js +2 -1
  46. package/dist/lib/deploy-identity.d.ts +18 -0
  47. package/dist/lib/deploy-identity.js +179 -0
  48. package/dist/lib/hot-channels/alert.js +13 -6
  49. package/dist/lib/hot-channels/fleet-complete.d.ts +89 -0
  50. package/dist/lib/hot-channels/fleet-complete.js +157 -0
  51. package/dist/lib/hot-channels/run.js +2 -1
  52. package/dist/lib/hot-channels/signals-claude-login.d.ts +3 -2
  53. package/dist/lib/hot-channels/signals-claude-login.js +6 -1
  54. package/dist/lib/hot-channels/signals-pass-failure.d.ts +29 -0
  55. package/dist/lib/hot-channels/signals-pass-failure.js +36 -0
  56. package/dist/lib/hot-channels/signals-pass.d.ts +49 -2
  57. package/dist/lib/hot-channels/signals-pass.js +188 -12
  58. package/dist/lib/hot-channels/signals-runtime.d.ts +6 -3
  59. package/dist/lib/hot-channels/signals-runtime.js +11 -2
  60. package/dist/lib/lanes/reconcile-result.d.ts +5 -0
  61. package/dist/lib/lanes/reconcile-result.js +20 -2
  62. package/dist/lib/lanes/reconcile.js +12 -3
  63. package/dist/lib/mesh/live/emit.js +25 -6
  64. package/dist/lib/mesh/live/flush.js +119 -15
  65. package/dist/lib/mesh/live/reporting-privacy.d.ts +41 -0
  66. package/dist/lib/mesh/live/reporting-privacy.js +147 -1
  67. package/dist/lib/mesh/live/spool.d.ts +16 -0
  68. package/dist/lib/mesh/live/spool.js +45 -0
  69. package/dist/lib/signals/engine.d.ts +17 -3
  70. package/dist/lib/signals/engine.js +28 -9
  71. package/dist/lib/signals/failure-alert.d.ts +33 -1
  72. package/dist/lib/signals/failure-alert.js +72 -5
  73. package/dist/lib/signals/owner-notice.d.ts +94 -0
  74. package/dist/lib/signals/owner-notice.js +233 -0
  75. package/dist/lib/signals/reply.d.ts +7 -0
  76. package/dist/lib/signals/reply.js +23 -3
  77. package/dist/lib/signals/steps/adapters.d.ts +51 -2
  78. package/dist/lib/signals/steps/adapters.js +213 -7
  79. package/dist/lib/signals/steps/extract.js +18 -4
  80. package/dist/lib/signals/steps/types.d.ts +63 -1
  81. package/dist/lib/signals/steps/types.js +32 -0
  82. package/dist/lib/sync-core/engine-auth.d.ts +35 -0
  83. package/dist/lib/sync-core/engine-auth.js +96 -0
  84. package/dist/lib/sync-core/engine-home.d.ts +6 -0
  85. package/dist/lib/sync-core/engine-home.js +12 -0
  86. package/dist/lib/sync-core/rollout-state.d.ts +1 -0
  87. package/dist/lib/sync-core/rollout-state.js +3 -0
  88. package/dist/lib/vault-sync-switches.d.ts +7 -0
  89. package/dist/lib/vault-sync-switches.js +56 -0
  90. package/dist/lib/work-context/errors.d.ts +12 -0
  91. package/dist/lib/work-context/errors.js +15 -0
  92. package/dist/lib/work-context/organize.js +6 -1
  93. package/dist/lib/work-context/reconcile.js +20 -1
  94. package/dist/utils/resident-package-preload.js +34 -4
  95. package/docs/anywhere-runtime.md +6 -0
  96. package/package.json +7 -7
package/CHANGELOG.md CHANGED
@@ -2,6 +2,52 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [5.345.238] — 2026-11-19
6
+ - Publish the warm CLI test fixture atomically before executing it on Unix.
7
+ - Internal: The hq-hook PR test shards run under cargo-nextest, one process per test across all cores.
8
+ - Record native UserPromptSubmit master coverage on Unix for Claude, Codex and Grok.
9
+ - Preserve pending inbox acknowledgements when their state file cannot be read or parsed.
10
+ - A local bot held for a move to the cloud now frees itself when HQ shows that move was cancelled (or has no move for it and its owner is signed in). `hq daemon` checks each held bot at most every 15 minutes and starts it again: a bot the daemon runs if it was running before the move, and an HQ Fleet bot on macOS. On Linux an HQ Fleet bot is freed but needs `hq bot start`. `hq bot run` checks within the same 15-minute limit, and `hq bot start` checks once before refusing. A bot that moved to the cloud, or whose move is still in progress, stays held.
11
+ - Host canaries can snapshot the working HQ scaffold and bind results to the installed policy gate.
12
+
13
+ ## [5.345.237] — 2026-11-19
14
+ - Declare the tests for the Unicode credential and released secrets guard replay differences.
15
+ - Declare the existing tests for five dispatcher replay differences.
16
+ - Declare the existing tests for the two env-file replay differences.
17
+ - Preserve configured Grok prompt bookkeeping after the native host adapter.
18
+ - Verify the Codex UserPromptSubmit adapter claim alongside released behavior parity.
19
+ - Test: require Rust hook difference ledgers to declare each referenced test function explicitly.
20
+ - `hq bot promote` now moves an HQ Fleet Runtime bot's learned skills and its scheduled jobs that report to its owner in the HQ DM. They travel in the promotion snapshot under `memory/fleet-state/`, with a record of the bot's runtime, provider, model, effort and timezone. Of those settings only the timezone is used, to pin the carried jobs' schedules; the cloud bot's model follows HQ's brain rules for the move. Memory notes are not carried: the computer's shared memory store cannot yet be separated per bot, so every note stays on the computer, and the snapshot records only whether any stayed, not how many.
21
+ - A learned skill stays behind when HQ's secret scanner (the same rules as `hq scan secrets`) finds a key or token in one of its files, when a file has a key or credentials name (`.pem`, `.key`, `.p12`, `.pfx`, `id_rsa`, `credentials*`, `secrets.*`, `.env*`), when it holds a path the cloud importer refuses, such as `node_modules` or `auth.json`, or when one of its files is over 4 MiB, the cloud computer's per-file limit. Placeholders and references such as `API_KEY=your-api-key-here`, `TOKEN_URL=https://…`, `op://…` and `hq://secrets/…` no longer hold a skill back, and a very long line is checked in bounded time. A skill also stays when a file's path looks like a key, or when a file has a line over 64 KiB, which is not scanned. `gitleaks:allow` and `hq-secret-scan:allow` markers do not exempt carried files. Learned skills that together pass one transfer's 2000-file or 32 MiB limit fail the move before any file is read or scanned, naming the skills largest first, and each file is scanned once per promotion. At most 500 learned skills move, as the cloud computer installs no more; the rest are listed as past the limit. A skill whose folder name looks like a key is listed as `(name withheld)` and never carried, and a provider or model name that looks like a key is left out of the recorded settings. No skills move when the runtime's bundled-skill list is missing.
22
+ - A scheduled job stays behind, with the reason printed, when its instructions or any other field it would carry (name, schedule, skills, state) look like they hold a secret, it is limited to certain tools, its id is not 1 to 64 letters, digits, `_` or `-`, its cron line has a line break, its interval is not a whole number of minutes from 1 to 525600, its repeat count is not a whole number, its one-time `run_at` is not an ISO 8601 time the cloud computer reads (a time without an offset is read in the job's or the bot's zone), its time zone is not one the cloud computer accepts, it has already run as many times as it was set to, or it is past the first 200 carried jobs. A job left behind is listed by id and name only when they hold no secret. A carried job keeps its state only when it is paused; any other state is carried as scheduled. Job text is scanned once per promotion. A top-level timezone the cloud computer would not accept is replaced by this computer's zone.
23
+ - The command prints what moves and what stays, `--json` adds a `fleetState` field for these bots, and a snapshot the cloud importer would refuse fails on the computer before the bot is held, stopped or uploaded, naming the learned skills to remove when they are the cause. If the snapshot fails after this run held the bot, the hold is removed and the bot started again if it was running; if a hold from an earlier run remains, the message says to rerun `hq bot promote <name> --company <uid>` or cancel. When HQ reports the earlier move as canceled and the snapshot then fails, the bot is started again if it was running before that move, and the message says so. The recorded runtime, model and effort, and so the printed summary, come from the brain sent to HQ (the Fleet profile first), not from `bot.json`. Bots that do not run on the HQ Fleet Runtime are unchanged.
24
+ - `hq bot promote` treats a 5xx answer to the prepare request like a lost answer: it asks HQ whether it recorded the move before releasing the bot. For an HQ Fleet bot the model in its Fleet profile is sent instead of `bot.json`'s when the profile's provider is known, and a profile model starting with `claude`, `anthropic/`, `grok`, `x-ai/` or `xai/` marks the bot as Claude or Grok.
25
+ - `hq bot promote --cancel` keeps the hold when HQ will not show the move and then answers that it has no move to cancel, and prints how to free the bot by hand, naming every file to delete: the hold, `promotion-hold-origin.json`, `promotion-active.json` and the frozen snapshots. The 8-minute cap on waiting for the cloud copy to shut down is measured on the clock, so slow requests count toward it.
26
+ - Harden native scope checks for uncertain function calls and zsh runtime state, and cover the mandatory scope guard on all five hosts.
27
+ - Close four native scope-guard bypasses: a zsh multi-name `for` loop glued to a case pattern, a `}` used as a case word, zsh `argv` outside a function body, and zsh extendedglob patterns (`#`, `^`, `~`) in a company path.
28
+ - Close two more native scope-guard bypasses: a `}` or other reserved word after an assignment or redirection (bash reads it as a command name, so the function body stays open), and zsh glob groups such as `companies/oth(e|x)rco` or `(companies)/...` in a path. zsh numeric globs (`<1-9>`) and glob qualifiers that run code are refused too.
29
+ - Close a native scope-guard bypass under bash 3.2 (macOS `/bin/bash` and `/bin/sh`), which has no `coproc` keyword: a reserved word, a group or nothing after `coproc` is refused. Bound functions that use `case $1 in ...` or the `[ ... ]` test command are allowed again.
30
+ - signals: the hot-channel signals pass runs on an HQ Fleet Executive bot's own login. When the Executive bot is a Claude or Codex HQ Fleet bot with its `hq-fleet-local` helper installed, each document goes through `hq-fleet-local complete` (one locked-down turn with the login the bot answers chat with), so signals no longer need a separate `claude auth login` and keep running while the `claude` CLI is signed out. An API-key login is refused. The pass falls back to the `claude` CLI only when the helper is missing or has no `complete` command; a Grok Fleet bot keeps the `claude` CLI path for now. A bot that cannot sign in fails with a distinct bot-login outcome; alerts and job notices point at its Brain profile. API-key logins get subscription-switch advice. A pass using another login retires the old Claude Code sign-out record, and bot status ignores it for Fleet completion targets.
31
+
32
+ - A scheduled signals run that could not do its work now tells the owner the same morning. When the signals pass found its login signed out, failed, or left landed documents unread at its document cap, or the run failed, `hq signals run --report-found` (the HQ Fleet job, whose output reaches the owner as an HQ DM) prints a plain notice with its fix. If the run used the Fleet bot's own login, a sign-out points to the bot's Brain profile in HQ to reconnect. If the run used the Claude Code fallback, the notice names that login and asks the owner to decide how signals should run; reconnecting the bot does not fix that fallback. Other causes link to Try now on the Daily Brief page. It prints no error code and no command. One notice per company per day per cause; after a told problem, the next clean run says signals are running again. State is in `workspace/signals/notices/{company}.json`. The bot's run reply for a blocked pass leads with the same words and keeps the run's own guidance, such as a reconnect step, after them.
33
+
34
+ - Notices distinguish Fleet bot login failures from the Claude CLI fallback and the bot Codex CLI; unsupported own-login setups call for an owner decision. The run detail records the selected login route.
35
+ - `hq signals run` now creates signals for the hot-channel sources its adapters step lands (meetings, Slack, Linear, Attio), using the same local signals pass, sign-in and document cap as `hq sources sync`. Before, a company whose bot job ran the signals engine landed a meeting, moved the cursor past it and wrote no signal. The run record counts the pass's signals in `counts.signalsOut`, sets `engine` and `account` from the pass when extract ran no model turn, and records the pass under the adapters step (`signalsOut`, `modelTurns`, `detail.signalsPass`). A pass that does not finish (Claude Code signed out, out of usage, a timeout), or whose document cap leaves a landed document unread, makes the run `partial` and leaves the landed documents queued in `sources/_signals-pending/` for the next run. The existing signals-failure alert fires when the pass failed after a landing, when its tool is signed out, or when the cap left everything an adapter landed unread. A channel folder with a `source.yaml` stays with the extract step. `hq signals run --report-found` also prints the owner's reply for signals the pass wrote and for those pass failures.
36
+ - The hot-channel signals pass now gives every `claude` call (the `claude auth status` check and each `claude -p` turn) only an allowlisted environment (`CLAUDE_SIGNALS_ENV_ALLOWLIST`), so `ANTHROPIC_API_KEY`, `ANTHROPIC_AUTH_TOKEN`, `ANTHROPIC_BASE_URL`, `CLAUDE_CODE_USE_BEDROCK`, `CLAUDE_CODE_USE_VERTEX` and any other parent variable never reach it, and the check refuses a Claude Code login that is an API key or a Bedrock/Vertex provider. The pass runs only on the subscription login, never an API key.
37
+ - Extraction turns (including incremental extraction) and fallback login checks now use the same Claude environment allowlist.
38
+ - `hq sync-core status` (text and `--json`) and the daemon's sync-engine self-check now report when the sync service keeps refusing the engine's token (HTTP 401) for a vault. Before, the engine unit kept running and looked healthy while nothing synced.
39
+ - The move from the old sync to the new sync engine now finishes on its own: the daemon asks an old sync runner that was started before a vault's switch changed to stop, so the desktop app relaunches it with the current switches. This covers a vault moving to the engine and a vault moved back to the old sync. It is never done for a vault the engine cannot run yet, and never on Windows. A handover still waiting after 10 minutes shows as stuck in `hq daemon status` or `hq sync-core status`, and the sync self-check reports it.
40
+ - Work Mesh now runs whenever a vault is on the new sync engine in full mode, even when the daemon config disables it, and `hq daemon disable mesh` says so. The sync self-check restarts Work Mesh or takes it over from an older unit before it sends a DM, at most once every 3 hours, and leaves a crash-looping Work Mesh alone.
41
+ - `hq sync-core status` shows, for each vault, whether its engine is running or waiting (and why) and whether its push channel is connected.
42
+ - `hq deploy upload-app` now retries the same app archive within a bounded window while its database is being created.
43
+ - Deploy metadata reads, app archive uploads, SSR registration, database enablement, and runtime binding commands keep the selected HQ identity and scope when recovering from a rejected session.
44
+ - Daemon status and logs now identify missing story ledgers during background lane reconciliation without exposing lane details.
45
+ - Work Mesh reporting of company work has fewer member off switches. For a session with a verified company binding, the HQ Anywhere person opt-out and `HQ_FLAG_HQ_ANYWHERE_RUNTIME=false|0` no longer stop Work Mesh events; the operator's `hq-anywhere-runtime` switch still stops everything. This also applies to fleet agent hosts that set the variable.
46
+ - Events from before are not sent: the first time HQ Anywhere is seen off on a machine the time is stored in `~/.hq/work-mesh/anywhere-off-since`, and while HQ Anywhere stays off a bound session's events dated before it (or undated) stay in the spool or retry file, unsent and undeleted.
47
+ - With HQ Anywhere off, a session without a verified company binding is unchanged: its events are not sent, held or dropped and its state is not written. A spool that holds no sendable event of a bound session is not claimed; otherwise the lines that are not sent are appended back byte for byte. The acknowledged-register repair no longer writes a binding into a session that has none while a Work Mesh switch is set or HQ Anywhere is off.
48
+ - `hq mesh context untracked` and `hq mesh context organize --untracked` are refused for a session with a verified company binding (`COMPANY_BOUND`; the untracked command exits 4). The message names the way to correct a wrong binding.
49
+ - `hq daemon disable mesh` is refused on a desktop or self-hosted machine while a session on it with a verified company binding was updated in the last 24 hours. The message names the way out.
50
+
5
51
  ## [5.345.236] — 2026-11-19
6
52
  - Test the Claude PostToolUse native claim alongside released dispatcher parity.
7
53
  - Verify the Codex SessionStart adapter claim alongside released behavior parity.
@@ -5663,7 +5663,7 @@ export declare const COMMAND_CATALOG: readonly [{
5663
5663
  readonly hidden: false;
5664
5664
  }, {
5665
5665
  readonly flags: "--report-found";
5666
- readonly description: "Print the owner's run reply only when the run found new signals; print nothing otherwise";
5666
+ readonly description: "Print the owner's run reply only when the run found new signals or its hot-channel signals pass did not finish; print nothing otherwise";
5667
5667
  readonly hidden: false;
5668
5668
  }, {
5669
5669
  readonly flags: "--redo <file>";
@@ -6880,7 +6880,7 @@ export const COMMAND_CATALOG = [
6880
6880
  },
6881
6881
  {
6882
6882
  "flags": "--report-found",
6883
- "description": "Print the owner's run reply only when the run found new signals; print nothing otherwise",
6883
+ "description": "Print the owner's run reply only when the run found new signals or its hot-channel signals pass did not finish; print nothing otherwise",
6884
6884
  "hidden": false
6885
6885
  },
6886
6886
  {
@@ -662,6 +662,8 @@ export declare const botPromoteSeams: {
662
662
  running: boolean;
663
663
  how: string;
664
664
  }>;
665
+ /** `hq bot start` asks HQ every time; `hq bot run` shares the daemon's per-bot interval, so a restart loop does not hammer HQ. */
666
+ reconcileHold: (name: string, dir: string, config: BotConfig, command: "hq bot start" | "hq bot run") => Promise<import("../lib/bot/promote.js").PromotionHoldReconcile>;
665
667
  };
666
668
  export declare function registerBotCommand(program: Command): void;
667
669
  /**
@@ -11,12 +11,14 @@ import { currentHotSignalSyncCompany, hasScheduledBriefJob, hotSignalSyncJobComp
11
11
  import { CLAUDE_SIGN_IN_STEPS, CODEX_SIGN_IN_STEPS, codexBotSignalsOptInCommand, createClaudeSignalsPass } from "../lib/hot-channels/signals-pass.js";
12
12
  import { executiveSignalsRuntimeOptions, signalsPassCodexLogin } from "../lib/hot-channels/signals-runtime.js";
13
13
  import { checkClaudeLoginNow, readSignalsClaudeLogin, recordSignalsPassClaudeLogin } from "../lib/hot-channels/signals-claude-login.js";
14
+ import { fleetCompleteTargetFor } from "../lib/hot-channels/fleet-complete.js";
14
15
  import { machineTimeZone } from "../lib/bot/job-run.js";
15
16
  import { runCompanyHotChannelSync } from "./sources.js";
16
17
  import { OwnerContextCache, lookupOwnerContext } from "../lib/bot/owner-context.js";
17
18
  import { hasActivePromotion, localPromotionState } from "../lib/bot/promotion-receipt.js";
18
19
  import { botBusyState, readInflightTurns } from "../lib/bot/inflight.js";
19
20
  import { hasPromotionHold, promotionHoldSummary } from "../lib/bot/promotion-hold.js";
21
+ import { heldBotThrottleDir, reconcileHeldBot } from "../lib/bot/promotion-hold-reconcile.js";
20
22
  /**
21
23
  * `hq bot` — personal local bots (local-bots US-003/US-004/US-005).
22
24
  *
@@ -41,6 +43,7 @@ import { hasPromotionHold, promotionHoldSummary } from "../lib/bot/promotion-hol
41
43
  * list (online flag), and rm. Secrets are never printed.
42
44
  */
43
45
  import { assertPromotedBotRemovable, cancelLocalBotPromotion, promoteLocalBot, promotionDetailsError, promotionFailureText, PROMOTION_CANCEL_TIMEOUT_MS } from "../lib/bot/promote.js";
46
+ import { describeFleetState } from "../lib/bot/fleet-state.js";
44
47
  import { DecisionsClient } from "../lib/decisions/client.js";
45
48
  import { releaseCurrentPackageUseLease, releasePackageUseLeaseAfterResidentPreload } from "../utils/package-use-lease.js";
46
49
  import { preloadResidentPackageModules, reportResidentPackagePreloadFailure, runResidentCommandWithPackageLease, } from "../utils/resident-package-preload.js";
@@ -534,6 +537,8 @@ export function signalsClaudeSignInFor(dir, fleet, record = readSignalsClaudeLog
534
537
  const executiveBot = resolveExecutiveBot();
535
538
  const source = executiveBot?.config ?? null;
536
539
  const executiveDir = executiveBot?.dir ?? null;
540
+ if (fleetCompleteTargetFor(source) && record?.loginRoute !== "claude-cli")
541
+ return null;
537
542
  if (signalsPassRuntime(source) === "codex")
538
543
  return null;
539
544
  const signedOutSince = record && !record.signedIn ? (record.signedOutSince ?? record.checkedAt) : null;
@@ -2250,6 +2255,7 @@ async function runBotResident(nameArg) {
2250
2255
  console.log(orphanBotRunMessage(name, outcome));
2251
2256
  return;
2252
2257
  }
2258
+ await releaseCancelledMove(name, dir, config, "text", "hq bot run");
2253
2259
  if ((await convertLegacyBotToFleet(name, dir, config, "run")).fleet)
2254
2260
  return;
2255
2261
  if (healNodePathFromJob(name, dir, config))
@@ -4226,7 +4232,27 @@ async function runBotListRemote(opts) {
4226
4232
  /** The bot's lifecycle seams for `hq bot promote`; tests replace them. */
4227
4233
  export const botPromoteSeams = {
4228
4234
  start: (name, dir, config) => startBot(name, dir, config, "silent"),
4235
+ /** `hq bot start` asks HQ every time; `hq bot run` shares the daemon's per-bot interval, so a restart loop does not hammer HQ. */
4236
+ reconcileHold: (name, dir, config, command) => reconcileHeldBot(name, dir, config, command === "hq bot run"
4237
+ ? { command, lockWaitMs: 0, throttle: { dir: heldBotThrottleDir(daemonPaths().root) } }
4238
+ : { command, lockWaitMs: 15_000, onWait: () => console.error(chalk.dim(`${name}: waiting for another hq command working on this bot...`)) }),
4229
4239
  };
4240
+ /** Before a start refuses a held bot: free it when HQ shows its move cancelled. */
4241
+ async function releaseCancelledMove(name, dir, config, output, command) {
4242
+ try {
4243
+ if (!hasPromotionHold(dir))
4244
+ return;
4245
+ }
4246
+ catch {
4247
+ return;
4248
+ }
4249
+ const result = await botPromoteSeams.reconcileHold(name, dir, config, command);
4250
+ if (result.outcome !== "released" || output !== "text")
4251
+ return;
4252
+ console.log(result.reason === "cancelled"
4253
+ ? `${name}: its move to the cloud was cancelled in HQ, so it is no longer held on this computer. Starting it.`
4254
+ : `${name}: HQ has no move to the cloud for it, so it is no longer held on this computer. Starting it.`);
4255
+ }
4230
4256
  /** `hq bot promote <name> --company <uid> --cancel`. */
4231
4257
  async function runBotPromoteCancel(name, dir, config, api, opts) {
4232
4258
  const result = await cancelLocalBotPromotion({
@@ -4325,6 +4351,11 @@ export function registerBotCommand(program) {
4325
4351
  isRunning: () => readBotListedProcess(dir, config).running,
4326
4352
  restart: () => botPromoteSeams.start(name, dir, config),
4327
4353
  ...(isFleetRuntimeBot(config) ? { runtime: fleetLocalPromotionRuntime(config.agentUid) } : {}),
4354
+ onSnapshot: (fleetState) => {
4355
+ if (fleetState && !opts.json)
4356
+ for (const line of describeFleetState(fleetState))
4357
+ console.log(line);
4358
+ },
4328
4359
  }), { command: "hq bot promote" });
4329
4360
  let details = null;
4330
4361
  let detailsError = null;
@@ -4413,6 +4444,7 @@ export function registerBotCommand(program) {
4413
4444
  .option("--json", "Print machine-readable JSON")
4414
4445
  .action((name, opts) => wrap(async () => {
4415
4446
  const b = requireBot(name);
4447
+ await releaseCancelledMove(b.name, b.dir, b.config, opts.json ? "json" : "text", "hq bot start");
4416
4448
  if (isFleetRuntimeBot(b.config)) {
4417
4449
  refuseHeldFleetBot(b.dir);
4418
4450
  const adopted = await adoptFleetRuntimeProfile(b.name, b.dir, b.config, { progress: fleetInstallProgressReporter(opts.json ? "silent" : "text") });
@@ -90,6 +90,7 @@ export declare function runLogs(d: DaemonCommandDeps, unit: string | undefined,
90
90
  follow?: boolean;
91
91
  lines?: string;
92
92
  }): Promise<void>;
93
+ export declare function repairWorkMesh(d: DaemonCommandDeps, action: "take-over" | "restart" | null): string | null;
93
94
  export declare function registerDaemonCommand(program: Command, over?: Partial<DaemonCommandDeps>): Command;
94
95
  export {};
95
96
  //# sourceMappingURL=daemon.d.ts.map
@@ -20,12 +20,14 @@ import * as fs from "node:fs";
20
20
  import * as os from "node:os";
21
21
  import * as path from "node:path";
22
22
  import { SYNC_WAKE_STATE_BASENAME, workMeshRoot } from "../lib/mesh/live/paths.js";
23
+ import { anyRecentSessionHasWorkMeshCompanyBinding, MESH_SERVICE_REQUIRED_NOTICE } from "../lib/mesh/live/reporting-privacy.js";
23
24
  import { homeIsLoginSafe, meshJobLoadedForHome } from "../lib/mesh/live/daemon/unit-home.js";
24
25
  import { randomBytes } from "node:crypto";
25
26
  import { spawn, spawnSync } from "node:child_process";
26
27
  import { once } from "node:events";
27
28
  import { compare as semverCompare, major as semverMajor, valid as validSemver } from "semver";
28
29
  import { DEFAULT_SERVICES, SERVICE_DESCRIPTIONS, enabledServices, hqCloudUnits } from "../lib/daemon/catalog.js";
30
+ import { engineVaultCount } from "../lib/sync-core/rollout-state.js";
29
31
  import { applyServiceToggle, effectiveSyncOwner, readDaemonConfig, writeDaemonConfig } from "../lib/daemon/config.js";
30
32
  import { daemonUnitInstalled } from "../lib/daemon/handoff.js";
31
33
  import { adoptLegacyUnits, readAdoptedUnits, restoreLegacyUnits } from "../lib/daemon/migrate.js";
@@ -192,8 +194,12 @@ function detect(d, flag, config) {
192
194
  readFileSync: d.readFile,
193
195
  });
194
196
  }
195
- function describeServices(machineType, config) {
196
- return enabledServices(machineType, config).map((s) => ` ${s.padEnd(16)} ${SERVICE_DESCRIPTIONS[s]}`);
197
+ function describeServices(machineType, config, engineVaults = 0) {
198
+ const lines = enabledServices(machineType, config, { engineVaults }).map((s) => ` ${s.padEnd(16)} ${SERVICE_DESCRIPTIONS[s]}`);
199
+ if (enabledServices(machineType, config, { engineVaults }).includes("mesh") && !enabledServices(machineType, config).includes("mesh")) {
200
+ lines.push(" mesh is kept on although disabled: the new sync engine needs it for change notifications while a vault is on it");
201
+ }
202
+ return lines;
197
203
  }
198
204
  function hostFor(d, paths, pathEnv) {
199
205
  const env = {};
@@ -311,7 +317,7 @@ async function runInstall(d, opts) {
311
317
  // The older Work Mesh unit is taken over by the install itself once the
312
318
  // daemon is running (feedback_c85ad51b): left alone, it kept running beside
313
319
  // the daemon until someone ran `hq daemon migrate --apply` by hand.
314
- const meshTakeover = scope === "user" && enabledServices(detected.type, config).includes("mesh")
320
+ const meshTakeover = scope === "user" && enabledServices(detected.type, config, { engineVaults: engineVaultCount(d.home) }).includes("mesh")
315
321
  ? migratable.filter((u) => u.service === "mesh" && u.kind !== "systemd-system")
316
322
  : [];
317
323
  const noteLegacy = (u) => d.out(`Note: ${describeLegacyUnit(u)} still runs ${u.unitId}. The daemon leaves it alone until \`hq daemon migrate\` takes it over.`);
@@ -972,11 +978,19 @@ async function runToggle(d, action, services) {
972
978
  const { paths } = host;
973
979
  const config = readDaemonConfig(paths.configPath);
974
980
  const machineType = host.detected.type;
981
+ // Work Mesh reporting of company work has no member off switch. On a
982
+ // member's own machine the mesh service cannot be switched off while a
983
+ // session here with a verified company binding was updated in the last 24
984
+ // hours. Agent machines have no member and are unchanged.
985
+ if (action === "disable" && services.includes("mesh") && (machineType === "desktop" || machineType === "self-hosted") &&
986
+ anyRecentSessionHasWorkMeshCompanyBinding(d.home, d.env)) {
987
+ throw new DaemonCommandError(MESH_SERVICE_REQUIRED_NOTICE);
988
+ }
975
989
  const next = applyServiceToggle(config, action, services, DEFAULT_SERVICES[machineType]);
976
990
  writeDaemonConfig(paths.configPath, next);
977
991
  handOver(d, host);
978
992
  d.out(`Services for this ${machineType} machine:`);
979
- for (const line of describeServices(machineType, next))
993
+ for (const line of describeServices(machineType, next, engineVaultCount(d.home)))
980
994
  d.out(line);
981
995
  d.out("A running daemon picks this up within 15 seconds.");
982
996
  }
@@ -1558,6 +1572,24 @@ async function runServiceCodexRemoteControl(d, opts) {
1558
1572
  watch: codex,
1559
1573
  });
1560
1574
  }
1575
+ export function repairWorkMesh(d, action) {
1576
+ if (action === "restart") {
1577
+ queueRequest(d, { action: "restart", unit: "mesh" }, "restart mesh");
1578
+ return "asked the daemon to restart Work Mesh";
1579
+ }
1580
+ if (action !== "take-over")
1581
+ return null;
1582
+ const host = currentHost(d);
1583
+ const units = legacyUnitsFor(d, host).filter((u) => u.service === "mesh" && u.migratable && u.kind !== "systemd-system");
1584
+ if (units.length === 0)
1585
+ return null;
1586
+ const result = adoptLegacyUnits(units, { ...migrateDeps(d, host.paths, host.runAsUser), sleep: d.sleep });
1587
+ for (const f of result.failed)
1588
+ d.err(`could not take over mesh from ${describeLegacyUnit(f.unit)}: ${f.error}`);
1589
+ return result.adopted.length > 0
1590
+ ? `took over Work Mesh from ${result.adopted.map((u) => describeLegacyUnit(u)).join(", ")}`
1591
+ : null;
1592
+ }
1561
1593
  /**
1562
1594
  * DM the person signed in on this machine (the machine owner) through the
1563
1595
  * same route as `hq dm`. A machine identity (agent box) has no person to tell.
@@ -1567,6 +1599,26 @@ async function runServiceCodexRemoteControl(d, opts) {
1567
1599
  * in ~/.hq/sync-core/skip.json or not on the rollout recorded in rollout.json
1568
1600
  * is kept on the old sync on purpose, so a hold left over for it is not an outage.
1569
1601
  */
1602
+ /** Engine units on this machine whose cycles the sync service keeps refusing (401). */
1603
+ async function engineAuthRefusals(home, unitLogPath) {
1604
+ const [{ readSyncCoreRolloutState }, { syncCoreUnitId }, { describeAuthRefusal, readEngineAuthRefusal }] = await Promise.all([
1605
+ import("../lib/sync-core/rollout-state.js"),
1606
+ import("../lib/sync-core/engine-home.js"),
1607
+ import("../lib/sync-core/engine-auth.js"),
1608
+ ]);
1609
+ let vaults = [];
1610
+ try {
1611
+ vaults = readSyncCoreRolloutState(home)?.vaults ?? [];
1612
+ }
1613
+ catch {
1614
+ return [];
1615
+ }
1616
+ return vaults.flatMap((vault) => {
1617
+ const unitId = syncCoreUnitId(vault.uid);
1618
+ const refused = readEngineAuthRefusal(unitLogPath(unitId), vault.engineHome, vault.uid);
1619
+ return refused ? [{ unitId, since: Date.parse(refused.lastAt), what: describeAuthRefusal(refused) }] : [];
1620
+ });
1621
+ }
1570
1622
  async function selfCheckVaults(home) {
1571
1623
  const [{ readSyncCoreSkips }, { readSyncCoreRolloutState }] = await Promise.all([
1572
1624
  import("../lib/sync-core/skip.js"),
@@ -1945,10 +1997,11 @@ export function registerDaemonCommand(program, over = {}) {
1945
1997
  .command("sync-core-selfcheck")
1946
1998
  .description("DM the person signed in here when a sync engine unit has been held or failing for over 30 minutes (at most daily per unit set)")
1947
1999
  .action(wrap(async (d) => {
1948
- const [{ runSelfCheck, SELF_CHECK_RESULT_FILE }, { readUnitHolds }, { daemonStateFileEnabled }] = await Promise.all([
2000
+ const [{ runSelfCheck, meshRepairAction, SELF_CHECK_RESULT_FILE }, { readUnitHolds }, { daemonStateFileEnabled }, { readLegacyHandoverStuck, LEGACY_HANDOVER_STUCK_FILE }] = await Promise.all([
1949
2001
  import("../lib/daemon/selfcheck.js"),
1950
2002
  import("../lib/daemon/unit-holds.js"),
1951
2003
  import("../lib/daemon/state-file-switch.js"),
2004
+ import("../lib/daemon/legacy-handover.js"),
1952
2005
  ]);
1953
2006
  const { paths } = currentHost(d);
1954
2007
  await runSelfCheck({
@@ -1982,10 +2035,21 @@ export function registerDaemonCommand(program, over = {}) {
1982
2035
  meshWanted: () => {
1983
2036
  const config = readDaemonConfig(paths.configPath);
1984
2037
  const { detected } = currentHost(d);
1985
- return enabledServices(detected.type, config).includes("mesh");
2038
+ return enabledServices(detected.type, config, { engineVaults: engineVaultCount(d.home) }).includes("mesh");
1986
2039
  },
2040
+ repairPath: path.join(paths.root, "selfcheck-mesh-repair.json"),
2041
+ repairMesh: async () => repairWorkMesh(d, meshRepairAction((() => {
2042
+ try {
2043
+ return readState(paths);
2044
+ }
2045
+ catch {
2046
+ return null;
2047
+ }
2048
+ })())),
1987
2049
  },
1988
2050
  ...(await selfCheckVaults(d.home)),
2051
+ readRestoreStuck: () => readLegacyHandoverStuck(path.join(paths.root, LEGACY_HANDOVER_STUCK_FILE)),
2052
+ readAuthRefusals: () => engineAuthRefusals(d.home, paths.unitLogPath),
1989
2053
  log: (line) => d.out(line),
1990
2054
  });
1991
2055
  }));
@@ -1,5 +1,5 @@
1
1
  import { deployApiRequest } from "../lib/deploy-api.js";
2
- import { ensureCognitoToken, resolveCognitoTokenSource } from "../utils/cognito-session.js";
2
+ import { DeployIdentityError, openDeployIdentity } from "../lib/deploy-identity.js";
3
3
  class EnableDatabaseError extends Error {
4
4
  }
5
5
  const VERIFY_SETTING = "Check the app's database setting before trying again.";
@@ -7,8 +7,6 @@ function responseError(status) {
7
7
  switch (status) {
8
8
  case 400:
9
9
  return new EnableDatabaseError("The deploy service refused the request. Check the app ID and billing acknowledgement.");
10
- case 401:
11
- return new EnableDatabaseError("Your deploy sign-in expired. Run hq login and try again.");
12
10
  case 403:
13
11
  case 404:
14
12
  return new EnableDatabaseError("Could not access this app. To continue, check your scope and app ID or ask the app owner.");
@@ -32,21 +30,8 @@ async function enableDatabase(appId, options) {
32
30
  if (acknowledgeDatabaseBilling !== true) {
33
31
  throw new EnableDatabaseError("Obtain explicit database billing approval before passing --acknowledge-database-billing.");
34
32
  }
35
- if (resolveCognitoTokenSource() === "machine") {
36
- throw new EnableDatabaseError("Database enablement requires a person identity. Sign in as the authorized operator.");
37
- }
38
- const token = await ensureCognitoToken({ tokenSource: "person", interactive: false }).catch(() => {
39
- throw new EnableDatabaseError("Could not get an HQ person sign-in. Run hq login and try again.");
40
- });
41
- const headers = company === undefined
42
- ? { "X-HQ-Deploy-Scope": "personal" }
43
- : { "X-Org-Slug": company };
44
- const response = await deployApiRequest(token, `/api/apps/${encodeURIComponent(appId)}`, "PATCH", {
45
- database: true,
46
- databaseBillingAcknowledged: true,
47
- }, headers).catch(() => {
48
- throw new EnableDatabaseError(`Could not confirm database enablement. ${VERIFY_SETTING}`);
49
- });
33
+ const request = await openDeployIdentity({ company, personal }, { personOnly: true });
34
+ const response = await request((token, headers) => deployApiRequest(token, "/api/apps/" + encodeURIComponent(appId), "PATCH", { database: true, databaseBillingAcknowledged: true }, headers, { redirect: "error" }));
50
35
  if (response.status !== 200)
51
36
  throw responseError(response.status);
52
37
  const receipt = await response.json().catch(() => null);
@@ -69,7 +54,7 @@ export function registerDeployAppDatabaseCommand(deploy) {
69
54
  await enableDatabase(appId, options);
70
55
  }
71
56
  catch (error) {
72
- console.error(error instanceof EnableDatabaseError
57
+ console.error(error instanceof EnableDatabaseError || error instanceof DeployIdentityError
73
58
  ? error.message
74
59
  : `Could not confirm database enablement. ${VERIFY_SETTING}`);
75
60
  process.exitCode = 1;
@@ -1,24 +1,18 @@
1
1
  import { openAsBlob } from "node:fs";
2
2
  import { stat } from "node:fs/promises";
3
3
  import { deployApiFormRequest } from "../lib/deploy-api.js";
4
- import { ensureCognitoToken, resolveCognitoTokenSource } from "../utils/cognito-session.js";
4
+ import { DeployIdentityError, openDeployIdentity } from "../lib/deploy-identity.js";
5
5
  const MAX_ARCHIVE_BYTES = 100 * 1024 * 1024;
6
+ const DATABASE_PROVISIONING_WAIT_MS = 600_000;
6
7
  class AppUploadError extends Error {
7
8
  }
8
- function scopeHeaders(options) {
9
- if (Boolean(options.company) === Boolean(options.personal)) {
9
+ function validateScope(options) {
10
+ if ((options.company !== undefined) === (options.personal === true)) {
10
11
  throw new AppUploadError("Choose exactly one of --company <slug> or --personal.");
11
12
  }
12
- if (options.company) {
13
- if (!/^[a-z0-9][a-z0-9-]{0,62}$/.test(options.company)) {
14
- throw new AppUploadError("Use a valid company slug.");
15
- }
16
- return { "X-Org-Slug": options.company };
17
- }
18
- if (resolveCognitoTokenSource() === "machine") {
19
- throw new AppUploadError("A machine identity needs an explicit company scope. Choose an authorized company.");
13
+ if (options.company !== undefined && !/^[a-z0-9][a-z0-9-]{0,62}$/.test(options.company)) {
14
+ throw new AppUploadError("Use a valid company slug.");
20
15
  }
21
- return { "X-HQ-Deploy-Scope": "personal" };
22
16
  }
23
17
  async function loadArchive(path) {
24
18
  try {
@@ -42,37 +36,72 @@ async function loadArchive(path) {
42
36
  throw new AppUploadError("Could not read the archive. Check the file path and permissions.");
43
37
  }
44
38
  }
45
- async function failureMessage(response) {
46
- if (response.status === 401)
47
- return "Your deploy sign-in expired. Run hq login and try again.";
48
- if (response.status === 403 || response.status === 404) {
39
+ function failureMessage(status, code) {
40
+ if (status === 403 || status === 404) {
49
41
  return "Could not access this app. To continue, check your scope and app ID or ask the app owner.";
50
42
  }
51
- if (response.status === 413 || response.status === 415 || response.status === 422) {
43
+ if (status === 413 || status === 415 || status === 422) {
52
44
  return "The deploy service refused the archive. Rebuild it as gzip within 100 MiB and try again.";
53
45
  }
54
- if (response.status === 409 || response.status === 503) {
55
- const body = await response.json().catch(() => null);
56
- const code = body?.code ?? body?.error?.code;
57
- if (response.status === 409 && code === "DATABASE_BILLING_ACK_REQUIRED") {
58
- return "This deployment needs database billing approval. Obtain approval before acknowledging billing.";
59
- }
60
- if (response.status === 409 && code === "PUBLIC_SECRET_BACKED_DEPLOY_BLOCKED") {
61
- return "This public app has bound secrets. Add an access gate or obtain explicit approval before acknowledging the risk.";
62
- }
63
- if (response.status === 503 && code === "DATABASE_PROVISIONING") {
46
+ if (status === 409 && code === "DATABASE_BILLING_ACK_REQUIRED") {
47
+ return "This deployment needs database billing approval. Obtain approval before acknowledging billing.";
48
+ }
49
+ if (status === 409 && code === "PUBLIC_SECRET_BACKED_DEPLOY_BLOCKED") {
50
+ return "This public app has bound secrets. Add an access gate or obtain explicit approval before acknowledging the risk.";
51
+ }
52
+ return "Could not confirm the app upload. Check deployment history before trying again.";
53
+ }
54
+ async function submitArchive(send) {
55
+ let retry;
56
+ try {
57
+ while (true) {
58
+ const signal = retry?.controller.signal;
59
+ const response = await send(signal);
60
+ if (response.status === 200) {
61
+ const receipt = await response.json().catch(() => null);
62
+ signal?.throwIfAborted();
63
+ return receipt;
64
+ }
65
+ const body = (response.status === 409 || response.status === 503
66
+ ? await response.json().catch(() => null)
67
+ : null);
68
+ signal?.throwIfAborted();
69
+ const code = body?.code ?? body?.error?.code;
70
+ if (response.status !== 503 || code !== "DATABASE_PROVISIONING") {
71
+ throw new AppUploadError(failureMessage(response.status, code));
72
+ }
73
+ // The deploy service stops this attempt before activation and reuses the app's pending cluster.
74
+ if (!retry) {
75
+ const controller = new AbortController();
76
+ retry = {
77
+ controller,
78
+ deadline: performance.now() + DATABASE_PROVISIONING_WAIT_MS,
79
+ timer: setTimeout(() => controller.abort(), DATABASE_PROVISIONING_WAIT_MS),
80
+ };
81
+ }
64
82
  const hint = body?.retryAfterSeconds;
65
- const delay = typeof hint === "number" && Number.isFinite(hint) ? Math.max(2, Math.min(30, Math.floor(hint))) : 5;
66
- return `DATABASE_PROVISIONING: the app database is being created. Wait and retry in ${delay} seconds.`;
83
+ const delaySeconds = typeof hint === "number" && Number.isFinite(hint) ? Math.max(2, Math.min(30, Math.floor(hint))) : 5;
84
+ const delayMs = delaySeconds * 1000;
85
+ if (performance.now() + delayMs >= retry.deadline) {
86
+ throw new AppUploadError("The app database is still being created. Check deployment history before trying again.");
87
+ }
88
+ console.error(`The app database is being created. Retrying the same upload in ${delaySeconds} seconds.`);
89
+ await new Promise((resolve) => setTimeout(resolve, delayMs));
90
+ if (performance.now() >= retry.deadline)
91
+ retry.controller.abort();
92
+ retry.controller.signal.throwIfAborted();
67
93
  }
68
94
  }
69
- return "Could not confirm the app upload. Check deployment history before trying again.";
95
+ finally {
96
+ if (retry)
97
+ clearTimeout(retry.timer);
98
+ }
70
99
  }
71
100
  async function uploadApp(appId, archive, options) {
72
101
  if (!/^(?:[a-f0-9]{8}-(?:[a-f0-9]{4}-){3}[a-f0-9]{12}|app_[A-Za-z0-9_-]+)$/i.test(appId)) {
73
102
  throw new AppUploadError("Use the app ID shown by hq deploy list.");
74
103
  }
75
- const headers = scopeHeaders(options);
104
+ validateScope(options);
76
105
  const form = new FormData();
77
106
  form.set("type", "app");
78
107
  form.set("file", await loadArchive(archive), "upload.tar.gz");
@@ -80,14 +109,11 @@ async function uploadApp(appId, archive, options) {
80
109
  form.set("database_billing_acknowledged", "true");
81
110
  if (options.acknowledgePublicSecretRisk)
82
111
  form.set("acknowledge_public_secret_risk", "true");
83
- const token = await ensureCognitoToken({ interactive: false, ...(options.personal ? { tokenSource: "person" } : {}) })
84
- .catch(() => { throw new AppUploadError("Could not get an HQ sign-in. Run hq login or check the configured machine identity."); });
85
- const appRoute = `/api/apps/${encodeURIComponent(appId)}`;
86
- const response = await deployApiFormRequest(token, `${appRoute}/deploy`, form, headers)
87
- .catch(() => { throw new AppUploadError("Could not confirm the app upload. Check deployment history before trying again."); });
88
- if (response.status !== 200)
89
- throw new AppUploadError(await failureMessage(response));
90
- const receipt = await response.json().catch(() => null);
112
+ const request = await openDeployIdentity(options);
113
+ const appRoute = "/api/apps/" + encodeURIComponent(appId);
114
+ const receipt = await submitArchive((signal) => request((token, headers) => deployApiFormRequest(token, appRoute + "/deploy", form, headers, signal),
115
+ // Provisioning retries already have a deadline and must reuse the accepted identity.
116
+ { recoverUnauthorized: signal === undefined }));
91
117
  const { appId: returnedApp, deployId, version, status, statusUrl } = receipt ?? {};
92
118
  if (returnedApp !== appId || typeof deployId !== "string" || !/^[A-Za-z0-9_-]+$/.test(deployId)
93
119
  || typeof version !== "number" || !Number.isSafeInteger(version) || version < 1
@@ -112,7 +138,7 @@ export function registerDeployAppUploadCommand(deploy) {
112
138
  await uploadApp(appId, archive, options);
113
139
  }
114
140
  catch (error) {
115
- console.error(error instanceof AppUploadError ? error.message : "Could not confirm the app upload. Check deployment history before trying again.");
141
+ console.error(error instanceof AppUploadError || error instanceof DeployIdentityError ? error.message : "Could not confirm the app upload. Check deployment history before trying again.");
116
142
  process.exitCode = 1;
117
143
  }
118
144
  });