@indigoai-us/hq-cli 5.345.212 → 5.345.215-beta.0

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 (161) hide show
  1. package/CHANGELOG.md +49 -0
  2. package/dist/bin/hq-auth-refresh.js +2 -1
  3. package/dist/command-catalog.generated.d.ts +442 -50
  4. package/dist/command-catalog.generated.js +541 -50
  5. package/dist/commands/agent-inbox.d.ts +11 -1
  6. package/dist/commands/agent-inbox.js +128 -38
  7. package/dist/commands/agent-kit.js +2 -2
  8. package/dist/commands/agents.d.ts +51 -1
  9. package/dist/commands/agents.js +154 -2
  10. package/dist/commands/bot-jobs.d.ts +2 -15
  11. package/dist/commands/bot-jobs.js +2 -94
  12. package/dist/commands/bot-runtime.d.ts +46 -5
  13. package/dist/commands/bot-runtime.js +228 -18
  14. package/dist/commands/bot.d.ts +16 -9
  15. package/dist/commands/bot.js +169 -51
  16. package/dist/commands/cloud.d.ts +66 -13
  17. package/dist/commands/cloud.js +120 -39
  18. package/dist/commands/company-restore.d.ts +23 -0
  19. package/dist/commands/company-restore.js +128 -0
  20. package/dist/commands/company.js +2 -0
  21. package/dist/commands/core-handoff.js +1 -0
  22. package/dist/commands/core-hq-session-native.js +2 -2
  23. package/dist/commands/core-pin-native.js +1 -1
  24. package/dist/commands/core-policy.js +1 -1
  25. package/dist/commands/core-resolve-company-native.js +1 -1
  26. package/dist/commands/core-sentry-report-fast.d.ts +2 -0
  27. package/dist/commands/core-sentry-report-fast.js +3 -1
  28. package/dist/commands/daemon.js +11 -1
  29. package/dist/commands/integrations-connect.d.ts +17 -4
  30. package/dist/commands/integrations-connect.js +224 -26
  31. package/dist/commands/lanes-link.js +10 -5
  32. package/dist/commands/lanes.js +26 -9
  33. package/dist/commands/rescue.js +13 -0
  34. package/dist/commands/secrets.d.ts +11 -0
  35. package/dist/commands/secrets.js +41 -7
  36. package/dist/commands/sources.js +6 -0
  37. package/dist/commands/storage-offload.d.ts +12 -0
  38. package/dist/commands/storage-offload.js +41 -3
  39. package/dist/commands/sync-mode.js +5 -0
  40. package/dist/commands/whoami.js +4 -0
  41. package/dist/index.js +2 -0
  42. package/dist/lazy-commands.js +2 -0
  43. package/dist/lib/agent-kit/inbox-fetch.d.ts +122 -1
  44. package/dist/lib/agent-kit/inbox-fetch.js +215 -3
  45. package/dist/lib/agent-kit/inbox-redact.js +1 -1
  46. package/dist/lib/agent-kit/inbox-state.d.ts +98 -1
  47. package/dist/lib/agent-kit/inbox-state.js +261 -4
  48. package/dist/lib/agent-kit/mcp/tools.d.ts +3 -3
  49. package/dist/lib/agent-kit/mcp/tools.js +68 -25
  50. package/dist/lib/agent-kit/run/inbox.js +4 -2
  51. package/dist/lib/agent-kit/skills.js +4 -1
  52. package/dist/lib/agent-kit/wake.d.ts +9 -1
  53. package/dist/lib/agent-kit/wake.js +10 -3
  54. package/dist/lib/bot/config.d.ts +1 -0
  55. package/dist/lib/bot/config.js +10 -0
  56. package/dist/lib/bot/eventbridge-cron.d.ts +22 -0
  57. package/dist/lib/bot/eventbridge-cron.js +104 -0
  58. package/dist/lib/bot/fleet-cron.js +193 -14
  59. package/dist/lib/bot/fleet-download.d.ts +2 -0
  60. package/dist/lib/bot/fleet-download.js +23 -0
  61. package/dist/lib/bot/fleet-local.d.ts +34 -1
  62. package/dist/lib/bot/fleet-local.js +254 -37
  63. package/dist/lib/bot/fleet-python.d.ts +3 -0
  64. package/dist/lib/bot/fleet-python.js +34 -4
  65. package/dist/lib/bot/fleet-runtime-sources.d.ts +15 -0
  66. package/dist/lib/bot/fleet-runtime-sources.js +30 -0
  67. package/dist/lib/bot/legacy-provider-login.d.ts +8 -0
  68. package/dist/lib/bot/legacy-provider-login.js +19 -2
  69. package/dist/lib/bot/prompt.js +1 -1
  70. package/dist/lib/bot/readiness.d.ts +8 -0
  71. package/dist/lib/bot/readiness.js +17 -3
  72. package/dist/lib/bot/runtime-auth.d.ts +30 -0
  73. package/dist/lib/bot/runtime-auth.js +94 -3
  74. package/dist/lib/bot/status.d.ts +2 -0
  75. package/dist/lib/capacity/collectors/grok-refresh.d.ts +80 -0
  76. package/dist/lib/capacity/collectors/grok-refresh.js +189 -0
  77. package/dist/lib/capacity/collectors/grok.d.ts +5 -0
  78. package/dist/lib/capacity/collectors/grok.js +56 -5
  79. package/dist/lib/core-utils/session-id.d.ts +1 -1
  80. package/dist/lib/core-utils/session-id.js +4 -0
  81. package/dist/lib/daemon/catalog.js +11 -1
  82. package/dist/lib/daemon/run.js +9 -1
  83. package/dist/lib/daemon/updater.d.ts +34 -2
  84. package/dist/lib/daemon/updater.js +51 -2
  85. package/dist/lib/db/sqlite-binding.d.ts +1 -0
  86. package/dist/lib/db/sqlite-binding.js +1 -1
  87. package/dist/lib/delivery/artifacts.d.ts +99 -0
  88. package/dist/lib/delivery/artifacts.js +548 -0
  89. package/dist/lib/delivery/backup.d.ts +78 -0
  90. package/dist/lib/delivery/backup.js +343 -0
  91. package/dist/lib/delivery/cache.d.ts +29 -0
  92. package/dist/lib/delivery/cache.js +33 -0
  93. package/dist/lib/delivery/contracts.d.ts +142 -0
  94. package/dist/lib/delivery/contracts.js +289 -0
  95. package/dist/lib/delivery/credentials.d.ts +54 -0
  96. package/dist/lib/delivery/credentials.js +119 -0
  97. package/dist/lib/delivery/enrollment.d.ts +142 -0
  98. package/dist/lib/delivery/enrollment.js +382 -0
  99. package/dist/lib/delivery/identity.d.ts +25 -0
  100. package/dist/lib/delivery/identity.js +82 -0
  101. package/dist/lib/delivery/inbox.d.ts +116 -0
  102. package/dist/lib/delivery/inbox.js +260 -0
  103. package/dist/lib/delivery/migrations.d.ts +139 -0
  104. package/dist/lib/delivery/migrations.js +623 -0
  105. package/dist/lib/delivery/mqtt-adapter.d.ts +50 -0
  106. package/dist/lib/delivery/mqtt-adapter.js +242 -0
  107. package/dist/lib/delivery/mqtt.d.ts +61 -0
  108. package/dist/lib/delivery/mqtt.js +112 -0
  109. package/dist/lib/delivery/outbox.d.ts +95 -0
  110. package/dist/lib/delivery/outbox.js +187 -0
  111. package/dist/lib/delivery/provenance.d.ts +129 -0
  112. package/dist/lib/delivery/provenance.js +93 -0
  113. package/dist/lib/delivery/reconciler.d.ts +151 -0
  114. package/dist/lib/delivery/reconciler.js +492 -0
  115. package/dist/lib/delivery/restore.d.ts +35 -0
  116. package/dist/lib/delivery/restore.js +134 -0
  117. package/dist/lib/delivery/store.d.ts +161 -0
  118. package/dist/lib/delivery/store.js +940 -0
  119. package/dist/lib/delivery/workers/macos-job-helper.d.ts +103 -0
  120. package/dist/lib/delivery/workers/macos-job-helper.js +927 -0
  121. package/dist/lib/delivery/workers/macos.d.ts +176 -0
  122. package/dist/lib/delivery/workers/macos.js +901 -0
  123. package/dist/lib/delivery/workers/windows-boundary.d.ts +453 -0
  124. package/dist/lib/delivery/workers/windows-boundary.js +693 -0
  125. package/dist/lib/delivery/workers/windows-job-helper.d.ts +35 -0
  126. package/dist/lib/delivery/workers/windows-job-helper.js +264 -0
  127. package/dist/lib/delivery/workers/windows.d.ts +241 -0
  128. package/dist/lib/delivery/workers/windows.js +608 -0
  129. package/dist/lib/doctor/checks/release-links.d.ts +50 -8
  130. package/dist/lib/doctor/checks/release-links.js +260 -24
  131. package/dist/lib/doctor/fix/apply.js +24 -8
  132. package/dist/lib/doctor/fix/remediation.js +15 -5
  133. package/dist/lib/install/provider-wrappers.d.ts +2 -0
  134. package/dist/lib/install/provider-wrappers.js +68 -3
  135. package/dist/lib/lanes/autopilot-registry.d.ts +14 -0
  136. package/dist/lib/lanes/autopilot-registry.js +59 -7
  137. package/dist/lib/lanes/links.d.ts +14 -0
  138. package/dist/lib/lanes/links.js +320 -25
  139. package/dist/lib/lanes/outpost-pruner-install.d.ts +10 -0
  140. package/dist/lib/lanes/outpost-pruner-install.js +4 -3
  141. package/dist/main.js +3 -1
  142. package/dist/sentry-init.d.ts +2 -0
  143. package/dist/sentry-init.js +13 -2
  144. package/dist/sentry.d.ts +2 -0
  145. package/dist/sentry.js +5 -1
  146. package/dist/utils/cli-network-lifecycle.d.ts +9 -0
  147. package/dist/utils/cli-network-lifecycle.js +52 -0
  148. package/dist/utils/cognito-callback-port.d.ts +14 -0
  149. package/dist/utils/cognito-callback-port.js +24 -0
  150. package/dist/utils/cognito-session.js +3 -3
  151. package/dist/utils/deleted-company-notice.d.ts +59 -0
  152. package/dist/utils/deleted-company-notice.js +156 -0
  153. package/dist/utils/login-browser.d.ts +1 -1
  154. package/dist/utils/login-browser.js +7 -5
  155. package/dist/utils/resident-package-preload.js +30 -15
  156. package/dist/utils/safe-link.d.ts +63 -0
  157. package/dist/utils/safe-link.js +246 -0
  158. package/dist/utils/sentry-keepalive-transport.d.ts +28 -0
  159. package/dist/utils/sentry-keepalive-transport.js +70 -0
  160. package/dist/utils/vault-api.js +7 -0
  161. package/package.json +7 -7
@@ -52,7 +52,7 @@ import { executiveStatus } from "../lib/bot/executive-settings.js";
52
52
  import { describeExecutiveBotSource, resolveExecutiveBot, setExecutiveBot } from "../lib/bot/executive.js";
53
53
  import { executiveHotSignalSyncCompanies } from "../lib/bot/executive-sync.js";
54
54
  import { readBotListedProcess } from "../lib/bot/listed-running.js";
55
- import { DEFAULT_BOT_READY_TIMEOUT_SECONDS, botReadinessReport, clearBotSetupStep, createSetupStepReporter, readBotSetupStep, waitForGatewayReady, writeBotSetupStep, } from "../lib/bot/readiness.js";
55
+ import { DEFAULT_BOT_READY_TIMEOUT_SECONDS, botReadinessReport, clearBotSetupStep, createSetupStepReporter, readBotSetupStep, waitForGatewayReady, fleetStatusCarriesReady, writeBotSetupStep, } from "../lib/bot/readiness.js";
56
56
  import { ensureFleetHotSignalSync, fleetCronOps, migrateLegacyJobsToFleet } from "../lib/bot/fleet-cron.js";
57
57
  import { resolvePackSetupPrompt } from "../lib/bot/pack-setup.js";
58
58
  import { detectCodingToolActivity } from "../lib/bot/coding-tool-activity.js";
@@ -78,11 +78,12 @@ import { unresolvedLastFailure } from "../lib/doctor/checks/bots.js";
78
78
  import { clearPendingSwitch, recoverPendingSwitchSafely, writePendingSwitch } from "../lib/bot/pending-switch.js";
79
79
  import { classifyRuntimeFailure, isRuntimeUsageLimit, runtimeFailureReason, usageLimitResetsAt } from "../lib/bot/runtime-failure.js";
80
80
  import { PROBE_DEFAULT_TIMEOUT_MS, probeBotRuntime } from "../lib/bot/probe.js";
81
- import { BOT_LOGIN_RUNTIMES, botAuthEnv, botRuntimeAuth, capacityAccountHome, describeBotAuth, formatBotAuth, isBotLoginRuntime, restoreBotSessions, setAsideBotSessions, signInBotRuntime, signOutBotRuntime, withRuntimeAuth, } from "../lib/bot/runtime-auth.js";
82
- 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";
81
+ import { BOT_LOGIN_RUNTIMES, botAuthEnv, botRuntimeAuth, capacityAccountHome, defaultSpawnBrowserSignIn, describeBotAuth, formatBotAuth, isBotLoginRuntime, restoreBotSessions, setAsideBotSessions, discardHeldBotLogin, holdPreviousBotLogin, restoreHeldBotLogin, signInBotRuntime, signOutBotRuntime, withRuntimeAuth, } from "../lib/bot/runtime-auth.js";
82
+ 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, botRuntimeFromBrainName, 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, fleetLocalGatewayPid, fleetLocalProfileNeedsAdoption, fleetLocalServiceInstalled, fleetProviderForRuntime, importFleetLocalMachineCredential, importFleetLocalProviderLogin, fleetProviderNeedsSignIn, fleetOwnerCompanies, refreshFleetLocalInstructions, fleetLocalPromotionRuntime, installPinnedFleetLocalDistribution, installTargetFleetLocalDistribution, resolveFleetLocalPointerTarget, resolveFleetLocalTargetRelease, fleetLocalProfileDir, fleetProfileOwnerCompanies, fleetLocalChannels, readFleetLocalGatewayState, readFleetLocalIntroSentAt, readFleetLocalSignInNeeded, readPromptSources, removeFleetLocalBot, } from "../lib/bot/index.js";
83
83
  import { gatedInteractiveLogin } from "../utils/interactive-caller.js";
84
- import { fleetInstallProgressReporter, fleetRuntimeStatus, runBotAuthStatus, runBotRuntimeInstall, runBotRuntimeStatus } from "./bot-runtime.js";
84
+ import { brainSignInStatus, fleetInstallProgressReporter, fleetRuntimeStatus, runBotAuthStatus, runBotRuntimeInstall, runBotRuntimeStatus, runBotSignIn } from "./bot-runtime.js";
85
85
  import { ensureFleetRuntimeInstalled } from "../lib/bot/fleet-local.js";
86
+ import { installFleetRuntimeSources, installOptionalFleetRuntimeSources } from "../lib/bot/fleet-runtime-sources.js";
86
87
  function collectRepeated(value, previous) {
87
88
  return [...previous, value];
88
89
  }
@@ -547,7 +548,7 @@ function rowFor(name, opts = {}) {
547
548
  const executiveBot = opts.executiveBot === undefined ? resolveExecutiveBot() : opts.executiveBot;
548
549
  const listed = readBotListedProcess(dir, config);
549
550
  const fleet = listed.fleet;
550
- const status = listed.status;
551
+ const status = fleet ? withFleetSignInNeeded(listed.status, config.agentUid) : listed.status;
551
552
  const legacy = fleet ? null : opts.legacy ?? legacyMoveState(dir, config, legacyConvertSeams.providerLogin(dir, config));
552
553
  const pid = listed.pid;
553
554
  const processAlive = listed.running;
@@ -557,6 +558,8 @@ function rowFor(name, opts = {}) {
557
558
  processAlive,
558
559
  livePid: pid,
559
560
  gateway: fleet ? readFleetLocalGatewayState(config.agentUid) : null,
561
+ status,
562
+ statusCarriesReady: fleet && fleetStatusCarriesReady(config.engine?.version),
560
563
  });
561
564
  // Turns this bot has taken and not finished: what "thinking" means.
562
565
  const inflightTurns = readInflightTurns(dir);
@@ -611,7 +614,7 @@ function rowFor(name, opts = {}) {
611
614
  daemonLoaded,
612
615
  daemonNodeMissing,
613
616
  dir,
614
- introSentAt: config.introSentAt,
617
+ introSentAt: config.introSentAt ?? (fleet ? readFleetLocalIntroSentAt(config.agentUid) ?? undefined : undefined),
615
618
  kind: effectiveBotKind(config),
616
619
  companies: effectiveBotCompanies(config),
617
620
  executive: executiveBot?.name === name,
@@ -1039,24 +1042,26 @@ async function installFleetRuntimeProfile(name, dir, config, opts = {}) {
1039
1042
  if (!opts.force && !fleetLocalProfileNeedsAdoption(config.agentUid, { release: target.release }))
1040
1043
  return null;
1041
1044
  const progress = opts.progress ?? fleetInstallProgressReporter("silent");
1042
- let installation;
1043
- try {
1044
- installation = await installTargetFleetLocalDistribution({ target, onProgress: progress });
1045
- }
1046
- catch (err) {
1047
- if (target.source !== "pointer" || target.localFile)
1048
- throw err;
1049
- if (opts.pointerOnly) {
1050
- createBotLogger(dir)("warn", `could not install HQ Fleet Local ${target.release.version} (${err instanceof Error ? err.message : String(err)}); the bot stays on its current release`);
1051
- return null;
1045
+ const sources = await installOptionalFleetRuntimeSources(async () => {
1046
+ try {
1047
+ return await installTargetFleetLocalDistribution({ target, onProgress: progress });
1052
1048
  }
1053
- createBotLogger(dir)("warn", `could not install HQ Fleet Local ${target.release.version} (${err instanceof Error ? err.message : String(err)}); staying on ${HQ_FLEET_LOCAL_RELEASE.version}`);
1054
- if (!opts.force && !fleetLocalProfileNeedsAdoption(config.agentUid, { release: HQ_FLEET_LOCAL_RELEASE }))
1055
- return null;
1056
- installation = await installPinnedFleetLocalDistribution({ onProgress: progress });
1057
- }
1058
- progress({ phase: "python" });
1059
- const python = await ensureFleetPython();
1049
+ catch (err) {
1050
+ if (target.source !== "pointer" || target.localFile)
1051
+ throw err;
1052
+ if (opts.pointerOnly) {
1053
+ createBotLogger(dir)("warn", `could not install HQ Fleet Local ${target.release.version} (${err instanceof Error ? err.message : String(err)}); the bot stays on its current release`);
1054
+ return null;
1055
+ }
1056
+ createBotLogger(dir)("warn", `could not install HQ Fleet Local ${target.release.version} (${err instanceof Error ? err.message : String(err)}); staying on ${HQ_FLEET_LOCAL_RELEASE.version}`);
1057
+ if (!opts.force && !fleetLocalProfileNeedsAdoption(config.agentUid, { release: HQ_FLEET_LOCAL_RELEASE }))
1058
+ return null;
1059
+ return await installPinnedFleetLocalDistribution({ onProgress: progress });
1060
+ }
1061
+ }, { onProgress: progress });
1062
+ if (!sources)
1063
+ return null;
1064
+ const { installation, python } = sources;
1060
1065
  const companyScope = effectiveBotKind(config) === "company"
1061
1066
  ? effectiveBotCompanies(config)
1062
1067
  : await fleetOwnerCompanies();
@@ -1083,12 +1088,49 @@ async function installFleetRuntimeProfile(name, dir, config, opts = {}) {
1083
1088
  * "unreadable output: trailing characters").
1084
1089
  */
1085
1090
  /** Seams for the self-stop path, replaced in tests. */
1091
+ function withFleetSignInNeeded(status, agentUid) {
1092
+ const marker = readFleetLocalSignInNeeded(agentUid);
1093
+ if (!marker || !status)
1094
+ return status;
1095
+ return { ...status, runtimeSignIn: { state: "signed-out", runtime: marker.runtime, since: marker.since ?? status.startedAt } };
1096
+ }
1097
+ function botReloadsOwnLogin(config) {
1098
+ if (!isFleetRuntimeBot(config))
1099
+ return false;
1100
+ const pid = fleetLocalGatewayPid(config.agentUid);
1101
+ if (pid === null || !isPidAlive(pid))
1102
+ return false;
1103
+ return readFleetLocalSignInNeeded(config.agentUid) !== null;
1104
+ }
1105
+ export const FLEET_SIGN_IN_PICKUP_WAIT_MS = 20_000;
1106
+ function signInPickupWaitMs() {
1107
+ const raw = Number(process.env.HQ_BOT_SIGN_IN_PICKUP_WAIT_MS);
1108
+ return Number.isFinite(raw) && raw >= 0 ? raw : FLEET_SIGN_IN_PICKUP_WAIT_MS;
1109
+ }
1110
+ async function signInMarkerClears(agentUid, waitMs, stepMs = 500) {
1111
+ const deadline = Date.now() + waitMs;
1112
+ for (;;) {
1113
+ if (readFleetLocalSignInNeeded(agentUid) === null)
1114
+ return true;
1115
+ if (Date.now() >= deadline)
1116
+ return false;
1117
+ await new Promise((resolve) => setTimeout(resolve, stepMs));
1118
+ }
1119
+ }
1120
+ function greetingReport(sentAt) {
1121
+ return { sent: sentAt !== null, sentAt };
1122
+ }
1086
1123
  export const botCreateSeams = {
1087
1124
  /** The Claude Code login read the way the HQ Fleet Runtime reads it. */
1088
1125
  claudeLogin: () => checkClaudeCodeLogin(),
1126
+ brainSignIn: brainSignInStatus,
1127
+ importBrainLogin: (agentUid, runtime) => {
1128
+ importFleetLocalProviderLogin(agentUid, runtime);
1129
+ },
1089
1130
  runtimeStatus: fleetRuntimeStatus,
1090
1131
  installRuntime: ensureFleetRuntimeInstalled,
1091
1132
  waitForReady: waitForGatewayReady,
1133
+ greetingSentAt: (agentUid) => readFleetLocalIntroSentAt(agentUid),
1092
1134
  };
1093
1135
  /**
1094
1136
  * A Claude bot on the HQ Fleet Runtime answers with the owner's Claude Code
@@ -1429,16 +1471,18 @@ async function runBotCreateLocked(name, opts) {
1429
1471
  if (opts.legacyRuntime) {
1430
1472
  throw Object.assign(new Error("--legacy-runtime is no longer supported: new bots run on the HQ Fleet Runtime. Drop --legacy-runtime."), { expected: true });
1431
1473
  }
1432
- if (opts.provider && !isBotRuntimeId(opts.provider)) {
1433
- throw Object.assign(new Error(`--provider must be one of ${BOT_RUNTIMES.join(", ")}`), { expected: true });
1474
+ const provider = opts.provider === undefined ? undefined : botRuntimeFromBrainName(opts.provider);
1475
+ if (provider === null) {
1476
+ throw Object.assign(new Error(`--provider must be one of ${BOT_RUNTIMES.join(", ")} (chatgpt is codex)`), { expected: true });
1434
1477
  }
1435
- if (opts.provider && opts.runtime && opts.provider !== opts.runtime) {
1436
- throw Object.assign(new Error("--provider and --runtime must name the same provider when both are used."), { expected: true });
1478
+ const runtimeOption = opts.runtime === undefined ? undefined : botRuntimeFromBrainName(opts.runtime);
1479
+ if (runtimeOption === null) {
1480
+ throw Object.assign(new Error(`--runtime must be one of ${BOT_RUNTIMES.join(", ")} (chatgpt is codex)`), { expected: true });
1437
1481
  }
1438
- const runtime = opts.provider ?? opts.runtime ?? "claude";
1439
- if (!isBotRuntimeId(runtime)) {
1440
- throw Object.assign(new Error(`--runtime must be one of ${BOT_RUNTIMES.join(", ")}`), { expected: true });
1482
+ if (provider && runtimeOption && provider !== runtimeOption) {
1483
+ throw Object.assign(new Error("--provider and --runtime must name the same provider when both are used."), { expected: true });
1441
1484
  }
1485
+ const runtime = provider ?? runtimeOption ?? "claude";
1442
1486
  const memoryMode = opts.memory ?? "synced";
1443
1487
  if (!isBotMemoryMode(memoryMode)) {
1444
1488
  throw Object.assign(new Error(`--memory must be one of ${BOT_MEMORY_MODES.join(", ")}`), { expected: true });
@@ -1489,7 +1533,6 @@ async function runBotCreateLocked(name, opts) {
1489
1533
  });
1490
1534
  }
1491
1535
  const fleetProvider = fleetProviderForRuntime(runtime, model);
1492
- const fleetAuthPending = fleetProviderNeedsSignIn(fleetProvider);
1493
1536
  if (fleetProvider.id === "anthropic")
1494
1537
  requireClaudeCodeLoginForCreate(name);
1495
1538
  const token = await ownerToken();
@@ -1588,13 +1631,15 @@ async function runBotCreateLocked(name, opts) {
1588
1631
  const progress = fleetInstallProgressReporter(opts.json ? (opts.progress ? "json" : "silent") : "text");
1589
1632
  const steps = createSetupStepReporter(opts.json ? (opts.progress ? "json" : "silent") : "text");
1590
1633
  const fleetTarget = await resolveFleetLocalTargetRelease();
1634
+ const brainLogin = fleetProviderNeedsSignIn(fleetProvider)
1635
+ ? await botCreateSeams.brainSignIn(runtime === "grok" ? "grok" : "chatgpt", { target: async () => fleetTarget })
1636
+ : null;
1637
+ const fleetAuthPending = brainLogin !== null && !brainLogin.signedIn;
1591
1638
  const runtimeStatus = await botCreateSeams.runtimeStatus({ target: fleetTarget });
1592
1639
  if (!opts.json)
1593
1640
  console.log(chalk.dim(`Setting up ${name} takes ${runtimeStatus.estimate}.`));
1594
1641
  steps.begin("install");
1595
- const fleetInstallation = await installTargetFleetLocalDistribution({ target: fleetTarget, onProgress: progress });
1596
- progress({ phase: "python" });
1597
- const fleetPython = await ensureFleetPython();
1642
+ const { installation: fleetInstallation, python: fleetPython } = await installFleetRuntimeSources(() => installTargetFleetLocalDistribution({ target: fleetTarget, onProgress: progress }), { onProgress: progress });
1598
1643
  await botCreateSeams.installRuntime(fleetInstallation, { python: fleetPython, onProgress: progress });
1599
1644
  steps.finish("install", runtimeStatus.installed ? "skipped" : "done");
1600
1645
  steps.begin("identity");
@@ -1769,10 +1814,24 @@ async function runBotCreateLocked(name, opts) {
1769
1814
  },
1770
1815
  // Where hq daemon runs the bots, the runtime must not register its own
1771
1816
  // login item; the daemon is asked to start the gateway below instead.
1772
- { start: startNow && !daemonRunsFleetBots, python: fleetPython, onProgress: progress });
1773
- syncFleetRuntimeJobs(name, dir, config);
1817
+ { start: startNow && !daemonRunsFleetBots && brainLogin === null, python: fleetPython, onProgress: progress });
1818
+ if (startNow && brainLogin) {
1819
+ try {
1820
+ botCreateSeams.importBrainLogin(agentUid, runtime === "grok" ? "grok" : "codex");
1821
+ }
1822
+ catch (err) {
1823
+ const cause = err instanceof Error ? err.message : String(err);
1824
+ createBotLogger(dir)("warn", `could not reuse the ${runtimeDisplayName(runtime)} login on this computer (${cause}); ${name} needs its own sign-in`);
1825
+ patchBotConfig(dir, { fleetAuthPending: true, enabled: false });
1826
+ steps.finish("starting", "failed");
1827
+ steps.finish("ready", "skipped");
1828
+ throw Object.assign(new Error(`${name} was created, but the ${runtimeDisplayName(runtime)} login on this computer could not be reused (${cause}). Sign it in with ${fleetAuthCommand(name, { ...config, fleetAuthPending: true })}.`), { expected: true });
1829
+ }
1830
+ }
1774
1831
  const startedByDaemon = startNow && daemonRunsFleetBots && controlFleetLocalBot(agentUid, "install").ok === true;
1775
- const running = fleetBootstrap.running || startedByDaemon;
1832
+ const startedByRuntime = startNow && !daemonRunsFleetBots && brainLogin !== null && controlFleetLocalBot(agentUid, "install").ok === true;
1833
+ syncFleetRuntimeJobs(name, dir, config);
1834
+ const running = fleetBootstrap.running || startedByDaemon || startedByRuntime;
1776
1835
  let readyWait = null;
1777
1836
  if (!startNow) {
1778
1837
  steps.finish("starting", "skipped");
@@ -1785,7 +1844,11 @@ async function runBotCreateLocked(name, opts) {
1785
1844
  else {
1786
1845
  steps.finish("starting", "done");
1787
1846
  steps.begin("ready");
1788
- readyWait = await botCreateSeams.waitForReady(agentUid, { timeoutMs: readyTimeoutMs });
1847
+ readyWait = await botCreateSeams.waitForReady(agentUid, {
1848
+ timeoutMs: readyTimeoutMs,
1849
+ botDir: dir,
1850
+ statusCarriesReady: fleetStatusCarriesReady(fleetInstallation.engine.version),
1851
+ });
1789
1852
  steps.finish("ready", readyWait.ready ? "done" : readyWait.failed ? "failed" : "timeout");
1790
1853
  }
1791
1854
  const readiness = !startNow || !running || readyWait?.failed ? "offline" : readyWait?.ready ? "ready" : "starting";
@@ -1843,10 +1906,11 @@ async function runBotCreateLocked(name, opts) {
1843
1906
  ...created_,
1844
1907
  daemon: null,
1845
1908
  running,
1846
- how: startedByDaemon ? "started by hq daemon" : fleetBootstrap.running ? "started by the HQ Fleet Runtime" : null,
1909
+ how: startedByDaemon ? "started by hq daemon" : fleetBootstrap.running || startedByRuntime ? "started by the HQ Fleet Runtime" : null,
1847
1910
  steps: steps.steps(),
1848
1911
  readiness,
1849
1912
  ready: readiness === "ready",
1913
+ greeting: greetingReport(botCreateSeams.greetingSentAt(agentUid)),
1850
1914
  readyAt: readyWait?.readyAt ?? null,
1851
1915
  readyWait: readyWait
1852
1916
  ? { timedOut: readyWait.timedOut, failed: readyWait.failed, waitedMs: readyWait.waitedMs, timeoutMs: readyTimeoutMs }
@@ -2936,7 +3000,13 @@ export async function runBotSwitchAccount(nameArg, opts, deps = {}) {
2936
3000
  if (!isBotRuntimeId(opts.runtime)) {
2937
3001
  throw Object.assign(new Error(`--runtime must be one of ${BOT_RUNTIMES.join(", ")}`), { expected: true });
2938
3002
  }
3003
+ if (opts.signIn && !isBotLoginRuntime(opts.runtime)) {
3004
+ throw Object.assign(new Error(`--sign-in supports ${BOT_LOGIN_RUNTIMES.join(", ")}; ${opts.runtime} has no login of its own for a bot. Nothing was changed.`), { expected: true });
3005
+ }
2939
3006
  if (isFleetRuntimeBot(config)) {
3007
+ if (opts.signIn) {
3008
+ throw Object.assign(new Error(`${name} runs on the HQ Fleet Runtime, which signs in through its own path (hq bot auth). --sign-in is for model-CLI bots. Nothing was changed.`), { expected: true });
3009
+ }
2940
3010
  if (opts.runtime === "grok") {
2941
3011
  // The Fleet Grok sign-in reuses another bot's xAI login on this
2942
3012
  // computer, so it cannot reach a different account.
@@ -2946,8 +3016,34 @@ export async function runBotSwitchAccount(nameArg, opts, deps = {}) {
2946
3016
  }
2947
3017
  const targetRuntime = opts.runtime;
2948
3018
  const switching = targetRuntime !== config.runtime;
2949
- // The owner's own sign-in for the target runtime: the account just picked.
2950
- const runtimeAuth = withRuntimeAuth(config.runtimeAuth, targetRuntime, null);
3019
+ let runtimeAuth;
3020
+ if (opts.signIn && isBotLoginRuntime(targetRuntime)) {
3021
+ // A login of the bot's own (~/.hq/bots/<name>/auth/<runtime>), signed
3022
+ // in fresh in the browser. The owner's sign-in and every other bot's
3023
+ // login are never touched. A previous own login is held aside and
3024
+ // put back when this sign-in fails or is cancelled. It is discarded
3025
+ // only after the new login succeeds.
3026
+ const authSpawn = deps.authSpawn;
3027
+ const held = holdPreviousBotLogin(dir, targetRuntime, authSpawn ? { spawn: authSpawn } : {});
3028
+ try {
3029
+ (deps.botSignIn ?? ((d, r) => signInBotRuntime(d, r, authSpawn ? { spawn: authSpawn, quietSpawn: authSpawn, preserveCredentialOnFailure: held } : { spawn: defaultSpawnBrowserSignIn, preserveCredentialOnFailure: held })))(dir, targetRuntime);
3030
+ }
3031
+ catch (err) {
3032
+ if (held) {
3033
+ restoreHeldBotLogin(dir, targetRuntime);
3034
+ throw Object.assign(new Error(`Sign-in did not finish, so ${name}'s previous ${targetRuntime} login was kept.`), { expected: true, cause: err });
3035
+ }
3036
+ throw err;
3037
+ }
3038
+ if (held)
3039
+ discardHeldBotLogin(dir, targetRuntime);
3040
+ createBotLogger(dir)("info", `switch-account: ${name} signed in to ${targetRuntime} with a login of its own`);
3041
+ runtimeAuth = withRuntimeAuth(config.runtimeAuth, targetRuntime, { mode: "own" });
3042
+ }
3043
+ else {
3044
+ // The owner's own sign-in for the target runtime.
3045
+ runtimeAuth = withRuntimeAuth(config.runtimeAuth, targetRuntime, null);
3046
+ }
2951
3047
  return switchRuntimeOrAccount({
2952
3048
  name,
2953
3049
  dir,
@@ -3119,6 +3215,13 @@ export async function runBotAuth(nameArg, opts) {
3119
3215
  if (opts.apiKey && !apiKey) {
3120
3216
  throw Object.assign(new Error("No API key was received on stdin."), { expected: true });
3121
3217
  }
3218
+ if (!apiKey && botRuntimeFromBrainName(opts.provider) === "claude" && !botCreateSeams.claudeLogin().signedIn) {
3219
+ const reason = `Claude Code is not signed in on this computer, so ${b.name} cannot answer.`;
3220
+ const brainSignIn = { provider: "claude", needed: true, reason, command: "claude /login" };
3221
+ if (opts.json)
3222
+ console.log(JSON.stringify({ ok: false, name: b.name, provider: "claude", signedIn: false, brainSignIn }, null, 2));
3223
+ throw Object.assign(new Error(`${reason} Sign in with claude /login, then run this again.`), { expected: true, brainSignIn, jsonReported: opts.json === true });
3224
+ }
3122
3225
  // A legacy bot moves to the HQ Fleet Runtime as part of its sign-in. Its
3123
3226
  // legacy runner stops for the sign-in and comes back if the sign-in fails.
3124
3227
  const legacy = isFleetRuntimeBot(b.config) ? null : b.config;
@@ -3142,6 +3245,7 @@ export async function runBotAuth(nameArg, opts) {
3142
3245
  if (legacy)
3143
3246
  process.on("SIGINT", keepAliveOnInterrupt);
3144
3247
  let result;
3248
+ let reloaded = false;
3145
3249
  try {
3146
3250
  result = await authenticateFleetLocalBot({
3147
3251
  agentUid: b.config.agentUid,
@@ -3155,6 +3259,10 @@ export async function runBotAuth(nameArg, opts) {
3155
3259
  openBrowser: opts.browser !== false,
3156
3260
  }, {
3157
3261
  control: (agentUid, action) => {
3262
+ if (action === "restart" && botReloadsOwnLogin(b.config)) {
3263
+ reloaded = true;
3264
+ return { ok: true, reloaded: true };
3265
+ }
3158
3266
  if (fleetBotsManagedByDaemon()) {
3159
3267
  if (legacy && engine)
3160
3268
  writeBotConfig(b.dir, { ...(readBotConfig(b.dir) ?? legacy), engine });
@@ -3207,9 +3315,10 @@ export async function runBotAuth(nameArg, opts) {
3207
3315
  model: result.model,
3208
3316
  ...(pending ? { fleetAuthPending: false, fleetServiceInstallPending: !result.restarted, enabled: result.restarted } : {}),
3209
3317
  });
3210
- const running = await fleetGatewayComesUp(b.config.agentUid, result.restarted ? fleetStartWaitMs() : 0);
3318
+ const retried = reloaded ? await signInMarkerClears(b.config.agentUid, signInPickupWaitMs()) : false;
3319
+ const running = await fleetGatewayComesUp(b.config.agentUid, result.restarted && !reloaded ? fleetStartWaitMs() : 0);
3211
3320
  if (opts.json) {
3212
- console.log(JSON.stringify({ ok: true, name: b.name, runtime: HQ_FLEET_RUNTIME_ENGINE_ID, ...result, needsSignIn: false, running, serviceInstallPending: pending && !result.restarted, ...(legacy ? { movedToFleet: true } : {}) }, null, 2));
3321
+ console.log(JSON.stringify({ ok: true, name: b.name, runtime: HQ_FLEET_RUNTIME_ENGINE_ID, ...result, ...(reloaded ? { restarted: false } : {}), signedIn: true, reloaded, retried, needsSignIn: false, running, serviceInstallPending: pending && !result.restarted, ...(legacy ? { movedToFleet: true } : {}) }, null, 2));
3213
3322
  return { running };
3214
3323
  }
3215
3324
  console.log(running
@@ -3484,10 +3593,11 @@ async function adoptRemoteBotLocked(input) {
3484
3593
  });
3485
3594
  // A bot made on the HQ Fleet Runtime comes back on it, on the release this CLI pins.
3486
3595
  const progress = input.progress ?? fleetInstallProgressReporter("silent");
3487
- const fleetInstallation = fleetEngine ? await installPinnedFleetLocalDistribution({ onProgress: progress }) : null;
3488
- if (fleetInstallation)
3489
- progress({ phase: "python" });
3490
- const fleetPython = fleetInstallation ? await ensureFleetPython() : null;
3596
+ const fleetSources = fleetEngine
3597
+ ? await installFleetRuntimeSources(() => installPinnedFleetLocalDistribution({ onProgress: progress }), { onProgress: progress })
3598
+ : null;
3599
+ const fleetInstallation = fleetSources?.installation ?? null;
3600
+ const fleetPython = fleetSources?.python ?? null;
3491
3601
  if (fleetInstallation)
3492
3602
  config.engine = fleetInstallation.engine;
3493
3603
  writeBotConfig(dir, config);
@@ -3826,7 +3936,7 @@ export function registerBotCommand(program) {
3826
3936
  .option("--kind <kind>", `personal (acts as you, everywhere you are) or company (acts as itself, as a member of its companies). Default: personal, or company when created from a company worker`)
3827
3937
  .option("--company <slug>", "Company bots: a company the bot is a member of (repeat for several); the owner invites it on creation", collectRepeated, [])
3828
3938
  .option("--runtime <runtime>", `Model provider the bot answers with: ${BOT_RUNTIMES.join("|")} (same as --provider; default claude)`)
3829
- .option("--provider <provider>", `HQ Fleet provider: ${BOT_RUNTIMES.join("|")} (default claude)`)
3939
+ .option("--provider <provider>", `HQ Fleet provider: ${BOT_RUNTIMES.join("|")}, or chatgpt for codex (default claude)`)
3830
3940
  .option("--hq-fleet-runtime", "Accepted for compatibility; every new bot runs on the HQ Fleet Runtime")
3831
3941
  .option("--legacy-runtime", "No longer supported; new bots always run on the HQ Fleet Runtime")
3832
3942
  .option("--model <model>", "Model the bot answers with")
@@ -3928,10 +4038,17 @@ export function registerBotCommand(program) {
3928
4038
  .action((name, opts) => wrap(async () => { await runBotAuth(name, opts); })());
3929
4039
  bot
3930
4040
  .command("auth-status")
3931
- .description("Say whether a Fleet bot created now would need its own ChatGPT or Grok sign-in, or reuse a login already on this computer")
3932
- .requiredOption("--provider <provider>", "Provider: chatgpt or grok")
3933
- .option("--json", "Print machine-readable JSON: { signedIn }")
4041
+ .description("Say whether a bot created now with this brain starts without a sign-in step, reusing a login already on this computer")
4042
+ .requiredOption("--provider <provider>", "Brain: claude, codex (or chatgpt) or grok")
4043
+ .option("--json", "Print machine-readable JSON: { provider, signedIn, source }")
3934
4044
  .action((opts) => wrap(async () => { await runBotAuthStatus(opts); })());
4045
+ bot
4046
+ .command("sign-in")
4047
+ .description("Sign this computer in to ChatGPT or Grok through its own CLI, so new bots with that brain start without a sign-in step")
4048
+ .requiredOption("--provider <provider>", "Brain: codex (or chatgpt) or grok")
4049
+ .option("--json", "Print one JSON line per event (device code, messages) and a final result")
4050
+ .option("--no-browser", "Use the CLI's device-code login instead of its browser login")
4051
+ .action((opts) => wrap(async () => { await runBotSignIn(opts); })());
3935
4052
  bot
3936
4053
  .command("logs <name>")
3937
4054
  .description("Show the bot's log")
@@ -3963,6 +4080,7 @@ export function registerBotCommand(program) {
3963
4080
  .command("switch-account <name>")
3964
4081
  .description("Move the bot onto another account (same provider or another), keeping its identity, worker, memory and jobs, then start it again. A model-CLI bot uses your own sign-in for --runtime, checked with one test turn first; a cut-off switch is rolled back by the next start or status. A Fleet Runtime bot uses the HQ Fleet sign-in (hq bot auth)")
3965
4082
  .requiredOption("--runtime <runtime>", `${BOT_RUNTIMES.join("|")}`)
4083
+ .option("--sign-in", `Sign the bot in with a login of its own first (${BOT_LOGIN_RUNTIMES.join(", ")}): a browser sign-in for this bot only; your own sign-in is not touched`)
3966
4084
  .option("--json", "Print machine-readable JSON")
3967
4085
  .action((name, opts) => wrap(() => runBotSwitchAccount(name, opts))());
3968
4086
  bot
@@ -693,18 +693,73 @@ export declare function nowPushLegRefused(input: {
693
693
  * personal-vault fanout slot and the legacy `companies/personal` company both
694
694
  * carry opaque slugs; everything else is a real company slug shown as-is.
695
695
  */
696
+ type StatusJournal = {
697
+ slug: string;
698
+ journal: {
699
+ files?: Record<string, unknown>;
700
+ };
701
+ };
702
+ export type ReadOnlyLocalOnlyGroup = {
703
+ slug: string;
704
+ total: number;
705
+ files: Array<{
706
+ path: string;
707
+ permission: "read" | "none";
708
+ }>;
709
+ };
710
+ export type ServerOwnedLocalOnlyGroup = {
711
+ slug: string;
712
+ total: number;
713
+ files: string[];
714
+ };
715
+ /**
716
+ * Collect local files under read-only vault prefixes that are not in the sync
717
+ * journal. `all` lifts the per-company cap so every path is returned; `total`
718
+ * always counts every match. Local reads only, no network.
719
+ */
720
+ export declare function collectReadOnlyLocalOnly(hqRoot: string, journals: ReadonlyArray<StatusJournal>, opts?: {
721
+ all?: boolean;
722
+ }): ReadOnlyLocalOnlyGroup[];
723
+ /**
724
+ * Collect local files under server-owned folders (sources/, signals/,
725
+ * ontology/ outside entities/) that are not in the sync journal. `all` lifts
726
+ * the per-company cap. Local reads only, no network.
727
+ */
728
+ export declare function collectServerOwnedLocalOnly(hqRoot: string, journals: ReadonlyArray<StatusJournal>, opts?: {
729
+ all?: boolean;
730
+ }): ServerOwnedLocalOnlyGroup[];
731
+ /**
732
+ * Full machine-readable `hq sync status`: scope summaries plus both local-only
733
+ * lists with every path (no cap).
734
+ */
735
+ export declare function buildSyncStatusJson(input: {
736
+ hqRoot: string;
737
+ activeCompany?: string;
738
+ stateDir: string;
739
+ companyFilter?: string;
740
+ journals: ReadonlyArray<{
741
+ slug: string;
742
+ path: string;
743
+ journal: {
744
+ lastSync?: string;
745
+ files?: Record<string, {
746
+ removedAt?: unknown;
747
+ size?: number;
748
+ syncedAt?: unknown;
749
+ }>;
750
+ };
751
+ }>;
752
+ }): Record<string, unknown>;
696
753
  /**
697
754
  * `hq sync status`: list local files under read-only vault prefixes that are
698
755
  * not in the sync journal. Push never uploads them (feedback_510661bc,
699
756
  * Shepherd #2813). Uses only the local vault-access manifest and the journals
700
757
  * already loaded, with no network calls. Prints nothing when nothing applies.
758
+ * Capped at 20 per company unless `opts.all` (feedback_f29d004a).
701
759
  */
702
- export declare function printReadOnlyLocalOnly(hqRoot: string, journals: ReadonlyArray<{
703
- slug: string;
704
- journal: {
705
- files?: Record<string, unknown>;
706
- };
707
- }>, log?: (line: string) => void): number;
760
+ export declare function printReadOnlyLocalOnly(hqRoot: string, journals: ReadonlyArray<StatusJournal>, log?: (line: string) => void, opts?: {
761
+ all?: boolean;
762
+ }): number;
708
763
  /**
709
764
  * `hq sync status`: list local files under server-owned folders (sources/,
710
765
  * signals/, ontology/ outside entities/) that are not in the sync journal.
@@ -712,13 +767,11 @@ export declare function printReadOnlyLocalOnly(hqRoot: string, journals: Readonl
712
767
  * the recurring runner skips them quietly, so a file written locally there
713
768
  * never reaches the vault and `pendingFiles: 0` still reports a clean tree
714
769
  * (feedback_0414d71c). Uses only the journals already loaded, with no
715
- * network calls. Prints nothing when nothing applies.
770
+ * network calls. Prints nothing when nothing applies. Capped at 20 per
771
+ * company unless `opts.all` (feedback_f29d004a).
716
772
  */
717
- export declare function printServerOwnedLocalOnly(hqRoot: string, journals: ReadonlyArray<{
718
- slug: string;
719
- journal: {
720
- files?: Record<string, unknown>;
721
- };
722
- }>, log?: (line: string) => void): number;
773
+ export declare function printServerOwnedLocalOnly(hqRoot: string, journals: ReadonlyArray<StatusJournal>, log?: (line: string) => void, opts?: {
774
+ all?: boolean;
775
+ }): number;
723
776
  export {};
724
777
  //# sourceMappingURL=cloud.d.ts.map