@cotal-ai/cli 0.116.3 → 0.116.5
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/chat/native-session.js +3 -2
- package/dist/chat/native-session.js.map +1 -1
- package/dist/chat/static-session.js +1 -1
- package/dist/chat/static-session.js.map +1 -1
- package/dist/commands/agents.d.ts.map +1 -1
- package/dist/commands/agents.js +19 -19
- package/dist/commands/agents.js.map +1 -1
- package/dist/commands/backup-maintenance.js +8 -8
- package/dist/commands/backup-maintenance.js.map +1 -1
- package/dist/commands/backup-restore.js +1 -1
- package/dist/commands/backup-restore.js.map +1 -1
- package/dist/commands/backup.js +11 -11
- package/dist/commands/backup.js.map +1 -1
- package/dist/commands/channels.js +4 -4
- package/dist/commands/channels.js.map +1 -1
- package/dist/commands/chat.js +5 -5
- package/dist/commands/chat.js.map +1 -1
- package/dist/commands/clean.d.ts.map +1 -1
- package/dist/commands/clean.js +12 -12
- package/dist/commands/clean.js.map +1 -1
- package/dist/commands/completion.d.ts.map +1 -1
- package/dist/commands/completion.js +5 -5
- package/dist/commands/completion.js.map +1 -1
- package/dist/commands/describe.js +2 -2
- package/dist/commands/describe.js.map +1 -1
- package/dist/commands/doctor.js +1 -1
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/down-live-lease.js +1 -1
- package/dist/commands/down-live-lease.js.map +1 -1
- package/dist/commands/down-manifest.js +1 -1
- package/dist/commands/down-manifest.js.map +1 -1
- package/dist/commands/down-services.js +8 -8
- package/dist/commands/down-services.js.map +1 -1
- package/dist/commands/down.js +8 -8
- package/dist/commands/down.js.map +1 -1
- package/dist/commands/endpoint.js +1 -1
- package/dist/commands/endpoint.js.map +1 -1
- package/dist/commands/history-clear.js +1 -1
- package/dist/commands/history-clear.js.map +1 -1
- package/dist/commands/history.js +1 -1
- package/dist/commands/history.js.map +1 -1
- package/dist/commands/join.js +1 -1
- package/dist/commands/join.js.map +1 -1
- package/dist/commands/mint.js +3 -3
- package/dist/commands/mint.js.map +1 -1
- package/dist/commands/persona-remote.js +1 -1
- package/dist/commands/persona-remote.js.map +1 -1
- package/dist/commands/persona.js +4 -4
- package/dist/commands/persona.js.map +1 -1
- package/dist/commands/personas.js +2 -2
- package/dist/commands/personas.js.map +1 -1
- package/dist/commands/reset-space-apply.js +5 -5
- package/dist/commands/reset-space-apply.js.map +1 -1
- package/dist/commands/reset-store-apply.js +21 -21
- package/dist/commands/reset-store-apply.js.map +1 -1
- package/dist/commands/revoke-credential.js +5 -5
- package/dist/commands/revoke-credential.js.map +1 -1
- package/dist/commands/send.d.ts.map +1 -1
- package/dist/commands/send.js +7 -7
- package/dist/commands/send.js.map +1 -1
- package/dist/commands/service-actions.js +9 -9
- package/dist/commands/service-actions.js.map +1 -1
- package/dist/commands/service-log-follow.js +1 -1
- package/dist/commands/service-log-follow.js.map +1 -1
- package/dist/commands/service-registry.js +19 -19
- package/dist/commands/service-registry.js.map +1 -1
- package/dist/commands/service-set-stop.js +3 -3
- package/dist/commands/service-set-stop.js.map +1 -1
- package/dist/commands/space-delete.js +10 -10
- package/dist/commands/space-delete.js.map +1 -1
- package/dist/commands/spawn-preview.js +1 -1
- package/dist/commands/spawn-preview.js.map +1 -1
- package/dist/commands/spawn.d.ts +1 -1
- package/dist/commands/spawn.js +19 -19
- package/dist/commands/spawn.js.map +1 -1
- package/dist/commands/stack-down.js +12 -12
- package/dist/commands/stack-down.js.map +1 -1
- package/dist/commands/stack-gone.js +7 -7
- package/dist/commands/stack-gone.js.map +1 -1
- package/dist/commands/stack-up.d.ts.map +1 -1
- package/dist/commands/stack-up.js +44 -44
- package/dist/commands/stack-up.js.map +1 -1
- package/dist/commands/stack-user-auth.d.ts.map +1 -1
- package/dist/commands/stack-user-auth.js +2 -2
- package/dist/commands/stack-user-auth.js.map +1 -1
- package/dist/commands/status.d.ts.map +1 -1
- package/dist/commands/status.js +14 -14
- package/dist/commands/status.js.map +1 -1
- package/dist/commands/team-agent-remove.js +2 -2
- package/dist/commands/team-agent-remove.js.map +1 -1
- package/dist/commands/team-boot-controller.js +5 -5
- package/dist/commands/team-boot-controller.js.map +1 -1
- package/dist/commands/team-channel-remove.js +4 -4
- package/dist/commands/team-channel-remove.js.map +1 -1
- package/dist/commands/team-deploy-apply.js +1 -1
- package/dist/commands/team-deploy-apply.js.map +1 -1
- package/dist/commands/team-mixed-remove.js +2 -2
- package/dist/commands/team-mixed-remove.js.map +1 -1
- package/dist/commands/team.js +7 -7
- package/dist/commands/team.js.map +1 -1
- package/dist/commands/up.d.ts.map +1 -1
- package/dist/commands/up.js +51 -51
- package/dist/commands/up.js.map +1 -1
- package/dist/commands/update.js +2 -2
- package/dist/commands/update.js.map +1 -1
- package/dist/console/launch.js +1 -1
- package/dist/console/launch.js.map +1 -1
- package/dist/exec-endpoint/service-adapter.js +1 -1
- package/dist/exec-endpoint/service-adapter.js.map +1 -1
- package/dist/ext-loader.js +2 -2
- package/dist/ext-loader.js.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/lib/agent-skills.js +3 -3
- package/dist/lib/agent-skills.js.map +1 -1
- package/dist/lib/backup-artifact.js +1 -1
- package/dist/lib/backup-artifact.js.map +1 -1
- package/dist/lib/broker-service.js +1 -1
- package/dist/lib/broker-service.js.map +1 -1
- package/dist/lib/broker-store-health.js +1 -1
- package/dist/lib/broker-store-health.js.map +1 -1
- package/dist/lib/completion-install.js +7 -7
- package/dist/lib/completion-install.js.map +1 -1
- package/dist/lib/control.js +3 -3
- package/dist/lib/control.js.map +1 -1
- package/dist/lib/controller-preserve.js +5 -5
- package/dist/lib/controller-preserve.js.map +1 -1
- package/dist/lib/controller-resume.js +3 -3
- package/dist/lib/controller-resume.js.map +1 -1
- package/dist/lib/delivery-responder.js +1 -1
- package/dist/lib/delivery-responder.js.map +1 -1
- package/dist/lib/endpoint-capability-gates.js +1 -1
- package/dist/lib/endpoint-capability-gates.js.map +1 -1
- package/dist/lib/endpoint-errors.d.ts.map +1 -1
- package/dist/lib/endpoint-errors.js +3 -3
- package/dist/lib/endpoint-errors.js.map +1 -1
- package/dist/lib/held-name.js +3 -3
- package/dist/lib/held-name.js.map +1 -1
- package/dist/lib/interrupt-notice.js +1 -1
- package/dist/lib/interrupt-notice.js.map +1 -1
- package/dist/lib/manager-choice.js +2 -2
- package/dist/lib/manager-choice.js.map +1 -1
- package/dist/lib/manifest/render.js +1 -1
- package/dist/lib/manifest/render.js.map +1 -1
- package/dist/lib/paths.js +5 -5
- package/dist/lib/paths.js.map +1 -1
- package/dist/lib/persona-files.js +3 -3
- package/dist/lib/persona-files.js.map +1 -1
- package/dist/lib/personas.js +1 -1
- package/dist/lib/personas.js.map +1 -1
- package/dist/lib/reset-space-plan.js +1 -1
- package/dist/lib/reset-space-plan.js.map +1 -1
- package/dist/lib/restore.d.ts.map +1 -1
- package/dist/lib/restore.js +20 -20
- package/dist/lib/restore.js.map +1 -1
- package/dist/lib/service-adapters.js +1 -1
- package/dist/lib/service-adapters.js.map +1 -1
- package/dist/lib/service-definitions.js +4 -4
- package/dist/lib/service-definitions.js.map +1 -1
- package/dist/lib/service-preset-target.js +7 -7
- package/dist/lib/service-preset-target.js.map +1 -1
- package/dist/lib/service-presets.js +2 -2
- package/dist/lib/service-presets.js.map +1 -1
- package/dist/lib/service-process.d.ts.map +1 -1
- package/dist/lib/service-process.js +18 -16
- package/dist/lib/service-process.js.map +1 -1
- package/dist/lib/stack-journal.d.ts.map +1 -1
- package/dist/lib/stack-journal.js +16 -16
- package/dist/lib/stack-journal.js.map +1 -1
- package/dist/lib/stack-resume.js +5 -5
- package/dist/lib/stack-resume.js.map +1 -1
- package/dist/lib/steps.js +1 -1
- package/dist/lib/steps.js.map +1 -1
- package/dist/lib/store-dir.d.ts +2 -1
- package/dist/lib/store-dir.d.ts.map +1 -1
- package/dist/lib/store-dir.js +5 -4
- package/dist/lib/store-dir.js.map +1 -1
- package/dist/lib/systemd-supervision.js +1 -1
- package/dist/lib/systemd-supervision.js.map +1 -1
- package/dist/lib/teardown-spare.js +1 -1
- package/dist/lib/teardown-spare.js.map +1 -1
- package/dist/lib/transient.js +2 -2
- package/dist/lib/transient.js.map +1 -1
- package/dist/lib/up-report.js +2 -2
- package/dist/lib/up-report.js.map +1 -1
- package/dist/telemetry.d.ts +1 -1
- package/dist/telemetry.d.ts.map +1 -1
- package/dist/telemetry.js +1 -1
- package/dist/ui.js +2 -2
- package/dist/ui.js.map +1 -1
- package/dist/watch-data.js +1 -1
- package/dist/watch-data.js.map +1 -1
- package/package.json +4 -4
|
@@ -14,7 +14,7 @@ import { isIP } from "node:net";
|
|
|
14
14
|
import { basename, join, resolve } from "node:path";
|
|
15
15
|
import { JetStreamApiCodes, JetStreamApiError } from "@nats-io/jetstream";
|
|
16
16
|
import { awaitDeadDeliveryLease, deliveryLeaseHolderFor, isJetStreamMissing, isReachable, LEASE_TTL_MS, mintCreds, newIdentity } from "@cotal-ai/core";
|
|
17
|
-
import { CommandFailure, accountInventory, authDir, canonicalRoot, deliveryCredsKey, findMesh, findPreparedSpace, getCurrent, getSpaceAuth, hasUserAuthState, homeCotalDir, isCommandFailure, loadMeshes, localMeshesForRoot, NATS_PIDFILE, presentationOf, readBrokerPolicy, readMaintenanceJournal, renderReport, resolveNativeServiceTarget, resolveOnPath, rotateSystemCreds, SPACE_NAME_MAX, spaceNameTooLong, stackHomeRemedy, stackRunsUnderOtherHome, terminalWidth, workspaceSecretStore, writeResult, MIN_FILE_STORE, unparsableDaemonCreds, loopbackListeners, readProcessCommand, resolveMeshTarget, processStopped, } from "@cotal-ai/workspace";
|
|
17
|
+
import { CommandFailure, accountInventory, authDir, canonicalRoot, codeSpan, deliveryCredsKey, findMesh, findPreparedSpace, getCurrent, getSpaceAuth, hasUserAuthState, homeCotalDir, isCommandFailure, loadMeshes, localMeshesForRoot, NATS_PIDFILE, presentationOf, readBrokerPolicy, readMaintenanceJournal, renderReport, resolveNativeServiceTarget, resolveOnPath, rotateSystemCreds, SPACE_NAME_MAX, spaceNameTooLong, stackHomeRemedy, stackRunsUnderOtherHome, terminalWidth, workspaceSecretStore, writeResult, MIN_FILE_STORE, unparsableDaemonCreds, loopbackListeners, readProcessCommand, resolveMeshTarget, processStopped, } from "@cotal-ai/workspace";
|
|
18
18
|
import { liveMeshProcesses } from "./clean.js";
|
|
19
19
|
import { addressHolder, brokerListenAddress, listenerBindError } from "../lib/broker-service.js";
|
|
20
20
|
import { brokerStoreWrite, jetStreamDisabled, jetStreamDisabledRefusal, readStoredBytes, storeDamageNotice, storeFull } from "../lib/broker-store-health.js";
|
|
@@ -104,8 +104,8 @@ function controllerUnsupported(root, options, prepared) {
|
|
|
104
104
|
return new CommandFailure("refused", "UNSUPPORTED", `${prepared ? "this root is prepared for a controller-owned stack" : "this root's stack is owned by the service controller"}, which has no route for ${named}; nothing was started through the legacy launcher`, {
|
|
105
105
|
target: { root, options },
|
|
106
106
|
remedy: manifest && options.some((name) => TLS_INPUTS.includes(name))
|
|
107
|
-
? `run cotal up without ${named} to serve plaintext, or serve TLS from a manifest whose broker.servers names a tls:// address, with cotal up -f <cotal.yaml> --tls-cert <cert.pem> --tls-key <key.pem
|
|
108
|
-
: manifest ? `run cotal up without ${named}, or start the space from a manifest with cotal up -f <cotal.yaml
|
|
107
|
+
? `run \`cotal up\` without ${named} to serve plaintext, or serve TLS from a manifest whose broker.servers names a tls:// address, with \`cotal up -f <cotal.yaml> --tls-cert <cert.pem> --tls-key <key.pem>\``
|
|
108
|
+
: manifest ? `run \`cotal up\` without ${named}, or start the space from a manifest with \`cotal up -f <cotal.yaml>\`, which takes ${flags.length === 1 ? "it" : "them"}` : `run \`cotal up\` without ${named}${rotation}`,
|
|
109
109
|
});
|
|
110
110
|
}
|
|
111
111
|
/** Any account record, readable or not, means the root carries static trust an open stack would bypass. */
|
|
@@ -119,7 +119,7 @@ const MODE_NAME = { auth: "static auth", open: "open", user: "user auth" };
|
|
|
119
119
|
* records it. So the step keeps that mode, or starts the requested one in another folder. */
|
|
120
120
|
function pinnedModeRemedy(recorded, requested) {
|
|
121
121
|
const flag = requested === "open" ? " --open" : requested === "user" ? " --user-auth" : "";
|
|
122
|
-
return `run bare cotal up to keep ${MODE_NAME[recorded]} here, or for ${MODE_NAME[requested]} run cotal space create <space
|
|
122
|
+
return `run bare \`cotal up\` to keep ${MODE_NAME[recorded]} here, or for ${MODE_NAME[requested]} run \`cotal space create <space>\`, then \`cotal up${flag}\`, in another folder`;
|
|
123
123
|
}
|
|
124
124
|
/** The mode an invocation explicitly asks for, or none for a bare `up`. */
|
|
125
125
|
export function requestedStackMode(values) {
|
|
@@ -228,7 +228,7 @@ function stackPreflight(root, space, recorded, ownAttempt) {
|
|
|
228
228
|
if (ledgers.valid.length || ledgers.refused.length || retained.length || additive.refused.length || boots.refused.length || summaries.refused.length || unsettledBoots.length) {
|
|
229
229
|
const ids = [...new Set([...retained.map((attempt) => attempt.deploymentId), ...ledgers.valid.map(({ ledger }) => ledger.runId), ...unsettledBoots.map((attempt) => attempt.deploymentId)])];
|
|
230
230
|
throw new CommandFailure("refused", "LIFECYCLE_BLOCKED", "team deployments or unsettled boot records remain under this root; the controller stack did not adopt their resources", { target: { root, space, deployments: ids },
|
|
231
|
-
remedy: ids.length ? `inspect each with ${ids.map((id) =>
|
|
231
|
+
remedy: ids.length ? `inspect each with ${ids.map((id) => `\`cotal team show ${id}\``).join(", ")}; nothing was started` : `list the records with \`cotal team\` in ${root}; nothing was started` });
|
|
232
232
|
}
|
|
233
233
|
return maintenance.admittedRestore;
|
|
234
234
|
}
|
|
@@ -257,8 +257,8 @@ function ensureDefinition(space, role, input, root, replace) {
|
|
|
257
257
|
const other = launch.type === "adapter" && launch.adapter === STACK_ADAPTER[role] && typeof launch.options.root === "string" ? launch.options.root : undefined;
|
|
258
258
|
if (other)
|
|
259
259
|
throw new CommandFailure("refused", "CONFLICT", `the saved ${name} definition belongs to the stack at ${other}; it was not replaced`, { target: { space, definition: name, root: other },
|
|
260
|
-
remedy: `if ${other} no longer runs ${space}, remove the stack definitions saved for it (${stackDefinitionsAt(space, other).map((row) => row.name).join(", ")}) with cotal service remove <name> --space ${space} --yes
|
|
261
|
-
throw new CommandFailure("refused", "CONFLICT", "a saved definition under a stack name belongs to another adapter or root; it was not replaced", { target: { space, definition: name }, remedy: `inspect cotal service show ${name} --space ${space}
|
|
260
|
+
remedy: `if ${other} no longer runs ${space}, remove the stack definitions saved for it (${stackDefinitionsAt(space, other).map((row) => row.name).join(", ")}) with \`cotal service remove <name> --space ${space} --yes\`` });
|
|
261
|
+
throw new CommandFailure("refused", "CONFLICT", "a saved definition under a stack name belongs to another adapter or root; it was not replaced", { target: { space, definition: name }, remedy: `inspect \`cotal service show ${name} --space ${space}\`` });
|
|
262
262
|
}
|
|
263
263
|
if (JSON.stringify(launch.options) === JSON.stringify(wanted.options))
|
|
264
264
|
return existing;
|
|
@@ -451,7 +451,7 @@ async function storeFullAfterStart(root, space) {
|
|
|
451
451
|
* manager's own process is ended first where it runs, as a full store refuses its stop. */
|
|
452
452
|
function fullStoreUpRemedy(root, space) {
|
|
453
453
|
const pid = serviceInstances(space, STACK_DEFINITION.manager).map((row) => row.record.value).find((value) => observeServiceProcess(value) === "running")?.process?.pid;
|
|
454
|
-
return `from ${root}, make room with cotal history clear --yes
|
|
454
|
+
return `from ${root}, make room with \`cotal history clear --yes\`, which purges all of this space's channel history, then run \`cotal up\` again; to keep that history, ${pid !== undefined ? `end the manager on this host with kill -TERM ${pid}, which stops its agents by its default policy, then ` : ""}run \`cotal down --yes\` and \`cotal up --max-file-store <bytes>\` with a larger cap`;
|
|
455
455
|
}
|
|
456
456
|
/** The running broker of an unregistered space: what an up stopped before registration leaves. */
|
|
457
457
|
function strandedBroker(space) {
|
|
@@ -467,11 +467,11 @@ export function stackUpInterruptNotice(root, space, noManager = false) {
|
|
|
467
467
|
const up = `cotal up${noManager ? " --no-manager" : ""}`;
|
|
468
468
|
const stranded = strandedBroker(space);
|
|
469
469
|
if (stranded)
|
|
470
|
-
return `Interrupted before the space was registered; its broker keeps running as pid ${stranded.process?.pid}. Run cotal down --yes
|
|
470
|
+
return `Interrupted before the space was registered; its broker keeps running as pid ${stranded.process?.pid}. Run \`cotal down --yes\`, then \`${up}\`.`;
|
|
471
471
|
const running = runningStackRoles(space);
|
|
472
472
|
return running.length
|
|
473
|
-
? `Interrupted while starting the stack in ${root}; ${running.join(", ")} ${running.length === 1 ? "keeps" : "keep"} running. Run
|
|
474
|
-
: `Interrupted before any member of the stack in ${root} started. Run
|
|
473
|
+
? `Interrupted while starting the stack in ${root}; ${running.join(", ")} ${running.length === 1 ? "keeps" : "keep"} running. Run \`${up}\` to finish the start, or \`cotal down --yes\` to stop ${running.length === 1 ? "it" : "them"}.`
|
|
474
|
+
: `Interrupted before any member of the stack in ${root} started. Run \`${up}\` to start it.`;
|
|
475
475
|
}
|
|
476
476
|
/** Whether a broker bound to `host` is reached at `server`'s address: a wildcard bind is reached at
|
|
477
477
|
* any address, and any other host must name that address. */
|
|
@@ -494,12 +494,12 @@ export async function startControllerStack(request, native) {
|
|
|
494
494
|
// member's file is written, instead of failing on the first file name that does not fit.
|
|
495
495
|
const tooLong = spaceNameTooLong(space);
|
|
496
496
|
if (tooLong)
|
|
497
|
-
throw new CommandFailure("refused", "USAGE_INVALID", `${tooLong}; nothing was started or written`, { target: { root, space }, remedy: `forget it with cotal space forget ${space}
|
|
497
|
+
throw new CommandFailure("refused", "USAGE_INVALID", `${tooLong}; nothing was started or written`, { target: { root, space }, remedy: `forget it with \`cotal space forget ${space}\`, then create one with a name of at most ${SPACE_NAME_MAX} characters with \`cotal space create <name>\`` });
|
|
498
498
|
// Each member's start is recorded under the space's service records. A folder there this account
|
|
499
499
|
// cannot write refuses here, naming it, instead of an unknown outcome after a member started.
|
|
500
500
|
const unwritable = serviceRecordsWriteProblem(space, ["definitions", "instances"]);
|
|
501
501
|
if (unwritable)
|
|
502
|
-
throw new CommandFailure("refused", "PERMISSION_DENIED", `this account cannot write ${unwritable}, where up records the stack's services; nothing was started or written`, { target: { root, space, path: unwritable }, remedy: `make it writable with chmod u+w ${unwritable}, then run cotal up again` });
|
|
502
|
+
throw new CommandFailure("refused", "PERMISSION_DENIED", `this account cannot write ${unwritable}, where up records the stack's services; nothing was started or written`, { target: { root, space, path: unwritable }, remedy: `make it writable with chmod u+w ${unwritable}, then run \`cotal up\` again` });
|
|
503
503
|
const recorded = readStackJournal(root);
|
|
504
504
|
if (request.expectPriorDown && (!recorded || recorded.sha256 !== request.expectPriorDown.journalSha256 || recorded.journal.operation.id !== request.expectPriorDown.operationId))
|
|
505
505
|
throw new CommandFailure("refused", "CONFLICT", "the stopped stack changed after the team boot checked it; nothing was started", { target: { root, space, expected: request.expectPriorDown.operationId } });
|
|
@@ -522,7 +522,7 @@ export async function startControllerStack(request, native) {
|
|
|
522
522
|
if (request.host === undefined || !bindReaches(request.host, previous.journal.server) || brokerRuns)
|
|
523
523
|
throw new CommandFailure("refused", "CONFLICT", `this stack's broker binds ${strayHost}${recordedInputs.host === undefined ? ", as no bind host was recorded," : ","} which does not serve its recorded address ${previous.journal.server}, so its clients cannot reach it; nothing was started`, {
|
|
524
524
|
target: { root, space, recorded: recordedInputs },
|
|
525
|
-
remedy: `${brokerRuns ? `stop its broker with cotal down --yes from ${root}, then ` : ""}run cotal up --host ${new URL(previous.journal.server).hostname} from ${root}`,
|
|
525
|
+
remedy: `${brokerRuns ? `stop its broker with \`cotal down --yes\` from ${root}, then ` : ""}run \`cotal up --host ${new URL(previous.journal.server).hostname}\` from ${root}`,
|
|
526
526
|
});
|
|
527
527
|
}
|
|
528
528
|
// The cap is fixed while the broker runs. A stopped broker starts again with an explicit new cap,
|
|
@@ -536,7 +536,7 @@ export async function startControllerStack(request, native) {
|
|
|
536
536
|
request.host !== undefined && request.host !== recordedBroker.host ? `--host ${request.host} (recorded: ${recordedBroker.host ?? "none"})` : undefined,
|
|
537
537
|
].filter((input) => input !== undefined) : [];
|
|
538
538
|
if (changedInputs.length)
|
|
539
|
-
throw new CommandFailure("refused", "CONFLICT", `${changedInputs.join(", ")} ${changedInputs.length === 1 ? "differs" : "differ"} from this stack's recorded broker inputs; nothing was prepared`, { target: { root, space, recorded: recordedBroker }, remedy: `run bare cotal up from ${root} to start it with its recorded inputs${newCap ? `; a new --max-file-store applies once the broker is stopped with cotal down --yes
|
|
539
|
+
throw new CommandFailure("refused", "CONFLICT", `${changedInputs.join(", ")} ${changedInputs.length === 1 ? "differs" : "differ"} from this stack's recorded broker inputs; nothing was prepared`, { target: { root, space, recorded: recordedBroker }, remedy: `run bare \`cotal up\` from ${root} to start it with its recorded inputs${newCap ? `; a new --max-file-store applies once the broker is stopped with \`cotal down --yes\`` : ""}` });
|
|
540
540
|
// A journal written before broker inputs were recorded cannot tell which store, cap or bind host
|
|
541
541
|
// its stopped broker used: `cotal down` removed the registration that held them, and broker
|
|
542
542
|
// preparation would otherwise fall back to the default `.cotal/nats` store with no cap. Such a
|
|
@@ -545,7 +545,7 @@ export async function startControllerStack(request, native) {
|
|
|
545
545
|
const brokerRows0 = previous && !recordedBroker ? serviceInstances(space, STACK_DEFINITION.broker) : [];
|
|
546
546
|
const legacyStopped = previous !== undefined && !recordedBroker && !(brokerRows0.length === 1 && observeServiceProcess(brokerRows0[0].record.value) === "running");
|
|
547
547
|
if (legacyStopped && request.storeDir === undefined)
|
|
548
|
-
throw new CommandFailure("refused", "LIFECYCLE_BLOCKED", "this stopped stack was recorded before its broker store, cap and bind host were kept; the broker is not prepared from a default store", { target: { root, space, operation: previous.journal.operation.id }, remedy: `name the stack's original store explicitly: cotal up --store-dir <original store dir> [--max-file-store <bytes>] [--host <host>] --space ${space}
|
|
548
|
+
throw new CommandFailure("refused", "LIFECYCLE_BLOCKED", "this stopped stack was recorded before its broker store, cap and bind host were kept; the broker is not prepared from a default store", { target: { root, space, operation: previous.journal.operation.id }, remedy: `name the stack's original store explicitly: \`cotal up --store-dir <original store dir> [--max-file-store <bytes>] [--host <host>] --space ${space}\`; omit --max-file-store and --host only if the original start set neither` });
|
|
549
549
|
// The named store must already exist as a real directory: preparation would otherwise create
|
|
550
550
|
// an empty store at a mistyped path and start the stack on it. Its identity is pinned here and
|
|
551
551
|
// checked again by preparation, which never creates a pinned store, and just before the broker starts.
|
|
@@ -575,19 +575,19 @@ export async function startControllerStack(request, native) {
|
|
|
575
575
|
// A running broker keeps the timeout it was started with, which the broker policy records.
|
|
576
576
|
const recordedTimeout = readBrokerPolicy(root)?.authTimeout;
|
|
577
577
|
if (request.authTimeout !== recordedTimeout && serviceInstances(space, STACK_DEFINITION.broker).some((row) => observeServiceProcess(row.record.value) === "running"))
|
|
578
|
-
throw new CommandFailure("refused", "CONFLICT", `--auth-timeout ${request.authTimeout} differs from the running broker's (${recordedTimeout === undefined ? "nats-server's default" : `${recordedTimeout} seconds`}), which is fixed at its start; nothing was prepared`, { target: { root, space }, remedy: `stop the stack with cotal down --yes from ${root}, then run cotal up --auth-timeout ${request.authTimeout}
|
|
578
|
+
throw new CommandFailure("refused", "CONFLICT", `--auth-timeout ${request.authTimeout} differs from the running broker's (${recordedTimeout === undefined ? "nats-server's default" : `${recordedTimeout} seconds`}), which is fixed at its start; nothing was prepared`, { target: { root, space }, remedy: `stop the stack with \`cotal down --yes\` from ${root}, then run \`cotal up --auth-timeout ${request.authTimeout}\`` });
|
|
579
579
|
}
|
|
580
580
|
const admittedRestore = stackPreflight(root, space, previous?.journal, request.manifest?.deploymentId);
|
|
581
581
|
// A recorded stack keeps its space and broker address. The refusal names what is recorded and the
|
|
582
582
|
// bare up that starts it there.
|
|
583
583
|
const recordedTarget = { root, space, recorded: { space: previous?.journal.space, server: previous?.journal.server }, requested: { space, server: request.server } };
|
|
584
584
|
if (previous && previous.journal.space !== space)
|
|
585
|
-
throw new CommandFailure("refused", "CONFLICT", `this root's controller stack is recorded for space ${previous.journal.space}, and this up asked for ${space}; it was not rebound`, { target: recordedTarget, remedy: `run bare cotal up from ${root} to start ${previous.journal.space}` });
|
|
585
|
+
throw new CommandFailure("refused", "CONFLICT", `this root's controller stack is recorded for space ${previous.journal.space}, and this up asked for ${space}; it was not rebound`, { target: recordedTarget, remedy: `run bare \`cotal up\` from ${root} to start ${previous.journal.space}` });
|
|
586
586
|
// No command moves a stack that ran to another address. While another program holds the recorded
|
|
587
587
|
// one, bare up refuses too, so the refusal names that holder rather than sending the operator there.
|
|
588
588
|
if (previous && canonicalServer(previous.journal.server) !== canonicalServer(request.server)) {
|
|
589
589
|
const held = await recordedAddressHeld(space, previous.journal.server);
|
|
590
|
-
throw new CommandFailure("refused", "CONFLICT", `this root's controller stack is recorded at ${previous.journal.server}, and this up asked for ${request.server}; a recorded stack is not moved to another address${held ? `, and ${held.says}` : ""}`, { target: recordedTarget, remedy: held ? `${held.frees}, then run bare cotal up from ${root}; no command moves a stack that ran to another address, so it starts only at ${previous.journal.server}` : `run bare cotal up from ${root} to start it at ${previous.journal.server}` });
|
|
590
|
+
throw new CommandFailure("refused", "CONFLICT", `this root's controller stack is recorded at ${previous.journal.server}, and this up asked for ${request.server}; a recorded stack is not moved to another address${held ? `, and ${held.says}` : ""}`, { target: recordedTarget, remedy: held ? `${held.frees}, then run bare \`cotal up\` from ${root}; no command moves a stack that ran to another address, so it starts only at ${previous.journal.server}` : `run bare \`cotal up\` from ${root} to start it at ${previous.journal.server}` });
|
|
591
591
|
}
|
|
592
592
|
// The broker service's own address rules run before anything is written, so an address it would
|
|
593
593
|
// refuse never becomes this root's recorded broker address.
|
|
@@ -597,9 +597,9 @@ export async function startControllerStack(request, native) {
|
|
|
597
597
|
// so the refusal leaves the folder as it was.
|
|
598
598
|
const registration = findMesh(space), preparedSpace = findPreparedSpace(space);
|
|
599
599
|
if (registration && (registration.origin !== "up" || canonicalRoot(registration.root) !== root || registration.server !== (previous?.journal.server ?? request.server)))
|
|
600
|
-
throw new CommandFailure("refused", "CONFLICT", "the space is registered to another root, broker address or external origin; nothing was prepared or started", { target: { root, space }, remedy: `inspect it with cotal space show ${space}
|
|
600
|
+
throw new CommandFailure("refused", "CONFLICT", "the space is registered to another root, broker address or external origin; nothing was prepared or started", { target: { root, space }, remedy: `inspect it with \`cotal space show ${space}\`` });
|
|
601
601
|
if (!registration && (!preparedSpace || canonicalRoot(preparedSpace.root) !== root))
|
|
602
|
-
throw new CommandFailure("refused", "TARGET_UNAVAILABLE", "the space has no prepared or locally started registration at this root; nothing was prepared or started", { target: { root, space }, remedy: `prepare it with cotal space create ${space} --root ${shellWord(root)}, then run cotal up
|
|
602
|
+
throw new CommandFailure("refused", "TARGET_UNAVAILABLE", "the space has no prepared or locally started registration at this root; nothing was prepared or started", { target: { root, space }, remedy: `prepare it with ${codeSpan(`cotal space create ${space} --root ${shellWord(root)}`)}, then run \`cotal up\`` });
|
|
603
603
|
// A store folder belongs to one space. A --store-dir no record of this stack names refuses while
|
|
604
604
|
// another space uses it; the recorded or default store starts, and the receipt warns.
|
|
605
605
|
const storePath = brokerStore !== undefined ? resolve(brokerStore) : join(root, ".cotal", "nats");
|
|
@@ -610,13 +610,13 @@ export async function startControllerStack(request, native) {
|
|
|
610
610
|
// prepared again under a running broker. This start refuses before any write and names the stop.
|
|
611
611
|
const stranded = registration ? undefined : strandedBroker(space);
|
|
612
612
|
if (stranded)
|
|
613
|
-
throw new CommandFailure("refused", "LIFECYCLE_BLOCKED", `the stack's broker runs as pid ${stranded.process?.pid}, but the cotal up that started it stopped before it registered the space, so this up cannot finish that start; nothing was changed`, { target: { root, space, broker: stranded.instanceId, pid: stranded.process?.pid }, remedy: "stop that broker with cotal down --yes
|
|
613
|
+
throw new CommandFailure("refused", "LIFECYCLE_BLOCKED", `the stack's broker runs as pid ${stranded.process?.pid}, but the \`cotal up\` that started it stopped before it registered the space, so this up cannot finish that start; nothing was changed`, { target: { root, space, broker: stranded.instanceId, pid: stranded.process?.pid }, remedy: "stop that broker with `cotal down --yes`, then run `cotal up` again" });
|
|
614
614
|
// A broker stopped by a signal accepts connections and never answers, so every step through it would
|
|
615
615
|
// wait out its budget, and its readiness check would record a listener that serves nothing. This
|
|
616
616
|
// start refuses before any write and names the signal that resumes it.
|
|
617
617
|
const brokerPid = serviceInstances(space, STACK_DEFINITION.broker).map((row) => row.record.value).find((value) => observeServiceProcess(value) === "running")?.process?.pid;
|
|
618
618
|
if (brokerPid !== undefined && processStopped(brokerPid))
|
|
619
|
-
throw new CommandFailure("refused", "TARGET_UNAVAILABLE", `the stack's broker, pid ${brokerPid}, is stopped, so it accepts connections at ${previous?.journal.server ?? request.server} and never answers; nothing was started or written`, { target: { root, space, pid: brokerPid }, remedy: `resume it with kill -CONT ${brokerPid} and run cotal up again` });
|
|
619
|
+
throw new CommandFailure("refused", "TARGET_UNAVAILABLE", `the stack's broker, pid ${brokerPid}, is stopped, so it accepts connections at ${previous?.journal.server ?? request.server} and never answers; nothing was started or written`, { target: { root, space, pid: brokerPid }, remedy: `resume it with kill -CONT ${brokerPid} and run \`cotal up\` again` });
|
|
620
620
|
// An earlier up or down that never recorded its outcome is settled from its members' process
|
|
621
621
|
// evidence under the held maintenance lock. Only a preserve or resume can remain unsettled here.
|
|
622
622
|
// A member stop an earlier down could not confirm in time is settled from its own receipt first.
|
|
@@ -624,29 +624,29 @@ export async function startControllerStack(request, native) {
|
|
|
624
624
|
await settleRetainedStackStops(previous.journal);
|
|
625
625
|
const { snapshot: current, settled } = previous ? settleStackOperation(request.maintenanceLock, previous) : { snapshot: undefined, settled: undefined };
|
|
626
626
|
if (current && stackOperationUnsettled(current.journal))
|
|
627
|
-
throw new CommandFailure("refused", "LIFECYCLE_BLOCKED", "an earlier preserve or resume on this root has no settled outcome; it is decided by its own maintenance attempt and no member was started", { target: { root, space, operation: current.journal.operation }, remedy: `inspect the root's maintenance attempt and the stack's members with cotal service --space ${space} before another whole-stack operation` });
|
|
627
|
+
throw new CommandFailure("refused", "LIFECYCLE_BLOCKED", "an earlier preserve or resume on this root has no settled outcome; it is decided by its own maintenance attempt and no member was started", { target: { root, space, operation: current.journal.operation }, remedy: `inspect the root's maintenance attempt and the stack's members with \`cotal service --space ${space}\` before another whole-stack operation` });
|
|
628
628
|
const server = previous?.journal.server ?? request.server;
|
|
629
629
|
if (request.noManager) {
|
|
630
630
|
const running = serviceInstances(space, STACK_DEFINITION.manager).filter((row) => observeServiceProcess(row.record.value) === "running");
|
|
631
631
|
if (running.length)
|
|
632
|
-
throw new CommandFailure("refused", "LIFECYCLE_BLOCKED", "--no-manager cannot keep an already-running controller manager; no member was started or stopped", { target: { root, space, instances: running.map((row) => row.name) }, remedy: `stop the recorded manager with cotal service stop ${STACK_DEFINITION.manager} --space ${space} --yes before requesting --no-manager` });
|
|
632
|
+
throw new CommandFailure("refused", "LIFECYCLE_BLOCKED", "--no-manager cannot keep an already-running controller manager; no member was started or stopped", { target: { root, space, instances: running.map((row) => row.name) }, remedy: `stop the recorded manager with \`cotal service stop ${STACK_DEFINITION.manager} --space ${space} --yes\` before requesting --no-manager` });
|
|
633
633
|
}
|
|
634
634
|
// A rotation is a stopped, fresh boot. A member that still runs would keep the retired system
|
|
635
635
|
// account, so every member must be stopped before anything is rotated or started.
|
|
636
636
|
if (request.rotateSys) {
|
|
637
637
|
if (mode === "open")
|
|
638
|
-
throw new CommandFailure("refused", "UNSUPPORTED", "an open stack has no system account or $SYS credentials to rotate; nothing was started", { target: { root, space }, remedy: `run bare cotal up from ${root} to start it` });
|
|
638
|
+
throw new CommandFailure("refused", "UNSUPPORTED", "an open stack has no system account or $SYS credentials to rotate; nothing was started", { target: { root, space }, remedy: `run bare \`cotal up\` from ${root} to start it` });
|
|
639
639
|
const running = STACK_ROLES.flatMap((role) => serviceInstances(space, STACK_DEFINITION[role])).filter((row) => observeServiceProcess(row.record.value) === "running");
|
|
640
640
|
if (running.length)
|
|
641
|
-
throw new CommandFailure("refused", "LIFECYCLE_BLOCKED", "this stack has running members, and a running broker keeps serving the retired system account; nothing was rotated or started", { target: { root, space, instances: running.map((row) => row.name) }, remedy: "stop the stack with cotal down --yes
|
|
641
|
+
throw new CommandFailure("refused", "LIFECYCLE_BLOCKED", "this stack has running members, and a running broker keeps serving the retired system account; nothing was rotated or started", { target: { root, space, instances: running.map((row) => row.name) }, remedy: "stop the stack with `cotal down --yes`, then run `cotal up --rotate-sys`" });
|
|
642
642
|
const trust = await getSpaceAuth(workspaceSecretStore(root), space);
|
|
643
643
|
if (!trust?.operator.seed)
|
|
644
|
-
throw new CommandFailure("refused", "TARGET_UNAVAILABLE", trust ? "this root holds the space's trust without the broker operator seed, so it cannot rotate the system account; nothing was started" : "this stack has no system account yet, so nothing was rotated or started", { target: { root, space }, remedy: trust ? "run the rotation where the broker trust record lives" : `run bare cotal up from ${root}; a first start mints the $SYS creds` });
|
|
644
|
+
throw new CommandFailure("refused", "TARGET_UNAVAILABLE", trust ? "this root holds the space's trust without the broker operator seed, so it cannot rotate the system account; nothing was started" : "this stack has no system account yet, so nothing was rotated or started", { target: { root, space }, remedy: trust ? "run the rotation where the broker trust record lives" : `run bare \`cotal up\` from ${root}; a first start mints the $SYS creds` });
|
|
645
645
|
}
|
|
646
646
|
if (request.recreateIssuedStores !== undefined) {
|
|
647
647
|
const running = STACK_ROLES.flatMap((role) => serviceInstances(space, STACK_DEFINITION[role])).filter((row) => observeServiceProcess(row.record.value) === "running");
|
|
648
648
|
if (running.length)
|
|
649
|
-
throw new CommandFailure("refused", "LIFECYCLE_BLOCKED", "this stack has running members, and the issued-authority stores are recreated only on a fresh broker start, before any issuer runs; nothing was changed", { target: { root, space, instances: running.map((row) => row.name) }, remedy: `stop the stack with cotal down --yes from ${root}, then run cotal up --recreate-issued-stores <backup-dir
|
|
649
|
+
throw new CommandFailure("refused", "LIFECYCLE_BLOCKED", "this stack has running members, and the issued-authority stores are recreated only on a fresh broker start, before any issuer runs; nothing was changed", { target: { root, space, instances: running.map((row) => row.name) }, remedy: `stop the stack with \`cotal down --yes\` from ${root}, then run \`cotal up --recreate-issued-stores <backup-dir>\` again` });
|
|
650
650
|
}
|
|
651
651
|
// Check provider inputs before preparation or a journal write. A supplied IdP is always checked,
|
|
652
652
|
// including a live refresh; only an unpinned first enable probes JWKS. Preparation checks again.
|
|
@@ -722,13 +722,13 @@ export async function startControllerStack(request, native) {
|
|
|
722
722
|
// address; a stack that ran keeps its recorded one, so whatever answers there must stop first.
|
|
723
723
|
const holder = loadMeshes().find((mesh) => mesh.space !== space && mesh.server === server);
|
|
724
724
|
const local = holder && (holder.origin === undefined || holder.origin === "up");
|
|
725
|
-
const stopHolder = holder ? local ? `stop space ${holder.space} with cotal down from ${holder.root}` : `stop the broker of space ${holder.space}` : `stop what answers at ${server}`;
|
|
725
|
+
const stopHolder = holder ? local ? `stop space ${holder.space} with \`cotal down\` from ${holder.root}` : `stop the broker of space ${holder.space}` : `stop what answers at ${server}`;
|
|
726
726
|
const address = new URL(server);
|
|
727
727
|
throw new CommandFailure("refused", "CONFLICT", `something already answers at the stack's broker address ${server}${holder ? `, where space ${holder.space} is registered` : ""}, without this stack's broker instance; it was not adopted or stopped`, {
|
|
728
728
|
target: { root, space, server, ...(holder ? { registered: { space: holder.space, root: holder.root } } : {}) },
|
|
729
729
|
remedy: previous === undefined
|
|
730
|
-
? `start this stack at another address with cotal up --server ${address.protocol}//${address.hostname}:<port
|
|
731
|
-
: `${stopHolder}, then run bare cotal up from ${root}; this stack keeps its recorded address`,
|
|
730
|
+
? `start this stack at another address with \`cotal up --server ${address.protocol}//${address.hostname}:<port>\` from ${root}, or ${stopHolder} and run \`cotal up\` again`
|
|
731
|
+
: `${stopHolder}, then run bare \`cotal up\` from ${root}; this stack keeps its recorded address`,
|
|
732
732
|
});
|
|
733
733
|
}
|
|
734
734
|
// A program that holds the address without answering NATS, such as a web server, is refused here
|
|
@@ -740,8 +740,8 @@ export async function startControllerStack(request, native) {
|
|
|
740
740
|
throw new CommandFailure("refused", "CONFLICT", `${says} (bind failed: address already in use); no broker was launched`, {
|
|
741
741
|
target: { root, space, server, bindError: bindError.code },
|
|
742
742
|
remedy: previous === undefined
|
|
743
|
-
? `start this stack at another address with cotal up --server ${address.protocol}//${address.hostname}:<port
|
|
744
|
-
: `${frees}, then run bare cotal up from ${root}; this stack keeps its recorded address`,
|
|
743
|
+
? `start this stack at another address with \`cotal up --server ${address.protocol}//${address.hostname}:<port>\` from ${root}, or ${frees} and run \`cotal up\` again`
|
|
744
|
+
: `${frees}, then run bare \`cotal up\` from ${root}; this stack keeps its recorded address`,
|
|
745
745
|
});
|
|
746
746
|
}
|
|
747
747
|
let prepared;
|
|
@@ -810,7 +810,7 @@ export async function startControllerStack(request, native) {
|
|
|
810
810
|
const authRows = serviceInstances(space, STACK_DEFINITION.auth);
|
|
811
811
|
const authRunning = authRows.length === 1 && observeServiceProcess(authRows[0].record.value) === "running";
|
|
812
812
|
if (!prepared?.user && !authRunning)
|
|
813
|
-
throw new CommandFailure("refused", "LIFECYCLE_BLOCKED", "the user stack's auth service is stopped while its broker still runs; its native preparation runs only with a broker start, so it was not started from other material", { target: { root, space }, remedy: "stop the stack with bare cotal down
|
|
813
|
+
throw new CommandFailure("refused", "LIFECYCLE_BLOCKED", "the user stack's auth service is stopped while its broker still runs; its native preparation runs only with a broker start, so it was not started from other material", { target: { root, space }, remedy: "stop the stack with bare `cotal down`, then run bare `cotal up`" });
|
|
814
814
|
// The callout's deadline is the timeout this broker configuration rendered, never a second setting.
|
|
815
815
|
const authOptions = { root, server, ...(prepared?.authTimeout !== undefined ? { "auth-timeout": String(prepared.authTimeout) } : {}) };
|
|
816
816
|
const authService = ensureDefinition(space, "auth", adapterDefinition(space, STACK_ADAPTER.auth, authOptions, 60000), root, replace("auth"));
|
|
@@ -849,7 +849,7 @@ export async function startControllerStack(request, native) {
|
|
|
849
849
|
process.stderr.write(`${STACK_DEFINITION.delivery}: shard 0 is still leased to this folder's previous delivery daemon, which is not running; waiting ${Math.ceil(ms / 1000)}s for the lease to expire\n`); },
|
|
850
850
|
});
|
|
851
851
|
if (waited === "rewritten")
|
|
852
|
-
throw new CommandFailure("refused", "CONFLICT", "shard 0 of the delivery lease names this folder's previous delivery daemon and was written again while up waited for it to expire, so a live daemon holds it; no second daemon was started", { target: { root, space }, remedy: `find the process running delivery for space ${space} and stop it or keep it; cotal down does not reach a daemon this folder has no record of` });
|
|
852
|
+
throw new CommandFailure("refused", "CONFLICT", "shard 0 of the delivery lease names this folder's previous delivery daemon and was written again while up waited for it to expire, so a live daemon holds it; no second daemon was started", { target: { root, space }, remedy: `find the process running delivery for space ${space} and stop it or keep it; \`cotal down\` does not reach a daemon this folder has no record of` });
|
|
853
853
|
}
|
|
854
854
|
await store.put(credsKey, creds);
|
|
855
855
|
}
|
|
@@ -893,7 +893,7 @@ export async function startControllerStack(request, native) {
|
|
|
893
893
|
// A reused broker that lost some of the space's streams, but not all of them as `cotal space delete`
|
|
894
894
|
// leaves it, gets none back here; a broker start creates the missing ones.
|
|
895
895
|
const error = brokerReused && isJetStreamMissing(caught, JetStreamApiCodes.StreamNotFound)
|
|
896
|
-
? new CommandFailure("refused", "TARGET_NOT_FOUND", "the running broker is missing some of this space's streams, and up creates them on a running broker only when every one is gone, as after cotal space delete", { remedy: "restart the stack with cotal down --yes
|
|
896
|
+
? new CommandFailure("refused", "TARGET_NOT_FOUND", "the running broker is missing some of this space's streams, and up creates them on a running broker only when every one is gone, as after `cotal space delete`", { remedy: "restart the stack with `cotal down --yes`, then `cotal up`, which creates the missing ones" })
|
|
897
897
|
: reusedWithoutJetStream(caught, brokerReused, root, space) ?? caught;
|
|
898
898
|
// A broker this call started that could not create the space's streams serves no stack, and a
|
|
899
899
|
// later up would reuse it and fail the same way. It is stopped again here, so the next up starts
|
|
@@ -924,12 +924,12 @@ export async function startControllerStack(request, native) {
|
|
|
924
924
|
changed: [instanceProjection(unserved.stopped)],
|
|
925
925
|
...(nativeCause ? { native: nativeCause } : {}),
|
|
926
926
|
remedy: unserved.outOfFiles
|
|
927
|
-
? `raise the open-file limit (ulimit -n) of the shell that runs cotal up
|
|
927
|
+
? `raise the open-file limit (ulimit -n) of the shell that runs \`cotal up\`, then run \`cotal up\` again from ${root}`
|
|
928
928
|
: noStorage
|
|
929
929
|
? brokerCap !== undefined
|
|
930
|
-
? `run cotal up --max-file-store <bytes
|
|
931
|
-
: `free space on the filesystem that holds ${brokerStore ?? join(root, ".cotal", "nats")}, or run cotal up --max-file-store <bytes
|
|
932
|
-
: `fix what the broker's log${unserved.log ? ` at ${unserved.log}` : ""} names, then run cotal up again from ${root}`,
|
|
930
|
+
? `run \`cotal up --max-file-store <bytes>\` from ${root} ${storeRemedy}`
|
|
931
|
+
: `free space on the filesystem that holds ${brokerStore ?? join(root, ".cotal", "nats")}, or run \`cotal up --max-file-store <bytes>\` from ${root} ${storeRemedy}`
|
|
932
|
+
: `fix what the broker's log${unserved.log ? ` at ${unserved.log}` : ""} names, then run \`cotal up\` again from ${root}`,
|
|
933
933
|
});
|
|
934
934
|
}
|
|
935
935
|
const failure = isCommandFailure(error) ? error : undefined;
|
|
@@ -956,7 +956,7 @@ export async function startControllerStack(request, native) {
|
|
|
956
956
|
const cause = pending && failure ? ` (${pending.role}: ${failure.message}${starved !== undefined ? `; the broker's log${starved ? ` at ${starved}` : ""} records that it ran out of open files` : full ? `; the broker's JetStream store ${full.path} is full at its --max-file-store cap of ${full.cap} bytes, so it refuses every write` : ""})` : "";
|
|
957
957
|
// A refusal or failure with no member started or reused leaves nothing of the stack running.
|
|
958
958
|
const none = !uncertain && !journal.members.some((row) => row.state === "started" || row.state === "reused");
|
|
959
|
-
throw new CommandFailure(outcome, uncertain ? "OPERATION_UNKNOWN" : changed.length ? "OPERATION_PARTIAL" : failure.code, none ? `the controller stack started no member${cause}; nothing was retried` : `the controller stack did not start every planned member${cause}; started members were kept and nothing was retried`, { target: { root, space, operation: journal.operation.id, members: journal.members, ...(failedStage ? { stage: failedStage } : {}) }, changed, ...(nativeCause ? { native: nativeCause } : {}), remedy: starved !== undefined ? `stop the stack with cotal down --yes from ${root}, raise the open-file limit (ulimit -n) of the shell that runs cotal up
|
|
959
|
+
throw new CommandFailure(outcome, uncertain ? "OPERATION_UNKNOWN" : changed.length ? "OPERATION_PARTIAL" : failure.code, none ? `the controller stack started no member${cause}; nothing was retried` : `the controller stack did not start every planned member${cause}; started members were kept and nothing was retried`, { target: { root, space, operation: journal.operation.id, members: journal.members, ...(failedStage ? { stage: failedStage } : {}) }, changed, ...(nativeCause ? { native: nativeCause } : {}), remedy: starved !== undefined ? `stop the stack with \`cotal down --yes\` from ${root}, raise the open-file limit (ulimit -n) of the shell that runs \`cotal up\`, then run \`cotal up\` there again` : full ? fullStoreUpRemedy(root, space) : !uncertain && failure?.remedy ? failure.remedy : `inspect the stack's members with ${codeSpan(`cotal service --space ${shellWord(space)}`)} before another \`cotal up\`; a later bare \`cotal down\` stops only the recorded members` });
|
|
960
960
|
}
|
|
961
961
|
if (loginBlock) {
|
|
962
962
|
mark("manager", { state: "not-attempted", code: "AUTH_REQUIRED" });
|
|
@@ -1018,8 +1018,8 @@ export function stackUpForegroundNotice(presentation, space, takeover = false) {
|
|
|
1018
1018
|
if (presentation === "json")
|
|
1019
1019
|
return;
|
|
1020
1020
|
const holds = takeover
|
|
1021
|
-
? "This stack is already running, and this terminal now takes over its lifetime. Ctrl-C or SIGTERM here stops the whole stack, though another command started it, with the same guarded whole-stack stop as bare cotal down
|
|
1022
|
-
: "This terminal holds the stack's lifetime. Ctrl-C or SIGTERM runs the same guarded whole-stack stop as bare cotal down
|
|
1021
|
+
? "This stack is already running, and this terminal now takes over its lifetime. Ctrl-C or SIGTERM here stops the whole stack, though another command started it, with the same guarded whole-stack stop as bare `cotal down`, including its manager impact review."
|
|
1022
|
+
: "This terminal holds the stack's lifetime. Ctrl-C or SIGTERM runs the same guarded whole-stack stop as bare `cotal down`, including its manager impact review.";
|
|
1023
1023
|
console.log(renderReport({ space, sections: [{ title: "Foreground stack lifetime", blocks: [{ kind: "lines", lines: [`${holds} Terminal loss or an external kill is not a confirmed stop.`] }] }] }, presentation, terminalWidth(process.stdout)));
|
|
1024
1024
|
}
|
|
1025
1025
|
//# sourceMappingURL=stack-up.js.map
|