@cotal-ai/cli 0.16.0 → 0.17.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 (104) hide show
  1. package/dist/command.d.ts.map +1 -1
  2. package/dist/command.js +13 -0
  3. package/dist/command.js.map +1 -1
  4. package/dist/commands/agents.d.ts +5 -15
  5. package/dist/commands/agents.d.ts.map +1 -1
  6. package/dist/commands/agents.js +133 -72
  7. package/dist/commands/agents.js.map +1 -1
  8. package/dist/commands/clean.d.ts.map +1 -1
  9. package/dist/commands/clean.js +4 -3
  10. package/dist/commands/clean.js.map +1 -1
  11. package/dist/commands/describe.d.ts +72 -0
  12. package/dist/commands/describe.d.ts.map +1 -0
  13. package/dist/commands/describe.js +148 -0
  14. package/dist/commands/describe.js.map +1 -0
  15. package/dist/commands/doctor.d.ts.map +1 -1
  16. package/dist/commands/doctor.js +27 -8
  17. package/dist/commands/doctor.js.map +1 -1
  18. package/dist/commands/down-manifest.d.ts.map +1 -1
  19. package/dist/commands/down-manifest.js +38 -18
  20. package/dist/commands/down-manifest.js.map +1 -1
  21. package/dist/commands/down.d.ts +9 -0
  22. package/dist/commands/down.d.ts.map +1 -1
  23. package/dist/commands/down.js +38 -10
  24. package/dist/commands/down.js.map +1 -1
  25. package/dist/commands/ext.d.ts.map +1 -1
  26. package/dist/commands/ext.js +16 -10
  27. package/dist/commands/ext.js.map +1 -1
  28. package/dist/commands/join.d.ts.map +1 -1
  29. package/dist/commands/join.js +2 -4
  30. package/dist/commands/join.js.map +1 -1
  31. package/dist/commands/meshes-add.d.ts.map +1 -1
  32. package/dist/commands/meshes-add.js +23 -0
  33. package/dist/commands/meshes-add.js.map +1 -1
  34. package/dist/commands/models.d.ts.map +1 -1
  35. package/dist/commands/models.js +2 -2
  36. package/dist/commands/models.js.map +1 -1
  37. package/dist/commands/spawn-manifest.d.ts.map +1 -1
  38. package/dist/commands/spawn-manifest.js +22 -12
  39. package/dist/commands/spawn-manifest.js.map +1 -1
  40. package/dist/commands/spawn.d.ts +5 -0
  41. package/dist/commands/spawn.d.ts.map +1 -1
  42. package/dist/commands/spawn.js +4 -2
  43. package/dist/commands/spawn.js.map +1 -1
  44. package/dist/commands/status.js +25 -5
  45. package/dist/commands/status.js.map +1 -1
  46. package/dist/commands/up.d.ts +17 -2
  47. package/dist/commands/up.d.ts.map +1 -1
  48. package/dist/commands/up.js +640 -49
  49. package/dist/commands/up.js.map +1 -1
  50. package/dist/console/app.d.ts +1 -1
  51. package/dist/console/app.d.ts.map +1 -1
  52. package/dist/console/app.js +16 -5
  53. package/dist/console/app.js.map +1 -1
  54. package/dist/console/commands.d.ts.map +1 -1
  55. package/dist/console/commands.js +5 -5
  56. package/dist/console/commands.js.map +1 -1
  57. package/dist/console/root.d.ts.map +1 -1
  58. package/dist/console/root.js +6 -1
  59. package/dist/console/root.js.map +1 -1
  60. package/dist/index.d.ts.map +1 -1
  61. package/dist/index.js +23 -0
  62. package/dist/index.js.map +1 -1
  63. package/dist/lib/attach-client.d.ts +37 -4
  64. package/dist/lib/attach-client.d.ts.map +1 -1
  65. package/dist/lib/attach-client.js +88 -18
  66. package/dist/lib/attach-client.js.map +1 -1
  67. package/dist/lib/auth-proc.d.ts +3 -1
  68. package/dist/lib/auth-proc.d.ts.map +1 -1
  69. package/dist/lib/auth-proc.js +15 -4
  70. package/dist/lib/auth-proc.js.map +1 -1
  71. package/dist/lib/connect.d.ts +1 -1
  72. package/dist/lib/connect.d.ts.map +1 -1
  73. package/dist/lib/connect.js +1 -1
  74. package/dist/lib/connect.js.map +1 -1
  75. package/dist/lib/control.d.ts +42 -11
  76. package/dist/lib/control.d.ts.map +1 -1
  77. package/dist/lib/control.js +251 -44
  78. package/dist/lib/control.js.map +1 -1
  79. package/dist/lib/delivery-proc.d.ts +19 -4
  80. package/dist/lib/delivery-proc.d.ts.map +1 -1
  81. package/dist/lib/delivery-proc.js +129 -43
  82. package/dist/lib/delivery-proc.js.map +1 -1
  83. package/dist/lib/manager-proc.d.ts +48 -5
  84. package/dist/lib/manager-proc.d.ts.map +1 -1
  85. package/dist/lib/manager-proc.js +131 -30
  86. package/dist/lib/manager-proc.js.map +1 -1
  87. package/dist/lib/manifest/ledger.d.ts +52 -8
  88. package/dist/lib/manifest/ledger.d.ts.map +1 -1
  89. package/dist/lib/manifest/ledger.js +77 -19
  90. package/dist/lib/manifest/ledger.js.map +1 -1
  91. package/dist/lib/manifest/live.d.ts +21 -16
  92. package/dist/lib/manifest/live.d.ts.map +1 -1
  93. package/dist/lib/manifest/live.js +33 -20
  94. package/dist/lib/manifest/live.js.map +1 -1
  95. package/dist/lib/restore.d.ts.map +1 -1
  96. package/dist/lib/restore.js +21 -3
  97. package/dist/lib/restore.js.map +1 -1
  98. package/dist/view/mesh-view.js +2 -2
  99. package/dist/view/mesh-view.js.map +1 -1
  100. package/package.json +4 -3
  101. package/dist/lib/pid.d.ts +0 -23
  102. package/dist/lib/pid.d.ts.map +0 -1
  103. package/dist/lib/pid.js +0 -39
  104. package/dist/lib/pid.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"control.d.ts","sourceRoot":"","sources":["../../src/lib/control.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,OAAO,EACb,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EAAiB,KAAK,YAAY,EAAE,MAAM,cAAc,CAAC;AAEhE;2CAC2C;AAC3C,MAAM,MAAM,WAAW,GAAG;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,aAAa,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAEtF;;;;;wBAKwB;AACxB,eAAO,MAAM,gBAAgB,QAAS,CAAC;AAEvC;;;;;;;;;GASG;AACH,wBAAsB,oBAAoB,CACxC,KAAK,EAAE,YAAY,EACnB,OAAO,EAAE,OAAO,GACf,OAAO,CAAC;IAAE,KAAK,EA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,GAAG,OAAO,GAAG,KAAK,CAAC;AA0F3C;;;;;;;;;4DAS4D;AAC5D,wBAAsB,UAAU,CAC9B,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,EAAE,EAAE,MAAM,EACV,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9B,IAAI,GAAE,WAAgB,EACtB,KAAK,GAAE,YAAsB,EAC7B,SAAS,CAAC,EAAE,MAAM,EAClB,UAAU,CAAC,EAAE,MAAM,GAClB,OAAO,CAAC,YAAY,CAAC,CAYvB;AAED;;4GAE4G;AAC5G,MAAM,WAAW,oBAAoB;IACnC,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AACD,MAAM,MAAM,YAAY,GAAG;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,SAAS,EAAE,oBAAoB,EAAE,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AA6C1G;;;;8EAI8E;AAC9E,wBAAsB,cAAc,CAClC,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,EAAE,EAAE,MAAM,EACV,IAAI,GAAE,WAAgB,EACtB,SAAS,CAAC,EAAE,MAAM,GACjB,OAAO,CAAC,YAAY,CAAC,CAOvB;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,YAAY,GAAG,IAAI,CAUrD"}
@@ -1,7 +1,18 @@
1
- import { CotalEndpoint, DEFAULT_SPACE, CONTROL_PRIVILEGED, CONTROL_ADMIN, } from "@cotal-ai/core";
2
- import { authDir, endpointAuth, findCotalRoot, loadSpaceAuth, soleSpaceOf } from "@cotal-ai/workspace";
1
+ import { DEFAULT_SPACE, DEV_OWNER, BASELINE_LIFECYCLE_ENDPOINT, EpEnvelopeError, GOAL_BEARING_COMMANDS, invokeCommand, submitAndFollowGoal, scatterCommand, mintLifecycleUid, newIdentity, resolveService, standaloneConnectOpts, } from "@cotal-ai/core";
2
+ import { connect } from "@nats-io/transport-node";
3
+ import { authDir, endpointAuth, findCotalRoot, isWorkspaceTargetError, loadSpaceAuth, resolveMeshTarget, pruneStaleMeshes, renderWorkspaceError, soleSpaceOf, } from "@cotal-ai/workspace";
3
4
  import { c, staleStoreHint } from "../ui.js";
4
- import { connectOrExit } from "./connect.js";
5
+ import { connectOrExit, connectUserControlOrExit } from "./connect.js";
6
+ /** The only {@link MeshTargetErrorCode}s that mean "there is NO registry entry here", and so the
7
+ * only ones the mode peek in {@link resolveControlTarget} may absorb. **Every other code is
8
+ * NON-ABSENCE and must fail loud** — which is the precise claim, and covers more than one
9
+ * situation: `stale-auth-root` / `unreadable-auth` / `user-auth-unrecorded` are an entry that
10
+ * exists and is broken, while `ambiguous-target` can be several perfectly healthy entries and
11
+ * `default-occupied` an intended local target with no entry at all. What unites them is not
12
+ * breakage, it is that absence has NOT been established, so falling through to a
13
+ * credential-less raw-open connect would be unsound. Deliberately a closed allow-list, not a
14
+ * deny-list: a new code defaults to failing loud. */
15
+ const TARGET_ABSENT_CODES = new Set(["unknown-space", "no-meshes"]);
5
16
  /** Client-side request window for the manager's readiness-waiting launch ops (`start`, and the
6
17
  * manifest `launch` — both funnel into the same startAgent readiness wait). #159 B1: the manager
7
18
  * replies only on a REAL outcome — presence join, process exit, or its ~30s readiness backstop —
@@ -23,58 +34,254 @@ export async function resolveControlTarget(flags, profile) {
23
34
  const withSpace = flags.creds
24
35
  ? { ...flags, space: flags.space ?? soleSpaceOf(authDir(findCotalRoot())) ?? DEFAULT_SPACE }
25
36
  : flags;
26
- // USER MODE rides through: the control call connects with the operator's bearer (actor `cli`) and
27
- // publishes on its OWN ctl principal subject the broker grants that publish only when the cli
28
- // actor's ledger scope carries the matching capability (`spawn` privileged, `admin` admin).
29
- // The preflight probe STAYS, and the duplicate handshake with it. Removing it saved one connect
30
- // per control command, and cost two things worth more: the classified failure (a live broker
31
- // rejecting stale registry creds reads as `registry-creds-rejected`/`stale-auth` with the right
32
- // repair, not "is it running? run cotal up"), and the probe's 8s bound — `CotalEndpoint` passes no
33
- // connect timeout, so nats-core's 20s default would apply and a blackholed target would hang more
34
- // than twice as long to produce worse copy. Reusing the real connection is the right idea; it needs
35
- // the endpoint to accept a deadline and the classifier to move with it, which is not this change.
37
+ // USER MODE: ledger-scoped bearer is the control surface; there is no instrument mint.
38
+ // `connectOrExit` refuses control-caller-* on a user mesh (those profiles carry freeze rows the
39
+ // bearer does not hold). Route through {@link connectUserControlOrExit}, which takes NO role
40
+ // a dummy Profile would be meaningless today and wrong the day the user path starts consulting
41
+ // it. Declared translation at this layer (the one that knows), not a silent substitute inside
42
+ // connectOrExit.
43
+ //
44
+ // Cost: the target is resolved here for the mode check and again inside the connect helper.
45
+ // Accepted for this slice so mode choice stays where it is knowable. The two reads are not
46
+ // atomic; a mesh that flips mode between them is an operator action mid-command.
47
+ //
48
+ // This peek reads the MODE and NOTHING ELSE — it must never decide the command's fate. It used
49
+ // to run through `resolveTargetOrExit`, which EXITS on a WorkspaceTargetError, so it killed a
50
+ // legitimate input on the way past: `--server` with an UNREGISTERED `--space` is the raw-open
51
+ // escape hatch, and by definition it has no registry entry to carry a mode. Resolve through the
52
+ // THROWING form instead and read ABSENCE as "not a registry mesh, therefore not user mode",
53
+ // leaving that path to `connectOrExit` below, which owns it.
54
+ //
55
+ // ABSENCE ONLY. The two absent codes are the entire escape hatch; every other
56
+ // MeshTargetErrorCode is NON-ABSENCE, and swallowing those is a
57
+ // fallback, not a restoration. `stale-auth-root` is the one that bites: `targetFromEntry`
58
+ // PRUNES the entry before throwing it, so absorbing it leaves `connectOrExit` seeing no
59
+ // registration at all — and with an explicit `--server` it then takes the raw-open arm and
60
+ // connects with NO CREDENTIALS. A misconfigured AUTH mesh would silently become an OPEN one,
61
+ // hiding the misconfiguration and switching identity planes under the operator. Those codes
62
+ // rethrow and the command dies loud, exactly as it did before this peek existed.
63
+ // Raw `--creds` skips the peek entirely (static/raw path below).
64
+ if (!withSpace.creds) {
65
+ // Sweep first when no space is named, exactly as `resolveTargetOrExit` does before ITS
66
+ // resolve. Without it the peek reads a world `connectOrExit` never sees: a dead entry
67
+ // alongside a live one makes a bare resolve `ambiguous-target` here while the connect,
68
+ // having pruned, resolves the single survivor cleanly. Same sweep, same view, one answer.
69
+ if (!withSpace.space)
70
+ await pruneStaleMeshes();
71
+ let mode;
72
+ try {
73
+ mode = resolveMeshTarget(process.cwd(), { server: withSpace.server, space: withSpace.space }).mode;
74
+ }
75
+ catch (e) {
76
+ // Non-absence propagates and ends the command. It is rethrown rather than rendered-and-exited
77
+ // here so this function stays composable and testable; the CLI boundary renders every
78
+ // WorkspaceTargetError through `renderWorkspaceError` (see the dispatcher's catch), which is
79
+ // what turns "entry X points at a root holding Y" into the removed-fact plus a recovery line.
80
+ if (!isWorkspaceTargetError(e) || !TARGET_ABSENT_CODES.has(e.code))
81
+ throw e;
82
+ }
83
+ if (mode === "user") {
84
+ const conn = await connectUserControlOrExit(withSpace);
85
+ return {
86
+ space: conn.space,
87
+ server: conn.server,
88
+ auth: { ...endpointAuth(conn), ...(conn.epCaller ? { epCaller: conn.epCaller } : {}) },
89
+ };
90
+ }
91
+ }
92
+ // Static / open / raw-creds: mint the requested instrument (or bare open connect).
36
93
  const conn = await connectOrExit(withSpace, profile);
37
- return { space: conn.space, server: conn.server, auth: endpointAuth(conn) };
94
+ return {
95
+ space: conn.space,
96
+ server: conn.server,
97
+ auth: { ...endpointAuth(conn), ...(conn.epCaller ? { epCaller: conn.epCaller } : {}) },
98
+ };
99
+ }
100
+ /** v0.3 ctl op → v0.4 typed command (P2 item 1, 1c.2b): the wire names the manager REGISTERS
101
+ * (manager-service-contract ROWS). `start` is creation (`spawn`), a NAMED `stop` is the one
102
+ * owner/any-mode terminal (`despawn`), the per-agent `status` read is `inspect`; the camelCase
103
+ * admin family maps to its kebab-case wire names. `targeted` marks the two commands whose
104
+ * `{name}` argument becomes a §13.2 target block (resolved to the agent's principal triple via
105
+ * the name-keyed `inspect` read — it rides the spawn capability arm, so resolution reach equals
106
+ * despawn/attach reach; the wire target is (owner, actor, lifecycleUid), never an alias). */
107
+ const EP_COMMANDS = {
108
+ start: { command: "spawn" },
109
+ stop: { command: "despawn", targeted: true },
110
+ attach: { command: "attach", targeted: true },
111
+ status: { command: "inspect" },
112
+ ps: { command: "ps" },
113
+ models: { command: "models" },
114
+ launch: { command: "launch" },
115
+ purge: { command: "purge" },
116
+ resumePreserved: { command: "resume-preserved" },
117
+ commitResume: { command: "commit-resume" },
118
+ finalizeResume: { command: "finalize-resume" },
119
+ preparePreservation: { command: "prepare-preservation" },
120
+ commitPreservation: { command: "commit-preservation" },
121
+ abortPreservation: { command: "abort-preservation" },
122
+ };
123
+ /** The ep-rail control call — since 1d {@link askManager}'s ONLY path: one short-lived raw
124
+ * connection, a fresh `resolveService` (describe → §13.7 store fetch → digest-verified recompile
125
+ * — the generic item-5 caller, no hand-imported manager schemas), then the mapped command.
126
+ * Targeted ops resolve the alias to its CURRENT principal triple through the name-keyed
127
+ * `inspect` read first and ride mode `any` (admin instruments) or `owner` per {@link
128
+ * ControlReach}. */
129
+ async function askManagerEp(space, server, op, args, auth, reach, timeoutMs, instanceId) {
130
+ const mapped = EP_COMMANDS[op];
131
+ if (!mapped)
132
+ return { ok: false, error: `unknown manager op "${op}" (no v0.4 command mapping)` };
133
+ const caller = auth.epCaller;
134
+ // standaloneConnectOpts handles all three auth shapes: static creds, the user bearer + sentinel
135
+ // (client-chosen inbox nonce; the callout scopes the reply inbox on it), or BARE on an open
136
+ // mesh (no credential system; the broker enforces nothing).
137
+ const nc = await connect({
138
+ servers: server,
139
+ ...standaloneConnectOpts(auth.creds ? { creds: auth.creds, tls: auth.tls === true } : auth.bearer ? { bearer: auth.bearer, sentinelCreds: auth.sentinelCreds, tls: auth.tls === true } : { tls: auth.tls === true }),
140
+ maxReconnectAttempts: 0,
141
+ });
142
+ try {
143
+ // P2 item 3 `--on <instance>`: pin the resolve to the exact manager instance's `inst` route so a
144
+ // multi-manager space addresses the intended manager, never whichever wins the class anycast.
145
+ const service = await resolveService(nc, space, BASELINE_LIFECYCLE_ENDPOINT, caller, { deadlineMs: 10_000, ...(instanceId !== undefined ? { instanceId } : {}) });
146
+ let target;
147
+ let sendArgs = args;
148
+ if (mapped.targeted) {
149
+ const name = String(args?.name ?? "").trim();
150
+ if (!name)
151
+ return { ok: false, error: `${op} requires a name` };
152
+ // Alias -> CURRENT principal triple via the manager's name-keyed `inspect` read (§13.2: a
153
+ // target is a triple, never an alias) - the same resolution the connector uses. `inspect`
154
+ // rides the SPAWN capability arm as well as the instrument read set, so every caller class
155
+ // that can despawn/attach can also resolve its target (a `ps` SCAN here broker-drops exactly
156
+ // the spawn-scoped user bearers - the 1c.2b read narrowing - and hangs their stop/attach).
157
+ const info = await invokeCommand(nc, space, service, "inspect", { name }, { deadlineMs: 10_000 });
158
+ if (info.reply.ok !== true)
159
+ return { ok: false, error: `could not resolve "${name}": ${info.reply.error?.message ?? info.reply.error?.code ?? "inspect failed"}` };
160
+ const row = info.reply.data;
161
+ // A STATIC row's `id` is the bare actor under the caller's own owner; a USER-mode row's `id`
162
+ // is the composite `owner.actor` principal key - split it (an embedded dot would break the
163
+ // target block's subject arity). Mode `any` spans owners (operator reach); mode `owner` pins
164
+ // the caller's own, so a foreign-owner target is broker-denied at publish.
165
+ const dot = row.id.indexOf(".");
166
+ const [tOwner, tActor] = dot > 0 ? [row.id.slice(0, dot), row.id.slice(dot + 1)] : [caller.owner, row.id];
167
+ // Target mode from the RESOLVED target owner: an own-domain target rides `owner` mode (pinned
168
+ // to the caller's own owner); a CROSS-owner target rides `any` mode - which the broker admits
169
+ // only for a caller holding the admin instrument rows (a static admin instrument, or a user
170
+ // bearer whose ledger `admin` scope the callout minted them into). `reach: "any"` forces
171
+ // any-mode for a static admin instrument even on its own domain. So a spawn-scoped caller's
172
+ // cross-owner despawn/attach is broker-denied at publish (no any-mode row), while an
173
+ // admin-scoped operator's is admitted and the manager's fresh ledger check governs.
174
+ const mode = reach === "any" || tOwner !== caller.owner ? "any" : "owner";
175
+ target = {
176
+ mode,
177
+ owner: tOwner,
178
+ actor: tActor,
179
+ lifecycleUid: row.lifecycleUid,
180
+ };
181
+ const { name: _dropped, ...rest } = args ?? {};
182
+ sendArgs = Object.keys(rest).length ? rest : undefined;
183
+ }
184
+ const invokeOpts = { ...(target ? { target } : {}), deadlineMs: timeoutMs ?? 10_000 };
185
+ const submit = () => invokeCommand(nc, space, service, mapped.command, sendArgs, invokeOpts);
186
+ // P2 item 2 (2b): a goal-bearing command (spawn/launch) FOLLOWS its acceptance to the goal
187
+ // terminal, so `spawn --detach` still returns on the real outcome (join / exit / ~30s uncertain)
188
+ // exactly like the pre-action blocking reply — UX unchanged, no --no-wait.
189
+ const r = GOAL_BEARING_COMMANDS.includes(mapped.command)
190
+ ? await submitAndFollowGoal(nc, space, BASELINE_LIFECYCLE_ENDPOINT, caller, timeoutMs ?? START_TIMEOUT_MS, submit)
191
+ : await submit();
192
+ if (r.reply.ok !== true)
193
+ return { ok: false, error: r.reply.error?.message ?? r.reply.error?.code ?? "error" };
194
+ // The ep `models` reply is normalized to `{catalogs}` — unwrap so call sites keep the ctl shape.
195
+ const data = mapped.command === "models" ? r.reply.data.catalogs : r.reply.data;
196
+ return { ok: true, ...(data !== undefined ? { data } : {}) };
197
+ }
198
+ catch (e) {
199
+ const msg = e instanceof EpEnvelopeError ? `${e.code}: ${e.message}` : e.message;
200
+ return { ok: false, error: `no manager reachable on the ep rails (${msg})` };
201
+ }
202
+ finally {
203
+ await nc.drain().catch(() => nc.close());
204
+ }
205
+ }
206
+ /** Send one control command to the manager over the v0.4 service-endpoint rails and disconnect —
207
+ * since 1d the manager's ONLY control door (the `ctl` tiers are deleted). The target is already
208
+ * reachability- + auth-preflighted by {@link resolveControlTarget}. `reach` picks the operator
209
+ * mode for the two targeted ops (stop/attach): `owner` = the caller's own domain (the spawn
210
+ * capability's standing mint / a user bearer's own owner), `any` = the admin instrument's
211
+ * cross-agent reach. Three auth shapes reach the rails: a static instrument's caller triple, a
212
+ * user bearer's triple, or an OPEN mesh (no credential system — a bare connection under a
213
+ * synthesized DEV_OWNER triple, since the manager registered under DEV_OWNER and the broker
214
+ * enforces nothing). A raw `--creds` file from an older generation carries no ep rows and is
215
+ * refused loud (no silent ctl fallback exists anymore). */
216
+ export async function askManager(space, server, op, args, auth = {}, reach = "owner", timeoutMs, instanceId) {
217
+ // A user bearer or a minted static instrument carries its own ep caller triple: ride it.
218
+ if (auth.epCaller && (auth.creds || (auth.bearer && auth.sentinelCreds)))
219
+ return askManagerEp(space, server, op, args, auth, reach, timeoutMs, instanceId);
220
+ // A raw `--creds` file with NO minted triple is a pre-1c generation's cred (no ep rows). The ctl
221
+ // rail it used to ride is gone (1d), so refuse loud with the recovery rather than hang.
222
+ if (auth.creds)
223
+ return { ok: false, error: `this --creds file predates the v0.4 control surface (no endpoint-serve rows); re-mint it with a current cotal, or drive the manager from its project folder (\`cotal ps\`/\`cotal stop\`) which mints the instrument for you` };
224
+ // OPEN mesh: no credential system. The manager registered its service under DEV_OWNER and the
225
+ // broker enforces nothing, so synthesize a fresh DEV_OWNER caller triple and connect bare.
226
+ const openAuth = { epCaller: { owner: DEV_OWNER, actor: newIdentity().id, uid: mintLifecycleUid() } };
227
+ return askManagerEp(space, server, op, args, openAuth, reach, timeoutMs, instanceId);
38
228
  }
39
- /** Connect a short-lived client with the resolved creds, send one control request to the manager,
40
- * disconnect. The target is already reachability- + auth-preflighted by
41
- * {@link resolveControlTarget}, so this connects straight through. `tier` picks the control
42
- * subject: privileged for spawn --detach/ps and, on a user mesh, for stop/attach too (the
43
- * operator's bearer publishes there with scope "spawn"; the MANAGER authorizes owner-domain vs
44
- * ledger-admin). On a static mesh stop/attach stay admin-tier ops. `creds` is the tier-scoped
45
- * caller cred (`control-caller-privileged` / `control-caller-admin` — each holds ONLY its own
46
- * tier's pub grant), or undefined on an open mesh. */
47
- export async function askManager(space, server, op, args, auth = {}, tier = CONTROL_PRIVILEGED, timeoutMs) {
48
- const ep = new CotalEndpoint({
49
- space,
229
+ /** The ep-rail CLASS SCATTER (P2 item 3, `cotal ps` default): one short-lived connection, a fresh
230
+ * UNPINNED {@link resolveService} (any instance answers `describe` for the shared command surface),
231
+ * then {@link scatterCommand} freeze the live class from the records registry, publish once on the
232
+ * `all` rail, and gather one attributed reply per instance. Every frozen instance is accounted for:
233
+ * a reachable one carries its reply, a non-answering one is labeled unreachable (never omitted). */
234
+ async function askManagerScatterEp(space, server, op, auth, timeoutMs) {
235
+ const mapped = EP_COMMANDS[op];
236
+ if (!mapped)
237
+ return { ok: false, error: `unknown manager op "${op}" (no v0.4 command mapping)` };
238
+ if (mapped.targeted)
239
+ return { ok: false, error: `${op} is targeted and cannot be scattered across instances` };
240
+ const caller = auth.epCaller;
241
+ const nc = await connect({
50
242
  servers: server,
51
- ...auth,
52
- channels: [],
53
- consume: false, // request/reply only — binds no consumers (and under auth has no pre-created DM durable)
54
- registerPresence: false,
55
- watchPresence: false,
56
- card: { name: "cli", kind: "endpoint" },
243
+ ...standaloneConnectOpts(auth.creds ? { creds: auth.creds, tls: auth.tls === true } : auth.bearer ? { bearer: auth.bearer, sentinelCreds: auth.sentinelCreds, tls: auth.tls === true } : { tls: auth.tls === true }),
244
+ maxReconnectAttempts: 0,
57
245
  });
58
- ep.on("error", (e) => console.error(c.red("! " + e.message)));
59
- await ep.start();
60
246
  try {
61
- return await ep.requestControl(tier, { op, args }, timeoutMs);
247
+ const service = await resolveService(nc, space, BASELINE_LIFECYCLE_ENDPOINT, caller, { deadlineMs: 10_000 });
248
+ const result = await scatterCommand(nc, space, service, mapped.command, undefined, {
249
+ deadlineMs: timeoutMs ?? 8_000,
250
+ reconcileDeadlineMs: 3_000,
251
+ });
252
+ const instances = [];
253
+ for (const [instanceId, ar] of result.replies) {
254
+ if (ar.reply.ok === true)
255
+ instances.push({ instanceId, reachable: true, data: ar.reply.data });
256
+ else
257
+ instances.push({ instanceId, reachable: true, error: ar.reply.error?.message ?? ar.reply.error?.code ?? "error" });
258
+ }
259
+ // A frozen instance that never answered is UNREACHABLE — surfaced, never silently dropped (pin 3).
260
+ for (const instanceId of result.missing)
261
+ instances.push({ instanceId, reachable: false });
262
+ return { ok: true, instances };
62
263
  }
63
264
  catch (e) {
64
- // A user-mode caller whose cli actor lacks the tier's scope gets a broker publish denial (the
65
- // red endpoint error above) and then this timeout — name the grant, not just the silence.
66
- // The re-grant REPLACES the scope list, so the hint must say "add", never a bare one-token
67
- // --scope that would silently strip the caller's spawn/role capabilities.
68
- const need = tier === CONTROL_ADMIN ? "admin" : "spawn";
69
- const scopeHint = auth.bearer
70
- ? ` - on a user-auth mesh this op needs scope "${need}" on your cli actor. Re-grant with "${need}" ADDED to your current scope (the upsert replaces the list; see \`cotal actor list\`), e.g. \`cotal actor grant cli --sub <your IdP subject> --scope 'spawn,role:default,${need}'\``
71
- : "";
72
- return { ok: false, error: `no manager reachable (${e.message})${scopeHint}` };
265
+ const msg = e instanceof EpEnvelopeError ? `${e.code}: ${e.message}` : e.message;
266
+ return { ok: false, error: `no manager reachable on the ep rails (${msg})` };
73
267
  }
74
268
  finally {
75
- await ep.stop();
269
+ await nc.drain().catch(() => nc.close());
76
270
  }
77
271
  }
272
+ /** SCATTER one untargeted read (`ps`) across EVERY registered manager instance in the space and merge
273
+ * the attributed results — the `cotal ps` default in a multi-manager space (P2 item 3). Auth shapes
274
+ * match {@link askManager}: a minted instrument or user bearer rides its own caller triple; a raw
275
+ * pre-1c `--creds` file is refused loud; an OPEN mesh synthesizes a DEV_OWNER triple and connects
276
+ * bare (the broker enforces nothing, so the records freeze reads freely). */
277
+ export async function scatterManager(space, server, op, auth = {}, timeoutMs) {
278
+ if (auth.epCaller && (auth.creds || (auth.bearer && auth.sentinelCreds)))
279
+ return askManagerScatterEp(space, server, op, auth, timeoutMs);
280
+ if (auth.creds)
281
+ return { ok: false, error: `this --creds file predates the v0.4 control surface (no endpoint-serve rows); re-mint it with a current cotal, or drive the manager from its project folder (\`cotal ps\`) which mints the instrument for you` };
282
+ const openAuth = { epCaller: { owner: DEV_OWNER, actor: newIdentity().id, uid: mintLifecycleUid() } };
283
+ return askManagerScatterEp(space, server, op, openAuth, timeoutMs);
284
+ }
78
285
  export function failIfNotOk(reply) {
79
286
  if (!reply.ok) {
80
287
  const msg = reply.error ?? "error";
@@ -1 +1 @@
1
- {"version":3,"file":"control.js","sourceRoot":"","sources":["../../src/lib/control.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,aAAa,EACb,kBAAkB,EAClB,aAAa,GAId,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvG,OAAO,EAAE,CAAC,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAqB,MAAM,cAAc,CAAC;AAMhE;;;;;wBAKwB;AACxB,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC;AAEvC;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,KAAmB,EACnB,OAAgB;IAEhB,MAAM,SAAS,GAAG,KAAK,CAAC,KAAK;QAC3B,CAAC,CAAC,EAAE,GAAG,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,IAAI,WAAW,CAAC,OAAO,CAAC,aAAa,EAAE,CAAC,CAAC,IAAI,aAAa,EAAE;QAC5F,CAAC,CAAC,KAAK,CAAC;IACV,kGAAkG;IAClG,gGAAgG;IAChG,gGAAgG;IAChG,gGAAgG;IAChG,6FAA6F;IAC7F,gGAAgG;IAChG,mGAAmG;IACnG,kGAAkG;IAClG,oGAAoG;IACpG,kGAAkG;IAClG,MAAM,IAAI,GAAG,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AAC,KAAK,GAAG,EAAE,CAAC,CAAC,CAAC;QACjC,6FAA6F;QAC7F,+EAA+E;QAC/E,MAAM,IAAI,GAAG,cAAc,CAAC,GAAG,CAAC,CAAC;QACjC,IAAI,IAAI;YAAE,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,CAAC;QAC9C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC"}
@@ -1,19 +1,34 @@
1
+ import { type LivenessProbe } from "@cotal-ai/workspace";
2
+ import { type SignalFn } from "./manager-proc.js";
3
+ /** `tls` is the broker's transport decision, propagated to the daemon's argv. It is not optional
4
+ * information the daemon can do without: it cannot derive the transport itself (see the note at
5
+ * the argv site), and omitting it leaves a standing-credential daemon connecting
6
+ * plaintext-capable to a TLS broker while looking entirely healthy.
7
+ * `wsPort` is the broker's loopback websocket listener (P2 item 6), forwarded to the manager. */
1
8
  type Opts = {
2
9
  space?: string;
3
10
  server?: string;
11
+ tls?: boolean;
4
12
  spawn?: string[];
5
13
  runtime?: string;
6
14
  launch?: string;
7
15
  attachHost?: string;
8
16
  resumeAttempt?: string;
9
17
  resumeCommitToken?: string;
18
+ wsPort?: number;
10
19
  };
11
- /** True if the delivery daemon we started for this folder is still running (pid file + liveness). */
20
+ /** The recorded daemon's liveness, THREE-VALUED plus absent. See {@link managerLiveness} for why the
21
+ * boolean collapse is the defect: `unknown` is reachable on a real kernel (a seccomp
22
+ * `SECCOMP_RET_ERRNO` filter or an LSM policy answers `kill(pid, 0)` with an arbitrary errno and
23
+ * libuv preserves it), and both ways of folding it into a boolean fail silently. */
24
+ export declare function deliveryLiveness(probe?: LivenessProbe): "alive" | "dead" | "unknown" | "absent" | "unattributable";
25
+ /** True only if the daemon is PROVABLY running. Callers that ACT on the answer take
26
+ * {@link deliveryLiveness} instead; this cannot express "cannot tell". */
12
27
  export declare function deliveryUp(): boolean;
13
28
  /** Cutover preflight — the FIRST action, BEFORE the daemon can bind: stop any old Plane-3-hosting
14
29
  * manager (live `manager.pid` without the delivery-aware marker) so it never double-binds the
15
30
  * daemon's durables. A delivery-aware (this-build) manager is left running. No-op on a fresh install. */
16
- export declare function stopOldHostingManagerIfPresent(): void;
31
+ export declare function stopOldHostingManagerIfPresent(probe?: LivenessProbe, signal?: SignalFn): Promise<void>;
17
32
  /** Start the delivery daemon detached (pid in `.cotal/delivery.pid`, output to `.cotal/delivery.log`),
18
33
  * stopped by `cotal down`. Re-execs this CLI's `deliver` command; the daemon loads the pre-minted
19
34
  * scoped `delivery.creds` (written by {@link ensureDelivery}) — it never sees the signer. */
@@ -23,14 +38,14 @@ export declare function startDeliveryDetached(o?: Opts): number;
23
38
  * never double-binds. Mints a SCOPED `delivery` cred from the local signer ONCE, writes it to
24
39
  * `.cotal/delivery.creds` (0600), and launches the daemon WITHOUT signer access. Best-effort — callers
25
40
  * treat it as non-fatal (a missing daemon degrades durable delivery, never live). */
26
- export declare function ensureDelivery(o?: Opts): Promise<{
41
+ export declare function ensureDelivery(o?: Opts, probe?: LivenessProbe): Promise<{
27
42
  running: boolean;
28
43
  }>;
29
44
  /** Stop the detached delivery daemon if we started one, and drop its creds from the store. The pid
30
45
  * kill runs even if the creds delete fails (finally) — a delete error must never leave the daemon
31
46
  * alive to outlive the teardown and reattach to a restarted broker; the error still propagates
32
47
  * after the kill so the caller can surface it. */
33
- export declare function stopDelivery(): Promise<void>;
48
+ export declare function stopDelivery(probe?: LivenessProbe, signal?: SignalFn): Promise<void>;
34
49
  /** Bring up the control plane in the correct cutover order: OLD-manager preflight → delivery daemon
35
50
  * (auth only, fails closed on a live old manager) → manager (lifecycle, writes the delivery-aware
36
51
  * marker). The manager no longer depends on the daemon (it hosts no Plane-3), so the daemon is started
@@ -1 +1 @@
1
- {"version":3,"file":"delivery-proc.d.ts","sourceRoot":"","sources":["../../src/lib/delivery-proc.ts"],"names":[],"mappings":"AAmBA,KAAK,IAAI,GAAG;IAAE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