@cotal-ai/cli 0.126.3 → 0.127.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.
- package/dist/commands/meshes-wizard.d.ts +2 -0
- package/dist/commands/meshes-wizard.d.ts.map +1 -1
- package/dist/commands/meshes-wizard.js +13 -12
- package/dist/commands/meshes-wizard.js.map +1 -1
- package/dist/commands/meshes.d.ts +1 -1
- package/dist/commands/meshes.js +2 -2
- package/dist/commands/meshes.js.map +1 -1
- package/dist/commands/spawn.d.ts.map +1 -1
- package/dist/commands/spawn.js +4 -2
- package/dist/commands/spawn.js.map +1 -1
- package/dist/commands/up.d.ts.map +1 -1
- package/dist/commands/up.js +35 -15
- package/dist/commands/up.js.map +1 -1
- package/dist/lib/control.d.ts +3 -2
- package/dist/lib/control.d.ts.map +1 -1
- package/dist/lib/control.js +45 -10
- package/dist/lib/control.js.map +1 -1
- package/dist/lib/delivery-proc.d.ts.map +1 -1
- package/dist/lib/delivery-proc.js +8 -8
- package/dist/lib/delivery-proc.js.map +1 -1
- package/dist/lib/up-report.d.ts +5 -1
- package/dist/lib/up-report.d.ts.map +1 -1
- package/dist/lib/up-report.js +11 -1
- package/dist/lib/up-report.js.map +1 -1
- package/package.json +4 -4
package/dist/commands/up.js
CHANGED
|
@@ -1597,11 +1597,13 @@ async function runUp(args, inheritedLock, onAdopt, freshTeamBoot = false, restor
|
|
|
1597
1597
|
const retained = implicit ? recorded : undefined;
|
|
1598
1598
|
// An address up chooses for a TLS broker names TLS, as an explicit one must.
|
|
1599
1599
|
const serving = (url) => transport.kind === "tls-required" ? tlsAddress(url) : url;
|
|
1600
|
+
// Printed below, once this up is known to start the stack: a refresh of the running one says nothing.
|
|
1601
|
+
let stoppedStart;
|
|
1600
1602
|
if (retained) {
|
|
1601
|
-
|
|
1603
|
+
stoppedStart = `starting this folder's stopped stack as it last ran: ${serving(retained.server)}${values.open ? ", open" : ""}`;
|
|
1602
1604
|
}
|
|
1603
1605
|
else if (recorded?.open) {
|
|
1604
|
-
|
|
1606
|
+
stoppedStart = "starting this folder's stopped stack in the mode it last ran: open";
|
|
1605
1607
|
}
|
|
1606
1608
|
else if (implicit) {
|
|
1607
1609
|
const cleaned = cleanedManifestStart(cotalRoot(), recordedSpace, values.open === true);
|
|
@@ -1942,7 +1944,8 @@ async function runUp(args, inheritedLock, onAdopt, freshTeamBoot = false, restor
|
|
|
1942
1944
|
seedPersonaAfterUp(root);
|
|
1943
1945
|
// The same Next a launch ends with: this mesh runs, so the steps are the ones that use and
|
|
1944
1946
|
// stop it. A manager the refresh found or healed is what makes `spawn` one of them.
|
|
1945
|
-
|
|
1947
|
+
const managerRecord = managerRecordState(held.space);
|
|
1948
|
+
console.log(`\n${renderReport({ sections: [{ title: "Next", blocks: [{ kind: "commands", items: detachedNext({ manager: managerRecord.state === "alive", controlPlane: controlPlane !== undefined, machineHome: canonicalRoot(root) === canonicalRoot(homedir()), ...(values.root ? { root } : {}), ...(managerRecord.state === "unattributable" ? { unattributableManager: managerRecord.path, noManager } : {}) }, held.space) }] }] }, "rich", process.stdout)}`);
|
|
1946
1949
|
return;
|
|
1947
1950
|
}
|
|
1948
1951
|
const who = held ? `mesh "${held.space}" (${held.root})` : "a broker not started here";
|
|
@@ -1968,6 +1971,8 @@ async function runUp(args, inheritedLock, onAdopt, freshTeamBoot = false, restor
|
|
|
1968
1971
|
process.exit(1);
|
|
1969
1972
|
}
|
|
1970
1973
|
}
|
|
1974
|
+
if (stoppedStart)
|
|
1975
|
+
console.log(c.dim(stoppedStart));
|
|
1971
1976
|
if (!resumeAttempt)
|
|
1972
1977
|
refuseRegisteredAddress(server, values.space ?? folderSpace(), `start this one at another address with \`cotal up --server nats://${host}:<port>\``);
|
|
1973
1978
|
await assertBrokerAddressFree(server, "cotal up");
|
|
@@ -2067,8 +2072,10 @@ async function runUp(args, inheritedLock, onAdopt, freshTeamBoot = false, restor
|
|
|
2067
2072
|
if (journal && "restore" in journal && journal.restore.attemptId === restored.attemptId)
|
|
2068
2073
|
console.log(c.dim(`next: ${restoreNextStep(journal.state, restored.attemptId, restoreLeftOut(journal))}`));
|
|
2069
2074
|
}
|
|
2070
|
-
if (!quietRestore)
|
|
2071
|
-
|
|
2075
|
+
if (!quietRestore) {
|
|
2076
|
+
const managerRecord = managerRecordState(receiptSpace);
|
|
2077
|
+
console.log(`\n${renderReport({ sections: [{ title: "Next", blocks: [{ kind: "commands", items: detachedNext({ ...detached, controlPlane, ...(managerRecord.state === "unattributable" ? { unattributableManager: managerRecord.path, noManager } : {}) }, receiptSpace) }] }] }, "rich", process.stdout)}`);
|
|
2078
|
+
}
|
|
2072
2079
|
if (restored)
|
|
2073
2080
|
restoreSinks.get(restored.attemptId)?.({
|
|
2074
2081
|
attemptId: restored.attemptId, space: restored.space, root: restored.root, server: restored.server, mode: restored.mode,
|
|
@@ -2214,18 +2221,22 @@ async function runUp(args, inheritedLock, onAdopt, freshTeamBoot = false, restor
|
|
|
2214
2221
|
// racing a second broker into existence. Foreground stdio is inherited (its own log lines
|
|
2215
2222
|
// are already on this terminal, above), so there is no `.cotal/nats.log` to name here.
|
|
2216
2223
|
const detail = signal ? `signal ${signal}` : `code ${code}`;
|
|
2224
|
+
const repair = `log: see the terminal output above; repair: \`cotal up --server ${server} --space ${space}\``;
|
|
2217
2225
|
// Retention is read from the registry, not assumed: a broker that exits before it first
|
|
2218
|
-
// answers was never recorded
|
|
2219
|
-
// the
|
|
2220
|
-
|
|
2226
|
+
// answers was never recorded, and running the same `up` again only repeats that exit, so its
|
|
2227
|
+
// step is the one a detached start gives. A registry that cannot be read is not claimed
|
|
2228
|
+
// either way, and the read cannot throw past this handler, which still has to exit.
|
|
2229
|
+
let outcome;
|
|
2221
2230
|
try {
|
|
2222
2231
|
const mine = findMesh(space);
|
|
2223
|
-
|
|
2232
|
+
outcome = mine && mine.server === server && mine.root === cotalRoot()
|
|
2233
|
+
? `; the mesh "${space}" stays recorded (\`cotal meshes\` lists it offline); ${repair}`
|
|
2234
|
+
: ` before the mesh "${space}" was recorded; next: ${listenerExitRemedy(natsServer, "the terminal output above")}`;
|
|
2224
2235
|
}
|
|
2225
2236
|
catch {
|
|
2226
|
-
|
|
2237
|
+
outcome = `; whether the mesh "${space}" stays recorded could not be read; ${repair}`;
|
|
2227
2238
|
}
|
|
2228
|
-
console.error(c.red(`✗ nats-server exited unexpectedly (${detail})
|
|
2239
|
+
console.error(c.red(`✗ nats-server exited unexpectedly (${detail})${outcome}`));
|
|
2229
2240
|
// A foreground broker under `Restart=on-failure` must exit non-zero on a crash so the unit
|
|
2230
2241
|
// restarts it; exiting 0 here (as an unconditional `code ?? 0` used to) looked like a clean
|
|
2231
2242
|
// stop and left the unit sitting dead. A broker that exited 0, as after an external `down`,
|
|
@@ -3711,8 +3722,13 @@ tlsRequired, mgr) {
|
|
|
3711
3722
|
return undefined;
|
|
3712
3723
|
}
|
|
3713
3724
|
}
|
|
3725
|
+
/** The degraded control plane on stderr: each line of `why`, then its consequence, wrapped to the
|
|
3726
|
+
* terminal as every other warning is. */
|
|
3714
3727
|
function reportDegradedControlPlane(why) {
|
|
3715
|
-
|
|
3728
|
+
const [first, ...rest] = why.split("\n");
|
|
3729
|
+
stderrLine("! ", `control plane degraded: ${first}`, c.dim);
|
|
3730
|
+
for (const line of [...rest, "Spawn and retirement require a functioning control plane."])
|
|
3731
|
+
stderrLine(" ", line, c.dim);
|
|
3716
3732
|
}
|
|
3717
3733
|
/**
|
|
3718
3734
|
* Publish a spawned listener's pid, and bind a maintenance-bound one to its attempt, before anything
|
|
@@ -3779,12 +3795,16 @@ function exitedBeforeReady(l) {
|
|
|
3779
3795
|
if (exitCode === null && signalCode === null)
|
|
3780
3796
|
return undefined;
|
|
3781
3797
|
const exit = exitCode !== null ? `exited with code ${exitCode}` : `was stopped by ${signalCode}`;
|
|
3782
|
-
const { path, source } = l.executable;
|
|
3783
3798
|
return new CommandFailure("failed", "OPERATION_FAILED", `${natsServerLabel(l.executable)} ${exit} before it answered at ${l.server}; see ${l.log}`, {
|
|
3784
|
-
target: { executable: path, ...(exitCode !== null ? { exitCode } : { signal: signalCode }), server: l.server, log: l.log },
|
|
3785
|
-
remedy:
|
|
3799
|
+
target: { executable: l.executable.path, ...(exitCode !== null ? { exitCode } : { signal: signalCode }), server: l.server, log: l.log },
|
|
3800
|
+
remedy: listenerExitRemedy(l.executable, l.log),
|
|
3786
3801
|
});
|
|
3787
3802
|
}
|
|
3803
|
+
/** The next step for a listener that exited before it answered: read its output, then fix a
|
|
3804
|
+
* nats-server found on PATH or take it off PATH, and start again. */
|
|
3805
|
+
function listenerExitRemedy(executable, log) {
|
|
3806
|
+
return executable.source === "path" ? `read ${log}, then fix ${executable.path} or take it off PATH so cotal uses its bundled nats-server, and run \`cotal up\` again` : `read ${log}, then run \`cotal up\` again`;
|
|
3807
|
+
}
|
|
3788
3808
|
/**
|
|
3789
3809
|
* Everything a launch runs once its listener answers: the space setup, the user-auth service, the
|
|
3790
3810
|
* mesh record, the transport commit and the control plane. Foreground `up` and
|