@cotal-ai/cli 0.172.0 → 0.172.2
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.
- package/dist/command.d.ts.map +1 -1
- package/dist/command.js +68 -47
- package/dist/command.js.map +1 -1
- package/dist/commands/agents.d.ts +2 -2
- package/dist/commands/agents.d.ts.map +1 -1
- package/dist/commands/agents.js +19 -12
- package/dist/commands/agents.js.map +1 -1
- package/dist/commands/channel-members.d.ts.map +1 -1
- package/dist/commands/channel-members.js +2 -1
- package/dist/commands/channel-members.js.map +1 -1
- package/dist/commands/channels.d.ts.map +1 -1
- package/dist/commands/channels.js +20 -9
- package/dist/commands/channels.js.map +1 -1
- package/dist/commands/clean.d.ts.map +1 -1
- package/dist/commands/clean.js +35 -9
- package/dist/commands/clean.js.map +1 -1
- package/dist/commands/completion.d.ts.map +1 -1
- package/dist/commands/completion.js +3 -2
- package/dist/commands/completion.js.map +1 -1
- package/dist/commands/config.d.ts.map +1 -1
- package/dist/commands/config.js +24 -7
- package/dist/commands/config.js.map +1 -1
- package/dist/commands/describe.js +2 -2
- package/dist/commands/describe.js.map +1 -1
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +25 -7
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/down.d.ts.map +1 -1
- package/dist/commands/down.js +43 -12
- package/dist/commands/down.js.map +1 -1
- package/dist/commands/endpoint-authoring.d.ts.map +1 -1
- package/dist/commands/endpoint-authoring.js +16 -4
- package/dist/commands/endpoint-authoring.js.map +1 -1
- package/dist/commands/endpoint.d.ts.map +1 -1
- package/dist/commands/endpoint.js +8 -3
- package/dist/commands/endpoint.js.map +1 -1
- package/dist/commands/ext.d.ts.map +1 -1
- package/dist/commands/ext.js +9 -8
- package/dist/commands/ext.js.map +1 -1
- package/dist/commands/history-clear.d.ts.map +1 -1
- package/dist/commands/history-clear.js +10 -3
- package/dist/commands/history-clear.js.map +1 -1
- package/dist/commands/history-limit.js +2 -2
- package/dist/commands/history-limit.js.map +1 -1
- package/dist/commands/history.d.ts +1 -1
- package/dist/commands/history.d.ts.map +1 -1
- package/dist/commands/history.js +101 -41
- package/dist/commands/history.js.map +1 -1
- package/dist/commands/join.d.ts.map +1 -1
- package/dist/commands/join.js +54 -23
- package/dist/commands/join.js.map +1 -1
- package/dist/commands/manager-service.d.ts.map +1 -1
- package/dist/commands/manager-service.js +5 -1
- package/dist/commands/manager-service.js.map +1 -1
- package/dist/commands/meshes-add.d.ts +4 -0
- package/dist/commands/meshes-add.d.ts.map +1 -1
- package/dist/commands/meshes-add.js +35 -1
- package/dist/commands/meshes-add.js.map +1 -1
- package/dist/commands/meshes-wizard.d.ts.map +1 -1
- package/dist/commands/meshes-wizard.js +5 -5
- package/dist/commands/meshes-wizard.js.map +1 -1
- package/dist/commands/meshes.d.ts.map +1 -1
- package/dist/commands/meshes.js +4 -3
- package/dist/commands/meshes.js.map +1 -1
- package/dist/commands/mint.d.ts.map +1 -1
- package/dist/commands/mint.js +11 -4
- package/dist/commands/mint.js.map +1 -1
- package/dist/commands/persona-remote.js +2 -2
- package/dist/commands/persona-remote.js.map +1 -1
- package/dist/commands/persona.d.ts.map +1 -1
- package/dist/commands/persona.js +28 -9
- package/dist/commands/persona.js.map +1 -1
- package/dist/commands/personas.d.ts.map +1 -1
- package/dist/commands/personas.js +17 -15
- package/dist/commands/personas.js.map +1 -1
- package/dist/commands/reset-space-apply.js +4 -4
- package/dist/commands/reset-space-apply.js.map +1 -1
- package/dist/commands/reset-store-apply.d.ts +2 -8
- package/dist/commands/reset-store-apply.d.ts.map +1 -1
- package/dist/commands/reset-store-apply.js +12 -28
- package/dist/commands/reset-store-apply.js.map +1 -1
- package/dist/commands/reset.js +2 -2
- package/dist/commands/reset.js.map +1 -1
- package/dist/commands/send.d.ts.map +1 -1
- package/dist/commands/send.js +21 -9
- package/dist/commands/send.js.map +1 -1
- package/dist/commands/service-actions.d.ts.map +1 -1
- package/dist/commands/service-actions.js +15 -4
- package/dist/commands/service-actions.js.map +1 -1
- package/dist/commands/service-registry.d.ts.map +1 -1
- package/dist/commands/service-registry.js +16 -5
- package/dist/commands/service-registry.js.map +1 -1
- package/dist/commands/setup.d.ts.map +1 -1
- package/dist/commands/setup.js +18 -10
- package/dist/commands/setup.js.map +1 -1
- package/dist/commands/space-delete.d.ts.map +1 -1
- package/dist/commands/space-delete.js +72 -33
- package/dist/commands/space-delete.js.map +1 -1
- package/dist/commands/space-export.js +1 -1
- package/dist/commands/space-export.js.map +1 -1
- package/dist/commands/space-registration.d.ts +4 -3
- package/dist/commands/space-registration.d.ts.map +1 -1
- package/dist/commands/space-registration.js +63 -41
- package/dist/commands/space-registration.js.map +1 -1
- package/dist/commands/space.d.ts.map +1 -1
- package/dist/commands/space.js +24 -8
- package/dist/commands/space.js.map +1 -1
- package/dist/commands/spawn-enrollment.d.ts +93 -0
- package/dist/commands/spawn-enrollment.d.ts.map +1 -0
- package/dist/commands/spawn-enrollment.js +195 -0
- package/dist/commands/spawn-enrollment.js.map +1 -0
- package/dist/commands/spawn-flags.d.ts +205 -0
- package/dist/commands/spawn-flags.d.ts.map +1 -0
- package/dist/commands/spawn-flags.js +34 -0
- package/dist/commands/spawn-flags.js.map +1 -0
- package/dist/commands/spawn-foreground.d.ts +74 -0
- package/dist/commands/spawn-foreground.d.ts.map +1 -0
- package/dist/commands/spawn-foreground.js +355 -0
- package/dist/commands/spawn-foreground.js.map +1 -0
- package/dist/commands/spawn-managed-launch.d.ts +43 -0
- package/dist/commands/spawn-managed-launch.d.ts.map +1 -0
- package/dist/commands/spawn-managed-launch.js +631 -0
- package/dist/commands/spawn-managed-launch.js.map +1 -0
- package/dist/commands/spawn-preview.d.ts.map +1 -1
- package/dist/commands/spawn-preview.js +7 -4
- package/dist/commands/spawn-preview.js.map +1 -1
- package/dist/commands/spawn.d.ts +8 -266
- package/dist/commands/spawn.d.ts.map +1 -1
- package/dist/commands/spawn.js +21 -1198
- package/dist/commands/spawn.js.map +1 -1
- package/dist/commands/stack-down.d.ts +3 -2
- package/dist/commands/stack-down.d.ts.map +1 -1
- package/dist/commands/stack-down.js +72 -31
- package/dist/commands/stack-down.js.map +1 -1
- package/dist/commands/stack-up.d.ts +2 -0
- package/dist/commands/stack-up.d.ts.map +1 -1
- package/dist/commands/stack-up.js +16 -7
- package/dist/commands/stack-up.js.map +1 -1
- package/dist/commands/status-stop-impact.d.ts +3 -0
- package/dist/commands/status-stop-impact.d.ts.map +1 -0
- package/dist/commands/status-stop-impact.js +34 -0
- package/dist/commands/status-stop-impact.js.map +1 -0
- package/dist/commands/status.d.ts.map +1 -1
- package/dist/commands/status.js +96 -80
- package/dist/commands/status.js.map +1 -1
- package/dist/commands/team-boot-controller.d.ts.map +1 -1
- package/dist/commands/team-boot-controller.js +21 -4
- package/dist/commands/team-boot-controller.js.map +1 -1
- package/dist/commands/team.d.ts.map +1 -1
- package/dist/commands/team.js +25 -23
- package/dist/commands/team.js.map +1 -1
- package/dist/commands/telemetry.d.ts +1 -1
- package/dist/commands/telemetry.d.ts.map +1 -1
- package/dist/commands/telemetry.js +17 -7
- package/dist/commands/telemetry.js.map +1 -1
- package/dist/commands/up-target.d.ts +7 -0
- package/dist/commands/up-target.d.ts.map +1 -0
- package/dist/commands/up-target.js +42 -0
- package/dist/commands/up-target.js.map +1 -0
- package/dist/commands/up.d.ts +4 -11
- package/dist/commands/up.d.ts.map +1 -1
- package/dist/commands/up.js +212 -207
- package/dist/commands/up.js.map +1 -1
- package/dist/commands/update-caches.d.ts +4 -0
- package/dist/commands/update-caches.d.ts.map +1 -0
- package/dist/commands/update-caches.js +82 -0
- package/dist/commands/update-caches.js.map +1 -0
- package/dist/commands/update.d.ts.map +1 -1
- package/dist/commands/update.js +29 -115
- package/dist/commands/update.js.map +1 -1
- package/dist/commands/use.d.ts.map +1 -1
- package/dist/commands/use.js +43 -22
- package/dist/commands/use.js.map +1 -1
- package/dist/commands/who.d.ts.map +1 -1
- package/dist/commands/who.js +2 -3
- package/dist/commands/who.js.map +1 -1
- package/dist/console/commands.d.ts.map +1 -1
- package/dist/console/commands.js +3 -2
- package/dist/console/commands.js.map +1 -1
- package/dist/help.d.ts.map +1 -1
- package/dist/help.js +2 -1
- package/dist/help.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -2
- package/dist/index.js.map +1 -1
- package/dist/lib/broker-log.d.ts +8 -0
- package/dist/lib/broker-log.d.ts.map +1 -0
- package/dist/lib/broker-log.js +27 -0
- package/dist/lib/broker-log.js.map +1 -0
- package/dist/lib/completion-install.d.ts.map +1 -1
- package/dist/lib/completion-install.js +17 -10
- package/dist/lib/completion-install.js.map +1 -1
- package/dist/lib/credential-authority.d.ts +7 -3
- package/dist/lib/credential-authority.d.ts.map +1 -1
- package/dist/lib/credential-authority.js +44 -11
- package/dist/lib/credential-authority.js.map +1 -1
- package/dist/lib/manifest/ledger.d.ts.map +1 -1
- package/dist/lib/manifest/ledger.js +7 -3
- package/dist/lib/manifest/ledger.js.map +1 -1
- package/dist/lib/paths.d.ts.map +1 -1
- package/dist/lib/paths.js +3 -3
- package/dist/lib/paths.js.map +1 -1
- package/dist/lib/restore.d.ts +32 -3
- package/dist/lib/restore.d.ts.map +1 -1
- package/dist/lib/restore.js +65 -54
- package/dist/lib/restore.js.map +1 -1
- package/dist/lib/service-preset-target.d.ts +2 -2
- package/dist/lib/service-preset-target.d.ts.map +1 -1
- package/dist/lib/service-preset-target.js +30 -15
- package/dist/lib/service-preset-target.js.map +1 -1
- package/dist/lib/service-presets.d.ts +2 -0
- package/dist/lib/service-presets.d.ts.map +1 -1
- package/dist/lib/service-presets.js +19 -2
- package/dist/lib/service-presets.js.map +1 -1
- package/dist/lib/spawn-defaults.d.ts +5 -0
- package/dist/lib/spawn-defaults.d.ts.map +1 -1
- package/dist/lib/spawn-defaults.js +5 -0
- package/dist/lib/spawn-defaults.js.map +1 -1
- package/dist/lib/stack-journal.d.ts +7 -4
- package/dist/lib/stack-journal.d.ts.map +1 -1
- package/dist/lib/stack-journal.js +31 -15
- package/dist/lib/stack-journal.js.map +1 -1
- package/dist/lib/transient.d.ts +3 -3
- package/dist/lib/transient.d.ts.map +1 -1
- package/dist/lib/transient.js +6 -5
- package/dist/lib/transient.js.map +1 -1
- package/dist/lib/up-broker-address.d.ts +7 -0
- package/dist/lib/up-broker-address.d.ts.map +1 -0
- package/dist/lib/up-broker-address.js +76 -0
- package/dist/lib/up-broker-address.js.map +1 -0
- package/dist/lib/up-report.d.ts +2 -0
- package/dist/lib/up-report.d.ts.map +1 -1
- package/dist/lib/up-report.js +8 -1
- package/dist/lib/up-report.js.map +1 -1
- package/dist/lib/update-connector-config.d.ts +6 -0
- package/dist/lib/update-connector-config.d.ts.map +1 -0
- package/dist/lib/update-connector-config.js +44 -0
- package/dist/lib/update-connector-config.js.map +1 -0
- package/dist/seed/reconcile.d.ts +1 -1
- package/dist/seed/reconcile.d.ts.map +1 -1
- package/dist/seed/reconcile.js +113 -35
- package/dist/seed/reconcile.js.map +1 -1
- package/package.json +4 -4
package/dist/commands/status.js
CHANGED
|
@@ -3,7 +3,7 @@ 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, 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, 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";
|
|
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";
|
|
@@ -41,6 +41,7 @@ import { natsServerLabel } from "../lib/nats-bin.js";
|
|
|
41
41
|
import { askManager } from "@cotal-ai/workspace/control";
|
|
42
42
|
import { readCursor } from "../seed/lock.js";
|
|
43
43
|
import { reconcileCursorPath } from "../seed/paths.js";
|
|
44
|
+
import { managerStopImpactFacts } from "./status-stop-impact.js";
|
|
44
45
|
/** `--components` is the fail-loud health pass with a machine-readable EXIT DISPOSITION. Bare
|
|
45
46
|
* `status` is a broad, recovery-oriented report: it exits 0, or 4 when it could not read part of what
|
|
46
47
|
* it reports; this explicit mode is for an operator or monitor that needs a component state per
|
|
@@ -104,6 +105,21 @@ async function folderSpacesOffline(cwd, values) {
|
|
|
104
105
|
const probed = await Promise.all(entries.map(async (m) => ((await isReachable(m.server, m.tlsRequired ? { tls: true } : {})) ? undefined : m.space)));
|
|
105
106
|
return probed.filter((space) => space !== undefined);
|
|
106
107
|
}
|
|
108
|
+
/** Outside a project, only the all-broker report has liveness evidence for the registry fallback. */
|
|
109
|
+
async function registryFallbackChecks(root, values) {
|
|
110
|
+
if (!values.all || values.space !== undefined || values.server !== undefined || isGenuineSpace(root))
|
|
111
|
+
return undefined;
|
|
112
|
+
let entries;
|
|
113
|
+
try {
|
|
114
|
+
if (readCurrent() !== undefined)
|
|
115
|
+
return undefined;
|
|
116
|
+
entries = readMeshRegistry().entries;
|
|
117
|
+
}
|
|
118
|
+
catch {
|
|
119
|
+
return undefined;
|
|
120
|
+
} // The reporting pass names unreadable records.
|
|
121
|
+
return new Map(await Promise.all(entries.map(async (entry) => [entry.space, { entry, check: await brokerCheck(entry.server, entry.tlsRequired) }])));
|
|
122
|
+
}
|
|
107
123
|
/** Collects what each reader could not read, so the report names it on its row and the run is
|
|
108
124
|
* reported partial rather than complete. */
|
|
109
125
|
class Gaps {
|
|
@@ -158,7 +174,9 @@ export async function status(args) {
|
|
|
158
174
|
});
|
|
159
175
|
const cwd = process.cwd();
|
|
160
176
|
const root = findCotalRoot(cwd);
|
|
161
|
-
const
|
|
177
|
+
const checks = await registryFallbackChecks(root, values);
|
|
178
|
+
const offline = checks === undefined ? await folderSpacesOffline(cwd, values)
|
|
179
|
+
: [...checks.values()].flatMap(({ entry, check }) => check === "reachable" ? [] : [entry.space]);
|
|
162
180
|
const selected = resolveSelected(cwd, values, offline);
|
|
163
181
|
const gaps = new Gaps();
|
|
164
182
|
const hints = [];
|
|
@@ -218,21 +236,25 @@ export async function status(args) {
|
|
|
218
236
|
hints.push(error.remedy);
|
|
219
237
|
}
|
|
220
238
|
}
|
|
221
|
-
const meshes = await readMeshes(cwd, selected, Boolean(values.all), gaps, offline, preflight);
|
|
239
|
+
const meshes = await readMeshes(cwd, selected, Boolean(values.all), gaps, offline, preflight, checks);
|
|
222
240
|
const { maintenance, sourceMissing } = blocked
|
|
223
241
|
? { maintenance: { root, space: null, state: "unreadable", attemptId: null, next: null }, sourceMissing: false }
|
|
224
242
|
: readMaintenance(root, gaps);
|
|
225
243
|
const recovery = backupRecovery(maintenance, sourceMissing);
|
|
226
244
|
const selectedHints = [];
|
|
227
|
-
const target = await readSelected(selected, responder, folder, gaps, selectedHints, preflight);
|
|
245
|
+
const target = await readSelected(selected, responder, folder, gaps, selectedHints, preflight, Boolean(values.all));
|
|
228
246
|
// Do not offer the conditional store reset when this folder needs a channel seed repair first,
|
|
229
247
|
// while a maintenance journal holds the store, or if the store is unwritable.
|
|
230
|
-
if (folder.storedState && folder.processSpace !== null && maintenance === null && !(target.channelSeedBlocksRestart && target.root === root) && !rootStoreProblem(root)) {
|
|
231
|
-
const
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
248
|
+
if ((target.resolved || target.code !== "SCHEMA_INVALID") && folder.storedState && folder.processSpace !== null && maintenance === null && !(target.channelSeedBlocksRestart && target.root === root) && !rootStoreProblem(root)) {
|
|
249
|
+
const reset = storeResetTarget(root, folder.processSpace);
|
|
250
|
+
// An explicit address is not evidence about a different broker's store.
|
|
251
|
+
if (values.server === undefined || (reset && selected.ok && selected.target.space === reset.space
|
|
252
|
+
&& brokerUrlKey(selected.target.server) === brokerUrlKey(reset.server))) {
|
|
253
|
+
const cmd = displayCmd();
|
|
254
|
+
hints.push(reset !== undefined
|
|
255
|
+
? `if the stored JetStream state is stale: ${codeSpan(`${cmd} reset store ${shellWord(reset.space)}`)}, then \`up\` with your usual flags`
|
|
256
|
+
: `if the stored JetStream state is stale: \`${cmd} clean store --force\`, then \`up\` with your usual flags (\`clean all\` also resets identity)`);
|
|
257
|
+
}
|
|
236
258
|
}
|
|
237
259
|
// A held backup or missing preserved store blocks startup. Keep the selection's diagnostics,
|
|
238
260
|
// but replace its ordinary restart advice with the journal's recovery step.
|
|
@@ -344,7 +366,7 @@ function readBootAttempts(root, gaps) {
|
|
|
344
366
|
// root passes over it.
|
|
345
367
|
const here = cotalLinkHere();
|
|
346
368
|
if (here?.dangling)
|
|
347
|
-
gaps.add("COTAL_DIR_DANGLING", `this folder's .cotal links to ${here.target}, which does not exist, so this folder has no records of its own; remove the link and prepare this folder with
|
|
369
|
+
gaps.add("COTAL_DIR_DANGLING", `this folder's .cotal links to ${here.target}, which does not exist, so this folder has no records of its own; remove the link and prepare this folder with ${codeSpan(`cotal space create <space> --root ${shellWord(here.root)}`)}`, { root: here.root, path: here.path, link: here.target });
|
|
348
370
|
// Neither inventory is read through a link; the folder it leads to reports its own.
|
|
349
371
|
const link = cotalDirLink(root);
|
|
350
372
|
if (link !== undefined) {
|
|
@@ -916,7 +938,7 @@ function personaCatalog(root, gaps) {
|
|
|
916
938
|
/** The one space whose `reset store <space>` selects this root's store: the folder's own, or one this
|
|
917
939
|
* machine registered here, which a stopped folder no longer resolves to. A legacy root whose down
|
|
918
940
|
* removed that registration has none, and the reset's refusal names clean instead. */
|
|
919
|
-
function
|
|
941
|
+
function storeResetTarget(root, space) {
|
|
920
942
|
let names;
|
|
921
943
|
try {
|
|
922
944
|
names = [...new Set([space, ...meshesForRoot(root).map((mesh) => mesh.space)])];
|
|
@@ -924,12 +946,15 @@ function storeResetSpace(root, space) {
|
|
|
924
946
|
catch {
|
|
925
947
|
return undefined;
|
|
926
948
|
}
|
|
927
|
-
const reached = names.
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
949
|
+
const reached = names.flatMap((name) => {
|
|
950
|
+
try {
|
|
951
|
+
const target = selectResetTarget(name, "reset store");
|
|
952
|
+
return sameDir(target.root, root) ? [target] : [];
|
|
953
|
+
}
|
|
954
|
+
catch {
|
|
955
|
+
return [];
|
|
956
|
+
}
|
|
957
|
+
});
|
|
933
958
|
return reached.length === 1 ? reached[0] : undefined;
|
|
934
959
|
}
|
|
935
960
|
/** Do two catalog paths denote the SAME directory? `canonicalRoot` (realpath, `resolve` fallback
|
|
@@ -1138,7 +1163,7 @@ function deliveryDetail(live, responder) {
|
|
|
1138
1163
|
* with its own recorded TLS requirement. A bare TCP/INFO probe would green-light a plaintext broker
|
|
1139
1164
|
* that has substituted for a TLS-required mesh — the FAIL1 attack — so a list that only asks "is
|
|
1140
1165
|
* anything listening" cannot report on the one property the record claims. */
|
|
1141
|
-
async function readMeshes(cwd, selected, all, gaps, offline, preflight) {
|
|
1166
|
+
async function readMeshes(cwd, selected, all, gaps, offline, preflight, checks) {
|
|
1142
1167
|
// A registry file that cannot be read is named, and the readable records are still listed and
|
|
1143
1168
|
// checked. Only an absent directory or pointer is an empty registry or no current mesh.
|
|
1144
1169
|
const unreadable = [];
|
|
@@ -1178,18 +1203,22 @@ async function readMeshes(cwd, selected, all, gaps, offline, preflight) {
|
|
|
1178
1203
|
throw e;
|
|
1179
1204
|
}
|
|
1180
1205
|
const chosen = selected.ok ? selected.target : undefined;
|
|
1206
|
+
const chosenServer = chosen && brokerUrlKey(chosen.server);
|
|
1181
1207
|
// A `--server` that names another address is the only broker dialed for the selected space.
|
|
1182
|
-
const checked = (m) => all || (m.space === chosen?.space && m.server === chosen.server);
|
|
1183
1208
|
const check = async (m) => {
|
|
1184
|
-
|
|
1209
|
+
const selectedAddress = m.space === chosen?.space && brokerUrlKey(m.server) === chosenServer;
|
|
1210
|
+
if (!all && !selectedAddress)
|
|
1185
1211
|
return "not-checked";
|
|
1186
|
-
if (preflight &&
|
|
1212
|
+
if (preflight && selectedAddress) {
|
|
1187
1213
|
if (preflight.ok)
|
|
1188
1214
|
return "reachable";
|
|
1189
1215
|
if (preflight.kind === "slow-link" || preflight.kind === "broker-stopped" || preflight.kind === "unreachable")
|
|
1190
1216
|
return preflight.kind;
|
|
1191
1217
|
return preflight.kind === "tls-trust" || preflight.kind === "tls-unsupported" || preflight.kind === "auth-unsupported" || preflight.kind === "jetstream-unsupported" || preflight.kind === "non-nats-listener" ? "unreachable" : "reachable";
|
|
1192
1218
|
}
|
|
1219
|
+
const prior = checks?.get(m.space);
|
|
1220
|
+
if (prior?.entry.server === m.server && prior.entry.tlsRequired === m.tlsRequired)
|
|
1221
|
+
return prior.check;
|
|
1193
1222
|
return brokerCheck(m.server, m.tlsRequired);
|
|
1194
1223
|
};
|
|
1195
1224
|
const items = await Promise.all(entries.map(async (m) => ({
|
|
@@ -1278,10 +1307,16 @@ function unusableServiceInstances(space) {
|
|
|
1278
1307
|
return isCommandFailure(error) && error.code === "SCHEMA_INVALID" ? error : undefined;
|
|
1279
1308
|
}
|
|
1280
1309
|
}
|
|
1281
|
-
async function readSelected(selected, responder, folder, gaps, hints, preflight) {
|
|
1310
|
+
async function readSelected(selected, responder, folder, gaps, hints, preflight, all) {
|
|
1282
1311
|
const cmd = displayCmd();
|
|
1283
1312
|
if (!selected.ok) {
|
|
1284
1313
|
const e = selected.error;
|
|
1314
|
+
if (isCommandFailure(e) && e.code === "SCHEMA_INVALID") {
|
|
1315
|
+
gaps.add(e.code, e.message, e.target);
|
|
1316
|
+
if (e.remedy)
|
|
1317
|
+
hints.push(e.remedy);
|
|
1318
|
+
return { resolved: false, code: e.code, message: e.message };
|
|
1319
|
+
}
|
|
1285
1320
|
// Resolution reads the whole registry and refuses a directory or record it cannot use. The meshes
|
|
1286
1321
|
// reader has already named it, so this is the same gap, and the selection is unresolved.
|
|
1287
1322
|
if (isMeshRegistryError(e)) {
|
|
@@ -1304,6 +1339,10 @@ async function readSelected(selected, responder, folder, gaps, hints, preflight)
|
|
|
1304
1339
|
}
|
|
1305
1340
|
if (!isWorkspaceTargetError(e))
|
|
1306
1341
|
throw e;
|
|
1342
|
+
if (!all && e.code === "ambiguous-target" && e.details.spaces && !isGenuineSpace(folder.root)) {
|
|
1343
|
+
hints.push(`check the registered spaces with \`${cmd} status --all\``);
|
|
1344
|
+
return { resolved: false, code: e.code, message: `multiple spaces are registered but unchecked: ${(e.details.available ?? []).join(", ")}` };
|
|
1345
|
+
}
|
|
1307
1346
|
// The canonical parts name the ACTUAL repair per code (`cotal meshes rm`, `--space
|
|
1308
1347
|
// <name>`, `cotal up --user-auth`, …). A fixed `up --detach` hint would be right for at most one
|
|
1309
1348
|
// of the codes and point the others at a command that does not fix them. The section states the
|
|
@@ -1384,7 +1423,8 @@ async function readSelected(selected, responder, folder, gaps, hints, preflight)
|
|
|
1384
1423
|
hints.push(moved.remedy);
|
|
1385
1424
|
return { resolved: false, code: "moved-folder", message: moved.message };
|
|
1386
1425
|
}
|
|
1387
|
-
const overridden = (target.source === "flag-server" || target.source === "flag-space-override") &&
|
|
1426
|
+
const overridden = (target.source === "flag-server" || target.source === "flag-space-override") &&
|
|
1427
|
+
(target.recordedServer === undefined || brokerUrlKey(target.recordedServer) !== brokerUrlKey(target.server));
|
|
1388
1428
|
if (base.rootGone && !overridden)
|
|
1389
1429
|
return { ...base, connection: "root-gone", snapshot: { state: "skipped", reason: "the stack's project folder was moved or deleted" } };
|
|
1390
1430
|
if (target.mode === "user") {
|
|
@@ -1426,12 +1466,11 @@ async function readSelected(selected, responder, folder, gaps, hints, preflight)
|
|
|
1426
1466
|
// stack runs, so Next names that address as the refusal of other commands does. A stopped stack
|
|
1427
1467
|
// this machine started keeps its registration, as a connect keeps it, so Next names the `up` that
|
|
1428
1468
|
// starts it again rather than a registration to repair.
|
|
1429
|
-
const
|
|
1430
|
-
const offline = preflight.kind === "unreachable" && !flagged && target.origin === "up";
|
|
1469
|
+
const offline = preflight.kind === "unreachable" && !overridden && target.origin === "up";
|
|
1431
1470
|
const store = offline ? rootStoreProblem(target.root) : undefined;
|
|
1432
1471
|
let seedBlock;
|
|
1433
1472
|
// A blocked stack refuses that `up`, and Next names the step that clears the block instead.
|
|
1434
|
-
if (preflight.kind === "unreachable" && (
|
|
1473
|
+
if (preflight.kind === "unreachable" && (overridden || offline || target.origin === "manual") && !(servedStack(folder, base) && folder.stackBlock)) {
|
|
1435
1474
|
const { message, remedy, restartRoot } = workspaceErrorParts({ kind: "preflight", failure: "unreachable", target, pruned: !offline && preflight.prune });
|
|
1436
1475
|
seedBlock = store || restartRoot === undefined ? undefined : channelSeedRestartBlock(restartRoot);
|
|
1437
1476
|
if (store)
|
|
@@ -1911,7 +1950,8 @@ function spaceStateCell(r, entry) {
|
|
|
1911
1950
|
const selected = r.selected.resolved && entry.space === r.selected.space;
|
|
1912
1951
|
// The selected connection describes this row only when it dialed the row's address; under
|
|
1913
1952
|
// `--all` with a `--server` that names another, the row shows its own address's check.
|
|
1914
|
-
if (selected && r.selected.resolved && entry.check !== "not-checked" && r.selected.server !== null &&
|
|
1953
|
+
if (selected && r.selected.resolved && entry.check !== "not-checked" && r.selected.server !== null && entry.server !== null &&
|
|
1954
|
+
brokerUrlKey(r.selected.server) === brokerUrlKey(entry.server))
|
|
1915
1955
|
return connectionCell(r.selected);
|
|
1916
1956
|
if (entry.check === "not-checked")
|
|
1917
1957
|
return "";
|
|
@@ -2118,23 +2158,25 @@ function nextActions(r, seedFailed, interactive, recovery, preparedHarness) {
|
|
|
2118
2158
|
}
|
|
2119
2159
|
if (r.selected.resolved) {
|
|
2120
2160
|
const s = r.selected;
|
|
2161
|
+
const reachable = s.connection === "ok" || s.connection === "reachable";
|
|
2121
2162
|
// Name what fixes the default persona alone; setup does far more than that.
|
|
2122
2163
|
if (!noApplication) {
|
|
2123
|
-
if (s.personas.default
|
|
2124
|
-
items.push({ command: `${cmd}
|
|
2125
|
-
else if (
|
|
2126
|
-
items.push({ command: `${cmd}
|
|
2127
|
-
else
|
|
2128
|
-
items.push({ command: `${cmd} spawn`, description: "Open your default agent" });
|
|
2164
|
+
if (s.personas.default !== "missing" && s.personas.default !== "valid")
|
|
2165
|
+
items.push({ command: `${cmd} persona show default --space ${shellWord(s.space)}`, description: "See what is wrong with the default persona" });
|
|
2166
|
+
else if (reachable)
|
|
2167
|
+
items.push({ command: `${cmd} spawn`, description: s.personas.default === "missing" ? "Open your default agent; creates the shipped default persona" : "Open your default agent" });
|
|
2129
2168
|
}
|
|
2130
|
-
|
|
2169
|
+
if (reachable)
|
|
2170
|
+
items.push({ command: `${cmd} who`, description: "See the live roster" });
|
|
2131
2171
|
if (r.stackManager?.endpoint === "answered" || r.outsideStackManager?.endpoint === "answered")
|
|
2132
2172
|
items.push({ command: `${cmd} ps`, description: "List managed agents" });
|
|
2133
2173
|
}
|
|
2134
2174
|
if (r.selected.resolved || !noApplication) {
|
|
2135
2175
|
items.push({ command: `${cmd} space`, description: "List the spaces on this machine" });
|
|
2136
|
-
items.
|
|
2137
|
-
if (r.
|
|
2176
|
+
const unchecked = r.meshes.items.some(m => m.check === "not-checked");
|
|
2177
|
+
if (!r.selected.resolved || r.selected.source !== "registry" || unchecked)
|
|
2178
|
+
items.push({ command: `${cmd} use <name>`, description: "Select the default space" });
|
|
2179
|
+
if (r.meshes.items.length > 1 && unchecked)
|
|
2138
2180
|
items.push({ command: `${cmd} status --all`, description: "Check every registered space" });
|
|
2139
2181
|
}
|
|
2140
2182
|
// A stopped broker is resumed, not restarted. A local controller stack that does not answer,
|
|
@@ -2146,8 +2188,9 @@ function nextActions(r, seedFailed, interactive, recovery, preparedHarness) {
|
|
|
2146
2188
|
// A connection to a `--server` address other than the recorded one does not say whether the stack
|
|
2147
2189
|
// answers; the hint `readSelected` adds names that address. A user-auth space is probed on its own path.
|
|
2148
2190
|
const dialed = r.selected.resolved ? r.selected : undefined;
|
|
2191
|
+
const recordedServer = r.meshes.items.find((m) => m.space === dialed?.space)?.server;
|
|
2149
2192
|
const elsewhere = dialed !== undefined && dialed.mode !== "user" && (dialed.source === "flag-server" || dialed.source === "flag-space-override")
|
|
2150
|
-
&&
|
|
2193
|
+
&& (recordedServer == null || dialed.server === null ? recordedServer !== dialed.server : brokerUrlKey(recordedServer) !== brokerUrlKey(dialed.server));
|
|
2151
2194
|
const stack = servedStack(r.folder, r.selected), own = stack !== undefined;
|
|
2152
2195
|
const seedBlocksRestart = r.selected.channelSeedBlocksRestart;
|
|
2153
2196
|
// This folder's own stack is blocked the same way under another selection, and its block leads too.
|
|
@@ -2163,7 +2206,7 @@ function nextActions(r, seedFailed, interactive, recovery, preparedHarness) {
|
|
|
2163
2206
|
if (r.selected.resolved && r.selected.connection === "broker-stopped")
|
|
2164
2207
|
items.unshift({ command: `kill -CONT ${r.selected.brokerPid}`, description: "Resume the stopped broker process so it answers again" });
|
|
2165
2208
|
else if (block && blocked) {
|
|
2166
|
-
const inspect = { command: `${cmd} service status ${block.definition} --instance ${block.instanceId} --space ${blocked.space}`, description: block.route.kind === "inspect" ? "Inspect the member that keeps up and down from settling" : "Inspect that member" };
|
|
2209
|
+
const inspect = { command: `${cmd} service status ${block.definition} --instance ${block.instanceId} --space ${shellWord(blocked.space)}`, description: block.route.kind === "inspect" ? "Inspect the member that keeps up and down from settling" : "Inspect that member" };
|
|
2167
2210
|
items.unshift(...(block.route.kind === "abandon" ? [{ command: `${cmd} down --abandon-stop ${block.route.requestId} --yes`, description: `Abandon the unconfirmed stop of ${block.definition}; up and down refuse until then` }, inspect] : [inspect]));
|
|
2168
2211
|
}
|
|
2169
2212
|
else if (stack && r.folder.stackUnfinished) {
|
|
@@ -2194,7 +2237,7 @@ function nextActions(r, seedFailed, interactive, recovery, preparedHarness) {
|
|
|
2194
2237
|
// `up` neither adopts nor replaces a service outside the stack that runs one of this root's
|
|
2195
2238
|
// records, so each is stopped first, with the stop `up` names.
|
|
2196
2239
|
const held = r.folder.heldServices ?? [], space = r.selected.space;
|
|
2197
|
-
items.unshift(...held.map((row) => ({ command: `${cmd} svc stop ${row.definition} --instance ${row.instanceId} --space ${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" });
|
|
2240
|
+
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" });
|
|
2198
2241
|
}
|
|
2199
2242
|
else if (!storeBlocked && !seedBlocksRestart && exited.length) {
|
|
2200
2243
|
const broker = exited.includes("nats"), manager = exited.includes("manager");
|
|
@@ -2208,13 +2251,13 @@ function nextActions(r, seedFailed, interactive, recovery, preparedHarness) {
|
|
|
2208
2251
|
}
|
|
2209
2252
|
// A stack whose folder was deleted stops only from this machine's records.
|
|
2210
2253
|
if (r.selected.resolved && r.selected.rootGone)
|
|
2211
|
-
items.unshift({ command: `${cmd} down --space ${r.selected.space} --yes`, description: "Stop the stack whose folder is gone and free its name" });
|
|
2254
|
+
items.unshift({ command: `${cmd} down --space ${shellWord(r.selected.space)} --yes`, description: "Stop the stack whose folder is gone and free its name" });
|
|
2212
2255
|
if (r.selected.resolved && r.selected.mode === "user" && r.selected.login && !r.selected.login.subject)
|
|
2213
2256
|
items.unshift({ command: `${cmd} login --idp ${r.selected.login.idp}`, description: "Sign in to the selected space" });
|
|
2214
2257
|
// A delivery member that runs with no lease is not replaced by `up`; `down` kills one that does not exit.
|
|
2215
2258
|
const deliveryPid = stackDeliveryPid(r);
|
|
2216
2259
|
if (r.selected.resolved && r.selected.deliveryResponder === "unbound" && deliveryPid !== undefined)
|
|
2217
|
-
items.unshift({ command: `${cmd} service status stack-delivery${own ? "" : ` --space ${r.selected.space}`}`, description: `Read the delivery member's record: pid ${deliveryPid} is alive but holds no lease, so it is starting or not responding` }, { command: own ? `${cmd} down --yes` : `${cmd} down --space ${r.selected.space} --yes`, description: "If it stays that way, stop the stack; down kills a member that does not exit on SIGTERM" }, { command: own ? `${cmd} up` : `${cmd} up --root ${shellWord(r.selected.root)}`, description: "Then start the stack again" });
|
|
2260
|
+
items.unshift({ command: `${cmd} service status stack-delivery${own ? "" : ` --space ${shellWord(r.selected.space)}`}`, description: `Read the delivery member's record: pid ${deliveryPid} is alive but holds no lease, so it is starting or not responding` }, { command: own ? `${cmd} down --yes` : `${cmd} down --space ${shellWord(r.selected.space)} --yes`, description: "If it stays that way, stop the stack; down kills a member that does not exit on SIGTERM" }, { command: own ? `${cmd} up` : `${cmd} up --root ${shellWord(r.selected.root)}`, description: "Then start the stack again" });
|
|
2218
2261
|
// A manager that does not answer cannot report its stop impact, so no stop route reaches it.
|
|
2219
2262
|
if (r.stackManager?.endpoint === "not-answering")
|
|
2220
2263
|
items.unshift({ command: `kill -KILL ${r.stackManager.pid}`, description: `The stack manager does not answer, so \`${cmd} down\` cannot stop it. If it stays that way, end its process; \`${cmd} down --yes\` then records it stopped` });
|
|
@@ -2224,7 +2267,7 @@ function nextActions(r, seedFailed, interactive, recovery, preparedHarness) {
|
|
|
2224
2267
|
const first = `First ${repair}`;
|
|
2225
2268
|
// A broker without JetStream cannot record the manager's stop, and it stops only after the manager.
|
|
2226
2269
|
if (r.store.jetStreamDisabled && r.stackManager && r.selected.resolved)
|
|
2227
|
-
items.unshift({ command: `kill -TERM ${r.stackManager.pid}`, description: "The broker disabled JetStream after the write failure and serves none until it restarts, which needs the manager stopped first. On this host, end the manager; it stops its agents by its default policy" }, { command: own ? `${cmd} down --yes` : `${cmd} down --space ${r.selected.space} --yes`, description: "Then stop the other members" }, { command: own ? `${cmd} up` : `${cmd} up --root ${shellWord(r.selected.root)}`, description: `${first}; then up starts the broker again with the history it kept` });
|
|
2270
|
+
items.unshift({ command: `kill -TERM ${r.stackManager.pid}`, description: "The broker disabled JetStream after the write failure and serves none until it restarts, which needs the manager stopped first. On this host, end the manager; it stops its agents by its default policy" }, { command: own ? `${cmd} down --yes` : `${cmd} down --space ${shellWord(r.selected.space)} --yes`, description: "Then stop the other members" }, { command: own ? `${cmd} up` : `${cmd} up --root ${shellWord(r.selected.root)}`, description: `${first}; then up starts the broker again with the history it kept` });
|
|
2228
2271
|
else
|
|
2229
2272
|
items.unshift({ command: `${cmd} down`, description: `${first}; then \`${cmd} up\` starts the broker again with the history it kept` });
|
|
2230
2273
|
}
|
|
@@ -2242,7 +2285,7 @@ function nextActions(r, seedFailed, interactive, recovery, preparedHarness) {
|
|
|
2242
2285
|
}
|
|
2243
2286
|
// The broker keeps serving a store it found damage in, from what it can still read there.
|
|
2244
2287
|
if (r.store?.state === "damaged" && r.selected.resolved && r.services?.instances?.some((row) => row.definition === STACK_DEFINITION.broker))
|
|
2245
|
-
items.unshift({ command: `${cmd} service logs stack-broker${own ? "" : ` --space ${r.selected.space}`}`, description: "Read what the broker logged about the damage it found in its store; history holds only what it could still read" });
|
|
2288
|
+
items.unshift({ command: `${cmd} service logs stack-broker${own ? "" : ` --space ${shellWord(r.selected.space)}`}`, description: "Read what the broker logged about the damage it found in its store; history holds only what it could still read" });
|
|
2246
2289
|
return { title: "Next", blocks: [{ kind: "commands", items }, ...[...extra, ...r.hints].map((hint) => ({ kind: "lines", lines: [cell(hint, "hint")] }))] };
|
|
2247
2290
|
}
|
|
2248
2291
|
function ownedServicesOverview(services) {
|
|
@@ -2273,9 +2316,10 @@ function ownedServicesOverview(services) {
|
|
|
2273
2316
|
blocks.push({ kind: "lines", lines: [cell(`Local records and process observations as of ${services.observedAt}; non-atomic. Recorded readiness is historical, not a fresh endpoint response. No OS unit query, service control, adoption or remote process ownership is implied.`, "hint")] });
|
|
2274
2317
|
// The space is known here, and a sole instance names its service and full ID as well.
|
|
2275
2318
|
const sole = services.instances?.length === 1 ? services.instances[0] : undefined;
|
|
2276
|
-
|
|
2277
|
-
|
|
2319
|
+
if (services.space !== null && (services.instances?.length || services.definitions?.length)) {
|
|
2320
|
+
const inspect = `${displayCmd()} svc status ${sole ? `${sole.definition} --instance ${sole.instanceId}` : "<service> --instance <full-id>"} --space ${shellWord(services.space)}`;
|
|
2278
2321
|
blocks.push({ kind: "commands", items: [{ command: inspect, description: "Inspect one exact owned instance and its recorded supervisor" }, { command: `${displayCmd()} svc`, description: "Read the full saved-service inventory" }] });
|
|
2322
|
+
}
|
|
2279
2323
|
return { title: `Owned services → ${services.space}`, blocks };
|
|
2280
2324
|
}
|
|
2281
2325
|
function bootAttemptOverview(snapshot) {
|
|
@@ -2459,39 +2503,6 @@ async function staticServiceAuth(auth) {
|
|
|
2459
2503
|
caller: { owner: "local", actor: serviceIdentity.id, uid: serviceUid },
|
|
2460
2504
|
};
|
|
2461
2505
|
}
|
|
2462
|
-
/** Display only. A status observation never authorizes process control or proves cleanup. */
|
|
2463
|
-
function managerStopImpactFacts(input) {
|
|
2464
|
-
if (!input || typeof input !== "object" || Array.isArray(input))
|
|
2465
|
-
return ["stop impact not reported by this manager build"];
|
|
2466
|
-
const impact = input;
|
|
2467
|
-
if (!["manager", "owner-filtered"].includes(String(impact.agentScope)) || typeof impact.observedAt !== "string" || impact.observedAt.length > 100 || !Number.isFinite(Date.parse(impact.observedAt)) || !Array.isArray(impact.agents))
|
|
2468
|
-
return ["stop impact could not be interpreted; no safe stop inferred"];
|
|
2469
|
-
const facts = [`stop impact ${impact.agentScope === "manager" ? "manager-owned rows" : "owner-filtered; full scope unknown"} as of ${new Date(impact.observedAt).toISOString()}`];
|
|
2470
|
-
const actions = { stop: 0, release: 0, retained: 0, unknown: 0 };
|
|
2471
|
-
for (const row of impact.agents) {
|
|
2472
|
-
const action = row && typeof row === "object" && !Array.isArray(row) ? row.defaultAction : undefined;
|
|
2473
|
-
if (action === "stop")
|
|
2474
|
-
actions.stop++;
|
|
2475
|
-
else if (action === "release-custody")
|
|
2476
|
-
actions.release++;
|
|
2477
|
-
else if (action === "stop-retaining-state")
|
|
2478
|
-
actions.retained++;
|
|
2479
|
-
else
|
|
2480
|
-
actions.unknown++;
|
|
2481
|
-
}
|
|
2482
|
-
facts.push(`default stop policy: stop ${actions.stop}, release custody ${actions.release}, stop retaining state ${actions.retained}, unknown ${actions.unknown} visible seats`);
|
|
2483
|
-
for (const [key, label] of [["lifecycleInFlight", "lifecycle work"], ["reservedLaunches", "reserved launches"], ["retirementsPending", "pending retirements"], ["deprovisioningInFlight", "cleanup in flight"], ["staticReconciliationInFlight", "reconciliation in flight"]]) {
|
|
2484
|
-
const count = impact[key];
|
|
2485
|
-
if (!Number.isSafeInteger(count) || Number(count) < 0)
|
|
2486
|
-
facts.push(`${label} unknown`);
|
|
2487
|
-
else if (Number(count) > 0)
|
|
2488
|
-
facts.push(`${label} ${count}`);
|
|
2489
|
-
}
|
|
2490
|
-
if (impact.stopping === true)
|
|
2491
|
-
facts.push("native manager stop already in progress");
|
|
2492
|
-
facts.push("stop not reserved; seat exit and cleanup not checked");
|
|
2493
|
-
return facts;
|
|
2494
|
-
}
|
|
2495
2506
|
/** A service registration is the health target itself. Calling its `status` command through a
|
|
2496
2507
|
* generic endpoint does not work on this base because a passive status endpoint has no v0.4 caller
|
|
2497
2508
|
* rail; a one-shot standalone caller does. */
|
|
@@ -2850,7 +2861,7 @@ async function brokerHealth(target, store) {
|
|
|
2850
2861
|
if (target.mode !== "user") {
|
|
2851
2862
|
const preflight = await preflightTarget(target);
|
|
2852
2863
|
if (!preflight.ok)
|
|
2853
|
-
return { name: "broker", verdict: "not-serving", facts: [`registered ${address}`, workspaceErrorParts({ kind: "preflight", failure: preflight.kind, target, pruned: false }).message] };
|
|
2864
|
+
return { name: "broker", verdict: "not-serving", facts: [`registered ${address}`, workspaceErrorParts({ kind: "preflight", failure: preflight.kind, target, pruned: false, ...(preflight.pid === undefined ? {} : { pid: preflight.pid }) }).message] };
|
|
2854
2865
|
return { name: "broker", verdict: storeFailure ? "not-serving" : "serving", facts: [`registered ${address}`, "reachable", ...(storeFailure ? [storeFailure] : [])] };
|
|
2855
2866
|
}
|
|
2856
2867
|
const reachable = await isReachable(target.server, target.tlsRequired ? { tls: true } : {});
|
|
@@ -2868,6 +2879,11 @@ async function printComponentHealth(selected, store) {
|
|
|
2868
2879
|
section("Component Health");
|
|
2869
2880
|
if (!selected.ok) {
|
|
2870
2881
|
const e = selected.error;
|
|
2882
|
+
if (isCommandFailure(e) && e.code === "SCHEMA_INVALID") {
|
|
2883
|
+
printComponent({ name: "target", verdict: "refused", facts: [e.code, e.message, ...(e.remedy ? [e.remedy] : [])] });
|
|
2884
|
+
process.exitCode = COMPONENT_EXIT.refused;
|
|
2885
|
+
return;
|
|
2886
|
+
}
|
|
2871
2887
|
if (isMeshRegistryError(e)) {
|
|
2872
2888
|
printComponent({ name: "target", verdict: "refused", facts: ["SCHEMA_INVALID", e.message] });
|
|
2873
2889
|
process.exitCode = COMPONENT_EXIT.refused;
|