@cotal-ai/manager 0.11.6 → 0.13.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/README.md CHANGED
@@ -12,3 +12,45 @@ each other; they meet at runtime over NATS.
12
12
 
13
13
  See [docs/architecture.md](../../docs/architecture.md) (*Manager*) and the
14
14
  [root AGENTS.md](../../AGENTS.md) for the tier rules.
15
+
16
+ ## Maintenance API
17
+
18
+ The admin control operations `preparePreservation {attemptId}` and
19
+ `commitPreservation {attemptId}` form a crash-safe handshake. Prepare fences new lifecycle/control
20
+ work, waits for already accepted work, and returns a `cotal-manager-resume/v1` non-secret inventory
21
+ without stopping a child. The coordinator must fsync that inventory into its locked maintenance
22
+ attempt before commit hard-stops and authoritatively awaits managed children without deprovisioning.
23
+ A failed child stop returns `ok: false` with the inventory and per-agent failures; callers must not
24
+ publish a completed maintenance cut. `abortPreservation {attemptId}` returns an abandoned prepare to
25
+ active mode only before commit starts. Runtime providers must implement `AgentHandle.waitForExit()`;
26
+ otherwise commit fails closed instead of guessing that the child is gone.
27
+
28
+ Library composition roots can call `Manager.preserveState({ attemptId, persistInventory })` and later use
29
+ `Manager.resumePreserved()` on a fresh active manager. The complete inventory is preflighted before
30
+ the first child launches. Static and open entries reuse and validate the exact retained principal.
31
+ User-auth entries are validated internally through `resolveAuthProvider().validateRetainedAgent()`;
32
+ the manager never calls `grantAgent` or provisions a replacement identity. Ordinary
33
+ `Manager.stop()` remains destructive while the manager is active.
34
+
35
+ After restore, start the manager with `supervise --resume-attempt <id>`, wait for normal manager
36
+ readiness, then send the admin control request:
37
+
38
+ ```json
39
+ {"op":"resumePreserved","args":{"attemptId":"<id>","inventory":{"version":"cotal-manager-resume/v1","space":"<space>","createdAt":"<iso>","agents":[]}}}
40
+ ```
41
+
42
+ The request is limited to 512 KiB and parsed with strict nested schemas; unknown fields are rejected.
43
+ The reply carries the attempt id, `state: "awaitingCommit"`, and one result per inventory agent.
44
+ Activated agents remain cleanup-suppressed and ordinary lifecycle work stays fenced. `commitResume`
45
+ revalidates every exact retained handle, principal, presence entry, file, static credential, and user
46
+ authority row, then returns `state: "awaitingFinalize"` plus a `durableCommitToken`; it deliberately
47
+ does not release the fence or cleanup suppression. The coordinator must durably record that result
48
+ before echoing its token in the separate admin request:
49
+
50
+ ```json
51
+ {"op":"finalizeResume","args":{"attemptId":"<id>","durableCommitToken":"<64 lowercase hex chars>"}}
52
+ ```
53
+
54
+ Only token-bound finalization releases ordinary destructive lifecycle semantics. Both operations are
55
+ same-attempt idempotent. A manager signal or lease loss after commit but before finalization remains
56
+ retention-safe, while failed or partial activation cannot be committed or finalized.
package/dist/commands.js CHANGED
@@ -32,6 +32,14 @@ async function runManager(args, defaultRuntime) {
32
32
  // before the manager comes up or any agent is spawned.
33
33
  const roster = v.roster ? loadRoster(v.roster) : [];
34
34
  const launchSpec = v.launch ? loadLaunchSpec(v.launch) : undefined;
35
+ if (v["resume-attempt"] && (v.roster || v.launch || v.spawn)) {
36
+ console.error(c.red("✗ --resume-attempt cannot be combined with --roster, --launch, or --spawn; retained agents resume only through the attempt-bound admin control op"));
37
+ process.exit(1);
38
+ }
39
+ if (v["resume-commit-token"] && !v["resume-attempt"]) {
40
+ console.error(c.red("✗ --resume-commit-token requires --resume-attempt"));
41
+ process.exit(1);
42
+ }
35
43
  if (!(await isReachable(server))) {
36
44
  console.error(c.red(`Can't reach NATS at ${server}. Run: cotal up`));
37
45
  process.exit(1);
@@ -45,7 +53,15 @@ async function runManager(args, defaultRuntime) {
45
53
  // The published-binary supervisor resolves connectors from the operator manifest (seeded +
46
54
  // `ext add`ed), NOT from static imports — `bin/cotal.ts` no longer registers any. A direct
47
55
  // library `Manager` keeps the registry-only default (opt-in preserved).
48
- mgr = new Manager({ space, servers: server, runtime, consolePort, installedExtensions: true });
56
+ mgr = new Manager({
57
+ space,
58
+ servers: server,
59
+ runtime,
60
+ consolePort,
61
+ installedExtensions: true,
62
+ resumeAttemptId: v["resume-attempt"],
63
+ resumeDurableCommitToken: v["resume-commit-token"],
64
+ });
49
65
  }
50
66
  catch (e) {
51
67
  console.error(c.red(`✗ ${e.message}`));
@@ -58,7 +74,12 @@ async function runManager(args, defaultRuntime) {
58
74
  c.dim("\n spawn: cotal spawn --detach <persona> · stop: cotal stop --name <n> (Ctrl-C to shut down)"));
59
75
  // Register shutdown handlers before any spawning, so a Ctrl-C during the (possibly slow,
60
76
  // staggered) boot tears the manager and its spawned teammates down rather than orphaning them.
61
- const shutdown = () => void mgr.stop().then(() => process.exit(0));
77
+ const shutdown = () => void mgr.stop()
78
+ .then(() => process.exit(0))
79
+ .catch((e) => {
80
+ process.exitCode = 1;
81
+ console.error(c.red(`✗ ${e.message}`));
82
+ });
62
83
  process.on("SIGINT", shutdown);
63
84
  process.on("SIGTERM", shutdown);
64
85
  // Declarative boot: bring up each rostered agent through the same spawn path as a detached spawn.
@@ -111,7 +132,7 @@ async function runManager(args, defaultRuntime) {
111
132
  console.error(c.red(`✗ ${la.name}: ${e.message}`));
112
133
  continue;
113
134
  }
114
- const reply = await mgr.startAgent(launchAgentToStartOpts(la, configPath, launchSpec.owner));
135
+ const reply = await mgr.startAgent(launchAgentToStartOpts(la, configPath, launchSpec.owner, launchSpec.runId));
115
136
  if (!reply.ok) {
116
137
  console.error(c.red(`✗ ${la.name}: ${reply.error}`));
117
138
  continue;
@@ -133,7 +154,7 @@ const managerCommands = [
133
154
  kind: "command",
134
155
  name: "supervise",
135
156
  group: "Manager",
136
- summary: "run a manager - [--runtime <name>] (default pty; extension runtimes are explicit-only) [--space <s>] [--server <url>] [--console-port <n>] [--roster <file>] [--launch <spec>]",
157
+ summary: "run a manager - [--runtime <name>] (default pty; extension runtimes are explicit-only) [--space <s>] [--server <url>] [--console-port <n>] [--roster <file>] [--launch <spec>] [--resume-attempt <id>]",
137
158
  flags: [
138
159
  { name: "space", type: "string", value: "<s>", description: "space to supervise (default: this folder's auth space)" },
139
160
  { name: "server", type: "string", value: "<url>", description: "broker URL (default: the local mesh)" },
@@ -141,6 +162,8 @@ const managerCommands = [
141
162
  { name: "console-port", type: "string", value: "<n>", description: "protocol-console port" },
142
163
  { name: "roster", type: "string", value: "<file>", description: "declarative roster to boot at startup" },
143
164
  { name: "launch", type: "string", value: "<spec>", description: "resolved mesh-manifest launch spec (cotal up -f / spawn -f)" },
165
+ { name: "resume-attempt", type: "string", value: "<id>", description: "maintenance restore attempt accepted by resumePreserved" },
166
+ { name: "resume-commit-token", type: "string", value: "<token>", description: "durable resume commit evidence for crash recovery" },
144
167
  { name: "spawn", type: "string", value: "<names>", description: "comma-separated personas to pre-spawn at startup" },
145
168
  ],
146
169
  requiredExtensions: (args) => {
@@ -1 +1 @@
1
- {"version":3,"file":"commands.js","sourceRoot":"","sources":["../src/commands.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,cAAc,EACd,aAAa,EACb,QAAQ,GAGT,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAC5E,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AACzF,OAAO,EAAoB,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,CAAC,EAAE,MAAM,SAAS,CAAC;AAI5B;qGACqG;AACrG,SAAS,QAAQ,CAAC,CAAS;IACzB,OAAO,CAAC,CAAC,KAAK,IAAI,aAAa,CAAC,OAAO,CAAC,aAAa,EAAE,CAAC,CAAC,EAAE,KAAK,IAAI,aAAa,CAAC;AACpF,CAAC;AAED;;;;;;8FAM8F;AAC9F,wFAAwF;AACxF,0FAA0F;AAC1F,wBAAwB;AACxB,KAAK,UAAU,UAAU,CAAC,IAAgB,EAAE,cAA2B;IACrE,MAAM,CAAC,GAAG,I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AQ,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,6DAA6D,EAAE;YAC/H,EAAE,IAAI,EAAE,gBAAgB,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,yDAAyD,EAAE;YACjI,EAAE,IAAI,EAAE,qBAAqB,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,mDAAmD,EAAE;YACnI,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,kDAAkD,EAAE;SACrH;QACD,kBAAkB,EAAE,CAAC,IAAI,EAAE,EAAE;YAC3B,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC;YACpC,OAAO,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACtG,CAAC;QACD,GAAG,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,EAAE,MAAM,CAAC;KACxC;CACF,CAAC;AAEF,QAAQ,CAAC,QAAQ,CAAC,GAAG,eAAe,CAAC,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import "./commands.js";
2
- export { Manager, READINESS_TIMEOUT_MS, type ManagerOptions } from "./manager.js";
2
+ export { Manager, READINESS_TIMEOUT_MS, type ManagerOptions, type ManagerMaintenanceState, type ManagerResumeIdentity, type ManagerResumeAgent, type ManagerResumeInventory, type ManagerResumeResult, type ManagerPreserveFailure, type ManagerPreservationPlan, type ManagerPreserveOptions, type ManagerPreserveResult, } from "./manager.js";
3
+ export { parseResumeControlArgs, parseResumeCommitArgs, parseResumeFinalizeArgs, MAX_RESUME_CONTROL_BYTES, MAX_RESUME_COMMIT_BYTES, type ResumeControlArgs, } from "./resume.js";
3
4
  export { createRuntime } from "./runtime/index.js";
4
5
  export type { Runtime, AgentHandle, AttachSession, RuntimeKind, RuntimeMode } from "./runtime/index.js";
5
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,CAAC;AAEvB,OAAO,EAAE,OAAO,EAAE,oBAAoB,EAAE,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AAClF,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,YAAY,EAAE,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,CAAC;AAEvB,OAAO,EACL,OAAO,EACP,oBAAoB,EACpB,KAAK,cAAc,EACnB,KAAK,uBAAuB,EAC5B,KAAK,qBAAqB,EAC1B,KAAK,kBAAkB,EACvB,KAAK,sBAAsB,EAC3B,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,EAC3B,KAAK,uBAAuB,EAC5B,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,GAC3B,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,sBAAsB,EACtB,qBAAqB,EACrB,uBAAuB,EACvB,wBAAwB,EACxB,uBAAuB,EACvB,KAAK,iBAAiB,GACvB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,YAAY,EAAE,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC"}
package/dist/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import "./commands.js"; // self-registers the control-plane commands on import
2
- export { Manager, READINESS_TIMEOUT_MS } from "./manager.js";
2
+ export { Manager, READINESS_TIMEOUT_MS, } from "./manager.js";
3
+ export { parseResumeControlArgs, parseResumeCommitArgs, parseResumeFinalizeArgs, MAX_RESUME_CONTROL_BYTES, MAX_RESUME_COMMIT_BYTES, } from "./resume.js";
3
4
  export { createRuntime } from "./runtime/index.js";
4
5
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,CAAC,CAAC,sDAAsD;AAE9E,OAAO,EAAE,OAAO,EAAE,oBAAoB,EAAuB,MAAM,cAAc,CAAC;AAClF,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,CAAC,CAAC,sDAAsD;AAE9E,OAAO,EACL,OAAO,EACP,oBAAoB,GAWrB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,sBAAsB,EACtB,qBAAqB,EACrB,uBAAuB,EACvB,wBAAwB,EACxB,uBAAuB,GAExB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC"}
package/dist/launch.d.ts CHANGED
@@ -15,7 +15,7 @@ export declare function launchSpecForRun(root: string, runId: string): MeshLaunc
15
15
  export declare function materializePersona(root: string, runId: string, a: MeshLaunchAgent): string;
16
16
  /** Build the manager spawn opts for a launch agent: identity/role/model/variant + the resolved object
17
17
  * (which carries the ACL authority) + the materialized configPath. */
18
- export declare function launchAgentToStartOpts(a: MeshLaunchAgent, configPath: string, owner?: string): {
18
+ export declare function launchAgentToStartOpts(a: MeshLaunchAgent, configPath: string, owner?: string, runId?: string): {
19
19
  name: string;
20
20
  agent: string;
21
21
  role?: string;
@@ -24,5 +24,10 @@ export declare function launchAgentToStartOpts(a: MeshLaunchAgent, configPath: s
24
24
  config: string;
25
25
  resolved: MeshLaunchAgent;
26
26
  owner?: string;
27
+ launchRef?: {
28
+ runId: string;
29
+ requested: string;
30
+ hash: string;
31
+ };
27
32
  };
28
33
  //# sourceMappingURL=launch.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"launch.d.ts","sourceRoot":"","sources":["../src/launch.ts"],"names":[],"mappings":"AAGA,OAAO,EAAyH,KAAK,eAAe,EAAE,KAAK,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAmDlM;qGACqG;AACrG,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,CAe3D;AAED;;;;;kFAKkF;AAClF,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,cAAc,CAe5E;AA+BD;;wGAEwG;AACxG,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,EAAE,eAAe,GAAG,MAAM,CAkB1F;AAED;uEACuE;AACvE,wBAAgB,sBAAsB,CAAC,CAAC,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG;IAC9F,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,eAAe,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAEA"}
1
+ {"version":3,"file":"launch.d.ts","sourceRoot":"","sources":["../src/launch.ts"],"names":[],"mappings":"AAGA,OAAO,EAAyH,KAAK,eAAe,EAAE,KAAK,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAmDlM;qGACqG;AACrG,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,CAe3D;AAED;;;;;kFAKkF;AAClF,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,cAAc,CAe5E;AA+BD;;wGAEwG;AACxG,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,EAAE,eAAe,GAAG,MAAM,CAkB1F;AAED;uEACuE;AACvE,wBAAgB,sBAAsB,CAAC,CAAC,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG;IAC9G,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,eAAe,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;CAChE,CAYA"}
package/dist/launch.js CHANGED
@@ -155,8 +155,18 @@ export function materializePersona(root, runId, a) {
155
155
  }
156
156
  /** Build the manager spawn opts for a launch agent: identity/role/model/variant + the resolved object
157
157
  * (which carries the ACL authority) + the materialized configPath. */
158
- export function launchAgentToStartOpts(a, configPath, owner) {
159
- return { name: a.name, agent: a.agent, role: a.role, model: a.model, variant: a.variant, config: configPath, resolved: a, owner };
158
+ export function launchAgentToStartOpts(a, configPath, owner, runId) {
159
+ return {
160
+ name: a.name,
161
+ agent: a.agent,
162
+ role: a.role,
163
+ model: a.model,
164
+ variant: a.variant,
165
+ config: configPath,
166
+ resolved: a,
167
+ owner,
168
+ launchRef: runId ? { runId, requested: a.name, hash: a.hash } : undefined,
169
+ };
160
170
  }
161
171
  /** Quote a frontmatter scalar so the agent-file parser reads it back unchanged (it strips a matching
162
172
  * outer quote pair). Plain tokens pass through; anything with structural chars is double-quoted. */
@@ -1 +1 @@
1
- {"version":3,"file":"launch.js","sourceRoot":"","sources":["../src/launch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACjE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,uBAAuB,EAAE,kBAAkB,EAAE,eAAe,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,gBAAgB,EAA6C,MAAM,gBAAgB,CAAC;AAElM;;;;;;;;GAQG;AAEH,6FAA6F;AAC7F,qGAAqG;AACrG,qGAAqG;AACrG,MAAM,KAAK,GAAG,kBAAkB,CAAC;AACjC,MAAM,KAAK,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,KAAK,EAAE,iDAAiD,CAAC,CAAC;AAEzF,MAAM,iBAAiB,GAAG,CAAC,CAAC,YAAY,CAAC;IACvC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACvB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,KAAK,EAAE,iDAAiD,CAAC;IACjF,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,KAAK,EAAE,iDAAiD,CAAC,CAAC,QAAQ,EAAE;IAC3F,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC5B,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IACrC,aAAa,EAAE,CA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ACZ,KAAK,EAAE,CAAC,CAAC,KAAK;QACd,OAAO,EAAE,CAAC,CAAC,OAAO;QAClB,MAAM,EAAE,UAAU;QAClB,QAAQ,EAAE,CAAC;QACX,KAAK;QACL,SAAS,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,SAAS;KAC1E,CAAC;AACJ,CAAC;AAED;qGACqG;AACrG,SAAS,MAAM,CAAC,CAAS;IACvB,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC;QAAE,OAAO,CAAC,CAAC;IACxE,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;QAAE,OAAO,IAAI,CAAC,GAAG,CAAC;IAC3D,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC,CAAC;AACpD,CAAC"}
package/dist/manager.d.ts CHANGED
@@ -18,11 +18,132 @@ export interface ManagerOptions {
18
18
  workspaceRoot?: string;
19
19
  /** Port for the console + attach HTTP/WS endpoint (loopback). 0 → ephemeral. */
20
20
  consolePort?: number;
21
+ /** Internal/test override for the preservation child-exit deadline. */
22
+ preserveStopTimeoutMs?: number;
23
+ /** Restore attempt this fresh manager will accept for the admin resumePreserved control op. */
24
+ resumeAttemptId?: string;
25
+ /** Fsynced coordinator evidence recovered after commit but before finalize. */
26
+ resumeDurableCommitToken?: string;
21
27
  /** Resolve connectors from the installed `cotal ext` manifest (lazy import + live-remove honored),
22
28
  * as the published binary does. A library composition leaves this off and resolves only what its
23
29
  * composition root imported — a direct `new Manager()` never implicitly reads the machine manifest. */
24
30
  installedExtensions?: boolean;
25
31
  }
32
+ export type ManagerMaintenanceState = "active" | "preserving" | "preserved";
33
+ export type ManagerResumeIdentity = {
34
+ mode: "open";
35
+ id: string;
36
+ lifecycleUid: string;
37
+ } | {
38
+ mode: "static";
39
+ id: string;
40
+ lifecycleUid: string;
41
+ credential: {
42
+ kind: "file";
43
+ path: string;
44
+ sha256: string;
45
+ };
46
+ } | {
47
+ mode: "user";
48
+ owner: string;
49
+ actor: string;
50
+ lifecycleUid: string;
51
+ actorToken: {
52
+ kind: "file";
53
+ path: string;
54
+ sha256: string;
55
+ };
56
+ sentinelCredential: {
57
+ kind: "file";
58
+ path: string;
59
+ sha256: string;
60
+ };
61
+ health: {
62
+ kind: "file";
63
+ path: string;
64
+ };
65
+ };
66
+ export interface ManagerResumeAgent {
67
+ space: string;
68
+ name: string;
69
+ role?: string;
70
+ identity: ManagerResumeIdentity;
71
+ launch: {
72
+ connector: string;
73
+ runtime: string;
74
+ cwd: string;
75
+ source: {
76
+ kind: "persona";
77
+ ref: string;
78
+ configPath: string;
79
+ configSha256: string;
80
+ } | {
81
+ kind: "manifest";
82
+ runId?: string;
83
+ requested: string;
84
+ hash: string;
85
+ configPath: string;
86
+ configSha256: string;
87
+ manifestSha256?: string;
88
+ };
89
+ model?: string;
90
+ variant?: string;
91
+ subscribe?: string[];
92
+ allowSubscribe: string[];
93
+ allowPublish?: string[];
94
+ capabilities?: string[];
95
+ transcript: boolean;
96
+ shareTools?: string;
97
+ /** Original connector fork source, not a captured id for the currently running host session. */
98
+ forkSource?: string;
99
+ /** Values are deliberately not persisted: connector launch options are opaque and may be secrets. */
100
+ unresolvedLaunchOptionKeys?: string[];
101
+ };
102
+ /** Host-local files that must survive the maintenance cut, including `.cotal/run` artifacts. */
103
+ dependencies: string[];
104
+ spawner: string;
105
+ /** User-auth ledger delegation parent; distinct from manager process-ownership spawner. */
106
+ authorityParent?: string;
107
+ startedAt: string;
108
+ }
109
+ export interface ManagerResumeInventory {
110
+ version: "cotal-manager-resume/v1";
111
+ space: string;
112
+ createdAt: string;
113
+ agents: ManagerResumeAgent[];
114
+ }
115
+ export interface ManagerPreserveFailure {
116
+ name: string;
117
+ id: string;
118
+ error: string;
119
+ }
120
+ export interface ManagerPreserveResult {
121
+ ok: boolean;
122
+ attemptId: string;
123
+ state: Exclude<ManagerMaintenanceState, "active">;
124
+ inventory: ManagerResumeInventory;
125
+ failures: ManagerPreserveFailure[];
126
+ }
127
+ export interface ManagerPreservationPlan {
128
+ ok: boolean;
129
+ attemptId: string;
130
+ state: "prepared" | "preserved";
131
+ inventory: ManagerResumeInventory;
132
+ failures: ManagerPreserveFailure[];
133
+ }
134
+ export interface ManagerPreserveOptions {
135
+ attemptId: string;
136
+ /** Must verify the coordinator's locked attempt and durably fsync the inventory before resolving. */
137
+ persistInventory(inventory: ManagerResumeInventory): Promise<void>;
138
+ }
139
+ export interface ManagerResumeResult {
140
+ ok: boolean;
141
+ agents: Array<{
142
+ name: string;
143
+ reply: ControlReply;
144
+ }>;
145
+ error?: string;
146
+ }
26
147
  /** A spawn request, typed. The control-plane `start` op parses one of these out of an
27
148
  * untyped request; roster boot constructs them directly. Both funnel into {@link Manager.startAgent}. */
28
149
  export interface StartAgentOpts {
@@ -80,6 +201,12 @@ export interface StartAgentOpts {
80
201
  * workspaceRoot. Lets different agents run in different repos/folders. A relative path is
81
202
  * resolved against the manager's workspace root. Omitted → the agent uses workspaceRoot. */
82
203
  cwd?: string;
204
+ /** Internal resolved-manifest provenance used by the preservation inventory. */
205
+ launchRef?: {
206
+ runId: string;
207
+ requested: string;
208
+ hash: string;
209
+ };
83
210
  }
84
211
  /**
85
212
  * The agent supervisor: a long-lived mesh node that owns agent process lifecycle.
@@ -95,6 +222,7 @@ export declare class Manager {
95
222
  /** See {@link ManagerOptions.installedExtensions}. */
96
223
  private readonly installedExtensions;
97
224
  private readonly runtime;
225
+ private readonly preserveStopTimeoutMs;
98
226
  private readonly agents;
99
227
  /** Names whose spawn is in flight (reserved synchronously before the provision await) — counted
100
228
  * toward the ceiling so two concurrent same-name spawns can't both pass the gate (P4a). */
@@ -102,6 +230,29 @@ export declare class Manager {
102
230
  /** Expiry stamps (`startedAt + MIN_LIFETIME`) for slots that freed while still young — a
103
231
  * count-only, lazily-pruned recycle floor (P4c). Pruned + summed into the ceiling gate. */
104
232
  private cooling;
233
+ /** Names RESERVED PENDING RETIREMENT (#29 piece 3): a despawned agent's name stays held until
234
+ * the auth plane confirms its lifecycle's retirement TERMINAL over the auth-admin rail — the
235
+ * alias-reuse gate that closes the same-name despawn→respawn race at its root. An UNCERTAIN
236
+ * outcome (rail down, timeout) keeps the hold with the last attempt's copy; a same-name spawn
237
+ * refuses legibly AND re-fires the request. In-memory: across a manager restart the durable
238
+ * truth is the auth-side lifecycle head itself (an unretired head refuses issuance — the
239
+ * named residual this belt narrows, not replaces). */
240
+ private retiring;
241
+ /** SINGLE-FLIGHT guard for {@link requestRetirement} (audit #1): one in-flight rail round-trip per
242
+ * (name, lifecycleUid). The detached `deprovision` call and every same-name-spawn nudge for THAT
243
+ * lifecycle JOIN the same promise instead of stacking independent requests that dual-enter the
244
+ * barrier; a fresh trigger after it settles re-drives. Keyed by (name, uid) — NOT name alone — so a
245
+ * same-name SUCCESSOR (which can spawn after the hold clears but before this flight's `nc.close`
246
+ * yield settles) never joins the predecessor's rail request and skips its own retirement. */
247
+ private retiringFlight;
248
+ /** SINGLE-FLIGHT guard for {@link deprovision} (INT-2/C): one in-flight teardown per
249
+ * (name, lifecycleUid). The detached freeSlot teardown and every same-name-spawn nudge that
250
+ * re-drives it JOIN one promise instead of launching a SECOND, concurrent teardown. Without it,
251
+ * two teardowns race the NAME-KEYED ledger revoke: once the first frees the alias and a successor
252
+ * mints its own row, the second's delayed revoke (which carries no lifecycle coordinate) would
253
+ * delete the SUCCESSOR's standing authority. Keyed by (name, uid) so a later same-name lifecycle
254
+ * gets its own flight; a fresh trigger after settle re-drives only if the hold still stands. */
255
+ private deprovisioningFlight;
105
256
  private readonly attach;
106
257
  private ep;
107
258
  /** Space trust material when the mesh runs in auth mode (`.cotal/auth` present);
@@ -119,6 +270,29 @@ export declare class Manager {
119
270
  private leaseTimer?;
120
271
  /** The class-2 renewal owner's half-TTL schedule (D5 slice 5); armed only on auth meshes. */
121
272
  private credRenewTimer?;
273
+ private maintenanceState;
274
+ private lifecycleInFlight;
275
+ private lifecycleDrainWaiters;
276
+ private preservationTask?;
277
+ private preparationTask?;
278
+ private preservationGeneration;
279
+ private preservationAttemptId?;
280
+ private preservationStarted;
281
+ private preservationFailures;
282
+ private unverifiedStops;
283
+ private preservationInventory?;
284
+ private resumeAttemptId?;
285
+ private resumeInventoryDigest?;
286
+ private resumeInventory?;
287
+ private resumeTask?;
288
+ private resumeResult?;
289
+ private resumeRequired;
290
+ private resumeAwaitingCommit;
291
+ private resumeCommitted;
292
+ private resumeCommitTask?;
293
+ private resumeFinalized;
294
+ private resumeDurableCommitToken?;
295
+ private readonly resumedAgentNames;
122
296
  constructor(opts: ManagerOptions);
123
297
  get runtimeKind(): string;
124
298
  /** The console page URL (manager-hosted, loopback). */
@@ -131,6 +305,35 @@ export declare class Manager {
131
305
  * (no responder) is recorded honestly: the daemon's 75% source re-read remains the adoption backstop.
132
306
  * Never throws — renewal failure must be LOUD (log + record), not fatal to the supervisor. */
133
307
  private renewDaemonCreds;
308
+ /** Admit one lifecycle/control operation while active. The synchronous increment is the fence:
309
+ * preserveState flips state before its first await, so work is either counted or rejected. */
310
+ private beginLifecycle;
311
+ private releaseLifecycle;
312
+ /** A cleanup spawned by accepted active-mode work is part of that work for maintenance draining,
313
+ * even where the ordinary control reply remains fire-and-forget. */
314
+ private trackDeprovision;
315
+ private awaitLifecycleDrain;
316
+ private maintenanceError;
317
+ /** Fence and build the inventory without stopping a child. The coordinator must durably persist
318
+ * this exact plan before calling commitPreservation with the same attempt id. */
319
+ preparePreservation(attemptId: string): Promise<ManagerPreservationPlan>;
320
+ private assertPreservationGeneration;
321
+ private runPreparation;
322
+ /** Stop children only after the coordinator has persisted the prepared inventory. Same-attempt
323
+ * retries are idempotent; a different attempt is refused. */
324
+ commitPreservation(attemptId: string): Promise<ManagerPreserveResult>;
325
+ /** Recover an abandoned prepare before any child stop. Once commit begins, preservation is
326
+ * irreversible and remains fenced until the coordinator records failure/recourse. */
327
+ abortPreservation(attemptId: string): void;
328
+ /** In-process convenience that preserves the crash barrier by awaiting durable persistence between
329
+ * prepare and commit. Wire callers use the explicit two-phase admin operations. */
330
+ preserveState(opts: ManagerPreserveOptions): Promise<ManagerPreserveResult>;
331
+ private runPreservation;
332
+ private awaitHandleExit;
333
+ private inventoryReferenceError;
334
+ private fileDigest;
335
+ private fileDigestOrEmpty;
336
+ private resumeEntry;
134
337
  /** Tear down every managed agent's footprint — the shared teardown for EVERY manager-exit path (#159
135
338
  * B2): graceful {@link stop} AND the fail-closed lease-loss exit ({@link renewLease}). A manager exit is
136
339
  * a mass agent-exit, and without this its agents' footprints (creds files + `dm_`/`dlv_` durables + ACL
@@ -141,6 +344,7 @@ export declare class Manager {
141
344
  * touches NEITHER the lease NOR the endpoints — the caller owns those (and lease loss must NOT release
142
345
  * the key, which may now belong to a replacement holder). */
143
346
  private teardownManagedAgents;
347
+ private stopRetainedAgentsOnExit;
144
348
  stop(): Promise<void>;
145
349
  /** Refresh the singleton lease before the bucket TTL expires it. On loss (missed the TTL, or another
146
350
  * manager took over after a gap) FAIL CLOSED: stop serving control at once so we can't double-process
@@ -148,6 +352,8 @@ export declare class Manager {
148
352
  * while we'd still be serving) and do NOT release the key — it now belongs to that replacement. */
149
353
  private renewLease;
150
354
  private handle;
355
+ private commitResumeActivation;
356
+ private handleActive;
151
357
  /** Collapsed despawn/attach authorization (P4b). The caller already reached the privileged or
152
358
  * admin tier (cred-gated). On the admin tier any named target is allowed (operator). On the
153
359
  * privileged tier a named target is allowed if it's the caller's OWN child (`spawner ==
@@ -162,6 +368,7 @@ export declare class Manager {
162
368
  * key), so the wire form derives under DEV_OWNER. Every comparison against an AUTHENTICATED wire
163
369
  * id (presence card.id, control from.id) must go through this, never raw `a.id`. */
164
370
  private managedPrincipal;
371
+ private resumeLivenessErrors;
165
372
  /** Self-despawn (P2b): stop the managed agent whose id == the authenticated caller. The
166
373
  * no-name self-op can only ever resolve to the caller's OWN managed entry (ids are unique
167
374
  * per spawn + non-forgeable in auth mode), never a peer — so it's structurally incapable of
@@ -181,6 +388,16 @@ export declare class Manager {
181
388
  * footprint, nor (in `reapChildrenOf`) abort the reap of later siblings. The failure is logged loudly,
182
389
  * never swallowed silently. Being the single stop chokepoint, guarding here covers all callers at once. */
183
390
  private stopHandle;
391
+ /** Keep an accepted stop inside the lifecycle drain until the runtime proves the child is gone,
392
+ * so a maintenance prepare can never fence ahead of a child that is still dying.
393
+ *
394
+ * An operator-accepted stop frees its slot at once: `stop` replying ✓ means `ps` no longer lists
395
+ * the agent. That cannot omit a still-live child from a cut, because runPreparation drains the
396
+ * lifecycle BEFORE it reads the roster — the exit proof below is what closes the race, not the
397
+ * slot lingering. A recursive reap (`requireAuthoritativeExit`) instead keeps the slot until the
398
+ * wait proves exit: nobody asked for those children to be gone, so they stay managed until the
399
+ * runtime says otherwise, and a runtime that cannot prove exit records an unverified stop. */
400
+ private trackStoppedHandle;
184
401
  /** USER-MODE spawn provisioning (the gate-1 counterpart to the static mint block): resolve the
185
402
  * OWNER (ctl caller's principal, or the manifest's stamped owner — never a payload field),
186
403
  * pre-create the principal-keyed durables + ACL row on the ephemeral provisioner, author the
@@ -209,9 +426,29 @@ export declare class Manager {
209
426
  * is the separate per-user-auth work, not this. Tearing down the durables + ACL row still shrinks the
210
427
  * delivery surface a stale copy could use. */
211
428
  private deprovision;
212
- /** Reap a parent's children on its exit (P4b): stop + free every agent whose `spawner` is the
213
- * exited agent's id, so orphans don't ratchet the ceiling shut. Recursive — a reaped child's
214
- * own children are reaped too. Exit-driven, so each freed slot is rate-floored like a despawn. */
429
+ /** The actual footprint teardown (wrapped by {@link deprovision}'s single-flight). */
430
+ private driveDeprovision;
431
+ /** Request the auth-side retirement of a departed agent's lifecycle (#29 piece 3): an ephemeral
432
+ * `retirement-requester` credential (request + reply only), the generic `retireLifecycle` op,
433
+ * a STABLE opId (derived from the lifecycleUid, so every retry re-drives the SAME operation),
434
+ * and the four-outcome handling in operator vocabulary. */
435
+ private requestRetirement;
436
+ /** The rail round-trip for one retirement (wrapped by {@link requestRetirement}'s single-flight). */
437
+ private driveRetirement;
438
+ /** The teardown's ASYNC BROKER PHASE: mint the ephemeral target-pinned deprovisioner cred and
439
+ * delete the agent's broker footprint (dm_/dlv_ durables + read-ACL row). Split from
440
+ * {@link deprovision} because it runs LAST in the ordered teardown chain — after the creds/secret
441
+ * shred and the awaited ledger revoke, which precede it in that same single-flighted chain (the
442
+ * revoke is awaited and can be deliberately slow, so it is not merely a synchronous prefix). The name
443
+ * is NOT freed while any teardown phase is still in flight — the hold clears only after the
444
+ * standing-authority revoke AND the lifecycle retirement both confirm (see {@link driveRetirement}) —
445
+ * but the deletes here are still lifecycle-uid-pinned so even a replayed/stale teardown can never
446
+ * reach a same-name successor's footprint (its names embed a different uid). */
447
+ private deprovisionBroker;
448
+ /** Reap a parent's children on its exit (P4b). Every descendant remains managed until the runtime's
449
+ * authoritative wait proves exit; the wait participates in the lifecycle drain, so preservation can
450
+ * never omit a child that may still be alive. Recursive descendants are scheduled before their parent
451
+ * slot can disappear. */
215
452
  private reapChildrenOf;
216
453
  /** A managed agent's process exited on its own (crash, /exit, finished). Free its slot
217
454
  * (rate-floored — exit-driven churn counts) and reap any children it spawned. Idempotent via
@@ -275,6 +512,23 @@ export declare class Manager {
275
512
  * defaulting to the manager's own id for roster/pre-spawn — recorded for the spawner
276
513
  * ledger (own-children despawn + reap-on-parent-exit). */
277
514
  startAgent(opts: StartAgentOpts, spawner?: string): Promise<ControlReply>;
515
+ private startAgentActive;
516
+ /** Preflight the whole inventory before launching its first process, then adopt each exact retained
517
+ * principal without provisioning. A later runtime launch failure is reported per-agent, but malformed
518
+ * or missing inventory material can never produce a partially resumed set. */
519
+ resumePreserved(inventory: ManagerResumeInventory): Promise<ManagerResumeResult>;
520
+ /** Re-read every retained identity input and its current authority without provisioning. This runs
521
+ * during whole-inventory preflight, immediately before each individual spawn, and at commit. */
522
+ private validateRetainedAuthority;
523
+ /** Validate/relaunch one retained inventory entry. Called only through resumePreserved so all
524
+ * records pass the same preflight before the first child is exposed. */
525
+ private resumePreservedAgent;
526
+ private launchPreparedResume;
527
+ private probeStaticCredential;
528
+ /** An uncertain resume remains non-destructive until exact-principal AND exact-incarnation presence
529
+ * arrives later. Same predicate as the readiness fence: a principal-only match would let a
530
+ * wrong/absent-uid presence under the reused alias clear cleanup suppression on another incarnation. */
531
+ private watchResumeAdoption;
278
532
  /** #159 B1: wait for a detached launch to reach a REAL outcome before replying — never a liveness-
279
533
  * inferring timer. Races three:
280
534
  * • the assigned id joins presence (live) → **started** — the honest signal (the manager owns mesh