@cotal-ai/cli 0.171.2 → 0.171.4
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 +142 -85
- package/dist/command.js.map +1 -1
- package/dist/commands/agents.js +7 -7
- package/dist/commands/agents.js.map +1 -1
- package/dist/commands/app-identity.d.ts +6 -0
- package/dist/commands/app-identity.d.ts.map +1 -1
- package/dist/commands/app-identity.js +4 -4
- package/dist/commands/app-identity.js.map +1 -1
- package/dist/commands/backup-maintenance.js +1 -1
- package/dist/commands/backup-maintenance.js.map +1 -1
- package/dist/commands/down.d.ts.map +1 -1
- package/dist/commands/down.js +7 -5
- package/dist/commands/down.js.map +1 -1
- package/dist/commands/ext.d.ts.map +1 -1
- package/dist/commands/ext.js +9 -4
- package/dist/commands/ext.js.map +1 -1
- package/dist/commands/help.d.ts.map +1 -1
- package/dist/commands/help.js +2 -13
- package/dist/commands/help.js.map +1 -1
- package/dist/commands/history-clear.d.ts.map +1 -1
- package/dist/commands/history-clear.js +18 -2
- package/dist/commands/history-clear.js.map +1 -1
- package/dist/commands/join.js +7 -2
- package/dist/commands/join.js.map +1 -1
- package/dist/commands/manager-service.d.ts +1 -1
- package/dist/commands/manager-service.d.ts.map +1 -1
- package/dist/commands/manager-service.js +9 -4
- package/dist/commands/manager-service.js.map +1 -1
- package/dist/commands/reset-space-apply.d.ts.map +1 -1
- package/dist/commands/reset-space-apply.js +2 -1
- package/dist/commands/reset-space-apply.js.map +1 -1
- package/dist/commands/reset-store-apply.d.ts +6 -0
- package/dist/commands/reset-store-apply.d.ts.map +1 -1
- package/dist/commands/reset-store-apply.js +22 -2
- package/dist/commands/reset-store-apply.js.map +1 -1
- package/dist/commands/service-registry.d.ts.map +1 -1
- package/dist/commands/service-registry.js +2 -0
- package/dist/commands/service-registry.js.map +1 -1
- package/dist/commands/space.d.ts +1 -0
- package/dist/commands/space.d.ts.map +1 -1
- package/dist/commands/space.js +5 -1
- package/dist/commands/space.js.map +1 -1
- package/dist/commands/spawn.d.ts +7 -2
- package/dist/commands/spawn.d.ts.map +1 -1
- package/dist/commands/spawn.js +115 -30
- package/dist/commands/spawn.js.map +1 -1
- package/dist/commands/stack-down.d.ts.map +1 -1
- package/dist/commands/stack-down.js +7 -8
- package/dist/commands/stack-down.js.map +1 -1
- package/dist/commands/stack-up.d.ts +3 -1
- package/dist/commands/stack-up.d.ts.map +1 -1
- package/dist/commands/stack-up.js +19 -8
- package/dist/commands/stack-up.js.map +1 -1
- package/dist/commands/status.d.ts +12 -1
- package/dist/commands/status.d.ts.map +1 -1
- package/dist/commands/status.js +89 -34
- package/dist/commands/status.js.map +1 -1
- package/dist/commands/up.d.ts.map +1 -1
- package/dist/commands/up.js +47 -22
- package/dist/commands/up.js.map +1 -1
- package/dist/commands/update.d.ts +1 -0
- package/dist/commands/update.d.ts.map +1 -1
- package/dist/commands/update.js +87 -31
- package/dist/commands/update.js.map +1 -1
- package/dist/ext-loader.d.ts +1 -1
- package/dist/ext-loader.d.ts.map +1 -1
- package/dist/ext-loader.js +3 -3
- package/dist/ext-loader.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/local-process-stop.d.ts +2 -0
- package/dist/lib/local-process-stop.d.ts.map +1 -1
- package/dist/lib/local-process-stop.js +1 -0
- package/dist/lib/local-process-stop.js.map +1 -1
- package/dist/lib/manager-proc.d.ts +2 -1
- package/dist/lib/manager-proc.d.ts.map +1 -1
- package/dist/lib/manager-proc.js +8 -2
- package/dist/lib/manager-proc.js.map +1 -1
- package/dist/lib/nats-bin.d.ts +1 -0
- package/dist/lib/nats-bin.d.ts.map +1 -1
- package/dist/lib/nats-bin.js +1 -0
- package/dist/lib/nats-bin.js.map +1 -1
- package/dist/lib/persona-files.d.ts +1 -1
- package/dist/lib/persona-files.d.ts.map +1 -1
- package/dist/lib/persona-files.js +10 -2
- package/dist/lib/persona-files.js.map +1 -1
- package/dist/lib/registry-errors.d.ts +2 -1
- package/dist/lib/registry-errors.d.ts.map +1 -1
- package/dist/lib/registry-errors.js +3 -2
- package/dist/lib/registry-errors.js.map +1 -1
- package/dist/lib/restore.d.ts +4 -3
- package/dist/lib/restore.d.ts.map +1 -1
- package/dist/lib/restore.js +12 -10
- package/dist/lib/restore.js.map +1 -1
- package/dist/lib/self-exec.d.ts.map +1 -1
- package/dist/lib/self-exec.js +8 -2
- package/dist/lib/self-exec.js.map +1 -1
- package/dist/lib/service-adapters.d.ts +1 -1
- package/dist/lib/service-adapters.d.ts.map +1 -1
- package/dist/lib/service-adapters.js +2 -2
- package/dist/lib/service-adapters.js.map +1 -1
- package/dist/lib/service-census.d.ts +5 -5
- package/dist/lib/service-install-intent.d.ts +2 -2
- package/dist/lib/service-instances.d.ts +2 -2
- package/dist/lib/service-presets.d.ts +1 -1
- package/dist/lib/service-presets.d.ts.map +1 -1
- package/dist/lib/service-presets.js +4 -4
- package/dist/lib/service-presets.js.map +1 -1
- package/dist/lib/service-supervision.d.ts +1 -1
- package/dist/lib/service-systemd-attempt-read.d.ts +3 -3
- package/dist/lib/service-uninstall-intent.d.ts +2 -2
- package/dist/lib/stack-journal.d.ts +11 -6
- package/dist/lib/stack-journal.d.ts.map +1 -1
- package/dist/lib/stack-journal.js +16 -9
- package/dist/lib/stack-journal.js.map +1 -1
- package/dist/lib/team-agent-removal.d.ts +1 -1
- package/dist/lib/version.d.ts +2 -0
- package/dist/lib/version.d.ts.map +1 -1
- package/dist/lib/version.js +26 -10
- package/dist/lib/version.js.map +1 -1
- package/dist/seed/reconcile.d.ts.map +1 -1
- package/dist/seed/reconcile.js +5 -2
- package/dist/seed/reconcile.js.map +1 -1
- package/package.json +12 -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, isReachable, isStreamNotFound, mintCreds, mintLifecycleUid, resolveService, realDirNoSymlink, invokeRepairingSplit, standaloneConnectOpts, newIdentity, idFromCreds, principalKey, DEV_OWNER, unansweredRequest, resolveAuthProvider, personaDir, } from "@cotal-ai/core";
|
|
6
|
-
import { stoppedLoopbackListener, 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, oneLine, spaceKey, PREFERENCE_KEYS, plainFlag, preflightTarget, presentationOf, principalFromBearer, verifyIdentityPin, probeWebReadiness, readCurrent, readMeshRegistry, readPidfile, preparedRecordSkipped, readPreparedSpaces, stackJournalPath, readRenewalRecord, recordOperationSpace, renderWorkspaceError, 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, 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, renderWorkspaceError, 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";
|
|
@@ -23,6 +23,7 @@ import { c } from "../ui.js";
|
|
|
23
23
|
import { preparedCatalogDiagnostics } from "./sync.js";
|
|
24
24
|
import { agentStatus } from "./agents.js";
|
|
25
25
|
import { invalidEnvironmentValues } from "./config.js";
|
|
26
|
+
import { canPrompt } from "./meshes-wizard.js";
|
|
26
27
|
import { cliControl, onInstance, onRerun } from "../lib/control.js";
|
|
27
28
|
import { serviceDefinitionProjection, serviceDefinitionStore } from "../lib/service-definitions.js";
|
|
28
29
|
import { instanceProjection, serviceInstances } from "../lib/service-instances.js";
|
|
@@ -37,6 +38,8 @@ import { rootStoreProblem } from "../lib/store-dir.js";
|
|
|
37
38
|
import { stackStoreWarnings } from "../lib/store-identity.js";
|
|
38
39
|
import { natsServerLabel } from "../lib/nats-bin.js";
|
|
39
40
|
import { askManager } from "@cotal-ai/workspace/control";
|
|
41
|
+
import { readCursor } from "../seed/lock.js";
|
|
42
|
+
import { reconcileCursorPath } from "../seed/paths.js";
|
|
40
43
|
/** `--components` is the fail-loud health pass with a machine-readable EXIT DISPOSITION. Bare
|
|
41
44
|
* `status` is a broad, recovery-oriented report: it exits 0, or 4 when it could not read part of what
|
|
42
45
|
* it reports; this explicit mode is for an operator or monitor that needs a component state per
|
|
@@ -169,14 +172,28 @@ export async function status(args) {
|
|
|
169
172
|
if (preferencesFolder)
|
|
170
173
|
hints.push(`protect the preferences folder: ${preferencesFolder.remedy}`);
|
|
171
174
|
const machine = await readMachine(selected, gaps, hints);
|
|
175
|
+
const installationChanging = gaps.warnings.some((warning) => warning.code === "INSTALLATION_CHANGING");
|
|
172
176
|
const extensions = readExtensions(gaps);
|
|
177
|
+
let seed;
|
|
178
|
+
try {
|
|
179
|
+
const cursor = readCursor();
|
|
180
|
+
if (cursor?.failed !== undefined)
|
|
181
|
+
seed = cursor;
|
|
182
|
+
}
|
|
183
|
+
catch (error) {
|
|
184
|
+
const path = reconcileCursorPath();
|
|
185
|
+
const code = error.code;
|
|
186
|
+
gaps.add("EXTENSIONS_UNREADABLE", `the connector seed cursor at ${path} could not be read${code ? ` (${code})` : ""}`, { path });
|
|
187
|
+
}
|
|
173
188
|
const skewedExtensions = extensions.items?.filter((item) => item.package.startsWith("@cotal-ai/") && item.version !== machine.version) ?? [];
|
|
174
189
|
const extensionWarnings = skewedExtensions.length ? [{
|
|
175
190
|
code: "EXTENSION_VERSION_SKEW",
|
|
176
191
|
target: { version: machine.version, packages: skewedExtensions.map((item) => item.package) },
|
|
177
|
-
message: `extension version skew: ${skewedExtensions.map((item) => `${item.package} is ${item.version}`).join(", ")}; this cotal is ${machine.version}.
|
|
192
|
+
message: `extension version skew: ${skewedExtensions.map((item) => `${item.package} is ${item.version}`).join(", ")}; this cotal is ${machine.version}. ${installationChanging
|
|
193
|
+
? "These versions may change. Check again when that command finishes."
|
|
194
|
+
: `Run \`${displayCmd()} update --self\` to reconcile this installation.`}`,
|
|
178
195
|
}] : [];
|
|
179
|
-
if (extensionWarnings.length)
|
|
196
|
+
if (extensionWarnings.length && !installationChanging)
|
|
180
197
|
hints.push(`reconcile extension versions with \`${displayCmd()} update --self\``);
|
|
181
198
|
// THE RESPONDER AXIS (#1576), read ONCE and threaded into the rows that would otherwise claim
|
|
182
199
|
// health they never checked. It is read before the folder section because that section renders
|
|
@@ -238,8 +255,14 @@ export async function status(args) {
|
|
|
238
255
|
const full = selected.ok && target.resolved && target.storedBytes !== null && logged?.state !== "write-failed" ? storeFull(selected.target.root, selected.target.space, target.storedBytes) : undefined;
|
|
239
256
|
const store = full ?? logged;
|
|
240
257
|
const stackManager = selected.ok ? await readStackManager(selected.target, services) : undefined;
|
|
258
|
+
const outsideStackManager = selected.ok && target.resolved && servedStack(folder, target) && folder.noManager && !folder.managerService && !stackManager
|
|
259
|
+
&& (target.connection === "ok" || target.connection === "reachable")
|
|
260
|
+
? await managerEndpoint(selected.target)
|
|
261
|
+
: undefined;
|
|
241
262
|
// Two readers can name the same unreadable record, so each hint is listed once.
|
|
242
|
-
const result = { kind: "infrastructure", machine, extensions, folder, meshes, selected: target, services, bootAttempts, maintenance, ...(store ? { store } : {}), ...(stackManager ? { stackManager } : {}),
|
|
263
|
+
const result = { kind: "infrastructure", machine, extensions, folder, meshes, selected: target, services, bootAttempts, maintenance, ...(store ? { store } : {}), ...(stackManager ? { stackManager } : {}), ...(outsideStackManager ? { outsideStackManager } : {}), hints: seed?.failed !== undefined
|
|
264
|
+
? [`Fix the recorded cause first:\n${seed.failed}`, `Then run \`${displayCmd()} ext seed --repair\` before starting a space`, ...(recovery ? [recovery] : [])]
|
|
265
|
+
: [...new Set(hints)] };
|
|
243
266
|
const parts = gaps.warnings.length;
|
|
244
267
|
// A preference variable `config set` would refuse is named, but it was read, so the run stays complete.
|
|
245
268
|
// An unreadable preferences file is already a gap, so the variables are checked without it.
|
|
@@ -263,7 +286,12 @@ export async function status(args) {
|
|
|
263
286
|
completeness: parts ? "partial" : "complete",
|
|
264
287
|
warnings: [...gaps.warnings, ...extensionWarnings, ...invalidValues, ...survivors],
|
|
265
288
|
...(parts ? { partial: { message: `status could not read ${parts === 1 ? "one part" : `${parts} parts`} of what it reports; the warnings name ${parts === 1 ? "it" : "each"}` } } : {}),
|
|
266
|
-
}, (result) => statusView(result, Boolean(values.verbose), Boolean(values.all) || Boolean(values.wide)
|
|
289
|
+
}, (result) => statusView(result, Boolean(values.verbose), Boolean(values.all) || Boolean(values.wide), {
|
|
290
|
+
interactive: presentation === "rich" && canPrompt(),
|
|
291
|
+
preparedHarness: !selected.ok && isWorkspaceTargetError(selected.error) && selected.error.code === "not-started" && preparedNeverStarted(selected.error.details)
|
|
292
|
+
? preferences.spaces[selected.error.details.space]?.harness : undefined,
|
|
293
|
+
seed,
|
|
294
|
+
}));
|
|
267
295
|
if (values.components)
|
|
268
296
|
await printComponentHealth(selected, store);
|
|
269
297
|
}
|
|
@@ -415,7 +443,7 @@ async function readMachine(selected, gaps, hints) {
|
|
|
415
443
|
}
|
|
416
444
|
// Loading a connector's provider waits for a command that is changing the installation. Status is
|
|
417
445
|
// a read: it reports that command and leaves the rows unread.
|
|
418
|
-
const writer =
|
|
446
|
+
const writer = installationWriter();
|
|
419
447
|
if (writer) {
|
|
420
448
|
gaps.add("INSTALLATION_CHANGING", `another cotal command (pid ${writer.pid}) is changing this installation, so the application rows were not read`, { pid: writer.pid });
|
|
421
449
|
hints.push("run `cotal status` again when that command finishes");
|
|
@@ -976,7 +1004,7 @@ async function managerProcess(target, state, space, gaps) {
|
|
|
976
1004
|
// A live pid whose instance is not on this root must not take an unpinned answer.
|
|
977
1005
|
if (target.mode === "user" && localId === undefined)
|
|
978
1006
|
return running("service unchecked");
|
|
979
|
-
const endpoint = await managerEndpoint(target, localId);
|
|
1007
|
+
const { endpoint } = await managerEndpoint(target, localId);
|
|
980
1008
|
if (endpoint === "not-answering")
|
|
981
1009
|
return { name: "manager", state: "not-serving", pid: state.pid ?? null, detail: ["service endpoint not answering", ...details.filter((d) => d.startsWith("delivery-aware marker unreadable"))].join(" · ") };
|
|
982
1010
|
return running(endpoint === "unchecked" ? "service unchecked" : undefined);
|
|
@@ -1049,16 +1077,18 @@ async function managerEndpoint(target, instanceId) {
|
|
|
1049
1077
|
if (target.mode === "user") {
|
|
1050
1078
|
const credential = await componentCredential(target);
|
|
1051
1079
|
if (credential.kind !== "user")
|
|
1052
|
-
return "unchecked";
|
|
1080
|
+
return { endpoint: "unchecked" };
|
|
1053
1081
|
status = await userManagerStatus(target, instanceId);
|
|
1054
1082
|
}
|
|
1055
1083
|
else {
|
|
1056
1084
|
status = await managerServiceHealth(target, await staticServiceAuth(target.auth));
|
|
1057
1085
|
}
|
|
1058
|
-
|
|
1086
|
+
if (instanceId !== undefined && status.instanceId !== instanceId)
|
|
1087
|
+
return { endpoint: "unchecked" };
|
|
1088
|
+
return { endpoint: "answered", ...(typeof status.instanceId === "string" && status.instanceId ? { instanceId: status.instanceId } : {}) };
|
|
1059
1089
|
}
|
|
1060
1090
|
catch (e) {
|
|
1061
|
-
return managerNoService(e) ? "not-answering" : "unchecked";
|
|
1091
|
+
return { endpoint: managerNoService(e) ? "not-answering" : "unchecked" };
|
|
1062
1092
|
}
|
|
1063
1093
|
}
|
|
1064
1094
|
/** A controller stack's manager is an owned service, and its instance record reads `running` while
|
|
@@ -1071,7 +1101,8 @@ async function readStackManager(target, services) {
|
|
|
1071
1101
|
const pin = target.mode === "user" ? localManagerInstanceId(target.root, target.space) : row.nativeEndpoint?.instanceId;
|
|
1072
1102
|
if (target.mode === "user" && pin === undefined)
|
|
1073
1103
|
return { instanceId: row.instanceId, pid: row.pid, endpoint: "unchecked" };
|
|
1074
|
-
|
|
1104
|
+
const { endpoint } = await managerEndpoint(target, pin);
|
|
1105
|
+
return { instanceId: row.instanceId, pid: row.pid, endpoint };
|
|
1075
1106
|
}
|
|
1076
1107
|
/** The delivery row's responder detail (#1576). An unbound responder is not a footnote about a
|
|
1077
1108
|
* component: while it holds, the mesh cannot spawn, retire or accept a join, and the whole reported
|
|
@@ -1731,10 +1762,12 @@ function setUpApplications(m) {
|
|
|
1731
1762
|
return (m.connectors ?? []).filter((connector) => !connector.missing.length).map((connector) => connector.name);
|
|
1732
1763
|
}
|
|
1733
1764
|
/** The applications line: the names that are set up, and how many more `cotal setup` would add. */
|
|
1734
|
-
function applicationsCell(m) {
|
|
1765
|
+
function applicationsCell(m, interactive) {
|
|
1735
1766
|
if (m.connectors === null)
|
|
1736
1767
|
return stateCell("could not be read", "failed");
|
|
1737
1768
|
const setUp = setUpApplications(m), others = m.connectors.length - setUp.length;
|
|
1769
|
+
if (!interactive)
|
|
1770
|
+
return setUp.length ? stateCell(`${setUp.join(", ")}${others ? ` · ${others} not set up` : ""}`, "ok") : stateCell("not set up", "hint");
|
|
1738
1771
|
if (!setUp.length)
|
|
1739
1772
|
return stateCell(`not set up · \`${displayCmd()} setup\` adds one`, "hint");
|
|
1740
1773
|
return stateCell(`${setUp.join(", ")}${others ? ` · ${others} more with \`${displayCmd()} setup\`` : ""}`, "ok");
|
|
@@ -1769,7 +1802,7 @@ function extensionsCell(e) {
|
|
|
1769
1802
|
* with the same version spelled out on each, and the broker executable's full bundled path on a
|
|
1770
1803
|
* healthy machine: a block of text whose signal a reader had to hunt for.
|
|
1771
1804
|
*/
|
|
1772
|
-
function machineOverview(r, wide) {
|
|
1805
|
+
function machineOverview(r, wide, interactive, seed) {
|
|
1773
1806
|
const m = r.machine;
|
|
1774
1807
|
const tones = { ok: "ok", warn: "waiting", error: "failed", off: "hint" };
|
|
1775
1808
|
const setUp = setUpApplications(m);
|
|
@@ -1778,7 +1811,7 @@ function machineOverview(r, wide) {
|
|
|
1778
1811
|
const rows = wide
|
|
1779
1812
|
? m.integrations.map((item) => [item.name, stateCell(item.text, tones[item.state])])
|
|
1780
1813
|
: m.integrations.filter((item) => item.state !== "ok" && ownedBySetUp(item.name)).map((item) => [item.name, stateCell(item.text, tones[item.state])]);
|
|
1781
|
-
rows.unshift(["Agent applications", applicationsCell(m)]);
|
|
1814
|
+
rows.unshift(["Agent applications", applicationsCell(m, interactive)]);
|
|
1782
1815
|
if (wide)
|
|
1783
1816
|
for (const connector of m.connectors ?? []) {
|
|
1784
1817
|
if (m.integrations.some((item) => item.name.toLowerCase().includes(connector.name.toLowerCase())))
|
|
@@ -1804,6 +1837,8 @@ function machineOverview(r, wide) {
|
|
|
1804
1837
|
: extensionsCell(r.extensions);
|
|
1805
1838
|
if (extensions !== undefined)
|
|
1806
1839
|
rows.push(["Extensions", extensions]);
|
|
1840
|
+
if (seed)
|
|
1841
|
+
rows.push(["Connector setup", stateCell(`incomplete · ${seed.package} failed during ${seed.phase}`, "failed")]);
|
|
1807
1842
|
return {
|
|
1808
1843
|
title: "This machine",
|
|
1809
1844
|
blocks: [
|
|
@@ -1869,7 +1904,7 @@ function spaceStateCell(r, entry) {
|
|
|
1869
1904
|
* is not a group title: it groups spaces by an address a reader does not act on here, and `cotal
|
|
1870
1905
|
* space show <name>` names it. `--all` and `--wide` keep the grouped report.
|
|
1871
1906
|
*/
|
|
1872
|
-
function spacesOverview(r, wide) {
|
|
1907
|
+
function spacesOverview(r, wide, seedFailed) {
|
|
1873
1908
|
const blocks = [];
|
|
1874
1909
|
// The space this report is for: the target it resolved or the space it is about, else the selection
|
|
1875
1910
|
// it could not resolve.
|
|
@@ -1881,7 +1916,7 @@ function spacesOverview(r, wide) {
|
|
|
1881
1916
|
});
|
|
1882
1917
|
const columns = [{ key: "space", label: "Space" }, { key: "state", label: "Connection" }, { key: "detail", label: "Signs in" }];
|
|
1883
1918
|
if (!r.meshes.items.length && !r.meshes.unreadable.length)
|
|
1884
|
-
blocks.push({ kind: "lines", lines: [cell("No spaces registered", "hint"), cell(`Sign in to Cotal Cloud with \`${displayCmd()} login\`.`, "hint")] });
|
|
1919
|
+
blocks.push({ kind: "lines", lines: [cell("No spaces registered", "hint"), ...(seedFailed ? [] : [cell(`Sign in to Cotal Cloud with \`${displayCmd()} login\`.`, "hint")])] });
|
|
1885
1920
|
else if (wide) {
|
|
1886
1921
|
const groups = new Map();
|
|
1887
1922
|
for (const entry of r.meshes.items) {
|
|
@@ -1965,11 +2000,14 @@ function selectedOverview(r) {
|
|
|
1965
2000
|
}
|
|
1966
2001
|
if (s.snapshot.state === "unavailable")
|
|
1967
2002
|
rows.push(["Live details", stateCell(`unavailable · ${s.snapshot.reason}`, "waiting")]);
|
|
1968
|
-
if (r.folder
|
|
2003
|
+
if (servedStack(r.folder, s) && r.folder.noManager && !r.stackManager) {
|
|
1969
2004
|
const service = r.folder.managerService;
|
|
2005
|
+
const outside = r.outsideStackManager;
|
|
1970
2006
|
rows.push(["Manager", service
|
|
1971
2007
|
? stateCell(`the ${service.definition} service · instance ${service.instanceId} · outside this stack, which was started with --no-manager`, "ok")
|
|
1972
|
-
:
|
|
2008
|
+
: outside?.endpoint === "answered"
|
|
2009
|
+
? stateCell(`answering${outside.instanceId ? ` · instance ${outside.instanceId}` : ""} · outside this stack, which was started with --no-manager`, "ok")
|
|
2010
|
+
: stateCell(`${outside?.endpoint === "not-answering" ? "no manager answered" : "endpoint not checked"} · this stack was started with --no-manager`, "hint")]);
|
|
1973
2011
|
}
|
|
1974
2012
|
const blocks = [{ kind: "fields", rows }];
|
|
1975
2013
|
if (r.folder.root === s.root && r.folder.processSpace === s.space && r.folder.controllerStack) {
|
|
@@ -2028,7 +2066,12 @@ function roleList(roles) {
|
|
|
2028
2066
|
function backupRecovery(maintenance) {
|
|
2029
2067
|
return maintenance?.state === "claimed" || maintenance?.state === "restore-ready" ? maintenance.next : null;
|
|
2030
2068
|
}
|
|
2031
|
-
function nextActions(r) {
|
|
2069
|
+
function nextActions(r, seedFailed, interactive, preparedHarness) {
|
|
2070
|
+
if (seedFailed)
|
|
2071
|
+
return {
|
|
2072
|
+
title: "Next",
|
|
2073
|
+
blocks: [{ kind: "lines", lines: r.hints.flatMap(hint => hint.split("\n").map(line => cell(line, "hint"))) }],
|
|
2074
|
+
};
|
|
2032
2075
|
const recovery = backupRecovery(r.maintenance);
|
|
2033
2076
|
if (recovery)
|
|
2034
2077
|
return { title: "Next", blocks: [...new Set([recovery, ...r.hints])].map((hint) => ({ kind: "lines", lines: [cell(hint, "hint")] })) };
|
|
@@ -2039,22 +2082,34 @@ function nextActions(r) {
|
|
|
2039
2082
|
if (!r.selected.resolved && !r.meshes.items.length && !r.meshes.unreadable.length) {
|
|
2040
2083
|
items.push({ command: `${cmd} login`, description: "Sign in to Cotal Cloud" });
|
|
2041
2084
|
}
|
|
2085
|
+
if (noApplication) {
|
|
2086
|
+
const s = r.selected;
|
|
2087
|
+
const connector = r.machine.connectors?.find((row) => row.name === preparedHarness);
|
|
2088
|
+
if (interactive)
|
|
2089
|
+
items.push({ command: `${cmd} setup`, description: !s.resolved && s.code !== "not-started" ? "Set up an agent application and a space" : "Set up an agent application" });
|
|
2090
|
+
else if (connector && !s.resolved && s.code === "not-started" && s.root && s.space && !s.recordedRoot) {
|
|
2091
|
+
const guide = Object.hasOwn(OFFICIAL_CONNECTORS, connector.name) ? `connect-${connector.name}` : "connectors";
|
|
2092
|
+
extra.push(`Install ${connector.missing.join(", ")} on PATH first. See https://docs.cotal.ai/docs/${guide}/.`);
|
|
2093
|
+
items.push({ command: `${cmd} setup --destination local --harness ${shellWord(connector.name)} --project ${shellWord(s.root)} --space ${shellWord(s.space)} --configure-only --no-input`, description: "" });
|
|
2094
|
+
}
|
|
2095
|
+
else
|
|
2096
|
+
items.push({ command: `${cmd} setup --help`, description: "See setup flags for scripts. Bare setup needs a terminal." });
|
|
2097
|
+
}
|
|
2042
2098
|
if (r.selected.resolved) {
|
|
2043
2099
|
const s = r.selected;
|
|
2044
|
-
// A space that already resolves needs only the application to spawn into it.
|
|
2045
|
-
if (noApplication)
|
|
2046
|
-
items.push({ command: `${cmd} setup`, description: "Set up an agent application" });
|
|
2047
2100
|
// Name what fixes the default persona alone; setup does far more than that.
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2101
|
+
if (!noApplication) {
|
|
2102
|
+
if (s.personas.default === "missing")
|
|
2103
|
+
items.push({ command: `${cmd} spawn`, description: "Open your default agent; creates the shipped default persona" });
|
|
2104
|
+
else if (s.personas.default !== "valid")
|
|
2105
|
+
items.push({ command: `${cmd} persona show default --space ${s.space}`, description: "See what is wrong with the default persona" });
|
|
2106
|
+
else
|
|
2107
|
+
items.push({ command: `${cmd} spawn`, description: "Open your default agent" });
|
|
2108
|
+
}
|
|
2109
|
+
items.push({ command: `${cmd} who`, description: "See the live roster" });
|
|
2110
|
+
if (r.stackManager?.endpoint === "answered" || r.outsideStackManager?.endpoint === "answered")
|
|
2111
|
+
items.push({ command: `${cmd} ps`, description: "List managed agents" });
|
|
2055
2112
|
}
|
|
2056
|
-
else if (noApplication)
|
|
2057
|
-
items.push({ command: `${cmd} setup`, description: r.selected.code === "not-started" ? "Set up an agent application" : "Set up an agent application and a space" });
|
|
2058
2113
|
if (r.selected.resolved || !noApplication) {
|
|
2059
2114
|
items.push({ command: `${cmd} space`, description: "List the spaces on this machine" });
|
|
2060
2115
|
items.push({ command: `${cmd} use <name>`, description: "Select the default space" });
|
|
@@ -2228,7 +2283,7 @@ function maintenanceOverview(maintenance) {
|
|
|
2228
2283
|
}
|
|
2229
2284
|
/** The approved screen hierarchy; record-level diagnostics are opt-in. `wide` reports every row in
|
|
2230
2285
|
* full, as `--all` and `--wide` ask. */
|
|
2231
|
-
export function statusView(r, verbose = false, wide = false) {
|
|
2286
|
+
export function statusView(r, verbose = false, wide = false, { interactive = false, preparedHarness, seed } = {}) {
|
|
2232
2287
|
const selected = selectedOverview(r);
|
|
2233
2288
|
// This folder's own stack under another selection, with the lines it has when it is selected.
|
|
2234
2289
|
const held = folderStack(r.folder, r.selected), heldLines = held ? stackLines(r.folder) : [];
|
|
@@ -2236,10 +2291,10 @@ export function statusView(r, verbose = false, wide = false) {
|
|
|
2236
2291
|
const owned = ownedServicesOverview(r.services);
|
|
2237
2292
|
const attempts = bootAttemptOverview(r.bootAttempts);
|
|
2238
2293
|
const maintenance = maintenanceOverview(r.maintenance);
|
|
2239
|
-
const sections = [machineOverview(r, wide), spacesOverview(r, wide), ...(selected ? [selected] : []), ...(heldSection ? [heldSection] : []), ...(maintenance ? [maintenance] : []), ...(attempts ? [attempts] : []), ...(owned ? [owned] : [])];
|
|
2294
|
+
const sections = [machineOverview(r, wide, interactive, seed), spacesOverview(r, wide, Boolean(seed)), ...(selected ? [selected] : []), ...(heldSection ? [heldSection] : []), ...(maintenance ? [maintenance] : []), ...(attempts ? [attempts] : []), ...(owned ? [owned] : [])];
|
|
2240
2295
|
if (verbose)
|
|
2241
2296
|
sections.push(machineSection(r.machine), extensionsSection(r.extensions), folderSection(r.folder, r.selected), ...meshesSections(r.meshes), selectedSection(r.selected, r.folder, stackDeliveryPid(r), r.store?.state === "full"));
|
|
2242
|
-
sections.push(nextActions(r));
|
|
2297
|
+
sections.push(nextActions(r, Boolean(seed), interactive, preparedHarness));
|
|
2243
2298
|
return { sections };
|
|
2244
2299
|
}
|
|
2245
2300
|
function section(name) {
|