@cotal-ai/manager 0.169.0 → 0.171.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.
- package/dist/credential-renewal.d.ts +261 -0
- package/dist/credential-renewal.d.ts.map +1 -0
- package/dist/credential-renewal.js +757 -0
- package/dist/credential-renewal.js.map +1 -0
- package/dist/goal-writer.d.ts +158 -0
- package/dist/goal-writer.d.ts.map +1 -0
- package/dist/goal-writer.js +342 -0
- package/dist/goal-writer.js.map +1 -0
- package/dist/manager.d.ts +62 -662
- package/dist/manager.d.ts.map +1 -1
- package/dist/manager.js +358 -2775
- package/dist/manager.js.map +1 -1
- package/dist/names-capacity.d.ts +34 -2
- package/dist/names-capacity.d.ts.map +1 -1
- package/dist/names-capacity.js +53 -1
- package/dist/names-capacity.js.map +1 -1
- package/dist/run-hosting.d.ts +1 -0
- package/dist/run-hosting.d.ts.map +1 -1
- package/dist/run-hosting.js +18 -2
- package/dist/run-hosting.js.map +1 -1
- package/dist/seat-custody.d.ts +2 -0
- package/dist/seat-custody.d.ts.map +1 -1
- package/dist/seat-custody.js +10 -1
- package/dist/seat-custody.js.map +1 -1
- package/dist/seat-launch.d.ts +266 -0
- package/dist/seat-launch.d.ts.map +1 -0
- package/dist/seat-launch.js +567 -0
- package/dist/seat-launch.js.map +1 -0
- package/dist/seat-start.d.ts +84 -0
- package/dist/seat-start.d.ts.map +1 -0
- package/dist/seat-start.js +1208 -0
- package/dist/seat-start.js.map +1 -0
- package/dist/seat-types.d.ts +362 -0
- package/dist/seat-types.d.ts.map +1 -0
- package/dist/seat-types.js +2 -0
- package/dist/seat-types.js.map +1 -0
- package/package.json +12 -12
|
@@ -0,0 +1,567 @@
|
|
|
1
|
+
import { existsSync, lstatSync, realpathSync, statSync } from "node:fs";
|
|
2
|
+
import { homedir, hostname } from "node:os";
|
|
3
|
+
import { isAbsolute, sep } from "node:path";
|
|
4
|
+
import { agentFilePath, assertLifecycleToken, assertValidChannel, DEFAULT_SERVER, digestIdToken, EpEnvelopeError, eventChannel, eventChannelPrincipal, grantOverreach, grantParts, isIssuedCaller, issuedSpawnerStanding, MAX_SCHEDULE_MS, parsePersonaEndpoints, principalKey, registry, rejectionText, renderOnceTask, resolveReadAcl, runDriverCaller, shownSpawner, withIssuerSession } from "@cotal-ai/core";
|
|
5
|
+
import { loadLaunchPersonaFile, manifestExtensionNames, PersonaSourceError, resolveAgentType } from "@cotal-ai/workspace";
|
|
6
|
+
import { inlinePersonaDir } from "./launch.js";
|
|
7
|
+
import { listDirectory } from "./list-dir.js";
|
|
8
|
+
import { MANAGER_ENDPOINT } from "./manager-service-contract.js";
|
|
9
|
+
import { SeatStart } from "./seat-start.js";
|
|
10
|
+
import { onceTurnNote, turnHoldToken } from "./turn-relay.js";
|
|
11
|
+
/** The goal index's bound on a relay note (core `GOAL_INDEX_NOTE_MAX`). A once task's note must
|
|
12
|
+
* fit it, and is refused at admission when it cannot. */
|
|
13
|
+
const TURN_NOTE_MAX = 65536;
|
|
14
|
+
/** The caller keeps the arrays it passed, so a launch form is admitted with its own copies: a later
|
|
15
|
+
* write to the caller's array cannot change what the manager grants, shares or preserves. */
|
|
16
|
+
export function ownLists(form) {
|
|
17
|
+
return {
|
|
18
|
+
...form,
|
|
19
|
+
...(form.subscribe && { subscribe: [...form.subscribe] }),
|
|
20
|
+
...(form.allowSubscribe && { allowSubscribe: [...form.allowSubscribe] }),
|
|
21
|
+
...(form.allowPublish && { allowPublish: [...form.allowPublish] }),
|
|
22
|
+
...(form.capabilities && { capabilities: [...form.capabilities] }),
|
|
23
|
+
...(form.shareTools && { shareTools: [...form.shareTools] }),
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
/** The inline record is admitted the same way, one level deeper: the record itself, its lists, and
|
|
27
|
+
* each `endpoints` entry with its commands. It is still untrusted here, so a shape the validator
|
|
28
|
+
* will refuse is copied as far as it goes and refused where it is read. */
|
|
29
|
+
export function ownPersona(record) {
|
|
30
|
+
if (record === null || typeof record !== "object" || Array.isArray(record))
|
|
31
|
+
return record;
|
|
32
|
+
const owned = ownLists({ ...record });
|
|
33
|
+
const endpoints = owned.endpoints;
|
|
34
|
+
if (Array.isArray(endpoints))
|
|
35
|
+
owned.endpoints = endpoints.map((e) => {
|
|
36
|
+
if (e === null || typeof e !== "object" || Array.isArray(e))
|
|
37
|
+
return e;
|
|
38
|
+
const entry = { ...e };
|
|
39
|
+
if (Array.isArray(entry.commands))
|
|
40
|
+
entry.commands = [...entry.commands];
|
|
41
|
+
return entry;
|
|
42
|
+
});
|
|
43
|
+
return owned;
|
|
44
|
+
}
|
|
45
|
+
/** Why a revoked run starts no helper, the same words wherever the marker is read. */
|
|
46
|
+
function revokedRunRefusal(runId, revoked) {
|
|
47
|
+
return `run ${runId} was revoked by ${revoked.by} (${revoked.reason}); a revoked run starts no helper (SPEC 14.8)`;
|
|
48
|
+
}
|
|
49
|
+
const INLINE_PERSONA_KEYS = ["prompt", "role", "model", "variant", "description", "subscribe", "allowSubscribe", "allowPublish", "capabilities", "endpoints", "save"];
|
|
50
|
+
/** Read an inline persona into the definition a catalog file would load as, refusing what a file
|
|
51
|
+
* load refuses plus any shape the closed record does not take. The body is literal text: nothing in
|
|
52
|
+
* it becomes a field, so a body that starts with `---` stays body. */
|
|
53
|
+
function inlinePersonaDef(name, raw) {
|
|
54
|
+
if (raw === null || typeof raw !== "object" || Array.isArray(raw))
|
|
55
|
+
throw new Error("persona: expected an object");
|
|
56
|
+
const rec = raw;
|
|
57
|
+
const extra = Object.keys(rec).filter((k) => !INLINE_PERSONA_KEYS.includes(k));
|
|
58
|
+
if (extra.length)
|
|
59
|
+
throw new Error(`persona: unknown key ${extra[0]}; it takes ${INLINE_PERSONA_KEYS.join(", ")}`);
|
|
60
|
+
const text = (k) => {
|
|
61
|
+
const v = rec[k];
|
|
62
|
+
if (v === undefined)
|
|
63
|
+
return undefined;
|
|
64
|
+
if (typeof v !== "string" || !v.trim())
|
|
65
|
+
throw new Error(`persona.${k}: expected a non-blank string`);
|
|
66
|
+
return v;
|
|
67
|
+
};
|
|
68
|
+
const list = (k) => {
|
|
69
|
+
const v = rec[k];
|
|
70
|
+
if (v === undefined)
|
|
71
|
+
return undefined;
|
|
72
|
+
if (!Array.isArray(v) || v.some((x) => typeof x !== "string"))
|
|
73
|
+
throw new Error(`persona.${k}: expected an array of strings`);
|
|
74
|
+
return [...v];
|
|
75
|
+
};
|
|
76
|
+
const prompt = text("prompt");
|
|
77
|
+
if (prompt === undefined)
|
|
78
|
+
throw new Error("persona.prompt: required; it is the persona body");
|
|
79
|
+
if (rec.save !== undefined && typeof rec.save !== "boolean")
|
|
80
|
+
throw new Error("persona.save: expected a boolean");
|
|
81
|
+
const def = {
|
|
82
|
+
name,
|
|
83
|
+
persona: prompt.trim(),
|
|
84
|
+
role: text("role"),
|
|
85
|
+
model: text("model"),
|
|
86
|
+
variant: text("variant"),
|
|
87
|
+
description: text("description"),
|
|
88
|
+
subscribe: list("subscribe"),
|
|
89
|
+
allowSubscribe: list("allowSubscribe"),
|
|
90
|
+
allowPublish: list("allowPublish"),
|
|
91
|
+
capabilities: list("capabilities"),
|
|
92
|
+
endpoints: parsePersonaEndpoints(rec.endpoints, "persona"),
|
|
93
|
+
};
|
|
94
|
+
// The checks a file load makes on these fields: channel names, and the read set within the read ACL.
|
|
95
|
+
try {
|
|
96
|
+
for (const ch of [...(def.subscribe ?? []), ...(def.allowSubscribe ?? []), ...(def.allowPublish ?? [])])
|
|
97
|
+
assertValidChannel(ch);
|
|
98
|
+
resolveReadAcl(def.subscribe ?? [], def.allowSubscribe);
|
|
99
|
+
}
|
|
100
|
+
catch (e) {
|
|
101
|
+
throw new Error(`persona: ${rejectionText(e)}`);
|
|
102
|
+
}
|
|
103
|
+
return { def, save: rec.save === true };
|
|
104
|
+
}
|
|
105
|
+
/** The refusal a user-auth mesh gives a persona that names `endpoints`. */
|
|
106
|
+
export function userMeshEndpointsRefusal(door) {
|
|
107
|
+
return `${door}: this mesh has per-user auth, where endpoint access comes from the service owner's grants and a persona cannot hand it on (SPEC 13.15). ` +
|
|
108
|
+
"Drop `endpoints` from the persona, and ask the operator to grant the helper with `cotal service-endpoint grant` once it runs.";
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Event channels in `channels` that do NOT belong to `{owner, actor}`.
|
|
112
|
+
*
|
|
113
|
+
* ONE HELPER FOR EVERY SEAM THAT ARMS AN ACL, and that is the whole design. The rule first existed
|
|
114
|
+
* only at the spawn accept seam, and a security review found the hole that shape guarantees: resume
|
|
115
|
+
* re-arms a managed row straight from the inventory document, and `renewManagedStaticCred` re-mints
|
|
116
|
+
* the JWT from that row, so an admin-supplied inventory could carry a foreign concrete event channel
|
|
117
|
+
* past a fence that only ever looked at spawns. A rule with one call site is a rule that covers one
|
|
118
|
+
* door.
|
|
119
|
+
*
|
|
120
|
+
* IT COMPARES PRINCIPALS, NOT STRINGS. `eventChannelPrincipal` decodes the channel back to the
|
|
121
|
+
* `{owner, actor}` it names, so this is mode-independent: static keys the actor on the allocated
|
|
122
|
+
* nkey and user mode keys it on the alias, and neither needs its own branch here.
|
|
123
|
+
*
|
|
124
|
+
* STATED LIMIT, unchanged and asserted by a cell: the decode refuses anything that is not exactly
|
|
125
|
+
* two principal tokens, so a WILDCARD is not an event channel to it. `events.<owner>.>` and
|
|
126
|
+
* `events.>` pass untouched and are governed by ordinary ACL authority. This closes the concrete
|
|
127
|
+
* form, which is what a caller writes when it knows which agent it wants to read, and not the
|
|
128
|
+
* wildcard form, which is what an operator writes deliberately for an observer.
|
|
129
|
+
*/
|
|
130
|
+
export function foreignEventChannels(channels, owner, actor) {
|
|
131
|
+
return channels.filter((ch) => {
|
|
132
|
+
const p = eventChannelPrincipal(ch);
|
|
133
|
+
return p !== null && !(p.owner === owner && p.actor === actor);
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
/** The launch pipeline's leaf steps: spawn-directory checks, the connector inventory reads, the
|
|
137
|
+
* once-spawn and spawn-grant refusals, and the persona a spawn resolves to. */
|
|
138
|
+
export class SeatLaunch {
|
|
139
|
+
deps;
|
|
140
|
+
/** The agent-start path. Shares this component's deps, and calls back into it for its leaf steps. */
|
|
141
|
+
seatStart;
|
|
142
|
+
constructor(deps) {
|
|
143
|
+
this.deps = deps;
|
|
144
|
+
this.seatStart = new SeatStart(deps, {
|
|
145
|
+
checkSpawnCwd: (...args) => this.checkSpawnCwd(...args),
|
|
146
|
+
harnessUnavailableError: (...args) => this.harnessUnavailableError(...args),
|
|
147
|
+
onceRefusal: (...args) => this.onceRefusal(...args),
|
|
148
|
+
spawnerName: (...args) => this.spawnerName(...args),
|
|
149
|
+
spawnPersona: (...args) => this.spawnPersona(...args),
|
|
150
|
+
spawnRun: (...args) => this.spawnRun(...args),
|
|
151
|
+
staticSpawnBound: (...args) => this.staticSpawnBound(...args),
|
|
152
|
+
spawnBoundRefusal: (...args) => this.spawnBoundRefusal(...args),
|
|
153
|
+
managedStaticInstanceReads: (...args) => this.managedStaticInstanceReads(...args),
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
/** The realpath + directory checks a placed spawn directory must pass on this manager's host,
|
|
157
|
+
* shared by the served `resolve-cwd` command and the `spawn` admission check (#385 item 2): one
|
|
158
|
+
* function, so the two doors never drift. Creates nothing and never substitutes the workspace root. */
|
|
159
|
+
checkSpawnCwd(resolved) {
|
|
160
|
+
let cwd = resolved;
|
|
161
|
+
try {
|
|
162
|
+
cwd = realpathSync(resolved);
|
|
163
|
+
}
|
|
164
|
+
catch (error) {
|
|
165
|
+
return { refusal: `path cannot be resolved: ${rejectionText(error)}` };
|
|
166
|
+
}
|
|
167
|
+
try {
|
|
168
|
+
if (!statSync(cwd).isDirectory())
|
|
169
|
+
return { refusal: "path is not a directory" };
|
|
170
|
+
}
|
|
171
|
+
catch (error) {
|
|
172
|
+
return { refusal: rejectionText(error) };
|
|
173
|
+
}
|
|
174
|
+
return { cwd, host: hostname() };
|
|
175
|
+
}
|
|
176
|
+
/** Refuse host directory reads before lookup when seats cannot use this host. */
|
|
177
|
+
assertHostDirectoryExecution() {
|
|
178
|
+
if (this.deps.execution() === "none")
|
|
179
|
+
throw new EpEnvelopeError("unimplemented", this.deps.executionRefusal());
|
|
180
|
+
if (this.deps.execution() === "runtime" && this.deps.requiredRuntime().spawnDelegated)
|
|
181
|
+
throw new EpEnvelopeError("failed-precondition", `runtime "${this.deps.requiredRuntime().kind}" starts seats outside this host, so it cannot resolve a directory on this host's filesystem (cwd); the seat runs in its runtime resource's own directory`);
|
|
182
|
+
}
|
|
183
|
+
async listSpawnDirectory(args) {
|
|
184
|
+
this.assertHostDirectoryExecution();
|
|
185
|
+
const { cwd } = this.resolveSpawnCwd(args.path ?? homedir());
|
|
186
|
+
try {
|
|
187
|
+
return await listDirectory(cwd, args.includeHidden === true, typeof args.limit === "number" ? args.limit : 200);
|
|
188
|
+
}
|
|
189
|
+
catch (error) {
|
|
190
|
+
throw new EpEnvelopeError("failed-precondition", `directory cannot be listed on this host: ${JSON.stringify(cwd)} (${rejectionText(error)})`);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
/** Resolve a placed spawn directory without creating or substituting a workspace. */
|
|
194
|
+
resolveSpawnCwd(value) {
|
|
195
|
+
this.assertHostDirectoryExecution();
|
|
196
|
+
const asked = typeof value === "string" ? value : String(value ?? "");
|
|
197
|
+
const refuse = (reason) => {
|
|
198
|
+
throw new EpEnvelopeError("failed-precondition", `cwd does not resolve on this host: ${JSON.stringify(asked)} (${reason})`);
|
|
199
|
+
};
|
|
200
|
+
if (!isAbsolute(asked))
|
|
201
|
+
refuse("expected an absolute path");
|
|
202
|
+
const result = this.checkSpawnCwd(asked);
|
|
203
|
+
if ("refusal" in result)
|
|
204
|
+
return refuse(result.refusal);
|
|
205
|
+
return result;
|
|
206
|
+
}
|
|
207
|
+
/** Connector names the manager can spawn WITHOUT importing: the manifest on the published binary,
|
|
208
|
+
* else whatever a composition root registered. Drives the `models` catalog enumeration. */
|
|
209
|
+
connectorNames() {
|
|
210
|
+
return this.deps.installedExtensions() ? manifestExtensionNames("connector") : registry.all("connector").map((c) => c.name);
|
|
211
|
+
}
|
|
212
|
+
/** True when at least one declared connector is available. Empty inventory (or a failed
|
|
213
|
+
* inventory load) skips the class `one` subscribe for spawn/launch so this member cannot
|
|
214
|
+
* consume an unpinned request a sibling could serve. */
|
|
215
|
+
classSpawnEnabled() {
|
|
216
|
+
if (this.deps.execution() === "none")
|
|
217
|
+
return false;
|
|
218
|
+
return this.deps.connectorStatuses().some((row) => row.state === "available");
|
|
219
|
+
}
|
|
220
|
+
omitClassCommands() {
|
|
221
|
+
return this.classSpawnEnabled() ? undefined : ["spawn", "launch"];
|
|
222
|
+
}
|
|
223
|
+
/** Named harness-unavailable refusal. On the class rail a partial inventory must not look
|
|
224
|
+
* like the space cannot launch: name `--on` so the caller can pin a sibling. The standing
|
|
225
|
+
* serve credential cannot enumerate sibling `svc.*.status` inventories, so the residual
|
|
226
|
+
* is the flag, not a list of capable instance ids. Instance-pinned calls keep the local
|
|
227
|
+
* reason only. */
|
|
228
|
+
harnessUnavailableError(reason, route) {
|
|
229
|
+
if (route !== "one")
|
|
230
|
+
return reason;
|
|
231
|
+
return `${reason}. This manager cannot launch that harness. The space may have other managers; pin one with --on <instance> (the whole id, as ps prints it)`;
|
|
232
|
+
}
|
|
233
|
+
/** The refusal for a `once` spawn this manager cannot run as one task: every check is made before
|
|
234
|
+
* anything is allocated, so a refused spawn leaves nothing behind. */
|
|
235
|
+
onceRefusal(connector, runtime, launch, spawner, hooks) {
|
|
236
|
+
if (!hooks?.onOnce)
|
|
237
|
+
return "once: a once task rides the spawn action, which this launch door is not";
|
|
238
|
+
if (launch.prompt === undefined || launch.prompt.trim() === "")
|
|
239
|
+
return "once: needs a prompt, which is the task";
|
|
240
|
+
if (launch.supervise !== undefined)
|
|
241
|
+
return "once: a once seat is never restarted, so it cannot carry supervise";
|
|
242
|
+
if (!connector.supportsTurnRelay)
|
|
243
|
+
return `once: the ${connector.name} connector cannot take a once task${connector.turnRelayRefusal ? `: ${connector.turnRelayRefusal}` : ""}`;
|
|
244
|
+
if (connector.onceNeedsConfirmed !== undefined && !runtime.reportsStartupOutcome)
|
|
245
|
+
return `once: runtime "${runtime.kind}" does not report how a seat's startup ended, which a once seat on the ${connector.name} connector needs`;
|
|
246
|
+
if (runtime.spawnDelegated)
|
|
247
|
+
return `once: runtime "${runtime.kind}" starts seats outside this host, where this manager cannot prove the seat's exit`;
|
|
248
|
+
const operator = connector.waitsForOperator?.(launch.launchOptions);
|
|
249
|
+
if (operator !== undefined)
|
|
250
|
+
return `once: these launch options make the seat wait at ${operator} before it starts, so nothing could take its task`;
|
|
251
|
+
// The task's relay record, measured with the widest deadline it could carry.
|
|
252
|
+
const { note, payload } = onceTurnNote({
|
|
253
|
+
prompt: launch.prompt, spawner: this.spawnerName(spawner),
|
|
254
|
+
...(launch.once.deadlineMs !== undefined ? { deadlineAt: MAX_SCHEDULE_MS, holdToken: turnHoldToken("") } : {}),
|
|
255
|
+
holdEpoch: this.deps.serviceServe()?.grant.epoch ?? 0,
|
|
256
|
+
...(connector.retireAfterExit ? { retire: connector.name } : {}),
|
|
257
|
+
// The longest id token core accepts (endpoint-subjects `assertIdToken`).
|
|
258
|
+
spawn: "x".repeat(64),
|
|
259
|
+
});
|
|
260
|
+
if (note.length > TURN_NOTE_MAX)
|
|
261
|
+
return `once: the prompt is too long for one task (its relay record is ${note.length} characters, over ${TURN_NOTE_MAX})`;
|
|
262
|
+
if (connector.turnFrameLimit !== undefined) {
|
|
263
|
+
// The text the seat shows, rendered by the seat's own function with the widest values it could
|
|
264
|
+
// carry: the task's goal id is a digest token, and a deadline renders as one ISO instant.
|
|
265
|
+
const text = renderOnceTask({ goalId: digestIdToken("once"), payload, spawner: this.spawnerName(spawner), ...(launch.once.deadlineMs !== undefined ? { deadlineAt: MAX_SCHEDULE_MS } : {}) });
|
|
266
|
+
if (text.length > connector.turnFrameLimit)
|
|
267
|
+
return `once: the prompt is too long for one ${connector.name} turn (the task renders to ${text.length} characters, over ${connector.turnFrameLimit})`;
|
|
268
|
+
}
|
|
269
|
+
return undefined;
|
|
270
|
+
}
|
|
271
|
+
/** How a once task names who sent it: the spawner's roster name, or its principal when that name is missing or only whitespace. */
|
|
272
|
+
spawnerName(spawner) {
|
|
273
|
+
const id = spawner ?? this.deps.ep().ref().id;
|
|
274
|
+
return shownSpawner(this.deps.ep().getRoster().find((p) => p.card.id === id)?.card.name, id);
|
|
275
|
+
}
|
|
276
|
+
/** The persona file a spawn loads and the harness it resolves, shared by `spawn` and the served
|
|
277
|
+
* `resolve-agent` read: a detached resume locates the session it carries with the connector this
|
|
278
|
+
* names, so the two doors must not drift (#2899). */
|
|
279
|
+
async spawnPersona(opts, spawner, authenticatedCaller) {
|
|
280
|
+
// Both config-taking wire commands and direct/roster starts enter here before interpreting
|
|
281
|
+
// a path. A resolved manifest is host-built authority over its own materialized resource,
|
|
282
|
+
// never a wire-supplied config override (the public schemas accept no `resolved` field).
|
|
283
|
+
if (this.deps.execution() === "runtime" && this.deps.requiredRuntime().spawnDelegated && opts.config !== undefined && !opts.resolved)
|
|
284
|
+
return { error: "delegated execution cannot use a manager-host persona config path; select a named persona" };
|
|
285
|
+
// The spawn argument is a persona REF — a filename in `.cotal/agents` (the unique spawn KEY), or
|
|
286
|
+
// a path via `--config`. It is NOT the mesh identity: the identity comes from inside the file
|
|
287
|
+
// (`name:`), so a persona can be filed descriptively (review-critic.md) yet present under a
|
|
288
|
+
// free-form name (socrates) — the same model `cotal spawn` already uses. You always spawn by
|
|
289
|
+
// filename (unique on disk); two files can't collide on the key.
|
|
290
|
+
const ref = opts.name.trim();
|
|
291
|
+
if (!ref)
|
|
292
|
+
return { error: "name required" };
|
|
293
|
+
// An inline persona is its own definition, read here like a file so every later check sees a
|
|
294
|
+
// def. It has no file until its snapshot is written, once the seat's lifecycle uid is final.
|
|
295
|
+
if (opts.persona !== undefined) {
|
|
296
|
+
if (opts.resolved || opts.config !== undefined || opts.identity !== undefined)
|
|
297
|
+
return { error: "persona: an inline persona names the helper itself, so it takes no config, identity or manifest launch", code: "bad-request" };
|
|
298
|
+
const refErr = this.deps.nameError(ref);
|
|
299
|
+
if (refErr)
|
|
300
|
+
return { error: refErr };
|
|
301
|
+
let inline;
|
|
302
|
+
try {
|
|
303
|
+
inline = inlinePersonaDef(ref, opts.persona);
|
|
304
|
+
}
|
|
305
|
+
catch (e) {
|
|
306
|
+
return { error: rejectionText(e), code: "bad-request" };
|
|
307
|
+
}
|
|
308
|
+
// A save under a name the catalog already holds is refused here, before anything is allocated,
|
|
309
|
+
// so the refusal starts nothing. The create-only write after the grant settles a race.
|
|
310
|
+
if (inline.save) {
|
|
311
|
+
const target = agentFilePath(this.deps.workspaceRoot(), ref);
|
|
312
|
+
let taken = true;
|
|
313
|
+
try {
|
|
314
|
+
lstatSync(target);
|
|
315
|
+
}
|
|
316
|
+
catch (e) {
|
|
317
|
+
if (e.code !== "ENOENT")
|
|
318
|
+
return { error: `persona.save: ${rejectionText(e)}` };
|
|
319
|
+
taken = false;
|
|
320
|
+
}
|
|
321
|
+
if (taken)
|
|
322
|
+
return { error: `persona.save: the catalog already holds a persona named "${ref}" (${target}). Spawn that persona by name, or pick another name to save this one under` };
|
|
323
|
+
}
|
|
324
|
+
return { ref, def: inline.def, agent: resolveAgentType({ flag: opts.agent, pin: undefined, callerDefault: opts.defaultAgent }), inline: { save: inline.save } };
|
|
325
|
+
}
|
|
326
|
+
// A bare ref maps to `.cotal/agents/<ref>.md`, so it must be a safe token (no path traversal); a
|
|
327
|
+
// `--config` path is validated by existsSync below instead.
|
|
328
|
+
if (!opts.config) {
|
|
329
|
+
const refErr = this.deps.nameError(ref);
|
|
330
|
+
if (refErr)
|
|
331
|
+
return { error: refErr };
|
|
332
|
+
}
|
|
333
|
+
// Resolve the persona file (fail loud — NO silent default-ACL fallback). A missing persona used
|
|
334
|
+
// to mint DEFAULT creds (read `general` only, default-deny publish, no capabilities), so a
|
|
335
|
+
// typo'd / renamed / spawned-by-display-name agent became live with silently-wrong ACLs — a
|
|
336
|
+
// behavioral/security bug. Fail loud instead, matching `cotal spawn` (loadAgentFile throws).
|
|
337
|
+
// This runs BEFORE the spawn path resolves its connector: the file's `agent:` pin participates in
|
|
338
|
+
// the harness choice (flag > file > COTAL_DEFAULT_AGENT > default, #869), which is impossible if
|
|
339
|
+
// the connector is materialized first.
|
|
340
|
+
let configPath;
|
|
341
|
+
if (opts.config) {
|
|
342
|
+
configPath = agentFilePath(this.deps.workspaceRoot(), opts.config);
|
|
343
|
+
if (!existsSync(configPath))
|
|
344
|
+
return { error: `agent file not found: ${configPath}` };
|
|
345
|
+
}
|
|
346
|
+
else {
|
|
347
|
+
configPath = agentFilePath(this.deps.workspaceRoot(), ref);
|
|
348
|
+
if (!existsSync(configPath))
|
|
349
|
+
return { error: `no persona "${ref}" in the catalog of manager ${this.deps.managerInstanceId()} on host ${hostname()}: ${configPath} not found; create it there` };
|
|
350
|
+
}
|
|
351
|
+
// An inline snapshot belongs to its own seat's lifecycle, which removes it at retirement and
|
|
352
|
+
// refuses a restart once it changed, so no other launch may read it. Compared after symlinks
|
|
353
|
+
// resolve, for a config path and a catalog entry alike.
|
|
354
|
+
if (!opts.resolved && this.insideInlineDir(configPath))
|
|
355
|
+
return { error: `${configPath} is an inline persona's snapshot, which belongs to the seat it was written for; spawn a saved persona by name, or pass the persona inline` };
|
|
356
|
+
// Load the persona ONCE, here, ahead of the connector choice. The file's `agent:` pin feeds the
|
|
357
|
+
// harness resolution below; the spawn path's identity/ACL profile block consumes the SAME def (no
|
|
358
|
+
// second load). A manifest launch (`resolved`) materializes its own transient persona and the
|
|
359
|
+
// file is NOT its authority, so its def (and its agent pin) is deliberately not consulted here —
|
|
360
|
+
// the manifest's own `agent:` field drove the launch object already.
|
|
361
|
+
let def;
|
|
362
|
+
if (!opts.resolved) {
|
|
363
|
+
try {
|
|
364
|
+
def = loadLaunchPersonaFile(configPath);
|
|
365
|
+
}
|
|
366
|
+
catch (e) {
|
|
367
|
+
return { error: rejectionText(e), ...(e instanceof PersonaSourceError ? { code: "bad-request" } : {}) };
|
|
368
|
+
}
|
|
369
|
+
// Shared operator files remain launchable. Owned content follows the catalog's visibility
|
|
370
|
+
// decision before connector loading or any allocation. A hosted run acts for its admission;
|
|
371
|
+
// only a complete authenticated caller can request the current ledger's admin decision.
|
|
372
|
+
if (this.deps.userMode() && def.owner !== undefined) {
|
|
373
|
+
const acting = authenticatedCaller === undefined ? undefined
|
|
374
|
+
: this.deps.runHosting()?.admittedCaller(authenticatedCaller) ?? authenticatedCaller;
|
|
375
|
+
const personaCaller = acting === undefined ? spawner ?? "" : principalKey(acting.owner, acting.actor).key;
|
|
376
|
+
const admin = authenticatedCaller !== undefined && await this.deps.epAdminReach(authenticatedCaller);
|
|
377
|
+
if (!this.deps.canReadPersona(def.owner, personaCaller, admin))
|
|
378
|
+
return { error: `no persona "${ref}"` };
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
return { ref, configPath, def, agent: resolveAgentType({ flag: opts.agent, pin: def?.agent, callerDefault: opts.defaultAgent }) };
|
|
382
|
+
}
|
|
383
|
+
/** Whether a persona path resolves into the inline snapshot directory, the directory itself
|
|
384
|
+
* included. A directory that does not exist holds nothing. */
|
|
385
|
+
insideInlineDir(path) {
|
|
386
|
+
const dir = inlinePersonaDir(this.deps.workspaceRoot());
|
|
387
|
+
if (!existsSync(dir))
|
|
388
|
+
return false;
|
|
389
|
+
const real = realpathSync(path);
|
|
390
|
+
const realDir = realpathSync(dir);
|
|
391
|
+
return real === realDir || real.startsWith(realDir + sep);
|
|
392
|
+
}
|
|
393
|
+
/** The run a spawn acts for (SPEC 14.8). The run this manager drives under `caller` answers from
|
|
394
|
+
* memory. On a static mesh, a spawn from a run hosted elsewhere names its run, whether the program
|
|
395
|
+
* placed it here or the class queue delivered it, and its caller must be that run's driver, whose
|
|
396
|
+
* triple derives from the run id; the run's admission and revocation marker are then read
|
|
397
|
+
* leader-served, so the helper is bounded as the hosting manager bounds it. Elsewhere the run id
|
|
398
|
+
* is not read: a user-auth run's issuing host bounds the helper, and an open mesh bounds none.
|
|
399
|
+
* `undefined` for a spawn that acts for no run. */
|
|
400
|
+
async spawnRun(caller, runId) {
|
|
401
|
+
const hosted = caller !== undefined ? this.deps.runHosting()?.runAdmission(caller) : undefined;
|
|
402
|
+
if (hosted !== undefined) {
|
|
403
|
+
if (runId !== undefined && runId !== hosted.runId)
|
|
404
|
+
return { refused: `it names run ${runId}, but its caller drives run ${hosted.runId}` };
|
|
405
|
+
return { admission: hosted, hosted: true };
|
|
406
|
+
}
|
|
407
|
+
if (runId === undefined || this.deps.meshMode() !== "static")
|
|
408
|
+
return undefined;
|
|
409
|
+
let driver;
|
|
410
|
+
try {
|
|
411
|
+
driver = caller !== undefined ? runDriverCaller(runId, caller.owner) : undefined;
|
|
412
|
+
}
|
|
413
|
+
catch (e) {
|
|
414
|
+
return { refused: `runId ${JSON.stringify(runId)} is not a run id (${rejectionText(e)})` };
|
|
415
|
+
}
|
|
416
|
+
if (driver === undefined || driver.actor !== caller.actor || driver.uid !== caller.uid)
|
|
417
|
+
return { refused: `it names run ${runId}, but its caller is not that run's driver` };
|
|
418
|
+
if (this.deps.runHosting() === undefined)
|
|
419
|
+
return { refused: `run ${runId} asked this manager for a helper, but this manager hosts no runs, so it cannot read the run's admission` };
|
|
420
|
+
let view;
|
|
421
|
+
try {
|
|
422
|
+
view = await this.deps.runHosting().admission(runId);
|
|
423
|
+
}
|
|
424
|
+
catch (e) {
|
|
425
|
+
return { refused: `run ${runId}'s admission and revocation marker could not be read (${rejectionText(e)}), so it starts no helper (SPEC 14.8)` };
|
|
426
|
+
}
|
|
427
|
+
if (view.revoked !== undefined)
|
|
428
|
+
return { refused: revokedRunRefusal(runId, view.revoked) };
|
|
429
|
+
return { admission: view.admission, hosted: false };
|
|
430
|
+
}
|
|
431
|
+
/**
|
|
432
|
+
* Resolve what bounds a spawn's grant on a STATIC mesh: the caller's issued evidence, read the way
|
|
433
|
+
* keyed runs read it. A user-auth mesh bounds the mint on its ledger instead, and an open mesh
|
|
434
|
+
* mints no grant, so both return `exempt`. So does a call with no authenticated caller, which is
|
|
435
|
+
* the manager's own composition root (roster boot, a manifest `launch`, which a static mesh mints
|
|
436
|
+
* only into operator instruments). A workflow run's spawn, whether this manager hosts the run or
|
|
437
|
+
* its spawn reached this manager from another host ({@link spawnRun}), is bounded by the run's admission (SPEC 14.8):
|
|
438
|
+
* the ceiling it recorded, at the starter's coordinate, unless the starter was exempt then. That
|
|
439
|
+
* ceiling is the starter's evidence as resolved at admission, or for a local run the channels the
|
|
440
|
+
* operator named. Any other caller with no issued generation, or whose evidence does not resolve,
|
|
441
|
+
* hands on no grant. The evidence's own standing decides the rest.
|
|
442
|
+
*/
|
|
443
|
+
async staticSpawnBound(caller, run) {
|
|
444
|
+
if (this.deps.meshMode() !== "static" || caller === undefined)
|
|
445
|
+
return { kind: "exempt" };
|
|
446
|
+
// The driver's own credential is not the run's authority, and the starter's evidence may have
|
|
447
|
+
// expired or changed since: the admission recorded both the ceiling and the verdict.
|
|
448
|
+
if (run !== undefined) {
|
|
449
|
+
const admission = run.admission;
|
|
450
|
+
// Read leader-served before each of the run's spawns, so a run revoked mid-step starts no
|
|
451
|
+
// helper, and a marker this manager cannot read refuses the spawn too. The marker of a run
|
|
452
|
+
// hosted elsewhere was read with its admission.
|
|
453
|
+
let refusal;
|
|
454
|
+
if (run.hosted)
|
|
455
|
+
try {
|
|
456
|
+
const revoked = (await this.deps.runHosting().admission(admission.runId)).revoked;
|
|
457
|
+
if (revoked !== undefined)
|
|
458
|
+
refusal = revokedRunRefusal(admission.runId, revoked);
|
|
459
|
+
}
|
|
460
|
+
catch (e) {
|
|
461
|
+
refusal = `run ${admission.runId}'s revocation marker could not be read (${rejectionText(e)}), so it starts no helper (SPEC 14.8)`;
|
|
462
|
+
}
|
|
463
|
+
if (refusal !== undefined)
|
|
464
|
+
return { kind: "refused", reason: refusal };
|
|
465
|
+
if (admission.spawnExempt)
|
|
466
|
+
return { kind: "exempt" };
|
|
467
|
+
// The helper is projected at the admitted coordinate, which needs a lifecycle token. A local
|
|
468
|
+
// admission written before its uid was one records the CLI's own holder id, and bounds nothing.
|
|
469
|
+
try {
|
|
470
|
+
assertLifecycleToken(admission.caller.uid);
|
|
471
|
+
}
|
|
472
|
+
catch {
|
|
473
|
+
return { kind: "refused", reason: `run ${admission.runId}'s admission records caller uid ${JSON.stringify(admission.caller.uid)}, which is not a lifecycle token, so its helpers cannot be measured and it starts none. Start the run again (SPEC 14.8)` };
|
|
474
|
+
}
|
|
475
|
+
return { kind: "bounded", caller: admission.caller, ceiling: admission.ceiling, run: admission.runId };
|
|
476
|
+
}
|
|
477
|
+
if (!isIssuedCaller(caller))
|
|
478
|
+
return { kind: "none", reason: "its credential carries no issued generation (an unissued mint or a legacy rail)" };
|
|
479
|
+
const ref = { space: this.deps.space(), owner: caller.owner, actor: caller.actor, uid: caller.uid, generation: caller.generation };
|
|
480
|
+
try {
|
|
481
|
+
const { evidence } = await withIssuerSession({ servers: this.deps.servers() ?? DEFAULT_SERVER, space: this.deps.space(), auth: this.deps.auth(), tls: false }, (s) => s.store.resolve(ref, s.sourceIsLive));
|
|
482
|
+
return issuedSpawnerStanding(evidence) === "bounded" ? { kind: "bounded", caller, ceiling: evidence.permissions } : { kind: "exempt" };
|
|
483
|
+
}
|
|
484
|
+
catch (e) {
|
|
485
|
+
return { kind: "none", reason: `its issued evidence does not resolve: ${rejectionText(e)}` };
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
/** The refusal for a grant its static spawner does not hold, or `undefined` when it holds all of
|
|
489
|
+
* it. Each part is named, so the caller can drop exactly what overreached. `armsEvents` is whether
|
|
490
|
+
* the helper's own event plane will be minted: that row is keyed on a principal allocated later,
|
|
491
|
+
* so it is measured as the spawner's own, the rule the ledger applies. `door` names the command
|
|
492
|
+
* being bounded: a persona definition is bounded against its definer as a spawn is. */
|
|
493
|
+
spawnBoundRefusal(bound, grant, armsEvents, door = "spawn") {
|
|
494
|
+
if (bound.kind === "exempt")
|
|
495
|
+
return undefined;
|
|
496
|
+
if (bound.kind === "refused")
|
|
497
|
+
return `${door}: ${bound.reason}`;
|
|
498
|
+
let over;
|
|
499
|
+
let eventsOver;
|
|
500
|
+
try {
|
|
501
|
+
over = bound.kind === "none" ? grantParts(grant) : grantOverreach(this.deps.space(), bound.caller, bound.ceiling, grant);
|
|
502
|
+
eventsOver = armsEvents && (bound.kind === "none"
|
|
503
|
+
|| grantOverreach(this.deps.space(), bound.caller, bound.ceiling, { allowPublish: [eventChannel({ owner: bound.caller.owner, actor: bound.caller.actor })] }).length > 0);
|
|
504
|
+
}
|
|
505
|
+
catch (e) {
|
|
506
|
+
return `${door}: ${rejectionText(e)}`;
|
|
507
|
+
}
|
|
508
|
+
if (!over.length && !eventsOver)
|
|
509
|
+
return undefined;
|
|
510
|
+
const named = [
|
|
511
|
+
// A role is handed on by a spawner whose credential binds that role's task queue: its own
|
|
512
|
+
// role, or a `role:<r>` token in its capabilities.
|
|
513
|
+
...over.map((o) => o.field === "role" ? `role ${o.value} (a spawner hands on a role it was given as its own or as the \`role:${o.value}\` capability)` : `${o.field} ${o.value}`),
|
|
514
|
+
...(eventsOver ? ["events (the helper's own event plane; pass events: false to spawn without it)"] : []),
|
|
515
|
+
].join(", ");
|
|
516
|
+
if (door === "define-persona")
|
|
517
|
+
return bound.kind === "none"
|
|
518
|
+
? `define-persona: the definer holds no issued evidence (SPEC 13.15), so its persona can grant nothing: ${bound.reason}. This persona asks for ${named}. ` +
|
|
519
|
+
`Define it without these, or start the definer under a manager (\`cotal spawn --detach\`), whose seats carry issued evidence.`
|
|
520
|
+
: `define-persona: this persona grants more than the definer holds: ${named}. A definer hands on only what its own issued credential carries (SPEC 13.15). ` +
|
|
521
|
+
`Drop these from the persona, or have the operator widen the definer's own persona.`;
|
|
522
|
+
if (bound.kind === "bounded" && bound.run !== undefined)
|
|
523
|
+
return `spawn: this spawn hands its helper more than run ${bound.run}'s starter held when the run was admitted: ${named}. ` +
|
|
524
|
+
`A run hands on only what its admission recorded: its starter's issued credential, or for a \`--local\` run the channels named by \`--admit-read\` and \`--admit-publish\` (SPEC 14.8). ` +
|
|
525
|
+
`Drop these from the persona or the spawn, or start the run from a caller that holds them.`;
|
|
526
|
+
return bound.kind === "none"
|
|
527
|
+
? `spawn: the spawner holds no issued evidence (SPEC 13.15), so it hands on no grant: ${bound.reason}. This spawn asks for ${named}. ` +
|
|
528
|
+
`Spawn a persona that names none of these, or start the spawner under a manager (\`cotal spawn --detach\`), whose seats carry issued evidence.`
|
|
529
|
+
: `spawn: this spawn hands its helper more than the spawner holds: ${named}. A spawner hands on only what its own issued credential carries (SPEC 13.15). ` +
|
|
530
|
+
`Drop these from the persona or the spawn, or have the operator widen the spawner's own persona.`;
|
|
531
|
+
}
|
|
532
|
+
/** Ordinary static control seats can read their holding instance. A run's recorded ceiling is
|
|
533
|
+
* authoritative, so its helpers receive no additional instance reads. */
|
|
534
|
+
managedStaticInstanceReads(capabilities) {
|
|
535
|
+
if (this.deps.meshMode() !== "static" || !this.deps.managerInstanceId() || !capabilities?.some(c => c === "spawn" || c === "run" || c === "admin"))
|
|
536
|
+
return [];
|
|
537
|
+
return ["describe", "inspect"].map(command => ({
|
|
538
|
+
endpoint: MANAGER_ENDPOINT, command, instanceId: this.deps.managerInstanceId(), instanceOnly: true,
|
|
539
|
+
}));
|
|
540
|
+
}
|
|
541
|
+
/** Spawn a teammate by persona ref (`name` loads `.cotal/agents/<name>.md`; the peer presents
|
|
542
|
+
* under that file's own `name:`), as if a peer asked via the control plane. Used to pre-spawn the
|
|
543
|
+
* demo's experts at startup so the manager owns them. */
|
|
544
|
+
async startByName(name) {
|
|
545
|
+
return this.deps.startAgent({ name });
|
|
546
|
+
}
|
|
547
|
+
/** Resolve once `name` shows up on the mesh roster (presence registered), or after `timeoutMs`.
|
|
548
|
+
* Lets the pre-spawn loop stagger heavy agent cold-starts so they don't all boot at once.
|
|
549
|
+
* Best-effort, keyed on the manager-owned (auto-numbered, unique) spawn name — NOT identity
|
|
550
|
+
* resolution: a same-named *unmanaged* peer already present could satisfy this early. That's
|
|
551
|
+
* acceptable for cold-start staggering; it never routes anything. */
|
|
552
|
+
async waitForPresence(name, timeoutMs = 30_000) {
|
|
553
|
+
const deadline = Date.now() + timeoutMs;
|
|
554
|
+
while (Date.now() < deadline) {
|
|
555
|
+
if (this.deps.ep().getRoster().some((p) => p.card.name === name))
|
|
556
|
+
return true;
|
|
557
|
+
await new Promise((r) => setTimeout(r, 1_000));
|
|
558
|
+
}
|
|
559
|
+
return false;
|
|
560
|
+
}
|
|
561
|
+
/** {@link SeatStart.startActive}. */
|
|
562
|
+
startActive(...args) { return this.seatStart.startActive(...args); }
|
|
563
|
+
// Read by the resolve-cwd mutation in checkSpawnCwd (resolve-cwd.json/1); not private, so it
|
|
564
|
+
// compiles while nothing else here reads it.
|
|
565
|
+
get workspaceRoot() { return this.deps.workspaceRoot(); }
|
|
566
|
+
}
|
|
567
|
+
//# sourceMappingURL=seat-launch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"seat-launch.js","sourceRoot":"","sources":["../src/seat-launch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACxE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,cAAc,EAAE,aAAa,EAAE,eAAe,EAAE,YAAY,EAAE,qBAAqB,EAAE,cAAc,EAAE,UAAU,EAAE,cAAc,EAAE,qBAAqB,EAAE,eAAe,EAAE,qBAAqB,EAAE,YAAY,EAAE,QAAQ,EAAE,aAAa,EAAE,cA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