@cotal-ai/cli 0.91.0 → 0.92.1

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 (222) hide show
  1. package/dist/chat/chat-view.d.ts.map +1 -1
  2. package/dist/chat/chat-view.js +3 -3
  3. package/dist/chat/chat-view.js.map +1 -1
  4. package/dist/chat/controller.d.ts +2 -1
  5. package/dist/chat/controller.d.ts.map +1 -1
  6. package/dist/chat/controller.js +29 -13
  7. package/dist/chat/controller.js.map +1 -1
  8. package/dist/chat/engine.d.ts +12 -10
  9. package/dist/chat/engine.d.ts.map +1 -1
  10. package/dist/chat/engine.js +17 -19
  11. package/dist/chat/engine.js.map +1 -1
  12. package/dist/chat/frontend.d.ts.map +1 -1
  13. package/dist/chat/frontend.js +17 -2
  14. package/dist/chat/frontend.js.map +1 -1
  15. package/dist/chat/native-session.d.ts +25 -3
  16. package/dist/chat/native-session.d.ts.map +1 -1
  17. package/dist/chat/native-session.js +72 -31
  18. package/dist/chat/native-session.js.map +1 -1
  19. package/dist/chat/picker.d.ts +4 -3
  20. package/dist/chat/picker.d.ts.map +1 -1
  21. package/dist/chat/picker.js +7 -5
  22. package/dist/chat/picker.js.map +1 -1
  23. package/dist/chat/plain.d.ts.map +1 -1
  24. package/dist/chat/plain.js +16 -9
  25. package/dist/chat/plain.js.map +1 -1
  26. package/dist/chat/session.d.ts +6 -1
  27. package/dist/chat/session.d.ts.map +1 -1
  28. package/dist/chat/stdio-io.d.ts +3 -2
  29. package/dist/chat/stdio-io.d.ts.map +1 -1
  30. package/dist/chat/stdio-io.js +3 -2
  31. package/dist/chat/stdio-io.js.map +1 -1
  32. package/dist/chat/stdio.d.ts.map +1 -1
  33. package/dist/chat/stdio.js +2 -1
  34. package/dist/chat/stdio.js.map +1 -1
  35. package/dist/chat/view.d.ts +37 -6
  36. package/dist/chat/view.d.ts.map +1 -1
  37. package/dist/chat/view.js +69 -22
  38. package/dist/chat/view.js.map +1 -1
  39. package/dist/command.d.ts.map +1 -1
  40. package/dist/command.js +5 -2
  41. package/dist/command.js.map +1 -1
  42. package/dist/commands/agents.d.ts.map +1 -1
  43. package/dist/commands/agents.js +5 -0
  44. package/dist/commands/agents.js.map +1 -1
  45. package/dist/commands/backup-maintenance.d.ts.map +1 -1
  46. package/dist/commands/backup-maintenance.js +4 -3
  47. package/dist/commands/backup-maintenance.js.map +1 -1
  48. package/dist/commands/backup-read.d.ts.map +1 -1
  49. package/dist/commands/backup-read.js +4 -1
  50. package/dist/commands/backup-read.js.map +1 -1
  51. package/dist/commands/backup-restore.d.ts.map +1 -1
  52. package/dist/commands/backup-restore.js +7 -10
  53. package/dist/commands/backup-restore.js.map +1 -1
  54. package/dist/commands/backup.d.ts.map +1 -1
  55. package/dist/commands/backup.js +22 -9
  56. package/dist/commands/backup.js.map +1 -1
  57. package/dist/commands/describe.d.ts.map +1 -1
  58. package/dist/commands/describe.js +10 -4
  59. package/dist/commands/describe.js.map +1 -1
  60. package/dist/commands/doctor.d.ts.map +1 -1
  61. package/dist/commands/doctor.js +1 -1
  62. package/dist/commands/doctor.js.map +1 -1
  63. package/dist/commands/down.d.ts.map +1 -1
  64. package/dist/commands/down.js +119 -13
  65. package/dist/commands/down.js.map +1 -1
  66. package/dist/commands/endpoint-authoring.d.ts +2 -0
  67. package/dist/commands/endpoint-authoring.d.ts.map +1 -1
  68. package/dist/commands/endpoint-authoring.js +6 -1
  69. package/dist/commands/endpoint-authoring.js.map +1 -1
  70. package/dist/commands/history-clear.d.ts.map +1 -1
  71. package/dist/commands/history-clear.js +3 -2
  72. package/dist/commands/history-clear.js.map +1 -1
  73. package/dist/commands/history.d.ts.map +1 -1
  74. package/dist/commands/history.js +1 -7
  75. package/dist/commands/history.js.map +1 -1
  76. package/dist/commands/meshes-add.d.ts.map +1 -1
  77. package/dist/commands/meshes-add.js +3 -1
  78. package/dist/commands/meshes-add.js.map +1 -1
  79. package/dist/commands/mint-endpoint-caller.js +2 -2
  80. package/dist/commands/mint-endpoint-caller.js.map +1 -1
  81. package/dist/commands/reset-space-apply.d.ts.map +1 -1
  82. package/dist/commands/reset-space-apply.js +43 -56
  83. package/dist/commands/reset-space-apply.js.map +1 -1
  84. package/dist/commands/reset-store-apply.d.ts +24 -0
  85. package/dist/commands/reset-store-apply.d.ts.map +1 -1
  86. package/dist/commands/reset-store-apply.js +115 -53
  87. package/dist/commands/reset-store-apply.js.map +1 -1
  88. package/dist/commands/reset.d.ts.map +1 -1
  89. package/dist/commands/reset.js +30 -18
  90. package/dist/commands/reset.js.map +1 -1
  91. package/dist/commands/service-actions.d.ts.map +1 -1
  92. package/dist/commands/service-actions.js +13 -5
  93. package/dist/commands/service-actions.js.map +1 -1
  94. package/dist/commands/service-log-follow.d.ts.map +1 -1
  95. package/dist/commands/service-log-follow.js +3 -2
  96. package/dist/commands/service-log-follow.js.map +1 -1
  97. package/dist/commands/service-registry.js +1 -1
  98. package/dist/commands/service-registry.js.map +1 -1
  99. package/dist/commands/service-set-stop.d.ts.map +1 -1
  100. package/dist/commands/service-set-stop.js +5 -2
  101. package/dist/commands/service-set-stop.js.map +1 -1
  102. package/dist/commands/space-delete.d.ts.map +1 -1
  103. package/dist/commands/space-delete.js +50 -5
  104. package/dist/commands/space-delete.js.map +1 -1
  105. package/dist/commands/space-registration.d.ts.map +1 -1
  106. package/dist/commands/space-registration.js +14 -8
  107. package/dist/commands/space-registration.js.map +1 -1
  108. package/dist/commands/spawn.d.ts +4 -4
  109. package/dist/commands/spawn.d.ts.map +1 -1
  110. package/dist/commands/spawn.js +20 -13
  111. package/dist/commands/spawn.js.map +1 -1
  112. package/dist/commands/stack-down.d.ts +15 -1
  113. package/dist/commands/stack-down.d.ts.map +1 -1
  114. package/dist/commands/stack-down.js +156 -49
  115. package/dist/commands/stack-down.js.map +1 -1
  116. package/dist/commands/stack-up.d.ts +7 -2
  117. package/dist/commands/stack-up.d.ts.map +1 -1
  118. package/dist/commands/stack-up.js +63 -24
  119. package/dist/commands/stack-up.js.map +1 -1
  120. package/dist/commands/status.d.ts +12 -0
  121. package/dist/commands/status.d.ts.map +1 -1
  122. package/dist/commands/status.js +71 -17
  123. package/dist/commands/status.js.map +1 -1
  124. package/dist/commands/team-boot-controller.js +1 -1
  125. package/dist/commands/team-boot-controller.js.map +1 -1
  126. package/dist/commands/team.js +4 -3
  127. package/dist/commands/team.js.map +1 -1
  128. package/dist/commands/up.d.ts +2 -1
  129. package/dist/commands/up.d.ts.map +1 -1
  130. package/dist/commands/up.js +117 -16
  131. package/dist/commands/up.js.map +1 -1
  132. package/dist/commands/update.d.ts +2 -0
  133. package/dist/commands/update.d.ts.map +1 -1
  134. package/dist/commands/update.js +20 -9
  135. package/dist/commands/update.js.map +1 -1
  136. package/dist/index.d.ts +1 -0
  137. package/dist/index.d.ts.map +1 -1
  138. package/dist/index.js +2 -1
  139. package/dist/index.js.map +1 -1
  140. package/dist/lib/backup-artifact.d.ts +7 -0
  141. package/dist/lib/backup-artifact.d.ts.map +1 -1
  142. package/dist/lib/backup-artifact.js +29 -5
  143. package/dist/lib/backup-artifact.js.map +1 -1
  144. package/dist/lib/broker-service.d.ts +9 -0
  145. package/dist/lib/broker-service.d.ts.map +1 -1
  146. package/dist/lib/broker-service.js +64 -24
  147. package/dist/lib/broker-service.js.map +1 -1
  148. package/dist/lib/confirmation-required.d.ts +13 -0
  149. package/dist/lib/confirmation-required.d.ts.map +1 -0
  150. package/dist/lib/confirmation-required.js +10 -0
  151. package/dist/lib/confirmation-required.js.map +1 -0
  152. package/dist/lib/credential-authority.d.ts.map +1 -1
  153. package/dist/lib/credential-authority.js +5 -4
  154. package/dist/lib/credential-authority.js.map +1 -1
  155. package/dist/lib/delivery-proc.d.ts.map +1 -1
  156. package/dist/lib/delivery-proc.js +36 -5
  157. package/dist/lib/delivery-proc.js.map +1 -1
  158. package/dist/lib/endpoint-client.d.ts +3 -0
  159. package/dist/lib/endpoint-client.d.ts.map +1 -1
  160. package/dist/lib/endpoint-client.js +4 -0
  161. package/dist/lib/endpoint-client.js.map +1 -1
  162. package/dist/lib/endpoint-errors.d.ts +9 -0
  163. package/dist/lib/endpoint-errors.d.ts.map +1 -1
  164. package/dist/lib/endpoint-errors.js +17 -1
  165. package/dist/lib/endpoint-errors.js.map +1 -1
  166. package/dist/lib/reset-space-plan.d.ts.map +1 -1
  167. package/dist/lib/reset-space-plan.js +25 -4
  168. package/dist/lib/reset-space-plan.js.map +1 -1
  169. package/dist/lib/restore.d.ts +10 -0
  170. package/dist/lib/restore.d.ts.map +1 -1
  171. package/dist/lib/restore.js +35 -1
  172. package/dist/lib/restore.js.map +1 -1
  173. package/dist/lib/service-census.d.ts +10 -10
  174. package/dist/lib/service-install-intent.d.ts +2 -2
  175. package/dist/lib/service-instances.d.ts +1 -1
  176. package/dist/lib/service-instances.d.ts.map +1 -1
  177. package/dist/lib/service-instances.js +2 -2
  178. package/dist/lib/service-instances.js.map +1 -1
  179. package/dist/lib/service-journal.d.ts.map +1 -1
  180. package/dist/lib/service-journal.js +4 -4
  181. package/dist/lib/service-journal.js.map +1 -1
  182. package/dist/lib/service-presets.d.ts.map +1 -1
  183. package/dist/lib/service-presets.js +3 -2
  184. package/dist/lib/service-presets.js.map +1 -1
  185. package/dist/lib/service-process.d.ts +26 -1
  186. package/dist/lib/service-process.d.ts.map +1 -1
  187. package/dist/lib/service-process.js +140 -20
  188. package/dist/lib/service-process.js.map +1 -1
  189. package/dist/lib/service-supervision.d.ts +1 -1
  190. package/dist/lib/service-systemd-attempt-read.d.ts +3 -3
  191. package/dist/lib/service-uninstall-intent.d.ts +3 -3
  192. package/dist/lib/shown-time.d.ts +5 -0
  193. package/dist/lib/shown-time.d.ts.map +1 -0
  194. package/dist/lib/shown-time.js +9 -0
  195. package/dist/lib/shown-time.js.map +1 -0
  196. package/dist/lib/stack-journal.d.ts +75 -1
  197. package/dist/lib/stack-journal.d.ts.map +1 -1
  198. package/dist/lib/stack-journal.js +226 -4
  199. package/dist/lib/stack-journal.js.map +1 -1
  200. package/dist/lib/stdout-owner.d.ts +17 -0
  201. package/dist/lib/stdout-owner.d.ts.map +1 -0
  202. package/dist/lib/stdout-owner.js +44 -0
  203. package/dist/lib/stdout-owner.js.map +1 -0
  204. package/dist/lib/team-additive-attempt.d.ts +1 -1
  205. package/dist/lib/up-report.d.ts +2 -0
  206. package/dist/lib/up-report.d.ts.map +1 -1
  207. package/dist/lib/up-report.js +3 -1
  208. package/dist/lib/up-report.js.map +1 -1
  209. package/dist/managed-handoff.d.ts +3 -0
  210. package/dist/managed-handoff.d.ts.map +1 -1
  211. package/dist/managed-handoff.js +5 -0
  212. package/dist/managed-handoff.js.map +1 -1
  213. package/dist/ui.d.ts +4 -2
  214. package/dist/ui.d.ts.map +1 -1
  215. package/dist/ui.js +17 -6
  216. package/dist/ui.js.map +1 -1
  217. package/dist/watch-data.js +1 -1
  218. package/dist/watch-data.js.map +1 -1
  219. package/dist/watch-json.d.ts.map +1 -1
  220. package/dist/watch-json.js +3 -2
  221. package/dist/watch-json.js.map +1 -1
  222. package/package.json +4 -4
@@ -2,7 +2,7 @@ import { existsSync, readFileSync } from "node:fs";
2
2
  import { homedir } from "node:os";
3
3
  import { join } from "node:path";
4
4
  import { CotalEndpoint, dialerFor, EpEnvelopeError, formatAge, isReachable, mintCreds, mintLifecycleUid, resolveService, realDirNoSymlink, invokeRepairingSplit, standaloneConnectOpts, newIdentity, idFromCreds, principalKey, DEV_OWNER, unansweredRequest, resolveAuthProvider, personaDir, presenceText, } from "@cotal-ai/core";
5
- import { accountInventory, authDir, isCommandFailure, brokerAddressForDisplay, canonicalRoot, CLI_USER_ACTOR, CommandFailure, deliveryCredsKey, DELIVERY_PIDFILE, extensionsDir, findCotalRoot, findPreparedSpace, hasUserAuthState, homeCotalDir, cachedPreferences, resolvePreference, isMeshRegistryError, isWorkspaceTargetError, jsonFlag, loadSoleSpaceAuth, localProcessPath, localProcessVisible, MANAGER_PIDFILE, oneLine, parsePid, plainFlag, preflightTarget, presentationOf, probeLiveness, probeWebReadiness, readCurrent, readMeshRegistry, readRenewalRecord, renderWorkspaceError, resolveMeshTarget, serverFlag, spaceFlag, userAuthStateDir, WEB_PIDFILE, WEB_READINESS_HEADER, workspaceSecretStore, writeResult } from "@cotal-ai/workspace";
5
+ import { accountInventory, authDir, isCommandFailure, readMaintenanceJournal, brokerAddressForDisplay, canonicalRoot, CLI_USER_ACTOR, CommandFailure, deliveryCredsKey, DELIVERY_PIDFILE, extensionsDir, findCotalRoot, findPreparedSpace, hasUserAuthState, homeCotalDir, cachedPreferences, resolvePreference, isMeshRegistryError, isWorkspaceTargetError, jsonFlag, loadSoleSpaceAuth, localProcessPath, localProcessVisible, MANAGER_PIDFILE, oneLine, parsePid, plainFlag, preflightTarget, presentationOf, probeLiveness, probeWebReadiness, readCurrent, readMeshRegistry, readRenewalRecord, renderWorkspaceError, resolveMeshTarget, serverFlag, spaceFlag, userAuthStateDir, WEB_PIDFILE, WEB_READINESS_HEADER, workspaceSecretStore, writeResult } from "@cotal-ai/workspace";
6
6
  import { localProcessSurface } from "../ext-loader.js";
7
7
  import { cliVersion, cliProvenance, readExtensionVersions } from "../lib/version.js";
8
8
  import { agentSkillsSkew } from "../lib/agent-skills.js";
@@ -21,6 +21,8 @@ import { serviceDefinitionProjection, serviceDefinitionStore } from "../lib/serv
21
21
  import { instanceProjection, serviceInstances } from "../lib/service-instances.js";
22
22
  import { freshTeamAttemptSettled, listFreshTeamAttempts, listFreshTeamSummaries } from "../lib/team-fresh.js";
23
23
  import { additiveTeamRecordedState, listAdditiveTeamAttempts } from "../lib/team-additive-attempt.js";
24
+ import { restoreNextStep } from "../lib/restore.js";
25
+ import { readStackJournal } from "../lib/stack-journal.js";
24
26
  /** `--components` is the fail-loud health pass with a machine-readable EXIT DISPOSITION. Bare
25
27
  * `status` is a broad, recovery-oriented report: it exits 0, or 4 when it could not read part of what
26
28
  * it reports; this explicit mode is for an operator or monitor that needs a component state per
@@ -120,7 +122,8 @@ export async function status(args) {
120
122
  const target = await readSelected(selected, responder, gaps, hints);
121
123
  const services = readOwnedServices(selected, gaps);
122
124
  const bootAttempts = readBootAttempts(root, gaps);
123
- const result = { kind: "infrastructure", machine, extensions, folder, meshes, selected: target, services, bootAttempts, hints };
125
+ const maintenance = readMaintenance(root, gaps);
126
+ const result = { kind: "infrastructure", machine, extensions, folder, meshes, selected: target, services, bootAttempts, maintenance, hints };
124
127
  const parts = gaps.warnings.length;
125
128
  writeResult(presentation, {
126
129
  command: "status",
@@ -133,6 +136,22 @@ export async function status(args) {
133
136
  if (values.components)
134
137
  await printComponentHealth(cwd, values);
135
138
  }
139
+ /** The folder's maintenance journal, read only. An unreadable one is reported, never taken for none. */
140
+ function readMaintenance(root, gaps) {
141
+ try {
142
+ const journal = readMaintenanceJournal(root);
143
+ if (!journal)
144
+ return null;
145
+ const attemptId = "restore" in journal ? journal.restore.attemptId : journal.cut.attemptId;
146
+ const next = "restore" in journal ? restoreNextStep(journal.state, attemptId)
147
+ : journal.state === "ready" ? `create a backup with ${displayCmd()} backup create <dir>, or resume with bare ${displayCmd()} up` : null;
148
+ return { root, space: journal.space, state: journal.state, attemptId, next };
149
+ }
150
+ catch {
151
+ gaps.add("MAINTENANCE_JOURNAL_UNREADABLE", "this folder's maintenance journal could not be read; no absent or settled state was inferred", { root });
152
+ return { root, space: null, state: "unreadable", attemptId: null, next: null };
153
+ }
154
+ }
136
155
  /** Local boot and additive intents are recovery coordinates, not evidence of native state. */
137
156
  function readBootAttempts(root, gaps) {
138
157
  const result = { root, state: "not-checked", observedAt: new Date().toISOString(), unsettled: [], additive: [], unreadable: [] };
@@ -378,13 +397,14 @@ async function readResponderAxis(selected) {
378
397
  }
379
398
  async function readFolder(root, selected, values, responder, gaps, hints) {
380
399
  const cmd = displayCmd();
381
- const folder = (auth, processes = null, storedState = false, processSpace = null) => ({
400
+ const folder = (auth, processes = null, storedState = false, processSpace = null, controllerStack = false) => ({
382
401
  root,
383
402
  auth,
384
403
  ...folderPersonas(root, selected, values, gaps, hints),
385
404
  processes,
386
405
  processSpace,
387
406
  storedState,
407
+ controllerStack,
388
408
  });
389
409
  const unreadable = (error, hint) => {
390
410
  gaps.add("AUTH_UNREADABLE", `this folder's trust material could not be read: ${error}`, { root });
@@ -472,10 +492,18 @@ async function readFolder(root, selected, values, responder, gaps, hints) {
472
492
  // A stopped mesh with a persisted store: name the reset verb. Stale state (e.g. durables from
473
493
  // an older Cotal generation) is otherwise invisible until a spawn fails on it. The restart is
474
494
  // deliberately "your usual flags", never a bare `up` (mode/name/store-dir aren't recorded).
475
- const storedState = nats?.liveness !== "alive" && existsSync(join(root, ".cotal", "nats"));
495
+ // A controller stack's broker has no legacy pidfile, so that heuristic says nothing about it.
496
+ let controllerStack = false;
497
+ try {
498
+ controllerStack = readStackJournal(root)?.journal.space === space;
499
+ }
500
+ catch {
501
+ controllerStack = false;
502
+ }
503
+ const storedState = !controllerStack && nats?.liveness !== "alive" && existsSync(join(root, ".cotal", "nats"));
476
504
  if (storedState)
477
505
  hints.push(`if the stored JetStream state is stale: ${cmd} clean store --force, then \`up\` with your usual flags (\`clean all\` also resets identity)`);
478
- return folder({ state: auth ? "space" : "none", spaces: auth ? [auth.space] : [], userAuth: userDisk, error: null }, processes, storedState, space);
506
+ return folder({ state: auth ? "space" : "none", spaces: auth ? [auth.space] : [], userAuth: userDisk, error: null }, processes, storedState, space, controllerStack);
479
507
  }
480
508
  /** The folder's persona catalog, which must never let a catalog imply a `spawn` the operator does
481
509
  * not have.
@@ -961,6 +989,20 @@ function meshesSections(m) {
961
989
  sections.push({ title: "Space Catalog Accounts", blocks: [{ kind: "lines", lines: m.catalogs.map((r) => `${r.idp} ${r.state}${r.error ? `: ${r.error}` : ""}`) }] });
962
990
  return sections;
963
991
  }
992
+ /** The selected space's delivery responder (#1576). Bare status and the verbose mesh section both
993
+ * state it, so an operator on a manager host away from the broker's folder still sees it. */
994
+ function responderText(state) {
995
+ if (state === "unbound")
996
+ return { text: `NOT BOUND - ${RESPONDER_UNBOUND_CONSEQUENCE} · start it with \`${displayCmd()} up\` (or \`${displayCmd()} deliver --space <space>\`)`, tone: "failed" };
997
+ // A stale record is NOT BOUND with a different next move: the slot is occupied by a corpse, so
998
+ // starting a daemon now loses the single-flight CAS. Say that, rather than sending the operator
999
+ // into a refusal they will read as a second failure.
1000
+ if (state === "stale")
1001
+ return { text: `NOT BOUND - a DEAD daemon's ready record still holds the lease - ${RESPONDER_UNBOUND_CONSEQUENCE} · it expires on its own; a replacement can then take the shard`, tone: "failed" };
1002
+ if (state === "bound")
1003
+ return { text: "bound", tone: "ok" };
1004
+ return undefined;
1005
+ }
964
1006
  function selectedSection(s) {
965
1007
  if (!s.resolved)
966
1008
  return { title: "Selected Mesh", blocks: [{ kind: "fields", rows: [["target", cell(s.code, "failed")]] }] };
@@ -998,15 +1040,9 @@ function selectedSection(s) {
998
1040
  }
999
1041
  else {
1000
1042
  rows.push(["connection", s.connection === "ok" ? cell("ok", "ok") : cell(`${s.connection}${s.staleRecord ? " (stale registry entry)" : ""}`, "failed")]);
1001
- if (s.deliveryResponder === "unbound")
1002
- rows.push(["delivery responder", cell(`NOT BOUND - ${RESPONDER_UNBOUND_CONSEQUENCE} · start it with \`${displayCmd()} up\` (or \`${displayCmd()} deliver --space <space>\`)`, "failed")]);
1003
- // A stale record is NOT BOUND with a different next move: the slot is occupied by a corpse, so
1004
- // starting a daemon now loses the single-flight CAS. Say that, rather than sending the operator
1005
- // into a refusal they will read as a second failure.
1006
- else if (s.deliveryResponder === "stale")
1007
- rows.push(["delivery responder", cell(`NOT BOUND - a DEAD daemon's ready record still holds the lease - ${RESPONDER_UNBOUND_CONSEQUENCE} · it expires on its own; a replacement can then take the shard`, "failed")]);
1008
- else if (s.deliveryResponder === "bound")
1009
- rows.push(["delivery responder", cell("bound", "ok")]);
1043
+ const responder = responderText(s.deliveryResponder);
1044
+ if (responder)
1045
+ rows.push(["delivery responder", cell(responder.text, responder.tone)]);
1010
1046
  }
1011
1047
  if (s.snapshot.state === "unavailable" || (s.mode === "user" && s.snapshot.state === "skipped"))
1012
1048
  rows.push(["live snapshot", cell(`${s.snapshot.state === "unavailable" ? "unavailable" : "not read"} (${s.snapshot.reason})`, s.snapshot.state === "unavailable" ? "failed" : "hint")]);
@@ -1106,11 +1142,14 @@ function selectedOverview(r) {
1106
1142
  const s = r.selected;
1107
1143
  if (!s.resolved)
1108
1144
  return { title: "Selected space", blocks: [{ kind: "lines", lines: [stateCell(s.message, "failed")] }] };
1109
- if (!r.meshes.items.length && !r.meshes.currentPrepared && r.folder.auth.state === "none" && !r.folder.processes?.some((item) => item.pid !== null))
1145
+ // A broker named with `--server` is reported even when nothing on this machine is registered.
1146
+ if (s.source !== "flag-server" && !r.meshes.items.length && !r.meshes.currentPrepared && r.folder.auth.state === "none" && !r.folder.processes?.some((item) => item.pid !== null))
1110
1147
  return undefined;
1148
+ const responder = responderText(s.deliveryResponder);
1111
1149
  const rows = [
1112
1150
  ["Broker", s.server ?? stateCell("address unavailable", "failed")],
1113
1151
  ["Connection", connectionCell(s)],
1152
+ ...(responder ? [["Delivery responder", stateCell(responder.text, responder.tone)]] : []),
1114
1153
  ["Access", s.mode === "user" ? "user sign-in" : s.mode === "auth" ? "static auth" : "open"],
1115
1154
  ["Project", s.root],
1116
1155
  ["Default agent", r.machine.defaults ? `${r.machine.defaults.harness ?? "application not set"} · persona ${r.machine.defaults.persona ?? "not set"}` : stateCell("saved defaults could not be read", "failed")],
@@ -1133,7 +1172,10 @@ function selectedOverview(r) {
1133
1172
  if (s.snapshot.state === "unavailable")
1134
1173
  rows.push(["Live details", stateCell(`unavailable · ${s.snapshot.reason}`, "waiting")]);
1135
1174
  const blocks = [{ kind: "fields", rows }];
1136
- if (r.folder.root === s.root && r.folder.processSpace === s.space && r.folder.processes) {
1175
+ if (r.folder.root === s.root && r.folder.processSpace === s.space && r.folder.controllerStack) {
1176
+ blocks.push({ kind: "lines", lines: [cell("Controller stack · its members are the stack-* rows under Owned services", "hint")] });
1177
+ }
1178
+ else if (r.folder.root === s.root && r.folder.processSpace === s.space && r.folder.processes) {
1137
1179
  blocks.push({ kind: "lines", lines: [cell("Legacy local process records", "label")] });
1138
1180
  blocks.push({
1139
1181
  kind: "table", header: false,
@@ -1173,6 +1215,9 @@ function nextActions(r) {
1173
1215
  if (r.meshes.items.length > 1)
1174
1216
  items.push({ command: `${cmd} status --all`, description: "Check every registered space" });
1175
1217
  }
1218
+ // A local controller stack that does not answer restarts its stopped members from its own records.
1219
+ if (r.selected.resolved && r.selected.connection !== "ok" && r.selected.connection !== "reachable" && r.folder.controllerStack && r.folder.root === r.selected.root && r.folder.processSpace === r.selected.space)
1220
+ items.unshift({ command: `${cmd} up --root ${r.selected.root}`, description: "Restart this stack's stopped members from its recorded inputs" });
1176
1221
  if (r.selected.resolved && r.selected.mode === "user" && r.selected.login && !r.selected.login.subject)
1177
1222
  items.unshift({ command: `${cmd} login --idp ${r.selected.login.idp}`, description: "Sign in to the selected space" });
1178
1223
  return { title: "Next", blocks: [{ kind: "commands", items }, ...r.hints.map((hint) => ({ kind: "lines", lines: [cell(hint, "hint")] }))] };
@@ -1221,12 +1266,21 @@ function bootAttemptOverview(snapshot) {
1221
1266
  { kind: "commands", items: [{ command: `${displayCmd()} team show <deployment-id>`, description: "Inspect the original attempt from its recorded root" }] },
1222
1267
  ] };
1223
1268
  }
1269
+ function maintenanceOverview(maintenance) {
1270
+ if (!maintenance)
1271
+ return undefined;
1272
+ return { title: "Maintenance", blocks: [
1273
+ { kind: "fields", rows: [["Folder root", maintenance.root], ["Space", maintenance.space ?? "not read"], ["State", maintenance.state], ["Attempt", maintenance.attemptId ?? "not read"]] },
1274
+ ...(maintenance.next ? [{ kind: "lines", lines: [maintenance.next] }] : []),
1275
+ ] };
1276
+ }
1224
1277
  /** The approved screen hierarchy; record-level diagnostics are opt-in. */
1225
1278
  export function statusView(r, verbose = false) {
1226
1279
  const selected = selectedOverview(r);
1227
1280
  const owned = ownedServicesOverview(r.services);
1228
1281
  const attempts = bootAttemptOverview(r.bootAttempts);
1229
- const sections = [machineOverview(r), brokerOverview(r), ...(selected ? [selected] : []), ...(attempts ? [attempts] : []), ...(owned ? [owned] : [])];
1282
+ const maintenance = maintenanceOverview(r.maintenance);
1283
+ const sections = [machineOverview(r), brokerOverview(r), ...(selected ? [selected] : []), ...(maintenance ? [maintenance] : []), ...(attempts ? [attempts] : []), ...(owned ? [owned] : [])];
1230
1284
  if (verbose)
1231
1285
  sections.push(machineSection(r.machine), extensionsSection(r.extensions), folderSection(r.folder, r.selected), ...meshesSections(r.meshes), selectedSection(r.selected));
1232
1286
  sections.push(nextActions(r));