@cotal-ai/cli 0.172.2 → 0.173.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 (107) hide show
  1. package/dist/command.d.ts.map +1 -1
  2. package/dist/command.js +15 -7
  3. package/dist/command.js.map +1 -1
  4. package/dist/commands/backup.d.ts.map +1 -1
  5. package/dist/commands/backup.js +15 -10
  6. package/dist/commands/backup.js.map +1 -1
  7. package/dist/commands/channels.d.ts.map +1 -1
  8. package/dist/commands/channels.js +8 -2
  9. package/dist/commands/channels.js.map +1 -1
  10. package/dist/commands/clean.d.ts.map +1 -1
  11. package/dist/commands/clean.js +1 -2
  12. package/dist/commands/clean.js.map +1 -1
  13. package/dist/commands/doctor.js +5 -2
  14. package/dist/commands/doctor.js.map +1 -1
  15. package/dist/commands/down-preserve.d.ts +74 -0
  16. package/dist/commands/down-preserve.d.ts.map +1 -0
  17. package/dist/commands/down-preserve.js +626 -0
  18. package/dist/commands/down-preserve.js.map +1 -0
  19. package/dist/commands/down.d.ts +2 -61
  20. package/dist/commands/down.d.ts.map +1 -1
  21. package/dist/commands/down.js +10 -621
  22. package/dist/commands/down.js.map +1 -1
  23. package/dist/commands/meshes-add.d.ts +2 -3
  24. package/dist/commands/meshes-add.d.ts.map +1 -1
  25. package/dist/commands/meshes-add.js +3 -19
  26. package/dist/commands/meshes-add.js.map +1 -1
  27. package/dist/commands/space-registration.d.ts.map +1 -1
  28. package/dist/commands/space-registration.js +8 -8
  29. package/dist/commands/space-registration.js.map +1 -1
  30. package/dist/commands/space.d.ts.map +1 -1
  31. package/dist/commands/space.js +15 -5
  32. package/dist/commands/space.js.map +1 -1
  33. package/dist/commands/spawn-preview.d.ts.map +1 -1
  34. package/dist/commands/spawn-preview.js +5 -5
  35. package/dist/commands/spawn-preview.js.map +1 -1
  36. package/dist/commands/spawn.d.ts.map +1 -1
  37. package/dist/commands/spawn.js +3 -3
  38. package/dist/commands/spawn.js.map +1 -1
  39. package/dist/commands/stack-up.d.ts +3 -1
  40. package/dist/commands/stack-up.d.ts.map +1 -1
  41. package/dist/commands/stack-up.js +37 -10
  42. package/dist/commands/stack-up.js.map +1 -1
  43. package/dist/commands/status-delivery.d.ts +9 -0
  44. package/dist/commands/status-delivery.d.ts.map +1 -0
  45. package/dist/commands/status-delivery.js +19 -0
  46. package/dist/commands/status-delivery.js.map +1 -0
  47. package/dist/commands/status-legacy.d.ts +7 -0
  48. package/dist/commands/status-legacy.d.ts.map +1 -0
  49. package/dist/commands/status-legacy.js +35 -0
  50. package/dist/commands/status-legacy.js.map +1 -0
  51. package/dist/commands/status.d.ts.map +1 -1
  52. package/dist/commands/status.js +29 -65
  53. package/dist/commands/status.js.map +1 -1
  54. package/dist/commands/team-agent-apply.js +11 -11
  55. package/dist/commands/team-agent-apply.js.map +1 -1
  56. package/dist/commands/team-deploy-apply.js +2 -2
  57. package/dist/commands/team-deploy-apply.js.map +1 -1
  58. package/dist/commands/team.js +12 -19
  59. package/dist/commands/team.js.map +1 -1
  60. package/dist/commands/up.d.ts +2 -0
  61. package/dist/commands/up.d.ts.map +1 -1
  62. package/dist/commands/up.js +11 -30
  63. package/dist/commands/up.js.map +1 -1
  64. package/dist/commands/update.js +6 -6
  65. package/dist/commands/update.js.map +1 -1
  66. package/dist/commands/watch.d.ts.map +1 -1
  67. package/dist/commands/watch.js +5 -2
  68. package/dist/commands/watch.js.map +1 -1
  69. package/dist/commands/whoami.d.ts.map +1 -1
  70. package/dist/commands/whoami.js +3 -2
  71. package/dist/commands/whoami.js.map +1 -1
  72. package/dist/help.d.ts +1 -1
  73. package/dist/help.d.ts.map +1 -1
  74. package/dist/help.js +3 -1
  75. package/dist/help.js.map +1 -1
  76. package/dist/index.d.ts.map +1 -1
  77. package/dist/index.js +3 -2
  78. package/dist/index.js.map +1 -1
  79. package/dist/lib/choose-target.d.ts.map +1 -1
  80. package/dist/lib/choose-target.js +12 -9
  81. package/dist/lib/choose-target.js.map +1 -1
  82. package/dist/lib/endpoint-errors.d.ts.map +1 -1
  83. package/dist/lib/endpoint-errors.js +9 -2
  84. package/dist/lib/endpoint-errors.js.map +1 -1
  85. package/dist/lib/persona-files.d.ts.map +1 -1
  86. package/dist/lib/persona-files.js +2 -3
  87. package/dist/lib/persona-files.js.map +1 -1
  88. package/dist/lib/spawn-defaults.d.ts +2 -0
  89. package/dist/lib/spawn-defaults.d.ts.map +1 -1
  90. package/dist/lib/spawn-defaults.js +11 -0
  91. package/dist/lib/spawn-defaults.js.map +1 -1
  92. package/dist/lib/stack-journal.d.ts.map +1 -1
  93. package/dist/lib/stack-journal.js +10 -1
  94. package/dist/lib/stack-journal.js.map +1 -1
  95. package/dist/lib/store-dir.d.ts +3 -1
  96. package/dist/lib/store-dir.d.ts.map +1 -1
  97. package/dist/lib/store-dir.js +20 -4
  98. package/dist/lib/store-dir.js.map +1 -1
  99. package/dist/lib/team-deploy-inspection.d.ts +2 -1
  100. package/dist/lib/team-deploy-inspection.d.ts.map +1 -1
  101. package/dist/lib/team-deploy-inspection.js +6 -1
  102. package/dist/lib/team-deploy-inspection.js.map +1 -1
  103. package/dist/seed/launch.d.ts +1 -1
  104. package/dist/seed/launch.d.ts.map +1 -1
  105. package/dist/seed/launch.js +3 -3
  106. package/dist/seed/launch.js.map +1 -1
  107. package/package.json +4 -4
@@ -1,17 +1,18 @@
1
- import { accessSync, constants, existsSync, lstatSync, statSync } from "node:fs";
1
+ import { accessSync, constants, existsSync, lstatSync } from "node:fs";
2
2
  import { drainAndClose } from "@cotal-ai/core";
3
3
  import { homedir } from "node:os";
4
4
  import { join } from "node:path";
5
5
  import { CotalEndpoint, agentFilePath, dialerFor, EpEnvelopeError, formatAge, globalConfigDir, isReachable, isStreamNotFound, mintCreds, mintLifecycleUid, resolveService, realDirNoSymlink, invokeRepairingSplit, standaloneConnectOpts, newIdentity, idFromCreds, principalKey, DEV_OWNER, unansweredRequest, resolveAuthProvider, personaDir, } from "@cotal-ai/core";
6
- import { stoppedLoopbackListener, UnreadableConnectorSelection, stackRunsUnderOtherHome, accountInventory, authDir, isCommandFailure, readMaintenanceJournal, recordsElsewhereError, recordsElsewhereText, restoreRolledBackRuns, targetErrorSpace, brokerAddressForDisplay, brokerCheck, brokerUrlKey, canonicalRoot, CLI_USER_ACTOR, codeSpan, credentialFileExposure, CommandFailure, deliveryCredsKey, DELIVERY_PIDFILE, extensionsDir, findCotalRoot, folderSpaceOverSelection, isGenuineSpace, meshesForRoot, resolveReadsLiveness, stoppedStack, unsettledStackOperation, withdrawOperationNote, hasUserAuthState, homeCotalDir, installationWriter, cachedPreferences, loadLaunchPersonaFile, resolvePreference, isMeshRegistryError, isWorkspaceTargetError, jsonFlag, loadManagerInstanceIdentity, loadSoleSpaceAuth, localProcessPath, localProcessVisible, MANAGER_PIDFILE, NATS_PIDFILE, OFFICIAL_CONNECTORS, oneLine, spaceKey, PREFERENCE_KEYS, plainFlag, preflightTarget, preparedNeverStarted, presentationOf, principalFromBearer, verifyIdentityPin, probeWebReadiness, readCurrent, readMeshRegistry, readPidfile, preparedRecordSkipped, readPreparedSpaces, stackJournalPath, readRenewalRecord, recordOperationSpace, resolveMeshTarget, serverFlag, spaceFlag, userAuthStateDir, WEB_PIDFILE, workspaceSecretStore, displayWidth, terminalWidth, wrapWords, writeResult, workspaceErrorParts, preferencesPath, preferencesFolderWarning, cotalDirLink, movedProject, spaceStreamsAbsent, spaceStreamsExpected, resolveControlTarget, } from "@cotal-ai/workspace";
6
+ import { stoppedLoopbackListener, UnreadableConnectorSelection, stackRunsUnderOtherHome, accountInventory, authDir, isCommandFailure, readMaintenanceJournal, recordsElsewhereError, recordsElsewhereText, restoreRolledBackRuns, targetErrorSpace, brokerAddressForDisplay, brokerCheck, brokerUrlKey, canonicalRoot, CLI_USER_ACTOR, codeSpan, credentialFileExposure, CommandFailure, deliveryCredsKey, DELIVERY_PIDFILE, extensionsDir, findCotalRoot, folderSpaceOverSelection, isGenuineSpace, meshesForRoot, resolveReadsLiveness, stoppedStack, unsettledStackOperation, withdrawOperationNote, hasUserAuthState, homeCotalDir, installationWriter, cachedPreferences, loadLaunchPersonaFile, resolvePreference, isMeshRegistryError, isWorkspaceTargetError, jsonFlag, loadManagerInstanceIdentity, loadSoleSpaceAuth, localProcessPath, localProcessVisible, MANAGER_PIDFILE, NATS_PIDFILE, OFFICIAL_CONNECTORS, oneLine, PREFERENCE_KEYS, plainFlag, preflightTarget, preparedNeverStarted, presentationOf, principalFromBearer, verifyIdentityPin, probeWebReadiness, readCurrent, readMeshRegistry, readPidfile, preparedRecordSkipped, readPreparedSpaces, stackJournalPath, readRenewalRecord, recordOperationSpace, resolveMeshTarget, serverFlag, spaceFlag, userAuthStateDir, WEB_PIDFILE, workspaceSecretStore, displayWidth, terminalWidth, wrapWords, writeResult, workspaceErrorParts, preferencesPath, preferencesFolderWarning, cotalDirLink, movedProject, spaceStreamsAbsent, spaceStreamsExpected, resolveControlTarget, } from "@cotal-ai/workspace";
7
7
  import { localProcessSurface } from "../ext-loader.js";
8
8
  import { cliVersion, cliProvenance, readExtensionVersions } from "../lib/version.js";
9
9
  import { agentSkillsSkew } from "../lib/agent-skills.js";
10
- import { managerHasDeliveryMarker, managerLogPath } from "../lib/manager-proc.js";
10
+ import { managerHasDeliveryMarker } from "../lib/manager-proc.js";
11
11
  import { MANAGER_OMITTED } from "../lib/delivery-proc.js";
12
12
  import { signedInSpace } from "../lib/conversation-identity.js";
13
- import { connectorHarnesses, connectorStatusRows, machineStatus, recordedWebUrl, resolveRuntimeSpace, webBoundAddress, webInstalled, webSessionSource } from "../lib/status.js";
14
- import { deliveryResponderFromLease, deliveryResponderState, deliveryRowSuffix, RESPONDER_STALE_TEXT, RESPONDER_UNBOUND_CONSEQUENCE } from "../lib/delivery-responder.js";
13
+ import { connectorHarnesses, connectorStatusRows, machineStatus, recordedWebUrl, webBoundAddress, webInstalled, webSessionSource } from "../lib/status.js";
14
+ import { legacyManagerStopped, statusRuntimeSpace } from "./status-legacy.js";
15
+ import { deliveryResponderFromLease, deliveryResponderState, deliveryRowSuffix, RESPONDER_UNBOUND_CONSEQUENCE } from "../lib/delivery-responder.js";
15
16
  import { brokerStoreWrite, storeFull, storeWriteRepair } from "../lib/broker-store-health.js";
16
17
  import { chatStreamGone, stackState } from "../lib/space-streams.js";
17
18
  import { pidfileState } from "./down.js";
@@ -42,6 +43,7 @@ import { askManager } from "@cotal-ai/workspace/control";
42
43
  import { readCursor } from "../seed/lock.js";
43
44
  import { reconcileCursorPath } from "../seed/paths.js";
44
45
  import { managerStopImpactFacts } from "./status-stop-impact.js";
46
+ import { responderText } from "./status-delivery.js";
45
47
  /** `--components` is the fail-loud health pass with a machine-readable EXIT DISPOSITION. Bare
46
48
  * `status` is a broad, recovery-oriented report: it exits 0, or 4 when it could not read part of what
47
49
  * it reports; this explicit mode is for an operator or monitor that needs a component state per
@@ -324,7 +326,7 @@ export async function status(args) {
324
326
  recovery,
325
327
  }));
326
328
  if (values.components)
327
- await printComponentHealth(selected, store);
329
+ await printComponentHealth(selected, store, target.resolved && target.connection === "unreachable");
328
330
  }
329
331
  /** Why this account cannot list or search `root`, or undefined when it can. */
330
332
  function folderReadProblem(root) {
@@ -750,7 +752,7 @@ async function readFolder(root, selected, values, responder, gaps, hints) {
750
752
  // report that state and stop rather than crashing in the recovery command that names it.
751
753
  let space;
752
754
  try {
753
- space = auth?.space ?? resolveRuntimeSpace(root);
755
+ space = auth?.space ?? statusRuntimeSpace(root, selected.ok ? selected.target : undefined);
754
756
  }
755
757
  catch (e) {
756
758
  hints.push(e.message);
@@ -823,7 +825,7 @@ async function readFolder(root, selected, values, responder, gaps, hints) {
823
825
  const managerIndex = !unusable && !controllerStack && (nats?.liveness === "alive" || nats?.liveness === "dead")
824
826
  ? processes.findIndex((row) => row.name === "manager" && row.state === "stopped" && row.pid === null)
825
827
  : -1;
826
- if (managerIndex !== -1 && legacyManagerStopped(root, space))
828
+ if (managerIndex !== -1 && legacyManagerStopped(root, space, localManagerInstanceId(root, space)))
827
829
  processes[managerIndex] = { ...processes[managerIndex], detail: "stopped" };
828
830
  const noManager = journal !== undefined && controllerStack && stackStartedWithoutManager(journal);
829
831
  // An operation cut off with no recorded outcome can keep up and down from settling it; status names
@@ -1068,28 +1070,6 @@ function localManagerInstanceId(root, space) {
1068
1070
  return undefined;
1069
1071
  }
1070
1072
  }
1071
- /** Whether the legacy stack whose broker pidfile is in `root` started a manager that has since
1072
- * exited and removed its pidfile (as SIGTERM does), rather than running with `--no-manager`. */
1073
- function legacyManagerStopped(root, space) {
1074
- const id = localManagerInstanceId(root, space);
1075
- if (id === undefined)
1076
- return false;
1077
- let brokerMtime;
1078
- try {
1079
- brokerMtime = statSync(join(root, ".cotal", NATS_PIDFILE), { bigint: true }).mtimeNs;
1080
- }
1081
- catch {
1082
- return false;
1083
- }
1084
- for (const path of [managerLogPath(space, root), join(root, ".cotal", `manager-execution.${spaceKey(space)}.${id}.json`)]) {
1085
- try {
1086
- if (statSync(path, { bigint: true }).mtimeNs >= brokerMtime)
1087
- return true;
1088
- }
1089
- catch { /* absent or unreadable candidate */ }
1090
- }
1091
- return false;
1092
- }
1093
1073
  /** User-mode manager status goes through the same control call `cotal spawn` uses. `instanceId`
1094
1074
  * pins that call to this machine's manager. Without it, the exchange may select another live
1095
1075
  * manager of the same owner. */
@@ -1737,30 +1717,6 @@ function meshesSections(m) {
1737
1717
  sections.push({ title: "Space Catalog Accounts", blocks: [{ kind: "lines", lines: m.catalogs.map((r) => `${r.idp} ${r.state}${r.error ? `: ${r.error}` : ""}`) }] });
1738
1718
  return sections;
1739
1719
  }
1740
- /** The selected space's delivery responder (#1576). Bare status and the verbose mesh section both
1741
- * state it, so an operator on a manager host away from the broker's folder still sees it. An open
1742
- * mesh runs no delivery daemon, so with no lease recorded its row says the responder is not used
1743
- * rather than unbound. */
1744
- function responderText(state, mode, stackBlocked = false, deliveryPid, storeFull = false) {
1745
- if (state === null && mode === "open")
1746
- return { text: "not used - an open mesh runs no delivery daemon", tone: "hint" };
1747
- // A running delivery member with no lease is starting or not responding. Status cannot ask it which,
1748
- // and `up` starts no second daemon beside it.
1749
- if (state === "unbound" && deliveryPid !== undefined)
1750
- return { text: `no lease · stack-delivery pid ${deliveryPid} is alive but holds no lease, so it is starting or not responding`, tone: "failed" };
1751
- // While this folder's stack is blocked, `up` refuses, so the row names the block Next clears. A full
1752
- // store refuses the daemon's lease as every other write, so `up` starts it only once there is room.
1753
- if (state === "unbound")
1754
- return { text: `NOT BOUND - ${RESPONDER_UNBOUND_CONSEQUENCE} · ${stackBlocked ? `\`${displayCmd()} up\` refuses until the stack block is cleared, as Next shows` : storeFull ? `the full store refuses its lease, so \`${displayCmd()} up\` starts it only once there is room, as Next shows` : `start it with \`${displayCmd()} up\``}`, tone: "failed" };
1755
- // A stale record is NOT BOUND with a different next move: the slot is occupied by a corpse, so
1756
- // starting a daemon now loses the single-flight CAS. Say that, rather than sending the operator
1757
- // into a refusal they will read as a second failure.
1758
- if (state === "stale")
1759
- return { text: `NOT BOUND - ${RESPONDER_STALE_TEXT} · \`${displayCmd()} up\` restarts it, after waiting out the lease`, tone: "failed" };
1760
- if (state === "bound")
1761
- return { text: "bound", tone: "ok" };
1762
- return undefined;
1763
- }
1764
1720
  /** The pid of the selected space's running stack delivery member, from its owned service record. */
1765
1721
  function stackDeliveryPid(r) {
1766
1722
  return r.services?.instances?.find((item) => item.definition === STACK_DEFINITION.delivery && item.observedProcess === "running")?.pid ?? undefined;
@@ -2163,7 +2119,7 @@ function nextActions(r, seedFailed, interactive, recovery, preparedHarness) {
2163
2119
  if (!noApplication) {
2164
2120
  if (s.personas.default !== "missing" && s.personas.default !== "valid")
2165
2121
  items.push({ command: `${cmd} persona show default --space ${shellWord(s.space)}`, description: "See what is wrong with the default persona" });
2166
- else if (reachable)
2122
+ else if (reachable && s.deliveryResponder !== "unbound" && s.deliveryResponder !== "stale")
2167
2123
  items.push({ command: `${cmd} spawn`, description: s.personas.default === "missing" ? "Open your default agent; creates the shipped default persona" : "Open your default agent" });
2168
2124
  }
2169
2125
  if (reachable)
@@ -2196,12 +2152,10 @@ function nextActions(r, seedFailed, interactive, recovery, preparedHarness) {
2196
2152
  // This folder's own stack is blocked the same way under another selection, and its block leads too.
2197
2153
  const blocked = stack ?? folderStack(r.folder, r.selected);
2198
2154
  const block = blocked ? r.folder.stackBlock : undefined;
2199
- // A legacy static-auth stack started here whose broker or manager exited leaves its pidfile, and a
2200
- // bare `up` in this folder starts it again on the address and store this machine recorded. An open
2201
- // refresh restarts no manager, and an open or user-auth broker needs its mode flag again.
2202
- const local = r.selected.resolved && r.selected.mode === "auth" && !r.folder.controllerStack && r.folder.root === r.selected.root && r.folder.processSpace === r.selected.space
2203
- && !["manual", "catalog"].includes(r.meshes.items.find((m) => m.space === r.selected.space)?.origin ?? "up");
2204
- const exited = local ? (r.folder.processes ?? []).filter((row) => (row.name === "nats" || row.name === "manager") && row.state === "stopped" && (row.pid !== null || row.detail === "stopped")).map((row) => row.name) : [];
2155
+ const origin = r.meshes.items.find((m) => m.space === dialed?.space)?.origin;
2156
+ const legacy = dialed && !r.folder.controllerStack && r.folder.root === dialed.root && r.folder.processSpace === dialed.space;
2157
+ const local = legacy && dialed.mode === "auth" && !["manual", "catalog"].includes(origin ?? "up");
2158
+ const exited = legacy ? (r.folder.processes ?? []).filter((row) => (row.name === "nats" || row.name === "manager") && row.state === "stopped" && (row.pid !== null || row.detail === "stopped")).map((row) => row.name) : [];
2205
2159
  const storeBlocked = !elsewhere && r.selected.resolved && r.selected.connection === "unreachable" && rootStoreProblem(r.selected.root) !== undefined;
2206
2160
  if (r.selected.resolved && r.selected.connection === "broker-stopped")
2207
2161
  items.unshift({ command: `kill -CONT ${r.selected.brokerPid}`, description: "Resume the stopped broker process so it answers again" });
@@ -2239,7 +2193,10 @@ function nextActions(r, seedFailed, interactive, recovery, preparedHarness) {
2239
2193
  const held = r.folder.heldServices ?? [], space = r.selected.space;
2240
2194
  items.unshift(...held.map((row) => ({ command: `${cmd} svc stop ${row.definition} --instance ${row.instanceId} --space ${shellWord(space)} --yes`, description: `Stop the ${row.definition} service, which runs this root's ${row.record} (pid ${row.pid}) outside the stack` })), { command: `${cmd} up --root ${shellWord(r.selected.root)}${r.folder.noManager ? " --no-manager" : ""}`, description: held.length ? "Then restart this stack's stopped members from its recorded inputs" : "Restart this stack's stopped members from its recorded inputs" });
2241
2195
  }
2242
- else if (!storeBlocked && !seedBlocksRestart && exited.length) {
2196
+ else if (!elsewhere && legacy && dialed.mode === "open" && origin === "up" && exited.includes("manager") && r.folder.processes?.some((row) => row.name === "nats" && row.state === "running")) {
2197
+ items.unshift({ command: `${cmd} down --yes`, description: "Stop this folder's broker so the exited manager can be restarted" }, { command: `${cmd} up --foreground`, description: "Then start the stack with its manager" });
2198
+ }
2199
+ else if (!storeBlocked && !seedBlocksRestart && local && exited.length) {
2243
2200
  const broker = exited.includes("nats"), manager = exited.includes("manager");
2244
2201
  const notes = [...(broker ? ["up reopens the recorded store"] : []), ...(manager ? ["pass --runtime again if the manager ran on one"] : [])];
2245
2202
  items.unshift({ command: `${cmd} up`, description: `Restart this folder's ${broker && manager ? "broker and manager" : broker ? "broker" : "manager"}, which exited; ${notes.join("; ")}` });
@@ -2249,6 +2206,11 @@ function nextActions(r, seedFailed, interactive, recovery, preparedHarness) {
2249
2206
  // bare `up` that starts it again on its recorded address and store comes first.
2250
2207
  items.unshift({ command: `${cmd} up`, description: "Start this folder's stopped stack again; pass --runtime again if the manager ran on one" });
2251
2208
  }
2209
+ else if (!seedBlocksRestart && !elsewhere && local && r.selected.resolved && r.selected.connection === "ok" && r.store?.state !== "full" && r.store?.state !== "write-failed"
2210
+ && (r.selected.deliveryResponder === "unbound" || r.selected.deliveryResponder === "stale")
2211
+ && r.folder.processes?.some((row) => row.name === "delivery" && row.state === "stopped")) {
2212
+ items.unshift({ command: `${cmd} up`, description: "Restore the delivery responder" });
2213
+ }
2252
2214
  // A stack whose folder was deleted stops only from this machine's records.
2253
2215
  if (r.selected.resolved && r.selected.rootGone)
2254
2216
  items.unshift({ command: `${cmd} down --space ${shellWord(r.selected.space)} --yes`, description: "Stop the stack whose folder is gone and free its name" });
@@ -2657,7 +2619,7 @@ export function deliveryLeaseAbsent(e) {
2657
2619
  /** Delivery owns two answers: its ready lease is its liveness/control surface; its latest explicit
2658
2620
  * adoption report is the renewal record it writes through the manager-owned renewal pass. The
2659
2621
  * latter is intentionally not inferred from credential mtime or process output. */
2660
- async function deliveryHealth(target, context, credential) {
2622
+ async function deliveryHealth(target, context, credential, brokerOffline) {
2661
2623
  const record = processRecord(DELIVERY_PIDFILE, context);
2662
2624
  const facts = pidFacts(record);
2663
2625
  const stopped = processVerdict(record);
@@ -2678,6 +2640,8 @@ async function deliveryHealth(target, context, credential) {
2678
2640
  facts.push(renewal.adoption.ok ? "renewal adoption accepted" : `renewal adoption refused${renewal.adoption.error ? `: ${renewal.adoption.error}` : ""}`);
2679
2641
  const renewalRefused = renewal?.adoption?.ok === false;
2680
2642
  if (target.mode === "open" && record.kind === "absent" && !renewalRefused) {
2643
+ if (brokerOffline)
2644
+ return { name: "delivery", verdict: "not-started", facts: ["not used on an open mesh"] };
2681
2645
  if (credential.kind === "unavailable")
2682
2646
  return { name: "delivery", verdict: "refused", facts: [credential.reason] };
2683
2647
  try {
@@ -2875,7 +2839,7 @@ async function brokerHealth(target, store) {
2875
2839
  return { name: "broker", verdict: "refused", facts: [`registered ${address}`, `probe refused: ${e.message}`] };
2876
2840
  }
2877
2841
  }
2878
- async function printComponentHealth(selected, store) {
2842
+ async function printComponentHealth(selected, store, brokerUnreachable) {
2879
2843
  section("Component Health");
2880
2844
  if (!selected.ok) {
2881
2845
  const e = selected.error;
@@ -2912,7 +2876,7 @@ async function printComponentHealth(selected, store) {
2912
2876
  const broker = await brokerHealth(target, store);
2913
2877
  const components = await Promise.all([
2914
2878
  managerHealth(target, context, credential, broker),
2915
- deliveryHealth(target, context, credential),
2879
+ deliveryHealth(target, context, credential, brokerUnreachable && broker.verdict === "absent"),
2916
2880
  webHealth(context),
2917
2881
  broker,
2918
2882
  ]);