@cotal-ai/manager 0.166.3 → 0.168.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 (42) hide show
  1. package/dist/attach-endpoint.d.ts.map +1 -1
  2. package/dist/attach-endpoint.js +2 -0
  3. package/dist/attach-endpoint.js.map +1 -1
  4. package/dist/console/app.js +12 -1
  5. package/dist/console/session-bundle.js +2 -0
  6. package/dist/lease-keeper.d.ts +98 -0
  7. package/dist/lease-keeper.d.ts.map +1 -0
  8. package/dist/lease-keeper.js +257 -0
  9. package/dist/lease-keeper.js.map +1 -0
  10. package/dist/managed-static-lifecycle.d.ts +247 -0
  11. package/dist/managed-static-lifecycle.d.ts.map +1 -0
  12. package/dist/managed-static-lifecycle.js +926 -0
  13. package/dist/managed-static-lifecycle.js.map +1 -0
  14. package/dist/manager-timeout.d.ts +5 -0
  15. package/dist/manager-timeout.d.ts.map +1 -0
  16. package/dist/manager-timeout.js +11 -0
  17. package/dist/manager-timeout.js.map +1 -0
  18. package/dist/manager.d.ts +201 -508
  19. package/dist/manager.d.ts.map +1 -1
  20. package/dist/manager.js +337 -3086
  21. package/dist/manager.js.map +1 -1
  22. package/dist/names-capacity.d.ts +125 -0
  23. package/dist/names-capacity.d.ts.map +1 -0
  24. package/dist/names-capacity.js +236 -0
  25. package/dist/names-capacity.js.map +1 -0
  26. package/dist/retirement.d.ts +221 -0
  27. package/dist/retirement.d.ts.map +1 -0
  28. package/dist/retirement.js +480 -0
  29. package/dist/retirement.js.map +1 -0
  30. package/dist/seat-custody.d.ts +100 -0
  31. package/dist/seat-custody.d.ts.map +1 -0
  32. package/dist/seat-custody.js +320 -0
  33. package/dist/seat-custody.js.map +1 -0
  34. package/dist/serve-plane.d.ts +228 -0
  35. package/dist/serve-plane.d.ts.map +1 -0
  36. package/dist/serve-plane.js +664 -0
  37. package/dist/serve-plane.js.map +1 -0
  38. package/dist/session-recovery.d.ts +115 -0
  39. package/dist/session-recovery.d.ts.map +1 -0
  40. package/dist/session-recovery.js +350 -0
  41. package/dist/session-recovery.js.map +1 -0
  42. package/package.json +12 -12
@@ -0,0 +1,125 @@
1
+ import { type Presence } from "@cotal-ai/core";
2
+ import type { ManagedAgent, FreeSlotCause } from "./manager.js";
3
+ import type { RetirementHold, TeardownTarget } from "./retirement.js";
4
+ import type { AttachEndReason } from "./session/index.js";
5
+ /** What holds the spawn ceiling's slots, as {@link Manager.occupancy} counts it (#906). */
6
+ export type Occupancy = {
7
+ managed: number;
8
+ reserved: number;
9
+ cooling: number;
10
+ launching: number;
11
+ used: number;
12
+ nextCoolingMs?: number;
13
+ };
14
+ /** Current manager-owned lifecycle operations used while allocating and releasing names. */
15
+ export interface NamesCapacityDeps {
16
+ userMode(): boolean;
17
+ authEnabled(): boolean;
18
+ maintenanceActive(): boolean;
19
+ roster(): readonly Presence[];
20
+ agentFor(name: string): ManagedAgent | undefined;
21
+ hasAgent(name: string): boolean;
22
+ removeAgent(name: string): void;
23
+ managedCount(): number;
24
+ predecessor(name: string): {
25
+ principal: string;
26
+ lifecycleUid: string;
27
+ } | undefined;
28
+ hasRetirementHold(name: string): boolean;
29
+ holdRetirement(name: string, hold: RetirementHold): void;
30
+ endSessionsForTarget(name: string, lifecycleUid: string, reason: AttachEndReason): void;
31
+ logSeatReaped: (agent: ManagedAgent, cause: FreeSlotCause) => void;
32
+ recordContinuityAtStop: (agent: ManagedAgent, boundary: string) => void;
33
+ releasedSeatPending: (agent: ManagedAgent) => boolean;
34
+ dropSeatRecord: (agent: ManagedAgent) => void;
35
+ failSeatTurns: (name: string, lifecycleUid: string) => void;
36
+ teardownTarget: (agent: ManagedAgent) => TeardownTarget;
37
+ dropInlineSnapshot: (name: string, lifecycleUid: string) => boolean;
38
+ trackDeprovision: (target: TeardownTarget) => void;
39
+ }
40
+ /** Allocation reservations, numbered-name history and cooling occupancy for one manager. */
41
+ export declare class NamesCapacity {
42
+ private readonly deps;
43
+ /** Names whose spawn is in flight (reserved synchronously before the provision await) - counted
44
+ * toward the ceiling (once per name, see {@link Manager.occupancy}) so two concurrent same-name
45
+ * spawns can't both pass the gate (P4a). Each name carries the OWNER its launch was admitted
46
+ * for, so the per-owner ceiling ({@link Manager.ownerSeats}) counts a launch from the moment it
47
+ * is reserved; a cap read only off `agents` would let a burst of concurrent spawns overshoot it,
48
+ * because none of them has a seat yet when the next one checks. */
49
+ private readonly reserved;
50
+ /** Reserved names whose launch already put its seat in `agents`. The name stays reserved until
51
+ * the launch settles, so no other spawn can take it, but the ceiling counts that seat through
52
+ * `agents` and, if it frees young, its cooling stamp, never through the reservation (#906). */
53
+ private readonly reservedLive;
54
+ /** Every numbered name {@link uniqueName} has issued. A suffix carries nothing but arrival order,
55
+ * so reissuing a freed one would give a later principal the name an earlier one posted under, and
56
+ * a reader of that name could not tell the two apart (#382). Never pruned in-process: one string
57
+ * per numbered spawn. */
58
+ private readonly issuedNumberedNames;
59
+ /** Expiry stamps (`startedAt + MIN_LIFETIME`) for slots that freed while still young - a
60
+ * count-only, lazily-pruned recycle floor (P4c). Pruned + summed into the ceiling gate. */
61
+ private cooling;
62
+ constructor(deps: NamesCapacityDeps);
63
+ reserve(name: string, owner: string): void;
64
+ placed(name: string): void;
65
+ release(name: string): void;
66
+ isReserved(name: string): boolean;
67
+ get reservedCount(): number;
68
+ numberedIssued(name: string): boolean;
69
+ rememberNumbered(name: string): void;
70
+ ownerReservations(owner: string): number;
71
+ /** Agent names become `.cotal/agents/<name>.md` paths and mesh identities, so they must be bare
72
+ * tokens, never a path - blocks traversal / arbitrary writes from a model-supplied name. In user
73
+ * mode the name is ALSO the actor, which is a narrower alphabet still; {@link spawnNameError}
74
+ * holds both halves so this door and the auto-numbering that feeds it cannot disagree. */
75
+ nameError(name: string): string | undefined;
76
+ /** The roster's LIVE occupant names (status !== offline) - occupants this manager may NOT manage
77
+ * (a foreground `cotal spawn`, a connector session, ANOTHER manager's agent). Allocating over any
78
+ * of them mints a sibling the broker/auth then refuses to admit, surfacing as the 30s launch-
79
+ * uncertain black hole. */
80
+ liveRosterNames(): Set<string>;
81
+ /** THE single name-liveness predicate both the hard-pinned collision refuse and
82
+ * uniqueName's numbering consult, so they can never drift: a name is taken if this manager
83
+ * reserves/manages/retires it OR a roster-live occupant already holds it. Pass a pre-built
84
+ * {@link liveRosterNames} set when checking many names in one allocation. */
85
+ nameInUse(name: string, live?: Set<string>): boolean;
86
+ /** First free name in the series `base`, `base_2`, `base_3`, … - checked against live slots,
87
+ * in-flight (reserved) slots, names held pending retirement, AND the live mesh roster. The
88
+ * roster check covers occupants this manager does not manage (a foreground `cotal spawn`, a
89
+ * connector session, another manager's agent): allocating their name would mint a sibling the
90
+ * broker/auth then refuses to admit, surfacing as a 30s launch-uncertain black hole instead of
91
+ * the auto-number the join path gives. Presence is ADVISORY (SPEC §6) - this is an availability
92
+ * choice at allocation, never an authority check (the broker still enforces): a stale
93
+ * still-live-looking row only costs a numbered suffix, and a missed freshly-joined occupant is
94
+ * still refused downstream exactly as before. Offline rows do NOT occupy - a properly retired
95
+ * name stays reusable. A row this manager itself confirmed retired (its alias, principal, and
96
+ * lifecycleUid all matching a {@link confirmedRetiredPredecessors} entry) does not occupy
97
+ * either, even while its advisory presence record ages out. A numbered name is never reissued
98
+ * ({@link issuedNumberedNames}), even after its holder retired. The requested base is exempt
99
+ * from that history: it is the persona's own name, which stays reusable even when it once came
100
+ * out of another persona's numbering. */
101
+ uniqueName(base: string, unavailable?: ReadonlySet<string>): string;
102
+ /** Drop a live agent's slot. When `floor` is set and the agent died young (lived less than
103
+ * MIN_LIFETIME), push a cooling stamp so the freed slot still counts toward the ceiling until it
104
+ * expires - flooring the RECYCLE, not the call, so both free paths (despawn + exit/reap) are
105
+ * covered (P4c). Floor self + own-child despawn and natural exit; NEVER admin despawn (operator
106
+ * emergency-kill stays unthrottled) and NEVER the reserved-rollback path (no cold-start paid). */
107
+ freeSlot(a: ManagedAgent, floor: boolean, cause: FreeSlotCause, acceptedBeforeFence?: boolean): void;
108
+ /** Prune expired cooling stamps (drop those at/before now) and return the live count - the
109
+ * recycle floor's contribution to the ceiling (P4c). Lazy: pruned only when the gate consults it. */
110
+ coolingCount(): number;
111
+ /** What holds the ceiling's slots, one count per seat (#906). A launching seat sits in `reserved`
112
+ * from accept until its launch settles, in `agents` once its process exists, and in `cooling`
113
+ * if it then frees young, so a reservation stops counting once it reaches `agents`. `managed` is
114
+ * what this manager's `ps` lists, `reserved` is the accepted launches that have no process yet,
115
+ * and `launching` is every unsettled launch that still holds a slot through `reserved` or
116
+ * `agents`. A launch whose seat already freed holds no slot but its cooling stamp, so its
117
+ * failure can free nothing. */
118
+ occupancy(): Occupancy;
119
+ occupancyText(o: Occupancy): string;
120
+ /** The capacity refusal states the split it enforces and whether waiting can free a slot: a
121
+ * cooling slot frees at a known time, an unsettled launch frees one only if it fails, and a
122
+ * managed seat frees one only when it is stopped. */
123
+ capacityRefusal(o: Occupancy): string;
124
+ }
125
+ //# sourceMappingURL=names-capacity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"names-capacity.d.ts","sourceRoot":"","sources":["../src/names-capacity.ts"],"names":[],"mappings":"AACA,OAAO,EAAsF,KAAK,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAEnI,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAChE,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAQ1D,2FAA2F;AAC3F,MAAM,MAAM,SAAS,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,aAAa,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAoBxI,4FAA4F;AAC5F,MAA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G;IACnG,QAAQ,CAAC,CAAC,EAAE,YAAY,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,mBAAmB,UAAQ,GAAG,IAAI;IA0DlG;0GACsG;IACtG,YAAY,IAAI,MAAM;IAMtB;;;;;;oCAMgC;IAChC,SAAS,IAAI,SAAS;IAoBtB,aAAa,CAAC,CAAC,EAAE,SAAS,GAAG,MAAM;IAInC;;0DAEsD;IACtD,eAAe,CAAC,CAAC,EAAE,SAAS,GAAG,MAAM;CAQtC"}
@@ -0,0 +1,236 @@
1
+ import { rmSync } from "node:fs";
2
+ import { DEV_OWNER, firstFreeName, managedRetirementOpId, parsePrincipalKey, spawnNameError } from "@cotal-ai/core";
3
+ import { MAX_AGENTS } from "./resume.js";
4
+ /** Minimum slot lifetime for rate-flooring (P4c). A slot freed (by despawn OR natural exit/reap)
5
+ * before living this long leaves a cooling stamp that still counts toward the ceiling until it
6
+ * expires - so churn (spawn↔despawn or spawn↔fast-exit) can't outrun the concurrency bound. */
7
+ const MIN_LIFETIME = 10_000;
8
+ /** The SPEC 13.6 end reason a live attach session gets when this cause frees its seat. The causes
9
+ * that free the slot in the same step that saw the seat's own process exit report `process-exit`.
10
+ * A failed recovery frees it later, after its own stop, so it reports `target-despawn` with every
11
+ * manager stop. */
12
+ const FREE_SLOT_ATTACH_END = {
13
+ "process-exit": "process-exit",
14
+ "pi-crash-loop": "process-exit",
15
+ "supervise-crash-loop": "process-exit",
16
+ "inline-snapshot-changed": "process-exit",
17
+ "pi-recovery-failed": "target-despawn",
18
+ "supervise-recovery-failed": "target-despawn",
19
+ "session-bind-failed": "target-despawn",
20
+ "resume-session-rebind-failed": "target-despawn",
21
+ "carried-fork-refused": "target-despawn",
22
+ "resume-custody-unrecorded": "target-despawn",
23
+ "supervise-record-failed": "target-despawn",
24
+ };
25
+ /** Allocation reservations, numbered-name history and cooling occupancy for one manager. */
26
+ export class NamesCapacity {
27
+ deps;
28
+ /** Names whose spawn is in flight (reserved synchronously before the provision await) - counted
29
+ * toward the ceiling (once per name, see {@link Manager.occupancy}) so two concurrent same-name
30
+ * spawns can't both pass the gate (P4a). Each name carries the OWNER its launch was admitted
31
+ * for, so the per-owner ceiling ({@link Manager.ownerSeats}) counts a launch from the moment it
32
+ * is reserved; a cap read only off `agents` would let a burst of concurrent spawns overshoot it,
33
+ * because none of them has a seat yet when the next one checks. */
34
+ reserved = new Map();
35
+ /** Reserved names whose launch already put its seat in `agents`. The name stays reserved until
36
+ * the launch settles, so no other spawn can take it, but the ceiling counts that seat through
37
+ * `agents` and, if it frees young, its cooling stamp, never through the reservation (#906). */
38
+ reservedLive = new Set();
39
+ /** Every numbered name {@link uniqueName} has issued. A suffix carries nothing but arrival order,
40
+ * so reissuing a freed one would give a later principal the name an earlier one posted under, and
41
+ * a reader of that name could not tell the two apart (#382). Never pruned in-process: one string
42
+ * per numbered spawn. */
43
+ issuedNumberedNames = new Set();
44
+ /** Expiry stamps (`startedAt + MIN_LIFETIME`) for slots that freed while still young - a
45
+ * count-only, lazily-pruned recycle floor (P4c). Pruned + summed into the ceiling gate. */
46
+ cooling = [];
47
+ constructor(deps) {
48
+ this.deps = deps;
49
+ }
50
+ reserve(name, owner) { this.reserved.set(name, owner); }
51
+ placed(name) { this.reservedLive.add(name); }
52
+ release(name) { this.reserved.delete(name); this.reservedLive.delete(name); }
53
+ isReserved(name) { return this.reserved.has(name); }
54
+ get reservedCount() { return this.reserved.size; }
55
+ numberedIssued(name) { return this.issuedNumberedNames.has(name); }
56
+ rememberNumbered(name) { this.issuedNumberedNames.add(name); }
57
+ ownerReservations(owner) {
58
+ let count = 0;
59
+ for (const [name, reservedFor] of this.reserved)
60
+ if (reservedFor === owner && !this.reservedLive.has(name))
61
+ count++;
62
+ return count;
63
+ }
64
+ /** Agent names become `.cotal/agents/<name>.md` paths and mesh identities, so they must be bare
65
+ * tokens, never a path - blocks traversal / arbitrary writes from a model-supplied name. In user
66
+ * mode the name is ALSO the actor, which is a narrower alphabet still; {@link spawnNameError}
67
+ * holds both halves so this door and the auto-numbering that feeds it cannot disagree. */
68
+ nameError(name) {
69
+ return spawnNameError(name, { userMode: this.deps.userMode() });
70
+ }
71
+ /** The roster's LIVE occupant names (status !== offline) - occupants this manager may NOT manage
72
+ * (a foreground `cotal spawn`, a connector session, ANOTHER manager's agent). Allocating over any
73
+ * of them mints a sibling the broker/auth then refuses to admit, surfacing as the 30s launch-
74
+ * uncertain black hole. */
75
+ liveRosterNames() {
76
+ const live = new Set();
77
+ for (const p of this.deps.roster()) {
78
+ if (p.status === "offline")
79
+ continue;
80
+ const predecessor = this.deps.predecessor(p.card.name);
81
+ if (predecessor !== undefined && predecessor.principal === p.card.id && predecessor.lifecycleUid === p.lifecycleUid)
82
+ continue;
83
+ live.add(p.card.name);
84
+ }
85
+ return live;
86
+ }
87
+ /** THE single name-liveness predicate both the hard-pinned collision refuse and
88
+ * uniqueName's numbering consult, so they can never drift: a name is taken if this manager
89
+ * reserves/manages/retires it OR a roster-live occupant already holds it. Pass a pre-built
90
+ * {@link liveRosterNames} set when checking many names in one allocation. */
91
+ nameInUse(name, live = this.liveRosterNames()) {
92
+ return this.deps.hasAgent(name) || this.reserved.has(name) || this.deps.hasRetirementHold(name) || live.has(name);
93
+ }
94
+ /** First free name in the series `base`, `base_2`, `base_3`, … - checked against live slots,
95
+ * in-flight (reserved) slots, names held pending retirement, AND the live mesh roster. The
96
+ * roster check covers occupants this manager does not manage (a foreground `cotal spawn`, a
97
+ * connector session, another manager's agent): allocating their name would mint a sibling the
98
+ * broker/auth then refuses to admit, surfacing as a 30s launch-uncertain black hole instead of
99
+ * the auto-number the join path gives. Presence is ADVISORY (SPEC §6) - this is an availability
100
+ * choice at allocation, never an authority check (the broker still enforces): a stale
101
+ * still-live-looking row only costs a numbered suffix, and a missed freshly-joined occupant is
102
+ * still refused downstream exactly as before. Offline rows do NOT occupy - a properly retired
103
+ * name stays reusable. A row this manager itself confirmed retired (its alias, principal, and
104
+ * lifecycleUid all matching a {@link confirmedRetiredPredecessors} entry) does not occupy
105
+ * either, even while its advisory presence record ages out. A numbered name is never reissued
106
+ * ({@link issuedNumberedNames}), even after its holder retired. The requested base is exempt
107
+ * from that history: it is the persona's own name, which stays reusable even when it once came
108
+ * out of another persona's numbering. */
109
+ uniqueName(base, unavailable = new Set()) {
110
+ const live = this.liveRosterNames();
111
+ // The cap belongs to user mode alone: only there is the numbered name the actor. Static and open
112
+ // mode key the actor on the minted nkey, so a numbered name there has no length to fit.
113
+ const name = firstFreeName(base, (n) => unavailable.has(n) || this.nameInUse(n, live) || (n !== base && this.issuedNumberedNames.has(n)), this.deps.userMode() ? { actorBound: true } : undefined);
114
+ return name;
115
+ }
116
+ /** Drop a live agent's slot. When `floor` is set and the agent died young (lived less than
117
+ * MIN_LIFETIME), push a cooling stamp so the freed slot still counts toward the ceiling until it
118
+ * expires - flooring the RECYCLE, not the call, so both free paths (despawn + exit/reap) are
119
+ * covered (P4c). Floor self + own-child despawn and natural exit; NEVER admin despawn (operator
120
+ * emergency-kill stays unthrottled) and NEVER the reserved-rollback path (no cold-start paid). */
121
+ freeSlot(a, floor, cause, acceptedBeforeFence = false) {
122
+ if (this.deps.agentFor(a.name) !== a)
123
+ return; // already freed (exit raced despawn, etc.)
124
+ // The terminalizing latch also covers exit/reap paths that never rode stopHandle.
125
+ this.deps.logSeatReaped(a, cause);
126
+ a.terminalizing = true;
127
+ this.deps.removeAgent(a.name);
128
+ this.deps.recordContinuityAtStop(a, "stop");
129
+ if (a.restart?.sessionStatePath)
130
+ rmSync(a.restart.sessionStatePath, { force: true });
131
+ // A released seat's record is the next manager's only pointer to it. It stays until the
132
+ // retirement is confirmed. Dropping it here let a refused retirement leave the lifecycle active
133
+ // with nothing left for that manager to adopt.
134
+ if (!this.deps.releasedSeatPending(a))
135
+ this.deps.dropSeatRecord(a);
136
+ if (a.seatHome)
137
+ rmSync(a.seatHome, { recursive: true, force: true });
138
+ // End any live §13.6 attach session bound to THIS incarnation with the reason its cause names.
139
+ // Fires once per agent on every free path (despawn / self-stop / reap / exit) via the `agents`
140
+ // guard above; a no-op when no plane or no live session for the target.
141
+ this.deps.endSessionsForTarget(a.name, a.lifecycleUid, typeof cause === "string" ? FREE_SLOT_ATTACH_END[cause] : "target-despawn");
142
+ // The turn relay's reap hook: every pending turn addressed to THIS incarnation is stamped
143
+ // with the death, and its deadline terminal carries it as `agentDownAt`. The addressee is gone
144
+ // and no successor may answer for it; the terminal is still the deadline's, not a new reason.
145
+ this.deps.failSeatTurns(a.name, a.lifecycleUid);
146
+ if (floor && Date.now() - a.startedAt < MIN_LIFETIME)
147
+ this.cooling.push(a.startedAt + MIN_LIFETIME);
148
+ // The departed agent's own custody reference rides the teardown: the exit that freed this slot
149
+ // is usually the seat ending, but a stop that could not prove the process gone leaves one the
150
+ // terminal must still address before it frees the alias.
151
+ const target = this.deps.teardownTarget(a);
152
+ // On a USER mesh the name is RESERVED PENDING RETIREMENT - despawn started this
153
+ // lifecycle's FULL teardown (footprint + standing-authority revoke + the auth-side retirement),
154
+ // and the alias frees only when all of it completes (not the retirement alone). The detached
155
+ // deprovision below drives it; a failed revoke or an unreachable rail keeps the name held,
156
+ // re-driven by a retry. Gate on userMode BY
157
+ // CONSTRUCTION (NEW-1): a static-auth mint has no user-mode lifecycle head to retire, so the
158
+ // reservation + rail request simply don't apply there (the incidental nkey-parse used to mask
159
+ // this, but the intent is "user mode only", not "any principal-shaped id").
160
+ if (this.deps.userMode()) {
161
+ const p = parsePrincipalKey(a.id);
162
+ if (p)
163
+ this.deps.holdRetirement(a.name, { opId: managedRetirementOpId(a.lifecycleUid), owner: p.owner, actor: p.actor, target, startedAt: Date.now() });
164
+ }
165
+ else if (this.deps.authEnabled()) {
166
+ // A STATIC lifecycle now also holds its name pending its own terminal (the
167
+ // static retirement the detached deprovision below drives) - the alias frees only when the
168
+ // gate+head terminal completes, exactly the user-mode discipline. The wire principal is the
169
+ // incarnation-unique nkey; owner is the dev owner.
170
+ this.deps.holdRetirement(a.name, { opId: managedRetirementOpId(a.lifecycleUid), owner: DEV_OWNER, actor: a.id, target, startedAt: Date.now() });
171
+ }
172
+ // Auth mode: tear down the departed agent's minted broker footprint + creds file (#159 B2). The
173
+ // process is already gone, so this must never block the slot free or throw into the caller - it runs
174
+ // detached, and a failure is logged loudly (never swallowed), not retried. The `agents` guard above
175
+ // makes this fire exactly once per agent across every free path (despawn / self-stop / reap / exit).
176
+ if (!a.suppressCleanup && (this.deps.maintenanceActive() || acceptedBeforeFence)) {
177
+ // An inline seat's snapshot goes with the seat on every mesh. An open mesh runs no teardown
178
+ // below, and a preservation cut suppresses this, so a resumed seat still finds its snapshot.
179
+ // Settled means the file is gone or the seat never had one. A removal that failed is left to
180
+ // the teardown, which retries it and reports what it could not remove.
181
+ if (a.launch.source.kind !== "inline" || this.deps.dropInlineSnapshot(a.name, a.lifecycleUid))
182
+ target.snapshotSettled = true;
183
+ this.deps.trackDeprovision(target);
184
+ }
185
+ }
186
+ /** Prune expired cooling stamps (drop those at/before now) and return the live count - the
187
+ * recycle floor's contribution to the ceiling (P4c). Lazy: pruned only when the gate consults it. */
188
+ coolingCount() {
189
+ const now = Date.now();
190
+ this.cooling = this.cooling.filter((stamp) => stamp > now);
191
+ return this.cooling.length;
192
+ }
193
+ /** What holds the ceiling's slots, one count per seat (#906). A launching seat sits in `reserved`
194
+ * from accept until its launch settles, in `agents` once its process exists, and in `cooling`
195
+ * if it then frees young, so a reservation stops counting once it reaches `agents`. `managed` is
196
+ * what this manager's `ps` lists, `reserved` is the accepted launches that have no process yet,
197
+ * and `launching` is every unsettled launch that still holds a slot through `reserved` or
198
+ * `agents`. A launch whose seat already freed holds no slot but its cooling stamp, so its
199
+ * failure can free nothing. */
200
+ occupancy() {
201
+ const cooling = this.coolingCount();
202
+ let reserved = 0;
203
+ let launching = 0;
204
+ for (const name of this.reserved.keys()) {
205
+ const placed = this.reservedLive.has(name);
206
+ if (!placed)
207
+ reserved++;
208
+ if (!placed || this.deps.hasAgent(name))
209
+ launching++;
210
+ }
211
+ const managed = this.deps.managedCount();
212
+ return {
213
+ managed,
214
+ reserved,
215
+ cooling,
216
+ launching,
217
+ used: managed + reserved + cooling,
218
+ nextCoolingMs: cooling ? Math.min(...this.cooling) - Date.now() : undefined,
219
+ };
220
+ }
221
+ occupancyText(o) {
222
+ return `${o.used} of ${MAX_AGENTS} slots: ${o.managed} managed, ${o.reserved} reserved, ${o.cooling} cooling`;
223
+ }
224
+ /** The capacity refusal states the split it enforces and whether waiting can free a slot: a
225
+ * cooling slot frees at a known time, an unsettled launch frees one only if it fails, and a
226
+ * managed seat frees one only when it is stopped. */
227
+ capacityRefusal(o) {
228
+ const remedy = o.nextCoolingMs !== undefined
229
+ ? `waiting frees a cooling slot in ${Math.ceil(o.nextCoolingMs / 1000)}s, or despawn one`
230
+ : o.launching
231
+ ? `waiting frees a slot only if an unsettled launch fails (${o.launching} pending); otherwise despawn one`
232
+ : "waiting frees no slot; despawn one";
233
+ return `at capacity (${this.occupancyText(o)}); ${remedy}`;
234
+ }
235
+ }
236
+ //# sourceMappingURL=names-capacity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"names-capacity.js","sourceRoot":"","sources":["../src/names-capacity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,cAAc,EAAiB,MAAM,gBAAgB,CAAC;AACnI,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAMzC;;gGAEgG;AAChG,MAAM,YAAY,GAAG,MAAM,CAAC;AAK5B;;;oBAGoB;AACpB,MAAM,oBAAoB,GAAuE;IAC/F,cAAc,EAAE,cAAc;IAC9B,eAAe,EAAE,cAAc;IAC/B,sBAAsB,EAAE,cAAc;IACtC,yBAAyB,EAAE,cAAc;IACzC,oBAAoB,EAAE,gBAAgB;IACtC,2BAA2B,EAAE,gBAAgB;IAC7C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C;IAED,aAAa,CAAC,CAAY;QACxB,OAAO,GAAG,CAAC,CAAC,IAAI,OAAO,UAAU,WAAW,CAAC,CAAC,OAAO,aAAa,CAAC,CAAC,QAAQ,cAAc,CAAC,CAAC,OAAO,UAAU,CAAC;IAChH,CAAC;IAED;;0DAEsD;IACtD,eAAe,CAAC,CAAY;QAC1B,MAAM,MAAM,GAAG,CAAC,CAAC,aAAa,KAAK,SAAS;YAC1C,CAAC,CAAC,mCAAmC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,aAAa,GAAG,IAAI,CAAC,mBAAmB;YACzF,CAAC,CAAC,CAAC,CAAC,SAAS;gBACX,CAAC,CAAC,2DAA2D,CAAC,CAAC,SAAS,kCAAkC;gBAC1G,CAAC,CAAC,oCAAoC,CAAC;QAC3C,OAAO,gBAAgB,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,MAAM,MAAM,EAAE,CAAC;IAC7D,CAAC;CACF"}
@@ -0,0 +1,221 @@
1
+ import { type NatsConnection } from "@nats-io/transport-node";
2
+ import { type CleanupFailure, type DeprovisionResourceAccounting, type Identity, type RuntimeReference, type SecretStore, type SpaceAuth, type dialerFor } from "@cotal-ai/core";
3
+ import type { ManagerOptions } from "./manager.js";
4
+ import type { AgentHandle } from "./runtime/index.js";
5
+ /** What the teardown chain (trackDeprovision → deprovision → driveDeprovision →
6
+ * driveStaticRetirement) needs to tear one incarnation down. Each hop passes the value on as a
7
+ * variable, which TypeScript does not excess-check, so the hops share this one declaration. */
8
+ export interface TeardownTarget {
9
+ id: string;
10
+ name: string;
11
+ lifecycleUid: string;
12
+ userOwner?: string;
13
+ delegated?: true;
14
+ secretPaths?: {
15
+ creds?: string;
16
+ actorToken?: string;
17
+ sentinelCreds?: string;
18
+ health?: string;
19
+ };
20
+ runtime?: RuntimeReference;
21
+ delegatedHandle?: AgentHandle;
22
+ launch?: {
23
+ allowSubscribe: readonly string[];
24
+ };
25
+ /** The departed agent's admitted renewal, which the static terminal drains before it begins. */
26
+ staticCredentialRenewal?: Promise<void>;
27
+ /** Set when this lifecycle's inline snapshot is settled: the file is gone, or the lifecycle never
28
+ * had one. A live slot's free and a manager shutdown set it once they removed the seat's own, and
29
+ * a spawn's rollback once it removed the one it wrote or its write was refused, since a file that
30
+ * write refused was never this lifecycle's. Absent after a removal that failed, and for a
31
+ * lifecycle known only by its slot row; the static terminal then removes the uid's path. */
32
+ snapshotSettled?: true;
33
+ }
34
+ /** A name held pending its incarnation's retirement. It keeps the teardown target whole, so a
35
+ * same-name spawn or a resume re-drives the same teardown the first drive ran. */
36
+ export interface RetirementHold {
37
+ opId: string;
38
+ owner: string;
39
+ actor: string;
40
+ target: TeardownTarget;
41
+ startedAt: number;
42
+ lastError?: string;
43
+ standingAuthorityLive?: boolean;
44
+ lastResources?: DeprovisionResourceAccounting;
45
+ }
46
+ /** The retirement coordinator reads current authority at each call and delegates process and
47
+ * maintenance ownership to its manager. */
48
+ export interface RetirementDeps {
49
+ auth(): SpaceAuth | undefined;
50
+ remoteAuthority(): Pick<NonNullable<ManagerOptions["remoteAuthority"]>, "owner" | "actors" | "prepareAgentRetirement" | "mintRetirementRequester"> | undefined;
51
+ userMode(): boolean;
52
+ workspaceRoot(): string;
53
+ space(): string;
54
+ servers(): string | undefined;
55
+ secrets(): SecretStore;
56
+ serveIdentity(): Identity | undefined;
57
+ lifecycleUid(): string;
58
+ instanceId(): string;
59
+ serveEpoch(): number | undefined;
60
+ dial(opts: Parameters<ReturnType<typeof dialerFor>>[0]): Promise<NatsConnection>;
61
+ withRetirementSlot<T>(run: () => Promise<T>): Promise<T>;
62
+ driveStaticRetirement(a: TeardownTarget): Promise<void>;
63
+ awaitHandleExit(handle: AgentHandle): Promise<void>;
64
+ shredUserSecrets(failures: CleanupFailure[], family: {
65
+ actorToken?: string;
66
+ sentinelCreds?: string;
67
+ health?: string;
68
+ }): Promise<void>;
69
+ dropSeatRecord(a: {
70
+ name: string;
71
+ lifecycleUid: string;
72
+ }): void;
73
+ fenceRetiringAcl(a: {
74
+ id: string;
75
+ lifecycleUid: string;
76
+ }): Promise<string | undefined>;
77
+ lifecycleMembershipInventory(a: {
78
+ id: string;
79
+ lifecycleUid: string;
80
+ }): Promise<{
81
+ complete: boolean;
82
+ channels: string[];
83
+ reason?: string;
84
+ }>;
85
+ brokerTeardown<T>(task: Promise<T>, message: string): Promise<T>;
86
+ trackLifecycle(): () => void;
87
+ }
88
+ /** Retirement holds, exact-lifecycle teardown flights and confirmed predecessor coordinates. */
89
+ export declare class Retirement {
90
+ private readonly deps;
91
+ /** Names RESERVED PENDING RETIREMENT: a despawned agent's name stays held until
92
+ * the auth plane confirms its lifecycle's retirement TERMINAL over the auth-admin rail - the
93
+ * alias-reuse gate that closes the same-name despawn→respawn race at its root. An UNCERTAIN
94
+ * outcome (rail down, timeout) keeps the hold with the last attempt's copy; a same-name spawn
95
+ * refuses legibly AND re-fires the request. In-memory: across a manager restart the durable
96
+ * truth is the auth-side lifecycle head itself (an unretired head refuses issuance - the
97
+ * named residual this belt narrows, not replaces). */
98
+ private retiring;
99
+ /** SINGLE-FLIGHT guard for {@link requestRetirement} (audit #1): one in-flight rail round-trip per
100
+ * (name, lifecycleUid). The detached `deprovision` call and every same-name-spawn nudge for THAT
101
+ * lifecycle JOIN the same promise instead of stacking independent requests that dual-enter the
102
+ * barrier; a fresh trigger after it settles re-drives. Keyed by (name, uid) - NOT name alone - so a
103
+ * same-name SUCCESSOR (which can spawn after the hold clears but before this flight's `nc.close`
104
+ * yield settles) never joins the predecessor's rail request and skips its own retirement. */
105
+ private retiringFlight;
106
+ /** Wire principals of RETIRED static incarnations: populated at every completed
107
+ * static terminal and from the boot sweep's retired slot rows, so a copied credential of a
108
+ * retired incarnation is refused at the control surface even across a manager restart. The
109
+ * durable truth is the slot row + principal-keyed head; this set is the in-memory index of it
110
+ * (one string per retired incarnation - bounded by lifecycle count, never pruned in-process). */
111
+ private readonly retiredPrincipals;
112
+ /** Exact predecessor incarnations whose full hosted retirement reached a terminal answer. Presence
113
+ * is advisory and can retain that old lifecycle briefly after its process exits. Resume may ignore
114
+ * only this exact (alias, principal, lifecycleUid) row when adopting a different lifecycle; every
115
+ * unknown, current, or differently identified live row still refuses. A later retirement of the
116
+ * same alias replaces its prior predecessor coordinate. */
117
+ private readonly confirmedRetiredPredecessors;
118
+ /** SINGLE-FLIGHT guard for {@link deprovision} (INT-2/C): one in-flight teardown per
119
+ * (name, lifecycleUid). The detached freeSlot teardown and every same-name-spawn nudge that
120
+ * re-drives it JOIN one promise instead of launching a SECOND, concurrent teardown. Without it,
121
+ * two teardowns race the NAME-KEYED ledger revoke: once the first frees the alias and a successor
122
+ * mints its own row, the second's delayed revoke (which carries no lifecycle coordinate) would
123
+ * delete the SUCCESSOR's standing authority. Keyed by (name, uid) so a later same-name lifecycle
124
+ * gets its own flight; a fresh trigger after settle re-drives only if the hold still stands. */
125
+ private deprovisioningFlight;
126
+ constructor(deps: RetirementDeps);
127
+ private get auth();
128
+ private get remoteAuthority();
129
+ private get userMode();
130
+ private get workspaceRoot();
131
+ private get space();
132
+ private get servers();
133
+ private get secrets();
134
+ private get managerServeIdentity();
135
+ private get managerLifecycleUid();
136
+ private get managerInstanceId();
137
+ private dial;
138
+ private withRetirementSlot;
139
+ private driveStaticRetirement;
140
+ private awaitHandleExit;
141
+ private shredUserSecrets;
142
+ private dropSeatRecord;
143
+ private fenceRetiringAcl;
144
+ private lifecycleMembershipInventory;
145
+ hold(name: string, hold: RetirementHold): void;
146
+ held(name: string): RetirementHold | undefined;
147
+ hasHold(name: string): boolean;
148
+ predecessor(name: string): {
149
+ principal: string;
150
+ lifecycleUid: string;
151
+ } | undefined;
152
+ get pendingCount(): number;
153
+ get inFlightCount(): number;
154
+ rememberRetired(principal: string): void;
155
+ recordStaticRetirement(a: {
156
+ id: string;
157
+ name: string;
158
+ lifecycleUid: string;
159
+ }): void;
160
+ membershipRefusal(caller: string): string | undefined;
161
+ /** Tear down a departed agent's minted footprint (#159 B2, auth mode): its local-principal durables
162
+ * (`dm_local-<id>`, `dlv_local-<id>`), its read-ACL row, and its creds file - everything the spawn's
163
+ * `provisionAgent` + creds-write left behind. Mints an EPHEMERAL, TARGET-PINNED `deprovisioner` cred
164
+ * (mirrors the ephemeral `provisioner`/`purger`): it can delete only THIS agent's local-principal footprint,
165
+ * never a peer's and never the role-shared `svc_<role>` (which its siblings still bind). Open mesh →
166
+ * no-op (nothing was minted). Idempotent at the broker (missing consumer / ACL row = no-op) and on
167
+ * disk (`force` tolerates an absent creds file, e.g. a ledgered deploy that wrote none).
168
+ *
169
+ * Removing the creds file is footprint REDUCTION, not revocation: a JWT copied off disk before exit
170
+ * keeps its inline publish/live-sub/control grants until key rotation or JWT expiry - cred revocation
171
+ * is the separate per-user-auth work, not this. Tearing down the durables + ACL row still shrinks the
172
+ * delivery surface a stale copy could use. */
173
+ deprovision(a: TeardownTarget): Promise<void>;
174
+ /** The actual footprint teardown (wrapped by {@link deprovision}'s single-flight). */
175
+ driveDeprovision(a: TeardownTarget): Promise<void>;
176
+ /** Request the auth-side retirement of a departed agent's lifecycle: an ephemeral
177
+ * `retirement-requester` credential (request + reply only), the generic `retireLifecycle` op,
178
+ * a STABLE opId (derived from the lifecycleUid, so every retry re-drives the SAME operation),
179
+ * and the four-outcome handling in operator vocabulary. */
180
+ requestRetirement(a: {
181
+ id: string;
182
+ name: string;
183
+ lifecycleUid: string;
184
+ }): Promise<void>;
185
+ /** The rail round-trip for one retirement (wrapped by {@link requestRetirement}'s single-flight). */
186
+ driveRetirement(a: {
187
+ id: string;
188
+ name: string;
189
+ lifecycleUid: string;
190
+ }): Promise<void>;
191
+ /** Apply one terminal retirement answer. The predecessor coordinate is recorded only when the
192
+ * answer clears this exact lifecycle's hold, never for an ABA-late answer or an incomplete hosted
193
+ * teardown whose standing authority still lives. */
194
+ confirmRetirement(a: {
195
+ id: string;
196
+ name: string;
197
+ lifecycleUid: string;
198
+ }): void;
199
+ /** The teardown's ASYNC BROKER PHASE: mint the ephemeral target-pinned deprovisioner cred and
200
+ * delete the agent's broker footprint (dm_/dlv_ durables + read-ACL row). Split from
201
+ * {@link deprovision} because it runs LAST in the ordered teardown chain - after the creds/secret
202
+ * shred and the awaited ledger revoke, which precede it in that same single-flighted chain (the
203
+ * revoke is awaited and can be deliberately slow, so it is not merely a synchronous prefix). The name
204
+ * is NOT freed while any teardown phase is still in flight - the hold clears only after the
205
+ * standing-authority revoke AND the lifecycle retirement both confirm (see {@link driveRetirement}) -
206
+ * but the deletes here are still lifecycle-uid-pinned so even a replayed/stale teardown can never
207
+ * reach a same-name successor's footprint (its names embed a different uid). Each call reports its
208
+ * own accounting: the return value, or the {@link DeprovisionError} it throws once the deletes ran. */
209
+ deprovisionBroker(a: {
210
+ id: string;
211
+ name: string;
212
+ lifecycleUid: string;
213
+ launch?: {
214
+ allowSubscribe: readonly string[];
215
+ };
216
+ }): Promise<DeprovisionResourceAccounting>;
217
+ /** A cleanup spawned by accepted active-mode work is part of that work for maintenance draining,
218
+ * even where the ordinary control reply remains fire-and-forget. */
219
+ trackDeprovision(a: TeardownTarget, context?: string): void;
220
+ }
221
+ //# sourceMappingURL=retirement.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"retirement.d.ts","sourceRoot":"","sources":["../src/retirement.ts"],"names":[],"mappings":"AACA,OAAO,EAAsB,KAAK,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAClF,OAAO,EAKL,KAAK,cAAc,EAAE,KAAK,6BAA6B,EAAE,KAAK,QAAQ,EAAE,KAAK,gBAAgB,EAC7F,KAAK,WAAW,EAAE,KAAK,SAAS,EAAE,KAAK,SAAS,EACjD,MAAM,gBAAgB,CAAC;AAGxB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEtD;;gGAEgG;AAChG,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,C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