@indigoai-us/hq-cli 5.345.208 → 5.345.211

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 (133) hide show
  1. package/CHANGELOG.md +106 -0
  2. package/assets/scaffold/core/scripts/derive-trigger-facts.sh +22 -3
  3. package/assets/scaffold/core/scripts/lib/trigger-fact-text.awk +152 -41
  4. package/dist/command-catalog.generated.d.ts +33 -8
  5. package/dist/command-catalog.generated.js +40 -8
  6. package/dist/command-registration-plan.d.ts +2 -2
  7. package/dist/command-registration-plan.js +1 -1
  8. package/dist/commands/access.js +11 -5
  9. package/dist/commands/agents.d.ts +8 -0
  10. package/dist/commands/agents.js +5 -0
  11. package/dist/commands/bot.d.ts +8 -0
  12. package/dist/commands/bot.js +67 -7
  13. package/dist/commands/channels.js +4 -0
  14. package/dist/commands/cloud.d.ts +83 -2
  15. package/dist/commands/cloud.js +161 -31
  16. package/dist/commands/company.d.ts +9 -0
  17. package/dist/commands/company.js +44 -14
  18. package/dist/commands/core-checkpoint-native.js +21 -0
  19. package/dist/commands/core-derive-trigger-facts-native.d.ts +1 -0
  20. package/dist/commands/core-derive-trigger-facts-native.js +75 -14
  21. package/dist/commands/core-generate-workers-registry-fast.d.ts +1 -1
  22. package/dist/commands/core-generate-workers-registry-fast.js +7 -1
  23. package/dist/commands/core-job-run-native.d.ts +8 -0
  24. package/dist/commands/core-job-run-native.js +11 -3
  25. package/dist/commands/core-jobs-native.js +1 -1
  26. package/dist/commands/core-register-project-native.js +31 -1
  27. package/dist/commands/core-scan-packages-fast.d.ts +1 -1
  28. package/dist/commands/core-scan-packages-fast.js +8 -1
  29. package/dist/commands/core-work-mesh-bind-trusted-native.d.ts +14 -2
  30. package/dist/commands/core-work-mesh-bind-trusted-native.js +62 -8
  31. package/dist/commands/core.js +12 -3
  32. package/dist/commands/dm-attach.d.ts +10 -0
  33. package/dist/commands/dm-attach.js +33 -5
  34. package/dist/commands/integrations-connect.d.ts +16 -0
  35. package/dist/commands/integrations-connect.js +70 -6
  36. package/dist/commands/lanes-session-start.d.ts +17 -0
  37. package/dist/commands/lanes-session-start.js +281 -13
  38. package/dist/commands/lanes-watch.js +11 -3
  39. package/dist/commands/lanes.d.ts +4 -0
  40. package/dist/commands/lanes.js +95 -22
  41. package/dist/commands/library.d.ts +10 -0
  42. package/dist/commands/library.js +30 -3
  43. package/dist/commands/meetings.d.ts +42 -0
  44. package/dist/commands/meetings.js +157 -12
  45. package/dist/commands/mesh.js +3 -0
  46. package/dist/commands/monitor.d.ts +6 -0
  47. package/dist/commands/monitor.js +29 -19
  48. package/dist/commands/onboard.js +8 -1
  49. package/dist/commands/sources.js +7 -3
  50. package/dist/index.js +9 -0
  51. package/dist/lanes-monitor-check-argv.d.ts +1 -1
  52. package/dist/lanes-monitor-check-argv.js +2 -2
  53. package/dist/lanes-session-start-argv.d.ts +4 -1
  54. package/dist/lanes-session-start-argv.js +5 -2
  55. package/dist/lib/bot/fleet-daemon.d.ts +101 -0
  56. package/dist/lib/bot/fleet-daemon.js +227 -0
  57. package/dist/lib/bot/fleet-local.d.ts +26 -0
  58. package/dist/lib/bot/fleet-local.js +51 -2
  59. package/dist/lib/bot/index.d.ts +1 -0
  60. package/dist/lib/bot/index.js +1 -0
  61. package/dist/lib/bot/jobs/hot-signal-sync.d.ts +4 -0
  62. package/dist/lib/bot/jobs/hot-signal-sync.js +8 -1
  63. package/dist/lib/bot/log.js +3 -1
  64. package/dist/lib/bot/probe.js +2 -0
  65. package/dist/lib/bot/run.js +28 -3
  66. package/dist/lib/bot/runtime-failure.d.ts +4 -2
  67. package/dist/lib/bot/runtime-failure.js +9 -1
  68. package/dist/lib/bot/status.d.ts +17 -0
  69. package/dist/lib/bot/status.js +53 -2
  70. package/dist/lib/capacity/collectors/claude-oauth.d.ts +5 -5
  71. package/dist/lib/capacity/collectors/claude-oauth.js +6 -6
  72. package/dist/lib/core-utils/native-scaffold-help.d.ts +16 -0
  73. package/dist/lib/core-utils/native-scaffold-help.js +26 -0
  74. package/dist/lib/core-utils/session-company.d.ts +25 -8
  75. package/dist/lib/core-utils/session-company.js +59 -17
  76. package/dist/lib/daemon/catalog.d.ts +34 -1
  77. package/dist/lib/daemon/catalog.js +42 -3
  78. package/dist/lib/daemon/run.d.ts +5 -4
  79. package/dist/lib/daemon/run.js +40 -16
  80. package/dist/lib/daemon/server.js +26 -7
  81. package/dist/lib/daemon/supervisor.d.ts +2 -0
  82. package/dist/lib/daemon/supervisor.js +60 -1
  83. package/dist/lib/daemon/tools.js +17 -1
  84. package/dist/lib/db/sqlite-binding.js +2 -1
  85. package/dist/lib/doctor/checks/bots.d.ts +2 -0
  86. package/dist/lib/doctor/checks/bots.js +11 -0
  87. package/dist/lib/doctor/checks/runtime-health.js +3 -2
  88. package/dist/lib/doctor/checks/work-context.js +5 -2
  89. package/dist/lib/hook-engine/resolve.d.ts +1 -1
  90. package/dist/lib/hook-engine/resolve.js +4 -1
  91. package/dist/lib/hot-channels/adapters/meeting-providers.d.ts +2 -0
  92. package/dist/lib/hot-channels/adapters/meeting-providers.js +13 -2
  93. package/dist/lib/lanes/index.d.ts +1 -1
  94. package/dist/lib/lanes/index.js +1 -1
  95. package/dist/lib/lanes/monitor.d.ts +14 -0
  96. package/dist/lib/lanes/monitor.js +51 -10
  97. package/dist/lib/lanes/outpost-dispatch.d.ts +3 -0
  98. package/dist/lib/lanes/outpost-dispatch.js +1 -0
  99. package/dist/lib/lanes/store.d.ts +1 -1
  100. package/dist/lib/lanes/store.js +2 -1
  101. package/dist/lib/mesh/client.js +7 -1
  102. package/dist/lib/mesh/live/backfill-held.d.ts +3 -0
  103. package/dist/lib/mesh/live/backfill-held.js +167 -7
  104. package/dist/lib/mesh/live/flush.d.ts +7 -0
  105. package/dist/lib/mesh/live/flush.js +10 -1
  106. package/dist/lib/monitor.d.ts +9 -0
  107. package/dist/lib/monitor.js +33 -7
  108. package/dist/lib/onboarding/orchestrator.js +269 -132
  109. package/dist/lib/onboarding/types.d.ts +2 -0
  110. package/dist/lib/scaffold-cli-floor.js +2 -1
  111. package/dist/lib/signals/failure-alert.js +3 -1
  112. package/dist/lib/sync-core/reconcile.js +15 -11
  113. package/dist/lib/work-context/organize.d.ts +6 -0
  114. package/dist/lib/work-context/organize.js +28 -0
  115. package/dist/lib/work-context/paths.d.ts +9 -0
  116. package/dist/lib/work-context/paths.js +15 -0
  117. package/dist/lib/work-context/prd-sync.js +2 -1
  118. package/dist/runners-alias.d.ts +54 -0
  119. package/dist/runners-alias.js +86 -0
  120. package/dist/utils/install-tree-torn.js +5 -3
  121. package/dist/utils/npm-install-flags.d.ts +27 -0
  122. package/dist/utils/npm-install-flags.js +68 -0
  123. package/dist/utils/package-use-lease.js +1 -1
  124. package/dist/utils/qmd-native-binding-error.js +2 -1
  125. package/dist/utils/self-update.js +2 -1
  126. package/dist/utils/staged-install.js +2 -1
  127. package/dist/utils/staged-npm-install.js +2 -1
  128. package/dist/utils/upload-author.d.ts +2 -1
  129. package/dist/utils/upload-author.js +9 -5
  130. package/dist/utils/version-check.js +2 -1
  131. package/dist/utils/version-gate.js +7 -6
  132. package/package.json +7 -7
  133. package/scripts/install-hook-engine.mjs +7 -3
@@ -6036,6 +6036,11 @@ export const COMMAND_CATALOG = [
6036
6036
  "description": "Company slug (defaults to the company this HQ session is bound to)",
6037
6037
  "hidden": false
6038
6038
  },
6039
+ {
6040
+ "flags": "--personal",
6041
+ "description": "Read your recordings that are not attributed to any company (list, get, search, transcript, notes)",
6042
+ "hidden": false
6043
+ },
6039
6044
  {
6040
6045
  "flags": "--json",
6041
6046
  "description": "Output raw JSON instead of formatted text",
@@ -6154,6 +6159,26 @@ export const COMMAND_CATALOG = [
6154
6159
  "options": [],
6155
6160
  "subcommands": []
6156
6161
  },
6162
+ {
6163
+ "name": "cancel",
6164
+ "description": "Cancel a meeting bot (for example one stuck at scheduled) so the meeting can be invited again. A bot from a recurring calendar event cancels the series' upcoming bots too.",
6165
+ "aliases": [],
6166
+ "hidden": false,
6167
+ "helpOption": true,
6168
+ "helpCommand": false,
6169
+ "usage": "[options] <botId>",
6170
+ "helpText": [],
6171
+ "arguments": [
6172
+ {
6173
+ "name": "botId",
6174
+ "required": true,
6175
+ "variadic": false,
6176
+ "description": ""
6177
+ }
6178
+ ],
6179
+ "options": [],
6180
+ "subcommands": []
6181
+ },
6157
6182
  {
6158
6183
  "name": "get",
6159
6184
  "description": "Show meeting details",
@@ -7444,6 +7469,11 @@ export const COMMAND_CATALOG = [
7444
7469
  "description": "With --connect: re-add it as a connection the whole company owns",
7445
7470
  "hidden": false
7446
7471
  },
7472
+ {
7473
+ "flags": "--mcp-url <url>",
7474
+ "description": "MCP endpoint for a custom app whose install never finished (no saved endpoint)",
7475
+ "hidden": false
7476
+ },
7447
7477
  {
7448
7478
  "flags": "--json",
7449
7479
  "description": "Machine-readable output",
@@ -8914,7 +8944,7 @@ export const COMMAND_CATALOG = [
8914
8944
  },
8915
8945
  {
8916
8946
  "name": "get",
8917
- "description": "Show whether the checkpoint Stop gate is on for this company (GET /company-settings/checkpoint-gate; any member may read it) and, for an owner or admin, the two work tracking switches (GET /company-settings).",
8947
+ "description": "Show whether the checkpoint Stop gate is on for this company (GET /company-settings/checkpoint-gate; any member may read it) and, for an owner or admin, the two work tracking switches and whether the cloud ontology gardener is on (GET /company-settings).",
8918
8948
  "aliases": [],
8919
8949
  "hidden": false,
8920
8950
  "helpOption": true,
@@ -14000,7 +14030,7 @@ export const COMMAND_CATALOG = [
14000
14030
  },
14001
14031
  {
14002
14032
  "flags": "-n, --count <count>",
14003
- "description": "Maximum result count",
14033
+ "description": "Maximum result count (default 10; HQ cloud returns at most 50)",
14004
14034
  "hidden": false
14005
14035
  },
14006
14036
  {
@@ -17423,9 +17453,11 @@ export const COMMAND_CATALOG = [
17423
17453
  ]
17424
17454
  },
17425
17455
  {
17426
- "name": "lanes",
17427
- "description": "Create, supervise, and steer worker lanes; routed decision queue",
17428
- "aliases": [],
17456
+ "name": "runners",
17457
+ "description": "Detached CLI machinery that runs a conduct lane in advanced mode",
17458
+ "aliases": [
17459
+ "lanes"
17460
+ ],
17429
17461
  "hidden": false,
17430
17462
  "helpOption": true,
17431
17463
  "helpCommand": true,
@@ -22035,7 +22067,7 @@ export const COMMAND_CATALOG = [
22035
22067
  },
22036
22068
  {
22037
22069
  "flags": "--timeout <duration>",
22038
- "description": "Deadline; bare numbers are milliseconds",
22070
+ "description": "Deadline; default 30m; bare numbers are milliseconds",
22039
22071
  "hidden": false
22040
22072
  },
22041
22073
  {
@@ -23744,7 +23776,7 @@ export const COMMAND_CATALOG = [
23744
23776
  },
23745
23777
  {
23746
23778
  "name": "start",
23747
- "description": "Start the bot (via launchd when installed, else a detached process)",
23779
+ "description": "Start the bot (under hq daemon or its own launchd agent when installed, else a detached process)",
23748
23780
  "aliases": [],
23749
23781
  "hidden": false,
23750
23782
  "helpOption": true,
@@ -23770,7 +23802,7 @@ export const COMMAND_CATALOG = [
23770
23802
  },
23771
23803
  {
23772
23804
  "name": "stop",
23773
- "description": "Stop the bot process (it starts again at next login while its launchd agent is installed)",
23805
+ "description": "Stop the bot process and keep it down until hq bot start",
23774
23806
  "aliases": [],
23775
23807
  "hidden": false,
23776
23808
  "helpOption": true,
@@ -498,10 +498,10 @@ export declare const REGISTRATION_PLAN: readonly [{
498
498
  readonly exportName: "registerMeshCommand";
499
499
  }, {
500
500
  readonly type: "registrar";
501
- readonly root: "lanes";
501
+ readonly root: "runners";
502
502
  readonly parent: "program";
503
503
  readonly module: "./commands/lanes.js";
504
- readonly exportName: "registerLanesCommand";
504
+ readonly exportName: "registerRunnersCommand";
505
505
  }, {
506
506
  readonly type: "registrar";
507
507
  readonly root: "monitor";
@@ -85,7 +85,7 @@ export const REGISTRATION_PLAN = [
85
85
  { type: "registrar", root: "capacity", parent: "program", module: "./commands/capacity.js", exportName: "registerCapacityCommand" },
86
86
  { type: "registrar", root: "doctor", parent: "program", module: "./commands/doctor.js", exportName: "registerDoctorCommand" },
87
87
  { type: "registrar", root: "mesh", parent: "program", module: "./commands/mesh.js", exportName: "registerMeshCommand" },
88
- { type: "registrar", root: "lanes", parent: "program", module: "./commands/lanes.js", exportName: "registerLanesCommand" },
88
+ { type: "registrar", root: "runners", parent: "program", module: "./commands/lanes.js", exportName: "registerRunnersCommand" },
89
89
  { type: "registrar", root: "monitor", parent: "program", module: "./commands/monitor.js", exportName: "registerMonitorCommand" },
90
90
  { type: "registrar", root: "daemon", parent: "program", module: "./commands/daemon.js", exportName: "registerDaemonCommand", hidden: true },
91
91
  { type: "registrar", root: "sync-core", parent: "program", module: "./commands/sync-core.js", exportName: "registerSyncCoreCommand", hidden: true },
@@ -1057,12 +1057,18 @@ highest one across the paths.
1057
1057
  throw new Error("Pass at least one path, or --stdin with one path per line.");
1058
1058
  }
1059
1059
  if (opts.as) {
1060
- if (targets.length !== 1) {
1061
- throw new Error("--as checks one path at a time.");
1060
+ const results = [];
1061
+ for (const target of targets) {
1062
+ results.push(await runAccessForPerson(target, opts.as, opts));
1062
1063
  }
1063
- const result = await runAccessForPerson(targets[0], opts.as, opts);
1064
- console.log(opts.json ? JSON.stringify(result) : formatAccessForPerson(result));
1065
- process.exitCode = result.exitCode;
1064
+ const exitCode = results.reduce((max, row) => Math.max(max, row.exitCode), 0);
1065
+ if (opts.json) {
1066
+ console.log(JSON.stringify(results.length === 1 ? results[0] : results));
1067
+ }
1068
+ else {
1069
+ console.log(results.map(formatAccessForPerson).join("\n"));
1070
+ }
1071
+ process.exitCode = exitCode;
1066
1072
  return;
1067
1073
  }
1068
1074
  if (targets.length === 1 && !opts.stdin) {
@@ -134,6 +134,14 @@ export interface CompanyAgentView {
134
134
  entityStatus?: string;
135
135
  agentStatus?: string;
136
136
  setupPhase?: string;
137
+ /** "hosted" | "external" | "local" (local bots have no agentStatus). */
138
+ runtimeKind?: string;
139
+ /** Local bots only: server-derived liveness. */
140
+ local?: {
141
+ online?: boolean;
142
+ lastSeenAt?: string | null;
143
+ lastHeartbeatAt?: string | null;
144
+ };
137
145
  provider?: string;
138
146
  codexModel?: string;
139
147
  codexReasoningEffort?: string;
@@ -266,6 +266,11 @@ export function rosterStatusLabel(agent) {
266
266
  return "removing";
267
267
  if (agent.setupPhase === "deprovisioned")
268
268
  return "removed";
269
+ // A local bot (runtimeKind "local") has no box and no agentStatus; the
270
+ // server reports its liveness (heartbeat or last own inbox use) instead.
271
+ if (agent.runtimeKind === "local") {
272
+ return agent.local?.online === true ? "online" : "offline";
273
+ }
269
274
  return agent.agentStatus ?? "";
270
275
  }
271
276
  /**
@@ -133,6 +133,14 @@ export declare function hotSignalSyncRole(name: string, config: BotConfig, execu
133
133
  executiveCompanies?: string[];
134
134
  otherBotDirs: string[];
135
135
  };
136
+ /**
137
+ * After a bot is removed, re-run the HQ Fleet Runtime job setup for every
138
+ * other enabled Fleet Runtime bot here, so a company whose hot-signal-sync the
139
+ * removed bot held is picked up by a bot that still runs. Best effort: a bot
140
+ * that is busy (its lock is held) or held for promotion is left for its next
141
+ * start. Returns the names it re-checked.
142
+ */
143
+ export declare function resyncHotSignalSyncAfterRemoval(removed: string, sync?: (name: string, dir: string, config: BotConfig) => void): Promise<string[]>;
136
144
  /** Bot-identity token supplier: per-bot creds + per-bot token cache dir. */
137
145
  export declare function botTokenSupplier(dir: string): () => Promise<string>;
138
146
  /**
@@ -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