@cotal-ai/cli 0.171.1 → 0.171.3
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 +140 -85
- package/dist/command.js.map +1 -1
- package/dist/commands/agents.d.ts.map +1 -1
- package/dist/commands/agents.js +12 -8
- 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/backup.d.ts.map +1 -1
- package/dist/commands/backup.js +12 -5
- package/dist/commands/backup.js.map +1 -1
- package/dist/commands/down.d.ts.map +1 -1
- package/dist/commands/down.js +11 -7
- package/dist/commands/down.js.map +1 -1
- package/dist/commands/ext.js +1 -1
- 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/setup.d.ts.map +1 -1
- package/dist/commands/setup.js +14 -2
- package/dist/commands/setup.js.map +1 -1
- package/dist/commands/space-registration.d.ts +3 -1
- package/dist/commands/space-registration.d.ts.map +1 -1
- package/dist/commands/space-registration.js +20 -14
- package/dist/commands/space-registration.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-preview.d.ts +1 -1
- package/dist/commands/spawn-preview.d.ts.map +1 -1
- package/dist/commands/spawn-preview.js +36 -6
- package/dist/commands/spawn-preview.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 +158 -75
- package/dist/commands/spawn.js.map +1 -1
- package/dist/commands/stack-down.js +9 -4
- package/dist/commands/stack-down.js.map +1 -1
- package/dist/commands/stack-gone.d.ts +8 -5
- package/dist/commands/stack-gone.d.ts.map +1 -1
- package/dist/commands/stack-gone.js +8 -6
- package/dist/commands/stack-gone.js.map +1 -1
- package/dist/commands/stack-up.d.ts +2 -1
- package/dist/commands/stack-up.d.ts.map +1 -1
- package/dist/commands/stack-up.js +9 -5
- package/dist/commands/stack-up.js.map +1 -1
- package/dist/commands/status.d.ts +6 -1
- package/dist/commands/status.d.ts.map +1 -1
- package/dist/commands/status.js +71 -27
- package/dist/commands/status.js.map +1 -1
- package/dist/commands/up.d.ts +2 -1
- package/dist/commands/up.d.ts.map +1 -1
- package/dist/commands/up.js +72 -43
- package/dist/commands/up.js.map +1 -1
- package/dist/commands/update.d.ts +9 -3
- package/dist/commands/update.d.ts.map +1 -1
- package/dist/commands/update.js +230 -40
- 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 +4 -2
- package/dist/index.js.map +1 -1
- package/dist/lib/backup-artifact.d.ts.map +1 -1
- package/dist/lib/backup-artifact.js +11 -3
- package/dist/lib/backup-artifact.js.map +1 -1
- package/dist/lib/credential-authority.d.ts.map +1 -1
- package/dist/lib/credential-authority.js +3 -1
- package/dist/lib/credential-authority.js.map +1 -1
- package/dist/lib/delivery-proc.d.ts +2 -1
- package/dist/lib/delivery-proc.d.ts.map +1 -1
- package/dist/lib/delivery-proc.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 +4 -2
- package/dist/lib/manager-proc.d.ts.map +1 -1
- package/dist/lib/manager-proc.js +10 -3
- package/dist/lib/manager-proc.js.map +1 -1
- package/dist/lib/manifest/render.d.ts.map +1 -1
- package/dist/lib/manifest/render.js +4 -0
- package/dist/lib/manifest/render.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 +4 -0
- 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 +24 -3
- 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-preset-target.d.ts.map +1 -1
- package/dist/lib/service-preset-target.js +6 -1
- package/dist/lib/service-preset-target.js.map +1 -1
- 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 +7 -5
- package/dist/lib/service-presets.js.map +1 -1
- package/dist/lib/service-process.d.ts +2 -0
- package/dist/lib/service-process.d.ts.map +1 -1
- package/dist/lib/service-process.js +3 -3
- package/dist/lib/service-process.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 +5 -2
- package/dist/lib/stack-journal.d.ts.map +1 -1
- package/dist/lib/stack-journal.js +5 -2
- package/dist/lib/stack-journal.js.map +1 -1
- package/dist/lib/team-agent-removal.d.ts +1 -1
- package/dist/lib/update-pending.d.ts.map +1 -1
- package/dist/lib/update-pending.js +4 -2
- package/dist/lib/update-pending.js.map +1 -1
- package/dist/lib/update-snapshot.js +3 -3
- package/dist/lib/update-snapshot.js.map +1 -1
- package/dist/lib/version.d.ts +2 -0
- package/dist/lib/version.d.ts.map +1 -1
- package/dist/lib/version.js +15 -1
- 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/up.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type BrokerTransport, type AuthPrepared, type ChannelRegistryFile, type ParsedArgs, type FlagSpec, type CompletionResult } from "@cotal-ai/core";
|
|
2
|
-
import { type MeshEntry, type MaintenanceLock } from "@cotal-ai/workspace";
|
|
2
|
+
import { type SeatCap, type MeshEntry, type MaintenanceLock } from "@cotal-ai/workspace";
|
|
3
3
|
import { type NatsServer } from "../lib/nats-bin.js";
|
|
4
4
|
import { type PreparedManifest } from "../lib/manifest/index.js";
|
|
5
5
|
import { type ExistingStorePin, type StackUpNative } from "./stack-up.js";
|
|
@@ -179,6 +179,7 @@ export interface DetachOpts {
|
|
|
179
179
|
sha256: string;
|
|
180
180
|
};
|
|
181
181
|
maxSessions?: number;
|
|
182
|
+
managerSeatCap?: SeatCap;
|
|
182
183
|
/** #1417 broker-only boot (`--no-manager`): no manager starts with this broker. An `up -f` under
|
|
183
184
|
* the flag boots the broker + channels and launches NO agents from this host — a manifest's
|
|
184
185
|
* agents are booted by its manager, so a launch spec under `--no-manager` would promise a boot
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"up.d.ts","sourceRoot":"","sources":["../../src/commands/up.ts"],"names":[],"mappings":"AAsBA,OAAO,EAaL,KAAK,eAAe,EA+BpB,KAAK,YAAY,EAEjB,KAAK,mBAAmB,EACxB,KAAK,UAAU,EACf,KAAK,QAAQ,EACb,KAAK,gBAAgB,EACtB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,
|
|
1
|
+
{"version":3,"file":"up.d.ts","sourceRoot":"","sources":["../../src/commands/up.ts"],"names":[],"mappings":"AAsBA,OAAO,EAaL,KAAK,eAAe,EA+BpB,KAAK,YAAY,EAEjB,KAAK,mBAAmB,EACxB,KAAK,UAAU,EACf,KAAK,QAAQ,EACb,KAAK,gBAAgB,EACtB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EAOL,KAAK,OAAO,EA+DZ,KAAK,SAAS,EAyBd,KAAK,eAAe,EAwCrB,MAAM,qBAAqB,CAAC;AAM7B,OAAO,EAA+E,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAclI,OAAO,EAA4C,KAAK,gBAAgB,EAAE,MAAM,0BAA0B,C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AAG,MAAM,GAAG,SAAS,CAEnF;AAED;;;;;;;;;;GAUG;AACH,KAAK,UAAU,GAAG,SAAS,GAAG,SAAS,CAAC;AAExC;;mCAEmC;AACnC,eAAO,MAAM,oBAAoB,GAAI,GAAG,SAAS,EAAE,YAAY,UAAU,KAAG,IAAoC,CAAC"}
|
package/dist/commands/up.js
CHANGED
|
@@ -10,13 +10,13 @@ import { basename, dirname, isAbsolute, join, resolve } from "node:path";
|
|
|
10
10
|
import { isReachable, dialerFor, DEFAULT_SERVER, DEFAULT_SPACE, SERVICE_AUTHORITY_MAX_BYTES, SERVICE_CALLER_PAYLOAD_FLOOR, CONTRACT_ARTIFACT_MAX_BYTES, MANAGER_START_PAYLOAD_FLOOR, createSpaceAuth, serverConfig, openServerConfig, validateTlsMaterial, credsProblem, mintCreds, mintLifecycleUid, DEV_OWNER, mintConnectionEvictorCreds, mintMembershipObserverCreds, newIdentity, setupSpaceStreams, removeIssuedStoresBeforeRetention, IssuedStoreBeforeRetentionError, IssuedStoreRecreateRefusal, reconcileSpaceMemoryBuckets, membershipStoreDefinition, LEGACY_MEMBERSHIP_MAX_BYTES, MEMBERSHIP_MAX_VALUE_SIZE, ttlBuckets, standaloneConnectOpts, requireBrokerFloor, parseServerVersion, presenceBucket, spaceDeletionStreams, isJetStreamMissing, seedChannelRegistry, ensureDefaultDeliveryClass, UndecodableRegistryEntry, LEASE_TTL_MS, EpEnvelopeError, mkSecretDir, openPrivateAppend, writeSecretFile, } from "@cotal-ai/core";
|
|
11
11
|
import { JetStreamApiCodes, jetstreamManager, StorageType } from "@nats-io/jetstream";
|
|
12
12
|
import { Kvm } from "@nats-io/kv";
|
|
13
|
-
import { assertManagerName, readManagerName, readManagerSeatCap, recordManagerName,
|
|
13
|
+
import { assertManagerName, readManagerName, readManagerSeatCap, recordManagerName, parseSeatCapFlag, seatCapText, CommandFailure, codeSpan, commandFailureReport, failureEnvelope, writeEnvelope, isCommandFailure, protectedLocalDirectory, jsonFlag, plainFlag, renderReport, assertSingleSpaceBroker, assertUserAuthInfo, authDir, brokerAddressForDisplay, brokerPolicyPath, getSoleSpaceAuth, soleSpaceOf, getSpaceAuth, hasUserAuthState, listSpaceAccounts, preloadSpaceAccounts, putSpaceAuth, brokerAddressKey, canonicalRoot, rootPathProblem, rootControlProblem, clearCurrent, findMesh, findPreparedSpace, homeCotalDir, legacyStackOtherHome, stackHomeRemedy, getCurrent, loadMeshes, preparedSpaceAt, removePreparedSpace, localMeshesForRoot, keepsRegistration, oneLine, presentationOf, writeResult, connectionEvictorCredsKey, membershipConfigPath, membershipObserverCredsKey, membershipRwCredsKey, MEMBERSHIP_CONFIG_KIND, MEMBERSHIP_RW_CREDS_KIND, WEB_CREDS_KIND, webCredsKey, parsePositiveIntegerFlag, recordMesh, retainedLegacyBroker, meshesForRoot, removeMesh, rotateSystemCreds, setAdoptedCurrent, staleSystemCreds, SYSTEM_CREDS_FILES, userAuthStateDir, userAuthSpacesOnDisk, workspaceSecretStore, acquireMaintenanceLock, assertStoreIdentity, assessMaintenanceClaim, assessRestoreClaim, beginOrdinaryResume, bindOrdinaryResumeListener, consumeRetiredMaintenance, markOrdinaryResumeActive, markOrdinaryResumeDegraded, replaceDeadOrdinaryResumeListener, localProcessOwnerStatus, readMaintenanceJournal, rootNamesNoSpace, readMaintenanceResumeDocument, readStoreIdentity, recordOrdinaryResumeManagerCommit, releaseMaintenanceLock, retireOrdinaryResume, settleTokenHandoff, sweepTokenHandoff, writeTokenHandoff, sameStoreIdentity, cutController, readBrokerPolicy, writeBrokerPolicy, brokerAccountResolver, removePidPair, writePidPair, verifyIdentityPin, processesNaming, isLoopbackHost, connectUserControlOrThrow, userViewAuth, recordOperationSpace, recordsElsewhereError, recordOperationWarning, retainSystemSigningSeed, restoreLeftOut, SPACE_NAME_MAX, spaceNameTooLong, NATS_PIDFILE, MANAGER_PIDFILE, DELIVERY_PIDFILE, AUTH_PIDFILE, localProcessPath, UNTRUSTED_CERTIFICATE, exitCode, canonicalLocalProcessPath, DELIVERY_LOGFILE, terminalWidth, } from "@cotal-ai/workspace";
|
|
14
14
|
import { FlagValueRefusal } from "../lib/flag-value-refusal.js";
|
|
15
15
|
import { ensureAuthService, resolveAuthProvider, stopAuthService } from "../lib/auth-proc.js";
|
|
16
16
|
import { resolveSpace } from "../lib/status.js";
|
|
17
17
|
import { c, hang, stderrLine } from "../ui.js";
|
|
18
18
|
import { admitAndRestoreSeatCheckpoints } from "../lib/seat-resume.js";
|
|
19
|
-
import { natsServerLabel, resolveNatsServer, unreadVersion } from "../lib/nats-bin.js";
|
|
19
|
+
import { NATS_DEFAULT_MAX_PAYLOAD, natsServerLabel, resolveNatsServer, unreadVersion } from "../lib/nats-bin.js";
|
|
20
20
|
import { cotalPath, cotalRoot, homeHoldsStack, linkedCotalRefusal } from "../lib/paths.js";
|
|
21
21
|
import { channelsReads, readChannelsFile, readDefaultChannelsFile } from "../lib/channel-seed.js";
|
|
22
22
|
import { detachedNext, renderDetachedSummary } from "../lib/up-report.js";
|
|
@@ -92,10 +92,10 @@ export const upFlags = [
|
|
|
92
92
|
{ name: "store-dir", type: "string", value: "<dir>", description: "JetStream store directory" },
|
|
93
93
|
{ name: "max-file-store", type: "string", value: "<bytes>", description: "JetStream file storage cap in bytes (default: nats-server's dynamic cap). Fixed at broker start and recorded for the next `up`; a legacy root also keeps it across `down --preserve-state`" },
|
|
94
94
|
{ name: "log-file", type: "string", value: "<path>", description: "nats-server log file path; recorded and reused by later starts" },
|
|
95
|
-
{ name: "logfile-size-limit", type: "string", value: "<bytes>", description: "nats-server log rotation threshold in bytes; requires --log-file" },
|
|
96
|
-
{ name: "logfile-max-num", type: "string", value: "<count>", description: "maximum total broker log files retained; requires --log-file" },
|
|
95
|
+
{ name: "logfile-size-limit", type: "string", value: "<bytes>", description: "nats-server log rotation threshold in bytes; requires --log-file or broker.logFile in a manifest" },
|
|
96
|
+
{ name: "logfile-max-num", type: "string", value: "<count>", description: "maximum total broker log files retained; requires --log-file or broker.logFile in a manifest" },
|
|
97
97
|
{ name: "auth-timeout", type: "string", value: "<seconds>", description: "user-auth only: how long the broker waits for the auth callout, 1 to 60 seconds (default: nats-server's 2); the auth service answers inside it. Fixed at broker start and recorded for the next `up`" },
|
|
98
|
-
{ name: "max-payload", type: "string", value: "<bytes>", description:
|
|
98
|
+
{ name: "max-payload", type: "string", value: "<bytes>", description: `broker-wide message size limit in bytes (default: nats-server's ${NATS_DEFAULT_MAX_PAYLOAD}). A manager-backed start needs at least 263168, and service endpoint caller grants need at least 2098176. Fixed at broker start and recorded for the next \`up\`` },
|
|
99
99
|
{ name: "account-resolver", type: "string", value: "<memory|full>", description: "how the broker resolves space accounts: memory (default) knows only the accounts its configuration lists, so adding one means a reload; full also keeps pushed account claims in .cotal/account-jwts, so a host can add and retire accounts on the running broker without a reload. Fixed at broker start and recorded for the next `up`" },
|
|
100
100
|
{ name: "channels", type: "string", value: "<path>", description: "channel-registry seed file (JSON; default .cotal/channels.json)" },
|
|
101
101
|
{ name: "tls-cert", type: "string", value: "<file>", description: "serve the broker over TLS with this certificate (requires --tls-key)" },
|
|
@@ -158,6 +158,8 @@ function assertIssuedBackupDirArgument(raw) {
|
|
|
158
158
|
* re-entry supplies its recorded mode explicitly rather than inheriting the new public default. */
|
|
159
159
|
export function validateUpArguments(args) {
|
|
160
160
|
presentationOf(args.values);
|
|
161
|
+
if (args.values.restore === "")
|
|
162
|
+
throw new CommandFailure("refused", "USAGE_INVALID", "--restore is empty, so it names no backup folder; nothing was started or written", { remedy: "pass the backup folder as --restore <dir>, or omit --restore to start without restoring", selfContained: true });
|
|
161
163
|
// A `.cotal` that is a link, or leads nowhere, is refused before anything reads through it.
|
|
162
164
|
const linked = args.values.root === undefined ? linkedCotalRefusal("up") : undefined;
|
|
163
165
|
if (linked)
|
|
@@ -213,6 +215,9 @@ export function validateUpArguments(args) {
|
|
|
213
215
|
parsePositiveIntegerFlag("--max-sessions", args.values["max-sessions"]);
|
|
214
216
|
parseSeatCapFlag("--seat-cap", args.values["seat-cap"]);
|
|
215
217
|
parseMaxFileStore(args.values["max-file-store"]);
|
|
218
|
+
const logFile = args.values["log-file"];
|
|
219
|
+
if (logFile !== undefined && (!logFile.trim() || /[\u0000-\u001f\u007f]/u.test(logFile)))
|
|
220
|
+
throw new CommandFailure("refused", "USAGE_INVALID", "--log-file must be a non-empty file path without control characters");
|
|
216
221
|
// The timeout belongs to the auth callout, which only a user-auth space has. A manifest or a
|
|
217
222
|
// restore starts the broker its own record describes, so neither takes it.
|
|
218
223
|
if (parseAuthTimeout(args.values["auth-timeout"]) !== undefined) {
|
|
@@ -781,7 +786,7 @@ export async function up(args, inheritedLock, freshTeamBoot = false, restoreSink
|
|
|
781
786
|
const previousCwd = process.cwd();
|
|
782
787
|
// Path flags still mean paths relative to the invoking directory, not the selected root.
|
|
783
788
|
// The recursive restore/resume re-entries inherit absolute paths and the same absolute root.
|
|
784
|
-
const paths = root ? Object.fromEntries(["file", "restore", "channels", "tls-cert", "tls-key", "store-dir"].filter((key) => typeof args.values[key] === "string" && args.values[key] !== "").map((key) => [key, resolve(String(args.values[key]))])) : {};
|
|
789
|
+
const paths = root ? Object.fromEntries(["file", "restore", "channels", "tls-cert", "tls-key", "store-dir", "log-file"].filter((key) => typeof args.values[key] === "string" && args.values[key] !== "").map((key) => [key, resolve(String(args.values[key]))])) : {};
|
|
785
790
|
// The receipt's Next must run from the folder up was invoked in, which a re-entry inherits.
|
|
786
791
|
const invokedRoot = root && args.values.__invokedRoot === undefined ? { __invokedRoot: canonicalRoot(cotalRoot()) } : {};
|
|
787
792
|
const invocation = { ...args, values: { ...args.values, ...paths, ...(root ? { root } : {}), ...invokedRoot, detach: args.values.foreground !== true } };
|
|
@@ -846,7 +851,7 @@ async function runUp(args, inheritedLock, onAdopt, freshTeamBoot = false, restor
|
|
|
846
851
|
// `space create` and `down` refuse a root other local accounts can write, so `up` refuses it too,
|
|
847
852
|
// before anything is written: a stack started there could not be stopped from it.
|
|
848
853
|
protectedLocalDirectory(canonicalRoot(cotalRoot()), "the project root");
|
|
849
|
-
if (values.restore) {
|
|
854
|
+
if (values.restore !== undefined) {
|
|
850
855
|
if (values.file || values.channels)
|
|
851
856
|
throw new Error("--restore cannot be combined with --file/-f or --channels");
|
|
852
857
|
// A restore REINSTATES a trust root from an artifact; a rotation SUPERSEDES the one on disk.
|
|
@@ -1315,12 +1320,10 @@ async function runUp(args, inheritedLock, onAdopt, freshTeamBoot = false, restor
|
|
|
1315
1320
|
const publicExchange = [...publicExchangeArgs(values, wantUser), ...serviceEndpointsArgs(values, wantUser)];
|
|
1316
1321
|
const maxSessions = parsePositiveIntegerFlag("--max-sessions", values["max-sessions"]);
|
|
1317
1322
|
const maxFileStore = parseMaxFileStore(values["max-file-store"]);
|
|
1318
|
-
if (values["log-file"] !== undefined && (!values["log-file"].trim() || /[\u0000-\u001f\u007f]/u.test(values["log-file"])))
|
|
1319
|
-
throw new CommandFailure("refused", "USAGE_INVALID", "--log-file must be a non-empty file path without control characters");
|
|
1320
1323
|
const logFile = values["log-file"] === undefined ? undefined : resolve(values["log-file"]);
|
|
1321
1324
|
const logfileSizeLimit = parsePositiveIntegerFlag("--logfile-size-limit", values["logfile-size-limit"]);
|
|
1322
1325
|
const logfileMaxNum = parsePositiveIntegerFlag("--logfile-max-num", values["logfile-max-num"]);
|
|
1323
|
-
if (logFile === undefined && (logfileSizeLimit !== undefined || logfileMaxNum !== undefined))
|
|
1326
|
+
if (!values.file && logFile === undefined && (logfileSizeLimit !== undefined || logfileMaxNum !== undefined))
|
|
1324
1327
|
throw new CommandFailure("refused", "USAGE_INVALID", "--logfile-size-limit and --logfile-max-num require --log-file");
|
|
1325
1328
|
const authTimeout = parseAuthTimeout(values["auth-timeout"]);
|
|
1326
1329
|
const maxPayload = parseMaxPayload(values["max-payload"]);
|
|
@@ -1379,18 +1382,12 @@ async function runUp(args, inheritedLock, onAdopt, freshTeamBoot = false, restor
|
|
|
1379
1382
|
recordManagerName(named, name);
|
|
1380
1383
|
}
|
|
1381
1384
|
}
|
|
1382
|
-
//
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
if (values["seat-cap"] !== undefined) {
|
|
1386
|
-
const cap = parseSeatCapFlag("--seat-cap", values["seat-cap"]);
|
|
1385
|
+
// The manager records this cap once it serves. A running manager keeps the cap it started with.
|
|
1386
|
+
const managerSeatCap = parseSeatCapFlag("--seat-cap", values["seat-cap"]);
|
|
1387
|
+
if (managerSeatCap !== undefined) {
|
|
1387
1388
|
const capped = { root: cotalRoot(), space: values.space ?? folderSpace() };
|
|
1388
|
-
if (readManagerSeatCap(capped) !==
|
|
1389
|
-
|
|
1390
|
-
throw new CommandFailure("refused", "LIFECYCLE_BLOCKED", `a manager already runs for space ${capped.space}, and it keeps the seat cap it started with`, { target: { root: capped.root, space: capped.space }, remedy: `stop it with \`cotal down\`, then run \`cotal up --seat-cap ${seatCapText(cap)}\`` });
|
|
1391
|
-
if (!values["dry-run"])
|
|
1392
|
-
recordManagerSeatCap(capped, cap);
|
|
1393
|
-
}
|
|
1389
|
+
if (readManagerSeatCap(capped) !== managerSeatCap && managerRecordState(capped.space, capped.root).state === "alive")
|
|
1390
|
+
throw new CommandFailure("refused", "LIFECYCLE_BLOCKED", `a manager already runs for space ${capped.space}, and it keeps the seat cap it started with`, { target: { root: capped.root, space: capped.space }, remedy: `stop it with \`cotal down\`, then run \`cotal up --seat-cap ${seatCapText(managerSeatCap)}\`` });
|
|
1394
1391
|
}
|
|
1395
1392
|
// THE TRANSPORT IS DECIDED HERE, ABOVE EVERY BRANCH, AND THIS POSITION IS THE FIX.
|
|
1396
1393
|
//
|
|
@@ -1483,7 +1480,7 @@ async function runUp(args, inheritedLock, onAdopt, freshTeamBoot = false, restor
|
|
|
1483
1480
|
const stackServer = values.server ?? readStackJournal(meshRoot)?.journal.server ?? localMeshesForRoot(meshRoot).find((m) => m.space === stackSpace)?.server ?? await unrecordedStackServer(meshRoot, stackSpace, values.host);
|
|
1484
1481
|
if (values.foreground && presentation !== "json")
|
|
1485
1482
|
stackUpForegroundNotice(presentation, stackSpace, takeover);
|
|
1486
|
-
await stackUp({ maintenanceLock: stackLock, root: meshRoot, space: stackSpace, server: stackServer, transport, runtime: values.runtime ?? "pty", noManager, ...(stackMode ? { mode: stackMode } : {}), ...(values.idp ? { idp: values.idp } : {}), ...(values.host ? { host: values.host } : {}), ...(values["store-dir"] ? { storeDir: values["store-dir"] } : {}), ...(values["rotate-sys"] ? { rotateSys: true } : {}), ...(values["recreate-membership-store"] ? { recreateMembershipStore: true } : {}), ...(values["recreate-issued-stores"] !== undefined ? { recreateIssuedStores: resolve(values["recreate-issued-stores"]) } : {}), ...(maxFileStore !== undefined ? { maxFileStore } : {}), ...(logFile !== undefined ? { logFile } : {}), ...(logfileSizeLimit !== undefined ? { logfileSizeLimit } : {}), ...(logfileMaxNum !== undefined ? { logfileMaxNum } : {}), ...(authTimeout !== undefined ? { authTimeout } : {}), ...(maxPayload !== undefined ? { maxPayload } : {}), ...(accountResolver !== undefined ? { accountResolver } : {}), ...(maxSessions !== undefined ? { maxSessions } : {}), ...(values.channels ? { channels: values.channels } : {}), ...(values.__invokedRoot ? { invokedRoot: values.__invokedRoot } : {}), foreground: values.foreground === true, presentation }, native);
|
|
1483
|
+
await stackUp({ maintenanceLock: stackLock, root: meshRoot, space: stackSpace, server: stackServer, transport, runtime: values.runtime ?? "pty", noManager, managerSeatCap, ...(stackMode ? { mode: stackMode } : {}), ...(values.idp ? { idp: values.idp } : {}), ...(values.host ? { host: values.host } : {}), ...(values["store-dir"] ? { storeDir: values["store-dir"] } : {}), ...(values["rotate-sys"] ? { rotateSys: true } : {}), ...(values["recreate-membership-store"] ? { recreateMembershipStore: true } : {}), ...(values["recreate-issued-stores"] !== undefined ? { recreateIssuedStores: resolve(values["recreate-issued-stores"]) } : {}), ...(maxFileStore !== undefined ? { maxFileStore } : {}), ...(logFile !== undefined ? { logFile } : {}), ...(logfileSizeLimit !== undefined ? { logfileSizeLimit } : {}), ...(logfileMaxNum !== undefined ? { logfileMaxNum } : {}), ...(authTimeout !== undefined ? { authTimeout } : {}), ...(maxPayload !== undefined ? { maxPayload } : {}), ...(accountResolver !== undefined ? { accountResolver } : {}), ...(maxSessions !== undefined ? { maxSessions } : {}), ...(values.channels ? { channels: values.channels } : {}), ...(values.__invokedRoot ? { invokedRoot: values.__invokedRoot } : {}), foreground: values.foreground === true, presentation }, native);
|
|
1487
1484
|
}
|
|
1488
1485
|
finally {
|
|
1489
1486
|
releaseMaintenanceLock(stackLock);
|
|
@@ -1861,8 +1858,8 @@ async function runUp(args, inheritedLock, onAdopt, freshTeamBoot = false, restor
|
|
|
1861
1858
|
process.exit(1);
|
|
1862
1859
|
}
|
|
1863
1860
|
// And so is the payload limit, which the same record carries.
|
|
1864
|
-
if (maxPayload !== undefined && maxPayload !== runningPolicy?.maxPayload) {
|
|
1865
|
-
console.error(c.red(`✗ mesh "${held.space}" is already running at ${server} - a running broker can't change --max-payload (it is fixed at start); \`cotal down\` it first, then \`cotal up --max-payload ${maxPayload}\``));
|
|
1861
|
+
if (maxPayload !== undefined && maxPayload !== (runningPolicy?.maxPayload ?? NATS_DEFAULT_MAX_PAYLOAD)) {
|
|
1862
|
+
console.error(c.red(`✗ mesh "${held.space}" is already running at ${server} - a running broker can't change --max-payload (it is fixed at start); \`cotal down\` it first, then \`cotal up${noManager ? " --no-manager" : ""} --max-payload ${maxPayload}\``));
|
|
1866
1863
|
process.exit(1);
|
|
1867
1864
|
}
|
|
1868
1865
|
// nats-server switches account resolvers only at start, and refuses a reload that changes one.
|
|
@@ -2044,6 +2041,7 @@ async function runUp(args, inheritedLock, onAdopt, freshTeamBoot = false, restor
|
|
|
2044
2041
|
runtime: values.runtime,
|
|
2045
2042
|
attachHost: attachHostFor(held.space, values.host),
|
|
2046
2043
|
maxSessions: maxSessionsFor(held.space, maxSessions),
|
|
2044
|
+
managerSeatCap,
|
|
2047
2045
|
noManager,
|
|
2048
2046
|
}, startAuth);
|
|
2049
2047
|
if (!controlPlane)
|
|
@@ -2093,8 +2091,16 @@ async function runUp(args, inheritedLock, onAdopt, freshTeamBoot = false, restor
|
|
|
2093
2091
|
}
|
|
2094
2092
|
if (stoppedStart)
|
|
2095
2093
|
console.log(c.dim(stoppedStart));
|
|
2096
|
-
if (!resumeAttempt)
|
|
2097
|
-
|
|
2094
|
+
if (!resumeAttempt) {
|
|
2095
|
+
const space = values.space ?? folderSpace();
|
|
2096
|
+
// A stopped reservation has no listener to trigger the port selection above. Only a first
|
|
2097
|
+
// implicit start can move: a prior store, launch record or manifest summary can outlive its address.
|
|
2098
|
+
if (!listenerReachable && values.server === undefined && !values["rotate-sys"] && registeredAddressHolder(server, space)
|
|
2099
|
+
&& recordsNameNoSpace(cotalRoot()) && !["nats", "stack-home.json", "team-summaries"].some((entry) => existsSync(cotalPath(entry)))) {
|
|
2100
|
+
server = await freshStackServer(server, host);
|
|
2101
|
+
}
|
|
2102
|
+
refuseRegisteredAddress(server, space, `start this one at another address with \`cotal up --server nats://${host}:<port>\``);
|
|
2103
|
+
}
|
|
2098
2104
|
await assertBrokerAddressFree(server, "cotal up");
|
|
2099
2105
|
// A repair keeps its own store rules above, and a resume or restore names its store.
|
|
2100
2106
|
if (!resumeAttempt && !repairing) {
|
|
@@ -2153,6 +2159,7 @@ async function runUp(args, inheritedLock, onAdopt, freshTeamBoot = false, restor
|
|
|
2153
2159
|
host: values.host,
|
|
2154
2160
|
runtime: values.runtime,
|
|
2155
2161
|
maxSessions,
|
|
2162
|
+
managerSeatCap,
|
|
2156
2163
|
noManager,
|
|
2157
2164
|
resumeAttempt,
|
|
2158
2165
|
resumeCommit: commitTokenHandoff(cotalRoot(), (restored?.managerCommit ?? ordinaryAttempt?.managerCommit) !== undefined, startupLock),
|
|
@@ -2193,11 +2200,12 @@ async function runUp(args, inheritedLock, onAdopt, freshTeamBoot = false, restor
|
|
|
2193
2200
|
console.log(c.dim(`restored: ${composition.restoredWords}; recreated empty: ${composition.emptyWords}`));
|
|
2194
2201
|
if (composition.note)
|
|
2195
2202
|
console.log(c.yellow(composition.note));
|
|
2196
|
-
|
|
2203
|
+
const cleanupRoot = values.__invokedRoot && values.__invokedRoot !== canonicalRoot(restored.root) ? restored.root : undefined;
|
|
2204
|
+
for (const line of leftOutNotes(restored.attemptId, restored.selection, restoreOnlyCopy(restored.root, restored.attemptId), cleanupRoot))
|
|
2197
2205
|
console.log(c.yellow(line));
|
|
2198
2206
|
const journal = readMaintenanceJournal(restored.root);
|
|
2199
2207
|
if (journal && "restore" in journal && journal.restore.attemptId === restored.attemptId)
|
|
2200
|
-
console.log(c.dim(`next: ${restoreNextStep(journal.state, restored.attemptId, restoreLeftOut(journal))}`));
|
|
2208
|
+
console.log(c.dim(`next: ${restoreNextStep(journal.state, restored.attemptId, restoreLeftOut(journal), cleanupRoot)}`));
|
|
2201
2209
|
}
|
|
2202
2210
|
if (!quietRestore) {
|
|
2203
2211
|
const managerRecord = managerRecordState(receiptSpace);
|
|
@@ -2264,6 +2272,7 @@ async function runUp(args, inheritedLock, onAdopt, freshTeamBoot = false, restor
|
|
|
2264
2272
|
// before signalling the broker. Keep the child referenced and its output in this terminal.
|
|
2265
2273
|
// The configuration names a store inside the root relative to it, so the broker runs from the root.
|
|
2266
2274
|
const child = spawnBroker(bin, natsArgs, { cwd: cotalRoot(), stdio: "inherit", detached: process.platform !== "win32" });
|
|
2275
|
+
let listenerReady = false;
|
|
2267
2276
|
let activationFinished = !resumeAttempt;
|
|
2268
2277
|
await recordSpawnedListener(child, listenerStartedAt, boundListener);
|
|
2269
2278
|
child.on("error", (err) => {
|
|
@@ -2333,9 +2342,8 @@ async function runUp(args, inheritedLock, onAdopt, freshTeamBoot = false, restor
|
|
|
2333
2342
|
await stopDelivery(space).catch((e) => console.error(`! delivery teardown: ${e.message}`));
|
|
2334
2343
|
await stopManager(space).then(() => clearManagerArtifacts(space)).catch((e) => console.error(`! manager teardown: ${e.message}`));
|
|
2335
2344
|
await stopAuthService(space).catch((e) => console.error(`! auth teardown: ${e.message}`));
|
|
2336
|
-
//
|
|
2337
|
-
//
|
|
2338
|
-
// (a crash, an OOM kill, a signal from outside `up`) leaves the record and its store in place.
|
|
2345
|
+
// Only the shutdown that `stop()` drives (Ctrl-C, SIGTERM) can unrecord here.
|
|
2346
|
+
// External `down` owns its own registry cleanup.
|
|
2339
2347
|
if (stopping) {
|
|
2340
2348
|
// Only unrecord if the registry still points at THIS broker. A newer broker for the same space
|
|
2341
2349
|
// (a concurrent `up`, or a different-port re-up that recorded after us) may have replaced our
|
|
@@ -2353,6 +2361,12 @@ async function runUp(args, inheritedLock, onAdopt, freshTeamBoot = false, restor
|
|
|
2353
2361
|
if (activationFinished)
|
|
2354
2362
|
process.exit(stopSignal === "SIGTERM" ? 143 : 130);
|
|
2355
2363
|
}
|
|
2364
|
+
else if (code === 0) {
|
|
2365
|
+
// Before readiness, the startup check reports that the listener never answered.
|
|
2366
|
+
// After readiness, do not race external `down` with a claim about its registry cleanup.
|
|
2367
|
+
if (listenerReady && activationFinished)
|
|
2368
|
+
process.exit(0);
|
|
2369
|
+
}
|
|
2356
2370
|
else {
|
|
2357
2371
|
// The record is kept ON PURPOSE: it still names the store this broker opened, so a repair
|
|
2358
2372
|
// `up` reopens that SAME store instead of falling back to the root's default, and a
|
|
@@ -2378,14 +2392,14 @@ async function runUp(args, inheritedLock, onAdopt, freshTeamBoot = false, restor
|
|
|
2378
2392
|
stderrLine("✗ ", `nats-server exited unexpectedly (${detail})${outcome}`, c.red);
|
|
2379
2393
|
// A foreground broker under `Restart=on-failure` must exit non-zero on a crash so the unit
|
|
2380
2394
|
// restarts it; exiting 0 here (as an unconditional `code ?? 0` used to) looked like a clean
|
|
2381
|
-
// stop and left the unit sitting dead.
|
|
2382
|
-
//
|
|
2383
|
-
// table would read as a usage error (1) or a refusal (2).
|
|
2395
|
+
// stop and left the unit sitting dead. An abnormal exit is a failed run, 5, not the broker's
|
|
2396
|
+
// own code, which the exit table would read as a usage error (1) or a refusal (2).
|
|
2384
2397
|
if (activationFinished)
|
|
2385
|
-
process.exit(
|
|
2398
|
+
process.exit(exitCode("failed", "OPERATION_FAILED"));
|
|
2386
2399
|
}
|
|
2387
2400
|
});
|
|
2388
2401
|
await awaitSpawnedListener({ child, executable: natsServer, server, space, creds: setup?.creds, tls: transport.kind === "tls-required", log: "the terminal output above", boundListener });
|
|
2402
|
+
listenerReady = true;
|
|
2389
2403
|
{
|
|
2390
2404
|
// A DAEMON THAT DIES UNDER THIS RUNNING BROKER IS RESTARTED HERE (#2469). It exits on its own once
|
|
2391
2405
|
// it cannot reach the broker, and a starved host makes a running broker look unreachable, so it can
|
|
@@ -2443,6 +2457,7 @@ async function runUp(args, inheritedLock, onAdopt, freshTeamBoot = false, restor
|
|
|
2443
2457
|
...(values["recreate-membership-store"] ? { recreateMembershipStore: true } : {}),
|
|
2444
2458
|
host: values.host,
|
|
2445
2459
|
maxSessions,
|
|
2460
|
+
managerSeatCap,
|
|
2446
2461
|
maxFileStore,
|
|
2447
2462
|
publicExchange,
|
|
2448
2463
|
resumeAttempt,
|
|
@@ -3501,6 +3516,8 @@ async function upManifest(file, opts) {
|
|
|
3501
3516
|
// broker + launch all agree on the same values.
|
|
3502
3517
|
const { prepared: eff, hostSource, serverSource } = applyUpOverrides(prepared, opts);
|
|
3503
3518
|
const m = eff.manifest;
|
|
3519
|
+
if (m.broker?.logFile === undefined && (opts.logfileSizeLimit !== undefined || opts.logfileMaxNum !== undefined))
|
|
3520
|
+
throw new CommandFailure("refused", "USAGE_INVALID", "--logfile-size-limit and --logfile-max-num require --log-file or broker.logFile in the manifest", { remedy: "pass --log-file <path>, set broker.logFile in the manifest, or omit the rotation flags" });
|
|
3504
3521
|
const host = m.broker?.host ?? "127.0.0.1";
|
|
3505
3522
|
// Same bind-vs-probe reconciliation as the flag path: a manifest that sets `broker.host` without
|
|
3506
3523
|
// an explicit `broker.servers` would otherwise bind one address and be probed at another.
|
|
@@ -3537,7 +3554,7 @@ async function upManifest(file, opts) {
|
|
|
3537
3554
|
// against a manifest declaring agents asks for a boot that cannot deliver its own plan. Refused
|
|
3538
3555
|
// before the dry-run print and before anything boots.
|
|
3539
3556
|
if (opts.noManager && eff.agents.length)
|
|
3540
|
-
throw new
|
|
3557
|
+
throw new FlagValueRefusal(`--no-manager cannot launch this manifest: it declares ${eff.agents.length} agent(s), and a manifest's agents are booted by its manager (which --no-manager omits)`, "drop --no-manager, or use a broker-only manifest with no agents");
|
|
3541
3558
|
const effectiveNoManager = Boolean(opts.noManager);
|
|
3542
3559
|
// The open-mesh refusal must be RE-STATED here, not only against the CLI `--open` flag: on this
|
|
3543
3560
|
// path openness comes from the MANIFEST (`broker.auth: false`), which the flag-level guard cannot
|
|
@@ -4011,6 +4028,7 @@ async function serveReadyListener(l) {
|
|
|
4011
4028
|
// is never a side effect of anything but the operator binding the mesh somewhere reachable.
|
|
4012
4029
|
attachHost,
|
|
4013
4030
|
maxSessions,
|
|
4031
|
+
managerSeatCap: l.managerSeatCap,
|
|
4014
4032
|
noManager: l.noManager,
|
|
4015
4033
|
resumeAttempt: l.resumeAttempt,
|
|
4016
4034
|
resumeCommit: l.resumeCommit,
|
|
@@ -4139,6 +4157,7 @@ opts) {
|
|
|
4139
4157
|
...(opts.recreateMembershipStore ? { recreateMembershipStore: true } : {}),
|
|
4140
4158
|
host: opts.host,
|
|
4141
4159
|
maxSessions: opts.maxSessions,
|
|
4160
|
+
managerSeatCap: opts.managerSeatCap,
|
|
4142
4161
|
maxFileStore: opts.maxFileStore,
|
|
4143
4162
|
publicExchange: opts.publicExchange,
|
|
4144
4163
|
resumeAttempt: opts.resumeAttempt,
|
|
@@ -4479,7 +4498,7 @@ function recordOurMesh(m, provenance, quietBoot = false) {
|
|
|
4479
4498
|
}
|
|
4480
4499
|
const nativeHost = nativeMembers.length ? knownStackRecoveryHost() : undefined;
|
|
4481
4500
|
const recorded = { ...m, origin, ...(nativeHost !== undefined ? { nativeMembers, nativeHost } : {}) };
|
|
4482
|
-
recordMesh(provenance === "refresh" ? { ...prior, ...recorded, stoppedByDown: undefined } : recorded);
|
|
4501
|
+
recordMesh(provenance === "refresh" ? { ...prior, ...recorded, stoppedByDown: undefined, stoppedWithAgents: undefined } : recorded);
|
|
4483
4502
|
removePreparedSpace(m.space); // started: the registration is its record now
|
|
4484
4503
|
if (!usableCurrent) {
|
|
4485
4504
|
setAdoptedCurrent(m.space);
|
|
@@ -4721,6 +4740,13 @@ async function assertFreshTeamBindAvailable(server, host, space) {
|
|
|
4721
4740
|
}
|
|
4722
4741
|
});
|
|
4723
4742
|
}
|
|
4743
|
+
function registeredAddressHolder(server, space) {
|
|
4744
|
+
const key = brokerAddressKey(server);
|
|
4745
|
+
if (key === undefined)
|
|
4746
|
+
return undefined;
|
|
4747
|
+
const root = canonicalRoot(cotalRoot());
|
|
4748
|
+
return loadMeshes().find((m) => m.space !== space && canonicalRoot(m.root) !== root && brokerAddressKey(m.server) === key);
|
|
4749
|
+
}
|
|
4724
4750
|
/** Refuse an address that a space registered for another folder keeps while its broker is stopped,
|
|
4725
4751
|
* as an occupied one is refused. Starting there would leave two registrations naming one broker:
|
|
4726
4752
|
* whichever stack runs answers for both, and the other one's `down` and reads reach it. Every
|
|
@@ -4728,11 +4754,7 @@ async function assertFreshTeamBindAvailable(server, host, space) {
|
|
|
4728
4754
|
* `elsewhere` names the way to move the one being started. A space this start takes the name of is
|
|
4729
4755
|
* left to the name rules. */
|
|
4730
4756
|
function refuseRegisteredAddress(server, space, elsewhere) {
|
|
4731
|
-
const
|
|
4732
|
-
if (key === undefined)
|
|
4733
|
-
return;
|
|
4734
|
-
const root = canonicalRoot(cotalRoot());
|
|
4735
|
-
const held = loadMeshes().find((m) => m.space !== space && canonicalRoot(m.root) !== root && brokerAddressKey(m.server) === key);
|
|
4757
|
+
const held = registeredAddressHolder(server, space);
|
|
4736
4758
|
if (!held)
|
|
4737
4759
|
return;
|
|
4738
4760
|
throw new CommandFailure("refused", "CONFLICT", `${server} is the broker address of "${held.space}", registered for ${held.root} and stopped; nothing was started`, {
|
|
@@ -5031,7 +5053,14 @@ async function refuseRunningElsewhere(space, root) {
|
|
|
5031
5053
|
controller = readStackJournal(owner.root)?.journal.space === space;
|
|
5032
5054
|
}
|
|
5033
5055
|
catch { /* named with the legacy stop */ }
|
|
5034
|
-
|
|
5056
|
+
const rootExists = existsSync(owner.root);
|
|
5057
|
+
const moved = !controller && !retainedLegacyBroker(owner.root) && recordsElsewhereError(root)?.details.stackSpace === space;
|
|
5058
|
+
const remedy = moved
|
|
5059
|
+
? `${rootExists ? `move what is now at ${owner.root} aside, then ` : ""}move this folder back to ${owner.root} and run \`cotal down --yes\` there`
|
|
5060
|
+
: !rootExists
|
|
5061
|
+
? `restore the original project at ${owner.root}, then run \`cotal down --yes\` there`
|
|
5062
|
+
: `use it from here with --space ${space}, or stop it with \`cotal down${controller ? " --yes" : ""}\` in ${owner.root}`;
|
|
5063
|
+
throw new CommandFailure("refused", "CONFLICT", `space "${space}" runs at ${owner.server}, started in ${owner.root}, so up did not start it again`, { target: { space, root: owner.root, server: owner.server }, remedy });
|
|
5035
5064
|
}
|
|
5036
5065
|
/** Refuses a bare `up` in a folder holding the records of a space this machine registers for another
|
|
5037
5066
|
* folder, as a copy, a moved folder and one whose name a later `up` took over keep them. The retained
|