@cotal-ai/manager 0.171.0 → 0.171.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,552 @@
1
+ import { clearGoalIndex, clearSpaceHistory, commitGoalResult, DEFAULT_SERVER, deprovisionTargetPrincipal, describeCleanupFailures, DEV_OWNER, EpEnvelopeError, fenceLifecycleAcl, isChannelFamily, isConcreteChannel, managedRetirementOpId, mintCreds, newIdentity, parsePrincipalKey, principalKey, rejectionText, transitionGoal } from "@cotal-ai/core";
2
+ import { agentLifecycleSecretFilePaths } from "@cotal-ai/workspace";
3
+ import { controlShutdown } from "./control-shutdown.js";
4
+ import { removeInlineSnapshot } from "./launch.js";
5
+ import { withTimeout } from "./manager-timeout.js";
6
+ /** Upper bound on a detached agent-exit deprovision (#159 B2). A wedged broker must not leave the
7
+ * fire-and-forget teardown pending forever with no log — past this it rejects into freeSlot's fail-loud
8
+ * `.catch`. Generous over the helper's 5s connect timeout to allow the two consumer-deletes + ACL purge
9
+ * + drain on a healthy-but-slow broker. */
10
+ export const DEPROVISION_TIMEOUT_MS = 15_000;
11
+ /** Operator-facing phrasing per cause. Kept beside the union so adding a member without a sentence
12
+ * is a type error rather than a blank in the log. The stop family's sentences carry the principal
13
+ * from the cause, so they render through {@link STOP_CAUSE_TEXT} under the same exhaustive-Record
14
+ * discipline: a new stop kind without a renderer is a type error too. */
15
+ const FREE_SLOT_CAUSE_TEXT = {
16
+ "process-exit": "its own process exited and this manager did not stop it",
17
+ "pi-crash-loop": "this manager retired it after a Pi crash loop",
18
+ "pi-recovery-failed": "this manager retired it after Pi session recovery failed",
19
+ "supervise-crash-loop": "this manager retired it after its supervise restart budget was spent",
20
+ "supervise-recovery-failed": "this manager retired it after a supervised restart failed",
21
+ "session-bind-failed": "this manager stopped it: its host session could not be bound at launch",
22
+ "resume-session-rebind-failed": "this manager stopped it: its host session could not be rebound on resume",
23
+ "carried-fork-refused": "this manager stopped it: it recorded no fork of the carried transcript",
24
+ "resume-custody-unrecorded": "this manager stopped it: its custody reference could not be recorded on resume",
25
+ "supervise-record-failed": "this manager stopped it: its supervise policy could not be recorded for a manager restart",
26
+ "inline-snapshot-changed": "this manager retired it instead of restarting it: its inline persona snapshot changed after launch",
27
+ };
28
+ /** The stop family's sentences — the same job {@link FREE_SLOT_CAUSE_TEXT} does for the string
29
+ * causes, beside it so both stay the single place a cause becomes a sentence. A requested stop's
30
+ * sentence embeds the authenticated principal and a recursive reap's embeds the parent that
31
+ * left, so they cannot sit in a static Record keyed by kind; this exhaustive switch is their
32
+ * single home, and the `satisfies never` default keeps the discipline: a new stop kind without a
33
+ * sentence is a type error rather than a blank in the log. */
34
+ function stopCauseText(cause) {
35
+ switch (cause.kind) {
36
+ case "stopped-requested": return `this manager stopped it at ${cause.requester}'s request`;
37
+ case "stopped-self": return "it stopped itself (self-stop)";
38
+ case "stopped-reap": return `this manager stopped it because its parent ${cause.parent} left (recursive reap)`;
39
+ case "stopped-shutdown": return "this manager stopped it on manager shutdown";
40
+ case "stopped-once": return `this manager stopped it: its once task ended (${cause.reason})`;
41
+ default: return cause;
42
+ }
43
+ }
44
+ /** The reason a once task is cancelled with when a stop of this kind ends its seat first. */
45
+ function onceStopReason(cause) {
46
+ switch (cause.kind) {
47
+ case "stopped-requested": return "despawned";
48
+ case "stopped-self": return "stopped-itself";
49
+ case "stopped-reap": return "parent-left";
50
+ case "stopped-shutdown": return "manager-shutdown";
51
+ case "stopped-once": return cause.reason;
52
+ default: return cause;
53
+ }
54
+ }
55
+ /** Stopping a seat, recording why it left, reaping its children, and the named despawn doors. */
56
+ export class SeatStop {
57
+ deps;
58
+ constructor(deps) {
59
+ this.deps = deps;
60
+ }
61
+ // The Manager members these bodies read, under their Manager names. Each reads through its dep at
62
+ // use, so a field the Manager assigns later is current and a method a test replaces on the Manager
63
+ // is the one that runs.
64
+ get agentGoals() { return this.deps.agentGoals(); }
65
+ get agents() { return this.deps.agents(); }
66
+ get auth() { return this.deps.auth(); }
67
+ get ep() { return this.deps.ep(); }
68
+ get execution() { return this.deps.execution(); }
69
+ get goalWriter() { return this.deps.goalWriter(); }
70
+ get lifecycleInFlight() { return this.deps.lifecycleInFlight(); }
71
+ set lifecycleInFlight(value) { this.deps.setLifecycleInFlight(value); }
72
+ get maintenanceState() { return this.deps.maintenanceState(); }
73
+ get managerInstanceId() { return this.deps.managerInstanceId(); }
74
+ get remoteAuthority() { return this.deps.remoteAuthority(); }
75
+ get retirement() { return this.deps.retirement(); }
76
+ get servers() { return this.deps.servers(); }
77
+ get serviceServe() { return this.deps.serviceServe(); }
78
+ get space() { return this.deps.space(); }
79
+ get unverifiedStops() { return this.deps.unverifiedStops(); }
80
+ set unverifiedStops(value) { this.deps.setUnverifiedStops(value); }
81
+ get workspaceRoot() { return this.deps.workspaceRoot(); }
82
+ assertGoalWriterEpochCurrent(...args) { return this.deps.assertGoalWriterEpochCurrent(...args); }
83
+ authorizeNamed(...args) { return this.deps.authorizeNamed(...args); }
84
+ awaitHandleExit(...args) { return this.deps.awaitHandleExit(...args); }
85
+ beginLifecycle(...args) { return this.deps.beginLifecycle(...args); }
86
+ confirmRetirement(...args) { return this.deps.confirmRetirement(...args); }
87
+ emitGoalProgress(...args) { return this.deps.emitGoalProgress(...args); }
88
+ executionRefusal(...args) { return this.deps.executionRefusal(...args); }
89
+ expireGoalAcceptance(...args) { return this.deps.expireGoalAcceptance(...args); }
90
+ freeSlot(...args) { return this.deps.freeSlot(...args); }
91
+ maintenanceError(...args) { return this.deps.maintenanceError(...args); }
92
+ managedPrincipal(...args) { return this.deps.managedPrincipal(...args); }
93
+ readManagedSessionState(...args) { return this.deps.readManagedSessionState(...args); }
94
+ recoverManagedSession(...args) { return this.deps.recoverManagedSession(...args); }
95
+ releaseLifecycle(...args) { return this.deps.releaseLifecycle(...args); }
96
+ shredUserSecrets(...args) { return this.deps.shredUserSecrets(...args); }
97
+ trackDeprovision(...args) { return this.deps.trackDeprovision(...args); }
98
+ /** Tear an agent down — the single chokepoint for every stop path (despawn, self-stop, reap). On
99
+ * Windows a graceful stop can't ride a signal (ConPTY delivers none, so the agent never runs its
100
+ * exit handlers / leaves the mesh), so first send a cooperative `{op:"shutdown"}` over its authed
101
+ * control endpoint; the agent exits cleanly and the runtime hard-kills as a fallback after its
102
+ * grace window. POSIX delivers SIGTERM→SIGKILL natively, so it keeps the signal path. A hard stop
103
+ * (`graceful:false`, e.g. emergency reap) skips the cooperative step on every platform.
104
+ *
105
+ * Never throws (#159 B2): a runtime hard-stop CAN throw (tmux `closeWindow` / cmux `closeWorkspace`
106
+ * are direct calls), and a throwing stop must not abort a caller's cleanup and leak the agent's
107
+ * footprint, nor (in `reapChildrenOf`) abort the reap of later siblings. The failure is logged and
108
+ * returned: a caller that must prove exit (shutdown, a failed resume) reports it as the cause at
109
+ * once instead of waiting out a stop the runtime already refused. */
110
+ stopHandle(a, graceful, cause) {
111
+ // The TERMINALIZING latch: flipped SYNCHRONOUSLY, before any await anywhere on
112
+ // this stop path — later renewals refuse, while an already-admitted renewal drains before the
113
+ // durable terminal begins.
114
+ a.terminalizing = true;
115
+ a.stopCause ??= cause;
116
+ try {
117
+ // A delegated seat's close runs only inside its retirement, after the host revoked its grant,
118
+ // so stopping it starts that retirement. Every exit wait on a stop path then settles on that
119
+ // close; the free path's own teardown joins the same flight.
120
+ if (a.handedOff)
121
+ this.trackDeprovision(this.teardownTarget(a));
122
+ else
123
+ a.handle.stop({ graceful });
124
+ // The runtime captured its cohort synchronously before the cooperative
125
+ // request can let a root exit and orphan its already-running children.
126
+ if (graceful && process.platform === "win32" && a.control)
127
+ controlShutdown(a.control);
128
+ }
129
+ catch (e) {
130
+ const failure = rejectionText(e);
131
+ console.error(`stop ${a.name} (${a.id}): ${failure}`);
132
+ return failure;
133
+ }
134
+ }
135
+ /** Windows PTY stops release their name only after the captured process cohort and PTY exited. */
136
+ async stopWindowsSeat(a, graceful, floor, cause) {
137
+ if (a.once)
138
+ a.once.stopReason ??= onceStopReason(cause);
139
+ const failure = this.stopHandle(a, graceful, cause);
140
+ this.lifecycleInFlight++;
141
+ try {
142
+ if (failure !== undefined)
143
+ throw new Error(failure);
144
+ await this.awaitHandleExit(a.handle);
145
+ this.unverifiedStops = this.unverifiedStops.filter((stopped) => stopped.handle !== a.handle);
146
+ this.freeSlot(a, floor, cause, true);
147
+ }
148
+ catch (error) {
149
+ const detail = `Windows stop could not prove the captured process tree exited: ${rejectionText(error)}`;
150
+ this.unverifiedStops = this.unverifiedStops.filter((stopped) => stopped.handle !== a.handle);
151
+ this.unverifiedStops.push({ name: a.name, id: a.id, handle: a.handle, authoritative: true, error: detail });
152
+ throw new EpEnvelopeError("unavailable", detail, undefined, "unknown");
153
+ }
154
+ finally {
155
+ this.releaseLifecycle();
156
+ }
157
+ }
158
+ /** Keep an accepted stop inside the lifecycle drain until the runtime proves the child is gone,
159
+ * so a maintenance prepare can never fence ahead of a child that is still dying. The `cause` is
160
+ * the stop-family cause the door already knows (which door, and who asked); it rides every
161
+ * freeSlot below so the reap line can say it.
162
+ *
163
+ * An operator-accepted stop frees its slot at once: `stop` replying ✓ means `ps` no longer lists
164
+ * the agent. That cannot omit a still-live child from a cut, because runPreparation drains the
165
+ * lifecycle BEFORE it reads the roster — the exit proof below is what closes the race, not the
166
+ * slot lingering. A recursive reap (`requireAuthoritativeExit`) instead keeps the slot until the
167
+ * wait proves exit: nobody asked for those children to be gone, so they stay managed until the
168
+ * runtime says otherwise, and a runtime that cannot prove exit records an unverified stop. */
169
+ trackStoppedHandle(a, floor, cause, requireAuthoritativeExit = false) {
170
+ if (process.platform === "win32" && a.handle.kind === "pty")
171
+ requireAuthoritativeExit = true;
172
+ // What a once seat's task is cancelled with if this stop ends it before the task has a terminal.
173
+ if (a.once && typeof cause !== "string")
174
+ a.once.stopReason ??= onceStopReason(cause);
175
+ if (!a.handle.waitForExit) {
176
+ // Preserve ordinary external-runtime stop behavior, but retain enough evidence for a later
177
+ // maintenance prepare to fail if that runtime still cannot prove the surface disappeared.
178
+ this.unverifiedStops.push({
179
+ name: a.name,
180
+ id: a.id,
181
+ handle: a.handle,
182
+ authoritative: requireAuthoritativeExit,
183
+ error: requireAuthoritativeExit
184
+ ? `recursive reap cannot prove exit on runtime "${a.handle.kind}" (AgentHandle.waitForExit is not implemented)`
185
+ : undefined,
186
+ });
187
+ if (requireAuthoritativeExit)
188
+ return;
189
+ this.freeSlot(a, floor, cause, true);
190
+ return;
191
+ }
192
+ if (!requireAuthoritativeExit)
193
+ this.freeSlot(a, floor, cause, true);
194
+ this.lifecycleInFlight++;
195
+ void this.awaitHandleExit(a.handle)
196
+ .then(() => {
197
+ this.unverifiedStops = this.unverifiedStops.filter((stopped) => stopped.handle !== a.handle);
198
+ this.freeSlot(a, floor, cause, true);
199
+ }) // no-op once an accepted stop already freed it
200
+ .catch((e) => {
201
+ this.unverifiedStops = this.unverifiedStops.filter((stopped) => stopped.handle !== a.handle);
202
+ this.unverifiedStops.push({
203
+ name: a.name,
204
+ id: a.id,
205
+ handle: a.handle,
206
+ authoritative: true,
207
+ error: `accepted stop could not prove exit: ${rejectionText(e)}`,
208
+ });
209
+ })
210
+ .finally(() => this.releaseLifecycle());
211
+ }
212
+ /**
213
+ * WHY A SEAT LEFT — one line, at the one place every free path passes through.
214
+ *
215
+ * A manager that had held twelve seats could not say why any of them had died: the log carried no
216
+ * per-seat exit line at all, so "the supervisor reaped them" and "they died on their own" were
217
+ * indistinguishable after the fact and the incident was unattributable. `freeSlot` is the single
218
+ * chokepoint for despawn, self-stop, reap and exit, which is why the line lives here rather than
219
+ * being remembered at each of the six callers.
220
+ *
221
+ * THE RUNTIME'S EXIT DETAIL IS OPTIONAL AND ITS ABSENCE IS SAID OUT LOUD. `AgentHandle.exitInfo`
222
+ * is only implemented by backends that own the child process; the rest genuinely cannot see how
223
+ * it ended. Printing `code 0` for those would be a fabricated clean exit on exactly the seats
224
+ * whose death nobody can explain, so an absent answer prints as unavailable and names the runtime
225
+ * that could not provide it.
226
+ */
227
+ logSeatReaped(a, cause) {
228
+ const causeText = typeof cause === "string" ? FREE_SLOT_CAUSE_TEXT[cause] : stopCauseText(cause);
229
+ let detail;
230
+ try {
231
+ const info = a.handle.exitInfo?.();
232
+ detail = info === undefined
233
+ ? `exit detail unavailable from runtime "${a.handle.kind}"`
234
+ : `exit code ${info.code ?? "unknown"}${info.signal === undefined ? "" : `, signal ${info.signal}`}${info.diagnostic ? `; diagnostic: ${info.diagnostic}` : ""}`;
235
+ }
236
+ catch (e) {
237
+ // A runtime that throws while being asked has told us something real; it must not take the
238
+ // log line (or the free path it sits on) down with it.
239
+ detail = `exit detail unreadable from runtime "${a.handle.kind}": ${rejectionText(e)}`;
240
+ }
241
+ console.error(`seat reaped: ${a.name} (${a.id}, uid ${a.lifecycleUid}${a.handle.pid !== undefined ? `, pid ${a.handle.pid}` : ""}) - ${causeText}; ${detail}`);
242
+ }
243
+ /**
244
+ * A SEAT THAT LEAVES THE MESH WHILE ITS SLOT IS HELD GETS A LINE, AND SO DOES ITS RETURN.
245
+ *
246
+ * Seats once read `running · mesh offline` for many hours with no manager log line, so a watchdog
247
+ * keyed on process liveness saw nothing wrong and nobody could say when each seat dropped (#1208).
248
+ * The line follows the same state `ps` reads, checked on every roster change and view transition,
249
+ * because not every offline record arrives as a presence event: after a reconnect the fresh snapshot
250
+ * records an already-offline seat quietly. Only a current view is a verdict, so a stale or
251
+ * unpopulated one logs nothing. The match is {@link isOwnPresence}. A seat being stopped is left to
252
+ * the reap line. The heartbeat is the seat's own record and nothing validated it, so an unreadable
253
+ * one prints as unknown instead of throwing inside the watch.
254
+ */
255
+ logSeatMeshTransitions() {
256
+ if (typeof this.ep.presenceView === "function" && this.ep.presenceView().state !== "current")
257
+ return;
258
+ const roster = new Map(this.ep.getRoster().map((p) => [p.card.id, p]));
259
+ for (const a of this.agents.values()) {
260
+ const seen = roster.get(this.managedPrincipal(a));
261
+ if (a.terminalizing || !this.isOwnPresence(a, seen))
262
+ continue;
263
+ if (seen.status !== "offline")
264
+ a.joinIssue = undefined;
265
+ const who = `${a.name} (${a.id}, uid ${a.lifecycleUid}${a.handle.pid !== undefined ? `, pid ${a.handle.pid}` : ""})`;
266
+ if (seen.status === "offline" && !a.offMesh) {
267
+ a.offMesh = true;
268
+ const ts = seen.ts;
269
+ const last = typeof ts === "number" && !Number.isNaN(new Date(ts).getTime()) ? new Date(ts).toISOString() : "unknown";
270
+ console.error(`seat offline on the mesh: ${who} - last heartbeat ${last}; process ${a.handle.status()}`);
271
+ }
272
+ else if (seen.status !== "offline" && a.offMesh) {
273
+ a.offMesh = false;
274
+ console.error(`seat back on the mesh: ${who}`);
275
+ }
276
+ }
277
+ }
278
+ /** Whether a roster record is this seat's own: the readiness fence's exact principal and
279
+ * incarnation, so a same-named foreign peer or an older incarnation never speaks for it (#1208). */
280
+ isOwnPresence(a, p) {
281
+ return p !== undefined && p.card.id === this.managedPrincipal(a) && p.lifecycleUid === a.lifecycleUid;
282
+ }
283
+ /** Remove one lifecycle's inline snapshot by the path its uid derives, never by a recorded one, so a
284
+ * resume inventory cannot point the removal at another file. Returns whether the file is gone. A
285
+ * failure is logged, never thrown, because the callers must still schedule the teardown. */
286
+ dropInlineSnapshot(name, lifecycleUid) {
287
+ try {
288
+ removeInlineSnapshot(this.workspaceRoot, lifecycleUid);
289
+ return true;
290
+ }
291
+ catch (e) {
292
+ console.error(`! ${name}: its inline persona snapshot could not be removed: ${rejectionText(e)}`);
293
+ return false;
294
+ }
295
+ }
296
+ /** A live agent's teardown target, built field by field so the rest of its record (handle, seed,
297
+ * restart state) never rides into the detached teardown or its single-flight map. */
298
+ teardownTarget(a) {
299
+ return { id: a.id, name: a.name, lifecycleUid: a.lifecycleUid, userOwner: a.userOwner, delegated: a.delegated, secretPaths: a.secretPaths, runtime: a.handle?.reference, ...(a.handedOff ? { delegatedHandle: a.handle } : {}), launch: { allowSubscribe: a.launch.allowSubscribe }, staticCredentialRenewal: a.staticCredentialRenewal };
300
+ }
301
+ /** Narrow the retiring lifecycle's read-ACL row to no reads ({@link fenceLifecycleAcl}) through a
302
+ * `deprovisioner` credential pinned to it. Returns undefined once fenced, or the reason it was not. */
303
+ async fenceRetiringAcl(a) {
304
+ try {
305
+ const creds = await mintCreds(this.auth, newIdentity(), "deprovisioner", { deprovisionTarget: { principal: a.id, lifecycleUid: a.lifecycleUid, memberChannels: [] } });
306
+ await withTimeout(fenceLifecycleAcl({ servers: this.servers ?? DEFAULT_SERVER, space: this.space, targetId: a.id, lifecycleUid: a.lifecycleUid, creds }), DEPROVISION_TIMEOUT_MS, `fence ${a.id}: the ACL fence timed out`);
307
+ return undefined;
308
+ }
309
+ catch (e) {
310
+ return rejectionText(e);
311
+ }
312
+ }
313
+ /** The retiring lifecycle's durable membership channels, read from the delivery daemon's
314
+ * `lifecycleMemberships` admin verb (read-only, lifecycle-exact). Incomplete on any refusal. */
315
+ async lifecycleMembershipInventory(a) {
316
+ const t = deprovisionTargetPrincipal({ principal: a.id, lifecycleUid: a.lifecycleUid });
317
+ try {
318
+ const r = await this.ep.requestDeliveryAdmin("lifecycleMemberships", { principal: principalKey(t.owner, t.actor).key, lifecycleUid: t.lifecycleUid }, 5_000);
319
+ const data = r.data;
320
+ if (!r.ok || data?.complete !== true || !Array.isArray(data.channels) || !data.channels.every((c) => typeof c === "string" && (isConcreteChannel(c) || isChannelFamily(c))))
321
+ return { complete: false, channels: [], reason: r.ok ? "malformed inventory reply" : (r.error ?? "refused") };
322
+ return { complete: true, channels: data.channels };
323
+ }
324
+ catch (e) {
325
+ return { complete: false, channels: [], reason: rejectionText(e) };
326
+ }
327
+ }
328
+ /** Reap a parent's children on its exit (P4b). Every descendant remains managed until the runtime's
329
+ * authoritative wait proves exit; the wait participates in the lifecycle drain, so preservation can
330
+ * never omit a child that may still be alive. Recursive descendants are scheduled before their parent
331
+ * slot can disappear. */
332
+ reapChildrenOf(parentId) {
333
+ for (const child of [...this.agents.values()]) {
334
+ if (child.spawner !== parentId)
335
+ continue;
336
+ this.reapChildrenOf(this.managedPrincipal(child));
337
+ const cause = { kind: "stopped-reap", parent: parentId };
338
+ this.stopHandle(child, false, cause);
339
+ this.trackStoppedHandle(child, true, cause, true);
340
+ }
341
+ }
342
+ /** A managed agent's process exited: on its own (crash, /exit, finished), or after a stop this
343
+ * manager started, whose recorded cause then frees the slot. Continuation-capable Pi seats
344
+ * restart in place after readiness; a spawn carrying `supervise` restarts any connector the same
345
+ * way, without classifying a session-state file. Every other exit follows the existing terminal
346
+ * path. */
347
+ onAgentExit(a) {
348
+ // Preservation owns the child-stop snapshot. Exit watchers must neither delete that snapshot nor
349
+ // trigger normal deprovision/reap while the cut is being formed.
350
+ if (this.maintenanceState !== "active")
351
+ return;
352
+ // A Windows stop owns the exit proof and its truthful reap cause. The raw
353
+ // terminal event must not release a slot while cohort verification is pending.
354
+ if (process.platform === "win32" && a.handle.kind === "pty" && a.terminalizing)
355
+ return;
356
+ // A replacement is proving readiness under this row. Its own wait owns a failed
357
+ // relaunch; treating that exit as a seat death would free the slot mid-recovery.
358
+ if (a.restart?.recovering && !a.terminalizing)
359
+ return;
360
+ if (a.restart?.armed && !a.terminalizing) {
361
+ if (a.restart.policy !== undefined) {
362
+ this.recoverManagedSession(a);
363
+ return;
364
+ }
365
+ try {
366
+ if (this.readManagedSessionState(a).status === "running") {
367
+ this.recoverManagedSession(a);
368
+ return;
369
+ }
370
+ }
371
+ catch (error) {
372
+ console.error(`! ${a.name}: cannot classify Pi process exit for recovery: ${rejectionText(error)} - retiring the seat`);
373
+ }
374
+ }
375
+ this.freeSlot(a, true, a.stopCause ?? "process-exit");
376
+ this.reapChildrenOf(this.managedPrincipal(a));
377
+ }
378
+ async opStop(args, caller, admin) {
379
+ const name = String(args.name ?? "").trim();
380
+ const a = this.agents.get(name);
381
+ if (!a)
382
+ return { ok: false, error: `no agent "${name}"` };
383
+ try {
384
+ return await this.despawnCore(a, caller, admin, args.graceful !== false);
385
+ }
386
+ catch (error) {
387
+ return { ok: false, error: rejectionText(error) };
388
+ }
389
+ }
390
+ /** The ONE named-terminal core both doors share: the ctl named `stop`
391
+ * and the v0.4 targeted `despawn` are the same terminal — authorize by the shared policy
392
+ * ({@link authorizeNamed}: own-child / owner-domain on privileged, any on admin), stop, track.
393
+ * The ep door runs the SAME two pieces separately so a policy denial surfaces as the §13.3
394
+ * `permission-denied` (never a generic failure). */
395
+ async despawnCore(a, caller, admin, graceful) {
396
+ const denied = await this.authorizeNamed(a, caller, admin);
397
+ if (denied)
398
+ return { ok: false, error: denied };
399
+ return this.despawnAuthorized(a, graceful, !admin, caller);
400
+ }
401
+ /** The post-authorization terminal effect (both doors). `trackNonAdmin` mirrors the ctl door's
402
+ * `trackStoppedHandle(a, !admin)` disposition. The reap line names `caller` — the AUTHENTICATED
403
+ * wire principal the door already resolved — so an operator reading the log can tell one peer's
404
+ * despawn from another's. */
405
+ despawnAuthorized(a, graceful, trackNonAdmin, caller) {
406
+ if (process.platform === "win32" && a.handle.kind === "pty") {
407
+ return this.stopWindowsSeat(a, graceful, trackNonAdmin, { kind: "stopped-requested", requester: caller }).then(() => {
408
+ void this.cancelAgentGoal(a.name, graceful ? "graceful" : "terminate");
409
+ return { ok: true, data: { name: a.name, stopped: true, graceful } };
410
+ });
411
+ }
412
+ const cause = { kind: "stopped-requested", requester: caller };
413
+ this.stopHandle(a, graceful, cause);
414
+ this.trackStoppedHandle(a, trackNonAdmin, cause);
415
+ void this.cancelAgentGoal(a.name, graceful ? "graceful" : "terminate"); // Cancel a live spawn goal
416
+ return { ok: true, data: { name: a.name, stopped: true, graceful } };
417
+ }
418
+ /** Retire one agent this manager launched under a delegated user intent, through the host
419
+ * (SPEC 13.16). It sends the user's retirement intent for the UID of the running slot or its
420
+ * retirement hold, and only on `retired: true` for that exact target stops the slot, shreds the
421
+ * seat's local secret family and frees the name; every other answer leaves the slot running or
422
+ * the name held, and a failed shred keeps the name held. It never calls the holder's own prepare
423
+ * or requester. */
424
+ async retireDelegatedAgent(name, intentId) {
425
+ const execute = this.remoteAuthority?.executeDelegatedUserIntent;
426
+ if (!execute)
427
+ return { ok: false, error: `this manager has no host execution for a delegated user intent; "${name}" was not retired` };
428
+ const release = this.beginLifecycle();
429
+ if (!release)
430
+ return { ok: false, error: this.maintenanceError() };
431
+ try {
432
+ const live = this.agents.get(name);
433
+ const held = live ? undefined : this.retirement.held(name);
434
+ const principal = live?.delegated ? parsePrincipalKey(live.id) : held?.target.delegated ? held : null;
435
+ const lifecycleUid = live?.lifecycleUid ?? held?.target.lifecycleUid;
436
+ if (!principal || !lifecycleUid)
437
+ return { ok: false, error: `no agent named "${name}" was launched on this manager under a delegated user intent` };
438
+ const target = { owner: principal.owner, actor: principal.actor, lifecycleUid };
439
+ try {
440
+ const result = await execute({ intentId, operation: "retire", target });
441
+ if (result.operation !== "retire" || result.intentId !== intentId || result.opId !== managedRetirementOpId(target.lifecycleUid) ||
442
+ result.target.owner !== target.owner || result.target.actor !== target.actor || result.target.lifecycleUid !== target.lifecycleUid)
443
+ throw new Error(`the host answered delegated intent ${intentId} with another execution`);
444
+ if (result.retired !== true)
445
+ return { ok: false, error: `the host did not confirm the delegated retirement of "${name}" at ${target.lifecycleUid}; "${name}" is unchanged` };
446
+ }
447
+ catch (e) {
448
+ const error = `the delegated retirement under intent ${intentId} did not complete (${rejectionText(e)})`;
449
+ const hold = this.retirement.held(name);
450
+ if (hold?.target.lifecycleUid === target.lifecycleUid)
451
+ hold.lastError = error;
452
+ return { ok: false, error: `${error}; "${name}" is unchanged` };
453
+ }
454
+ // The host's retirement closed this UID's provider handle before its barrier, so the stop only
455
+ // reaps the slot, and its hold clears with the confirmation.
456
+ const slot = this.agents.get(name);
457
+ if (slot?.lifecycleUid === target.lifecycleUid)
458
+ await this.despawnAuthorized(slot, true, false, `delegated retirement ${intentId}`);
459
+ // The host owns the grant and the footprint, but the secret family enrollUserAgent wrote here
460
+ // is this participant's, and no teardown arm of a delegated seat removes it.
461
+ const unshredded = [];
462
+ await this.shredUserSecrets(unshredded, (live ?? held?.target)?.secretPaths ?? agentLifecycleSecretFilePaths(this.workspaceRoot, this.space, name, target.lifecycleUid));
463
+ if (unshredded.length) {
464
+ const error = `the host retired "${name}" at ${target.lifecycleUid}, but cleanup failed: ${describeCleanupFailures(unshredded)}; the name stays held until a retried retirement intent removes it`;
465
+ const hold = this.retirement.held(name);
466
+ if (hold?.target.lifecycleUid === target.lifecycleUid)
467
+ hold.lastError = error;
468
+ return { ok: false, error };
469
+ }
470
+ this.confirmRetirement({ id: principalKey(target.owner, target.actor).key, name, lifecycleUid: target.lifecycleUid });
471
+ return { ok: true, data: { name, lifecycleUid: target.lifecycleUid, retired: true } };
472
+ }
473
+ finally {
474
+ release();
475
+ }
476
+ }
477
+ /** Resolve a v0.4 TARGET triple (owner, actor, lifecycleUid — broker-validated subject/body
478
+ * agreement, currency re-checked by the serve boundary's resolver) to the live managed agent it
479
+ * names. Static agents key `(DEV_OWNER, nkey)`; user-mode agents store the principal dot-form
480
+ * in `id`. A uid mismatch is a superseded incarnation — never resolved to its successor. */
481
+ findManagedByTarget(t) {
482
+ for (const a of this.agents.values()) {
483
+ const matches = a.userOwner ? a.id === principalKey(t.owner, t.actor).key : t.owner === DEV_OWNER && a.id === t.actor;
484
+ if (matches && a.lifecycleUid === t.lifecycleUid)
485
+ return a;
486
+ }
487
+ return undefined;
488
+ }
489
+ /** Settle race: a despawn MID-GOAL drives the goal's cancel terminal - transition to
490
+ * `cancelling`, then commit the `cancel` cause on the goal-writer connection. First-terminal-fact
491
+ * wins: if the readiness outcome already committed (succeeded/failed/uncertain) the transition or
492
+ * the create-only commit loses gracefully and the readiness terminal stands. Fire-and-forget from
493
+ * despawn (the process teardown is authoritative for the agent; this settles the GOAL honestly).
494
+ * Cancel rides the despawn's own authorizeNamed reach - there is no cancel-by-goalId. */
495
+ async cancelAgentGoal(name, mode) {
496
+ const gw = this.goalWriter;
497
+ const ref = this.agentGoals.get(name);
498
+ if (!gw || !ref)
499
+ return;
500
+ this.agentGoals.delete(name);
501
+ const epoch = this.serviceServe?.grant.epoch ?? 0;
502
+ try {
503
+ await this.assertGoalWriterEpochCurrent(epoch); // a superseded corpse never commits a cancel terminal either
504
+ await transitionGoal(gw.ctx, ref, "cancelling", { fields: { cancelMode: mode } });
505
+ const r = await commitGoalResult(gw.ctx, { ref, now: Date.now(), cause: "cancel", data: { cancelledBy: "despawn" }, committer: { instanceId: this.managerInstanceId, epoch } });
506
+ this.expireGoalAcceptance(ref);
507
+ this.emitGoalProgress(ref, epoch, { phase: "terminal", state: r.fact.state, ...(r.fact.data !== undefined ? { data: r.fact.data } : {}) });
508
+ await clearGoalIndex(gw.ctx, ref); // terminal reached - the successor never reconciles it
509
+ }
510
+ catch {
511
+ // the goal already terminalized (the readiness outcome won the settle race) - nothing to cancel.
512
+ }
513
+ }
514
+ /** The membership gate: decide a control caller by its
515
+ * AUTHENTICATED wire principal. A LIVE managed slot passes (unless terminalizing); a RETIRING
516
+ * hold or a RETIRED static incarnation refuses even with a tier-valid JWT (the
517
+ * copied-credential vector — its subject can never collide with a successor's, so this match
518
+ * is non-forgeable); any OTHER principal is not a managed lifecycle (an operator instrument:
519
+ * the credential tier governs, exactly as before). Never name alone, never a payload field. */
520
+ lifecycleMembershipRefusal(caller) {
521
+ for (const a of this.agents.values()) {
522
+ if (this.managedPrincipal(a) === caller)
523
+ return a.terminalizing
524
+ ? `the caller's lifecycle ${a.lifecycleUid} is terminalizing; control is refused from the first terminal step`
525
+ : undefined;
526
+ }
527
+ return this.retirement.membershipRefusal(caller);
528
+ }
529
+ /** Purge the space's retained message backlog (chat, optionally DMs). Privileged — the manager mints a
530
+ * short-lived "purger" cred (same destructive grant as `cotal history clear`, isolated off the
531
+ * supervisor); regular agents are denied STREAM.PURGE under auth. Cleanup only: leaves live agents and
532
+ * the TASK queue alone. */
533
+ async opPurge(args, _caller) {
534
+ if (this.execution === "none")
535
+ throw new EpEnvelopeError("unimplemented", this.executionRefusal());
536
+ const includeDms = args.includeDms === true;
537
+ try {
538
+ const creds = this.auth ? await mintCreds(this.auth, newIdentity(), "purger") : undefined;
539
+ const result = await clearSpaceHistory({
540
+ servers: this.servers ?? DEFAULT_SERVER,
541
+ space: this.space,
542
+ creds,
543
+ includeDms,
544
+ });
545
+ return { ok: true, data: result };
546
+ }
547
+ catch (e) {
548
+ return { ok: false, error: rejectionText(e) };
549
+ }
550
+ }
551
+ }
552
+ //# sourceMappingURL=seat-stop.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"seat-stop.js","sourceRoot":"","sources":["../src/seat-stop.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,cAAc,EAAE,0BAA0B,EAAE,uBAAuB,EAAE,SAAS,EAAE,eAAe,EAAE,iBAAiB,EAAE,eAAe,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,SAAS,EAAE,WAAW,EAAE,iBAAiB,EAAE,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAE5V,OAAO,EAAE,6BAA6B,EAAE,MAAM,qBAAqB,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAQnD;;;4CAG4C;AAC5C,MAAM,CAAC,MAAM,sBAAsB,GAAG,MAAM,CAAC;AAE7C;;;0EAG0E;AAC1E,MAAM,oBAAoB,GAA8D;IACtF,cAAc,EAAE,yDAAyD;IACzE,eAAe,EAAE,+CAA+C;IAChE,oBAAoB,EAAE,0DAA0D;IAChF,sBAAsB,EAAE,sEAAsE;IAC9F,2BAA2B,EAAE,2DAA2D;IACxF,qBAAqB,EAAE,wEAAwE;IAC/F,8BAA8B,EAAE,0EAA0E;IAC1G,sBAAsB,EAAE,wEAAwE;IAChG,2BAA2B,EAAE,gFAAgF;IAC7G,yBAAyB,EAAE,2FAA2F;IACtH,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K,qBAAqB,EAAE,KAAK,qBAAqB,EAGxK,MAAM,qBAAqB,CAAC;AAa7B;;;;;;2DAM2D;AAC3D,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,qBAAqB,EAAE,OAAO,EAAE,qBAAqB,GAAG,SAAS,GAAG,OAAO,CASnJ;AA8JD,eAAO,MAAM,cAAc,EAAE,YA+D5B,CAAC"}
1
+ {"version":3,"file":"service-adapter.d.ts","sourceRoot":"","sources":["../src/service-adapter.ts"],"names":[],"mappings":"AAIA,OAAO,EAO2C,KAAK,YAAY,EAA6D,KAAK,qBAAqB,EAAE,KAAK,qBAAqB,EAGrL,MAAM,qBAAqB,CAAC;AAa7B;;;;;;2DAM2D;AAC3D,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,qBAAqB,EAAE,OAAO,EAAE,qBAAqB,GAAG,SAAS,GAAG,OAAO,CASnJ;AA+JD,eAAO,MAAM,cAAc,EAAE,YAgE5B,CAAC"}