@cotal-ai/cli 0.10.1 → 0.11.0

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 (133) hide show
  1. package/dist/command.d.ts.map +1 -1
  2. package/dist/command.js +11 -3
  3. package/dist/command.js.map +1 -1
  4. package/dist/commands/agents.d.ts.map +1 -1
  5. package/dist/commands/agents.js +30 -13
  6. package/dist/commands/agents.js.map +1 -1
  7. package/dist/commands/channels.d.ts.map +1 -1
  8. package/dist/commands/channels.js +16 -6
  9. package/dist/commands/channels.js.map +1 -1
  10. package/dist/commands/completion.js +5 -5
  11. package/dist/commands/console.d.ts +1 -1
  12. package/dist/commands/console.d.ts.map +1 -1
  13. package/dist/commands/console.js +17 -11
  14. package/dist/commands/console.js.map +1 -1
  15. package/dist/commands/doctor.d.ts +14 -0
  16. package/dist/commands/doctor.d.ts.map +1 -0
  17. package/dist/commands/doctor.js +171 -0
  18. package/dist/commands/doctor.js.map +1 -0
  19. package/dist/commands/down-manifest.js +15 -15
  20. package/dist/commands/down.d.ts.map +1 -1
  21. package/dist/commands/down.js +4 -1
  22. package/dist/commands/down.js.map +1 -1
  23. package/dist/commands/ext.js +11 -11
  24. package/dist/commands/feedback.js +2 -2
  25. package/dist/commands/history.d.ts.map +1 -1
  26. package/dist/commands/history.js +7 -3
  27. package/dist/commands/history.js.map +1 -1
  28. package/dist/commands/join.d.ts.map +1 -1
  29. package/dist/commands/join.js +14 -7
  30. package/dist/commands/join.js.map +1 -1
  31. package/dist/commands/meshes.js +2 -2
  32. package/dist/commands/mint.d.ts.map +1 -1
  33. package/dist/commands/mint.js +16 -5
  34. package/dist/commands/mint.js.map +1 -1
  35. package/dist/commands/models.js +1 -1
  36. package/dist/commands/models.js.map +1 -1
  37. package/dist/commands/personas.js +4 -4
  38. package/dist/commands/send.js +1 -1
  39. package/dist/commands/setup.js +25 -25
  40. package/dist/commands/setup.js.map +1 -1
  41. package/dist/commands/spawn-manifest.d.ts.map +1 -1
  42. package/dist/commands/spawn-manifest.js +47 -25
  43. package/dist/commands/spawn-manifest.js.map +1 -1
  44. package/dist/commands/spawn.d.ts +6 -0
  45. package/dist/commands/spawn.d.ts.map +1 -1
  46. package/dist/commands/spawn.js +257 -46
  47. package/dist/commands/spawn.js.map +1 -1
  48. package/dist/commands/status.d.ts.map +1 -1
  49. package/dist/commands/status.js +71 -6
  50. package/dist/commands/status.js.map +1 -1
  51. package/dist/commands/topology.js +2 -2
  52. package/dist/commands/up.d.ts +5 -0
  53. package/dist/commands/up.d.ts.map +1 -1
  54. package/dist/commands/up.js +269 -48
  55. package/dist/commands/up.js.map +1 -1
  56. package/dist/commands/use.js +1 -1
  57. package/dist/console/commands.js +2 -2
  58. package/dist/console/mesh.js +1 -1
  59. package/dist/console/mesh.js.map +1 -1
  60. package/dist/console/root.d.ts +15 -3
  61. package/dist/console/root.d.ts.map +1 -1
  62. package/dist/console/root.js +12 -7
  63. package/dist/console/root.js.map +1 -1
  64. package/dist/console/ui/Confirm.js +1 -1
  65. package/dist/console/ui/Confirm.js.map +1 -1
  66. package/dist/console/ui/Feed.js +1 -1
  67. package/dist/console/ui/Feed.js.map +1 -1
  68. package/dist/console/ui/Help.js +2 -2
  69. package/dist/console/ui/Help.js.map +1 -1
  70. package/dist/console/ui/NeedsYou.js +1 -1
  71. package/dist/console/ui/NeedsYou.js.map +1 -1
  72. package/dist/console/ui/SpacePicker.js +1 -1
  73. package/dist/console/ui/SpacePicker.js.map +1 -1
  74. package/dist/console/ui/Tiles.js +1 -1
  75. package/dist/console/ui/topo/Map.js +1 -1
  76. package/dist/console/ui/topo/Map.js.map +1 -1
  77. package/dist/console/ui/topo/Matrix.js +2 -2
  78. package/dist/console/ui/topo/Matrix.js.map +1 -1
  79. package/dist/console/ui/topo/Sequence.js +1 -1
  80. package/dist/console/ui/topo/Sequence.js.map +1 -1
  81. package/dist/ext-loader.js +8 -8
  82. package/dist/index.d.ts.map +1 -1
  83. package/dist/index.js +29 -17
  84. package/dist/index.js.map +1 -1
  85. package/dist/lib/attach-client.js +1 -1
  86. package/dist/lib/auth-proc.d.ts +19 -0
  87. package/dist/lib/auth-proc.d.ts.map +1 -0
  88. package/dist/lib/auth-proc.js +81 -0
  89. package/dist/lib/auth-proc.js.map +1 -0
  90. package/dist/lib/connect.d.ts +1 -1
  91. package/dist/lib/connect.d.ts.map +1 -1
  92. package/dist/lib/connect.js +2 -2
  93. package/dist/lib/connect.js.map +1 -1
  94. package/dist/lib/control.d.ts +14 -6
  95. package/dist/lib/control.d.ts.map +1 -1
  96. package/dist/lib/control.js +23 -11
  97. package/dist/lib/control.js.map +1 -1
  98. package/dist/lib/delivery-proc.js +2 -2
  99. package/dist/lib/manifest/apply.d.ts +3 -2
  100. package/dist/lib/manifest/apply.d.ts.map +1 -1
  101. package/dist/lib/manifest/apply.js +7 -2
  102. package/dist/lib/manifest/apply.js.map +1 -1
  103. package/dist/lib/manifest/ledger.js +4 -4
  104. package/dist/lib/manifest/live.d.ts +23 -9
  105. package/dist/lib/manifest/live.d.ts.map +1 -1
  106. package/dist/lib/manifest/live.js +22 -12
  107. package/dist/lib/manifest/live.js.map +1 -1
  108. package/dist/lib/manifest/model.d.ts +4 -1
  109. package/dist/lib/manifest/model.d.ts.map +1 -1
  110. package/dist/lib/manifest/prepare.d.ts +2 -0
  111. package/dist/lib/manifest/prepare.d.ts.map +1 -1
  112. package/dist/lib/manifest/prepare.js +5 -2
  113. package/dist/lib/manifest/prepare.js.map +1 -1
  114. package/dist/lib/manifest/render.d.ts.map +1 -1
  115. package/dist/lib/manifest/render.js +14 -13
  116. package/dist/lib/manifest/render.js.map +1 -1
  117. package/dist/lib/manifest/resolve.js +19 -6
  118. package/dist/lib/manifest/resolve.js.map +1 -1
  119. package/dist/lib/manifest/schema.d.ts +4 -1
  120. package/dist/lib/manifest/schema.d.ts.map +1 -1
  121. package/dist/lib/manifest/schema.js +10 -2
  122. package/dist/lib/manifest/schema.js.map +1 -1
  123. package/dist/lib/setup-log.js +1 -1
  124. package/dist/lib/status.d.ts +1 -1
  125. package/dist/lib/status.js +1 -1
  126. package/dist/lib/transient.d.ts +8 -10
  127. package/dist/lib/transient.d.ts.map +1 -1
  128. package/dist/lib/transient.js +11 -11
  129. package/dist/lib/transient.js.map +1 -1
  130. package/dist/render.js +2 -2
  131. package/dist/ui.js +1 -1
  132. package/dist/ui.js.map +1 -1
  133. package/package.json +3 -3
@@ -1 +1 @@
1
- {"version":3,"file":"status.js","sourceRoot":"","sources":["../../src/commands/status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EACL,aAAa,EACb,WAAW,EACX,SAAS,EACT,WAAW,GAGZ,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,OAAO,EACP,aAAa,EACb,UAAU,EACV,sBAAsB,EACtB,sBAAsB,EACtB,UAAU,EACV,aAAa,EACb,eAAe,EACf,iBAAiB,EACjB,UAAU,EACV,SAAS,GACV,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,CAAC,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAE1C,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,SAAS,EAAE,UAAU,CAAU,CAAC;AAI5D,8FAA8F;AAC9F,MAAM,CAAC,KAAK,UAAU,MAAM,CAAC,IAAgB;IAC3C,MAAM,MAAM,GAAG,IAAI,CAAC,MAAwC,CAAC;IAC7D,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAC1B,MAAM,IAAI,GAAG,aAAa,CAAC,GAAG,CAAC,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AAC,CAAC,CAAC,IAAI,IAAI,MAAM,CAAC,CAAC,CAAC;AACpE,CAAC;AAED,SAAS,OAAO,CAAC,IAAY;IAC3B,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACnC,CAAC;AAED,SAAS,GAAG,CAAC,IAAY,EAAE,KAAa;IACtC,OAAO,CAAC,GAAG,CAAC,KAAK,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,KAAK,EAAE,CAAC,CAAC;AAC/C,CAAC"}
@@ -12,13 +12,13 @@ export async function topology(args) {
12
12
  const values = args.values;
13
13
  const [sub, ...positionals] = args.positionals;
14
14
  if (sub !== "view") {
15
- console.error(c.red(`✗ unknown topology subcommand "${sub ?? ""}" expected: view`));
15
+ console.error(c.red(`✗ unknown topology subcommand "${sub ?? ""}" - expected: view`));
16
16
  console.error(c.dim("cotal topology view -f <cotal.yaml>"));
17
17
  process.exit(1);
18
18
  }
19
19
  const file = values.file ?? positionals[0];
20
20
  if (!file) {
21
- console.error(c.red("✗ a manifest file is required `cotal topology view -f <cotal.yaml>`"));
21
+ console.error(c.red("✗ a manifest file is required - `cotal topology view -f <cotal.yaml>`"));
22
22
  process.exit(1);
23
23
  }
24
24
  try {
@@ -5,6 +5,10 @@ export interface DetachOpts {
5
5
  storeDir?: string;
6
6
  space?: string;
7
7
  open?: boolean;
8
+ /** USER MODE: enable per-user auth (presence = on; `idpUrl` pins the IdP on first enable). */
9
+ userAuth?: {
10
+ idpUrl?: string;
11
+ };
8
12
  channels?: string;
9
13
  host?: string;
10
14
  /** Channel-registry seed in memory (the `cotal up -f` manifest path), used instead of reading a
@@ -29,5 +33,6 @@ export declare function startMeshDetached(opts?: DetachOpts): Promise<{
29
33
  pid: number;
30
34
  source: string;
31
35
  controlPlane: boolean;
36
+ authService: boolean;
32
37
  }>;
33
38
  //# sourceMappingURL=up.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"up.d.ts","sourceRoot":"","sources":["../../src/commands/up.ts"],"names":[],"mappings":"AAaA,OAAO,EAcL,KAAK,mBAAmB,EACxB,KAAK,UAAU,EAChB,MAAM,gBAAgB,CAAC;AAyBxB,wBAAsB,EAAE,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAqHxD;AAmID,MAAM,WAAW,UAAU;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;qEACiE;IACjE,IAAI,CAAC,EAAE,mBAAmB,CAAC;IAC3B,sFAAsF;IACtF,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC;yGACqG;IACrG,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;GAMG;AACH,wBAAsB,iBAAiB,CACrC,IAAI,GAAE,UAAe,GACpB,OAAO,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,OAAO,CAAA;CAAE,CAAC,CAsCjF"}
1
+ {"version":3,"file":"up.d.ts","sourceRoot":"","sources":["../../src/commands/up.ts"],"names":[],"mappings":"AAaA,OAAO,EAgBL,KAAK,mBAAmB,EACxB,KAAK,UAAU,EAChB,MAAM,gBAAgB,CAAC;AA6BxB,wBAAsB,EAAE,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CA4MxD;AAsMD,MAAM,WAAW,UAAU;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,8FAA8F;IAC9F,QAAQ,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC/B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;qEACiE;IACjE,IAAI,CAAC,EAAE,mBAAmB,CAAC;IAC3B,sFAAsF;IACtF,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC;yGACqG;IACrG,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;GAMG;AACH,wBAAsB,iBAAiB,CACrC,IAAI,GAAE,UAAe,GACpB,OAAO,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,OAAO,CAAC;IAAC,WAAW,EAAE,OAAO,CAAA;CAAE,CAAC,CAgDvG"}
@@ -1,9 +1,10 @@
1
1
  import { spawn } from "node:child_process";
2
2
  import { createServer } from "node:net";
3
3
  import { mkdirSync, writeFileSync, readFileSync, existsSync, openSync, statSync, readSync, closeSync, } from "node:fs";
4
- import { resolve } from "node:path";
5
- import { isReachable, DEFAULT_SERVER, createSpaceAuth, serverConfig, mintCreds, mintMembershipObserverCreds, newIdentity, setupSpaceStreams, seedChannelRegistry, ensureDefaultDeliveryClass, mkSecretDir, writeSecretFile, } from "@cotal-ai/core";
6
- import { authDir, loadSpaceAuth, saveSpaceAuth, clearCurrent, findMesh, getCurrent, loadMeshes, recordMesh, removeMesh, setCurrent, } from "@cotal-ai/workspace";
4
+ import { join, resolve } from "node:path";
5
+ import { isReachable, DEFAULT_SERVER, createSpaceAuth, serverConfig, mintCreds, mintConnectionEvictorCreds, mintMembershipObserverCreds, newIdentity, setupSpaceStreams, seedChannelRegistry, ensureDefaultDeliveryClass, mkSecretDir, writeSecretFile, } from "@cotal-ai/core";
6
+ import { assertUserAuthInfo, authDir, loadSpaceAuth, saveSpaceAuth, clearCurrent, findMesh, getCurrent, loadMeshes, recordMesh, removeMesh, setCurrent, userAuthStateDir, } from "@cotal-ai/workspace";
7
+ import { ensureAuthService, resolveAuthProvider, stopAuthService } from "../lib/auth-proc.js";
7
8
  import { resolveSpace } from "../lib/status.js";
8
9
  import { c } from "../ui.js";
9
10
  import { resolveNatsServer } from "../lib/nats-bin.js";
@@ -16,6 +17,18 @@ import { renderUpPlan, renderInherited, renderWarnings } from "../lib/manifest/r
16
17
  import { failManifest } from "./topology.js";
17
18
  export async function up(args) {
18
19
  const values = args.values;
20
+ const wantUser = Boolean(values["user-auth"]);
21
+ // The auth-mode flags contradict each other loudly, never silently (a user-auth space quietly
22
+ // started open would run agents on the wrong identity plane — the exact failure per-user-auth
23
+ // exists to prevent).
24
+ if (wantUser && values.open) {
25
+ console.error(c.red("✗ --user-auth and --open contradict - a user-auth space cannot run unauthenticated"));
26
+ process.exit(1);
27
+ }
28
+ if (values.idp && !wantUser && !values.file) {
29
+ console.error(c.red('✗ --idp is for user-auth spaces; pair it with --user-auth, or set broker.auth: "user" in a manifest'));
30
+ process.exit(1);
31
+ }
19
32
  // `up -f cotal.yaml` is a distinct path: bring up a FRESH mesh described by a manifest (broker +
20
33
  // channels + booted agents). It owns the whole space; deploying onto a RUNNING mesh is `spawn -f`.
21
34
  // CLI flags override the manifest (flag > manifest > default) so the same file runs at a different
@@ -28,6 +41,8 @@ export async function up(args) {
28
41
  space: values.space,
29
42
  runtime: values.runtime,
30
43
  open: values.open,
44
+ userAuth: wantUser,
45
+ idp: values.idp,
31
46
  });
32
47
  return;
33
48
  }
@@ -43,9 +58,57 @@ export async function up(args) {
43
58
  const held = loadMeshes().find((m) => m.server === server);
44
59
  if (held && held.root === root && (held.space === space || values.space === undefined)) {
45
60
  // A refresh of the SAME already-running mesh — its mode is fixed by how the live broker was
46
- // started; preserve `held.mode` rather than relabel it from this invocation's `--open`.
47
- recordOurMesh({ space: held.space, server, root, mode: held.mode, ts: new Date().toISOString() });
61
+ // started. A flag asking for a DIFFERENT mode must fail loud (silently preserving the old
62
+ // mode would hand the operator a mesh on the wrong identity plane); a bare refresh keeps the
63
+ // held mode.
64
+ const requested = wantUser ? "user" : values.open ? "open" : undefined;
65
+ if (requested && requested !== held.mode) {
66
+ const label = { auth: "static JWT auth", open: "no auth (--open)", user: "per-user auth" }[held.mode];
67
+ console.error(c.red(`✗ mesh "${held.space}" is already running at ${server} with ${label} - a running broker can't change auth mode; \`cotal down\` it first, then \`cotal up ${wantUser ? "--user-auth" : "--open"}\``));
68
+ process.exit(1);
69
+ }
48
70
  console.log(c.green(`✓ mesh "${held.space}" already running at ${server}`));
71
+ // USER MODE: re-upping IS the documented recovery for a dead auth service (the provider's
72
+ // failure copy says "restart it with `cotal up`"), so a refresh must re-ensure the service —
73
+ // never just reprint "already running" over a dead callout. No broker config is (re)written
74
+ // here, so healing on a bare `cotal up` is safe: the mode can't drift, only the daemon heals.
75
+ let userAuth = held.userAuth;
76
+ if (held.mode === "user") {
77
+ const auth = loadSpaceAuth(authDir(root));
78
+ if (!auth) {
79
+ console.error(c.red(`✗ mesh "${held.space}" is user-auth but this root has no trust material under ${authDir(root)} - \`cotal down\` it, restore or re-provision \`.cotal/auth\`, then \`cotal up --user-auth\``));
80
+ process.exit(1);
81
+ }
82
+ const stateDir = userAuthStateDir(root, held.space);
83
+ let prepared;
84
+ try {
85
+ prepared = await resolveAuthProvider().prepareServer({
86
+ space: held.space,
87
+ operatorSeed: auth.operator.seed,
88
+ account: { pub: auth.account.pub, signingSeed: auth.account.signingSeed },
89
+ dir: stateDir,
90
+ idpUrl: values.idp,
91
+ });
92
+ }
93
+ catch (e) {
94
+ console.error(c.red(`✗ ${e.message}`));
95
+ process.exit(1);
96
+ }
97
+ const svc = await startUserAuthService(held.space, server, { prepared, stateDir });
98
+ userAuth = svc.userAuth;
99
+ // The refresh IS the recovery command — a heal that didn't heal must not exit 0.
100
+ if (!svc.ok)
101
+ process.exitCode = 1;
102
+ }
103
+ // Auth/user meshes also need their resident renewal owner. A same-root refresh is the normal
104
+ // repair command after a stale/missing manager, so ensure the delivery daemon + manager before
105
+ // claiming the running mesh is healthy. Open meshes have no auth creds or delivery daemon.
106
+ if (held.mode !== "open") {
107
+ const controlPlane = await startDeliveryWithBroker(held.space, server);
108
+ if (!controlPlane)
109
+ process.exitCode = 1;
110
+ }
111
+ recordOurMesh({ space: held.space, server, root, mode: held.mode, ...(userAuth ? { userAuth } : {}), ts: new Date().toISOString() });
49
112
  return;
50
113
  }
51
114
  const who = held ? `mesh "${held.space}" (${held.root})` : "a broker not started here";
@@ -55,35 +118,42 @@ export async function up(args) {
55
118
  server = next;
56
119
  }
57
120
  else {
58
- console.error(c.red(`✗ ${server} is already in use by ${who} to run "${space}" use \`--server nats://${host}:<port>\` with a free port`));
121
+ console.error(c.red(`✗ ${server} is already in use by ${who} - to run "${space}" use \`--server nats://${host}:<port>\` with a free port`));
59
122
  process.exit(1);
60
123
  }
61
124
  }
62
125
  if (values.detach) {
63
- const { pid, source } = await startMeshDetached({
126
+ const { pid, source, authService } = await startMeshDetached({
64
127
  server,
65
128
  storeDir: values["store-dir"],
66
129
  space: values.space,
67
130
  open: values.open,
131
+ userAuth: wantUser ? { idpUrl: values.idp } : undefined,
68
132
  channels: values.channels,
69
133
  host,
70
134
  });
71
135
  console.log(c.dim(`Started nats-server (${source}).`));
72
- console.log(c.green(`✓ mesh running in the background (pid ${pid}) stop with: cotal down`));
136
+ console.log(c.green(`✓ mesh running in the background (pid ${pid}) - stop with: cotal down`));
137
+ // A user mesh whose auth service never became ready is recorded + running (a re-`cotal up`
138
+ // heals it), but this `up` did NOT deliver what was asked — automation must see that in the
139
+ // exit code, not only in the red line above.
140
+ if (!authService)
141
+ process.exitCode = 1;
73
142
  return;
74
143
  }
75
- const storeDir = values["store-dir"] ? resolve(values["store-dir"]) : cotalPath("nats");
76
- mkdirSync(storeDir, { recursive: true });
77
144
  const useAuth = !values.open;
78
145
  const space = values.space ?? resolveSpace(process.cwd());
79
- assertAuthMatchesSpace(useAuth, space);
146
+ ensureRootForSpace(useAuth, space); // may pin the cwd as this space's root — before any cotalPath use
147
+ refuseOpenOverUserState(Boolean(values.open), space);
148
+ const storeDir = values["store-dir"] ? resolve(values["store-dir"]) : cotalPath("nats");
149
+ mkdirSync(storeDir, { recursive: true });
80
150
  await claimSpace(space, server, cotalRoot());
81
151
  const seedFile = loadChannelsFile(values.channels);
82
- const setup = useAuth ? await authSetup(storeDir, server, space, host) : undefined;
152
+ const setup = useAuth ? await authSetup(storeDir, server, space, host, wantUser ? { idpUrl: values.idp } : undefined) : undefined;
83
153
  const port = Number(new URL(server).port) || 4222;
84
154
  const natsArgs = setup ? ["-c", setup.confPath] : ["-js", "-sd", storeDir, "-p", String(port), "-a", host];
85
155
  const { bin, source } = await resolveNatsServer();
86
- console.log(c.dim(`Starting nats-server (JetStream, ${useAuth ? "JWT auth" : "OPEN/no-auth"}, ${source}) store: ${storeDir}, bind: ${host}`));
156
+ console.log(c.dim(`Starting nats-server (JetStream, ${useAuth ? "JWT auth" : "OPEN/no-auth"}, ${source}) - store: ${storeDir}, bind: ${host}`));
87
157
  console.log(c.dim("Press Ctrl-C to stop.\n"));
88
158
  const child = spawn(bin, natsArgs, { stdio: "inherit" });
89
159
  child.on("error", (err) => {
@@ -91,10 +161,11 @@ export async function up(args) {
91
161
  process.exit(1);
92
162
  });
93
163
  // The control plane is coupled to the broker: stop the delivery daemon AND the detached manager
94
- // when this `up` stops (Ctrl-C), so neither outlives the broker it serves — a surviving manager
95
- // would reconnect-loop invisibly against the dead (or the NEXT) broker (the documented
96
- // orphan-supervisor failure mode). Both kill by pidfile, symmetric.
97
- const stop = () => { stopDelivery(); stopManager(); child.kill("SIGTERM"); };
164
+ // (AND the space's user-auth service) when this `up` stops (Ctrl-C), so none outlives the broker
165
+ // it serves — a surviving manager would reconnect-loop invisibly against the dead (or the NEXT)
166
+ // broker (the documented orphan-supervisor failure mode). All kill by pidfile, symmetric; the
167
+ // auth service's pid is space-scoped so no other space's daemon can ever be hit.
168
+ const stop = () => { stopDelivery(); stopManager(); stopAuthService(space); child.kill("SIGTERM"); };
98
169
  process.on("SIGINT", stop);
99
170
  process.on("SIGTERM", stop);
100
171
  // The broker is gone — drop it from the registry (and the `current` pointer if it was the default)
@@ -102,6 +173,7 @@ export async function up(args) {
102
173
  child.on("exit", (code) => {
103
174
  stopDelivery();
104
175
  stopManager();
176
+ stopAuthService(space);
105
177
  // Only unrecord if the registry still points at THIS broker. A newer broker for the same space
106
178
  // (a concurrent `up`, or a different-port re-up that recorded after us) may have replaced our
107
179
  // record — removing by name would clobber the live winner and hide it from the registry.
@@ -115,13 +187,50 @@ export async function up(args) {
115
187
  });
116
188
  if (await waitReady(server, setup?.creds)) {
117
189
  await postStart(server, space, setup, seedFile);
190
+ // USER MODE: the auth service comes up FIRST among the daemons — until its callout answers,
191
+ // every user-mode connect to this broker is denied, so `up` must not report a usable user mesh
192
+ // (nor let agents race it) on a half-started auth plane. (Foreground `up` doesn't exit here, so
193
+ // `ok` has no exit code to carry — the red consequence line above is the operator signal.)
194
+ const svc = await startUserAuthService(space, server, setup);
195
+ // Record BEFORE the control plane comes up: the manager's fail-closed mode detection requires
196
+ // an authoritative registry entry (marker-without-registry is a refused start, not a guess),
197
+ // so the record must exist by the time it boots. A manager/delivery failure after this leaves
198
+ // a recorded-but-degraded mesh — the documented, healable posture.
199
+ recordOurMesh({
200
+ space, server, root: cotalRoot(),
201
+ mode: setup?.prepared ? "user" : useAuth ? "auth" : "open",
202
+ ...(svc.userAuth ? { userAuth: svc.userAuth } : {}),
203
+ ts: new Date().toISOString(),
204
+ });
118
205
  // Bring up the delivery daemon WITH the server (auth mode only — it self-gates on `.cotal/auth`).
119
206
  // It is part of the server, so `cotal up` starts it by default; open dev mode has no daemon.
207
+ // Class-2 credential renewal is NOT wired here: the MANAGER is the renewal owner (it is resident
208
+ // in every mesh mode — foreground, --detach, refresh — where this foreground process is not).
120
209
  await startDeliveryWithBroker(space, server);
121
- recordOurMesh({ space, server, root: cotalRoot(), mode: useAuth ? "auth" : "open", ts: new Date().toISOString() });
122
210
  }
123
211
  await new Promise(() => { });
124
212
  }
213
+ /** Bring the space's USER-AUTH service up with the broker (user mode only — `setup.prepared` is the
214
+ * provider's output). Loud both ways (U5): a ready service prints the login line; a service that
215
+ * never became ready prints the exact consequence + recourse. Returns the registry metadata either
216
+ * way — the mesh IS a user-auth mesh even while its service is down (connects must say "auth
217
+ * service down", never fall back to static semantics) — plus `ok`, so the exiting `up` surfaces
218
+ * (detach / manifest / refresh-heal) turn a dead identity plane into a NON-ZERO exit: automation
219
+ * must not read "user mesh up" from a mesh whose every user connect will be denied. */
220
+ async function startUserAuthService(space, server, setup) {
221
+ if (!setup?.prepared || !setup.stateDir)
222
+ return { ok: true };
223
+ try {
224
+ const endpoints = await ensureAuthService({ space, server, stateDir: setup.stateDir, prepared: setup.prepared });
225
+ const info = assertUserAuthInfo({ ...setup.prepared.publicAuth, endpoints });
226
+ console.log(c.green("✓ user-auth service up") + c.dim(` - sign in with: cotal login --idp ${info.idp.url}`));
227
+ return { userAuth: info, ok: true };
228
+ }
229
+ catch (e) {
230
+ console.error(c.red(`✗ user-auth service did not come up (${e.message}) - user connects to "${space}" will fail until a re-\`cotal up\` succeeds`));
231
+ return { userAuth: assertUserAuthInfo(setup.prepared.publicAuth), ok: false };
232
+ }
233
+ }
125
234
  /** `cotal up -f cotal.yaml` — bring up a FRESH mesh from a manifest (broker + channels + booted
126
235
  * agents). `up -f` is a broker-CREATION command: `broker.servers` is the bind address for the NEW
127
236
  * local broker, never a connect target. A broker already reachable there (local OR remote) means
@@ -137,7 +246,23 @@ async function upManifest(file, opts) {
137
246
  failManifest(e);
138
247
  }
139
248
  if (opts.runtime && !["pty", "tmux", "cmux"].includes(opts.runtime)) {
140
- console.error(c.red(`✗ unknown --runtime "${opts.runtime}" expected pty, tmux, or cmux`));
249
+ console.error(c.red(`✗ unknown --runtime "${opts.runtime}" - expected pty, tmux, or cmux`));
250
+ process.exit(1);
251
+ }
252
+ // The auth-mode sources (flags vs manifest) must AGREE — any mismatch names both sources and the
253
+ // exact correction in one sentence (a no-fallback identity decision, never a bare enum error).
254
+ const declared = prepared.manifest.broker?.auth;
255
+ const declaredStr = declared === undefined ? '"static" (the unset default)' : JSON.stringify(declared);
256
+ if (opts.open && declared === "user") {
257
+ console.error(c.red('✗ --open contradicts this manifest\'s broker.auth: "user" - a user-auth space cannot run unauthenticated. Drop --open, or change the manifest.'));
258
+ process.exit(1);
259
+ }
260
+ if (opts.userAuth && declared !== "user") {
261
+ console.error(c.red(`✗ --user-auth requires manifest broker.auth: "user" (this manifest's broker.auth is ${declaredStr}). Either set broker.auth: "user" in the manifest, or drop --user-auth.`));
262
+ process.exit(1);
263
+ }
264
+ if (opts.idp && declared !== "user") {
265
+ console.error(c.red(`✗ --idp is for user-auth spaces (this manifest's broker.auth is ${declaredStr}) - set broker.auth: "user" in the manifest, or drop --idp.`));
141
266
  process.exit(1);
142
267
  }
143
268
  // Apply CLI overrides to one effective manifest (flag > manifest > default) so render + seed +
@@ -147,6 +272,7 @@ async function upManifest(file, opts) {
147
272
  const server = m.broker?.servers ?? DEFAULT_SERVER;
148
273
  const host = m.broker?.host ?? "127.0.0.1";
149
274
  const open = m.broker?.auth === false; // default is auth
275
+ const userAuth = m.broker?.auth === "user" ? { idpUrl: opts.idp ?? m.broker?.idp } : undefined; // flag > manifest
150
276
  const runtime = m.runtime ?? "pty";
151
277
  if (opts.dryRun) {
152
278
  console.log(renderUpPlan(eff, server));
@@ -154,7 +280,7 @@ async function upManifest(file, opts) {
154
280
  }
155
281
  // up -f never adopts a running broker. Reachable at the bind address ⇒ redirect to spawn -f.
156
282
  if (await isReachable(server)) {
157
- console.error(c.red(`✗ ${server} already has a broker deploy this manifest onto it with \`cotal spawn -f ${file}\``));
283
+ console.error(c.red(`✗ ${server} already has a broker - deploy this manifest onto it with \`cotal spawn -f ${file}\``));
158
284
  process.exit(1);
159
285
  }
160
286
  // Connectors + their required binaries must exist before any mutation (no fallback).
@@ -163,21 +289,39 @@ async function upManifest(file, opts) {
163
289
  console.error(c.red(`✗ connector preflight failed: ${conn}`));
164
290
  process.exit(1);
165
291
  }
292
+ // USER-AUTH manifest: the agents run under the LOGGED-IN operator's owner, and the launch spec
293
+ // (consumed by the manager at boot) must carry it — so resolve it NOW. On a fresh mesh the
294
+ // derivation material doesn't exist yet; ensure it just-in-time (authSetup + prepareServer are
295
+ // idempotent ensure-* — the same contract the refresh-heal path already rides). Not logged in /
296
+ // no provider = the exact recovery sentence, before anything boots.
297
+ let owner;
298
+ if (userAuth) {
299
+ try {
300
+ mkdirSync(cotalPath("nats"), { recursive: true });
301
+ const setup = await authSetup(cotalPath("nats"), server, m.space, host, userAuth);
302
+ owner = await resolveAuthProvider().ownerForLogin({ dir: setup.stateDir, space: m.space });
303
+ }
304
+ catch (e) {
305
+ console.error(c.red(`✗ ${e.message}`));
306
+ process.exit(1);
307
+ }
308
+ }
166
309
  // The resolved launch spec is written FIRST so the ONE control-plane manager that comes up with
167
310
  // the broker (inside startMeshDetached) carries it. Exactly one manager serves a space (the
168
311
  // singleton lease): a second `supervise` started here for the launch would race the plain one for
169
312
  // the lease — the loser refuses, so either the agents never boot or the incumbent is orphaned
170
313
  // behind an overwritten pid file. The manager materializes each transient persona and mints creds
171
314
  // from the resolved policy — never re-reading a file for authority.
172
- const specPath = writeLaunchSpec(cotalRoot(), buildLaunchSpec(eff, genRunId()));
315
+ const specPath = writeLaunchSpec(cotalRoot(), buildLaunchSpec(eff, genRunId(), owner));
173
316
  // A leftover detached manager (its broker is gone — the reachability check above proved nothing
174
317
  // lives at this address) would win the fresh mesh's lease and the launch manager would refuse.
175
318
  // Stop it, so the manager started below WITH the launch spec is THE manager.
176
319
  stopManager();
177
320
  let pid;
178
321
  let controlPlane = false;
322
+ let authService = true;
179
323
  try {
180
- ({ pid, controlPlane } = await startMeshDetached({ server, space: m.space, open, host, seed: manifestToChannels(eff), runtime, launch: specPath }));
324
+ ({ pid, controlPlane, authService } = await startMeshDetached({ server, space: m.space, open, userAuth, host, seed: manifestToChannels(eff), runtime, launch: specPath }));
181
325
  }
182
326
  catch (e) {
183
327
  console.error(c.red(`✗ ${e.message}`));
@@ -188,10 +332,11 @@ async function upManifest(file, opts) {
188
332
  // Never claim a launch the control plane can't deliver: the manager carries the launch spec, so a
189
333
  // degraded control plane (announced above) means the agents are NOT coming up.
190
334
  if (controlPlane) {
191
- console.log(c.green(`✓ launching ${eff.agents.length} agent(s)`) + c.dim(` via manager (${runtime}) see .cotal/manager.log`));
335
+ // U6: on a user mesh the agents run under the OPERATOR's identitysay whose they are.
336
+ console.log(c.green(`✓ launching ${eff.agents.length} agent(s)`) + c.dim(` via manager (${runtime})${owner ? ` as you (owner ${owner})` : ""} - see .cotal/manager.log`));
192
337
  }
193
338
  else {
194
- console.error(c.red(`✗ ${eff.agents.length} agent(s) NOT launched the control plane did not come up (see above)`));
339
+ console.error(c.red(`✗ ${eff.agents.length} agent(s) NOT launched - the control plane did not come up (see above)`));
195
340
  }
196
341
  // Loud summary: any persona-inherited access an `include` manifest dragged in, plus warnings.
197
342
  const inherited = renderInherited(eff);
@@ -200,6 +345,11 @@ async function upManifest(file, opts) {
200
345
  if (eff.warnings.length)
201
346
  console.log("\n" + renderWarnings(eff.warnings));
202
347
  console.log(c.dim(`\nWatch: \`cotal console --space ${m.space}\` or \`cotal web\` · Tear down: \`cotal down\``));
348
+ // A declared-user-auth manifest whose auth service never became ready: the mesh is up + recorded
349
+ // (re-`cotal up` heals), but this launch did not deliver a usable identity plane — exit non-zero
350
+ // so CI/wrappers don't read success (the red consequence line printed at the failure above).
351
+ if (!authService)
352
+ process.exitCode = 1;
203
353
  }
204
354
  /** Return a copy of the prepared manifest with CLI overrides applied to broker/space/runtime, so the
205
355
  * whole launch (render, seed, broker, manager, launch spec) runs against one effective manifest. */
@@ -239,7 +389,7 @@ async function startDeliveryWithBroker(space, server, mgr) {
239
389
  // Non-fatal (live messaging is unaffected) — but never SILENT: without the manager,
240
390
  // `spawn --detach` / cotal_spawn have no responder, and the operator must hear it here,
241
391
  // not as an unexplained "no manager reachable" later.
242
- console.error(c.dim(`! control plane degraded: ${e.message} durable delivery/manager may be down; start one with: cotal supervise`));
392
+ console.error(c.dim(`! control plane degraded: ${e.message} - durable delivery/manager may be down; start one with: cotal supervise`));
243
393
  return false;
244
394
  }
245
395
  }
@@ -252,15 +402,16 @@ async function startDeliveryWithBroker(space, server, mgr) {
252
402
  */
253
403
  export async function startMeshDetached(opts = {}) {
254
404
  const server = opts.server ?? DEFAULT_SERVER;
255
- const storeDir = opts.storeDir ? resolve(opts.storeDir) : cotalPath("nats");
256
- mkdirSync(storeDir, { recursive: true });
257
405
  const useAuth = !opts.open;
258
406
  const space = opts.space ?? resolveSpace(process.cwd());
259
- assertAuthMatchesSpace(useAuth, space);
407
+ ensureRootForSpace(useAuth, space); // may pin the cwd as this space's root — before any cotalPath use
408
+ refuseOpenOverUserState(Boolean(opts.open), space);
409
+ const storeDir = opts.storeDir ? resolve(opts.storeDir) : cotalPath("nats");
410
+ mkdirSync(storeDir, { recursive: true });
260
411
  await claimSpace(space, server, cotalRoot());
261
412
  const seedFile = opts.seed ?? loadChannelsFile(opts.channels);
262
413
  const host = opts.host ?? "127.0.0.1";
263
- const setup = useAuth ? await authSetup(storeDir, server, space, host) : undefined;
414
+ const setup = useAuth ? await authSetup(storeDir, server, space, host, opts.userAuth) : undefined;
264
415
  const port = Number(new URL(server).port) || 4222;
265
416
  const args = setup ? ["-c", setup.confPath] : ["-js", "-sd", storeDir, "-p", String(port), "-a", host];
266
417
  const { bin, source } = await resolveNatsServer();
@@ -277,28 +428,61 @@ export async function startMeshDetached(opts = {}) {
277
428
  tailing = false;
278
429
  if (!ready) {
279
430
  child.kill("SIGTERM");
280
- throw new Error(`nats-server did not become reachable at ${server} see ${logPath}`);
431
+ throw new Error(`nats-server did not become reachable at ${server} - see ${logPath}`);
281
432
  }
282
433
  writeFileSync(cotalPath("nats.pid"), String(child.pid));
283
434
  await postStart(server, space, setup, seedFile);
435
+ // USER MODE: the auth service comes up FIRST among the daemons (see the foreground path).
436
+ const svc = await startUserAuthService(space, server, setup);
437
+ // Record BEFORE the control plane: the manager's fail-closed mode detection needs the
438
+ // authoritative registry entry at boot (marker-without-registry refuses). Detached: the entry
439
+ // outlives this process — `cotal down` removes it.
440
+ recordOurMesh({
441
+ space, server, root: cotalRoot(),
442
+ mode: setup?.prepared ? "user" : useAuth ? "auth" : "open",
443
+ ...(svc.userAuth ? { userAuth: svc.userAuth } : {}),
444
+ ts: new Date().toISOString(),
445
+ });
284
446
  // Bring up the delivery daemon WITH the detached broker (auth mode only; `cotal down` tears both down).
285
447
  const controlPlane = await startDeliveryWithBroker(space, server, { runtime: opts.runtime, launch: opts.launch });
286
- // Detached: the registry entry outlives this process `cotal down` removes it.
287
- recordOurMesh({ space, server, root: cotalRoot(), mode: useAuth ? "auth" : "open", ts: new Date().toISOString() });
288
- return { server, pid: child.pid ?? 0, source, controlPlane };
448
+ return { server, pid: child.pid ?? 0, source, controlPlane, authService: svc.ok };
449
+ }
450
+ /** THE FLIP, open-boot edition: `--open` must never boot a credless broker over a root whose
451
+ * space has user-auth state on disk — that would serve the space's existing JetStream store to
452
+ * anyone and re-record the mesh "open" over its user entry. The same fail-closed rule authSetup
453
+ * enforces for static re-ups, applied to the one boot path that skips authSetup entirely. */
454
+ function refuseOpenOverUserState(open, space) {
455
+ if (!open)
456
+ return;
457
+ const stateDir = userAuthStateDir(cotalRoot(), space);
458
+ if (!existsSync(stateDir))
459
+ return;
460
+ console.error(c.red(`✗ space "${space}" has user auth enabled (state under ${stateDir}) - \`--open\` would serve its streams without auth. Start it with \`cotal up --user-auth\`, or remove that directory deliberately to disable user auth (existing logins/grants die with it)`));
461
+ process.exit(1);
289
462
  }
290
- /** Today a root's `.cotal/auth` is created for one space (its account is space-bound), so starting it
291
- * under a *different* explicit `--space` would run that space's name against the other space's trust
292
- * material — the registry would then point a `spawn --space` at mismatched creds. Reject it. (When
293
- * multi-space-per-root lands, this becomes provision-the-new-space instead of an error.) */
294
- function assertAuthMatchesSpace(useAuth, space) {
463
+ /** Today a root's `.cotal/auth` is created for one space (its account is space-bound), so an
464
+ * explicit `--space` naming a different space cannot run against this root's trust material — the
465
+ * registry would point a `spawn --space` at mismatched creds. A mismatch only exists when
466
+ * `--space` was given (the default IS this root's space): clear intent for a different mesh. When
467
+ * the root was merely inherited from an ancestor folder (the cwd has no `.cotal` of its own),
468
+ * honor that intent — make the cwd the new space's own root. Only a folder that itself holds the
469
+ * other space's material refuses. (When multi-space-per-root lands, that refusal becomes
470
+ * provision-the-new-space instead.) */
471
+ function ensureRootForSpace(useAuth, space) {
295
472
  if (!useAuth)
296
473
  return;
297
- const existing = loadSpaceAuth(authDir(cotalRoot()));
298
- if (existing && existing.space !== space) {
299
- console.error(c.red(`✗ this root's trust material is for space "${existing.space}", not "${space}" — drop \`--space\` (it defaults to "${existing.space}"), or run "${space}" from its own root`));
300
- process.exit(1);
474
+ const root = cotalRoot();
475
+ const existing = loadSpaceAuth(authDir(root));
476
+ if (!existing || existing.space === space)
477
+ return;
478
+ const cwd = process.cwd();
479
+ if (root !== cwd) {
480
+ mkdirSync(join(cwd, ".cotal"), { recursive: true });
481
+ console.log(c.dim(`nearest mesh root ${root} is space "${existing.space}" - making this folder its own root for "${space}"`));
482
+ return;
301
483
  }
484
+ console.error(c.red(`✗ this folder is the root of space "${existing.space}" (${authDir(root)}), so it can't also run "${space}" - drop \`--space\` to run "${existing.space}", or start "${space}" from a different folder (it becomes that mesh's own root)`));
485
+ process.exit(1);
302
486
  }
303
487
  /** A space name maps to one mesh in the registry (the key `--space`/`use`/`down` act on). Before
304
488
  * starting a broker, refuse to reuse a space already claimed by a DIFFERENT live mesh — a stale/dead
@@ -311,7 +495,7 @@ async function claimSpace(space, server, root) {
311
495
  if (!existing || (existing.server === server && existing.root === root))
312
496
  return;
313
497
  if (await isReachable(existing.server)) {
314
- console.error(c.red(`✗ space "${space}" is already in use by a mesh at ${existing.server} (${existing.root}) pick a different \`--space\`, or \`cotal down\` it first`));
498
+ console.error(c.red(`✗ space "${space}" is already in use by a mesh at ${existing.server} (${existing.root}) - pick a different \`--space\`, or \`cotal down\` it first`));
315
499
  process.exit(1);
316
500
  }
317
501
  removeMesh(space); // the prior holder's broker is gone — reclaim the name
@@ -329,7 +513,7 @@ function recordOurMesh(m) {
329
513
  return;
330
514
  }
331
515
  if (usableCurrent !== m.space)
332
- console.log(c.dim(`"${m.space}" up; current is still "${usableCurrent}" \`cotal use ${m.space}\` to switch`));
516
+ console.log(c.dim(`"${m.space}" up; current is still "${usableCurrent}" - \`cotal use ${m.space}\` to switch`));
333
517
  }
334
518
  /** Poll a growing log file and forward newly-appended lines until `stopped()` is true. */
335
519
  function tailLines(path, from, onLine, stopped) {
@@ -427,8 +611,14 @@ function loadChannelsFile(explicit) {
427
611
  }
428
612
  /** Ensure the space's trust material exists, render a server config, and mint a privileged
429
613
  * setup creds (used to pre-create streams once the server is up). The account signing key
430
- * in `.cotal/auth` is what `cotal mint` and the manager later use to issue per-agent creds. */
431
- async function authSetup(storeDir, server, space, host = "127.0.0.1") {
614
+ * in `.cotal/auth` is what `cotal mint` and the manager later use to issue per-agent creds.
615
+ *
616
+ * USER MODE (`user` set): additionally run the registered auth provider's `prepareServer` over the
617
+ * SPACE-SCOPED state dir (`.cotal/auth/<space>/` — the multi-space-ready layout; nothing user-auth
618
+ * lives flat) and preload its extra account(s) into the broker config. The inverse is fail-closed:
619
+ * a space whose user-auth state exists MUST keep being started with --user-auth — regenerating the
620
+ * config without the callout account would silently break every sentinel connect. */
621
+ async function authSetup(storeDir, server, space, host = "127.0.0.1", user) {
432
622
  const dir = authDir(cotalRoot());
433
623
  let auth = loadSpaceAuth(dir);
434
624
  if (!auth) {
@@ -436,14 +626,39 @@ async function authSetup(storeDir, server, space, host = "127.0.0.1") {
436
626
  saveSpaceAuth(dir, auth); // strips the $SYS seed on disk, but leaves the in-memory `auth` intact …
437
627
  await provisionMembershipCreds(auth); // … so the observer can still be minted here (fresh-space only)
438
628
  }
629
+ const stateDir = userAuthStateDir(cotalRoot(), space); // the provider's space-scoped state dir
630
+ if (!user && existsSync(stateDir)) {
631
+ console.error(c.red(`✗ space "${space}" has user auth enabled (state under ${stateDir}) - start it with \`--user-auth\`, or remove that directory deliberately to disable user auth (existing logins/grants die with it)`));
632
+ process.exit(1);
633
+ }
634
+ let prepared;
635
+ if (user) {
636
+ // Registry composition: the provider came from the composition root (bin/cotal.ts imports
637
+ // @cotal-ai/auth); this package never imports it. No provider ⇒ resolveAuthProvider throws the
638
+ // exact fix. The narrow input is a capability boundary: operator seed (signs the provider's
639
+ // account once) + the data account's pub/signingSeed (projected for the service's minting duty).
640
+ try {
641
+ prepared = await resolveAuthProvider().prepareServer({
642
+ space,
643
+ operatorSeed: auth.operator.seed,
644
+ account: { pub: auth.account.pub, signingSeed: auth.account.signingSeed },
645
+ dir: stateDir,
646
+ idpUrl: user.idpUrl,
647
+ });
648
+ }
649
+ catch (e) {
650
+ console.error(c.red(`✗ ${e.message}`));
651
+ process.exit(1);
652
+ }
653
+ }
439
654
  const port = Number(new URL(server).port) || 4222;
440
655
  const confPath = resolve(dir, "server.conf");
441
- writeFileSync(confPath, serverConfig(auth, { port, storeDir, host }));
656
+ writeFileSync(confPath, serverConfig(auth, { port, storeDir, host, ...(prepared ? { extraAccounts: prepared.extraAccounts } : {}) }));
442
657
  // Ephemeral setup cred: used only to probe reachability, pre-create the space streams/buckets
443
658
  // (setupSpaceStreams) and seed the channel registry (seedChannelRegistry) — all within the
444
659
  // enumerated `provisioner` scope. No broad `manager` residual for the up path.
445
660
  const creds = await mintCreds(auth, newIdentity(), "provisioner");
446
- return { confPath, creds };
661
+ return { confPath, creds, ...(prepared ? { prepared, stateDir } : {}) };
447
662
  }
448
663
  /** Mint the two scoped creds the delivery daemon's membership feed loads (broker-sourced graph
449
664
  * membership), at the FRESH `cotal up` while the in-memory `$SYS` signing seed still exists:
@@ -461,9 +676,15 @@ async function provisionMembershipCreds(auth) {
461
676
  try {
462
677
  const observer = await mintMembershipObserverCreds(auth, newIdentity());
463
678
  const rw = await mintCreds(auth, newIdentity(), "membership-rw");
679
+ // D5 slice 4: the KICK-only connection-evictor cred — same mint-only-at-fresh-`up` window as
680
+ // the observer ($SYS seed in memory here). The delivery daemon pairs it with the observer to
681
+ // close a revoked/removed principal's live connections. A space without it degrades to
682
+ // deny-new-only (durable reauth) — surfaced loudly by the removal path, never silent.
683
+ const evictor = await mintConnectionEvictorCreds(auth, newIdentity());
464
684
  mkSecretDir(cotalPath()); // harden .cotal/ before the creds land (born under a private ACL, no race)
465
685
  writeSecretFile(cotalPath("membership-observer.creds"), observer);
466
686
  writeSecretFile(cotalPath("membership-rw.creds"), rw);
687
+ writeSecretFile(cotalPath("connection-evictor.creds"), evictor);
467
688
  writeSecretFile(cotalPath("membership.json"), JSON.stringify({ accountId: auth.account.pub }));
468
689
  }
469
690
  catch (e) {