@cotal-ai/cli 0.172.1 → 0.172.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (186) hide show
  1. package/dist/command.d.ts.map +1 -1
  2. package/dist/command.js +19 -13
  3. package/dist/command.js.map +1 -1
  4. package/dist/commands/agents.d.ts.map +1 -1
  5. package/dist/commands/agents.js +8 -6
  6. package/dist/commands/agents.js.map +1 -1
  7. package/dist/commands/channel-members.d.ts.map +1 -1
  8. package/dist/commands/channel-members.js +2 -1
  9. package/dist/commands/channel-members.js.map +1 -1
  10. package/dist/commands/channels.d.ts.map +1 -1
  11. package/dist/commands/channels.js +11 -7
  12. package/dist/commands/channels.js.map +1 -1
  13. package/dist/commands/clean.js +1 -1
  14. package/dist/commands/clean.js.map +1 -1
  15. package/dist/commands/down.d.ts.map +1 -1
  16. package/dist/commands/down.js +27 -7
  17. package/dist/commands/down.js.map +1 -1
  18. package/dist/commands/endpoint-authoring.d.ts.map +1 -1
  19. package/dist/commands/endpoint-authoring.js +16 -4
  20. package/dist/commands/endpoint-authoring.js.map +1 -1
  21. package/dist/commands/history-clear.d.ts.map +1 -1
  22. package/dist/commands/history-clear.js +10 -3
  23. package/dist/commands/history-clear.js.map +1 -1
  24. package/dist/commands/history-limit.js +2 -2
  25. package/dist/commands/history-limit.js.map +1 -1
  26. package/dist/commands/history.d.ts.map +1 -1
  27. package/dist/commands/history.js +49 -19
  28. package/dist/commands/history.js.map +1 -1
  29. package/dist/commands/join.d.ts.map +1 -1
  30. package/dist/commands/join.js +30 -7
  31. package/dist/commands/join.js.map +1 -1
  32. package/dist/commands/manager-service.d.ts.map +1 -1
  33. package/dist/commands/manager-service.js +5 -1
  34. package/dist/commands/manager-service.js.map +1 -1
  35. package/dist/commands/meshes-add.d.ts +4 -0
  36. package/dist/commands/meshes-add.d.ts.map +1 -1
  37. package/dist/commands/meshes-add.js +35 -1
  38. package/dist/commands/meshes-add.js.map +1 -1
  39. package/dist/commands/meshes-wizard.d.ts.map +1 -1
  40. package/dist/commands/meshes-wizard.js +5 -5
  41. package/dist/commands/meshes-wizard.js.map +1 -1
  42. package/dist/commands/meshes.d.ts.map +1 -1
  43. package/dist/commands/meshes.js +4 -3
  44. package/dist/commands/meshes.js.map +1 -1
  45. package/dist/commands/persona-remote.js +2 -2
  46. package/dist/commands/persona-remote.js.map +1 -1
  47. package/dist/commands/persona.d.ts.map +1 -1
  48. package/dist/commands/persona.js +13 -5
  49. package/dist/commands/persona.js.map +1 -1
  50. package/dist/commands/personas.d.ts.map +1 -1
  51. package/dist/commands/personas.js +4 -1
  52. package/dist/commands/personas.js.map +1 -1
  53. package/dist/commands/reset-space-apply.js +2 -2
  54. package/dist/commands/reset-space-apply.js.map +1 -1
  55. package/dist/commands/reset-store-apply.d.ts +2 -2
  56. package/dist/commands/reset-store-apply.d.ts.map +1 -1
  57. package/dist/commands/reset-store-apply.js +10 -7
  58. package/dist/commands/reset-store-apply.js.map +1 -1
  59. package/dist/commands/reset.js +2 -2
  60. package/dist/commands/reset.js.map +1 -1
  61. package/dist/commands/send.d.ts.map +1 -1
  62. package/dist/commands/send.js +21 -9
  63. package/dist/commands/send.js.map +1 -1
  64. package/dist/commands/service-actions.d.ts.map +1 -1
  65. package/dist/commands/service-actions.js +15 -4
  66. package/dist/commands/service-actions.js.map +1 -1
  67. package/dist/commands/service-registry.d.ts.map +1 -1
  68. package/dist/commands/service-registry.js +16 -5
  69. package/dist/commands/service-registry.js.map +1 -1
  70. package/dist/commands/space-delete.d.ts.map +1 -1
  71. package/dist/commands/space-delete.js +46 -31
  72. package/dist/commands/space-delete.js.map +1 -1
  73. package/dist/commands/space-registration.d.ts +4 -3
  74. package/dist/commands/space-registration.d.ts.map +1 -1
  75. package/dist/commands/space-registration.js +57 -37
  76. package/dist/commands/space-registration.js.map +1 -1
  77. package/dist/commands/space.d.ts.map +1 -1
  78. package/dist/commands/space.js +3 -1
  79. package/dist/commands/space.js.map +1 -1
  80. package/dist/commands/spawn-flags.d.ts +205 -0
  81. package/dist/commands/spawn-flags.d.ts.map +1 -0
  82. package/dist/commands/spawn-flags.js +34 -0
  83. package/dist/commands/spawn-flags.js.map +1 -0
  84. package/dist/commands/spawn-foreground.d.ts +74 -0
  85. package/dist/commands/spawn-foreground.d.ts.map +1 -0
  86. package/dist/commands/spawn-foreground.js +355 -0
  87. package/dist/commands/spawn-foreground.js.map +1 -0
  88. package/dist/commands/spawn-managed-launch.d.ts +43 -0
  89. package/dist/commands/spawn-managed-launch.d.ts.map +1 -0
  90. package/dist/commands/spawn-managed-launch.js +631 -0
  91. package/dist/commands/spawn-managed-launch.js.map +1 -0
  92. package/dist/commands/spawn-preview.d.ts.map +1 -1
  93. package/dist/commands/spawn-preview.js +7 -4
  94. package/dist/commands/spawn-preview.js.map +1 -1
  95. package/dist/commands/spawn.d.ts +6 -220
  96. package/dist/commands/spawn.d.ts.map +1 -1
  97. package/dist/commands/spawn.js +20 -1008
  98. package/dist/commands/spawn.js.map +1 -1
  99. package/dist/commands/stack-down.d.ts.map +1 -1
  100. package/dist/commands/stack-down.js +7 -4
  101. package/dist/commands/stack-down.js.map +1 -1
  102. package/dist/commands/stack-up.d.ts +2 -0
  103. package/dist/commands/stack-up.d.ts.map +1 -1
  104. package/dist/commands/stack-up.js +9 -5
  105. package/dist/commands/stack-up.js.map +1 -1
  106. package/dist/commands/status-stop-impact.d.ts +3 -0
  107. package/dist/commands/status-stop-impact.d.ts.map +1 -0
  108. package/dist/commands/status-stop-impact.js +34 -0
  109. package/dist/commands/status-stop-impact.js.map +1 -0
  110. package/dist/commands/status.d.ts.map +1 -1
  111. package/dist/commands/status.js +20 -41
  112. package/dist/commands/status.js.map +1 -1
  113. package/dist/commands/team-boot-controller.d.ts.map +1 -1
  114. package/dist/commands/team-boot-controller.js +21 -4
  115. package/dist/commands/team-boot-controller.js.map +1 -1
  116. package/dist/commands/team.d.ts.map +1 -1
  117. package/dist/commands/team.js +25 -23
  118. package/dist/commands/team.js.map +1 -1
  119. package/dist/commands/telemetry.d.ts +1 -1
  120. package/dist/commands/telemetry.d.ts.map +1 -1
  121. package/dist/commands/telemetry.js +17 -7
  122. package/dist/commands/telemetry.js.map +1 -1
  123. package/dist/commands/up-target.d.ts +7 -0
  124. package/dist/commands/up-target.d.ts.map +1 -0
  125. package/dist/commands/up-target.js +42 -0
  126. package/dist/commands/up-target.js.map +1 -0
  127. package/dist/commands/up.d.ts +3 -10
  128. package/dist/commands/up.d.ts.map +1 -1
  129. package/dist/commands/up.js +44 -126
  130. package/dist/commands/up.js.map +1 -1
  131. package/dist/commands/update-caches.d.ts +4 -0
  132. package/dist/commands/update-caches.d.ts.map +1 -0
  133. package/dist/commands/update-caches.js +82 -0
  134. package/dist/commands/update-caches.js.map +1 -0
  135. package/dist/commands/update.d.ts.map +1 -1
  136. package/dist/commands/update.js +29 -115
  137. package/dist/commands/update.js.map +1 -1
  138. package/dist/help.d.ts.map +1 -1
  139. package/dist/help.js +2 -1
  140. package/dist/help.js.map +1 -1
  141. package/dist/index.d.ts.map +1 -1
  142. package/dist/index.js +1 -0
  143. package/dist/index.js.map +1 -1
  144. package/dist/lib/broker-log.d.ts +8 -0
  145. package/dist/lib/broker-log.d.ts.map +1 -0
  146. package/dist/lib/broker-log.js +27 -0
  147. package/dist/lib/broker-log.js.map +1 -0
  148. package/dist/lib/credential-authority.d.ts.map +1 -1
  149. package/dist/lib/credential-authority.js +22 -5
  150. package/dist/lib/credential-authority.js.map +1 -1
  151. package/dist/lib/restore.d.ts +2 -1
  152. package/dist/lib/restore.d.ts.map +1 -1
  153. package/dist/lib/restore.js +4 -3
  154. package/dist/lib/restore.js.map +1 -1
  155. package/dist/lib/service-preset-target.d.ts.map +1 -1
  156. package/dist/lib/service-preset-target.js +6 -2
  157. package/dist/lib/service-preset-target.js.map +1 -1
  158. package/dist/lib/service-presets.d.ts +2 -0
  159. package/dist/lib/service-presets.d.ts.map +1 -1
  160. package/dist/lib/service-presets.js +19 -2
  161. package/dist/lib/service-presets.js.map +1 -1
  162. package/dist/lib/spawn-defaults.d.ts +5 -0
  163. package/dist/lib/spawn-defaults.d.ts.map +1 -1
  164. package/dist/lib/spawn-defaults.js +5 -0
  165. package/dist/lib/spawn-defaults.js.map +1 -1
  166. package/dist/lib/stack-journal.d.ts +4 -4
  167. package/dist/lib/stack-journal.d.ts.map +1 -1
  168. package/dist/lib/stack-journal.js +6 -5
  169. package/dist/lib/stack-journal.js.map +1 -1
  170. package/dist/lib/up-broker-address.d.ts +7 -0
  171. package/dist/lib/up-broker-address.d.ts.map +1 -0
  172. package/dist/lib/up-broker-address.js +76 -0
  173. package/dist/lib/up-broker-address.js.map +1 -0
  174. package/dist/lib/up-report.d.ts +2 -0
  175. package/dist/lib/up-report.d.ts.map +1 -1
  176. package/dist/lib/up-report.js +8 -1
  177. package/dist/lib/up-report.js.map +1 -1
  178. package/dist/lib/update-connector-config.d.ts +6 -0
  179. package/dist/lib/update-connector-config.d.ts.map +1 -0
  180. package/dist/lib/update-connector-config.js +44 -0
  181. package/dist/lib/update-connector-config.js.map +1 -0
  182. package/dist/seed/reconcile.d.ts +1 -1
  183. package/dist/seed/reconcile.d.ts.map +1 -1
  184. package/dist/seed/reconcile.js +28 -11
  185. package/dist/seed/reconcile.js.map +1 -1
  186. package/package.json +4 -4
@@ -0,0 +1,42 @@
1
+ import { lstatSync, realpathSync, statSync } from "node:fs";
2
+ import { homedir } from "node:os";
3
+ import { join, resolve } from "node:path";
4
+ import { authDir, canonicalRoot, CommandFailure, findMesh, findPreparedSpace, homeCotalDir, listSpaceAccounts } from "@cotal-ai/workspace";
5
+ import { retainedOpenSpace } from "../lib/legacy-start.js";
6
+ import { cotalRoot } from "../lib/paths.js";
7
+ import { readStackJournal } from "../lib/stack-journal.js";
8
+ import { checkSpaceName } from "./meshes-add.js";
9
+ /** An explicit root is an existing local workspace, not a hint to find another ancestor or
10
+ * create trust in an arbitrary directory. Validation runs before the dispatcher seeds extensions. */
11
+ export function preparedUpRoot(value) {
12
+ if (!value)
13
+ throw new CommandFailure("refused", "USAGE_INVALID", "--root needs an existing prepared project directory; an empty value is not the current folder");
14
+ let root;
15
+ try {
16
+ root = realpathSync(resolve(value));
17
+ if (!statSync(root).isDirectory())
18
+ throw new Error("not a directory");
19
+ const cotal = lstatSync(join(root, ".cotal"));
20
+ if (!cotal.isDirectory() || cotal.isSymbolicLink())
21
+ throw new Error("not a private project directory");
22
+ }
23
+ catch {
24
+ throw new CommandFailure("refused", "TARGET_UNAVAILABLE", "--root must name an existing prepared local project with its own .cotal directory; no ancestor or other space was selected", { target: { root: resolve(value) }, remedy: "prepare it with `cotal space create <space> --root <dir>`, then retry with that root" });
25
+ }
26
+ if (canonicalRoot(root) === canonicalRoot(homedir()) || canonicalRoot(join(root, ".cotal")) === canonicalRoot(homeCotalDir()))
27
+ throw new CommandFailure("refused", "CONFLICT", "--root names the machine's home store, not a prepared project; no stack was started there", { target: { root }, remedy: "prepare the space in a project folder with `cotal space create <space> --root <dir>`" });
28
+ return root;
29
+ }
30
+ /** Only new spaces need the creation grammar. A stopped legacy stack may have lost its
31
+ * registration while its own journal, broker configuration or account still names it. */
32
+ export function checkNewUpSpace(space, root) {
33
+ if (typeof space !== "string")
34
+ return;
35
+ const named = checkSpaceName(space);
36
+ const resolvedRoot = root ?? cotalRoot();
37
+ if (!named.ok && !findMesh(space) && !findPreparedSpace(space) &&
38
+ readStackJournal(resolvedRoot)?.journal.space !== space && retainedOpenSpace(resolvedRoot) !== space &&
39
+ !listSpaceAccounts(authDir(resolvedRoot)).includes(space))
40
+ throw new CommandFailure("refused", "USAGE_INVALID", `${named.message.replace(/^✗ /, "")}; nothing was started or written`, { remedy: named.remedy });
41
+ }
42
+ //# sourceMappingURL=up-target.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"up-target.js","sourceRoot":"","sources":["../../src/commands/up-target.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SA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s, type FlagSpec, type CompletionResult } from "@cotal-ai/core";
2
3
  import { type SeatCap, type MeshEntry, type MaintenanceLock } from "@cotal-ai/workspace";
3
4
  import { type NatsServer } from "../lib/nats-bin.js";
@@ -40,9 +41,7 @@ export declare function upComplete(argv: string[]): CompletionResult;
40
41
  /** Launch intent is checked by the kernel before seed or effect preparation. A recovery
41
42
  * re-entry supplies its recorded mode explicitly rather than inheriting the new public default. */
42
43
  export declare function validateUpArguments(args: ParsedArgs): void;
43
- /** An explicit root is an existing local workspace, not a hint to find another ancestor or
44
- * create trust in an arbitrary directory. Validation runs before the dispatcher seeds extensions. */
45
- export declare function preparedUpRoot(value: string): string;
44
+ export { preparedUpRoot } from "./up-target.js";
46
45
  /** Foreground controller stack: the terminal holds the stack's lifetime until SIGINT or SIGTERM,
47
46
  * which runs the same guarded whole-stack stop as bare `down`. A hangup leaves the stack running and
48
47
  * exits 129, naming `cotal down`. `start`, when given, is the startup this terminal already holds: a
@@ -228,12 +227,7 @@ export declare function prepareBrokerStart(opts: DetachOpts): Promise<{
228
227
  source: "path" | "bundled";
229
228
  version: string;
230
229
  }>;
231
- /**
232
- * Open the detached broker's log with {@link openPrivateAppend}: created `0600` whatever the umask,
233
- * never through a symlink, and an earlier log this user owns set to `0600`. A symlink, a log another
234
- * user owns or a name that is not a regular file is refused and left unchanged.
235
- */
236
- export declare function openBrokerLog(path: string): number;
230
+ export { openBrokerLog };
237
231
  /**
238
232
  * Start a background nats-server (JetStream), wait until it's reachable, pre-create the
239
233
  * space's streams, and leave it running detached (pid in `.cotal/nats.pid`). Used by
@@ -299,5 +293,4 @@ type Provenance = "started" | "refresh";
299
293
  * asserted directly by the registry smoke, since reaching each branch through a full `up` would
300
294
  * need a live broker per case. */
301
295
  export declare const recordOurMeshForTest: (m: MeshEntry, provenance: Provenance) => void;
302
- export {};
303
296
  //# sourceMappingURL=up.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"up.d.ts","sourceRoot":"","sources":["../../src/commands/up.ts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AI,GAAG,SAAS,EAAE,YAAY,UAAU,KAAG,IAAoC,CAAC"}
@@ -1,13 +1,14 @@
1
1
  import { noManagerCredentialWarning } from "../lib/daemon-credential-warning.js";
2
2
  import { drainAndClose } from "@cotal-ai/core";
3
3
  import {} from "node:child_process";
4
+ import { openBrokerLog, prepareForegroundBrokerLog } from "../lib/broker-log.js";
4
5
  import { spawnBroker } from "../lib/broker-spawn.js";
5
6
  import { randomUUID } from "node:crypto";
6
7
  import { createConnection, createServer, isIP } from "node:net";
7
8
  import { homedir, hostname } from "node:os";
8
9
  import { accessSync, constants, mkdirSync, readFileSync, existsSync, statSync, closeSync, lstatSync, realpathSync, readdirSync, rmdirSync, } from "node:fs";
9
10
  import { basename, dirname, isAbsolute, join, resolve } from "node:path";
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, recreateMembershipStore, 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
+ 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, recreateMembershipStore, membershipStoreDefinition, LEGACY_MEMBERSHIP_MAX_BYTES, MEMBERSHIP_MAX_VALUE_SIZE, ttlBuckets, standaloneConnectOpts, requireBrokerFloor, parseServerVersion, presenceBucket, spaceDeletionStreams, isJetStreamMissing, seedChannelRegistry, ensureDefaultDeliveryClass, UndecodableRegistryEntry, LEASE_TTL_MS, EpEnvelopeError, mkSecretDir, writeSecretFile, } from "@cotal-ai/core";
11
12
  import { JetStreamApiCodes, jetstreamManager, StorageType } from "@nats-io/jetstream";
12
13
  import { Kvm } from "@nats-io/kv";
13
14
  import { assertManagerName, processStopped, 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";
@@ -19,7 +20,7 @@ import { admitAndRestoreSeatCheckpoints } from "../lib/seat-resume.js";
19
20
  import { NATS_DEFAULT_MAX_PAYLOAD, natsServerLabel, resolveNatsServer, unreadVersion } from "../lib/nats-bin.js";
20
21
  import { cotalPath, cotalRoot, homeHoldsStack, linkedCotalRefusal } from "../lib/paths.js";
21
22
  import { channelsReads, readChannelsFile, readDefaultChannelsFile } from "../lib/channel-seed.js";
22
- import { detachedNext, renderDetachedSummary } from "../lib/up-report.js";
23
+ import { controllerManifestRemedy, detachedNext, renderDetachedSummary } from "../lib/up-report.js";
23
24
  import { seedDefaultPersona } from "../lib/default-persona.js";
24
25
  import { seedBeforeLaunch, seedMoveNote } from "../seed/launch.js";
25
26
  import { seedDir } from "../seed/paths.js";
@@ -42,6 +43,7 @@ import { failManifest, refuseManifestSpaceMismatch } from "./topology.js";
42
43
  import { liveMeshProcesses } from "./clean.js";
43
44
  import { checkSpaceFlagValue, checkSpaceName } from "./meshes-add.js";
44
45
  import { checkLocalSpace } from "./space-registration.js";
46
+ import { checkNewUpSpace, preparedUpRoot } from "./up-target.js";
45
47
  import { cleanedManifestStart, interruptedStartBroker, namedOpenConfig, retainedOpenSpace } from "../lib/legacy-start.js";
46
48
  import { bindReaches, canonicalServer, controllerStackApplies, recheckExistingStore, requestedStackMode, requestsTls, stackUp, stackUpForegroundNotice, stackUpInterrupted, keptOnUp, selectedOnUp, unparsableDaemonCredsNotice, } from "./stack-up.js";
47
49
  import { handOverStartupNotice, noticeOnInterrupt, releaseStartupNotice } from "../lib/interrupt-notice.js";
@@ -67,6 +69,7 @@ import { bindPreparedRestoreListener, isManagerCommitResult, isManagerFinalizeRe
67
69
  import { attemptProcessesGone } from "../lib/isolated-broker.js";
68
70
  import { assertEndpointUnreachable } from "../lib/endpoint-cut.js";
69
71
  import { addressHolder, brokerListenAddress, listenerBindError } from "../lib/broker-service.js";
72
+ import { freePort, freshStackServer, retryStackAddress, serverWithFreePort } from "../lib/up-broker-address.js";
70
73
  import { askManager } from "@cotal-ai/workspace/control";
71
74
  import { cliControl } from "../lib/control.js";
72
75
  const pendingRestores = new Map();
@@ -92,8 +95,8 @@ export const upFlags = [
92
95
  { name: "store-dir", type: "string", value: "<dir>", description: "JetStream store directory" },
93
96
  { 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
97
  { 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 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" },
98
+ { name: "logfile-size-limit", type: "string", value: "<bytes>", description: "nats-server log rotation threshold in bytes; requires --log-file, a saved controller log path, or broker.logFile in a manifest" },
99
+ { name: "logfile-max-num", type: "string", value: "<count>", description: "maximum total broker log files retained; requires --log-file, a saved controller log path, or broker.logFile in a manifest" },
97
100
  { 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
101
  { 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
102
  { 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`" },
@@ -228,7 +231,9 @@ export function validateUpArguments(args) {
228
231
  throw new CommandFailure("refused", "USAGE_INVALID", "--log-file must be a non-empty file path without control characters");
229
232
  const logfileSizeLimit = parsePositiveIntegerFlag("--logfile-size-limit", args.values["logfile-size-limit"]);
230
233
  const logfileMaxNum = parsePositiveIntegerFlag("--logfile-max-num", args.values["logfile-max-num"]);
231
- if (!args.values.file && logFile === undefined && (logfileSizeLimit !== undefined || logfileMaxNum !== undefined))
234
+ // A controller restart can use its saved path. A restore still needs an explicit path.
235
+ if (!args.values.file && logFile === undefined && (logfileSizeLimit !== undefined || logfileMaxNum !== undefined)
236
+ && (args.values.restore !== undefined || readStackJournal(tlsRoot)?.journal.broker?.logFile === undefined))
232
237
  throw new CommandFailure("refused", "USAGE_INVALID", "--logfile-size-limit and --logfile-max-num require --log-file");
233
238
  // The timeout belongs to the auth callout, which only a user-auth space has. A manifest or a
234
239
  // restore starts the broker its own record describes, so neither takes it.
@@ -514,27 +519,7 @@ function machineHomeRoot() {
514
519
  const root = cotalRoot();
515
520
  return canonicalRoot(root) === canonicalRoot(homedir()) || canonicalRoot(join(root, ".cotal")) === canonicalRoot(homeCotalDir()) ? root : undefined;
516
521
  }
517
- /** An explicit root is an existing local workspace, not a hint to find another ancestor or
518
- * create trust in an arbitrary directory. Validation runs before the dispatcher seeds extensions. */
519
- export function preparedUpRoot(value) {
520
- if (!value)
521
- throw new CommandFailure("refused", "USAGE_INVALID", "--root needs an existing prepared project directory; an empty value is not the current folder");
522
- let root;
523
- try {
524
- root = realpathSync(resolve(value));
525
- if (!statSync(root).isDirectory())
526
- throw new Error("not a directory");
527
- const cotal = lstatSync(join(root, ".cotal"));
528
- if (!cotal.isDirectory() || cotal.isSymbolicLink())
529
- throw new Error("not a private project directory");
530
- }
531
- catch {
532
- throw new CommandFailure("refused", "TARGET_UNAVAILABLE", "--root must name an existing prepared local project with its own .cotal directory; no ancestor or other space was selected", { target: { root: resolve(value) }, remedy: "prepare it with `cotal space create <space> --root <dir>`, then retry with that root" });
533
- }
534
- if (canonicalRoot(root) === canonicalRoot(homedir()) || canonicalRoot(join(root, ".cotal")) === canonicalRoot(homeCotalDir()))
535
- throw new CommandFailure("refused", "CONFLICT", "--root names the machine's home store, not a prepared project; no stack was started there", { target: { root }, remedy: "prepare the space in a project folder with `cotal space create <space> --root <dir>`" });
536
- return root;
537
- }
522
+ export { preparedUpRoot } from "./up-target.js";
538
523
  /** The fresh team entry refuses retained custody before `up -f` can write a launch spec,
539
524
  * regenerate trust or stop a leftover manager. Only a recorded local root is eligible. */
540
525
  function assertFreshTeamBootOwnership(root, space, mode, own) {
@@ -780,6 +765,9 @@ export async function up(args, inheritedLock, freshTeamBoot = false, restoreSink
780
765
  let adopted = false;
781
766
  try {
782
767
  validateUpArguments(args);
768
+ const root = args.values.root === undefined ? undefined : preparedUpRoot(String(args.values.root));
769
+ const fresh = args.values.root === undefined ? freshFolderRoot(args.values) : undefined;
770
+ checkNewUpSpace(args.values.space, root ?? fresh);
783
771
  // The broker reads an explicit channels file only once it is being prepared, so a file it would
784
772
  // refuse is named here, before the stack journal or anything else is written.
785
773
  if (typeof args.values.channels === "string")
@@ -789,13 +777,11 @@ export async function up(args, inheritedLock, freshTeamBoot = false, restoreSink
789
777
  args = { ...args, values: { ...args.values, space: folderNamed, __folderNamed: true } };
790
778
  // A fresh folder under the machine home gets its own `.cotal` before anything resolves the root, so
791
779
  // every later step uses this folder. A run that stops before writing there removes it again.
792
- const fresh = args.values.root === undefined ? freshFolderRoot(args.values) : undefined;
793
780
  if (fresh) {
794
781
  mkdirSync(join(fresh, ".cotal"), { mode: 0o700 });
795
782
  for (const line of hang("", `made ${join(fresh, ".cotal")} for this folder's records; the machine's home .cotal was not used`, terminalWidth(process.stderr), c.dim))
796
783
  console.error(line);
797
784
  }
798
- const root = args.values.root === undefined ? undefined : preparedUpRoot(String(args.values.root));
799
785
  const previousCwd = process.cwd();
800
786
  // Path flags still mean paths relative to the invoking directory, not the selected root.
801
787
  // The recursive restore/resume re-entries inherit absolute paths and the same absolute root.
@@ -823,7 +809,7 @@ export async function up(args, inheritedLock, freshTeamBoot = false, restoreSink
823
809
  }
824
810
  }
825
811
  try {
826
- return await runUp(invocation, inheritedLock, () => { adopted = true; }, freshTeamBoot, restoreSink);
812
+ return await runUp(invocation, previousCwd, inheritedLock, () => { adopted = true; }, freshTeamBoot, restoreSink);
827
813
  }
828
814
  catch (error) {
829
815
  if (fresh)
@@ -856,7 +842,7 @@ const NO_MANAGER_DURING_RECOVERY = "--no-manager is refused while this root has
856
842
  function retainedStartupPresentationRefusal(root) {
857
843
  return new CommandFailure("refused", "UNSUPPORTED", "this startup uses the retained native launcher, which has no structured or plain receipt; nothing was started", { target: { root }, remedy: "use a fresh prepared root with static auth, --open, or plain-loopback --user-auth for the controller-owned stack, or omit --json/--plain" });
858
844
  }
859
- async function runUp(args, inheritedLock, onAdopt, freshTeamBoot = false, restoreSink) {
845
+ async function runUp(args, invokedFrom, inheritedLock, onAdopt, freshTeamBoot = false, restoreSink) {
860
846
  const values = args.values;
861
847
  if (freshTeamBoot && (!values.file || values.restore || values.__restoreAttempt || values.__ordinaryResumeAttempt || values["rotate-sys"] || values["no-manager"]))
862
848
  throw new CommandFailure("refused", "USAGE_INVALID", "fresh team boot accepts one manifest and its selected lifetime, not a restore, rotation or manager-free override");
@@ -899,9 +885,9 @@ async function runUp(args, inheritedLock, onAdopt, freshTeamBoot = false, restor
899
885
  "accept-missing-source": undefined,
900
886
  __restoreAttempt: attemptId,
901
887
  space: values.space ?? launch.space,
902
- server: launch.server,
903
- host: launch.host,
888
+ server: launch.server, host: launch.host,
904
889
  runtime: launch.runtime,
890
+ "max-file-store": launch.maxFileStore === undefined ? undefined : String(launch.maxFileStore),
905
891
  open: launch.mode === "open",
906
892
  "user-auth": launch.mode === "user",
907
893
  } };
@@ -1370,19 +1356,17 @@ async function runUp(args, inheritedLock, onAdopt, freshTeamBoot = false, restor
1370
1356
  const logFile = values["log-file"] === undefined ? undefined : resolve(values["log-file"]);
1371
1357
  const logfileSizeLimit = parsePositiveIntegerFlag("--logfile-size-limit", values["logfile-size-limit"]);
1372
1358
  const logfileMaxNum = parsePositiveIntegerFlag("--logfile-max-num", values["logfile-max-num"]);
1373
- if (!values.file && logFile === undefined && (logfileSizeLimit !== undefined || logfileMaxNum !== undefined))
1374
- throw new CommandFailure("refused", "USAGE_INVALID", "--logfile-size-limit and --logfile-max-num require --log-file");
1375
1359
  const authTimeout = parseAuthTimeout(values["auth-timeout"]);
1376
1360
  const maxPayload = parseMaxPayload(values["max-payload"]);
1377
1361
  const accountResolver = parseAccountResolver(values["account-resolver"]);
1378
1362
  // The manifest path renders its broker from the manifest, which has no store fields, so the flag
1379
1363
  // would be accepted and never rendered. Refuse it rather than drop it.
1380
1364
  if (maxFileStore !== undefined && values.file)
1381
- throw new Error("--max-file-store cannot be combined with --file/-f - a manifest launch does not render a store cap; drop --max-file-store, or start the mesh without -f");
1365
+ throw new FlagValueRefusal("--max-file-store cannot be combined with --file/-f: a manifest launch does not render a store cap, so nothing was started", "drop --max-file-store, or start the mesh without -f");
1382
1366
  // An open mesh has no operator, no system account, and no $SYS creds, so there is nothing to
1383
1367
  // rotate; the request is a misunderstanding to name, never a silent no-op that reports success.
1384
1368
  if (values["rotate-sys"] && values.open) {
1385
- throw new Error("--rotate-sys is for auth meshes: an open mesh (--open) has no system account or $SYS credentials to rotate");
1369
+ throw new FlagValueRefusal("--rotate-sys is for auth meshes: an open mesh (--open) has no system account or $SYS credentials to rotate, so nothing was started", "drop --rotate-sys, or drop --open to rotate an auth mesh's system account");
1386
1370
  }
1387
1371
  // THE EFFECTIVE PROJECT ROOT IS PINNED BEFORE THE TRANSPORT IS DECIDED.
1388
1372
  //
@@ -1527,7 +1511,9 @@ async function runUp(args, inheritedLock, onAdopt, freshTeamBoot = false, restor
1527
1511
  const stackServer = values.server ?? readStackJournal(meshRoot)?.journal.server ?? localMeshesForRoot(meshRoot).find((m) => m.space === stackSpace)?.server ?? await unrecordedStackServer(meshRoot, stackSpace, values.host);
1528
1512
  if (values.foreground && presentation !== "json")
1529
1513
  stackUpForegroundNotice(presentation, stackSpace, takeover);
1530
- 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);
1514
+ 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,
1515
+ retryAtAnotherAddress: (host) => retryStackAddress(args.raw, invokedFrom, stackServer, host),
1516
+ }, native);
1531
1517
  }
1532
1518
  finally {
1533
1519
  releaseMaintenanceLock(stackLock);
@@ -1581,7 +1567,7 @@ async function runUp(args, inheritedLock, onAdopt, freshTeamBoot = false, restor
1581
1567
  if (controller)
1582
1568
  throw new CommandFailure("refused", "CONFLICT", `this root holds the controller stack of space ${controller.journal.space}, and up -f does not start a manifest beside it; nothing was started`, {
1583
1569
  target: { root: meshRoot, space: controller.journal.space },
1584
- remedy: `add the manifest's channels and agents to the running stack with \`cotal team deploy ${values.file}\`, or stop it with \`cotal down --yes\` and start the manifest through the controller with \`cotal team boot ${values.file}\``,
1570
+ remedy: controllerManifestRemedy(meshRoot, controller.journal.space, resolve(values.file)),
1585
1571
  });
1586
1572
  if (values["dry-run"]) {
1587
1573
  await upManifest(values.file, {
@@ -2281,6 +2267,7 @@ async function runUp(args, inheritedLock, onAdopt, freshTeamBoot = false, restor
2281
2267
  }
2282
2268
  if (values["store-dir"])
2283
2269
  warnForeignStoreEntries(storeDir);
2270
+ prepareForegroundBrokerLog(logFile);
2284
2271
  // Owner-private regardless of umask: a recursive create also makes a missing `.cotal`, which every
2285
2272
  // later protection check walks as an ancestor.
2286
2273
  mkdirSync(storeDir, { recursive: true, mode: 0o700 });
@@ -2289,7 +2276,7 @@ async function runUp(args, inheritedLock, onAdopt, freshTeamBoot = false, restor
2289
2276
  // Decided above the branch; the dial host is only settled here (a port collision may have moved
2290
2277
  // the server, and the hostname is what the certificate has to match).
2291
2278
  assertServesDialHost(transport, new URL(server).hostname);
2292
- const brokerSetup = useAuth ? await authSetup(storeDir, server, space, host, wantUser ? { idpUrl: values.idp } : undefined, transport, values["rotate-sys"], maxFileStore, false, { authTimeout, maxPayload, accountResolver, manager: values["no-manager"] !== true }) : undefined;
2279
+ const brokerSetup = useAuth ? await authSetup(storeDir, server, space, host, wantUser ? { idpUrl: values.idp } : undefined, transport, values["rotate-sys"], maxFileStore, false, { authTimeout, maxPayload, accountResolver, manager: values["no-manager"] !== true, logFile, logfileSizeLimit, logfileMaxNum }) : undefined;
2293
2280
  const brokerMaxPayload = brokerSetup?.maxPayload ?? maxPayload ?? readBrokerPolicy(cotalRoot())?.maxPayload;
2294
2281
  const port = Number(new URL(server).port) || 4222;
2295
2282
  // Both modes go through a RENDERER, never bare CLI flags. Open mode used to start from
@@ -2299,13 +2286,14 @@ async function runUp(args, inheritedLock, onAdopt, freshTeamBoot = false, restor
2299
2286
  const renderingBinary = brokerSetup?.brokerBinary ?? await resolveNatsServer();
2300
2287
  if (!renderingBinary.version)
2301
2288
  throw unreadVersion(renderingBinary);
2302
- const confPath = brokerSetup ? brokerSetup.confPath : writeOpenBrokerConf(storeDir, space, { brokerVersion: renderingBinary.version, port, host, transport, maxFileStore, maxPayload: brokerMaxPayload });
2289
+ const confPath = brokerSetup ? brokerSetup.confPath : writeOpenBrokerConf(storeDir, space, { brokerVersion: renderingBinary.version, port, host, transport, maxFileStore, maxPayload: brokerMaxPayload, logFile, logfileSizeLimit, logfileMaxNum });
2303
2290
  const natsArgs = [
2304
2291
  "-c", confPath,
2305
2292
  ...(boundListener ? ["--name", boundListener.serverName] : []),
2306
2293
  ];
2307
2294
  const natsServer = renderingBinary;
2308
2295
  const bin = natsServer.path;
2296
+ const brokerOutput = logFile ?? "the terminal output above";
2309
2297
  await seedBeforeLaunch();
2310
2298
  const setup = brokerSetup && { ...brokerSetup, creds: await brokerSetup.mintProvisioner() };
2311
2299
  const starting = `Starting ${natsServerLabel(natsServer)} (JetStream, ${useAuth ? "JWT auth" : "OPEN/no-auth"}) - store: ${storeDir}, bind: ${host}`;
@@ -2418,10 +2406,10 @@ async function runUp(args, inheritedLock, onAdopt, freshTeamBoot = false, restor
2418
2406
  // The record is kept ON PURPOSE: it still names the store this broker opened, so a repair
2419
2407
  // `up` reopens that SAME store instead of falling back to the root's default, and a
2420
2408
  // supervising unit's restart takes the refresh path against the recorded store rather than
2421
- // racing a second broker into existence. Foreground stdio is inherited (its own log lines
2422
- // are already on this terminal, above), so there is no `.cotal/nats.log` to name here.
2409
+ // racing a second broker into existence. NATS logs to this terminal unless a native log was
2410
+ // requested, so there is no `.cotal/nats.log` to name here.
2423
2411
  const detail = signal ? `signal ${signal}` : `code ${code}`;
2424
- const repair = `log: see the terminal output above; repair: \`cotal up --server ${server} --space ${space}\``;
2412
+ const repair = `log: see ${brokerOutput}; repair: ${codeSpan(`cotal up --server ${shellWord(server)} --space ${shellWord(space)}`)}`;
2425
2413
  // Retention is read from the registry, not assumed: a broker that exits before it first
2426
2414
  // answers was never recorded, and running the same `up` again only repeats that exit, so its
2427
2415
  // step is the one a detached start gives. A registry that cannot be read is not claimed
@@ -2431,7 +2419,7 @@ async function runUp(args, inheritedLock, onAdopt, freshTeamBoot = false, restor
2431
2419
  const mine = findMesh(space);
2432
2420
  outcome = mine && mine.server === server && mine.root === cotalRoot()
2433
2421
  ? `; the mesh "${space}" stays recorded (\`cotal meshes\` lists it offline); ${repair}`
2434
- : ` before the mesh "${space}" was recorded; next: ${listenerExitRemedy(natsServer, "the terminal output above")}`;
2422
+ : ` before the mesh "${space}" was recorded; next: ${listenerExitRemedy(natsServer, brokerOutput)}`;
2435
2423
  }
2436
2424
  catch {
2437
2425
  outcome = `; whether the mesh "${space}" stays recorded could not be read; ${repair}`;
@@ -2445,7 +2433,7 @@ async function runUp(args, inheritedLock, onAdopt, freshTeamBoot = false, restor
2445
2433
  process.exit(exitCode("failed", "OPERATION_FAILED"));
2446
2434
  }
2447
2435
  });
2448
- await awaitSpawnedListener({ child, executable: natsServer, server, space, creds: setup?.creds, tls: transport.kind === "tls-required", log: "the terminal output above", boundListener });
2436
+ await awaitSpawnedListener({ child, executable: natsServer, server, space, creds: setup?.creds, tls: transport.kind === "tls-required", log: brokerOutput, boundListener });
2449
2437
  listenerReady = true;
2450
2438
  {
2451
2439
  // A DAEMON THAT DIES UNDER THIS RUNNING BROKER IS RESTARTED HERE (#2469). It exits on its own once
@@ -3634,7 +3622,7 @@ async function upManifest(file, opts) {
3634
3622
  // nothing: a rotation ask answered with silent success, the exact failure class this change
3635
3623
  // exists to remove. Before the dry-run print and before anything boots.
3636
3624
  if (opts.rotateSys && open)
3637
- throw new Error("--rotate-sys is for auth meshes: this manifest sets broker.auth: false (open), so there is no system account or $SYS credentials to rotate");
3625
+ throw new FlagValueRefusal("--rotate-sys is for auth meshes: this manifest sets broker.auth: false (open), so there is no system account or $SYS credentials to rotate, and nothing was started", "drop --rotate-sys for this open manifest");
3638
3626
  // Before the dry-run print and before connector preflight or any write, as the refusals above.
3639
3627
  if (!opts.storeDir)
3640
3628
  refuseUnnamedLastStore(cotalPath("nats"));
@@ -3643,6 +3631,13 @@ async function upManifest(file, opts) {
3643
3631
  if (userAuth)
3644
3632
  await preflightUserStack(cotalRoot(), m.space, userAuth.idpUrl);
3645
3633
  checkStartStore(opts.storeDir, m.space);
3634
+ // Preview and apply resolve and probe the same runtime before showing a plan or starting a broker.
3635
+ try {
3636
+ await preflightRuntime(runtime);
3637
+ }
3638
+ catch (error) {
3639
+ throw new CommandFailure("refused", "DEPENDENCY_UNAVAILABLE", `the requested runtime did not pass preflight; ${opts.freshTeamBoot ? "no fresh boot intent or broker was started" : "no broker was started"}`, { target: { space: m.space, runtime }, remedy: error instanceof Error ? error.message : "inspect the selected runtime provider" });
3640
+ }
3646
3641
  if (opts.dryRun) {
3647
3642
  // Dial-host SAN must refuse here too (S6). The real route runs assertServesDialHost after
3648
3643
  // the plan is computed; dry-run used to return before that check and green-lit a launch
@@ -3666,14 +3661,6 @@ async function upManifest(file, opts) {
3666
3661
  console.log(c.dim(" no manager will start on this host (--no-manager): broker, channels and, in auth mode, the delivery daemon come up, and no agents launch from here"));
3667
3662
  return;
3668
3663
  }
3669
- // Preflight an extension runtime before starting the broker. The detached manager re-execs this
3670
- // CLI and resolves the same installed package when `supervise --runtime <name>` starts.
3671
- try {
3672
- await preflightRuntime(runtime);
3673
- }
3674
- catch (error) {
3675
- throw new CommandFailure("refused", "DEPENDENCY_UNAVAILABLE", `the requested runtime did not pass preflight; ${opts.freshTeamBoot ? "no fresh boot intent or broker was started" : "no broker was started"}`, { target: { space: m.space, runtime }, remedy: error instanceof Error ? error.message : "inspect the selected runtime provider" });
3676
- }
3677
3664
  // up -f never adopts a running broker. The old spawn -f route is no longer a manifest deploy.
3678
3665
  if (await isReachable(server)) {
3679
3666
  if (opts.freshTeamBoot)
@@ -3681,7 +3668,7 @@ async function upManifest(file, opts) {
3681
3668
  // This folder's own mesh for the manifest's space is named as running, as a bare `up` names it,
3682
3669
  // with the routes that change it instead of the advice for a foreign broker.
3683
3670
  if (loadMeshes().some((row) => row.server === server && row.root === cotalRoot() && row.space === m.space)) {
3684
- stderrLine("✗ ", `mesh "${m.space}" is already running at ${brokerAddressForDisplay(server) ?? "its address"} from this folder - \`up -f\` boots a fresh mesh and does not apply a manifest to a running one; \`cotal team deploy ${file}\` adds all-new channels and agents to it, or \`cotal down\` it first, then \`cotal up -f ${file}\``, c.red);
3671
+ stderrLine("✗ ", `mesh "${m.space}" is already running at ${brokerAddressForDisplay(server) ?? "its address"} from this folder - \`up -f\` boots a fresh mesh and does not apply a manifest to a running one; stop it with \`cotal down\`, then retry your original command`, c.red);
3685
3672
  process.exit(1);
3686
3673
  }
3687
3674
  stderrLine("✗ ", `${brokerAddressForDisplay(server) ?? "selected address"} already has a broker - a fresh boot will not adopt it. Stop the owned stack or select another address; team deploy supports only all-new channel cards, not agent apply.`, c.red);
@@ -4185,21 +4172,7 @@ export async function prepareBrokerStart(opts) {
4185
4172
  const { path: bin, source, version } = renderingBinary;
4186
4173
  return { root, server, space, useAuth, storeDir, seedFile, host, transport, setup, maxPayload, confPath, args, bin, source, version };
4187
4174
  }
4188
- /**
4189
- * Open the detached broker's log with {@link openPrivateAppend}: created `0600` whatever the umask,
4190
- * never through a symlink, and an earlier log this user owns set to `0600`. A symlink, a log another
4191
- * user owns or a name that is not a regular file is refused and left unchanged.
4192
- */
4193
- export function openBrokerLog(path) {
4194
- try {
4195
- return openPrivateAppend(path);
4196
- }
4197
- catch (error) {
4198
- if (error.code !== "EPERM")
4199
- throw error;
4200
- throw new CommandFailure("refused", "PERMISSION_DENIED", `no broker was started: ${error.message}`, { target: { path }, remedy: `remove ${path} or replace it with a regular file you own, then run \`cotal up\` again` });
4201
- }
4202
- }
4175
+ export { openBrokerLog };
4203
4176
  /**
4204
4177
  * Start a background nats-server (JetStream), wait until it's reachable, pre-create the
4205
4178
  * space's streams, and leave it running detached (pid in `.cotal/nats.pid`). Used by
@@ -4632,8 +4605,7 @@ async function waitReady(server, creds, tls = false, log) {
4632
4605
  return false;
4633
4606
  }
4634
4607
  /** Bytes plus completed-restore lines in the broker log, and whether a restore is in flight. A
4635
- * foreground launch inherits the terminal and has no file to read, so it contributes no evidence
4636
- * and keeps the silent-probe bound. */
4608
+ * foreground broker logging to the terminal has no file to read, so it keeps the silent-probe bound. */
4637
4609
  function brokerRecoveryEvidence(log) {
4638
4610
  const none = { evidence: 0, restoring: false };
4639
4611
  if (!log || log.startsWith("the terminal"))
@@ -4837,60 +4809,6 @@ function refuseRegisteredAddress(server, space, elsewhere) {
4837
4809
  remedy: `${elsewhere}, or free that one with \`cotal space forget ${held.space}\``,
4838
4810
  });
4839
4811
  }
4840
- /** Choose only a first implicit address. A saved or explicitly requested address is never moved.
4841
- * The broker still validates and binds its own listener; this inspection cannot reserve the port. */
4842
- async function freshStackServer(server, bindHost) {
4843
- const url = new URL(server);
4844
- const host = (bindHost ?? url.hostname).replace(/^\[|\]$/g, "");
4845
- const reserved = new Set();
4846
- // A recorded address this cannot take apart reserves nothing: it names no host and port to avoid.
4847
- for (const mesh of loadMeshes()) {
4848
- const key = brokerAddressKey(mesh.server);
4849
- if (key !== undefined)
4850
- reserved.add(key);
4851
- }
4852
- let candidate = server;
4853
- for (let attempt = 0; attempt < 16; attempt++) {
4854
- const address = new URL(candidate);
4855
- const key = brokerAddressKey(candidate);
4856
- if (key === undefined || !reserved.has(key)) {
4857
- try {
4858
- await freePort(host, Number(address.port) || 4222);
4859
- return candidate;
4860
- }
4861
- catch (error) {
4862
- if (error.code !== "EADDRINUSE")
4863
- throw error;
4864
- }
4865
- }
4866
- candidate = await serverWithFreePort(server, host);
4867
- }
4868
- throw new CommandFailure("refused", "TARGET_UNAVAILABLE", "no unreserved local broker address could be selected; no broker was started");
4869
- }
4870
- async function serverWithFreePort(server, host) {
4871
- const url = new URL(server);
4872
- url.port = String(await freePort(host));
4873
- return url.toString();
4874
- }
4875
- function freePort(host, requestedPort = 0) {
4876
- return new Promise((resolve, reject) => {
4877
- const srv = createServer();
4878
- srv.unref();
4879
- srv.once("error", reject);
4880
- srv.listen(requestedPort, host, () => {
4881
- const addr = srv.address();
4882
- const port = typeof addr === "object" && addr ? addr.port : undefined;
4883
- srv.close((err) => {
4884
- if (err)
4885
- reject(err);
4886
- else if (port)
4887
- resolve(port);
4888
- else
4889
- reject(new Error("could not allocate a free port"));
4890
- });
4891
- });
4892
- });
4893
- }
4894
4812
  function membershipConversionRefusal(space, remedy = "stop the stack with `cotal down --yes`, then run `cotal up --recreate-membership-store`") {
4895
4813
  return new CommandFailure("refused", "LIFECYCLE_BLOCKED", `space ${space} has a legacy File-backed membership store; it was not changed while its broker or membership services may be in use`, {
4896
4814
  target: { space }, remedy,