@indigoai-us/hq-cli 5.345.208 → 5.345.210

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 (126) hide show
  1. package/CHANGELOG.md +98 -0
  2. package/assets/scaffold/core/scripts/derive-trigger-facts.sh +22 -3
  3. package/dist/command-catalog.generated.d.ts +33 -8
  4. package/dist/command-catalog.generated.js +40 -8
  5. package/dist/command-registration-plan.d.ts +2 -2
  6. package/dist/command-registration-plan.js +1 -1
  7. package/dist/commands/access.js +11 -5
  8. package/dist/commands/agents.d.ts +8 -0
  9. package/dist/commands/agents.js +5 -0
  10. package/dist/commands/bot.d.ts +8 -0
  11. package/dist/commands/bot.js +67 -7
  12. package/dist/commands/channels.js +4 -0
  13. package/dist/commands/cloud.d.ts +83 -2
  14. package/dist/commands/cloud.js +161 -31
  15. package/dist/commands/company.d.ts +9 -0
  16. package/dist/commands/company.js +44 -14
  17. package/dist/commands/core-checkpoint-native.js +21 -0
  18. package/dist/commands/core-derive-trigger-facts-native.js +14 -3
  19. package/dist/commands/core-generate-workers-registry-fast.d.ts +1 -1
  20. package/dist/commands/core-generate-workers-registry-fast.js +7 -1
  21. package/dist/commands/core-job-run-native.d.ts +8 -0
  22. package/dist/commands/core-job-run-native.js +11 -3
  23. package/dist/commands/core-jobs-native.js +1 -1
  24. package/dist/commands/core-register-project-native.js +31 -1
  25. package/dist/commands/core-scan-packages-fast.d.ts +1 -1
  26. package/dist/commands/core-scan-packages-fast.js +8 -1
  27. package/dist/commands/core.js +12 -3
  28. package/dist/commands/dm-attach.d.ts +10 -0
  29. package/dist/commands/dm-attach.js +33 -5
  30. package/dist/commands/integrations-connect.js +47 -2
  31. package/dist/commands/lanes-session-start.d.ts +17 -0
  32. package/dist/commands/lanes-session-start.js +281 -13
  33. package/dist/commands/lanes-watch.js +11 -3
  34. package/dist/commands/lanes.d.ts +4 -0
  35. package/dist/commands/lanes.js +95 -22
  36. package/dist/commands/library.d.ts +10 -0
  37. package/dist/commands/library.js +30 -3
  38. package/dist/commands/meetings.d.ts +42 -0
  39. package/dist/commands/meetings.js +157 -12
  40. package/dist/commands/mesh.js +3 -0
  41. package/dist/commands/monitor.d.ts +6 -0
  42. package/dist/commands/monitor.js +29 -19
  43. package/dist/commands/onboard.js +8 -1
  44. package/dist/commands/sources.js +7 -3
  45. package/dist/index.js +9 -0
  46. package/dist/lanes-monitor-check-argv.d.ts +1 -1
  47. package/dist/lanes-monitor-check-argv.js +2 -2
  48. package/dist/lanes-session-start-argv.d.ts +4 -1
  49. package/dist/lanes-session-start-argv.js +5 -2
  50. package/dist/lib/bot/fleet-daemon.d.ts +101 -0
  51. package/dist/lib/bot/fleet-daemon.js +227 -0
  52. package/dist/lib/bot/fleet-local.d.ts +26 -0
  53. package/dist/lib/bot/fleet-local.js +51 -2
  54. package/dist/lib/bot/index.d.ts +1 -0
  55. package/dist/lib/bot/index.js +1 -0
  56. package/dist/lib/bot/jobs/hot-signal-sync.d.ts +4 -0
  57. package/dist/lib/bot/jobs/hot-signal-sync.js +8 -1
  58. package/dist/lib/bot/log.js +3 -1
  59. package/dist/lib/bot/probe.js +2 -0
  60. package/dist/lib/bot/run.js +28 -3
  61. package/dist/lib/bot/runtime-failure.d.ts +4 -2
  62. package/dist/lib/bot/runtime-failure.js +9 -1
  63. package/dist/lib/bot/status.d.ts +17 -0
  64. package/dist/lib/bot/status.js +53 -2
  65. package/dist/lib/capacity/collectors/claude-oauth.d.ts +5 -5
  66. package/dist/lib/capacity/collectors/claude-oauth.js +6 -6
  67. package/dist/lib/core-utils/native-scaffold-help.d.ts +16 -0
  68. package/dist/lib/core-utils/native-scaffold-help.js +26 -0
  69. package/dist/lib/core-utils/session-company.d.ts +25 -8
  70. package/dist/lib/core-utils/session-company.js +59 -17
  71. package/dist/lib/daemon/catalog.d.ts +25 -1
  72. package/dist/lib/daemon/catalog.js +29 -2
  73. package/dist/lib/daemon/run.d.ts +0 -1
  74. package/dist/lib/daemon/run.js +3 -11
  75. package/dist/lib/daemon/server.js +26 -7
  76. package/dist/lib/daemon/supervisor.js +1 -1
  77. package/dist/lib/daemon/tools.js +17 -1
  78. package/dist/lib/db/sqlite-binding.js +2 -1
  79. package/dist/lib/doctor/checks/bots.d.ts +2 -0
  80. package/dist/lib/doctor/checks/bots.js +11 -0
  81. package/dist/lib/doctor/checks/runtime-health.js +3 -2
  82. package/dist/lib/doctor/checks/work-context.js +5 -2
  83. package/dist/lib/hook-engine/resolve.d.ts +1 -1
  84. package/dist/lib/hook-engine/resolve.js +4 -1
  85. package/dist/lib/hot-channels/adapters/meeting-providers.d.ts +2 -0
  86. package/dist/lib/hot-channels/adapters/meeting-providers.js +13 -2
  87. package/dist/lib/lanes/index.d.ts +1 -1
  88. package/dist/lib/lanes/index.js +1 -1
  89. package/dist/lib/lanes/monitor.d.ts +14 -0
  90. package/dist/lib/lanes/monitor.js +51 -10
  91. package/dist/lib/lanes/outpost-dispatch.d.ts +3 -0
  92. package/dist/lib/lanes/outpost-dispatch.js +1 -0
  93. package/dist/lib/lanes/store.d.ts +1 -1
  94. package/dist/lib/lanes/store.js +2 -1
  95. package/dist/lib/mesh/client.js +7 -1
  96. package/dist/lib/mesh/live/backfill-held.d.ts +3 -0
  97. package/dist/lib/mesh/live/backfill-held.js +167 -7
  98. package/dist/lib/mesh/live/flush.d.ts +7 -0
  99. package/dist/lib/mesh/live/flush.js +10 -1
  100. package/dist/lib/monitor.d.ts +9 -0
  101. package/dist/lib/monitor.js +33 -7
  102. package/dist/lib/onboarding/orchestrator.js +269 -132
  103. package/dist/lib/onboarding/types.d.ts +2 -0
  104. package/dist/lib/scaffold-cli-floor.js +2 -1
  105. package/dist/lib/signals/failure-alert.js +3 -1
  106. package/dist/lib/work-context/organize.d.ts +6 -0
  107. package/dist/lib/work-context/organize.js +28 -0
  108. package/dist/lib/work-context/paths.d.ts +9 -0
  109. package/dist/lib/work-context/paths.js +15 -0
  110. package/dist/lib/work-context/prd-sync.js +2 -1
  111. package/dist/runners-alias.d.ts +54 -0
  112. package/dist/runners-alias.js +86 -0
  113. package/dist/utils/install-tree-torn.js +5 -3
  114. package/dist/utils/npm-install-flags.d.ts +27 -0
  115. package/dist/utils/npm-install-flags.js +68 -0
  116. package/dist/utils/package-use-lease.js +1 -1
  117. package/dist/utils/qmd-native-binding-error.js +2 -1
  118. package/dist/utils/self-update.js +2 -1
  119. package/dist/utils/staged-install.js +2 -1
  120. package/dist/utils/staged-npm-install.js +2 -1
  121. package/dist/utils/upload-author.d.ts +2 -1
  122. package/dist/utils/upload-author.js +9 -5
  123. package/dist/utils/version-check.js +2 -1
  124. package/dist/utils/version-gate.js +7 -6
  125. package/package.json +7 -7
  126. package/scripts/install-hook-engine.mjs +7 -3
@@ -78,7 +78,7 @@ import { clearPendingSwitch, recoverPendingSwitchSafely, writePendingSwitch } fr
78
78
  import { classifyRuntimeFailure, isRuntimeUsageLimit, runtimeFailureReason, usageLimitResetsAt } from "../lib/bot/runtime-failure.js";
79
79
  import { PROBE_DEFAULT_TIMEOUT_MS, probeBotRuntime } from "../lib/bot/probe.js";
80
80
  import { BOT_LOGIN_RUNTIMES, botAuthEnv, botRuntimeAuth, capacityAccountHome, describeBotAuth, formatBotAuth, isBotLoginRuntime, restoreBotSessions, setAsideBotSessions, signInBotRuntime, signOutBotRuntime, withRuntimeAuth, } from "../lib/bot/runtime-auth.js";
81
- import { BotApi, BotApiError, BOT_RESTORE_DEFAULTS, buildBotLocalConfig, describeBotLocalConfig, orphanBotRunMessage, parseBotLocalConfig, removeOrphanBotDaemon, botDaemonStatus, botDir, botCredsPath, botLogPath, botsRoot, botTokenStateDir, botWorkerRelDir, buildBotDaemonPaths, createBotLogger, deleteBotCreds, installBotDaemon, repairBotDaemonIfStale, healBotDaemonNodeFromJob, introDmText, isBotMemoryMode, botLocalMemoryDir, botMemoryMode, resolveBotMemoryDir, validateBotIntro, validateBotDisplayName, validateBotKickoff, validateBotEffort, validateBotModel, effectiveBotEffort, BOT_EFFORT_LEVELS, DEFAULT_BOT_EFFORT, BOT_MEMORY_MODES, BOT_KINDS, isBotKind, effectiveBotKind, effectiveBotCompanies, normalizeBotCompanies, SETUP_BOT_WORKER_ID, isBotRuntimeId, localNameForRemoteBot, remoteBotRunnability, isPidAlive, listBotWorkerOptions, patchBotConfig, readBotConfig, readBotCredsIdentity, readBotStatus, patchBotStatus, runtimeCrashSinceStart, resolveBotWorker, runBot, runtimeFor, scaffoldBotMemory, scaffoldBotWorker, startBotDaemon, stopBotDaemon, uninstallBotDaemon, validateBotName, writeBotConfig, writeBotCreds, BOT_RUNTIMES, BOT_INTRO_MAX_CHARS, BOT_DISPLAY_NAME_MAX_CHARS, BOT_KICKOFF_MAX_CHARS, detectBotPlatform, withBotLock, localBotRole, remoteBotRole, remoteBotDisplayName, personFacingName, writeCloudDisplayName, setupSlugFor, ASSISTANT_ROLE, HQ_FLEET_RUNTIME_ENGINE_ID, HQ_FLEET_LOCAL_RELEASE, authenticateFleetLocalBot, bootstrapFleetLocalBot, buildSystemPrompt, controlFleetLocalBot, ensureFleetPython, fleetLocalGatewayPid, fleetLocalProfileNeedsAdoption, fleetLocalServiceInstalled, fleetProviderForRuntime, importFleetLocalMachineCredential, importFleetLocalProviderLogin, fleetProviderNeedsSignIn, fleetOwnerCompanies, refreshFleetLocalInstructions, fleetLocalPromotionRuntime, installPinnedFleetLocalDistribution, installTargetFleetLocalDistribution, resolveFleetLocalPointerTarget, resolveFleetLocalTargetRelease, fleetLocalProfileDir, fleetProfileOwnerCompanies, fleetLocalChannels, readFleetLocalGatewayState, readPromptSources, removeFleetLocalBot, } from "../lib/bot/index.js";
81
+ import { BotApi, BotApiError, BOT_RESTORE_DEFAULTS, buildBotLocalConfig, describeBotLocalConfig, orphanBotRunMessage, parseBotLocalConfig, removeOrphanBotDaemon, botDaemonStatus, botDir, botCredsPath, botLogPath, botsRoot, botTokenStateDir, botWorkerRelDir, buildBotDaemonPaths, createBotLogger, deleteBotCreds, installBotDaemon, repairBotDaemonIfStale, healBotDaemonNodeFromJob, introDmText, isBotMemoryMode, botLocalMemoryDir, botMemoryMode, resolveBotMemoryDir, validateBotIntro, validateBotDisplayName, validateBotKickoff, validateBotEffort, validateBotModel, effectiveBotEffort, BOT_EFFORT_LEVELS, DEFAULT_BOT_EFFORT, BOT_MEMORY_MODES, BOT_KINDS, isBotKind, effectiveBotKind, effectiveBotCompanies, normalizeBotCompanies, SETUP_BOT_WORKER_ID, isBotRuntimeId, localNameForRemoteBot, remoteBotRunnability, isPidAlive, listBotWorkerOptions, patchBotConfig, readBotConfig, readBotCredsIdentity, readBotStatus, patchBotStatus, runtimeCrashSinceStart, resolveBotWorker, runBot, runtimeFor, scaffoldBotMemory, scaffoldBotWorker, startBotDaemon, stopBotDaemon, uninstallBotDaemon, validateBotName, writeBotConfig, writeBotCreds, BOT_RUNTIMES, BOT_INTRO_MAX_CHARS, BOT_DISPLAY_NAME_MAX_CHARS, BOT_KICKOFF_MAX_CHARS, detectBotPlatform, withBotLock, localBotRole, remoteBotRole, remoteBotDisplayName, personFacingName, writeCloudDisplayName, setupSlugFor, ASSISTANT_ROLE, HQ_FLEET_RUNTIME_ENGINE_ID, HQ_FLEET_LOCAL_RELEASE, authenticateFleetLocalBot, bootstrapFleetLocalBot, buildSystemPrompt, controlFleetBot as controlFleetLocalBot, fleetBotUnitId, fleetBotsManagedByDaemon, ensureFleetPython, fleetLocalGatewayPid, fleetLocalProfileNeedsAdoption, fleetLocalServiceInstalled, fleetProviderForRuntime, importFleetLocalMachineCredential, importFleetLocalProviderLogin, fleetProviderNeedsSignIn, fleetOwnerCompanies, refreshFleetLocalInstructions, fleetLocalPromotionRuntime, installPinnedFleetLocalDistribution, installTargetFleetLocalDistribution, resolveFleetLocalPointerTarget, resolveFleetLocalTargetRelease, fleetLocalProfileDir, fleetProfileOwnerCompanies, fleetLocalChannels, readFleetLocalGatewayState, readPromptSources, removeFleetLocalBot, } from "../lib/bot/index.js";
82
82
  import { gatedInteractiveLogin } from "../utils/interactive-caller.js";
83
83
  import { fleetInstallProgressReporter, runBotRuntimeInstall, runBotRuntimeStatus } from "./bot-runtime.js";
84
84
  function collectRepeated(value, previous) {
@@ -334,6 +334,41 @@ function companyBotDirs() {
334
334
  }
335
335
  });
336
336
  }
337
+ /**
338
+ * After a bot is removed, re-run the HQ Fleet Runtime job setup for every
339
+ * other enabled Fleet Runtime bot here, so a company whose hot-signal-sync the
340
+ * removed bot held is picked up by a bot that still runs. Best effort: a bot
341
+ * that is busy (its lock is held) or held for promotion is left for its next
342
+ * start. Returns the names it re-checked.
343
+ */
344
+ export async function resyncHotSignalSyncAfterRemoval(removed, sync = syncFleetRuntimeJobs) {
345
+ const done = [];
346
+ let names;
347
+ try {
348
+ names = listBotNames(botsRoot());
349
+ }
350
+ catch {
351
+ return done;
352
+ }
353
+ for (const other of names) {
354
+ if (other === removed)
355
+ continue;
356
+ try {
357
+ await withBotLock(other, async () => {
358
+ const dir = botDir(other);
359
+ const config = readBotConfig(dir);
360
+ if (!config || config.enabled === false || !isFleetRuntimeBot(config) || hasPromotionHold(dir))
361
+ return;
362
+ sync(other, dir, config);
363
+ done.push(other);
364
+ }, { command: "hq bot rm (hot-signal-sync hand-over)", waitMs: 5_000 });
365
+ }
366
+ catch {
367
+ /* left for that bot's next start */
368
+ }
369
+ }
370
+ return done;
371
+ }
337
372
  /** Every local bot folder; empty when they cannot be listed. */
338
373
  function allBotDirs() {
339
374
  try {
@@ -347,6 +382,20 @@ function refuseHeldFleetBot(dir) {
347
382
  if (hasPromotionHold(dir))
348
383
  throw new Error("This bot is held for cloud promotion. Continue its promotion before changing local settings or lifecycle.");
349
384
  }
385
+ /** The `service:` line of `hq bot status` for an HQ Fleet bot. */
386
+ function fleetBotServiceLine(name, config, installPending) {
387
+ if (fleetBotsManagedByDaemon()) {
388
+ const unit = fleetBotUnitId(name);
389
+ if (daemonSupervises(daemonPaths(), unit))
390
+ return `run by hq daemon (${unit}, starts at login)`;
391
+ if (fleetLocalServiceInstalled(config.agentUid))
392
+ return `own login item (moves under hq daemon on hq bot start ${name})`;
393
+ return installPending ? `not started yet; hq daemon runs it after hq bot start ${name}` : `hq daemon will run it (${unit}) once it reads its plan`;
394
+ }
395
+ if (fleetLocalServiceInstalled(config.agentUid))
396
+ return "installed (HQ Fleet gateway, starts at login)";
397
+ return installPending ? "not installed yet; installs on hq bot start" : "not installed";
398
+ }
350
399
  function fleetAuthCommand(name, config) {
351
400
  return `hq bot auth ${name} --provider ${config.runtime === "grok" ? "grok" : config.runtime === "codex" ? "chatgpt" : "claude"}`;
352
401
  }
@@ -1620,6 +1669,8 @@ async function runBotCreateLocked(name, opts) {
1620
1669
  fs.rmSync(path.join(dir, "status.json"), { force: true });
1621
1670
  const introText = introDmText(name, runtime, intro, { kind, companies });
1622
1671
  const toolOffer = isSetupBot && kickoff ? fleetSetupToolOffer(dir, config) : null;
1672
+ const startNow = opts.start !== false && !fleetAuthPending;
1673
+ const daemonRunsFleetBots = fleetBotsManagedByDaemon();
1623
1674
  const fleetBootstrap = await bootstrapFleetLocalBot({
1624
1675
  agentUid,
1625
1676
  ownerUid: config.ownerUid,
@@ -1634,8 +1685,13 @@ async function runBotCreateLocked(name, opts) {
1634
1685
  firstStart: toolOffer
1635
1686
  ? { intro: setupToolOfferText(toolOffer, setupWelcomeOpening(intro)) }
1636
1687
  : { intro: introText, ...(kickoff ? { kickoff } : {}) },
1637
- }, { start: opts.start !== false && !fleetAuthPending, python: fleetPython, onProgress: progress });
1688
+ },
1689
+ // Where hq daemon runs the bots, the runtime must not register its own
1690
+ // login item; the daemon is asked to start the gateway below instead.
1691
+ { start: startNow && !daemonRunsFleetBots, python: fleetPython, onProgress: progress });
1638
1692
  syncFleetRuntimeJobs(name, dir, config);
1693
+ const startedByDaemon = startNow && daemonRunsFleetBots && controlFleetLocalBot(agentUid, "install").ok === true;
1694
+ const running = fleetBootstrap.running || startedByDaemon;
1639
1695
  const fleetProfile = fleetBootstrap.profile;
1640
1696
  const runtimeLabel = HQ_FLEET_RUNTIME_ENGINE_ID;
1641
1697
  createBotLogger(dir)("info", `created ${name} (${agentUid}) kind=${kind}${companies.length ? ` companies=${companies.join(",")}` : ""} runtime=${runtimeLabel}${worker ? ` worker=${worker.id} company=${worker.company ?? "-"}` : ""} memory=${memoryMode}`);
@@ -1686,8 +1742,8 @@ async function runBotCreateLocked(name, opts) {
1686
1742
  name,
1687
1743
  ...created_,
1688
1744
  daemon: null,
1689
- running: fleetBootstrap.running,
1690
- how: fleetBootstrap.running ? "started by the HQ Fleet Runtime" : null,
1745
+ running,
1746
+ how: startedByDaemon ? "started by hq daemon" : fleetBootstrap.running ? "started by the HQ Fleet Runtime" : null,
1691
1747
  state: status?.state ?? "unknown",
1692
1748
  pid: status?.pid ?? null,
1693
1749
  lastError: status?.lastError ?? null,
@@ -2070,7 +2126,7 @@ async function runBotStatus(nameArg, opts) {
2070
2126
  }
2071
2127
  console.log(` answering: ${row.busy ? chalk.green(`yes${row.busySince ? `, since ${row.busySince}` : ""}`) : chalk.gray("no")}`);
2072
2128
  if (fleet) {
2073
- console.log(` service: ${fleetLocalServiceInstalled(config.agentUid) ? "installed (HQ Fleet gateway, starts at login)" : row.serviceInstallPending ? "not installed yet; installs on hq bot start" : "not installed"}`);
2129
+ console.log(` service: ${fleetBotServiceLine(name, config, row.serviceInstallPending === true)}`);
2074
2130
  if (channels)
2075
2131
  console.log(` channels: Slack ${channels.slack.replace(/_/g, " ")}, Telegram ${channels.telegram.replace(/_/g, " ")}`);
2076
2132
  }
@@ -2380,6 +2436,10 @@ async function runBotRmLocked(validated, opts) {
2380
2436
  if (isFleetRuntimeBot(config))
2381
2437
  removeFleetLocalBot(config.agentUid);
2382
2438
  fs.rmSync(dir, { recursive: true, force: true });
2439
+ // The removed bot may have held companies' daily hot-signal-sync; the
2440
+ // other bots skipped those companies on their last start. Check again now,
2441
+ // so a company does not stay without signals until the next restart.
2442
+ await resyncHotSignalSyncAfterRemoval(name);
2383
2443
  }
2384
2444
  const message = incomplete
2385
2445
  ? `HQ removed what it could of "${name}", but ${incomplete.detail}.` +
@@ -3696,7 +3756,7 @@ export function registerBotCommand(program) {
3696
3756
  .action((opts) => wrap(() => runBotRestore(opts))());
3697
3757
  bot
3698
3758
  .command("start <name>")
3699
- .description("Start the bot (via launchd when installed, else a detached process)")
3759
+ .description("Start the bot (under hq daemon or its own launchd agent when installed, else a detached process)")
3700
3760
  .option("--json", "Print machine-readable JSON")
3701
3761
  .action((name, opts) => wrap(async () => {
3702
3762
  const b = requireBot(name);
@@ -3710,7 +3770,7 @@ export function registerBotCommand(program) {
3710
3770
  })());
3711
3771
  bot
3712
3772
  .command("stop <name>")
3713
- .description("Stop the bot process (it starts again at next login while its launchd agent is installed)")
3773
+ .description("Stop the bot process and keep it down until hq bot start")
3714
3774
  .option("--json", "Print machine-readable JSON")
3715
3775
  .action((name, opts) => wrap(async () => {
3716
3776
  const b = requireBot(name);
@@ -205,6 +205,10 @@ async function runChannelsMembers(channelName, opts) {
205
205
  }
206
206
  const members = await fetchChannelMembers(token, matches[0].channelId);
207
207
  const visibleMembers = excludeCallerFromChannelMembers(members, callerFromToken(token));
208
+ if (visibleMembers.length === 0 && opts.json !== true) {
209
+ console.log("No other members listed. You are in this channel.");
210
+ return;
211
+ }
208
212
  console.log(formatChannelMembers(visibleMembers, opts.json === true));
209
213
  }
210
214
  catch (err) {
@@ -231,8 +231,60 @@ export declare function createIdentityHeldTracker(): {
231
231
  * Older builds send a count only, and this keeps the previous sentence.
232
232
  */
233
233
  export declare function identityHeldLines(count: number, notice?: Pick<IdentityHeldNotice, "message">): string[];
234
- /** Actionable recovery for files refused because the vault baseline is stale. */
235
- export declare function staleUploadRefusalLines(count: number, paths?: readonly string[]): string[];
234
+ /**
235
+ * feedback_65ee9e51: a delete an unattended sync held because another member
236
+ * created the file (hq-cloud event `delete-refused-stale-etag`, reason
237
+ * `unattended-foreign-creator`). hq-cloud counts these in `filesRefusedStale`,
238
+ * so they are split out of the stale-upload message and get their own.
239
+ */
240
+ export interface HeldDelete {
241
+ path: string;
242
+ createdBy?: string;
243
+ }
244
+ export declare function createUnattendedHeldDeleteTracker(): {
245
+ observe: (event: {
246
+ type: string;
247
+ path?: unknown;
248
+ reason?: unknown;
249
+ createdBy?: unknown;
250
+ }) => void;
251
+ held: () => HeldDelete[];
252
+ };
253
+ /** Lines for deletes an unattended sync held. */
254
+ export declare function unattendedHeldDeleteLines(held: readonly HeldDelete[]): string[];
255
+ /**
256
+ * `filesRefusedStale` without the held deletes, which have their own message.
257
+ *
258
+ * Contract with hq-cloud (feedback_65ee9e51): for every held delete, the push
259
+ * counts exactly one entry in `filesRefusedStale`, lists its path once in the
260
+ * stale paths, and emits one `delete-refused-stale-etag` event with reason
261
+ * `unattended-foreign-creator` for that path (the tracker dedupes by path).
262
+ * Subtracting `held.length` relies on that one-entry-per-held-row match; if
263
+ * hq-cloud ever counts a held row more than once or not at all, this drifts.
264
+ */
265
+ export declare function staleRefusalsExcludingHeld(count: number, paths?: readonly string[], held?: readonly HeldDelete[]): {
266
+ count: number;
267
+ paths: string[];
268
+ };
269
+ /**
270
+ * `push --all` totals without held deletes: sums each target's stale
271
+ * refusals minus that target's held deletes, so exit status and the summary
272
+ * agree with the per-target lines.
273
+ */
274
+ export declare function pushAllStaleExcludingHeld(result: {
275
+ perCompany: ReadonlyArray<{
276
+ result?: Pick<ShareCallResult, "filesRefusedStale" | "filesRefusedStalePaths" | "heldDeletes">;
277
+ }>;
278
+ }): {
279
+ count: number;
280
+ paths: string[];
281
+ held: number;
282
+ };
283
+ /**
284
+ * Actionable recovery for files refused because the vault baseline is stale.
285
+ * Held unattended deletes in `held` are reported separately.
286
+ */
287
+ export declare function staleUploadRefusalLines(rawCount: number, rawPaths?: readonly string[], held?: readonly HeldDelete[]): string[];
236
288
  /**
237
289
  * Upload-failure fields newer hq-cloud ShareResult carries. Read through
238
290
  * readUploadFailures so this CLI also builds against a release without them.
@@ -444,6 +496,8 @@ export interface ShareCallResult {
444
496
  filesRefusedStalePaths?: string[];
445
497
  filesUploadFailed?: number;
446
498
  uploadFailedPaths?: string[];
499
+ /** Deletes an unattended sync held (feedback_65ee9e51); counted in filesRefusedStale. */
500
+ heldDeletes?: HeldDelete[];
447
501
  conflictPaths: string[];
448
502
  aborted: boolean;
449
503
  /** Files this leg's plan limit refused; absent or null when none were. */
@@ -499,6 +553,13 @@ export interface PushAllResult {
499
553
  }>;
500
554
  perCompany: PushAllRow[];
501
555
  }
556
+ interface PushRefusalSummary {
557
+ planLimitRefused: PlanLimitRefusalSummary | null;
558
+ filesExcludedByScope: number;
559
+ filesRefusedStale: number;
560
+ filesRefusedStalePaths: string[];
561
+ filesUploadFailed: number;
562
+ }
502
563
  export interface PullAllResult {
503
564
  attempted: number;
504
565
  filesDownloaded: number;
@@ -608,6 +669,25 @@ export declare function registerCloudCommands(program: Command): void;
608
669
  export declare function runSyncDoctorReconcileConflicts(hqRoot: string, yes: boolean): Promise<void>;
609
670
  /** Exported for the US-003 sync-health exit-path regression test. */
610
671
  export declare function runPullPersonal(hqRoot: string, onConflict?: ConflictStrategy): Promise<void>;
672
+ /**
673
+ * The refusal summary `runPushAll` returns; null means the caller reports
674
+ * success and exits 0. feedback_65ee9e51: held unattended deletes are left
675
+ * out, so a push whose only "refusals" are held deletes returns null.
676
+ */
677
+ export declare function pushAllRefusalSummary(result: Pick<PushAllResult, "filesExcludedByScope" | "filesUploadFailed" | "perCompany">, planLimitRefused: PlanLimitRefusalSummary | null): PushRefusalSummary | null;
678
+ /**
679
+ * Whether `hq sync now` (`runNowSingle`) must exit 1 after its push leg
680
+ * ("one or more requested uploads were refused"). feedback_65ee9e51: held
681
+ * unattended deletes are a warning, never a refusal.
682
+ */
683
+ export declare function nowPushLegRefused(input: {
684
+ filesExcludedByScope: number;
685
+ filesRefusedStale?: number;
686
+ filesRefusedStalePaths?: readonly string[];
687
+ heldDeletes: readonly HeldDelete[];
688
+ uploadFailedCount: number;
689
+ identityHeldCount: number;
690
+ }): boolean;
611
691
  /**
612
692
  * Human-friendly label for a journal slug in `hq sync status`. The
613
693
  * personal-vault fanout slot and the legacy `companies/personal` company both
@@ -640,4 +720,5 @@ export declare function printServerOwnedLocalOnly(hqRoot: string, journals: Read
640
720
  files?: Record<string, unknown>;
641
721
  };
642
722
  }>, log?: (line: string) => void): number;
723
+ export {};
643
724
  //# sourceMappingURL=cloud.d.ts.map
@@ -537,10 +537,84 @@ export function identityHeldLines(count, notice) {
537
537
  `\`hq sync release-held\` to upload it.`,
538
538
  ];
539
539
  }
540
- /** Actionable recovery for files refused because the vault baseline is stale. */
541
- export function staleUploadRefusalLines(count, paths = []) {
542
- if (count <= 0)
540
+ export function createUnattendedHeldDeleteTracker() {
541
+ const held = new Map();
542
+ return {
543
+ observe(event) {
544
+ if (event.type !== "delete-refused-stale-etag" || event.reason !== "unattended-foreign-creator")
545
+ return;
546
+ if (typeof event.path !== "string")
547
+ return;
548
+ held.set(event.path, {
549
+ path: event.path,
550
+ ...(typeof event.createdBy === "string" && event.createdBy ? { createdBy: event.createdBy } : {}),
551
+ });
552
+ },
553
+ held: () => [...held.values()],
554
+ };
555
+ }
556
+ /** Lines for deletes an unattended sync held. */
557
+ export function unattendedHeldDeleteLines(held) {
558
+ if (held.length === 0)
543
559
  return [];
560
+ const one = held.length === 1;
561
+ return [
562
+ `⚠ ${held.length} deletion(s) held: an unattended sync never deletes a file another member created, ` +
563
+ (one
564
+ ? `and this file's delete was held by one (now or on an earlier run). The file stays in the vault. `
565
+ : `and these files' deletes were held by an unattended sync (now or on an earlier run). The files stay in the vault. `) +
566
+ `Run \`hq sync pull\` to restore ${one ? "it" : "them"} locally; if the delete is intended, ` +
567
+ `delete ${one ? "it" : "them"} again from an interactive session and sync.`,
568
+ " Held:",
569
+ ...held.map((item) => ` - ${item.path}${item.createdBy ? ` (created by ${item.createdBy})` : ""}`),
570
+ ];
571
+ }
572
+ /**
573
+ * `filesRefusedStale` without the held deletes, which have their own message.
574
+ *
575
+ * Contract with hq-cloud (feedback_65ee9e51): for every held delete, the push
576
+ * counts exactly one entry in `filesRefusedStale`, lists its path once in the
577
+ * stale paths, and emits one `delete-refused-stale-etag` event with reason
578
+ * `unattended-foreign-creator` for that path (the tracker dedupes by path).
579
+ * Subtracting `held.length` relies on that one-entry-per-held-row match; if
580
+ * hq-cloud ever counts a held row more than once or not at all, this drifts.
581
+ */
582
+ export function staleRefusalsExcludingHeld(count, paths = [], held = []) {
583
+ if (held.length === 0)
584
+ return { count, paths: [...paths] };
585
+ const heldPaths = new Set(held.map((item) => item.path));
586
+ return {
587
+ count: Math.max(0, count - held.length),
588
+ paths: paths.filter((filePath) => !heldPaths.has(filePath)),
589
+ };
590
+ }
591
+ /**
592
+ * `push --all` totals without held deletes: sums each target's stale
593
+ * refusals minus that target's held deletes, so exit status and the summary
594
+ * agree with the per-target lines.
595
+ */
596
+ export function pushAllStaleExcludingHeld(result) {
597
+ let count = 0;
598
+ let held = 0;
599
+ const paths = [];
600
+ for (const row of result.perCompany) {
601
+ if (!row.result)
602
+ continue;
603
+ const leg = staleRefusalsExcludingHeld(row.result.filesRefusedStale ?? 0, row.result.filesRefusedStalePaths, row.result.heldDeletes);
604
+ count += leg.count;
605
+ paths.push(...leg.paths);
606
+ held += row.result.heldDeletes?.length ?? 0;
607
+ }
608
+ return { count, paths, held };
609
+ }
610
+ /**
611
+ * Actionable recovery for files refused because the vault baseline is stale.
612
+ * Held unattended deletes in `held` are reported separately.
613
+ */
614
+ export function staleUploadRefusalLines(rawCount, rawPaths = [], held = []) {
615
+ const { count, paths } = staleRefusalsExcludingHeld(rawCount, rawPaths, held);
616
+ if (count <= 0)
617
+ return unattendedHeldDeleteLines(held);
544
618
  const lines = [
545
619
  `⚠ ${count} file(s) were NOT uploaded because the vault copy changed after your edit. ` +
546
620
  `Pull the current vault copy, merge your edit, and push again.`,
@@ -548,7 +622,7 @@ export function staleUploadRefusalLines(count, paths = []) {
548
622
  if (paths.length > 0) {
549
623
  lines.push(" Not uploaded:", ...paths.map((filePath) => ` - ${filePath}`));
550
624
  }
551
- return lines;
625
+ return [...lines, ...unattendedHeldDeleteLines(held)];
552
626
  }
553
627
  export function readUploadFailures(result) {
554
628
  const r = result;
@@ -1456,6 +1530,7 @@ export function registerCloudCommands(program) {
1456
1530
  : undefined) ??
1457
1531
  (personalMode ? undefined : companySlugFromSyncPaths(options.hqRoot, targetPaths));
1458
1532
  const identityHeld = createIdentityHeldTracker();
1533
+ const heldDeleteTracker = createUnattendedHeldDeleteTracker();
1459
1534
  syncHealth = beginSyncHealthReport();
1460
1535
  if (!personalMode) {
1461
1536
  const companyUid = entityContext?.uid ??
@@ -1485,6 +1560,7 @@ export function registerCloudCommands(program) {
1485
1560
  onEvent,
1486
1561
  progressRecorder: ((record) => (event) => {
1487
1562
  identityHeld.observe(event);
1563
+ heldDeleteTracker.observe(event);
1488
1564
  record(event);
1489
1565
  })(trackingProgressRecorder(planLimitTracker, progressCompany)),
1490
1566
  ...(personalMode ? { personalMode: true } : {}),
@@ -1495,7 +1571,8 @@ export function registerCloudCommands(program) {
1495
1571
  });
1496
1572
  const planLimitRefused = planLimitTracker.summary();
1497
1573
  const identityHeldCount = identityHeld.count();
1498
- const staleRefusalCount = result.filesRefusedStale ?? 0;
1574
+ const heldDeletes = heldDeleteTracker.held();
1575
+ const staleRefusalCount = staleRefusalsExcludingHeld(result.filesRefusedStale ?? 0, result.filesRefusedStalePaths, heldDeletes).count;
1499
1576
  const uploadFailed = readUploadFailures(result);
1500
1577
  const refusalRecovery = [
1501
1578
  result.filesExcludedByScope > 0
@@ -1529,7 +1606,9 @@ export function registerCloudCommands(program) {
1529
1606
  aborted: result.aborted,
1530
1607
  filesExcludedByScope: result.filesExcludedByScope,
1531
1608
  filesRefusedStale: staleRefusalCount,
1532
- filesRefusedStalePaths: result.filesRefusedStalePaths ?? [],
1609
+ filesRefusedStalePaths: staleRefusalsExcludingHeld(result.filesRefusedStale ?? 0, result.filesRefusedStalePaths, heldDeletes).paths,
1610
+ // feedback_65ee9e51: deletes an unattended sync held (not refusals).
1611
+ heldDeletes: { count: heldDeletes.length, paths: heldDeletes.map((item) => item.path) },
1533
1612
  filesHeldByIdentityFence: identityHeldCount,
1534
1613
  filesUploadFailed: uploadFailed.count,
1535
1614
  uploadFailedPaths: uploadFailed.paths,
@@ -1562,7 +1641,7 @@ export function registerCloudCommands(program) {
1562
1641
  for (const line of scopeExcludedLines(result.filesExcludedByScope, pushPrefixSet)) {
1563
1642
  log(chalk.yellow(line));
1564
1643
  }
1565
- for (const line of staleUploadRefusalLines(result.filesRefusedStale ?? 0, result.filesRefusedStalePaths)) {
1644
+ for (const line of staleUploadRefusalLines(result.filesRefusedStale ?? 0, result.filesRefusedStalePaths, heldDeletes)) {
1566
1645
  log(chalk.yellow(line));
1567
1646
  }
1568
1647
  for (const line of uploadFailedLines(uploadFailed.count, uploadFailed.paths)) {
@@ -1595,7 +1674,7 @@ export function registerCloudCommands(program) {
1595
1674
  })) {
1596
1675
  log(chalk.red(line));
1597
1676
  }
1598
- for (const line of staleUploadRefusalLines(staleRefusalCount, result.filesRefusedStalePaths)) {
1677
+ for (const line of staleUploadRefusalLines(result.filesRefusedStale ?? 0, result.filesRefusedStalePaths, heldDeletes)) {
1599
1678
  log(chalk.yellow(line));
1600
1679
  }
1601
1680
  for (const line of uploadFailedLines(uploadFailed.count, uploadFailed.paths)) {
@@ -1610,6 +1689,11 @@ export function registerCloudCommands(program) {
1610
1689
  log(chalk.yellow(line));
1611
1690
  }
1612
1691
  }
1692
+ else if (heldDeletes.length > 0) {
1693
+ log(chalk.yellow(`\n⚠ Pushed ${result.filesUploaded} file(s) (${formatBytes(result.bytesUploaded)}, ${formatPushSkipSummary(result)})`));
1694
+ for (const line of unattendedHeldDeleteLines(heldDeletes))
1695
+ log(chalk.yellow(line));
1696
+ }
1613
1697
  else {
1614
1698
  const skipSummary = formatPushSkipSummary(result);
1615
1699
  log(chalk.green(`\n✓ Pushed ${result.filesUploaded} file(s) (${formatBytes(result.bytesUploaded)}, ${skipSummary})`));
@@ -2256,12 +2340,17 @@ async function runPushAll(hqRoot, message, onConflict, skipPersonal, skipCompani
2256
2340
  ? null
2257
2341
  : (opts.targetSlug ?? opts.company);
2258
2342
  const tracker = createPlanLimitRefusalTracker(companySlugForBilling(progressCompany));
2343
+ const heldDeleteTracker = createUnattendedHeldDeleteTracker();
2344
+ const record = trackingProgressRecorder(tracker, progressCompany);
2259
2345
  const shareResult = await share({
2260
2346
  paths: opts.paths,
2261
2347
  company: opts.company,
2262
2348
  vaultConfig,
2263
2349
  hqRoot: opts.hqRoot,
2264
- progressRecorder: trackingProgressRecorder(tracker, progressCompany),
2350
+ progressRecorder: (event) => {
2351
+ heldDeleteTracker.observe(event);
2352
+ record(event);
2353
+ },
2265
2354
  ...(opts.onConflict ? { onConflict: opts.onConflict } : {}),
2266
2355
  ...(opts.personalMode !== undefined
2267
2356
  ? { personalMode: opts.personalMode }
@@ -2282,7 +2371,7 @@ async function runPushAll(hqRoot, message, onConflict, skipPersonal, skipCompani
2282
2371
  ...(opts.prefixSet !== undefined ? { prefixSet: opts.prefixSet } : {}),
2283
2372
  ...(author ? { author } : {}),
2284
2373
  });
2285
- return { ...shareResult, planLimit: tracker.summary() };
2374
+ return { ...shareResult, planLimit: tracker.summary(), heldDeletes: heldDeleteTracker.held() };
2286
2375
  },
2287
2376
  });
2288
2377
  }
@@ -2301,9 +2390,12 @@ async function runPushAll(hqRoot, message, onConflict, skipPersonal, skipCompani
2301
2390
  else if (row.result) {
2302
2391
  const r = row.result;
2303
2392
  const legRefused = r.planLimit ?? null;
2393
+ const legStale = staleRefusalsExcludingHeld(r.filesRefusedStale ?? 0, r.filesRefusedStalePaths, r.heldDeletes).count;
2394
+ const legHeld = r.heldDeletes?.length ?? 0;
2304
2395
  const status = r.aborted ||
2305
2396
  r.filesExcludedByScope > 0 ||
2306
- (r.filesRefusedStale ?? 0) > 0 ||
2397
+ legStale > 0 ||
2398
+ legHeld > 0 ||
2307
2399
  (r.filesUploadFailed ?? 0) > 0 ||
2308
2400
  legRefused
2309
2401
  ? chalk.yellow("⚠")
@@ -2311,7 +2403,8 @@ async function runPushAll(hqRoot, message, onConflict, skipPersonal, skipCompani
2311
2403
  console.log(` ${status} ${row.slug}: ${r.filesUploaded} file(s), ` +
2312
2404
  `${formatBytes(r.bytesUploaded)}, ${r.filesSkipped} skipped, ` +
2313
2405
  `${r.filesDeleted} deleted, ${r.filesExcludedByScope} scope-excluded, ` +
2314
- `${r.filesRefusedStale ?? 0} stale-refused, ${r.filesUploadFailed ?? 0} failed, ` +
2406
+ `${legStale} stale-refused, ${r.filesUploadFailed ?? 0} failed, ` +
2407
+ (legHeld > 0 ? `${legHeld} deletion(s) held, ` : "") +
2315
2408
  `${r.conflictPaths.length} conflict(s)` +
2316
2409
  (r.aborted ? " — aborted" : "") +
2317
2410
  (legRefused
@@ -2325,18 +2418,23 @@ async function runPushAll(hqRoot, message, onConflict, skipPersonal, skipCompani
2325
2418
  }
2326
2419
  }
2327
2420
  const errored = result.errors.length;
2421
+ // feedback_65ee9e51: held unattended deletes are warnings, not refused
2422
+ // uploads; they never count as stale refusals or fail the run.
2423
+ const pushAllStale = pushAllStaleExcludingHeld(result);
2328
2424
  const summary = `\nPushed ${result.filesUploaded} file(s) ` +
2329
2425
  `(${formatBytes(result.bytesUploaded)}) across ${result.attempted} ` +
2330
2426
  `target(s); ${result.filesDeleted} deleted; ${errored} error(s); ` +
2331
2427
  `${result.filesExcludedByScope} scope-excluded; ` +
2332
- `${result.filesRefusedStale ?? 0} stale-refused; ` +
2428
+ `${pushAllStale.count} stale-refused; ` +
2429
+ (pushAllStale.held > 0 ? `${pushAllStale.held} deletion(s) held; ` : "") +
2333
2430
  `${result.filesUploadFailed ?? 0} failed` +
2334
2431
  (refusedTargets > 0
2335
2432
  ? `; new files paused on ${refusedTargets} target(s)`
2336
2433
  : "");
2337
2434
  console.log(errored > 0 ||
2338
2435
  result.filesExcludedByScope > 0 ||
2339
- (result.filesRefusedStale ?? 0) > 0 ||
2436
+ pushAllStale.count > 0 ||
2437
+ pushAllStale.held > 0 ||
2340
2438
  (result.filesUploadFailed ?? 0) > 0 ||
2341
2439
  refusedTargets > 0
2342
2440
  ? chalk.yellow(summary)
@@ -2356,7 +2454,7 @@ async function runPushAll(hqRoot, message, onConflict, skipPersonal, skipCompani
2356
2454
  console.log(chalk.yellow(`${row.slug}: ${line}`));
2357
2455
  }
2358
2456
  const staleCount = row.result?.filesRefusedStale ?? 0;
2359
- for (const line of staleUploadRefusalLines(staleCount, row.result?.filesRefusedStalePaths)) {
2457
+ for (const line of staleUploadRefusalLines(staleCount, row.result?.filesRefusedStalePaths, row.result?.heldDeletes)) {
2360
2458
  console.log(chalk.yellow(`${row.slug}: ${line}`));
2361
2459
  }
2362
2460
  for (const line of uploadFailedLines(row.result?.filesUploadFailed ?? 0, row.result?.uploadFailedPaths)) {
@@ -2365,19 +2463,40 @@ async function runPushAll(hqRoot, message, onConflict, skipPersonal, skipCompani
2365
2463
  }
2366
2464
  if (errored > 0)
2367
2465
  throw new SyncExitError(1);
2368
- const refusalSummary = {
2369
- planLimitRefused: refused,
2466
+ return pushAllRefusalSummary(result, refused);
2467
+ }
2468
+ /**
2469
+ * The refusal summary `runPushAll` returns; null means the caller reports
2470
+ * success and exits 0. feedback_65ee9e51: held unattended deletes are left
2471
+ * out, so a push whose only "refusals" are held deletes returns null.
2472
+ */
2473
+ export function pushAllRefusalSummary(result, planLimitRefused) {
2474
+ const stale = pushAllStaleExcludingHeld(result);
2475
+ const summary = {
2476
+ planLimitRefused,
2370
2477
  filesExcludedByScope: result.filesExcludedByScope,
2371
- filesRefusedStale: result.filesRefusedStale ?? 0,
2372
- filesRefusedStalePaths: [...new Set(result.filesRefusedStalePaths ?? [])],
2478
+ filesRefusedStale: stale.count,
2479
+ filesRefusedStalePaths: [...new Set(stale.paths)],
2373
2480
  filesUploadFailed: result.filesUploadFailed ?? 0,
2374
2481
  };
2375
- return (refusalSummary.planLimitRefused ||
2376
- refusalSummary.filesExcludedByScope > 0 ||
2377
- refusalSummary.filesRefusedStale > 0 ||
2378
- refusalSummary.filesUploadFailed > 0
2379
- ? refusalSummary
2380
- : null);
2482
+ return summary.planLimitRefused ||
2483
+ summary.filesExcludedByScope > 0 ||
2484
+ summary.filesRefusedStale > 0 ||
2485
+ summary.filesUploadFailed > 0
2486
+ ? summary
2487
+ : null;
2488
+ }
2489
+ /**
2490
+ * Whether `hq sync now` (`runNowSingle`) must exit 1 after its push leg
2491
+ * ("one or more requested uploads were refused"). feedback_65ee9e51: held
2492
+ * unattended deletes are a warning, never a refusal.
2493
+ */
2494
+ export function nowPushLegRefused(input) {
2495
+ const stale = staleRefusalsExcludingHeld(input.filesRefusedStale ?? 0, input.filesRefusedStalePaths, input.heldDeletes).count;
2496
+ return input.filesExcludedByScope > 0 ||
2497
+ stale > 0 ||
2498
+ input.uploadFailedCount > 0 ||
2499
+ input.identityHeldCount > 0;
2381
2500
  }
2382
2501
  async function runNowSingle(hqRoot, company, personal, message, onConflict, modeAllOverride, forceScopeShrink) {
2383
2502
  console.log(chalk.bold("\nHQ Sync — Now"));
@@ -2452,6 +2571,7 @@ async function runNowSingle(hqRoot, company, personal, message, onConflict, mode
2452
2571
  // feedback_2356e54f: the push leg held files after an account switch and
2453
2572
  // still printed "0 uploaded, 0 skipped" and "Sync now complete".
2454
2573
  const pushIdentityHeld = createIdentityHeldTracker();
2574
+ const pushHeldDeletes = createUnattendedHeldDeleteTracker();
2455
2575
  const pushRecord = trackingProgressRecorder(planLimitTracker, pushProgressCompany);
2456
2576
  const pushResult = await share({
2457
2577
  paths: pushPaths,
@@ -2460,6 +2580,7 @@ async function runNowSingle(hqRoot, company, personal, message, onConflict, mode
2460
2580
  hqRoot,
2461
2581
  progressRecorder: (event) => {
2462
2582
  pushIdentityHeld.observe(event);
2583
+ pushHeldDeletes.observe(event);
2463
2584
  pushRecord(event);
2464
2585
  },
2465
2586
  skipUnchanged: true,
@@ -2477,11 +2598,15 @@ async function runNowSingle(hqRoot, company, personal, message, onConflict, mode
2477
2598
  const pushUploadFailed = readUploadFailures(pushResult);
2478
2599
  const pushHeldCount = pushIdentityHeld.count();
2479
2600
  const pushHeldNotice = pushIdentityHeld.notice();
2601
+ // feedback_65ee9e51: held unattended deletes warn but never fail the run.
2602
+ const pushHeldDeleteList = pushHeldDeletes.held();
2603
+ const pushStaleCount = staleRefusalsExcludingHeld(pushResult.filesRefusedStale ?? 0, pushResult.filesRefusedStalePaths, pushHeldDeleteList).count;
2480
2604
  const pushStatus = pushResult.aborted ||
2481
2605
  pushHeldCount > 0 ||
2482
2606
  Boolean(pushHeldNotice.message) ||
2483
2607
  pushResult.filesExcludedByScope > 0 ||
2484
- (pushResult.filesRefusedStale ?? 0) > 0 ||
2608
+ pushStaleCount > 0 ||
2609
+ pushHeldDeleteList.length > 0 ||
2485
2610
  pushUploadFailed.count > 0 ||
2486
2611
  pushRefused
2487
2612
  ? chalk.yellow("⚠")
@@ -2490,6 +2615,7 @@ async function runNowSingle(hqRoot, company, personal, message, onConflict, mode
2490
2615
  `${pushResult.filesUploaded} uploaded, ${pushResult.filesSkipped} skipped, ` +
2491
2616
  `${pushResult.filesDeleted} deleted, ${pushResult.filesExcludedByScope} scope-excluded` +
2492
2617
  (pushHeldCount > 0 ? `, ${pushHeldCount} held` : "") +
2618
+ (pushHeldDeleteList.length > 0 ? `, ${pushHeldDeleteList.length} deletion(s) held` : "") +
2493
2619
  (pushResult.aborted ? " — aborted" : "") +
2494
2620
  (pushRefused
2495
2621
  ? ` — ${describeRefusedCount(pushRefused)} refused (new files paused)`
@@ -2501,7 +2627,7 @@ async function runNowSingle(hqRoot, company, personal, message, onConflict, mode
2501
2627
  console.log(chalk.yellow(line));
2502
2628
  }
2503
2629
  }
2504
- for (const line of staleUploadRefusalLines(pushResult.filesRefusedStale ?? 0, pushResult.filesRefusedStalePaths)) {
2630
+ for (const line of staleUploadRefusalLines(pushResult.filesRefusedStale ?? 0, pushResult.filesRefusedStalePaths, pushHeldDeleteList)) {
2505
2631
  console.log(chalk.yellow(line));
2506
2632
  }
2507
2633
  for (const line of uploadFailedLines(pushUploadFailed.count, pushUploadFailed.paths)) {
@@ -2630,10 +2756,14 @@ async function runNowSingle(hqRoot, company, personal, message, onConflict, mode
2630
2756
  "refused: new files are paused for this account (listed above)."));
2631
2757
  throw new SyncExitError(1, { health: "succeeded" });
2632
2758
  }
2633
- if (pushResult.filesExcludedByScope > 0 ||
2634
- (pushResult.filesRefusedStale ?? 0) > 0 ||
2635
- pushUploadFailed.count > 0 ||
2636
- pushHeldCount > 0) {
2759
+ if (nowPushLegRefused({
2760
+ filesExcludedByScope: pushResult.filesExcludedByScope,
2761
+ filesRefusedStale: pushResult.filesRefusedStale,
2762
+ filesRefusedStalePaths: pushResult.filesRefusedStalePaths,
2763
+ heldDeletes: pushHeldDeleteList,
2764
+ uploadFailedCount: pushUploadFailed.count,
2765
+ identityHeldCount: pushHeldCount,
2766
+ })) {
2637
2767
  console.log(chalk.yellow("\n⚠ Sync now finished, but one or more requested uploads were refused."));
2638
2768
  throw new SyncExitError(1, { health: "succeeded" });
2639
2769
  }
@@ -8,6 +8,15 @@ interface WorkTrackingSettings {
8
8
  workRegistryEnabled: boolean;
9
9
  workMeshLiveEnabled: boolean;
10
10
  }
11
+ /**
12
+ * What to tell the reader when the cloud ontology gardener is off. The
13
+ * gardener is opt-in per company (default off), and while it is off every
14
+ * scheduled or knowledge-push run is a silent no-op: no `ontology/`,
15
+ * `signals/` or `company-brief.md` is ever built in the company vault.
16
+ * Nothing else tells an owner that, so `settings get` says it and names the
17
+ * command that turns it on.
18
+ */
19
+ export declare function ontologyNextSteps(companySlug: string, ontologyEnabled: boolean): string[];
11
20
  /** Plain next steps after a work tracking switch was set, from the effective settings. */
12
21
  export declare function workTrackingNextSteps(companySlug: string, settings: WorkTrackingSettings | null): string[];
13
22
  export declare function registerCompanyCommand(program: Command): void;